@serwist/vite 9.5.6 → 9.5.8
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/chunks/schema-CF26pDQI.js +77 -0
- package/dist/chunks/schema-CF26pDQI.js.map +1 -0
- package/dist/index.d.mts +228 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +393 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.schema.d.mts +126 -0
- package/dist/index.schema.d.mts.map +1 -0
- package/dist/index.schema.mjs +2 -0
- package/dist/index.worker.d.mts +13 -0
- package/dist/index.worker.d.mts.map +1 -0
- package/dist/index.worker.mjs +108 -0
- package/dist/index.worker.mjs.map +1 -0
- package/package.json +30 -26
- package/src/lib/modules.ts +1 -0
- package/dist/chunks/schema.js +0 -80
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -400
- package/dist/index.schema.d.ts +0 -3
- package/dist/index.schema.d.ts.map +0 -1
- package/dist/index.schema.js +0 -3
- package/dist/index.worker.d.ts +0 -9
- package/dist/index.worker.d.ts.map +0 -1
- package/dist/index.worker.js +0 -118
- package/dist/lib/api.d.ts +0 -4
- package/dist/lib/api.d.ts.map +0 -1
- package/dist/lib/constants.d.ts +0 -3
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/context.d.ts +0 -33
- package/dist/lib/context.d.ts.map +0 -1
- package/dist/lib/log.d.ts +0 -4
- package/dist/lib/log.d.ts.map +0 -1
- package/dist/lib/modules.d.ts +0 -10
- package/dist/lib/modules.d.ts.map +0 -1
- package/dist/lib/options.d.ts +0 -4
- package/dist/lib/options.d.ts.map +0 -1
- package/dist/lib/schema.d.ts +0 -122
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/types.d.ts +0 -130
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -24
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/validator.d.ts +0 -3
- package/dist/lib/validator.d.ts.map +0 -1
- package/dist/plugins/build.d.ts +0 -12
- package/dist/plugins/build.d.ts.map +0 -1
- package/dist/plugins/dev.d.ts +0 -12
- package/dist/plugins/dev.d.ts.map +0 -1
- package/dist/plugins/main.d.ts +0 -12
- package/dist/plugins/main.d.ts.map +0 -1
- package/src/rollup.js +0 -23
- /package/{typings.d.ts → typings.d.mts} +0 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { o as __require } from "./chunks/schema-CF26pDQI.js";
|
|
2
|
+
import { cyan, dim, green, yellow } from "kolorist";
|
|
3
|
+
import assert from "node:assert";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import fs$1 from "node:fs";
|
|
7
|
+
import { SerwistConfigError, validationErrorMap } from "@serwist/build/schema";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { normalizePath } from "vite";
|
|
10
|
+
import process from "node:process";
|
|
11
|
+
//#region package.json
|
|
12
|
+
var version = "9.5.8";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/lib/log.ts
|
|
15
|
+
const logSerwistResult = (buildResult, viteOptions) => {
|
|
16
|
+
const { logLevel = "info" } = viteOptions;
|
|
17
|
+
if (logLevel === "silent") return;
|
|
18
|
+
const { count, size, warnings } = buildResult;
|
|
19
|
+
if (logLevel === "info") console.info([
|
|
20
|
+
"",
|
|
21
|
+
`${cyan(`@serwist/vite v${version}`)} ${green("files generated.")}`,
|
|
22
|
+
`${green("✓")} ${count} precache entries ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}`,
|
|
23
|
+
warnings && warnings.length > 0 ? yellow([
|
|
24
|
+
"⚠ warnings",
|
|
25
|
+
...warnings.map((w) => ` ${w}`),
|
|
26
|
+
""
|
|
27
|
+
].join("\n")) : ""
|
|
28
|
+
].join("\n"));
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/lib/modules.ts
|
|
32
|
+
const loadSerwistBuild = async () => {
|
|
33
|
+
try {
|
|
34
|
+
return await import("@serwist/build");
|
|
35
|
+
} catch (_) {
|
|
36
|
+
return __require("@serwist/build");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const injectManifest = async (options) => {
|
|
40
|
+
const { getFileManifestEntries } = await loadSerwistBuild();
|
|
41
|
+
const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);
|
|
42
|
+
return {
|
|
43
|
+
warnings,
|
|
44
|
+
size,
|
|
45
|
+
count,
|
|
46
|
+
manifestEntries,
|
|
47
|
+
manifestString: manifestEntries === void 0 ? "undefined" : JSON.stringify(manifestEntries)
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const generateServiceWorker = async (ctx) => {
|
|
51
|
+
const { plugins, rollupOptions, rollupFormat } = ctx.options;
|
|
52
|
+
const parsedSwDest = path.parse(ctx.options.injectManifest.swDest);
|
|
53
|
+
let injectManifestResult;
|
|
54
|
+
if (ctx.options.injectManifest.injectionPoint) {
|
|
55
|
+
await ctx.options.integration?.beforeBuildServiceWorker?.(ctx.options);
|
|
56
|
+
injectManifestResult = await injectManifest(ctx.options.injectManifest);
|
|
57
|
+
}
|
|
58
|
+
const isProduction = ctx.options.mode === "production";
|
|
59
|
+
if (ctx.options.mode === "development" && !ctx.options.devOptions.bundle) {
|
|
60
|
+
if (!injectManifestResult) throw new Error("injectManifest failed to generate results. This is likely a bug.");
|
|
61
|
+
const { errors, escapeRegExp, getSourceMapURL, rebasePath, replaceAndUpdateSourceMap, translateURLToSourcemapPaths } = await loadSerwistBuild();
|
|
62
|
+
for (const file of [ctx.options.injectManifest.swSrc, ctx.options.injectManifest.swDest]) ctx.options.injectManifest.globIgnores.push(rebasePath({
|
|
63
|
+
file,
|
|
64
|
+
baseDirectory: ctx.options.injectManifest.globDirectory
|
|
65
|
+
}));
|
|
66
|
+
const injectionPoint = ctx.options.injectManifest.injectionPoint;
|
|
67
|
+
const globalRegexp = new RegExp(escapeRegExp(injectionPoint), "g");
|
|
68
|
+
let swFileContents;
|
|
69
|
+
try {
|
|
70
|
+
swFileContents = await fs.readFile(ctx.options.injectManifest.swSrc, "utf8");
|
|
71
|
+
} catch (error) {
|
|
72
|
+
throw new Error(`${errors["invalid-sw-src"]} ${error instanceof Error && error.message ? error.message : ""}`);
|
|
73
|
+
}
|
|
74
|
+
const injectionResults = swFileContents.match(globalRegexp);
|
|
75
|
+
if (!injectionResults) throw new Error(`${errors["injection-point-not-found"]} ${injectionPoint}`);
|
|
76
|
+
assert(injectionResults.length === 1, `${errors["multiple-injection-points"]} ${injectionPoint}`);
|
|
77
|
+
const filesToWrite = {};
|
|
78
|
+
const { destPath, srcPath, warning } = translateURLToSourcemapPaths(getSourceMapURL(swFileContents), ctx.options.injectManifest.swSrc, ctx.options.injectManifest.swDest);
|
|
79
|
+
if (warning) injectManifestResult.warnings.push(warning);
|
|
80
|
+
if (srcPath && destPath) {
|
|
81
|
+
const { map, source } = await replaceAndUpdateSourceMap({
|
|
82
|
+
originalMap: JSON.parse(await fs.readFile(srcPath, "utf8")),
|
|
83
|
+
jsFilename: path.basename(ctx.options.injectManifest.swDest),
|
|
84
|
+
originalSource: swFileContents,
|
|
85
|
+
replaceString: injectManifestResult.manifestString,
|
|
86
|
+
searchString: injectionPoint
|
|
87
|
+
});
|
|
88
|
+
filesToWrite[ctx.options.injectManifest.swDest] = source;
|
|
89
|
+
filesToWrite[destPath] = map;
|
|
90
|
+
} else filesToWrite[ctx.options.injectManifest.swDest] = swFileContents.replace(globalRegexp, injectManifestResult.manifestString);
|
|
91
|
+
for (const [file, contents] of Object.entries(filesToWrite)) {
|
|
92
|
+
try {
|
|
93
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
94
|
+
} catch (error) {
|
|
95
|
+
throw new Error(`${errors["unable-to-make-sw-directory"]} '${error instanceof Error && error.message ? error.message : ""}'`);
|
|
96
|
+
}
|
|
97
|
+
await fs.writeFile(file, contents);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
const define = {
|
|
101
|
+
...ctx.framework === "nuxt" ? void 0 : ctx.viteConfig.define,
|
|
102
|
+
"process.env.NODE_ENV": `"${ctx.options.mode}"`
|
|
103
|
+
};
|
|
104
|
+
if (ctx.options.injectManifest.injectionPoint && injectManifestResult) define[ctx.options.injectManifest.injectionPoint] = injectManifestResult.manifestString;
|
|
105
|
+
const { build } = await import("vite");
|
|
106
|
+
await build({
|
|
107
|
+
logLevel: ctx.viteConfig.isProduction ? "info" : "warn",
|
|
108
|
+
root: ctx.viteConfig.root,
|
|
109
|
+
base: ctx.viteConfig.base,
|
|
110
|
+
resolve: ctx.viteConfig.resolve,
|
|
111
|
+
publicDir: false,
|
|
112
|
+
build: {
|
|
113
|
+
sourcemap: ctx.viteConfig.build.sourcemap,
|
|
114
|
+
lib: {
|
|
115
|
+
entry: ctx.options.injectManifest.swSrc,
|
|
116
|
+
name: "app",
|
|
117
|
+
formats: [rollupFormat]
|
|
118
|
+
},
|
|
119
|
+
rollupOptions: {
|
|
120
|
+
...rollupOptions,
|
|
121
|
+
plugins,
|
|
122
|
+
output: { entryFileNames: parsedSwDest.base }
|
|
123
|
+
},
|
|
124
|
+
outDir: parsedSwDest.dir,
|
|
125
|
+
emptyOutDir: false,
|
|
126
|
+
minify: isProduction || ctx.options.devOptions.minify
|
|
127
|
+
},
|
|
128
|
+
configFile: false,
|
|
129
|
+
define
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return injectManifestResult;
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/lib/api.ts
|
|
136
|
+
const createApi = (ctx) => {
|
|
137
|
+
return {
|
|
138
|
+
get disabled() {
|
|
139
|
+
return ctx?.options?.disable;
|
|
140
|
+
},
|
|
141
|
+
async generateSW() {
|
|
142
|
+
if (ctx.options.disable) return;
|
|
143
|
+
const buildResult = await generateServiceWorker(ctx);
|
|
144
|
+
if (buildResult) {
|
|
145
|
+
if (ctx.viteConfig.isProduction) logSerwistResult(buildResult, ctx.viteConfig);
|
|
146
|
+
else if (buildResult.warnings && buildResult.warnings.length > 0) console.warn(yellow([
|
|
147
|
+
"[@serwist/vite] Warnings",
|
|
148
|
+
...buildResult.warnings.map((w) => ` - ${w}`),
|
|
149
|
+
""
|
|
150
|
+
].join("\n")));
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
extendManifestEntries(fn) {
|
|
154
|
+
const { options } = ctx;
|
|
155
|
+
if (options.disable) return;
|
|
156
|
+
const result = fn(options.injectManifest.additionalPrecacheEntries || []);
|
|
157
|
+
if (result != null) options.injectManifest.additionalPrecacheEntries = result;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/lib/context.ts
|
|
163
|
+
const createContext = (userOptions, framework) => {
|
|
164
|
+
return {
|
|
165
|
+
userOptions,
|
|
166
|
+
options: void 0,
|
|
167
|
+
viteConfig: void 0,
|
|
168
|
+
useImportRegister: false,
|
|
169
|
+
devEnvironment: false,
|
|
170
|
+
framework
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/lib/utils.ts
|
|
175
|
+
const slash = (str) => {
|
|
176
|
+
return str.replace(/\\/g, "/");
|
|
177
|
+
};
|
|
178
|
+
const resolveBasePath = (base) => {
|
|
179
|
+
if (isAbsolute(base)) return base;
|
|
180
|
+
return !base.startsWith("/") && !base.startsWith("./") ? `/${base}` : base;
|
|
181
|
+
};
|
|
182
|
+
const isAbsolute = (url) => {
|
|
183
|
+
return url.match(/^(?:[a-z]+:)?\/\//i);
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Internal function used by `@serwist/vite`.
|
|
187
|
+
* Resolves a file path without extension. Also handles `/index` if the path
|
|
188
|
+
* actually points to a directory.
|
|
189
|
+
* @internal
|
|
190
|
+
* @param ctx
|
|
191
|
+
* @param api
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
const resolveEntry = (entry) => {
|
|
195
|
+
if (fs$1.existsSync(entry)) {
|
|
196
|
+
if (fs$1.statSync(entry).isDirectory()) return resolveEntry(path.join(entry, "index"));
|
|
197
|
+
return entry;
|
|
198
|
+
}
|
|
199
|
+
const dir = path.dirname(entry);
|
|
200
|
+
if (fs$1.existsSync(dir)) {
|
|
201
|
+
const base = path.basename(entry);
|
|
202
|
+
const found = fs$1.readdirSync(dir).find((file) => file.replace(/\.[^.]+$/, "") === base);
|
|
203
|
+
if (found) return path.join(dir, found);
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Internal function used by `@serwist/vite`.
|
|
209
|
+
* Converts a filesystem path to a Vite `@fs` URL.
|
|
210
|
+
* @internal
|
|
211
|
+
* @param ctx
|
|
212
|
+
* @param api
|
|
213
|
+
* @returns
|
|
214
|
+
*/
|
|
215
|
+
const toFs = (str) => {
|
|
216
|
+
str = str.replace(/\\/g, "/");
|
|
217
|
+
return `/@fs${str.startsWith("/") ? "" : "/"}${str}`;
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/lib/validator.ts
|
|
221
|
+
const validateInjectManifestOptions = async (input) => {
|
|
222
|
+
const result = await (await import("./chunks/schema-CF26pDQI.js").then((n) => n.a)).injectManifestOptions.spa(input, { error: validationErrorMap });
|
|
223
|
+
if (!result.success) throw new SerwistConfigError({
|
|
224
|
+
moduleName: "@serwist/vite",
|
|
225
|
+
message: z.prettifyError(result.error)
|
|
226
|
+
});
|
|
227
|
+
return result.data;
|
|
228
|
+
};
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/plugins/build.ts
|
|
231
|
+
/**
|
|
232
|
+
* Internal build plugin used by `@serwist/vite`.
|
|
233
|
+
* @internal
|
|
234
|
+
* @param ctx
|
|
235
|
+
* @param api
|
|
236
|
+
* @returns
|
|
237
|
+
*/
|
|
238
|
+
const buildPlugin = (ctx, api) => {
|
|
239
|
+
return {
|
|
240
|
+
name: "@serwist/vite:build",
|
|
241
|
+
enforce: "post",
|
|
242
|
+
apply: "build",
|
|
243
|
+
closeBundle: {
|
|
244
|
+
sequential: true,
|
|
245
|
+
order: ctx.userOptions?.integration?.closeBundleOrder,
|
|
246
|
+
async handler() {
|
|
247
|
+
if (!ctx.viteConfig.build.ssr && !ctx.options.disable) await api.generateSW();
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
buildEnd(error) {
|
|
251
|
+
if (error) throw error;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/plugins/dev.ts
|
|
257
|
+
/**
|
|
258
|
+
* Internal dev plugin used by `@serwist/vite`.
|
|
259
|
+
* @internal
|
|
260
|
+
* @param ctx
|
|
261
|
+
* @param api
|
|
262
|
+
* @returns
|
|
263
|
+
*/
|
|
264
|
+
const devPlugin = (ctx, api) => {
|
|
265
|
+
return {
|
|
266
|
+
name: "@serwist/vite:dev",
|
|
267
|
+
apply: "serve",
|
|
268
|
+
configureServer(server) {
|
|
269
|
+
ctx.devEnvironment = true;
|
|
270
|
+
server.middlewares.use(async (req, res, next) => {
|
|
271
|
+
if (!ctx.options.disable && req.url === ctx.options.swUrl) if (ctx.options.devOptions.bundle) {
|
|
272
|
+
await api.generateSW();
|
|
273
|
+
const content = await fs.readFile(ctx.options.injectManifest.swDest, "utf-8");
|
|
274
|
+
await fs.rm(ctx.options.injectManifest.swDest);
|
|
275
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
276
|
+
res.write(content);
|
|
277
|
+
res.end();
|
|
278
|
+
} else {
|
|
279
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
280
|
+
res.write(`import "${toFs(path.resolve(ctx.options.injectManifest.swSrc))}";`);
|
|
281
|
+
res.end();
|
|
282
|
+
}
|
|
283
|
+
else next();
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
async load(id) {
|
|
287
|
+
if (!ctx.options.disable && !ctx.options.devOptions.bundle) {
|
|
288
|
+
if (id === normalizePath(ctx.options.injectManifest.swSrc)) {
|
|
289
|
+
await api.generateSW();
|
|
290
|
+
const content = await fs.readFile(ctx.options.injectManifest.swDest, "utf-8");
|
|
291
|
+
await fs.rm(ctx.options.injectManifest.swDest);
|
|
292
|
+
return content;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
const RESOLVED_SERWIST_VIRTUAL = `\0virtual:serwist`;
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/lib/options.ts
|
|
301
|
+
const prepareConfigForValidation = (viteConfig, { mode = process.env.NODE_ENV === "production" || process.env.NODE_ENV === "development" ? process.env.NODE_ENV : "production", base = viteConfig.base, scope: _scope, devOptions, ...injectManifest }) => {
|
|
302
|
+
const basePath = resolveBasePath(base);
|
|
303
|
+
return {
|
|
304
|
+
mode,
|
|
305
|
+
base: basePath,
|
|
306
|
+
scope: _scope || basePath,
|
|
307
|
+
devOptions,
|
|
308
|
+
...injectManifest
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
const resolveOptions = async (options, viteConfig) => {
|
|
312
|
+
const { mode, type, scope, base, disable, integration, swUrl, swSrc, swDest, plugins, rollupFormat, rollupOptions, devOptions, ...userInjectManifest } = await validateInjectManifestOptions(prepareConfigForValidation(viteConfig, options));
|
|
313
|
+
let assetsDir = slash(viteConfig.build.assetsDir ?? "assets");
|
|
314
|
+
if (assetsDir[assetsDir.length - 1] !== "/") assetsDir += "/";
|
|
315
|
+
return {
|
|
316
|
+
mode,
|
|
317
|
+
type,
|
|
318
|
+
scope,
|
|
319
|
+
base,
|
|
320
|
+
disable,
|
|
321
|
+
integration,
|
|
322
|
+
swUrl,
|
|
323
|
+
plugins,
|
|
324
|
+
rollupFormat,
|
|
325
|
+
rollupOptions,
|
|
326
|
+
devOptions,
|
|
327
|
+
injectManifest: {
|
|
328
|
+
dontCacheBustURLsMatching: new RegExp(`^${assetsDir.replace(/^\.*?\//, "")}`),
|
|
329
|
+
...userInjectManifest,
|
|
330
|
+
swSrc: path.resolve(viteConfig.root, swSrc),
|
|
331
|
+
swDest: path.resolve(viteConfig.root, viteConfig.build.outDir, swDest),
|
|
332
|
+
disablePrecacheManifest: !viteConfig.isProduction
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/plugins/main.ts
|
|
338
|
+
/**
|
|
339
|
+
* Internal plugin used by `@serwist/vite`.
|
|
340
|
+
* @internal
|
|
341
|
+
* @param ctx
|
|
342
|
+
* @param api
|
|
343
|
+
* @returns
|
|
344
|
+
*/
|
|
345
|
+
const mainPlugin = (ctx, api) => {
|
|
346
|
+
return {
|
|
347
|
+
name: "@serwist/vite",
|
|
348
|
+
enforce: "pre",
|
|
349
|
+
config() {
|
|
350
|
+
return { ssr: { noExternal: [] } };
|
|
351
|
+
},
|
|
352
|
+
async configResolved(config) {
|
|
353
|
+
ctx.viteConfig = config;
|
|
354
|
+
ctx.userOptions?.integration?.configureOptions?.(config, ctx.userOptions);
|
|
355
|
+
ctx.options = await resolveOptions(ctx.userOptions, config);
|
|
356
|
+
},
|
|
357
|
+
resolveId(id) {
|
|
358
|
+
if (id === "virtual:serwist") return RESOLVED_SERWIST_VIRTUAL;
|
|
359
|
+
},
|
|
360
|
+
load(id) {
|
|
361
|
+
if (id === RESOLVED_SERWIST_VIRTUAL) return `export const swUrl = "${path.posix.join(ctx.options.base, ctx.options.swUrl)}";
|
|
362
|
+
export const swScope = "${ctx.options.scope}";
|
|
363
|
+
export const swType = "${ctx.devEnvironment ? "module" : ctx.options.type}";
|
|
364
|
+
export const getSerwist = async () => {
|
|
365
|
+
if ("serviceWorker" in navigator) {
|
|
366
|
+
return new (await import("@serwist/window")).Serwist(swUrl, { scope: swScope, type: swType });
|
|
367
|
+
}
|
|
368
|
+
return undefined;
|
|
369
|
+
}`;
|
|
370
|
+
},
|
|
371
|
+
api
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/index.ts
|
|
376
|
+
/**
|
|
377
|
+
* Integrates Serwist into your Vite app.
|
|
378
|
+
* @param userOptions
|
|
379
|
+
* @returns
|
|
380
|
+
*/
|
|
381
|
+
const serwist = (userOptions) => {
|
|
382
|
+
const ctx = createContext(userOptions, void 0);
|
|
383
|
+
const api = createApi(ctx);
|
|
384
|
+
return [
|
|
385
|
+
mainPlugin(ctx, api),
|
|
386
|
+
buildPlugin(ctx, api),
|
|
387
|
+
devPlugin(ctx, api)
|
|
388
|
+
];
|
|
389
|
+
};
|
|
390
|
+
//#endregion
|
|
391
|
+
export { buildPlugin as build, createApi, createContext, devPlugin as dev, mainPlugin as main, resolveEntry, serwist, toFs, validateInjectManifestOptions };
|
|
392
|
+
|
|
393
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["packageJson.version","fs"],"sources":["../package.json","../src/lib/log.ts","../src/lib/modules.ts","../src/lib/api.ts","../src/lib/context.ts","../src/lib/utils.ts","../src/lib/validator.ts","../src/plugins/build.ts","../src/plugins/dev.ts","../src/lib/constants.ts","../src/lib/options.ts","../src/plugins/main.ts","../src/index.ts"],"sourcesContent":["","import type { BuildResult } from \"@serwist/build\";\nimport { cyan, dim, green, yellow } from \"kolorist\";\nimport type { ResolvedConfig } from \"vite\";\n\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\nexport const logSerwistResult = (buildResult: Pick<BuildResult, \"count\" | \"size\" | \"warnings\">, viteOptions: ResolvedConfig) => {\n const { logLevel = \"info\" } = viteOptions;\n\n if (logLevel === \"silent\") return;\n\n const { count, size, warnings } = buildResult;\n\n if (logLevel === \"info\") {\n console.info(\n [\n \"\",\n `${cyan(`@serwist/vite v${packageJson.version}`)} ${green(\"files generated.\")}`,\n `${green(\"✓\")} ${count} precache entries ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}`,\n // log build warning\n warnings && warnings.length > 0 ? yellow([\"⚠ warnings\", ...warnings.map((w) => ` ${w}`), \"\"].join(\"\\n\")) : \"\",\n ].join(\"\\n\"),\n );\n }\n};\n","import assert from \"node:assert\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type * as SerwistBuild from \"@serwist/build\";\n\nimport type { SerwistViteContext } from \"./context.js\";\n\nexport const loadSerwistBuild = async (): Promise<typeof SerwistBuild> => {\n // \"@serwist/build\" is large and makes config loading slow.\n // Since it is not always used, we only load this when it is needed.\n try {\n return await import(\"@serwist/build\");\n } catch (_) {\n // We don't have a default export, don't worry.\n return require(\"@serwist/build\");\n }\n};\n\ninterface BuildResult extends SerwistBuild.GetManifestResult {\n manifestString: string;\n}\n\nexport const injectManifest = async (options: SerwistBuild.GetManifestOptionsComplete): Promise<BuildResult> => {\n const { getFileManifestEntries } = await loadSerwistBuild();\n const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);\n const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries);\n return {\n warnings,\n size,\n count,\n manifestEntries,\n manifestString,\n };\n};\n\nexport const generateServiceWorker = async (ctx: SerwistViteContext) => {\n const { plugins, rollupOptions, rollupFormat } = ctx.options;\n\n const parsedSwDest = path.parse(ctx.options.injectManifest.swDest);\n\n let injectManifestResult: BuildResult | undefined;\n\n if (ctx.options.injectManifest.injectionPoint) {\n await ctx.options.integration?.beforeBuildServiceWorker?.(ctx.options);\n injectManifestResult = await injectManifest(ctx.options.injectManifest);\n }\n\n const isProduction = ctx.options.mode === \"production\";\n const isDev = ctx.options.mode === \"development\";\n\n if (isDev && !ctx.options.devOptions.bundle) {\n if (!injectManifestResult) {\n throw new Error(\"injectManifest failed to generate results. This is likely a bug.\");\n }\n\n const { errors, escapeRegExp, getSourceMapURL, rebasePath, replaceAndUpdateSourceMap, translateURLToSourcemapPaths } = await loadSerwistBuild();\n\n // Make sure we leave swSrc and swDest out of the precache manifest.\n for (const file of [ctx.options.injectManifest.swSrc, ctx.options.injectManifest.swDest]) {\n ctx.options.injectManifest.globIgnores!.push(\n rebasePath({\n file,\n baseDirectory: ctx.options.injectManifest.globDirectory,\n }),\n );\n }\n\n const injectionPoint = ctx.options.injectManifest.injectionPoint!;\n\n const globalRegexp = new RegExp(escapeRegExp(injectionPoint), \"g\");\n\n let swFileContents: string;\n try {\n swFileContents = await fs.readFile(ctx.options.injectManifest.swSrc, \"utf8\");\n } catch (error) {\n throw new Error(`${errors[\"invalid-sw-src\"]} ${error instanceof Error && error.message ? error.message : \"\"}`);\n }\n\n const injectionResults = swFileContents.match(globalRegexp);\n // See https://github.com/GoogleChrome/workbox/issues/2230\n if (!injectionResults) {\n throw new Error(`${errors[\"injection-point-not-found\"]} ${injectionPoint}`);\n }\n\n assert(injectionResults.length === 1, `${errors[\"multiple-injection-points\"]} ${injectionPoint}`);\n\n const filesToWrite: Record<string, string> = {};\n\n const url = getSourceMapURL(swFileContents);\n // See https://github.com/GoogleChrome/workbox/issues/2957\n const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, ctx.options.injectManifest.swSrc, ctx.options.injectManifest.swDest);\n if (warning) {\n injectManifestResult.warnings.push(warning);\n }\n\n // If our swSrc file contains a sourcemap, we would invalidate that\n // mapping if we just replaced injectionPoint with the stringified manifest.\n // Instead, we need to update the swDest contents as well as the sourcemap\n // (assuming it's a real file, not a data: URL) at the same time.\n // See https://github.com/GoogleChrome/workbox/issues/2235\n // and https://github.com/GoogleChrome/workbox/issues/2648\n if (srcPath && destPath) {\n const { map, source } = await replaceAndUpdateSourceMap({\n originalMap: JSON.parse(await fs.readFile(srcPath, \"utf8\")),\n jsFilename: path.basename(ctx.options.injectManifest.swDest),\n originalSource: swFileContents,\n replaceString: injectManifestResult.manifestString,\n searchString: injectionPoint,\n });\n\n filesToWrite[ctx.options.injectManifest.swDest] = source;\n filesToWrite[destPath] = map;\n } else {\n // If there's no sourcemap associated with swSrc, a simple string\n // replacement will suffice.\n filesToWrite[ctx.options.injectManifest.swDest] = swFileContents.replace(globalRegexp, injectManifestResult.manifestString);\n }\n\n for (const [file, contents] of Object.entries(filesToWrite)) {\n try {\n await fs.mkdir(path.dirname(file), { recursive: true });\n } catch (error: unknown) {\n throw new Error(`${errors[\"unable-to-make-sw-directory\"]} '${error instanceof Error && error.message ? error.message : \"\"}'`);\n }\n\n await fs.writeFile(file, contents);\n }\n } else {\n const define: Record<string, any> = {\n // Nuxt does some really weird stuff. During the build, they MANUALLY\n // set browser APIs, such as window, document, location,..., to `undefined`??\n // Probably some Vue or server stuff. Their `define` doesn't seem to have anything\n // particularly useful for the service worker anyway, so we don't extend it.\n ...(ctx.framework === \"nuxt\" ? undefined : ctx.viteConfig.define),\n \"process.env.NODE_ENV\": `\"${ctx.options.mode}\"`,\n };\n if (ctx.options.injectManifest.injectionPoint && injectManifestResult) {\n define[ctx.options.injectManifest.injectionPoint] = injectManifestResult.manifestString;\n }\n const { build } = await import(\"vite\");\n await build({\n logLevel: ctx.viteConfig.isProduction ? \"info\" : \"warn\",\n root: ctx.viteConfig.root,\n base: ctx.viteConfig.base,\n resolve: ctx.viteConfig.resolve,\n // Don't copy anything from public folder\n publicDir: false,\n build: {\n sourcemap: ctx.viteConfig.build.sourcemap,\n lib: {\n entry: ctx.options.injectManifest.swSrc,\n name: \"app\",\n formats: [rollupFormat],\n },\n // @ts-expect-error Currently on Vite 8 (migrated to Rolldown)'s types\n rollupOptions: {\n ...rollupOptions,\n plugins,\n output: {\n entryFileNames: parsedSwDest.base,\n },\n },\n outDir: parsedSwDest.dir,\n emptyOutDir: false,\n minify: isProduction || ctx.options.devOptions.minify,\n },\n configFile: false,\n define,\n });\n }\n\n return injectManifestResult;\n};\n","import { yellow } from \"kolorist\";\n\nimport type { SerwistViteContext } from \"./context.js\";\nimport { logSerwistResult } from \"./log.js\";\nimport { generateServiceWorker } from \"./modules.js\";\nimport type { ExtendManifestEntriesHook, SerwistViteApi } from \"./types.js\";\n\nexport const createApi = (ctx: SerwistViteContext): SerwistViteApi => {\n return {\n get disabled() {\n return ctx?.options?.disable;\n },\n async generateSW() {\n if (ctx.options.disable) {\n return undefined;\n }\n const buildResult = await generateServiceWorker(ctx);\n if (buildResult) {\n if (ctx.viteConfig.isProduction) {\n // Log Serwist result\n logSerwistResult(buildResult, ctx.viteConfig);\n } else if (buildResult.warnings && buildResult.warnings.length > 0) {\n console.warn(yellow([\"[@serwist/vite] Warnings\", ...buildResult.warnings.map((w) => ` - ${w}`), \"\"].join(\"\\n\")));\n }\n }\n },\n extendManifestEntries(fn: ExtendManifestEntriesHook) {\n const { options } = ctx;\n if (options.disable) return;\n\n const result = fn(options.injectManifest.additionalPrecacheEntries || []);\n\n if (result != null) {\n options.injectManifest.additionalPrecacheEntries = result;\n }\n },\n };\n};\n","import type { ResolvedConfig } from \"vite\";\n\nimport type { PluginOptions, PluginOptionsComplete } from \"./types.js\";\n\nexport type SerwistViteFrameworks = \"nuxt\";\n\nexport interface SerwistViteContext {\n /**\n * Resolved Vite config.\n *\n * Note: This value is set by our main plugin, located at plugins/main.ts.\n */\n viteConfig: ResolvedConfig;\n /**\n * Provided options.\n */\n userOptions: PluginOptions;\n /**\n * Resolved options.\n *\n * Note: this is different from `userOptions` in that it has been parsed, whereas\n * `userOptions` is the raw configuration that the user provides us.\n */\n options: PluginOptionsComplete;\n useImportRegister: boolean;\n /**\n * Is the plugin running on dev?\n *\n * Note: This value is set by our dev plugin, located at plugins/dev.ts.\n */\n devEnvironment: boolean;\n /** To tailor our APIs to these frameworks. */\n framework: SerwistViteFrameworks | undefined;\n}\n\nexport const createContext = (userOptions: PluginOptions, framework: SerwistViteFrameworks | undefined): SerwistViteContext => {\n return {\n userOptions,\n options: undefined!,\n viteConfig: undefined!,\n useImportRegister: false,\n devEnvironment: false,\n framework,\n };\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport const slash = (str: string) => {\n return str.replace(/\\\\/g, \"/\");\n};\n\nexport const resolveBasePath = (base: string) => {\n if (isAbsolute(base)) return base;\n return !base.startsWith(\"/\") && !base.startsWith(\"./\") ? `/${base}` : base;\n};\n\nexport const isAbsolute = (url: string) => {\n return url.match(/^(?:[a-z]+:)?\\/\\//i);\n};\n\nexport const normalizePath = (path: string) => {\n return path.replace(/\\\\/g, \"/\");\n};\n\n// Source: https://github.com/sveltejs/kit/blob/6419d3eaa7bf1b0a756b28f06a73f71fe042de0a/packages/kit/src/utils/filesystem.js\n// License: MIT\n/**\n * Internal function used by `@serwist/vite`.\n * Resolves a file path without extension. Also handles `/index` if the path\n * actually points to a directory.\n * @internal\n * @param ctx\n * @param api\n * @returns\n */\nexport const resolveEntry = (entry: string): string | null => {\n if (fs.existsSync(entry)) {\n const stats = fs.statSync(entry);\n if (stats.isDirectory()) {\n return resolveEntry(path.join(entry, \"index\"));\n }\n\n return entry;\n }\n const dir = path.dirname(entry);\n\n if (fs.existsSync(dir)) {\n const base = path.basename(entry);\n const files = fs.readdirSync(dir);\n\n const found = files.find((file) => file.replace(/\\.[^.]+$/, \"\") === base);\n\n if (found) return path.join(dir, found);\n }\n\n return null;\n};\n\n// Source: https://github.com/sveltejs/kit/blob/6419d3eaa7bf1b0a756b28f06a73f71fe042de0a/packages/kit/src/utils/filesystem.js\n// License: MIT\n/**\n * Internal function used by `@serwist/vite`.\n * Converts a filesystem path to a Vite `@fs` URL.\n * @internal\n * @param ctx\n * @param api\n * @returns\n */\nexport const toFs = (str: string) => {\n str = str.replace(/\\\\/g, \"/\");\n // Windows/Linux separation - Windows starts with a drive letter, we need a / in front there\n return `/@fs${str.startsWith(\"/\") ? \"\" : \"/\"}${str}`;\n};\n","import { SerwistConfigError, validationErrorMap } from \"@serwist/build/schema\";\nimport { z } from \"zod\";\nimport type { InjectManifestOptionsComplete } from \"./types.js\";\n\nexport const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {\n const result = await (await import(\"./schema.js\")).injectManifestOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({ moduleName: \"@serwist/vite\", message: z.prettifyError(result.error) });\n }\n return result.data;\n};\n","import type { Plugin } from \"vite\";\n\nimport type { SerwistViteContext } from \"../lib/context.js\";\nimport type { SerwistViteApi } from \"../lib/types.js\";\n\n/**\n * Internal build plugin used by `@serwist/vite`.\n * @internal\n * @param ctx\n * @param api\n * @returns\n */\nexport const buildPlugin = (ctx: SerwistViteContext, api: SerwistViteApi) => {\n return <Plugin>{\n name: \"@serwist/vite:build\",\n enforce: \"post\",\n apply: \"build\",\n closeBundle: {\n sequential: true,\n order: ctx.userOptions?.integration?.closeBundleOrder,\n async handler() {\n if (!ctx.viteConfig.build.ssr && !ctx.options.disable) {\n await api.generateSW();\n }\n },\n },\n buildEnd(error) {\n if (error) throw error;\n },\n };\n};\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport { normalizePath, type Plugin } from \"vite\";\n\nimport type { SerwistViteContext } from \"../lib/context.js\";\nimport type { SerwistViteApi } from \"../lib/types.js\";\nimport { toFs } from \"../lib/utils.js\";\n\n// This plugin handles the service worker in two ways:\n// - If `devOptions.bundle` is enabled, hook a middleware that bundles the service worker\n// through `api.generateSW()` and returns the result into Vite's dev server.\n// - Otherwise, run `injectManifest` and return the service worker through `async load(id)`. Although\n// `precacheEntries` is always `undefined`, we still do this to check the user's `injectManifest` options\n// in dev mode.\n/**\n * Internal dev plugin used by `@serwist/vite`.\n * @internal\n * @param ctx\n * @param api\n * @returns\n */\nexport const devPlugin = (ctx: SerwistViteContext, api: SerwistViteApi): Plugin => {\n return {\n name: \"@serwist/vite:dev\",\n apply: \"serve\",\n configureServer(server) {\n ctx.devEnvironment = true;\n server.middlewares.use(async (req, res, next) => {\n if (!ctx.options.disable && req.url === ctx.options.swUrl) {\n if (ctx.options.devOptions.bundle) {\n await api.generateSW();\n const content = await fs.readFile(ctx.options.injectManifest.swDest, \"utf-8\");\n await fs.rm(ctx.options.injectManifest.swDest);\n res.setHeader(\"Content-Type\", \"application/javascript\");\n res.write(content);\n res.end();\n } else {\n res.setHeader(\"Content-Type\", \"application/javascript\");\n res.write(`import \"${toFs(path.resolve(ctx.options.injectManifest.swSrc))}\";`);\n res.end();\n }\n } else {\n next();\n }\n });\n },\n async load(id) {\n if (!ctx.options.disable && !ctx.options.devOptions.bundle) {\n const swSrcId = normalizePath(ctx.options.injectManifest.swSrc);\n if (id === swSrcId) {\n await api.generateSW();\n const content = await fs.readFile(ctx.options.injectManifest.swDest, \"utf-8\");\n await fs.rm(ctx.options.injectManifest.swDest);\n return content;\n }\n }\n return undefined;\n },\n };\n};\n","export const SERWIST_VIRTUAL = \"virtual:serwist\";\nexport const RESOLVED_SERWIST_VIRTUAL = `\\0${SERWIST_VIRTUAL}`;\n","import path from \"node:path\";\nimport process from \"node:process\";\n\nimport type { ResolvedConfig } from \"vite\";\n\nimport type { PluginOptions, PluginOptionsComplete } from \"./types.js\";\nimport { resolveBasePath, slash } from \"./utils.js\";\nimport { validateInjectManifestOptions } from \"./validator.js\";\n\nconst prepareConfigForValidation = (\n viteConfig: ResolvedConfig,\n {\n mode = process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"development\" ? process.env.NODE_ENV : \"production\",\n base = viteConfig.base,\n scope: _scope,\n devOptions,\n ...injectManifest\n }: PluginOptions,\n) => {\n const basePath = resolveBasePath(base);\n return {\n mode,\n base: basePath,\n scope: _scope || basePath,\n devOptions,\n ...injectManifest,\n };\n};\n\nexport const resolveOptions = async (options: PluginOptions, viteConfig: ResolvedConfig): Promise<PluginOptionsComplete> => {\n const {\n mode,\n type,\n scope,\n base,\n disable,\n integration,\n swUrl,\n swSrc,\n swDest,\n plugins,\n rollupFormat,\n rollupOptions,\n devOptions,\n ...userInjectManifest\n } = await validateInjectManifestOptions(prepareConfigForValidation(viteConfig, options));\n\n let assetsDir = slash(viteConfig.build.assetsDir ?? \"assets\");\n if (assetsDir[assetsDir.length - 1] !== \"/\") assetsDir += \"/\";\n\n // remove './' prefix from assetsDir\n const dontCacheBustURLsMatching = new RegExp(`^${assetsDir.replace(/^\\.*?\\//, \"\")}`);\n\n const resolvedPluginOptions = {\n mode,\n type,\n scope,\n base,\n disable,\n integration,\n swUrl,\n plugins,\n rollupFormat,\n rollupOptions,\n devOptions,\n injectManifest: {\n dontCacheBustURLsMatching,\n ...userInjectManifest,\n swSrc: path.resolve(viteConfig.root, swSrc),\n swDest: path.resolve(viteConfig.root, viteConfig.build.outDir, swDest),\n disablePrecacheManifest: !viteConfig.isProduction,\n },\n } satisfies PluginOptionsComplete;\n\n return resolvedPluginOptions;\n};\n","import path from \"node:path\";\n\nimport type { Plugin, UserConfig } from \"vite\";\n\nimport { RESOLVED_SERWIST_VIRTUAL, SERWIST_VIRTUAL } from \"../lib/constants.js\";\nimport type { SerwistViteContext } from \"../lib/context.js\";\nimport { resolveOptions } from \"../lib/options.js\";\nimport type { SerwistViteApi } from \"../lib/types.js\";\n\n/**\n * Internal plugin used by `@serwist/vite`.\n * @internal\n * @param ctx\n * @param api\n * @returns\n */\nexport const mainPlugin = (ctx: SerwistViteContext, api: SerwistViteApi) => {\n return <Plugin>{\n name: \"@serwist/vite\",\n enforce: \"pre\",\n config() {\n return <UserConfig>{\n ssr: {\n noExternal: [],\n },\n };\n },\n async configResolved(config) {\n ctx.viteConfig = config;\n ctx.userOptions?.integration?.configureOptions?.(config, ctx.userOptions);\n ctx.options = await resolveOptions(ctx.userOptions, config);\n },\n resolveId(id) {\n if (id === SERWIST_VIRTUAL) {\n return RESOLVED_SERWIST_VIRTUAL;\n }\n return undefined;\n },\n load(id) {\n if (id === RESOLVED_SERWIST_VIRTUAL) {\n return `export const swUrl = \"${path.posix.join(ctx.options.base, ctx.options.swUrl)}\";\nexport const swScope = \"${ctx.options.scope}\";\nexport const swType = \"${ctx.devEnvironment ? \"module\" : ctx.options.type}\";\nexport const getSerwist = async () => {\n if (\"serviceWorker\" in navigator) {\n return new (await import(\"@serwist/window\")).Serwist(swUrl, { scope: swScope, type: swType });\n }\n return undefined;\n}`;\n }\n return undefined;\n },\n api,\n };\n};\n","import type { Plugin } from \"vite\";\n\nimport { createApi } from \"./lib/api.js\";\nimport { createContext } from \"./lib/context.js\";\nimport type { DevOptions, ExtendManifestEntriesHook, Hooks, PluginOptions, PluginOptionsComplete, SerwistViteApi } from \"./lib/types.js\";\nimport { resolveEntry, toFs } from \"./lib/utils.js\";\nimport { validateInjectManifestOptions } from \"./lib/validator.js\";\nimport { buildPlugin } from \"./plugins/build.js\";\nimport { devPlugin } from \"./plugins/dev.js\";\nimport { mainPlugin } from \"./plugins/main.js\";\n\n/**\n * Integrates Serwist into your Vite app.\n * @param userOptions\n * @returns\n */\nexport const serwist = (userOptions: PluginOptions): Plugin[] => {\n const ctx = createContext(userOptions, undefined);\n const api = createApi(ctx);\n return [mainPlugin(ctx, api), buildPlugin(ctx, api), devPlugin(ctx, api)];\n};\n\n// This allows for customization.\nexport { buildPlugin as build, createApi, createContext, devPlugin as dev, mainPlugin as main, resolveEntry, toFs, validateInjectManifestOptions };\nexport type { SerwistViteContext } from \"./lib/context.js\";\nexport type { PluginOptions, PluginOptionsComplete, Hooks, ExtendManifestEntriesHook, DevOptions, SerwistViteApi };\n"],"mappings":";;;;;;;;;;;;;;ACMA,MAAa,oBAAoB,aAA+D,gBAAgC;CAC9H,MAAM,EAAE,WAAW,WAAW;AAE9B,KAAI,aAAa,SAAU;CAE3B,MAAM,EAAE,OAAO,MAAM,aAAa;AAElC,KAAI,aAAa,OACf,SAAQ,KACN;EACE;EACA,GAAG,KAAK,kBAAkBA,UAAsB,CAAC,GAAG,MAAM,mBAAmB;EAC7E,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,oBAAoB,IAAI,KAAK,OAAO,MAAM,QAAQ,EAAE,CAAC,OAAO;EAEnF,YAAY,SAAS,SAAS,IAAI,OAAO;GAAC;GAAc,GAAG,SAAS,KAAK,MAAM,KAAK,IAAI;GAAE;GAAG,CAAC,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AACzE,OAAI,UAAU,MAAM,eAAe,IAAI,aAAa,OAAO;;EAE7D,UAAU,IAAI;AACZ,OAAI,OAAA,kBACF,QAAO;;EAIX,KAAK,IAAI;AACP,OAAI,OAAO,yBACT,QAAO,yBAAyB,KAAK,MAAM,KAAK,IAAI,QAAQ,MAAM,IAAI,QAAQ,MAAM,CAAC;0BACnE,IAAI,QAAQ,MAAM;yBACnB,IAAI,iBAAiB,WAAW,IAAI,QAAQ,KAAK;;;;;;;;EAUtE;EACD;;;;;;;;;ACrCH,MAAa,WAAW,gBAAyC;CAC/D,MAAM,MAAM,cAAc,aAAa,KAAA,EAAU;CACjD,MAAM,MAAM,UAAU,IAAI;AAC1B,QAAO;EAAC,WAAW,KAAK,IAAI;EAAE,YAAY,KAAK,IAAI;EAAE,UAAU,KAAK,IAAI;EAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/schema.d.ts
|
|
4
|
+
declare const hooks: z.ZodObject<{
|
|
5
|
+
beforeBuildServiceWorker: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
6
|
+
closeBundleOrder: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"pre">, z.ZodLiteral<"post">, z.ZodNull]>>;
|
|
7
|
+
configureOptions: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any, args_1: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const devOptions: z.ZodObject<{
|
|
10
|
+
bundle: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
minify: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"terser">, z.ZodLiteral<"esbuild">]>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
declare const injectManifestPartial: z.ZodObject<{
|
|
14
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"development">, z.ZodLiteral<"production">]>;
|
|
15
|
+
type: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"classic">, z.ZodLiteral<"module">]>>;
|
|
16
|
+
scope: z.ZodString;
|
|
17
|
+
base: z.ZodString;
|
|
18
|
+
disable: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
+
integration: z.ZodDefault<z.ZodObject<{
|
|
20
|
+
beforeBuildServiceWorker: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
21
|
+
closeBundleOrder: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"pre">, z.ZodLiteral<"post">, z.ZodNull]>>;
|
|
22
|
+
configureOptions: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any, args_1: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
swUrl: z.ZodDefault<z.ZodString>;
|
|
25
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodAny>>;
|
|
26
|
+
rollupFormat: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"es">, z.ZodLiteral<"iife">]>>;
|
|
27
|
+
rollupOptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
28
|
+
devOptions: z.ZodPrefault<z.ZodObject<{
|
|
29
|
+
bundle: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
minify: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"terser">, z.ZodLiteral<"esbuild">]>>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const injectManifestOptions: z.ZodObject<{
|
|
34
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"development">, z.ZodLiteral<"production">]>;
|
|
35
|
+
type: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"classic">, z.ZodLiteral<"module">]>>;
|
|
36
|
+
scope: z.ZodString;
|
|
37
|
+
base: z.ZodString;
|
|
38
|
+
disable: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
integration: z.ZodDefault<z.ZodObject<{
|
|
40
|
+
beforeBuildServiceWorker: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
41
|
+
closeBundleOrder: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"pre">, z.ZodLiteral<"post">, z.ZodNull]>>;
|
|
42
|
+
configureOptions: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<(args_0: any, args_1: any) => void, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodAny, z.ZodAny], null>, z.ZodVoid>>>]>>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
swUrl: z.ZodDefault<z.ZodString>;
|
|
45
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodAny>>;
|
|
46
|
+
rollupFormat: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"es">, z.ZodLiteral<"iife">]>>;
|
|
47
|
+
rollupOptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
48
|
+
devOptions: z.ZodPrefault<z.ZodObject<{
|
|
49
|
+
bundle: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
minify: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"terser">, z.ZodLiteral<"esbuild">]>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
globDirectory: z.ZodString;
|
|
53
|
+
swDest: z.ZodString;
|
|
54
|
+
injectionPoint: z.ZodDefault<z.ZodString>;
|
|
55
|
+
swSrc: z.ZodString;
|
|
56
|
+
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
57
|
+
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
58
|
+
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
|
+
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
61
|
+
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
62
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
63
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
+
url: z.ZodString;
|
|
65
|
+
}, z.core.$strict>]>>>;
|
|
66
|
+
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
68
|
+
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
69
|
+
size: z.ZodNumber;
|
|
70
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
71
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
url: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
74
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
75
|
+
size: z.ZodNumber;
|
|
76
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
77
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
url: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
82
|
+
size: z.ZodNumber;
|
|
83
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
84
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
url: z.ZodString;
|
|
86
|
+
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
87
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
88
|
+
size: z.ZodNumber;
|
|
89
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
90
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
url: z.ZodString;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
94
|
+
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
95
|
+
size: z.ZodNumber;
|
|
96
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
97
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
url: z.ZodString;
|
|
99
|
+
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
100
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
101
|
+
size: z.ZodNumber;
|
|
102
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
103
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
url: z.ZodString;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
|
+
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
108
|
+
size: z.ZodNumber;
|
|
109
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
110
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
111
|
+
url: z.ZodString;
|
|
112
|
+
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
113
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
114
|
+
size: z.ZodNumber;
|
|
115
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
116
|
+
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
url: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
120
|
+
}, z.core.$strict>>>>>>;
|
|
121
|
+
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
122
|
+
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
//#endregion
|
|
125
|
+
export { devOptions, hooks, injectManifestOptions, injectManifestPartial };
|
|
126
|
+
//# sourceMappingURL=index.schema.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.schema.d.mts","names":[],"sources":["../src/lib/schema.ts"],"mappings":";;;cAGa,KAAA,EAAK,CAAA,CAAA,SAAA;;;;;cA4BL,UAAA,EAAU,CAAA,CAAA,SAAA;;;;cAKV,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAcrB,qBAAA,EAAqB,CAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RuntimeCaching } from "serwist";
|
|
2
|
+
|
|
3
|
+
//#region src/index.worker.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The default, recommended list of caching strategies for applications
|
|
6
|
+
* built with Vite.
|
|
7
|
+
*
|
|
8
|
+
* @see https://serwist.pages.dev/docs/vite/worker-exports#default-cache
|
|
9
|
+
*/
|
|
10
|
+
declare const defaultCache: RuntimeCaching[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { defaultCache };
|
|
13
|
+
//# sourceMappingURL=index.worker.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.worker.d.mts","names":[],"sources":["../src/index.worker.ts"],"mappings":";;;;;AASA;;;;cAAa,YAAA,EAAc,cAAA"}
|