single-file-core 1.5.89 → 1.5.90
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/publish.yml +88 -0
- package/.github/workflows/vendor.yml +21 -0
- package/package.json +7 -3
- package/zip-build/README.md +56 -0
- package/zip-build/lib/fflate-streams.js +47 -0
- package/zip-build/lib/fflate.js +2692 -0
- package/zip-build/lib/zip-vendor-worker.js +3 -0
- package/zip-build/lib/zip-vendor.js +3 -0
- package/zip-build/lib/zip.js +25 -0
- package/zip-build/package-lock.json +665 -0
- package/zip-build/package.json +15 -0
- package/zip-build/reserved-property-names.json +10597 -0
- package/zip-build/rollup.config.js +54 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# .github/workflows/publish.yml
|
|
2
|
+
|
|
3
|
+
name: Publish
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
id-token: write
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
# nothing else guarantees that the released commit was verified: the vendor workflow runs on push,
|
|
15
|
+
# so this waits for its run on that exact commit and refuses to publish unless it succeeded
|
|
16
|
+
check_vendor:
|
|
17
|
+
name: 'Check vendor rebuild'
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
actions: read
|
|
22
|
+
steps:
|
|
23
|
+
# only used to resolve the tag to a commit, so it runs no code from the repository and keeps no
|
|
24
|
+
# git credentials behind
|
|
25
|
+
- uses: actions/checkout@v5
|
|
26
|
+
with:
|
|
27
|
+
ref: ${{ github.event.release.tag_name }}
|
|
28
|
+
persist-credentials: false
|
|
29
|
+
# the tag is typed in the release UI, so nothing ties it to the version that is about to be
|
|
30
|
+
# published: a mistyped tag, or a bump that was never pushed, publishes a version nobody asked for
|
|
31
|
+
- name: Verify the tag matches the declared version
|
|
32
|
+
env:
|
|
33
|
+
TAG_NAME: ${{ github.event.release.tag_name }}
|
|
34
|
+
run: |
|
|
35
|
+
version=$(jq -r .version package.json)
|
|
36
|
+
if [ "$TAG_NAME" != "v$version" ]; then
|
|
37
|
+
echo "::error::release $TAG_NAME but package.json declares $version"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
- name: Wait for the vendor rebuild check of the released commit
|
|
41
|
+
env:
|
|
42
|
+
GH_TOKEN: ${{ github.token }}
|
|
43
|
+
run: |
|
|
44
|
+
sha=$(git rev-parse HEAD)
|
|
45
|
+
echo "released commit: $sha"
|
|
46
|
+
missing=0
|
|
47
|
+
for attempt in $(seq 1 60); do
|
|
48
|
+
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/vendor.yml/runs?head_sha=$sha&per_page=1" \
|
|
49
|
+
--jq 'if (.workflow_runs | length) == 0 then "none none none"
|
|
50
|
+
else (.workflow_runs[0] | "\(.status) \(.conclusion) \(.html_url)") end')
|
|
51
|
+
run_status=$(echo "$run" | cut -d' ' -f1)
|
|
52
|
+
conclusion=$(echo "$run" | cut -d' ' -f2)
|
|
53
|
+
url=$(echo "$run" | cut -d' ' -f3)
|
|
54
|
+
if [ "$run_status" = "none" ]; then
|
|
55
|
+
missing=$((missing + 1))
|
|
56
|
+
if [ "$missing" -ge 10 ]; then
|
|
57
|
+
echo "::error::no vendor run for $sha, run the vendor workflow on this commit and publish again"
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
echo "no vendor run found yet for $sha"
|
|
61
|
+
else
|
|
62
|
+
echo "vendor run: status=$run_status conclusion=$conclusion $url"
|
|
63
|
+
if [ "$run_status" = "completed" ]; then
|
|
64
|
+
if [ "$conclusion" = "success" ]; then
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
echo "::error::the vendor rebuild concluded $conclusion for $sha, see $url"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
sleep 30
|
|
72
|
+
done
|
|
73
|
+
echo "::error::timed out waiting for the vendor rebuild of $sha"
|
|
74
|
+
exit 1
|
|
75
|
+
|
|
76
|
+
publish_npm:
|
|
77
|
+
needs: check_vendor
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/checkout@v5
|
|
81
|
+
with:
|
|
82
|
+
ref: ${{ github.event.release.tag_name }}
|
|
83
|
+
# Setup .npmrc file to publish to npm
|
|
84
|
+
- uses: actions/setup-node@v5
|
|
85
|
+
with:
|
|
86
|
+
node-version: '24'
|
|
87
|
+
registry-url: 'https://registry.npmjs.org'
|
|
88
|
+
- run: npm publish
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# .github/workflows/vendor.yml
|
|
2
|
+
|
|
3
|
+
name: Vendor
|
|
4
|
+
|
|
5
|
+
on: [push, pull_request]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
rebuild:
|
|
9
|
+
name: 'Rebuild vendor/zip'
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v5
|
|
13
|
+
- uses: actions/setup-node@v5
|
|
14
|
+
with:
|
|
15
|
+
node-version: '24'
|
|
16
|
+
- run: npm ci
|
|
17
|
+
working-directory: zip-build
|
|
18
|
+
- run: npm run build
|
|
19
|
+
working-directory: zip-build
|
|
20
|
+
# the checked-in files in vendor/zip must be exactly what the sources in zip-build produce
|
|
21
|
+
- run: git diff --exit-code vendor/zip
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "single-file-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.90",
|
|
4
4
|
"description": "SingleFile Core",
|
|
5
5
|
"author": "Gildas Lormeau",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"bump-patch": "npm version patch --no-git-tag-version && npm run bump-commit",
|
|
10
|
+
"bump-minor": "npm version minor --no-git-tag-version && npm run bump-commit",
|
|
11
|
+
"bump-major": "npm version major --no-git-tag-version && npm run bump-commit",
|
|
12
|
+
"bump-commit": "git commit -m \"bump up version\" package.json package-lock.json"
|
|
9
13
|
},
|
|
10
14
|
"repository": {
|
|
11
15
|
"type": "git",
|
|
@@ -18,4 +22,4 @@
|
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"eslint": "^9.39.1"
|
|
20
24
|
}
|
|
21
|
-
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Rebuilding `vendor/zip`
|
|
2
|
+
|
|
3
|
+
The three files in [`../vendor/zip`](../vendor/zip) are custom builds of
|
|
4
|
+
[@zip.js/zip.js](https://www.npmjs.com/package/@zip.js/zip.js) with
|
|
5
|
+
[fflate](https://www.npmjs.com/package/fflate) as `DecompressionStream`
|
|
6
|
+
fallback:
|
|
7
|
+
|
|
8
|
+
- `zip.min.js` — extraction bundle used by self-extracting pages
|
|
9
|
+
(`ZipReader`, `HttpRangeReader`, blob/text/data-URI readers and writers,
|
|
10
|
+
no web workers, fflate fallback for browsers without
|
|
11
|
+
`DecompressionStream`)
|
|
12
|
+
- `zip.js` — creation bundle used when saving pages (full zip-core plus
|
|
13
|
+
`deflateRaw`/`inflateRaw`)
|
|
14
|
+
- `z-worker.js` — web worker script for the creation bundle
|
|
15
|
+
|
|
16
|
+
This directory rebuilds them byte-for-byte from their sources. All
|
|
17
|
+
dependencies are pinned to exact versions by `package.json` and
|
|
18
|
+
`package-lock.json`, and the build embeds no timestamps, so the output is
|
|
19
|
+
reproducible on any platform with a recent Node.js version:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
cd zip-build
|
|
23
|
+
npm ci
|
|
24
|
+
npm run build
|
|
25
|
+
git diff --exit-code ../vendor/zip
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An empty diff means the checked-in files match the sources exactly. The
|
|
29
|
+
GitHub Actions workflow `.github/workflows/vendor.yml` runs the same steps
|
|
30
|
+
on every push.
|
|
31
|
+
|
|
32
|
+
## Files
|
|
33
|
+
|
|
34
|
+
- `lib/zip.js`, `lib/zip-vendor.js`, `lib/zip-vendor-worker.js` — bundle
|
|
35
|
+
entry points; they import the zip.js sources from the pinned npm package
|
|
36
|
+
- `lib/fflate.js` — vendored [fflate](https://github.com/101arrowz/fflate)
|
|
37
|
+
0.8.3 (MIT)
|
|
38
|
+
- `lib/fflate-streams.js` — `CompressionStream`/`DecompressionStream`
|
|
39
|
+
adapter over fflate
|
|
40
|
+
- `reserved-property-names.json` — property names protected from terser
|
|
41
|
+
property mangling; generated by `reserved-property-names.js` in the
|
|
42
|
+
[zip.js repository](https://github.com/gildas-lormeau/zip.js) at the
|
|
43
|
+
pinned version (the script is not part of the npm package)
|
|
44
|
+
|
|
45
|
+
## Updating zip.js
|
|
46
|
+
|
|
47
|
+
1. Bump `@zip.js/zip.js` in `package.json` and run `npm install`.
|
|
48
|
+
2. Regenerate `reserved-property-names.json` from a checkout of the zip.js
|
|
49
|
+
repository at the matching tag, with its dev dependencies installed:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
node --input-type=module -e "import { getReservedPropertyNames } from './reserved-property-names.js'; console.log(JSON.stringify([...getReservedPropertyNames()], null, '\t'))" > path/to/single-file-core/zip-build/reserved-property-names.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Run `npm run build` and commit the regenerated files in `../vendor/zip`
|
|
56
|
+
together with the changes in this directory.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* global TransformStream */
|
|
2
|
+
|
|
3
|
+
import { Deflate, Inflate } from "./fflate.js";
|
|
4
|
+
|
|
5
|
+
const FORMAT_DEFLATE_RAW = "deflate-raw";
|
|
6
|
+
|
|
7
|
+
class FflateStream extends TransformStream {
|
|
8
|
+
constructor(codec) {
|
|
9
|
+
super({
|
|
10
|
+
start(controller) {
|
|
11
|
+
codec.ondata = chunk => {
|
|
12
|
+
if (chunk.length) {
|
|
13
|
+
controller.enqueue(chunk);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
transform(chunk) {
|
|
18
|
+
codec.push(chunk);
|
|
19
|
+
},
|
|
20
|
+
flush() {
|
|
21
|
+
codec.push(new Uint8Array(0), true);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class CompressionStreamFallback extends FflateStream {
|
|
28
|
+
constructor(format, { level } = {}) {
|
|
29
|
+
checkFormat(format);
|
|
30
|
+
super(new Deflate(level === undefined ? {} : { level }));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class DecompressionStreamFallback extends FflateStream {
|
|
35
|
+
constructor(format) {
|
|
36
|
+
checkFormat(format);
|
|
37
|
+
super(new Inflate());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function checkFormat(format) {
|
|
42
|
+
if (format != FORMAT_DEFLATE_RAW) {
|
|
43
|
+
throw new TypeError("Unsupported compression format: " + format);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { CompressionStreamFallback, DecompressionStreamFallback };
|