swpp-backends 0.0.9-alpha → 0.0.10-alpha

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.
@@ -101,10 +101,10 @@ exports.loadVersionJson = loadVersionJson;
101
101
  let _oldVersionJson;
102
102
  let _newVersionJson;
103
103
  let _mergeVersionMap;
104
- const event = [];
104
+ const event = new Map();
105
105
  /** 提交要存储到 version json 的值 */
106
- function submitCacheInfo(value) {
107
- event.push(value);
106
+ function submitCacheInfo(key, value) {
107
+ event.set(key, value);
108
108
  }
109
109
  exports.submitCacheInfo = submitCacheInfo;
110
110
  /**
@@ -168,7 +168,7 @@ exports.readMergeVersionMap = readMergeVersionMap;
168
168
  async function buildVersionJson(protocol, domain, root) {
169
169
  const list = {};
170
170
  await eachAllFile(root, async (path) => {
171
- const endIndex = path.length - (path.endsWith('/index.html') ? 10 : 0);
171
+ const endIndex = path.length - (/[\/\\]index\.html$/.test(path) ? 10 : 0);
172
172
  const url = new URL(protocol + path_1.default.join(domain, path.substring(root.length, endIndex)));
173
173
  const pathname = url.pathname;
174
174
  if (isExclude(domain, pathname))
@@ -363,10 +363,9 @@ async function eachAllLinkInCss(domain, content, result, event) {
363
363
  if (!any)
364
364
  return;
365
365
  for (let rule of any) {
366
+ if (rule.declarations)
367
+ await each(rule.declarations);
366
368
  switch (rule.type) {
367
- case 'rule':
368
- await each(rule.declarations);
369
- break;
370
369
  case 'declaration':
371
370
  const value = rule.value;
372
371
  const list = value.match(/url\(['"]?([^'")]+)['"]?\)/g)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "0.0.9-alpha",
3
+ "version": "0.0.10-alpha",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",
@@ -41,7 +41,7 @@ export declare function isStable(url: string): boolean;
41
41
  */
42
42
  export declare function loadVersionJson(url: string): Promise<VersionJson>;
43
43
  /** 提交要存储到 version json 的值 */
44
- export declare function submitCacheInfo(value: any): void;
44
+ export declare function submitCacheInfo(key: string, value: any): void;
45
45
  /**
46
46
  * 读取最后一次加载的 version json
47
47
  *