wxt 0.17.4 → 0.17.5
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/{chunk-E5MGUY6P.js → chunk-4K4AQ5GV.js} +238 -25
- package/dist/chunk-VBXJIVYU.js +38 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +374 -85
- package/dist/execa-4F7CCWCA.js +2191 -0
- package/dist/{index-vpYNIeCJ.d.cts → index-5w9cnXgy.d.cts} +80 -3
- package/dist/{index-vpYNIeCJ.d.ts → index-5w9cnXgy.d.ts} +80 -3
- package/dist/index.cjs +2848 -181
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +105 -27
- package/dist/storage.js +1 -1
- package/dist/testing.cjs +54 -44
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +2 -2
- package/package.json +5 -3
- package/dist/chunk-P57PW2II.js +0 -11
|
@@ -6,6 +6,7 @@ import { PluginVisualizerOptions } from '@aklinker1/rollup-plugin-visualizer';
|
|
|
6
6
|
import { FSWatcher } from 'chokidar';
|
|
7
7
|
import { ResolvedConfig as ResolvedConfig$1 } from 'c12';
|
|
8
8
|
import { NestedHooks, Hookable } from 'hookable';
|
|
9
|
+
import * as Nypm from 'nypm';
|
|
9
10
|
|
|
10
11
|
declare class WxtLocationChangeEvent extends Event {
|
|
11
12
|
readonly newUrl: URL;
|
|
@@ -289,6 +290,31 @@ interface InlineConfig {
|
|
|
289
290
|
* ]
|
|
290
291
|
*/
|
|
291
292
|
excludeSources?: string[];
|
|
293
|
+
/**
|
|
294
|
+
* The Firefox review process requires the extension be buildable from source to make reviewing
|
|
295
|
+
* easier. This field allows you to use private packages without exposing your auth tokens.
|
|
296
|
+
*
|
|
297
|
+
* Just list the name of all the packages you want to download and include in the sources zip.
|
|
298
|
+
* Usually, these will be private packages behind auth tokens, but they don't have to be.
|
|
299
|
+
*
|
|
300
|
+
* All packages listed here will be downloaded to in `.wxt/local_modules/` and an `overrides` or
|
|
301
|
+
* `resolutions` field (depending on your package manager) will be added to the `package.json`,
|
|
302
|
+
* pointing to the downloaded packages.
|
|
303
|
+
*
|
|
304
|
+
* > ***DO NOT include versions or version filters.*** Just the package name. If multiple
|
|
305
|
+
* > versions of a package are present in the project, all versions will be downloaded and
|
|
306
|
+
* > referenced in the package.json correctly.
|
|
307
|
+
*
|
|
308
|
+
* @default []
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* // Correct:
|
|
312
|
+
* ["@scope/package-name", "package-name"]
|
|
313
|
+
*
|
|
314
|
+
* // Incorrect, don't include versions!!!
|
|
315
|
+
* ["@scope/package-name@1.1.3", "package-name@^2"]
|
|
316
|
+
*/
|
|
317
|
+
downloadPackages?: string[];
|
|
292
318
|
};
|
|
293
319
|
/**
|
|
294
320
|
* @deprecated Use `hooks.build.manifestGenerated` to modify your manifest instead. This option
|
|
@@ -757,14 +783,23 @@ type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
|
|
|
757
783
|
type UserManifest = Partial<Omit<Manifest.WebExtensionManifest, 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox'>>;
|
|
758
784
|
type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
|
|
759
785
|
interface ConfigEnv {
|
|
786
|
+
/**
|
|
787
|
+
* The build mode passed into the CLI. By default, `wxt` uses `"development"` and `wxt build|zip`
|
|
788
|
+
* uses `"production"`.
|
|
789
|
+
*/
|
|
760
790
|
mode: string;
|
|
791
|
+
/**
|
|
792
|
+
* The command used to run WXT. `"serve"` during development and `"build"` for any other command.
|
|
793
|
+
*/
|
|
761
794
|
command: 'build' | 'serve';
|
|
762
795
|
/**
|
|
763
|
-
* Browser passed in from the CLI
|
|
796
|
+
* Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
|
|
764
797
|
*/
|
|
765
798
|
browser: TargetBrowser;
|
|
766
799
|
/**
|
|
767
|
-
* Manifest version passed in from the CLI
|
|
800
|
+
* Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags. When not passed, it depends on the target browser. See
|
|
801
|
+
* [the guide](https://wxt.dev/guide/multiple-browsers.html#target-manifest-version) for more
|
|
802
|
+
* details.
|
|
768
803
|
*/
|
|
769
804
|
manifestVersion: 2 | 3;
|
|
770
805
|
}
|
|
@@ -964,6 +999,10 @@ interface Wxt {
|
|
|
964
999
|
* Reload config file and update the `config` field with the result.
|
|
965
1000
|
*/
|
|
966
1001
|
reloadConfig: () => Promise<void>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Package manager utilities.
|
|
1004
|
+
*/
|
|
1005
|
+
pm: WxtPackageManager;
|
|
967
1006
|
}
|
|
968
1007
|
interface ResolvedConfig {
|
|
969
1008
|
root: string;
|
|
@@ -998,6 +1037,8 @@ interface ResolvedConfig {
|
|
|
998
1037
|
includeSources: string[];
|
|
999
1038
|
excludeSources: string[];
|
|
1000
1039
|
sourcesRoot: string;
|
|
1040
|
+
downloadedPackagesDir: string;
|
|
1041
|
+
downloadPackages: string[];
|
|
1001
1042
|
};
|
|
1002
1043
|
transformManifest: (manifest: Manifest.WebExtensionManifest) => void;
|
|
1003
1044
|
analysis: {
|
|
@@ -1072,5 +1113,41 @@ type WxtUnimportOptions = Partial<UnimportOptions> & {
|
|
|
1072
1113
|
type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
|
|
1073
1114
|
eslintrc: ResolvedEslintrc;
|
|
1074
1115
|
};
|
|
1116
|
+
/**
|
|
1117
|
+
* Package management utils built on top of [`nypm`](https://www.npmjs.com/package/nypm)
|
|
1118
|
+
*/
|
|
1119
|
+
interface WxtPackageManager extends Nypm.PackageManager {
|
|
1120
|
+
addDependency: typeof Nypm.addDependency;
|
|
1121
|
+
addDevDependency: typeof Nypm.addDevDependency;
|
|
1122
|
+
ensureDependencyInstalled: typeof Nypm.ensureDependencyInstalled;
|
|
1123
|
+
installDependencies: typeof Nypm.installDependencies;
|
|
1124
|
+
removeDependency: typeof Nypm.removeDependency;
|
|
1125
|
+
/**
|
|
1126
|
+
* Download a package's TGZ file and move it into the `downloadDir`. Use's `npm pack <name>`, so
|
|
1127
|
+
* you must have setup authorization in `.npmrc` file, regardless of the package manager used.
|
|
1128
|
+
*
|
|
1129
|
+
* @param id Name of the package to download, can include a version (like `wxt@0.17.1`)
|
|
1130
|
+
* @param downloadDir Where to store the package.
|
|
1131
|
+
* @returns Absolute path to downloaded file.
|
|
1132
|
+
*/
|
|
1133
|
+
downloadDependency: (id: string, downloadDir: string) => Promise<string>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Run `npm ls`, `pnpm ls`, or `bun pm ls`, or `yarn list` and return the results.
|
|
1136
|
+
*
|
|
1137
|
+
* WARNING: Yarn always returns all dependencies
|
|
1138
|
+
*/
|
|
1139
|
+
listDependencies: (options?: {
|
|
1140
|
+
cwd?: string;
|
|
1141
|
+
all?: boolean;
|
|
1142
|
+
}) => Promise<Dependency[]>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Key used to override package versions. Sometimes called "resolutions".
|
|
1145
|
+
*/
|
|
1146
|
+
overridesKey: string;
|
|
1147
|
+
}
|
|
1148
|
+
interface Dependency {
|
|
1149
|
+
name: string;
|
|
1150
|
+
version: string;
|
|
1151
|
+
}
|
|
1075
1152
|
|
|
1076
|
-
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 };
|
|
1153
|
+
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, WxtPackageManager as a4, Dependency as a5, 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 };
|
|
@@ -6,6 +6,7 @@ import { PluginVisualizerOptions } from '@aklinker1/rollup-plugin-visualizer';
|
|
|
6
6
|
import { FSWatcher } from 'chokidar';
|
|
7
7
|
import { ResolvedConfig as ResolvedConfig$1 } from 'c12';
|
|
8
8
|
import { NestedHooks, Hookable } from 'hookable';
|
|
9
|
+
import * as Nypm from 'nypm';
|
|
9
10
|
|
|
10
11
|
declare class WxtLocationChangeEvent extends Event {
|
|
11
12
|
readonly newUrl: URL;
|
|
@@ -289,6 +290,31 @@ interface InlineConfig {
|
|
|
289
290
|
* ]
|
|
290
291
|
*/
|
|
291
292
|
excludeSources?: string[];
|
|
293
|
+
/**
|
|
294
|
+
* The Firefox review process requires the extension be buildable from source to make reviewing
|
|
295
|
+
* easier. This field allows you to use private packages without exposing your auth tokens.
|
|
296
|
+
*
|
|
297
|
+
* Just list the name of all the packages you want to download and include in the sources zip.
|
|
298
|
+
* Usually, these will be private packages behind auth tokens, but they don't have to be.
|
|
299
|
+
*
|
|
300
|
+
* All packages listed here will be downloaded to in `.wxt/local_modules/` and an `overrides` or
|
|
301
|
+
* `resolutions` field (depending on your package manager) will be added to the `package.json`,
|
|
302
|
+
* pointing to the downloaded packages.
|
|
303
|
+
*
|
|
304
|
+
* > ***DO NOT include versions or version filters.*** Just the package name. If multiple
|
|
305
|
+
* > versions of a package are present in the project, all versions will be downloaded and
|
|
306
|
+
* > referenced in the package.json correctly.
|
|
307
|
+
*
|
|
308
|
+
* @default []
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* // Correct:
|
|
312
|
+
* ["@scope/package-name", "package-name"]
|
|
313
|
+
*
|
|
314
|
+
* // Incorrect, don't include versions!!!
|
|
315
|
+
* ["@scope/package-name@1.1.3", "package-name@^2"]
|
|
316
|
+
*/
|
|
317
|
+
downloadPackages?: string[];
|
|
292
318
|
};
|
|
293
319
|
/**
|
|
294
320
|
* @deprecated Use `hooks.build.manifestGenerated` to modify your manifest instead. This option
|
|
@@ -757,14 +783,23 @@ type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
|
|
|
757
783
|
type UserManifest = Partial<Omit<Manifest.WebExtensionManifest, 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox'>>;
|
|
758
784
|
type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
|
|
759
785
|
interface ConfigEnv {
|
|
786
|
+
/**
|
|
787
|
+
* The build mode passed into the CLI. By default, `wxt` uses `"development"` and `wxt build|zip`
|
|
788
|
+
* uses `"production"`.
|
|
789
|
+
*/
|
|
760
790
|
mode: string;
|
|
791
|
+
/**
|
|
792
|
+
* The command used to run WXT. `"serve"` during development and `"build"` for any other command.
|
|
793
|
+
*/
|
|
761
794
|
command: 'build' | 'serve';
|
|
762
795
|
/**
|
|
763
|
-
* Browser passed in from the CLI
|
|
796
|
+
* Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
|
|
764
797
|
*/
|
|
765
798
|
browser: TargetBrowser;
|
|
766
799
|
/**
|
|
767
|
-
* Manifest version passed in from the CLI
|
|
800
|
+
* Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags. When not passed, it depends on the target browser. See
|
|
801
|
+
* [the guide](https://wxt.dev/guide/multiple-browsers.html#target-manifest-version) for more
|
|
802
|
+
* details.
|
|
768
803
|
*/
|
|
769
804
|
manifestVersion: 2 | 3;
|
|
770
805
|
}
|
|
@@ -964,6 +999,10 @@ interface Wxt {
|
|
|
964
999
|
* Reload config file and update the `config` field with the result.
|
|
965
1000
|
*/
|
|
966
1001
|
reloadConfig: () => Promise<void>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Package manager utilities.
|
|
1004
|
+
*/
|
|
1005
|
+
pm: WxtPackageManager;
|
|
967
1006
|
}
|
|
968
1007
|
interface ResolvedConfig {
|
|
969
1008
|
root: string;
|
|
@@ -998,6 +1037,8 @@ interface ResolvedConfig {
|
|
|
998
1037
|
includeSources: string[];
|
|
999
1038
|
excludeSources: string[];
|
|
1000
1039
|
sourcesRoot: string;
|
|
1040
|
+
downloadedPackagesDir: string;
|
|
1041
|
+
downloadPackages: string[];
|
|
1001
1042
|
};
|
|
1002
1043
|
transformManifest: (manifest: Manifest.WebExtensionManifest) => void;
|
|
1003
1044
|
analysis: {
|
|
@@ -1072,5 +1113,41 @@ type WxtUnimportOptions = Partial<UnimportOptions> & {
|
|
|
1072
1113
|
type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
|
|
1073
1114
|
eslintrc: ResolvedEslintrc;
|
|
1074
1115
|
};
|
|
1116
|
+
/**
|
|
1117
|
+
* Package management utils built on top of [`nypm`](https://www.npmjs.com/package/nypm)
|
|
1118
|
+
*/
|
|
1119
|
+
interface WxtPackageManager extends Nypm.PackageManager {
|
|
1120
|
+
addDependency: typeof Nypm.addDependency;
|
|
1121
|
+
addDevDependency: typeof Nypm.addDevDependency;
|
|
1122
|
+
ensureDependencyInstalled: typeof Nypm.ensureDependencyInstalled;
|
|
1123
|
+
installDependencies: typeof Nypm.installDependencies;
|
|
1124
|
+
removeDependency: typeof Nypm.removeDependency;
|
|
1125
|
+
/**
|
|
1126
|
+
* Download a package's TGZ file and move it into the `downloadDir`. Use's `npm pack <name>`, so
|
|
1127
|
+
* you must have setup authorization in `.npmrc` file, regardless of the package manager used.
|
|
1128
|
+
*
|
|
1129
|
+
* @param id Name of the package to download, can include a version (like `wxt@0.17.1`)
|
|
1130
|
+
* @param downloadDir Where to store the package.
|
|
1131
|
+
* @returns Absolute path to downloaded file.
|
|
1132
|
+
*/
|
|
1133
|
+
downloadDependency: (id: string, downloadDir: string) => Promise<string>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Run `npm ls`, `pnpm ls`, or `bun pm ls`, or `yarn list` and return the results.
|
|
1136
|
+
*
|
|
1137
|
+
* WARNING: Yarn always returns all dependencies
|
|
1138
|
+
*/
|
|
1139
|
+
listDependencies: (options?: {
|
|
1140
|
+
cwd?: string;
|
|
1141
|
+
all?: boolean;
|
|
1142
|
+
}) => Promise<Dependency[]>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Key used to override package versions. Sometimes called "resolutions".
|
|
1145
|
+
*/
|
|
1146
|
+
overridesKey: string;
|
|
1147
|
+
}
|
|
1148
|
+
interface Dependency {
|
|
1149
|
+
name: string;
|
|
1150
|
+
version: string;
|
|
1151
|
+
}
|
|
1075
1152
|
|
|
1076
|
-
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 };
|
|
1153
|
+
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, WxtPackageManager as a4, Dependency as a5, 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 };
|