single-file-core 1.3.18 → 1.3.20
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
|
@@ -27,7 +27,7 @@ export {
|
|
|
27
27
|
display
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
async function display(document, docContent, { disableFramePointerEvents }
|
|
30
|
+
async function display(document, docContent, { disableFramePointerEvents }) {
|
|
31
31
|
docContent = docContent.replace(/<noscript/gi, "<template disabled-noscript");
|
|
32
32
|
docContent = docContent.replaceAll(/<\/noscript/gi, "</template");
|
|
33
33
|
const doc = (new DOMParser()).parseFromString(docContent, "text/html");
|
|
@@ -251,13 +251,16 @@ async function prependHTMLData(pageData, zipDataWriter, script, options) {
|
|
|
251
251
|
textBody = textBody.replace(/</g, "<").replace(/>/g, ">").replace(/\n +/g, "\n").replace(/\n\n\n+/g, "\n\n").trim();
|
|
252
252
|
pageContent += "\n<main hidden>\n" + textBody + "\n</main>\n";
|
|
253
253
|
}
|
|
254
|
+
const displayOptions = {
|
|
255
|
+
insertEmbeddedImage: Boolean(options.embeddedImage),
|
|
256
|
+
};
|
|
254
257
|
script = "<script>" +
|
|
255
258
|
script +
|
|
256
259
|
"document.currentScript.remove();" +
|
|
257
260
|
"globalThis.addEventListener('load', () => {" +
|
|
258
261
|
"globalThis.bootstrap=(()=>{let bootstrapStarted;return async content=>{if (bootstrapStarted) return bootstrapStarted; bootstrapStarted = (" +
|
|
259
262
|
extract.toString().replace(/\n|\t/g, "") + ")(content,{prompt}).then(({docContent}) => " +
|
|
260
|
-
display.toString().replace(/\n|\t/g, "") + "(document,docContent));return bootstrapStarted;}})();(" +
|
|
263
|
+
display.toString().replace(/\n|\t/g, "") + "(document,docContent," + JSON.stringify(displayOptions) + "));return bootstrapStarted;}})();(" +
|
|
261
264
|
getContent.toString().replace(/\n|\t/g, "") + ")().then(globalThis.bootstrap).then(() => document.dispatchEvent(new CustomEvent(\"single-file-display-infobar\"))).catch(()=>{});" +
|
|
262
265
|
"});" +
|
|
263
266
|
"</script>";
|