wxt 0.17.8 → 0.17.10

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/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-cFBbMXAl.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, a5 as Dependency, 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, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-cFBbMXAl.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-w7ohFTEX.cjs';
2
+ export { w as BackgroundDefinition, m as BackgroundEntrypoint, h as BackgroundEntrypointOptions, i as BaseContentScriptEntrypointOptions, l as BaseEntrypoint, g as BaseEntrypointOptions, d as BuildStepOutput, H as ConfigEnv, v as ContentScriptDefinition, C as ContentScriptEntrypoint, a6 as Dependency, q as Entrypoint, r as EntrypointGroup, a0 as EslintGlobalsPropValue, a1 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, V as HookResult, t as IsolatedWorldContentScriptDefinition, j as IsolatedWorldContentScriptEntrypointOptions, L as Logger, u as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, s as OnContentScriptStopped, o as OptionsEntrypoint, k as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, z as PerBrowserMap, y as PerBrowserOption, n as PopupEntrypoint, P as PopupEntrypointOptions, e as ReloadContentScriptPayload, R as ResolvedConfig, a2 as ResolvedEslintrc, A as ResolvedPerBrowserOptions, Q as ServerInfo, p as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, f as TargetManifestVersion, x as UnlistedScriptDefinition, D as UserManifest, F as UserManifestFn, $ as VirtualEntrypointType, Y as Wxt, K as WxtBuilder, N as WxtBuilderServer, J as WxtCommand, X as WxtHooks, a5 as WxtPackageManager, a4 as WxtResolvedUnimportOptions, a3 as WxtUnimportOptions, a as WxtViteConfig } from './index-w7ohFTEX.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.17.8";
68
+ var version = "0.17.10";
69
69
 
70
70
  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-cFBbMXAl.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, a5 as Dependency, 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, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-cFBbMXAl.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-w7ohFTEX.js';
2
+ export { w as BackgroundDefinition, m as BackgroundEntrypoint, h as BackgroundEntrypointOptions, i as BaseContentScriptEntrypointOptions, l as BaseEntrypoint, g as BaseEntrypointOptions, d as BuildStepOutput, H as ConfigEnv, v as ContentScriptDefinition, C as ContentScriptEntrypoint, a6 as Dependency, q as Entrypoint, r as EntrypointGroup, a0 as EslintGlobalsPropValue, a1 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, V as HookResult, t as IsolatedWorldContentScriptDefinition, j as IsolatedWorldContentScriptEntrypointOptions, L as Logger, u as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, s as OnContentScriptStopped, o as OptionsEntrypoint, k as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, z as PerBrowserMap, y as PerBrowserOption, n as PopupEntrypoint, P as PopupEntrypointOptions, e as ReloadContentScriptPayload, R as ResolvedConfig, a2 as ResolvedEslintrc, A as ResolvedPerBrowserOptions, Q as ServerInfo, p as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, f as TargetManifestVersion, x as UnlistedScriptDefinition, D as UserManifest, F as UserManifestFn, $ as VirtualEntrypointType, Y as Wxt, K as WxtBuilder, N as WxtBuilderServer, J as WxtCommand, X as WxtHooks, a5 as WxtPackageManager, a4 as WxtResolvedUnimportOptions, a3 as WxtUnimportOptions, a as WxtViteConfig } from './index-w7ohFTEX.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.17.8";
68
+ var version = "0.17.10";
69
69
 
70
70
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  unnormalizePath,
19
19
  version,
20
20
  wxt
21
- } from "./chunk-5XQOZCZF.js";
21
+ } from "./chunk-2SH4GQGN.js";
22
22
  import "./chunk-VBXJIVYU.js";
23
23
 
24
24
  // src/core/build.ts
@@ -222,14 +222,59 @@ import { Mutex } from "async-mutex";
222
222
  import pc2 from "picocolors";
223
223
  import { relative as relative4 } from "node:path";
224
224
  async function createServer(inlineConfig) {
225
- const port = await getPort();
226
- const hostname = "localhost";
227
- const origin = `http://${hostname}:${port}`;
228
- const serverInfo = {
229
- port,
230
- hostname,
231
- origin
232
- };
225
+ await registerWxt("serve", inlineConfig, async (config) => {
226
+ const { port, hostname } = config.dev.server;
227
+ const serverInfo = {
228
+ port,
229
+ hostname,
230
+ origin: `http://${hostname}:${port}`
231
+ };
232
+ const server2 = {
233
+ ...serverInfo,
234
+ get watcher() {
235
+ return builderServer.watcher;
236
+ },
237
+ get ws() {
238
+ return builderServer.ws;
239
+ },
240
+ currentOutput: void 0,
241
+ async start() {
242
+ await builderServer.listen();
243
+ wxt.logger.success(`Started dev server @ ${serverInfo.origin}`);
244
+ await buildAndOpenBrowser();
245
+ },
246
+ async stop() {
247
+ await runner.closeBrowser();
248
+ await builderServer.close();
249
+ },
250
+ async restart() {
251
+ await closeAndRecreateRunner();
252
+ await buildAndOpenBrowser();
253
+ },
254
+ transformHtml(url, html, originalUrl) {
255
+ return builderServer.transformHtml(url, html, originalUrl);
256
+ },
257
+ reloadContentScript(payload) {
258
+ server2.ws.send("wxt:reload-content-script", payload);
259
+ },
260
+ reloadPage(path4) {
261
+ server2.ws.send("wxt:reload-page", path4);
262
+ },
263
+ reloadExtension() {
264
+ server2.ws.send("wxt:reload-extension");
265
+ },
266
+ async restartBrowser() {
267
+ await closeAndRecreateRunner();
268
+ await runner.openBrowser();
269
+ }
270
+ };
271
+ return server2;
272
+ });
273
+ const server = wxt.server;
274
+ let [runner, builderServer] = await Promise.all([
275
+ createExtensionRunner(),
276
+ wxt.builder.createServer(server)
277
+ ]);
233
278
  const buildAndOpenBrowser = async () => {
234
279
  server.currentOutput = await internalBuild();
235
280
  try {
@@ -244,50 +289,6 @@ async function createServer(inlineConfig) {
244
289
  await wxt.reloadConfig();
245
290
  runner = await createExtensionRunner();
246
291
  };
247
- const server = {
248
- ...serverInfo,
249
- get watcher() {
250
- return builderServer.watcher;
251
- },
252
- get ws() {
253
- return builderServer.ws;
254
- },
255
- currentOutput: void 0,
256
- async start() {
257
- await builderServer.listen();
258
- wxt.logger.success(`Started dev server @ ${serverInfo.origin}`);
259
- await buildAndOpenBrowser();
260
- },
261
- async stop() {
262
- await runner.closeBrowser();
263
- await builderServer.close();
264
- },
265
- async restart() {
266
- await closeAndRecreateRunner();
267
- await buildAndOpenBrowser();
268
- },
269
- transformHtml(url, html, originalUrl) {
270
- return builderServer.transformHtml(url, html, originalUrl);
271
- },
272
- reloadContentScript(payload) {
273
- server.ws.send("wxt:reload-content-script", payload);
274
- },
275
- reloadPage(path4) {
276
- server.ws.send("wxt:reload-page", path4);
277
- },
278
- reloadExtension() {
279
- server.ws.send("wxt:reload-extension");
280
- },
281
- async restartBrowser() {
282
- await closeAndRecreateRunner();
283
- await runner.openBrowser();
284
- }
285
- };
286
- await registerWxt("serve", inlineConfig, server);
287
- let [runner, builderServer] = await Promise.all([
288
- createExtensionRunner(),
289
- wxt.config.builder.createServer(server)
290
- ]);
291
292
  server.ws.on("wxt:background-initialized", () => {
292
293
  if (server.currentOutput == null)
293
294
  return;
@@ -297,10 +298,6 @@ async function createServer(inlineConfig) {
297
298
  server.watcher.on("all", reloadOnChange);
298
299
  return server;
299
300
  }
300
- async function getPort() {
301
- const { default: getPort2, portNumbers } = await import("get-port");
302
- return await getPort2({ port: portNumbers(3e3, 3010) });
303
- }
304
301
  function createFileReloader(server) {
305
302
  const fileChangedMutex = new Mutex();
306
303
  const changeQueue = [];
@@ -575,7 +572,7 @@ async function zip(config) {
575
572
  const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
576
573
  "{{version}}",
577
574
  output.manifest.version_name ?? output.manifest.version
578
- ).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
575
+ ).replaceAll("{{mode}}", wxt.config.mode).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
579
576
  await fs3.ensureDir(wxt.config.outBaseDir);
580
577
  const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
581
578
  const outZipPath = path3.resolve(wxt.config.outBaseDir, outZipFilename);