wxt 0.13.1 → 0.13.3

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
@@ -9,9 +9,8 @@
9
9
  <a href="https://www.npmjs.com/package/wxt" target="_blank"><img alt="npm" src="https://img.shields.io/npm/dm/wxt?labelColor=black&color=%234fa048"></a>
10
10
  <span> </span>
11
11
  <a href="https://github.com/wxt-dev/wxt/blob/main/LICENSE" target="_blank"><img alt="NPM" src="https://img.shields.io/npm/l/wxt?labelColor=black&color=%234fa048"></a>
12
- <!-- Hide code coverage while it's broken -->
13
- <!-- <span> </span>
14
- <a href="https://codecov.io/github/wxt-dev/wxt" target="_blank"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/wxt-dev/wxt?labelColor=black&color=%234fa048"></a> -->
12
+ <span> </span>
13
+ <a href="https://codecov.io/github/wxt-dev/wxt" target="_blank"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/wxt-dev/wxt?labelColor=black&color=%234fa048"></a>
15
14
  </p>
16
15
 
17
16
  <p align="center">
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.13.1";
2
+ var version = "0.13.3";
3
3
 
4
4
  // src/core/utils/arrays.ts
5
5
  function every(array, predicate) {
@@ -1751,27 +1751,42 @@ async function writeManifest(manifest, output, config) {
1751
1751
  fileName: "manifest.json"
1752
1752
  });
1753
1753
  }
1754
- async function generateMainfest(entrypoints, buildOutput, config) {
1754
+ async function generateManifest(entrypoints, buildOutput, config) {
1755
1755
  const pkg = await getPackageJson(config);
1756
- const versionName = config.manifest.version_name ?? pkg?.version;
1757
- const version2 = config.manifest.version ?? simplifyVersion(pkg?.version);
1756
+ let versionName = config.manifest.version_name ?? config.manifest.version ?? pkg?.version;
1757
+ if (versionName == null) {
1758
+ versionName = "0.0.0";
1759
+ config.logger.warn(
1760
+ 'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/manifest.html#version-and-version-name'
1761
+ );
1762
+ }
1763
+ let version2 = config.manifest.version ?? simplifyVersion(versionName);
1758
1764
  const baseManifest = {
1759
1765
  manifest_version: config.manifestVersion,
1760
1766
  name: pkg?.name,
1761
1767
  description: pkg?.description,
1762
1768
  version: version2,
1763
- version_name: (
1764
- // Firefox doesn't support version_name
1765
- config.browser === "firefox" || versionName === version2 ? void 0 : versionName
1766
- ),
1767
1769
  short_name: pkg?.shortName,
1768
1770
  icons: discoverIcons(buildOutput)
1769
1771
  };
1772
+ if (config.command === "serve") {
1773
+ baseManifest.commands = {
1774
+ "wxt:reload-extension": {
1775
+ description: "Reload the extension during development",
1776
+ suggested_key: {
1777
+ default: "Ctrl+E"
1778
+ }
1779
+ }
1780
+ };
1781
+ }
1770
1782
  const userManifest = config.manifest;
1771
1783
  const manifest = defu3(
1772
1784
  userManifest,
1773
1785
  baseManifest
1774
1786
  );
1787
+ manifest.version = version2;
1788
+ manifest.version_name = // Firefox doesn't support version_name
1789
+ config.browser === "firefox" || versionName === version2 ? void 0 : versionName;
1775
1790
  addEntrypoints(manifest, entrypoints, buildOutput, config);
1776
1791
  if (config.command === "serve")
1777
1792
  addDevModeCsp(manifest, config);
@@ -2139,7 +2154,7 @@ async function rebuild(config, entrypointGroups, existingOutput = {
2139
2154
  steps: [...existingOutput.steps, ...newOutput.steps],
2140
2155
  publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets]
2141
2156
  };
2142
- const newManifest = await generateMainfest(
2157
+ const newManifest = await generateManifest(
2143
2158
  allEntrypoints,
2144
2159
  mergedOutput,
2145
2160
  config
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import "./chunk-VBXJIVYU.js";
4
4
  import cac from "cac";
5
5
 
6
6
  // package.json
7
- var version = "0.13.1";
7
+ var version = "0.13.3";
8
8
 
9
9
  // src/core/utils/fs.ts
10
10
  import fs from "fs-extra";
@@ -2048,27 +2048,42 @@ async function writeManifest(manifest, output, config) {
2048
2048
  fileName: "manifest.json"
2049
2049
  });
2050
2050
  }
2051
- async function generateMainfest(entrypoints, buildOutput, config) {
2051
+ async function generateManifest(entrypoints, buildOutput, config) {
2052
2052
  const pkg = await getPackageJson(config);
2053
- const versionName = config.manifest.version_name ?? pkg?.version;
2054
- const version2 = config.manifest.version ?? simplifyVersion(pkg?.version);
2053
+ let versionName = config.manifest.version_name ?? config.manifest.version ?? pkg?.version;
2054
+ if (versionName == null) {
2055
+ versionName = "0.0.0";
2056
+ config.logger.warn(
2057
+ 'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/manifest.html#version-and-version-name'
2058
+ );
2059
+ }
2060
+ let version2 = config.manifest.version ?? simplifyVersion(versionName);
2055
2061
  const baseManifest = {
2056
2062
  manifest_version: config.manifestVersion,
2057
2063
  name: pkg?.name,
2058
2064
  description: pkg?.description,
2059
2065
  version: version2,
2060
- version_name: (
2061
- // Firefox doesn't support version_name
2062
- config.browser === "firefox" || versionName === version2 ? void 0 : versionName
2063
- ),
2064
2066
  short_name: pkg?.shortName,
2065
2067
  icons: discoverIcons(buildOutput)
2066
2068
  };
2069
+ if (config.command === "serve") {
2070
+ baseManifest.commands = {
2071
+ "wxt:reload-extension": {
2072
+ description: "Reload the extension during development",
2073
+ suggested_key: {
2074
+ default: "Ctrl+E"
2075
+ }
2076
+ }
2077
+ };
2078
+ }
2067
2079
  const userManifest = config.manifest;
2068
2080
  const manifest = defu3(
2069
2081
  userManifest,
2070
2082
  baseManifest
2071
2083
  );
2084
+ manifest.version = version2;
2085
+ manifest.version_name = // Firefox doesn't support version_name
2086
+ config.browser === "firefox" || versionName === version2 ? void 0 : versionName;
2072
2087
  addEntrypoints(manifest, entrypoints, buildOutput, config);
2073
2088
  if (config.command === "serve")
2074
2089
  addDevModeCsp(manifest, config);
@@ -2436,7 +2451,7 @@ async function rebuild(config, entrypointGroups, existingOutput = {
2436
2451
  steps: [...existingOutput.steps, ...newOutput.steps],
2437
2452
  publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets]
2438
2453
  };
2439
- const newManifest = await generateMainfest(
2454
+ const newManifest = await generateManifest(
2440
2455
  allEntrypoints,
2441
2456
  mergedOutput,
2442
2457
  config
package/dist/client.d.ts CHANGED
@@ -61,8 +61,8 @@ interface ContentScriptAnchoredOptions {
61
61
  }
62
62
 
63
63
  /**
64
- * Utility for mounting content script UI's with isolated styles. Automatically removed from the DOM
65
- * when the content script's context is invalidated.
64
+ * Utility for mounting content script UI's with isolated styles and controlled event bubbling.
65
+ * Automatically removed from the DOM when the content script's context is invalidated.
66
66
  *
67
67
  * See https://wxt.dev/guide/content-script-ui.html for full documentation.
68
68
  *
@@ -82,7 +82,7 @@ interface ContentScriptAnchoredOptions {
82
82
  * const app = document.createElement("div");
83
83
  * app.textContent = "Content Script UI";
84
84
  * container.append(app);
85
- * }
85
+ * },
86
86
  * })
87
87
  * ui.mount();
88
88
  * }
@@ -142,6 +142,15 @@ type ContentScriptUiOptions<TApp> = ContentScriptPositioningOptions & ContentScr
142
142
  * See https://wxt.dev/guide/content-script-ui.html for more info.
143
143
  */
144
144
  css?: string;
145
+ /**
146
+ * When enabled, `event.stopPropagation` will be called on events trying to bubble out of the
147
+ * shadow root.
148
+ *
149
+ * - Set to `true` to stop the propagation of a default set of events,
150
+ * `["keyup", "keydown", "keypress"]`
151
+ * - Set to an array of event names to stop the propagation of a custom list of events
152
+ */
153
+ isolateEvents?: boolean | string[];
145
154
  };
146
155
 
147
156
  /**
package/dist/client.js CHANGED
@@ -320,7 +320,8 @@ async function createContentScriptUi(ctx, options) {
320
320
  css: {
321
321
  textContent: css.join("\n").trim()
322
322
  },
323
- mode: "open"
323
+ mode: "open",
324
+ isolateEvents: options.isolateEvents
324
325
  });
325
326
  let mounted;
326
327
  const mount = () => {
package/dist/index.cjs CHANGED
@@ -4334,7 +4334,7 @@ function getChunkSortWeight(filename) {
4334
4334
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4335
4335
 
4336
4336
  // package.json
4337
- var version = "0.13.1";
4337
+ var version = "0.13.3";
4338
4338
 
4339
4339
  // src/core/utils/log/printHeader.ts
4340
4340
  var import_consola2 = require("consola");
@@ -4474,27 +4474,42 @@ async function writeManifest(manifest, output, config) {
4474
4474
  fileName: "manifest.json"
4475
4475
  });
4476
4476
  }
4477
- async function generateMainfest(entrypoints, buildOutput, config) {
4477
+ async function generateManifest(entrypoints, buildOutput, config) {
4478
4478
  const pkg = await getPackageJson(config);
4479
- const versionName = config.manifest.version_name ?? pkg?.version;
4480
- const version2 = config.manifest.version ?? simplifyVersion(pkg?.version);
4479
+ let versionName = config.manifest.version_name ?? config.manifest.version ?? pkg?.version;
4480
+ if (versionName == null) {
4481
+ versionName = "0.0.0";
4482
+ config.logger.warn(
4483
+ 'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/manifest.html#version-and-version-name'
4484
+ );
4485
+ }
4486
+ let version2 = config.manifest.version ?? simplifyVersion(versionName);
4481
4487
  const baseManifest = {
4482
4488
  manifest_version: config.manifestVersion,
4483
4489
  name: pkg?.name,
4484
4490
  description: pkg?.description,
4485
4491
  version: version2,
4486
- version_name: (
4487
- // Firefox doesn't support version_name
4488
- config.browser === "firefox" || versionName === version2 ? void 0 : versionName
4489
- ),
4490
4492
  short_name: pkg?.shortName,
4491
4493
  icons: discoverIcons(buildOutput)
4492
4494
  };
4495
+ if (config.command === "serve") {
4496
+ baseManifest.commands = {
4497
+ "wxt:reload-extension": {
4498
+ description: "Reload the extension during development",
4499
+ suggested_key: {
4500
+ default: "Ctrl+E"
4501
+ }
4502
+ }
4503
+ };
4504
+ }
4493
4505
  const userManifest = config.manifest;
4494
4506
  const manifest = (0, import_defu3.default)(
4495
4507
  userManifest,
4496
4508
  baseManifest
4497
4509
  );
4510
+ manifest.version = version2;
4511
+ manifest.version_name = // Firefox doesn't support version_name
4512
+ config.browser === "firefox" || versionName === version2 ? void 0 : versionName;
4498
4513
  addEntrypoints(manifest, entrypoints, buildOutput, config);
4499
4514
  if (config.command === "serve")
4500
4515
  addDevModeCsp(manifest, config);
@@ -4862,7 +4877,7 @@ async function rebuild(config, entrypointGroups, existingOutput = {
4862
4877
  steps: [...existingOutput.steps, ...newOutput.steps],
4863
4878
  publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets]
4864
4879
  };
4865
- const newManifest = await generateMainfest(
4880
+ const newManifest = await generateManifest(
4866
4881
  allEntrypoints,
4867
4882
  mergedOutput,
4868
4883
  config
package/dist/index.d.cts CHANGED
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.13.1";
65
+ var version = "0.13.3";
66
66
 
67
67
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.13.1";
65
+ var version = "0.13.3";
66
66
 
67
67
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  rebuild,
16
16
  resolvePerBrowserOption,
17
17
  version
18
- } from "./chunk-7UUH3573.js";
18
+ } from "./chunk-EWVNLDDM.js";
19
19
  import "./chunk-VBXJIVYU.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-7UUH3573.js";
8
+ } from "./chunk-EWVNLDDM.js";
9
9
  import "./chunk-VBXJIVYU.js";
10
10
 
11
11
  // src/testing/fake-browser.ts
@@ -116,6 +116,11 @@ if (__COMMAND__ === "serve") {
116
116
  } catch (err) {
117
117
  logger.error("Failed to setup web socket connection with dev server", err);
118
118
  }
119
+ browser3.commands.onCommand.addListener((command) => {
120
+ if (command === "wxt:reload-extension") {
121
+ browser3.runtime.reload();
122
+ }
123
+ });
119
124
  }
120
125
  try {
121
126
  const res = definition.main();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.13.1",
4
+ "version": "0.13.3",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -84,7 +84,7 @@
84
84
  "dependencies": {
85
85
  "@types/webextension-polyfill": "^0.10.5",
86
86
  "@webext-core/fake-browser": "^1.3.1",
87
- "@webext-core/isolated-element": "^1.0.4",
87
+ "@webext-core/isolated-element": "^1.1.1",
88
88
  "@webext-core/match-patterns": "^1.0.3",
89
89
  "async-mutex": "^0.4.0",
90
90
  "c12": "^1.5.1",
@@ -139,7 +139,7 @@
139
139
  "typedoc-plugin-markdown": "4.0.0-next.23",
140
140
  "typedoc-vitepress-theme": "1.0.0-next.3",
141
141
  "typescript": "^5.3.2",
142
- "vitepress": "1.0.0-rc.31",
142
+ "vitepress": "1.0.0-rc.34",
143
143
  "vitest": "^1.1.0",
144
144
  "vitest-mock-extended": "^1.3.1",
145
145
  "vue": "^3.3.10"
@@ -168,7 +168,7 @@
168
168
  "compile:wxt": "tsc --noEmit",
169
169
  "compile:virtual": "tsc --noEmit -p src/virtual",
170
170
  "test": "vitest",
171
- "test:coverage": "vitest run --coverage",
171
+ "test:coverage": "vitest run --coverage.enabled \"--coverage.include=src/**\" \"--coverage.exclude=src/core/utils/testing/**\" \"--coverage.exclude=**/*.d.ts\"",
172
172
  "prepublish": "pnpm -s build",
173
173
  "docs:gen": "typedoc --options docs/typedoc.json",
174
174
  "docs:dev": "pnpm -s docs:gen && vitepress dev docs",