@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.
Files changed (53) hide show
  1. package/dist/chunks/schema-CF26pDQI.js +77 -0
  2. package/dist/chunks/schema-CF26pDQI.js.map +1 -0
  3. package/dist/index.d.mts +228 -0
  4. package/dist/index.d.mts.map +1 -0
  5. package/dist/index.mjs +393 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/index.schema.d.mts +126 -0
  8. package/dist/index.schema.d.mts.map +1 -0
  9. package/dist/index.schema.mjs +2 -0
  10. package/dist/index.worker.d.mts +13 -0
  11. package/dist/index.worker.d.mts.map +1 -0
  12. package/dist/index.worker.mjs +108 -0
  13. package/dist/index.worker.mjs.map +1 -0
  14. package/package.json +30 -26
  15. package/src/lib/modules.ts +1 -0
  16. package/dist/chunks/schema.js +0 -80
  17. package/dist/index.d.ts +0 -19
  18. package/dist/index.d.ts.map +0 -1
  19. package/dist/index.js +0 -400
  20. package/dist/index.schema.d.ts +0 -3
  21. package/dist/index.schema.d.ts.map +0 -1
  22. package/dist/index.schema.js +0 -3
  23. package/dist/index.worker.d.ts +0 -9
  24. package/dist/index.worker.d.ts.map +0 -1
  25. package/dist/index.worker.js +0 -118
  26. package/dist/lib/api.d.ts +0 -4
  27. package/dist/lib/api.d.ts.map +0 -1
  28. package/dist/lib/constants.d.ts +0 -3
  29. package/dist/lib/constants.d.ts.map +0 -1
  30. package/dist/lib/context.d.ts +0 -33
  31. package/dist/lib/context.d.ts.map +0 -1
  32. package/dist/lib/log.d.ts +0 -4
  33. package/dist/lib/log.d.ts.map +0 -1
  34. package/dist/lib/modules.d.ts +0 -10
  35. package/dist/lib/modules.d.ts.map +0 -1
  36. package/dist/lib/options.d.ts +0 -4
  37. package/dist/lib/options.d.ts.map +0 -1
  38. package/dist/lib/schema.d.ts +0 -122
  39. package/dist/lib/schema.d.ts.map +0 -1
  40. package/dist/lib/types.d.ts +0 -130
  41. package/dist/lib/types.d.ts.map +0 -1
  42. package/dist/lib/utils.d.ts +0 -24
  43. package/dist/lib/utils.d.ts.map +0 -1
  44. package/dist/lib/validator.d.ts +0 -3
  45. package/dist/lib/validator.d.ts.map +0 -1
  46. package/dist/plugins/build.d.ts +0 -12
  47. package/dist/plugins/build.d.ts.map +0 -1
  48. package/dist/plugins/dev.d.ts +0 -12
  49. package/dist/plugins/dev.d.ts.map +0 -1
  50. package/dist/plugins/main.d.ts +0 -12
  51. package/dist/plugins/main.d.ts.map +0 -1
  52. package/src/rollup.js +0 -23
  53. /package/{typings.d.ts → typings.d.mts} +0 -0
package/dist/index.js DELETED
@@ -1,400 +0,0 @@
1
- import { cyan, green, dim, yellow } from 'kolorist';
2
- import assert from 'node:assert';
3
- import fs from 'node:fs/promises';
4
- import path from 'node:path';
5
- import fs$1 from 'node:fs';
6
- import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
7
- import { z } from 'zod';
8
- import { normalizePath } from 'vite';
9
- import process from 'node:process';
10
-
11
- var version = "9.5.6";
12
- var packageJson = {
13
- version: version};
14
-
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") {
20
- console.info([
21
- "",
22
- `${cyan(`@serwist/vite v${packageJson.version}`)} ${green("files generated.")}`,
23
- `${green("✓")} ${count} precache entries ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}`,
24
- warnings && warnings.length > 0 ? yellow([
25
- "⚠ warnings",
26
- ...warnings.map((w)=>` ${w}`),
27
- ""
28
- ].join("\n")) : ""
29
- ].join("\n"));
30
- }
31
- };
32
-
33
- const loadSerwistBuild = async ()=>{
34
- try {
35
- return await import('@serwist/build');
36
- } catch (_) {
37
- return require("@serwist/build");
38
- }
39
- };
40
- const injectManifest = async (options)=>{
41
- const { getFileManifestEntries } = await loadSerwistBuild();
42
- const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);
43
- const manifestString = manifestEntries === undefined ? "undefined" : JSON.stringify(manifestEntries);
44
- return {
45
- warnings,
46
- size,
47
- count,
48
- manifestEntries,
49
- manifestString
50
- };
51
- };
52
- const generateServiceWorker = async (ctx)=>{
53
- const { plugins, rollupOptions, rollupFormat } = ctx.options;
54
- const parsedSwDest = path.parse(ctx.options.injectManifest.swDest);
55
- let injectManifestResult;
56
- if (ctx.options.injectManifest.injectionPoint) {
57
- await ctx.options.integration?.beforeBuildServiceWorker?.(ctx.options);
58
- injectManifestResult = await injectManifest(ctx.options.injectManifest);
59
- }
60
- const isProduction = ctx.options.mode === "production";
61
- const isDev = ctx.options.mode === "development";
62
- if (isDev && !ctx.options.devOptions.bundle) {
63
- if (!injectManifestResult) {
64
- throw new Error("injectManifest failed to generate results. This is likely a bug.");
65
- }
66
- const { errors, escapeRegExp, getSourceMapURL, rebasePath, replaceAndUpdateSourceMap, translateURLToSourcemapPaths } = await loadSerwistBuild();
67
- for (const file of [
68
- ctx.options.injectManifest.swSrc,
69
- ctx.options.injectManifest.swDest
70
- ]){
71
- ctx.options.injectManifest.globIgnores.push(rebasePath({
72
- file,
73
- baseDirectory: ctx.options.injectManifest.globDirectory
74
- }));
75
- }
76
- const injectionPoint = ctx.options.injectManifest.injectionPoint;
77
- const globalRegexp = new RegExp(escapeRegExp(injectionPoint), "g");
78
- let swFileContents;
79
- try {
80
- swFileContents = await fs.readFile(ctx.options.injectManifest.swSrc, "utf8");
81
- } catch (error) {
82
- throw new Error(`${errors["invalid-sw-src"]} ${error instanceof Error && error.message ? error.message : ""}`);
83
- }
84
- const injectionResults = swFileContents.match(globalRegexp);
85
- if (!injectionResults) {
86
- throw new Error(`${errors["injection-point-not-found"]} ${injectionPoint}`);
87
- }
88
- assert(injectionResults.length === 1, `${errors["multiple-injection-points"]} ${injectionPoint}`);
89
- const filesToWrite = {};
90
- const url = getSourceMapURL(swFileContents);
91
- const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, ctx.options.injectManifest.swSrc, ctx.options.injectManifest.swDest);
92
- if (warning) {
93
- injectManifestResult.warnings.push(warning);
94
- }
95
- if (srcPath && destPath) {
96
- const { map, source } = await replaceAndUpdateSourceMap({
97
- originalMap: JSON.parse(await fs.readFile(srcPath, "utf8")),
98
- jsFilename: path.basename(ctx.options.injectManifest.swDest),
99
- originalSource: swFileContents,
100
- replaceString: injectManifestResult.manifestString,
101
- searchString: injectionPoint
102
- });
103
- filesToWrite[ctx.options.injectManifest.swDest] = source;
104
- filesToWrite[destPath] = map;
105
- } else {
106
- filesToWrite[ctx.options.injectManifest.swDest] = swFileContents.replace(globalRegexp, injectManifestResult.manifestString);
107
- }
108
- for (const [file, contents] of Object.entries(filesToWrite)){
109
- try {
110
- await fs.mkdir(path.dirname(file), {
111
- recursive: true
112
- });
113
- } catch (error) {
114
- throw new Error(`${errors["unable-to-make-sw-directory"]} '${error instanceof Error && error.message ? error.message : ""}'`);
115
- }
116
- await fs.writeFile(file, contents);
117
- }
118
- } else {
119
- const define = {
120
- ...ctx.framework === "nuxt" ? undefined : ctx.viteConfig.define,
121
- "process.env.NODE_ENV": `"${ctx.options.mode}"`
122
- };
123
- if (ctx.options.injectManifest.injectionPoint && injectManifestResult) {
124
- define[ctx.options.injectManifest.injectionPoint] = injectManifestResult.manifestString;
125
- }
126
- const { build } = await import('vite');
127
- await build({
128
- logLevel: ctx.viteConfig.isProduction ? "info" : "warn",
129
- root: ctx.viteConfig.root,
130
- base: ctx.viteConfig.base,
131
- resolve: ctx.viteConfig.resolve,
132
- publicDir: false,
133
- build: {
134
- sourcemap: ctx.viteConfig.build.sourcemap,
135
- lib: {
136
- entry: ctx.options.injectManifest.swSrc,
137
- name: "app",
138
- formats: [
139
- rollupFormat
140
- ]
141
- },
142
- rollupOptions: {
143
- ...rollupOptions,
144
- plugins,
145
- output: {
146
- entryFileNames: parsedSwDest.base
147
- }
148
- },
149
- outDir: parsedSwDest.dir,
150
- emptyOutDir: false,
151
- minify: isProduction || ctx.options.devOptions.minify
152
- },
153
- configFile: false,
154
- define
155
- });
156
- }
157
- return injectManifestResult;
158
- };
159
-
160
- const createApi = (ctx)=>{
161
- return {
162
- get disabled () {
163
- return ctx?.options?.disable;
164
- },
165
- async generateSW () {
166
- if (ctx.options.disable) {
167
- return undefined;
168
- }
169
- const buildResult = await generateServiceWorker(ctx);
170
- if (buildResult) {
171
- if (ctx.viteConfig.isProduction) {
172
- logSerwistResult(buildResult, ctx.viteConfig);
173
- } else if (buildResult.warnings && buildResult.warnings.length > 0) {
174
- console.warn(yellow([
175
- "[@serwist/vite] Warnings",
176
- ...buildResult.warnings.map((w)=>` - ${w}`),
177
- ""
178
- ].join("\n")));
179
- }
180
- }
181
- },
182
- extendManifestEntries (fn) {
183
- const { options } = ctx;
184
- if (options.disable) return;
185
- const result = fn(options.injectManifest.additionalPrecacheEntries || []);
186
- if (result != null) {
187
- options.injectManifest.additionalPrecacheEntries = result;
188
- }
189
- }
190
- };
191
- };
192
-
193
- const createContext = (userOptions, framework)=>{
194
- return {
195
- userOptions,
196
- options: undefined,
197
- viteConfig: undefined,
198
- useImportRegister: false,
199
- devEnvironment: false,
200
- framework
201
- };
202
- };
203
-
204
- const slash = (str)=>{
205
- return str.replace(/\\/g, "/");
206
- };
207
- const resolveBasePath = (base)=>{
208
- if (isAbsolute(base)) return base;
209
- return !base.startsWith("/") && !base.startsWith("./") ? `/${base}` : base;
210
- };
211
- const isAbsolute = (url)=>{
212
- return url.match(/^(?:[a-z]+:)?\/\//i);
213
- };
214
- const resolveEntry = (entry)=>{
215
- if (fs$1.existsSync(entry)) {
216
- const stats = fs$1.statSync(entry);
217
- if (stats.isDirectory()) {
218
- return resolveEntry(path.join(entry, "index"));
219
- }
220
- return entry;
221
- }
222
- const dir = path.dirname(entry);
223
- if (fs$1.existsSync(dir)) {
224
- const base = path.basename(entry);
225
- const files = fs$1.readdirSync(dir);
226
- const found = files.find((file)=>file.replace(/\.[^.]+$/, "") === base);
227
- if (found) return path.join(dir, found);
228
- }
229
- return null;
230
- };
231
- const toFs = (str)=>{
232
- str = str.replace(/\\/g, "/");
233
- return `/@fs${str.startsWith("/") ? "" : "/"}${str}`;
234
- };
235
-
236
- const validateInjectManifestOptions = async (input)=>{
237
- const result = await (await import('./chunks/schema.js')).injectManifestOptions.spa(input, {
238
- error: validationErrorMap
239
- });
240
- if (!result.success) {
241
- throw new SerwistConfigError({
242
- moduleName: "@serwist/vite",
243
- message: z.prettifyError(result.error)
244
- });
245
- }
246
- return result.data;
247
- };
248
-
249
- const buildPlugin = (ctx, api)=>{
250
- return {
251
- name: "@serwist/vite:build",
252
- enforce: "post",
253
- apply: "build",
254
- closeBundle: {
255
- sequential: true,
256
- order: ctx.userOptions?.integration?.closeBundleOrder,
257
- async handler () {
258
- if (!ctx.viteConfig.build.ssr && !ctx.options.disable) {
259
- await api.generateSW();
260
- }
261
- }
262
- },
263
- buildEnd (error) {
264
- if (error) throw error;
265
- }
266
- };
267
- };
268
-
269
- const devPlugin = (ctx, api)=>{
270
- return {
271
- name: "@serwist/vite:dev",
272
- apply: "serve",
273
- configureServer (server) {
274
- ctx.devEnvironment = true;
275
- server.middlewares.use(async (req, res, next)=>{
276
- if (!ctx.options.disable && req.url === ctx.options.swUrl) {
277
- if (ctx.options.devOptions.bundle) {
278
- await api.generateSW();
279
- const content = await fs.readFile(ctx.options.injectManifest.swDest, "utf-8");
280
- await fs.rm(ctx.options.injectManifest.swDest);
281
- res.setHeader("Content-Type", "application/javascript");
282
- res.write(content);
283
- res.end();
284
- } else {
285
- res.setHeader("Content-Type", "application/javascript");
286
- res.write(`import "${toFs(path.resolve(ctx.options.injectManifest.swSrc))}";`);
287
- res.end();
288
- }
289
- } else {
290
- next();
291
- }
292
- });
293
- },
294
- async load (id) {
295
- if (!ctx.options.disable && !ctx.options.devOptions.bundle) {
296
- const swSrcId = normalizePath(ctx.options.injectManifest.swSrc);
297
- if (id === swSrcId) {
298
- await api.generateSW();
299
- const content = await fs.readFile(ctx.options.injectManifest.swDest, "utf-8");
300
- await fs.rm(ctx.options.injectManifest.swDest);
301
- return content;
302
- }
303
- }
304
- return undefined;
305
- }
306
- };
307
- };
308
-
309
- const SERWIST_VIRTUAL = "virtual:serwist";
310
- const RESOLVED_SERWIST_VIRTUAL = `\0${SERWIST_VIRTUAL}`;
311
-
312
- 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 })=>{
313
- const basePath = resolveBasePath(base);
314
- return {
315
- mode,
316
- base: basePath,
317
- scope: _scope || basePath,
318
- devOptions,
319
- ...injectManifest
320
- };
321
- };
322
- const resolveOptions = async (options, viteConfig)=>{
323
- const { mode, type, scope, base, disable, integration, swUrl, swSrc, swDest, plugins, rollupFormat, rollupOptions, devOptions, ...userInjectManifest } = await validateInjectManifestOptions(prepareConfigForValidation(viteConfig, options));
324
- let assetsDir = slash(viteConfig.build.assetsDir ?? "assets");
325
- if (assetsDir[assetsDir.length - 1] !== "/") assetsDir += "/";
326
- const dontCacheBustURLsMatching = new RegExp(`^${assetsDir.replace(/^\.*?\//, "")}`);
327
- const resolvedPluginOptions = {
328
- mode,
329
- type,
330
- scope,
331
- base,
332
- disable,
333
- integration,
334
- swUrl,
335
- plugins,
336
- rollupFormat,
337
- rollupOptions,
338
- devOptions,
339
- injectManifest: {
340
- dontCacheBustURLsMatching,
341
- ...userInjectManifest,
342
- swSrc: path.resolve(viteConfig.root, swSrc),
343
- swDest: path.resolve(viteConfig.root, viteConfig.build.outDir, swDest),
344
- disablePrecacheManifest: !viteConfig.isProduction
345
- }
346
- };
347
- return resolvedPluginOptions;
348
- };
349
-
350
- const mainPlugin = (ctx, api)=>{
351
- return {
352
- name: "@serwist/vite",
353
- enforce: "pre",
354
- config () {
355
- return {
356
- ssr: {
357
- noExternal: []
358
- }
359
- };
360
- },
361
- async configResolved (config) {
362
- ctx.viteConfig = config;
363
- ctx.userOptions?.integration?.configureOptions?.(config, ctx.userOptions);
364
- ctx.options = await resolveOptions(ctx.userOptions, config);
365
- },
366
- resolveId (id) {
367
- if (id === SERWIST_VIRTUAL) {
368
- return RESOLVED_SERWIST_VIRTUAL;
369
- }
370
- return undefined;
371
- },
372
- load (id) {
373
- if (id === RESOLVED_SERWIST_VIRTUAL) {
374
- return `export const swUrl = "${path.posix.join(ctx.options.base, ctx.options.swUrl)}";
375
- export const swScope = "${ctx.options.scope}";
376
- export const swType = "${ctx.devEnvironment ? "module" : ctx.options.type}";
377
- export const getSerwist = async () => {
378
- if ("serviceWorker" in navigator) {
379
- return new (await import("@serwist/window")).Serwist(swUrl, { scope: swScope, type: swType });
380
- }
381
- return undefined;
382
- }`;
383
- }
384
- return undefined;
385
- },
386
- api
387
- };
388
- };
389
-
390
- const serwist = (userOptions)=>{
391
- const ctx = createContext(userOptions, undefined);
392
- const api = createApi(ctx);
393
- return [
394
- mainPlugin(ctx, api),
395
- buildPlugin(ctx, api),
396
- devPlugin(ctx, api)
397
- ];
398
- };
399
-
400
- export { buildPlugin as build, createApi, createContext, devPlugin as dev, mainPlugin as main, resolveEntry, serwist, toFs, validateInjectManifestOptions };
@@ -1,3 +0,0 @@
1
- import { devOptions, hooks, injectManifestOptions, injectManifestPartial } from "./lib/schema.js";
2
- export { hooks, devOptions, injectManifestPartial, injectManifestOptions };
3
- //# sourceMappingURL=index.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- export { devOptions, hooks, injectManifestOptions, injectManifestPartial } from './chunks/schema.js';
2
- import '@serwist/build/schema';
3
- import 'zod';
@@ -1,9 +0,0 @@
1
- import type { RuntimeCaching } from "serwist";
2
- /**
3
- * The default, recommended list of caching strategies for applications
4
- * built with Vite.
5
- *
6
- * @see https://serwist.pages.dev/docs/vite/worker-exports#default-cache
7
- */
8
- export declare const defaultCache: RuntimeCaching[];
9
- //# sourceMappingURL=index.worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.worker.d.ts","sourceRoot":"","sources":["../src/index.worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAmHpC,CAAC"}
@@ -1,118 +0,0 @@
1
- import { NetworkOnly, CacheFirst, StaleWhileRevalidate, NetworkFirst, ExpirationPlugin } from 'serwist';
2
-
3
- const defaultCache = import.meta.env.DEV ? [
4
- {
5
- matcher: /.*/i,
6
- handler: new NetworkOnly()
7
- }
8
- ] : [
9
- {
10
- matcher: /^https:\/\/fonts\.(?:googleapis|gstatic)\.com\/.*/i,
11
- handler: new CacheFirst({
12
- cacheName: "google-fonts",
13
- plugins: [
14
- new ExpirationPlugin({
15
- maxEntries: 4,
16
- maxAgeSeconds: 365 * 24 * 60 * 60,
17
- maxAgeFrom: "last-used"
18
- })
19
- ]
20
- })
21
- },
22
- {
23
- matcher: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
24
- handler: new StaleWhileRevalidate({
25
- cacheName: "static-font-assets",
26
- plugins: [
27
- new ExpirationPlugin({
28
- maxEntries: 4,
29
- maxAgeSeconds: 7 * 24 * 60 * 60,
30
- maxAgeFrom: "last-used"
31
- })
32
- ]
33
- })
34
- },
35
- {
36
- matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
37
- handler: new StaleWhileRevalidate({
38
- cacheName: "static-image-assets",
39
- plugins: [
40
- new ExpirationPlugin({
41
- maxEntries: 64,
42
- maxAgeSeconds: 24 * 60 * 60,
43
- maxAgeFrom: "last-used"
44
- })
45
- ]
46
- })
47
- },
48
- {
49
- matcher: /\.(?:js)$/i,
50
- handler: new StaleWhileRevalidate({
51
- cacheName: "static-js-assets",
52
- plugins: [
53
- new ExpirationPlugin({
54
- maxEntries: 32,
55
- maxAgeSeconds: 24 * 60 * 60,
56
- maxAgeFrom: "last-used"
57
- })
58
- ]
59
- })
60
- },
61
- {
62
- matcher: /\.(?:css|less)$/i,
63
- handler: new StaleWhileRevalidate({
64
- cacheName: "static-style-assets",
65
- plugins: [
66
- new ExpirationPlugin({
67
- maxEntries: 32,
68
- maxAgeSeconds: 24 * 60 * 60,
69
- maxAgeFrom: "last-used"
70
- })
71
- ]
72
- })
73
- },
74
- {
75
- matcher: /\.(?:json|xml|csv)$/i,
76
- handler: new NetworkFirst({
77
- cacheName: "static-data-assets",
78
- plugins: [
79
- new ExpirationPlugin({
80
- maxEntries: 32,
81
- maxAgeSeconds: 24 * 60 * 60,
82
- maxAgeFrom: "last-used"
83
- })
84
- ]
85
- })
86
- },
87
- {
88
- matcher: /\/api\/.*$/i,
89
- method: "GET",
90
- handler: new NetworkFirst({
91
- cacheName: "apis",
92
- plugins: [
93
- new ExpirationPlugin({
94
- maxEntries: 16,
95
- maxAgeSeconds: 24 * 60 * 60,
96
- maxAgeFrom: "last-used"
97
- })
98
- ],
99
- networkTimeoutSeconds: 10
100
- })
101
- },
102
- {
103
- matcher: /.*/i,
104
- handler: new NetworkFirst({
105
- cacheName: "others",
106
- plugins: [
107
- new ExpirationPlugin({
108
- maxEntries: 32,
109
- maxAgeSeconds: 24 * 60 * 60,
110
- maxAgeFrom: "last-used"
111
- })
112
- ],
113
- networkTimeoutSeconds: 10
114
- })
115
- }
116
- ];
117
-
118
- export { defaultCache };
package/dist/lib/api.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { SerwistViteContext } from "./context.js";
2
- import type { SerwistViteApi } from "./types.js";
3
- export declare const createApi: (ctx: SerwistViteContext) => SerwistViteApi;
4
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EAA6B,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5E,eAAO,MAAM,SAAS,GAAI,KAAK,kBAAkB,KAAG,cA8BnD,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const SERWIST_VIRTUAL = "virtual:serwist";
2
- export declare const RESOLVED_SERWIST_VIRTUAL = "\0virtual:serwist";
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,wBAAwB,sBAAyB,CAAC"}
@@ -1,33 +0,0 @@
1
- import type { ResolvedConfig } from "vite";
2
- import type { PluginOptions, PluginOptionsComplete } from "./types.js";
3
- export type SerwistViteFrameworks = "nuxt";
4
- export interface SerwistViteContext {
5
- /**
6
- * Resolved Vite config.
7
- *
8
- * Note: This value is set by our main plugin, located at plugins/main.ts.
9
- */
10
- viteConfig: ResolvedConfig;
11
- /**
12
- * Provided options.
13
- */
14
- userOptions: PluginOptions;
15
- /**
16
- * Resolved options.
17
- *
18
- * Note: this is different from `userOptions` in that it has been parsed, whereas
19
- * `userOptions` is the raw configuration that the user provides us.
20
- */
21
- options: PluginOptionsComplete;
22
- useImportRegister: boolean;
23
- /**
24
- * Is the plugin running on dev?
25
- *
26
- * Note: This value is set by our dev plugin, located at plugins/dev.ts.
27
- */
28
- devEnvironment: boolean;
29
- /** To tailor our APIs to these frameworks. */
30
- framework: SerwistViteFrameworks | undefined;
31
- }
32
- export declare const createContext: (userOptions: PluginOptions, framework: SerwistViteFrameworks | undefined) => SerwistViteContext;
33
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/lib/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,WAAW,EAAE,aAAa,CAAC;IAC3B;;;;;OAKG;IACH,OAAO,EAAE,qBAAqB,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,SAAS,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC9C;AAED,eAAO,MAAM,aAAa,GAAI,aAAa,aAAa,EAAE,WAAW,qBAAqB,GAAG,SAAS,KAAG,kBASxG,CAAC"}
package/dist/lib/log.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { BuildResult } from "@serwist/build";
2
- import type { ResolvedConfig } from "vite";
3
- export declare const logSerwistResult: (buildResult: Pick<BuildResult, "count" | "size" | "warnings">, viteOptions: ResolvedConfig) => void;
4
- //# sourceMappingURL=log.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/lib/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAI3C,eAAO,MAAM,gBAAgB,GAAI,aAAa,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,EAAE,aAAa,cAAc,SAkB1H,CAAC"}
@@ -1,10 +0,0 @@
1
- import type * as SerwistBuild from "@serwist/build";
2
- import type { SerwistViteContext } from "./context.js";
3
- export declare const loadSerwistBuild: () => Promise<typeof SerwistBuild>;
4
- interface BuildResult extends SerwistBuild.GetManifestResult {
5
- manifestString: string;
6
- }
7
- export declare const injectManifest: (options: SerwistBuild.GetManifestOptionsComplete) => Promise<BuildResult>;
8
- export declare const generateServiceWorker: (ctx: SerwistViteContext) => Promise<BuildResult | undefined>;
9
- export {};
10
- //# sourceMappingURL=modules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/lib/modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,OAAO,YAAY,CASpE,CAAC;AAEF,UAAU,WAAY,SAAQ,YAAY,CAAC,iBAAiB;IAC1D,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,GAAU,SAAS,YAAY,CAAC,0BAA0B,KAAG,OAAO,CAAC,WAAW,CAW1G,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,KAAK,kBAAkB,qCAwIlE,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { ResolvedConfig } from "vite";
2
- import type { PluginOptions, PluginOptionsComplete } from "./types.js";
3
- export declare const resolveOptions: (options: PluginOptions, viteConfig: ResolvedConfig) => Promise<PluginOptionsComplete>;
4
- //# sourceMappingURL=options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/lib/options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAwBvE,eAAO,MAAM,cAAc,GAAU,SAAS,aAAa,EAAE,YAAY,cAAc,KAAG,OAAO,CAAC,qBAAqB,CA8CtH,CAAC"}