single-file-core 1.2.29 → 1.2.31
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.
|
@@ -224,7 +224,7 @@ class ProcessorHelperCommon {
|
|
|
224
224
|
// ignored
|
|
225
225
|
}
|
|
226
226
|
if (testValidURL(resourceURL)) {
|
|
227
|
-
|
|
227
|
+
return this.processImageSrcset(resourceURL, srcsetValue, resources, batchRequest);
|
|
228
228
|
} else {
|
|
229
229
|
return "";
|
|
230
230
|
}
|
|
@@ -91,7 +91,9 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
replaceStylesheets(doc, stylesheets, options, resources) {
|
|
94
|
-
|
|
94
|
+
const entries = Array.from(stylesheets);
|
|
95
|
+
entries.reverse();
|
|
96
|
+
for (const [key, stylesheetInfo] of entries) {
|
|
95
97
|
if (key.urlNode) {
|
|
96
98
|
const name = "stylesheet_" + resources.stylesheets.size + ".css";
|
|
97
99
|
if (!isDataURL(stylesheetInfo.url) && options.saveOriginalURLs) {
|
|
@@ -100,10 +102,7 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
100
102
|
key.urlNode.value = name;
|
|
101
103
|
}
|
|
102
104
|
resources.stylesheets.set(resources.stylesheets.size, { name, content: this.generateStylesheetContent(stylesheetInfo.stylesheet, options), url: stylesheetInfo.url });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
for (const [key, stylesheetInfo] of stylesheets) {
|
|
106
|
-
if (key.element) {
|
|
105
|
+
} else {
|
|
107
106
|
if (key.element.tagName.toUpperCase() == "LINK") {
|
|
108
107
|
const linkElement = key.element;
|
|
109
108
|
const name = "stylesheet_" + resources.stylesheets.size + ".css";
|
|
@@ -181,8 +181,16 @@ function testUsedFont(ruleData, familyName, declaredFonts, filteredUsedFonts) {
|
|
|
181
181
|
fontInfo[2] = "normal";
|
|
182
182
|
return getUsedFontWeight(fontInfo, fontStyle, declaredFontsWeights);
|
|
183
183
|
});
|
|
184
|
+
test = testFontweight(fontWeight, usedFontWeights);
|
|
185
|
+
if (!test) {
|
|
186
|
+
usedFontWeights = optionalUsedFonts.map(fontInfo => {
|
|
187
|
+
fontInfo = Array.from(fontInfo);
|
|
188
|
+
fontInfo[2] = fontStyle = "normal";
|
|
189
|
+
return getUsedFontWeight(fontInfo, fontStyle, declaredFontsWeights);
|
|
190
|
+
});
|
|
191
|
+
test = testFontweight(fontWeight, usedFontWeights);
|
|
192
|
+
}
|
|
184
193
|
}
|
|
185
|
-
test = testFontweight(fontWeight, usedFontWeights);
|
|
186
194
|
} else {
|
|
187
195
|
test = true;
|
|
188
196
|
}
|
package/package.json
CHANGED
|
@@ -127,9 +127,7 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
|
|
|
127
127
|
}
|
|
128
128
|
}));
|
|
129
129
|
await zipReader.close();
|
|
130
|
-
resources.sort(sortByFilenameLength);
|
|
131
130
|
indexPages.sort(sortByFilenameLength);
|
|
132
|
-
resources.sort((resourceLeft, resourceRight) => resourceRight.textContent ? -1 : resourceLeft.textContent ? 1 : 0);
|
|
133
131
|
resources = resources.concat(...indexPages);
|
|
134
132
|
for (const resource of resources) {
|
|
135
133
|
let { textContent, mimeType, filename } = resource;
|