wxt 0.16.11 → 0.16.12-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,5 @@
1
1
  // package.json
2
- var version = "0.16.11";
2
+ var version = "0.16.12-alpha1";
3
3
 
4
4
  // src/core/utils/paths.ts
5
5
  import systemPath from "node:path";
package/dist/cli.js CHANGED
@@ -2181,7 +2181,7 @@ function getChunkSortWeight(filename) {
2181
2181
  import pc4 from "picocolors";
2182
2182
 
2183
2183
  // package.json
2184
- var version = "0.16.11";
2184
+ var version = "0.16.12-alpha1";
2185
2185
 
2186
2186
  // src/core/utils/log/printHeader.ts
2187
2187
  import { consola as consola2 } from "consola";
@@ -3204,8 +3204,8 @@ async function createServer(inlineConfig) {
3204
3204
  transformHtml(url, html, originalUrl) {
3205
3205
  return builderServer.transformHtml(url, html, originalUrl);
3206
3206
  },
3207
- reloadContentScript(contentScript) {
3208
- server.ws.send("wxt:reload-content-script", contentScript);
3207
+ reloadContentScript(payload) {
3208
+ server.ws.send("wxt:reload-content-script", payload);
3209
3209
  },
3210
3210
  reloadPage(path8) {
3211
3211
  server.ws.send("wxt:reload-page", path8);
@@ -3306,9 +3306,14 @@ function reloadContentScripts(steps, server) {
3306
3306
  const js = [getEntrypointBundlePath(entry, wxt.config.outDir, ".js")];
3307
3307
  const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);
3308
3308
  const css = getContentScriptCssFiles([entry], cssMap);
3309
- server.reloadContentScript(
3310
- mapWxtOptionsToRegisteredContentScript(entry.options, js, css)
3311
- );
3309
+ server.reloadContentScript({
3310
+ registration: entry.options.registration,
3311
+ contentScript: mapWxtOptionsToRegisteredContentScript(
3312
+ entry.options,
3313
+ js,
3314
+ css
3315
+ )
3316
+ });
3312
3317
  });
3313
3318
  } else {
3314
3319
  server.reloadExtension();
@@ -471,14 +471,18 @@ interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, Serve
471
471
  /**
472
472
  * Tell the extension to restart a content script.
473
473
  *
474
- * @param contentScript The manifest definition for a content script
474
+ * @param payload Information about the content script to reload.
475
475
  */
476
- reloadContentScript: (contentScript: Omit<Scripting.RegisteredContentScript, 'id'>) => void;
476
+ reloadContentScript: (payload: ReloadContentScriptPayload) => void;
477
477
  /**
478
478
  * Grab the latest runner config and restart the browser.
479
479
  */
480
480
  restartBrowser: () => void;
481
481
  }
482
+ interface ReloadContentScriptPayload {
483
+ registration?: BaseContentScriptEntrypointOptions['registration'];
484
+ contentScript: Omit<Scripting.RegisteredContentScript, 'id'>;
485
+ }
482
486
  type TargetBrowser = string;
483
487
  type TargetManifestVersion = 2 | 3;
484
488
  type UserConfig = Omit<InlineConfig, 'configFile'>;
@@ -1042,4 +1046,4 @@ type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
1042
1046
  eslintrc: ResolvedEslintrc;
1043
1047
  };
1044
1048
 
1045
- export type { Eslintrc as $, UserManifestFn as A, BuildOutput as B, ContentScriptEntrypoint as C, ConfigEnv as D, ExtensionRunnerConfig as E, WxtBuilder as F, GenericEntrypoint as G, WxtBuilderServer as H, InlineConfig as I, ServerInfo as J, HookResult as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtHooks as N, OutputFile as O, PopupEntrypointOptions as P, Wxt as Q, ResolvedPerBrowserOptions as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ResolvedConfig as V, WxtDevServer as W, FsCache as X, ExtensionRunner as Y, VirtualEntrypointType as Z, EslintGlobalsPropValue as _, WxtViteConfig as a, ResolvedEslintrc as a0, WxtUnimportOptions as a1, WxtResolvedUnimportOptions as a2, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, UserManifest as z };
1049
+ export type { EslintGlobalsPropValue as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtBuilder as H, InlineConfig as I, WxtBuilderServer as J, ServerInfo as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, HookResult as N, OutputFile as O, PopupEntrypointOptions as P, WxtHooks as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, Wxt as V, WxtDevServer as W, ResolvedConfig as X, FsCache as Y, ExtensionRunner as Z, VirtualEntrypointType as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
@@ -471,14 +471,18 @@ interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, Serve
471
471
  /**
472
472
  * Tell the extension to restart a content script.
473
473
  *
474
- * @param contentScript The manifest definition for a content script
474
+ * @param payload Information about the content script to reload.
475
475
  */
476
- reloadContentScript: (contentScript: Omit<Scripting.RegisteredContentScript, 'id'>) => void;
476
+ reloadContentScript: (payload: ReloadContentScriptPayload) => void;
477
477
  /**
478
478
  * Grab the latest runner config and restart the browser.
479
479
  */
480
480
  restartBrowser: () => void;
481
481
  }
482
+ interface ReloadContentScriptPayload {
483
+ registration?: BaseContentScriptEntrypointOptions['registration'];
484
+ contentScript: Omit<Scripting.RegisteredContentScript, 'id'>;
485
+ }
482
486
  type TargetBrowser = string;
483
487
  type TargetManifestVersion = 2 | 3;
484
488
  type UserConfig = Omit<InlineConfig, 'configFile'>;
@@ -1042,4 +1046,4 @@ type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
1042
1046
  eslintrc: ResolvedEslintrc;
1043
1047
  };
1044
1048
 
1045
- export type { Eslintrc as $, UserManifestFn as A, BuildOutput as B, ContentScriptEntrypoint as C, ConfigEnv as D, ExtensionRunnerConfig as E, WxtBuilder as F, GenericEntrypoint as G, WxtBuilderServer as H, InlineConfig as I, ServerInfo as J, HookResult as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtHooks as N, OutputFile as O, PopupEntrypointOptions as P, Wxt as Q, ResolvedPerBrowserOptions as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ResolvedConfig as V, WxtDevServer as W, FsCache as X, ExtensionRunner as Y, VirtualEntrypointType as Z, EslintGlobalsPropValue as _, WxtViteConfig as a, ResolvedEslintrc as a0, WxtUnimportOptions as a1, WxtResolvedUnimportOptions as a2, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, UserManifest as z };
1049
+ export type { EslintGlobalsPropValue as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtBuilder as H, InlineConfig as I, WxtBuilderServer as J, ServerInfo as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, HookResult as N, OutputFile as O, PopupEntrypointOptions as P, WxtHooks as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, Wxt as V, WxtDevServer as W, ResolvedConfig as X, FsCache as Y, ExtensionRunner as Z, VirtualEntrypointType as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
package/dist/index.cjs CHANGED
@@ -4608,7 +4608,7 @@ function getChunkSortWeight(filename) {
4608
4608
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4609
4609
 
4610
4610
  // package.json
4611
- var version = "0.16.11";
4611
+ var version = "0.16.12-alpha1";
4612
4612
 
4613
4613
  // src/core/utils/log/printHeader.ts
4614
4614
  var import_consola2 = require("consola");
@@ -5637,8 +5637,8 @@ async function createServer(inlineConfig) {
5637
5637
  transformHtml(url2, html, originalUrl) {
5638
5638
  return builderServer.transformHtml(url2, html, originalUrl);
5639
5639
  },
5640
- reloadContentScript(contentScript) {
5641
- server.ws.send("wxt:reload-content-script", contentScript);
5640
+ reloadContentScript(payload) {
5641
+ server.ws.send("wxt:reload-content-script", payload);
5642
5642
  },
5643
5643
  reloadPage(path11) {
5644
5644
  server.ws.send("wxt:reload-page", path11);
@@ -5739,9 +5739,14 @@ function reloadContentScripts(steps, server) {
5739
5739
  const js = [getEntrypointBundlePath(entry, wxt.config.outDir, ".js")];
5740
5740
  const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);
5741
5741
  const css = getContentScriptCssFiles([entry], cssMap);
5742
- server.reloadContentScript(
5743
- mapWxtOptionsToRegisteredContentScript(entry.options, js, css)
5744
- );
5742
+ server.reloadContentScript({
5743
+ registration: entry.options.registration,
5744
+ contentScript: mapWxtOptionsToRegisteredContentScript(
5745
+ entry.options,
5746
+ js,
5747
+ css
5748
+ )
5749
+ });
5745
5750
  });
5746
5751
  } else {
5747
5752
  server.reloadExtension();
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-h54vKikt.cjs';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, D as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, _ as EslintGlobalsPropValue, $ as Eslintrc, Y as ExtensionRunner, X as FsCache, G as GenericEntrypoint, K 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, V as ResolvedConfig, a0 as ResolvedEslintrc, R as ResolvedPerBrowserOptions, J as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, z as UserManifest, A as UserManifestFn, Z as VirtualEntrypointType, Q as Wxt, F as WxtBuilder, H as WxtBuilderServer, N as WxtHooks, a2 as WxtResolvedUnimportOptions, a1 as WxtUnimportOptions, a as WxtViteConfig } from './index-h54vKikt.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-Du5Xv5e8.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-Du5Xv5e8.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.16.11";
67
+ var version = "0.16.12-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-h54vKikt.js';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, D as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, p as Entrypoint, q as EntrypointGroup, _ as EslintGlobalsPropValue, $ as Eslintrc, Y as ExtensionRunner, X as FsCache, G as GenericEntrypoint, K 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, V as ResolvedConfig, a0 as ResolvedEslintrc, R as ResolvedPerBrowserOptions, J as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, z as UserManifest, A as UserManifestFn, Z as VirtualEntrypointType, Q as Wxt, F as WxtBuilder, H as WxtBuilderServer, N as WxtHooks, a2 as WxtResolvedUnimportOptions, a1 as WxtUnimportOptions, a as WxtViteConfig } from './index-h54vKikt.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-Du5Xv5e8.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-Du5Xv5e8.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.16.11";
67
+ var version = "0.16.12-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,7 @@ import {
17
17
  unnormalizePath,
18
18
  version,
19
19
  wxt
20
- } from "./chunk-YH7RSTGT.js";
20
+ } from "./chunk-EWMHSRAA.js";
21
21
  import "./chunk-VBXJIVYU.js";
22
22
 
23
23
  // src/core/build.ts
@@ -268,8 +268,8 @@ async function createServer(inlineConfig) {
268
268
  transformHtml(url, html, originalUrl) {
269
269
  return builderServer.transformHtml(url, html, originalUrl);
270
270
  },
271
- reloadContentScript(contentScript) {
272
- server.ws.send("wxt:reload-content-script", contentScript);
271
+ reloadContentScript(payload) {
272
+ server.ws.send("wxt:reload-content-script", payload);
273
273
  },
274
274
  reloadPage(path3) {
275
275
  server.ws.send("wxt:reload-page", path3);
@@ -370,9 +370,14 @@ function reloadContentScripts(steps, server) {
370
370
  const js = [getEntrypointBundlePath(entry, wxt.config.outDir, ".js")];
371
371
  const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);
372
372
  const css = getContentScriptCssFiles([entry], cssMap);
373
- server.reloadContentScript(
374
- mapWxtOptionsToRegisteredContentScript(entry.options, js, css)
375
- );
373
+ server.reloadContentScript({
374
+ registration: entry.options.registration,
375
+ contentScript: mapWxtOptionsToRegisteredContentScript(
376
+ entry.options,
377
+ js,
378
+ css
379
+ )
380
+ });
376
381
  });
377
382
  } else {
378
383
  server.reloadExtension();
@@ -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-h54vKikt.cjs';
3
+ import { I as InlineConfig } from './index-Du5Xv5e8.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-h54vKikt.js';
3
+ import { I as InlineConfig } from './index-Du5Xv5e8.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-YH7RSTGT.js";
8
+ } from "./chunk-EWMHSRAA.js";
9
9
  import "./chunk-VBXJIVYU.js";
10
10
 
11
11
  // src/testing/fake-browser.ts
@@ -60,27 +60,46 @@ function keepServiceWorkerAlive() {
60
60
  // src/virtual/utils/reload-content-scripts.ts
61
61
  import { browser as browser2 } from "wxt/browser";
62
62
  import { MatchPattern } from "wxt/sandbox";
63
- function reloadContentScript(contentScript) {
63
+ function reloadContentScript(payload) {
64
64
  const manifest = browser2.runtime.getManifest();
65
65
  if (manifest.manifest_version == 2) {
66
- void reloadContentScriptMv2(contentScript);
66
+ void reloadContentScriptMv2(payload);
67
67
  } else {
68
- void reloadContentScriptMv3(contentScript);
68
+ void reloadContentScriptMv3(payload);
69
69
  }
70
70
  }
71
- async function reloadContentScriptMv3(contentScript) {
72
- const id = `wxt:${contentScript.js[0]}`;
71
+ async function reloadContentScriptMv3({
72
+ registration,
73
+ contentScript
74
+ }) {
75
+ if (registration === "runtime") {
76
+ await reloadRuntimeContentScriptMv3(contentScript);
77
+ } else {
78
+ await reloadRuntimeContentScriptMv3(contentScript);
79
+ }
80
+ }
81
+ async function reloadRuntimeContentScriptMv3(contentScript) {
73
82
  logger.log("Reloading content script:", contentScript);
74
83
  const registered = await browser2.scripting.getRegisteredContentScripts();
75
84
  logger.debug("Existing scripts:", registered);
76
- const existing = registered.find((cs) => cs.id === id);
77
- if (existing) {
78
- logger.debug("Updating content script", existing);
79
- await browser2.scripting.updateContentScripts([{ ...contentScript, id }]);
80
- } else {
81
- logger.debug("Registering new content script...");
82
- await browser2.scripting.registerContentScripts([{ ...contentScript, id }]);
85
+ const existing = registered.find((cs) => {
86
+ const hasEveryJs = contentScript.js?.every((js) => cs.js?.includes(js));
87
+ const hasEveryCss = contentScript.css?.every(
88
+ (css) => cs.css?.includes(css)
89
+ );
90
+ return hasEveryJs && hasEveryCss;
91
+ });
92
+ if (!existing) {
93
+ logger.log(
94
+ "Content script is not registered yet, nothing to reload",
95
+ contentScript
96
+ );
97
+ return;
83
98
  }
99
+ await browser2.scripting.updateContentScripts([existing]);
100
+ await reloadTabsForContentScript(contentScript);
101
+ }
102
+ async function reloadTabsForContentScript(contentScript) {
84
103
  const allTabs = await browser2.tabs.query({});
85
104
  const matchPatterns = contentScript.matches.map(
86
105
  (match) => new MatchPattern(match)
@@ -93,7 +112,7 @@ async function reloadContentScriptMv3(contentScript) {
93
112
  });
94
113
  await Promise.all(matchingTabs.map((tab) => browser2.tabs.reload(tab.id)));
95
114
  }
96
- async function reloadContentScriptMv2(contentScript) {
115
+ async function reloadContentScriptMv2(_payload) {
97
116
  throw Error("TODO: reloadContentScriptMv2");
98
117
  }
99
118
 
@@ -126,7 +145,7 @@ try {
126
145
  const res = definition.main();
127
146
  if (res instanceof Promise) {
128
147
  console.warn(
129
- "The background's main() function return a promise, but it must be synchonous"
148
+ "The background's main() function return a promise, but it must be synchronous"
130
149
  );
131
150
  }
132
151
  } catch (err) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.16.11",
4
+ "version": "0.16.12-alpha1",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",