swpp-backends 0.0.2-alpha → 0.0.4-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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.refreshUrl = exports.analyzer = void 0;
3
+ exports.refreshUrl = exports.analyze = void 0;
4
4
  const FileAnalyzer_1 = require("./FileAnalyzer");
5
5
  const extraUrl = new Set();
6
6
  /**
@@ -11,7 +11,7 @@ const extraUrl = new Set();
11
11
  *
12
12
  * @param version 新的版本信息
13
13
  */
14
- function analyzer(version) {
14
+ function analyze(version) {
15
15
  const oldVersion = (0, FileAnalyzer_1.readOldVersionJson)();
16
16
  const result = {
17
17
  force: false,
@@ -54,7 +54,7 @@ function analyzer(version) {
54
54
  extraUrl.forEach(url => result.refresh.push(url));
55
55
  return result;
56
56
  }
57
- exports.analyzer = analyzer;
57
+ exports.analyze = analyze;
58
58
  /** 手动添加一个要刷新的 URL */
59
59
  function refreshUrl(url) {
60
60
  extraUrl.add(url);
@@ -190,7 +190,7 @@ async function buildVersionJson(protocol, domain, root) {
190
190
  }
191
191
  });
192
192
  return _newVersionJson = {
193
- version: 3, list
193
+ version: 3, list, external: event
194
194
  };
195
195
  }
196
196
  exports.buildVersionJson = buildVersionJson;
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ exports.default = {
18
18
  buildVersionJson: FileAnalyzer_1.buildVersionJson,
19
19
  buildNewInfo: UpdateJsonBuilder_1.buildNewInfo,
20
20
  calcEjectValues: Utils_1.calcEjectValues,
21
- analyzer: VersionAnalyzer_1.analyzer
21
+ analyzer: VersionAnalyzer_1.analyze
22
22
  },
23
23
  loader: {
24
24
  loadRules: SwppRules_1.loadRules, loadUpdateJson: UpdateJsonBuilder_1.loadUpdateJson, loadVersionJson: FileAnalyzer_1.loadVersionJson
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "0.0.2-alpha",
3
+ "version": "0.0.4-alpha",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",
@@ -1,4 +1,4 @@
1
- import { AnalyzerResult } from './VersionAnalyzer';
1
+ import { AnalyzeResult } from './VersionAnalyzer';
2
2
  /** 提交修改 */
3
3
  export declare function submitChange(...change: ChangeExpression[]): void;
4
4
  /**
@@ -25,7 +25,7 @@ export declare function readUpdateJson(): UpdateJson | null;
25
25
  * @param root 网站根路径(包括网络协议)
26
26
  * @param dif 网站文件变化
27
27
  */
28
- export declare function buildNewInfo(root: string, dif: AnalyzerResult): UpdateJson;
28
+ export declare function buildNewInfo(root: string, dif: AnalyzeResult): UpdateJson;
29
29
  /**
30
30
  * 获取 URL 的缩写形式
31
31
  *
@@ -7,10 +7,10 @@ import { VersionJson } from './FileAnalyzer';
7
7
  *
8
8
  * @param version 新的版本信息
9
9
  */
10
- export declare function analyzer(version: VersionJson): AnalyzerResult;
10
+ export declare function analyze(version: VersionJson): AnalyzeResult;
11
11
  /** 手动添加一个要刷新的 URL */
12
12
  export declare function refreshUrl(url: string): void;
13
- export interface AnalyzerResult {
13
+ export interface AnalyzeResult {
14
14
  /** 是否强制刷新所有缓存 */
15
15
  force: boolean;
16
16
  /** 被删除的 URL */
@@ -5,6 +5,9 @@
5
5
  export interface VersionJson {
6
6
  version: number;
7
7
  list: VersionMap;
8
+ external: {
9
+ [propName: string]: any;
10
+ };
8
11
  }
9
12
  /**
10
13
  * 版本列表
package/types/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { isExclude, isStable, loadVersionJson, readOldVersionJson, readNewVersio
3
3
  import { buildServiceWorker } from './ServiceWorkerBuilder';
4
4
  import { readRules, loadRules, addRulesMapEvent } from './SwppRules';
5
5
  import { readUpdateJson, loadUpdateJson, submitChange, getShorthand, buildNewInfo } from './UpdateJsonBuilder';
6
- import { refreshUrl, analyzer } from './VersionAnalyzer';
6
+ import { refreshUrl, analyze } from './VersionAnalyzer';
7
7
  declare const _default: {
8
8
  cache: {
9
9
  readEjectData: typeof readEjectData;
@@ -18,7 +18,7 @@ declare const _default: {
18
18
  buildVersionJson: typeof buildVersionJson;
19
19
  buildNewInfo: typeof buildNewInfo;
20
20
  calcEjectValues: typeof calcEjectValues;
21
- analyzer: typeof analyzer;
21
+ analyzer: typeof analyze;
22
22
  };
23
23
  loader: {
24
24
  loadRules: typeof loadRules;
@@ -52,4 +52,4 @@ export { VersionJson, VersionMap } from './FileAnalyzer';
52
52
  export { ServiceWorkerConfig, SwppConfig, SwppConfigTemplate, DomConfig, VersionJsonConfig, RegisterConfig, ExternalMonitorConfig } from './SwppConfig';
53
53
  export { SwppRules, CacheRules, SpareURLs, EjectValue } from './SwppRules';
54
54
  export { UpdateJson, UpdateVersionInfo, FlagStr, ChangeExpression } from './UpdateJsonBuilder';
55
- export { AnalyzerResult } from './VersionAnalyzer';
55
+ export { AnalyzeResult } from './VersionAnalyzer';
@@ -76,6 +76,8 @@ export interface SwppRules {
76
76
  * @param spare 备用 URL
77
77
  */
78
78
  fetchFile?: (request: Request, banCache: boolean, spare?: SpareURLs) => Promise<Response>;
79
+ /** 第三方添加的值 */
80
+ [propName: string]: any;
79
81
  }
80
82
  export interface CacheRules {
81
83
  /** 符合该规则的缓存在进行全局清理时是否清除 */