Skip to content

Commit 62b5e3c

Browse files
committed
enya: the humming
unify interface and functionality between chrome and firefox hosts
1 parent 8d021e8 commit 62b5e3c

35 files changed

+1040
-718
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ node_modules/
1111
# application autogenerated files not for git
1212
*.js.map
1313
*.zip
14+
*.crx
1415
manifest.json
1516
bundle/js

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"fileMatch": ["manifest.json"],
77
"url": "https://json.schemastore.org/chrome-manifest.json"
88
}
9-
]
9+
],
10+
"typescript.tsdk": "node_modules/typescript/lib"
1011
}

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Chrome extension to compare objects in memory with console.diff(old, new) devtoo
3535

3636
- JSDiff devtools panel reflects current state of comparison, regardless the tab[s] it was opened from.
3737

38-
- Basic integration with search functionality within devtools:
38+
- Internal search inside comparison results
3939

4040
- If search query contains at least one upper-case letter - the search will be case-sensitive.
4141

@@ -69,6 +69,8 @@ Chrome extension to compare objects in memory with console.diff(old, new) devtoo
6969

7070
- Compared objects, after being serialized, stored in `chrome.storage.local` wich has 10MB limit (before chrome v114 was 5MB).
7171

72+
- In Firefox the API is under `jsdiff` object for now, cause extension API's not fully compatible.
73+
7274
### API
7375

7476
- **console.diff(left, right)** - compare left and right arguments
@@ -113,7 +115,7 @@ Historically, left side represents the old state and right side the new state.
113115

114116
- To track changes of the same variable in timed manner you can push it with `diffPush` or `diff` with a single argument, - that will shift objects from right to left, showing differences with previous push state.
115117

116-
### How it works
118+
### How it works (in chrome mv3)
117119

118120
![screenshot](./doc/design.png)
119121

@@ -123,15 +125,15 @@ Historically, left side represents the old state and right side the new state.
123125

124126
```sh
125127
make install # to install dependencies
126-
make all # build for prod and make extension.zip
128+
make all # build for prod and make extension.${browser}.zip
127129
make tune2chrome # or tune2firefox for relevant manifest
128130
make dev # local development
129131
```
130132

131133
### Protection
132134

133135
- How to protect your site from this extension:
134-
- Well, tests show that even `Content-Security-Policy: default-src 'none';` header won't prevent injection of extension content-scripts...
136+
- Well, tests on chrome show that even `Content-Security-Policy: default-src 'none';` header won't prevent injection of extension content-scripts...
135137
- Avoid assigning to `window` or `globalThis` any application object.
136138
See also [accidental global variables and memory leaks](https://www.tutorialspoint.com/explain-in-detail-about-memory-leaks-in-javascript).
137139
- In general, you can incapacitate console functions:

doc/design.plantuml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Panel ->o]: Display result
5353
deactivate Panel
5454

5555
=== Search in DevTools Panel ==
56-
[-> User: ctrl+F\ncmd+F
57-
User -> Panel: jsdiff-devtools-to-panel-search
56+
User -> Panel: ^+F\n⌘+F
57+
5858
activate Panel
5959
Panel -> Panel: search in DOM
6060
Panel ->o]: Display result

doc/design.png

-24.8 KB
Loading

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"keywords": [
1515
"devtools",
16+
"diff",
1617
"chrome",
1718
"extension"
1819
],
@@ -25,22 +26,24 @@
2526
"type": "module",
2627
"devDependencies": {
2728
"@types/chrome": "0.0.256",
29+
"@types/diff-match-patch": "^1.0.36",
2830
"@types/firefox-webext-browser": "120.0.0",
2931
"@types/webpack-bundle-analyzer": "4.6.3",
30-
"@vue/compiler-sfc": "3.4.9",
32+
"@vue/compiler-sfc": "3.4.13",
3133
"clean-webpack-plugin": "4.0.0",
3234
"css-loader": "6.9.0",
3335
"diff-match-patch": "^1.0.5",
3436
"esbuild": "0.19.11",
3537
"esbuild-loader": "4.0.2",
3638
"jsondiffpatch": "0.6.0",
37-
"prettier": "3.1.1",
39+
"pinia": "^2.1.7",
40+
"prettier": "3.2.2",
3841
"sass": "1.69.7",
3942
"sass-loader": "13.3.3",
4043
"style-loader": "3.3.4",
4144
"ts-node": "10.9.2",
4245
"typescript": "5.3.3",
43-
"vue": "3.4.9",
46+
"vue": "3.4.13",
4447
"vue-loader": "17.4.2",
4548
"webpack": "5.89.0",
4649
"webpack-bundle-analyzer": "4.10.1",

pnpm-lock.yaml

Lines changed: 98 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/@types/index.d.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,10 @@ declare global {
2929
on: boolean;
3030
}
3131

32-
interface ISearchMessage {
33-
source: 'jsdiff-devtools-to-panel-search';
34-
params: ISearchOptions;
35-
}
36-
37-
type TSearchCommands = 'performSearch' | 'nextSearchResult' | 'cancelSearch';
38-
39-
interface ISearchOptions {
40-
cmd: TSearchCommands;
41-
query: string | null;
42-
}
43-
4432
type TRuntimeMessageOptions =
4533
| ICompareMessage
4634
| IProgressMessage
47-
| IErrorMessage
48-
| ISearchMessage;
35+
| IErrorMessage;
4936

5037
interface Window {
5138
wrappedJSObject: { jsdiff: () => void };

0 commit comments

Comments
 (0)