@serwist/vite 8.4.0 → 8.4.1
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.js +1 -2
- package/dist/integration/svelte/index.js +1 -1
- package/dist/main.js +14 -15
- package/dist/types.d.ts +1 -2
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { m as mainPlugin, d as devPlugin, c as createContext, a as createApi } from './main.js';
|
|
2
2
|
export { r as resolveEntry, t as toFs } from './main.js';
|
|
3
|
-
import 'node:assert';
|
|
4
3
|
import 'node:fs/promises';
|
|
5
4
|
import 'node:path';
|
|
6
5
|
import 'vite';
|
|
7
6
|
import 'node:process';
|
|
8
|
-
import '@serwist/build';
|
|
9
7
|
import 'node:crypto';
|
|
10
8
|
import 'node:fs';
|
|
11
9
|
import 'fast-glob';
|
|
10
|
+
import 'node:assert';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Internal build plugin used by `@serwist/vite`.
|
|
@@ -3,12 +3,12 @@ import crypto from 'node:crypto';
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { errors } from '@serwist/build';
|
|
6
|
-
import 'node:assert';
|
|
7
6
|
import 'node:fs/promises';
|
|
8
7
|
import 'vite';
|
|
9
8
|
import 'node:process';
|
|
10
9
|
import 'node:fs';
|
|
11
10
|
import 'fast-glob';
|
|
11
|
+
import 'node:assert';
|
|
12
12
|
|
|
13
13
|
const buildPlugin = (ctx, api)=>{
|
|
14
14
|
return {
|
package/dist/main.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import fs from 'node:fs/promises';
|
|
3
2
|
import path, { resolve } from 'node:path';
|
|
4
3
|
import { normalizePath } from 'vite';
|
|
5
4
|
import process$1 from 'node:process';
|
|
6
|
-
import { validateInjectManifestOptions } from '@serwist/build';
|
|
7
5
|
import crypto from 'node:crypto';
|
|
8
6
|
import fs$1 from 'node:fs';
|
|
9
7
|
import fg from 'fast-glob';
|
|
8
|
+
import assert from 'node:assert';
|
|
10
9
|
|
|
11
10
|
let enabled = true;
|
|
12
11
|
// Support both browser and node environments
|
|
@@ -68,7 +67,7 @@ const green = kolorist(32, 39);
|
|
|
68
67
|
const yellow = kolorist(33, 39);
|
|
69
68
|
const cyan = kolorist(36, 39);
|
|
70
69
|
|
|
71
|
-
var version = "8.4.
|
|
70
|
+
var version = "8.4.1";
|
|
72
71
|
|
|
73
72
|
const logSerwistResult = (buildResult, viteOptions)=>{
|
|
74
73
|
const { logLevel = "info" } = viteOptions;
|
|
@@ -124,7 +123,7 @@ const generateServiceWorker = async (ctx)=>{
|
|
|
124
123
|
const isDev = ctx.options.mode === "development";
|
|
125
124
|
if (isProduction && ctx.framework === "sveltekit" || isDev && !ctx.options.devOptions.bundle) {
|
|
126
125
|
if (!injectManifestResult) {
|
|
127
|
-
throw new Error(
|
|
126
|
+
throw new Error("injectManifest failed to generate results. This is likely a bug.");
|
|
128
127
|
}
|
|
129
128
|
const { errors, escapeRegExp, getSourceMapURL, rebasePath, replaceAndUpdateSourceMap, translateURLToSourcemapPaths } = await loadSerwistBuild();
|
|
130
129
|
// Make sure we leave swSrc and swDest out of the precache manifest.
|
|
@@ -185,7 +184,7 @@ const generateServiceWorker = async (ctx)=>{
|
|
|
185
184
|
recursive: true
|
|
186
185
|
});
|
|
187
186
|
} catch (error) {
|
|
188
|
-
throw new Error(errors["unable-to-make-sw-directory"]
|
|
187
|
+
throw new Error(`${errors["unable-to-make-sw-directory"]} '${error instanceof Error && error.message ? error.message : ""}'`);
|
|
189
188
|
}
|
|
190
189
|
await fs.writeFile(file, contents);
|
|
191
190
|
}
|
|
@@ -308,14 +307,13 @@ const isAbsolute = (url)=>{
|
|
|
308
307
|
return resolveEntry(path.join(entry, "index"));
|
|
309
308
|
}
|
|
310
309
|
return entry;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
310
|
+
}
|
|
311
|
+
const dir = path.dirname(entry);
|
|
312
|
+
if (fs$1.existsSync(dir)) {
|
|
313
|
+
const base = path.basename(entry);
|
|
314
|
+
const files = fs$1.readdirSync(dir);
|
|
315
|
+
const found = files.find((file)=>file.replace(/\.[^.]+$/, "") === base);
|
|
316
|
+
if (found) return path.join(dir, found);
|
|
319
317
|
}
|
|
320
318
|
return null;
|
|
321
319
|
};
|
|
@@ -436,7 +434,7 @@ const configureStaticAssets = async (resolvedPluginOptions, viteConfig)=>{
|
|
|
436
434
|
if (manifestEntries.length > 0) {
|
|
437
435
|
const included = manifestEntries.map((me)=>{
|
|
438
436
|
if (typeof me === "string") return me;
|
|
439
|
-
|
|
437
|
+
return me.url;
|
|
440
438
|
});
|
|
441
439
|
assets = assets.filter((a)=>!included.includes(a));
|
|
442
440
|
}
|
|
@@ -464,7 +462,8 @@ const resolveOptions = async (options, viteConfig)=>{
|
|
|
464
462
|
};
|
|
465
463
|
// remove './' prefix from assetsDir
|
|
466
464
|
const dontCacheBustURLsMatching = new RegExp(`^${assetsDir.replace(/^\.*?\//, "")}`);
|
|
467
|
-
|
|
465
|
+
const { validateViteInjectManifestOptions } = await loadSerwistBuild();
|
|
466
|
+
validateViteInjectManifestOptions(injectManifest);
|
|
468
467
|
const { swSrc, swDest, ...userInjectManifest } = injectManifest || {};
|
|
469
468
|
const resolvedPluginOptions = {
|
|
470
469
|
base: basePath,
|
package/dist/types.d.ts
CHANGED
|
@@ -171,8 +171,7 @@ export type LaunchHandlerClientMode = "auto" | "focus-existing" | "navigate-exis
|
|
|
171
171
|
export type Display = "fullscreen" | "standalone" | "minimal-ui" | "browser";
|
|
172
172
|
export type DisplayOverride = Display | "window-controls-overlay";
|
|
173
173
|
export type IconPurpose = "monochrome" | "maskable" | "any";
|
|
174
|
-
|
|
175
|
-
}
|
|
174
|
+
type Nothing = {};
|
|
176
175
|
/**
|
|
177
176
|
* type StringLiteralUnion<'maskable'> = 'maskable' | string
|
|
178
177
|
* This has auto completion whereas `'maskable' | string` doesn't
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/vite",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Vite application.",
|
|
6
6
|
"files": [
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"debug": "4.3.4",
|
|
78
78
|
"fast-glob": "3.3.2",
|
|
79
79
|
"pretty-bytes": "6.1.1",
|
|
80
|
-
"@serwist/build": "8.4.
|
|
81
|
-
"@serwist/window": "8.4.
|
|
80
|
+
"@serwist/build": "8.4.1",
|
|
81
|
+
"@serwist/window": "8.4.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@playwright/test": "1.40.1",
|
|
@@ -88,7 +88,6 @@
|
|
|
88
88
|
"@types/prompts": "2.4.9",
|
|
89
89
|
"@types/react": "18.2.45",
|
|
90
90
|
"bumpp": "9.2.1",
|
|
91
|
-
"eslint": "8.56.0",
|
|
92
91
|
"kolorist": "1.8.0",
|
|
93
92
|
"preact": "10.19.3",
|
|
94
93
|
"prompts": "2.4.2",
|
|
@@ -100,7 +99,7 @@
|
|
|
100
99
|
"typescript": "5.4.0-dev.20231226",
|
|
101
100
|
"vite": "5.0.10",
|
|
102
101
|
"vue": "3.3.13",
|
|
103
|
-
"@serwist/constants": "8.4.
|
|
102
|
+
"@serwist/constants": "8.4.1"
|
|
104
103
|
},
|
|
105
104
|
"peerDependencies": {
|
|
106
105
|
"@sveltejs/kit": "^1.0.0 || ^2.0.0",
|
|
@@ -134,7 +133,7 @@
|
|
|
134
133
|
"scripts": {
|
|
135
134
|
"build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",
|
|
136
135
|
"dev": "rollup --config rollup.config.js --watch",
|
|
137
|
-
"lint": "
|
|
136
|
+
"lint": "biome lint ./src",
|
|
138
137
|
"typecheck": "tsc"
|
|
139
138
|
}
|
|
140
139
|
}
|