extension 4.1.39 → 4.1.40-canary.459.2c1ba7b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +27 -17
  2. package/dist/browsers.cjs +3132 -923
  3. package/dist/cli.cjs +3590 -1115
  4. package/dist/extension/__spec__/command-harness.d.ts +1 -0
  5. package/dist/extension/__spec__/helpers/temp-folders.d.ts +1 -0
  6. package/dist/extension/browsers/__spec__/safari-fake-tools.d.ts +4 -0
  7. package/dist/extension/browsers/__spec__/safari-fake-ui-tools.d.ts +11 -0
  8. package/dist/extension/browsers/browsers-lib/banner.d.ts +2 -0
  9. package/dist/extension/browsers/browsers-lib/binary-env-override.d.ts +12 -0
  10. package/dist/extension/browsers/browsers-lib/boot-registrations-hold.d.ts +9 -0
  11. package/dist/extension/browsers/browsers-lib/built-boot-registrations.d.ts +47 -0
  12. package/dist/extension/browsers/browsers-lib/eval-result-cap.d.ts +15 -0
  13. package/dist/extension/browsers/browsers-lib/locator-env.d.ts +2 -0
  14. package/dist/extension/browsers/browsers-lib/manifest-refusal.d.ts +9 -0
  15. package/dist/extension/browsers/browsers-lib/messages.d.ts +21 -4
  16. package/dist/extension/browsers/browsers-lib/output-binaries-resolver.d.ts +2 -0
  17. package/dist/extension/browsers/browsers-lib/pinned-binary.d.ts +2 -0
  18. package/dist/extension/browsers/browsers-lib/process-teardown.d.ts +6 -0
  19. package/dist/extension/browsers/browsers-lib/ready-stamp.d.ts +28 -0
  20. package/dist/extension/browsers/browsers-lib/real-path.d.ts +7 -0
  21. package/dist/extension/browsers/browsers-lib/resolve-live-pid.d.ts +1 -0
  22. package/dist/extension/browsers/browsers-lib/runtime-options.d.ts +1 -0
  23. package/dist/extension/browsers/browsers-lib/shared-utils.d.ts +2 -0
  24. package/dist/extension/browsers/browsers-types.d.ts +1 -0
  25. package/dist/extension/browsers/index.d.ts +2 -1
  26. package/dist/extension/browsers/run-chromium/cdp/cdp-extension-controller/index.d.ts +8 -0
  27. package/dist/extension/browsers/run-chromium/cdp/ensure-developer-mode.d.ts +3 -1
  28. package/dist/extension/browsers/run-chromium/cdp/ensure-startup-new-tab.d.ts +14 -0
  29. package/dist/extension/browsers/run-chromium/cdp/evaluate-tab-document.d.ts +32 -0
  30. package/dist/extension/browsers/run-chromium/chromium-launch/browser-config.d.ts +6 -0
  31. package/dist/extension/browsers/run-chromium/chromium-launch/dry-run.d.ts +1 -1
  32. package/dist/extension/browsers/run-chromium/chromium-launch/process-handlers.d.ts +1 -1
  33. package/dist/extension/browsers/run-chromium/chromium-types.d.ts +5 -1
  34. package/dist/extension/browsers/run-firefox/firefox-launch/dry-run.d.ts +1 -1
  35. package/dist/extension/browsers/run-firefox/firefox-types.d.ts +4 -1
  36. package/dist/extension/browsers/run-firefox/rdp/evaluate-extension-document.d.ts +22 -0
  37. package/dist/extension/browsers/run-firefox/rdp/rdp-extension-controller/index.d.ts +5 -1
  38. package/dist/extension/browsers/run-firefox/rdp/remote-firefox/firefox-utils.d.ts +1 -0
  39. package/dist/extension/browsers/run-firefox/rdp/remote-firefox/index.d.ts +6 -1
  40. package/dist/extension/browsers/run-firefox/rdp/remote-firefox/manager-tab.d.ts +2 -0
  41. package/dist/extension/browsers/run-firefox/rdp/remote-firefox/moz-id.d.ts +10 -0
  42. package/dist/extension/browsers/run-firefox/rdp/remote-firefox/starting-url.d.ts +3 -1
  43. package/dist/extension/browsers/run-only.d.ts +1 -0
  44. package/dist/extension/browsers/run-safari/safari-launch/index.d.ts +3 -1
  45. package/dist/extension/browsers/run-safari/safari-launch/registry.d.ts +18 -0
  46. package/dist/extension/browsers/run-safari/safari-launch/safari-config.d.ts +1 -0
  47. package/dist/extension/browsers/run-safari/safari-launch/tools.d.ts +5 -0
  48. package/dist/extension/browsers/run-safari/safari-launch/webdriver.d.ts +2 -0
  49. package/dist/extension/browsers/run-safari/safari-types.d.ts +2 -0
  50. package/dist/extension/browsers/run-safari/safari-ui/index.d.ts +12 -0
  51. package/dist/extension/browsers/run-safari/safari-ui/scripts.d.ts +8 -4
  52. package/dist/extension/commands/act.d.ts +6 -0
  53. package/dist/extension/commands/create.d.ts +1 -1
  54. package/dist/extension/commands/doctor.d.ts +2 -0
  55. package/dist/extension/config-types.d.ts +35 -2
  56. package/dist/extension/helpers/localized-manifest-name.d.ts +9 -0
  57. package/dist/extension/helpers/messages.d.ts +4 -2
  58. package/dist/extension/helpers/session-liveness.d.ts +27 -0
  59. package/dist/extension/helpers/session-project-path.d.ts +1 -0
  60. package/dist/extension/helpers/telemetry-cli.d.ts +1 -0
  61. package/dist/extension/helpers/telemetry.d.ts +3 -1
  62. package/dist/extension/helpers/template-catalog.d.ts +1 -1
  63. package/dist/extension/helpers/template-corpus.generated.d.ts +2 -2
  64. package/dist/{753.cjs → t.cjs} +94 -88
  65. package/package.json +11 -8
  66. package/types/env.d.ts +69 -0
  67. package/types/firefox.d.ts +35 -0
  68. package/types/index.d.ts +3 -71
  69. package/types/legacy.d.ts +13 -0
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- [npm-version-image]: https://img.shields.io/npm/v/extension.svg?color=0971fe
1
+ [npm-version-image]: https://img.shields.io/npm/v/extension.svg?color=0065e6
2
2
  [npm-version-url]: https://www.npmjs.com/package/extension
3
- [stars-image]: https://img.shields.io/github/stars/extension-js/extension.js?style=flat&color=0971fe
3
+ [stars-image]: https://img.shields.io/github/stars/extension-js/extension.js?style=flat&color=0065e6
4
4
  [stars-url]: https://github.com/extension-js/extension.js/stargazers
5
- [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main&color=0971fe
5
+ [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main&color=0065e6
6
6
  [action-url]: https://github.com/extension-js/extension.js/actions
7
- [discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat&color=0971fe
7
+ [discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat&color=0065e6
8
8
  [discord-url]: https://discord.gg/BRqbPDfPxb
9
- [bestpractices-image]: https://img.shields.io/cii/level/14662?label=Best%20Practices&style=flat&color=0971fe
9
+ [bestpractices-image]: https://img.shields.io/cii/level/14662?label=Best%20Practices&style=flat&color=0065e6
10
10
  [bestpractices-url]: https://www.bestpractices.dev/projects/14662
11
11
 
12
12
  # Extension.js [![Version][npm-version-image]][npm-version-url] [![Stars][stars-image]][stars-url] [![CI][action-image]][action-url] [![Discord][discord-image]][discord-url] [![Best Practices][bestpractices-image]][bestpractices-url]
@@ -25,7 +25,7 @@ Works with `npm`, `pnpm`, `yarn`, `bun`, and `deno`.
25
25
 
26
26
  The CLI itself runs on Node.js 22.12+, Deno 2.5+, and Bun 1.2+.
27
27
 
28
- [Documentation](https://extension.js.org/docs) · [Examples](https://github.com/extension-js/examples) · [YouTube](https://www.youtube.com/@BrowserExtension) · [Showcase](https://extension.js.org/showcase) · [Blog](https://extension.js.org/blog)
28
+ [Documentation](https://extension.js.org/docs) · [Examples](https://github.com/extension-js/templates) · [YouTube](https://www.youtube.com/@BrowserExtension) · [Showcase](https://extension.js.org/showcase) · [Blog](https://extension.js.org/blog)
29
29
 
30
30
  ## Why Extension.js
31
31
 
@@ -33,10 +33,10 @@ Browser extensions ship with the worst dev experience in modern web. Manifest V3
33
33
 
34
34
  - **Hot Module Replacement** for popup, options, devtools and other extension pages, including React, Vue, Svelte, and Preact components, with targeted reloads for content scripts and the service worker so one save never reloads the whole extension
35
35
  - **Manifest V3 by default**, with automatic adapters for Chrome, Edge, Firefox, and Safari targets
36
- - **One CLI** for Chrome, Edge, Firefox, and any Chromium or Gecko binary
36
+ - **One CLI** for Chrome, Edge, Firefox, Safari, and any Chromium or Gecko binary
37
37
  - **Zero config**, no webpack, no rollup, no plugins to maintain
38
38
  - **First-class** TypeScript, React, Vue, Svelte, and Preact support
39
- - **Production builds** with `extension build --zip`, ready for the Chrome Web Store and Firefox Add-ons
39
+ - **Production builds** with `extension build --zip`, ready for the Chrome Web Store, Edge Add-ons and Firefox Add-ons, and a Safari app built through Xcode on macOS
40
40
  - **Drop-in** for existing extensions with one `devDependency`
41
41
 
42
42
  ## Watch it work
@@ -53,7 +53,7 @@ If you have used [Plasmo](https://www.plasmo.com), [WXT](https://wxt.dev), or [C
53
53
  | Managed browser binaries | `extension install firefox` downloads an isolated build |
54
54
  | Targeted content-script reload across browsers | Built in, only the changed entries re-inject, no plugin glue |
55
55
  | Production zip for the stores | `extension build --zip` |
56
- | Framework agnostic | [Vanilla](https://github.com/extension-js/examples/tree/main/examples/javascript), [TS](https://github.com/extension-js/examples/tree/main/examples/typescript), [React](https://github.com/extension-js/examples/tree/main/examples/react), [Vue](https://github.com/extension-js/examples/tree/main/examples/vue), [Svelte](https://github.com/extension-js/examples/tree/main/examples/svelte), [Preact](https://github.com/extension-js/examples/tree/main/examples/preact), no lock-in |
56
+ | Framework agnostic | [Vanilla](https://github.com/extension-js/templates/tree/main/examples/javascript), [TS](https://github.com/extension-js/templates/tree/main/examples/typescript), [React](https://github.com/extension-js/templates/tree/main/examples/react), [Vue](https://github.com/extension-js/templates/tree/main/examples/vue), [Svelte](https://github.com/extension-js/templates/tree/main/examples/svelte), [Preact](https://github.com/extension-js/templates/tree/main/examples/preact), no lock-in |
57
57
  | Custom Chromium and Gecko binaries | `--chromium-binary`, `--gecko-binary` |
58
58
 
59
59
  ## Frameworks
@@ -62,7 +62,7 @@ If you have used [Plasmo](https://www.plasmo.com), [WXT](https://wxt.dev), or [C
62
62
 
63
63
  | <img alt="ESNext" src="https://github.com/cezaraugusto/extension.js/assets/4672033/a9e2541a-96f0-4caa-9fc9-5fc5c3e901c8" width="70"> | <img alt="TypeScript" src="https://github.com/cezaraugusto/extension.js/assets/4672033/b42c5330-9e2a-4045-99c3-1f7d264dfaf4" width="70"> | <img alt="WASM" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f19edff3-9005-4f50-b05c-fba615896a7f" width="70"> | <img alt="React" src="https://github.com/cezaraugusto/extension.js/assets/4672033/ff64721d-d145-4213-930d-e70193f8d57e" width="70"> | <img alt="Vue" src="https://github.com/cezaraugusto/extension.js/assets/4672033/15f1314a-aa65-4ce2-a3f3-cf53c4f730cf" width="70"> | <img alt="Svelte" src="https://github.com/cezaraugusto/extension.js/assets/4672033/de1082fd-7cf6-4202-8c12-a5c3cd3e5b42" width="70"> | <img alt="Preact" src="https://github.com/cezaraugusto/extension.js/assets/4672033/8807efd9-93e5-4db5-a1d2-9ac524f7ecc2" width="70"> |
64
64
  | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
65
- | ESNext<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/javascript) | TypeScript<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/typescript) | WASM<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/transformers-js) | React<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/react) | Vue<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/vue) | Svelte<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/svelte) | Preact<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/preact) |
65
+ | ESNext<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/javascript) | TypeScript<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/typescript) | WASM<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/transformers-js) | React<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/react) | Vue<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/vue) | Svelte<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/svelte) | Preact<br>[Try out](https://github.com/extension-js/templates/tree/main/examples/preact) |
66
66
 
67
67
  </div>
68
68
 
@@ -74,15 +74,20 @@ Use these flags with `extension dev`, `extension start`, or `extension preview`:
74
74
  - Custom Chromium binary: `--chromium-binary <path-to-binary>`
75
75
  - Custom Gecko (Firefox) binary: `--gecko-binary <path-to-binary>`
76
76
 
77
+ Every browser picks its binary in the same order: the flag above, then the browser's variable (`CHROME_FOR_TESTING_PATH`, `CHROMIUM_BINARY`, `CHROME_BINARY`, `EDGE_BINARY` or `FIREFOX_BINARY`), then the copy `extension install` downloaded, then the system install. A flag or variable that names a path that does not exist stops the command and names the path.
78
+
77
79
  ```bash
78
- # Chrome (system default)
80
+ # Chrome for Testing (the managed copy, offered on the first run)
79
81
  npx extension@latest dev --browser=chrome
80
82
 
81
83
  # Edge
82
84
  npx extension@latest dev --browser=edge
83
85
 
84
- # Custom Chrome/Chromium path
85
- npx extension@latest dev --chromium-binary "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
86
+ # Safari, on macOS with Xcode
87
+ npx extension@latest dev --browser=safari
88
+
89
+ # Custom Chromium path
90
+ npx extension@latest dev --chromium-binary "/Applications/Chromium.app/Contents/MacOS/Chromium"
86
91
 
87
92
  # Custom Firefox path
88
93
  npx extension@latest dev --gecko-binary "/Applications/Firefox.app/Contents/MacOS/firefox"
@@ -98,7 +103,7 @@ npx extension@latest dev --gecko-binary "/Applications/Firefox.app/Contents/MacO
98
103
 
99
104
  ## Ship to the store
100
105
 
101
- Build a production-ready bundle and zip it for submission to the Chrome Web Store, Edge Add-ons, or Firefox AMO:
106
+ Build a production-ready bundle and zip it for submission to the Chrome Web Store, Edge Add-ons, or Firefox AMO. A Safari build produces a macOS app through Xcode instead of a ZIP file:
102
107
 
103
108
  ```bash
104
109
  # Production build
@@ -109,6 +114,9 @@ npx extension@latest build --zip
109
114
 
110
115
  # Per-browser builds
111
116
  npx extension@latest build --browser=firefox --zip
117
+
118
+ # Safari app, on macOS with Xcode
119
+ npx extension@latest build --browser=safari
112
120
  ```
113
121
 
114
122
  Useful flags:
@@ -116,8 +124,10 @@ Useful flags:
116
124
  - `--zip` packages the build into a ZIP ready for store upload
117
125
  - `--zip-source` includes source files for store source-code review
118
126
  - `--zip-filename <name>` controls the output filename, written as `dist/<name>-<browser>.zip`
127
+ - `--zip-dir <path>` writes the ZIP files to that folder instead of `dist`, relative to the project root or absolute
128
+ - `--source-maps` writes a source map beside each script and stylesheet of a production build. The maps stay out of the ZIP file, and the build total counts them apart
119
129
  - `--out-dir <path>` writes the build to `<path>/<browser>` instead of `dist/<browser>`. A build into the folder a live dev session serves is refused, so this is how a build runs beside a dev session
120
- - `--polyfill` enables the cross-browser webextension polyfill
130
+ - `--polyfill` bundles the cross-browser webextension polyfill, off by default in every command. It is for a Chromium older than 148, or older than 152 when the manifest declares a `devtools_page`
121
131
 
122
132
  ## Manage browser binaries
123
133
 
@@ -195,7 +205,7 @@ Which runtime the CLI then executes on is a separate question, answered below.
195
205
  - Star the repo if Extension.js helped you ship faster
196
206
  - Join the [Discord](https://discord.gg/BRqbPDfPxb) for help and feedback
197
207
  - Open issues and feature requests on [GitHub](https://github.com/extension-js/extension.js/issues)
198
- - Browse production-ready [examples](https://github.com/extension-js/examples)
208
+ - Browse production-ready [examples](https://github.com/extension-js/templates)
199
209
 
200
210
  ## Sponsors
201
211
 
@@ -207,7 +217,7 @@ Sponsors help the project ship faster releases, better developer experience, and
207
217
  </p>
208
218
  </div>
209
219
 
210
- Documentation is hosted by [Mintlify](https://mintlify.com/?utm_medium=infrastructure&utm_source=extensionjs) through its open source program. Tiers and placement are listed in [BACKERS.md](https://github.com/extension-js/extension.js/blob/main/BACKERS.md).
220
+ Documentation is hosted by [Mintlify](https://mintlify.com/) through its open source program. Tiers and placement are listed in [BACKERS.md](https://github.com/extension-js/extension.js/blob/main/BACKERS.md).
211
221
 
212
222
  ## Contributing
213
223