Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## TODO

- review workbox-sw package, maybe we need to move it to commonjs?
- review service worker (registration) globals

## Pending task

Expand Down
17 changes: 17 additions & 0 deletions alias.ts
Original file line number Diff line number Diff line change
@@ -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<string, string>)
31 changes: 31 additions & 0 deletions helper.ts
Original file line number Diff line number Diff line change
@@ -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<string, string[]> = {}
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
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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\""
},
Expand All @@ -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"
Expand Down
46 changes: 0 additions & 46 deletions packages/workbox-background-sync/package.json

This file was deleted.

16 changes: 0 additions & 16 deletions packages/workbox-background-sync/tsdown.config.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/workbox-broadcast-update/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/workbox-broadcast-update/src/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/workbox-broadcast-update/tsdown.config.ts

This file was deleted.

Binary file added packages/workbox-build/magicast-0.3.5.tgz
Binary file not shown.
77 changes: 77 additions & 0 deletions packages/workbox-build/package.json
Original file line number Diff line number Diff line change
@@ -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 <userquin@gmail.com>"
],
"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"
}
}
Loading