wxt 0.18.9 → 0.18.11

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-B0efqfEK.cjs';
2
- export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-B0efqfEK.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-CER9SLWP.cjs';
2
+ export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, ab as ResolvedBasePublicFile, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-CER9SLWP.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -28,6 +28,17 @@ declare function build(config?: InlineConfig): Promise<BuildOutput>;
28
28
  /**
29
29
  * Remove generated/temp files from the directory.
30
30
  *
31
+ * @param config Optional config that will override your `<root>/wxt.config.ts`.
32
+ *
33
+ * @example
34
+ * await clean();
35
+ */
36
+ declare function clean(config?: InlineConfig): Promise<void>;
37
+ /**
38
+ * Remove generated/temp files from the directory.
39
+ *
40
+ * @deprecated
41
+ *
31
42
  * @param root The directory to look for generated/temp files in. Defaults to `process.cwd()`. Can be relative to `process.cwd()` or absolute.
32
43
  *
33
44
  * @example
@@ -65,6 +76,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
76
  */
66
77
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
78
 
68
- var version = "0.18.8";
79
+ var version = "0.18.10";
69
80
 
70
81
  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-B0efqfEK.js';
2
- export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-B0efqfEK.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-CER9SLWP.js';
2
+ export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, ab as ResolvedBasePublicFile, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-CER9SLWP.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -28,6 +28,17 @@ declare function build(config?: InlineConfig): Promise<BuildOutput>;
28
28
  /**
29
29
  * Remove generated/temp files from the directory.
30
30
  *
31
+ * @param config Optional config that will override your `<root>/wxt.config.ts`.
32
+ *
33
+ * @example
34
+ * await clean();
35
+ */
36
+ declare function clean(config?: InlineConfig): Promise<void>;
37
+ /**
38
+ * Remove generated/temp files from the directory.
39
+ *
40
+ * @deprecated
41
+ *
31
42
  * @param root The directory to look for generated/temp files in. Defaults to `process.cwd()`. Can be relative to `process.cwd()` or absolute.
32
43
  *
33
44
  * @example
@@ -65,6 +76,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
76
  */
66
77
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
78
 
68
- var version = "0.18.8";
79
+ var version = "0.18.10";
69
80
 
70
81
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -19,8 +19,9 @@ import {
19
19
  unnormalizePath,
20
20
  version,
21
21
  wxt
22
- } from "./chunk-UA35R5HN.js";
22
+ } from "./chunk-XNTIBS6O.js";
23
23
  import "./chunk-BERPNPEZ.js";
24
+ import "./chunk-6XSIWUWF.js";
24
25
  import {
25
26
  consola
26
27
  } from "./chunk-BM6QYGAW.js";
@@ -37,32 +38,37 @@ import path from "node:path";
37
38
  import glob from "fast-glob";
38
39
  import fs from "fs-extra";
39
40
  import pc from "picocolors";
40
- async function clean(root = process.cwd()) {
41
- consola.info("Cleaning Project");
41
+ async function clean(config) {
42
+ if (typeof config === "string") {
43
+ config = { root: config };
44
+ }
45
+ await registerWxt("build", config);
46
+ wxt.logger.info("Cleaning Project");
47
+ const root = wxt.config.root;
42
48
  const tempDirs = [
43
49
  "node_modules/.vite",
44
50
  "node_modules/.cache",
45
51
  "**/.wxt",
46
- ".output/*"
52
+ `${path.relative(root, wxt.config.outBaseDir)}/*`
47
53
  ];
48
- consola.debug("Looking for:", tempDirs.map(pc.cyan).join(", "));
54
+ wxt.logger.debug("Looking for:", tempDirs.map(pc.cyan).join(", "));
49
55
  const directories = await glob(tempDirs, {
50
- cwd: path.resolve(root),
56
+ cwd: root,
51
57
  absolute: true,
52
58
  onlyDirectories: true,
53
59
  deep: 2
54
60
  });
55
61
  if (directories.length === 0) {
56
- consola.debug("No generated files found.");
62
+ wxt.logger.debug("No generated files found.");
57
63
  return;
58
64
  }
59
- consola.debug(
65
+ wxt.logger.debug(
60
66
  "Found:",
61
67
  directories.map((dir) => pc.cyan(path.relative(root, dir))).join(", ")
62
68
  );
63
69
  for (const directory of directories) {
64
70
  await fs.rm(directory, { force: true, recursive: true });
65
- consola.debug("Deleted " + pc.cyan(path.relative(root, directory)));
71
+ wxt.logger.debug("Deleted " + pc.cyan(path.relative(root, directory)));
66
72
  }
67
73
  }
68
74
 
@@ -335,19 +341,19 @@ function createFileReloader(server) {
335
341
  switch (changes.type) {
336
342
  case "extension-reload":
337
343
  server.reloadExtension();
338
- consola.success(`Reloaded extension`);
344
+ wxt.logger.success(`Reloaded extension`);
339
345
  break;
340
346
  case "html-reload":
341
347
  const { reloadedNames } = reloadHtmlPages(
342
348
  changes.rebuildGroups,
343
349
  server
344
350
  );
345
- consola.success(`Reloaded: ${getFilenameList(reloadedNames)}`);
351
+ wxt.logger.success(`Reloaded: ${getFilenameList(reloadedNames)}`);
346
352
  break;
347
353
  case "content-script-reload":
348
354
  reloadContentScripts(changes.changedSteps, server);
349
355
  const rebuiltNames = changes.rebuildGroups.flat().map((entry) => entry.name);
350
- consola.success(`Reloaded: ${getFilenameList(rebuiltNames)}`);
356
+ wxt.logger.success(`Reloaded: ${getFilenameList(rebuiltNames)}`);
351
357
  break;
352
358
  }
353
359
  } catch (err) {
@@ -1,4 +1,4 @@
1
- import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.cjs';
1
+ import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-CER9SLWP.cjs';
2
2
  import * as vite from 'vite';
3
3
  import { UnimportOptions } from 'unimport';
4
4
  import 'webextension-polyfill';
package/dist/modules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.js';
1
+ import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-CER9SLWP.js';
2
2
  import * as vite from 'vite';
3
3
  import { UnimportOptions } from 'unimport';
4
4
  import 'webextension-polyfill';
package/dist/modules.js CHANGED
@@ -1,53 +1,12 @@
1
+ import {
2
+ addEntrypoint,
3
+ addImportPreset,
4
+ addPublicAssets,
5
+ addViteConfig,
6
+ addWxtPlugin,
7
+ defineWxtModule
8
+ } from "./chunk-6XSIWUWF.js";
1
9
  import "./chunk-QGM4M3NI.js";
2
-
3
- // src/modules.ts
4
- import * as vite from "vite";
5
- import glob from "fast-glob";
6
- import { resolve } from "node:path";
7
- function defineWxtModule(module) {
8
- if (typeof module === "function") return { setup: module };
9
- return module;
10
- }
11
- function addEntrypoint(wxt, entrypoint) {
12
- wxt.hooks.hook("entrypoints:resolved", (wxt2, entrypoints) => {
13
- entrypoints.push(entrypoint);
14
- });
15
- }
16
- function addPublicAssets(wxt, dir) {
17
- wxt.hooks.hook("build:publicAssets", async (wxt2, files) => {
18
- const moreFiles = await glob("**/*", { cwd: dir });
19
- if (moreFiles.length === 0) {
20
- wxt2.logger.warn("No files to copy in", dir);
21
- return;
22
- }
23
- moreFiles.forEach((file) => {
24
- files.unshift({ absoluteSrc: resolve(dir, file), relativeDest: file });
25
- });
26
- });
27
- }
28
- function addViteConfig(wxt, viteConfig) {
29
- wxt.hooks.hook("ready", (wxt2) => {
30
- const userVite = wxt2.config.vite;
31
- wxt2.config.vite = async (env) => {
32
- const fromUser = await userVite(env);
33
- const fromModule = viteConfig(env) ?? {};
34
- return vite.mergeConfig(fromModule, fromUser);
35
- };
36
- });
37
- }
38
- function addWxtPlugin(wxt, plugin) {
39
- wxt.hooks.hook("ready", (wxt2) => {
40
- wxt2.config.plugins.push(plugin);
41
- });
42
- }
43
- function addImportPreset(wxt, preset) {
44
- wxt.hooks.hook("ready", (wxt2) => {
45
- if (!wxt2.config.imports) return;
46
- wxt2.config.imports.presets ??= [];
47
- if (wxt2.config.imports.presets.includes(preset)) return;
48
- wxt2.config.imports.presets.push(preset);
49
- });
50
- }
51
10
  export {
52
11
  addEntrypoint,
53
12
  addImportPreset,