single-file-core 1.3.14 → 1.3.15
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/core/index.js
CHANGED
|
@@ -473,13 +473,20 @@ class Processor {
|
|
|
473
473
|
this.doc = util.parseDocContent(pageContent, this.baseURI);
|
|
474
474
|
if (this.options.saveRawPage) {
|
|
475
475
|
let charset;
|
|
476
|
-
this.doc.querySelectorAll("meta[charset]
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
charset = charsetDeclaration.split("=")[1].trim().toLowerCase();
|
|
476
|
+
this.doc.querySelectorAll("meta[charset]").forEach(element => {
|
|
477
|
+
if (!charset) {
|
|
478
|
+
charset = element.getAttribute("charset").trim().toLowerCase();
|
|
480
479
|
}
|
|
481
480
|
});
|
|
482
|
-
if (charset
|
|
481
|
+
if (!charset) {
|
|
482
|
+
this.doc.querySelectorAll("meta[http-equiv=\"content-type\"]").forEach(element => {
|
|
483
|
+
const charsetDeclaration = element.content.split(";")[1];
|
|
484
|
+
if (charsetDeclaration && !charset) {
|
|
485
|
+
charset = charsetDeclaration.split("=")[1].trim().toLowerCase();
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (charset && content.charset && charset != content.charset.toLowerCase()) {
|
|
483
490
|
return this.loadPage(pageContent, charset);
|
|
484
491
|
}
|
|
485
492
|
}
|
|
@@ -857,7 +864,7 @@ class Processor {
|
|
|
857
864
|
this.stats.set("discarded", "objects", objectElements.length);
|
|
858
865
|
this.stats.set("processed", "objects", objectElements.length);
|
|
859
866
|
objectElements.forEach(element => element.remove());
|
|
860
|
-
const replacedAttributeValue = this.doc.querySelectorAll("link[rel~=preconnect], link[rel~=prerender], link[rel~=dns-prefetch], link[rel~=preload], link[rel~=manifest], link[rel~=prefetch]");
|
|
867
|
+
const replacedAttributeValue = this.doc.querySelectorAll("link[rel~=preconnect], link[rel~=prerender], link[rel~=dns-prefetch], link[rel~=preload], link[rel~=manifest], link[rel~=prefetch], link[rel~=modulepreload]");
|
|
861
868
|
replacedAttributeValue.forEach(element => {
|
|
862
869
|
const relValue = element
|
|
863
870
|
.getAttribute("rel")
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { parse } from "./template-parser.js";
|
|
27
27
|
import { getContentSize, digest } from "./../core/helper.js";
|
|
28
28
|
|
|
29
|
-
const Blob = globalThis.Blob;
|
|
29
|
+
const Blob = globalThis.Blob;
|
|
30
30
|
const FileReader = globalThis.FileReader;
|
|
31
31
|
const URL = globalThis.URL;
|
|
32
32
|
const URLSearchParams = globalThis.URLSearchParams;
|
|
@@ -16991,6 +16991,10 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
|
|
|
16991
16991
|
"length": value => value.length,
|
|
16992
16992
|
"url-search-name": (index = 0) => params[index] && params[index][0],
|
|
16993
16993
|
"url-search-value": (index = 0) => params[index] && params[index][1],
|
|
16994
|
+
"url-search-named-value": name => {
|
|
16995
|
+
const param = params.find(param => param[0] == name);
|
|
16996
|
+
return (param && param[1]);
|
|
16997
|
+
},
|
|
16994
16998
|
"url-search": name => {
|
|
16995
16999
|
const param = params.find(param => param[0] == name);
|
|
16996
17000
|
return (param && param[1]);
|
|
@@ -17030,6 +17034,9 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
|
|
|
17030
17034
|
const fn = functions[name];
|
|
17031
17035
|
if (fn) {
|
|
17032
17036
|
argument = argument.replace(/\\\\(.)/g, "$1");
|
|
17037
|
+
if (!optionalArguments) {
|
|
17038
|
+
optionalArguments = [];
|
|
17039
|
+
}
|
|
17033
17040
|
optionalArguments = optionalArguments
|
|
17034
17041
|
.map(argument => argument.replace(/\\\\(.)/g, "$1"))
|
|
17035
17042
|
.filter(argument => argument != undefined && argument != null && argument != "");
|
package/package.json
CHANGED
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
const time = 0;
|
|
192
192
|
return { target, intersectionRatio, boundingClientRect, intersectionRect: boundingClientRect, isIntersecting, rootBounds, time };
|
|
193
193
|
});
|
|
194
|
-
observer.callback(params, intersectionObserver);
|
|
194
|
+
observer.callback.call(intersectionObserver, params, intersectionObserver);
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
}
|