@unplugin-pwa/core 0.0.0 → 0.0.2

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -2
  3. package/client.d.ts +6 -0
  4. package/dist/additional-manifest-entries.d.mts +10 -0
  5. package/dist/additional-manifest-entries.mjs +60 -0
  6. package/dist/build-pwa-asset.d.mts +18 -0
  7. package/dist/build-pwa-asset.mjs +87 -0
  8. package/dist/config.d.mts +75 -0
  9. package/dist/config.mjs +293 -0
  10. package/dist/constants.d.mts +31 -0
  11. package/dist/constants.mjs +41 -0
  12. package/dist/context-types.d.mts +155 -0
  13. package/dist/context.d.mts +15 -0
  14. package/dist/context.mjs +58 -0
  15. package/dist/create-generate-register-sw-script.d.mts +15 -0
  16. package/dist/create-generate-register-sw-script.mjs +27 -0
  17. package/dist/create-web-manifest-html-link.d.mts +13 -0
  18. package/dist/create-web-manifest-html-link.mjs +21 -0
  19. package/dist/dev/prepare-sw-names-and-glob-directory.d.mts +18 -0
  20. package/dist/dev/prepare-sw-names-and-glob-directory.mjs +75 -0
  21. package/dist/dev/prepare-temp-folder.d.mts +9 -0
  22. package/dist/dev/prepare-temp-folder.mjs +44 -0
  23. package/dist/dual-sw-utilities.d.mts +9 -0
  24. package/dist/dual-sw-utilities.mjs +16 -0
  25. package/dist/generate-register-sw.d.mts +14 -0
  26. package/dist/generate-register-sw.mjs +22 -0
  27. package/dist/generate-web-manifest.d.mts +9 -0
  28. package/dist/generate-web-manifest.mjs +12 -0
  29. package/dist/helpers.d.mts +33 -0
  30. package/dist/helpers.mjs +132 -0
  31. package/dist/html.d.mts +8 -0
  32. package/dist/html.mjs +28 -0
  33. package/dist/index.d.mts +9 -0
  34. package/dist/inject-generate-register-sw.d.mts +16 -0
  35. package/dist/inject-generate-register-sw.mjs +22 -0
  36. package/dist/inject-web-manifest-html-link.d.mts +14 -0
  37. package/dist/inject-web-manifest-html-link.mjs +20 -0
  38. package/dist/inspector-utils.d.mts +26 -0
  39. package/dist/inspector-utils.mjs +47 -0
  40. package/dist/logs.d.mts +8 -0
  41. package/dist/logs.mjs +19 -0
  42. package/dist/package-DpKc2x3j.mjs +10 -0
  43. package/dist/prepare-pwa-context.d.mts +11 -0
  44. package/dist/prepare-pwa-context.mjs +135 -0
  45. package/dist/prepare-sw-names.d.mts +11 -0
  46. package/dist/prepare-sw-names.mjs +45 -0
  47. package/dist/pwa-assets/build.d.mts +9 -0
  48. package/dist/pwa-assets/build.mjs +15 -0
  49. package/dist/pwa-assets/config.d.mts +10 -0
  50. package/dist/pwa-assets/config.mjs +136 -0
  51. package/dist/pwa-assets/dev.d.mts +11 -0
  52. package/dist/pwa-assets/dev.mjs +35 -0
  53. package/dist/pwa-assets/generator.d.mts +20 -0
  54. package/dist/pwa-assets/generator.mjs +31 -0
  55. package/dist/pwa-assets/html.d.mts +11 -0
  56. package/dist/pwa-assets/html.mjs +47 -0
  57. package/dist/pwa-assets/manifest.d.mts +10 -0
  58. package/dist/pwa-assets/manifest.mjs +15 -0
  59. package/dist/pwa-assets/options.d.mts +9 -0
  60. package/dist/pwa-assets/options.mjs +34 -0
  61. package/dist/pwa-assets/types.d.mts +9 -0
  62. package/dist/pwa-assets/utils.d.mts +11 -0
  63. package/dist/pwa-assets/utils.mjs +48 -0
  64. package/dist/resolve-inspector-dist.d.mts +11 -0
  65. package/dist/resolve-inspector-dist.mjs +25 -0
  66. package/dist/types-B60e7Nq4.d.mts +67 -0
  67. package/dist/types-BhwjnGLn.d.mts +703 -0
  68. package/info.d.ts +71 -0
  69. package/package.json +133 -7
  70. package/preact.d.ts +17 -0
  71. package/pwa-assets.d.ts +40 -0
  72. package/react-legacy.d.ts +22 -0
  73. package/react.d.ts +17 -0
  74. package/solid.d.ts +17 -0
  75. package/svelte.d.ts +17 -0
  76. package/types/index.d.ts +43 -0
  77. package/types/package.json +3 -0
  78. package/vanillajs.d.ts +13 -0
  79. package/vue.d.ts +17 -0
  80. package/index.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-PRESENT Anthony Fu <https://github.com/antfu>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,104 @@
1
- # @unplugin-pwa/core
1
+ <p align='center'>
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vite-pwa/.github/main/unplugin-pwa-core-hero-dark.svg" />
4
+ <img src="https://raw.githubusercontent.com/vite-pwa/.github/main/unplugin-pwa-core-hero.svg" alt="Bundler-agnostic core logic and utilities for PWA logo">
5
+ </picture>
6
+ </p>
2
7
 
3
- This is a stub package published by setup-trusted-publishing to enable OIDC trusted publishing configuration.
8
+ <h1 align="center">Bundler-agnostic core logic and utilities for PWA</h1>
9
+
10
+ <p align='center'>
11
+ <a href='https://npmx.dev/package/@unplugin-pwa/core' target="_blank" rel="noopener noreferrer">
12
+ <img src='https://img.shields.io/npm/v/@unplugin-pwa/core?color=33A6B8&label=' alt="NPM version">
13
+ </a>
14
+ <a href="https://npmx.dev/package/@unplugin-pwa/core" target="_blank" rel="noopener noreferrer">
15
+ <img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@unplugin-pwa/core?color=476582&label=">
16
+ </a>
17
+ <a href="https://unplugin-pwa.netlify.app/unplugin-pwa/core.html" target="_blank" rel="noopener noreferrer">
18
+ <img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
19
+ </a>
20
+ <br>
21
+ <a href="https://github.com/vite-pwa/unplugin-pwa" target="_blank" rel="noopener noreferrer">
22
+ <img alt="GitHub stars" src="https://img.shields.io/github/stars/vite-pwa/unplugin-pwa?style=social">
23
+ </a>
24
+ </p>
25
+
26
+ <br>
27
+
28
+ <p align="center">
29
+ <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
30
+ <img src="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg" alt="Anthony Fu SVG sponsors image" />
31
+ </a>
32
+ </p>
33
+
34
+ ## 🧱 What is `@unplugin-pwa/core`?
35
+
36
+ The bundler-agnostic foundation of `unplugin-pwa`. It contains the shared PWA logic (configuration resolution, Web App Manifest, service worker registration, virtual modules, PWA assets and inspector utilities) with no dependency on any specific bundler.
37
+
38
+ > 💡 **Note:** this package is aimed at integration authors. If you just want to add PWA support to your app, use an integration such as [`@unplugin-pwa/vite`](https://npmx.dev/package/@unplugin-pwa/vite) instead.
39
+
40
+ ## 🧩 What's inside?
41
+
42
+ Each area is exposed as its own subpath export, so you only import what you need and everything stays tree-shakable.
43
+
44
+ | Area | Subpaths |
45
+ | --- | --- |
46
+ | Configuration and context | `config`, `context`, `context-types`, `constants`, `prepare-pwa-context`, `prepare-sw-names` |
47
+ | Web App Manifest | `generate-web-manifest`, `create-web-manifest-html-link`, `inject-web-manifest-html-link` |
48
+ | Service worker registration | `generate-register-sw`, `create-generate-register-sw-script`, `inject-generate-register-sw`, `generate-virtual-module` |
49
+ | Service worker utilities | `additional-manifest-entries`, `dual-sw-utilities`, `build-pwa-asset` |
50
+ | Development | `dev/prepare-sw-names-and-glob-directory`, `dev/prepare-temp-folder` |
51
+ | PWA Assets | `pwa-assets/*` (`build`, `config`, `dev`, `generator`, `html`, `manifest`, `options`, `types`, `utils`) |
52
+ | Inspector | `inspector-utils`, `resolve-inspector-dist` |
53
+ | Misc | `html`, `helpers`, `logs` |
54
+
55
+ ## 🏷️ Client types
56
+
57
+ The virtual module and framework type declarations also live here, shared by all integrations:
58
+
59
+ | Subpath | Use it for |
60
+ | --- | --- |
61
+ | `@unplugin-pwa/core/client` | Virtual modules (base) |
62
+ | `@unplugin-pwa/core/vanillajs` | Vanilla JavaScript |
63
+ | `@unplugin-pwa/core/vue` | Vue 3 |
64
+ | `@unplugin-pwa/core/react` | React |
65
+ | `@unplugin-pwa/core/react-legacy` | React (legacy) |
66
+ | `@unplugin-pwa/core/preact` | Preact |
67
+ | `@unplugin-pwa/core/solid` | SolidJS |
68
+ | `@unplugin-pwa/core/svelte` | Svelte |
69
+ | `@unplugin-pwa/core/info` | `virtual:pwa-info` |
70
+ | `@unplugin-pwa/core/pwa-assets` | PWA Assets virtual modules |
71
+
72
+ ```json
73
+ {
74
+ "compilerOptions": {
75
+ "types": ["@unplugin-pwa/core/vue"]
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## 📋 Requirements
81
+
82
+ `@unplugin-pwa/core` requires **Node 22.14.0 or above**.
83
+
84
+ The following peer dependencies are all optional; install them only if your integration needs them:
85
+
86
+ - `vite`: from 3.1 to 8.
87
+ - `rolldown`: 1.0.0 or above.
88
+ - `@vite-pwa/assets-generator`: 1.x or 2.x, only when using PWA Assets.
89
+
90
+ ## 📦 Install
91
+
92
+ ```bash
93
+ npm i -D @unplugin-pwa/core
94
+
95
+ # yarn
96
+ yarn add -D @unplugin-pwa/core
97
+
98
+ # pnpm
99
+ pnpm add -D @unplugin-pwa/core
100
+ ```
101
+
102
+ ## 📄 License
103
+
104
+ [MIT](./LICENSE) License &copy; 2026-PRESENT [Anthony Fu](https://github.com/antfu)
package/client.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import './vue.d.ts'
2
+ import './preact.d.ts'
3
+ import './react.d.ts'
4
+ import './svelte.d.ts'
5
+ import './solid.d.ts'
6
+ import './vanillajs.d.ts'
@@ -0,0 +1,10 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { PWAPluginContext } from "./context-types.mjs";
9
+ import { ManifestEntry } from "@vite-pwa/workbox-build/types";
10
+ export declare function additionalManifestEntriesFactory(ctx: PWAPluginContext<any, any, any>, mapFile: (url: string) => string): () => AsyncGenerator<string | ManifestEntry, undefined, void>;
@@ -0,0 +1,60 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { generateWebManifest } from "./generate-web-manifest.mjs";
9
+ // src/additional-manifest-entries.ts
10
+ function additionalManifestEntriesFactory(ctx, mapFile) {
11
+ return async function* additionalManifestEntries() {
12
+ const { includeManifest, includeManifestIcons, includeAssets, includeManifestShortcutIcons, includeManifestScreenshots } = ctx.resolvedOptions;
13
+ if (includeManifest || includeManifestIcons || includeAssets || includeManifestScreenshots || includeManifestShortcutIcons) {
14
+ const manifest = ctx.resolvedOptions.manifest;
15
+ const [{ hash }, { readFile }] = await Promise.all([import("node:crypto"), import("node:fs/promises")]);
16
+ if (manifest) {
17
+ if (includeManifest) yield {
18
+ url: ctx.resolvedOptions.manifestFilename,
19
+ revision: hash("md5", generateWebManifest(ctx), "hex")
20
+ };
21
+ if (includeManifestIcons && manifest.icons) {
22
+ const consumerIcons = /* @__PURE__ */ new Set();
23
+ if (ctx.consumerOptions.manifest && ctx.consumerOptions.manifest.icons) {
24
+ for (const icon of ctx.consumerOptions.manifest.icons) if (icon.src) consumerIcons.add(mapFile(icon.src));
25
+ }
26
+ for (const icon of manifest.icons) if (icon.src) {
27
+ const path = mapFile(icon.src);
28
+ if (!consumerIcons.has(path)) continue;
29
+ yield {
30
+ url: icon.src,
31
+ revision: hash("md5", await readFile(path, "utf-8"), "hex")
32
+ };
33
+ }
34
+ }
35
+ if (includeManifestShortcutIcons && manifest.shortcuts) {
36
+ for (const shortcut of manifest.shortcuts) if (shortcut.icons) {
37
+ for (const icons of shortcut.icons) if (icons.src) yield {
38
+ url: icons.src,
39
+ revision: hash("md5", await readFile(mapFile(icons.src), "utf-8"), "hex")
40
+ };
41
+ }
42
+ }
43
+ if (includeManifestScreenshots && manifest.screenshots) for (const screenshot of manifest.screenshots) yield {
44
+ url: screenshot.src,
45
+ revision: hash("md5", await readFile(mapFile(screenshot.src), "utf-8"), "hex")
46
+ };
47
+ if (includeAssets) {
48
+ const assets = typeof includeAssets === "string" ? [includeAssets] : includeAssets;
49
+ for (const asset of assets) yield {
50
+ url: asset,
51
+ revision: hash("md5", await readFile(mapFile(asset), "utf-8"), "hex")
52
+ };
53
+ }
54
+ }
55
+ }
56
+ const consumerGenerator = ctx.consumerOptions.additionalManifestEntriesGenerator;
57
+ if (consumerGenerator) yield* consumerGenerator();
58
+ };
59
+ }
60
+ export { additionalManifestEntriesFactory };
@@ -0,0 +1,18 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { w as VitePWAStrategy } from "./types-BhwjnGLn.mjs";
9
+ import { Bundler, PWAPluginContext } from "./context-types.mjs";
10
+ import { SWType } from "@vite-pwa/workbox-build/types";
11
+ export type DependenciesResolved = NonNullable<Pick<import('rolldown').Plugin, 'resolveId' | 'load'>>;
12
+ /**
13
+ * This module will build `registerSW` or any virtual module.
14
+ * @param code The code to build.
15
+ * @param ctx The context of the PWA bundler.
16
+ * @param resolver Rolldown hooks to resolve dependencies.
17
+ */
18
+ export declare function buildPwaAsset<B extends Bundler, UserStrategy extends VitePWAStrategy, T extends SWType>(code: string, ctx: PWAPluginContext<B, UserStrategy, T>, resolver?: DependenciesResolved): Promise<string>;
@@ -0,0 +1,87 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { resolveSWNames } from "@vite-pwa/workbox-build/utils/resolve-sw-names";
9
+ // src/build-pwa-asset.ts
10
+ /**
11
+ * This module will build `registerSW` or any virtual module.
12
+ * @param code The code to build.
13
+ * @param ctx The context of the PWA bundler.
14
+ * @param resolver Rolldown hooks to resolve dependencies.
15
+ */
16
+ async function buildPwaAsset(code, ctx, resolver) {
17
+ const { filename = "sw.js" } = ctx.consumerOptions;
18
+ const { strategy, scope, buildBase, base: useBase, buildSW, injectManifest, updateViaCache } = ctx.resolvedOptions;
19
+ const useGenerateSW = strategy === "generate-sw";
20
+ const { swDestPath, classicSWDestPath, moduleSWDestPath } = resolveSWNames(filename, strategy === "generate-sw" ? "" : strategy === "build-sw" ? buildSW.swSrc : injectManifest.swSrc, useGenerateSW);
21
+ let swType = "classic";
22
+ if (ctx.devEnvironment) {
23
+ if (ctx.resolvedOptions.devOptions?.type === "module") swType = "module";
24
+ } else if (ctx.resolvedOptions.swType === "module") swType = "module";
25
+ const devEnabled = ctx.resolvedOptions.devOptions?.enabled === true;
26
+ const base = ctx.devEnvironment ? useBase : buildBase;
27
+ return await buildPwaAssetWithRolldown(code, {
28
+ "import.meta.PWA_ESM_FALLBACK_SW": JSON.stringify(ctx.resolvedOptions.swType === "classic-and-module"),
29
+ "import.meta.PWA_SELF_DESTROYING_SW": JSON.stringify(ctx.strategy === "self-destroy-sw"),
30
+ "import.meta.PWA_SW_URL": JSON.stringify(`${base}${swDestPath}`),
31
+ "import.meta.PWA_SW_CLASSIC_URL": JSON.stringify(`${base}${classicSWDestPath}`),
32
+ "import.meta.PWA_SW_MODULE_URL": JSON.stringify(`${base}${moduleSWDestPath}`),
33
+ "import.meta.PWA_SW_SCOPE": JSON.stringify(scope),
34
+ "import.meta.PWA_SW_TYPE": JSON.stringify(swType),
35
+ "import.meta.PWA_SW_UPDATE_VIA_CACHE": JSON.stringify(updateViaCache),
36
+ "import.meta.PWA_DEV_SERVER": JSON.stringify(ctx.devEnvironment),
37
+ "import.meta.PWA_SW_AUTO_UPDATE": JSON.stringify(ctx.resolvedOptions.registerType === "autoUpdate"),
38
+ "import.meta.PWA_DEV_ENABLED": JSON.stringify(devEnabled),
39
+ "import.meta.PWA_DEV_UI_ENABLED": JSON.stringify(devEnabled && ctx.resolvedOptions.devOptions?.enableUISwitcher === true),
40
+ "import.meta.PWA_DEV_CURRENT_SW_TYPE": JSON.stringify(ctx.dev.options.swType)
41
+ }, ctx.devEnvironment, ctx.resolvedOptions.minify, resolver);
42
+ }
43
+ async function writeAsset(instance, options) {
44
+ try {
45
+ return await instance.generate(options);
46
+ } finally {
47
+ await instance.close();
48
+ }
49
+ }
50
+ async function buildPwaAssetWithRolldown(code, define, isDev, minify, resolver) {
51
+ const { rolldown } = await import("rolldown");
52
+ const input = "asset.js";
53
+ const plugins = [{
54
+ name: "pwa-asset-resolver",
55
+ resolveId(id) {
56
+ return id === input ? input : void 0;
57
+ },
58
+ load(id) {
59
+ return id === input ? code : void 0;
60
+ }
61
+ }];
62
+ if (resolver) plugins.push({
63
+ name: "pwa-asset-custom-resolver",
64
+ resolveId: resolver.resolveId,
65
+ load: resolver.load
66
+ });
67
+ return (await writeAsset(await rolldown({
68
+ input,
69
+ platform: "browser",
70
+ treeshake: true,
71
+ logLevel: "warn",
72
+ plugins,
73
+ transform: { define }
74
+ }), {
75
+ format: "esm",
76
+ topLevelVar: true,
77
+ cleanDir: false,
78
+ comments: {
79
+ legal: !isDev && !minify,
80
+ jsdoc: false,
81
+ annotation: false
82
+ },
83
+ minify: isDev ? false : minify,
84
+ codeSplitting: false
85
+ })).output.find((e) => e.fileName === input && e.type === "chunk").code;
86
+ }
87
+ export { buildPwaAsset };
@@ -0,0 +1,75 @@
1
+ /*!
2
+ MIT License
3
+
4
+ Copyright (c) 2020-PRESENT Anthony Fu <https://github.com/antfu>
5
+
6
+ https://github.com/userquin/quini-pwa-monorepo/blob/main/LICENSE.
7
+ */
8
+ import { C as VitePWAOptions, w as VitePWAStrategy, y as ResolvedVitePWAOptions } from "./types-BhwjnGLn.mjs";
9
+ import { ExtractStrategy } from "./context-types.mjs";
10
+ import { SWType } from "@vite-pwa/workbox-build/types";
11
+ export declare const DEFAULT_CONFIG_FILES: readonly ["pwa.config.js", "pwa.config.ts", "pwa.config.mjs", "pwa.config.mts"];
12
+ export type LoaderType<S extends VitePWAStrategy, T extends SWType> = VitePWAOptions<S, T> | (() => VitePWAOptions<S, T>) | (() => Promise<VitePWAOptions<S, T>>);
13
+ /**
14
+ * Loads the PWA configuration from a specified path.
15
+ *
16
+ * If the `path` options is not provided, it will return the provided options as is.
17
+ *
18
+ * Otherwise, it will attempt to load the configuration from the specified path
19
+ * and merge it with the provided options if `mergeOptions` is set to true.
20
+ *
21
+ * @param options The partial PWA options to load.
22
+ * @returns The resolved PWA options, merged with the provided options if `mergeOptions` is set to true.
23
+ */
24
+ export declare function loadConfiguration<S extends VitePWAStrategy, T extends SWType>(options: Partial<VitePWAOptions<S, T>>): Promise<Partial<VitePWAOptions<S, T>>>;
25
+ /**
26
+ * Loads the first existing default configuration file from the current working directory.
27
+ *
28
+ * The default configuration files are searched in the following order:
29
+ * - `pwa.config.js`
30
+ * - `pwa.config.ts`
31
+ * - `pwa.config.mjs`
32
+ * - `pwa.config.mts`
33
+ *
34
+ * @param cwd The current working directory to search for the default configuration files. Defaults to `process.cwd()`.
35
+ * @returns The path to the first existing default configuration file, or `undefined` if none are found.
36
+ */
37
+ export declare function resolveDefaultConfig(cwd?: string): string | undefined;
38
+ /**
39
+ * Loads the default manifest using the `package.json` file.
40
+ *
41
+ * @param options The resolved PWA options.
42
+ */
43
+ export declare function prepareManifest(options: ResolvedVitePWAOptions<any, any>): void;
44
+ /**
45
+ * The resolver options containing environment information and callbacks for `resolvePwaConfiguration`.
46
+ */
47
+ export interface ResolverOptions {
48
+ /**
49
+ * Whether the current environment is a development environment.
50
+ */
51
+ isDev: boolean;
52
+ /**
53
+ * When using `inject-manifest`, this callback must resolve if the strategy is wrong, the implementation should be:
54
+ * - if the service worker with `.ts` or `.mts` extension, then, it is `build-sw` and not `inject-manifest` strategy: must return true
55
+ * - if the service worker outside public dir, then, it is `build-sw` and not `inject-manifest` strategy: must return true
56
+ * - otherwise must return false
57
+ */
58
+ isWrongInjectManifest: (swSrc: string) => boolean | Promise<boolean>;
59
+ }
60
+ /**
61
+ * Resolves the PWA configuration based on the provided options and resolver options.
62
+ *
63
+ * This function will search for the PWA configuration file if the `path` option is not provided,
64
+ * and will merge the loaded configuration with the provided options.
65
+ *
66
+ * When using `inject-manifest`, the `resolverOptions.isWrongInjectManifest` callback must resolve if the strategy is wrong, the implementation should be:
67
+ * - if the service worker with `.ts` or `.mts` extension, then, it is `build-sw` and not `inject-manifest` strategy: must return true
68
+ * - if the service worker outside public dir, then, it is `build-sw` and not `inject-manifest` strategy: must return true
69
+ * - otherwise must return false
70
+ *
71
+ * @param pwaOptions The PWA options to resolve.
72
+ * @param resolverOptions The resolver options containing environment information and callbacks.
73
+ * @returns The resolved PWA options.
74
+ */
75
+ export declare function resolvePwaConfiguration<UserStrategy extends VitePWAStrategy, T extends SWType>(pwaOptions: Partial<VitePWAOptions<UserStrategy, T>>, resolverOptions: ResolverOptions): Promise<ResolvedVitePWAOptions<ExtractStrategy<UserStrategy>, T>>;