single-file-core 1.2.30 → 1.2.32

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
- await this.processImageSrcset(resourceURL, srcsetValue, resources, batchRequest);
227
+ return this.processImageSrcset(resourceURL, srcsetValue, resources, batchRequest);
228
228
  } else {
229
229
  return "";
230
230
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.2.30",
3
+ "version": "1.2.32",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -84,6 +84,12 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
84
84
  await Promise.all(entries.map(async entry => {
85
85
  const { filename } = entry;
86
86
  let dataWriter, content, textContent, mimeType;
87
+ const resourceInfo = {};
88
+ if (filename.match(REGEXP_MATCH_INDEX)) {
89
+ indexPages.push(resourceInfo);
90
+ } else {
91
+ resources.push(resourceInfo);
92
+ }
87
93
  if (!options.password && entry.encrypted) {
88
94
  options.password = prompt("Please enter the password to view the page");
89
95
  }
@@ -119,18 +125,18 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
119
125
  }
120
126
  }
121
127
  const name = entry.filename.match(/^([0-9_]+\/)?(.*)$/)[2];
122
- const resourceInfo = { filename: entry.filename, name, url: entry.comment, content, mimeType, textContent, parentResources: [] };
123
- if (filename.match(REGEXP_MATCH_INDEX)) {
124
- indexPages.push(resourceInfo);
125
- } else {
126
- resources.push(resourceInfo);
127
- }
128
+ Object.assign(resourceInfo, {
129
+ filename: entry.filename,
130
+ name,
131
+ url: entry.comment,
132
+ content,
133
+ mimeType,
134
+ textContent,
135
+ parentResources: []
136
+ });
128
137
  }));
129
138
  await zipReader.close();
130
- resources.reverse();
131
- resources.sort(sortByFilenameLength);
132
139
  indexPages.sort(sortByFilenameLength);
133
- resources.sort((resourceLeft, resourceRight) => resourceRight.textContent ? -1 : resourceLeft.textContent ? 1 : 0);
134
140
  resources = resources.concat(...indexPages);
135
141
  for (const resource of resources) {
136
142
  let { textContent, mimeType, filename } = resource;