single-file-core 1.2.21 → 1.2.23

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.
@@ -240,8 +240,7 @@ class ProcessorHelperCommon {
240
240
  resourceElement.parentElement.insertBefore(symbolElement, resourceElement.parentElement.firstChild);
241
241
  }
242
242
  } else {
243
- const content = await batchRequest.addURL(resourceURL, { expectedType: "image" });
244
- resourceElement.setAttribute(attributeName, PREFIX_DATA_URI_IMAGE_SVG + "," + content);
243
+ resourceElement.setAttribute(attributeName, PREFIX_DATA_URI_IMAGE_SVG + "," + response.content);
245
244
  }
246
245
  }
247
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -38,6 +38,7 @@ import {
38
38
  } from "./compression-display.js";
39
39
 
40
40
  const { Blob, fetch, TextEncoder, DOMParser } = globalThis;
41
+
41
42
  const NO_COMPRESSION_EXTENSIONS = [".jpg", ".jpeg", ".png", ".pdf", ".woff2", ".mp4", ".mp3", ".ogg", ".webp", ".webm", ".avi", ".mpeg", ".ts", ".ogv"];
42
43
  const SCRIPT_PATH = "/lib/single-file-zip.min.js";
43
44
  const EXTRA_DATA_TAGS = [
@@ -117,11 +118,12 @@ async function process(pageData, options, lastModDate = new Date()) {
117
118
  script = "<script>" +
118
119
  script +
119
120
  "document.currentScript.remove();" +
120
- "globalThis.bootstrap=(()=>{let bootstrapStarted;return content=>{if (bootstrapStarted) return bootstrapStarted;bootstrapStarted=" +
121
- "new Promise(resolve=>{document.readyState=='complete'?resolve():globalThis.onload=resolve}).then(()=>" +
122
- extract.toString().replace(/\n|\t/g, "") + "(content,{prompt}).then(({docContent}) => " +
123
- display.toString().replace(/\n|\t/g, "") + "(document,docContent)));return bootstrapStarted;}})();(" +
124
- getContent.toString().replace(/\n|\t/g, "") + ")().then(globalThis.bootstrap).catch(()=>{});" +
121
+ "globalThis.addEventListener('load', () => {" +
122
+ "globalThis.bootstrap=(()=>{let bootstrapStarted;return async content=>{if (bootstrapStarted) return bootstrapStarted; bootstrapStarted = (" +
123
+ extract.toString().replace(/\n|\t/g, "") + ")(content,{prompt}).then(({docContent}) => " +
124
+ display.toString().replace(/\n|\t/g, "") + "(document,docContent));return bootstrapStarted;}})();(" +
125
+ getContent.toString().replace(/\n|\t/g, "") + ")().then(globalThis.bootstrap).then(() => document.dispatchEvent(new CustomEvent(\"single-file-display-infobar\"))).catch(()=>{});" +
126
+ "});" +
125
127
  "</script>";
126
128
  pageContent += script;
127
129
  let extraData = "";