wxt 0.17.3 → 0.17.4

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.
@@ -1,5 +1,9 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-P57PW2II.js";
4
+
1
5
  // package.json
2
- var version = "0.17.3";
6
+ var version = "0.17.4";
3
7
 
4
8
  // src/core/utils/paths.ts
5
9
  import systemPath from "node:path";
@@ -907,8 +911,8 @@ var reactRefreshPreamble = "";
907
911
  function devHtmlPrerender(config) {
908
912
  const htmlReloadId = "@wxt/reload-html";
909
913
  const resolvedHtmlReloadId = resolve6(
910
- config.root,
911
- "node_modules/wxt/dist/virtual/reload-html.js"
914
+ config.wxtModuleDir,
915
+ "dist/virtual/reload-html.js"
912
916
  );
913
917
  const virtualReactRefreshId = "@wxt/virtual-react-refresh";
914
918
  const resolvedVirtualReactRefreshId = "\0" + virtualReactRefreshId;
@@ -1253,10 +1257,7 @@ function virtualEntrypoint(type, config) {
1253
1257
  return;
1254
1258
  const inputPath = id.replace(resolvedVirtualId, "");
1255
1259
  const template = await fs7.readFile(
1256
- resolve8(
1257
- config.root,
1258
- `node_modules/wxt/dist/virtual/${type}-entrypoint.js`
1259
- ),
1260
+ resolve8(config.wxtModuleDir, `dist/virtual/${type}-entrypoint.js`),
1260
1261
  "utf-8"
1261
1262
  );
1262
1263
  return template.replace(`virtual:user-${type}`, inputPath);
@@ -1362,8 +1363,8 @@ function webextensionPolyfillMock(config) {
1362
1363
  alias: {
1363
1364
  // Alias to use a mocked version of the polyfill
1364
1365
  "webextension-polyfill": path4.resolve(
1365
- config.root,
1366
- "node_modules/wxt/dist/virtual/mock-browser"
1366
+ config.wxtModuleDir,
1367
+ "dist/virtual/mock-browser"
1367
1368
  )
1368
1369
  }
1369
1370
  },
@@ -1702,6 +1703,7 @@ async function resolveConfig(inlineConfig, command, server) {
1702
1703
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1703
1704
  );
1704
1705
  const wxtDir = path5.resolve(root, ".wxt");
1706
+ const wxtModuleDir = await resolveWxtModuleDir();
1705
1707
  const srcDir = path5.resolve(root, mergedConfig.srcDir ?? root);
1706
1708
  const entrypointsDir = path5.resolve(
1707
1709
  srcDir,
@@ -1752,6 +1754,7 @@ async function resolveConfig(inlineConfig, command, server) {
1752
1754
  outBaseDir,
1753
1755
  outDir,
1754
1756
  publicDir,
1757
+ wxtModuleDir,
1755
1758
  root,
1756
1759
  runnerConfig,
1757
1760
  srcDir,
@@ -1918,6 +1921,10 @@ async function getUnimportOptions(wxtDir, logger, config) {
1918
1921
  defaultOptions
1919
1922
  );
1920
1923
  }
1924
+ async function resolveWxtModuleDir() {
1925
+ const requireResolve = __require?.resolve ?? (await import("node:module")).default.createRequire(import.meta.url).resolve;
1926
+ return path5.resolve(requireResolve("wxt"), "../..");
1927
+ }
1921
1928
 
1922
1929
  // src/core/utils/building/group-entrypoints.ts
1923
1930
  function groupEntrypoints(entrypoints) {
@@ -2007,8 +2014,8 @@ async function importEntrypointFile(path7) {
2007
2014
  esmResolve: true,
2008
2015
  alias: {
2009
2016
  "webextension-polyfill": resolve10(
2010
- wxt.config.root,
2011
- "node_modules/wxt/dist/virtual/mock-browser.js"
2017
+ wxt.config.wxtModuleDir,
2018
+ "dist/virtual/mock-browser.js"
2012
2019
  )
2013
2020
  },
2014
2021
  // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -0,0 +1,11 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ export {
10
+ __require
11
+ };
package/dist/cli.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
- import "./chunk-73I7FAJU.js";
2
+ import {
3
+ __require
4
+ } from "./chunk-73I7FAJU.js";
3
5
 
4
6
  // src/cli/commands.ts
5
7
  import cac from "cac";
@@ -932,8 +934,8 @@ var reactRefreshPreamble = "";
932
934
  function devHtmlPrerender(config) {
933
935
  const htmlReloadId = "@wxt/reload-html";
934
936
  const resolvedHtmlReloadId = resolve6(
935
- config.root,
936
- "node_modules/wxt/dist/virtual/reload-html.js"
937
+ config.wxtModuleDir,
938
+ "dist/virtual/reload-html.js"
937
939
  );
938
940
  const virtualReactRefreshId = "@wxt/virtual-react-refresh";
939
941
  const resolvedVirtualReactRefreshId = "\0" + virtualReactRefreshId;
@@ -1278,10 +1280,7 @@ function virtualEntrypoint(type, config) {
1278
1280
  return;
1279
1281
  const inputPath = id.replace(resolvedVirtualId, "");
1280
1282
  const template = await fs7.readFile(
1281
- resolve8(
1282
- config.root,
1283
- `node_modules/wxt/dist/virtual/${type}-entrypoint.js`
1284
- ),
1283
+ resolve8(config.wxtModuleDir, `dist/virtual/${type}-entrypoint.js`),
1285
1284
  "utf-8"
1286
1285
  );
1287
1286
  return template.replace(`virtual:user-${type}`, inputPath);
@@ -1702,6 +1701,7 @@ async function resolveConfig(inlineConfig, command, server) {
1702
1701
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1703
1702
  );
1704
1703
  const wxtDir = path4.resolve(root, ".wxt");
1704
+ const wxtModuleDir = await resolveWxtModuleDir();
1705
1705
  const srcDir = path4.resolve(root, mergedConfig.srcDir ?? root);
1706
1706
  const entrypointsDir = path4.resolve(
1707
1707
  srcDir,
@@ -1752,6 +1752,7 @@ async function resolveConfig(inlineConfig, command, server) {
1752
1752
  outBaseDir,
1753
1753
  outDir,
1754
1754
  publicDir,
1755
+ wxtModuleDir,
1755
1756
  root,
1756
1757
  runnerConfig,
1757
1758
  srcDir,
@@ -1918,6 +1919,10 @@ async function getUnimportOptions(wxtDir, logger, config) {
1918
1919
  defaultOptions
1919
1920
  );
1920
1921
  }
1922
+ async function resolveWxtModuleDir() {
1923
+ const requireResolve = __require?.resolve ?? (await import("node:module")).default.createRequire(import.meta.url).resolve;
1924
+ return path4.resolve(requireResolve("wxt"), "../..");
1925
+ }
1921
1926
 
1922
1927
  // src/core/utils/building/group-entrypoints.ts
1923
1928
  function groupEntrypoints(entrypoints) {
@@ -2007,8 +2012,8 @@ async function importEntrypointFile(path8) {
2007
2012
  esmResolve: true,
2008
2013
  alias: {
2009
2014
  "webextension-polyfill": resolve10(
2010
- wxt.config.root,
2011
- "node_modules/wxt/dist/virtual/mock-browser.js"
2015
+ wxt.config.wxtModuleDir,
2016
+ "dist/virtual/mock-browser.js"
2012
2017
  )
2013
2018
  },
2014
2019
  // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -2181,7 +2186,7 @@ function getChunkSortWeight(filename) {
2181
2186
  import pc4 from "picocolors";
2182
2187
 
2183
2188
  // package.json
2184
- var version = "0.17.3";
2189
+ var version = "0.17.4";
2185
2190
 
2186
2191
  // src/core/utils/log/printHeader.ts
2187
2192
  import { consola as consola2 } from "consola";
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ContentScriptContext } from './index-v_64CCcw.js';
1
+ import { a as ContentScriptContext } from './index-mYGv2dqk.js';
2
2
  import 'webextension-polyfill';
3
3
 
4
4
  interface IntegratedContentScriptUi<TMounted> extends ContentScriptUi<TMounted> {
@@ -13,6 +13,29 @@ declare class WxtLocationChangeEvent extends Event {
13
13
  *
14
14
  * It also provides several utilities like `ctx.setTimeout` and `ctx.setInterval` that should be used in
15
15
  * content scripts instead of `window.setTimeout` or `window.setInterval`.
16
+ *
17
+ * To create context for testing, you can use the class's constructor:
18
+ *
19
+ * ```ts
20
+ * import { ContentScriptContext } from 'wxt/client';
21
+ *
22
+ * test("storage listener should be removed when context is invalidated", () => {
23
+ * const ctx = new ContentScriptContext('test');
24
+ * const item = storage.defineItem("local:count", { defaultValue: 0 });
25
+ * const watcher = vi.fn();
26
+ *
27
+ * const unwatch = item.watch(watcher);
28
+ * ctx.onInvalidated(unwatch); // Listen for invalidate here
29
+ *
30
+ * await item.setValue(1);
31
+ * expect(watcher).toBeCalledTimes(1);
32
+ * expect(watcher).toBeCalledWith(1, 0);
33
+ *
34
+ * ctx.notifyInvalidated(); // Use this function to invalidate the context
35
+ * await item.setValue(2);
36
+ * expect(watcher).toBeCalledTimes(1);
37
+ * });
38
+ * ```
16
39
  */
17
40
  declare class ContentScriptContext implements AbortController {
18
41
  #private;
@@ -20,6 +20,29 @@ declare class WxtLocationChangeEvent extends Event {
20
20
  *
21
21
  * It also provides several utilities like `ctx.setTimeout` and `ctx.setInterval` that should be used in
22
22
  * content scripts instead of `window.setTimeout` or `window.setInterval`.
23
+ *
24
+ * To create context for testing, you can use the class's constructor:
25
+ *
26
+ * ```ts
27
+ * import { ContentScriptContext } from 'wxt/client';
28
+ *
29
+ * test("storage listener should be removed when context is invalidated", () => {
30
+ * const ctx = new ContentScriptContext('test');
31
+ * const item = storage.defineItem("local:count", { defaultValue: 0 });
32
+ * const watcher = vi.fn();
33
+ *
34
+ * const unwatch = item.watch(watcher);
35
+ * ctx.onInvalidated(unwatch); // Listen for invalidate here
36
+ *
37
+ * await item.setValue(1);
38
+ * expect(watcher).toBeCalledTimes(1);
39
+ * expect(watcher).toBeCalledWith(1, 0);
40
+ *
41
+ * ctx.notifyInvalidated(); // Use this function to invalidate the context
42
+ * await item.setValue(2);
43
+ * expect(watcher).toBeCalledTimes(1);
44
+ * });
45
+ * ```
23
46
  */
24
47
  declare class ContentScriptContext implements AbortController {
25
48
  #private;
@@ -953,6 +976,10 @@ interface ResolvedConfig {
953
976
  outBaseDir: string;
954
977
  outDir: string;
955
978
  debug: boolean;
979
+ /**
980
+ * Directory pointing to `node_modules/wxt`, wherever WXT is installed.
981
+ */
982
+ wxtModuleDir: string;
956
983
  mode: string;
957
984
  command: 'build' | 'serve';
958
985
  browser: TargetBrowser;
@@ -20,6 +20,29 @@ declare class WxtLocationChangeEvent extends Event {
20
20
  *
21
21
  * It also provides several utilities like `ctx.setTimeout` and `ctx.setInterval` that should be used in
22
22
  * content scripts instead of `window.setTimeout` or `window.setInterval`.
23
+ *
24
+ * To create context for testing, you can use the class's constructor:
25
+ *
26
+ * ```ts
27
+ * import { ContentScriptContext } from 'wxt/client';
28
+ *
29
+ * test("storage listener should be removed when context is invalidated", () => {
30
+ * const ctx = new ContentScriptContext('test');
31
+ * const item = storage.defineItem("local:count", { defaultValue: 0 });
32
+ * const watcher = vi.fn();
33
+ *
34
+ * const unwatch = item.watch(watcher);
35
+ * ctx.onInvalidated(unwatch); // Listen for invalidate here
36
+ *
37
+ * await item.setValue(1);
38
+ * expect(watcher).toBeCalledTimes(1);
39
+ * expect(watcher).toBeCalledWith(1, 0);
40
+ *
41
+ * ctx.notifyInvalidated(); // Use this function to invalidate the context
42
+ * await item.setValue(2);
43
+ * expect(watcher).toBeCalledTimes(1);
44
+ * });
45
+ * ```
23
46
  */
24
47
  declare class ContentScriptContext implements AbortController {
25
48
  #private;
@@ -953,6 +976,10 @@ interface ResolvedConfig {
953
976
  outBaseDir: string;
954
977
  outDir: string;
955
978
  debug: boolean;
979
+ /**
980
+ * Directory pointing to `node_modules/wxt`, wherever WXT is installed.
981
+ */
982
+ wxtModuleDir: string;
956
983
  mode: string;
957
984
  command: 'build' | 'serve';
958
985
  browser: TargetBrowser;
package/dist/index.cjs CHANGED
@@ -970,8 +970,8 @@ var reactRefreshPreamble = "";
970
970
  function devHtmlPrerender(config) {
971
971
  const htmlReloadId = "@wxt/reload-html";
972
972
  const resolvedHtmlReloadId = (0, import_node_path4.resolve)(
973
- config.root,
974
- "node_modules/wxt/dist/virtual/reload-html.js"
973
+ config.wxtModuleDir,
974
+ "dist/virtual/reload-html.js"
975
975
  );
976
976
  const virtualReactRefreshId = "@wxt/virtual-react-refresh";
977
977
  const resolvedVirtualReactRefreshId = "\0" + virtualReactRefreshId;
@@ -1316,10 +1316,7 @@ function virtualEntrypoint(type, config) {
1316
1316
  return;
1317
1317
  const inputPath = id.replace(resolvedVirtualId, "");
1318
1318
  const template = await import_fs_extra7.default.readFile(
1319
- (0, import_path6.resolve)(
1320
- config.root,
1321
- `node_modules/wxt/dist/virtual/${type}-entrypoint.js`
1322
- ),
1319
+ (0, import_path6.resolve)(config.wxtModuleDir, `dist/virtual/${type}-entrypoint.js`),
1323
1320
  "utf-8"
1324
1321
  );
1325
1322
  return template.replace(`virtual:user-${type}`, inputPath);
@@ -1714,6 +1711,7 @@ function isModuleInstalled(name) {
1714
1711
  }
1715
1712
 
1716
1713
  // src/core/utils/building/resolve-config.ts
1714
+ var import_meta = {};
1717
1715
  async function resolveConfig(inlineConfig, command, server) {
1718
1716
  let userConfig = {};
1719
1717
  let userConfigMetadata;
@@ -1743,6 +1741,7 @@ async function resolveConfig(inlineConfig, command, server) {
1743
1741
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1744
1742
  );
1745
1743
  const wxtDir = import_node_path9.default.resolve(root, ".wxt");
1744
+ const wxtModuleDir = await resolveWxtModuleDir();
1746
1745
  const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
1747
1746
  const entrypointsDir = import_node_path9.default.resolve(
1748
1747
  srcDir,
@@ -1793,6 +1792,7 @@ async function resolveConfig(inlineConfig, command, server) {
1793
1792
  outBaseDir,
1794
1793
  outDir,
1795
1794
  publicDir,
1795
+ wxtModuleDir,
1796
1796
  root,
1797
1797
  runnerConfig,
1798
1798
  srcDir,
@@ -1959,6 +1959,10 @@ async function getUnimportOptions(wxtDir, logger, config) {
1959
1959
  defaultOptions
1960
1960
  );
1961
1961
  }
1962
+ async function resolveWxtModuleDir() {
1963
+ const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
1964
+ return import_node_path9.default.resolve(requireResolve("wxt"), "../..");
1965
+ }
1962
1966
 
1963
1967
  // src/core/utils/building/group-entrypoints.ts
1964
1968
  function groupEntrypoints(entrypoints) {
@@ -2025,7 +2029,7 @@ ${noImports}`;
2025
2029
  // src/core/utils/building/import-entrypoint.ts
2026
2030
  var import_esbuild = require("esbuild");
2027
2031
  var import_node_url = require("url");
2028
- var import_meta = {};
2032
+ var import_meta2 = {};
2029
2033
  async function importEntrypointFile(path9) {
2030
2034
  wxt.logger.debug("Loading file metadata:", path9);
2031
2035
  const normalPath = normalizePath(path9);
@@ -2042,15 +2046,15 @@ async function importEntrypointFile(path9) {
2042
2046
  ["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
2043
2047
  );
2044
2048
  const jiti = (0, import_jiti.default)(
2045
- typeof __filename !== "undefined" ? __filename : (0, import_node_url.fileURLToPath)(import_meta.url),
2049
+ typeof __filename !== "undefined" ? __filename : (0, import_node_url.fileURLToPath)(import_meta2.url),
2046
2050
  {
2047
2051
  cache: false,
2048
2052
  debug: wxt.config.debug,
2049
2053
  esmResolve: true,
2050
2054
  alias: {
2051
2055
  "webextension-polyfill": (0, import_node_path10.resolve)(
2052
- wxt.config.root,
2053
- "node_modules/wxt/dist/virtual/mock-browser.js"
2056
+ wxt.config.wxtModuleDir,
2057
+ "dist/virtual/mock-browser.js"
2054
2058
  )
2055
2059
  },
2056
2060
  // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -2223,7 +2227,7 @@ function getChunkSortWeight(filename) {
2223
2227
  var import_picocolors4 = __toESM(require("picocolors"), 1);
2224
2228
 
2225
2229
  // package.json
2226
- var version = "0.17.3";
2230
+ var version = "0.17.4";
2227
2231
 
2228
2232
  // src/core/utils/log/printHeader.ts
2229
2233
  var import_consola2 = require("consola");
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-V1QWdhdh.cjs';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-V1QWdhdh.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-vpYNIeCJ.cjs';
2
+ export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-vpYNIeCJ.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
64
64
  */
65
65
  declare function zip(config?: InlineConfig): Promise<string[]>;
66
66
 
67
- var version = "0.17.3";
67
+ var version = "0.17.4";
68
68
 
69
69
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-V1QWdhdh.js';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-V1QWdhdh.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-vpYNIeCJ.js';
2
+ export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-vpYNIeCJ.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
64
64
  */
65
65
  declare function zip(config?: InlineConfig): Promise<string[]>;
66
66
 
67
- var version = "0.17.3";
67
+ var version = "0.17.4";
68
68
 
69
69
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -17,7 +17,8 @@ import {
17
17
  unnormalizePath,
18
18
  version,
19
19
  wxt
20
- } from "./chunk-ILVTCCLE.js";
20
+ } from "./chunk-E5MGUY6P.js";
21
+ import "./chunk-P57PW2II.js";
21
22
 
22
23
  // src/core/build.ts
23
24
  async function build(config) {
package/dist/sandbox.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { U as UnlistedScriptDefinition, B as BackgroundDefinition, C as ContentScriptDefinition } from './index-v_64CCcw.js';
1
+ import { U as UnlistedScriptDefinition, B as BackgroundDefinition, C as ContentScriptDefinition } from './index-mYGv2dqk.js';
2
2
  export * from '@webext-core/match-patterns';
3
3
  import 'webextension-polyfill';
4
4
 
package/dist/storage.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "./chunk-P57PW2II.js";
2
+
1
3
  // src/browser.ts
2
4
  import originalBrowser from "webextension-polyfill";
3
5
  var browser = originalBrowser;
package/dist/testing.cjs CHANGED
@@ -75,8 +75,8 @@ var reactRefreshPreamble = "";
75
75
  function devHtmlPrerender(config) {
76
76
  const htmlReloadId = "@wxt/reload-html";
77
77
  const resolvedHtmlReloadId = (0, import_node_path3.resolve)(
78
- config.root,
79
- "node_modules/wxt/dist/virtual/reload-html.js"
78
+ config.wxtModuleDir,
79
+ "dist/virtual/reload-html.js"
80
80
  );
81
81
  const virtualReactRefreshId = "@wxt/virtual-react-refresh";
82
82
  const resolvedVirtualReactRefreshId = "\0" + virtualReactRefreshId;
@@ -412,10 +412,7 @@ function virtualEntrypoint(type, config) {
412
412
  return;
413
413
  const inputPath = id.replace(resolvedVirtualId, "");
414
414
  const template = await import_fs_extra2.default.readFile(
415
- (0, import_path2.resolve)(
416
- config.root,
417
- `node_modules/wxt/dist/virtual/${type}-entrypoint.js`
418
- ),
415
+ (0, import_path2.resolve)(config.wxtModuleDir, `dist/virtual/${type}-entrypoint.js`),
419
416
  "utf-8"
420
417
  );
421
418
  return template.replace(`virtual:user-${type}`, inputPath);
@@ -579,8 +576,8 @@ function webextensionPolyfillMock(config) {
579
576
  alias: {
580
577
  // Alias to use a mocked version of the polyfill
581
578
  "webextension-polyfill": import_node_path6.default.resolve(
582
- config.root,
583
- "node_modules/wxt/dist/virtual/mock-browser"
579
+ config.wxtModuleDir,
580
+ "dist/virtual/mock-browser"
584
581
  )
585
582
  }
586
583
  },
@@ -979,6 +976,7 @@ function isModuleInstalled(name) {
979
976
  }
980
977
 
981
978
  // src/core/utils/building/resolve-config.ts
979
+ var import_meta = {};
982
980
  async function resolveConfig(inlineConfig, command, server) {
983
981
  let userConfig = {};
984
982
  let userConfigMetadata;
@@ -1008,6 +1006,7 @@ async function resolveConfig(inlineConfig, command, server) {
1008
1006
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1009
1007
  );
1010
1008
  const wxtDir = import_node_path9.default.resolve(root, ".wxt");
1009
+ const wxtModuleDir = await resolveWxtModuleDir();
1011
1010
  const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
1012
1011
  const entrypointsDir = import_node_path9.default.resolve(
1013
1012
  srcDir,
@@ -1058,6 +1057,7 @@ async function resolveConfig(inlineConfig, command, server) {
1058
1057
  outBaseDir,
1059
1058
  outDir,
1060
1059
  publicDir,
1060
+ wxtModuleDir,
1061
1061
  root,
1062
1062
  runnerConfig,
1063
1063
  srcDir,
@@ -1224,6 +1224,10 @@ async function getUnimportOptions(wxtDir, logger, config) {
1224
1224
  defaultOptions
1225
1225
  );
1226
1226
  }
1227
+ async function resolveWxtModuleDir() {
1228
+ const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
1229
+ return import_node_path9.default.resolve(requireResolve("wxt"), "../..");
1230
+ }
1227
1231
 
1228
1232
  // src/core/utils/building/import-entrypoint.ts
1229
1233
  var import_jiti = __toESM(require("jiti"), 1);
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-V1QWdhdh.cjs';
3
+ import { I as InlineConfig } from './index-vpYNIeCJ.cjs';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-V1QWdhdh.js';
3
+ import { I as InlineConfig } from './index-vpYNIeCJ.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-ILVTCCLE.js";
8
+ } from "./chunk-E5MGUY6P.js";
9
+ import "./chunk-P57PW2II.js";
9
10
 
10
11
  // src/testing/fake-browser.ts
11
12
  import { fakeBrowser } from "@webext-core/fake-browser";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.17.3",
4
+ "version": "0.17.4",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }