extension 4.4.0 → 4.4.1-canary.478.4248f9b

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.
package/README.md CHANGED
@@ -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/templates) · [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) · [Templates](https://extension.js.org/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
 
@@ -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/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 |
56
+ | Framework agnostic | [Vanilla](https://extension.js.org/templates#javascript), [TS](https://extension.js.org/templates#typescript), [React](https://extension.js.org/templates#react), [Vue](https://extension.js.org/templates#vue), [Svelte](https://extension.js.org/templates#svelte), [Preact](https://extension.js.org/templates#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/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) |
65
+ | ESNext<br>[Try out](https://extension.js.org/templates#javascript) | TypeScript<br>[Try out](https://extension.js.org/templates#typescript) | WASM<br>[Try out](https://extension.js.org/templates#transformers-js) | React<br>[Try out](https://extension.js.org/templates#react) | Vue<br>[Try out](https://extension.js.org/templates#vue) | Svelte<br>[Try out](https://extension.js.org/templates#svelte) | Preact<br>[Try out](https://extension.js.org/templates#preact) |
66
66
 
67
67
  </div>
68
68
 
@@ -182,13 +182,13 @@ npx extension@latest dev https://github.com/GoogleChrome/chrome-extensions-sampl
182
182
 
183
183
  Add Extension.js to a project, or run it once without installing, with the package manager you already use.
184
184
 
185
- | Package manager | Add to a project | Run without installing |
186
- | :-- | :-- | :-- |
187
- | npm | `npm install extension@latest --save-dev` | `npx extension@latest create my-extension` |
188
- | pnpm | `pnpm add extension@latest --save-dev` | `pnpm dlx extension@latest create my-extension` |
189
- | Yarn | `yarn add extension@latest --dev` | `yarn dlx extension@latest create my-extension` |
190
- | Bun | `bun add --dev extension@latest` | `bunx extension@latest create my-extension` |
191
- | Deno | `deno add npm:extension@latest` | `deno run -A npm:extension@latest create my-extension` |
185
+ | | Package manager | Add to a project | Run without installing |
186
+ | :-: | :-- | :-- | :-- |
187
+ | <img alt="npm" src="https://media.extension.land/logos/package-managers/npm.svg" width="64"> | npm | `npm install extension@latest --save-dev` | `npx extension@latest create my-extension` |
188
+ | <img alt="pnpm" src="https://media.extension.land/logos/package-managers/pnpm.svg" width="64"> | pnpm | `pnpm add extension@latest --save-dev` | `pnpm dlx extension@latest create my-extension` |
189
+ | <img alt="Yarn" src="https://media.extension.land/logos/package-managers/yarn.svg" width="64"> | Yarn | `yarn add extension@latest --dev` | `yarn dlx extension@latest create my-extension` |
190
+ | <img alt="Bun" src="https://media.extension.land/logos/package-managers/bun.svg" width="64"> | Bun | `bun add --dev extension@latest` | `bunx extension@latest create my-extension` |
191
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.extension.land/logos/package-managers/deno-dark.svg"><img alt="Deno" src="https://media.extension.land/logos/package-managers/deno.svg" width="64"></picture> | Deno | `deno add npm:extension@latest` | `deno run -A npm:extension@latest create my-extension` |
192
192
 
193
193
  Which runtime the CLI then executes on is a separate question, answered below.
194
194
 
@@ -209,7 +209,7 @@ Extension.js collects a tiny amount of anonymous telemetry to understand which c
209
209
  - Star the repo if Extension.js helped you ship faster
210
210
  - Join the [Discord](https://discord.gg/BRqbPDfPxb) for help and feedback
211
211
  - Open issues and feature requests on [GitHub](https://github.com/extension-js/extension.js/issues)
212
- - Browse production-ready [examples](https://github.com/extension-js/templates)
212
+ - Browse production-ready [templates](https://extension.js.org/templates)
213
213
 
214
214
  ## Sponsors
215
215
 
package/dist/cli.cjs CHANGED
@@ -18132,7 +18132,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
18132
18132
  ];
18133
18133
  function readyContractErrorCode(code) {
18134
18134
  if ('string' != typeof code) return;
18135
- return READY_CONTRACT_CODES[code.trim().toLowerCase()];
18135
+ const key = code.trim().toLowerCase();
18136
+ return Object.prototype.hasOwnProperty.call(READY_CONTRACT_CODES, key) ? READY_CONTRACT_CODES[key] : void 0;
18136
18137
  }
18137
18138
  function stampedLaunchFailureCode(ready) {
18138
18139
  if ('browser_launch_failed' !== ready.code) return;
@@ -21091,16 +21092,26 @@ Cross-browser compatibility
21091
21092
  var safari_launch = __webpack_require__("./browsers/run-safari/safari-launch/index.ts");
21092
21093
  var safari_packager = __webpack_require__("./browsers/run-safari/safari-packager.ts");
21093
21094
  const STOCK_BROWSER = 'chromium';
21094
- async function resolveConfigBrowser(projectPath, command, loadDevelop = loadExtensionDevelopModule, mode) {
21095
+ async function resolveConfigBrowser(projectPath, command, loadDevelop = loadExtensionDevelopModule, mode, install) {
21095
21096
  try {
21096
21097
  const develop = await loadDevelop();
21097
- if ('function' != typeof develop.loadCommandConfig) return;
21098
- const config = await develop.loadCommandConfig(projectPath, command, {
21099
- mode: mode || void 0,
21100
- browser: STOCK_BROWSER
21101
- });
21102
- const browser = config.browser;
21103
- return 'string' == typeof browser && browser.length > 0 ? browser : void 0;
21098
+ const load = develop.loadCommandConfig;
21099
+ if ('function' != typeof load) return;
21100
+ const read = async ()=>{
21101
+ const { browser } = await load(projectPath, command, {
21102
+ mode: mode || void 0,
21103
+ browser: STOCK_BROWSER
21104
+ });
21105
+ return 'string' == typeof browser && browser.length > 0 ? browser : void 0;
21106
+ };
21107
+ try {
21108
+ return await read();
21109
+ } catch (error) {
21110
+ const installMissing = develop.installMissingProjectDependencies;
21111
+ if (false === install || 'function' != typeof installMissing) throw error;
21112
+ if (!await installMissing(projectPath)) throw error;
21113
+ return await read();
21114
+ }
21104
21115
  } catch {
21105
21116
  return;
21106
21117
  }
@@ -21232,7 +21243,7 @@ Cross-browser compatibility
21232
21243
  })).hook('preAction', refuseUnlistedChoices({
21233
21244
  reportFailure
21234
21245
  })).action(async (pathOrRemoteUrl, { browser: cliBrowser, ...buildOptions })=>{
21235
- const browser = cliBrowser ?? await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'build', loadDevelop, buildOptions.mode?.trim().toLowerCase()) ?? 'chromium';
21246
+ const browser = cliBrowser ?? await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'build', loadDevelop, buildOptions.mode?.trim().toLowerCase(), buildOptions.install) ?? 'chromium';
21236
21247
  if (buildOptions.debug || buildOptions.authorMode) {
21237
21248
  process.env.EXTENSION_DEBUG = '1';
21238
21249
  process.env.EXTENSION_AUTHOR_MODE = 'true';
@@ -22091,7 +22102,7 @@ Cross-browser compatibility
22091
22102
  const { browser: cliBrowser, ...devOptions } = options;
22092
22103
  const binaryPick = browserForBinaryFlags({
22093
22104
  typedBrowser: cliBrowser,
22094
- configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'dev', loadDevelop),
22105
+ configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'dev', loadDevelop, void 0, devOptions.install),
22095
22106
  chromiumBinary: devOptions.chromiumBinary,
22096
22107
  geckoBinary: cliGeckoBinary(devOptions)
22097
22108
  });
@@ -23492,7 +23503,7 @@ Cross-browser compatibility
23492
23503
  const { browser: cliBrowser, ...previewOptions } = options;
23493
23504
  const binaryPick = browserForBinaryFlags({
23494
23505
  typedBrowser: cliBrowser,
23495
- configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'preview', loadDevelop),
23506
+ configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'preview', loadDevelop, void 0, false),
23496
23507
  chromiumBinary: previewOptions.chromiumBinary,
23497
23508
  geckoBinary: cliGeckoBinary(previewOptions)
23498
23509
  });
@@ -24150,7 +24161,7 @@ Cross-browser compatibility
24150
24161
  const { browser: cliBrowser, ...startOptions } = options;
24151
24162
  const binaryPick = browserForBinaryFlags({
24152
24163
  typedBrowser: cliBrowser,
24153
- configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'start', loadDevelop),
24164
+ configBrowser: void 0 !== cliBrowser ? void 0 : await resolveConfigBrowser(pathOrRemoteUrl || process.cwd(), 'start', loadDevelop, void 0, startOptions.install),
24154
24165
  chromiumBinary: startOptions.chromiumBinary,
24155
24166
  geckoBinary: cliGeckoBinary(startOptions)
24156
24167
  });
@@ -1,2 +1,2 @@
1
1
  import { type DevelopFor } from './extension-develop-runtime.js';
2
- export declare function resolveConfigBrowser(projectPath: string, command: 'dev' | 'build' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>, mode?: string): Promise<string | undefined>;
2
+ export declare function resolveConfigBrowser(projectPath: string, command: 'dev' | 'build' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>, mode?: string, install?: boolean): Promise<string | undefined>;
@@ -1,6 +1,6 @@
1
1
  export type DevelopModule = typeof import('extension-develop');
2
2
  export type DevelopPreviewModule = typeof import('extension-develop/preview');
3
- export type DevelopFor<K extends keyof DevelopModule = never> = Pick<DevelopModule, K> & Partial<Pick<DevelopModule, 'loadCommandConfig'>>;
3
+ export type DevelopFor<K extends keyof DevelopModule = never> = Pick<DevelopModule, K> & Partial<Pick<DevelopModule, 'loadCommandConfig' | 'installMissingProjectDependencies'>>;
4
4
  export type DevelopBridge = typeof import('extension-develop/bridge');
5
5
  export type DevelopBrowser = import('extension-develop').BrowserType;
6
6
  export type DevelopLauncher = import('extension-develop').BrowserLauncherFn;
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "extension": "./bin/extension.cjs"
43
43
  },
44
44
  "name": "extension",
45
- "version": "4.4.0",
45
+ "version": "4.4.1-canary.478.4248f9b",
46
46
  "description": "The cross-browser extension framework. Build Chrome, Edge, Firefox, and Safari extensions with no build configuration.",
47
47
  "homepage": "https://extension.js.org/",
48
48
  "funding": "https://github.com/sponsors/cezaraugusto",
@@ -107,9 +107,9 @@
107
107
  "chrome-types": ">=0.1.460",
108
108
  "chromium-location": "2.1.2",
109
109
  "edge-location": "2.3.1",
110
- "extension-create": "4.4.0",
111
- "extension-develop": "4.4.0",
112
- "extension-install": "4.4.0",
110
+ "extension-create": "4.4.1-canary.478.4248f9b",
111
+ "extension-develop": "4.4.1-canary.478.4248f9b",
112
+ "extension-install": "4.4.1-canary.478.4248f9b",
113
113
  "firefox-location2": "3.2.0",
114
114
  "floorp-location": "1.0.0",
115
115
  "librewolf-location": "1.2.1",