From 030ad3dcded7f737ef59765c9e19942b7e2213c1 Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 29 Mar 2025 15:40:30 +0100 Subject: [PATCH 01/10] feat!: move to ESM-only --- build.config.ts | 3 +- eslint.config.mjs => eslint.config.js | 0 package.json | 28 ++++------- src/client/index.ts | 2 +- src/client/single-page.ts | 2 +- src/node/build.ts | 69 +++++++++++---------------- src/types.ts | 7 --- 7 files changed, 42 insertions(+), 69 deletions(-) rename eslint.config.mjs => eslint.config.js (100%) diff --git a/build.config.ts b/build.config.ts index fbaed1b..75bf380 100644 --- a/build.config.ts +++ b/build.config.ts @@ -8,14 +8,13 @@ export default defineBuildConfig({ { input: 'src/node', name: 'node' }, ], clean: true, - declaration: true, + declaration: 'node16', externals: [ 'vue', 'vue/server-renderer', 'vue/compiler-sfc', ], rollup: { - emitCJS: true, inlineDependencies: true, }, }) diff --git a/eslint.config.mjs b/eslint.config.js similarity index 100% rename from eslint.config.mjs rename to eslint.config.js diff --git a/package.json b/package.json index 44786be..064c80d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "vite-ssg", + "type": "module", "version": "26.1.0", "packageManager": "pnpm@10.7.0", "description": "Server-side generation for Vite", @@ -20,29 +21,20 @@ ], "sideEffects": false, "exports": { - ".": { - "import": "./dist/index.mjs", - "require": "./dist/index.cjs" - }, - "./node": { - "import": "./dist/node.mjs", - "require": "./dist/node.cjs" - }, - "./single-page": { - "import": "./dist/client/single-page.mjs", - "require": "./dist/client/single-page.cjs" - } + ".": "./dist/index.mjs", + "./node": "./dist/node.mjs", + "./single-page": "./dist/client/single-page.mjs" }, - "main": "dist/index.cjs", + "main": "dist/index.mjs", "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "types": "dist/index.d.mts", "typesVersions": { "*": { - "single-page": [ - "dist/client/single-page.d.ts" - ], "node": [ - "dist/node.d.ts" + "dist/node.d.mts" + ], + "single-page": [ + "dist/client/single-page.d.mts" ] } }, diff --git a/src/client/index.ts b/src/client/index.ts index 8cd175c..c4093a0 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -24,7 +24,7 @@ export function ViteSSG( rootContainer = '#app', } = options ?? {} - async function createApp(_client = false, routePath?: string) { + async function createApp(routePath?: string) { const app = import.meta.env.SSR || options?.hydration ? createSSRApp(App) : createClientApp(App) diff --git a/src/client/single-page.ts b/src/client/single-page.ts index 898ca91..07961d2 100644 --- a/src/client/single-page.ts +++ b/src/client/single-page.ts @@ -22,7 +22,7 @@ export function ViteSSG( rootContainer = '#app', } = options ?? {} - async function createApp(_client = false) { + async function createApp() { const app = import.meta.env.SSR || options?.hydration ? createSSRApp(App) : createClientApp(App) diff --git a/src/node/build.ts b/src/node/build.ts index 80db223..7feb90b 100644 --- a/src/node/build.ts +++ b/src/node/build.ts @@ -6,9 +6,9 @@ import type { SSRContext } from 'vue/server-renderer' import type { ViteSSGContext, ViteSSGOptions } from '../types' import { existsSync } from 'node:fs' import fs from 'node:fs/promises' -import { createRequire } from 'node:module' -import { dirname, isAbsolute, join, parse } from 'node:path' +import { dirname, isAbsolute, parse, resolve } from 'node:path' import process from 'node:process' +import { pathToFileURL } from 'node:url' import { renderDOMHead } from '@unhead/dom' import { blue, cyan, dim, gray, green, red, yellow } from 'ansis' import { JSDOM } from 'jsdom' @@ -21,7 +21,7 @@ import { buildLog, getSize, routesToPaths } from './utils' export type Manifest = Record -export type CreateAppFactory = (client: boolean, routePath?: string) => Promise | ViteSSGContext> +export type CreateAppFactory = (routePath?: string) => Promise | ViteSSGContext> function DefaultIncludedRoutes(paths: string[], _routes: Readonly) { // ignore dynamic routes @@ -35,10 +35,10 @@ export async function build(ssgOptions: Partial = {}, viteConfig const cwd = process.cwd() const root = config.root || cwd - const ssgOutTempFolder = join(root, '.vite-ssg-temp') - const ssgOut = join(ssgOutTempFolder, Math.random().toString(36).substring(2, 12)) + const ssgOutTempFolder = resolve(root, '.vite-ssg-temp') + const ssgOut = resolve(ssgOutTempFolder, Math.random().toString(36).substring(2, 12)) const outDir = config.build.outDir || 'dist' - const out = isAbsolute(outDir) ? outDir : join(root, outDir) + const out = isAbsolute(outDir) ? outDir : resolve(root, outDir) const mergedOptions = Object.assign({}, config.ssgOptions || {}, ssgOptions) const { @@ -52,7 +52,6 @@ export async function build(ssgOptions: Partial = {}, viteConfig onFinished, dirStyle = 'flat', includeAllRoutes = false, - format = 'esm', concurrency = 20, rootContainerId = 'app', base, @@ -71,7 +70,7 @@ export async function build(ssgOptions: Partial = {}, viteConfig ssrManifest: true, rollupOptions: { input: { - app: join(root, './index.html'), + app: resolve(root, './index.html'), }, }, }, @@ -97,15 +96,10 @@ export async function build(ssgOptions: Partial = {}, viteConfig minify: false, cssCodeSplit: false, rollupOptions: { - output: format === 'esm' - ? { - entryFileNames: '[name].mjs', - format: 'esm', - } - : { - entryFileNames: '[name].cjs', - format: 'cjs', - }, + output: { + entryFileNames: '[name].mjs', + format: 'esm', + }, }, }, mode: config.mode, @@ -114,22 +108,17 @@ export async function build(ssgOptions: Partial = {}, viteConfig }, })) - const prefix = (format === 'esm' && process.platform === 'win32') ? 'file://' : '' - const ext = format === 'esm' ? '.mjs' : '.cjs' - - /** - * `join('file://')` will be equal to `'file:\'`, which is not the correct file protocol and will fail to be parsed under bun. - * It is changed to '+' splicing here. - */ - const serverEntry = prefix + join(ssgOut, parse(ssrEntry).name + ext).replace(/\\/g, '/') - - const _require = createRequire(import.meta.url) + const serverEntry = pathToFileURL(resolve(ssgOut, `${parse(ssrEntry).name}.mjs`)).href + const { + createApp, + includedRoutes: serverEntryIncludedRoutes, + }: { + createApp: CreateAppFactory + includedRoutes: ViteSSGOptions['includedRoutes'] + } = await import(serverEntry) - const { createApp, includedRoutes: serverEntryIncludedRoutes }: { createApp: CreateAppFactory, includedRoutes: ViteSSGOptions['includedRoutes'] } = format === 'esm' - ? await import(serverEntry) - : _require(serverEntry) const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes - const { routes } = await createApp(false) + const { routes } = await createApp() let routesPaths = includeAllRoutes ? routesToPaths(routes) @@ -151,11 +140,11 @@ export async function build(ssgOptions: Partial = {}, viteConfig path: _ssrManifestPath, content: ssrManifestRaw, } = await readFiles( - join(out, '.vite', 'ssr-manifest.json'), // Vite 5 - join(out, 'ssr-manifest.json'), // Vite 4 and below + resolve(out, '.vite', 'ssr-manifest.json'), // Vite 5 + resolve(out, 'ssr-manifest.json'), // Vite 4 and below ) const ssrManifest: Manifest = JSON.parse(ssrManifestRaw) - let indexHTML = await fs.readFile(join(out, 'index.html'), 'utf-8') + let indexHTML = await fs.readFile(resolve(out, 'index.html'), 'utf-8') indexHTML = rewriteScripts(indexHTML, script) const { renderToString }: typeof import('vue/server-renderer') = await import('vue/server-renderer') @@ -165,7 +154,7 @@ export async function build(ssgOptions: Partial = {}, viteConfig for (const route of routesPaths) { queue.add(async () => { try { - const appCtx = await createApp(false, route) as ViteSSGContext + const appCtx = await createApp(route) as ViteSSGContext const { app, router, head, initialState, triggerOnSSRAppRendered, transformState = serializeState } = appCtx if (router) { @@ -208,11 +197,11 @@ export async function build(ssgOptions: Partial = {}, viteConfig : route).replace(/^\//g, '')}.html` const filename = dirStyle === 'nested' - ? join(route.replace(/^\//g, ''), 'index.html') + ? resolve(route.replace(/^\//g, ''), 'index.html') : relativeRouteFile - await fs.mkdir(join(out, dirname(filename)), { recursive: true }) - await fs.writeFile(join(out, filename), formatted, 'utf-8') + await fs.mkdir(resolve(out, dirname(filename)), { recursive: true }) + await fs.writeFile(resolve(out, filename), formatted, 'utf-8') config.logger.info( `${dim(`${outDir}/`)}${cyan(filename.padEnd(15, ' '))} ${dim(getSize(formatted))}`, ) @@ -251,7 +240,7 @@ async function detectEntry(root: string) { // pick the first script tag of type module as the entry // eslint-disable-next-line regexp/no-super-linear-backtracking const scriptSrcReg = /\s*<\/script>/gi - const html = await fs.readFile(join(root, 'index.html'), 'utf-8') + const html = await fs.readFile(resolve(root, 'index.html'), 'utf-8') const scripts = [...html.matchAll(scriptSrcReg)] const [, entry] = scripts.find((matchResult) => { const [script] = matchResult @@ -264,7 +253,7 @@ async function detectEntry(root: string) { async function resolveAlias(config: ResolvedConfig, entry: string) { const resolver = config.createResolver() const result = await resolver(entry, config.root) - return result || join(config.root, entry) + return result || resolve(config.root, entry) } function rewriteScripts(indexHTML: string, mode?: string) { diff --git a/src/types.ts b/src/types.ts index 6926a67..c291b3c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -11,13 +11,6 @@ export interface ViteSSGOptions { */ script?: 'sync' | 'async' | 'defer' | 'async defer' - /** - * Build format. - * - * @default 'esm' - */ - format?: 'esm' | 'cjs' - /** * The path of the main entry file (relative to the project root). * From a059a3c6090a01c3c879e462a97530414713fddd Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 29 Mar 2025 16:21:26 +0100 Subject: [PATCH 02/10] chore: update readme file --- README.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e478f95..7b15541 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Static-site generation for Vue 3 on Vite. [![NPM version](https://img.shields.io/npm/v/vite-ssg?color=a1b858)](https://www.npmjs.com/package/vite-ssg) +> ℹ️ **ESM-only from `v27.0.0`, CJS generation format also dropped.** > ℹ️ **Vite 2 is supported from `v0.2.x`, Vite 1's support is discontinued.** ## Install @@ -46,13 +47,55 @@ export const createApp = ViteSSG( ) ``` +### How to allow Rollup tree-shake your client code + +In order to allow Rollup tree-shake your client code at build time, you need to wrap you code using `import.meta.env.SSR`, that's, checking if the build is for the server: Rollup will remove the server code from the client build. + +```ts +if (import.meta.env.SSR) { + // your server code will be removed in the client build +} +else { + // your client code will be removed in the server build +} +``` + +Alternatively, you can also use `isClient` from `ViteSSGContext` using these 3 simple rules: +1) don't destructure the `ViteSSGContext` in the `ViteSSG` function +2) don't destructure `isClient` from `ViteSSGContext` in the callback function body +3) use `isClient` from `ViteSSGContext` in the callback function body (implicit ;) ) + +```ts +import { ViteSSG } from 'vite-ssg' +import App from './App.vue' + +export const createApp = ViteSSG( + // the root component + App, + // vue-router options + { routes }, + // previous 1) rule + (ctx) => { + // previous 2) rule + const { app, router, routes, initialState } = ctx + // previous 3) rule + if (ctx.isClient) { + // your client code + } + else { + // your server code + } + } +) +``` + ### Single Page SSG For SSG of an index page only (i.e. without `vue-router`); import `vite-ssg/single-page` instead, and only install `@unhead/vue` (`npm i -D vite-ssg @unhead/vue`). ```ts // src/main.ts -import { ViteSSG } from 'vite-ssg/single-page' +import {ViteSSG} from 'vite-ssg/single-page' import App from './App.vue' // `export const createApp` is required instead of the original `createApp(App).mount('#app')` @@ -307,14 +350,14 @@ const { app, router, initialState, isClient, onSSRAppRendered } = ctx const pinia = createPinia() app.use(pinia) -if (isClient) { - pinia.state.value = (initialState.pinia) || {} -} -else { +if (import.meta.env.SSR) { onSSRAppRendered(() => { initialState.pinia = pinia.state.value }) } +else { + pinia.state.value = (initialState.pinia) || {} +} ``` ## Configuration From 769494efbc3fd52bf26622f5dd1a74dcee1725f6 Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 29 Mar 2025 16:26:16 +0100 Subject: [PATCH 03/10] chore: update info --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b15541..05218c9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Static-site generation for Vue 3 on Vite. [![NPM version](https://img.shields.io/npm/v/vite-ssg?color=a1b858)](https://www.npmjs.com/package/vite-ssg) -> ℹ️ **ESM-only from `v27.0.0`, CJS generation format also dropped.** +> ℹ️ **ESM-only from `v27.0.0` (CJS generation format also dropped).** +> > ℹ️ **Vite 2 is supported from `v0.2.x`, Vite 1's support is discontinued.** ## Install From 362433205b5ef55485b9725e626b453bf1eb965f Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 29 Mar 2025 16:28:14 +0100 Subject: [PATCH 04/10] chore: fix lint --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 05218c9..0c5e779 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Static-site generation for Vue 3 on Vite. [![NPM version](https://img.shields.io/npm/v/vite-ssg?color=a1b858)](https://www.npmjs.com/package/vite-ssg) > ℹ️ **ESM-only from `v27.0.0` (CJS generation format also dropped).** -> +> > ℹ️ **Vite 2 is supported from `v0.2.x`, Vite 1's support is discontinued.** ## Install @@ -57,7 +57,7 @@ if (import.meta.env.SSR) { // your server code will be removed in the client build } else { - // your client code will be removed in the server build + // your client code will be removed in the server build } ``` @@ -96,7 +96,7 @@ For SSG of an index page only (i.e. without `vue-router`); import `vite-ssg/sing ```ts // src/main.ts -import {ViteSSG} from 'vite-ssg/single-page' +import { ViteSSG } from 'vite-ssg/single-page' import App from './App.vue' // `export const createApp` is required instead of the original `createApp(App).mount('#app')` From 172d12d99aa9e00f7684dc48609c5a327fb52e44 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 30 Mar 2025 10:32:48 +0800 Subject: [PATCH 05/10] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c5e779..40543e8 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,7 @@ export const createApp = ViteSSG( ### How to allow Rollup tree-shake your client code -In order to allow Rollup tree-shake your client code at build time, you need to wrap you code using `import.meta.env.SSR`, that's, checking if the build is for the server: Rollup will remove the server code from the client build. - +In order to allow Rollup tree-shake your client code at build time, you need to wrap your code using `import.meta.env.SSR`, that's, checking if the build is for the server: Rollup will remove the server code from the client build. ```ts if (import.meta.env.SSR) { // your server code will be removed in the client build From 7fbfd2e75ac32e0d3efa6fd081ab8e7e8db79462 Mon Sep 17 00:00:00 2001 From: userquin Date: Sun, 30 Mar 2025 13:23:37 +0200 Subject: [PATCH 06/10] chore: update `vite-plugin-pwa` to `v1.0.0` --- examples/multiple-pages-pwa/package.json | 3 +- pnpm-lock.yaml | 302 +++++++++++------------ pnpm-workspace.yaml | 3 +- 3 files changed, 153 insertions(+), 155 deletions(-) diff --git a/examples/multiple-pages-pwa/package.json b/examples/multiple-pages-pwa/package.json index 34208cb..0ce032b 100644 --- a/examples/multiple-pages-pwa/package.json +++ b/examples/multiple-pages-pwa/package.json @@ -18,6 +18,7 @@ "vite-plugin-pages": "catalog:", "vite-plugin-pwa": "catalog:", "vite-ssg": "workspace:*", - "vue-router": "catalog:" + "vue-router": "catalog:", + "workbox-build": "catalog:" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04c533a..7530ec2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -85,8 +85,8 @@ catalogs: specifier: ^0.32.5 version: 0.32.5 vite-plugin-pwa: - specifier: ^0.21.2 - version: 0.21.2 + specifier: ^1.0.0 + version: 1.0.0 vitest: specifier: ^3.0.9 version: 3.0.9 @@ -99,6 +99,9 @@ catalogs: vue-tsc: specifier: ^2.2.8 version: 2.2.8 + workbox-build: + specifier: ^7.3.0 + version: 7.3.0 overrides: vite: ^6.2.3 @@ -173,7 +176,7 @@ importers: version: 6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0) vite-plugin-pwa: specifier: 'catalog:' - version: 0.21.2(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.0.0)(workbox-window@7.0.0) + version: 1.0.0(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.3.0)(workbox-window@7.3.0) vitest: specifier: 'catalog:' version: 3.0.9(@types/debug@4.1.12)(@types/node@20.6.0)(jiti@2.4.2)(jsdom@26.0.0)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0) @@ -247,13 +250,16 @@ importers: version: 0.32.5(@vue/compiler-sfc@3.5.13)(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(vue-router@4.5.0(vue@3.5.13(typescript@5.8.2))) vite-plugin-pwa: specifier: 'catalog:' - version: 0.21.2(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.0.0)(workbox-window@7.0.0) + version: 1.0.0(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.3.0)(workbox-window@7.3.0) vite-ssg: specifier: workspace:* version: link:../.. vue-router: specifier: 'catalog:' version: 4.5.0(vue@3.5.13(typescript@5.8.2)) + workbox-build: + specifier: 'catalog:' + version: 7.3.0 examples/multiple-pages-with-store: dependencies: @@ -1470,11 +1476,14 @@ packages: rollup: optional: true - '@rollup/plugin-node-resolve@11.2.1': - resolution: {integrity: sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==} - engines: {node: '>= 10.0.0'} + '@rollup/plugin-node-resolve@15.3.1': + resolution: {integrity: sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==} + engines: {node: '>=14.0.0'} peerDependencies: - rollup: ^1.20.0||^2.0.0 + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true '@rollup/plugin-node-resolve@16.0.0': resolution: {integrity: sha512-0FPvAeVUT/zdWoO0jnb/V5BlBsUSNfkIOtFHzMO4H9MOklrmQFY6FduVHKucNb/aTFxvnGhj4MNj/T1oNdDfNg==} @@ -1499,6 +1508,15 @@ packages: rollup: optional: true + '@rollup/plugin-terser@0.4.4': + resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/pluginutils@3.1.0': resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} engines: {node: '>= 8.0.0'} @@ -1675,9 +1693,6 @@ packages: '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} - '@types/resolve@1.17.1': - resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} - '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -2062,10 +2077,6 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - builtin-modules@3.3.0: - resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} - engines: {node: '>=6'} - builtin-modules@4.0.0: resolution: {integrity: sha512-p1n8zyCkt1BVrKNFymOHjcDSAl7oq/gUvfgULv2EblgpPVQlQr9yHnWjg9IJ2MhfwPqiYqMMrr01OY7yQoK2yA==} engines: {node: '>=18.20'} @@ -3025,10 +3036,6 @@ packages: engines: {node: '>=10'} hasBin: true - jest-worker@26.6.2: - resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} - engines: {node: '>= 10.13.0'} - jiti@1.21.7: resolution: {integrity: sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==} hasBin: true @@ -3241,9 +3248,6 @@ packages: mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} - merge-stream@2.0.0: - resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} - merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -3886,12 +3890,6 @@ packages: rollup: ^3.29.4 || ^4 typescript: ^4.5 || ^5.0 - rollup-plugin-terser@7.0.2: - resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} - deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser - peerDependencies: - rollup: ^2.0.0 - rollup@2.79.1: resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==} engines: {node: '>=10.0.0'} @@ -3945,8 +3943,8 @@ packages: engines: {node: '>=10'} hasBin: true - serialize-javascript@4.0.0: - resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} set-function-length@1.1.1: resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} @@ -3976,6 +3974,9 @@ packages: slashes@3.0.12: resolution: {integrity: sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==} + smob@1.5.0: + resolution: {integrity: sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -4340,11 +4341,11 @@ packages: vue-router: optional: true - vite-plugin-pwa@0.21.2: - resolution: {integrity: sha512-vFhH6Waw8itNu37hWUJxL50q+CBbNcMVzsKaYHQVrfxTt3ihk3PeLO22SbiP1UNWzcEPaTQv+YVxe4G0KOjAkg==} + vite-plugin-pwa@1.0.0: + resolution: {integrity: sha512-X77jo0AOd5OcxmWj3WnVti8n7Kw2tBgV1c8MCXFclrSlDV23ePzv2eTDIALXI2Qo6nJ5pZJeZAuX0AawvRfoeA==} engines: {node: '>=16.0.0'} peerDependencies: - '@vite-pwa/assets-generator': ^0.2.6 + '@vite-pwa/assets-generator': ^1.0.0 vite: ^6.2.3 workbox-build: ^7.3.0 workbox-window: ^7.3.0 @@ -4494,55 +4495,54 @@ packages: engines: {node: '>=8'} hasBin: true - workbox-background-sync@7.0.0: - resolution: {integrity: sha512-S+m1+84gjdueM+jIKZ+I0Lx0BDHkk5Nu6a3kTVxP4fdj3gKouRNmhO8H290ybnJTOPfBDtTMXSQA/QLTvr7PeA==} + workbox-background-sync@7.3.0: + resolution: {integrity: sha512-PCSk3eK7Mxeuyatb22pcSx9dlgWNv3+M8PqPaYDokks8Y5/FX4soaOqj3yhAZr5k6Q5JWTOMYgaJBpbw11G9Eg==} - workbox-broadcast-update@7.0.0: - resolution: {integrity: sha512-oUuh4jzZrLySOo0tC0WoKiSg90bVAcnE98uW7F8GFiSOXnhogfNDGZelPJa+6KpGBO5+Qelv04Hqx2UD+BJqNQ==} + workbox-broadcast-update@7.3.0: + resolution: {integrity: sha512-T9/F5VEdJVhwmrIAE+E/kq5at2OY6+OXXgOWQevnubal6sO92Gjo24v6dCVwQiclAF5NS3hlmsifRrpQzZCdUA==} - workbox-build@7.0.0: - resolution: {integrity: sha512-CttE7WCYW9sZC+nUYhQg3WzzGPr4IHmrPnjKiu3AMXsiNQKx+l4hHl63WTrnicLmKEKHScWDH8xsGBdrYgtBzg==} + workbox-build@7.3.0: + resolution: {integrity: sha512-JGL6vZTPlxnlqZRhR/K/msqg3wKP+m0wfEUVosK7gsYzSgeIxvZLi1ViJJzVL7CEeI8r7rGFV973RiEqkP3lWQ==} engines: {node: '>=16.0.0'} - workbox-cacheable-response@7.0.0: - resolution: {integrity: sha512-0lrtyGHn/LH8kKAJVOQfSu3/80WDc9Ma8ng0p2i/5HuUndGttH+mGMSvOskjOdFImLs2XZIimErp7tSOPmu/6g==} + workbox-cacheable-response@7.3.0: + resolution: {integrity: sha512-eAFERIg6J2LuyELhLlmeRcJFa5e16Mj8kL2yCDbhWE+HUun9skRQrGIFVUagqWj4DMaaPSMWfAolM7XZZxNmxA==} - workbox-core@7.0.0: - resolution: {integrity: sha512-81JkAAZtfVP8darBpfRTovHg8DGAVrKFgHpOArZbdFd78VqHr5Iw65f2guwjE2NlCFbPFDoez3D3/6ZvhI/rwQ==} + workbox-core@7.3.0: + resolution: {integrity: sha512-Z+mYrErfh4t3zi7NVTvOuACB0A/jA3bgxUN3PwtAVHvfEsZxV9Iju580VEETug3zYJRc0Dmii/aixI/Uxj8fmw==} - workbox-expiration@7.0.0: - resolution: {integrity: sha512-MLK+fogW+pC3IWU9SFE+FRStvDVutwJMR5if1g7oBJx3qwmO69BNoJQVaMXq41R0gg3MzxVfwOGKx3i9P6sOLQ==} + workbox-expiration@7.3.0: + resolution: {integrity: sha512-lpnSSLp2BM+K6bgFCWc5bS1LR5pAwDWbcKt1iL87/eTSJRdLdAwGQznZE+1czLgn/X05YChsrEegTNxjM067vQ==} - workbox-google-analytics@7.0.0: - resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} - deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained + workbox-google-analytics@7.3.0: + resolution: {integrity: sha512-ii/tSfFdhjLHZ2BrYgFNTrb/yk04pw2hasgbM70jpZfLk0vdJAXgaiMAWsoE+wfJDNWoZmBYY0hMVI0v5wWDbg==} - workbox-navigation-preload@7.0.0: - resolution: {integrity: sha512-juWCSrxo/fiMz3RsvDspeSLGmbgC0U9tKqcUPZBCf35s64wlaLXyn2KdHHXVQrb2cqF7I0Hc9siQalainmnXJA==} + workbox-navigation-preload@7.3.0: + resolution: {integrity: sha512-fTJzogmFaTv4bShZ6aA7Bfj4Cewaq5rp30qcxl2iYM45YD79rKIhvzNHiFj1P+u5ZZldroqhASXwwoyusnr2cg==} - workbox-precaching@7.0.0: - resolution: {integrity: sha512-EC0vol623LJqTJo1mkhD9DZmMP604vHqni3EohhQVwhJlTgyKyOkMrZNy5/QHfOby+39xqC01gv4LjOm4HSfnA==} + workbox-precaching@7.3.0: + resolution: {integrity: sha512-ckp/3t0msgXclVAYaNndAGeAoWQUv7Rwc4fdhWL69CCAb2UHo3Cef0KIUctqfQj1p8h6aGyz3w8Cy3Ihq9OmIw==} - workbox-range-requests@7.0.0: - resolution: {integrity: sha512-SxAzoVl9j/zRU9OT5+IQs7pbJBOUOlriB8Gn9YMvi38BNZRbM+RvkujHMo8FOe9IWrqqwYgDFBfv6sk76I1yaQ==} + workbox-range-requests@7.3.0: + resolution: {integrity: sha512-EyFmM1KpDzzAouNF3+EWa15yDEenwxoeXu9bgxOEYnFfCxns7eAxA9WSSaVd8kujFFt3eIbShNqa4hLQNFvmVQ==} - workbox-recipes@7.0.0: - resolution: {integrity: sha512-DntcK9wuG3rYQOONWC0PejxYYIDHyWWZB/ueTbOUDQgefaeIj1kJ7pdP3LZV2lfrj8XXXBWt+JDRSw1lLLOnww==} + workbox-recipes@7.3.0: + resolution: {integrity: sha512-BJro/MpuW35I/zjZQBcoxsctgeB+kyb2JAP5EB3EYzePg8wDGoQuUdyYQS+CheTb+GhqJeWmVs3QxLI8EBP1sg==} - workbox-routing@7.0.0: - resolution: {integrity: sha512-8YxLr3xvqidnbVeGyRGkaV4YdlKkn5qZ1LfEePW3dq+ydE73hUUJJuLmGEykW3fMX8x8mNdL0XrWgotcuZjIvA==} + workbox-routing@7.3.0: + resolution: {integrity: sha512-ZUlysUVn5ZUzMOmQN3bqu+gK98vNfgX/gSTZ127izJg/pMMy4LryAthnYtjuqcjkN4HEAx1mdgxNiKJMZQM76A==} - workbox-strategies@7.0.0: - resolution: {integrity: sha512-dg3qJU7tR/Gcd/XXOOo7x9QoCI9nk74JopaJaYAQ+ugLi57gPsXycVdBnYbayVj34m6Y8ppPwIuecrzkpBVwbA==} + workbox-strategies@7.3.0: + resolution: {integrity: sha512-tmZydug+qzDFATwX7QiEL5Hdf7FrkhjaF9db1CbB39sDmEZJg3l9ayDvPxy8Y18C3Y66Nrr9kkN1f/RlkDgllg==} - workbox-streams@7.0.0: - resolution: {integrity: sha512-moVsh+5to//l6IERWceYKGiftc+prNnqOp2sgALJJFbnNVpTXzKISlTIsrWY+ogMqt+x1oMazIdHj25kBSq/HQ==} + workbox-streams@7.3.0: + resolution: {integrity: sha512-SZnXucyg8x2Y61VGtDjKPO5EgPUG5NDn/v86WYHX+9ZqvAsGOytP0Jxp1bl663YUuMoXSAtsGLL+byHzEuMRpw==} - workbox-sw@7.0.0: - resolution: {integrity: sha512-SWfEouQfjRiZ7GNABzHUKUyj8pCoe+RwjfOIajcx6J5mtgKkN+t8UToHnpaJL5UVVOf5YhJh+OHhbVNIHe+LVA==} + workbox-sw@7.3.0: + resolution: {integrity: sha512-aCUyoAZU9IZtH05mn0ACUpyHzPs0lMeJimAYkQkBsOWiqaJLgusfDCR+yllkPkFRxWpZKF8vSvgHYeG7LwhlmA==} - workbox-window@7.0.0: - resolution: {integrity: sha512-j7P/bsAWE/a7sxqTzXo3P2ALb1reTfZdvVp6OJ/uLr/C2kZAMvjeWGm8V4htQhor7DOvYg0sSbFN2+flT5U0qA==} + workbox-window@7.3.0: + resolution: {integrity: sha512-qW8PDy16OV1UBaUNGlTVcepzrlzyzNW/ZJvFQQs2j2TzGsg6IKjcpZC1RSquqQnTOafl5pCj5bGfAHlCjOOjdA==} wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -5746,14 +5746,14 @@ snapshots: optionalDependencies: rollup: 4.37.0 - '@rollup/plugin-node-resolve@11.2.1(rollup@2.79.1)': + '@rollup/plugin-node-resolve@15.3.1(rollup@2.79.1)': dependencies: - '@rollup/pluginutils': 3.1.0(rollup@2.79.1) - '@types/resolve': 1.17.1 - builtin-modules: 3.3.0 + '@rollup/pluginutils': 5.1.4(rollup@2.79.1) + '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.4 + optionalDependencies: rollup: 2.79.1 '@rollup/plugin-node-resolve@16.0.0(rollup@4.37.0)': @@ -5779,6 +5779,14 @@ snapshots: optionalDependencies: rollup: 4.37.0 + '@rollup/plugin-terser@0.4.4(rollup@2.79.1)': + dependencies: + serialize-javascript: 6.0.2 + smob: 1.5.0 + terser: 5.19.4 + optionalDependencies: + rollup: 2.79.1 + '@rollup/pluginutils@3.1.0(rollup@2.79.1)': dependencies: '@types/estree': 0.0.39 @@ -5786,6 +5794,14 @@ snapshots: picomatch: 2.3.1 rollup: 2.79.1 + '@rollup/pluginutils@5.1.4(rollup@2.79.1)': + dependencies: + '@types/estree': 1.0.6 + estree-walker: 2.0.2 + picomatch: 4.0.2 + optionalDependencies: + rollup: 2.79.1 + '@rollup/pluginutils@5.1.4(rollup@4.37.0)': dependencies: '@types/estree': 1.0.6 @@ -5924,10 +5940,6 @@ snapshots: '@types/normalize-package-data@2.4.4': {} - '@types/resolve@1.17.1': - dependencies: - '@types/node': 20.6.0 - '@types/resolve@1.20.2': {} '@types/tough-cookie@4.0.3': {} @@ -6372,8 +6384,6 @@ snapshots: buffer-from@1.1.2: {} - builtin-modules@3.3.0: {} - builtin-modules@4.0.0: {} bumpp@10.1.0: @@ -7535,12 +7545,6 @@ snapshots: filelist: 1.0.4 minimatch: 3.1.2 - jest-worker@26.6.2: - dependencies: - '@types/node': 20.6.0 - merge-stream: 2.0.0 - supports-color: 7.2.0 - jiti@1.21.7: {} jiti@2.4.2: {} @@ -7813,8 +7817,6 @@ snapshots: mdurl@2.0.0: {} - merge-stream@2.0.0: {} - merge2@1.4.1: {} micromark-core-commonmark@2.0.1: @@ -8527,14 +8529,6 @@ snapshots: optionalDependencies: '@babel/code-frame': 7.26.2 - rollup-plugin-terser@7.0.2(rollup@2.79.1): - dependencies: - '@babel/code-frame': 7.26.2 - jest-worker: 26.6.2 - rollup: 2.79.1 - serialize-javascript: 4.0.0 - terser: 5.19.4 - rollup@2.79.1: optionalDependencies: fsevents: 2.3.3 @@ -8609,7 +8603,7 @@ snapshots: semver@7.7.1: {} - serialize-javascript@4.0.0: + serialize-javascript@6.0.2: dependencies: randombytes: 2.1.0 @@ -8644,6 +8638,8 @@ snapshots: slashes@3.0.12: {} + smob@1.5.0: {} + source-map-js@1.2.1: {} source-map-support@0.5.21: @@ -9088,14 +9084,14 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-pwa@0.21.2(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.0.0)(workbox-window@7.0.0): + vite-plugin-pwa@1.0.0(vite@6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0))(workbox-build@7.3.0)(workbox-window@7.3.0): dependencies: debug: 4.4.0 pretty-bytes: 6.1.1 tinyglobby: 0.2.12 vite: 6.2.3(@types/node@20.6.0)(jiti@2.4.2)(terser@5.19.4)(tsx@4.19.3)(yaml@2.7.0) - workbox-build: 7.0.0 - workbox-window: 7.0.0 + workbox-build: 7.3.0 + workbox-window: 7.3.0 transitivePeerDependencies: - supports-color @@ -9240,24 +9236,25 @@ snapshots: siginfo: 2.0.0 stackback: 0.0.2 - workbox-background-sync@7.0.0: + workbox-background-sync@7.3.0: dependencies: idb: 7.1.1 - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-broadcast-update@7.0.0: + workbox-broadcast-update@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-build@7.0.0: + workbox-build@7.3.0: dependencies: '@apideck/better-ajv-errors': 0.3.6(ajv@8.12.0) '@babel/core': 7.26.0 '@babel/preset-env': 7.22.15(@babel/core@7.26.0) '@babel/runtime': 7.22.15 '@rollup/plugin-babel': 5.3.1(@babel/core@7.26.0)(rollup@2.79.1) - '@rollup/plugin-node-resolve': 11.2.1(rollup@2.79.1) + '@rollup/plugin-node-resolve': 15.3.1(rollup@2.79.1) '@rollup/plugin-replace': 2.4.2(rollup@2.79.1) + '@rollup/plugin-terser': 0.4.4(rollup@2.79.1) '@surma/rollup-plugin-off-main-thread': 2.2.3 ajv: 8.12.0 common-tags: 1.8.2 @@ -9267,91 +9264,90 @@ snapshots: lodash: 4.17.21 pretty-bytes: 5.6.0 rollup: 2.79.1 - rollup-plugin-terser: 7.0.2(rollup@2.79.1) source-map: 0.8.0-beta.0 stringify-object: 3.3.0 strip-comments: 2.0.1 tempy: 0.6.0 upath: 1.2.0 - workbox-background-sync: 7.0.0 - workbox-broadcast-update: 7.0.0 - workbox-cacheable-response: 7.0.0 - workbox-core: 7.0.0 - workbox-expiration: 7.0.0 - workbox-google-analytics: 7.0.0 - workbox-navigation-preload: 7.0.0 - workbox-precaching: 7.0.0 - workbox-range-requests: 7.0.0 - workbox-recipes: 7.0.0 - workbox-routing: 7.0.0 - workbox-strategies: 7.0.0 - workbox-streams: 7.0.0 - workbox-sw: 7.0.0 - workbox-window: 7.0.0 + workbox-background-sync: 7.3.0 + workbox-broadcast-update: 7.3.0 + workbox-cacheable-response: 7.3.0 + workbox-core: 7.3.0 + workbox-expiration: 7.3.0 + workbox-google-analytics: 7.3.0 + workbox-navigation-preload: 7.3.0 + workbox-precaching: 7.3.0 + workbox-range-requests: 7.3.0 + workbox-recipes: 7.3.0 + workbox-routing: 7.3.0 + workbox-strategies: 7.3.0 + workbox-streams: 7.3.0 + workbox-sw: 7.3.0 + workbox-window: 7.3.0 transitivePeerDependencies: - '@types/babel__core' - supports-color - workbox-cacheable-response@7.0.0: + workbox-cacheable-response@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-core@7.0.0: {} + workbox-core@7.3.0: {} - workbox-expiration@7.0.0: + workbox-expiration@7.3.0: dependencies: idb: 7.1.1 - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-google-analytics@7.0.0: + workbox-google-analytics@7.3.0: dependencies: - workbox-background-sync: 7.0.0 - workbox-core: 7.0.0 - workbox-routing: 7.0.0 - workbox-strategies: 7.0.0 + workbox-background-sync: 7.3.0 + workbox-core: 7.3.0 + workbox-routing: 7.3.0 + workbox-strategies: 7.3.0 - workbox-navigation-preload@7.0.0: + workbox-navigation-preload@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-precaching@7.0.0: + workbox-precaching@7.3.0: dependencies: - workbox-core: 7.0.0 - workbox-routing: 7.0.0 - workbox-strategies: 7.0.0 + workbox-core: 7.3.0 + workbox-routing: 7.3.0 + workbox-strategies: 7.3.0 - workbox-range-requests@7.0.0: + workbox-range-requests@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-recipes@7.0.0: + workbox-recipes@7.3.0: dependencies: - workbox-cacheable-response: 7.0.0 - workbox-core: 7.0.0 - workbox-expiration: 7.0.0 - workbox-precaching: 7.0.0 - workbox-routing: 7.0.0 - workbox-strategies: 7.0.0 + workbox-cacheable-response: 7.3.0 + workbox-core: 7.3.0 + workbox-expiration: 7.3.0 + workbox-precaching: 7.3.0 + workbox-routing: 7.3.0 + workbox-strategies: 7.3.0 - workbox-routing@7.0.0: + workbox-routing@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-strategies@7.0.0: + workbox-strategies@7.3.0: dependencies: - workbox-core: 7.0.0 + workbox-core: 7.3.0 - workbox-streams@7.0.0: + workbox-streams@7.3.0: dependencies: - workbox-core: 7.0.0 - workbox-routing: 7.0.0 + workbox-core: 7.3.0 + workbox-routing: 7.3.0 - workbox-sw@7.0.0: {} + workbox-sw@7.3.0: {} - workbox-window@7.0.0: + workbox-window@7.3.0: dependencies: '@types/trusted-types': 2.0.4 - workbox-core: 7.0.0 + workbox-core: 7.3.0 wrappy@1.0.2: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c416019..b63ef52 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -28,11 +28,12 @@ catalog: unplugin-vue-markdown: ^28.3.1 vite: ^6.2.3 vite-plugin-pages: ^0.32.5 - vite-plugin-pwa: ^0.21.2 + vite-plugin-pwa: ^1.0.0 vitest: ^3.0.9 vue: ^3.5.13 vue-router: ^4.5.0 vue-tsc: ^2.2.8 yargs: ^17.7.2 + workbox-build: ^7.3.0 onlyBuiltDependencies: - esbuild From db5117771872e11abb74b3e4da37316e3bfc211e Mon Sep 17 00:00:00 2001 From: userquin Date: Sun, 30 Mar 2025 13:26:55 +0200 Subject: [PATCH 07/10] chore: fix lint --- pnpm-workspace.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b63ef52..5fae7a5 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -33,7 +33,7 @@ catalog: vue: ^3.5.13 vue-router: ^4.5.0 vue-tsc: ^2.2.8 - yargs: ^17.7.2 workbox-build: ^7.3.0 + yargs: ^17.7.2 onlyBuiltDependencies: - esbuild From 703c4f7887b8788c364ef21c21ebe34342ba88ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Mon, 31 Mar 2025 23:12:13 +0200 Subject: [PATCH 08/10] chore: apply suggestion Co-authored-by: Kevin Marrec --- README.md | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/README.md b/README.md index 40543e8..292fadf 100644 --- a/README.md +++ b/README.md @@ -59,36 +59,6 @@ else { // your client code will be removed in the server build } ``` - -Alternatively, you can also use `isClient` from `ViteSSGContext` using these 3 simple rules: -1) don't destructure the `ViteSSGContext` in the `ViteSSG` function -2) don't destructure `isClient` from `ViteSSGContext` in the callback function body -3) use `isClient` from `ViteSSGContext` in the callback function body (implicit ;) ) - -```ts -import { ViteSSG } from 'vite-ssg' -import App from './App.vue' - -export const createApp = ViteSSG( - // the root component - App, - // vue-router options - { routes }, - // previous 1) rule - (ctx) => { - // previous 2) rule - const { app, router, routes, initialState } = ctx - // previous 3) rule - if (ctx.isClient) { - // your client code - } - else { - // your server code - } - } -) -``` - ### Single Page SSG For SSG of an index page only (i.e. without `vue-router`); import `vite-ssg/single-page` instead, and only install `@unhead/vue` (`npm i -D vite-ssg @unhead/vue`). From 74ff2cf0f5e77256c4a8872b934ffc27a37e4f0d Mon Sep 17 00:00:00 2001 From: userquin Date: Mon, 31 Mar 2025 23:30:41 +0200 Subject: [PATCH 09/10] chore: deprecate `isClient` --- src/types.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types.ts b/src/types.ts index c291b3c..bc228e9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -123,6 +123,12 @@ export interface ViteSSGContext { routes: HasRouter extends true ? Readonly : undefined initialState: Record head: VueHeadClient | undefined + /** + * Use `!import.meta.env.SSR` instead. + * + * @see https://github.com/antfu-collective/vite-ssg?tab=readme-ov-file#how-to-allow-rollup-tree-shake-your-client-code + * @deprecated + */ isClient: boolean onSSRAppRendered: (cb: () => void) => void triggerOnSSRAppRendered: (route: string, appHTML: string, appCtx: ViteSSGContext) => Promise From 878f867eee4e5e8b95a6d76a8ea0f3e8f4554cd1 Mon Sep 17 00:00:00 2001 From: userquin Date: Mon, 31 Mar 2025 23:31:01 +0200 Subject: [PATCH 10/10] chore: add type to spa context --- src/client/single-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/single-page.ts b/src/client/single-page.ts index 07961d2..7347b9b 100644 --- a/src/client/single-page.ts +++ b/src/client/single-page.ts @@ -40,7 +40,7 @@ export function ViteSSG( const triggerOnSSRAppRendered = () => { return Promise.all(appRenderCallbacks.map(cb => cb())) } - const context = { + const context: ViteSSGContext = { app, head, isClient: !import.meta.env.SSR,