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/chunk-6XSIWUWF.js +57 -0
- package/dist/{chunk-UA35R5HN.js → chunk-XNTIBS6O.js} +295 -202
- package/dist/cli.js +350 -238
- package/dist/{execa-D7CMCKO2.js → execa-4UBDUBJZ.js} +566 -478
- package/dist/{execa-ATHZH2Y4.js → execa-QLUM2B3W.js} +566 -478
- package/dist/{index-B0efqfEK.d.ts → index-CER9SLWP.d.cts} +69 -13
- package/dist/{index-B0efqfEK.d.cts → index-CER9SLWP.d.ts} +69 -13
- package/dist/index.cjs +1134 -913
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +18 -12
- package/dist/modules.d.cts +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/modules.js +8 -49
- package/dist/testing.cjs +253 -122
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +18 -9
- package/dist/virtual/background-entrypoint.js +9 -1
- package/package.json +9 -9
|
@@ -1041,6 +1041,23 @@ interface WxtHooks {
|
|
|
1041
1041
|
* @returns Promise
|
|
1042
1042
|
*/
|
|
1043
1043
|
ready: (wxt: Wxt) => HookResult;
|
|
1044
|
+
/**
|
|
1045
|
+
* Called before WXT writes .wxt/tsconfig.json and .wxt/wxt.d.ts, allowing
|
|
1046
|
+
* addition of custom references and declarations in wxt.d.ts, or directly
|
|
1047
|
+
* modifying the options in `tsconfig.json`.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* wxt.hooks.hook("prepare:types", (wxt, entries) => {
|
|
1051
|
+
* // Add a file, ".wxt/types/example.d.ts", that defines a global
|
|
1052
|
+
* // variable called "example" in the TS project.
|
|
1053
|
+
* entries.push({
|
|
1054
|
+
* path: "types/example.d.ts",
|
|
1055
|
+
* textContent: "declare const a: string;",
|
|
1056
|
+
* tsReference: true,
|
|
1057
|
+
* });
|
|
1058
|
+
* })
|
|
1059
|
+
*/
|
|
1060
|
+
'prepare:types': (wxt: Wxt, entries: WxtDirEntry[]) => HookResult;
|
|
1044
1061
|
/**
|
|
1045
1062
|
* Called before the build is started in both dev mode and build mode.
|
|
1046
1063
|
*
|
|
@@ -1193,7 +1210,8 @@ interface ResolvedConfig {
|
|
|
1193
1210
|
reloadCommand: string | false;
|
|
1194
1211
|
};
|
|
1195
1212
|
hooks: NestedHooks<WxtHooks>;
|
|
1196
|
-
|
|
1213
|
+
builtinModules: WxtModule<any>[];
|
|
1214
|
+
userModules: WxtModuleWithMetadata<any>[];
|
|
1197
1215
|
/**
|
|
1198
1216
|
* An array of string to import plugins from. These paths should be
|
|
1199
1217
|
* resolvable by vite, and they should `export default defineWxtPlugin(...)`.
|
|
@@ -1216,17 +1234,21 @@ interface Eslintrc {
|
|
|
1216
1234
|
/**
|
|
1217
1235
|
* When true, generates a file that can be used by ESLint to know which variables are valid globals.
|
|
1218
1236
|
*
|
|
1219
|
-
* - `
|
|
1220
|
-
* - `
|
|
1221
|
-
* - `
|
|
1237
|
+
* - `false`: Don't generate the file.
|
|
1238
|
+
* - `'auto'`: Check if eslint is installed, and if it is, generate a compatible config file.
|
|
1239
|
+
* - `true`: Same as `8`.
|
|
1240
|
+
* - `8`: Generate a config file compatible with ESLint 8.
|
|
1241
|
+
* - `9`: Generate a config file compatible with ESLint 9.
|
|
1222
1242
|
*
|
|
1223
1243
|
* @default 'auto'
|
|
1224
1244
|
*/
|
|
1225
|
-
enabled?:
|
|
1245
|
+
enabled?: false | true | 'auto' | 8 | 9;
|
|
1226
1246
|
/**
|
|
1227
1247
|
* File path to save the generated eslint config.
|
|
1228
1248
|
*
|
|
1229
|
-
*
|
|
1249
|
+
* Default depends on version of ESLint used:
|
|
1250
|
+
* - 9 and above: './.wxt/eslint-auto-imports.mjs'
|
|
1251
|
+
* - 8 and below: './.wxt/eslintrc-auto-import.json'
|
|
1230
1252
|
*/
|
|
1231
1253
|
filePath?: string;
|
|
1232
1254
|
/**
|
|
@@ -1235,7 +1257,8 @@ interface Eslintrc {
|
|
|
1235
1257
|
globalsPropValue?: EslintGlobalsPropValue;
|
|
1236
1258
|
}
|
|
1237
1259
|
interface ResolvedEslintrc {
|
|
1238
|
-
|
|
1260
|
+
/** False if disabled, otherwise the major version of ESLint installed */
|
|
1261
|
+
enabled: false | 8 | 9;
|
|
1239
1262
|
/** Absolute path */
|
|
1240
1263
|
filePath: string;
|
|
1241
1264
|
globalsPropValue: EslintGlobalsPropValue;
|
|
@@ -1316,20 +1339,53 @@ interface WxtModuleWithMetadata<TOptions extends WxtModuleOptions> extends WxtMo
|
|
|
1316
1339
|
type: 'local' | 'node_module';
|
|
1317
1340
|
id: string;
|
|
1318
1341
|
}
|
|
1319
|
-
|
|
1342
|
+
type ResolvedPublicFile = CopiedPublicFile | GeneratedPublicFile;
|
|
1343
|
+
interface ResolvedBasePublicFile {
|
|
1344
|
+
/**
|
|
1345
|
+
* The relative path in the output directory to copy the file to.
|
|
1346
|
+
* @example
|
|
1347
|
+
* "content-scripts/base-styles.css"
|
|
1348
|
+
*/
|
|
1349
|
+
relativeDest: string;
|
|
1350
|
+
}
|
|
1351
|
+
interface CopiedPublicFile extends ResolvedBasePublicFile {
|
|
1320
1352
|
/**
|
|
1321
1353
|
* The absolute path to the file that will be copied to the output directory.
|
|
1322
1354
|
* @example
|
|
1323
1355
|
* "/path/to/any/file.css"
|
|
1324
1356
|
*/
|
|
1325
1357
|
absoluteSrc: string;
|
|
1358
|
+
}
|
|
1359
|
+
interface GeneratedPublicFile extends ResolvedBasePublicFile {
|
|
1326
1360
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
* @example
|
|
1329
|
-
* "content-scripts/base-styles.css"
|
|
1361
|
+
* Text to write to the file.
|
|
1330
1362
|
*/
|
|
1331
|
-
|
|
1363
|
+
contents: string;
|
|
1332
1364
|
}
|
|
1333
1365
|
type WxtPlugin = () => void;
|
|
1366
|
+
type WxtDirEntry = WxtDirTypeReferenceEntry | WxtDirFileEntry;
|
|
1367
|
+
/**
|
|
1368
|
+
* Represents type reference to a node module to be added to `.wxt/wxt.d.ts` file
|
|
1369
|
+
*/
|
|
1370
|
+
interface WxtDirTypeReferenceEntry {
|
|
1371
|
+
module: string;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Represents a file to be written to the project's `.wxt/` directory.
|
|
1375
|
+
*/
|
|
1376
|
+
interface WxtDirFileEntry {
|
|
1377
|
+
/**
|
|
1378
|
+
* Path relative to the `.wxt/` directory. So "tsconfig.json" would resolve to ".wxt/tsconfig.json".
|
|
1379
|
+
*/
|
|
1380
|
+
path: string;
|
|
1381
|
+
/**
|
|
1382
|
+
* The text that will be written to the file.
|
|
1383
|
+
*/
|
|
1384
|
+
text: string;
|
|
1385
|
+
/**
|
|
1386
|
+
* Set to `true` to add a reference to this file in `.wxt/wxt.d.ts`.
|
|
1387
|
+
*/
|
|
1388
|
+
tsReference?: boolean;
|
|
1389
|
+
}
|
|
1334
1390
|
|
|
1335
|
-
export type { EslintGlobalsPropValue as $, PerBrowserMap as A, BuildOutput as B, ContentScriptEntrypoint as C, ResolvedPerBrowserOptions as D, ExtensionRunnerConfig as E, UserManifest as F, GenericEntrypoint as G, UserManifestFn as H, InlineConfig as I, ConfigEnv as J, WxtCommand as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilder as N, OutputFile as O, PopupEntrypointOptions as P, WxtBuilderServer as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ServerInfo as V, WxtDevServer as W, HookResult as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, WxtModuleOptions as a6, WxtModuleSetup as a7, WxtModule as a8, WxtModuleWithMetadata as a9, ResolvedPublicFile as aa,
|
|
1391
|
+
export type { EslintGlobalsPropValue as $, PerBrowserMap as A, BuildOutput as B, ContentScriptEntrypoint as C, ResolvedPerBrowserOptions as D, ExtensionRunnerConfig as E, UserManifest as F, GenericEntrypoint as G, UserManifestFn as H, InlineConfig as I, ConfigEnv as J, WxtCommand as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilder as N, OutputFile as O, PopupEntrypointOptions as P, WxtBuilderServer as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ServerInfo as V, WxtDevServer as W, HookResult as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, WxtModuleOptions as a6, WxtModuleSetup as a7, WxtModule as a8, WxtModuleWithMetadata as a9, ResolvedPublicFile as aa, ResolvedBasePublicFile as ab, CopiedPublicFile as ac, GeneratedPublicFile as ad, WxtPlugin as ae, WxtDirEntry as af, WxtDirTypeReferenceEntry as ag, WxtDirFileEntry as ah, WxtHooks as b, OutputChunk as c, OutputAsset as d, BuildStepOutput as e, ReloadContentScriptPayload as f, TargetManifestVersion as g, BaseEntrypointOptions as h, BackgroundEntrypointOptions as i, BaseContentScriptEntrypointOptions as j, IsolatedWorldContentScriptEntrypointOptions as k, OptionsEntrypointOptions as l, BaseEntrypoint as m, BackgroundEntrypoint as n, PopupEntrypoint as o, OptionsEntrypoint as p, SidepanelEntrypoint as q, Entrypoint as r, EntrypointGroup as s, OnContentScriptStopped as t, IsolatedWorldContentScriptDefinition as u, MainWorldContentScriptDefinition as v, ContentScriptDefinition as w, BackgroundDefinition as x, UnlistedScriptDefinition as y, PerBrowserOption as z };
|
|
@@ -1041,6 +1041,23 @@ interface WxtHooks {
|
|
|
1041
1041
|
* @returns Promise
|
|
1042
1042
|
*/
|
|
1043
1043
|
ready: (wxt: Wxt) => HookResult;
|
|
1044
|
+
/**
|
|
1045
|
+
* Called before WXT writes .wxt/tsconfig.json and .wxt/wxt.d.ts, allowing
|
|
1046
|
+
* addition of custom references and declarations in wxt.d.ts, or directly
|
|
1047
|
+
* modifying the options in `tsconfig.json`.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* wxt.hooks.hook("prepare:types", (wxt, entries) => {
|
|
1051
|
+
* // Add a file, ".wxt/types/example.d.ts", that defines a global
|
|
1052
|
+
* // variable called "example" in the TS project.
|
|
1053
|
+
* entries.push({
|
|
1054
|
+
* path: "types/example.d.ts",
|
|
1055
|
+
* textContent: "declare const a: string;",
|
|
1056
|
+
* tsReference: true,
|
|
1057
|
+
* });
|
|
1058
|
+
* })
|
|
1059
|
+
*/
|
|
1060
|
+
'prepare:types': (wxt: Wxt, entries: WxtDirEntry[]) => HookResult;
|
|
1044
1061
|
/**
|
|
1045
1062
|
* Called before the build is started in both dev mode and build mode.
|
|
1046
1063
|
*
|
|
@@ -1193,7 +1210,8 @@ interface ResolvedConfig {
|
|
|
1193
1210
|
reloadCommand: string | false;
|
|
1194
1211
|
};
|
|
1195
1212
|
hooks: NestedHooks<WxtHooks>;
|
|
1196
|
-
|
|
1213
|
+
builtinModules: WxtModule<any>[];
|
|
1214
|
+
userModules: WxtModuleWithMetadata<any>[];
|
|
1197
1215
|
/**
|
|
1198
1216
|
* An array of string to import plugins from. These paths should be
|
|
1199
1217
|
* resolvable by vite, and they should `export default defineWxtPlugin(...)`.
|
|
@@ -1216,17 +1234,21 @@ interface Eslintrc {
|
|
|
1216
1234
|
/**
|
|
1217
1235
|
* When true, generates a file that can be used by ESLint to know which variables are valid globals.
|
|
1218
1236
|
*
|
|
1219
|
-
* - `
|
|
1220
|
-
* - `
|
|
1221
|
-
* - `
|
|
1237
|
+
* - `false`: Don't generate the file.
|
|
1238
|
+
* - `'auto'`: Check if eslint is installed, and if it is, generate a compatible config file.
|
|
1239
|
+
* - `true`: Same as `8`.
|
|
1240
|
+
* - `8`: Generate a config file compatible with ESLint 8.
|
|
1241
|
+
* - `9`: Generate a config file compatible with ESLint 9.
|
|
1222
1242
|
*
|
|
1223
1243
|
* @default 'auto'
|
|
1224
1244
|
*/
|
|
1225
|
-
enabled?:
|
|
1245
|
+
enabled?: false | true | 'auto' | 8 | 9;
|
|
1226
1246
|
/**
|
|
1227
1247
|
* File path to save the generated eslint config.
|
|
1228
1248
|
*
|
|
1229
|
-
*
|
|
1249
|
+
* Default depends on version of ESLint used:
|
|
1250
|
+
* - 9 and above: './.wxt/eslint-auto-imports.mjs'
|
|
1251
|
+
* - 8 and below: './.wxt/eslintrc-auto-import.json'
|
|
1230
1252
|
*/
|
|
1231
1253
|
filePath?: string;
|
|
1232
1254
|
/**
|
|
@@ -1235,7 +1257,8 @@ interface Eslintrc {
|
|
|
1235
1257
|
globalsPropValue?: EslintGlobalsPropValue;
|
|
1236
1258
|
}
|
|
1237
1259
|
interface ResolvedEslintrc {
|
|
1238
|
-
|
|
1260
|
+
/** False if disabled, otherwise the major version of ESLint installed */
|
|
1261
|
+
enabled: false | 8 | 9;
|
|
1239
1262
|
/** Absolute path */
|
|
1240
1263
|
filePath: string;
|
|
1241
1264
|
globalsPropValue: EslintGlobalsPropValue;
|
|
@@ -1316,20 +1339,53 @@ interface WxtModuleWithMetadata<TOptions extends WxtModuleOptions> extends WxtMo
|
|
|
1316
1339
|
type: 'local' | 'node_module';
|
|
1317
1340
|
id: string;
|
|
1318
1341
|
}
|
|
1319
|
-
|
|
1342
|
+
type ResolvedPublicFile = CopiedPublicFile | GeneratedPublicFile;
|
|
1343
|
+
interface ResolvedBasePublicFile {
|
|
1344
|
+
/**
|
|
1345
|
+
* The relative path in the output directory to copy the file to.
|
|
1346
|
+
* @example
|
|
1347
|
+
* "content-scripts/base-styles.css"
|
|
1348
|
+
*/
|
|
1349
|
+
relativeDest: string;
|
|
1350
|
+
}
|
|
1351
|
+
interface CopiedPublicFile extends ResolvedBasePublicFile {
|
|
1320
1352
|
/**
|
|
1321
1353
|
* The absolute path to the file that will be copied to the output directory.
|
|
1322
1354
|
* @example
|
|
1323
1355
|
* "/path/to/any/file.css"
|
|
1324
1356
|
*/
|
|
1325
1357
|
absoluteSrc: string;
|
|
1358
|
+
}
|
|
1359
|
+
interface GeneratedPublicFile extends ResolvedBasePublicFile {
|
|
1326
1360
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
* @example
|
|
1329
|
-
* "content-scripts/base-styles.css"
|
|
1361
|
+
* Text to write to the file.
|
|
1330
1362
|
*/
|
|
1331
|
-
|
|
1363
|
+
contents: string;
|
|
1332
1364
|
}
|
|
1333
1365
|
type WxtPlugin = () => void;
|
|
1366
|
+
type WxtDirEntry = WxtDirTypeReferenceEntry | WxtDirFileEntry;
|
|
1367
|
+
/**
|
|
1368
|
+
* Represents type reference to a node module to be added to `.wxt/wxt.d.ts` file
|
|
1369
|
+
*/
|
|
1370
|
+
interface WxtDirTypeReferenceEntry {
|
|
1371
|
+
module: string;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Represents a file to be written to the project's `.wxt/` directory.
|
|
1375
|
+
*/
|
|
1376
|
+
interface WxtDirFileEntry {
|
|
1377
|
+
/**
|
|
1378
|
+
* Path relative to the `.wxt/` directory. So "tsconfig.json" would resolve to ".wxt/tsconfig.json".
|
|
1379
|
+
*/
|
|
1380
|
+
path: string;
|
|
1381
|
+
/**
|
|
1382
|
+
* The text that will be written to the file.
|
|
1383
|
+
*/
|
|
1384
|
+
text: string;
|
|
1385
|
+
/**
|
|
1386
|
+
* Set to `true` to add a reference to this file in `.wxt/wxt.d.ts`.
|
|
1387
|
+
*/
|
|
1388
|
+
tsReference?: boolean;
|
|
1389
|
+
}
|
|
1334
1390
|
|
|
1335
|
-
export type { EslintGlobalsPropValue as $, PerBrowserMap as A, BuildOutput as B, ContentScriptEntrypoint as C, ResolvedPerBrowserOptions as D, ExtensionRunnerConfig as E, UserManifest as F, GenericEntrypoint as G, UserManifestFn as H, InlineConfig as I, ConfigEnv as J, WxtCommand as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilder as N, OutputFile as O, PopupEntrypointOptions as P, WxtBuilderServer as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ServerInfo as V, WxtDevServer as W, HookResult as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, WxtModuleOptions as a6, WxtModuleSetup as a7, WxtModule as a8, WxtModuleWithMetadata as a9, ResolvedPublicFile as aa,
|
|
1391
|
+
export type { EslintGlobalsPropValue as $, PerBrowserMap as A, BuildOutput as B, ContentScriptEntrypoint as C, ResolvedPerBrowserOptions as D, ExtensionRunnerConfig as E, UserManifest as F, GenericEntrypoint as G, UserManifestFn as H, InlineConfig as I, ConfigEnv as J, WxtCommand as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilder as N, OutputFile as O, PopupEntrypointOptions as P, WxtBuilderServer as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ServerInfo as V, WxtDevServer as W, HookResult as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, WxtModuleOptions as a6, WxtModuleSetup as a7, WxtModule as a8, WxtModuleWithMetadata as a9, ResolvedPublicFile as aa, ResolvedBasePublicFile as ab, CopiedPublicFile as ac, GeneratedPublicFile as ad, WxtPlugin as ae, WxtDirEntry as af, WxtDirTypeReferenceEntry as ag, WxtDirFileEntry as ah, WxtHooks as b, OutputChunk as c, OutputAsset as d, BuildStepOutput as e, ReloadContentScriptPayload as f, TargetManifestVersion as g, BaseEntrypointOptions as h, BackgroundEntrypointOptions as i, BaseContentScriptEntrypointOptions as j, IsolatedWorldContentScriptEntrypointOptions as k, OptionsEntrypointOptions as l, BaseEntrypoint as m, BackgroundEntrypoint as n, PopupEntrypoint as o, OptionsEntrypoint as p, SidepanelEntrypoint as q, Entrypoint as r, EntrypointGroup as s, OnContentScriptStopped as t, IsolatedWorldContentScriptDefinition as u, MainWorldContentScriptDefinition as v, ContentScriptDefinition as w, BackgroundDefinition as x, UnlistedScriptDefinition as y, PerBrowserOption as z };
|