swpp-backends 3.0.0-alpha.310 → 3.0.0-alpha.312

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.
@@ -63,9 +63,11 @@ class RuntimeData {
63
63
  for (let key of this.insertOrder) {
64
64
  this.getDatabase(key).initRuntimeAndCompilation(this, compilation);
65
65
  }
66
+ this.domConfig.initRuntimeAndCompilation(this, compilation);
66
67
  }
67
68
  freezeAll() {
68
69
  this.insertOrder.forEach(it => this.getDatabase(it).freeze());
70
+ this.domConfig.freeze();
69
71
  }
70
72
  }
71
73
  exports.RuntimeData = RuntimeData;
@@ -45,25 +45,23 @@ class KeyValueDatabase {
45
45
  const item = this.dataValues[key];
46
46
  if (!item)
47
47
  throw new untils_1.RuntimeException(untils_1.exceptionNames.invalidKey, `输入的 key[${key}] 不存在`);
48
+ if (SpecialConfig_1.SpecialConfig.isSpecialConfig(item.default)) {
49
+ item.default = item.default.get(this.runtime, this.compilation);
50
+ }
48
51
  // 获取真实值
49
- let value = item.default;
52
+ let value = item.manual ?? item.default;
50
53
  let isNoCache = false;
51
- if (item.manual) {
52
- if (SpecialConfig_1.SpecialConfig.isSpecialConfig(item.manual)) {
53
- this.runtime.debugCallChain.push(this.namespace, key);
54
- value = item.manual.get(this.runtime, this.compilation);
55
- this.runtime.debugCallChain.pop(this.namespace, key);
56
- if (SpecialConfig_1.SpecialConfig.isNoCacheConfig(item.manual)) {
57
- isNoCache = true;
58
- }
59
- }
60
- else {
61
- value = item.manual;
54
+ if (SpecialConfig_1.SpecialConfig.isSpecialConfig(value)) {
55
+ this.runtime.debugCallChain.push(this.namespace, key);
56
+ value = value.get(this.runtime, this.compilation);
57
+ this.runtime.debugCallChain.pop(this.namespace, key);
58
+ if (SpecialConfig_1.SpecialConfig.isNoCacheConfig(value)) {
59
+ isNoCache = true;
62
60
  }
63
61
  }
64
62
  // 进行类型预检
65
63
  if (!(value === null || value === undefined) && typeof value != typeof item.default) {
66
- throw new untils_1.RuntimeException(untils_1.exceptionNames.invalidValue, '用户传入的值类型与缺省值类型不统一', { default: item.default, value });
64
+ throw new untils_1.RuntimeException(untils_1.exceptionNames.invalidValue, '用户传入的值类型与缺省值类型不统一', { key, default: item.default, value });
67
65
  }
68
66
  // 执行全局检查
69
67
  this.globalChecker?.(key, value);
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RuntimeEventCode = void 0;
4
4
  const RuntimeKeyValueDatabase_1 = require("./RuntimeKeyValueDatabase");
5
+ let ESCAPE;
5
6
  let handleFetchEvent;
6
7
  let handleUpdate;
7
8
  let postMessage;
8
9
  let readVersion;
10
+ let handleEscape;
9
11
  class RuntimeEventCode extends RuntimeKeyValueDatabase_1.RuntimeKeyValueDatabase {
10
12
  constructor() {
11
13
  super('RuntimeEventCode', buildCommon());
@@ -28,6 +30,10 @@ function buildCommon() {
28
30
  default: (_event) => {
29
31
  // @ts-ignore
30
32
  skipWaiting();
33
+ if (ESCAPE) {
34
+ // noinspection JSIgnoredPromiseFromCall
35
+ handleEscape();
36
+ }
31
37
  }
32
38
  },
33
39
  /** sw 激活后立即对所有页面生效,而非等待刷新 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "3.0.0-alpha.310",
3
+ "version": "3.0.0-alpha.312",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",