Skip to content

Commit 82694cc

Browse files
committed
unify interface and functionality between chrome and firefox hosts
1 parent 8d021e8 commit 82694cc

36 files changed

+1427
-857
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: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
Chrome extension to compare objects in memory with console.diff(old, new) devtools function.
66

77
<details>
8-
<summary> <strong>Screenshots</strong> </summary>
8+
<summary> <strong>Examples</strong> </summary>
99

1010
- Comparing two objects
1111
![screenshot](./doc/screenshot-01.png)
1212

1313
- Tracking changes in localStorage (unchanged are hidden)
1414
![screenshot](./doc/screenshot-02.png)
1515

16+
</details>
17+
<details>
18+
<summary> <strong>How it works (in chrome mv3)</strong> </summary>
19+
20+
![screenshot](./doc/design.png)
21+
1622
</details>
1723

1824
### Based on
@@ -35,7 +41,7 @@ Chrome extension to compare objects in memory with console.diff(old, new) devtoo
3541

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

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

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

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

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

78+
- In Firefox the API is under `jsdiff` object for now, cause extension API's not fully compatible.
79+
7280
### API
7381

7482
- **console.diff(left, right)** - compare left and right arguments
@@ -113,25 +121,21 @@ Historically, left side represents the old state and right side the new state.
113121

114122
- 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.
115123

116-
### How it works
117-
118-
![screenshot](./doc/design.png)
119-
120124
### How to build
121125

122126
- requires npm/nodejs
123127

124128
```sh
125129
make install # to install dependencies
126-
make all # build for prod and make extension.zip
127-
make tune2chrome # or tune2firefox for relevant manifest
130+
make all # build for prod and make extension.${browser}.zip
131+
make tune2chrome # or tune2firefox for relevant manifest.json file
128132
make dev # local development
129133
```
130134

131135
### Protection
132136

133137
- 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...
138+
- Well, tests on chrome show that even `Content-Security-Policy: default-src 'none';` header won't prevent injection of extension content-scripts...
135139
- Avoid assigning to `window` or `globalThis` any application object.
136140
See also [accidental global variables and memory leaks](https://www.tutorialspoint.com/explain-in-detail-about-memory-leaks-in-javascript).
137141
- 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

-4.61 KB
Loading

package.json

Lines changed: 14 additions & 11 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
],
@@ -24,25 +25,27 @@
2425
"homepage": "https://github.com/zendive/jsdiff#readme",
2526
"type": "module",
2627
"devDependencies": {
27-
"@types/chrome": "0.0.256",
28+
"@types/chrome": "0.0.259",
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.15",
3133
"clean-webpack-plugin": "4.0.0",
32-
"css-loader": "6.9.0",
34+
"css-loader": "6.10.0",
3335
"diff-match-patch": "^1.0.5",
34-
"esbuild": "0.19.11",
35-
"esbuild-loader": "4.0.2",
36-
"jsondiffpatch": "0.6.0",
37-
"prettier": "3.1.1",
38-
"sass": "1.69.7",
39-
"sass-loader": "13.3.3",
36+
"esbuild": "0.20.0",
37+
"esbuild-loader": "4.0.3",
38+
"jsondiffpatch": "^0.6.0",
39+
"pinia": "^2.1.7",
40+
"prettier": "3.2.4",
41+
"sass": "1.70.0",
42+
"sass-loader": "14.1.0",
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.15",
4447
"vue-loader": "17.4.2",
45-
"webpack": "5.89.0",
48+
"webpack": "5.90.0",
4649
"webpack-bundle-analyzer": "4.10.1",
4750
"webpack-cli": "5.1.4"
4851
},

0 commit comments

Comments
 (0)