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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.107",
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": "echo \"Error: no test specified\" && exit 1",
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
- const options = { password };
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
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("") +