swpp-backends 1.0.13 → 1.0.14

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.
@@ -93,7 +93,7 @@ exports.isStable = isStable;
93
93
  */
94
94
  async function loadVersionJson(url) {
95
95
  const response = await (0, Utils_1.fetchFile)(url).catch(err => err);
96
- if (response?.status === 404) {
96
+ if (response?.status === 404 || response?.code === 'ENOTFOUND') {
97
97
  (0, Utils_1.warn)('LoadVersionJson', `拉取 ${url} 时出现 404 错误,如果您是第一次构建请忽略这个警告。`);
98
98
  return _oldVersionJson = null;
99
99
  }
@@ -255,7 +255,7 @@ async function eachAllLinkInUrl(domain, url, result, event) {
255
255
  result[url] = false;
256
256
  const response = await (0, Utils_1.fetchFile)(url).catch(err => err);
257
257
  if (![200, 301, 302, 307, 308].includes(response?.status ?? 0)) {
258
- (0, Utils_1.error)('LinkItorInUrl', `拉取文件 [${url}] 时出现错误:${response?.status}`);
258
+ (0, Utils_1.error)('LinkItorInUrl', `拉取文件 [${url}] 时出现错误:${response?.status ?? response?.code}`);
259
259
  return;
260
260
  }
261
261
  event?.(url);
@@ -19,8 +19,8 @@ exports.submitChange = submitChange;
19
19
  async function loadUpdateJson(url) {
20
20
  if (_oldJson !== undefined)
21
21
  return _oldJson;
22
- const response = await (0, Utils_1.fetchFile)(url);
23
- if (response.status === 404) {
22
+ const response = await (0, Utils_1.fetchFile)(url).catch(err => err);
23
+ if (response?.status === 404 || response.code === 'ENOTFOUND') {
24
24
  (0, Utils_1.warn)('LoadUpdateJson', `拉取 ${url} 时出现 404 错误,如果您是第一次构建请忽略这个警告。`);
25
25
  return _oldJson = null;
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",