@angular/service-worker 19.2.0 → 19.2.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.
- package/config/index.d.ts +36 -44
- package/fesm2022/config.mjs +2 -8
- package/fesm2022/config.mjs.map +1 -1
- package/fesm2022/service-worker.mjs +15 -28
- package/fesm2022/service-worker.mjs.map +1 -1
- package/index.d.ts +164 -162
- package/ngsw-config.js +5 -5
- package/ngsw-worker.js +17 -17
- package/package.json +2 -2
package/config/index.d.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v19.2.2
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
8
|
+
* An abstraction over a virtual file system used to enable testing and operation
|
|
9
|
+
* of the config generator in different environments.
|
|
10
10
|
*
|
|
11
11
|
* @publicApi
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
files?: Glob[];
|
|
19
|
-
urls?: Glob[];
|
|
20
|
-
};
|
|
21
|
-
cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
|
|
13
|
+
interface Filesystem {
|
|
14
|
+
list(dir: string): Promise<string[]>;
|
|
15
|
+
read(file: string): Promise<string>;
|
|
16
|
+
hash(file: string): Promise<string>;
|
|
17
|
+
write(file: string, contents: string): Promise<void>;
|
|
22
18
|
}
|
|
23
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @publicApi
|
|
22
|
+
*/
|
|
23
|
+
type Glob = string;
|
|
24
|
+
/**
|
|
25
|
+
* @publicApi
|
|
26
|
+
*/
|
|
27
|
+
type Duration = string;
|
|
24
28
|
/**
|
|
25
29
|
* A top-level Angular Service Worker configuration object.
|
|
26
30
|
*
|
|
27
31
|
* @publicApi
|
|
28
32
|
*/
|
|
29
|
-
|
|
33
|
+
interface Config {
|
|
30
34
|
appData?: {};
|
|
31
35
|
index: string;
|
|
32
36
|
assetGroups?: AssetGroup[];
|
|
@@ -35,13 +39,27 @@ export declare interface Config {
|
|
|
35
39
|
navigationRequestStrategy?: 'freshness' | 'performance';
|
|
36
40
|
applicationMaxAge?: Duration;
|
|
37
41
|
}
|
|
38
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for a particular group of assets.
|
|
44
|
+
*
|
|
45
|
+
* @publicApi
|
|
46
|
+
*/
|
|
47
|
+
interface AssetGroup {
|
|
48
|
+
name: string;
|
|
49
|
+
installMode?: 'prefetch' | 'lazy';
|
|
50
|
+
updateMode?: 'prefetch' | 'lazy';
|
|
51
|
+
resources: {
|
|
52
|
+
files?: Glob[];
|
|
53
|
+
urls?: Glob[];
|
|
54
|
+
};
|
|
55
|
+
cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
|
|
56
|
+
}
|
|
39
57
|
/**
|
|
40
58
|
* Configuration for a particular group of dynamic URLs.
|
|
41
59
|
*
|
|
42
60
|
* @publicApi
|
|
43
61
|
*/
|
|
44
|
-
|
|
62
|
+
interface DataGroup {
|
|
45
63
|
name: string;
|
|
46
64
|
urls: Glob[];
|
|
47
65
|
version?: number;
|
|
@@ -56,31 +74,12 @@ export declare interface DataGroup {
|
|
|
56
74
|
cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
|
|
57
75
|
}
|
|
58
76
|
|
|
59
|
-
/**
|
|
60
|
-
* @publicApi
|
|
61
|
-
*/
|
|
62
|
-
export declare type Duration = string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* An abstraction over a virtual file system used to enable testing and operation
|
|
67
|
-
* of the config generator in different environments.
|
|
68
|
-
*
|
|
69
|
-
* @publicApi
|
|
70
|
-
*/
|
|
71
|
-
export declare interface Filesystem {
|
|
72
|
-
list(dir: string): Promise<string[]>;
|
|
73
|
-
read(file: string): Promise<string>;
|
|
74
|
-
hash(file: string): Promise<string>;
|
|
75
|
-
write(file: string, contents: string): Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
77
|
/**
|
|
79
78
|
* Consumes service worker configuration files and processes them into control files.
|
|
80
79
|
*
|
|
81
80
|
* @publicApi
|
|
82
81
|
*/
|
|
83
|
-
declare class
|
|
82
|
+
declare class Generator {
|
|
84
83
|
readonly fs: Filesystem;
|
|
85
84
|
private baseHref;
|
|
86
85
|
constructor(fs: Filesystem, baseHref: string);
|
|
@@ -88,12 +87,5 @@ declare class Generator_2 {
|
|
|
88
87
|
private processAssetGroups;
|
|
89
88
|
private processDataGroups;
|
|
90
89
|
}
|
|
91
|
-
export { Generator_2 as Generator }
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @publicApi
|
|
96
|
-
*/
|
|
97
|
-
export declare type Glob = string;
|
|
98
90
|
|
|
99
|
-
export { }
|
|
91
|
+
export { type AssetGroup, type Config, type DataGroup, type Duration, type Filesystem, Generator, type Glob };
|
package/fesm2022/config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v19.2.2
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -239,11 +239,5 @@ function buildCacheQueryOptions(inOptions) {
|
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
// This file is not used to build this module. It is only used during editing
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Generated bundle index. Do not edit.
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
242
|
export { Generator };
|
|
249
243
|
//# sourceMappingURL=config.mjs.map
|
package/fesm2022/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","sources":["../../../../../../packages/service-worker/config/src/duration.ts","../../../../../../packages/service-worker/config/src/glob.ts","../../../../../../packages/service-worker/config/src/generator.ts","../../../../../../packages/service-worker/config/index.ts","../../../../../../packages/service-worker/config/config.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nconst PARSE_TO_PAIRS = /([0-9]+[^0-9]+)/g;\nconst PAIR_SPLIT = /^([0-9]+)([dhmsu]+)$/;\n\nexport function parseDurationToMs(duration: string): number {\n const matches: string[] = [];\n\n let array: RegExpExecArray | null;\n while ((array = PARSE_TO_PAIRS.exec(duration)) !== null) {\n matches.push(array[0]);\n }\n return matches\n .map((match) => {\n const res = PAIR_SPLIT.exec(match);\n if (res === null) {\n throw new Error(`Not a valid duration: ${match}`);\n }\n let factor: number = 0;\n switch (res[2]) {\n case 'd':\n factor = 86400000;\n break;\n case 'h':\n factor = 3600000;\n break;\n case 'm':\n factor = 60000;\n break;\n case 's':\n factor = 1000;\n break;\n case 'u':\n factor = 1;\n break;\n default:\n throw new Error(`Not a valid duration unit: ${res[2]}`);\n }\n return parseInt(res[1]) * factor;\n })\n .reduce((total, value) => total + value, 0);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nconst QUESTION_MARK = '[^/]';\nconst WILD_SINGLE = '[^/]*';\nconst WILD_OPEN = '(?:.+\\\\/)?';\n\nconst TO_ESCAPE_BASE = [\n {replace: /\\./g, with: '\\\\.'},\n {replace: /\\+/g, with: '\\\\+'},\n {replace: /\\*/g, with: WILD_SINGLE},\n];\nconst TO_ESCAPE_WILDCARD_QM = [...TO_ESCAPE_BASE, {replace: /\\?/g, with: QUESTION_MARK}];\nconst TO_ESCAPE_LITERAL_QM = [...TO_ESCAPE_BASE, {replace: /\\?/g, with: '\\\\?'}];\n\nexport function globToRegex(glob: string, literalQuestionMark = false): string {\n const toEscape = literalQuestionMark ? TO_ESCAPE_LITERAL_QM : TO_ESCAPE_WILDCARD_QM;\n const segments = glob.split('/').reverse();\n let regex: string = '';\n while (segments.length > 0) {\n const segment = segments.pop()!;\n if (segment === '**') {\n if (segments.length > 0) {\n regex += WILD_OPEN;\n } else {\n regex += '.*';\n }\n } else {\n const processed = toEscape.reduce(\n (segment, escape) => segment.replace(escape.replace, escape.with),\n segment,\n );\n regex += processed;\n if (segments.length > 0) {\n regex += '\\\\/';\n }\n }\n }\n return regex;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {parseDurationToMs} from './duration';\nimport {Filesystem} from './filesystem';\nimport {globToRegex} from './glob';\nimport {AssetGroup, Config} from './in';\n\nconst DEFAULT_NAVIGATION_URLS = [\n '/**', // Include all URLs.\n '!/**/*.*', // Exclude URLs to files (containing a file extension in the last segment).\n '!/**/*__*', // Exclude URLs containing `__` in the last segment.\n '!/**/*__*/**', // Exclude URLs containing `__` in any other segment.\n];\n\n/**\n * Consumes service worker configuration files and processes them into control files.\n *\n * @publicApi\n */\nexport class Generator {\n constructor(\n readonly fs: Filesystem,\n private baseHref: string,\n ) {}\n\n async process(config: Config): Promise<Object> {\n const unorderedHashTable = {};\n const assetGroups = await this.processAssetGroups(config, unorderedHashTable);\n\n return {\n configVersion: 1,\n timestamp: Date.now(),\n appData: config.appData,\n index: joinUrls(this.baseHref, config.index),\n assetGroups,\n dataGroups: this.processDataGroups(config),\n hashTable: withOrderedKeys(unorderedHashTable),\n navigationUrls: processNavigationUrls(this.baseHref, config.navigationUrls),\n navigationRequestStrategy: config.navigationRequestStrategy ?? 'performance',\n applicationMaxAge: config.applicationMaxAge\n ? parseDurationToMs(config.applicationMaxAge)\n : undefined,\n };\n }\n\n private async processAssetGroups(\n config: Config,\n hashTable: {[file: string]: string | undefined},\n ): Promise<Object[]> {\n // Retrieve all files of the build.\n const allFiles = await this.fs.list('/');\n const seenMap = new Set<string>();\n const filesPerGroup = new Map<AssetGroup, string[]>();\n\n // Computed which files belong to each asset-group.\n for (const group of config.assetGroups || []) {\n if ((group.resources as any).versionedFiles) {\n throw new Error(\n `Asset-group '${group.name}' in 'ngsw-config.json' uses the 'versionedFiles' option, ` +\n \"which is no longer supported. Use 'files' instead.\",\n );\n }\n\n const fileMatcher = globListToMatcher(group.resources.files || []);\n const matchedFiles = allFiles\n .filter(fileMatcher)\n .filter((file) => !seenMap.has(file))\n .sort();\n\n matchedFiles.forEach((file) => seenMap.add(file));\n filesPerGroup.set(group, matchedFiles);\n }\n\n // Compute hashes for all matched files and add them to the hash-table.\n const allMatchedFiles = ([] as string[]).concat(...Array.from(filesPerGroup.values())).sort();\n const allMatchedHashes = await processInBatches(allMatchedFiles, 500, (file) =>\n this.fs.hash(file),\n );\n allMatchedFiles.forEach((file, idx) => {\n hashTable[joinUrls(this.baseHref, file)] = allMatchedHashes[idx];\n });\n\n // Generate and return the processed asset-groups.\n return Array.from(filesPerGroup.entries()).map(([group, matchedFiles]) => ({\n name: group.name,\n installMode: group.installMode || 'prefetch',\n updateMode: group.updateMode || group.installMode || 'prefetch',\n cacheQueryOptions: buildCacheQueryOptions(group.cacheQueryOptions),\n urls: matchedFiles.map((url) => joinUrls(this.baseHref, url)),\n patterns: (group.resources.urls || []).map((url) => urlToRegex(url, this.baseHref, true)),\n }));\n }\n\n private processDataGroups(config: Config): Object[] {\n return (config.dataGroups || []).map((group) => {\n return {\n name: group.name,\n patterns: group.urls.map((url) => urlToRegex(url, this.baseHref, true)),\n strategy: group.cacheConfig.strategy || 'performance',\n maxSize: group.cacheConfig.maxSize,\n maxAge: parseDurationToMs(group.cacheConfig.maxAge),\n timeoutMs: group.cacheConfig.timeout && parseDurationToMs(group.cacheConfig.timeout),\n refreshAheadMs:\n group.cacheConfig.refreshAhead && parseDurationToMs(group.cacheConfig.refreshAhead),\n cacheOpaqueResponses: group.cacheConfig.cacheOpaqueResponses,\n cacheQueryOptions: buildCacheQueryOptions(group.cacheQueryOptions),\n version: group.version !== undefined ? group.version : 1,\n };\n });\n }\n}\n\nexport function processNavigationUrls(\n baseHref: string,\n urls = DEFAULT_NAVIGATION_URLS,\n): {positive: boolean; regex: string}[] {\n return urls.map((url) => {\n const positive = !url.startsWith('!');\n url = positive ? url : url.slice(1);\n return {positive, regex: `^${urlToRegex(url, baseHref)}$`};\n });\n}\n\nasync function processInBatches<I, O>(\n items: I[],\n batchSize: number,\n processFn: (item: I) => O | Promise<O>,\n): Promise<O[]> {\n const batches = [];\n\n for (let i = 0; i < items.length; i += batchSize) {\n batches.push(items.slice(i, i + batchSize));\n }\n\n return batches.reduce(\n async (prev, batch) =>\n (await prev).concat(await Promise.all(batch.map((item) => processFn(item)))),\n Promise.resolve<O[]>([]),\n );\n}\n\nfunction globListToMatcher(globs: string[]): (file: string) => boolean {\n const patterns = globs.map((pattern) => {\n if (pattern.startsWith('!')) {\n return {\n positive: false,\n regex: new RegExp('^' + globToRegex(pattern.slice(1)) + '$'),\n };\n } else {\n return {\n positive: true,\n regex: new RegExp('^' + globToRegex(pattern) + '$'),\n };\n }\n });\n return (file: string) => matches(file, patterns);\n}\n\nfunction matches(file: string, patterns: {positive: boolean; regex: RegExp}[]): boolean {\n return patterns.reduce((isMatch, pattern) => {\n if (pattern.positive) {\n return isMatch || pattern.regex.test(file);\n } else {\n return isMatch && !pattern.regex.test(file);\n }\n }, false);\n}\n\nfunction urlToRegex(url: string, baseHref: string, literalQuestionMark?: boolean): string {\n if (!url.startsWith('/') && url.indexOf('://') === -1) {\n // Prefix relative URLs with `baseHref`.\n // Strip a leading `.` from a relative `baseHref` (e.g. `./foo/`), since it would result in an\n // incorrect regex (matching a literal `.`).\n url = joinUrls(baseHref.replace(/^\\.(?=\\/)/, ''), url);\n }\n\n return globToRegex(url, literalQuestionMark);\n}\n\nfunction joinUrls(a: string, b: string): string {\n if (a.endsWith('/') && b.startsWith('/')) {\n return a + b.slice(1);\n } else if (!a.endsWith('/') && !b.startsWith('/')) {\n return a + '/' + b;\n }\n return a + b;\n}\n\nfunction withOrderedKeys<T extends {[key: string]: any}>(unorderedObj: T): T {\n const orderedObj = {} as {[key: string]: any};\n Object.keys(unorderedObj)\n .sort()\n .forEach((key) => (orderedObj[key] = unorderedObj[key]));\n return orderedObj as T;\n}\n\nfunction buildCacheQueryOptions(\n inOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>,\n): CacheQueryOptions {\n return {\n ignoreVary: true,\n ...inOptions,\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,cAAc,GAAG,kBAAkB,CAAA;AACzC,MAAM,UAAU,GAAG,sBAAsB,CAAA;AAEnC,SAAU,iBAAiB,CAAC,QAAgB,EAAA;IAChD,MAAM,OAAO,GAAa,EAAE,CAAA;AAE5B,IAAA,IAAI,KAA6B,CAAA;AACjC,IAAA,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE;QACvD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;KACxB;AACA,IAAA,OAAO,OAAO;AACX,SAAA,GAAG,CAAC,CAAC,KAAK,KAAI;QACb,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAClC,QAAA,IAAI,GAAG,KAAK,I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,GAAG,SAAS;KACb,CAAA;AACH;;ACzMA;;ACRA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"config.mjs","sources":["../../../../../../packages/service-worker/config/src/duration.ts","../../../../../../packages/service-worker/config/src/glob.ts","../../../../../../packages/service-worker/config/src/generator.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nconst PARSE_TO_PAIRS = /([0-9]+[^0-9]+)/g;\nconst PAIR_SPLIT = /^([0-9]+)([dhmsu]+)$/;\n\nexport function parseDurationToMs(duration: string): number {\n const matches: string[] = [];\n\n let array: RegExpExecArray | null;\n while ((array = PARSE_TO_PAIRS.exec(duration)) !== null) {\n matches.push(array[0]);\n }\n return matches\n .map((match) => {\n const res = PAIR_SPLIT.exec(match);\n if (res === null) {\n throw new Error(`Not a valid duration: ${match}`);\n }\n let factor: number = 0;\n switch (res[2]) {\n case 'd':\n factor = 86400000;\n break;\n case 'h':\n factor = 3600000;\n break;\n case 'm':\n factor = 60000;\n break;\n case 's':\n factor = 1000;\n break;\n case 'u':\n factor = 1;\n break;\n default:\n throw new Error(`Not a valid duration unit: ${res[2]}`);\n }\n return parseInt(res[1]) * factor;\n })\n .reduce((total, value) => total + value, 0);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nconst QUESTION_MARK = '[^/]';\nconst WILD_SINGLE = '[^/]*';\nconst WILD_OPEN = '(?:.+\\\\/)?';\n\nconst TO_ESCAPE_BASE = [\n {replace: /\\./g, with: '\\\\.'},\n {replace: /\\+/g, with: '\\\\+'},\n {replace: /\\*/g, with: WILD_SINGLE},\n];\nconst TO_ESCAPE_WILDCARD_QM = [...TO_ESCAPE_BASE, {replace: /\\?/g, with: QUESTION_MARK}];\nconst TO_ESCAPE_LITERAL_QM = [...TO_ESCAPE_BASE, {replace: /\\?/g, with: '\\\\?'}];\n\nexport function globToRegex(glob: string, literalQuestionMark = false): string {\n const toEscape = literalQuestionMark ? TO_ESCAPE_LITERAL_QM : TO_ESCAPE_WILDCARD_QM;\n const segments = glob.split('/').reverse();\n let regex: string = '';\n while (segments.length > 0) {\n const segment = segments.pop()!;\n if (segment === '**') {\n if (segments.length > 0) {\n regex += WILD_OPEN;\n } else {\n regex += '.*';\n }\n } else {\n const processed = toEscape.reduce(\n (segment, escape) => segment.replace(escape.replace, escape.with),\n segment,\n );\n regex += processed;\n if (segments.length > 0) {\n regex += '\\\\/';\n }\n }\n }\n return regex;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {parseDurationToMs} from './duration';\nimport {Filesystem} from './filesystem';\nimport {globToRegex} from './glob';\nimport {AssetGroup, Config} from './in';\n\nconst DEFAULT_NAVIGATION_URLS = [\n '/**', // Include all URLs.\n '!/**/*.*', // Exclude URLs to files (containing a file extension in the last segment).\n '!/**/*__*', // Exclude URLs containing `__` in the last segment.\n '!/**/*__*/**', // Exclude URLs containing `__` in any other segment.\n];\n\n/**\n * Consumes service worker configuration files and processes them into control files.\n *\n * @publicApi\n */\nexport class Generator {\n constructor(\n readonly fs: Filesystem,\n private baseHref: string,\n ) {}\n\n async process(config: Config): Promise<Object> {\n const unorderedHashTable = {};\n const assetGroups = await this.processAssetGroups(config, unorderedHashTable);\n\n return {\n configVersion: 1,\n timestamp: Date.now(),\n appData: config.appData,\n index: joinUrls(this.baseHref, config.index),\n assetGroups,\n dataGroups: this.processDataGroups(config),\n hashTable: withOrderedKeys(unorderedHashTable),\n navigationUrls: processNavigationUrls(this.baseHref, config.navigationUrls),\n navigationRequestStrategy: config.navigationRequestStrategy ?? 'performance',\n applicationMaxAge: config.applicationMaxAge\n ? parseDurationToMs(config.applicationMaxAge)\n : undefined,\n };\n }\n\n private async processAssetGroups(\n config: Config,\n hashTable: {[file: string]: string | undefined},\n ): Promise<Object[]> {\n // Retrieve all files of the build.\n const allFiles = await this.fs.list('/');\n const seenMap = new Set<string>();\n const filesPerGroup = new Map<AssetGroup, string[]>();\n\n // Computed which files belong to each asset-group.\n for (const group of config.assetGroups || []) {\n if ((group.resources as any).versionedFiles) {\n throw new Error(\n `Asset-group '${group.name}' in 'ngsw-config.json' uses the 'versionedFiles' option, ` +\n \"which is no longer supported. Use 'files' instead.\",\n );\n }\n\n const fileMatcher = globListToMatcher(group.resources.files || []);\n const matchedFiles = allFiles\n .filter(fileMatcher)\n .filter((file) => !seenMap.has(file))\n .sort();\n\n matchedFiles.forEach((file) => seenMap.add(file));\n filesPerGroup.set(group, matchedFiles);\n }\n\n // Compute hashes for all matched files and add them to the hash-table.\n const allMatchedFiles = ([] as string[]).concat(...Array.from(filesPerGroup.values())).sort();\n const allMatchedHashes = await processInBatches(allMatchedFiles, 500, (file) =>\n this.fs.hash(file),\n );\n allMatchedFiles.forEach((file, idx) => {\n hashTable[joinUrls(this.baseHref, file)] = allMatchedHashes[idx];\n });\n\n // Generate and return the processed asset-groups.\n return Array.from(filesPerGroup.entries()).map(([group, matchedFiles]) => ({\n name: group.name,\n installMode: group.installMode || 'prefetch',\n updateMode: group.updateMode || group.installMode || 'prefetch',\n cacheQueryOptions: buildCacheQueryOptions(group.cacheQueryOptions),\n urls: matchedFiles.map((url) => joinUrls(this.baseHref, url)),\n patterns: (group.resources.urls || []).map((url) => urlToRegex(url, this.baseHref, true)),\n }));\n }\n\n private processDataGroups(config: Config): Object[] {\n return (config.dataGroups || []).map((group) => {\n return {\n name: group.name,\n patterns: group.urls.map((url) => urlToRegex(url, this.baseHref, true)),\n strategy: group.cacheConfig.strategy || 'performance',\n maxSize: group.cacheConfig.maxSize,\n maxAge: parseDurationToMs(group.cacheConfig.maxAge),\n timeoutMs: group.cacheConfig.timeout && parseDurationToMs(group.cacheConfig.timeout),\n refreshAheadMs:\n group.cacheConfig.refreshAhead && parseDurationToMs(group.cacheConfig.refreshAhead),\n cacheOpaqueResponses: group.cacheConfig.cacheOpaqueResponses,\n cacheQueryOptions: buildCacheQueryOptions(group.cacheQueryOptions),\n version: group.version !== undefined ? group.version : 1,\n };\n });\n }\n}\n\nexport function processNavigationUrls(\n baseHref: string,\n urls = DEFAULT_NAVIGATION_URLS,\n): {positive: boolean; regex: string}[] {\n return urls.map((url) => {\n const positive = !url.startsWith('!');\n url = positive ? url : url.slice(1);\n return {positive, regex: `^${urlToRegex(url, baseHref)}$`};\n });\n}\n\nasync function processInBatches<I, O>(\n items: I[],\n batchSize: number,\n processFn: (item: I) => O | Promise<O>,\n): Promise<O[]> {\n const batches = [];\n\n for (let i = 0; i < items.length; i += batchSize) {\n batches.push(items.slice(i, i + batchSize));\n }\n\n return batches.reduce(\n async (prev, batch) =>\n (await prev).concat(await Promise.all(batch.map((item) => processFn(item)))),\n Promise.resolve<O[]>([]),\n );\n}\n\nfunction globListToMatcher(globs: string[]): (file: string) => boolean {\n const patterns = globs.map((pattern) => {\n if (pattern.startsWith('!')) {\n return {\n positive: false,\n regex: new RegExp('^' + globToRegex(pattern.slice(1)) + '$'),\n };\n } else {\n return {\n positive: true,\n regex: new RegExp('^' + globToRegex(pattern) + '$'),\n };\n }\n });\n return (file: string) => matches(file, patterns);\n}\n\nfunction matches(file: string, patterns: {positive: boolean; regex: RegExp}[]): boolean {\n return patterns.reduce((isMatch, pattern) => {\n if (pattern.positive) {\n return isMatch || pattern.regex.test(file);\n } else {\n return isMatch && !pattern.regex.test(file);\n }\n }, false);\n}\n\nfunction urlToRegex(url: string, baseHref: string, literalQuestionMark?: boolean): string {\n if (!url.startsWith('/') && url.indexOf('://') === -1) {\n // Prefix relative URLs with `baseHref`.\n // Strip a leading `.` from a relative `baseHref` (e.g. `./foo/`), since it would result in an\n // incorrect regex (matching a literal `.`).\n url = joinUrls(baseHref.replace(/^\\.(?=\\/)/, ''), url);\n }\n\n return globToRegex(url, literalQuestionMark);\n}\n\nfunction joinUrls(a: string, b: string): string {\n if (a.endsWith('/') && b.startsWith('/')) {\n return a + b.slice(1);\n } else if (!a.endsWith('/') && !b.startsWith('/')) {\n return a + '/' + b;\n }\n return a + b;\n}\n\nfunction withOrderedKeys<T extends {[key: string]: any}>(unorderedObj: T): T {\n const orderedObj = {} as {[key: string]: any};\n Object.keys(unorderedObj)\n .sort()\n .forEach((key) => (orderedObj[key] = unorderedObj[key]));\n return orderedObj as T;\n}\n\nfunction buildCacheQueryOptions(\n inOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>,\n): CacheQueryOptions {\n return {\n ignoreVary: true,\n ...inOptions,\n };\n}\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,cAAc,GAAG,kBAAkB;AACzC,MAAM,UAAU,GAAG,sBAAsB;AAEnC,SAAU,iBAAiB,CAAC,QAAgB,EAAA;IAChD,MAAM,OAAO,GAAa,EAAE;AAE5B,IAAA,IAAI,KAA6B;AACjC,IAAA,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE;QACvD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;;AAExB,IAAA,OAAO;AACJ,SAAA,GAAG,CAAC,CAAC,KAAK,KAAI;QACb,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,GAAG,KAAK,IAAI,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,CAAA,CAAE,CAAC;;QAEnD,IAAI,MAAM,GAAW,CAAC;AACtB,QAAA,QAAQ,GAAG,CAAC,CAAC,CAAC;AACZ,YAAA,KAAK,GAAG;gBACN,MAAM,GAAG,QAAQ;gBACjB;AACF,YAAA,KAAK,GAAG;gBACN,MAAM,GAAG,OAAO;gBAChB;AACF,YAAA,KAAK,GAAG;gBACN,MAAM,GAAG,KAAK;gBACd;AACF,YAA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YAAY;AACrB,SAAA,IAAI;AACJ,SAAA,OAAO,CAAC,CAAC,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,IAAA,OAAO,UAAe;AACxB;AAEA,SAAS,sBAAsB,CAC7B,SAAmD,EAAA;IAEnD,OAAO;AACL,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,GAAG,SAAS;KACb;AACH;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v19.2.2
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { Injectable,
|
|
9
|
-
import {
|
|
8
|
+
import { Injectable, makeEnvironmentProviders, InjectionToken, Injector, APP_INITIALIZER, NgZone, ApplicationRef, NgModule } from '@angular/core';
|
|
9
|
+
import { fromEvent, defer, of, concat, throwError, Subject, NEVER, merge, from } from 'rxjs';
|
|
10
10
|
import { map, filter, switchMap, publish, take, tap, delay } from 'rxjs/operators';
|
|
11
11
|
|
|
12
12
|
const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';
|
|
@@ -268,10 +268,10 @@ class SwPush {
|
|
|
268
268
|
decodeBase64(input) {
|
|
269
269
|
return atob(input);
|
|
270
270
|
}
|
|
271
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
272
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwPush, deps: [{ token: NgswCommChannel }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
272
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwPush });
|
|
273
273
|
}
|
|
274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwPush, decorators: [{
|
|
275
275
|
type: Injectable
|
|
276
276
|
}], ctorParameters: () => [{ type: NgswCommChannel }] });
|
|
277
277
|
|
|
@@ -279,7 +279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImpor
|
|
|
279
279
|
* Subscribe to update notifications from the Service Worker, trigger update
|
|
280
280
|
* checks, and forcibly activate updates.
|
|
281
281
|
*
|
|
282
|
-
* @see {@link ecosystem/service-workers/communications Service
|
|
282
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
283
283
|
*
|
|
284
284
|
* @publicApi
|
|
285
285
|
*/
|
|
@@ -370,10 +370,10 @@ class SwUpdate {
|
|
|
370
370
|
const nonce = this.sw.generateNonce();
|
|
371
371
|
return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', { nonce }, nonce);
|
|
372
372
|
}
|
|
373
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
374
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
373
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwUpdate, deps: [{ token: NgswCommChannel }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
374
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwUpdate });
|
|
375
375
|
}
|
|
376
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SwUpdate, decorators: [{
|
|
377
377
|
type: Injectable
|
|
378
378
|
}], ctorParameters: () => [{ type: NgswCommChannel }] });
|
|
379
379
|
|
|
@@ -561,27 +561,14 @@ class ServiceWorkerModule {
|
|
|
561
561
|
providers: [provideServiceWorker(script, options)],
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
565
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.
|
|
566
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.
|
|
564
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ServiceWorkerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
565
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: ServiceWorkerModule });
|
|
566
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ServiceWorkerModule, providers: [SwPush, SwUpdate] });
|
|
567
567
|
}
|
|
568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ServiceWorkerModule, decorators: [{
|
|
569
569
|
type: NgModule,
|
|
570
570
|
args: [{ providers: [SwPush, SwUpdate] }]
|
|
571
571
|
}] });
|
|
572
572
|
|
|
573
|
-
/**
|
|
574
|
-
* @module
|
|
575
|
-
* @description
|
|
576
|
-
* Entry point for all public APIs of this package.
|
|
577
|
-
*/
|
|
578
|
-
// This file only reexports content of the `src` folder. Keep it that way.
|
|
579
|
-
|
|
580
|
-
// This file is not used to build this module. It is only used during editing
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Generated bundle index. Do not edit.
|
|
584
|
-
*/
|
|
585
|
-
|
|
586
573
|
export { ServiceWorkerModule, SwPush, SwRegistrationOptions, SwUpdate, provideServiceWorker };
|
|
587
574
|
//# sourceMappingURL=service-worker.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-worker.mjs","sources":["../../../../../../packages/service-worker/src/low_level.ts","../../../../../../packages/service-worker/src/push.ts","../../../../../../packages/service-worker/src/update.ts","../../../../../../packages/service-worker/src/provider.ts","../../../../../../packages/service-worker/src/module.ts","../../../../../../packages/service-worker/public_api.ts","../../../../../../packages/service-worker/index.ts","../../../../../../packages/service-worker/service-worker.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {concat, ConnectableObservable, defer, fromEvent, Observable, of, throwError} from 'rxjs';\nimport {filter, map, publish, switchMap, take, tap} from 'rxjs/operators';\n\nexport const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';\n\n/**\n * An event emitted when the service worker has checked the version of the app on the server and it\n * didn't find a new version that it doesn't have already downloaded.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface NoNewVersionDetectedEvent {\n type: 'NO_NEW_VERSION_DETECTED';\n version: {hash: string; appData?: Object};\n}\n\n/**\n * An event emitted when the service worker has detected a new version of the app on the server and\n * is about to start downloading it.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface VersionDetectedEvent {\n type: 'VERSION_DETECTED';\n version: {hash: string; appData?: object};\n}\n\n/**\n * An event emitted when the installation of a new version failed.\n * It may be used for logging/monitoring purposes.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface VersionInstallationFailedEvent {\n type: 'VERSION_INSTALLATION_FAILED';\n version: {hash: string; appData?: object};\n error: string;\n}\n\n/**\n * An event emitted when a new version of the app is available.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface VersionReadyEvent {\n type: 'VERSION_READY';\n currentVersion: {hash: string; appData?: object};\n latestVersion: {hash: string; appData?: object};\n}\n\n/**\n * A union of all event types that can be emitted by\n * {@link SwUpdate#versionUpdates}.\n *\n * @publicApi\n */\nexport type VersionEvent =\n | VersionDetectedEvent\n | VersionInstallationFailedEvent\n | VersionReadyEvent\n | NoNewVersionDetectedEvent;\n\n/**\n * An event emitted when the version of the app used by the service worker to serve this client is\n * in a broken state that cannot be recovered from and a full page reload is required.\n *\n * For example, the service worker may not be able to retrieve a required resource, neither from the\n * cache nor from the server. This could happen if a new version is deployed to the server and the\n * service worker cache has been partially cleaned by the browser, removing some files of a previous\n * app version but not all.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface UnrecoverableStateEvent {\n type: 'UNRECOVERABLE_STATE';\n reason: string;\n}\n\n/**\n * An event emitted when a `PushEvent` is received by the service worker.\n */\nexport interface PushEvent {\n type: 'PUSH';\n data: any;\n}\n\nexport type IncomingEvent = UnrecoverableStateEvent | VersionEvent;\n\nexport interface TypedEvent {\n type: string;\n}\n\ntype OperationCompletedEvent =\n | {\n type: 'OPERATION_COMPLETED';\n nonce: number;\n result: boolean;\n }\n | {\n type: 'OPERATION_COMPLETED';\n nonce: number;\n result?: undefined;\n error: string;\n };\n\nfunction errorObservable(message: string): Observable<any> {\n return defer(() => throwError(new Error(message)));\n}\n\n/**\n * @publicApi\n */\nexport class NgswCommChannel {\n readonly worker: Observable<ServiceWorker>;\n\n readonly registration: Observable<ServiceWorkerRegistration>;\n\n readonly events: Observable<TypedEvent>;\n\n constructor(private serviceWorker: ServiceWorkerContainer | undefined) {\n if (!serviceWorker) {\n this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED);\n } else {\n const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange');\n const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller));\n const currentController = defer(() => of(serviceWorker.controller));\n const controllerWithChanges = concat(currentController, controllerChanges);\n\n this.worker = controllerWithChanges.pipe(filter((c): c is ServiceWorker => !!c));\n\n this.registration = <Observable<ServiceWorkerRegistration>>(\n this.worker.pipe(switchMap(() => serviceWorker.getRegistration()))\n );\n\n const rawEvents = fromEvent<MessageEvent>(serviceWorker, 'message');\n const rawEventPayload = rawEvents.pipe(map((event) => event.data));\n const eventsUnconnected = rawEventPayload.pipe(filter((event) => event && event.type));\n const events = eventsUnconnected.pipe(publish()) as ConnectableObservable<IncomingEvent>;\n events.connect();\n\n this.events = events;\n }\n }\n\n postMessage(action: string, payload: Object): Promise<void> {\n return this.worker\n .pipe(\n take(1),\n tap((sw: ServiceWorker) => {\n sw.postMessage({\n action,\n ...payload,\n });\n }),\n )\n .toPromise()\n .then(() => undefined);\n }\n\n postMessageWithOperation(\n type: string,\n payload: Object,\n operationNonce: number,\n ): Promise<boolean> {\n const waitForOperationCompleted = this.waitForOperationCompleted(operationNonce);\n const postMessage = this.postMessage(type, payload);\n return Promise.all([postMessage, waitForOperationCompleted]).then(([, result]) => result);\n }\n\n generateNonce(): number {\n return Math.round(Math.random() * 10000000);\n }\n\n eventsOfType<T extends TypedEvent>(type: T['type'] | T['type'][]): Observable<T> {\n let filterFn: (event: TypedEvent) => event is T;\n if (typeof type === 'string') {\n filterFn = (event: TypedEvent): event is T => event.type === type;\n } else {\n filterFn = (event: TypedEvent): event is T => type.includes(event.type);\n }\n return this.events.pipe(filter(filterFn));\n }\n\n nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T> {\n return this.eventsOfType(type).pipe(take(1));\n }\n\n waitForOperationCompleted(nonce: number): Promise<boolean> {\n return this.eventsOfType<OperationCompletedEvent>('OPERATION_COMPLETED')\n .pipe(\n filter((event) => event.nonce === nonce),\n take(1),\n map((event) => {\n if (event.result !== undefined) {\n return event.result;\n }\n throw new Error(event.error!);\n }),\n )\n .toPromise() as Promise<boolean>;\n }\n\n get isEnabled(): boolean {\n return !!this.serviceWorker;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {merge, NEVER, Observable, Subject} from 'rxjs';\nimport {map, switchMap, take} from 'rxjs/operators';\n\nimport {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';\n\n/**\n * Subscribe and listen to\n * [Web Push\n * Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through\n * Angular Service Worker.\n *\n * @usageNotes\n *\n * You can inject a `SwPush` instance into any component or service\n * as a dependency.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"inject-sw-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission.\n * The call returns a `Promise` with a new\n * [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * instance.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * A request is rejected if the user denies permission, or if the browser\n * blocks or does not support the Push API or ServiceWorkers.\n * Check `SwPush.isEnabled` to confirm status.\n *\n * Invoke Push Notifications by pushing a message with the following payload.\n *\n * ```ts\n * {\n * \"notification\": {\n * \"actions\": NotificationAction[],\n * \"badge\": USVString,\n * \"body\": DOMString,\n * \"data\": any,\n * \"dir\": \"auto\"|\"ltr\"|\"rtl\",\n * \"icon\": USVString,\n * \"image\": USVString,\n * \"lang\": DOMString,\n * \"renotify\": boolean,\n * \"requireInteraction\": boolean,\n * \"silent\": boolean,\n * \"tag\": DOMString,\n * \"timestamp\": DOMTimeStamp,\n * \"title\": DOMString,\n * \"vibrate\": number[]\n * }\n * }\n * ```\n *\n * Only `title` is required. See `Notification`\n * [instance\n * properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties).\n *\n * While the subscription is active, Service Worker listens for\n * [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent)\n * occurrences and creates\n * [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification)\n * instances in response.\n *\n * Unsubscribe using `SwPush.unsubscribe()`.\n *\n * An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user\n * clicks on a notification. For example:\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-notification-clicks\"\n * header=\"app.component.ts\"></code-example>\n *\n * You can read more on handling notification clicks in the [Service worker notifications\n * guide](ecosystem/service-workers/push-notifications).\n *\n * @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/)\n * @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/)\n * @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API)\n * @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)\n * @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices)\n *\n * @publicApi\n */\n@Injectable()\nexport class SwPush {\n /**\n * Emits the payloads of the received push notification messages.\n */\n readonly messages: Observable<object>;\n\n /**\n * Emits the payloads of the received push notification messages as well as the action the user\n * interacted with. If no action was used the `action` property contains an empty string `''`.\n *\n * Note that the `notification` property does **not** contain a\n * [Notification][Mozilla Notification] object but rather a\n * [NotificationOptions](https://notifications.spec.whatwg.org/#dictdef-notificationoptions)\n * object that also includes the `title` of the [Notification][Mozilla Notification] object.\n *\n * [Mozilla Notification]: https://developer.mozilla.org/en-US/docs/Web/API/Notification\n */\n readonly notificationClicks: Observable<{\n action: string;\n notification: NotificationOptions & {\n title: string;\n };\n }>;\n\n /**\n * Emits the currently active\n * [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * associated to the Service Worker registration or `null` if there is no subscription.\n */\n readonly subscription: Observable<PushSubscription | null>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n private pushManager: Observable<PushManager> | null = null;\n private subscriptionChanges = new Subject<PushSubscription | null>();\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.messages = NEVER;\n this.notificationClicks = NEVER;\n this.subscription = NEVER;\n return;\n }\n\n this.messages = this.sw.eventsOfType<PushEvent>('PUSH').pipe(map((message) => message.data));\n\n this.notificationClicks = this.sw\n .eventsOfType('NOTIFICATION_CLICK')\n .pipe(map((message: any) => message.data));\n\n this.pushManager = this.sw.registration.pipe(map((registration) => registration.pushManager));\n\n const workerDrivenSubscriptions = this.pushManager.pipe(\n switchMap((pm) => pm.getSubscription()),\n );\n this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges);\n }\n\n /**\n * Subscribes to Web Push Notifications,\n * after requesting and receiving user permission.\n *\n * @param options An object containing the `serverPublicKey` string.\n * @returns A Promise that resolves to the new subscription object.\n */\n requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> {\n if (!this.sw.isEnabled || this.pushManager === null) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions: PushSubscriptionOptionsInit = {userVisibleOnly: true};\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n\n return this.pushManager\n .pipe(\n switchMap((pm) => pm.subscribe(pushOptions)),\n take(1),\n )\n .toPromise()\n .then((sub) => {\n this.subscriptionChanges.next(sub!);\n return sub!;\n });\n }\n\n /**\n * Unsubscribes from Service Worker push notifications.\n *\n * @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no\n * active subscription or the unsubscribe operation fails.\n */\n unsubscribe(): Promise<void> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n\n const doUnsubscribe = (sub: PushSubscription | null) => {\n if (sub === null) {\n throw new Error('Not subscribed to push notifications.');\n }\n\n return sub.unsubscribe().then((success) => {\n if (!success) {\n throw new Error('Unsubscribe failed!');\n }\n\n this.subscriptionChanges.next(null);\n });\n };\n\n return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();\n }\n\n private decodeBase64(input: string): string {\n return atob(input);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {NEVER, Observable} from 'rxjs';\n\nimport {\n ERR_SW_NOT_SUPPORTED,\n NgswCommChannel,\n UnrecoverableStateEvent,\n VersionEvent,\n} from './low_level';\n\n/**\n * Subscribe to update notifications from the Service Worker, trigger update\n * checks, and forcibly activate updates.\n *\n * @see {@link ecosystem/service-workers/communications Service worker communication guide}\n *\n * @publicApi\n */\n@Injectable()\nexport class SwUpdate {\n /**\n * Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.\n *\n * Emits a `VersionInstallationFailedEvent` event whenever checking for or downloading a new\n * version fails.\n *\n * Emits a `VersionReadyEvent` event whenever a new version has been downloaded and is ready for\n * activation.\n */\n readonly versionUpdates: Observable<VersionEvent>;\n\n /**\n * Emits an `UnrecoverableStateEvent` event whenever the version of the app used by the service\n * worker to serve this client is in a broken state that cannot be recovered from without a full\n * page reload.\n */\n readonly unrecoverable: Observable<UnrecoverableStateEvent>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.versionUpdates = NEVER;\n this.unrecoverable = NEVER;\n return;\n }\n this.versionUpdates = this.sw.eventsOfType<VersionEvent>([\n 'VERSION_DETECTED',\n 'VERSION_INSTALLATION_FAILED',\n 'VERSION_READY',\n 'NO_NEW_VERSION_DETECTED',\n ]);\n this.unrecoverable = this.sw.eventsOfType<UnrecoverableStateEvent>('UNRECOVERABLE_STATE');\n }\n\n /**\n * Checks for an update and waits until the new version is downloaded from the server and ready\n * for activation.\n *\n * @returns a promise that\n * - resolves to `true` if a new version was found and is ready to be activated.\n * - resolves to `false` if no new version was found\n * - rejects if any error occurs\n */\n checkForUpdate(): Promise<boolean> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('CHECK_FOR_UPDATES', {nonce}, nonce);\n }\n\n /**\n * Updates the current client (i.e. browser tab) to the latest version that is ready for\n * activation.\n *\n * In most cases, you should not use this method and instead should update a client by reloading\n * the page.\n *\n * <div class=\"docs-alert docs-alert-important\">\n *\n * Updating a client without reloading can easily result in a broken application due to a version\n * mismatch between the application shell and other page resources,\n * such as lazy-loaded chunks, whose filenames may change between\n * versions.\n *\n * Only use this method, if you are certain it is safe for your specific use case.\n *\n * </div>\n *\n * @returns a promise that\n * - resolves to `true` if an update was activated successfully\n * - resolves to `false` if no update was available (for example, the client was already on the\n * latest version).\n * - rejects if any error occurs\n */\n activateUpdate(): Promise<boolean> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', {nonce}, nonce);\n }\n}\n","/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n APP_INITIALIZER,\n ApplicationRef,\n EnvironmentProviders,\n InjectionToken,\n Injector,\n makeEnvironmentProviders,\n NgZone,\n} from '@angular/core';\nimport {merge, from, Observable, of} from 'rxjs';\nimport {delay, take} from 'rxjs/operators';\n\nimport {NgswCommChannel} from './low_level';\nimport {SwPush} from './push';\nimport {SwUpdate} from './update';\n\nexport const SCRIPT = new InjectionToken<string>(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : '');\n\nexport function ngswAppInitializer(\n injector: Injector,\n script: string,\n options: SwRegistrationOptions,\n): Function {\n return () => {\n if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n return;\n }\n\n if (!('serviceWorker' in navigator && options.enabled !== false)) {\n return;\n }\n\n const ngZone = injector.get(NgZone);\n const appRef = injector.get(ApplicationRef);\n\n // Set up the `controllerchange` event listener outside of\n // the Angular zone to avoid unnecessary change detections,\n // as this event has no impact on view updates.\n ngZone.runOutsideAngular(() => {\n // Wait for service worker controller changes, and fire an INITIALIZE action when a new SW\n // becomes active. This allows the SW to initialize itself even if there is no application\n // traffic.\n const sw = navigator.serviceWorker;\n const onControllerChange = () => sw.controller?.postMessage({action: 'INITIALIZE'});\n\n sw.addEventListener('controllerchange', onControllerChange);\n\n appRef.onDestroy(() => {\n sw.removeEventListener('controllerchange', onControllerChange);\n });\n });\n\n let readyToRegister$: Observable<unknown>;\n\n if (typeof options.registrationStrategy === 'function') {\n readyToRegister$ = options.registrationStrategy();\n } else {\n const [strategy, ...args] = (\n options.registrationStrategy || 'registerWhenStable:30000'\n ).split(':');\n\n switch (strategy) {\n case 'registerImmediately':\n readyToRegister$ = of(null);\n break;\n case 'registerWithDelay':\n readyToRegister$ = delayWithTimeout(+args[0] || 0);\n break;\n case 'registerWhenStable':\n const whenStable$ = from(injector.get(ApplicationRef).whenStable());\n readyToRegister$ = !args[0]\n ? whenStable$\n : merge(whenStable$, delayWithTimeout(+args[0]));\n break;\n default:\n // Unknown strategy.\n throw new Error(\n `Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`,\n );\n }\n }\n\n // Don't return anything to avoid blocking the application until the SW is registered.\n // Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially\n // given that some registration strategies wait for the app to stabilize).\n // Catch and log the error if SW registration fails to avoid uncaught rejection warning.\n ngZone.runOutsideAngular(() =>\n readyToRegister$\n .pipe(take(1))\n .subscribe(() =>\n navigator.serviceWorker\n .register(script, {scope: options.scope})\n .catch((err) => console.error('Service worker registration failed with:', err)),\n ),\n );\n };\n}\n\nfunction delayWithTimeout(timeout: number): Observable<unknown> {\n return of(null).pipe(delay(timeout));\n}\n\nexport function ngswCommChannelFactory(opts: SwRegistrationOptions): NgswCommChannel {\n const isBrowser = !(typeof ngServerMode !== 'undefined' && ngServerMode);\n\n return new NgswCommChannel(\n isBrowser && opts.enabled !== false ? navigator.serviceWorker : undefined,\n );\n}\n\n/**\n * Token that can be used to provide options for `ServiceWorkerModule` outside of\n * `ServiceWorkerModule.register()`.\n *\n * You can use this token to define a provider that generates the registration options at runtime,\n * for example via a function call:\n *\n * {@example service-worker/registration-options/module.ts region=\"registration-options\"\n * header=\"app.module.ts\"}\n *\n * @publicApi\n */\nexport abstract class SwRegistrationOptions {\n /**\n * Whether the ServiceWorker will be registered and the related services (such as `SwPush` and\n * `SwUpdate`) will attempt to communicate and interact with it.\n *\n * Default: true\n */\n enabled?: boolean;\n\n /**\n * A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can\n * control. It will be used when calling\n * [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n */\n scope?: string;\n\n /**\n * Defines the ServiceWorker registration strategy, which determines when it will be registered\n * with the browser.\n *\n * The default behavior of registering once the application stabilizes (i.e. as soon as there are\n * no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as\n * possible but without affecting the application's first time load.\n *\n * Still, there might be cases where you want more control over when the ServiceWorker is\n * registered (for example, there might be a long-running timeout or polling interval, preventing\n * the app from stabilizing). The available option are:\n *\n * - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending\n * micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't\n * stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous\n * task), the ServiceWorker will be registered anyway.\n * If `<timeout>` is omitted, the ServiceWorker will only be registered once the app\n * stabilizes.\n * - `registerImmediately`: Register immediately.\n * - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For\n * example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If\n * `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon\n * as possible but still asynchronously, once all pending micro-tasks are completed.\n * - An Observable factory function: A function that returns an `Observable`.\n * The function will be used at runtime to obtain and subscribe to the `Observable` and the\n * ServiceWorker will be registered as soon as the first value is emitted.\n *\n * Default: 'registerWhenStable:30000'\n */\n registrationStrategy?: string | (() => Observable<unknown>);\n}\n\n/**\n * @publicApi\n *\n * Sets up providers to register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n *\n * Example usage:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideServiceWorker('ngsw-worker.js')\n * ],\n * });\n * ```\n */\nexport function provideServiceWorker(\n script: string,\n options: SwRegistrationOptions = {},\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n SwPush,\n SwUpdate,\n {provide: SCRIPT, useValue: script},\n {provide: SwRegistrationOptions, useValue: options},\n {\n provide: NgswCommChannel,\n useFactory: ngswCommChannelFactory,\n deps: [SwRegistrationOptions],\n },\n {\n provide: APP_INITIALIZER,\n useFactory: ngswAppInitializer,\n deps: [Injector, SCRIPT, SwRegistrationOptions],\n multi: true,\n },\n ]);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ModuleWithProviders, NgModule} from '@angular/core';\n\nimport {provideServiceWorker, SwRegistrationOptions} from './provider';\nimport {SwPush} from './push';\nimport {SwUpdate} from './update';\n\n/**\n * @publicApi\n */\n@NgModule({providers: [SwPush, SwUpdate]})\nexport class ServiceWorkerModule {\n /**\n * Register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n */\n static register(\n script: string,\n options: SwRegistrationOptions = {},\n ): ModuleWithProviders<ServiceWorkerModule> {\n return {\n ngModule: ServiceWorkerModule,\n providers: [provideServiceWorker(script, options)],\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/index';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.NgswCommChannel"],"mappings":";;;;;;;;;;;AAWO,MAAM,oBAAoB,GAAG,+DAA+D,CAAA;AAgHnG,SAAS,eAAe,CAAC,OAAe,EAAA;AACtC,IAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACpD,CAAA;AAEA;;AAEG;MACU,eAAe,CAAA;AAON,IAAA,aAAA,CAAA;AANX,IAAA,MAAM,CAAA;AAEN,IAAA,YAAY,CAAA;AAEZ,IAAA,MAAM,CAAA;AAEf,IAAA,WAAA,CAAoB,aAAiD,EAAA;QAAjD,IAAa,CAAA,aAAA,GAAb,aAAa,CAAA;QAC/B,IAAI,CAAC,aAAa,EAAE;AAClB,YAAA,IAAI,C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AAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACnD,CAAA;KACH;kHAfW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;mHAAnB,mBAAmB,EAAA,CAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EADV,SAAA,EAAA,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAA,CAAA,CAAA;;sGAC3B,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAC,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC,CAAA;;;ACTzC;;;;AAIG;AAGH;;ACPA;;ACRA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"service-worker.mjs","sources":["../../../../../../packages/service-worker/src/low_level.ts","../../../../../../packages/service-worker/src/push.ts","../../../../../../packages/service-worker/src/update.ts","../../../../../../packages/service-worker/src/provider.ts","../../../../../../packages/service-worker/src/module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {concat, ConnectableObservable, defer, fromEvent, Observable, of, throwError} from 'rxjs';\nimport {filter, map, publish, switchMap, take, tap} from 'rxjs/operators';\n\nexport const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';\n\n/**\n * An event emitted when the service worker has checked the version of the app on the server and it\n * didn't find a new version that it doesn't have already downloaded.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n\n *\n * @publicApi\n */\nexport interface NoNewVersionDetectedEvent {\n type: 'NO_NEW_VERSION_DETECTED';\n version: {hash: string; appData?: Object};\n}\n\n/**\n * An event emitted when the service worker has detected a new version of the app on the server and\n * is about to start downloading it.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n\n *\n * @publicApi\n */\nexport interface VersionDetectedEvent {\n type: 'VERSION_DETECTED';\n version: {hash: string; appData?: object};\n}\n\n/**\n * An event emitted when the installation of a new version failed.\n * It may be used for logging/monitoring purposes.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n *a\n * @publicApi\n */\nexport interface VersionInstallationFailedEvent {\n type: 'VERSION_INSTALLATION_FAILED';\n version: {hash: string; appData?: object};\n error: string;\n}\n\n/**\n * An event emitted when a new version of the app is available.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n\n *\n * @publicApi\n */\nexport interface VersionReadyEvent {\n type: 'VERSION_READY';\n currentVersion: {hash: string; appData?: object};\n latestVersion: {hash: string; appData?: object};\n}\n\n/**\n * A union of all event types that can be emitted by\n * {@link SwUpdate#versionUpdates}.\n *\n * @publicApi\n */\nexport type VersionEvent =\n | VersionDetectedEvent\n | VersionInstallationFailedEvent\n | VersionReadyEvent\n | NoNewVersionDetectedEvent;\n\n/**\n * An event emitted when the version of the app used by the service worker to serve this client is\n * in a broken state that cannot be recovered from and a full page reload is required.\n *\n * For example, the service worker may not be able to retrieve a required resource, neither from the\n * cache nor from the server. This could happen if a new version is deployed to the server and the\n * service worker cache has been partially cleaned by the browser, removing some files of a previous\n * app version but not all.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n\n *\n * @publicApi\n */\nexport interface UnrecoverableStateEvent {\n type: 'UNRECOVERABLE_STATE';\n reason: string;\n}\n\n/**\n * An event emitted when a `PushEvent` is received by the service worker.\n */\nexport interface PushEvent {\n type: 'PUSH';\n data: any;\n}\n\nexport type IncomingEvent = UnrecoverableStateEvent | VersionEvent;\n\nexport interface TypedEvent {\n type: string;\n}\n\ntype OperationCompletedEvent =\n | {\n type: 'OPERATION_COMPLETED';\n nonce: number;\n result: boolean;\n }\n | {\n type: 'OPERATION_COMPLETED';\n nonce: number;\n result?: undefined;\n error: string;\n };\n\nfunction errorObservable(message: string): Observable<any> {\n return defer(() => throwError(new Error(message)));\n}\n\n/**\n * @publicApi\n */\nexport class NgswCommChannel {\n readonly worker: Observable<ServiceWorker>;\n\n readonly registration: Observable<ServiceWorkerRegistration>;\n\n readonly events: Observable<TypedEvent>;\n\n constructor(private serviceWorker: ServiceWorkerContainer | undefined) {\n if (!serviceWorker) {\n this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED);\n } else {\n const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange');\n const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller));\n const currentController = defer(() => of(serviceWorker.controller));\n const controllerWithChanges = concat(currentController, controllerChanges);\n\n this.worker = controllerWithChanges.pipe(filter((c): c is ServiceWorker => !!c));\n\n this.registration = <Observable<ServiceWorkerRegistration>>(\n this.worker.pipe(switchMap(() => serviceWorker.getRegistration()))\n );\n\n const rawEvents = fromEvent<MessageEvent>(serviceWorker, 'message');\n const rawEventPayload = rawEvents.pipe(map((event) => event.data));\n const eventsUnconnected = rawEventPayload.pipe(filter((event) => event && event.type));\n const events = eventsUnconnected.pipe(publish()) as ConnectableObservable<IncomingEvent>;\n events.connect();\n\n this.events = events;\n }\n }\n\n postMessage(action: string, payload: Object): Promise<void> {\n return this.worker\n .pipe(\n take(1),\n tap((sw: ServiceWorker) => {\n sw.postMessage({\n action,\n ...payload,\n });\n }),\n )\n .toPromise()\n .then(() => undefined);\n }\n\n postMessageWithOperation(\n type: string,\n payload: Object,\n operationNonce: number,\n ): Promise<boolean> {\n const waitForOperationCompleted = this.waitForOperationCompleted(operationNonce);\n const postMessage = this.postMessage(type, payload);\n return Promise.all([postMessage, waitForOperationCompleted]).then(([, result]) => result);\n }\n\n generateNonce(): number {\n return Math.round(Math.random() * 10000000);\n }\n\n eventsOfType<T extends TypedEvent>(type: T['type'] | T['type'][]): Observable<T> {\n let filterFn: (event: TypedEvent) => event is T;\n if (typeof type === 'string') {\n filterFn = (event: TypedEvent): event is T => event.type === type;\n } else {\n filterFn = (event: TypedEvent): event is T => type.includes(event.type);\n }\n return this.events.pipe(filter(filterFn));\n }\n\n nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T> {\n return this.eventsOfType(type).pipe(take(1));\n }\n\n waitForOperationCompleted(nonce: number): Promise<boolean> {\n return this.eventsOfType<OperationCompletedEvent>('OPERATION_COMPLETED')\n .pipe(\n filter((event) => event.nonce === nonce),\n take(1),\n map((event) => {\n if (event.result !== undefined) {\n return event.result;\n }\n throw new Error(event.error!);\n }),\n )\n .toPromise() as Promise<boolean>;\n }\n\n get isEnabled(): boolean {\n return !!this.serviceWorker;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {merge, NEVER, Observable, Subject} from 'rxjs';\nimport {map, switchMap, take} from 'rxjs/operators';\n\nimport {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';\n\n/**\n * Subscribe and listen to\n * [Web Push\n * Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through\n * Angular Service Worker.\n *\n * @usageNotes\n *\n * You can inject a `SwPush` instance into any component or service\n * as a dependency.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"inject-sw-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission.\n * The call returns a `Promise` with a new\n * [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * instance.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * A request is rejected if the user denies permission, or if the browser\n * blocks or does not support the Push API or ServiceWorkers.\n * Check `SwPush.isEnabled` to confirm status.\n *\n * Invoke Push Notifications by pushing a message with the following payload.\n *\n * ```ts\n * {\n * \"notification\": {\n * \"actions\": NotificationAction[],\n * \"badge\": USVString,\n * \"body\": DOMString,\n * \"data\": any,\n * \"dir\": \"auto\"|\"ltr\"|\"rtl\",\n * \"icon\": USVString,\n * \"image\": USVString,\n * \"lang\": DOMString,\n * \"renotify\": boolean,\n * \"requireInteraction\": boolean,\n * \"silent\": boolean,\n * \"tag\": DOMString,\n * \"timestamp\": DOMTimeStamp,\n * \"title\": DOMString,\n * \"vibrate\": number[]\n * }\n * }\n * ```\n *\n * Only `title` is required. See `Notification`\n * [instance\n * properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties).\n *\n * While the subscription is active, Service Worker listens for\n * [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent)\n * occurrences and creates\n * [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification)\n * instances in response.\n *\n * Unsubscribe using `SwPush.unsubscribe()`.\n *\n * An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user\n * clicks on a notification. For example:\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-notification-clicks\"\n * header=\"app.component.ts\"></code-example>\n *\n * You can read more on handling notification clicks in the [Service worker notifications\n * guide](ecosystem/service-workers/push-notifications).\n *\n * @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/)\n * @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/)\n * @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API)\n * @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)\n * @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices)\n *\n * @publicApi\n */\n@Injectable()\nexport class SwPush {\n /**\n * Emits the payloads of the received push notification messages.\n */\n readonly messages: Observable<object>;\n\n /**\n * Emits the payloads of the received push notification messages as well as the action the user\n * interacted with. If no action was used the `action` property contains an empty string `''`.\n *\n * Note that the `notification` property does **not** contain a\n * [Notification][Mozilla Notification] object but rather a\n * [NotificationOptions](https://notifications.spec.whatwg.org/#dictdef-notificationoptions)\n * object that also includes the `title` of the [Notification][Mozilla Notification] object.\n *\n * [Mozilla Notification]: https://developer.mozilla.org/en-US/docs/Web/API/Notification\n */\n readonly notificationClicks: Observable<{\n action: string;\n notification: NotificationOptions & {\n title: string;\n };\n }>;\n\n /**\n * Emits the currently active\n * [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * associated to the Service Worker registration or `null` if there is no subscription.\n */\n readonly subscription: Observable<PushSubscription | null>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n private pushManager: Observable<PushManager> | null = null;\n private subscriptionChanges = new Subject<PushSubscription | null>();\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.messages = NEVER;\n this.notificationClicks = NEVER;\n this.subscription = NEVER;\n return;\n }\n\n this.messages = this.sw.eventsOfType<PushEvent>('PUSH').pipe(map((message) => message.data));\n\n this.notificationClicks = this.sw\n .eventsOfType('NOTIFICATION_CLICK')\n .pipe(map((message: any) => message.data));\n\n this.pushManager = this.sw.registration.pipe(map((registration) => registration.pushManager));\n\n const workerDrivenSubscriptions = this.pushManager.pipe(\n switchMap((pm) => pm.getSubscription()),\n );\n this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges);\n }\n\n /**\n * Subscribes to Web Push Notifications,\n * after requesting and receiving user permission.\n *\n * @param options An object containing the `serverPublicKey` string.\n * @returns A Promise that resolves to the new subscription object.\n */\n requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> {\n if (!this.sw.isEnabled || this.pushManager === null) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions: PushSubscriptionOptionsInit = {userVisibleOnly: true};\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n\n return this.pushManager\n .pipe(\n switchMap((pm) => pm.subscribe(pushOptions)),\n take(1),\n )\n .toPromise()\n .then((sub) => {\n this.subscriptionChanges.next(sub!);\n return sub!;\n });\n }\n\n /**\n * Unsubscribes from Service Worker push notifications.\n *\n * @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no\n * active subscription or the unsubscribe operation fails.\n */\n unsubscribe(): Promise<void> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n\n const doUnsubscribe = (sub: PushSubscription | null) => {\n if (sub === null) {\n throw new Error('Not subscribed to push notifications.');\n }\n\n return sub.unsubscribe().then((success) => {\n if (!success) {\n throw new Error('Unsubscribe failed!');\n }\n\n this.subscriptionChanges.next(null);\n });\n };\n\n return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();\n }\n\n private decodeBase64(input: string): string {\n return atob(input);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {NEVER, Observable} from 'rxjs';\n\nimport {\n ERR_SW_NOT_SUPPORTED,\n NgswCommChannel,\n UnrecoverableStateEvent,\n VersionEvent,\n} from './low_level';\n\n/**\n * Subscribe to update notifications from the Service Worker, trigger update\n * checks, and forcibly activate updates.\n *\n * @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}\n *\n * @publicApi\n */\n@Injectable()\nexport class SwUpdate {\n /**\n * Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.\n *\n * Emits a `VersionInstallationFailedEvent` event whenever checking for or downloading a new\n * version fails.\n *\n * Emits a `VersionReadyEvent` event whenever a new version has been downloaded and is ready for\n * activation.\n */\n readonly versionUpdates: Observable<VersionEvent>;\n\n /**\n * Emits an `UnrecoverableStateEvent` event whenever the version of the app used by the service\n * worker to serve this client is in a broken state that cannot be recovered from without a full\n * page reload.\n */\n readonly unrecoverable: Observable<UnrecoverableStateEvent>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.versionUpdates = NEVER;\n this.unrecoverable = NEVER;\n return;\n }\n this.versionUpdates = this.sw.eventsOfType<VersionEvent>([\n 'VERSION_DETECTED',\n 'VERSION_INSTALLATION_FAILED',\n 'VERSION_READY',\n 'NO_NEW_VERSION_DETECTED',\n ]);\n this.unrecoverable = this.sw.eventsOfType<UnrecoverableStateEvent>('UNRECOVERABLE_STATE');\n }\n\n /**\n * Checks for an update and waits until the new version is downloaded from the server and ready\n * for activation.\n *\n * @returns a promise that\n * - resolves to `true` if a new version was found and is ready to be activated.\n * - resolves to `false` if no new version was found\n * - rejects if any error occurs\n */\n checkForUpdate(): Promise<boolean> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('CHECK_FOR_UPDATES', {nonce}, nonce);\n }\n\n /**\n * Updates the current client (i.e. browser tab) to the latest version that is ready for\n * activation.\n *\n * In most cases, you should not use this method and instead should update a client by reloading\n * the page.\n *\n * <div class=\"docs-alert docs-alert-important\">\n *\n * Updating a client without reloading can easily result in a broken application due to a version\n * mismatch between the application shell and other page resources,\n * such as lazy-loaded chunks, whose filenames may change between\n * versions.\n *\n * Only use this method, if you are certain it is safe for your specific use case.\n *\n * </div>\n *\n * @returns a promise that\n * - resolves to `true` if an update was activated successfully\n * - resolves to `false` if no update was available (for example, the client was already on the\n * latest version).\n * - rejects if any error occurs\n */\n activateUpdate(): Promise<boolean> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', {nonce}, nonce);\n }\n}\n","/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n APP_INITIALIZER,\n ApplicationRef,\n EnvironmentProviders,\n InjectionToken,\n Injector,\n makeEnvironmentProviders,\n NgZone,\n} from '@angular/core';\nimport {merge, from, Observable, of} from 'rxjs';\nimport {delay, take} from 'rxjs/operators';\n\nimport {NgswCommChannel} from './low_level';\nimport {SwPush} from './push';\nimport {SwUpdate} from './update';\n\nexport const SCRIPT = new InjectionToken<string>(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : '');\n\nexport function ngswAppInitializer(\n injector: Injector,\n script: string,\n options: SwRegistrationOptions,\n): Function {\n return () => {\n if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n return;\n }\n\n if (!('serviceWorker' in navigator && options.enabled !== false)) {\n return;\n }\n\n const ngZone = injector.get(NgZone);\n const appRef = injector.get(ApplicationRef);\n\n // Set up the `controllerchange` event listener outside of\n // the Angular zone to avoid unnecessary change detections,\n // as this event has no impact on view updates.\n ngZone.runOutsideAngular(() => {\n // Wait for service worker controller changes, and fire an INITIALIZE action when a new SW\n // becomes active. This allows the SW to initialize itself even if there is no application\n // traffic.\n const sw = navigator.serviceWorker;\n const onControllerChange = () => sw.controller?.postMessage({action: 'INITIALIZE'});\n\n sw.addEventListener('controllerchange', onControllerChange);\n\n appRef.onDestroy(() => {\n sw.removeEventListener('controllerchange', onControllerChange);\n });\n });\n\n let readyToRegister$: Observable<unknown>;\n\n if (typeof options.registrationStrategy === 'function') {\n readyToRegister$ = options.registrationStrategy();\n } else {\n const [strategy, ...args] = (\n options.registrationStrategy || 'registerWhenStable:30000'\n ).split(':');\n\n switch (strategy) {\n case 'registerImmediately':\n readyToRegister$ = of(null);\n break;\n case 'registerWithDelay':\n readyToRegister$ = delayWithTimeout(+args[0] || 0);\n break;\n case 'registerWhenStable':\n const whenStable$ = from(injector.get(ApplicationRef).whenStable());\n readyToRegister$ = !args[0]\n ? whenStable$\n : merge(whenStable$, delayWithTimeout(+args[0]));\n break;\n default:\n // Unknown strategy.\n throw new Error(\n `Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`,\n );\n }\n }\n\n // Don't return anything to avoid blocking the application until the SW is registered.\n // Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially\n // given that some registration strategies wait for the app to stabilize).\n // Catch and log the error if SW registration fails to avoid uncaught rejection warning.\n ngZone.runOutsideAngular(() =>\n readyToRegister$\n .pipe(take(1))\n .subscribe(() =>\n navigator.serviceWorker\n .register(script, {scope: options.scope})\n .catch((err) => console.error('Service worker registration failed with:', err)),\n ),\n );\n };\n}\n\nfunction delayWithTimeout(timeout: number): Observable<unknown> {\n return of(null).pipe(delay(timeout));\n}\n\nexport function ngswCommChannelFactory(opts: SwRegistrationOptions): NgswCommChannel {\n const isBrowser = !(typeof ngServerMode !== 'undefined' && ngServerMode);\n\n return new NgswCommChannel(\n isBrowser && opts.enabled !== false ? navigator.serviceWorker : undefined,\n );\n}\n\n/**\n * Token that can be used to provide options for `ServiceWorkerModule` outside of\n * `ServiceWorkerModule.register()`.\n *\n * You can use this token to define a provider that generates the registration options at runtime,\n * for example via a function call:\n *\n * {@example service-worker/registration-options/module.ts region=\"registration-options\"\n * header=\"app.module.ts\"}\n *\n * @publicApi\n */\nexport abstract class SwRegistrationOptions {\n /**\n * Whether the ServiceWorker will be registered and the related services (such as `SwPush` and\n * `SwUpdate`) will attempt to communicate and interact with it.\n *\n * Default: true\n */\n enabled?: boolean;\n\n /**\n * A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can\n * control. It will be used when calling\n * [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n */\n scope?: string;\n\n /**\n * Defines the ServiceWorker registration strategy, which determines when it will be registered\n * with the browser.\n *\n * The default behavior of registering once the application stabilizes (i.e. as soon as there are\n * no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as\n * possible but without affecting the application's first time load.\n *\n * Still, there might be cases where you want more control over when the ServiceWorker is\n * registered (for example, there might be a long-running timeout or polling interval, preventing\n * the app from stabilizing). The available option are:\n *\n * - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending\n * micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't\n * stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous\n * task), the ServiceWorker will be registered anyway.\n * If `<timeout>` is omitted, the ServiceWorker will only be registered once the app\n * stabilizes.\n * - `registerImmediately`: Register immediately.\n * - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For\n * example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If\n * `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon\n * as possible but still asynchronously, once all pending micro-tasks are completed.\n * - An Observable factory function: A function that returns an `Observable`.\n * The function will be used at runtime to obtain and subscribe to the `Observable` and the\n * ServiceWorker will be registered as soon as the first value is emitted.\n *\n * Default: 'registerWhenStable:30000'\n */\n registrationStrategy?: string | (() => Observable<unknown>);\n}\n\n/**\n * @publicApi\n *\n * Sets up providers to register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n *\n * Example usage:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideServiceWorker('ngsw-worker.js')\n * ],\n * });\n * ```\n */\nexport function provideServiceWorker(\n script: string,\n options: SwRegistrationOptions = {},\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n SwPush,\n SwUpdate,\n {provide: SCRIPT, useValue: script},\n {provide: SwRegistrationOptions, useValue: options},\n {\n provide: NgswCommChannel,\n useFactory: ngswCommChannelFactory,\n deps: [SwRegistrationOptions],\n },\n {\n provide: APP_INITIALIZER,\n useFactory: ngswAppInitializer,\n deps: [Injector, SCRIPT, SwRegistrationOptions],\n multi: true,\n },\n ]);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ModuleWithProviders, NgModule} from '@angular/core';\n\nimport {provideServiceWorker, SwRegistrationOptions} from './provider';\nimport {SwPush} from './push';\nimport {SwUpdate} from './update';\n\n/**\n * @publicApi\n */\n@NgModule({providers: [SwPush, SwUpdate]})\nexport class ServiceWorkerModule {\n /**\n * Register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n */\n static register(\n script: string,\n options: SwRegistrationOptions = {},\n ): ModuleWithProviders<ServiceWorkerModule> {\n return {\n ngModule: ServiceWorkerModule,\n providers: [provideServiceWorker(script, options)],\n };\n }\n}\n"],"names":["i1.NgswCommChannel"],"mappings":";;;;;;;;;;;AAWO,MAAM,oBAAoB,GAAG,+DAA+D;AAoHnG,SAAS,eAAe,CAAC,OAAe,EAAA;AACtC,IAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD;AAEA;;AAEG;MACU,eAAe,CAAA;AAON,IAAA,aAAA;AANX,IAAA,MAAM;AAEN,IAAA,YAAY;AAEZ,IAAA,MAAM;AAEf,IAAA,WAAA,CAAoB,aAAiD,EAAA;QAAjD,IAAa,CAAA,aAAA,GAAb,aAAa;QAC/B,IAAI,CAAC,aAAa,EAAE;AAClB,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,G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AAC;AAC/C,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACF,KAAA,CAAC;AACJ;;AC1MA;;AAEG;MAEU,mBAAmB,CAAA;AAC9B;;;;;AAKG;AACH,IAAA,OAAO,QAAQ,CACb,MAAc,EACd,UAAiC,EAAE,EAAA;QAEnC,OAAO;AACL,YAAA,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACnD;;kHAdQ,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;mHAAnB,mBAAmB,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EADV,SAAA,EAAA,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAA,CAAA;;sGAC3B,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAC,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC;;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,15 +1,108 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v19.2.2
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { EnvironmentProviders } from '@angular/core';
|
|
9
|
-
import * as i0 from '@angular/core';
|
|
10
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
11
7
|
import { Observable } from 'rxjs';
|
|
8
|
+
import * as i0 from '@angular/core';
|
|
9
|
+
import { EnvironmentProviders, ModuleWithProviders } from '@angular/core';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An event emitted when the service worker has checked the version of the app on the server and it
|
|
13
|
+
* didn't find a new version that it doesn't have already downloaded.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
16
|
+
|
|
17
|
+
*
|
|
18
|
+
* @publicApi
|
|
19
|
+
*/
|
|
20
|
+
interface NoNewVersionDetectedEvent {
|
|
21
|
+
type: 'NO_NEW_VERSION_DETECTED';
|
|
22
|
+
version: {
|
|
23
|
+
hash: string;
|
|
24
|
+
appData?: Object;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* An event emitted when the service worker has detected a new version of the app on the server and
|
|
29
|
+
* is about to start downloading it.
|
|
30
|
+
*
|
|
31
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
32
|
+
|
|
33
|
+
*
|
|
34
|
+
* @publicApi
|
|
35
|
+
*/
|
|
36
|
+
interface VersionDetectedEvent {
|
|
37
|
+
type: 'VERSION_DETECTED';
|
|
38
|
+
version: {
|
|
39
|
+
hash: string;
|
|
40
|
+
appData?: object;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* An event emitted when the installation of a new version failed.
|
|
45
|
+
* It may be used for logging/monitoring purposes.
|
|
46
|
+
*
|
|
47
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
48
|
+
*a
|
|
49
|
+
* @publicApi
|
|
50
|
+
*/
|
|
51
|
+
interface VersionInstallationFailedEvent {
|
|
52
|
+
type: 'VERSION_INSTALLATION_FAILED';
|
|
53
|
+
version: {
|
|
54
|
+
hash: string;
|
|
55
|
+
appData?: object;
|
|
56
|
+
};
|
|
57
|
+
error: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* An event emitted when a new version of the app is available.
|
|
61
|
+
*
|
|
62
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
63
|
+
|
|
64
|
+
*
|
|
65
|
+
* @publicApi
|
|
66
|
+
*/
|
|
67
|
+
interface VersionReadyEvent {
|
|
68
|
+
type: 'VERSION_READY';
|
|
69
|
+
currentVersion: {
|
|
70
|
+
hash: string;
|
|
71
|
+
appData?: object;
|
|
72
|
+
};
|
|
73
|
+
latestVersion: {
|
|
74
|
+
hash: string;
|
|
75
|
+
appData?: object;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A union of all event types that can be emitted by
|
|
80
|
+
* {@link SwUpdate#versionUpdates}.
|
|
81
|
+
*
|
|
82
|
+
* @publicApi
|
|
83
|
+
*/
|
|
84
|
+
type VersionEvent = VersionDetectedEvent | VersionInstallationFailedEvent | VersionReadyEvent | NoNewVersionDetectedEvent;
|
|
85
|
+
/**
|
|
86
|
+
* An event emitted when the version of the app used by the service worker to serve this client is
|
|
87
|
+
* in a broken state that cannot be recovered from and a full page reload is required.
|
|
88
|
+
*
|
|
89
|
+
* For example, the service worker may not be able to retrieve a required resource, neither from the
|
|
90
|
+
* cache nor from the server. This could happen if a new version is deployed to the server and the
|
|
91
|
+
* service worker cache has been partially cleaned by the browser, removing some files of a previous
|
|
92
|
+
* app version but not all.
|
|
93
|
+
*
|
|
94
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
12
95
|
|
|
96
|
+
*
|
|
97
|
+
* @publicApi
|
|
98
|
+
*/
|
|
99
|
+
interface UnrecoverableStateEvent {
|
|
100
|
+
type: 'UNRECOVERABLE_STATE';
|
|
101
|
+
reason: string;
|
|
102
|
+
}
|
|
103
|
+
interface TypedEvent {
|
|
104
|
+
type: string;
|
|
105
|
+
}
|
|
13
106
|
/**
|
|
14
107
|
* @publicApi
|
|
15
108
|
*/
|
|
@@ -28,22 +121,71 @@ declare class NgswCommChannel {
|
|
|
28
121
|
get isEnabled(): boolean;
|
|
29
122
|
}
|
|
30
123
|
|
|
124
|
+
/*!
|
|
125
|
+
* @license
|
|
126
|
+
* Copyright Google LLC All Rights Reserved.
|
|
127
|
+
*
|
|
128
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
129
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
130
|
+
*/
|
|
131
|
+
|
|
31
132
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
133
|
+
* Token that can be used to provide options for `ServiceWorkerModule` outside of
|
|
134
|
+
* `ServiceWorkerModule.register()`.
|
|
34
135
|
*
|
|
35
|
-
*
|
|
136
|
+
* You can use this token to define a provider that generates the registration options at runtime,
|
|
137
|
+
* for example via a function call:
|
|
138
|
+
*
|
|
139
|
+
* {@example service-worker/registration-options/module.ts region="registration-options"
|
|
140
|
+
* header="app.module.ts"}
|
|
36
141
|
*
|
|
37
142
|
* @publicApi
|
|
38
143
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
144
|
+
declare abstract class SwRegistrationOptions {
|
|
145
|
+
/**
|
|
146
|
+
* Whether the ServiceWorker will be registered and the related services (such as `SwPush` and
|
|
147
|
+
* `SwUpdate`) will attempt to communicate and interact with it.
|
|
148
|
+
*
|
|
149
|
+
* Default: true
|
|
150
|
+
*/
|
|
151
|
+
enabled?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can
|
|
154
|
+
* control. It will be used when calling
|
|
155
|
+
* [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
|
|
156
|
+
*/
|
|
157
|
+
scope?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Defines the ServiceWorker registration strategy, which determines when it will be registered
|
|
160
|
+
* with the browser.
|
|
161
|
+
*
|
|
162
|
+
* The default behavior of registering once the application stabilizes (i.e. as soon as there are
|
|
163
|
+
* no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as
|
|
164
|
+
* possible but without affecting the application's first time load.
|
|
165
|
+
*
|
|
166
|
+
* Still, there might be cases where you want more control over when the ServiceWorker is
|
|
167
|
+
* registered (for example, there might be a long-running timeout or polling interval, preventing
|
|
168
|
+
* the app from stabilizing). The available option are:
|
|
169
|
+
*
|
|
170
|
+
* - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending
|
|
171
|
+
* micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't
|
|
172
|
+
* stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous
|
|
173
|
+
* task), the ServiceWorker will be registered anyway.
|
|
174
|
+
* If `<timeout>` is omitted, the ServiceWorker will only be registered once the app
|
|
175
|
+
* stabilizes.
|
|
176
|
+
* - `registerImmediately`: Register immediately.
|
|
177
|
+
* - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For
|
|
178
|
+
* example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If
|
|
179
|
+
* `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon
|
|
180
|
+
* as possible but still asynchronously, once all pending micro-tasks are completed.
|
|
181
|
+
* - An Observable factory function: A function that returns an `Observable`.
|
|
182
|
+
* The function will be used at runtime to obtain and subscribe to the `Observable` and the
|
|
183
|
+
* ServiceWorker will be registered as soon as the first value is emitted.
|
|
184
|
+
*
|
|
185
|
+
* Default: 'registerWhenStable:30000'
|
|
186
|
+
*/
|
|
187
|
+
registrationStrategy?: string | (() => Observable<unknown>);
|
|
45
188
|
}
|
|
46
|
-
|
|
47
189
|
/**
|
|
48
190
|
* @publicApi
|
|
49
191
|
*
|
|
@@ -61,12 +203,12 @@ export declare interface NoNewVersionDetectedEvent {
|
|
|
61
203
|
* });
|
|
62
204
|
* ```
|
|
63
205
|
*/
|
|
64
|
-
|
|
206
|
+
declare function provideServiceWorker(script: string, options?: SwRegistrationOptions): EnvironmentProviders;
|
|
65
207
|
|
|
66
208
|
/**
|
|
67
209
|
* @publicApi
|
|
68
210
|
*/
|
|
69
|
-
|
|
211
|
+
declare class ServiceWorkerModule {
|
|
70
212
|
/**
|
|
71
213
|
* Register the given Angular Service Worker script.
|
|
72
214
|
*
|
|
@@ -158,7 +300,7 @@ export declare class ServiceWorkerModule {
|
|
|
158
300
|
*
|
|
159
301
|
* @publicApi
|
|
160
302
|
*/
|
|
161
|
-
|
|
303
|
+
declare class SwPush {
|
|
162
304
|
private sw;
|
|
163
305
|
/**
|
|
164
306
|
* Emits the payloads of the received push notification messages.
|
|
@@ -217,73 +359,15 @@ export declare class SwPush {
|
|
|
217
359
|
static ɵprov: i0.ɵɵInjectableDeclaration<SwPush>;
|
|
218
360
|
}
|
|
219
361
|
|
|
220
|
-
/**
|
|
221
|
-
* Token that can be used to provide options for `ServiceWorkerModule` outside of
|
|
222
|
-
* `ServiceWorkerModule.register()`.
|
|
223
|
-
*
|
|
224
|
-
* You can use this token to define a provider that generates the registration options at runtime,
|
|
225
|
-
* for example via a function call:
|
|
226
|
-
*
|
|
227
|
-
* {@example service-worker/registration-options/module.ts region="registration-options"
|
|
228
|
-
* header="app.module.ts"}
|
|
229
|
-
*
|
|
230
|
-
* @publicApi
|
|
231
|
-
*/
|
|
232
|
-
export declare abstract class SwRegistrationOptions {
|
|
233
|
-
/**
|
|
234
|
-
* Whether the ServiceWorker will be registered and the related services (such as `SwPush` and
|
|
235
|
-
* `SwUpdate`) will attempt to communicate and interact with it.
|
|
236
|
-
*
|
|
237
|
-
* Default: true
|
|
238
|
-
*/
|
|
239
|
-
enabled?: boolean;
|
|
240
|
-
/**
|
|
241
|
-
* A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can
|
|
242
|
-
* control. It will be used when calling
|
|
243
|
-
* [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
|
|
244
|
-
*/
|
|
245
|
-
scope?: string;
|
|
246
|
-
/**
|
|
247
|
-
* Defines the ServiceWorker registration strategy, which determines when it will be registered
|
|
248
|
-
* with the browser.
|
|
249
|
-
*
|
|
250
|
-
* The default behavior of registering once the application stabilizes (i.e. as soon as there are
|
|
251
|
-
* no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as
|
|
252
|
-
* possible but without affecting the application's first time load.
|
|
253
|
-
*
|
|
254
|
-
* Still, there might be cases where you want more control over when the ServiceWorker is
|
|
255
|
-
* registered (for example, there might be a long-running timeout or polling interval, preventing
|
|
256
|
-
* the app from stabilizing). The available option are:
|
|
257
|
-
*
|
|
258
|
-
* - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending
|
|
259
|
-
* micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't
|
|
260
|
-
* stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous
|
|
261
|
-
* task), the ServiceWorker will be registered anyway.
|
|
262
|
-
* If `<timeout>` is omitted, the ServiceWorker will only be registered once the app
|
|
263
|
-
* stabilizes.
|
|
264
|
-
* - `registerImmediately`: Register immediately.
|
|
265
|
-
* - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For
|
|
266
|
-
* example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If
|
|
267
|
-
* `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon
|
|
268
|
-
* as possible but still asynchronously, once all pending micro-tasks are completed.
|
|
269
|
-
* - An Observable factory function: A function that returns an `Observable`.
|
|
270
|
-
* The function will be used at runtime to obtain and subscribe to the `Observable` and the
|
|
271
|
-
* ServiceWorker will be registered as soon as the first value is emitted.
|
|
272
|
-
*
|
|
273
|
-
* Default: 'registerWhenStable:30000'
|
|
274
|
-
*/
|
|
275
|
-
registrationStrategy?: string | (() => Observable<unknown>);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
362
|
/**
|
|
279
363
|
* Subscribe to update notifications from the Service Worker, trigger update
|
|
280
364
|
* checks, and forcibly activate updates.
|
|
281
365
|
*
|
|
282
|
-
* @see {@link ecosystem/service-workers/communications Service
|
|
366
|
+
* @see {@link /ecosystem/service-workers/communications Service Worker Communication Guide}
|
|
283
367
|
*
|
|
284
368
|
* @publicApi
|
|
285
369
|
*/
|
|
286
|
-
|
|
370
|
+
declare class SwUpdate {
|
|
287
371
|
private sw;
|
|
288
372
|
/**
|
|
289
373
|
* Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.
|
|
@@ -346,86 +430,4 @@ export declare class SwUpdate {
|
|
|
346
430
|
static ɵprov: i0.ɵɵInjectableDeclaration<SwUpdate>;
|
|
347
431
|
}
|
|
348
432
|
|
|
349
|
-
|
|
350
|
-
type: string;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* An event emitted when the version of the app used by the service worker to serve this client is
|
|
355
|
-
* in a broken state that cannot be recovered from and a full page reload is required.
|
|
356
|
-
*
|
|
357
|
-
* For example, the service worker may not be able to retrieve a required resource, neither from the
|
|
358
|
-
* cache nor from the server. This could happen if a new version is deployed to the server and the
|
|
359
|
-
* service worker cache has been partially cleaned by the browser, removing some files of a previous
|
|
360
|
-
* app version but not all.
|
|
361
|
-
*
|
|
362
|
-
* @see {@link ecosystem/service-workers/communications Service worker communication guide}
|
|
363
|
-
*
|
|
364
|
-
* @publicApi
|
|
365
|
-
*/
|
|
366
|
-
export declare interface UnrecoverableStateEvent {
|
|
367
|
-
type: 'UNRECOVERABLE_STATE';
|
|
368
|
-
reason: string;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* An event emitted when the service worker has detected a new version of the app on the server and
|
|
373
|
-
* is about to start downloading it.
|
|
374
|
-
*
|
|
375
|
-
* @see {@link ecosystem/service-workers/communications Service worker communication guide}
|
|
376
|
-
*
|
|
377
|
-
* @publicApi
|
|
378
|
-
*/
|
|
379
|
-
export declare interface VersionDetectedEvent {
|
|
380
|
-
type: 'VERSION_DETECTED';
|
|
381
|
-
version: {
|
|
382
|
-
hash: string;
|
|
383
|
-
appData?: object;
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* A union of all event types that can be emitted by
|
|
389
|
-
* {@link SwUpdate#versionUpdates}.
|
|
390
|
-
*
|
|
391
|
-
* @publicApi
|
|
392
|
-
*/
|
|
393
|
-
export declare type VersionEvent = VersionDetectedEvent | VersionInstallationFailedEvent | VersionReadyEvent | NoNewVersionDetectedEvent;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* An event emitted when the installation of a new version failed.
|
|
397
|
-
* It may be used for logging/monitoring purposes.
|
|
398
|
-
*
|
|
399
|
-
* @see {@link ecosystem/service-workers/communications Service worker communication guide}
|
|
400
|
-
*
|
|
401
|
-
* @publicApi
|
|
402
|
-
*/
|
|
403
|
-
export declare interface VersionInstallationFailedEvent {
|
|
404
|
-
type: 'VERSION_INSTALLATION_FAILED';
|
|
405
|
-
version: {
|
|
406
|
-
hash: string;
|
|
407
|
-
appData?: object;
|
|
408
|
-
};
|
|
409
|
-
error: string;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* An event emitted when a new version of the app is available.
|
|
414
|
-
*
|
|
415
|
-
* @see {@link ecosystem/service-workers/communications Service worker communication guide}
|
|
416
|
-
*
|
|
417
|
-
* @publicApi
|
|
418
|
-
*/
|
|
419
|
-
export declare interface VersionReadyEvent {
|
|
420
|
-
type: 'VERSION_READY';
|
|
421
|
-
currentVersion: {
|
|
422
|
-
hash: string;
|
|
423
|
-
appData?: object;
|
|
424
|
-
};
|
|
425
|
-
latestVersion: {
|
|
426
|
-
hash: string;
|
|
427
|
-
appData?: object;
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
export { }
|
|
433
|
+
export { type NoNewVersionDetectedEvent, ServiceWorkerModule, SwPush, SwRegistrationOptions, SwUpdate, type UnrecoverableStateEvent, type VersionDetectedEvent, type VersionEvent, type VersionInstallationFailedEvent, type VersionReadyEvent, provideServiceWorker };
|
package/ngsw-config.js
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
const require = __cjsCompatRequire(import.meta.url);
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
// bazel-out/
|
|
7
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/main.mjs
|
|
8
8
|
import { Generator } from "@angular/service-worker/config";
|
|
9
9
|
import * as fs2 from "fs";
|
|
10
10
|
import * as path2 from "path";
|
|
11
11
|
|
|
12
|
-
// bazel-out/
|
|
12
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/filesystem.mjs
|
|
13
13
|
import * as fs from "fs";
|
|
14
14
|
import * as path from "path";
|
|
15
15
|
|
|
16
|
-
// bazel-out/
|
|
16
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/sha1.mjs
|
|
17
17
|
function sha1Binary(buffer) {
|
|
18
18
|
const words32 = arrayBufferToWords32(buffer, Endian.Big);
|
|
19
19
|
return _sha1(words32, buffer.byteLength * 8);
|
|
@@ -115,7 +115,7 @@ function byteStringToHexString(str) {
|
|
|
115
115
|
return hex.toLowerCase();
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
// bazel-out/
|
|
118
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/filesystem.mjs
|
|
119
119
|
var NodeFilesystem = class {
|
|
120
120
|
base;
|
|
121
121
|
constructor(base) {
|
|
@@ -145,7 +145,7 @@ var NodeFilesystem = class {
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
// bazel-out/
|
|
148
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/cli/main.mjs
|
|
149
149
|
var cwd = process.cwd();
|
|
150
150
|
var distDir = path2.join(cwd, process.argv[2]);
|
|
151
151
|
var config = path2.join(cwd, process.argv[3]);
|
package/ngsw-worker.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
// bazel-out/
|
|
26
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/named-cache-storage.mjs
|
|
27
27
|
var NamedCacheStorage = class {
|
|
28
28
|
constructor(original, cacheNamePrefix) {
|
|
29
29
|
__publicField(this, "original");
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
// bazel-out/
|
|
55
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/adapter.mjs
|
|
56
56
|
var Adapter = class {
|
|
57
57
|
constructor(scopeUrl, caches) {
|
|
58
58
|
__publicField(this, "scopeUrl");
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
// bazel-out/
|
|
96
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/database.mjs
|
|
97
97
|
var NotFound = class {
|
|
98
98
|
constructor(table, key) {
|
|
99
99
|
__publicField(this, "table");
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
// bazel-out/
|
|
106
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/db-cache.mjs
|
|
107
107
|
var CacheDatabase = class {
|
|
108
108
|
constructor(adapter2) {
|
|
109
109
|
__publicField(this, "adapter");
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
// bazel-out/
|
|
170
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/api.mjs
|
|
171
171
|
var UpdateCacheStatus;
|
|
172
172
|
(function(UpdateCacheStatus2) {
|
|
173
173
|
UpdateCacheStatus2[UpdateCacheStatus2["NOT_CACHED"] = 0] = "NOT_CACHED";
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
UpdateCacheStatus2[UpdateCacheStatus2["CACHED"] = 2] = "CACHED";
|
|
176
176
|
})(UpdateCacheStatus || (UpdateCacheStatus = {}));
|
|
177
177
|
|
|
178
|
-
// bazel-out/
|
|
178
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/error.mjs
|
|
179
179
|
var SwCriticalError = class extends Error {
|
|
180
180
|
constructor() {
|
|
181
181
|
super(...arguments);
|
|
@@ -197,7 +197,7 @@ ${error.stack}`;
|
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
-
// bazel-out/
|
|
200
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/sha1.mjs
|
|
201
201
|
function sha1(str) {
|
|
202
202
|
const utf8 = str;
|
|
203
203
|
const words32 = stringToWords32(utf8, Endian.Big);
|
|
@@ -312,7 +312,7 @@ ${error.stack}`;
|
|
|
312
312
|
return hex.toLowerCase();
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
// bazel-out/
|
|
315
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/assets.mjs
|
|
316
316
|
var AssetGroup = class {
|
|
317
317
|
constructor(scope2, adapter2, idle, config, hashes, db, cacheNamePrefix) {
|
|
318
318
|
__publicField(this, "scope");
|
|
@@ -609,7 +609,7 @@ ${error.stack}`;
|
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
611
|
|
|
612
|
-
// bazel-out/
|
|
612
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/data.mjs
|
|
613
613
|
var LruList = class {
|
|
614
614
|
constructor(state) {
|
|
615
615
|
__publicField(this, "state");
|
|
@@ -913,7 +913,7 @@ ${error.stack}`;
|
|
|
913
913
|
}
|
|
914
914
|
};
|
|
915
915
|
|
|
916
|
-
// bazel-out/
|
|
916
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/app-version.mjs
|
|
917
917
|
var AppVersion = class {
|
|
918
918
|
constructor(scope2, adapter2, database, idle, debugHandler, manifest, manifestHash) {
|
|
919
919
|
__publicField(this, "scope");
|
|
@@ -1068,8 +1068,8 @@ ${error.stack}`;
|
|
|
1068
1068
|
}
|
|
1069
1069
|
};
|
|
1070
1070
|
|
|
1071
|
-
// bazel-out/
|
|
1072
|
-
var SW_VERSION = "19.2.
|
|
1071
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/debug.mjs
|
|
1072
|
+
var SW_VERSION = "19.2.2";
|
|
1073
1073
|
var DEBUG_LOG_BUFFER_SIZE = 100;
|
|
1074
1074
|
var DebugHandler = class {
|
|
1075
1075
|
constructor(driver, adapter2) {
|
|
@@ -1144,7 +1144,7 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
|
|
|
1144
1144
|
}
|
|
1145
1145
|
};
|
|
1146
1146
|
|
|
1147
|
-
// bazel-out/
|
|
1147
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/idle.mjs
|
|
1148
1148
|
var IdleScheduler = class {
|
|
1149
1149
|
constructor(adapter2, delay, maxDelay, debug) {
|
|
1150
1150
|
__publicField(this, "adapter");
|
|
@@ -1226,12 +1226,12 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
|
|
|
1226
1226
|
}
|
|
1227
1227
|
};
|
|
1228
1228
|
|
|
1229
|
-
// bazel-out/
|
|
1229
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/manifest.mjs
|
|
1230
1230
|
function hashManifest(manifest) {
|
|
1231
1231
|
return sha1(JSON.stringify(manifest));
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
|
-
// bazel-out/
|
|
1234
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/msg.mjs
|
|
1235
1235
|
function isMsgCheckForUpdates(msg) {
|
|
1236
1236
|
return msg.action === "CHECK_FOR_UPDATES";
|
|
1237
1237
|
}
|
|
@@ -1239,7 +1239,7 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
|
|
|
1239
1239
|
return msg.action === "ACTIVATE_UPDATE";
|
|
1240
1240
|
}
|
|
1241
1241
|
|
|
1242
|
-
// bazel-out/
|
|
1242
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/driver.mjs
|
|
1243
1243
|
var IDLE_DELAY = 5e3;
|
|
1244
1244
|
var MAX_IDLE_DELAY = 3e4;
|
|
1245
1245
|
var SUPPORTED_CONFIG_VERSION = 1;
|
|
@@ -1890,7 +1890,7 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
|
|
|
1890
1890
|
}
|
|
1891
1891
|
};
|
|
1892
1892
|
|
|
1893
|
-
// bazel-out/
|
|
1893
|
+
// bazel-out/k8-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/main.mjs
|
|
1894
1894
|
var scope = self;
|
|
1895
1895
|
var adapter = new Adapter(scope.registration.scope, self.caches);
|
|
1896
1896
|
new Driver(scope, adapter, new CacheDatabase(adapter));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/service-worker",
|
|
3
|
-
"version": "19.2.
|
|
3
|
+
"version": "19.2.2",
|
|
4
4
|
"description": "Angular - service worker tooling!",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"tslib": "^2.3.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@angular/core": "19.2.
|
|
36
|
+
"@angular/core": "19.2.2",
|
|
37
37
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|