Skip to content

Commit 4d6ee2a

Browse files
committed
prepare for package
1 parent beb7f5c commit 4d6ee2a

18 files changed

+263
-19283
lines changed

.gitignore

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,16 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (http://nodejs.org/api/addons.html)
33-
build/Release
341

352
# Dependency directories
363
node_modules/
37-
jspm_packages/
38-
39-
# Typescript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# dotenv environment variables file
55-
.env
564

575
# ide
586
.idea
597

608
# os
619
.DS_Store
6210

63-
*.zip
64-
*.js.map
65-
6611
# typescript output
6712
.ts-built
13+
14+
# application files not for git
15+
*.js.map
16+
*.zip

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
25
"singleQuote": true
36
}

README.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
[![console.diff()](https://storage.googleapis.com/web-dev-uploads/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/tbyBjqi7Zu733AAKA5n4.png)](https://chrome.google.com/webstore/detail/jsdiff-devtool/iefeamoljhdcpigpnpggeiiabpnpgonb)
44

5-
Chrome devtools extension intended to display result of deep in-memory object
6-
comparisons with the help of dedicated console commands.
5+
Chrome extension to compare objects in memory with console.diff(old, new) devtools function.
76

87
<details>
98
<summary> <strong>Screenshots</strong> </summary>
@@ -23,20 +22,23 @@ comparisons with the help of dedicated console commands.
2322

2423
### Features
2524

26-
- compare objects between multiple [sub]domains, chrome tabs, or single page reloads
27-
- function code included in comparison result in form of a string, may help to see if it was altered
28-
- document, dom-elements and other non-serializable objects are filtered-out from the results
29-
- self recurring references displayed only once, the rest of occurrences are filtered-out
30-
- basic integration with search functionality within devtools
31-
- if search query contains upper-case letter - the search will be case-sensitive
25+
- Compare objects between multiple [sub]domains, chrome tabs, or single page reloads.
26+
- Function code included in comparison result in form of a string, combined from a function name (if declared) and a SHA-256 function body hash; so it may help to detect if it was altered. Native functions delcared as silmply as `ƒ(native)`.
27+
- Unserializable objects, like Document or Elements, are serialized as `0x####: unserializable`.
28+
- Self recurring references displayed only once, and the rest of ocurrences are mentioned with object reference like `0x####: ...`.
29+
- Basic integration with search functionality within devtools:
30+
- if search query contains upper-case letter - the search will be case-sensitive.
31+
- Serialization of Set, Map, +/-Infinity, NaN, BigInt, Symbols and proper serialization of `undefined` values.
32+
- Failsafe serialization of objects having security issues accessing their props.
33+
- Failsefe serialization of objects having `toJSON()` function (instead of serialization of all object properties, - only toJSON() return value are serialized, similar to the way JSON.strigify() works)
3234

3335
### Limitations and workarounds
3436

35-
- some instances of objects may cause exception during preparations for comparison
36-
- try to narrow compared contexts
37-
- if it's some Browser API that causes an exception and not a framework, consider opening an issue,
38-
so it will be possible to solve it on a permanent basis
39-
- while paused in debug mode, JSDiff panel won't reflect the result until runtime is resumed ([#10][i10])
37+
- Some instances of objects may cause exception during preparations for comparison
38+
- Try to narrow compared contexts
39+
- If it's some Browser API that causes an exception and not a framework, consider opening an issue, so it will be possible to solve it on a permanent basis
40+
- While paused in debug mode, JSDiff panel won't reflect the result until runtime is resumed ([#10][i10])
41+
- Compared objects, after being serialized, are stored in `chrome.storage.local` wich has 10MB limit, so if you see `QUOTA_BYTES quota exceeded` error message - this is it.
4042

4143
[i10]: https://github.com/zendive/jsdiff/issues/10
4244

@@ -72,25 +74,32 @@ console.diffLeft(Date.now());
7274
console.diffRight(Date.now());
7375
```
7476

77+
- **console.diff\_(\*)** - deprecated, left for backward compatibility, uses `nativeClone` based of JSON.parse(JSON.stringify(...)) serialization method
78+
7579
### Usage basics
7680

7781
Historically, left side represents the old state and right side the new state.
7882

7983
- Things that are present on the left side but missing on the right side are colour-coded as red (old).
8084
- Things that are missing on the left side but present on the right side are colour-coded as green (new).
81-
82-
To track changes of the same variable in timed manner you can push it with `diffPush` or `diff`
83-
with a single argument, that will shift objects from right to left, showing differences with previous push state.
85+
- 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.
8486

8587
### How it works
8688

87-
- `jsdiff-devtools.js` registers devtools panel
88-
- injects `console.diff` commands into inspected window's console interface
89-
- each function clones arguments and sends them via `postMessage` to `jsdiff-proxy.js` in `jsdiff-console-to-proxy` message
90-
- injects `jsdiff-proxy.js` that listens on window `jsdiff-console-to-proxy` message and sends it further to chrome runtime in `jsdiff-proxy-to-devtools` message
91-
- listens on `jsdiff-proxy-to-devtools` and prepares payload for `view/panel.vue` and sends it with `jsdiff-devtools-to-panel-compare` message
92-
- when user invokes devtools search command - informs `view/panel.vue` with `jsdiff-devtools-to-panel-search` message
93-
- when `view/panel.vue` is visible in devtools
94-
- reflects result of last compare request
95-
- listens on `jsdiff-devtools-to-panel-compare` requests
96-
- listens on `jsdiff-devtools-to-panel-search` and tries to find query in DOM
89+
- `manifest.json` injects content scripts to each visited site (except for chrome web store site and google-protected alike):
90+
- `jsdiff-console.ts` as [MAIN world](https://developer.chrome.com/docs/extensions/reference/scripting/#type-ExecutionWorld), - to have access to the target site memory
91+
- sends messages to `jsdiff-proxy.ts`.
92+
- `jsdiff-proxy.ts` as `ISOLATED` world (has access to chrome runtime)
93+
- stores data from `jsdiff-console.ts` in `chrome.storage.local` and sends runtime messages to `panel.vue`.
94+
- `jsdiff-devtools.ts` registers `panel.vue` as a JSDiff devtools panel that reads current state of `chorme.storage.local` and listens to incomming `chrome.runtime` mesages from `jsdiff-proxy.ts`.
95+
96+
### How to build
97+
98+
- requires nodejs
99+
- requires pnpm `npm i -g pnpm`
100+
101+
```sh
102+
pnpm i
103+
pnpm dev # local development
104+
pnpm zip # make extension.zip
105+
```

0 commit comments

Comments
 (0)