diff --git a/TODO.md b/TODO.md index 7f91507..d8af0b6 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,7 @@ ## TODO - review workbox-sw package, maybe we need to move it to commonjs? +- review service worker (registration) globals ## Pending task diff --git a/alias.ts b/alias.ts new file mode 100644 index 0000000..02feb64 --- /dev/null +++ b/alias.ts @@ -0,0 +1,17 @@ +import type { TSConfig } from 'pkg-types' +import { createRequire } from 'node:module' +import { fileURLToPath } from 'node:url' +import { resolve } from 'pathe' + +const require = createRequire(import.meta.url) + +const compilerOptions: TSConfig['compilerOptions'] = require('./tsconfig.json').compilerOptions + +function r(p: string) { + return resolve(fileURLToPath(new URL('.', import.meta.url)), p) +} + +export const alias = Array.from(Object.entries(compilerOptions!.paths)).reduce((acc, [name, paths]) => { + acc[name] = r((paths as string[])[0]) + return acc +}, {} as Record) diff --git a/helper.ts b/helper.ts new file mode 100644 index 0000000..96833a5 --- /dev/null +++ b/helper.ts @@ -0,0 +1,31 @@ +export const banner = `/* + Copyright 2019 Google LLC, Vite PWA's Team + + Use of this source code is governed by an MIT-style + license that can be found in the LICENSE file or at + https://opensource.org/licenses/MIT. +*/` + +export const define = { + 'process.env.NODE_ENV': 'process.env.NODE_ENV', +} satisfies import('tsdown').Options['define'] + +export const exports = { + customExports(exp, { pkg }) { + // **/types contains only types: just replace the entry + const typesVersions: Record = {} + for (const [key, value] of Object.entries(exp)) { + // add typesVersions entry + if (key !== '.' && key !== './package.json') { + typesVersions[key.slice(2)] = [value.replace(/\.js$/, '.d.ts')] + } + if (key.endsWith('/types')) { + exp[key] = { types: value.replace(/\.js$/, '.d.ts') } + } + } + + pkg.typesVersions = { '*': typesVersions } + + return exp + }, +} satisfies import('tsdown').ExportsOptions diff --git a/package.json b/package.json index f6f54de..745b683 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "version": "0.0.0", "private": true, - "packageManager": "pnpm@10.18.3", + "packageManager": "pnpm@10.19.0", "description": "Top-level scripts and dependencies for the workbox monorepo.", "author": "Google's Web DevRel Team, Vite PWA's Team", "contributors": [ @@ -21,9 +21,12 @@ "node": ">=20.0.0" }, "scripts": { - "build": "pnpm -r --filter=./packages/* run build", + "build": "pnpm -r --filter \"./packages/*\" run build", "lint": "eslint .", "lint:fix": "nr lint --fix", + "test": "vitest", + "test:run": "vitest run", + "test:ui": "vitest --ui", "update-deps": "taze minor -wIr", "release": "bumpp -r --excute=\"pnpm i\"" }, @@ -34,12 +37,15 @@ "@types/node": "catalog:types", "@types/trusted-types": "catalog:types", "@typescript-eslint/utils": "catalog:typescript", + "@vitest/ui": "catalog:testing", "bumpp": "catalog:build", "eslint": "catalog:eslint", "eslint-plugin-antfu": "catalog:eslint", "taze": "catalog:utils", "tsdown": "catalog:build", - "typescript": "catalog:typescript" + "tsx": "^4.20.6", + "typescript": "catalog:typescript", + "vitest": "catalog:testing" }, "resolutions": { "@typescript-eslint/utils": "catalog:typescript" diff --git a/packages/workbox-background-sync/package.json b/packages/workbox-background-sync/package.json deleted file mode 100644 index d10f0ba..0000000 --- a/packages/workbox-background-sync/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@vite-pwa/workbox-background-sync", - "type": "module", - "version": "0.0.0", - "description": "Queues failed requests and uses the Background Sync API to replay them when the network is available", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-background-sync" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "background", - "sync", - "workbox-plugin" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*", - "idb": "catalog:utils" - } -} diff --git a/packages/workbox-background-sync/tsdown.config.ts b/packages/workbox-background-sync/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-background-sync/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-broadcast-update/package.json b/packages/workbox-broadcast-update/package.json deleted file mode 100644 index 26b5d28..0000000 --- a/packages/workbox-broadcast-update/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@vite-pwa/workbox-broadcast-update", - "type": "module", - "version": "0.0.0", - "description": "A service worker helper library that uses the Broadcast Channel API to announce when a cached response has updated", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-broadcast-update" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "workbox-plugin" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-broadcast-update/src/index.ts b/packages/workbox-broadcast-update/src/index.ts deleted file mode 100644 index df3ea54..0000000 --- a/packages/workbox-broadcast-update/src/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright 2018 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/ - -import { - BroadcastCacheUpdate, - BroadcastCacheUpdateOptions, -} from './BroadcastCacheUpdate' -import { BroadcastUpdatePlugin } from './BroadcastUpdatePlugin' -import { responsesAreSame } from './responsesAreSame' - -export { - BroadcastCacheUpdate, - BroadcastCacheUpdateOptions, - BroadcastUpdatePlugin, - responsesAreSame, -} diff --git a/packages/workbox-broadcast-update/tsdown.config.ts b/packages/workbox-broadcast-update/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-broadcast-update/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-build/magicast-0.3.5.tgz b/packages/workbox-build/magicast-0.3.5.tgz new file mode 100644 index 0000000..245c69a Binary files /dev/null and b/packages/workbox-build/magicast-0.3.5.tgz differ diff --git a/packages/workbox-build/package.json b/packages/workbox-build/package.json new file mode 100644 index 0000000..73fd187 --- /dev/null +++ b/packages/workbox-build/package.json @@ -0,0 +1,77 @@ +{ + "name": "@vite-pwa/workbox-build", + "type": "module", + "version": "0.0.0", + "description": "A module that integrates into your build process, helping you generate a manifest of local files that workbox-sw should precache.", + "author": "Google's Web DevRel Team, Vite PWA's Team", + "contributors": [ + "userquin " + ], + "license": "MIT", + "funding": "https://github.com/sponsors/antfu", + "homepage": "https://github.com/vite-pwa/workbox#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/vite-pwa/workbox.git", + "directory": "packages/workbox-build" + }, + "bugs": "https://github.com/vite-pwa/workbox/issues", + "keywords": [ + "workbox", + "workboxjs", + "service worker", + "caching", + "fetch requests", + "offline", + "file manifest" + ], + "sideEffects": false, + "exports": { + ".": "./dist/index.js", + "./generate-sw": "./dist/generate-sw.js", + "./get-manifest": "./dist/get-manifest.js", + "./inject-manifest": "./dist/inject-manifest.js", + "./types": { + "types": "./dist/types.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "typesVersions": { + "*": { + "generate-sw": [ + "./dist/generate-sw.d.ts" + ], + "get-manifest": [ + "./dist/get-manifest.d.ts" + ], + "inject-manifest": [ + "./dist/inject-manifest.d.ts" + ], + "types": [ + "./dist/types.d.ts" + ] + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "tsdown", + "prepublishOnly": "pnpm run build", + "node:test": "node ./dist/generate-sw.js", + "tsx:test": "tsx ./src/generate-sw.ts" + }, + "dependencies": { + "@vite-pwa/workbox-swkit": "workspace:*", + "@vite-pwa/workbox-window": "workspace:*", + "magicast": "file:magicast-0.3.5.tgz", + "pathe": "catalog:utils", + "pkg-types": "catalog:utils", + "proper-tags": "catalog:utils", + "recast": "catalog:utils", + "valibot": "catalog:utils" + } +} diff --git a/packages/workbox-build/src/generate-sw.ts b/packages/workbox-build/src/generate-sw.ts new file mode 100644 index 0000000..8eb67ee --- /dev/null +++ b/packages/workbox-build/src/generate-sw.ts @@ -0,0 +1,476 @@ +import type { ArrayExpression, Identifier, ObjectExpression, Program } from '@babel/types' +import type { ProxifiedModule, ProxifiedObject } from 'magicast' +import type { GenerateSWOptions } from './types' +import { builders, generateCode, parseModule } from 'magicast' +import { deepMergeObject, getDefaultExportOptions } from 'magicast/helpers' +import { AsyncGenerateSWOptionsSchema } from './validation/async-generate-sw' +import { validateAsync } from './validation/validation-helper' + +// Helper para capitalizar: NetworkFirst -> NetworkFirst +function capitalize(s: string, sanitize = false) { + const value = s.charAt(0).toUpperCase() + s.slice(1) + return sanitize ? value.replace(/['"]/g, '') : value +} + +export async function generateSW( + options: ProxifiedModule, +): Promise { + const proxifiedOptions = getDefaultExportOptions(options) as ProxifiedObject + /* const optionsWithDefaults = validate( + GenerateSWOptionsSchema, + proxifiedOptions, + 'generateSW', + ) */ + const optionsWithDefaults = await validateAsync( + AsyncGenerateSWOptionsSchema, + proxifiedOptions, + 'generateSW', + ) + // inject defaults added by valibot + deepMergeObject(proxifiedOptions, optionsWithDefaults) + console.log(generateCode(proxifiedOptions).code) + // if (true) { + // return + // } + + const swModule = parseModule('') + + const strategyImports = new Set() + if (proxifiedOptions.runtimeCaching) { + for (const entry of proxifiedOptions.runtimeCaching) { + if (typeof entry.handler === 'string') { + strategyImports.add(capitalize(entry.handler)) + } + } + } + + if (proxifiedOptions.skipWaiting) { + swModule.imports.$append({ from: '@vite-pwa/workbox-swkit/core', imported: 'skipWaiting' }) + } + if (proxifiedOptions.clientsClaim) { + swModule.imports.$append({ from: '@vite-pwa/workbox-swkit/core', imported: 'clientsClaim' }) + } + if (proxifiedOptions.runtimeCaching?.length) { + swModule.imports.$append({ from: '@vite-pwa/workbox-swkit/routing', imported: 'registerRoute' }) + if (strategyImports.size > 0) { + for (const strategyImport of strategyImports) { + swModule.imports.$append({ + from: '@vite-pwa/workbox-swkit/strategies', + imported: strategyImport, + }) + } + } + } + + // --- CONSTRUCCIÓN DEL CÓDIGO --- + const swCode: string[] = [] + + if (proxifiedOptions.skipWaiting) { + swCode.push('skipWaiting();') + } + if (proxifiedOptions.clientsClaim) { + swCode.push('clientsClaim();') + } + + if (proxifiedOptions.runtimeCaching) { + swCode.push(...getRuntimeCachingEntries(proxifiedOptions, strategyImports)) + } + + const importsCode = generateCode(swModule.imports).code + const finalCode = `${importsCode}\n\n${swCode.join('\n')}` + + console.log('--- GENERATED SERVICE WORKER ---') + console.log(finalCode) +} + +function getRuntimeCachingEntries( + proxifiedOptions: ProxifiedObject, + strategyImports: Set, +): string[] { + const entries: string[] = [] + if (!proxifiedOptions.runtimeCaching) { + return entries + } + + for (const entry of proxifiedOptions.runtimeCaching) { + let handlerNode: any + + if (typeof entry.handler === 'string') { + const strategyName = capitalize(entry.handler, true) + strategyImports.add(capitalize(strategyName, true)) + // const callee = builders.identifier(strategyName) + const args = entry.options?.$ast ? [entry.options] : undefined + handlerNode = args && args.length > 0 + ? builders.newExpression(strategyName, ...args) + : builders.newExpression(strategyName) + } + else { + handlerNode = entry.handler + } + + const routeCallNode = builders.functionCall( + 'registerRoute', + entry.urlPattern, + handlerNode, + ) + + entries.push(generateCode(routeCallNode).code) + } + + return entries +} + +function __getRuntimeCachingEntries( + proxifiedOptions: ProxifiedObject, + strategyImports: Set, +): string[] { + const entries: string[] = [] + if (!proxifiedOptions.runtimeCaching) { + return entries + } + + // ¡Ahora podemos iterar directamente sobre el proxy! + for (const entry of proxifiedOptions.runtimeCaching) { + // 1. Generar el código para urlPattern de forma segura + let patternCode: string + if (typeof entry.urlPattern === 'string') { + // Es un string, lo convertimos a un literal de string + patternCode = JSON.stringify(entry.urlPattern) + } + else if (entry.urlPattern instanceof RegExp) { + // Es un RegExp nativo, usamos .toString() + patternCode = entry.urlPattern.toString() + } + else { + // Es un Proxy de función, usamos generateCode + patternCode = generateCode(entry.urlPattern).code + } + + // 2. Generar el código para handler + let handlerCode: string + if (typeof entry.handler === 'string') { + strategyImports.add(capitalize(entry.handler)) + const optionsCode = entry.options ? generateCode(entry.options).code : '' + // Usamos generateCode en el string para obtener el literal correcto (e.g. 'CacheFirst') + // y luego lo sanitizamos para quitar las comillas. + handlerCode = `new ${capitalize(entry.handler, true)}(${optionsCode})` + } + else { + handlerCode = generateCode(entry.handler).code + } + + // 3. Sanitizar el código generado para las funciones (eliminar paréntesis/punto y coma extra) + const sanitize = (code: string) => { + if (code.startsWith('(') && code.endsWith(');')) { + return code.slice(1, -2) // (function() {}); => function() {} + } + if (code.endsWith(';')) { + return code.slice(0, -1) // () => {}; => () => {} + } + return code + } + + const registerRoute = builders.functionCall('registerRoute', entry.urlPattern, entry.handler) + console.log(generateCode(registerRoute).code) + + // 4. Construir la llamada final + entries.push(`registerRoute(${sanitize(patternCode)}, ${sanitize(handlerCode)});`) + } + + return entries +} + +function _getRuntimeCachingEntries( + proxifiedOptions: ProxifiedObject, + strategyImports: Set, +): string[] { + if (!proxifiedOptions.runtimeCaching) + return [] + + // Tu genialidad: aislar el array en un módulo temporal para obtener un AST "limpio". + const runtimeCachingModule = parseModule(`const runtimeCaching = ${generateCode(proxifiedOptions.runtimeCaching).code};\nexport default runtimeCaching;`) + const runtimeCachingDeclarationId = runtimeCachingModule.exports.default!.$name + + const entries: string[] = [] + + for (const node of (runtimeCachingModule.$ast as Program).body) { + if (node.type === 'VariableDeclaration') { + for (const declaration of node.declarations) { + if ( + declaration.id.type === 'Identifier' + && declaration.id.name === runtimeCachingDeclarationId + && declaration.init + ) { + const handlers = declaration.init as ArrayExpression + for (const rCaching of handlers.elements) { + if (!rCaching) + continue + + const data = rCaching as ObjectExpression + let patternCode: string | undefined + let handlerCode: string | undefined + + for (const prop of data.properties) { + if (prop.type === 'ObjectMethod') { + const id = prop.key as Identifier + // El replace para convertir `method() {}` en `function () {}` + const code = generateCode(prop).code.replace(new RegExp(`^${id.name}`), 'function ') + if (id.name === 'handler') { + handlerCode = code + } + else if (id.name === 'urlPattern') { + patternCode = code + } + } + else if (prop.type === 'ObjectProperty') { + const id = prop.key as Identifier + const value = prop.value + if (id.name === 'handler') { + if (value.type === 'StringLiteral') { + strategyImports.add(value.value) + // La sanitización correcta para `new Strategy()` + handlerCode = `new ${capitalize(generateCode(value).code, true)}()` + } + else { + // Para funciones y objetos, simplemente generamos el código + handlerCode = generateCode(value).code + } + } + else if (id.name === 'urlPattern') { + patternCode = generateCode(value).code + } + } + } + if (patternCode && handlerCode) { + if (patternCode.startsWith('(') && patternCode.endsWith(');')) { + patternCode = patternCode.slice(1, -2) // Elimina ( y ); + } + else if (patternCode.endsWith(';')) { + patternCode = patternCode.slice(0, -1) // Elimina ; + } + + if (handlerCode.startsWith('(') && handlerCode.endsWith(');')) { + handlerCode = handlerCode.slice(1, -2) // Elimina ( y ); + } + else if (handlerCode.endsWith(';')) { + handlerCode = handlerCode.slice(0, -1) // Elimina ; + } + + entries.push(`registerRoute(${patternCode}, ${handlerCode});`) + } + } + } + } + } + } + + return entries +} + +function getRuntimeCachingEntries2( + proxifiedOptions: ProxifiedObject, + strategyImports: Set, +): string[] { + if (!proxifiedOptions.runtimeCaching) + return [] + + const runtimeCachingModule = parseModule(`const runtimeCaching = ${generateCode(proxifiedOptions.runtimeCaching).code};\nexport default runtimeCaching;`) + const runtimeCachingDeclarationId = runtimeCachingModule.exports.default!.$name + + const entries: string[] = [] + + for (const node of (runtimeCachingModule.$ast as Program).body) { + if (node.type === 'VariableDeclaration') { + for (const declaration of node.declarations) { + if ( + declaration.id.type === 'Identifier' + && declaration.id.name === runtimeCachingDeclarationId + && declaration.init + ) { + const handlers = declaration.init as ArrayExpression + for (const rCaching of handlers.elements) { + if (!rCaching) + continue + + const data = rCaching as ObjectExpression + let patternCode: string | undefined + let handlerCode: string | undefined + + for (const prop of data.properties) { + if (prop.type === 'ObjectMethod') { + const id = prop.key as Identifier + if (id.name === 'handler') { + handlerCode = generateCode(prop).code.replace(new RegExp(`^${id.name}`), 'function ') + } + else if (id.name === 'urlPattern') { + patternCode = generateCode(prop).code.replace(new RegExp(`^${id.name}`), 'function ') + } + } + else if (prop.type === 'ObjectProperty') { + const id = prop.key as Identifier + const value = prop.value + if (id.name === 'handler') { + if (value.type === 'StringLiteral') { + strategyImports.add(value.value) + handlerCode = `new ${capitalize(value.value, true)}()` + } + else { + handlerCode = generateCode(value).code + } + } + else if (id.name === 'urlPattern') { + patternCode = generateCode(value).code + } + } + } + if (patternCode && handlerCode) { + entries.push(`registerRoute(${patternCode}, ${handlerCode});`) + } + } + } + } + } + } + + return entries +} + +function getRuntimeCachingEntriesOld( + proxifiedOptions: ProxifiedObject, + strategyImports: Set, +): string[] { + const runtimeCaching = parseModule(`const runtimeCaching = ${generateCode(proxifiedOptions.runtimeCaching!).code}; +export default runtimeCaching; +`) + + const runtimeCachingDeclarationId = runtimeCaching.exports.default.$name + + const entries: string[] = [] + + for (const node of (runtimeCaching.$ast as Program).body) { + if (node.type === 'VariableDeclaration') { + for (const declaration of node.declarations) { + if ( + declaration.id.type === 'Identifier' + && declaration.id.name === runtimeCachingDeclarationId + && declaration.init + ) { + /* const init + = declaration.init.type === 'TSSatisfiesExpression' + ? declaration.init.expression + : declaration.init */ + + const handlers = declaration.init as ArrayExpression + + for (const rCaching of handlers.elements) { + if (!rCaching) { + continue + } + const data = rCaching as ObjectExpression + console.log(rCaching?.type) + console.log(data.properties) + let patternCode: string | undefined + let handlerCode: string | undefined + for (const prop of data.properties) { + if (prop.type === 'ObjectMethod') { + const id = prop.key as Identifier + if (id.name === 'handler') { + handlerCode = generateCode(prop).code + } + else if (id.name === 'urlPattern') { + patternCode = generateCode(prop).code + } + } + else if (prop.type === 'ObjectProperty') { + const id = prop.key as Identifier + const value = prop.value + if (id.name === 'handler') { + // can be an arrow function or a handler we only check for strategy name here + // todo: handle options arggg + if (value.type !== 'StringLiteral') { + handlerCode = `new ${capitalize(generateCode(value).code, true)}()` + } + else { + handlerCode = generateCode(value).code + } + } + else if (id.name === 'urlPattern') { + patternCode = generateCode(value).code + } + } + } + if (patternCode && handlerCode) { + entries.push(`registerRoute(${patternCode}, ${handlerCode});`) + } + } + } + } + } + } + + return entries +} + +async function main() { + const module = parseModule(`export default { + swDest: 'sw.js', + skipWaiting: true, + clientsClaim: true, + runtimeCaching: [ + { + urlPattern: /^\\/api\\//, + handler: 'NetworkFirst', + }, + { + urlPattern: ({ request }) => request.destination === 'image', + handler: 'CacheFirst', + options: { + cacheName: 'google-fonts', + expiration: { + maxEntries: 4, + maxAgeSeconds: 365 * 24 * 60 * 60, // 365 days + }, + }, + }, + { + urlPattern({ request }) { return request.destination === 'image' }, + handler: 'NetworkFirst', + }, + { + urlPattern: '/images/', + handler: 'CacheFirst', + }, + { + urlPattern() { return false }, + handler: 'CacheFirst', + }, + { + urlPattern: function () { return false }, + handler: 'CacheFirst', + }, + { + urlPattern: function () { return false }, + handler() { return Response.error() }, + }, + { + urlPattern: function () { return false }, + handler: { + handle: () => Response.error() + } + }, + { + // method: 'PEPE', + urlPattern: function () { return false }, + handler: { + handle() { + return Response.error() + } + } + } + ], +} +`) + await generateSW(module) +} + +main() diff --git a/packages/workbox-build/src/get-manifest.ts b/packages/workbox-build/src/get-manifest.ts new file mode 100644 index 0000000..5d83455 --- /dev/null +++ b/packages/workbox-build/src/get-manifest.ts @@ -0,0 +1,5 @@ +import type { GetManifestOptions } from './types' + +export async function injectManifest(config: GetManifestOptions) { + +} diff --git a/packages/workbox-build/src/index.ts b/packages/workbox-build/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/workbox-build/src/inject-manifest.ts b/packages/workbox-build/src/inject-manifest.ts new file mode 100644 index 0000000..3f062e8 --- /dev/null +++ b/packages/workbox-build/src/inject-manifest.ts @@ -0,0 +1,5 @@ +import type { InjectManifestOptions } from './types' + +export async function injectManifest(config: InjectManifestOptions) { + +} diff --git a/packages/workbox-build/src/schema/GenerateSWOptions.json b/packages/workbox-build/src/schema/GenerateSWOptions.json new file mode 100644 index 0000000..e58464b --- /dev/null +++ b/packages/workbox-build/src/schema/GenerateSWOptions.json @@ -0,0 +1,883 @@ +{ + "additionalProperties": false, + "type": "object", + "properties": { + "additionalManifestEntries": { + "description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ManifestEntry" + }, + { + "type": "string" + } + ] + } + }, + "dontCacheBustURLsMatching": { + "description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.", + "$ref": "#/definitions/RegExp" + }, + "manifestTransforms": { + "description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.", + "type": "array", + "items": {} + }, + "maximumFileSizeToCacheInBytes": { + "description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.", + "default": 2097152, + "type": "number" + }, + "modifyURLPrefix": { + "description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "globFollow": { + "description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "globIgnores": { + "description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": [ + "**/node_modules/**/*" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globPatterns": { + "description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).", + "default": [ + "**/*.{js,css,html}" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globStrict": { + "description": "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "templatedURLs": { + "description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] + } + }, + "babelPresetEnvTargets": { + "description": "The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass\nto `babel-preset-env` when transpiling the service worker bundle.", + "default": [ + "chrome >= 56" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "cacheId": { + "description": "An optional ID to be prepended to cache names. This is primarily useful for\nlocal development where multiple sites may be served from the same\n`http://localhost:port` origin.", + "type": [ + "null", + "string" + ] + }, + "cleanupOutdatedCaches": { + "description": "Whether or not Workbox should attempt to identify and delete any precaches\ncreated by older, incompatible versions.", + "default": false, + "type": "boolean" + }, + "clientsClaim": { + "description": "Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim)\nany existing clients as soon as it activates.", + "default": false, + "type": "boolean" + }, + "directoryIndex": { + "description": "If a navigation request for a URL ending in `/` fails to match a precached\nURL, this value will be appended to the URL and that will be checked for a\nprecache match. This should be set to what your web server is using for its\ndirectory index.", + "type": [ + "null", + "string" + ] + }, + "disableDevLogs": { + "default": false, + "type": "boolean" + }, + "ignoreURLParametersMatching": { + "description": "Any search parameter names that match against one of the RegExp in this\narray will be removed before looking for a precache match. This is useful\nif your users might request URLs that contain, for example, URL parameters\nused to track the source of the traffic. If not provided, the default value\nis `[/^utm_/, /^fbclid$/]`.", + "type": "array", + "items": { + "$ref": "#/definitions/RegExp" + } + }, + "importScripts": { + "description": "A list of JavaScript files that should be passed to\n[`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)\ninside the generated service worker file. This is useful when you want to\nlet Workbox create your top-level service worker file, but want to include\nsome additional code, such as a push event listener.", + "type": "array", + "items": { + "type": "string" + } + }, + "inlineWorkboxRuntime": { + "description": "Whether the runtime code for the Workbox library should be included in the\ntop-level service worker, or split into a separate file that needs to be\ndeployed alongside the service worker. Keeping the runtime separate means\nthat users will not have to re-download the Workbox code each time your\ntop-level service worker changes.", + "default": false, + "type": "boolean" + }, + "mode": { + "description": "If set to 'production', then an optimized service worker bundle that\nexcludes debugging info will be produced. If not explicitly configured\nhere, the `process.env.NODE_ENV` value will be used, and failing that, it\nwill fall back to `'production'`.", + "default": "production", + "type": [ + "null", + "string" + ] + }, + "navigateFallback": { + "description": "If specified, all\n[navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests)\nfor URLs that aren't precached will be fulfilled with the HTML at the URL\nprovided. You must pass in the URL of an HTML document that is listed in\nyour precache manifest. This is meant to be used in a Single Page App\nscenario, in which you want all navigations to use common\n[App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell).", + "default": null, + "type": [ + "null", + "string" + ] + }, + "navigateFallbackAllowlist": { + "description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedent.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.", + "type": "array", + "items": { + "$ref": "#/definitions/RegExp" + } + }, + "navigateFallbackDenylist": { + "description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedence.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.", + "type": "array", + "items": { + "$ref": "#/definitions/RegExp" + } + }, + "navigationPreload": { + "description": "Whether or not to enable\n[navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload)\nin the generated service worker. When set to true, you must also use\n`runtimeCaching` to set up an appropriate response strategy that will match\nnavigation requests, and make use of the preloaded response.", + "default": false, + "type": "boolean" + }, + "offlineGoogleAnalytics": { + "description": "Controls whether or not to include support for\n[offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics).\nWhen `true`, the call to `workbox-google-analytics`'s `initialize()` will\nbe added to your generated service worker. When set to an `Object`, that\nobject will be passed in to the `initialize()` call, allowing you to\ncustomize the behavior.", + "default": false, + "anyOf": [ + { + "$ref": "#/definitions/GoogleAnalyticsInitializeOptions" + }, + { + "type": "boolean" + } + ] + }, + "runtimeCaching": { + "description": "When using Workbox's build tools to generate your service worker, you can\nspecify one or more runtime caching configurations. These are then\ntranslated to {@link workbox-routing.registerRoute} calls using the match\nand handler configuration you define.\n\nFor all of the options, see the {@link workbox-build.RuntimeCaching}\ndocumentation. The example below shows a typical configuration, with two\nruntime routes defined:", + "type": "array", + "items": { + "$ref": "#/definitions/RuntimeCaching" + } + }, + "skipWaiting": { + "description": "Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase)\nto the generated service worker. If `false`, then a `message` listener will\nbe added instead, allowing client pages to trigger `skipWaiting()` by\ncalling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker.", + "default": false, + "type": "boolean" + }, + "sourcemap": { + "description": "Whether to create a sourcemap for the generated service worker files.", + "default": true, + "type": "boolean" + }, + "swDest": { + "description": "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.", + "type": "string" + }, + "globDirectory": { + "description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.", + "type": "string" + } + }, + "required": [ + "swDest" + ], + "definitions": { + "ManifestEntry": { + "type": "object", + "properties": { + "integrity": { + "type": "string" + }, + "revision": { + "type": [ + "null", + "string" + ] + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "revision", + "url" + ] + }, + "RegExp": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "ignoreCase": { + "type": "boolean" + }, + "multiline": { + "type": "boolean" + }, + "lastIndex": { + "type": "number" + }, + "flags": { + "type": "string" + }, + "sticky": { + "type": "boolean" + }, + "unicode": { + "type": "boolean" + }, + "dotAll": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "dotAll", + "flags", + "global", + "ignoreCase", + "lastIndex", + "multiline", + "source", + "sticky", + "unicode" + ] + }, + "GoogleAnalyticsInitializeOptions": { + "type": "object", + "properties": { + "cacheName": { + "type": "string" + }, + "parameterOverrides": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "hitFilter": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "RuntimeCaching": { + "type": "object", + "properties": { + "handler": { + "description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.", + "anyOf": [ + { + "$ref": "#/definitions/RouteHandlerCallback" + }, + { + "$ref": "#/definitions/RouteHandlerObject" + }, + { + "enum": [ + "CacheFirst", + "CacheOnly", + "NetworkFirst", + "NetworkOnly", + "StaleWhileRevalidate" + ], + "type": "string" + } + ] + }, + "method": { + "description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.", + "default": "GET", + "enum": [ + "DELETE", + "GET", + "HEAD", + "PATCH", + "POST", + "PUT" + ], + "type": "string" + }, + "options": { + "type": "object", + "properties": { + "backgroundSync": { + "description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/QueueOptions" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "broadcastUpdate": { + "description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "channelName": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/BroadcastCacheUpdateOptions" + } + }, + "additionalProperties": false, + "required": [ + "options" + ] + }, + "cacheableResponse": { + "description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheableResponseOptions" + }, + "cacheName": { + "description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.", + "type": [ + "null", + "string" + ] + }, + "expiration": { + "description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/ExpirationPluginOptions" + }, + "networkTimeoutSeconds": { + "description": "If provided, this will set the `networkTimeoutSeconds` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.", + "type": "number" + }, + "plugins": { + "description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkboxPlugin" + } + }, + "precacheFallback": { + "description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "fallbackURL": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "fallbackURL" + ] + }, + "rangeRequests": { + "description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "boolean" + }, + "fetchOptions": { + "description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/RequestInit" + }, + "matchOptions": { + "description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheQueryOptions" + } + }, + "additionalProperties": false + }, + "urlPattern": { + "description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.", + "anyOf": [ + { + "$ref": "#/definitions/RegExp" + }, + { + "$ref": "#/definitions/RouteMatchCallback" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "handler", + "urlPattern" + ] + }, + "RouteHandlerCallback": {}, + "RouteHandlerObject": { + "description": "An object with a `handle` method of type `RouteHandlerCallback`.\n\nA `Route` object can be created with either an `RouteHandlerCallback`\nfunction or this `RouteHandler` object. The benefit of the `RouteHandler`\nis it can be extended (as is done by the `workbox-strategies` package).", + "type": "object", + "properties": { + "handle": { + "$ref": "#/definitions/RouteHandlerCallback" + } + }, + "additionalProperties": false, + "required": [ + "handle" + ] + }, + "QueueOptions": { + "type": "object", + "properties": { + "forceSyncFallback": { + "type": "boolean" + }, + "maxRetentionTime": { + "type": "number" + }, + "onSync": { + "$ref": "#/definitions/OnSyncCallback" + } + }, + "additionalProperties": false + }, + "OnSyncCallback": {}, + "BroadcastCacheUpdateOptions": { + "type": "object", + "properties": { + "headersToCheck": { + "type": "array", + "items": { + "type": "string" + } + }, + "generatePayload": { + "type": "object", + "additionalProperties": false + }, + "notifyAllClients": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheableResponseOptions": { + "type": "object", + "properties": { + "statuses": { + "type": "array", + "items": { + "type": "number" + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "ExpirationPluginOptions": { + "type": "object", + "properties": { + "maxEntries": { + "type": "number" + }, + "maxAgeSeconds": { + "type": "number" + }, + "matchOptions": { + "$ref": "#/definitions/CacheQueryOptions" + }, + "purgeOnQuotaError": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheQueryOptions": { + "type": "object", + "properties": { + "ignoreMethod": { + "type": "boolean" + }, + "ignoreSearch": { + "type": "boolean" + }, + "ignoreVary": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "WorkboxPlugin": { + "description": "An object with optional lifecycle callback properties for the fetch and\ncache operations.", + "type": "object", + "properties": { + "cacheDidUpdate": {}, + "cachedResponseWillBeUsed": {}, + "cacheKeyWillBeUsed": {}, + "cacheWillUpdate": {}, + "fetchDidFail": {}, + "fetchDidSucceed": {}, + "handlerDidComplete": {}, + "handlerDidError": {}, + "handlerDidRespond": {}, + "handlerWillRespond": {}, + "handlerWillStart": {}, + "requestWillFetch": {} + }, + "additionalProperties": false + }, + "CacheDidUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "CachedResponseWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheKeyWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheWillUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidFailCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidSucceedCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidCompleteCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidErrorCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillStartCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestWillFetchCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestInit": { + "type": "object", + "properties": { + "body": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/ArrayBufferView" + }, + { + "$ref": "#/definitions/Blob" + }, + { + "$ref": "#/definitions/FormData" + }, + { + "$ref": "#/definitions/URLSearchParams" + }, + { + "$ref": "#/definitions/ReadableStream" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "cache": { + "enum": [ + "default", + "force-cache", + "no-cache", + "no-store", + "only-if-cached", + "reload" + ], + "type": "string" + }, + "credentials": { + "enum": [ + "include", + "omit", + "same-origin" + ], + "type": "string" + }, + "headers": { + "anyOf": [ + { + "$ref": "#/definitions/Headers" + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "$ref": "#/definitions/Record" + } + ] + }, + "integrity": { + "type": "string" + }, + "keepalive": { + "type": "boolean" + }, + "method": { + "type": "string" + }, + "mode": { + "enum": [ + "cors", + "navigate", + "no-cors", + "same-origin" + ], + "type": "string" + }, + "redirect": { + "enum": [ + "error", + "follow", + "manual" + ], + "type": "string" + }, + "referrer": { + "type": "string" + }, + "referrerPolicy": { + "enum": [ + "", + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ], + "type": "string" + }, + "signal": { + "anyOf": [ + { + "$ref": "#/definitions/AbortSignal" + }, + { + "type": "null" + } + ] + }, + "window": {} + }, + "additionalProperties": false + }, + "ArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@toStringTag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "__@toStringTag", + "byteLength" + ] + }, + "ArrayBufferView": { + "type": "object", + "properties": { + "buffer": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/SharedArrayBuffer" + } + ] + }, + "byteLength": { + "type": "number" + }, + "byteOffset": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "buffer", + "byteLength", + "byteOffset" + ] + }, + "SharedArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@species": { + "$ref": "#/definitions/SharedArrayBuffer" + }, + "__@toStringTag": { + "type": "string", + "enum": [ + "SharedArrayBuffer" + ] + } + }, + "additionalProperties": false, + "required": [ + "__@species", + "__@toStringTag", + "byteLength" + ] + }, + "Blob": { + "type": "object", + "properties": { + "size": { + "type": "number" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "size", + "type" + ] + }, + "FormData": { + "type": "object", + "additionalProperties": false + }, + "URLSearchParams": { + "type": "object", + "additionalProperties": false + }, + "ReadableStream": { + "type": "object", + "properties": { + "locked": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "locked" + ] + }, + "Headers": { + "type": "object", + "additionalProperties": false + }, + "Record": { + "type": "object", + "additionalProperties": false + }, + "AbortSignal": { + "type": "object", + "properties": { + "aborted": { + "type": "boolean" + }, + "onabort": { + "anyOf": [ + { + "type": "object", + "additionalProperties": false + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "aborted", + "onabort" + ] + }, + "RouteMatchCallback": {} + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} diff --git a/packages/workbox-build/src/schema/GetManifestOptions.json b/packages/workbox-build/src/schema/GetManifestOptions.json new file mode 100644 index 0000000..d813cb9 --- /dev/null +++ b/packages/workbox-build/src/schema/GetManifestOptions.json @@ -0,0 +1,758 @@ +{ + "additionalProperties": false, + "type": "object", + "properties": { + "additionalManifestEntries": { + "description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ManifestEntry" + }, + { + "type": "string" + } + ] + } + }, + "dontCacheBustURLsMatching": { + "description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.", + "$ref": "#/definitions/RegExp" + }, + "manifestTransforms": { + "description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.", + "type": "array", + "items": {} + }, + "maximumFileSizeToCacheInBytes": { + "description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.", + "default": 2097152, + "type": "number" + }, + "modifyURLPrefix": { + "description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "globFollow": { + "description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "globIgnores": { + "description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": [ + "**/node_modules/**/*" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globPatterns": { + "description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).", + "default": [ + "**/*.{js,css,html}" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globStrict": { + "description": "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "templatedURLs": { + "description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] + } + }, + "globDirectory": { + "description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.", + "type": "string" + } + }, + "required": [ + "globDirectory" + ], + "definitions": { + "ManifestEntry": { + "type": "object", + "properties": { + "integrity": { + "type": "string" + }, + "revision": { + "type": [ + "null", + "string" + ] + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "revision", + "url" + ] + }, + "RegExp": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "ignoreCase": { + "type": "boolean" + }, + "multiline": { + "type": "boolean" + }, + "lastIndex": { + "type": "number" + }, + "flags": { + "type": "string" + }, + "sticky": { + "type": "boolean" + }, + "unicode": { + "type": "boolean" + }, + "dotAll": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "dotAll", + "flags", + "global", + "ignoreCase", + "lastIndex", + "multiline", + "source", + "sticky", + "unicode" + ] + }, + "GoogleAnalyticsInitializeOptions": { + "type": "object", + "properties": { + "cacheName": { + "type": "string" + }, + "parameterOverrides": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "hitFilter": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "RuntimeCaching": { + "type": "object", + "properties": { + "handler": { + "description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.", + "anyOf": [ + { + "$ref": "#/definitions/RouteHandlerCallback" + }, + { + "$ref": "#/definitions/RouteHandlerObject" + }, + { + "enum": [ + "CacheFirst", + "CacheOnly", + "NetworkFirst", + "NetworkOnly", + "StaleWhileRevalidate" + ], + "type": "string" + } + ] + }, + "method": { + "description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.", + "default": "GET", + "enum": [ + "DELETE", + "GET", + "HEAD", + "PATCH", + "POST", + "PUT" + ], + "type": "string" + }, + "options": { + "type": "object", + "properties": { + "backgroundSync": { + "description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/QueueOptions" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "broadcastUpdate": { + "description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "channelName": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/BroadcastCacheUpdateOptions" + } + }, + "additionalProperties": false, + "required": [ + "options" + ] + }, + "cacheableResponse": { + "description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheableResponseOptions" + }, + "cacheName": { + "description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.", + "type": [ + "null", + "string" + ] + }, + "expiration": { + "description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/ExpirationPluginOptions" + }, + "networkTimeoutSeconds": { + "description": "If provided, this will set the `networkTimeoutSeconds` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.", + "type": "number" + }, + "plugins": { + "description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkboxPlugin" + } + }, + "precacheFallback": { + "description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "fallbackURL": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "fallbackURL" + ] + }, + "rangeRequests": { + "description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "boolean" + }, + "fetchOptions": { + "description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/RequestInit" + }, + "matchOptions": { + "description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheQueryOptions" + } + }, + "additionalProperties": false + }, + "urlPattern": { + "description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.", + "anyOf": [ + { + "$ref": "#/definitions/RegExp" + }, + { + "$ref": "#/definitions/RouteMatchCallback" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "handler", + "urlPattern" + ] + }, + "RouteHandlerCallback": {}, + "RouteHandlerObject": { + "description": "An object with a `handle` method of type `RouteHandlerCallback`.\n\nA `Route` object can be created with either an `RouteHandlerCallback`\nfunction or this `RouteHandler` object. The benefit of the `RouteHandler`\nis it can be extended (as is done by the `workbox-strategies` package).", + "type": "object", + "properties": { + "handle": { + "$ref": "#/definitions/RouteHandlerCallback" + } + }, + "additionalProperties": false, + "required": [ + "handle" + ] + }, + "QueueOptions": { + "type": "object", + "properties": { + "forceSyncFallback": { + "type": "boolean" + }, + "maxRetentionTime": { + "type": "number" + }, + "onSync": { + "$ref": "#/definitions/OnSyncCallback" + } + }, + "additionalProperties": false + }, + "OnSyncCallback": {}, + "BroadcastCacheUpdateOptions": { + "type": "object", + "properties": { + "headersToCheck": { + "type": "array", + "items": { + "type": "string" + } + }, + "generatePayload": { + "type": "object", + "additionalProperties": false + }, + "notifyAllClients": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheableResponseOptions": { + "type": "object", + "properties": { + "statuses": { + "type": "array", + "items": { + "type": "number" + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "ExpirationPluginOptions": { + "type": "object", + "properties": { + "maxEntries": { + "type": "number" + }, + "maxAgeSeconds": { + "type": "number" + }, + "matchOptions": { + "$ref": "#/definitions/CacheQueryOptions" + }, + "purgeOnQuotaError": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheQueryOptions": { + "type": "object", + "properties": { + "ignoreMethod": { + "type": "boolean" + }, + "ignoreSearch": { + "type": "boolean" + }, + "ignoreVary": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "WorkboxPlugin": { + "description": "An object with optional lifecycle callback properties for the fetch and\ncache operations.", + "type": "object", + "properties": { + "cacheDidUpdate": {}, + "cachedResponseWillBeUsed": {}, + "cacheKeyWillBeUsed": {}, + "cacheWillUpdate": {}, + "fetchDidFail": {}, + "fetchDidSucceed": {}, + "handlerDidComplete": {}, + "handlerDidError": {}, + "handlerDidRespond": {}, + "handlerWillRespond": {}, + "handlerWillStart": {}, + "requestWillFetch": {} + }, + "additionalProperties": false + }, + "CacheDidUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "CachedResponseWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheKeyWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheWillUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidFailCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidSucceedCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidCompleteCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidErrorCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillStartCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestWillFetchCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestInit": { + "type": "object", + "properties": { + "body": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/ArrayBufferView" + }, + { + "$ref": "#/definitions/Blob" + }, + { + "$ref": "#/definitions/FormData" + }, + { + "$ref": "#/definitions/URLSearchParams" + }, + { + "$ref": "#/definitions/ReadableStream" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "cache": { + "enum": [ + "default", + "force-cache", + "no-cache", + "no-store", + "only-if-cached", + "reload" + ], + "type": "string" + }, + "credentials": { + "enum": [ + "include", + "omit", + "same-origin" + ], + "type": "string" + }, + "headers": { + "anyOf": [ + { + "$ref": "#/definitions/Headers" + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "$ref": "#/definitions/Record" + } + ] + }, + "integrity": { + "type": "string" + }, + "keepalive": { + "type": "boolean" + }, + "method": { + "type": "string" + }, + "mode": { + "enum": [ + "cors", + "navigate", + "no-cors", + "same-origin" + ], + "type": "string" + }, + "redirect": { + "enum": [ + "error", + "follow", + "manual" + ], + "type": "string" + }, + "referrer": { + "type": "string" + }, + "referrerPolicy": { + "enum": [ + "", + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ], + "type": "string" + }, + "signal": { + "anyOf": [ + { + "$ref": "#/definitions/AbortSignal" + }, + { + "type": "null" + } + ] + }, + "window": {} + }, + "additionalProperties": false + }, + "ArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@toStringTag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "__@toStringTag", + "byteLength" + ] + }, + "ArrayBufferView": { + "type": "object", + "properties": { + "buffer": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/SharedArrayBuffer" + } + ] + }, + "byteLength": { + "type": "number" + }, + "byteOffset": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "buffer", + "byteLength", + "byteOffset" + ] + }, + "SharedArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@species": { + "$ref": "#/definitions/SharedArrayBuffer" + }, + "__@toStringTag": { + "type": "string", + "enum": [ + "SharedArrayBuffer" + ] + } + }, + "additionalProperties": false, + "required": [ + "__@species", + "__@toStringTag", + "byteLength" + ] + }, + "Blob": { + "type": "object", + "properties": { + "size": { + "type": "number" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "size", + "type" + ] + }, + "FormData": { + "type": "object", + "additionalProperties": false + }, + "URLSearchParams": { + "type": "object", + "additionalProperties": false + }, + "ReadableStream": { + "type": "object", + "properties": { + "locked": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "locked" + ] + }, + "Headers": { + "type": "object", + "additionalProperties": false + }, + "Record": { + "type": "object", + "additionalProperties": false + }, + "AbortSignal": { + "type": "object", + "properties": { + "aborted": { + "type": "boolean" + }, + "onabort": { + "anyOf": [ + { + "type": "object", + "additionalProperties": false + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "aborted", + "onabort" + ] + }, + "RouteMatchCallback": {} + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} diff --git a/packages/workbox-build/src/schema/InjectManifestOptions.json b/packages/workbox-build/src/schema/InjectManifestOptions.json new file mode 100644 index 0000000..313a6e9 --- /dev/null +++ b/packages/workbox-build/src/schema/InjectManifestOptions.json @@ -0,0 +1,773 @@ +{ + "additionalProperties": false, + "type": "object", + "properties": { + "additionalManifestEntries": { + "description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ManifestEntry" + }, + { + "type": "string" + } + ] + } + }, + "dontCacheBustURLsMatching": { + "description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.", + "$ref": "#/definitions/RegExp" + }, + "manifestTransforms": { + "description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.", + "type": "array", + "items": {} + }, + "maximumFileSizeToCacheInBytes": { + "description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.", + "default": 2097152, + "type": "number" + }, + "modifyURLPrefix": { + "description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "globFollow": { + "description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "globIgnores": { + "description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).", + "default": [ + "**/node_modules/**/*" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globPatterns": { + "description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).", + "default": [ + "**/*.{js,css,html}" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "globStrict": { + "description": "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).", + "default": true, + "type": "boolean" + }, + "templatedURLs": { + "description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] + } + }, + "injectionPoint": { + "description": "The string to find inside of the `swSrc` file. Once found, it will be\nreplaced by the generated precache manifest.", + "default": "self.__WB_MANIFEST", + "type": "string" + }, + "swSrc": { + "description": "The path and filename of the service worker file that will be read during\nthe build process, relative to the current working directory.", + "type": "string" + }, + "swDest": { + "description": "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.", + "type": "string" + }, + "globDirectory": { + "description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.", + "type": "string" + } + }, + "required": [ + "globDirectory", + "swDest", + "swSrc" + ], + "definitions": { + "ManifestEntry": { + "type": "object", + "properties": { + "integrity": { + "type": "string" + }, + "revision": { + "type": [ + "null", + "string" + ] + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "revision", + "url" + ] + }, + "RegExp": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "ignoreCase": { + "type": "boolean" + }, + "multiline": { + "type": "boolean" + }, + "lastIndex": { + "type": "number" + }, + "flags": { + "type": "string" + }, + "sticky": { + "type": "boolean" + }, + "unicode": { + "type": "boolean" + }, + "dotAll": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "dotAll", + "flags", + "global", + "ignoreCase", + "lastIndex", + "multiline", + "source", + "sticky", + "unicode" + ] + }, + "GoogleAnalyticsInitializeOptions": { + "type": "object", + "properties": { + "cacheName": { + "type": "string" + }, + "parameterOverrides": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "hitFilter": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "RuntimeCaching": { + "type": "object", + "properties": { + "handler": { + "description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.", + "anyOf": [ + { + "$ref": "#/definitions/RouteHandlerCallback" + }, + { + "$ref": "#/definitions/RouteHandlerObject" + }, + { + "enum": [ + "CacheFirst", + "CacheOnly", + "NetworkFirst", + "NetworkOnly", + "StaleWhileRevalidate" + ], + "type": "string" + } + ] + }, + "method": { + "description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.", + "default": "GET", + "enum": [ + "DELETE", + "GET", + "HEAD", + "PATCH", + "POST", + "PUT" + ], + "type": "string" + }, + "options": { + "type": "object", + "properties": { + "backgroundSync": { + "description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/QueueOptions" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "broadcastUpdate": { + "description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "channelName": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/BroadcastCacheUpdateOptions" + } + }, + "additionalProperties": false, + "required": [ + "options" + ] + }, + "cacheableResponse": { + "description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheableResponseOptions" + }, + "cacheName": { + "description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.", + "type": [ + "null", + "string" + ] + }, + "expiration": { + "description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/ExpirationPluginOptions" + }, + "networkTimeoutSeconds": { + "description": "If provided, this will set the `networkTimeoutSeconds` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.", + "type": "number" + }, + "plugins": { + "description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkboxPlugin" + } + }, + "precacheFallback": { + "description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "object", + "properties": { + "fallbackURL": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "fallbackURL" + ] + }, + "rangeRequests": { + "description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.", + "type": "boolean" + }, + "fetchOptions": { + "description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/RequestInit" + }, + "matchOptions": { + "description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.", + "$ref": "#/definitions/CacheQueryOptions" + } + }, + "additionalProperties": false + }, + "urlPattern": { + "description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.", + "anyOf": [ + { + "$ref": "#/definitions/RegExp" + }, + { + "$ref": "#/definitions/RouteMatchCallback" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "handler", + "urlPattern" + ] + }, + "RouteHandlerCallback": {}, + "RouteHandlerObject": { + "description": "An object with a `handle` method of type `RouteHandlerCallback`.\n\nA `Route` object can be created with either an `RouteHandlerCallback`\nfunction or this `RouteHandler` object. The benefit of the `RouteHandler`\nis it can be extended (as is done by the `workbox-strategies` package).", + "type": "object", + "properties": { + "handle": { + "$ref": "#/definitions/RouteHandlerCallback" + } + }, + "additionalProperties": false, + "required": [ + "handle" + ] + }, + "QueueOptions": { + "type": "object", + "properties": { + "forceSyncFallback": { + "type": "boolean" + }, + "maxRetentionTime": { + "type": "number" + }, + "onSync": { + "$ref": "#/definitions/OnSyncCallback" + } + }, + "additionalProperties": false + }, + "OnSyncCallback": {}, + "BroadcastCacheUpdateOptions": { + "type": "object", + "properties": { + "headersToCheck": { + "type": "array", + "items": { + "type": "string" + } + }, + "generatePayload": { + "type": "object", + "additionalProperties": false + }, + "notifyAllClients": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheableResponseOptions": { + "type": "object", + "properties": { + "statuses": { + "type": "array", + "items": { + "type": "number" + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "ExpirationPluginOptions": { + "type": "object", + "properties": { + "maxEntries": { + "type": "number" + }, + "maxAgeSeconds": { + "type": "number" + }, + "matchOptions": { + "$ref": "#/definitions/CacheQueryOptions" + }, + "purgeOnQuotaError": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CacheQueryOptions": { + "type": "object", + "properties": { + "ignoreMethod": { + "type": "boolean" + }, + "ignoreSearch": { + "type": "boolean" + }, + "ignoreVary": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "WorkboxPlugin": { + "description": "An object with optional lifecycle callback properties for the fetch and\ncache operations.", + "type": "object", + "properties": { + "cacheDidUpdate": {}, + "cachedResponseWillBeUsed": {}, + "cacheKeyWillBeUsed": {}, + "cacheWillUpdate": {}, + "fetchDidFail": {}, + "fetchDidSucceed": {}, + "handlerDidComplete": {}, + "handlerDidError": {}, + "handlerDidRespond": {}, + "handlerWillRespond": {}, + "handlerWillStart": {}, + "requestWillFetch": {} + }, + "additionalProperties": false + }, + "CacheDidUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "CachedResponseWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheKeyWillBeUsedCallback": { + "type": "object", + "additionalProperties": false + }, + "CacheWillUpdateCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidFailCallback": { + "type": "object", + "additionalProperties": false + }, + "FetchDidSucceedCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidCompleteCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidErrorCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerDidRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillRespondCallback": { + "type": "object", + "additionalProperties": false + }, + "HandlerWillStartCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestWillFetchCallback": { + "type": "object", + "additionalProperties": false + }, + "RequestInit": { + "type": "object", + "properties": { + "body": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/ArrayBufferView" + }, + { + "$ref": "#/definitions/Blob" + }, + { + "$ref": "#/definitions/FormData" + }, + { + "$ref": "#/definitions/URLSearchParams" + }, + { + "$ref": "#/definitions/ReadableStream" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "cache": { + "enum": [ + "default", + "force-cache", + "no-cache", + "no-store", + "only-if-cached", + "reload" + ], + "type": "string" + }, + "credentials": { + "enum": [ + "include", + "omit", + "same-origin" + ], + "type": "string" + }, + "headers": { + "anyOf": [ + { + "$ref": "#/definitions/Headers" + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "$ref": "#/definitions/Record" + } + ] + }, + "integrity": { + "type": "string" + }, + "keepalive": { + "type": "boolean" + }, + "method": { + "type": "string" + }, + "mode": { + "enum": [ + "cors", + "navigate", + "no-cors", + "same-origin" + ], + "type": "string" + }, + "redirect": { + "enum": [ + "error", + "follow", + "manual" + ], + "type": "string" + }, + "referrer": { + "type": "string" + }, + "referrerPolicy": { + "enum": [ + "", + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ], + "type": "string" + }, + "signal": { + "anyOf": [ + { + "$ref": "#/definitions/AbortSignal" + }, + { + "type": "null" + } + ] + }, + "window": {} + }, + "additionalProperties": false + }, + "ArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@toStringTag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "__@toStringTag", + "byteLength" + ] + }, + "ArrayBufferView": { + "type": "object", + "properties": { + "buffer": { + "anyOf": [ + { + "$ref": "#/definitions/ArrayBuffer" + }, + { + "$ref": "#/definitions/SharedArrayBuffer" + } + ] + }, + "byteLength": { + "type": "number" + }, + "byteOffset": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "buffer", + "byteLength", + "byteOffset" + ] + }, + "SharedArrayBuffer": { + "type": "object", + "properties": { + "byteLength": { + "type": "number" + }, + "__@species": { + "$ref": "#/definitions/SharedArrayBuffer" + }, + "__@toStringTag": { + "type": "string", + "enum": [ + "SharedArrayBuffer" + ] + } + }, + "additionalProperties": false, + "required": [ + "__@species", + "__@toStringTag", + "byteLength" + ] + }, + "Blob": { + "type": "object", + "properties": { + "size": { + "type": "number" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "size", + "type" + ] + }, + "FormData": { + "type": "object", + "additionalProperties": false + }, + "URLSearchParams": { + "type": "object", + "additionalProperties": false + }, + "ReadableStream": { + "type": "object", + "properties": { + "locked": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "locked" + ] + }, + "Headers": { + "type": "object", + "additionalProperties": false + }, + "Record": { + "type": "object", + "additionalProperties": false + }, + "AbortSignal": { + "type": "object", + "properties": { + "aborted": { + "type": "boolean" + }, + "onabort": { + "anyOf": [ + { + "type": "object", + "additionalProperties": false + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "aborted", + "onabort" + ] + }, + "RouteMatchCallback": {} + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} diff --git a/packages/workbox-build/src/types.ts b/packages/workbox-build/src/types.ts new file mode 100644 index 0000000..5a2cfe8 --- /dev/null +++ b/packages/workbox-build/src/types.ts @@ -0,0 +1,499 @@ +import type { BroadcastCacheUpdateOptions } from '@vite-pwa/workbox-swkit/broadcast-update/types' +import type { CacheableResponseOptions } from '@vite-pwa/workbox-swkit/cacheable-response/types' +import type { RouteHandler, RouteMatchCallback, WorkboxPlugin } from '@vite-pwa/workbox-swkit/core/types' +import type { ExpirationPluginOptions } from '@vite-pwa/workbox-swkit/expiration/types' +import type { HTTPMethod } from '@vite-pwa/workbox-swkit/routing/types' +import type { QueueOptions } from '@vite-pwa/workbox-swkit/types' +import type { PackageJson } from 'pkg-types' + +export interface ManifestEntry { + integrity?: string + revision: string | null + url: string +} + +export type StrategyName + = | 'CacheFirst' + | 'CacheOnly' + | 'NetworkFirst' + | 'NetworkOnly' + | 'StaleWhileRevalidate' + +export interface RuntimeCaching { + /** + * This determines how the runtime route will generate a response. + * To use one of the built-in {@link workbox-strategies}, provide its name, + * like `'NetworkFirst'`. + * Alternatively, this can be a {@link workbox-core.RouteHandler} callback + * function with custom response logic. + */ + handler: RouteHandler | StrategyName + /** + * The HTTP method to match against. The default value of `'GET'` is normally + * sufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or + * another type of request. + * @default "GET" + */ + method?: HTTPMethod + options?: { + /** + * Configuring this will add a + * {@link workbox-background-sync.BackgroundSyncPlugin} instance to the + * {@link workbox-strategies} configured in `handler`. + */ + backgroundSync?: { + name: string + options?: QueueOptions + } + /** + * Configuring this will add a + * {@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the + * {@link workbox-strategies} configured in `handler`. + */ + broadcastUpdate?: { + // TODO: This option is ignored since we switched to using postMessage(). + // Remove it in the next major release. + channelName?: string + options: BroadcastCacheUpdateOptions + } + /** + * Configuring this will add a + * {@link workbox-cacheable-response.CacheableResponsePlugin} instance to + * the {@link workbox-strategies} configured in `handler`. + */ + cacheableResponse?: CacheableResponseOptions + /** + * If provided, this will set the `cacheName` property of the + * {@link workbox-strategies} configured in `handler`. + */ + cacheName?: string | null + /** + * Configuring this will add a + * {@link workbox-expiration.ExpirationPlugin} instance to + * the {@link workbox-strategies} configured in `handler`. + */ + expiration?: ExpirationPluginOptions + /** + * If provided, this will set the `networkTimeoutSeconds` property of the + * {@link workbox-strategies} configured in `handler`. Note that only + * `'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`. + */ + networkTimeoutSeconds?: number + /** + * Configuring this allows the use of one or more Workbox plugins that + * don't have "shortcut" options (like `expiration` for + * {@link workbox-expiration.ExpirationPlugin}). The plugins provided here + * will be added to the {@link workbox-strategies} configured in `handler`. + */ + plugins?: Array + /** + * Configuring this will add a + * {@link workbox-precaching.PrecacheFallbackPlugin} instance to + * the {@link workbox-strategies} configured in `handler`. + */ + precacheFallback?: { + fallbackURL: string + } + /** + * Enabling this will add a + * {@link workbox-range-requests.RangeRequestsPlugin} instance to + * the {@link workbox-strategies} configured in `handler`. + */ + rangeRequests?: boolean + /** + * Configuring this will pass along the `fetchOptions` value to + * the {@link workbox-strategies} configured in `handler`. + */ + fetchOptions?: RequestInit + /** + * Configuring this will pass along the `matchOptions` value to + * the {@link workbox-strategies} configured in `handler`. + */ + matchOptions?: CacheQueryOptions + } + /** + * This match criteria determines whether the configured handler will + * generate a response for any requests that don't match one of the precached + * URLs. If multiple `RuntimeCaching` routes are defined, then the first one + * whose `urlPattern` matches will be the one that responds. + * + * This value directly maps to the first parameter passed to + * {@link workbox-routing.registerRoute}. It's recommended to use a + * {@link workbox-core.RouteMatchCallback} function for greatest flexibility. + */ + urlPattern: RegExp | string | RouteMatchCallback +} + +export interface ManifestTransformResult { + manifest: Array + warnings?: Array +} + +export type ManifestTransform = ( + manifestEntries: Array, + compilation?: unknown, +) => Promise | ManifestTransformResult + +export interface BasePartial { + /** + * A list of entries to be precached, in addition to any entries that are + * generated as part of the build configuration. + */ + additionalManifestEntries?: Array + /** + * Assets that match this will be assumed to be uniquely versioned via their + * URL, and exempted from the normal HTTP cache-busting that's done when + * populating the precache. While not required, it's recommended that if your + * existing build process already inserts a `[hash]` value into each filename, + * you provide a RegExp that will detect that, as it will reduce the bandwidth + * consumed when precaching. + */ + dontCacheBustURLsMatching?: RegExp + /** + * One or more functions which will be applied sequentially against the + * generated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are + * also specified, their corresponding transformations will be applied first. + */ + manifestTransforms?: Array + /** + * This value can be used to determine the maximum size of files that will be + * precached. This prevents you from inadvertently precaching very large files + * that might have accidentally matched one of your patterns. + * @default 2097152 + */ + maximumFileSizeToCacheInBytes?: number + /** + * An object mapping string prefixes to replacement string values. This can be + * used to, e.g., remove or add a path prefix from a manifest entry if your + * web hosting setup doesn't match your local filesystem setup. As an + * alternative with more flexibility, you can use the `manifestTransforms` + * option and provide a function that modifies the entries in the manifest + * using whatever logic you provide. + * + * Example usage: + * + * ``` + * // Replace a '/dist/' prefix with '/', and also prepend + * // '/static' to every URL. + * modifyURLPrefix: { + * '/dist/': '/', + * '': '/static', + * } + * ``` + */ + modifyURLPrefix?: { + [key: string]: string + } +} + +export interface GeneratePartial { + /** + * The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass + * to `babel-preset-env` when transpiling the service worker bundle. + * @default ["chrome >= 56"] + */ + babelPresetEnvTargets?: Array + /** + * An optional ID to be prepended to cache names. This is primarily useful for + * local development where multiple sites may be served from the same + * `http://localhost:port` origin. + */ + cacheId?: string | null + /** + * Whether or not Workbox should attempt to identify and delete any precaches + * created by older, incompatible versions. + * @default false + */ + cleanupOutdatedCaches?: boolean + /** + * Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim) + * any existing clients as soon as it activates. + * @default false + */ + clientsClaim?: boolean + /** + * If a navigation request for a URL ending in `/` fails to match a precached + * URL, this value will be appended to the URL and that will be checked for a + * precache match. This should be set to what your web server is using for its + * directory index. + */ + directoryIndex?: string | null + /** + * @default false + */ + disableDevLogs?: boolean + // We can't use the @default annotation here to assign the value via AJV, as + // an Array can't be serialized into JSON. + /** + * Any search parameter names that match against one of the RegExp in this + * array will be removed before looking for a precache match. This is useful + * if your users might request URLs that contain, for example, URL parameters + * used to track the source of the traffic. If not provided, the default value + * is `[/^utm_/, /^fbclid$/]`. + * + */ + ignoreURLParametersMatching?: Array + /** + * A list of JavaScript files that should be passed to + * [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts) + * inside the generated service worker file. This is useful when you want to + * let Workbox create your top-level service worker file, but want to include + * some additional code, such as a push event listener. + */ + importScripts?: Array + /** + * Whether the runtime code for the Workbox library should be included in the + * top-level service worker, or split into a separate file that needs to be + * deployed alongside the service worker. Keeping the runtime separate means + * that users will not have to re-download the Workbox code each time your + * top-level service worker changes. + * @default false + */ + inlineWorkboxRuntime?: boolean + /** + * If set to 'production', then an optimized service worker bundle that + * excludes debugging info will be produced. If not explicitly configured + * here, the `process.env.NODE_ENV` value will be used, and failing that, it + * will fall back to `'production'`. + * @default "production" + */ + mode?: string | null + /** + * If specified, all + * [navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests) + * for URLs that aren't precached will be fulfilled with the HTML at the URL + * provided. You must pass in the URL of an HTML document that is listed in + * your precache manifest. This is meant to be used in a Single Page App + * scenario, in which you want all navigations to use common + * [App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell). + * @default null + */ + navigateFallback?: string | null + /** + * An optional array of regular expressions that restricts which URLs the + * configured `navigateFallback` behavior applies to. This is useful if only a + * subset of your site's URLs should be treated as being part of a + * [Single Page App](https://en.wikipedia.org/wiki/Single-page_application). + * If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are + * configured, the denylist takes precedent. + * + * Note*: These RegExps may be evaluated against every destination URL during + * a navigation. Avoid using + * [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077), + * or else your users may see delays when navigating your site. + */ + navigateFallbackAllowlist?: Array + /** + * An optional array of regular expressions that restricts which URLs the + * configured `navigateFallback` behavior applies to. This is useful if only a + * subset of your site's URLs should be treated as being part of a + * [Single Page App](https://en.wikipedia.org/wiki/Single-page_application). + * If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are + * configured, the denylist takes precedence. + * + * Note*: These RegExps may be evaluated against every destination URL during + * a navigation. Avoid using + * [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077), + * or else your users may see delays when navigating your site. + */ + navigateFallbackDenylist?: Array + /** + * Whether or not to enable + * [navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload) + * in the generated service worker. When set to true, you must also use + * `runtimeCaching` to set up an appropriate response strategy that will match + * navigation requests, and make use of the preloaded response. + * @default false + */ + navigationPreload?: boolean + /** + * Controls whether or not to include support for + * [offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics). + * When `true`, the call to `workbox-google-analytics`'s `initialize()` will + * be added to your generated service worker. When set to an `Object`, that + * object will be passed in to the `initialize()` call, allowing you to + * customize the behavior. + * @default false + */ + // offlineGoogleAnalytics?: boolean | GoogleAnalyticsInitializeOptions + /** + * When using Workbox's build tools to generate your service worker, you can + * specify one or more runtime caching configurations. These are then + * translated to {@link workbox-routing.registerRoute} calls using the match + * and handler configuration you define. + * + * For all of the options, see the {@link workbox-build.RuntimeCaching} + * documentation. The example below shows a typical configuration, with two + * runtime routes defined: + * + * @example + * runtimeCaching: [{ + * urlPattern: ({url}) => url.origin === 'https://api.example.com', + * handler: 'NetworkFirst', + * options: { + * cacheName: 'api-cache', + * }, + * }, { + * urlPattern: ({request}) => request.destination === 'image', + * handler: 'StaleWhileRevalidate', + * options: { + * cacheName: 'images-cache', + * expiration: { + * maxEntries: 10, + * }, + * }, + * }] + */ + runtimeCaching?: Array + /** + * Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase) + * to the generated service worker. If `false`, then a `message` listener will + * be added instead, allowing client pages to trigger `skipWaiting()` by + * calling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker. + * @default false + */ + skipWaiting?: boolean + /** + * Whether to create a sourcemap for the generated service worker files. + * @default true + */ + sourcemap?: boolean +} + +// This needs to be set when using GetManifest or InjectManifest, but is +// optional when using GenerateSW if runtimeCaching is also used. This is +// enforced via runtime validation, and needs to be documented. +export interface RequiredGlobDirectoryPartial { + /** + * The local directory you wish to match `globPatterns` against. The path is + * relative to the current directory. + */ + globDirectory: string +} + +export interface OptionalGlobDirectoryPartial { + /** + * The local directory you wish to match `globPatterns` against. The path is + * relative to the current directory. + */ + globDirectory?: string +} + +export interface GlobPartial { + /** + * Determines whether or not symlinks are followed when generating the + * precache manifest. For more information, see the definition of `follow` in + * the `glob` [documentation](https://github.com/isaacs/node-glob#options). + * @default true + */ + globFollow?: boolean + /** + * A set of patterns matching files to always exclude when generating the + * precache manifest. For more information, see the definition of `ignore` in + * the `glob` [documentation](https://github.com/isaacs/node-glob#options). + * @default ["**\/node_modules\/**\/*"] + */ + globIgnores?: Array + /** + * Files matching any of these patterns will be included in the precache + * manifest. For more information, see the + * [`glob` primer](https://github.com/isaacs/node-glob#glob-primer). + * @default ["**\/*.{js,css,html}"] + */ + globPatterns?: Array + /** + * If true, an error reading a directory when generating a precache manifest + * will cause the build to fail. If false, the problematic directory will be + * skipped. For more information, see the definition of `strict` in the `glob` + * [documentation](https://github.com/isaacs/node-glob#options). + * @default true + */ + globStrict?: boolean + /** + * If a URL is rendered based on some server-side logic, its contents may + * depend on multiple files or on some other unique string value. The keys in + * this object are server-rendered URLs. If the values are an array of + * strings, they will be interpreted as `glob` patterns, and the contents of + * any files matching the patterns will be used to uniquely version the URL. + * If used with a single string, it will be interpreted as unique versioning + * information that you've generated for a given URL. + */ + templatedURLs?: { + [key: string]: string | Array + } +} + +export interface InjectPartial { + /** + * The string to find inside of the `swSrc` file. Once found, it will be + * replaced by the generated precache manifest. + * @default "self.__WB_MANIFEST" + */ + injectionPoint?: string + /** + * The path and filename of the service worker file that will be read during + * the build process, relative to the current working directory. + */ + swSrc: string +} + +export interface RequiredSWDestPartial { + /** + * The path and filename of the service worker file that will be created by + * the build process, relative to the current working directory. It must end + * in '.js'. + */ + swDest: string +} + +export type GenerateSWOptions = BasePartial + & GlobPartial + & GeneratePartial + & RequiredSWDestPartial + & OptionalGlobDirectoryPartial + +export type GetManifestOptions = BasePartial + & GlobPartial + & RequiredGlobDirectoryPartial + +export type InjectManifestOptions = BasePartial + & GlobPartial + & InjectPartial + & RequiredSWDestPartial + & RequiredGlobDirectoryPartial + +export interface GetManifestResult { + count: number + manifestEntries: Array + size: number + warnings: Array +} + +export type BuildResult = Omit & { + filePaths: Array +} + +/** + * @private + */ +export interface FileDetails { + file: string + hash: string + size: number +} + +/** + * @private + */ +export type BuildType = 'dev' | 'prod' + +/** + * @private + */ +export interface WorkboxPackageJSON extends PackageJson { + workbox?: { + browserNamespace?: string + packageType?: string + prodOnly?: boolean + } +} diff --git a/packages/workbox-build/src/validation/async-generate-sw.ts b/packages/workbox-build/src/validation/async-generate-sw.ts new file mode 100644 index 0000000..2e3610a --- /dev/null +++ b/packages/workbox-build/src/validation/async-generate-sw.ts @@ -0,0 +1,124 @@ +import * as v from 'valibot' +import { AsyncManifestOptionsSchema, AsyncRuntimeCachingEntrySchema } from './utils' + +export type AsyncGenerateSWOptionsSchemaType = v.InferInput + +export const AsyncGenerateSWOptionsSchema = v.pipeAsync( + v.strictObjectAsync({ + ...AsyncManifestOptionsSchema.entries, + /** + * The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass to `babel-preset-env` when transpiling the service worker bundle. + */ + babelPresetEnvTargets: v.optionalAsync(v.arrayAsync(v.string()), ['chrome >= 56']), + /** + * An optional ID to be prepended to cache names. This is primarily useful for local development where multiple sites may be served from the same `http://localhost:port` origin. + */ + cacheId: v.optionalAsync(v.nullable(v.string())), + /** + * Whether or not Workbox should attempt to identify and delete any precaches created by older, incompatible versions. + */ + cleanupOutdatedCaches: v.optionalAsync(v.boolean(), false), + /** + * Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim) any existing clients as soon as it activates. + */ + clientsClaim: v.optionalAsync(v.boolean(), false), + /** + * If a navigation request for a URL ending in `/` fails to match a precached URL, this value will be appended to the URL and that will be checked for a precache match. This should be set to what your web server is using for its directory index. + */ + directoryIndex: v.optionalAsync(v.nullable(v.string())), + /** + * Whether to disable logging of warnings and errors. + */ + disableDevLogs: v.optionalAsync(v.boolean(), false), + /** + * Any search parameter names that match against one of the RegExp in this array will be removed before looking for a precache match. This is useful if your users might request URLs that contain, for example, URL parameters used to track the source of the traffic. If not provided, the default value is `[/^utm_/, /^fbclid$/]`. + */ + ignoreURLParametersMatching: v.optionalAsync(v.arrayAsync(v.instance(RegExp))), + /** + * A list of JavaScript files that should be passed to [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts) inside the generated service worker file. This is useful when you want to let Workbox create your top-level service worker file, but want to include some additional code, such as a push event listener. + */ + importScripts: v.optionalAsync(v.arrayAsync(v.string())), + /** + * Whether the runtime code for the Workbox library should be included in the top-level service worker, or split into a separate file that needs to be deployed alongside the service worker. Keeping the runtime separate means that users will not have to re-download the Workbox code each time your top-level service worker changes. + */ + inlineWorkboxRuntime: v.optionalAsync(v.boolean(), false), + /** + * If set to 'production', then an optimized service worker bundle that excludes debugging info will be produced. If not explicitly configured here, the `process.env.NODE_ENV` value will be used, and failing that, it will fall back to `'production'`. + */ + mode: v.optionalAsync(v.nullable(v.string()), 'production'), + /** + * If specified, all [navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests) for URLs that aren't precached will be fulfilled with the HTML at the URL provided. You must pass in the URL of an HTML document that is listed in your precache manifest. This is meant to be used in a Single Page App scenario, in which you want all navigations to use common [App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell). + */ + navigateFallback: v.optionalAsync(v.nullable(v.string()), null), + /** + * An optional array of regular expressions that restricts which URLs the configured `navigateFallback` behavior applies to. This is useful if only a subset of your site's URLs should be treated as being part of a [Single Page App](https://en.wikipedia.org/wiki/Single-page_application). If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are configured, the denylist takes precedent. + */ + navigateFallbackAllowlist: v.optionalAsync(v.arrayAsync(v.instance(RegExp))), + /** + * An optional array of regular expressions that restricts which URLs the configured `navigateFallback` behavior applies to. This is useful if only a subset of your site's URLs should be treated as being part of a [Single Page App](https://en.wikipedia.org/wiki/Single-page_application). If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are configured, the denylist takes precedent. + */ + navigateFallbackDenylist: v.optionalAsync(v.arrayAsync(v.instance(RegExp))), + /** + * Whether or not to enable [navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload) in the generated service worker. When set to true, you must also use `runtimeCaching` to set up an appropriate response strategy that will match navigation requests, and make use of the preloaded response. + */ + navigationPreload: v.optionalAsync(v.boolean(), false), + /** + * When using Workbox's build tools to generate your service worker, you can specify one or more runtime caching configurations. These are then translated to {@link workbox-routing.registerRoute} calls using the match and handler configuration you define. + */ + runtimeCaching: v.optionalAsync(v.arrayAsync(AsyncRuntimeCachingEntrySchema)), + /** + * Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase) to the generated service worker. If `false`, then a `message` listener will be added instead, allowing client pages to trigger `skipWaiting()` by calling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker. + */ + skipWaiting: v.optionalAsync(v.boolean(), false), + /** + * Whether to create a sourcemap for the generated service worker files. + */ + sourcemap: v.optionalAsync(v.boolean(), true), + /** + * The path and filename of the service worker file that will be created by the build process, relative to the current working directory. It must end in '.js'. + */ + swDest: v.pipeAsync( + v.string(), + v.endsWith('.js', 'invalid-sw-dest-js-ext'), + ), + /** + * The local directory you wish to match `globPatterns` against. The path is + * relative to the current directory. + */ + globDirectory: v.optionalAsync(v.string()), + }), + v.forwardAsync( + v.checkAsync( + async input => !!input.runtimeCaching || (typeof input.globDirectory === 'string'), + 'no-manifest-entries-or-runtime-caching', + ), + ['globDirectory'], + ), + v.forwardAsync( + v.checkAsync( + async input => !input.navigationPreload || (Array.isArray(input.runtimeCaching) && input.runtimeCaching.length > 0), + 'nav-preload-runtime-caching', + ), + ['navigationPreload'], + ), + // This is the cross-field validation for cacheName when expiration is present. + v.forwardAsync( + v.checkAsync( + async (options) => { + const runtimeCaching = options.runtimeCaching + if (!runtimeCaching) { + return true + } + for (const runtime of runtimeCaching) { + if (runtime.options?.expiration && !runtime.options?.cacheName) { + return false + } + } + + return true + }, + 'cache-name-required', + ), + ['runtimeCaching'], + ), +) diff --git a/packages/workbox-build/src/validation/async-get-manifest.ts b/packages/workbox-build/src/validation/async-get-manifest.ts new file mode 100644 index 0000000..87fa26b --- /dev/null +++ b/packages/workbox-build/src/validation/async-get-manifest.ts @@ -0,0 +1,15 @@ +import * as v from 'valibot' +import { AsyncManifestOptionsSchema } from './utils' + +export type AsyncGetManifestOptionsSchemaType = v.InferInput + +export const AsyncGetManifestOptionsSchema = v.pipeAsync( + v.strictObjectAsync({ + ...AsyncManifestOptionsSchema.entries, + /** + * The local directory you wish to match `globPatterns` against. The path is + * relative to the current directory. + */ + globDirectory: v.string(), + }), +) diff --git a/packages/workbox-build/src/validation/async-inject-manifest.ts b/packages/workbox-build/src/validation/async-inject-manifest.ts new file mode 100644 index 0000000..2f2c109 --- /dev/null +++ b/packages/workbox-build/src/validation/async-inject-manifest.ts @@ -0,0 +1,37 @@ +import * as v from 'valibot' +import { AsyncManifestOptionsSchema } from './utils' + +export type AsyncInjectManifestOptionsSchemaType = v.InferInput + +export const AsyncInjectManifestOptionsSchema = v.pipeAsync( + v.strictObjectAsync({ + ...AsyncManifestOptionsSchema.entries, + /** + * The string to find inside of the `swSrc` file. Once found, it will be + * replaced by the generated precache manifest. + * @default "self.__WB_MANIFEST" + */ + injectionPoint: v.optionalAsync(v.string(), 'self.__WB_MANIFEST'), + /** + * The path and filename of the service worker file that will be read during + * the build process, relative to the current working directory. + */ + swSrc: v.string(), + + /** + * The path and filename of the service worker file that will be created by + * the build process, relative to the current working directory. It must end + * in '.js'. + */ + swDest: v.pipeAsync( + v.string(), + v.endsWith('.js', 'invalid-sw-dest-js-ext'), + ), + + /** + * The local directory you wish to match `globPatterns` against. The path is + * relative to the current directory. + */ + globDirectory: v.string(), + }), +) diff --git a/packages/workbox-build/src/validation/errors.ts b/packages/workbox-build/src/validation/errors.ts new file mode 100644 index 0000000..ef0b626 --- /dev/null +++ b/packages/workbox-build/src/validation/errors.ts @@ -0,0 +1,126 @@ +/* + Copyright 2018 Google LLC + + Use of this source code is governed by an MIT-style + license that can be found in the LICENSE file or at + https://opensource.org/licenses/MIT. +*/ + +import { oneLine as ol } from 'proper-tags' + +export const errors = { + 'unable-to-get-rootdir': `Unable to get the root directory of your web app.`, + 'no-extension': ol`Unable to detect a usable extension for a file in your web + app directory.`, + 'invalid-file-manifest-name': ol`The File Manifest Name must have at least one + character.`, + 'unable-to-get-file-manifest-name': 'Unable to get a file manifest name.', + 'missing-sw-dest': `The 'swDest' option is required.`, + 'invalid-sw-dest': `The 'swDest' value must be a valid path.`, + 'invalid-sw-dest-js-ext': `The 'swDest' must end with .js.`, + 'unable-to-get-sw-name': 'Unable to get a service worker file name.', + 'unable-to-get-save-config': ol`An error occurred when asking to save details + in a config file.`, + 'unable-to-get-file-hash': ol`An error occurred when attempting to create a + file hash.`, + 'unable-to-get-file-size': ol`An error occurred when attempting to get a file + size.`, + 'unable-to-glob-files': 'An error occurred when globbing for files.', + 'unable-to-make-manifest-directory': ol`Unable to make output directory for + file manifest.`, + 'read-manifest-template-failure': 'Unable to read template for file manifest', + 'populating-manifest-tmpl-failed': ol`An error occurred when populating the + file manifest template.`, + 'manifest-file-write-failure': 'Unable to write the file manifest.', + 'unable-to-make-sw-directory': ol`Unable to make the directories to output + the service worker path.`, + 'read-sw-template-failure': ol`Unable to read the service worker template + file.`, + 'sw-write-failure': 'Unable to write the service worker file.', + 'sw-write-failure-directory': ol`Unable to write the service worker file; + 'swDest' should be a full path to the file, not a path to a directory.`, + 'unable-to-copy-workbox-libraries': ol`One or more of the Workbox libraries + could not be copied over to the destination directory: `, + 'invalid-generate-sw-input': ol`The input to generateSW() must be an object.`, + 'invalid-glob-directory': ol`The supplied globDirectory must be a path as a + string.`, + 'invalid-dont-cache-bust': ol`The supplied 'dontCacheBustURLsMatching' + parameter must be a RegExp.`, + 'invalid-exclude-files': 'The excluded files should be an array of strings.', + 'invalid-get-manifest-entries-input': ol`The input to + 'getFileManifestEntries()' must be an object.`, + 'invalid-manifest-path': ol`The supplied manifest path is not a string with + at least one character.`, + 'invalid-manifest-entries': ol`The manifest entries must be an array of + strings or JavaScript objects containing a url parameter.`, + 'invalid-manifest-format': ol`The value of the 'format' option passed to + generateFileManifest() must be either 'iife' (the default) or 'es'.`, + 'invalid-static-file-globs': ol`The 'globPatterns' value must be an array + of strings.`, + 'invalid-templated-urls': ol`The 'templatedURLs' value should be an object + that maps URLs to either a string, or to an array of glob patterns.`, + 'templated-url-matches-glob': ol`One of the 'templatedURLs' URLs is already + being tracked via 'globPatterns': `, + 'invalid-glob-ignores': ol`The 'globIgnores' parameter must be an array of + glob pattern strings.`, + 'manifest-entry-bad-url': ol`The generated manifest contains an entry without + a URL string. This is likely an error with workbox-build.`, + 'modify-url-prefix-bad-prefixes': ol`The 'modifyURLPrefix' parameter must be + an object with string key value pairs.`, + 'invalid-inject-manifest-arg': ol`The input to 'injectManifest()' must be an + object.`, + 'injection-point-not-found': ol`Unable to find a place to inject the manifest. + Please ensure that your service worker file contains the following: `, + 'multiple-injection-points': ol`Please ensure that your 'swSrc' file contains + only one match for the following: `, + 'populating-sw-tmpl-failed': ol`Unable to generate service worker from + template.`, + 'useless-glob-pattern': ol`One of the glob patterns doesn't match any files. + Please remove or fix the following: `, + 'bad-template-urls-asset': ol`There was an issue using one of the provided + 'templatedURLs'.`, + 'invalid-runtime-caching': ol`The 'runtimeCaching' parameter must an an + array of objects with at least a 'urlPattern' and 'handler'.`, + 'static-file-globs-deprecated': ol`'staticFileGlobs' is deprecated. + Please use 'globPatterns' instead.`, + 'dynamic-url-deprecated': ol`'dynamicURLToDependencies' is deprecated. + Please use 'templatedURLs' instead.`, + 'urlPattern-is-required': ol`The 'urlPattern' option is required when using + 'runtimeCaching'.`, + 'handler-is-required': ol`The 'handler' option is required when using + runtimeCaching.`, + 'invalid-generate-file-manifest-arg': ol`The input to generateFileManifest() + must be an Object.`, + 'invalid-sw-src': `The 'swSrc' file can't be read.`, + 'same-src-and-dest': ol`Unable to find a place to inject the manifest. This is + likely because swSrc and swDest are configured to the same file. + Please ensure that your swSrc file contains the following:`, + 'only-regexp-routes-supported': ol`Please use a regular expression object as + the urlPattern parameter. (Express-style routes are not currently + supported.)`, + 'bad-runtime-caching-config': ol`An unknown configuration option was used + with runtimeCaching: `, + 'invalid-network-timeout-seconds': ol`When using networkTimeoutSeconds, you + must set the handler to 'NetworkFirst'.`, + 'no-module-name': ol`You must provide a moduleName parameter when calling + getModuleURL().`, + 'bad-manifest-transforms-return-value': ol`The return value from a + manifestTransform should be an object with 'manifest' and optionally + 'warnings' properties.`, + 'string-entry-warning': ol`Some items were passed to additionalManifestEntries + without revisioning info. This is generally NOT safe. Learn more at + https://bit.ly/wb-precache.`, + 'no-manifest-entries-or-runtime-caching': ol`Couldn't find configuration for + either precaching or runtime caching. Please ensure that the various glob + options are set to match one or more files, and/or configure the + runtimeCaching option.`, + 'cant-find-sourcemap': ol`The swSrc file refers to a sourcemap that can't be + opened:`, + 'nav-preload-runtime-caching': ol`When using navigationPreload, you must also + configure a runtimeCaching route that will use the preloaded response.`, + 'cache-name-required': ol`When using cache expiration, you must also + configure a custom cacheName.`, + 'manifest-transforms': ol`When using manifestTransforms, you must provide + an array of functions.`, + 'invalid-handler-string': ol`The handler name provided is not valid: `, +} diff --git a/packages/workbox-build/src/validation/utils.ts b/packages/workbox-build/src/validation/utils.ts new file mode 100644 index 0000000..704187a --- /dev/null +++ b/packages/workbox-build/src/validation/utils.ts @@ -0,0 +1,264 @@ +import type { Node } from '@babel/types' +import * as v from 'valibot' + +/** + * Recursively infers the type of an AST expression node. + * It does NOT evaluate the expression. + */ +function inferExpressionType(node: Node): 'number' | 'unknown' { + switch (node.type) { + case 'NumericLiteral': + return 'number' + case 'BinaryExpression': { + // A binary expression is numeric only if both sides are numeric + // and the operator is mathematical. + const leftType = inferExpressionType(node.left) + const rightType = inferExpressionType(node.right) + if (leftType === 'number' && rightType === 'number') { + if (['+', '-', '*', '/', '%'].includes(node.operator)) + return 'number' + } + return 'unknown' + } + default: + return 'unknown' + } +} + +// ManifestEntry is used in additionalManifestEntries +export const AsyncManifestEntrySchema = v.strictObjectAsync({ + integrity: v.optionalAsync(v.string()), + revision: v.nullable(v.string()), + url: v.string(), +}) + +/** + * A custom Valibot schema that accepts either a primitive number + * or a magicast Proxy representing a numeric expression. + */ +export const AsyncNumericExpressionSchema = v.customAsync( + async (input) => { + // Accept primitive numbers + if (typeof input === 'number') + return true + // Accept magicast proxies + if (typeof input === 'object' && input !== null && '$ast' in input) { + // And statically validate that the expression will result in a number + return inferExpressionType((input as any).$ast) === 'number' + } + return false + }, + 'invalid-number-entry-or-expression', +) + +// Reused schema +export const AsyncCacheQueryOptionsSchema = v.strictObjectAsync({ + ignoreMethod: v.optionalAsync(v.boolean()), + ignoreSearch: v.optionalAsync(v.boolean()), + ignoreVary: v.optionalAsync(v.boolean()), +}) + +// Schema for the `options` property within a runtimeCaching entry. +// This allows us to attach cross-field validation rules to it. +export const AsyncRuntimeCachingOptionsSchema = v.strictObjectAsync({ + /** + * Configuring this will add a workbox-background-sync.BackgroundSyncPlugin instance to the workbox-strategies configured in `handler`. + */ + backgroundSync: v.optionalAsync(v.strictObjectAsync({ + name: v.string(), + options: v.optionalAsync(v.strictObjectAsync({ // Inlined QueueOptionsSchema + forceSyncFallback: v.optionalAsync(v.boolean()), + maxRetentionTime: v.optionalAsync(AsyncNumericExpressionSchema), + onSync: v.optionalAsync(v.function()), + })), + })), + /** + * Configuring this will add a workbox-broadcast-update.BroadcastUpdatePlugin instance to the workbox-strategies configured in `handler`. + */ + broadcastUpdate: v.optionalAsync(v.strictObjectAsync({ + channelName: v.string(), + options: v.strictObjectAsync({ // Inlined BroadcastCacheUpdateOptionsSchema + headersToCheck: v.optionalAsync(v.arrayAsync(v.string())), + generatePayload: v.optionalAsync(v.function()), + notifyAllClients: v.optionalAsync(v.boolean()), + }), + })), + /** + * Configuring this will add a workbox-cacheable-response.CacheableResponsePlugin instance to the workbox-strategies configured in `handler`. + */ + cacheableResponse: v.optionalAsync(v.strictObjectAsync({ // Inlined CacheableResponseOptionsSchema + statuses: v.optionalAsync(v.arrayAsync(AsyncNumericExpressionSchema)), + headers: v.optionalAsync(v.recordAsync(v.string(), v.string())), + })), + /** + * If provided, this will set the `cacheName` property of the workbox-strategies configured in `handler`. + */ + cacheName: v.optionalAsync(v.nullable(v.string())), + /** + * Configuring this will add a workbox-expiration.ExpirationPlugin instance to the workbox-strategies configured in `handler`. + */ + expiration: v.optionalAsync(v.strictObjectAsync({ // Inlined ExpirationPluginOptionsSchema + maxEntries: v.optionalAsync(AsyncNumericExpressionSchema), + maxAgeSeconds: v.optionalAsync(AsyncNumericExpressionSchema), + matchOptions: v.optionalAsync(AsyncCacheQueryOptionsSchema), // Reused + purgeOnQuotaError: v.optionalAsync(v.boolean()), + })), + /** + * If provided, this will set the `networkTimeoutSeconds` property of the workbox-strategies configured in `handler`. Note that only 'NetworkFirst' and 'NetworkOnly' support `networkTimeoutSeconds`. + */ + networkTimeoutSeconds: v.optionalAsync(AsyncNumericExpressionSchema), + /** + * Configuring this allows the use of one or more Workbox plugins that don't have "shortcut" options (like `expiration` for workbox-expiration.ExpirationPlugin). The plugins provided here will be added to the workbox-strategies configured in `handler`. + */ + plugins: v.optionalAsync(v.arrayAsync(v.strictObjectAsync({ // Inlined WorkboxPluginSchema + cacheDidUpdate: v.optionalAsync(v.function()), + cachedResponseWillBeUsed: v.optionalAsync(v.function()), + cacheKeyWillBeUsed: v.optionalAsync(v.function()), + cacheWillUpdate: v.optionalAsync(v.function()), + fetchDidFail: v.optionalAsync(v.function()), + fetchDidSucceed: v.optionalAsync(v.function()), + handlerDidComplete: v.optionalAsync(v.function()), + handlerDidError: v.optionalAsync(v.function()), + handlerDidRespond: v.optionalAsync(v.function()), + handlerWillRespond: v.optionalAsync(v.function()), + handlerWillStart: v.optionalAsync(v.function()), + requestWillFetch: v.optionalAsync(v.function()), + }))), + /** + * Configuring this will add a workbox-precaching.PrecacheFallbackPlugin instance to the workbox-strategies configured in `handler`. + */ + precacheFallback: v.optionalAsync(v.strictObjectAsync({ fallbackURL: v.string() })), + /** + * Enabling this will add a workbox-range-requests.RangeRequestsPlugin instance to the workbox-strategies configured in `handler`. + */ + rangeRequests: v.optionalAsync(v.boolean()), + /** + * Configuring this will pass along the `fetchOptions` value to the workbox-strategies configured in `handler`. + */ + fetchOptions: v.optionalAsync(v.any()), // RequestInit is too complex to define for now + /** + * Configuring this will pass along the `matchOptions` value to the workbox-strategies configured in `handler`. + */ + matchOptions: v.optionalAsync(AsyncCacheQueryOptionsSchema), // Reused +}) + +// Schema for a single entry in the runtimeCaching array. +// It's a strict object to prevent unknown properties. +export const AsyncRuntimeCachingEntrySchema = v.strictObjectAsync({ + /** + * This determines how the runtime route will generate a response. + * To use one of the built-in workbox-strategies, provide its name, like 'NetworkFirst'. + * Alternatively, this can be a workbox-core.RouteHandler callback function with custom response logic. + */ + handler: v.unionAsync([ + v.function(), // RouteHandlerCallback + v.strictObjectAsync({ handle: v.function() }), // Inlined RouteHandlerObjectSchema + v.picklist([ + 'CacheFirst', + 'CacheOnly', + 'NetworkFirst', + 'NetworkOnly', + 'StaleWhileRevalidate', + ]), + ]), + /** + * The HTTP method to match against. The default value of 'GET' is normally sufficient, unless you explicitly need to match 'POST', 'PUT', or another type of request. + */ + method: v.optional(v.picklist([ + 'DELETE', + 'GET', + 'HEAD', + 'PATCH', + 'POST', + 'PUT', + ]), 'GET'), + options: v.optionalAsync(AsyncRuntimeCachingOptionsSchema), + /** + * This match criteria determines whether the configured handler will generate a response for any requests that don't match one of the precached URLs. If multiple `RuntimeCaching` routes are defined, then the first one whose `urlPattern` matches will be the one that responds. + * This value directly maps to the first parameter passed to workbox-routing.registerRoute. It's recommended to use a workbox-core.RouteMatchCallback function for greatest flexibility. + */ + urlPattern: v.unionAsync([v.instance(RegExp), v.function(), v.string()]), +}) + +export const AsyncAdditionalManifestEntriesSchema = v.optionalAsync(v.arrayAsync(v.unionAsync([ + AsyncManifestEntrySchema, + v.string(), +]))) + +export const AsyncGlobOptionsSchema = v.objectAsync({ + /** + * This value can be used to determine the maximum size of files that will be + * precached. This prevents you from inadvertently precaching very large files + * that might have accidentally matched one of your patterns. + * @default 2097152 (2MiB) + */ + maximumFileSizeToCacheInBytes: v.optionalAsync(AsyncNumericExpressionSchema, 2097152), + /** + * Determines whether or not symlinks are followed when generating the + * precache manifest. For more information, see the definition of `follow` in + * the `glob` [documentation](https://github.com/isaacs/node-glob#options). + */ + globFollow: v.optionalAsync(v.boolean(), true), + /** + * A set of patterns matching files to always exclude when generating the + * precache manifest. For more information, see the definition of `ignore` in + * the `glob` [documentation](https://github.com/isaacs/node-glob#options). + */ + globIgnores: v.optionalAsync(v.arrayAsync(v.string()), ['**/node_modules/**/*']), + /** + * Files matching any of these patterns will be included in the precache + * manifest. For more information, see the + * [`glob` primer](https://github.com/isaacs/node-glob#glob-primer). + */ + globPatterns: v.optionalAsync(v.arrayAsync(v.string()), ['**/*.{js,css,html}']), + /** + * If true, an error reading a directory when generating a precache manifest + * will cause the build to fail. If false, the problematic directory will be + * skipped. For more information, see the definition of `strict` in the `glob` + * [documentation](https://github.com/isaacs/node-glob#options). + */ + globStrict: v.optionalAsync(v.boolean(), true), +}) + +export const AsyncManifestOptionsSchema = v.strictObjectAsync({ + ...AsyncGlobOptionsSchema.entries, + /** + * A list of entries to be precached, in addition to any entries that are + * generated as part of the build configuration. + */ + additionalManifestEntries: AsyncAdditionalManifestEntriesSchema, + /** + * Assets that match this will be assumed to be uniquely versioned via their + * URL, and exempted from the normal HTTP cache-busting that's done when + * populating the precache. While not required, it's recommended that if your + * existing build process already inserts a `[hash]` value into each filename, + * you provide a RegExp that will detect that, as it will reduce the bandwidth + * consumed when precaching. + */ + dontCacheBustURLsMatching: v.optionalAsync(v.instance(RegExp)), + /** + * One or more functions which will be applied sequentially against the + * generated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are + * also specified, their corresponding transformations will be applied first. + */ + manifestTransforms: v.optionalAsync(v.arrayAsync(v.function())), + /** + * An object mapping string prefixes to replacement string values. This can be + * used to, e.g., remove or add a path prefix from a manifest entry if your + * web hosting setup doesn't match your local filesystem setup. As an + * alternative with more flexibility, you can use the `manifestTransforms` + * option and provide a function that modifies the entries in the manifest + * using whatever logic you provide. + */ + modifyURLPrefix: v.optionalAsync(v.recordAsync(v.string(), v.string())), + /** + * If a URL is rendered based on some server-side logic, its contents may + * depend on multiple files or on some other unique string value. The keys in + * this object are server-rendered URLs. If the values are an array of + * strings, they will be interpreted as `glob` patterns, and the contents of + * any files matching the patterns will be used to uniquely version the URL. + * If used with a single string, it will be interpreted as unique versioning + * information that you've generated for a given URL. + */ + templatedURLs: v.optionalAsync(v.recordAsync(v.string(), v.unionAsync([v.arrayAsync(v.string()), v.string()]))), +}) diff --git a/packages/workbox-build/src/validation/validation-helper.ts b/packages/workbox-build/src/validation/validation-helper.ts new file mode 100644 index 0000000..59e9a81 --- /dev/null +++ b/packages/workbox-build/src/validation/validation-helper.ts @@ -0,0 +1,169 @@ +// import type { ArrayExpression, Program } from '@babel/types' +import type { BaseIssue, BaseSchemaAsync, InferOutput, IssuePathItem } from 'valibot' +import { getDotPath, safeParseAsync } from 'valibot' +import { errors } from './errors' + +// This helper function traverses the issue's path to find the top-level object key +// that contains the error. This is crucial for errors nested inside arrays. +function getTopLevelKey(path: IssuePathItem[] | undefined): string | undefined { + if (!path || path.length === 0) { + return undefined + } + // The path is ordered from the outside in. The first item is the outermost. + // Its key is what we need to identify the top-level option. + return path[0].key as string | undefined +} + +const requiredErrorMap: Record = { + swSrc: 'invalid-sw-src', + swDest: 'missing-sw-dest', + globDirectory: 'invalid-glob-directory', +} as const + +// see [Path Key not Available in safeParse](https://github.com/fabian-hiller/valibot/discussions/696). +// custom Valibot's message mapping +function extractIssueMessage(issue: BaseIssue) { + console.log(issue) + const path = getDotPath(issue) + const topLevelKey = getTopLevelKey(issue.path) + const lastKey = issue.path?.[issue.path.length - 1]?.key + + // If the message is a key in our errors object, use it. + if (issue.message && issue.message in errors) { + return errors[issue.message as keyof typeof errors] + } + + console.log(path, path && path in requiredErrorMap) + if (path && path in requiredErrorMap) { + console.log('WTF') + return errors[requiredErrorMap[path]] + } + + // Priority 1: Custom messages from pipes (e.g., endsWith). + // These are the most specific and should always be shown. + if (issue.type === 'custom') { + // handle NumericExpressionSchema from utils.ts + if (issue.message === 'invalid-number-entry-or-expression') { + return `The option "${path}" must be a number or a valid numeric expression (e.g., 60 * 60).` + } + + return issue.message + } + + // Priority 2: Missing required key. + if (issue.kind === 'schema' && issue.received === 'undefined') { + // Otherwise, fall back to the generic message. + return `The option "${path}" is required.` + } + + // Priority 3: Unknown key in strict object. + if (issue.type === 'strict_object') + return `The option "${path}" is unknown or has been deprecated.` + + // Priority 4: Human-readable message for array-based options + if (topLevelKey === 'manifestTransforms' || topLevelKey === 'runtimeCaching') { + // This error happens when the value itself is not an array + if (issue.expected?.includes('Array')) + return `The "${topLevelKey}" option must be an array.` + + // This error happens for items within the array + const index = issue.path?.find(p => p.type === 'array')?.key + if (topLevelKey === 'manifestTransforms') + return `Each item in the "manifestTransforms" array must be a function (error at index ${index}).` + + if (topLevelKey === 'runtimeCaching') { + // This error happens when the value is not an array (e.g., a function) + if (issue.expected?.includes('Array')) { + return 'The "runtimeCaching" option must be an array of handlers.' + } + + const index = issue.path?.find(p => p.type === 'array')?.key + + if (lastKey === 'handler') { + if (issue.type === 'union') { + if (issue.input === 'InvalidStrategy') { + return `Invalid "handler" option in runtimeCaching[${index}]. ${issue.message}.` + } + return `Invalid "handler" option in runtimeCaching[${index}]. ${issue.message}.` + } + if (issue.type === 'object') { + return `Invalid "handler" option in runtimeCaching[${index}]. The required option "handler" is missing.` + } + } + + // This is the catch-all for any other error inside a runtimeCaching item. + // It handles cases where an item is not an object, or is missing urlPattern, etc. + return `Invalid item at index ${index} in the "runtimeCaching" array. ${issue.message}.` + } + } + + // Priority 5: Generic type mismatch for other fields. + if (issue.kind === 'schema') { + return `Invalid type for option "${path}". Expected ${issue.expected} but received ${issue.received}.` + } + + // Fallback for any other unhandled case. + return issue.message +} + +// This function intelligently sanitizes the options object from magicast. +function _sanitizeMagicastOptions(options: any): any { + if (options === null || typeof options !== 'object') + return options + + // Gracias a tu parche, podemos detectar los tipos directamente. + if (options instanceof RegExp || typeof options === 'function') { + return options + } + + if (Array.isArray(options)) { + // console.log('PASO') + const sanitizedArray: any[] = [] + for (const option of options) { + sanitizedArray.push(_sanitizeMagicastOptions(option)) + } + return sanitizedArray + // return options.map(sanitizeMagicastOptions) + } + + /* if (options.$type === 'array') { + const sanitizedArray: any[] = [] + for (const option of options) { + sanitizedArray.push(sanitizeMagicastOptions(option)) + } + return sanitizedArray + } */ + + const sanitized: { [key: string]: any } = {} + for (const key in options) { + if (Object.prototype.hasOwnProperty.call(options, key) && !key.startsWith('$')) + sanitized[key] = _sanitizeMagicastOptions(options[key]) + } + + return sanitized +} + +/** + * A wrapper around Valibot's `safeParseAsync` that throws a user-friendly error + * if validation fails. + * @param schema The Valibot schema to use. + * @param options The options object to validate. + * @param methodName The name of the Workbox method being validated, for context. + */ +export async function validateAsync>( + schema: TSchema, + options: unknown, + methodName: string, +): Promise> { + const result = await safeParseAsync( + schema, + options, + ) + if (!result.success) { + const errorMessages = result.issues.map(extractIssueMessage) + throw new Error( + `${methodName}() options validation failed: \n- ${errorMessages.join('\n- ')}`, + ) + } + return result.output +} diff --git a/packages/workbox-build/src/validation/validation-options.ts b/packages/workbox-build/src/validation/validation-options.ts new file mode 100644 index 0000000..94e895c --- /dev/null +++ b/packages/workbox-build/src/validation/validation-options.ts @@ -0,0 +1,49 @@ +import type { GenerateSWOptions } from '../types' +import { errors } from './errors' + +const DEFAULT_EXCLUDE_VALUE = [/\.map$/, /^manifest.*\.js$/] + +export class WorkboxConfigError extends Error { + constructor(message?: string) { + super(message) + Object.setPrototypeOf(this, new.target.prototype) + } +} +export function ensureValidNavigationPreloadConfig( + options: GenerateSWOptions, +): void { + if ( + options.navigationPreload + && (!Array.isArray(options.runtimeCaching) + || options.runtimeCaching.length === 0) + ) { + throw new WorkboxConfigError(errors['nav-preload-runtime-caching']) + } +} + +export function ensureValidCacheExpiration( + options: GenerateSWOptions, +): void { + for (const runtimeCaching of options.runtimeCaching || []) { + if ( + runtimeCaching.options?.expiration + && !runtimeCaching.options?.cacheName + ) { + throw new WorkboxConfigError(errors['cache-name-required']) + } + } +} + +export function ensureValidRuntimeCachingOrGlobDirectory( + options: GenerateSWOptions, +): void { + if ( + !options.globDirectory + && (!Array.isArray(options.runtimeCaching) + || options.runtimeCaching.length === 0) + ) { + throw new WorkboxConfigError( + errors['no-manifest-entries-or-runtime-caching'], + ) + } +} diff --git a/packages/workbox-build/test/validation.test.ts b/packages/workbox-build/test/validation.test.ts new file mode 100644 index 0000000..027524b --- /dev/null +++ b/packages/workbox-build/test/validation.test.ts @@ -0,0 +1,325 @@ +import type { GenerateSWOptions, GetManifestOptions, InjectManifestOptions } from '../src/types' +import type { AsyncGenerateSWOptionsSchemaType } from '../src/validation/async-generate-sw' +import type { AsyncGetManifestOptionsSchemaType } from '../src/validation/async-get-manifest' +import type { AsyncInjectManifestOptionsSchemaType } from '../src/validation/async-inject-manifest' +import { describe, expect, expectTypeOf, it } from 'vitest' +import { AsyncGenerateSWOptionsSchema } from '../src/validation/async-generate-sw' +import { AsyncGetManifestOptionsSchema } from '../src/validation/async-get-manifest' +import { AsyncInjectManifestOptionsSchema } from '../src/validation/async-inject-manifest' +import { errors } from '../src/validation/errors' +import { validateAsync } from '../src/validation/validation-helper' + +describe('schema Type Inference Validation', () => { + it('should correctly infer types that are compatible with the original Workbox types', () => { + // @ts-expect-error - This is a type-level test. The IDE may complain because the nominal + // types are different, but `expectTypeOf` checks for structural compatibility, which is what we care about. + // This test will fail at COMPILE time if the schema's inferred type is not assignable to the original Workbox type. + expectTypeOf().toEqualTypeOf() + // @ts-expect-error - See comment above. + expectTypeOf().toEqualTypeOf() + // @ts-expect-error - See comment above. + expectTypeOf().toEqualTypeOf() + }) +}) + +describe('generateSWOptions Schema Validation', () => { + it('should pass with valid minimal options', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + } satisfies GenerateSWOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).resolves.not.toThrow() + }) + + it('should fail if swDest is missing', async () => { + const options = { + globDirectory: './', + } satisfies Partial + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options as any, 'generateSW')).rejects.toThrow( + `generateSW() options validation failed: \n- ${errors['missing-sw-dest']}`, + ) + }) + + it('should pass with a function for manifestTransforms', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + manifestTransforms: [ + (manifest: any) => { + return { manifest, warnings: [] } + }, + ], + } satisfies GenerateSWOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).resolves.not.toThrow() + }) + + it('should fail if manifestTransforms contains a non-function', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + manifestTransforms: ['not-a-function'], + } satisfies Omit & { manifestTransforms: string[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options as any, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- Each item in the "manifestTransforms" array must be a function (error at index 0).', + ) + }) + + it('should fail if manifestTransforms is a function instead of an array', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + manifestTransforms: (manifest: any) => ({ manifest, warnings: [] }), + } satisfies Omit & { manifestTransforms: (manifest: any) => void } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options as any, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- The "manifestTransforms" option must be an array.', + ) + }) + + it('should pass if globDirectory is missing but runtimeCaching is present', async () => { + const options = { + swDest: 'sw.js', + runtimeCaching: [ + { + urlPattern: /.*/, + handler: 'NetworkFirst', + }, + ], + } satisfies GenerateSWOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).resolves.not.toThrow() + }) + + it('should fail if an unknown property is present', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + importWorkboxFrom: 'cdn', + } satisfies GenerateSWOptions & { importWorkboxFrom?: string } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options as any, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- The option "importWorkboxFrom" is unknown or has been deprecated.', + ) + }) + + it('should fail if swDest does not end with .js', async () => { + const options = { + swDest: 'sw.txt', + globDirectory: './', + } satisfies GenerateSWOptions + // The shape is valid, but the content is not. + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).rejects.toThrow( + `generateSW() options validation failed: \n- ${errors['invalid-sw-dest-js-ext']}`, + ) + }) + + describe('runtimeCaching validation', () => { + it('should pass with a valid runtimeCaching entry', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + runtimeCaching: [{ + urlPattern: /.*/, + handler: 'NetworkFirst', + }], + } satisfies GenerateSWOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).resolves.not.toThrow() + }) + + it('should fail if runtimeCaching is not an array (string)', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + runtimeCaching: 'a-string-not-an-array', + } satisfies Omit & { runtimeCaching: string } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- The "runtimeCaching" option must be an array.', + ) + }) + + it('should fail if a runtimeCaching entry is missing a handler', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + runtimeCaching: [{ + urlPattern: /.*/, + }], + } satisfies Omit & { runtimeCaching: { urlPattern: RegExp }[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- The option "runtimeCaching.0.handler" is required.', + ) + }) + + it('should fail if a runtimeCaching entry has an invalid handler type', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + runtimeCaching: [{ + urlPattern: /.*/, + handler: 123, + }], + } satisfies Omit & { runtimeCaching: { urlPattern: RegExp, handler: number }[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- Invalid "handler" option in runtimeCaching[0]. Invalid type: Expected (Function | Object | ("CacheFirst" | "CacheOnly" | "NetworkFirst" | "NetworkOnly" | "StaleWhileRevalidate")) but received 123.', + ) + }) + + it('should fail if a runtimeCaching entry has an invalid handler string value', async () => { + const options = { + swDest: 'sw.js', + globDirectory: './', + runtimeCaching: [{ + urlPattern: /.*/, + handler: 'InvalidStrategy', + }], + } satisfies Omit & { runtimeCaching: { urlPattern: RegExp, handler: 'InvalidStrategy' }[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGenerateSWOptionsSchema, options, 'generateSW')).rejects.toThrow( + 'generateSW() options validation failed: \n- Invalid "handler" option in runtimeCaching[0]. Invalid type: Expected (Function | Object | ("CacheFirst" | "CacheOnly" | "NetworkFirst" | "NetworkOnly" | "StaleWhileRevalidate")) but received "InvalidStrategy"', + ) + }) + }) +}) + +describe('getManifestOptions Schema Validation', () => { + it('should pass with valid minimal options', async () => { + const options = { + globDirectory: './', + } satisfies GetManifestOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncGetManifestOptionsSchema, options, 'getManifest')).resolves.not.toThrow() + }) + + it('should fail if globDirectory is missing', async () => { + const options = {} satisfies Partial + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGetManifestOptionsSchema, options as any, 'getManifest')).rejects.toThrow( + `getManifest() options validation failed: \n- ${errors['invalid-glob-directory']}`, + ) + }) + + it('should fail if manifestTransforms contains a non-function', async () => { + const options = { + globDirectory: './', + manifestTransforms: ['not-a-function'], + } satisfies Omit & { manifestTransforms: string[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGetManifestOptionsSchema, options as any, 'getManifest')).rejects.toThrow( + 'getManifest() options validation failed: \n- Each item in the "manifestTransforms" array must be a function (error at index 0).', + ) + }) + + it('should fail if manifestTransforms is a function instead of an array', async () => { + const options = { + globDirectory: './', + manifestTransforms: (manifest: any) => ({ manifest, warnings: [] }), + } satisfies Omit & { manifestTransforms: (manifest: any) => void } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGetManifestOptionsSchema, options as any, 'getManifest')).rejects.toThrow( + 'getManifest() options validation failed: \n- The "manifestTransforms" option must be an array.', + ) + }) + + it('should fail if an unknown property is present', async () => { + const options = { + globDirectory: './', + anotherUnknown: 'noop', + } satisfies GetManifestOptions & { anotherUnknown?: string } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncGetManifestOptionsSchema, options as any, 'getManifest')).rejects.toThrow( + 'getManifest() options validation failed: \n- The option "anotherUnknown" is unknown or has been deprecated.', + ) + }) +}) + +describe('injectManifestOptions Schema Validation', () => { + it('should pass with valid minimal options', async () => { + const options = { + swSrc: 'sw.js', + swDest: 'sw-injected.js', + globDirectory: './', + } satisfies InjectManifestOptions + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options, 'injectManifest')).resolves.not.toThrow() + }) + + it('should fail if swSrc is missing', async () => { + const options = { + swDest: 'sw-injected.js', + globDirectory: './', + } satisfies Partial + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options as any, 'injectManifest')).rejects.toThrow( + `injectManifest() options validation failed: \n- ${errors['invalid-sw-src']}`, + ) + }) + + it('should fail if manifestTransforms contains a non-function', async () => { + const options = { + swSrc: 'sw.js', + swDest: 'sw-injected.js', + globDirectory: './', + manifestTransforms: ['not-a-function'], + } satisfies Omit & { manifestTransforms: string[] } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options as any, 'injectManifest')).rejects.toThrow( + 'injectManifest() options validation failed: \n- Each item in the "manifestTransforms" array must be a function (error at index 0).', + ) + }) + + it('should fail if manifestTransforms is a function instead of an array', async () => { + const options = { + swSrc: 'sw.js', + swDest: 'sw-injected.js', + globDirectory: './', + manifestTransforms: (manifest: any) => ({ manifest, warnings: [] }), + } satisfies Omit & { manifestTransforms: (manifest: any) => void } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options as any, 'injectManifest')).rejects.toThrow( + 'injectManifest() options validation failed: \n- The "manifestTransforms" option must be an array.', + ) + }) + + it('should fail if swDest does not end with .js', async () => { + const options = { + swSrc: 'sw.js', + swDest: 'sw-injected.txt', + globDirectory: './', + } satisfies InjectManifestOptions + // The shape is valid, but the content is not. + // @ts-expect-error - schema Type Inference Validation. + expectTypeOf().toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options, 'injectManifest')).rejects.toThrow( + `injectManifest() options validation failed: \n- ${errors['invalid-sw-dest-js-ext']}`, + ) + }) + + it('should fail if an unknown property is present', async () => { + const options = { + swSrc: 'sw.js', + swDest: 'sw-injected.js', + globDirectory: './', + anotherUnknown: 'noop', + } satisfies InjectManifestOptions & { anotherUnknown?: string } + expectTypeOf().not.toMatchObjectType() + await expect(validateAsync(AsyncInjectManifestOptionsSchema, options as any, 'injectManifest')).rejects.toThrow( + 'injectManifest() options validation failed: \n- The option "anotherUnknown" is unknown or has been deprecated.', + ) + }) +}) diff --git a/packages/workbox-build/tsdown.config.ts b/packages/workbox-build/tsdown.config.ts new file mode 100644 index 0000000..a67e051 --- /dev/null +++ b/packages/workbox-build/tsdown.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'tsdown' +import { banner, exports } from '../../helper.ts' + +export default defineConfig({ + entry: './src/{index,types,generate-sw,get-manifest,inject-manifest}.ts', + platform: 'node', + banner, + exports, +}) diff --git a/packages/workbox-cacheable-response/package.json b/packages/workbox-cacheable-response/package.json deleted file mode 100644 index 8eb9cef..0000000 --- a/packages/workbox-cacheable-response/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@vite-pwa/workbox-cacheable-response", - "type": "module", - "version": "0.0.0", - "description": "This library takes a Response object and determines whether it's cacheable based on a specific configuration.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-cacheable-response" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "workbox-plugin" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-cacheable-response/tsdown.config.ts b/packages/workbox-cacheable-response/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-cacheable-response/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-core/package.json b/packages/workbox-core/package.json deleted file mode 100644 index 8e20a85..0000000 --- a/packages/workbox-core/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@vite-pwa/workbox-core", - "type": "module", - "version": "0.0.0", - "description": "This module is used by a number of the other Workbox modules to share common code.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-core" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js", - "./internals": "./dist/internals.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "typesVersions": { - "*": { - "internals": ["dist/internals.d.ts"] - } - }, - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - } -} diff --git a/packages/workbox-core/tsdown.config.ts b/packages/workbox-core/tsdown.config.ts deleted file mode 100644 index dc388bf..0000000 --- a/packages/workbox-core/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/{index,internals}.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-expiration/package.json b/packages/workbox-expiration/package.json deleted file mode 100644 index b53566d..0000000 --- a/packages/workbox-expiration/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@vite-pwa/workbox-expiration", - "type": "module", - "version": "0.0.0", - "description": "A service worker helper library that expires cached responses based on age or maximum number of entries.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-expiration" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "workbox-plugin" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*", - "idb": "catalog:utils" - } -} diff --git a/packages/workbox-expiration/src/index.ts b/packages/workbox-expiration/src/index.ts deleted file mode 100644 index 4d372be..0000000 --- a/packages/workbox-expiration/src/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright 2018 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/ - -import type { ExpirationPluginOptions } from './ExpirationPlugin' -import { CacheExpiration } from './CacheExpiration' -import { ExpirationPlugin } from './ExpirationPlugin' - -/** - * @module workbox-expiration - */ - -export { CacheExpiration, ExpirationPlugin, ExpirationPluginOptions } diff --git a/packages/workbox-expiration/tsdown.config.ts b/packages/workbox-expiration/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-expiration/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-navigation-preload/package.json b/packages/workbox-navigation-preload/package.json deleted file mode 100644 index adde92d..0000000 --- a/packages/workbox-navigation-preload/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@vite-pwa/workbox-navigation-preload", - "type": "module", - "version": "0.0.0", - "description": "This library allows developers to opt-in to using Navigation Preload in their service worker.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-navigation-preload" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "navigation" - ], - "workbox": { - "browserNamespace": "workbox.navigationPreload", - "packageType": "sw" - }, - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-navigation-preload/tsdown.config.ts b/packages/workbox-navigation-preload/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-navigation-preload/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-precaching/package.json b/packages/workbox-precaching/package.json deleted file mode 100644 index 9416c37..0000000 --- a/packages/workbox-precaching/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@vite-pwa/workbox-precaching", - "type": "module", - "version": "0.0.0", - "description": "This module efficiently precaches assets.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-precaching" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*", - "@vite-pwa/workbox-routing": "workspace:*", - "@vite-pwa/workbox-strategies": "workspace:*" - } -} diff --git a/packages/workbox-precaching/tsdown.config.ts b/packages/workbox-precaching/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-precaching/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-range-requests/package.json b/packages/workbox-range-requests/package.json deleted file mode 100644 index 6699edf..0000000 --- a/packages/workbox-range-requests/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@vite-pwa/workbox-range-requests", - "type": "module", - "version": "0.0.0", - "description": "This library creates a new Response, given a source Response and a Range header value.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-range-requests" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "caching", - "cache", - "range", - "media", - "workbox-plugin" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-range-requests/tsdown.config.ts b/packages/workbox-range-requests/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-range-requests/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-recipes/package.json b/packages/workbox-recipes/package.json deleted file mode 100644 index 9afcb5c..0000000 --- a/packages/workbox-recipes/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@vite-pwa/workbox-recipes", - "type": "module", - "version": "0.0.0", - "description": "A service worker helper library to manage common request and caching patterns", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-recipes" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "router", - "routing" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-cacheable-response": "workspace:*", - "@vite-pwa/workbox-core": "workspace:*", - "@vite-pwa/workbox-expiration": "workspace:*", - "@vite-pwa/workbox-precaching": "workspace:*", - "@vite-pwa/workbox-routing": "workspace:*", - "@vite-pwa/workbox-strategies": "workspace:*" - } -} diff --git a/packages/workbox-recipes/tsdown.config.ts b/packages/workbox-recipes/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-recipes/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-routing/package.json b/packages/workbox-routing/package.json deleted file mode 100644 index 19f3d07..0000000 --- a/packages/workbox-routing/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@vite-pwa/workbox-routing", - "type": "module", - "version": "0.0.0", - "description": "A service worker helper library to route request URLs to handlers.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-routing" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "router", - "routing" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-routing/src/index.ts b/packages/workbox-routing/src/index.ts deleted file mode 100644 index c83954c..0000000 --- a/packages/workbox-routing/src/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright 2018 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/ - -import type { NavigationRouteMatchOptions } from './NavigationRoute' -import { NavigationRoute } from './NavigationRoute' -import { RegExpRoute } from './RegExpRoute' -import { registerRoute } from './registerRoute' -import { Route } from './Route' -import { Router } from './Router' -import { setCatchHandler } from './setCatchHandler' -import { setDefaultHandler } from './setDefaultHandler' - -/** - * @module workbox-routing - */ - -export { - NavigationRoute, - NavigationRouteMatchOptions, - RegExpRoute, - registerRoute, - Route, - Router, - setCatchHandler, - setDefaultHandler, -} diff --git a/packages/workbox-routing/tsdown.config.ts b/packages/workbox-routing/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-routing/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-strategies/package.json b/packages/workbox-strategies/package.json deleted file mode 100644 index 71c42c2..0000000 --- a/packages/workbox-strategies/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@vite-pwa/workbox-strategies", - "type": "module", - "version": "0.0.0", - "description": "A service worker helper library implementing common caching strategies.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-strategies" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "router", - "routing" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*" - } -} diff --git a/packages/workbox-strategies/tsdown.config.ts b/packages/workbox-strategies/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-strategies/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-streams/package.json b/packages/workbox-streams/package.json deleted file mode 100644 index 651c962..0000000 --- a/packages/workbox-streams/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@vite-pwa/workbox-streams", - "type": "module", - "version": "0.0.0", - "description": "A library that makes it easier to work with Streams in the browser.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-streams" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw", - "streams", - "readablestream" - ], - "sideEffects": false, - "exports": { - ".": "./dist/index.js" - }, - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - }, - "dependencies": { - "@vite-pwa/workbox-core": "workspace:*", - "@vite-pwa/workbox-routing": "workspace:*" - } -} diff --git a/packages/workbox-streams/tsdown.config.ts b/packages/workbox-streams/tsdown.config.ts deleted file mode 100644 index 1ba9d65..0000000 --- a/packages/workbox-streams/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/index.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-sw/package.json b/packages/workbox-sw/package.json deleted file mode 100644 index 01c403a..0000000 --- a/packages/workbox-sw/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@vite-pwa/workbox-sw", - "type": "module", - "version": "0.0.0", - "description": "This module makes it easy to get started with the Workbox service worker libraries.", - "author": "Google's Web DevRel Team, Vite PWA's Team", - "contributors": [ - "userquin " - ], - "license": "MIT", - "funding": "https://github.com/sponsors/antfu", - "homepage": "https://github.com/vite-pwa/workbox#readme", - "repository": { - "type": "git", - "url": "https://github.com/vite-pwa/workbox.git", - "directory": "packages/workbox-sw" - }, - "bugs": "https://github.com/vite-pwa/workbox/issues", - "keywords": [ - "workbox", - "workboxjs", - "service worker", - "sw" - ], - "sideEffects": false, - "main": "dist/workbox-sw.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "tsdown", - "prepublishOnly": "pnpm run build" - } -} diff --git a/packages/workbox-sw/src/_types.ts b/packages/workbox-sw/src/_types.ts deleted file mode 100644 index 515baa7..0000000 --- a/packages/workbox-sw/src/_types.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/ - -/** - * A `ModulePathCallback` function can be used to modify the modify the where - * Workbox modules are loaded. - * - * @callback ~ModulePathCallback - * @param {string} moduleName The name of the module to load (i.e. - * 'workbox-core', 'workbox-precaching' etc.). - * @param {boolean} debug When true, `dev` builds should be loaded, otherwise - * load `prod` builds. - * @return {string} This callback should return a path of module. This will - * be passed to `importScripts()`. - * - * @memberof workbox - */ diff --git a/packages/workbox-sw/tsdown.config.ts b/packages/workbox-sw/tsdown.config.ts deleted file mode 100644 index 944e76e..0000000 --- a/packages/workbox-sw/tsdown.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ - entry: './src/{index,workbox-sw}.ts', - platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, -}) diff --git a/packages/workbox-swkit/package.json b/packages/workbox-swkit/package.json new file mode 100644 index 0000000..d81ca09 --- /dev/null +++ b/packages/workbox-swkit/package.json @@ -0,0 +1,165 @@ +{ + "name": "@vite-pwa/workbox-swkit", + "type": "module", + "version": "0.0.0", + "description": "This library contains all the packages from workbox packages for the service worker.", + "author": "Google's Web DevRel Team, Vite PWA's Team", + "contributors": [ + "userquin " + ], + "license": "MIT", + "funding": "https://github.com/sponsors/antfu", + "homepage": "https://github.com/vite-pwa/toolkit#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/vite-pwa/toolkit.git", + "directory": "packages/workbox-swkit" + }, + "bugs": "https://github.com/vite-pwa/toolkit/issues", + "keywords": [ + "workbox", + "workboxjs", + "service worker", + "sw", + "background", + "sync", + "navigation", + "caching", + "cache", + "range", + "media", + "workbox-plugin", + "router", + "routing", + "streams", + "readablestream" + ], + "sideEffects": false, + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": "./dist/index.js", + "./background-sync": "./dist/background-sync/index.js", + "./background-sync/types": { + "types": "./dist/background-sync/types.d.ts" + }, + "./broadcast-update": "./dist/broadcast-update/index.js", + "./broadcast-update/types": { + "types": "./dist/broadcast-update/types.d.ts" + }, + "./cacheable-response": "./dist/cacheable-response/index.js", + "./cacheable-response/types": { + "types": "./dist/cacheable-response/types.d.ts" + }, + "./core": "./dist/core/index.js", + "./core/types": { + "types": "./dist/core/types.d.ts" + }, + "./expiration": "./dist/expiration/index.js", + "./expiration/types": { + "types": "./dist/expiration/types.d.ts" + }, + "./navigation-preload": "./dist/navigation-preload/index.js", + "./precaching": "./dist/precaching/index.js", + "./precaching/types": { + "types": "./dist/precaching/types.d.ts" + }, + "./range-requests": "./dist/range-requests/index.js", + "./recipes": "./dist/recipes/index.js", + "./routing": "./dist/routing/index.js", + "./routing/types": { + "types": "./dist/routing/types.d.ts" + }, + "./strategies": "./dist/strategies/index.js", + "./streams": "./dist/streams/index.js", + "./streams/types": { + "types": "./dist/streams/types.d.ts" + }, + "./sw": "./dist/sw/index.js", + "./types": { + "types": "./dist/types.d.ts" + }, + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "background-sync": [ + "./dist/background-sync/index.d.ts" + ], + "background-sync/types": [ + "./dist/background-sync/types.d.ts" + ], + "broadcast-update": [ + "./dist/broadcast-update/index.d.ts" + ], + "broadcast-update/types": [ + "./dist/broadcast-update/types.d.ts" + ], + "cacheable-response": [ + "./dist/cacheable-response/index.d.ts" + ], + "cacheable-response/types": [ + "./dist/cacheable-response/types.d.ts" + ], + "core": [ + "./dist/core/index.d.ts" + ], + "core/types": [ + "./dist/core/types.d.ts" + ], + "expiration": [ + "./dist/expiration/index.d.ts" + ], + "expiration/types": [ + "./dist/expiration/types.d.ts" + ], + "navigation-preload": [ + "./dist/navigation-preload/index.d.ts" + ], + "precaching": [ + "./dist/precaching/index.d.ts" + ], + "precaching/types": [ + "./dist/precaching/types.d.ts" + ], + "range-requests": [ + "./dist/range-requests/index.d.ts" + ], + "recipes": [ + "./dist/recipes/index.d.ts" + ], + "routing": [ + "./dist/routing/index.d.ts" + ], + "routing/types": [ + "./dist/routing/types.d.ts" + ], + "strategies": [ + "./dist/strategies/index.d.ts" + ], + "streams": [ + "./dist/streams/index.d.ts" + ], + "streams/types": [ + "./dist/streams/types.d.ts" + ], + "sw": [ + "./dist/sw/index.d.ts" + ], + "types": [ + "./dist/types.d.ts" + ] + } + }, + "files": [ + "./dist" + ], + "scripts": { + "build": "tsdown", + "prepublishOnly": "pnpm run build" + }, + "dependencies": { + "idb": "catalog:utils" + } +} diff --git a/packages/workbox-background-sync/src/BackgroundSyncPlugin.ts b/packages/workbox-swkit/src/background-sync/BackgroundSyncPlugin.ts similarity index 95% rename from packages/workbox-background-sync/src/BackgroundSyncPlugin.ts rename to packages/workbox-swkit/src/background-sync/BackgroundSyncPlugin.ts index d0a64ef..6f7dfd6 100644 --- a/packages/workbox-background-sync/src/BackgroundSyncPlugin.ts +++ b/packages/workbox-swkit/src/background-sync/BackgroundSyncPlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import type { QueueOptions } from './Queue' import { Queue } from './Queue' diff --git a/packages/workbox-background-sync/src/Queue.ts b/packages/workbox-swkit/src/background-sync/Queue.ts similarity index 98% rename from packages/workbox-background-sync/src/Queue.ts rename to packages/workbox-swkit/src/background-sync/Queue.ts index 85d3b73..1d73ef1 100644 --- a/packages/workbox-background-sync/src/Queue.ts +++ b/packages/workbox-swkit/src/background-sync/Queue.ts @@ -8,18 +8,18 @@ import type { QueueStoreEntry, UnidentifiedQueueStoreEntry } from './lib/QueueDb' -import { assert, getFriendlyURL, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, getFriendlyURL, logger, WorkboxError } from '../core/internals' import { QueueStore } from './lib/QueueStore' import { StorableRequest } from './lib/StorableRequest' // Give TypeScript the correct global. declare let self: ServiceWorkerGlobalScope -interface OnSyncCallbackOptions { +export interface OnSyncCallbackOptions { queue: Queue } -interface OnSyncCallback { +export interface OnSyncCallback { (options: OnSyncCallbackOptions): void | Promise } @@ -29,7 +29,7 @@ export interface QueueOptions { onSync?: OnSyncCallback } -interface QueueEntry { +export interface QueueEntry { request: Request timestamp?: number // We could use Record as a type but that would be a breaking diff --git a/packages/workbox-background-sync/src/QueueStore.ts b/packages/workbox-swkit/src/background-sync/QueueStore.ts similarity index 100% rename from packages/workbox-background-sync/src/QueueStore.ts rename to packages/workbox-swkit/src/background-sync/QueueStore.ts diff --git a/packages/workbox-background-sync/src/StorableRequest.ts b/packages/workbox-swkit/src/background-sync/StorableRequest.ts similarity index 100% rename from packages/workbox-background-sync/src/StorableRequest.ts rename to packages/workbox-swkit/src/background-sync/StorableRequest.ts diff --git a/packages/workbox-background-sync/src/index.ts b/packages/workbox-swkit/src/background-sync/index.ts similarity index 100% rename from packages/workbox-background-sync/src/index.ts rename to packages/workbox-swkit/src/background-sync/index.ts diff --git a/packages/workbox-background-sync/src/lib/QueueDb.ts b/packages/workbox-swkit/src/background-sync/lib/QueueDb.ts similarity index 100% rename from packages/workbox-background-sync/src/lib/QueueDb.ts rename to packages/workbox-swkit/src/background-sync/lib/QueueDb.ts diff --git a/packages/workbox-background-sync/src/lib/QueueStore.ts b/packages/workbox-swkit/src/background-sync/lib/QueueStore.ts similarity index 98% rename from packages/workbox-background-sync/src/lib/QueueStore.ts rename to packages/workbox-swkit/src/background-sync/lib/QueueStore.ts index 3d726f9..515a8c2 100644 --- a/packages/workbox-background-sync/src/lib/QueueStore.ts +++ b/packages/workbox-swkit/src/background-sync/lib/QueueStore.ts @@ -10,7 +10,7 @@ import type { QueueStoreEntry, UnidentifiedQueueStoreEntry, } from './QueueDb' -import { assert } from '@vite-pwa/workbox-core/internals' +import { assert } from '../../core/internals' import { QueueDb, } from './QueueDb' diff --git a/packages/workbox-background-sync/src/lib/StorableRequest.ts b/packages/workbox-swkit/src/background-sync/lib/StorableRequest.ts similarity index 97% rename from packages/workbox-background-sync/src/lib/StorableRequest.ts rename to packages/workbox-swkit/src/background-sync/lib/StorableRequest.ts index f17586a..4af338c 100644 --- a/packages/workbox-background-sync/src/lib/StorableRequest.ts +++ b/packages/workbox-swkit/src/background-sync/lib/StorableRequest.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { MapLikeObject } from '@vite-pwa/workbox-core' -import { assert } from '@vite-pwa/workbox-core/internals' +import type { MapLikeObject } from '../../core/types' +import { assert } from '../../core/internals' type SerializableProperties = | 'method' diff --git a/packages/workbox-swkit/src/background-sync/types.ts b/packages/workbox-swkit/src/background-sync/types.ts new file mode 100644 index 0000000..bead194 --- /dev/null +++ b/packages/workbox-swkit/src/background-sync/types.ts @@ -0,0 +1 @@ +export type { OnSyncCallback, OnSyncCallbackOptions, QueueEntry, QueueOptions } from './Queue' diff --git a/packages/workbox-broadcast-update/src/BroadcastCacheUpdate.ts b/packages/workbox-swkit/src/broadcast-update/BroadcastCacheUpdate.ts similarity index 98% rename from packages/workbox-broadcast-update/src/BroadcastCacheUpdate.ts rename to packages/workbox-swkit/src/broadcast-update/BroadcastCacheUpdate.ts index e5ec863..4c0c51e 100644 --- a/packages/workbox-broadcast-update/src/BroadcastCacheUpdate.ts +++ b/packages/workbox-swkit/src/broadcast-update/BroadcastCacheUpdate.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { CacheDidUpdateCallbackParam } from '@vite-pwa/workbox-core' -import { assert, logger, resultingClientExists, timeout } from '@vite-pwa/workbox-core/internals' +import type { CacheDidUpdateCallbackParam } from '../core/types' +import { assert, logger, resultingClientExists, timeout } from '../core/internals' import { responsesAreSame } from './responsesAreSame' import { diff --git a/packages/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts b/packages/workbox-swkit/src/broadcast-update/BroadcastUpdatePlugin.ts similarity index 94% rename from packages/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts rename to packages/workbox-swkit/src/broadcast-update/BroadcastUpdatePlugin.ts index 82c99e0..0da3c03 100644 --- a/packages/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts +++ b/packages/workbox-swkit/src/broadcast-update/BroadcastUpdatePlugin.ts @@ -6,12 +6,12 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import type { BroadcastCacheUpdateOptions, } from './BroadcastCacheUpdate' -import { dontWaitFor } from '@vite-pwa/workbox-core/internals' +import { dontWaitFor } from '../core/internals' import { BroadcastCacheUpdate, } from './BroadcastCacheUpdate' diff --git a/packages/workbox-swkit/src/broadcast-update/index.ts b/packages/workbox-swkit/src/broadcast-update/index.ts new file mode 100644 index 0000000..63b3e92 --- /dev/null +++ b/packages/workbox-swkit/src/broadcast-update/index.ts @@ -0,0 +1,12 @@ +/* + Copyright 2018 Google LLC, Vite PWA's Team + + Use of this source code is governed by an MIT-style + license that can be found in the LICENSE file or at + https://opensource.org/licenses/MIT. +*/ + +export type { BroadcastCacheUpdateOptions } from './BroadcastCacheUpdate' +export { BroadcastCacheUpdate } from './BroadcastCacheUpdate' +export { BroadcastUpdatePlugin } from './BroadcastUpdatePlugin' +export { responsesAreSame } from './responsesAreSame' diff --git a/packages/workbox-broadcast-update/src/responsesAreSame.ts b/packages/workbox-swkit/src/broadcast-update/responsesAreSame.ts similarity index 96% rename from packages/workbox-broadcast-update/src/responsesAreSame.ts rename to packages/workbox-swkit/src/broadcast-update/responsesAreSame.ts index 0ce6804..18f62d1 100644 --- a/packages/workbox-broadcast-update/src/responsesAreSame.ts +++ b/packages/workbox-swkit/src/broadcast-update/responsesAreSame.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { logger, WorkboxError } from '../core/internals' /** * Given two `Response's`, compares several header values to see if they are diff --git a/packages/workbox-swkit/src/broadcast-update/types.ts b/packages/workbox-swkit/src/broadcast-update/types.ts new file mode 100644 index 0000000..4ab276a --- /dev/null +++ b/packages/workbox-swkit/src/broadcast-update/types.ts @@ -0,0 +1 @@ +export type { BroadcastCacheUpdateOptions } from './BroadcastCacheUpdate' diff --git a/packages/workbox-broadcast-update/src/utils/constants.ts b/packages/workbox-swkit/src/broadcast-update/utils/constants.ts similarity index 100% rename from packages/workbox-broadcast-update/src/utils/constants.ts rename to packages/workbox-swkit/src/broadcast-update/utils/constants.ts diff --git a/packages/workbox-cacheable-response/src/CacheableResponse.ts b/packages/workbox-swkit/src/cacheable-response/CacheableResponse.ts similarity index 97% rename from packages/workbox-cacheable-response/src/CacheableResponse.ts rename to packages/workbox-swkit/src/cacheable-response/CacheableResponse.ts index 2902e43..db0dfb5 100644 --- a/packages/workbox-cacheable-response/src/CacheableResponse.ts +++ b/packages/workbox-swkit/src/cacheable-response/CacheableResponse.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { assert, getFriendlyURL, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, getFriendlyURL, logger, WorkboxError } from '../core/internals' export interface CacheableResponseOptions { statuses?: number[] diff --git a/packages/workbox-cacheable-response/src/CacheableResponsePlugin.ts b/packages/workbox-swkit/src/cacheable-response/CacheableResponsePlugin.ts similarity index 96% rename from packages/workbox-cacheable-response/src/CacheableResponsePlugin.ts rename to packages/workbox-swkit/src/cacheable-response/CacheableResponsePlugin.ts index 8dbd3b7..81e044e 100644 --- a/packages/workbox-cacheable-response/src/CacheableResponsePlugin.ts +++ b/packages/workbox-swkit/src/cacheable-response/CacheableResponsePlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import type { CacheableResponseOptions } from './CacheableResponse' import { CacheableResponse } from './CacheableResponse' diff --git a/packages/workbox-cacheable-response/src/index.ts b/packages/workbox-swkit/src/cacheable-response/index.ts similarity index 60% rename from packages/workbox-cacheable-response/src/index.ts rename to packages/workbox-swkit/src/cacheable-response/index.ts index 7ce9202..cdbd6b7 100644 --- a/packages/workbox-cacheable-response/src/index.ts +++ b/packages/workbox-swkit/src/cacheable-response/index.ts @@ -6,8 +6,6 @@ https://opensource.org/licenses/MIT. */ -import { CacheableResponse } from './CacheableResponse' -import { CacheableResponsePlugin } from './CacheableResponsePlugin' - +export { CacheableResponse } from './CacheableResponse' export type { CacheableResponseOptions } from './CacheableResponse' -export { CacheableResponse, CacheableResponsePlugin } +export { CacheableResponsePlugin } from './CacheableResponsePlugin' diff --git a/packages/workbox-swkit/src/cacheable-response/types.ts b/packages/workbox-swkit/src/cacheable-response/types.ts new file mode 100644 index 0000000..6a77371 --- /dev/null +++ b/packages/workbox-swkit/src/cacheable-response/types.ts @@ -0,0 +1 @@ +export type { CacheableResponseOptions } from './CacheableResponse' diff --git a/packages/workbox-core/src/_private.ts b/packages/workbox-swkit/src/core/_private.ts similarity index 100% rename from packages/workbox-core/src/_private.ts rename to packages/workbox-swkit/src/core/_private.ts diff --git a/packages/workbox-core/src/_private/Deferred.ts b/packages/workbox-swkit/src/core/_private/Deferred.ts similarity index 100% rename from packages/workbox-core/src/_private/Deferred.ts rename to packages/workbox-swkit/src/core/_private/Deferred.ts diff --git a/packages/workbox-core/src/_private/WorkboxError.ts b/packages/workbox-swkit/src/core/_private/WorkboxError.ts similarity index 100% rename from packages/workbox-core/src/_private/WorkboxError.ts rename to packages/workbox-swkit/src/core/_private/WorkboxError.ts diff --git a/packages/workbox-core/src/_private/assert.ts b/packages/workbox-swkit/src/core/_private/assert.ts similarity index 97% rename from packages/workbox-core/src/_private/assert.ts rename to packages/workbox-swkit/src/core/_private/assert.ts index 9925a79..b10f1fa 100644 --- a/packages/workbox-core/src/_private/assert.ts +++ b/packages/workbox-swkit/src/core/_private/assert.ts @@ -7,7 +7,7 @@ */ import type { MapLikeObject } from '../types' -import { WorkboxError } from '../_private/WorkboxError' +import { WorkboxError } from './WorkboxError' /* * This method throws if the supplied value is not an array. diff --git a/packages/workbox-core/src/_private/cacheMatchIgnoreParams.ts b/packages/workbox-swkit/src/core/_private/cacheMatchIgnoreParams.ts similarity index 100% rename from packages/workbox-core/src/_private/cacheMatchIgnoreParams.ts rename to packages/workbox-swkit/src/core/_private/cacheMatchIgnoreParams.ts diff --git a/packages/workbox-core/src/_private/cacheNames.ts b/packages/workbox-swkit/src/core/_private/cacheNames.ts similarity index 100% rename from packages/workbox-core/src/_private/cacheNames.ts rename to packages/workbox-swkit/src/core/_private/cacheNames.ts diff --git a/packages/workbox-core/src/_private/canConstructReadableStream.ts b/packages/workbox-swkit/src/core/_private/canConstructReadableStream.ts similarity index 100% rename from packages/workbox-core/src/_private/canConstructReadableStream.ts rename to packages/workbox-swkit/src/core/_private/canConstructReadableStream.ts diff --git a/packages/workbox-core/src/_private/canConstructResponseFromBodyStream.ts b/packages/workbox-swkit/src/core/_private/canConstructResponseFromBodyStream.ts similarity index 100% rename from packages/workbox-core/src/_private/canConstructResponseFromBodyStream.ts rename to packages/workbox-swkit/src/core/_private/canConstructResponseFromBodyStream.ts diff --git a/packages/workbox-core/src/_private/dontWaitFor.ts b/packages/workbox-swkit/src/core/_private/dontWaitFor.ts similarity index 100% rename from packages/workbox-core/src/_private/dontWaitFor.ts rename to packages/workbox-swkit/src/core/_private/dontWaitFor.ts diff --git a/packages/workbox-core/src/_private/executeQuotaErrorCallbacks.ts b/packages/workbox-swkit/src/core/_private/executeQuotaErrorCallbacks.ts similarity index 96% rename from packages/workbox-core/src/_private/executeQuotaErrorCallbacks.ts rename to packages/workbox-swkit/src/core/_private/executeQuotaErrorCallbacks.ts index 0f00f02..a02d1a5 100644 --- a/packages/workbox-core/src/_private/executeQuotaErrorCallbacks.ts +++ b/packages/workbox-swkit/src/core/_private/executeQuotaErrorCallbacks.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import { logger } from '../_private/logger' import { quotaErrorCallbacks } from '../models/quotaErrorCallbacks' +import { logger } from './logger' /** * Runs all of the callback functions, one at a time sequentially, in the order diff --git a/packages/workbox-core/src/_private/getFriendlyURL.ts b/packages/workbox-swkit/src/core/_private/getFriendlyURL.ts similarity index 100% rename from packages/workbox-core/src/_private/getFriendlyURL.ts rename to packages/workbox-swkit/src/core/_private/getFriendlyURL.ts diff --git a/packages/workbox-core/src/_private/logger.ts b/packages/workbox-swkit/src/core/_private/logger.ts similarity index 100% rename from packages/workbox-core/src/_private/logger.ts rename to packages/workbox-swkit/src/core/_private/logger.ts diff --git a/packages/workbox-core/src/_private/resultingClientExists.ts b/packages/workbox-swkit/src/core/_private/resultingClientExists.ts similarity index 100% rename from packages/workbox-core/src/_private/resultingClientExists.ts rename to packages/workbox-swkit/src/core/_private/resultingClientExists.ts diff --git a/packages/workbox-core/src/_private/timeout.ts b/packages/workbox-swkit/src/core/_private/timeout.ts similarity index 100% rename from packages/workbox-core/src/_private/timeout.ts rename to packages/workbox-swkit/src/core/_private/timeout.ts diff --git a/packages/workbox-core/src/_private/waitUntil.ts b/packages/workbox-swkit/src/core/_private/waitUntil.ts similarity index 100% rename from packages/workbox-core/src/_private/waitUntil.ts rename to packages/workbox-swkit/src/core/_private/waitUntil.ts diff --git a/packages/workbox-core/src/cacheNames.ts b/packages/workbox-swkit/src/core/cacheNames.ts similarity index 100% rename from packages/workbox-core/src/cacheNames.ts rename to packages/workbox-swkit/src/core/cacheNames.ts diff --git a/packages/workbox-core/src/clientsClaim.ts b/packages/workbox-swkit/src/core/clientsClaim.ts similarity index 100% rename from packages/workbox-core/src/clientsClaim.ts rename to packages/workbox-swkit/src/core/clientsClaim.ts diff --git a/packages/workbox-core/src/copyResponse.ts b/packages/workbox-swkit/src/core/copyResponse.ts similarity index 100% rename from packages/workbox-core/src/copyResponse.ts rename to packages/workbox-swkit/src/core/copyResponse.ts diff --git a/packages/workbox-core/src/index.ts b/packages/workbox-swkit/src/core/index.ts similarity index 100% rename from packages/workbox-core/src/index.ts rename to packages/workbox-swkit/src/core/index.ts diff --git a/packages/workbox-core/src/internals.ts b/packages/workbox-swkit/src/core/internals.ts similarity index 100% rename from packages/workbox-core/src/internals.ts rename to packages/workbox-swkit/src/core/internals.ts diff --git a/packages/workbox-core/src/models/messages/messageGenerator.ts b/packages/workbox-swkit/src/core/models/messages/messageGenerator.ts similarity index 100% rename from packages/workbox-core/src/models/messages/messageGenerator.ts rename to packages/workbox-swkit/src/core/models/messages/messageGenerator.ts diff --git a/packages/workbox-core/src/models/messages/messages.ts b/packages/workbox-swkit/src/core/models/messages/messages.ts similarity index 100% rename from packages/workbox-core/src/models/messages/messages.ts rename to packages/workbox-swkit/src/core/models/messages/messages.ts diff --git a/packages/workbox-core/src/models/pluginEvents.ts b/packages/workbox-swkit/src/core/models/pluginEvents.ts similarity index 100% rename from packages/workbox-core/src/models/pluginEvents.ts rename to packages/workbox-swkit/src/core/models/pluginEvents.ts diff --git a/packages/workbox-core/src/models/quotaErrorCallbacks.ts b/packages/workbox-swkit/src/core/models/quotaErrorCallbacks.ts similarity index 100% rename from packages/workbox-core/src/models/quotaErrorCallbacks.ts rename to packages/workbox-swkit/src/core/models/quotaErrorCallbacks.ts diff --git a/packages/workbox-core/src/registerQuotaErrorCallback.ts b/packages/workbox-swkit/src/core/registerQuotaErrorCallback.ts similarity index 100% rename from packages/workbox-core/src/registerQuotaErrorCallback.ts rename to packages/workbox-swkit/src/core/registerQuotaErrorCallback.ts diff --git a/packages/workbox-core/src/setCacheNameDetails.ts b/packages/workbox-swkit/src/core/setCacheNameDetails.ts similarity index 100% rename from packages/workbox-core/src/setCacheNameDetails.ts rename to packages/workbox-swkit/src/core/setCacheNameDetails.ts diff --git a/packages/workbox-core/src/skipWaiting.ts b/packages/workbox-swkit/src/core/skipWaiting.ts similarity index 100% rename from packages/workbox-core/src/skipWaiting.ts rename to packages/workbox-swkit/src/core/skipWaiting.ts diff --git a/packages/workbox-core/src/types.ts b/packages/workbox-swkit/src/core/types.ts similarity index 98% rename from packages/workbox-core/src/types.ts rename to packages/workbox-swkit/src/core/types.ts index 4fedb71..c616c9a 100644 --- a/packages/workbox-core/src/types.ts +++ b/packages/workbox-swkit/src/core/types.ts @@ -44,7 +44,7 @@ export interface RouteMatchCallback { /** * Options passed to a `RouteHandlerCallback` function. */ -export declare interface RouteHandlerCallbackOptions { +export interface RouteHandlerCallbackOptions { event: ExtendableEvent request: Request url: URL @@ -249,7 +249,7 @@ export interface HandlerDidCompleteCallback { * An object with optional lifecycle callback properties for the fetch and * cache operations. */ -export declare interface WorkboxPlugin { +export interface WorkboxPlugin { cacheDidUpdate?: CacheDidUpdateCallback cachedResponseWillBeUsed?: CachedResponseWillBeUsedCallback cacheKeyWillBeUsed?: CacheKeyWillBeUsedCallback diff --git a/packages/workbox-core/src/utils/pluginUtils.ts b/packages/workbox-swkit/src/core/utils/pluginUtils.ts similarity index 100% rename from packages/workbox-core/src/utils/pluginUtils.ts rename to packages/workbox-swkit/src/core/utils/pluginUtils.ts diff --git a/packages/workbox-core/src/utils/welcome.ts b/packages/workbox-swkit/src/core/utils/welcome.ts similarity index 100% rename from packages/workbox-core/src/utils/welcome.ts rename to packages/workbox-swkit/src/core/utils/welcome.ts diff --git a/packages/workbox-expiration/src/CacheExpiration.ts b/packages/workbox-swkit/src/expiration/CacheExpiration.ts similarity index 98% rename from packages/workbox-expiration/src/CacheExpiration.ts rename to packages/workbox-swkit/src/expiration/CacheExpiration.ts index 73c4b03..9ab02c4 100644 --- a/packages/workbox-expiration/src/CacheExpiration.ts +++ b/packages/workbox-swkit/src/expiration/CacheExpiration.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { assert, dontWaitFor, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, dontWaitFor, logger, WorkboxError } from '../core/internals' import { CacheTimestampsModel } from './models/CacheTimestampsModel' diff --git a/packages/workbox-expiration/src/ExpirationPlugin.ts b/packages/workbox-swkit/src/expiration/ExpirationPlugin.ts similarity index 98% rename from packages/workbox-expiration/src/ExpirationPlugin.ts rename to packages/workbox-swkit/src/expiration/ExpirationPlugin.ts index 0ea5968..f2408e7 100644 --- a/packages/workbox-expiration/src/ExpirationPlugin.ts +++ b/packages/workbox-swkit/src/expiration/ExpirationPlugin.ts @@ -6,9 +6,9 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' -import { registerQuotaErrorCallback } from '@vite-pwa/workbox-core' -import { assert, privateCacheNames as cacheNames, dontWaitFor, getFriendlyURL, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import type { WorkboxPlugin } from '../core/types' +import { registerQuotaErrorCallback } from '../core/index' +import { assert, privateCacheNames as cacheNames, dontWaitFor, getFriendlyURL, logger, WorkboxError } from '../core/internals' import { CacheExpiration } from './CacheExpiration' diff --git a/packages/workbox-swkit/src/expiration/index.ts b/packages/workbox-swkit/src/expiration/index.ts new file mode 100644 index 0000000..b08158c --- /dev/null +++ b/packages/workbox-swkit/src/expiration/index.ts @@ -0,0 +1,11 @@ +/* + Copyright 2018 Google LLC, Vite PWA's Team + + Use of this source code is governed by an MIT-style + license that can be found in the LICENSE file or at + https://opensource.org/licenses/MIT. +*/ + +export { CacheExpiration } from './CacheExpiration' +export type { ExpirationPluginOptions } from './ExpirationPlugin' +export { ExpirationPlugin } from './ExpirationPlugin' diff --git a/packages/workbox-expiration/src/models/CacheTimestampsModel.ts b/packages/workbox-swkit/src/expiration/models/CacheTimestampsModel.ts similarity index 100% rename from packages/workbox-expiration/src/models/CacheTimestampsModel.ts rename to packages/workbox-swkit/src/expiration/models/CacheTimestampsModel.ts diff --git a/packages/workbox-swkit/src/expiration/types.ts b/packages/workbox-swkit/src/expiration/types.ts new file mode 100644 index 0000000..159c1a8 --- /dev/null +++ b/packages/workbox-swkit/src/expiration/types.ts @@ -0,0 +1 @@ +export type { ExpirationPluginOptions } from './ExpirationPlugin' diff --git a/packages/workbox-swkit/src/index.ts b/packages/workbox-swkit/src/index.ts new file mode 100644 index 0000000..c80a6d8 --- /dev/null +++ b/packages/workbox-swkit/src/index.ts @@ -0,0 +1,12 @@ +export * from './background-sync/index' +export * from './broadcast-update' +export * from './cacheable-response' +export * from './core' +export * from './expiration' +export * from './precaching' +export * from './range-requests' +export * from './recipes' +export * from './routing' +export * from './strategies' +export * from './streams' +export * from './sw' diff --git a/packages/workbox-navigation-preload/src/disable.ts b/packages/workbox-swkit/src/navigation-preload/disable.ts similarity index 94% rename from packages/workbox-navigation-preload/src/disable.ts rename to packages/workbox-swkit/src/navigation-preload/disable.ts index cd3d2f0..c9b5b44 100644 --- a/packages/workbox-navigation-preload/src/disable.ts +++ b/packages/workbox-swkit/src/navigation-preload/disable.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { logger } from '@vite-pwa/workbox-core/internals' +import { logger } from '../core/internals' import { isSupported } from './isSupported' // Give TypeScript the correct global. diff --git a/packages/workbox-navigation-preload/src/enable.ts b/packages/workbox-swkit/src/navigation-preload/enable.ts similarity index 96% rename from packages/workbox-navigation-preload/src/enable.ts rename to packages/workbox-swkit/src/navigation-preload/enable.ts index 89fddb1..2e0c149 100644 --- a/packages/workbox-navigation-preload/src/enable.ts +++ b/packages/workbox-swkit/src/navigation-preload/enable.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { logger } from '@vite-pwa/workbox-core/internals' +import { logger } from '../core/internals' import { isSupported } from './isSupported' // Give TypeScript the correct global. diff --git a/packages/workbox-navigation-preload/src/index.ts b/packages/workbox-swkit/src/navigation-preload/index.ts similarity index 100% rename from packages/workbox-navigation-preload/src/index.ts rename to packages/workbox-swkit/src/navigation-preload/index.ts diff --git a/packages/workbox-navigation-preload/src/isSupported.ts b/packages/workbox-swkit/src/navigation-preload/isSupported.ts similarity index 100% rename from packages/workbox-navigation-preload/src/isSupported.ts rename to packages/workbox-swkit/src/navigation-preload/isSupported.ts diff --git a/packages/workbox-precaching/src/PrecacheController.ts b/packages/workbox-swkit/src/precaching/PrecacheController.ts similarity index 98% rename from packages/workbox-precaching/src/PrecacheController.ts rename to packages/workbox-swkit/src/precaching/PrecacheController.ts index 1481c09..9e07553 100644 --- a/packages/workbox-precaching/src/PrecacheController.ts +++ b/packages/workbox-swkit/src/precaching/PrecacheController.ts @@ -6,10 +6,10 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandlerCallback, WorkboxPlugin } from '@vite-pwa/workbox-core' -import type { Strategy } from '@vite-pwa/workbox-strategies' -import type { CleanupResult, InstallResult, PrecacheEntry } from './_types' -import { assert, privateCacheNames as cacheNames, logger, waitUntil, WorkboxError } from '@vite-pwa/workbox-core/internals' +import type { RouteHandlerCallback, WorkboxPlugin } from '../core/types' +import type { Strategy } from '../strategies/Strategy' +import type { CleanupResult, InstallResult, PrecacheEntry } from './types' +import { assert, privateCacheNames as cacheNames, logger, waitUntil, WorkboxError } from '../core/internals' import { PrecacheStrategy } from './PrecacheStrategy' import { createCacheKey } from './utils/createCacheKey' import { PrecacheCacheKeyPlugin } from './utils/PrecacheCacheKeyPlugin' diff --git a/packages/workbox-precaching/src/PrecacheFallbackPlugin.ts b/packages/workbox-swkit/src/precaching/PrecacheFallbackPlugin.ts similarity index 97% rename from packages/workbox-precaching/src/PrecacheFallbackPlugin.ts rename to packages/workbox-swkit/src/precaching/PrecacheFallbackPlugin.ts index 290602c..51db859 100644 --- a/packages/workbox-precaching/src/PrecacheFallbackPlugin.ts +++ b/packages/workbox-swkit/src/precaching/PrecacheFallbackPlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import type { PrecacheController } from './PrecacheController' import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController' diff --git a/packages/workbox-precaching/src/PrecacheRoute.ts b/packages/workbox-swkit/src/precaching/PrecacheRoute.ts similarity index 92% rename from packages/workbox-precaching/src/PrecacheRoute.ts rename to packages/workbox-swkit/src/precaching/PrecacheRoute.ts index 9047ba5..be18891 100644 --- a/packages/workbox-precaching/src/PrecacheRoute.ts +++ b/packages/workbox-swkit/src/precaching/PrecacheRoute.ts @@ -9,12 +9,12 @@ import type { RouteMatchCallback, RouteMatchCallbackOptions, -} from '@vite-pwa/workbox-core' -import type { PrecacheRouteOptions } from './_types' +} from '../core/types' import type { PrecacheController } from './PrecacheController' -import { getFriendlyURL, logger } from '@vite-pwa/workbox-core/internals' +import type { PrecacheRouteOptions } from './types' +import { getFriendlyURL, logger } from '../core/internals' -import { Route } from '@vite-pwa/workbox-routing' +import { Route } from '../routing/Route' import { generateURLVariations } from './utils/generateURLVariations' /** diff --git a/packages/workbox-precaching/src/PrecacheStrategy.ts b/packages/workbox-swkit/src/precaching/PrecacheStrategy.ts similarity index 97% rename from packages/workbox-precaching/src/PrecacheStrategy.ts rename to packages/workbox-swkit/src/precaching/PrecacheStrategy.ts index 88f3314..c2405aa 100644 --- a/packages/workbox-precaching/src/PrecacheStrategy.ts +++ b/packages/workbox-swkit/src/precaching/PrecacheStrategy.ts @@ -6,11 +6,12 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' -import type { StrategyHandler, StrategyOptions } from '@vite-pwa/workbox-strategies' -import { copyResponse } from '@vite-pwa/workbox-core' -import { privateCacheNames as cacheNames, getFriendlyURL, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' -import { Strategy } from '@vite-pwa/workbox-strategies' +import type { WorkboxPlugin } from '../core/types' +import type { StrategyOptions } from '../strategies/Strategy' +import type { StrategyHandler } from '../strategies/StrategyHandler' +import { copyResponse } from '../core/index' +import { privateCacheNames as cacheNames, getFriendlyURL, logger, WorkboxError } from '../core/internals' +import { Strategy } from '../strategies/Strategy' interface PrecacheStrategyOptions extends StrategyOptions { fallbackToNetwork?: boolean diff --git a/packages/workbox-precaching/src/addPlugins.ts b/packages/workbox-swkit/src/precaching/addPlugins.ts similarity index 90% rename from packages/workbox-precaching/src/addPlugins.ts rename to packages/workbox-swkit/src/precaching/addPlugins.ts index 476185d..0d224f5 100644 --- a/packages/workbox-precaching/src/addPlugins.ts +++ b/packages/workbox-swkit/src/precaching/addPlugins.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController' /** diff --git a/packages/workbox-precaching/src/addRoute.ts b/packages/workbox-swkit/src/precaching/addRoute.ts similarity index 90% rename from packages/workbox-precaching/src/addRoute.ts rename to packages/workbox-swkit/src/precaching/addRoute.ts index 3c5e1e1..5ecb835 100644 --- a/packages/workbox-precaching/src/addRoute.ts +++ b/packages/workbox-swkit/src/precaching/addRoute.ts @@ -5,9 +5,9 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheRouteOptions } from './_types' +import type { PrecacheRouteOptions } from './types' -import { registerRoute } from '@vite-pwa/workbox-routing' +import { registerRoute } from '../routing/registerRoute' import { PrecacheRoute } from './PrecacheRoute' import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController' diff --git a/packages/workbox-precaching/src/cleanupOutdatedCaches.ts b/packages/workbox-swkit/src/precaching/cleanupOutdatedCaches.ts similarity index 93% rename from packages/workbox-precaching/src/cleanupOutdatedCaches.ts rename to packages/workbox-swkit/src/precaching/cleanupOutdatedCaches.ts index 0815f7a..9ca8fd5 100644 --- a/packages/workbox-precaching/src/cleanupOutdatedCaches.ts +++ b/packages/workbox-swkit/src/precaching/cleanupOutdatedCaches.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { privateCacheNames as cacheNames, logger } from '@vite-pwa/workbox-core/internals' +import { privateCacheNames as cacheNames, logger } from '../core/internals' import { deleteOutdatedCaches } from './utils/deleteOutdatedCaches' /** diff --git a/packages/workbox-precaching/src/createHandlerBoundToURL.ts b/packages/workbox-swkit/src/precaching/createHandlerBoundToURL.ts similarity index 93% rename from packages/workbox-precaching/src/createHandlerBoundToURL.ts rename to packages/workbox-swkit/src/precaching/createHandlerBoundToURL.ts index ddbaf35..49c0a93 100644 --- a/packages/workbox-precaching/src/createHandlerBoundToURL.ts +++ b/packages/workbox-swkit/src/precaching/createHandlerBoundToURL.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandlerCallback } from '@vite-pwa/workbox-core' +import type { RouteHandlerCallback } from '../core/types' import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController' /** diff --git a/packages/workbox-precaching/src/getCacheKeyForURL.ts b/packages/workbox-swkit/src/precaching/getCacheKeyForURL.ts similarity index 100% rename from packages/workbox-precaching/src/getCacheKeyForURL.ts rename to packages/workbox-swkit/src/precaching/getCacheKeyForURL.ts diff --git a/packages/workbox-precaching/src/index.ts b/packages/workbox-swkit/src/precaching/index.ts similarity index 98% rename from packages/workbox-precaching/src/index.ts rename to packages/workbox-swkit/src/precaching/index.ts index f409f01..a9a1990 100644 --- a/packages/workbox-precaching/src/index.ts +++ b/packages/workbox-swkit/src/precaching/index.ts @@ -47,4 +47,4 @@ export { PrecacheStrategy, } -export * from './_types' +export * from './types' diff --git a/packages/workbox-precaching/src/matchPrecache.ts b/packages/workbox-swkit/src/precaching/matchPrecache.ts similarity index 100% rename from packages/workbox-precaching/src/matchPrecache.ts rename to packages/workbox-swkit/src/precaching/matchPrecache.ts diff --git a/packages/workbox-precaching/src/precache.ts b/packages/workbox-swkit/src/precaching/precache.ts similarity index 95% rename from packages/workbox-precaching/src/precache.ts rename to packages/workbox-swkit/src/precaching/precache.ts index b27afd8..88125a0 100644 --- a/packages/workbox-precaching/src/precache.ts +++ b/packages/workbox-swkit/src/precaching/precache.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheEntry } from './_types' +import type { PrecacheEntry } from './types' import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController' /** diff --git a/packages/workbox-precaching/src/precacheAndRoute.ts b/packages/workbox-swkit/src/precaching/precacheAndRoute.ts similarity index 92% rename from packages/workbox-precaching/src/precacheAndRoute.ts rename to packages/workbox-swkit/src/precaching/precacheAndRoute.ts index b126a66..bde9ac2 100644 --- a/packages/workbox-precaching/src/precacheAndRoute.ts +++ b/packages/workbox-swkit/src/precaching/precacheAndRoute.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheEntry, PrecacheRouteOptions } from './_types' +import type { PrecacheEntry, PrecacheRouteOptions } from './types' import { addRoute } from './addRoute' import { precache } from './precache' diff --git a/packages/workbox-precaching/src/_types.ts b/packages/workbox-swkit/src/precaching/types.ts similarity index 98% rename from packages/workbox-precaching/src/_types.ts rename to packages/workbox-swkit/src/precaching/types.ts index 0029344..7f84651 100644 --- a/packages/workbox-precaching/src/_types.ts +++ b/packages/workbox-swkit/src/precaching/types.ts @@ -15,7 +15,7 @@ export interface CleanupResult { deletedCacheRequests: string[] } -export declare interface PrecacheEntry { +export interface PrecacheEntry { integrity?: string url: string revision?: string | null diff --git a/packages/workbox-precaching/src/utils/PrecacheCacheKeyPlugin.ts b/packages/workbox-swkit/src/precaching/utils/PrecacheCacheKeyPlugin.ts similarity index 98% rename from packages/workbox-precaching/src/utils/PrecacheCacheKeyPlugin.ts rename to packages/workbox-swkit/src/precaching/utils/PrecacheCacheKeyPlugin.ts index 1278e4d..5fd069c 100644 --- a/packages/workbox-precaching/src/utils/PrecacheCacheKeyPlugin.ts +++ b/packages/workbox-swkit/src/precaching/utils/PrecacheCacheKeyPlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin, WorkboxPluginCallbackParam } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin, WorkboxPluginCallbackParam } from '../../core/types' import type { PrecacheController } from '../PrecacheController' /** diff --git a/packages/workbox-precaching/src/utils/PrecacheInstallReportPlugin.ts b/packages/workbox-swkit/src/precaching/utils/PrecacheInstallReportPlugin.ts similarity index 98% rename from packages/workbox-precaching/src/utils/PrecacheInstallReportPlugin.ts rename to packages/workbox-swkit/src/precaching/utils/PrecacheInstallReportPlugin.ts index e0e7607..19f2c2f 100644 --- a/packages/workbox-precaching/src/utils/PrecacheInstallReportPlugin.ts +++ b/packages/workbox-swkit/src/precaching/utils/PrecacheInstallReportPlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin, WorkboxPluginCallbackParam } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin, WorkboxPluginCallbackParam } from '../../core/types' /** * A plugin, designed to be used with PrecacheController, to determine the diff --git a/packages/workbox-precaching/src/utils/createCacheKey.ts b/packages/workbox-swkit/src/precaching/utils/createCacheKey.ts similarity index 94% rename from packages/workbox-precaching/src/utils/createCacheKey.ts rename to packages/workbox-swkit/src/precaching/utils/createCacheKey.ts index 8228969..2d9da10 100644 --- a/packages/workbox-precaching/src/utils/createCacheKey.ts +++ b/packages/workbox-swkit/src/precaching/utils/createCacheKey.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheEntry } from '../_types' -import { WorkboxError } from '@vite-pwa/workbox-core/internals' +import type { PrecacheEntry } from '../types' +import { WorkboxError } from '../../core/internals' interface CacheKey { cacheKey: string diff --git a/packages/workbox-precaching/src/utils/deleteOutdatedCaches.ts b/packages/workbox-swkit/src/precaching/utils/deleteOutdatedCaches.ts similarity index 100% rename from packages/workbox-precaching/src/utils/deleteOutdatedCaches.ts rename to packages/workbox-swkit/src/precaching/utils/deleteOutdatedCaches.ts diff --git a/packages/workbox-precaching/src/utils/generateURLVariations.ts b/packages/workbox-swkit/src/precaching/utils/generateURLVariations.ts similarity index 91% rename from packages/workbox-precaching/src/utils/generateURLVariations.ts rename to packages/workbox-swkit/src/precaching/utils/generateURLVariations.ts index 7afaa7d..893bf2f 100644 --- a/packages/workbox-precaching/src/utils/generateURLVariations.ts +++ b/packages/workbox-swkit/src/precaching/utils/generateURLVariations.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheRouteOptions } from '../_types' +import type { PrecacheRouteOptions } from '../types' import { removeIgnoredSearchParams } from './removeIgnoredSearchParams' /** @@ -14,7 +14,7 @@ import { removeIgnoredSearchParams } from './removeIgnoredSearchParams' * check, one at a time. * * @param {string} url - * @param {import('../_types').PrecacheRouteOptions} [options]')} options + * @param {import('../types').PrecacheRouteOptions} [options]')} options * * @private */ diff --git a/packages/workbox-precaching/src/utils/getCacheKeyForURL.ts b/packages/workbox-swkit/src/precaching/utils/getCacheKeyForURL.ts similarity index 95% rename from packages/workbox-precaching/src/utils/getCacheKeyForURL.ts rename to packages/workbox-swkit/src/precaching/utils/getCacheKeyForURL.ts index 8876143..7dea71f 100644 --- a/packages/workbox-precaching/src/utils/getCacheKeyForURL.ts +++ b/packages/workbox-swkit/src/precaching/utils/getCacheKeyForURL.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { PrecacheRouteOptions } from '../_types' +import type { PrecacheRouteOptions } from '../types' import { generateURLVariations } from './generateURLVariations' import { getOrCreatePrecacheController } from './getOrCreatePrecacheController' diff --git a/packages/workbox-precaching/src/utils/getOrCreatePrecacheController.ts b/packages/workbox-swkit/src/precaching/utils/getOrCreatePrecacheController.ts similarity index 100% rename from packages/workbox-precaching/src/utils/getOrCreatePrecacheController.ts rename to packages/workbox-swkit/src/precaching/utils/getOrCreatePrecacheController.ts diff --git a/packages/workbox-precaching/src/utils/printCleanupDetails.ts b/packages/workbox-swkit/src/precaching/utils/printCleanupDetails.ts similarity index 94% rename from packages/workbox-precaching/src/utils/printCleanupDetails.ts rename to packages/workbox-swkit/src/precaching/utils/printCleanupDetails.ts index 026948a..21b3cc5 100644 --- a/packages/workbox-precaching/src/utils/printCleanupDetails.ts +++ b/packages/workbox-swkit/src/precaching/utils/printCleanupDetails.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { logger } from '@vite-pwa/workbox-core/internals' +import { logger } from '../../core/internals' /** * @param {string} groupTitle diff --git a/packages/workbox-precaching/src/utils/printInstallDetails.ts b/packages/workbox-swkit/src/precaching/utils/printInstallDetails.ts similarity index 96% rename from packages/workbox-precaching/src/utils/printInstallDetails.ts rename to packages/workbox-swkit/src/precaching/utils/printInstallDetails.ts index d81ff3f..f55a134 100644 --- a/packages/workbox-precaching/src/utils/printInstallDetails.ts +++ b/packages/workbox-swkit/src/precaching/utils/printInstallDetails.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { logger } from '@vite-pwa/workbox-core/internals' +import { logger } from '../../core/internals' /** * @param {string} groupTitle diff --git a/packages/workbox-precaching/src/utils/removeIgnoredSearchParams.ts b/packages/workbox-swkit/src/precaching/utils/removeIgnoredSearchParams.ts similarity index 100% rename from packages/workbox-precaching/src/utils/removeIgnoredSearchParams.ts rename to packages/workbox-swkit/src/precaching/utils/removeIgnoredSearchParams.ts diff --git a/packages/workbox-range-requests/src/RangeRequestsPlugin.ts b/packages/workbox-swkit/src/range-requests/RangeRequestsPlugin.ts similarity index 96% rename from packages/workbox-range-requests/src/RangeRequestsPlugin.ts rename to packages/workbox-swkit/src/range-requests/RangeRequestsPlugin.ts index 35cce9b..a5d551d 100644 --- a/packages/workbox-range-requests/src/RangeRequestsPlugin.ts +++ b/packages/workbox-swkit/src/range-requests/RangeRequestsPlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../core/types' import { createPartialResponse } from './createPartialResponse' /** diff --git a/packages/workbox-range-requests/src/createPartialResponse.ts b/packages/workbox-swkit/src/range-requests/createPartialResponse.ts similarity index 97% rename from packages/workbox-range-requests/src/createPartialResponse.ts rename to packages/workbox-swkit/src/range-requests/createPartialResponse.ts index 4282ab9..5467897 100644 --- a/packages/workbox-range-requests/src/createPartialResponse.ts +++ b/packages/workbox-swkit/src/range-requests/createPartialResponse.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { assert, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, WorkboxError } from '../core/internals' import { calculateEffectiveBoundaries } from './utils/calculateEffectiveBoundaries' import { parseRangeHeader } from './utils/parseRangeHeader' diff --git a/packages/workbox-range-requests/src/index.ts b/packages/workbox-swkit/src/range-requests/index.ts similarity index 100% rename from packages/workbox-range-requests/src/index.ts rename to packages/workbox-swkit/src/range-requests/index.ts diff --git a/packages/workbox-range-requests/src/utils/calculateEffectiveBoundaries.ts b/packages/workbox-swkit/src/range-requests/utils/calculateEffectiveBoundaries.ts similarity index 95% rename from packages/workbox-range-requests/src/utils/calculateEffectiveBoundaries.ts rename to packages/workbox-swkit/src/range-requests/utils/calculateEffectiveBoundaries.ts index bf1bc68..b3c4cb9 100644 --- a/packages/workbox-range-requests/src/utils/calculateEffectiveBoundaries.ts +++ b/packages/workbox-swkit/src/range-requests/utils/calculateEffectiveBoundaries.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { assert, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, WorkboxError } from '../../core/internals' /** * @param {Blob} blob A source blob. diff --git a/packages/workbox-range-requests/src/utils/parseRangeHeader.ts b/packages/workbox-swkit/src/range-requests/utils/parseRangeHeader.ts similarity index 96% rename from packages/workbox-range-requests/src/utils/parseRangeHeader.ts rename to packages/workbox-swkit/src/range-requests/utils/parseRangeHeader.ts index 5fdb2d5..26ac8c9 100644 --- a/packages/workbox-range-requests/src/utils/parseRangeHeader.ts +++ b/packages/workbox-swkit/src/range-requests/utils/parseRangeHeader.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { assert, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, WorkboxError } from '../../core/internals' /** * @param {string} rangeHeader A Range: header value. diff --git a/packages/workbox-recipes/src/googleFontsCache.ts b/packages/workbox-swkit/src/recipes/googleFontsCache.ts similarity index 84% rename from packages/workbox-recipes/src/googleFontsCache.ts rename to packages/workbox-swkit/src/recipes/googleFontsCache.ts index a23f40a..2f17b0f 100644 --- a/packages/workbox-recipes/src/googleFontsCache.ts +++ b/packages/workbox-swkit/src/recipes/googleFontsCache.ts @@ -1,5 +1,5 @@ -import { CacheableResponsePlugin } from '@vite-pwa/workbox-cacheable-response' -import { ExpirationPlugin } from '@vite-pwa/workbox-expiration' +import { CacheableResponsePlugin } from '../cacheable-response/CacheableResponsePlugin' +import { ExpirationPlugin } from '../expiration/ExpirationPlugin' /* Copyright 2020 Google LLC, Vite PWA's Team @@ -7,8 +7,9 @@ import { ExpirationPlugin } from '@vite-pwa/workbox-expiration' license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT. */ -import { registerRoute } from '@vite-pwa/workbox-routing' -import { CacheFirst, StaleWhileRevalidate } from '@vite-pwa/workbox-strategies' +import { registerRoute } from '../routing/registerRoute' +import { CacheFirst } from '../strategies/CacheFirst' +import { StaleWhileRevalidate } from '../strategies/StaleWhileRevalidate' export interface GoogleFontCacheOptions { cachePrefix?: string diff --git a/packages/workbox-recipes/src/imageCache.ts b/packages/workbox-swkit/src/recipes/imageCache.ts similarity index 88% rename from packages/workbox-recipes/src/imageCache.ts rename to packages/workbox-swkit/src/recipes/imageCache.ts index 19d2fc4..4e0264c 100644 --- a/packages/workbox-recipes/src/imageCache.ts +++ b/packages/workbox-swkit/src/recipes/imageCache.ts @@ -10,11 +10,11 @@ import type { RouteMatchCallback, RouteMatchCallbackOptions, WorkboxPlugin, -} from '@vite-pwa/workbox-core' -import { CacheableResponsePlugin } from '@vite-pwa/workbox-cacheable-response' -import { ExpirationPlugin } from '@vite-pwa/workbox-expiration' -import { registerRoute } from '@vite-pwa/workbox-routing' -import { CacheFirst } from '@vite-pwa/workbox-strategies' +} from '../core/types' +import { CacheableResponsePlugin } from '../cacheable-response/CacheableResponsePlugin' +import { ExpirationPlugin } from '../expiration/ExpirationPlugin' +import { registerRoute } from '../routing/registerRoute' +import { CacheFirst } from '../strategies/CacheFirst' import { warmStrategyCache } from './warmStrategyCache' export interface ImageCacheOptions { diff --git a/packages/workbox-recipes/src/index.ts b/packages/workbox-swkit/src/recipes/index.ts similarity index 100% rename from packages/workbox-recipes/src/index.ts rename to packages/workbox-swkit/src/recipes/index.ts diff --git a/packages/workbox-recipes/src/offlineFallback.ts b/packages/workbox-swkit/src/recipes/offlineFallback.ts similarity index 94% rename from packages/workbox-recipes/src/offlineFallback.ts rename to packages/workbox-swkit/src/recipes/offlineFallback.ts index bd2b952..2501aea 100644 --- a/packages/workbox-recipes/src/offlineFallback.ts +++ b/packages/workbox-swkit/src/recipes/offlineFallback.ts @@ -6,9 +6,9 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler, RouteHandlerCallbackOptions } from '@vite-pwa/workbox-core' -import { matchPrecache } from '@vite-pwa/workbox-precaching' -import { setCatchHandler } from '@vite-pwa/workbox-routing' +import type { RouteHandler, RouteHandlerCallbackOptions } from '../core/types' +import { matchPrecache } from '../precaching/matchPrecache' +import { setCatchHandler } from '../routing/setCatchHandler' export interface OfflineFallbackOptions { pageFallback?: string diff --git a/packages/workbox-recipes/src/pageCache.ts b/packages/workbox-swkit/src/recipes/pageCache.ts similarity index 89% rename from packages/workbox-recipes/src/pageCache.ts rename to packages/workbox-swkit/src/recipes/pageCache.ts index c150a4b..0449de9 100644 --- a/packages/workbox-recipes/src/pageCache.ts +++ b/packages/workbox-swkit/src/recipes/pageCache.ts @@ -10,10 +10,10 @@ import type { RouteMatchCallback, RouteMatchCallbackOptions, WorkboxPlugin, -} from '@vite-pwa/workbox-core' -import { CacheableResponsePlugin } from '@vite-pwa/workbox-cacheable-response' -import { registerRoute } from '@vite-pwa/workbox-routing' -import { NetworkFirst } from '@vite-pwa/workbox-strategies' +} from '../core/types' +import { CacheableResponsePlugin } from '../cacheable-response/CacheableResponsePlugin' +import { registerRoute } from '../routing/registerRoute' +import { NetworkFirst } from '../strategies/NetworkFirst' import { warmStrategyCache } from './warmStrategyCache' export interface PageCacheOptions { diff --git a/packages/workbox-recipes/src/staticResourceCache.ts b/packages/workbox-swkit/src/recipes/staticResourceCache.ts similarity index 89% rename from packages/workbox-recipes/src/staticResourceCache.ts rename to packages/workbox-swkit/src/recipes/staticResourceCache.ts index 82a4f4d..9bac097 100644 --- a/packages/workbox-recipes/src/staticResourceCache.ts +++ b/packages/workbox-swkit/src/recipes/staticResourceCache.ts @@ -10,10 +10,10 @@ import type { RouteMatchCallback, RouteMatchCallbackOptions, WorkboxPlugin, -} from '@vite-pwa/workbox-core' -import { CacheableResponsePlugin } from '@vite-pwa/workbox-cacheable-response' -import { registerRoute } from '@vite-pwa/workbox-routing' -import { StaleWhileRevalidate } from '@vite-pwa/workbox-strategies' +} from '../core/types' +import { CacheableResponsePlugin } from '../cacheable-response/CacheableResponsePlugin' +import { registerRoute } from '../routing/registerRoute' +import { StaleWhileRevalidate } from '../strategies/StaleWhileRevalidate' import { warmStrategyCache } from './warmStrategyCache' export interface StaticResourceOptions { diff --git a/packages/workbox-recipes/src/warmStrategyCache.ts b/packages/workbox-swkit/src/recipes/warmStrategyCache.ts similarity index 93% rename from packages/workbox-recipes/src/warmStrategyCache.ts rename to packages/workbox-swkit/src/recipes/warmStrategyCache.ts index 0fada5e..8b2b438 100644 --- a/packages/workbox-recipes/src/warmStrategyCache.ts +++ b/packages/workbox-swkit/src/recipes/warmStrategyCache.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { Strategy } from '@vite-pwa/workbox-strategies' +import type { Strategy } from '../strategies/Strategy' export interface WarmStrategyCacheOptions { urls: Array diff --git a/packages/workbox-routing/src/NavigationRoute.ts b/packages/workbox-swkit/src/routing/NavigationRoute.ts similarity index 96% rename from packages/workbox-routing/src/NavigationRoute.ts rename to packages/workbox-swkit/src/routing/NavigationRoute.ts index 9a9cf19..e35714c 100644 --- a/packages/workbox-routing/src/NavigationRoute.ts +++ b/packages/workbox-swkit/src/routing/NavigationRoute.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler, RouteMatchCallbackOptions } from '@vite-pwa/workbox-core' -import { assert, logger } from '@vite-pwa/workbox-core/internals' +import type { RouteHandler, RouteMatchCallbackOptions } from '../core/types' +import { assert, logger } from '../core/internals' import { Route } from './Route' diff --git a/packages/workbox-routing/src/RegExpRoute.ts b/packages/workbox-swkit/src/routing/RegExpRoute.ts similarity index 96% rename from packages/workbox-routing/src/RegExpRoute.ts rename to packages/workbox-swkit/src/routing/RegExpRoute.ts index ebd3548..e3dd351 100644 --- a/packages/workbox-routing/src/RegExpRoute.ts +++ b/packages/workbox-swkit/src/routing/RegExpRoute.ts @@ -10,9 +10,9 @@ import type { RouteHandler, RouteMatchCallback, RouteMatchCallbackOptions, -} from '@vite-pwa/workbox-core' +} from '../core/types' import type { HTTPMethod } from './utils/constants' -import { assert, logger } from '@vite-pwa/workbox-core/internals' +import { assert, logger } from '../core/internals' import { Route } from './Route' /** diff --git a/packages/workbox-routing/src/Route.ts b/packages/workbox-swkit/src/routing/Route.ts similarity index 96% rename from packages/workbox-routing/src/Route.ts rename to packages/workbox-swkit/src/routing/Route.ts index 1926035..0e4ffe4 100644 --- a/packages/workbox-routing/src/Route.ts +++ b/packages/workbox-swkit/src/routing/Route.ts @@ -10,9 +10,9 @@ import type { RouteHandler, RouteHandlerObject, RouteMatchCallback, -} from '@vite-pwa/workbox-core' +} from '../core/types' import type { HTTPMethod } from './utils/constants' -import { assert } from '@vite-pwa/workbox-core/internals' +import { assert } from '../core/internals' import { defaultMethod, validMethods } from './utils/constants' import { normalizeHandler } from './utils/normalizeHandler' diff --git a/packages/workbox-routing/src/Router.ts b/packages/workbox-swkit/src/routing/Router.ts similarity index 99% rename from packages/workbox-routing/src/Router.ts rename to packages/workbox-swkit/src/routing/Router.ts index 5f97d67..1edc0b4 100644 --- a/packages/workbox-routing/src/Router.ts +++ b/packages/workbox-swkit/src/routing/Router.ts @@ -11,10 +11,10 @@ import type { RouteHandlerCallbackOptions, RouteHandlerObject, RouteMatchCallbackOptions, -} from '@vite-pwa/workbox-core' +} from '../core/types' import type { Route } from './Route' import type { HTTPMethod } from './utils/constants' -import { assert, getFriendlyURL, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, getFriendlyURL, logger, WorkboxError } from '../core/internals' import { defaultMethod } from './utils/constants' import { normalizeHandler } from './utils/normalizeHandler' diff --git a/packages/workbox-routing/src/_types.ts b/packages/workbox-swkit/src/routing/_types.ts similarity index 100% rename from packages/workbox-routing/src/_types.ts rename to packages/workbox-swkit/src/routing/_types.ts diff --git a/packages/workbox-swkit/src/routing/index.ts b/packages/workbox-swkit/src/routing/index.ts new file mode 100644 index 0000000..ec6a29b --- /dev/null +++ b/packages/workbox-swkit/src/routing/index.ts @@ -0,0 +1,16 @@ +/* + Copyright 2018 Google LLC, Vite PWA's Team + + Use of this source code is governed by an MIT-style + license that can be found in the LICENSE file or at + https://opensource.org/licenses/MIT. +*/ + +export type { NavigationRouteMatchOptions } from './NavigationRoute' +export { NavigationRoute } from './NavigationRoute' +export { RegExpRoute } from './RegExpRoute' +export { registerRoute } from './registerRoute' +export { Route } from './Route' +export { Router } from './Router' +export { setCatchHandler } from './setCatchHandler' +export { setDefaultHandler } from './setDefaultHandler' diff --git a/packages/workbox-routing/src/registerRoute.ts b/packages/workbox-swkit/src/routing/registerRoute.ts similarity index 96% rename from packages/workbox-routing/src/registerRoute.ts rename to packages/workbox-swkit/src/routing/registerRoute.ts index 0b256bf..83e0cf8 100644 --- a/packages/workbox-routing/src/registerRoute.ts +++ b/packages/workbox-swkit/src/routing/registerRoute.ts @@ -6,9 +6,9 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler, RouteMatchCallback } from '@vite-pwa/workbox-core' +import type { RouteHandler, RouteMatchCallback } from '../core/types' import type { HTTPMethod } from './utils/constants' -import { logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { logger, WorkboxError } from '../core/internals' import { RegExpRoute } from './RegExpRoute' import { Route } from './Route' diff --git a/packages/workbox-routing/src/setCatchHandler.ts b/packages/workbox-swkit/src/routing/setCatchHandler.ts similarity index 92% rename from packages/workbox-routing/src/setCatchHandler.ts rename to packages/workbox-swkit/src/routing/setCatchHandler.ts index ed8ecb6..afdf28f 100644 --- a/packages/workbox-routing/src/setCatchHandler.ts +++ b/packages/workbox-swkit/src/routing/setCatchHandler.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler } from '@vite-pwa/workbox-core' +import type { RouteHandler } from '../core/types' import { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter' diff --git a/packages/workbox-routing/src/setDefaultHandler.ts b/packages/workbox-swkit/src/routing/setDefaultHandler.ts similarity index 93% rename from packages/workbox-routing/src/setDefaultHandler.ts rename to packages/workbox-swkit/src/routing/setDefaultHandler.ts index 20d8a2f..b978d8c 100644 --- a/packages/workbox-routing/src/setDefaultHandler.ts +++ b/packages/workbox-swkit/src/routing/setDefaultHandler.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler } from '@vite-pwa/workbox-core' +import type { RouteHandler } from '../core/types' import { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter' diff --git a/packages/workbox-swkit/src/routing/types.ts b/packages/workbox-swkit/src/routing/types.ts new file mode 100644 index 0000000..f765a40 --- /dev/null +++ b/packages/workbox-swkit/src/routing/types.ts @@ -0,0 +1,2 @@ +export type { NavigationRouteMatchOptions } from './NavigationRoute' +export type { HTTPMethod } from './utils/constants' diff --git a/packages/workbox-routing/src/utils/constants.ts b/packages/workbox-swkit/src/routing/utils/constants.ts similarity index 100% rename from packages/workbox-routing/src/utils/constants.ts rename to packages/workbox-swkit/src/routing/utils/constants.ts diff --git a/packages/workbox-routing/src/utils/getOrCreateDefaultRouter.ts b/packages/workbox-swkit/src/routing/utils/getOrCreateDefaultRouter.ts similarity index 100% rename from packages/workbox-routing/src/utils/getOrCreateDefaultRouter.ts rename to packages/workbox-swkit/src/routing/utils/getOrCreateDefaultRouter.ts diff --git a/packages/workbox-routing/src/utils/normalizeHandler.ts b/packages/workbox-swkit/src/routing/utils/normalizeHandler.ts similarity index 89% rename from packages/workbox-routing/src/utils/normalizeHandler.ts rename to packages/workbox-swkit/src/routing/utils/normalizeHandler.ts index b4c8bcc..56e471d 100644 --- a/packages/workbox-routing/src/utils/normalizeHandler.ts +++ b/packages/workbox-swkit/src/routing/utils/normalizeHandler.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { RouteHandler, RouteHandlerObject } from '@vite-pwa/workbox-core' -import { assert } from '@vite-pwa/workbox-core/internals' +import type { RouteHandler, RouteHandlerObject } from '../../core/types' +import { assert } from '../../core/internals' /** * @param {function() | object} handler Either a function, or an object with a diff --git a/packages/workbox-strategies/src/CacheFirst.ts b/packages/workbox-swkit/src/strategies/CacheFirst.ts similarity index 94% rename from packages/workbox-strategies/src/CacheFirst.ts rename to packages/workbox-swkit/src/strategies/CacheFirst.ts index fc52bb6..dd158db 100644 --- a/packages/workbox-strategies/src/CacheFirst.ts +++ b/packages/workbox-swkit/src/strategies/CacheFirst.ts @@ -7,7 +7,7 @@ */ import type { StrategyHandler } from './StrategyHandler' -import { assert, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, WorkboxError } from '../core/internals' import { Strategy } from './Strategy' import { messages } from './utils/messages' @@ -26,7 +26,7 @@ class CacheFirst extends Strategy { /** * @private * @param request {Request|string} A request to run this strategy for. - * @param handler {import('@vite-pwa/workbox-strategies').StrategyHandler} The event that + * @param handler {import('./index').StrategyHandler} The event that * triggered the request. * @return {Promise} */ diff --git a/packages/workbox-strategies/src/CacheOnly.ts b/packages/workbox-swkit/src/strategies/CacheOnly.ts similarity index 96% rename from packages/workbox-strategies/src/CacheOnly.ts rename to packages/workbox-swkit/src/strategies/CacheOnly.ts index 5fa7504..374f9dc 100644 --- a/packages/workbox-strategies/src/CacheOnly.ts +++ b/packages/workbox-swkit/src/strategies/CacheOnly.ts @@ -8,7 +8,7 @@ import type { StrategyHandler } from './StrategyHandler' -import { assert, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, WorkboxError } from '../core/internals' import { Strategy } from './Strategy' import { messages } from './utils/messages' diff --git a/packages/workbox-strategies/src/NetworkFirst.ts b/packages/workbox-swkit/src/strategies/NetworkFirst.ts similarity index 99% rename from packages/workbox-strategies/src/NetworkFirst.ts rename to packages/workbox-swkit/src/strategies/NetworkFirst.ts index 5a34382..af10b78 100644 --- a/packages/workbox-strategies/src/NetworkFirst.ts +++ b/packages/workbox-swkit/src/strategies/NetworkFirst.ts @@ -9,7 +9,7 @@ import type { StrategyOptions } from './Strategy' import type { StrategyHandler } from './StrategyHandler' -import { assert, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, WorkboxError } from '../core/internals' import { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin' import { Strategy } from './Strategy' import { messages } from './utils/messages' diff --git a/packages/workbox-strategies/src/NetworkOnly.ts b/packages/workbox-swkit/src/strategies/NetworkOnly.ts similarity index 97% rename from packages/workbox-strategies/src/NetworkOnly.ts rename to packages/workbox-swkit/src/strategies/NetworkOnly.ts index 7f1a305..b35a5ed 100644 --- a/packages/workbox-strategies/src/NetworkOnly.ts +++ b/packages/workbox-swkit/src/strategies/NetworkOnly.ts @@ -8,7 +8,7 @@ import type { StrategyOptions } from './Strategy' import type { StrategyHandler } from './StrategyHandler' -import { assert, logger, timeout, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, timeout, WorkboxError } from '../core/internals' import { Strategy } from './Strategy' import { messages } from './utils/messages' diff --git a/packages/workbox-strategies/src/StaleWhileRevalidate.ts b/packages/workbox-swkit/src/strategies/StaleWhileRevalidate.ts similarity index 98% rename from packages/workbox-strategies/src/StaleWhileRevalidate.ts rename to packages/workbox-swkit/src/strategies/StaleWhileRevalidate.ts index 2f92af2..ca99208 100644 --- a/packages/workbox-strategies/src/StaleWhileRevalidate.ts +++ b/packages/workbox-swkit/src/strategies/StaleWhileRevalidate.ts @@ -8,7 +8,7 @@ import type { StrategyOptions } from './Strategy' import type { StrategyHandler } from './StrategyHandler' -import { assert, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import { assert, logger, WorkboxError } from '../core/internals' import { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin' import { Strategy } from './Strategy' import { messages } from './utils/messages' diff --git a/packages/workbox-strategies/src/Strategy.ts b/packages/workbox-swkit/src/strategies/Strategy.ts similarity index 99% rename from packages/workbox-strategies/src/Strategy.ts rename to packages/workbox-swkit/src/strategies/Strategy.ts index 55786d1..fd765ad 100644 --- a/packages/workbox-strategies/src/Strategy.ts +++ b/packages/workbox-swkit/src/strategies/Strategy.ts @@ -10,13 +10,13 @@ import type { HandlerCallbackOptions, RouteHandlerObject, WorkboxPlugin, -} from '@vite-pwa/workbox-core' +} from '../core/types' import { privateCacheNames as cacheNames, getFriendlyURL, logger, WorkboxError, -} from '@vite-pwa/workbox-core/internals' +} from '../core/internals' import { StrategyHandler } from './StrategyHandler' export interface StrategyOptions { diff --git a/packages/workbox-strategies/src/StrategyHandler.ts b/packages/workbox-swkit/src/strategies/StrategyHandler.ts similarity index 99% rename from packages/workbox-strategies/src/StrategyHandler.ts rename to packages/workbox-swkit/src/strategies/StrategyHandler.ts index 6d3e2c0..8f96e77 100644 --- a/packages/workbox-strategies/src/StrategyHandler.ts +++ b/packages/workbox-swkit/src/strategies/StrategyHandler.ts @@ -11,7 +11,7 @@ import type { MapLikeObject, WorkboxPlugin, WorkboxPluginCallbackParam, -} from '@vite-pwa/workbox-core' +} from '../core/types' import type { Strategy } from './Strategy' import { assert, @@ -22,7 +22,7 @@ import { logger, timeout, WorkboxError, -} from '@vite-pwa/workbox-core/internals' +} from '../core/internals' function toRequest(input: RequestInfo) { return typeof input === 'string' ? new Request(input) : input diff --git a/packages/workbox-strategies/src/index.ts b/packages/workbox-swkit/src/strategies/index.ts similarity index 100% rename from packages/workbox-strategies/src/index.ts rename to packages/workbox-swkit/src/strategies/index.ts diff --git a/packages/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts b/packages/workbox-swkit/src/strategies/plugins/cacheOkAndOpaquePlugin.ts similarity index 91% rename from packages/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts rename to packages/workbox-swkit/src/strategies/plugins/cacheOkAndOpaquePlugin.ts index fb3fdd7..eb0f2ba 100644 --- a/packages/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts +++ b/packages/workbox-swkit/src/strategies/plugins/cacheOkAndOpaquePlugin.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { WorkboxPlugin } from '@vite-pwa/workbox-core' +import type { WorkboxPlugin } from '../../core/types' export const cacheOkAndOpaquePlugin: WorkboxPlugin = { /** diff --git a/packages/workbox-strategies/src/utils/messages.ts b/packages/workbox-swkit/src/strategies/utils/messages.ts similarity index 89% rename from packages/workbox-strategies/src/utils/messages.ts rename to packages/workbox-swkit/src/strategies/utils/messages.ts index c794053..efe6578 100644 --- a/packages/workbox-strategies/src/utils/messages.ts +++ b/packages/workbox-swkit/src/strategies/utils/messages.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { getFriendlyURL, logger } from '@vite-pwa/workbox-core/internals' +import { getFriendlyURL, logger } from '../../core/internals' export const messages = { strategyStart: (strategyName: string, request: Request): string => diff --git a/packages/workbox-streams/src/concatenate.ts b/packages/workbox-swkit/src/streams/concatenate.ts similarity index 97% rename from packages/workbox-streams/src/concatenate.ts rename to packages/workbox-swkit/src/streams/concatenate.ts index 519b0f8..642ea22 100644 --- a/packages/workbox-streams/src/concatenate.ts +++ b/packages/workbox-swkit/src/streams/concatenate.ts @@ -6,8 +6,8 @@ https://opensource.org/licenses/MIT. */ -import type { StreamSource } from './_types' -import { assert, Deferred, logger, WorkboxError } from '@vite-pwa/workbox-core/internals' +import type { StreamSource } from './types' +import { assert, Deferred, logger, WorkboxError } from '../core/internals' /** * Takes either a Response, a ReadableStream, or a diff --git a/packages/workbox-streams/src/concatenateToResponse.ts b/packages/workbox-swkit/src/streams/concatenateToResponse.ts similarity index 97% rename from packages/workbox-streams/src/concatenateToResponse.ts rename to packages/workbox-swkit/src/streams/concatenateToResponse.ts index 5caf6ce..71c4bb3 100644 --- a/packages/workbox-streams/src/concatenateToResponse.ts +++ b/packages/workbox-swkit/src/streams/concatenateToResponse.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import type { StreamSource } from './_types' +import type { StreamSource } from './types' import { concatenate } from './concatenate' import { createHeaders } from './utils/createHeaders' diff --git a/packages/workbox-streams/src/index.ts b/packages/workbox-swkit/src/streams/index.ts similarity index 95% rename from packages/workbox-streams/src/index.ts rename to packages/workbox-swkit/src/streams/index.ts index 4940f23..2acf7b7 100644 --- a/packages/workbox-streams/src/index.ts +++ b/packages/workbox-swkit/src/streams/index.ts @@ -20,4 +20,4 @@ export { StreamsHandlerCallback, } -export * from './_types' +export * from './types' diff --git a/packages/workbox-streams/src/isSupported.ts b/packages/workbox-swkit/src/streams/isSupported.ts similarity index 90% rename from packages/workbox-streams/src/isSupported.ts rename to packages/workbox-swkit/src/streams/isSupported.ts index 17020b3..f10c46f 100644 --- a/packages/workbox-streams/src/isSupported.ts +++ b/packages/workbox-swkit/src/streams/isSupported.ts @@ -6,7 +6,7 @@ https://opensource.org/licenses/MIT. */ -import { canConstructReadableStream } from '@vite-pwa/workbox-core/internals' +import { canConstructReadableStream } from '../core/internals' /** * This is a utility method that determines whether the current browser supports diff --git a/packages/workbox-streams/src/strategy.ts b/packages/workbox-swkit/src/streams/strategy.ts similarity index 95% rename from packages/workbox-streams/src/strategy.ts rename to packages/workbox-swkit/src/streams/strategy.ts index 880df49..180269d 100644 --- a/packages/workbox-streams/src/strategy.ts +++ b/packages/workbox-swkit/src/streams/strategy.ts @@ -9,9 +9,9 @@ import type { RouteHandlerCallback, RouteHandlerCallbackOptions, -} from '@vite-pwa/workbox-core' -import type { StreamSource } from './_types' -import { logger } from '@vite-pwa/workbox-core/internals' +} from '../core/types' +import type { StreamSource } from './types' +import { logger } from '../core/internals' import { concatenateToResponse } from './concatenateToResponse' import { isSupported } from './isSupported' import { createHeaders } from './utils/createHeaders' diff --git a/packages/workbox-streams/src/_types.ts b/packages/workbox-swkit/src/streams/types.ts similarity index 100% rename from packages/workbox-streams/src/_types.ts rename to packages/workbox-swkit/src/streams/types.ts diff --git a/packages/workbox-streams/src/utils/createHeaders.ts b/packages/workbox-swkit/src/streams/utils/createHeaders.ts similarity index 100% rename from packages/workbox-streams/src/utils/createHeaders.ts rename to packages/workbox-swkit/src/streams/utils/createHeaders.ts diff --git a/packages/workbox-sw/src/index.ts b/packages/workbox-swkit/src/sw/index.ts similarity index 100% rename from packages/workbox-sw/src/index.ts rename to packages/workbox-swkit/src/sw/index.ts diff --git a/packages/workbox-sw/src/workbox-sw.ts b/packages/workbox-swkit/src/sw/workbox-sw.ts similarity index 100% rename from packages/workbox-sw/src/workbox-sw.ts rename to packages/workbox-swkit/src/sw/workbox-sw.ts diff --git a/packages/workbox-swkit/src/types.ts b/packages/workbox-swkit/src/types.ts new file mode 100644 index 0000000..3aa09c8 --- /dev/null +++ b/packages/workbox-swkit/src/types.ts @@ -0,0 +1,13 @@ +export type * from './background-sync/types' +export type * from './broadcast-update/types' +export type * from './cacheable-response/types' +export type * from './core/types' +export type * from './expiration/types' +export type * from './precaching' +export type * from './range-requests' +export type * from './recipes' +export type * from './routing/types' +export type * from './strategies' +export type * from './streams/types' +export type * from './sw' +export type * from './types' diff --git a/packages/workbox-swkit/tsdown.config.ts b/packages/workbox-swkit/tsdown.config.ts new file mode 100644 index 0000000..296d944 --- /dev/null +++ b/packages/workbox-swkit/tsdown.config.ts @@ -0,0 +1,39 @@ +import { createRequire } from 'node:module' +import { defineConfig } from 'tsdown' +import { banner, define, exports } from '../../helper.ts' + +const require = createRequire(import.meta.url) +const packageJson = require('./package.json') + +export default defineConfig({ + entry: [ + 'src/index.ts', // <== barrel + 'src/types.ts', // <== all types + 'src/background-sync/index.ts', + 'src/background-sync/types.ts', + 'src/broadcast-update/index.ts', + 'src/broadcast-update/types.ts', + 'src/cacheable-response/index.ts', + 'src/cacheable-response/types.ts', + 'src/core/index.ts', + 'src/core/types.ts', + 'src/expiration/index.ts', + 'src/expiration/types.ts', + 'src/navigation-preload/index.ts', + 'src/precaching/index.ts', + 'src/precaching/types.ts', + 'src/range-requests/index.ts', + 'src/recipes/index.ts', + 'src/routing/index.ts', + 'src/routing/types.ts', + 'src/strategies/index.ts', + 'src/streams/index.ts', + 'src/streams/types.ts', + 'src/sw/index.ts', + ], + platform: 'browser', + banner, + define, + noExternal: ['idb'], + exports, +}) diff --git a/packages/workbox-window/tsdown.config.ts b/packages/workbox-window/tsdown.config.ts index 1ba9d65..e2a6727 100644 --- a/packages/workbox-window/tsdown.config.ts +++ b/packages/workbox-window/tsdown.config.ts @@ -1,16 +1,9 @@ import { defineConfig } from 'tsdown' +import { banner, define } from '../../helper.ts' export default defineConfig({ entry: './src/index.ts', platform: 'browser', - banner: `/* - Copyright 2019 Google LLC, Vite PWA's Team - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. -*/`, - define: { - 'process.env.NODE_ENV': 'process.env.NODE_ENV', - }, + banner, + define, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9890c4a..e1b3306 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,8 +10,8 @@ catalogs: specifier: ^10.3.1 version: 10.3.1 tsdown: - specifier: ^0.15.7 - version: 0.15.7 + specifier: https://pkg.pr.new/tsdown@c4f9764 + version: 0.15.9 eslint: '@antfu/eslint-config': specifier: ^6.0.0 @@ -22,6 +22,13 @@ catalogs: eslint-plugin-antfu: specifier: ^3.1.1 version: 3.1.1 + testing: + '@vitest/ui': + specifier: ^3.2.4 + version: 3.2.4 + vitest: + specifier: ^3.2.4 + version: 3.2.4 types: '@types/node': specifier: ^22.9.3 @@ -43,9 +50,24 @@ catalogs: idb: specifier: ^8.0.3 version: 8.0.3 + pathe: + specifier: ^2.0.3 + version: 2.0.3 + pkg-types: + specifier: ^2.3.0 + version: 2.3.0 + proper-tags: + specifier: ^2.0.2 + version: 2.0.2 + recast: + specifier: ^0.23.11 + version: 0.23.11 taze: specifier: ^19.7.0 version: 19.7.0 + valibot: + specifier: ^1.1.0 + version: 1.1.0 overrides: '@typescript-eslint/utils': ^8.45.0 @@ -56,7 +78,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: catalog:eslint - version: 6.0.0(@vue/compiler-sfc@3.5.22)(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) + version: 6.0.0(@vue/compiler-sfc@3.5.22)(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)(vitest@3.2.4) '@antfu/ni': specifier: catalog:utils version: 25.0.0 @@ -72,9 +94,12 @@ importers: '@typescript-eslint/utils': specifier: ^8.45.0 version: 8.46.1(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) + '@vitest/ui': + specifier: catalog:testing + version: 3.2.4(vitest@3.2.4) bumpp: specifier: catalog:build - version: 10.3.1 + version: 10.3.1(magicast@0.3.5) eslint: specifier: catalog:eslint version: 9.37.0(jiti@2.6.1) @@ -86,111 +111,50 @@ importers: version: 19.7.0 tsdown: specifier: catalog:build - version: 0.15.7(typescript@5.9.3) + version: https://pkg.pr.new/tsdown@c4f9764(typescript@5.9.3) + tsx: + specifier: ^4.20.6 + version: 4.20.6 typescript: specifier: catalog:typescript version: 5.9.3 + vitest: + specifier: catalog:testing + version: 3.2.4(@types/debug@4.1.12)(@types/node@22.18.10)(@vitest/ui@3.2.4)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) - packages/workbox-background-sync: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - idb: - specifier: catalog:utils - version: 8.0.3 - - packages/workbox-broadcast-update: + packages/workbox-build: dependencies: - '@vite-pwa/workbox-core': + '@vite-pwa/workbox-swkit': specifier: workspace:* - version: link:../workbox-core - - packages/workbox-cacheable-response: - dependencies: - '@vite-pwa/workbox-core': + version: link:../workbox-swkit + '@vite-pwa/workbox-window': specifier: workspace:* - version: link:../workbox-core - - packages/workbox-core: {} + version: link:../workbox-window + magicast: + specifier: file:magicast-0.3.5.tgz + version: file:packages/workbox-build/magicast-0.3.5.tgz + pathe: + specifier: catalog:utils + version: 2.0.3 + pkg-types: + specifier: catalog:utils + version: 2.3.0 + proper-tags: + specifier: catalog:utils + version: 2.0.2 + recast: + specifier: catalog:utils + version: 0.23.11 + valibot: + specifier: catalog:utils + version: 1.1.0(typescript@5.9.3) - packages/workbox-expiration: + packages/workbox-swkit: dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core idb: specifier: catalog:utils version: 8.0.3 - packages/workbox-navigation-preload: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - - packages/workbox-precaching: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - '@vite-pwa/workbox-routing': - specifier: workspace:* - version: link:../workbox-routing - '@vite-pwa/workbox-strategies': - specifier: workspace:* - version: link:../workbox-strategies - - packages/workbox-range-requests: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - - packages/workbox-recipes: - dependencies: - '@vite-pwa/workbox-cacheable-response': - specifier: workspace:* - version: link:../workbox-cacheable-response - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - '@vite-pwa/workbox-expiration': - specifier: workspace:* - version: link:../workbox-expiration - '@vite-pwa/workbox-precaching': - specifier: workspace:* - version: link:../workbox-precaching - '@vite-pwa/workbox-routing': - specifier: workspace:* - version: link:../workbox-routing - '@vite-pwa/workbox-strategies': - specifier: workspace:* - version: link:../workbox-strategies - - packages/workbox-routing: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - - packages/workbox-strategies: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - - packages/workbox-streams: - dependencies: - '@vite-pwa/workbox-core': - specifier: workspace:* - version: link:../workbox-core - '@vite-pwa/workbox-routing': - specifier: workspace:* - version: link:../workbox-routing - - packages/workbox-sw: {} - packages/workbox-window: dependencies: '@types/trusted-types': @@ -329,6 +293,162 @@ packages: resolution: {integrity: sha512-smMc5pDht/UVsCD3hhw/a/e/p8m0RdRYiluXToVfd+d4yaQQh7nn9bACjkk6nXJvat7EWPAxuFkMEFfrxeGa3Q==} engines: {node: '>=20.11.0'} + '@esbuild/aix-ppc64@0.25.11': + resolution: {integrity: sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.11': + resolution: {integrity: sha512-9slpyFBc4FPPz48+f6jyiXOx/Y4v34TUeDDXJpZqAWQn/08lKGeD8aDp9TMn9jDz2CiEuHwfhRmGBvpnd/PWIQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.11': + resolution: {integrity: sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.11': + resolution: {integrity: sha512-Sgiab4xBjPU1QoPEIqS3Xx+R2lezu0LKIEcYe6pftr56PqPygbB7+szVnzoShbx64MUupqoE0KyRlN7gezbl8g==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.11': + resolution: {integrity: sha512-VekY0PBCukppoQrycFxUqkCojnTQhdec0vevUL/EDOCnXd9LKWqD/bHwMPzigIJXPhC59Vd1WFIL57SKs2mg4w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.11': + resolution: {integrity: sha512-+hfp3yfBalNEpTGp9loYgbknjR695HkqtY3d3/JjSRUyPg/xd6q+mQqIb5qdywnDxRZykIHs3axEqU6l1+oWEQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.11': + resolution: {integrity: sha512-CmKjrnayyTJF2eVuO//uSjl/K3KsMIeYeyN7FyDBjsR3lnSJHaXlVoAK8DZa7lXWChbuOk7NjAc7ygAwrnPBhA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.11': + resolution: {integrity: sha512-Dyq+5oscTJvMaYPvW3x3FLpi2+gSZTCE/1ffdwuM6G1ARang/mb3jvjxs0mw6n3Lsw84ocfo9CrNMqc5lTfGOw==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.11': + resolution: {integrity: sha512-Qr8AzcplUhGvdyUF08A1kHU3Vr2O88xxP0Tm8GcdVOUm25XYcMPp2YqSVHbLuXzYQMf9Bh/iKx7YPqECs6ffLA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.11': + resolution: {integrity: sha512-TBMv6B4kCfrGJ8cUPo7vd6NECZH/8hPpBHHlYI3qzoYFvWu2AdTvZNuU/7hsbKWqu/COU7NIK12dHAAqBLLXgw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.11': + resolution: {integrity: sha512-TmnJg8BMGPehs5JKrCLqyWTVAvielc615jbkOirATQvWWB1NMXY77oLMzsUjRLa0+ngecEmDGqt5jiDC6bfvOw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.11': + resolution: {integrity: sha512-DIGXL2+gvDaXlaq8xruNXUJdT5tF+SBbJQKbWy/0J7OhU8gOHOzKmGIlfTTl6nHaCOoipxQbuJi7O++ldrxgMw==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.11': + resolution: {integrity: sha512-Osx1nALUJu4pU43o9OyjSCXokFkFbyzjXb6VhGIJZQ5JZi8ylCQ9/LFagolPsHtgw6himDSyb5ETSfmp4rpiKQ==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.11': + resolution: {integrity: sha512-nbLFgsQQEsBa8XSgSTSlrnBSrpoWh7ioFDUmwo158gIm5NNP+17IYmNWzaIzWmgCxq56vfr34xGkOcZ7jX6CPw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.11': + resolution: {integrity: sha512-HfyAmqZi9uBAbgKYP1yGuI7tSREXwIb438q0nqvlpxAOs3XnZ8RsisRfmVsgV486NdjD7Mw2UrFSw51lzUk1ww==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.11': + resolution: {integrity: sha512-HjLqVgSSYnVXRisyfmzsH6mXqyvj0SA7pG5g+9W7ESgwA70AXYNpfKBqh1KbTxmQVaYxpzA/SvlB9oclGPbApw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.11': + resolution: {integrity: sha512-HSFAT4+WYjIhrHxKBwGmOOSpphjYkcswF449j6EjsjbinTZbp8PJtjsVK1XFJStdzXdy/jaddAep2FGY+wyFAQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.11': + resolution: {integrity: sha512-hr9Oxj1Fa4r04dNpWr3P8QKVVsjQhqrMSUzZzf+LZcYjZNqhA3IAfPQdEh1FLVUJSiu6sgAwp3OmwBfbFgG2Xg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.11': + resolution: {integrity: sha512-u7tKA+qbzBydyj0vgpu+5h5AeudxOAGncb8N6C9Kh1N4n7wU1Xw1JDApsRjpShRpXRQlJLb9wY28ELpwdPcZ7A==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.11': + resolution: {integrity: sha512-Qq6YHhayieor3DxFOoYM1q0q1uMFYb7cSpLD2qzDSvK1NAvqFi8Xgivv0cFC6J+hWVw2teCYltyy9/m/14ryHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.11': + resolution: {integrity: sha512-CN+7c++kkbrckTOz5hrehxWN7uIhFFlmS/hqziSFVWpAzpWrQoAG4chH+nN3Be+Kzv/uuo7zhX716x3Sn2Jduw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.11': + resolution: {integrity: sha512-rOREuNIQgaiR+9QuNkbkxubbp8MSO9rONmwP5nKncnWJ9v5jQ4JxFnLu4zDSRPf3x4u+2VN4pM4RdyIzDty/wQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.25.11': + resolution: {integrity: sha512-nq2xdYaWxyg9DcIyXkZhcYulC6pQ2FuCgem3LI92IwMgIZ69KHeY8T4Y88pcwoLIjbed8n36CyKoYRDygNSGhA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.11': + resolution: {integrity: sha512-3XxECOWJq1qMZ3MN8srCJ/QfoLpL+VaxD/WfNRm1O3B4+AZ/BnLVgFbUV3eiRYDMXetciH16dwPbbHqwe1uU0Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.11': + resolution: {integrity: sha512-3ukss6gb9XZ8TlRyJlgLn17ecsK4NSQTmdIXRASVsiS2sQ6zPPZklNJT5GR5tE/MUarymmy8kCEf5xPCNCqVOA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.11': + resolution: {integrity: sha512-D7Hpz6A2L4hzsRpPaCYkQnGOotdUpDzSGRIv9I+1ITdHROSFUWW95ZPZWQmGka1Fg7W3zFJowyn9WGwMJ0+KPA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-plugin-eslint-comments@4.5.0': resolution: {integrity: sha512-MAhuTKlr4y/CE3WYX26raZjy+I/kS2PLKSzvfmDCGrBLTFHOYwqROZdr4XwPgXwX3K9rjzMr4pSmUWGnzsUyMg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -441,101 +561,214 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@oxc-project/types@0.94.0': - resolution: {integrity: sha512-+UgQT/4o59cZfH6Cp7G0hwmqEQ0wE+AdIwhikdwnhWI9Dp8CgSY081+Q3O67/wq3VJu8mgUEB93J9EHHn70fOw==} + '@oxc-project/types@0.95.0': + resolution: {integrity: sha512-vACy7vhpMPhjEJhULNxrdR0D943TkA/MigMpJCHmBHvMXxRStRi/dPtTlfQ3uDwWSzRpT8z+7ImjZVf8JWBocQ==} '@pkgr/core@0.2.9': resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + '@quansync/fs@0.1.5': resolution: {integrity: sha512-lNS9hL2aS2NZgNW7BBj+6EBl4rOf8l+tQ0eRY6JWCI8jI2kc53gSoqbjojU0OnAWhzoXiOjFyGsHcDGePB3lhA==} - '@rolldown/binding-android-arm64@1.0.0-beta.43': - resolution: {integrity: sha512-TP8bcPOb1s6UmY5syhXrDn9k0XkYcw+XaoylTN4cJxf0JOVS2j682I3aTcpfT51hOFGr2bRwNKN9RZ19XxeQbA==} + '@rolldown/binding-android-arm64@1.0.0-beta.44': + resolution: {integrity: sha512-g9ejDOehJFhxC1DIXQuZQ9bKv4lRDioOTL42cJjFjqKPl1L7DVb9QQQE1FxokGEIMr6FezLipxwnzOXWe7DNPg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@rolldown/binding-darwin-arm64@1.0.0-beta.43': - resolution: {integrity: sha512-kuVWnZsE4vEjMF/10SbSUyzucIW2zmdsqFghYMqy+fsjXnRHg0luTU6qWF8IqJf4Cbpm9NEZRnjIEPpAbdiSNQ==} + '@rolldown/binding-darwin-arm64@1.0.0-beta.44': + resolution: {integrity: sha512-PxAW1PXLPmCzfhfKIS53kwpjLGTUdIfX4Ht+l9mj05C3lYCGaGowcNsYi2rdxWH24vSTmeK+ajDNRmmmrK0M7g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0-beta.43': - resolution: {integrity: sha512-u9Ps4sh6lcmJ3vgLtyEg/x4jlhI64U0mM93Ew+tlfFdLDe7yKyA+Fe80cpr2n1mNCeZXrvTSbZluKpXQ0GxLjw==} + '@rolldown/binding-darwin-x64@1.0.0-beta.44': + resolution: {integrity: sha512-/CtQqs1oO9uSb5Ju60rZvsdjE7Pzn8EK2ISAdl2jedjMzeD/4neNyCbwyJOAPzU+GIQTZVyrFZJX+t7HXR1R/g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@1.0.0-beta.43': - resolution: {integrity: sha512-h9lUtVtXgfbk/tnicMpbFfZ3DJvk5Zn2IvmlC1/e0+nUfwoc/TFqpfrRRqcNBXk/e+xiWMSKv6b0MF8N+Rtvlg==} + '@rolldown/binding-freebsd-x64@1.0.0-beta.44': + resolution: {integrity: sha512-V5Q5W9c4+2GJ4QabmjmVV6alY97zhC/MZBaLkDtHwGy3qwzbM4DYgXUbun/0a8AH5hGhuU27tUIlYz6ZBlvgOA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.43': - resolution: {integrity: sha512-IX2C6bA6wM2rX/RvD75ko+ix9yxPKjKGGq7pOhB8wGI4Z4fqX5B1nDHga/qMDmAdCAR1m9ymzxkmqhm/AFYf7A==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.44': + resolution: {integrity: sha512-X6adjkHeFqKsTU0FXdNN9HY4LDozPqIfHcnXovE5RkYLWIjMWuc489mIZ6iyhrMbCqMUla9IOsh5dvXSGT9o9A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.43': - resolution: {integrity: sha512-mcjd57vEj+CEQbZAzUiaxNzNgwwgOpFtZBWcINm8DNscvkXl5b/s622Z1dqGNWSdrZmdjdC6LWMvu8iHM6v9sQ==} + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.44': + resolution: {integrity: sha512-kRRKGZI4DXWa6ANFr3dLA85aSVkwPdgXaRjfanwY84tfc3LncDiIjyWCb042e3ckPzYhHSZ3LmisO+cdOIYL6Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.43': - resolution: {integrity: sha512-Pa8QMwlkrztTo/1mVjZmPIQ44tCSci10TBqxzVBvXVA5CFh5EpiEi99fPSll2dHG2uT4dCOMeC6fIhyDdb0zXA==} + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.44': + resolution: {integrity: sha512-hMtiN9xX1NhxXBa2U3Up4XkVcsVp2h73yYtMDY59z9CDLEZLrik9RVLhBL5QtoX4zZKJ8HZKJtWuGYvtmkCbIQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.43': - resolution: {integrity: sha512-BgynXKMjeaX4AfWLARhOKDetBOOghnSiVRjAHVvhiAaDXgdQN8e65mSmXRiVoVtD3cHXx/cfU8Gw0p0K+qYKVQ==} + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.44': + resolution: {integrity: sha512-rd1LzbpXQuR8MTG43JB9VyXDjG7ogSJbIkBpZEHJ8oMKzL6j47kQT5BpIXrg3b5UVygW9QCI2fpFdMocT5Kudg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@rolldown/binding-linux-x64-musl@1.0.0-beta.43': - resolution: {integrity: sha512-VIsoPlOB/tDSAw9CySckBYysoIBqLeps1/umNSYUD8pMtalJyzMTneAVI1HrUdf4ceFmQ5vARoLIXSsPwVFxNg==} + '@rolldown/binding-linux-x64-musl@1.0.0-beta.44': + resolution: {integrity: sha512-qI2IiPqmPRW25exXkuQr3TlweCDc05YvvbSDRPCuPsWkwb70dTiSoXn8iFxT4PWqTi71wWHg1Wyta9PlVhX5VA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@rolldown/binding-openharmony-arm64@1.0.0-beta.43': - resolution: {integrity: sha512-YDXTxVJG67PqTQMKyjVJSddoPbSWJ4yRz/E3xzTLHqNrTDGY0UuhG8EMr8zsYnfH/0cPFJ3wjQd/hJWHuR6nkA==} + '@rolldown/binding-openharmony-arm64@1.0.0-beta.44': + resolution: {integrity: sha512-+vHvEc1pL5iJRFlldLC8mjm6P4Qciyfh2bh5ZI6yxDQKbYhCHRKNURaKz1mFcwxhVL5YMYsLyaqM3qizVif9MQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@rolldown/binding-wasm32-wasi@1.0.0-beta.43': - resolution: {integrity: sha512-3M+2DmorXvDuAIGYQ9Z93Oy1G9ETkejLwdXXb1uRTgKN9pMcu7N+KG2zDrJwqyxeeLIFE22AZGtSJm3PJbNu9Q==} + '@rolldown/binding-wasm32-wasi@1.0.0-beta.44': + resolution: {integrity: sha512-XSgLxRrtFj6RpTeMYmmQDAwHjKseYGKUn5LPiIdW4Cq+f5SBSStL2ToBDxkbdxKPEbCZptnLPQ/nfKcAxrC8Xg==} engines: {node: '>=14.0.0'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.43': - resolution: {integrity: sha512-/B1j1pJs33y9ywtslOMxryUPHq8zIGu/OGEc2gyed0slimJ8fX2uR/SaJVhB4+NEgCFIeYDR4CX6jynAkeRuCA==} + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.44': + resolution: {integrity: sha512-cF1LJdDIX02cJrFrX3wwQ6IzFM7I74BYeKFkzdcIA4QZ0+2WA7/NsKIgjvrunupepWb1Y6PFWdRlHSaz5AW1Wg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.43': - resolution: {integrity: sha512-29oG1swCz7hNP+CQYrsM4EtylsKwuYzM8ljqbqC5TsQwmKat7P8ouDpImsqg/GZxFSXcPP9ezQm0Q0wQwGM3JA==} + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.44': + resolution: {integrity: sha512-5uaJonDafhHiMn+iEh7qUp3QQ4Gihv3lEOxKfN8Vwadpy0e+5o28DWI42DpJ9YBYMrVy4JOWJ/3etB/sptpUwA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.43': - resolution: {integrity: sha512-eWBV1Ef3gfGNehxVGCyXs7wLayRIgCmyItuCZwYYXW5bsk4EvR4n2GP5m3ohjnx7wdiY3nLmwQfH2Knb5gbNZw==} + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.44': + resolution: {integrity: sha512-vsqhWAFJkkmgfBN/lkLCWTXF1PuPhMjfnAyru48KvF7mVh2+K7WkKYHezF3Fjz4X/mPScOcIv+g6cf6wnI6eWg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] - '@rolldown/pluginutils@1.0.0-beta.43': - resolution: {integrity: sha512-5Uxg7fQUCmfhax7FJke2+8B6cqgeUJUD9o2uXIKXhD+mG0mL6NObmVoi9wXEU1tY89mZKgAYA6fTbftx3q2ZPQ==} + '@rolldown/pluginutils@1.0.0-beta.44': + resolution: {integrity: sha512-g6eW7Zwnr2c5RADIoqziHoVs6b3W5QTQ4+qbpfjbkMJ9x+8Og211VW/oot2dj9dVwaK/UyC6Yo+02gV+wWQVNg==} + + '@rollup/rollup-android-arm-eabi@4.52.5': + resolution: {integrity: sha512-8c1vW4ocv3UOMp9K+gToY5zL2XiiVw3k7f1ksf4yO1FlDFQ1C2u72iACFnSOceJFsWskc2WZNqeRhFRPzv+wtQ==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.52.5': + resolution: {integrity: sha512-mQGfsIEFcu21mvqkEKKu2dYmtuSZOBMmAl5CFlPGLY94Vlcm+zWApK7F/eocsNzp8tKmbeBP8yXyAbx0XHsFNA==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.52.5': + resolution: {integrity: sha512-takF3CR71mCAGA+v794QUZ0b6ZSrgJkArC+gUiG6LB6TQty9T0Mqh3m2ImRBOxS2IeYBo4lKWIieSvnEk2OQWA==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.52.5': + resolution: {integrity: sha512-W901Pla8Ya95WpxDn//VF9K9u2JbocwV/v75TE0YIHNTbhqUTv9w4VuQ9MaWlNOkkEfFwkdNhXgcLqPSmHy0fA==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.52.5': + resolution: {integrity: sha512-QofO7i7JycsYOWxe0GFqhLmF6l1TqBswJMvICnRUjqCx8b47MTo46W8AoeQwiokAx3zVryVnxtBMcGcnX12LvA==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.52.5': + resolution: {integrity: sha512-jr21b/99ew8ujZubPo9skbrItHEIE50WdV86cdSoRkKtmWa+DDr6fu2c/xyRT0F/WazZpam6kk7IHBerSL7LDQ==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.52.5': + resolution: {integrity: sha512-PsNAbcyv9CcecAUagQefwX8fQn9LQ4nZkpDboBOttmyffnInRy8R8dSg6hxxl2Re5QhHBf6FYIDhIj5v982ATQ==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.52.5': + resolution: {integrity: sha512-Fw4tysRutyQc/wwkmcyoqFtJhh0u31K+Q6jYjeicsGJJ7bbEq8LwPWV/w0cnzOqR2m694/Af6hpFayLJZkG2VQ==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.52.5': + resolution: {integrity: sha512-a+3wVnAYdQClOTlyapKmyI6BLPAFYs0JM8HRpgYZQO02rMR09ZcV9LbQB+NL6sljzG38869YqThrRnfPMCDtZg==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.52.5': + resolution: {integrity: sha512-AvttBOMwO9Pcuuf7m9PkC1PUIKsfaAJ4AYhy944qeTJgQOqJYJ9oVl2nYgY7Rk0mkbsuOpCAYSs6wLYB2Xiw0Q==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.52.5': + resolution: {integrity: sha512-DkDk8pmXQV2wVrF6oq5tONK6UHLz/XcEVow4JTTerdeV1uqPeHxwcg7aFsfnSm9L+OO8WJsWotKM2JJPMWrQtA==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.52.5': + resolution: {integrity: sha512-W/b9ZN/U9+hPQVvlGwjzi+Wy4xdoH2I8EjaCkMvzpI7wJUs8sWJ03Rq96jRnHkSrcHTpQe8h5Tg3ZzUPGauvAw==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.52.5': + resolution: {integrity: sha512-sjQLr9BW7R/ZiXnQiWPkErNfLMkkWIoCz7YMn27HldKsADEKa5WYdobaa1hmN6slu9oWQbB6/jFpJ+P2IkVrmw==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-riscv64-musl@4.52.5': + resolution: {integrity: sha512-hq3jU/kGyjXWTvAh2awn8oHroCbrPm8JqM7RUpKjalIRWWXE01CQOf/tUNWNHjmbMHg/hmNCwc/Pz3k1T/j/Lg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.52.5': + resolution: {integrity: sha512-gn8kHOrku8D4NGHMK1Y7NA7INQTRdVOntt1OCYypZPRt6skGbddska44K8iocdpxHTMMNui5oH4elPH4QOLrFQ==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.52.5': + resolution: {integrity: sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.52.5': + resolution: {integrity: sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openharmony-arm64@4.52.5': + resolution: {integrity: sha512-QoFqB6+/9Rly/RiPjaomPLmR/13cgkIGfA40LHly9zcH1S0bN2HVFYk3a1eAyHQyjs3ZJYlXvIGtcCs5tko9Cw==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.52.5': + resolution: {integrity: sha512-w0cDWVR6MlTstla1cIfOGyl8+qb93FlAVutcor14Gf5Md5ap5ySfQ7R9S/NjNaMLSFdUnKGEasmVnu3lCMqB7w==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.52.5': + resolution: {integrity: sha512-Aufdpzp7DpOTULJCuvzqcItSGDH73pF3ko/f+ckJhxQyHtp67rHw3HMNxoIdDMUITJESNE6a8uh4Lo4SLouOUg==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.52.5': + resolution: {integrity: sha512-UGBUGPFp1vkj6p8wCRraqNhqwX/4kNQPS57BCFc8wYh0g94iVIW33wJtQAx3G7vrjjNtRaxiMUylM0ktp/TRSQ==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.52.5': + resolution: {integrity: sha512-TAcgQh2sSkykPRWLrdyy2AiceMckNf5loITqXxFI5VuQjS5tSuw3WlwdN8qv8vzjLAUTvYaH/mVjSFpbkFbpTg==} + cpu: [x64] + os: [win32] '@sindresorhus/is@4.6.0': resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} @@ -550,9 +783,15 @@ packages: '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + '@types/chai@5.2.2': + resolution: {integrity: sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==} + '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} @@ -645,6 +884,40 @@ packages: vitest: optional: true + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} + + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} + + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} + + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} + + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} + + '@vitest/ui@3.2.4': + resolution: {integrity: sha512-hGISOaP18plkzbWEcP/QvtRW1xDXF2+96HbEX6byqQhAUbiS5oH6/9JwW+QsQCIYON2bI6QZBF+2PvOmrRZ9wA==} + peerDependencies: + vitest: 3.2.4 + + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} + '@vue/compiler-core@3.5.22': resolution: {integrity: sha512-jQ0pFPmZwTEiRNSb+i9Ow/I/cHv2tXYqsnHKKyCQ08irI2kdF5qmYedmF8si8mA7zepUFmJ2hqzS8CQmNOWOkQ==} @@ -706,10 +979,18 @@ packages: args-tokenizer@0.3.0: resolution: {integrity: sha512-xXAd7G2Mll5W8uo37GETpQ2VrE84M181Z7ugHFGQnJZ50M2mbOv0osSZ9VsSgPfJQ+LVG0prSi0th+ELMsno7Q==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + ast-kit@2.1.3: resolution: {integrity: sha512-TH+b3Lv6pUjy/Nu0m6A2JULtdzLpmqF9x1Dhj00ZoEiML8qvVA9j1flkzTKNYgdEhWrjDwtWNpyyCUbfQe514g==} engines: {node: '>=20.19.0'} + ast-types@0.16.1: + resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==} + engines: {node: '>=4'} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -769,6 +1050,10 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -787,6 +1072,10 @@ packages: character-entities@2.0.2: resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + chokidar@4.0.3: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} @@ -869,6 +1158,10 @@ packages: decode-named-character-reference@1.2.0: resolution: {integrity: sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -931,6 +1224,14 @@ packages: resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==} engines: {node: '>=18'} + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + esbuild@0.25.11: + resolution: {integrity: sha512-KohQwyzrKTQmhXDW1PjCv3Tyspn9n5GcY2RTDqeORIdIJY8yKIF7sTSopFmn/wpMPW4rdPXI0UE5LJLuq3bx0Q==} + engines: {node: '>=18'} + hasBin: true + escalade@3.2.0: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} @@ -1125,6 +1426,11 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + esquery@1.6.0: resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} engines: {node: '>=0.10'} @@ -1140,10 +1446,17 @@ packages: estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + expect-type@1.2.2: + resolution: {integrity: sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==} + engines: {node: '>=12.0.0'} + exsolve@1.0.7: resolution: {integrity: sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw==} @@ -1205,6 +1518,11 @@ packages: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} engines: {node: '>=0.4.x'} + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + fzf@0.5.2: resolution: {integrity: sha512-Tt4kuxLXFKHy8KT40zwsUPUkg1CrsgY25FxA2U/j/0WgEDCk3ddc/zLTCCcbSHX9FcKtLuVaDGtGE/STWC+j3Q==} @@ -1215,6 +1533,9 @@ packages: get-tsconfig@4.12.0: resolution: {integrity: sha512-LScr2aNr2FbjAjZh2C6X6BxRx1/x+aTDExct/xyq2XKbYOiG5c0aK7pMsSuyc0brz3ibr/lbQiHD9jzt4lccJw==} + get-tsconfig@4.13.0: + resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==} + giget@2.0.0: resolution: {integrity: sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==} hasBin: true @@ -1311,6 +1632,9 @@ packages: resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} hasBin: true + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -1377,12 +1701,22 @@ packages: longest-streak@3.1.0: resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==} + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} magic-string@0.30.19: resolution: {integrity: sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==} + magicast@0.3.5: + resolution: {integrity: sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==} + + magicast@file:packages/workbox-build/magicast-0.3.5.tgz: + resolution: {integrity: sha512-z7mBYVtGx5aFIFqOa6lBYuyKJqYUsvS85uB8zMDcBIZTtN3j7xlYh67g2WmHTZJbFX8i74T2t9g4KcZF9U5XGA==, tarball: file:packages/workbox-build/magicast-0.3.5.tgz} + version: 0.3.5 + markdown-table@3.0.4: resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==} @@ -1542,6 +1876,10 @@ packages: mlly@1.8.0: resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==} + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -1644,6 +1982,10 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + perfect-debounce@2.0.0: resolution: {integrity: sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow==} @@ -1683,6 +2025,10 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + proper-tags@2.0.2: + resolution: {integrity: sha512-rpgQb3JC9uWAogm9J3G6heeg7n/Gq82GZKaFt080JPVbydKvGW6ECj9Ui1a6taTFv9Oa+dq9GMhHeOJyxxaURA==} + engines: {node: '>=12.0.0'} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1700,6 +2046,10 @@ packages: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} + recast@0.23.11: + resolution: {integrity: sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==} + engines: {node: '>= 4'} + refa@0.12.1: resolution: {integrity: sha512-J8rn6v4DBb2nnFqkqwy6/NnTYMcgLA+sLr0iIO41qpv0n+ngb7ksag2tMRl0inb1bbO/esUwzW1vbJi7K0sI0g==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -1735,13 +2085,13 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rolldown-plugin-dts@0.16.11: - resolution: {integrity: sha512-9IQDaPvPqTx3RjG2eQCK5GYZITo203BxKunGI80AGYicu1ySFTUyugicAaTZWRzFWh9DSnzkgNeMNbDWBbSs0w==} + rolldown-plugin-dts@0.17.0: + resolution: {integrity: sha512-dZlFs5D6Qemo8Ch4Pz2tD2lhmfh74XSq8r+fUvVXJaP8iiunrF5wIQaoT7QIB/Q3HLMn8ETMR9mRn+Zh96FdNg==} engines: {node: '>=20.18.0'} peerDependencies: '@ts-macro/tsc': ^0.3.6 '@typescript/native-preview': '>=7.0.0-dev.20250601.1' - rolldown: ^1.0.0-beta.9 + rolldown: ^1.0.0-beta.44 typescript: ^5.0.0 vue-tsc: ~3.1.0 peerDependenciesMeta: @@ -1754,11 +2104,16 @@ packages: vue-tsc: optional: true - rolldown@1.0.0-beta.43: - resolution: {integrity: sha512-6RcqyRx0tY1MlRLnjXPp/849Rl/CPFhzpGGwNPEPjKwqBMqPq/Rbbkxasa8s0x+IkUk46ty4jazb5skZ/Vgdhw==} + rolldown@1.0.0-beta.44: + resolution: {integrity: sha512-gcqgyCi3g93Fhr49PKvymE8PoaGS0sf6ajQrsYaQ8o5de6aUEbD6rJZiJbhOfpcqOnycgsAsUNPYri1h25NgsQ==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + rollup@4.52.5: + resolution: {integrity: sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -1779,10 +2134,17 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -1794,6 +2156,10 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + spdx-exceptions@2.5.0: resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} @@ -1803,6 +2169,12 @@ packages: spdx-license-ids@3.0.22: resolution: {integrity: sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -1819,6 +2191,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1846,6 +2221,15 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + tiny-invariant@1.3.3: + resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + tinyexec@1.0.1: resolution: {integrity: sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==} @@ -1853,6 +2237,18 @@ packages: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} + engines: {node: '>=14.0.0'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1861,6 +2257,10 @@ packages: resolution: {integrity: sha512-khrZo4buq4qVmsGzS5yQjKe/WsFvV8fGfOjDQN0q4iy9FjRfPWRgTFrU8u1R2iu/SfWLhY9WnCi4Jhdrcbtg+g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + tree-kill@1.2.2: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true @@ -1876,8 +2276,9 @@ packages: peerDependencies: typescript: '>=4.0.0' - tsdown@0.15.7: - resolution: {integrity: sha512-uFaVgWAogjOMqjY+CQwrUt3C6wzy6ynt82CIoXymnbS17ipUZ8WDXUceJjkislUahF/BZc5+W44Ue3p2oWtqUg==} + tsdown@https://pkg.pr.new/tsdown@c4f9764: + resolution: {tarball: https://pkg.pr.new/tsdown@c4f9764} + version: 0.15.9 engines: {node: '>=20.19.0'} hasBin: true peerDependencies: @@ -1901,6 +2302,11 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsx@4.20.6: + resolution: {integrity: sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==} + engines: {node: '>=18.0.0'} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -1944,21 +2350,102 @@ packages: unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} - update-browserslist-db@1.1.3: - resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==} + update-browserslist-db@1.1.3: + resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + valibot@1.1.0: + resolution: {integrity: sha512-Nk8lX30Qhu+9txPYTwM0cFlWLdPFsFr6LblzqIySfbZph9+BFsAHsNvHOymEviUepeIW6KFHzpX8TKhbptBXXw==} + peerDependencies: + typescript: '>=5' + peerDependenciesMeta: + typescript: + optional: true + + validate-npm-package-name@5.0.1: + resolution: {integrity: sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + + vite@7.1.10: + resolution: {integrity: sha512-CmuvUBzVJ/e3HGxhg6cYk88NGgTnBoOo7ogtfJJ0fefUWAxN/WDSUa50o+oVBxuIhO8FoEZW0j2eW7sfjs5EtA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: - browserslist: '>= 4.21.0' - - uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - - util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - - validate-npm-package-name@5.0.1: - resolution: {integrity: sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true vue-eslint-parser@10.2.0: resolution: {integrity: sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==} @@ -1971,6 +2458,11 @@ packages: engines: {node: '>= 8'} hasBin: true + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + word-wrap@1.2.5: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} @@ -2015,7 +2507,7 @@ snapshots: '@andrewbranch/untar.js@1.0.3': {} - '@antfu/eslint-config@6.0.0(@vue/compiler-sfc@3.5.22)(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)': + '@antfu/eslint-config@6.0.0(@vue/compiler-sfc@3.5.22)(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)(vitest@3.2.4)': dependencies: '@antfu/install-pkg': 1.1.0 '@clack/prompts': 0.11.0 @@ -2024,7 +2516,7 @@ snapshots: '@stylistic/eslint-plugin': 5.4.0(eslint@9.37.0(jiti@2.6.1)) '@typescript-eslint/eslint-plugin': 8.46.1(@typescript-eslint/parser@8.46.1(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) '@typescript-eslint/parser': 8.46.1(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) - '@vitest/eslint-plugin': 1.3.20(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) + '@vitest/eslint-plugin': 1.3.20(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)(vitest@3.2.4) ansis: 4.2.0 cac: 6.7.14 eslint: 9.37.0(jiti@2.6.1) @@ -2171,6 +2663,84 @@ snapshots: esquery: 1.6.0 jsdoc-type-pratt-parser: 5.4.0 + '@esbuild/aix-ppc64@0.25.11': + optional: true + + '@esbuild/android-arm64@0.25.11': + optional: true + + '@esbuild/android-arm@0.25.11': + optional: true + + '@esbuild/android-x64@0.25.11': + optional: true + + '@esbuild/darwin-arm64@0.25.11': + optional: true + + '@esbuild/darwin-x64@0.25.11': + optional: true + + '@esbuild/freebsd-arm64@0.25.11': + optional: true + + '@esbuild/freebsd-x64@0.25.11': + optional: true + + '@esbuild/linux-arm64@0.25.11': + optional: true + + '@esbuild/linux-arm@0.25.11': + optional: true + + '@esbuild/linux-ia32@0.25.11': + optional: true + + '@esbuild/linux-loong64@0.25.11': + optional: true + + '@esbuild/linux-mips64el@0.25.11': + optional: true + + '@esbuild/linux-ppc64@0.25.11': + optional: true + + '@esbuild/linux-riscv64@0.25.11': + optional: true + + '@esbuild/linux-s390x@0.25.11': + optional: true + + '@esbuild/linux-x64@0.25.11': + optional: true + + '@esbuild/netbsd-arm64@0.25.11': + optional: true + + '@esbuild/netbsd-x64@0.25.11': + optional: true + + '@esbuild/openbsd-arm64@0.25.11': + optional: true + + '@esbuild/openbsd-x64@0.25.11': + optional: true + + '@esbuild/openharmony-arm64@0.25.11': + optional: true + + '@esbuild/sunos-x64@0.25.11': + optional: true + + '@esbuild/win32-arm64@0.25.11': + optional: true + + '@esbuild/win32-ia32@0.25.11': + optional: true + + '@esbuild/win32-x64@0.25.11': + optional: true + '@eslint-community/eslint-plugin-eslint-comments@4.5.0(eslint@9.37.0(jiti@2.6.1))': dependencies: escape-string-regexp: 4.0.0 @@ -2300,59 +2870,127 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.1 - '@oxc-project/types@0.94.0': {} + '@oxc-project/types@0.95.0': {} '@pkgr/core@0.2.9': {} + '@polka/url@1.0.0-next.29': {} + '@quansync/fs@0.1.5': dependencies: quansync: 0.2.11 - '@rolldown/binding-android-arm64@1.0.0-beta.43': + '@rolldown/binding-android-arm64@1.0.0-beta.44': optional: true - '@rolldown/binding-darwin-arm64@1.0.0-beta.43': + '@rolldown/binding-darwin-arm64@1.0.0-beta.44': optional: true - '@rolldown/binding-darwin-x64@1.0.0-beta.43': + '@rolldown/binding-darwin-x64@1.0.0-beta.44': optional: true - '@rolldown/binding-freebsd-x64@1.0.0-beta.43': + '@rolldown/binding-freebsd-x64@1.0.0-beta.44': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.43': + '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.44': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.43': + '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.44': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.43': + '@rolldown/binding-linux-arm64-musl@1.0.0-beta.44': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.43': + '@rolldown/binding-linux-x64-gnu@1.0.0-beta.44': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0-beta.43': + '@rolldown/binding-linux-x64-musl@1.0.0-beta.44': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0-beta.43': + '@rolldown/binding-openharmony-arm64@1.0.0-beta.44': optional: true - '@rolldown/binding-wasm32-wasi@1.0.0-beta.43': + '@rolldown/binding-wasm32-wasi@1.0.0-beta.44': dependencies: '@napi-rs/wasm-runtime': 1.0.7 optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.43': + '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.44': + optional: true + + '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.44': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.0.0-beta.44': + optional: true + + '@rolldown/pluginutils@1.0.0-beta.44': {} + + '@rollup/rollup-android-arm-eabi@4.52.5': + optional: true + + '@rollup/rollup-android-arm64@4.52.5': + optional: true + + '@rollup/rollup-darwin-arm64@4.52.5': + optional: true + + '@rollup/rollup-darwin-x64@4.52.5': + optional: true + + '@rollup/rollup-freebsd-arm64@4.52.5': + optional: true + + '@rollup/rollup-freebsd-x64@4.52.5': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.52.5': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.52.5': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.52.5': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.52.5': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.52.5': + optional: true + + '@rollup/rollup-linux-x64-musl@4.52.5': + optional: true + + '@rollup/rollup-openharmony-arm64@4.52.5': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.52.5': optional: true - '@rolldown/binding-win32-ia32-msvc@1.0.0-beta.43': + '@rollup/rollup-win32-ia32-msvc@4.52.5': optional: true - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.43': + '@rollup/rollup-win32-x64-gnu@4.52.5': optional: true - '@rolldown/pluginutils@1.0.0-beta.43': {} + '@rollup/rollup-win32-x64-msvc@4.52.5': + optional: true '@sindresorhus/is@4.6.0': {} @@ -2371,10 +3009,16 @@ snapshots: tslib: 2.8.1 optional: true + '@types/chai@5.2.2': + dependencies: + '@types/deep-eql': 4.0.2 + '@types/debug@4.1.12': dependencies: '@types/ms': 2.1.0 + '@types/deep-eql@4.0.2': {} + '@types/estree@1.0.8': {} '@types/json-schema@7.0.15': {} @@ -2486,16 +3130,70 @@ snapshots: '@typescript-eslint/types': 8.46.1 eslint-visitor-keys: 4.2.1 - '@vitest/eslint-plugin@1.3.20(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)': + '@vitest/eslint-plugin@1.3.20(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)(vitest@3.2.4)': dependencies: '@typescript-eslint/scope-manager': 8.46.1 '@typescript-eslint/utils': 8.46.1(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3) eslint: 9.37.0(jiti@2.6.1) optionalDependencies: typescript: 5.9.3 + vitest: 3.2.4(@types/debug@4.1.12)(@types/node@22.18.10)(@vitest/ui@3.2.4)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) transitivePeerDependencies: - supports-color + '@vitest/expect@3.2.4': + dependencies: + '@types/chai': 5.2.2 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.4(vite@7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1))': + dependencies: + '@vitest/spy': 3.2.4 + estree-walker: 3.0.3 + magic-string: 0.30.19 + optionalDependencies: + vite: 7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) + + '@vitest/pretty-format@3.2.4': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.4': + dependencies: + '@vitest/utils': 3.2.4 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + magic-string: 0.30.19 + pathe: 2.0.3 + + '@vitest/spy@3.2.4': + dependencies: + tinyspy: 4.0.4 + + '@vitest/ui@3.2.4(vitest@3.2.4)': + dependencies: + '@vitest/utils': 3.2.4 + fflate: 0.8.2 + flatted: 3.3.3 + pathe: 2.0.3 + sirv: 3.0.2 + tinyglobby: 0.2.15 + tinyrainbow: 2.0.0 + vitest: 3.2.4(@types/debug@4.1.12)(@types/node@22.18.10)(@vitest/ui@3.2.4)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) + + '@vitest/utils@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + '@vue/compiler-core@3.5.22': dependencies: '@babel/parser': 7.28.4 @@ -2563,11 +3261,17 @@ snapshots: args-tokenizer@0.3.0: {} + assertion-error@2.0.1: {} + ast-kit@2.1.3: dependencies: '@babel/parser': 7.28.4 pathe: 2.0.3 + ast-types@0.16.1: + dependencies: + tslib: 2.8.1 + balanced-match@1.0.2: {} baseline-browser-mapping@2.8.17: {} @@ -2599,11 +3303,11 @@ snapshots: builtin-modules@5.0.0: {} - bumpp@10.3.1: + bumpp@10.3.1(magicast@0.3.5): dependencies: ansis: 4.2.0 args-tokenizer: 0.3.0 - c12: 3.3.0 + c12: 3.3.0(magicast@0.3.5) cac: 6.7.14 escalade: 3.2.0 jsonc-parser: 3.3.1 @@ -2615,7 +3319,7 @@ snapshots: transitivePeerDependencies: - magicast - c12@3.3.0: + c12@3.3.0(magicast@0.3.5): dependencies: chokidar: 4.0.3 confbox: 0.2.2 @@ -2629,6 +3333,8 @@ snapshots: perfect-debounce: 2.0.0 pkg-types: 2.3.0 rc9: 2.1.2 + optionalDependencies: + magicast: 0.3.5 cac@6.7.14: {} @@ -2638,6 +3344,14 @@ snapshots: ccount@2.0.1: {} + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -2651,6 +3365,8 @@ snapshots: character-entities@2.0.2: {} + check-error@2.1.1: {} + chokidar@4.0.3: dependencies: readdirp: 4.1.2 @@ -2726,6 +3442,8 @@ snapshots: dependencies: character-entities: 2.0.2 + deep-eql@5.0.2: {} + deep-is@0.1.4: {} defu@6.1.4: {} @@ -2763,6 +3481,37 @@ snapshots: environment@1.1.0: {} + es-module-lexer@1.7.0: {} + + esbuild@0.25.11: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.11 + '@esbuild/android-arm': 0.25.11 + '@esbuild/android-arm64': 0.25.11 + '@esbuild/android-x64': 0.25.11 + '@esbuild/darwin-arm64': 0.25.11 + '@esbuild/darwin-x64': 0.25.11 + '@esbuild/freebsd-arm64': 0.25.11 + '@esbuild/freebsd-x64': 0.25.11 + '@esbuild/linux-arm': 0.25.11 + '@esbuild/linux-arm64': 0.25.11 + '@esbuild/linux-ia32': 0.25.11 + '@esbuild/linux-loong64': 0.25.11 + '@esbuild/linux-mips64el': 0.25.11 + '@esbuild/linux-ppc64': 0.25.11 + '@esbuild/linux-riscv64': 0.25.11 + '@esbuild/linux-s390x': 0.25.11 + '@esbuild/linux-x64': 0.25.11 + '@esbuild/netbsd-arm64': 0.25.11 + '@esbuild/netbsd-x64': 0.25.11 + '@esbuild/openbsd-arm64': 0.25.11 + '@esbuild/openbsd-x64': 0.25.11 + '@esbuild/openharmony-arm64': 0.25.11 + '@esbuild/sunos-x64': 0.25.11 + '@esbuild/win32-arm64': 0.25.11 + '@esbuild/win32-ia32': 0.25.11 + '@esbuild/win32-x64': 0.25.11 + escalade@3.2.0: {} escape-string-regexp@1.0.5: {} @@ -3036,6 +3785,8 @@ snapshots: acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 3.4.3 + esprima@4.0.1: {} + esquery@1.6.0: dependencies: estraverse: 5.3.0 @@ -3048,8 +3799,14 @@ snapshots: estree-walker@2.0.2: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.8 + esutils@2.0.3: {} + expect-type@1.2.2: {} + exsolve@1.0.7: {} fast-deep-equal@3.1.3: {} @@ -3104,6 +3861,9 @@ snapshots: format@0.2.2: {} + fsevents@2.3.3: + optional: true + fzf@0.5.2: {} get-caller-file@2.0.5: {} @@ -3112,6 +3872,10 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + get-tsconfig@4.13.0: + dependencies: + resolve-pkg-maps: 1.0.0 + giget@2.0.0: dependencies: citty: 0.1.6 @@ -3182,6 +3946,8 @@ snapshots: jiti@2.6.1: {} + js-tokens@9.0.1: {} + js-yaml@4.1.0: dependencies: argparse: 2.0.1 @@ -3236,12 +4002,27 @@ snapshots: longest-streak@3.1.0: {} + loupe@3.2.1: {} + lru-cache@10.4.3: {} magic-string@0.30.19: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + magicast@0.3.5: + dependencies: + '@babel/parser': 7.28.4 + '@babel/types': 7.28.4 + source-map-js: 1.2.1 + optional: true + + magicast@file:packages/workbox-build/magicast-0.3.5.tgz: + dependencies: + '@babel/parser': 7.28.4 + '@babel/types': 7.28.4 + source-map-js: 1.2.1 + markdown-table@3.0.4: {} marked-terminal@7.3.0(marked@9.1.6): @@ -3592,6 +4373,8 @@ snapshots: pkg-types: 1.3.1 ufo: 1.6.1 + mrmime@2.0.1: {} + ms@2.1.3: {} mz@2.7.0: @@ -3692,6 +4475,8 @@ snapshots: pathe@2.0.3: {} + pathval@2.0.1: {} + perfect-debounce@2.0.0: {} picocolors@1.1.1: {} @@ -3731,6 +4516,8 @@ snapshots: prelude-ls@1.2.1: {} + proper-tags@2.0.2: {} + punycode@2.3.1: {} quansync@0.2.11: {} @@ -3744,6 +4531,14 @@ snapshots: readdirp@4.1.2: {} + recast@0.23.11: + dependencies: + ast-types: 0.16.1 + esprima: 4.0.1 + source-map: 0.6.1 + tiny-invariant: 1.3.3 + tslib: 2.8.1 + refa@0.12.1: dependencies: '@eslint-community/regexpp': 4.12.1 @@ -3772,7 +4567,7 @@ snapshots: reusify@1.1.0: {} - rolldown-plugin-dts@0.16.11(rolldown@1.0.0-beta.43)(typescript@5.9.3): + rolldown-plugin-dts@0.17.0(rolldown@1.0.0-beta.44)(typescript@5.9.3): dependencies: '@babel/generator': 7.28.3 '@babel/parser': 7.28.4 @@ -3781,35 +4576,62 @@ snapshots: birpc: 2.6.1 debug: 4.4.3 dts-resolver: 2.1.2 - get-tsconfig: 4.12.0 + get-tsconfig: 4.13.0 magic-string: 0.30.19 - rolldown: 1.0.0-beta.43 + rolldown: 1.0.0-beta.44 optionalDependencies: typescript: 5.9.3 transitivePeerDependencies: - oxc-resolver - supports-color - rolldown@1.0.0-beta.43: + rolldown@1.0.0-beta.44: dependencies: - '@oxc-project/types': 0.94.0 - '@rolldown/pluginutils': 1.0.0-beta.43 - ansis: 4.2.0 + '@oxc-project/types': 0.95.0 + '@rolldown/pluginutils': 1.0.0-beta.44 + optionalDependencies: + '@rolldown/binding-android-arm64': 1.0.0-beta.44 + '@rolldown/binding-darwin-arm64': 1.0.0-beta.44 + '@rolldown/binding-darwin-x64': 1.0.0-beta.44 + '@rolldown/binding-freebsd-x64': 1.0.0-beta.44 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.44 + '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.44 + '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.44 + '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.44 + '@rolldown/binding-linux-x64-musl': 1.0.0-beta.44 + '@rolldown/binding-openharmony-arm64': 1.0.0-beta.44 + '@rolldown/binding-wasm32-wasi': 1.0.0-beta.44 + '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.44 + '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.44 + '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.44 + + rollup@4.52.5: + dependencies: + '@types/estree': 1.0.8 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-beta.43 - '@rolldown/binding-darwin-arm64': 1.0.0-beta.43 - '@rolldown/binding-darwin-x64': 1.0.0-beta.43 - '@rolldown/binding-freebsd-x64': 1.0.0-beta.43 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.43 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.43 - '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.43 - '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.43 - '@rolldown/binding-linux-x64-musl': 1.0.0-beta.43 - '@rolldown/binding-openharmony-arm64': 1.0.0-beta.43 - '@rolldown/binding-wasm32-wasi': 1.0.0-beta.43 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.43 - '@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.43 - '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.43 + '@rollup/rollup-android-arm-eabi': 4.52.5 + '@rollup/rollup-android-arm64': 4.52.5 + '@rollup/rollup-darwin-arm64': 4.52.5 + '@rollup/rollup-darwin-x64': 4.52.5 + '@rollup/rollup-freebsd-arm64': 4.52.5 + '@rollup/rollup-freebsd-x64': 4.52.5 + '@rollup/rollup-linux-arm-gnueabihf': 4.52.5 + '@rollup/rollup-linux-arm-musleabihf': 4.52.5 + '@rollup/rollup-linux-arm64-gnu': 4.52.5 + '@rollup/rollup-linux-arm64-musl': 4.52.5 + '@rollup/rollup-linux-loong64-gnu': 4.52.5 + '@rollup/rollup-linux-ppc64-gnu': 4.52.5 + '@rollup/rollup-linux-riscv64-gnu': 4.52.5 + '@rollup/rollup-linux-riscv64-musl': 4.52.5 + '@rollup/rollup-linux-s390x-gnu': 4.52.5 + '@rollup/rollup-linux-x64-gnu': 4.52.5 + '@rollup/rollup-linux-x64-musl': 4.52.5 + '@rollup/rollup-openharmony-arm64': 4.52.5 + '@rollup/rollup-win32-arm64-msvc': 4.52.5 + '@rollup/rollup-win32-ia32-msvc': 4.52.5 + '@rollup/rollup-win32-x64-gnu': 4.52.5 + '@rollup/rollup-win32-x64-msvc': 4.52.5 + fsevents: 2.3.3 run-parallel@1.2.0: dependencies: @@ -3829,8 +4651,16 @@ snapshots: shebang-regex@3.0.0: {} + siginfo@2.0.0: {} + signal-exit@4.1.0: {} + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + sisteransi@1.0.5: {} skin-tone@2.0.0: @@ -3839,6 +4669,8 @@ snapshots: source-map-js@1.2.1: {} + source-map@0.6.1: {} + spdx-exceptions@2.5.0: {} spdx-expression-parse@4.0.0: @@ -3848,6 +4680,10 @@ snapshots: spdx-license-ids@3.0.22: {} + stackback@0.0.2: {} + + std-env@3.10.0: {} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -3862,6 +4698,10 @@ snapshots: strip-json-comments@3.1.1: {} + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -3899,6 +4739,12 @@ snapshots: dependencies: any-promise: 1.3.0 + tiny-invariant@1.3.3: {} + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + tinyexec@1.0.1: {} tinyglobby@0.2.15: @@ -3906,6 +4752,12 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.4: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -3914,6 +4766,8 @@ snapshots: dependencies: eslint-visitor-keys: 3.4.3 + totalist@3.0.1: {} + tree-kill@1.2.2: {} ts-api-utils@2.1.0(typescript@5.9.3): @@ -3925,7 +4779,7 @@ snapshots: picomatch: 4.0.3 typescript: 5.9.3 - tsdown@0.15.7(typescript@5.9.3): + tsdown@https://pkg.pr.new/tsdown@c4f9764(typescript@5.9.3): dependencies: ansis: 4.2.0 cac: 6.7.14 @@ -3934,8 +4788,8 @@ snapshots: diff: 8.0.2 empathic: 2.0.0 hookable: 5.5.3 - rolldown: 1.0.0-beta.43 - rolldown-plugin-dts: 0.16.11(rolldown@1.0.0-beta.43)(typescript@5.9.3) + rolldown: 1.0.0-beta.44 + rolldown-plugin-dts: 0.17.0(rolldown@1.0.0-beta.44)(typescript@5.9.3) semver: 7.7.3 tinyexec: 1.0.1 tinyglobby: 0.2.15 @@ -3950,8 +4804,14 @@ snapshots: - supports-color - vue-tsc - tslib@2.8.1: - optional: true + tslib@2.8.1: {} + + tsx@4.20.6: + dependencies: + esbuild: 0.25.11 + get-tsconfig: 4.12.0 + optionalDependencies: + fsevents: 2.3.3 type-check@0.4.0: dependencies: @@ -4007,8 +4867,91 @@ snapshots: util-deprecate@1.0.2: {} + valibot@1.1.0(typescript@5.9.3): + optionalDependencies: + typescript: 5.9.3 + validate-npm-package-name@5.0.1: {} + vite-node@3.2.4(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1): + dependencies: + esbuild: 0.25.11 + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + postcss: 8.5.6 + rollup: 4.52.5 + tinyglobby: 0.2.15 + optionalDependencies: + '@types/node': 22.18.10 + fsevents: 2.3.3 + jiti: 2.6.1 + tsx: 4.20.6 + yaml: 2.8.1 + + vitest@3.2.4(@types/debug@4.1.12)(@types/node@22.18.10)(@vitest/ui@3.2.4)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1): + dependencies: + '@types/chai': 5.2.2 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(vite@7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.2.2 + magic-string: 0.30.19 + pathe: 2.0.3 + picomatch: 4.0.3 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.15 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.1.10(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) + vite-node: 3.2.4(@types/node@22.18.10)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/debug': 4.1.12 + '@types/node': 22.18.10 + '@vitest/ui': 3.2.4(vitest@3.2.4) + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + vue-eslint-parser@10.2.0(eslint@9.37.0(jiti@2.6.1)): dependencies: debug: 4.4.3 @@ -4025,6 +4968,11 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + word-wrap@1.2.5: {} wrap-ansi@7.0.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2cc24f9..e8a1ac0 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -6,33 +6,40 @@ autoInstallPeers: true catalogs: build: bumpp: ^10.3.1 - tsdown: ^0.15.7 - + tsdown: https://pkg.pr.new/tsdown@c4f9764 eslint: '@antfu/eslint-config': ^6.0.0 eslint: ^9.37.0 eslint-plugin-antfu: ^3.1.1 - + testing: + '@vitest/ui': ^3.2.4 + vitest: ^3.2.4 types: '@types/node': ^22.9.3 '@types/trusted-types': ^2.0.7 - typescript: '@typescript-eslint/utils': ^8.45.0 typescript: ~5.9.3 - utils: '@antfu/ni': ^25.0.0 '@arethetypeswrong/cli': ^0.17.4 idb: ^8.0.3 + pathe: ^2.0.3 + pkg-types: ^2.3.0 + proper-tags: ^2.0.2 + recast: ^0.23.11 taze: ^19.7.0 + valibot: ^1.1.0 cleanupUnusedCatalogs: true ignoreWorkspaceRootCheck: true +onlyBuiltDependencies: + - esbuild + shamefullyHoist: true -shell-emulator: true +shellEmulator: true strictPeerDependencies: false diff --git a/tsconfig.json b/tsconfig.json index 9c2cdc2..cfecf35 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,56 +4,31 @@ "lib": ["DOM", "ESNext", "DOM.Iterable", "ESNext.AsyncIterable", "WebWorker"], "module": "ESNext", "moduleResolution": "Bundler", + "allowImportingTsExtensions": true, "paths": { - "@vite-pwa/workbox-background-sync": [ - "./packages/workbox-background-sync/src/" + "@vite-pwa/workbox-build": [ + "./packages/workbox-build/src/index.ts" ], - "@vite-pwa/workbox-broadcast-update": [ - "./packages/workbox-broadcast-update/src/" + "@vite-pwa/workbox-build/*": [ + "./packages/workbox-build/src/*.ts" ], - "@vite-pwa/workbox-cacheable-response": [ - "./packages/workbox-cacheable-response/src/" + "@vite-pwa/workbox-swkit": [ + "./packages/workbox-swkit/src/index.ts" ], - "@vite-pwa/workbox-core": [ - "./packages/workbox-core/src/" - ], - "@vite-pwa/workbox-core/internals": [ - "./packages/workbox-core/src/internals.ts" - ], - "@vite-pwa/workbox-expiration": [ - "./packages/workbox-expiration/src/" - ], - "@vite-pwa/workbox-navigation-preload": [ - "./packages/workbox-navigation-preload/src/" - ], - "@vite-pwa/workbox-precaching": [ - "./packages/workbox-precaching/src/" - ], - "@vite-pwa/workbox-range-requests": [ - "./packages/workbox-range-requests/src/" - ], - "@vite-pwa/workbox-recipes": [ - "./packages/workbox-recipes/src/" - ], - "@vite-pwa/workbox-routing": [ - "./packages/workbox-routing/src/" - ], - "@vite-pwa/workbox-strategies": [ - "./packages/workbox-strategies/src/" - ], - "@vite-pwa/workbox-streams": [ - "./packages/workbox-streams/src/" - ], - "@vite-pwa/workbox-sw": [ - "./packages/workbox-sw/src/" + "@vite-pwa/workbox-swkit/*": [ + "./packages/workbox-swkit/src/*.ts" ], "@vite-pwa/workbox-window": [ - "./packages/workbox-window/src/" + "./packages/workbox-window/src/index.ts" + ], + "@vite-pwa/workbox-window/*": [ + "./packages/workbox-window/src/*.ts" ] }, "resolveJsonModule": true, "types": [ - "node" + "node", + "vitest/globals" ], "strict": true, "strictNullChecks": true, diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..d66d3ff --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from 'vitest/config' +import { alias } from './alias' + +export default defineConfig({ + optimizeDeps: { + entries: [], + }, + resolve: { + alias, + }, + test: { + globals: true, + environment: 'node', + testTimeout: 30_000, + name: 'unit', + }, +})