single-file-core 1.5.107 → 1.5.109
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/test.yml +31 -0
- package/doc/assets/singlefile-archive-byte-map.svg +298 -0
- package/doc/assets/singlefile-archive-lenses.svg +245 -0
- package/doc/singlefile-archive.md +1455 -0
- package/package.json +2 -2
- package/processors/compression/compression-extract.js +4 -3
- package/processors/compression/compression-packager.js +4 -1
- package/processors/compression/compression.js +239 -131
- package/single-file.js +1 -0
- package/test/sfz-harness/README.md +58 -0
- package/test/sfz-harness/check-determinism.js +57 -0
- package/test/sfz-harness/common.js +154 -0
- package/test/sfz-harness/dom-stub.js +13 -0
- package/test/sfz-harness/format-rules.js +289 -0
- package/test/sfz-harness/gen-e2e-page.js +14 -0
- package/test/sfz-harness/search-triggers.js +35 -0
- package/test/sfz-harness/smoke.js +10 -0
- package/test/sfz-harness/stored-trigger.js +50 -0
- package/test/sfz-harness/trigger-seeds.json +120 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "single-file-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.109",
|
|
4
4
|
"description": "SingleFile Core",
|
|
5
5
|
"author": "Gildas Lormeau",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "deno run --allow-read test/sfz-harness/format-rules.js && deno run --allow-read test/sfz-harness/stored-trigger.js && deno run --allow-read test/sfz-harness/check-determinism.js",
|
|
9
9
|
"bump-patch": "npm version patch --no-git-tag-version && npm run bump-commit",
|
|
10
10
|
"bump-minor": "npm version minor --no-git-tag-version && npm run bump-commit",
|
|
11
11
|
"bump-major": "npm version major --no-git-tag-version && npm run bump-commit",
|
|
@@ -75,7 +75,6 @@ async function extract(content, { password, prompt = () => { }, zipOptions = { u
|
|
|
75
75
|
const CHARSET_UTF8 = ";charset=utf-8";
|
|
76
76
|
const REGEXP_ESCAPE = /([{}()^$&.*?/+|[\\\\]|\]|-)/g;
|
|
77
77
|
let zipReader;
|
|
78
|
-
zip.configure(zipOptions);
|
|
79
78
|
if (!entries) {
|
|
80
79
|
let reader;
|
|
81
80
|
if (content.readUint8Array) {
|
|
@@ -86,7 +85,7 @@ async function extract(content, { password, prompt = () => { }, zipOptions = { u
|
|
|
86
85
|
}
|
|
87
86
|
reader = new zip.BlobReader(content);
|
|
88
87
|
}
|
|
89
|
-
zipReader = new zip.ZipReader(reader);
|
|
88
|
+
zipReader = new zip.ZipReader(reader, zipOptions);
|
|
90
89
|
entries = await zipReader.getEntries();
|
|
91
90
|
}
|
|
92
91
|
// page.pdf data lies in the HTML head, outside the zip region recovered in
|
|
@@ -111,7 +110,9 @@ async function extract(content, { password, prompt = () => { }, zipOptions = { u
|
|
|
111
110
|
} else if (excludedPaths) {
|
|
112
111
|
entries = entries.filter(entry => !excludedPaths.some(excludedPath => entry.filename.startsWith(excludedPath)));
|
|
113
112
|
}
|
|
114
|
-
|
|
113
|
+
// the options are applied per reader and per entry: a global zip.configure() would leak
|
|
114
|
+
// them to every other caller in the page, and the default would re-enable web workers
|
|
115
|
+
const options = Object.assign({ password }, zipOptions);
|
|
115
116
|
let docContent, origDocContent, url, resources = [], indexPages = [], textResources = [];
|
|
116
117
|
await Promise.all(entries.map(async entry => {
|
|
117
118
|
const filename = entry.filename.substring(pagePath.length);
|
|
@@ -75,7 +75,7 @@ async function createPagesArchive(pages, options) {
|
|
|
75
75
|
content: "",
|
|
76
76
|
title: pages[0].title || "",
|
|
77
77
|
comment: options.insertSingleFileComment ? getComment(pages[0].url, options) : undefined,
|
|
78
|
-
tocContent: getTOCContent(pages)
|
|
78
|
+
tocContent: options.pageList ? getTOCContent(pages) : undefined
|
|
79
79
|
};
|
|
80
80
|
const archiveOptions = {
|
|
81
81
|
url: pages[0].url,
|
|
@@ -219,6 +219,9 @@ function escapeUnicodeHTML(value) {
|
|
|
219
219
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
// the list of pages in the prelude is the only description of the archive readable without
|
|
223
|
+
// decompressing an entry, for indexing tools that never extract it; the table of contents
|
|
224
|
+
// page stored in the archive is what serves navigation
|
|
222
225
|
function getTOCContent(pages) {
|
|
223
226
|
return "<nav><ul>" +
|
|
224
227
|
pages.map(page => "<li><a href=\"" + escapeHTML(page.url) + "\">" + escapeHTML(page.title || page.url) + "</a></li>").join("") +
|