single-file-core 1.3.9 → 1.3.10
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/helper.js
CHANGED
|
@@ -498,16 +498,18 @@ function getStylesheetsData(doc) {
|
|
|
498
498
|
const contents = [];
|
|
499
499
|
doc.querySelectorAll("style").forEach((styleElement, styleIndex) => {
|
|
500
500
|
try {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
501
|
+
if (!styleElement.sheet.disabled) {
|
|
502
|
+
const tempStyleElement = doc.createElement("style");
|
|
503
|
+
tempStyleElement.textContent = styleElement.textContent;
|
|
504
|
+
doc.body.appendChild(tempStyleElement);
|
|
505
|
+
const stylesheet = tempStyleElement.sheet;
|
|
506
|
+
tempStyleElement.remove();
|
|
507
|
+
const textContentStylesheet = Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
|
|
508
|
+
const sheetStylesheet = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
|
|
509
|
+
if (!stylesheet || textContentStylesheet != sheetStylesheet) {
|
|
510
|
+
styleElement.setAttribute(STYLESHEET_ATTRIBUTE_NAME, styleIndex);
|
|
511
|
+
contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
|
|
512
|
+
}
|
|
511
513
|
}
|
|
512
514
|
} catch (error) {
|
|
513
515
|
// ignored
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
|
|
|
138
138
|
}));
|
|
139
139
|
await zipReader.close();
|
|
140
140
|
indexPages.sort(sortByFilenameLength);
|
|
141
|
-
resources = resources.concat(...indexPages);
|
|
141
|
+
resources = resources.reverse().concat(...indexPages);
|
|
142
142
|
for (const resource of resources) {
|
|
143
143
|
let { textContent, mimeType, filename } = resource;
|
|
144
144
|
if (textContent !== undefined) {
|