@tramvai/module-progressive-web-app 2.123.1 → 2.123.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/lib/workbox/browser.browser.js +23 -20
- package/package.json +6 -6
|
@@ -61,31 +61,34 @@ const TramvaiPwaWorkboxModule = declareModule({
|
|
|
61
61
|
provide: commandLineListTokens.init,
|
|
62
62
|
useFactory: ({ workbox, logger }) => {
|
|
63
63
|
const log = logger('pwa:workbox');
|
|
64
|
-
return
|
|
64
|
+
return function registerWorkbox() {
|
|
65
65
|
if (!process.env.TRAMVAI_PWA_WORKBOX_ENABLED) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
// load workbox-window early but in non-blocking way
|
|
69
|
+
(async () => {
|
|
70
|
+
try {
|
|
71
|
+
const wb = await workbox();
|
|
72
|
+
if (!wb) {
|
|
73
|
+
log.info('Service Worker registration stopped');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// @todo unregister when Workbox is disabled in config !!!
|
|
77
|
+
// https://github.com/nuxt-community/pwa-module/blob/main/templates/workbox/workbox.unregister.js
|
|
78
|
+
await wb.register();
|
|
79
|
+
// @todo support force update strategies?
|
|
80
|
+
if (process.env.NODE_ENV === 'development') {
|
|
81
|
+
await wb.update();
|
|
82
|
+
}
|
|
73
83
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
catch (error) {
|
|
85
|
+
log.error({
|
|
86
|
+
event: 'register-failed',
|
|
87
|
+
message: 'Service Worker registration failed',
|
|
88
|
+
error,
|
|
89
|
+
});
|
|
80
90
|
}
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
log.error({
|
|
84
|
-
event: 'register-failed',
|
|
85
|
-
message: 'Service Worker registration failed',
|
|
86
|
-
error,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
91
|
+
})();
|
|
89
92
|
};
|
|
90
93
|
},
|
|
91
94
|
deps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-progressive-web-app",
|
|
3
|
-
"version": "2.123.
|
|
3
|
+
"version": "2.123.2",
|
|
4
4
|
"description": "Pwa integration - SW, manifest, icons and meta",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"registry": "https://registry.npmjs.org/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tramvai/tokens-common": "2.123.
|
|
27
|
-
"@tramvai/tokens-render": "2.123.
|
|
28
|
-
"@tramvai/tokens-server": "2.123.
|
|
26
|
+
"@tramvai/tokens-common": "2.123.2",
|
|
27
|
+
"@tramvai/tokens-render": "2.123.2",
|
|
28
|
+
"@tramvai/tokens-server": "2.123.2",
|
|
29
29
|
"workbox-window": "^6.6.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@tramvai/cli": "2.123.
|
|
34
|
-
"@tramvai/core": "2.123.
|
|
33
|
+
"@tramvai/cli": "2.123.2",
|
|
34
|
+
"@tramvai/core": "2.123.2",
|
|
35
35
|
"@tinkoff/dippy": "0.8.15",
|
|
36
36
|
"tslib": "^2.4.0"
|
|
37
37
|
}
|