@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
@@ -0,0 +1,11 @@
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 { i as PWAAssetsIcons, o as PWAHtmlLink } from "../types-B60e7Nq4.mjs";
9
+ import { AppleSplashScreenLink, FaviconLink, HtmlLink, ImageAssetsInstructions } from "@vite-pwa/assets-generator/api";
10
+ export declare function mapLink(includeId: boolean, link: HtmlLink | FaviconLink | AppleSplashScreenLink): PWAHtmlLink;
11
+ export declare function extractIcons(instructions?: ImageAssetsInstructions): PWAAssetsIcons;
@@ -0,0 +1,48 @@
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
+ // src/pwa-assets/utils.ts
9
+ function mapLink(includeId, link) {
10
+ const linkObject = {
11
+ href: link.href,
12
+ rel: link.rel
13
+ };
14
+ if (includeId && link.id) linkObject.id = link.id;
15
+ if ("media" in link && link.media) linkObject.media = link.media;
16
+ linkObject.href = link.href;
17
+ if ("sizes" in link && link.sizes) linkObject.sizes = link.sizes;
18
+ if ("type" in link && link.type) linkObject.type = link.type;
19
+ return linkObject;
20
+ }
21
+ function extractIcons(instructions) {
22
+ const icons = {
23
+ favicon: {},
24
+ transparent: {},
25
+ maskable: {},
26
+ apple: {},
27
+ appleSplashScreen: {}
28
+ };
29
+ if (instructions) {
30
+ Array.from(Object.values(instructions.favicon)).forEach(({ buffer: _buffer, ...rest }) => {
31
+ if (rest.url) icons.favicon[rest.url] = { ...rest };
32
+ });
33
+ Array.from(Object.values(instructions.transparent)).forEach(({ buffer: _buffer, ...rest }) => {
34
+ if (rest.url) icons.transparent[rest.url] = { ...rest };
35
+ });
36
+ Array.from(Object.values(instructions.maskable)).forEach(({ buffer: _buffer, ...rest }) => {
37
+ if (rest.url) icons.maskable[rest.url] = { ...rest };
38
+ });
39
+ Array.from(Object.values(instructions.apple)).forEach(({ buffer: _buffer, ...rest }) => {
40
+ if (rest.url) icons.apple[rest.url] = { ...rest };
41
+ });
42
+ Array.from(Object.values(instructions.appleSplashScreen)).forEach(({ buffer: _buffer, ...rest }) => {
43
+ if (rest.url) icons.appleSplashScreen[rest.url] = { ...rest };
44
+ });
45
+ }
46
+ return icons;
47
+ }
48
+ export { extractIcons, mapLink };
@@ -0,0 +1,11 @@
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
+ /**
9
+ * Locate the built-in inspector folder.
10
+ */
11
+ export declare function resolveInspectorDist(): string | undefined;
@@ -0,0 +1,25 @@
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 { createRequire, findPackageJSON } from "node:module";
9
+ import { dirname, resolve } from "node:path";
10
+ // src/resolve-inspector-dist.ts
11
+ /**
12
+ * Locate the built-in inspector folder.
13
+ */
14
+ function resolveInspectorDist() {
15
+ let inspectorJSON;
16
+ try {
17
+ inspectorJSON = findPackageJSON("@unplugin-pwa/inspector", import.meta.url);
18
+ } catch {
19
+ try {
20
+ inspectorJSON = createRequire(import.meta.url).resolve("@unplugin-pwa/inspector/package.json");
21
+ } catch {}
22
+ }
23
+ return inspectorJSON ? resolve(dirname(inspectorJSON), "dist") : void 0;
24
+ }
25
+ export { resolveInspectorDist };
@@ -0,0 +1,67 @@
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 { AppleSplashScreenLink, FaviconLink, HtmlLink, IconAsset, ImageAssetsInstructions } from "@vite-pwa/assets-generator/api";
9
+ interface PWAHtmlLink {
10
+ id?: string;
11
+ rel: 'apple-touch-startup-image' | 'apple-touch-icon' | 'icon';
12
+ href: string;
13
+ media?: string;
14
+ sizes?: string;
15
+ type?: string;
16
+ }
17
+ interface ColorSchemeMeta {
18
+ name: string;
19
+ content: string;
20
+ }
21
+ interface ResolvedIconAsset {
22
+ path: string;
23
+ mimeType: string;
24
+ buffer: Promise<Buffer>;
25
+ age: number;
26
+ lastModified: number;
27
+ }
28
+ interface PWAHtmlAssets {
29
+ links: PWAHtmlLink[];
30
+ themeColor?: ColorSchemeMeta;
31
+ }
32
+ interface AssetsGeneratorContext {
33
+ lastModified: number;
34
+ assetsInstructions: ImageAssetsInstructions;
35
+ cache: Map<string, ResolvedIconAsset>;
36
+ useImage: string;
37
+ imageFile: string;
38
+ publicDir: string;
39
+ outDir: string;
40
+ imageName: string;
41
+ imageOutDir: string;
42
+ xhtml: boolean;
43
+ includeId: boolean;
44
+ sources: string[];
45
+ injectThemeColor: boolean;
46
+ includeHtmlHeadLinks: boolean;
47
+ overrideManifestIcons: boolean;
48
+ }
49
+ interface PWAAssetsIcons {
50
+ favicon: Record<string, Omit<IconAsset<FaviconLink>, 'buffer'>>;
51
+ transparent: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
52
+ maskable: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
53
+ apple: Record<string, Omit<IconAsset<HtmlLink>, 'buffer'>>;
54
+ appleSplashScreen: Record<string, Omit<IconAsset<AppleSplashScreenLink>, 'buffer'>>;
55
+ }
56
+ interface PWAAssetsGenerator {
57
+ sources: () => string[];
58
+ generate: () => Promise<void>;
59
+ findIconAsset: (path: string) => ResolvedIconAsset | undefined;
60
+ resolveHtmlAssets: () => PWAHtmlAssets;
61
+ transformIndexHtml: (html: string) => string;
62
+ injectManifestIcons: () => void;
63
+ instructions: () => ImageAssetsInstructions;
64
+ icons: () => PWAAssetsIcons;
65
+ checkHotUpdate: (path: string) => Promise<boolean>;
66
+ }
67
+ export { PWAHtmlAssets as a, PWAAssetsIcons as i, ColorSchemeMeta as n, PWAHtmlLink as o, PWAAssetsGenerator as r, ResolvedIconAsset as s, AssetsGeneratorContext as t };