wxt 0.17.3 → 0.17.4-alpha1

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-alpha1";
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 = 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,9 @@ async function getUnimportOptions(wxtDir, logger, config) {
1918
1921
  defaultOptions
1919
1922
  );
1920
1923
  }
1924
+ function resolveWxtModuleDir() {
1925
+ return path5.resolve(__require.resolve("wxt"), "../..");
1926
+ }
1921
1927
 
1922
1928
  // src/core/utils/building/group-entrypoints.ts
1923
1929
  function groupEntrypoints(entrypoints) {
@@ -2007,8 +2013,8 @@ async function importEntrypointFile(path7) {
2007
2013
  esmResolve: true,
2008
2014
  alias: {
2009
2015
  "webextension-polyfill": resolve10(
2010
- wxt.config.root,
2011
- "node_modules/wxt/dist/virtual/mock-browser.js"
2016
+ wxt.config.wxtModuleDir,
2017
+ "dist/virtual/mock-browser.js"
2012
2018
  )
2013
2019
  },
2014
2020
  // 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 = 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,9 @@ async function getUnimportOptions(wxtDir, logger, config) {
1918
1919
  defaultOptions
1919
1920
  );
1920
1921
  }
1922
+ function resolveWxtModuleDir() {
1923
+ return path4.resolve(__require.resolve("wxt"), "../..");
1924
+ }
1921
1925
 
1922
1926
  // src/core/utils/building/group-entrypoints.ts
1923
1927
  function groupEntrypoints(entrypoints) {
@@ -2007,8 +2011,8 @@ async function importEntrypointFile(path8) {
2007
2011
  esmResolve: true,
2008
2012
  alias: {
2009
2013
  "webextension-polyfill": resolve10(
2010
- wxt.config.root,
2011
- "node_modules/wxt/dist/virtual/mock-browser.js"
2014
+ wxt.config.wxtModuleDir,
2015
+ "dist/virtual/mock-browser.js"
2012
2016
  )
2013
2017
  },
2014
2018
  // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -2181,7 +2185,7 @@ function getChunkSortWeight(filename) {
2181
2185
  import pc4 from "picocolors";
2182
2186
 
2183
2187
  // package.json
2184
- var version = "0.17.3";
2188
+ var version = "0.17.4-alpha1";
2185
2189
 
2186
2190
  // src/core/utils/log/printHeader.ts
2187
2191
  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);
@@ -1743,6 +1740,7 @@ async function resolveConfig(inlineConfig, command, server) {
1743
1740
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1744
1741
  );
1745
1742
  const wxtDir = import_node_path9.default.resolve(root, ".wxt");
1743
+ const wxtModuleDir = resolveWxtModuleDir();
1746
1744
  const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
1747
1745
  const entrypointsDir = import_node_path9.default.resolve(
1748
1746
  srcDir,
@@ -1793,6 +1791,7 @@ async function resolveConfig(inlineConfig, command, server) {
1793
1791
  outBaseDir,
1794
1792
  outDir,
1795
1793
  publicDir,
1794
+ wxtModuleDir,
1796
1795
  root,
1797
1796
  runnerConfig,
1798
1797
  srcDir,
@@ -1959,6 +1958,9 @@ async function getUnimportOptions(wxtDir, logger, config) {
1959
1958
  defaultOptions
1960
1959
  );
1961
1960
  }
1961
+ function resolveWxtModuleDir() {
1962
+ return import_node_path9.default.resolve(require.resolve("wxt"), "../..");
1963
+ }
1962
1964
 
1963
1965
  // src/core/utils/building/group-entrypoints.ts
1964
1966
  function groupEntrypoints(entrypoints) {
@@ -2049,8 +2051,8 @@ async function importEntrypointFile(path9) {
2049
2051
  esmResolve: true,
2050
2052
  alias: {
2051
2053
  "webextension-polyfill": (0, import_node_path10.resolve)(
2052
- wxt.config.root,
2053
- "node_modules/wxt/dist/virtual/mock-browser.js"
2054
+ wxt.config.wxtModuleDir,
2055
+ "dist/virtual/mock-browser.js"
2054
2056
  )
2055
2057
  },
2056
2058
  // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -2223,7 +2225,7 @@ function getChunkSortWeight(filename) {
2223
2225
  var import_picocolors4 = __toESM(require("picocolors"), 1);
2224
2226
 
2225
2227
  // package.json
2226
- var version = "0.17.3";
2228
+ var version = "0.17.4-alpha1";
2227
2229
 
2228
2230
  // src/core/utils/log/printHeader.ts
2229
2231
  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-alpha1";
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-alpha1";
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-63LEV65X.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
  },
@@ -1008,6 +1005,7 @@ async function resolveConfig(inlineConfig, command, server) {
1008
1005
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1009
1006
  );
1010
1007
  const wxtDir = import_node_path9.default.resolve(root, ".wxt");
1008
+ const wxtModuleDir = resolveWxtModuleDir();
1011
1009
  const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
1012
1010
  const entrypointsDir = import_node_path9.default.resolve(
1013
1011
  srcDir,
@@ -1058,6 +1056,7 @@ async function resolveConfig(inlineConfig, command, server) {
1058
1056
  outBaseDir,
1059
1057
  outDir,
1060
1058
  publicDir,
1059
+ wxtModuleDir,
1061
1060
  root,
1062
1061
  runnerConfig,
1063
1062
  srcDir,
@@ -1224,6 +1223,9 @@ async function getUnimportOptions(wxtDir, logger, config) {
1224
1223
  defaultOptions
1225
1224
  );
1226
1225
  }
1226
+ function resolveWxtModuleDir() {
1227
+ return import_node_path9.default.resolve(require.resolve("wxt"), "../..");
1228
+ }
1227
1229
 
1228
1230
  // src/core/utils/building/import-entrypoint.ts
1229
1231
  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-63LEV65X.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-alpha1",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",