@angular/service-worker 13.0.0-next.8 → 13.0.0-rc.2

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.
Files changed (62) hide show
  1. package/config/config.d.ts +1 -1
  2. package/config/package.json +5 -5
  3. package/{esm2015/config/config.js → esm2020/config/config.mjs} +0 -0
  4. package/{esm2015/config/index.js → esm2020/config/index.mjs} +0 -0
  5. package/{esm2015/config/public_api.js → esm2020/config/public_api.mjs} +0 -0
  6. package/{esm2015/config/src/duration.js → esm2020/config/src/duration.mjs} +0 -0
  7. package/{esm2015/config/src/filesystem.js → esm2020/config/src/filesystem.mjs} +0 -0
  8. package/esm2020/config/src/generator.mjs +153 -0
  9. package/{esm2015/config/src/glob.js → esm2020/config/src/glob.mjs} +0 -0
  10. package/{esm2015/config/src/in.js → esm2020/config/src/in.mjs} +0 -0
  11. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  12. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  13. package/esm2020/service-worker.mjs +5 -0
  14. package/{esm2015/src/index.js → esm2020/src/index.mjs} +1 -1
  15. package/esm2020/src/low_level.mjs +84 -0
  16. package/esm2020/src/module.mjs +128 -0
  17. package/esm2020/src/push.mjs +174 -0
  18. package/esm2020/src/update.mjs +87 -0
  19. package/fesm2015/{config.js → config.mjs} +25 -26
  20. package/fesm2015/config.mjs.map +1 -0
  21. package/fesm2015/{service-worker.js → service-worker.mjs} +67 -33
  22. package/fesm2015/service-worker.mjs.map +1 -0
  23. package/fesm2020/config.mjs +273 -0
  24. package/fesm2020/config.mjs.map +1 -0
  25. package/fesm2020/service-worker.mjs +494 -0
  26. package/fesm2020/service-worker.mjs.map +1 -0
  27. package/ngsw-config.js +169 -218
  28. package/ngsw-worker.js +1434 -1574
  29. package/package.json +40 -9
  30. package/service-worker.d.ts +139 -23
  31. package/bundles/service-worker-config.umd.js +0 -626
  32. package/bundles/service-worker-config.umd.js.map +0 -1
  33. package/bundles/service-worker.umd.js +0 -804
  34. package/bundles/service-worker.umd.js.map +0 -1
  35. package/config/config.metadata.json +0 -1
  36. package/config/index.ngfactory.d.ts +0 -2
  37. package/config/index.ngsummary.d.ts +0 -2
  38. package/config/public_api.ngfactory.d.ts +0 -2
  39. package/config/public_api.ngsummary.d.ts +0 -2
  40. package/config/src/duration.ngfactory.d.ts +0 -2
  41. package/config/src/duration.ngsummary.d.ts +0 -2
  42. package/config/src/filesystem.ngfactory.d.ts +0 -2
  43. package/config/src/filesystem.ngsummary.d.ts +0 -2
  44. package/config/src/generator.ngfactory.d.ts +0 -2
  45. package/config/src/generator.ngsummary.d.ts +0 -2
  46. package/config/src/glob.ngfactory.d.ts +0 -2
  47. package/config/src/glob.ngsummary.d.ts +0 -2
  48. package/config/src/in.ngfactory.d.ts +0 -2
  49. package/config/src/in.ngsummary.d.ts +0 -2
  50. package/config.d.ts +0 -7
  51. package/config.metadata.json +0 -1
  52. package/esm2015/config/config.externs.js +0 -6
  53. package/esm2015/config/src/generator.js +0 -150
  54. package/esm2015/service-worker.externs.js +0 -6
  55. package/esm2015/service-worker.js +0 -7
  56. package/esm2015/src/low_level.js +0 -75
  57. package/esm2015/src/module.js +0 -123
  58. package/esm2015/src/push.js +0 -173
  59. package/esm2015/src/update.js +0 -60
  60. package/fesm2015/config.js.map +0 -1
  61. package/fesm2015/service-worker.js.map +0 -1
  62. package/service-worker.metadata.json +0 -1
package/ngsw-config.js CHANGED
@@ -1,226 +1,177 @@
1
1
  #!/usr/bin/env node
2
- (function () {
3
- 'use strict';
4
2
 
5
- /**
6
- * @license
7
- * Copyright Google LLC All Rights Reserved.
8
- *
9
- * Use of this source code is governed by an MIT-style license that can be
10
- * found in the LICENSE file at https://angular.io/license
11
- */
12
- function sha1Binary(buffer) {
13
- const words32 = arrayBufferToWords32(buffer, Endian.Big);
14
- return _sha1(words32, buffer.byteLength * 8);
15
- }
16
- function _sha1(words32, len) {
17
- const w = [];
18
- let [a, b, c, d, e] = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
19
- words32[len >> 5] |= 0x80 << (24 - len % 32);
20
- words32[((len + 64 >> 9) << 4) + 15] = len;
21
- for (let i = 0; i < words32.length; i += 16) {
22
- const [h0, h1, h2, h3, h4] = [a, b, c, d, e];
23
- for (let j = 0; j < 80; j++) {
24
- if (j < 16) {
25
- w[j] = words32[i + j];
26
- }
27
- else {
28
- w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
29
- }
30
- const [f, k] = fk(j, b, c, d);
31
- const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
32
- [e, d, c, b, a] = [d, c, rol32(b, 30), a, temp];
33
- }
34
- [a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)];
35
- }
36
- return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
37
- }
38
- function add32(a, b) {
39
- return add32to64(a, b)[1];
40
- }
41
- function add32to64(a, b) {
42
- const low = (a & 0xffff) + (b & 0xffff);
43
- const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
44
- return [high >>> 16, (high << 16) | (low & 0xffff)];
45
- }
46
- // Rotate a 32b number left `count` position
47
- function rol32(a, count) {
48
- return (a << count) | (a >>> (32 - count));
49
- }
50
- var Endian = /*@__PURE__*/ (function (Endian) {
51
- Endian[Endian["Little"] = 0] = "Little";
52
- Endian[Endian["Big"] = 1] = "Big";
53
- return Endian;
54
- })({});
55
- function fk(index, b, c, d) {
56
- if (index < 20) {
57
- return [(b & c) | (~b & d), 0x5a827999];
58
- }
59
- if (index < 40) {
60
- return [b ^ c ^ d, 0x6ed9eba1];
61
- }
62
- if (index < 60) {
63
- return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
64
- }
65
- return [b ^ c ^ d, 0xca62c1d6];
66
- }
67
- function arrayBufferToWords32(buffer, endian) {
68
- const size = (buffer.byteLength + 3) >>> 2;
69
- const words32 = [];
70
- const view = new Uint8Array(buffer);
71
- for (let i = 0; i < size; i++) {
72
- words32[i] = wordAt(view, i * 4, endian);
73
- }
74
- return words32;
75
- }
76
- function byteAt(str, index) {
77
- if (typeof str === 'string') {
78
- return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
79
- }
80
- else {
81
- return index >= str.byteLength ? 0 : str[index] & 0xff;
82
- }
83
- }
84
- function wordAt(str, index, endian) {
85
- let word = 0;
86
- if (endian === Endian.Big) {
87
- for (let i = 0; i < 4; i++) {
88
- word += byteAt(str, index + i) << (24 - 8 * i);
89
- }
90
- }
91
- else {
92
- for (let i = 0; i < 4; i++) {
93
- word += byteAt(str, index + i) << 8 * i;
94
- }
95
- }
96
- return word;
97
- }
98
- function words32ToByteString(words32) {
99
- return words32.reduce((str, word) => str + word32ToByteString(word), '');
100
- }
101
- function word32ToByteString(word) {
102
- let str = '';
103
- for (let i = 0; i < 4; i++) {
104
- str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
105
- }
106
- return str;
3
+ import {createRequire as __cjsCompatRequire} from 'module';
4
+ const require = __cjsCompatRequire(import.meta.url);
5
+
6
+ // bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/main.mjs
7
+ import { Generator } from "@angular/service-worker/config";
8
+ import {
9
+ readFileSync as readFileSync2
10
+ } from "fs";
11
+ import {
12
+ join as join2
13
+ } from "path";
14
+
15
+ // bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/filesystem.mjs
16
+ import {
17
+ readFileSync,
18
+ readdirSync,
19
+ statSync,
20
+ writeFileSync
21
+ } from "fs";
22
+ import {
23
+ join,
24
+ posix
25
+ } from "path";
26
+
27
+ // bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/sha1.mjs
28
+ function sha1Binary(buffer) {
29
+ const words32 = arrayBufferToWords32(buffer, Endian.Big);
30
+ return _sha1(words32, buffer.byteLength * 8);
31
+ }
32
+ function _sha1(words32, len) {
33
+ const w = [];
34
+ let [a, b, c, d, e] = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
35
+ words32[len >> 5] |= 128 << 24 - len % 32;
36
+ words32[(len + 64 >> 9 << 4) + 15] = len;
37
+ for (let i = 0; i < words32.length; i += 16) {
38
+ const [h0, h1, h2, h3, h4] = [a, b, c, d, e];
39
+ for (let j = 0; j < 80; j++) {
40
+ if (j < 16) {
41
+ w[j] = words32[i + j];
42
+ } else {
43
+ w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
44
+ }
45
+ const [f, k] = fk(j, b, c, d);
46
+ const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
47
+ [e, d, c, b, a] = [d, c, rol32(b, 30), a, temp];
107
48
  }
108
- function byteStringToHexString(str) {
109
- let hex = '';
110
- for (let i = 0; i < str.length; i++) {
111
- const b = byteAt(str, i);
112
- hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
113
- }
114
- return hex.toLowerCase();
49
+ [a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)];
50
+ }
51
+ return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
52
+ }
53
+ function add32(a, b) {
54
+ return add32to64(a, b)[1];
55
+ }
56
+ function add32to64(a, b) {
57
+ const low = (a & 65535) + (b & 65535);
58
+ const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
59
+ return [high >>> 16, high << 16 | low & 65535];
60
+ }
61
+ function rol32(a, count) {
62
+ return a << count | a >>> 32 - count;
63
+ }
64
+ var Endian;
65
+ (function(Endian2) {
66
+ Endian2[Endian2["Little"] = 0] = "Little";
67
+ Endian2[Endian2["Big"] = 1] = "Big";
68
+ })(Endian || (Endian = {}));
69
+ function fk(index, b, c, d) {
70
+ if (index < 20) {
71
+ return [b & c | ~b & d, 1518500249];
72
+ }
73
+ if (index < 40) {
74
+ return [b ^ c ^ d, 1859775393];
75
+ }
76
+ if (index < 60) {
77
+ return [b & c | b & d | c & d, 2400959708];
78
+ }
79
+ return [b ^ c ^ d, 3395469782];
80
+ }
81
+ function arrayBufferToWords32(buffer, endian) {
82
+ const size = buffer.byteLength + 3 >>> 2;
83
+ const words32 = [];
84
+ const view = new Uint8Array(buffer);
85
+ for (let i = 0; i < size; i++) {
86
+ words32[i] = wordAt(view, i * 4, endian);
87
+ }
88
+ return words32;
89
+ }
90
+ function byteAt(str, index) {
91
+ if (typeof str === "string") {
92
+ return index >= str.length ? 0 : str.charCodeAt(index) & 255;
93
+ } else {
94
+ return index >= str.byteLength ? 0 : str[index] & 255;
95
+ }
96
+ }
97
+ function wordAt(str, index, endian) {
98
+ let word = 0;
99
+ if (endian === Endian.Big) {
100
+ for (let i = 0; i < 4; i++) {
101
+ word += byteAt(str, index + i) << 24 - 8 * i;
115
102
  }
116
-
117
- /**
118
- * @license
119
- * Copyright Google LLC All Rights Reserved.
120
- *
121
- * Use of this source code is governed by an MIT-style license that can be
122
- * found in the LICENSE file at https://angular.io/license
123
- */
124
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
125
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
126
- return new (P || (P = Promise))(function (resolve, reject) {
127
- function fulfilled(value) { try {
128
- step(generator.next(value));
129
- }
130
- catch (e) {
131
- reject(e);
132
- } }
133
- function rejected(value) { try {
134
- step(generator["throw"](value));
135
- }
136
- catch (e) {
137
- reject(e);
138
- } }
139
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
140
- step((generator = generator.apply(thisArg, _arguments || [])).next());
141
- });
142
- };
143
- const fs = require('fs');
144
- const path = require('path');
145
- class NodeFilesystem {
146
- constructor(base) {
147
- this.base = base;
148
- }
149
- list(_path) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- const dir = this.canonical(_path);
152
- const entries = fs.readdirSync(dir).map((entry) => ({ entry, stats: fs.statSync(path.join(dir, entry)) }));
153
- const files = entries.filter((entry) => !entry.stats.isDirectory())
154
- .map((entry) => path.posix.join(_path, entry.entry));
155
- return entries.filter((entry) => entry.stats.isDirectory())
156
- .map((entry) => path.posix.join(_path, entry.entry))
157
- .reduce((list, subdir) => __awaiter(this, void 0, void 0, function* () { return (yield list).concat(yield this.list(subdir)); }), Promise.resolve(files));
158
- });
159
- }
160
- read(_path) {
161
- return __awaiter(this, void 0, void 0, function* () {
162
- const file = this.canonical(_path);
163
- return fs.readFileSync(file).toString();
164
- });
165
- }
166
- hash(_path) {
167
- return __awaiter(this, void 0, void 0, function* () {
168
- const file = this.canonical(_path);
169
- const contents = fs.readFileSync(file);
170
- return sha1Binary(contents);
171
- });
172
- }
173
- write(_path, contents) {
174
- return __awaiter(this, void 0, void 0, function* () {
175
- const file = this.canonical(_path);
176
- fs.writeFileSync(file, contents);
177
- });
178
- }
179
- canonical(_path) {
180
- return path.posix.join(this.base, _path);
181
- }
103
+ } else {
104
+ for (let i = 0; i < 4; i++) {
105
+ word += byteAt(str, index + i) << 8 * i;
182
106
  }
107
+ }
108
+ return word;
109
+ }
110
+ function words32ToByteString(words32) {
111
+ return words32.reduce((str, word) => str + word32ToByteString(word), "");
112
+ }
113
+ function word32ToByteString(word) {
114
+ let str = "";
115
+ for (let i = 0; i < 4; i++) {
116
+ str += String.fromCharCode(word >>> 8 * (3 - i) & 255);
117
+ }
118
+ return str;
119
+ }
120
+ function byteStringToHexString(str) {
121
+ let hex = "";
122
+ for (let i = 0; i < str.length; i++) {
123
+ const b = byteAt(str, i);
124
+ hex += (b >>> 4).toString(16) + (b & 15).toString(16);
125
+ }
126
+ return hex.toLowerCase();
127
+ }
183
128
 
184
- /**
185
- * @license
186
- * Copyright Google LLC All Rights Reserved.
187
- *
188
- * Use of this source code is governed by an MIT-style license that can be
189
- * found in the LICENSE file at https://angular.io/license
190
- */
191
- var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
192
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
193
- return new (P || (P = Promise))(function (resolve, reject) {
194
- function fulfilled(value) { try {
195
- step(generator.next(value));
196
- }
197
- catch (e) {
198
- reject(e);
199
- } }
200
- function rejected(value) { try {
201
- step(generator["throw"](value));
202
- }
203
- catch (e) {
204
- reject(e);
205
- } }
206
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
207
- step((generator = generator.apply(thisArg, _arguments || [])).next());
208
- });
209
- };
210
- const { Generator } = require('@angular/service-worker/config');
211
- const fs$1 = require('fs');
212
- const path$1 = require('path');
213
- const cwd = process.cwd();
214
- const distDir = path$1.join(cwd, process.argv[2]);
215
- const config = path$1.join(cwd, process.argv[3]);
216
- const baseHref = process.argv[4] || '/';
217
- const configParsed = JSON.parse(fs$1.readFileSync(config).toString());
218
- const filesystem = new NodeFilesystem(distDir);
219
- const gen = new Generator(filesystem, baseHref);
220
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
221
- const control = yield gen.process(configParsed);
222
- yield filesystem.write('/ngsw.json', JSON.stringify(control, null, 2));
223
- }))();
129
+ // bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/filesystem.mjs
130
+ var NodeFilesystem = class {
131
+ constructor(base) {
132
+ this.base = base;
133
+ }
134
+ async list(_path) {
135
+ const dir = this.canonical(_path);
136
+ const entries = readdirSync(dir).map((entry) => ({ entry, stats: statSync(join(dir, entry)) }));
137
+ const files = entries.filter((entry) => !entry.stats.isDirectory()).map((entry) => posix.join(_path, entry.entry));
138
+ return entries.filter((entry) => entry.stats.isDirectory()).map((entry) => posix.join(_path, entry.entry)).reduce(async (list, subdir) => (await list).concat(await this.list(subdir)), Promise.resolve(files));
139
+ }
140
+ async read(_path) {
141
+ const file = this.canonical(_path);
142
+ return readFileSync(file).toString();
143
+ }
144
+ async hash(_path) {
145
+ const file = this.canonical(_path);
146
+ const contents = readFileSync(file);
147
+ return sha1Binary(contents);
148
+ }
149
+ async write(_path, contents) {
150
+ const file = this.canonical(_path);
151
+ writeFileSync(file, contents);
152
+ }
153
+ canonical(_path) {
154
+ return posix.join(this.base, _path);
155
+ }
156
+ };
224
157
 
225
- }());
158
+ // bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/main.mjs
159
+ var cwd = process.cwd();
160
+ var distDir = join2(cwd, process.argv[2]);
161
+ var config = join2(cwd, process.argv[3]);
162
+ var baseHref = process.argv[4] || "/";
163
+ var configParsed = JSON.parse(readFileSync2(config).toString());
164
+ var filesystem = new NodeFilesystem(distDir);
165
+ var gen = new Generator(filesystem, baseHref);
166
+ (async () => {
167
+ const control = await gen.process(configParsed);
168
+ await filesystem.write("/ngsw.json", JSON.stringify(control, null, 2));
169
+ })();
170
+ /**
171
+ * @license
172
+ * Copyright Google LLC All Rights Reserved.
173
+ *
174
+ * Use of this source code is governed by an MIT-style license that can be
175
+ * found in the LICENSE file at https://angular.io/license
176
+ */
226
177
  //# sourceMappingURL=ngsw_config.js.map