diff --git a/.github/workflows/esm-lint.yml b/.github/workflows/esm-lint.yml
index 1986d31..ffb7101 100644
--- a/.github/workflows/esm-lint.yml
+++ b/.github/workflows/esm-lint.yml
@@ -1,6 +1,5 @@
env:
- IMPORT_TEXT: import {CachedValue, CachedFunction, globalCache} from
- NPM_MODULE_NAME: webext-storage-cache
+ IMPORT_STATEMENT: export {CachedValue, CachedFunction, globalCache} from "webext-storage-cache"
# FILE GENERATED WITH: npx ghat fregante/ghatemplates/esm-lint
# SOURCE: https://github.com/fregante/ghatemplates
@@ -18,80 +17,88 @@ jobs:
Pack:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- run: npm install
- run: npm run build --if-present
- run: npm pack --dry-run
- run: npm pack | tail -1 | xargs -n1 tar -xzf
- - uses: actions/upload-artifact@v3
+ - uses: actions/upload-artifact@v4
with:
path: package
+ Publint:
+ runs-on: ubuntu-latest
+ needs: Pack
+ steps:
+ - uses: actions/download-artifact@v4
+ - run: npx publint ./artifact
Webpack:
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - run: npm install ./artifact
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
+ - uses: actions/download-artifact@v4
+ - run: npm install --omit=dev ./artifact
+ - run: echo "$IMPORT_STATEMENT" > index.js
- run: webpack --entry ./index.js
- run: cat dist/main.js
Parcel:
- if: false # https://github.com/parcel-bundler/parcel/issues/4155
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - run: npm install ./artifact
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
+ - uses: actions/download-artifact@v4
+ - run: npm install --omit=dev ./artifact
+ - run: echo "$IMPORT_STATEMENT" > index.js
+ - run: >
+ echo '{"@parcel/resolver-default": {"packageExports": true}}' >
+ package.json
- run: npx parcel@2 build index.js
- run: cat dist/index.js
Rollup:
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - run: npm install ./artifact rollup@2 @rollup/plugin-node-resolve
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
+ - uses: actions/download-artifact@v4
+ - run: npm install --omit=dev ./artifact rollup@4 @rollup/plugin-node-resolve
+ - run: echo "$IMPORT_STATEMENT" > index.js
- run: npx rollup -p node-resolve index.js
Vite:
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - run: npm install ./artifact
- - run: >-
- echo '' > index.html
+ - uses: actions/download-artifact@v4
+ - run: npm install --omit=dev ./artifact
+ - run: echo '' > index.html
- run: npx vite build
- run: cat dist/assets/*
esbuild:
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
+ - uses: actions/download-artifact@v4
- run: echo '{}' > package.json
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
- - run: npm install ./artifact
+ - run: echo "$IMPORT_STATEMENT" > index.js
+ - run: npm install --omit=dev ./artifact
- run: npx esbuild --bundle index.js
TypeScript:
- if: false
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - run: npm install ./artifact @sindresorhus/tsconfig
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.mts
- - run: echo '{"extends":"@sindresorhus/tsconfig","files":["index.mts"]}' > tsconfig.json
- - run: tsc
- - run: cat index.js
+ - uses: actions/download-artifact@v4
+ - run: echo '{"type":"module"}' > package.json
+ - run: npm install --omit=dev ./artifact @sindresorhus/tsconfig
+ - run: echo "$IMPORT_STATEMENT" > index.ts
+ - run: >
+ echo '{"extends":"@sindresorhus/tsconfig","files":["index.ts"]}' >
+ tsconfig.json
+ - run: npx --package typescript -- tsc
+ - run: cat distribution/index.js
Node:
runs-on: ubuntu-latest
needs: Pack
steps:
- - uses: actions/download-artifact@v3
- - uses: actions/setup-node@v3
+ - uses: actions/download-artifact@v4
+ - uses: actions/setup-node@v4
with:
- node-version: 14.x
- - run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.mjs
- - run: npm install ./artifact
+ node-version-file: artifact/package.json
+ - run: echo "$IMPORT_STATEMENT" > index.mjs
+ - run: npm install --omit=dev ./artifact
- run: node index.mjs
diff --git a/package.json b/package.json
index 9b41b23..bc6e87c 100644
--- a/package.json
+++ b/package.json
@@ -59,17 +59,17 @@
},
"dependencies": {
"@sindresorhus/to-milliseconds": "^2.0.0",
- "type-fest": "^4.20.0",
- "webext-detect-page": "^5.0.1",
+ "type-fest": "^4.20.1",
+ "webext-detect": "^5.0.2",
"webext-polyfill-kinda": "^1.0.2"
},
"devDependencies": {
- "@sindresorhus/tsconfig": "^5.0.0",
+ "@sindresorhus/tsconfig": "^6.0.0",
"@types/chrome": "0.0.268",
"@types/sinon-chrome": "^2.2.15",
"sinon-chrome": "^3.0.1",
- "tsd": "^0.31.0",
- "typescript": "^5.4.5",
+ "tsd": "^0.31.1",
+ "typescript": "^5.5.2",
"vitest": "^1.6.0",
"xo": "^0.58.0"
},
diff --git a/readme.md b/readme.md
index 763de24..466f89b 100644
--- a/readme.md
+++ b/readme.md
@@ -117,7 +117,7 @@ The documentation for the legacy API can be found on the [v5 version of this rea
## Related
-- [webext-detect-page](https://github.com/fregante/webext-detect-page) - Detects where the current browser extension code is being run.
+- [webext-detect](https://github.com/fregante/webext-detect) - Detects where the current browser extension code is being run.
- [webext-options-sync](https://github.com/fregante/webext-options-sync) - Helps you manage and autosave your extension's options.
- [webext-base-css](https://github.com/fregante/webext-base-css) - Extremely minimal stylesheet/setup for Web Extensions’ options pages (also dark mode)
- [webext-dynamic-content-scripts](https://github.com/fregante/webext-dynamic-content-scripts) - Automatically registers your content_scripts on domains added via permission.request
diff --git a/source/legacy.ts b/source/legacy.ts
index 1aaa097..734dec9 100644
--- a/source/legacy.ts
+++ b/source/legacy.ts
@@ -1,5 +1,5 @@
import chromeP from 'webext-polyfill-kinda';
-import {isBackgroundPage, isExtensionContext} from 'webext-detect-page';
+import {isBackgroundPage, isExtensionContext} from 'webext-detect';
import toMilliseconds, {type TimeDescriptor} from '@sindresorhus/to-milliseconds';
const cacheDefault = {days: 30};