wxt 0.21.2 → 0.21.4
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/builtin-modules/escape-unicode.mjs +34 -0
- package/dist/builtin-modules/index.mjs +6 -1
- package/dist/builtin-modules/unimport.mjs +3 -3
- package/dist/cli/cli-utils.mjs +5 -2
- package/dist/core/builders/vite/index.mjs +8 -1
- package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +2 -2
- package/dist/core/initialize.d.mts +3 -3
- package/dist/core/initialize.mjs +33 -47
- package/dist/core/keyboard-shortcuts.mjs +1 -0
- package/dist/core/package-managers/bun.mjs +5 -2
- package/dist/core/package-managers/npm.mjs +10 -4
- package/dist/core/package-managers/pnpm.mjs +5 -2
- package/dist/core/package-managers/yarn.mjs +5 -2
- package/dist/core/resolve-config.mjs +17 -20
- package/dist/core/utils/building/find-entrypoints.mjs +3 -3
- package/dist/core/utils/building/internal-build.mjs +3 -3
- package/dist/core/utils/building/rebuild.mjs +1 -1
- package/dist/core/utils/create-file-reloader.mjs +3 -3
- package/dist/core/utils/env.mjs +5 -1
- package/dist/core/utils/fs.mjs +6 -1
- package/dist/core/utils/log/index.mjs +1 -0
- package/dist/core/utils/log/printFileList.mjs +3 -3
- package/dist/core/utils/log/wxtLogger.mjs +32 -0
- package/dist/core/utils/manifest.mjs +6 -6
- package/dist/core/utils/paths.mjs +2 -2
- package/dist/core/utils/spinner.mjs +69 -0
- package/dist/core/utils/strings.mjs +2 -2
- package/dist/core/zip.mjs +6 -13
- package/dist/index.d.mts +2 -2
- package/dist/inline/get-port-please/index.mjs +196 -0
- package/dist/inline/is-wsl/index.mjs +44 -0
- package/dist/inline/normalize-path/index.mjs +23 -0
- package/dist/inline/ohash/index.mjs +113 -0
- package/dist/inline/scule/index.mjs +50 -0
- package/dist/types.d.mts +49 -34
- package/dist/utils/content-script-ui/iframe.d.mts +2 -0
- package/dist/utils/content-script-ui/iframe.mjs +2 -0
- package/dist/utils/content-script-ui/integrated.d.mts +2 -0
- package/dist/utils/content-script-ui/integrated.mjs +2 -0
- package/dist/utils/content-script-ui/shadow-root.d.mts +2 -0
- package/dist/utils/content-script-ui/shadow-root.mjs +2 -0
- package/dist/version.mjs +1 -1
- package/package.json +16 -19
package/dist/types.d.mts
CHANGED
|
@@ -441,7 +441,23 @@ interface InlineConfig {
|
|
|
441
441
|
*/
|
|
442
442
|
alias?: Record<string, string>;
|
|
443
443
|
/** Experimental settings - use with caution. */
|
|
444
|
-
experimental?: {
|
|
444
|
+
experimental?: {
|
|
445
|
+
/**
|
|
446
|
+
* Some libraries include unicode characters Chrome does not allow in
|
|
447
|
+
* extensions. If you receive "Could not load content script... it is not
|
|
448
|
+
* UTF-8 encoded", enable this setting.
|
|
449
|
+
*
|
|
450
|
+
* It is not enabled by default because it will slow down your build, and
|
|
451
|
+
* because it's very rare to have the problematic characters in JS. So not
|
|
452
|
+
* every extension needs this flag enabled.
|
|
453
|
+
*
|
|
454
|
+
* For more details, see:
|
|
455
|
+
*
|
|
456
|
+
* - https://github.com/wxt-dev/wxt/issues/353
|
|
457
|
+
* - https://github.com/wxt-dev/wxt/issues/2535
|
|
458
|
+
*/
|
|
459
|
+
escapeUnicode?: boolean;
|
|
460
|
+
};
|
|
445
461
|
/** Config effecting dev mode only. */
|
|
446
462
|
dev?: {
|
|
447
463
|
server?: {
|
|
@@ -618,6 +634,17 @@ interface Logger {
|
|
|
618
634
|
success(...args: any[]): void;
|
|
619
635
|
level: LogLevel;
|
|
620
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* The logger available at `wxt.logger`. Extends {@link Logger} with a `warnOnce`
|
|
639
|
+
* which only logs a message once per process.
|
|
640
|
+
*/
|
|
641
|
+
interface WxtLogger extends Logger {
|
|
642
|
+
/**
|
|
643
|
+
* Same as {@link Logger.warn}, but only logs a given message once per process,
|
|
644
|
+
* even if called multiple times with the same arguments.
|
|
645
|
+
*/
|
|
646
|
+
warnOnce(...args: any[]): void;
|
|
647
|
+
}
|
|
621
648
|
interface BaseEntrypointOptions {
|
|
622
649
|
/**
|
|
623
650
|
* List of target browsers to include this entrypoint in. Defaults to being
|
|
@@ -1106,21 +1133,6 @@ interface WebExtConfig {
|
|
|
1106
1133
|
* default_directory: "/my/custom/dir",
|
|
1107
1134
|
* },
|
|
1108
1135
|
* }
|
|
1109
|
-
*
|
|
1110
|
-
* @default
|
|
1111
|
-
* // Enable dev mode and allow content script sourcemaps
|
|
1112
|
-
* {
|
|
1113
|
-
* devtools: {
|
|
1114
|
-
* synced_preferences_sync_disabled: {
|
|
1115
|
-
* skipContentScripts: false,
|
|
1116
|
-
* },
|
|
1117
|
-
* }
|
|
1118
|
-
* extensions: {
|
|
1119
|
-
* ui: {
|
|
1120
|
-
* developer_mode: true,
|
|
1121
|
-
* },
|
|
1122
|
-
* }
|
|
1123
|
-
* }
|
|
1124
1136
|
*/
|
|
1125
1137
|
chromiumPref?: Record<string, any>;
|
|
1126
1138
|
/**
|
|
@@ -1365,8 +1377,8 @@ interface Wxt {
|
|
|
1365
1377
|
hooks: Hookable<WxtHooks>;
|
|
1366
1378
|
/** Alias for `wxt.hooks.hook(...)`. */
|
|
1367
1379
|
hook: Hookable<WxtHooks>['hook'];
|
|
1368
|
-
/**
|
|
1369
|
-
logger:
|
|
1380
|
+
/** Wraps `config.logger`, adding `warnOnce`. */
|
|
1381
|
+
logger: WxtLogger;
|
|
1370
1382
|
/** Reload config file and update `wxt.config` with the result. */
|
|
1371
1383
|
reloadConfig: () => Promise<void>;
|
|
1372
1384
|
/** Package manager utilities. */
|
|
@@ -1417,7 +1429,7 @@ interface ResolvedConfig$1 {
|
|
|
1417
1429
|
targetBrowsers: TargetBrowser[];
|
|
1418
1430
|
manifestVersion: TargetManifestVersion;
|
|
1419
1431
|
env: ConfigEnv;
|
|
1420
|
-
logger:
|
|
1432
|
+
logger: WxtLogger;
|
|
1421
1433
|
imports: WxtResolvedUnimportOptions;
|
|
1422
1434
|
manifest: UserManifest;
|
|
1423
1435
|
fsCache: FsCache;
|
|
@@ -1449,7 +1461,9 @@ interface ResolvedConfig$1 {
|
|
|
1449
1461
|
userConfigMetadata: Omit<ResolvedConfig<UserConfig>, 'config'>;
|
|
1450
1462
|
/** Import aliases to absolute paths. */
|
|
1451
1463
|
alias: Record<string, string>;
|
|
1452
|
-
experimental: {
|
|
1464
|
+
experimental: {
|
|
1465
|
+
escapeUnicode: boolean;
|
|
1466
|
+
};
|
|
1453
1467
|
/** List of warning identifiers to suppress during the build process. */
|
|
1454
1468
|
suppressWarnings: {
|
|
1455
1469
|
firefoxDataCollection?: boolean;
|
|
@@ -1508,28 +1522,29 @@ interface ExtensionRunner {
|
|
|
1508
1522
|
canOpen?(): boolean;
|
|
1509
1523
|
}
|
|
1510
1524
|
type EslintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
|
|
1525
|
+
type EslintConfigVersion = 8 | 9;
|
|
1511
1526
|
interface Eslintrc {
|
|
1512
1527
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1528
|
+
* Determines if and in what format a config file will be generated to inform
|
|
1529
|
+
* ESLint of unimport globals.
|
|
1515
1530
|
*
|
|
1516
|
-
* - `
|
|
1517
|
-
*
|
|
1518
|
-
* - `
|
|
1519
|
-
* - `
|
|
1520
|
-
* - `
|
|
1521
|
-
* - `
|
|
1531
|
+
* - `true`: If eslint is installed, generate a compatible config file based on
|
|
1532
|
+
* the installed version.
|
|
1533
|
+
* - `false`: Never generate the file.
|
|
1534
|
+
* - `8`: Generate an eslintrc file compatible with ESLint <e; 8.
|
|
1535
|
+
* - `9`: Generate a flat config file compatible with ESLint >e; 9.
|
|
1536
|
+
* - `'auto'` (Deprecated): Same as `true`.
|
|
1522
1537
|
*
|
|
1523
|
-
* @default
|
|
1538
|
+
* @default true
|
|
1524
1539
|
*/
|
|
1525
|
-
enabled?:
|
|
1540
|
+
enabled?: boolean | 'auto' | EslintConfigVersion;
|
|
1526
1541
|
/**
|
|
1527
1542
|
* File path to save the generated eslint config.
|
|
1528
1543
|
*
|
|
1529
1544
|
* Default depends on version of ESLint used:
|
|
1530
1545
|
*
|
|
1531
|
-
* - 9
|
|
1532
|
-
* - 8
|
|
1546
|
+
* - >e; 9: './.wxt/eslint-auto-imports.mjs'
|
|
1547
|
+
* - <e; 8: './.wxt/eslintrc-auto-import.json'
|
|
1533
1548
|
*/
|
|
1534
1549
|
filePath?: string;
|
|
1535
1550
|
/** @default true */
|
|
@@ -1537,7 +1552,7 @@ interface Eslintrc {
|
|
|
1537
1552
|
}
|
|
1538
1553
|
interface ResolvedEslintrc {
|
|
1539
1554
|
/** False if disabled, otherwise the major version of ESLint installed */
|
|
1540
|
-
enabled: false |
|
|
1555
|
+
enabled: false | EslintConfigVersion;
|
|
1541
1556
|
/** Absolute path */
|
|
1542
1557
|
filePath: string;
|
|
1543
1558
|
globalsPropValue: EslintGlobalsPropValue;
|
|
@@ -1683,4 +1698,4 @@ interface WxtDirFileEntry {
|
|
|
1683
1698
|
tsReference?: boolean;
|
|
1684
1699
|
}
|
|
1685
1700
|
//#endregion
|
|
1686
|
-
export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };
|
|
1701
|
+
export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintConfigVersion, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtLogger, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };
|
|
@@ -6,6 +6,8 @@ import * as _$wxt_browser0 from "wxt/browser";
|
|
|
6
6
|
/**
|
|
7
7
|
* Create a content script UI using an iframe.
|
|
8
8
|
*
|
|
9
|
+
* @param options - Iframe options. See {@link ContentScriptUiOptions} for shared
|
|
10
|
+
* positioning, anchoring, `append`, and removal options.
|
|
9
11
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#iframe
|
|
10
12
|
*/
|
|
11
13
|
declare function createIframeUi<TMounted>(ctx: ContentScriptContext, options: IframeContentScriptUiOptions<TMounted>): IframeContentScriptUi<TMounted>;
|
|
@@ -5,6 +5,8 @@ import { browser } from "wxt/browser";
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a content script UI using an iframe.
|
|
7
7
|
*
|
|
8
|
+
* @param options - Iframe options. See {@link ContentScriptUiOptions} for shared
|
|
9
|
+
* positioning, anchoring, `append`, and removal options.
|
|
8
10
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#iframe
|
|
9
11
|
*/
|
|
10
12
|
function createIframeUi(ctx, options) {
|
|
@@ -5,6 +5,8 @@ import { ContentScriptUi, ContentScriptUiOptions } from "./types.mjs";
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a content script UI without any isolation.
|
|
7
7
|
*
|
|
8
|
+
* @param options - Integrated UI options. See {@link ContentScriptUiOptions} for
|
|
9
|
+
* shared positioning, anchoring, `append`, and removal options.
|
|
8
10
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#integrated
|
|
9
11
|
*/
|
|
10
12
|
declare function createIntegratedUi<TMounted>(ctx: ContentScriptContext, options: IntegratedContentScriptUiOptions<TMounted>): IntegratedContentScriptUi<TMounted>;
|
|
@@ -3,6 +3,8 @@ import { applyPosition, createMountFunctions, mountUi } from "./shared.mjs";
|
|
|
3
3
|
/**
|
|
4
4
|
* Create a content script UI without any isolation.
|
|
5
5
|
*
|
|
6
|
+
* @param options - Integrated UI options. See {@link ContentScriptUiOptions} for
|
|
7
|
+
* shared positioning, anchoring, `append`, and removal options.
|
|
6
8
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#integrated
|
|
7
9
|
*/
|
|
8
10
|
function createIntegratedUi(ctx, options) {
|
|
@@ -8,6 +8,8 @@ import { ContentScriptUi, ContentScriptUiOptions } from "./types.mjs";
|
|
|
8
8
|
*
|
|
9
9
|
* > This function is async because it has to load the CSS via a network call.
|
|
10
10
|
*
|
|
11
|
+
* @param options - Shadow root options. See {@link ContentScriptUiOptions} for
|
|
12
|
+
* shared positioning, anchoring, `append`, and removal options.
|
|
11
13
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#shadow-root
|
|
12
14
|
*/
|
|
13
15
|
declare function createShadowRootUi<TMounted>(ctx: ContentScriptContext, options: ShadowRootContentScriptUiOptions<TMounted>): Promise<ShadowRootContentScriptUi<TMounted>>;
|
|
@@ -11,6 +11,8 @@ import { createIsolatedElement } from "@webext-core/isolated-element";
|
|
|
11
11
|
*
|
|
12
12
|
* > This function is async because it has to load the CSS via a network call.
|
|
13
13
|
*
|
|
14
|
+
* @param options - Shadow root options. See {@link ContentScriptUiOptions} for
|
|
15
|
+
* shared positioning, anchoring, `append`, and removal options.
|
|
14
16
|
* @see https://wxt.dev/guide/essentials/content-scripts.html#shadow-root
|
|
15
17
|
*/
|
|
16
18
|
async function createShadowRootUi(ctx, options) {
|
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.4",
|
|
5
5
|
"description": "⚡ Next-gen Web Extension Framework",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -17,39 +17,31 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@1natsu/wait-element": "^4.1.2",
|
|
19
19
|
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
|
|
20
|
+
"@aklinker1/zero-zip": "^1.0.1",
|
|
21
|
+
"@topcli/prompts": "^4.0.0",
|
|
20
22
|
"@webext-core/fake-browser": "^2.0.1",
|
|
21
23
|
"@webext-core/isolated-element": "^1.1.3 || ^2 || ^3",
|
|
22
24
|
"@webext-core/match-patterns": "^2.0.0",
|
|
23
|
-
"@wxt-dev/browser": "
|
|
25
|
+
"@wxt-dev/browser": ">=0.1",
|
|
24
26
|
"@wxt-dev/storage": "^1.0.0",
|
|
25
|
-
"async-mutex": "^0.5.0",
|
|
26
27
|
"c12": "^3.3.4",
|
|
27
28
|
"cac": "^6.7.14 || ^7.0.0",
|
|
28
29
|
"chokidar": "^5.0.0",
|
|
29
|
-
"ci-info": "^4.4.0",
|
|
30
30
|
"consola": "^3.4.2",
|
|
31
31
|
"defu": "^6.1.4",
|
|
32
32
|
"dotenv-expand": "^13.0.0",
|
|
33
33
|
"filesize": "^11.0.17",
|
|
34
|
-
"get-port-please": "^3.2.0",
|
|
35
34
|
"giget": "^1.2.3 || ^2.0.0 || ^3.0.0",
|
|
36
35
|
"hookable": "^6.1.0",
|
|
37
|
-
"import-meta-resolve": "^4.2.0",
|
|
38
|
-
"is-wsl": "^3.1.1",
|
|
39
36
|
"json5": "^2.2.3",
|
|
40
|
-
"jszip": "^3.10.1",
|
|
41
37
|
"linkedom": "^0.18.12",
|
|
42
38
|
"magicast": "^0.5.2",
|
|
43
|
-
"nano-spawn": "^2.0.0",
|
|
44
|
-
"nanospinner": "^1.2.2",
|
|
45
|
-
"normalize-path": "^3.0.0",
|
|
46
39
|
"nypm": "^0.6.5",
|
|
47
|
-
"ohash": "^2.0.11",
|
|
48
|
-
"open": "^11.0.0",
|
|
49
40
|
"picomatch": "^4.0.3",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
41
|
+
"publish-browser-extension": "^5.1.0 || ^6.0.0",
|
|
42
|
+
"superlock": "^1.3.2",
|
|
43
|
+
"tiny-open": "^1.3.0",
|
|
44
|
+
"tinyexec": "^1.2.4",
|
|
53
45
|
"tinyglobby": "^0.2.16",
|
|
54
46
|
"unimport": "^3.13.1 || ^4.0.0 || ^5.0.0 || ^6.0.0"
|
|
55
47
|
},
|
|
@@ -81,15 +73,20 @@
|
|
|
81
73
|
"@types/prompts": "^2.4.9",
|
|
82
74
|
"eslint": "^10.1.0",
|
|
83
75
|
"extract-zip": "^2.0.1",
|
|
76
|
+
"get-port-please": "^3.2.0",
|
|
84
77
|
"happy-dom": "^20.8.3",
|
|
78
|
+
"is-wsl": "^3.1.1",
|
|
85
79
|
"lodash.merge": "^4.6.2",
|
|
80
|
+
"normalize-path": "^3.0.0",
|
|
81
|
+
"ohash": "^2.0.11",
|
|
86
82
|
"oxlint": "^1.63.0",
|
|
87
83
|
"publint": "^0.3.18",
|
|
84
|
+
"scule": "^1.3.0",
|
|
88
85
|
"tsdown": "^0.21.0",
|
|
89
86
|
"typescript": "^6.0.3",
|
|
90
|
-
"vite": "^
|
|
91
|
-
"vitest": "^4.1.
|
|
92
|
-
"vitest-plugin-random-seed": "^
|
|
87
|
+
"vite": "^8.2.0",
|
|
88
|
+
"vitest": "^4.1.10",
|
|
89
|
+
"vitest-plugin-random-seed": "^2.0.2",
|
|
93
90
|
"web-ext": "^10.5.0"
|
|
94
91
|
},
|
|
95
92
|
"repository": {
|