@docusaurus/plugin-pwa 0.0.0-5040 → 0.0.0-5041
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/registerSw.d.ts +1 -15
- package/lib/registerSw.js +2 -1
- package/lib/sw.d.ts +1 -0
- package/package.json +8 -8
- package/src/registerSw.ts +3 -11
package/lib/registerSw.d.ts
CHANGED
|
@@ -4,29 +4,15 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
declare global {
|
|
8
|
-
namespace NodeJS {
|
|
9
|
-
interface ProcessEnv {
|
|
10
|
-
PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES: (keyof typeof OfflineModeActivationStrategiesImplementations)[];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
7
|
declare global {
|
|
15
8
|
interface Navigator {
|
|
16
9
|
getInstalledRelatedApps: () => Promise<{
|
|
17
10
|
platform: string;
|
|
18
11
|
}[]>;
|
|
19
12
|
connection: {
|
|
13
|
+
effectiveType: string;
|
|
20
14
|
saveData: boolean;
|
|
21
15
|
};
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
declare const OfflineModeActivationStrategiesImplementations: {
|
|
25
|
-
always: () => boolean;
|
|
26
|
-
mobile: () => boolean;
|
|
27
|
-
saveData: () => boolean;
|
|
28
|
-
appInstalled: () => Promise<boolean>;
|
|
29
|
-
standalone: () => boolean;
|
|
30
|
-
queryString: () => boolean;
|
|
31
|
-
};
|
|
32
18
|
export {};
|
package/lib/registerSw.js
CHANGED
|
@@ -9,7 +9,8 @@ import { createStorageSlot } from '@docusaurus/theme-common';
|
|
|
9
9
|
/* eslint-disable prefer-destructuring */
|
|
10
10
|
const PWA_SERVICE_WORKER_URL = process.env.PWA_SERVICE_WORKER_URL;
|
|
11
11
|
const PWA_RELOAD_POPUP = process.env.PWA_RELOAD_POPUP;
|
|
12
|
-
const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES = process.env
|
|
12
|
+
const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES = process.env
|
|
13
|
+
.PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES;
|
|
13
14
|
const PWA_DEBUG = process.env.PWA_DEBUG;
|
|
14
15
|
/* eslint-enable prefer-destructuring */
|
|
15
16
|
const debug = PWA_DEBUG; // Shortcut
|
package/lib/sw.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-pwa",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5041",
|
|
4
4
|
"description": "Docusaurus Plugin to add PWA support.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-pwa.d.ts",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@babel/core": "^7.18.0",
|
|
24
24
|
"@babel/preset-env": "^7.18.0",
|
|
25
|
-
"@docusaurus/core": "0.0.0-
|
|
26
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
27
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
28
|
-
"@docusaurus/utils": "0.0.0-
|
|
29
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
25
|
+
"@docusaurus/core": "0.0.0-5041",
|
|
26
|
+
"@docusaurus/theme-common": "0.0.0-5041",
|
|
27
|
+
"@docusaurus/theme-translations": "0.0.0-5041",
|
|
28
|
+
"@docusaurus/utils": "0.0.0-5041",
|
|
29
|
+
"@docusaurus/utils-validation": "0.0.0-5041",
|
|
30
30
|
"babel-loader": "^8.2.5",
|
|
31
31
|
"clsx": "^1.1.1",
|
|
32
32
|
"core-js": "^3.22.5",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"workbox-window": "^6.5.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
42
|
+
"@docusaurus/module-type-aliases": "0.0.0-5041",
|
|
43
43
|
"fs-extra": "^10.1.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": "^16.8.4 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.4 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "5a3b9a5a3a9c680f7f6d29b622416fc30cd8275d"
|
|
50
50
|
}
|
package/src/registerSw.ts
CHANGED
|
@@ -7,20 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import {createStorageSlot} from '@docusaurus/theme-common';
|
|
9
9
|
|
|
10
|
-
declare global {
|
|
11
|
-
namespace NodeJS {
|
|
12
|
-
interface ProcessEnv {
|
|
13
|
-
PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES: (keyof typeof OfflineModeActivationStrategiesImplementations)[];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
10
|
// First: read the env variables (provided by Webpack)
|
|
19
11
|
/* eslint-disable prefer-destructuring */
|
|
20
12
|
const PWA_SERVICE_WORKER_URL = process.env.PWA_SERVICE_WORKER_URL;
|
|
21
13
|
const PWA_RELOAD_POPUP = process.env.PWA_RELOAD_POPUP;
|
|
22
|
-
const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES =
|
|
23
|
-
|
|
14
|
+
const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES = process.env
|
|
15
|
+
.PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES as unknown as (keyof typeof OfflineModeActivationStrategiesImplementations)[];
|
|
24
16
|
const PWA_DEBUG = process.env.PWA_DEBUG;
|
|
25
17
|
/* eslint-enable prefer-destructuring */
|
|
26
18
|
|
|
@@ -77,7 +69,7 @@ async function isAppInstalledEventFired() {
|
|
|
77
69
|
declare global {
|
|
78
70
|
interface Navigator {
|
|
79
71
|
getInstalledRelatedApps: () => Promise<{platform: string}[]>;
|
|
80
|
-
connection: {saveData: boolean};
|
|
72
|
+
connection: {effectiveType: string; saveData: boolean};
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
75
|
|