single-file-cli 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +24 -0
- package/build-dev.sh +35 -14
- package/build.sh +1 -1
- package/deno.json +1 -1
- package/eslint.config.mjs +1 -1
- package/lib/deno-polyfill.js +6 -4
- package/lib/single-file-archive.js +4 -4
- package/lib/single-file-bundle.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -1
- package/test/e2e/automation-detection.test.js +2 -3
- package/test/e2e/backend-fetch.test.js +2 -3
- package/test/e2e/blocked-url-pattern.test.js +2 -3
- package/test/e2e/browser-profile.test.js +2 -3
- package/test/e2e/compress-content.test.js +3 -4
- package/test/e2e/crawl-save-archive.test.js +3 -4
- package/test/e2e/crawl.test.js +2 -3
- package/test/e2e/errors-file.test.js +2 -3
- package/test/e2e/fidelity.test.js +214 -0
- package/test/e2e/frame-gate.test.js +2 -3
- package/test/e2e/http-header.test.js +2 -3
- package/test/e2e/oopif.test.js +2 -3
- package/test/e2e/output-json.test.js +2 -3
- package/test/e2e/saved-page-opens.test.js +79 -0
- package/test/e2e/service-worker.test.js +2 -3
- package/test/e2e/timeouts.test.js +2 -3
- package/test/e2e/urls-file.test.js +2 -3
- package/test/fidelity/README.md +111 -0
- package/test/fidelity/browser.js +162 -0
- package/test/fidelity/make-font.js +294 -0
- package/test/fidelity/pages/duplicate-stylesheet/index.html +126 -0
- package/test/fidelity/pages/fonts/band.ttf +0 -0
- package/test/fidelity/pages/fonts/bar.ttf +0 -0
- package/test/fidelity/pages/fonts/block.ttf +0 -0
- package/test/fidelity/pages/frame-fonts/index.html +53 -0
- package/test/fidelity/pages/linked-stylesheet/index.html +30 -0
- package/test/fidelity/pages/linked-stylesheet/theme.css +38 -0
- package/test/fidelity/pages/synthetic-italic/index.html +59 -0
- package/test/fidelity/pages/unresolved-font-property/index.html +75 -0
- package/test/fidelity/pages/used-fonts/index.html +96 -0
- package/test/fidelity/server.js +70 -0
- package/test/target.js +77 -0
- package/test/unit/archive-packager.test.js +2 -1
package/.github/workflows/ci.yml
CHANGED
|
@@ -28,3 +28,27 @@ jobs:
|
|
|
28
28
|
-
|
|
29
29
|
name: Run tests
|
|
30
30
|
run: npm test
|
|
31
|
+
|
|
32
|
+
# lib/ holds generated code that is committed, so nothing at runtime notices when it falls behind
|
|
33
|
+
# the core release it was built from — a stale bundle just silently runs old code, and a dev build
|
|
34
|
+
# (build-dev.sh, unminified, built from a local core checkout) silently replaces the released one.
|
|
35
|
+
# build.sh is reproducible: it pins both the core package and esbuild, so rebuilding here and
|
|
36
|
+
# diffing catches either case before it ships.
|
|
37
|
+
build-output:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
timeout-minutes: 15
|
|
40
|
+
steps:
|
|
41
|
+
-
|
|
42
|
+
name: Checkout sources
|
|
43
|
+
uses: actions/checkout@v7
|
|
44
|
+
-
|
|
45
|
+
name: Set up Deno
|
|
46
|
+
uses: denoland/setup-deno@v2
|
|
47
|
+
with:
|
|
48
|
+
deno-version: v2.x
|
|
49
|
+
-
|
|
50
|
+
name: Rebuild the released artifacts
|
|
51
|
+
run: bash build.sh
|
|
52
|
+
-
|
|
53
|
+
name: Check lib/ matches the pinned core release
|
|
54
|
+
run: git diff --exit-code --stat -- lib/
|
package/build-dev.sh
CHANGED
|
@@ -16,7 +16,7 @@ await build({
|
|
|
16
16
|
],
|
|
17
17
|
bundle: true,
|
|
18
18
|
globalName: 'singlefile',
|
|
19
|
-
outdir: 'lib/',
|
|
19
|
+
outdir: 'lib-dev/',
|
|
20
20
|
platform: 'browser',
|
|
21
21
|
sourcemap: false,
|
|
22
22
|
minify: false,
|
|
@@ -30,7 +30,7 @@ await build({
|
|
|
30
30
|
],
|
|
31
31
|
bundle: true,
|
|
32
32
|
globalName: 'singlefileBootstrap',
|
|
33
|
-
outdir: 'lib/',
|
|
33
|
+
outdir: 'lib-dev/',
|
|
34
34
|
platform: 'browser',
|
|
35
35
|
sourcemap: false,
|
|
36
36
|
minify: false,
|
|
@@ -43,7 +43,7 @@ await build({
|
|
|
43
43
|
'../single-file-core/single-file-hooks-frames.js'
|
|
44
44
|
],
|
|
45
45
|
bundle: true,
|
|
46
|
-
outdir: 'lib/',
|
|
46
|
+
outdir: 'lib-dev/',
|
|
47
47
|
platform: 'browser',
|
|
48
48
|
sourcemap: false,
|
|
49
49
|
minify: false,
|
|
@@ -57,7 +57,7 @@ await build({
|
|
|
57
57
|
],
|
|
58
58
|
bundle: true,
|
|
59
59
|
globalName: 'zip',
|
|
60
|
-
outdir: 'lib/',
|
|
60
|
+
outdir: 'lib-dev/',
|
|
61
61
|
platform: 'browser',
|
|
62
62
|
sourcemap: false,
|
|
63
63
|
minify: false,
|
|
@@ -70,7 +70,7 @@ await build({
|
|
|
70
70
|
'../single-file-core/single-file-archive.js'
|
|
71
71
|
],
|
|
72
72
|
bundle: true,
|
|
73
|
-
outfile: 'lib/single-file-archive.js',
|
|
73
|
+
outfile: 'lib-dev/single-file-archive.js',
|
|
74
74
|
platform: 'neutral',
|
|
75
75
|
sourcemap: false,
|
|
76
76
|
minify: false,
|
|
@@ -79,23 +79,44 @@ await build({
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
const SCRIPTS = [
|
|
82
|
-
'lib/single-file.js',
|
|
83
|
-
'lib/single-file-bootstrap.js',
|
|
84
|
-
'lib/zip.min.js'
|
|
82
|
+
'lib-dev/single-file.js',
|
|
83
|
+
'lib-dev/single-file-bootstrap.js',
|
|
84
|
+
'lib-dev/zip.min.js'
|
|
85
85
|
];
|
|
86
86
|
|
|
87
87
|
let script = '';
|
|
88
88
|
const scripts = SCRIPTS.map(script => Deno.readTextFile(script));
|
|
89
89
|
const sources = await Promise.all(scripts);
|
|
90
90
|
script += 'const script = ' + JSON.stringify(sources.join(';')) + ';';
|
|
91
|
-
const hookScript = await Deno.readTextFile('lib/single-file-hooks-frames.js');
|
|
91
|
+
const hookScript = await Deno.readTextFile('lib-dev/single-file-hooks-frames.js');
|
|
92
92
|
script += 'const hookScript = ' + JSON.stringify(hookScript) + ';';
|
|
93
|
-
const zipScript = await Deno.readTextFile('lib/zip.min.js');
|
|
93
|
+
const zipScript = await Deno.readTextFile('lib-dev/zip.min.js');
|
|
94
94
|
script += 'const zipScript = ' + JSON.stringify(zipScript) + ';';
|
|
95
95
|
script += 'export { script, zipScript, hookScript };';
|
|
96
|
-
await Deno.writeTextFile('lib/single-file-bundle.js', script)
|
|
96
|
+
await Deno.writeTextFile('lib-dev/single-file-bundle.js', script)
|
|
97
97
|
await Promise.all(SCRIPTS.map(script => Deno.remove(script)));
|
|
98
|
-
await Deno.remove('lib/single-file-hooks-frames.js');
|
|
98
|
+
await Deno.remove('lib-dev/single-file-hooks-frames.js');
|
|
99
99
|
const version = JSON.parse(await Deno.readTextFile('./deno.json')).version;
|
|
100
|
-
await Deno.writeTextFile('lib/version.js', 'export const version = ' + JSON.stringify(version) + ';');
|
|
101
|
-
" | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock="$build_dir/build.lock" -
|
|
100
|
+
await Deno.writeTextFile('lib-dev/version.js', 'export const version = ' + JSON.stringify(version) + ';');
|
|
101
|
+
" | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock="$build_dir/build.lock" -
|
|
102
|
+
|
|
103
|
+
# Stage a runnable tree in .dev/, with the freshly built artifacts overlaid on the hand-written
|
|
104
|
+
# files from lib/. Generated code never lands in the tracked lib/ directory, so a dev build cannot
|
|
105
|
+
# leave an unminified bundle where the release one belongs, and using the dev build is something you
|
|
106
|
+
# opt into by invoking .dev/single-file rather than something you get by forgetting to rebuild.
|
|
107
|
+
rm -rf .dev
|
|
108
|
+
mkdir -p .dev
|
|
109
|
+
cp ./single-file ./single-file-node.js ./single-file-launcher.js ./single-file-cli-api.js ./options.js ./deno.json ./package.json .dev/
|
|
110
|
+
cp -R ./resources .dev/resources
|
|
111
|
+
cp -R ./lib .dev/lib
|
|
112
|
+
cp lib-dev/* .dev/lib/
|
|
113
|
+
|
|
114
|
+
core_revision=$(git -C ../single-file-core rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
115
|
+
if [ -n "$(git -C ../single-file-core status --porcelain 2>/dev/null | head -1)" ]; then
|
|
116
|
+
core_revision="$core_revision+uncommitted"
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
echo
|
|
120
|
+
echo "Dev build ready: single-file-core $core_revision"
|
|
121
|
+
echo " run it with: node .dev/single-file <url> <output>"
|
|
122
|
+
echo " tracked lib/ is untouched; .dev/ and lib-dev/ are git-ignored"
|
package/build.sh
CHANGED
package/deno.json
CHANGED
package/eslint.config.mjs
CHANGED
package/lib/deno-polyfill.js
CHANGED
|
@@ -128,11 +128,13 @@ const pathAPI = {
|
|
|
128
128
|
|
|
129
129
|
const isDeno = DENO_RUNTIME_DETECTED;
|
|
130
130
|
|
|
131
|
-
// the connection to the browser relies on the WebSocket of the runtime
|
|
132
|
-
//
|
|
133
|
-
// --no-experimental-websocket
|
|
131
|
+
// the connection to the browser relies on the WebSocket of the runtime. Every version the
|
|
132
|
+
// engines field supports has one, so reaching this means either an older runtime than that,
|
|
133
|
+
// or Node.js started with --no-experimental-websocket, which still removes the global on
|
|
134
|
+
// current versions. The message names neither version, so that it cannot drift away from
|
|
135
|
+
// the engines field the way it already did once
|
|
134
136
|
if (typeof globalThis.WebSocket !== "function") {
|
|
135
|
-
throw new Error("WebSocket is not available
|
|
137
|
+
throw new Error("WebSocket is not available: the runtime is older than this package supports, or it was started with --no-experimental-websocket");
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
export { DenoAPI as Deno, pathAPI as path, isDeno };
|