@serwist/vite 9.0.0-preview.3 → 9.0.0-preview.5
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/dist/index.worker.d.ts +2 -2
- package/dist/index.worker.js +8 -8
- package/dist/main.js +2 -2
- package/package.json +8 -8
- package/src/index.worker.ts +8 -8
- package/src/options.ts +1 -1
package/dist/index.worker.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CacheFirst, NetworkFirst } from "@serwist/strategies";
|
|
2
2
|
export declare const defaultCache: ({
|
|
3
|
-
|
|
3
|
+
matcher: RegExp;
|
|
4
4
|
handler: CacheFirst;
|
|
5
5
|
method?: undefined;
|
|
6
6
|
} | {
|
|
7
|
-
|
|
7
|
+
matcher: RegExp;
|
|
8
8
|
method: "GET";
|
|
9
9
|
handler: NetworkFirst;
|
|
10
10
|
})[];
|
package/dist/index.worker.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CacheFirst, StaleWhileRevalidate, NetworkFirst } from '@serwist/strateg
|
|
|
3
3
|
|
|
4
4
|
const defaultCache = [
|
|
5
5
|
{
|
|
6
|
-
|
|
6
|
+
matcher: /^https:\/\/fonts\.(?:googleapis|gstatic)\.com\/.*/i,
|
|
7
7
|
handler: new CacheFirst({
|
|
8
8
|
cacheName: "google-fonts",
|
|
9
9
|
plugins: [
|
|
@@ -15,7 +15,7 @@ const defaultCache = [
|
|
|
15
15
|
})
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
matcher: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
19
19
|
handler: new StaleWhileRevalidate({
|
|
20
20
|
cacheName: "static-font-assets",
|
|
21
21
|
plugins: [
|
|
@@ -27,7 +27,7 @@ const defaultCache = [
|
|
|
27
27
|
})
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
|
|
30
|
+
matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
31
31
|
handler: new StaleWhileRevalidate({
|
|
32
32
|
cacheName: "static-image-assets",
|
|
33
33
|
plugins: [
|
|
@@ -39,7 +39,7 @@ const defaultCache = [
|
|
|
39
39
|
})
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
|
|
42
|
+
matcher: /\.(?:js)$/i,
|
|
43
43
|
handler: new StaleWhileRevalidate({
|
|
44
44
|
cacheName: "static-js-assets",
|
|
45
45
|
plugins: [
|
|
@@ -51,7 +51,7 @@ const defaultCache = [
|
|
|
51
51
|
})
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
|
|
54
|
+
matcher: /\.(?:css|less)$/i,
|
|
55
55
|
handler: new StaleWhileRevalidate({
|
|
56
56
|
cacheName: "static-style-assets",
|
|
57
57
|
plugins: [
|
|
@@ -63,7 +63,7 @@ const defaultCache = [
|
|
|
63
63
|
})
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
|
|
66
|
+
matcher: /\.(?:json|xml|csv)$/i,
|
|
67
67
|
handler: new NetworkFirst({
|
|
68
68
|
cacheName: "static-data-assets",
|
|
69
69
|
plugins: [
|
|
@@ -75,7 +75,7 @@ const defaultCache = [
|
|
|
75
75
|
})
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
|
|
78
|
+
matcher: /\/api\/.*$/i,
|
|
79
79
|
method: "GET",
|
|
80
80
|
handler: new NetworkFirst({
|
|
81
81
|
cacheName: "apis",
|
|
@@ -89,7 +89,7 @@ const defaultCache = [
|
|
|
89
89
|
})
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
|
|
92
|
+
matcher: /.*/i,
|
|
93
93
|
handler: new NetworkFirst({
|
|
94
94
|
cacheName: "others",
|
|
95
95
|
plugins: [
|
package/dist/main.js
CHANGED
|
@@ -62,7 +62,7 @@ const green = kolorist(32, 39);
|
|
|
62
62
|
const yellow = kolorist(33, 39);
|
|
63
63
|
const cyan = kolorist(36, 39);
|
|
64
64
|
|
|
65
|
-
var version = "9.0.0-preview.
|
|
65
|
+
var version = "9.0.0-preview.5";
|
|
66
66
|
|
|
67
67
|
const logSerwistResult = (buildResult, viteOptions)=>{
|
|
68
68
|
const { logLevel = "info" } = viteOptions;
|
|
@@ -386,7 +386,7 @@ const configureStaticAssets = async (resolvedPluginOptions, viteConfig)=>{
|
|
|
386
386
|
};
|
|
387
387
|
|
|
388
388
|
const resolveOptions = async (options, viteConfig)=>{
|
|
389
|
-
const { type = "classic", mode = process$1.env.NODE_ENV || "production", injectRegister = "auto", registerType = "prompt", minify = true, base = viteConfig.base, scope: _scope, swUrl = "/sw.js", includeAssets = undefined, useCredentials = false, disable = false, integration = {}, buildBase, devOptions, plugins = [], rollupOptions = {}, rollupFormat = "es", ...injectManifest } = options;
|
|
389
|
+
const { type = "classic", mode = process$1.env.NODE_ENV === "production" || process$1.env.NODE_ENV === "development" ? process$1.env.NODE_ENV : "production", injectRegister = "auto", registerType = "prompt", minify = true, base = viteConfig.base, scope: _scope, swUrl = "/sw.js", includeAssets = undefined, useCredentials = false, disable = false, integration = {}, buildBase, devOptions, plugins = [], rollupOptions = {}, rollupFormat = "es", ...injectManifest } = options;
|
|
390
390
|
const basePath = resolveBasePath(base);
|
|
391
391
|
const scope = _scope || basePath;
|
|
392
392
|
let assetsDir = slash(viteConfig.build.assetsDir ?? "assets");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/vite",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Vite application.",
|
|
6
6
|
"files": [
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"debug": "4.3.4",
|
|
73
73
|
"fast-glob": "3.3.2",
|
|
74
74
|
"pretty-bytes": "6.1.1",
|
|
75
|
-
"@serwist/build": "9.0.0-preview.
|
|
76
|
-
"@serwist/expiration": "9.0.0-preview.
|
|
77
|
-
"@serwist/strategies": "9.0.0-preview.
|
|
78
|
-
"@serwist/window": "9.0.0-preview.
|
|
75
|
+
"@serwist/build": "9.0.0-preview.5",
|
|
76
|
+
"@serwist/expiration": "9.0.0-preview.5",
|
|
77
|
+
"@serwist/strategies": "9.0.0-preview.5",
|
|
78
|
+
"@serwist/window": "9.0.0-preview.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@playwright/test": "1.41.2",
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"typescript": "5.4.0-dev.20240206",
|
|
97
97
|
"vite": "5.0.12",
|
|
98
98
|
"vue": "3.4.15",
|
|
99
|
-
"@serwist/constants": "9.0.0-preview.
|
|
100
|
-
"@serwist/sw": "9.0.0-preview.
|
|
99
|
+
"@serwist/constants": "9.0.0-preview.5",
|
|
100
|
+
"@serwist/sw": "9.0.0-preview.5"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@sveltejs/kit": "^1.0.0 || ^2.0.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"typescript": ">=5.0.0",
|
|
109
109
|
"vite": "^5.0.0",
|
|
110
110
|
"vue": "^3.0.0",
|
|
111
|
-
"@serwist/sw": "9.0.0-preview.
|
|
111
|
+
"@serwist/sw": "9.0.0-preview.5"
|
|
112
112
|
},
|
|
113
113
|
"peerDependenciesMeta": {
|
|
114
114
|
"@serwist/sw": {
|
package/src/index.worker.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { RuntimeCaching } from "@serwist/sw";
|
|
|
4
4
|
|
|
5
5
|
export const defaultCache = [
|
|
6
6
|
{
|
|
7
|
-
|
|
7
|
+
matcher: /^https:\/\/fonts\.(?:googleapis|gstatic)\.com\/.*/i,
|
|
8
8
|
handler: new CacheFirst({
|
|
9
9
|
cacheName: "google-fonts",
|
|
10
10
|
plugins: [
|
|
@@ -16,7 +16,7 @@ export const defaultCache = [
|
|
|
16
16
|
}),
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
|
|
19
|
+
matcher: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
20
20
|
handler: new StaleWhileRevalidate({
|
|
21
21
|
cacheName: "static-font-assets",
|
|
22
22
|
plugins: [
|
|
@@ -28,7 +28,7 @@ export const defaultCache = [
|
|
|
28
28
|
}),
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
|
|
31
|
+
matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
32
32
|
handler: new StaleWhileRevalidate({
|
|
33
33
|
cacheName: "static-image-assets",
|
|
34
34
|
plugins: [
|
|
@@ -40,7 +40,7 @@ export const defaultCache = [
|
|
|
40
40
|
}),
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
|
|
43
|
+
matcher: /\.(?:js)$/i,
|
|
44
44
|
handler: new StaleWhileRevalidate({
|
|
45
45
|
cacheName: "static-js-assets",
|
|
46
46
|
plugins: [
|
|
@@ -52,7 +52,7 @@ export const defaultCache = [
|
|
|
52
52
|
}),
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
|
|
55
|
+
matcher: /\.(?:css|less)$/i,
|
|
56
56
|
handler: new StaleWhileRevalidate({
|
|
57
57
|
cacheName: "static-style-assets",
|
|
58
58
|
plugins: [
|
|
@@ -64,7 +64,7 @@ export const defaultCache = [
|
|
|
64
64
|
}),
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
|
|
67
|
+
matcher: /\.(?:json|xml|csv)$/i,
|
|
68
68
|
handler: new NetworkFirst({
|
|
69
69
|
cacheName: "static-data-assets",
|
|
70
70
|
plugins: [
|
|
@@ -76,7 +76,7 @@ export const defaultCache = [
|
|
|
76
76
|
}),
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
|
|
79
|
+
matcher: /\/api\/.*$/i,
|
|
80
80
|
method: "GET",
|
|
81
81
|
handler: new NetworkFirst({
|
|
82
82
|
cacheName: "apis",
|
|
@@ -90,7 +90,7 @@ export const defaultCache = [
|
|
|
90
90
|
}),
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
|
|
93
|
+
matcher: /.*/i,
|
|
94
94
|
handler: new NetworkFirst({
|
|
95
95
|
cacheName: "others",
|
|
96
96
|
plugins: [
|
package/src/options.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { resolveBasePath, slash } from "./utils.js";
|
|
|
11
11
|
export const resolveOptions = async (options: PluginOptions, viteConfig: ResolvedConfig): Promise<ResolvedPluginOptions> => {
|
|
12
12
|
const {
|
|
13
13
|
type = "classic",
|
|
14
|
-
mode =
|
|
14
|
+
mode = process.env.NODE_ENV === "production" || process.env.NODE_ENV === "development" ? process.env.NODE_ENV : "production",
|
|
15
15
|
injectRegister = "auto",
|
|
16
16
|
registerType = "prompt",
|
|
17
17
|
minify = true,
|