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.
- package/dist/VersionAnalyzer.js +3 -3
- package/dist/fileAnalyzer.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/types/UpdateJsonBuilder.d.ts +2 -2
- package/types/VersionAnalyzer.d.ts +2 -2
- package/types/fileAnalyzer.d.ts +3 -0
- package/types/index.d.ts +3 -3
- package/types/swppRules.d.ts +2 -0
package/dist/VersionAnalyzer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.refreshUrl = exports.
|
|
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
|
|
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.
|
|
57
|
+
exports.analyze = analyze;
|
|
58
58
|
/** 手动添加一个要刷新的 URL */
|
|
59
59
|
function refreshUrl(url) {
|
|
60
60
|
extraUrl.add(url);
|
package/dist/fileAnalyzer.js
CHANGED
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.
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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
|
|
10
|
+
export declare function analyze(version: VersionJson): AnalyzeResult;
|
|
11
11
|
/** 手动添加一个要刷新的 URL */
|
|
12
12
|
export declare function refreshUrl(url: string): void;
|
|
13
|
-
export interface
|
|
13
|
+
export interface AnalyzeResult {
|
|
14
14
|
/** 是否强制刷新所有缓存 */
|
|
15
15
|
force: boolean;
|
|
16
16
|
/** 被删除的 URL */
|
package/types/fileAnalyzer.d.ts
CHANGED
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,
|
|
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
|
|
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 {
|
|
55
|
+
export { AnalyzeResult } from './VersionAnalyzer';
|
package/types/swppRules.d.ts
CHANGED
|
@@ -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
|
/** 符合该规则的缓存在进行全局清理时是否清除 */
|