single-file-core 1.2.9 → 1.2.11

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.
@@ -38,12 +38,15 @@ export {
38
38
 
39
39
  function process(stylesheets) {
40
40
  const stats = { processed: 0, discarded: 0 };
41
- stylesheets.forEach((stylesheetInfo, element) => {
41
+ stylesheets.forEach((stylesheetInfo, key) => {
42
42
  if (matchesMediaType(stylesheetInfo.mediaText || MEDIA_ALL, MEDIA_SCREEN) && stylesheetInfo.stylesheet.children) {
43
43
  const removedRules = processRules(stylesheetInfo.stylesheet.children, stats);
44
44
  removedRules.forEach(({ cssRules, cssRule }) => cssRules.remove(cssRule));
45
45
  } else {
46
- stylesheets.delete(element);
46
+ stylesheets.delete(key);
47
+ if (key.element) {
48
+ key.element.remove();
49
+ }
47
50
  }
48
51
  });
49
52
  return stats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -106,7 +106,8 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
106
106
  content = URL.createObjectURL(blob);
107
107
  }
108
108
  }
109
- resources.push({ filename: entry.filename, url: entry.comment, content, mimeType, textContent, parentResources: [] });
109
+ const name = entry.filename.match(/^([0-9_]+\/)?(.*)$/)[2];
110
+ resources.push({ filename: entry.filename, name, url: entry.comment, content, mimeType, textContent, parentResources: [] });
110
111
  }));
111
112
  await zipReader.close();
112
113
  resources = resources.sort((resourceLeft, resourceRight) => resourceRight.filename.length - resourceLeft.filename.length);
@@ -24,6 +24,9 @@
24
24
  import * as serializer from "./modules/html-serializer.js";
25
25
  import * as infobar from "./core/infobar.js";
26
26
  import { getInstance } from "./core/util.js";
27
+ import * as zip from "./vendor/zip/zip.js";
28
+ import { extract } from "./processors/compression/compression-extract.js";
29
+ import { display } from "./processors/compression/compression-display.js";
27
30
 
28
31
  const util = getInstance();
29
32
  const helper = {
@@ -42,6 +45,9 @@ const helper = {
42
45
  displayIcon(doc, useShadowRoot) {
43
46
  return infobar.displayIcon(doc, useShadowRoot);
44
47
  },
48
+ zip,
49
+ extract,
50
+ display,
45
51
  INFOBAR_TAGNAME: infobar.INFOBAR_TAGNAME
46
52
  };
47
53