fix!: Rename runner to webExt (#1180)
This commit is contained in:
@@ -4,7 +4,7 @@ outline: deep
|
||||
|
||||
# Browser Startup
|
||||
|
||||
> See the [API Reference](/api/reference/wxt/interfaces/ExtensionRunnerConfig) for a full list of config.
|
||||
> See the [API Reference](/api/reference/wxt/interfaces/WebExtConfig) for a full list of config.
|
||||
|
||||
During development, WXT uses [`web-ext` by Mozilla](https://www.npmjs.com/package/web-ext) to automatically open a browser window with your extension installed.
|
||||
|
||||
@@ -15,9 +15,9 @@ You can configure browser startup in 3 places:
|
||||
1. `<rootDir>/web-ext.config.ts`: Ignored from version control, this file lets you configure your own options for a specific project without affecting other developers
|
||||
|
||||
```ts
|
||||
import { defineRunnerConfig } from 'wxt';
|
||||
import { defineWebExtConfig } from 'wxt';
|
||||
|
||||
export default defineRunnerConfig({
|
||||
export default defineWebExtConfig({
|
||||
// ...
|
||||
});
|
||||
```
|
||||
@@ -32,7 +32,7 @@ You can configure browser startup in 3 places:
|
||||
To set or customize the browser opened during development:
|
||||
|
||||
```ts
|
||||
export default defineRunnerConfig({
|
||||
export default defineWebExtConfig({
|
||||
binaries: {
|
||||
chrome: '/path/to/chrome-beta', // Use Chrome Beta instead of regular Chrome
|
||||
firefox: 'firefoxdeveloperedition', // Use Firefox Developer Edition instead of regular Firefox
|
||||
@@ -54,7 +54,7 @@ To persist data, set the `--user-data-dir` flag:
|
||||
:::code-group
|
||||
|
||||
```ts [Mac/Linux]
|
||||
export default defineRunnerConfig({
|
||||
export default defineWebExtConfig({
|
||||
chromiumArgs: ['--user-data-dir=./.wxt/chrome-data'],
|
||||
});
|
||||
```
|
||||
@@ -62,7 +62,7 @@ export default defineRunnerConfig({
|
||||
```ts [Windows]
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
export default defineRunnerConfig({
|
||||
export default defineWebExtConfig({
|
||||
// On Windows, the path must be absolute
|
||||
chromiumProfile: resolve('.wxt/chrome-data'),
|
||||
keepProfileChanges: true,
|
||||
@@ -82,7 +82,7 @@ You can use any directory you'd like for `--user-data-dir`, the examples above c
|
||||
If you prefer to load the extension into your browser manually, you can disable the auto-open behavior:
|
||||
|
||||
```ts
|
||||
export default defineRunnerConfig({
|
||||
export default defineWebExtConfig({
|
||||
disabled: true,
|
||||
});
|
||||
```
|
||||
|
||||
@@ -180,7 +180,7 @@ describe('Hooks', () => {
|
||||
|
||||
const server = await project.startServer({
|
||||
hooks,
|
||||
runner: {
|
||||
webExt: {
|
||||
disabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { ExtensionRunnerConfig } from '../types';
|
||||
|
||||
export function defineRunnerConfig(
|
||||
config: ExtensionRunnerConfig,
|
||||
): ExtensionRunnerConfig {
|
||||
return config;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import consola from 'consola';
|
||||
import { WebExtConfig } from '../types';
|
||||
|
||||
/**
|
||||
* @deprecated Use `defineWebExtConfig` instead. Same function, different name.
|
||||
*/
|
||||
export function defineRunnerConfig(config: WebExtConfig): WebExtConfig {
|
||||
consola.warn(
|
||||
'`defineRunnerConfig` is deprecated, use `defineWebExtConfig` instead. See https://wxt.dev/guide/resources/upgrading.html#v0-19-0-rarr-v0-20-0',
|
||||
);
|
||||
return defineWebExtConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser during development.
|
||||
*/
|
||||
export function defineWebExtConfig(config: WebExtConfig): WebExtConfig {
|
||||
return config;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
export * from './build';
|
||||
export * from './clean';
|
||||
export * from './define-config';
|
||||
export * from './define-runner-config';
|
||||
export * from './define-web-ext-config';
|
||||
export * from './create-server';
|
||||
export * from './initialize';
|
||||
export * from './prepare';
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
ConfigEnv,
|
||||
UserManifestFn,
|
||||
UserManifest,
|
||||
ExtensionRunnerConfig,
|
||||
WebExtConfig,
|
||||
WxtResolvedUnimportOptions,
|
||||
Logger,
|
||||
WxtCommand,
|
||||
@@ -118,13 +118,18 @@ export async function resolveConfig(
|
||||
const outDir = path.resolve(outBaseDir, outDirTemplate);
|
||||
const reloadCommand = mergedConfig.dev?.reloadCommand ?? 'Alt+R';
|
||||
|
||||
const runnerConfig = await loadConfig<ExtensionRunnerConfig>({
|
||||
if (inlineConfig.runner != null || userConfig.runner != null) {
|
||||
logger.warn(
|
||||
'`InlineConfig#runner` is deprecated, use `InlineConfig#webExt` instead. See https://wxt.dev/guide/resources/upgrading.html#v0-19-0-rarr-v0-20-0',
|
||||
);
|
||||
}
|
||||
const runnerConfig = await loadConfig<WebExtConfig>({
|
||||
name: 'web-ext',
|
||||
cwd: root,
|
||||
globalRc: true,
|
||||
rcFile: '.webextrc',
|
||||
overrides: inlineConfig.runner,
|
||||
defaults: userConfig.runner,
|
||||
overrides: inlineConfig.webExt ?? inlineConfig.runner,
|
||||
defaults: userConfig.webExt ?? userConfig.runner,
|
||||
});
|
||||
// Make sure alias are absolute
|
||||
const alias = Object.fromEntries(
|
||||
|
||||
@@ -126,9 +126,13 @@ export interface InlineConfig {
|
||||
*/
|
||||
manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
|
||||
/**
|
||||
* Custom runner options. Options set here can be overridden in a `web-ext.config.ts` file.
|
||||
* Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
|
||||
*/
|
||||
runner?: ExtensionRunnerConfig;
|
||||
webExt?: WebExtConfig;
|
||||
/**
|
||||
* @deprecated Use `webExt` instead. Same option, just renamed.
|
||||
*/
|
||||
runner?: WebExtConfig;
|
||||
zip?: {
|
||||
/**
|
||||
* Configure the filename output when zipping files.
|
||||
@@ -923,9 +927,9 @@ export interface ConfigEnv {
|
||||
export type WxtCommand = 'build' | 'serve';
|
||||
|
||||
/**
|
||||
* Configure how the browser starts up.
|
||||
* Options for how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser.
|
||||
*/
|
||||
export interface ExtensionRunnerConfig {
|
||||
export interface WebExtConfig {
|
||||
/**
|
||||
* Whether or not to open the browser with the extension installed in dev mode.
|
||||
*
|
||||
@@ -1316,7 +1320,7 @@ export interface ResolvedConfig {
|
||||
imports: false | WxtResolvedUnimportOptions;
|
||||
manifest: UserManifest;
|
||||
fsCache: FsCache;
|
||||
runnerConfig: C12ResolvedConfig<ExtensionRunnerConfig>;
|
||||
runnerConfig: C12ResolvedConfig<WebExtConfig>;
|
||||
zip: {
|
||||
name?: string;
|
||||
artifactTemplate: string;
|
||||
|
||||
Reference in New Issue
Block a user