perf(size)!: Switch from tsup to unbuild for building WXT (#848)

This commit is contained in:
Aaron
2024-07-24 08:48:48 -05:00
committed by GitHub
parent 886b2081c2
commit 5eb5be7123
110 changed files with 477 additions and 990 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ There are other options for unit tests however, like [Jest](https://jestjs.io/),
If you want to try to use a different framework for unit tests, you will need to configure the environment manually:
- **Auto-imports**: Add `unimport` to your test environment or disable them by setting `imports: false` in your `wxt.config.ts` file
- **`browser` mock**: Mock the `webextension-polyfill` module globally with `wxt/dist/virtual/mock-browser.js`
- **`browser` mock**: Mock the `webextension-polyfill` module globally with `wxt/dist/virtual/mock-browser.mjs`
- **[Remote Code Bundling](/guide/go-further/remote-code)**: If you use it, configure your environment to handle the `url:` module prefix
- **Global Variables**: If you consume them, manually define globals provided by WXT (like `import.meta.env.BROWSER`) by adding them to the global scope before accessing them (`import.meta.env.BROWSER = "chrome"`)
- **Import paths**: If you use the `@/` or `~/` path aliases, add them to your test environment
+1 -1
View File
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "buildc --deps-only -- wxt",
"build": "buildc -- wxt build",
"build": "buildc --deps-only -- wxt build",
"build:all": "buildc --deps-only -- run-s -s 'build:all:*'",
"build:all:chrome-mv3": "wxt build",
"build:all:chrome-mv2": "wxt build --mv2",
+1 -1
View File
@@ -1,2 +1,2 @@
#!/usr/bin/env node
import '../dist/cli.js';
import '../dist/cli/index.mjs';
+49
View File
@@ -0,0 +1,49 @@
import { defineBuildConfig } from 'unbuild';
import { version } from './package.json';
import { readFile, writeFile } from 'fs/promises';
import {
virtualEntrypointModuleNames,
virtualModuleNames,
} from './src/core/utils/virtual-modules';
export default defineBuildConfig([
// Non-virtual modules can be transpiled with mkdist
{
entries: [
{
builder: 'mkdist',
input: 'src',
pattern: ['**/*', '!**/__tests__', '!**/*.md', '!virtual'],
declaration: true,
},
],
hooks: {
async 'build:done'() {
// Replace any template variables in output files
await replaceVars('dist/version.mjs', { version });
},
},
},
// Virtual modules must be bundled individually
...virtualModuleNames.map((moduleName) => ({
entries: [`src/virtual/${moduleName}.ts`],
externals: [
...virtualEntrypointModuleNames.map((name) => `virtual:user-${name}`),
'virtual:wxt-plugins',
'virtual:app-config',
'wxt/browser',
'wxt/sandbox',
'wxt/client',
'wxt/testing',
],
})),
]);
async function replaceVars(file: string, vars: Record<string, string>) {
let text = await readFile(file, 'utf8');
Object.entries(vars).forEach(([name, value]) => {
text = text.replaceAll(`{{${name}}}`, value);
});
await writeFile(file, text, 'utf8');
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { TestProject } from '../utils';
import { resetBundleIncrement } from '~/core/builders/vite/plugins';
import { resetBundleIncrement } from '../../src/core/builders/vite/plugins';
import open from 'open';
vi.mock('open');
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { TestProject } from '../utils';
import { WxtHooks } from '~/types';
import { WxtHooks } from '../../src/types';
const hooks: WxtHooks = {
ready: vi.fn(),
+1 -2
View File
@@ -1,9 +1,8 @@
import { describe, it, expect } from 'vitest';
import { TestProject } from '../utils';
import { TestProject, WXT_PACKAGE_DIR } from '../utils';
import { execaCommand } from 'execa';
import glob from 'fast-glob';
import { mkdir, writeJson } from 'fs-extra';
import { WXT_PACKAGE_DIR } from '../utils';
describe('Init command', () => {
it('should download and create a template', async () => {
+1 -1
View File
@@ -2,7 +2,7 @@ import { describe, it, expect, vi } from 'vitest';
import { TestProject } from '../utils';
import type { GenericEntrypoint, InlineConfig } from '../../src/types';
import { readFile } from 'fs-extra';
import { normalizePath } from '~/core/utils/paths';
import { normalizePath } from '../../src/core/utils/paths';
describe('Module Helpers', () => {
describe('options', () => {
@@ -293,13 +293,13 @@ describe('Output Directory Structure', () => {
function print(method, ...args) {
return;
}
var logger = {
const logger = {
debug: (...args) => print(console.debug, ...args),
log: (...args) => print(console.log, ...args),
warn: (...args) => print(console.warn, ...args),
error: (...args) => print(console.error, ...args)
};
var result;
let result;
try {
initPlugins();
result = definition.main();
@@ -381,13 +381,13 @@ describe('Output Directory Structure', () => {
function print(method, ...args) {
return;
}
var logger = {
const logger = {
debug: (...args) => print(console.debug, ...args),
log: (...args) => print(console.log, ...args),
warn: (...args) => print(console.warn, ...args),
error: (...args) => print(console.error, ...args)
};
var result;
let result;
try {
initPlugins();
result = definition.main();
@@ -400,8 +400,8 @@ describe('Output Directory Structure', () => {
logger.error("The background crashed on startup!");
throw err;
}
var background_entrypoint_default = result;
return background_entrypoint_default;
const result$1 = result;
return result$1;
}();
_background;
"
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { TestProject } from '../utils';
import { InlineConfig } from '~/types';
import { InlineConfig } from '../../src/types';
describe('User Config', () => {
// Root directory is tested with all tests.
+16 -41
View File
@@ -30,69 +30,44 @@
"wxt": "./bin/wxt.mjs",
"wxt-publish-extension": "./bin/wxt-publish-extension.cjs"
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"./client": {
"types": "./dist/client.d.ts",
"import": "./dist/client.js"
"types": "./dist/client/index.d.ts",
"default": "./dist/client/index.mjs"
},
"./sandbox": {
"types": "./dist/sandbox.d.ts",
"import": "./dist/sandbox.js"
"types": "./dist/sandbox/index.d.ts",
"default": "./dist/sandbox/index.mjs"
},
"./browser": {
"types": "./dist/browser.d.ts",
"import": "./dist/browser.js"
"default": "./dist/browser.mjs"
},
"./testing": {
"import": {
"types": "./dist/testing.d.ts",
"default": "./dist/testing.js"
},
"require": {
"types": "./dist/testing.d.cts",
"default": "./dist/testing.cjs"
}
"types": "./dist/testing/index.d.ts",
"default": "./dist/testing/index.mjs"
},
"./storage": {
"import": {
"types": "./dist/storage.d.ts",
"default": "./dist/storage.js"
},
"require": {
"types": "./dist/storage.d.cts",
"default": "./dist/storage.cjs"
}
"types": "./dist/storage.d.ts",
"default": "./dist/storage.mjs"
},
"./vite-builder-env": {
"types": "./dist/vite-builder-env.d.ts"
},
"./modules": {
"import": {
"types": "./dist/modules.d.ts",
"default": "./dist/modules.js"
},
"require": {
"types": "./dist/modules.d.cts",
"default": "./dist/modules.cjs"
}
"types": "./dist/modules.d.ts",
"default": "./dist/modules.mjs"
}
},
"scripts": {
"wxt": "tsx src/cli/index.ts",
"build": "buildc -- tsx scripts/build.ts",
"build": "buildc -- unbuild",
"check": "buildc --deps-only -- run-s -c check:*",
"check:default": "check",
"check:tsc-virtual": "tsc --noEmit -p src/virtual",
@@ -158,9 +133,9 @@
"lodash.merge": "^4.6.2",
"p-map": "^7.0.2",
"publint": "^0.2.9",
"tsup": "^8.2.1",
"tsx": "4.15.7",
"typescript": "^5.5.3",
"unbuild": "^2.0.0",
"vitest": "^2.0.3",
"vitest-plugin-random-seed": "^1.1.0"
}
-126
View File
@@ -1,126 +0,0 @@
import tsup from 'tsup';
import glob from 'fast-glob';
import { printFileList } from '~/core/utils/log';
import { formatDuration } from '~/core/utils/time';
import ora from 'ora';
import fs from 'fs-extra';
import { consola } from 'consola';
import pMap from 'p-map';
import os from 'node:os';
import path from 'node:path';
import {
virtualModuleNames,
virtualEntrypointModuleNames,
} from '~/core/utils/virtual-modules';
const spinnerText = 'Building WXT';
const spinner = ora(spinnerText).start();
const startTime = Date.now();
const outDir = 'dist';
await fs.rm(path.join(outDir, '*'), { recursive: true, force: true });
const preset = {
dts: true,
silent: true,
sourcemap: false,
external: [
...virtualEntrypointModuleNames.map((name) => `virtual:user-${name}`),
'virtual:wxt-plugins',
'virtual:app-config',
],
} satisfies tsup.Options;
function spinnerPMap(configs: tsup.Options[]) {
let progress = 1;
const updateSpinner = () => {
spinner.text = `${spinnerText} [${progress}/${configs.length}]`;
};
updateSpinner();
return pMap(
config,
async (config) => {
const res = await tsup.build(config);
progress++;
updateSpinner();
return res;
},
{
stopOnError: true,
concurrency: process.env.CI === 'true' ? os.cpus().length : Infinity,
},
);
}
const config: tsup.Options[] = [
// CJS/ESM
{
...preset,
entry: {
index: 'src/index.ts',
testing: 'src/testing/index.ts',
storage: 'src/storage.ts',
modules: 'src/modules.ts',
},
format: ['cjs', 'esm'],
clean: true,
},
// ESM-only
{
...preset,
entry: {
browser: 'src/browser.ts',
sandbox: 'src/sandbox/index.ts',
client: 'src/client/index.ts',
},
format: ['esm'],
},
{
...preset,
entry: virtualModuleNames.reduce<Record<string, string>>(
(acc, moduleName) => {
acc[`virtual/${moduleName}`] = `src/virtual/${moduleName}.ts`;
return acc;
},
{},
),
format: ['esm'],
splitting: false,
dts: false,
external: [...preset.external, 'wxt'],
},
// CJS-only
{
...preset,
entry: {
cli: 'src/cli/index.ts',
},
format: ['esm'],
banner: {
// Fixes dynamic require of nodejs modules. See https://github.com/wxt-dev/wxt/issues/355
// https://github.com/evanw/esbuild/issues/1921#issuecomment-1152991694
js: "import { createRequire } from 'module';const require = createRequire(import.meta.url);",
},
},
];
await spinnerPMap(config).catch((err) => {
spinner.fail();
console.error(err);
process.exit(1);
});
// Copy "public" files that need shipped inside WXT
await fs.copyFile('src/vite-builder-env.d.ts', 'dist/vite-builder-env.d.ts');
spinner.clear().stop();
const duration = Date.now() - startTime;
const outFiles = await glob(`${outDir}/**`, { absolute: true });
await printFileList(
consola.success,
`Built WXT in ${formatDuration(duration)}`,
outDir,
outFiles,
);
+1 -1
View File
@@ -1,4 +1,4 @@
import { fakeWxt } from '~/core/utils/testing/fake-objects';
import { fakeWxt } from '../core/utils/testing/fake-objects';
import { addImportPreset, addViteConfig } from '../modules';
import { describe, it, expect } from 'vitest';
import { createHooks } from 'hookable';
+2 -2
View File
@@ -1,7 +1,7 @@
import { fakeBrowser } from '@webext-core/fake-browser';
import { describe, it, expect, beforeEach, vi, expectTypeOf } from 'vitest';
import { browser } from '~/browser';
import { WxtStorageItem, storage } from '~/storage';
import { browser } from '../browser';
import { WxtStorageItem, storage } from '../storage';
/**
* This works because fakeBrowser is synchronous, and is will finish any number of chained
+1 -1
View File
@@ -1,4 +1,4 @@
import { WxtModule } from '~/types';
import { WxtModule } from '../types';
import unimport from './unimport';
export const builtinModules: WxtModule<any>[] = [unimport];
+2 -2
View File
@@ -1,10 +1,10 @@
import { addViteConfig, defineWxtModule } from '~/modules';
import { addViteConfig, defineWxtModule } from '../modules';
import type {
EslintGlobalsPropValue,
WxtDirFileEntry,
WxtModule,
WxtResolvedUnimportOptions,
} from '~/types';
} from '../types';
import { type Unimport, createUnimport } from 'unimport';
import { Plugin } from 'vite';
import { extname } from 'node:path';
+13 -13
View File
@@ -1,29 +1,29 @@
import { describe, it, vi, beforeEach, expect } from 'vitest';
import { build } from '~/core/build';
import { createServer } from '~/core/create-server';
import { zip } from '~/core/zip';
import { prepare } from '~/core/prepare';
import { clean } from '~/core/clean';
import { initialize } from '~/core/initialize';
import { build } from '../../core/build';
import { createServer } from '../../core/create-server';
import { zip } from '../../core/zip';
import { prepare } from '../../core/prepare';
import { clean } from '../../core/clean';
import { initialize } from '../../core/initialize';
import { mock } from 'vitest-mock-extended';
import consola from 'consola';
vi.mock('~/core/build');
vi.mock('../../core/build');
const buildMock = vi.mocked(build);
vi.mock('~/core/create-server');
vi.mock('../../core/create-server');
const createServerMock = vi.mocked(createServer);
vi.mock('~/core/zip');
vi.mock('../../core/zip');
const zipMock = vi.mocked(zip);
vi.mock('~/core/prepare');
vi.mock('../../core/prepare');
const prepareMock = vi.mocked(prepare);
vi.mock('~/core/clean');
vi.mock('../../core/clean');
const cleanMock = vi.mocked(clean);
vi.mock('~/core/initialize');
vi.mock('../../core/initialize');
const initializeMock = vi.mocked(initialize);
consola.wrapConsole();
@@ -35,7 +35,7 @@ function mockArgv(...args: string[]) {
}
async function importCli() {
await import('~/cli');
await import('../../cli');
}
describe('CLI', () => {
+5 -5
View File
@@ -1,10 +1,10 @@
import { CAC, Command } from 'cac';
import consola, { LogLevels } from 'consola';
import { filterTruthy, toArray } from '~/core/utils/arrays';
import { printHeader } from '~/core/utils/log';
import { formatDuration } from '~/core/utils/time';
import { ValidationError } from '~/core/utils/validation';
import { registerWxt } from '~/core/wxt';
import { filterTruthy, toArray } from '../core/utils/arrays';
import { printHeader } from '../core/utils/log';
import { formatDuration } from '../core/utils/time';
import { ValidationError } from '../core/utils/validation';
import { registerWxt } from '../core/wxt';
/**
* Wrap an action handler to add a timer, error handling, and maybe enable debug mode.
+1 -1
View File
@@ -1,5 +1,5 @@
import cac from 'cac';
import { build, clean, createServer, initialize, prepare, zip } from '~/core';
import { build, clean, createServer, initialize, prepare, zip } from '../core';
import {
createAliasedCommand,
getArrayFromFlags,
+1 -1
View File
@@ -1,5 +1,5 @@
import cli from './commands';
import { version } from '~/version';
import { version } from '../version';
import { isAliasedCommand } from './cli-utils';
// TODO: Remove. See https://github.com/wxt-dev/wxt/issues/277
+1 -1
View File
@@ -1,6 +1,6 @@
// @ts-expect-error: Untyped virtual module
import appConfig from 'virtual:app-config';
import type { WxtAppConfig } from '~/sandbox/define-app-config';
import type { WxtAppConfig } from '../sandbox/define-app-config';
export function useAppConfig(): WxtAppConfig {
return appConfig;
@@ -1,6 +1,6 @@
import { ContentScriptDefinition } from '~/types';
import { browser } from '~/browser';
import { logger } from '~/sandbox/utils/logger';
import { ContentScriptDefinition } from '../../types';
import { browser } from '../../browser';
import { logger } from '../../sandbox/utils/logger';
import { WxtLocationChangeEvent, getUniqueEventName } from './custom-events';
import { createLocationWatcher } from './location-watcher';
@@ -1,4 +1,4 @@
import { browser } from '~/browser';
import { browser } from '../../browser';
export class WxtLocationChangeEvent extends Event {
static EVENT_NAME = getUniqueEventName('wxt:locationchange');
@@ -1,4 +1,4 @@
import { browser } from '~/browser';
import { browser } from '../../../browser';
import { ContentScriptContext } from '..';
import {
ContentScriptAnchoredOptions,
@@ -10,7 +10,7 @@ import {
ShadowRootContentScriptUi,
ShadowRootContentScriptUiOptions,
} from './types';
import { logger } from '~/sandbox/utils/logger';
import { logger } from '../../../sandbox/utils/logger';
import { createIsolatedElement } from '@webext-core/isolated-element';
export * from './types';
+1 -1
View File
@@ -1,4 +1,4 @@
import { BuildOutput, InlineConfig } from '~/types';
import { BuildOutput, InlineConfig } from '../types';
import { internalBuild } from './utils/building';
import { registerWxt } from './wxt';
+6 -6
View File
@@ -7,20 +7,20 @@ import {
WxtBuilderServer,
WxtDevServer,
WxtHooks,
} from '~/types';
} from '../../../types';
import * as wxtPlugins from './plugins';
import {
getEntrypointBundlePath,
isHtmlEntrypoint,
} from '~/core/utils/entrypoints';
} from '../../utils/entrypoints';
import {
VirtualEntrypointType,
VirtualModuleId,
} from '~/core/utils/virtual-modules';
} from '../../utils/virtual-modules';
import { Hookable } from 'hookable';
import { toArray } from '~/core/utils/arrays';
import { safeVarName } from '~/core/utils/strings';
import { importEntrypointFile } from '~/core/utils/building';
import { toArray } from '../../utils/arrays';
import { safeVarName } from '../../utils/strings';
import { importEntrypointFile } from '../../utils/building';
import { ViteNodeServer } from 'vite-node/server';
import { ViteNodeRunner } from 'vite-node/client';
import { installSourcemapsSupport } from 'vite-node/source-map';
@@ -4,8 +4,8 @@ import { pointToDevServer } from '../devHtmlPrerender';
import {
fakeDevServer,
fakeResolvedConfig,
} from '~/core/utils/testing/fake-objects';
import { normalizePath } from '~/core/utils/paths';
} from '../../../../utils/testing/fake-objects';
import { normalizePath } from '../../../../utils/paths';
import { resolve } from 'node:path';
describe('Dev HTML Prerender Plugin', () => {
@@ -1,11 +1,12 @@
import type * as vite from 'vite';
import { visualizer } from '@aklinker1/rollup-plugin-visualizer';
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
import path from 'node:path';
let increment = 0;
export function bundleAnalysis(config: ResolvedConfig): vite.Plugin {
// @ts-expect-error: Vite version mismatch
return visualizer({
template: 'raw-data',
filename: path.resolve(
@@ -1,6 +1,6 @@
import type * as vite from 'vite';
import { Entrypoint, ResolvedConfig } from '~/types';
import { getEntrypointBundlePath } from '~/core/utils/entrypoints';
import { Entrypoint, ResolvedConfig } from '../../../../types';
import { getEntrypointBundlePath } from '../../../utils/entrypoints';
/**
* Rename CSS entrypoint outputs to ensure a JS file is not generated, and that the CSS file is
@@ -1,9 +1,9 @@
import type * as vite from 'vite';
import { ResolvedConfig, WxtDevServer } from '~/types';
import { getEntrypointName } from '~/core/utils/entrypoints';
import { ResolvedConfig, WxtDevServer } from '../../../../types';
import { getEntrypointName } from '../../../utils/entrypoints';
import { parseHTML } from 'linkedom';
import { dirname, relative, resolve } from 'node:path';
import { normalizePath } from '~/core/utils/paths';
import { normalizePath } from '../../../utils/paths';
import { murmurHash } from 'ohash';
// Stored outside the plugin to effect all instances of the devHtmlPrerender plugin.
@@ -19,7 +19,7 @@ export function devHtmlPrerender(
const htmlReloadId = '@wxt/reload-html';
const resolvedHtmlReloadId = resolve(
config.wxtModuleDir,
'dist/virtual/reload-html.js',
'dist/virtual/reload-html.mjs',
);
const virtualInlineScript = 'virtual:wxt-inline-script';
@@ -1,5 +1,5 @@
import { Plugin } from 'vite';
import { ResolvedConfig, WxtDevServer } from '~/types';
import { ResolvedConfig, WxtDevServer } from '../../../../types';
/**
* Defines global constants about the dev server. Helps scripts connect to the server's web socket.
@@ -1,6 +1,6 @@
import { Plugin } from 'vite';
import { ResolvedConfig } from '~/types';
import { fetchCached } from '~/core/utils/network';
import { ResolvedConfig } from '../../../../types';
import { fetchCached } from '../../../utils/network';
/**
* Downloads any URL imports, like Google Analytics, into virtual modules so they are bundled with
@@ -1,6 +1,6 @@
import type * as vite from 'vite';
import { EntrypointGroup } from '~/types';
import { getEntrypointGlobals } from '~/core/utils/globals';
import { EntrypointGroup } from '../../../../types';
import { getEntrypointGlobals } from '../../../utils/globals';
/**
* Define a set of global variables specific to an entrypoint.
@@ -1,4 +1,4 @@
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
import type * as vite from 'vite';
/**
@@ -1,6 +1,6 @@
import type * as vite from 'vite';
import { ResolvedConfig } from '~/types';
import { getGlobals } from '~/core/utils/globals';
import { ResolvedConfig } from '../../../../types';
import { getGlobals } from '../../../utils/globals';
export function globals(config: ResolvedConfig): vite.PluginOption {
return {
@@ -1,9 +1,9 @@
import type * as vite from 'vite';
import { Entrypoint, ResolvedConfig } from '~/types';
import { Entrypoint, ResolvedConfig } from '../../../../types';
import { dirname, extname, resolve, join } from 'node:path';
import { getEntrypointBundlePath } from '~/core/utils/entrypoints';
import { getEntrypointBundlePath } from '../../../utils/entrypoints';
import fs, { ensureDir } from 'fs-extra';
import { normalizePath } from '~/core/utils/paths';
import { normalizePath } from '../../../utils/paths';
/**
* Ensures the HTML files output by a multipage build are in the correct location. This does two
@@ -1,5 +1,5 @@
import { Plugin } from 'vite';
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '~/core/utils/constants';
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../../../utils/constants';
/**
* In dev mode, if there's not a background script listed, we need to add one so that the web socket
@@ -1,7 +1,7 @@
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
import * as vite from 'vite';
import { normalizePath } from '~/core/utils/paths';
import { removeMainFunctionCode } from '~/core/utils/transform';
import { normalizePath } from '../../../utils/paths';
import { removeMainFunctionCode } from '../../../utils/transform';
import { resolve } from 'node:path';
/**
@@ -1,7 +1,7 @@
import { exists } from 'fs-extra';
import { resolve } from 'node:path';
import type * as vite from 'vite';
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
/**
* When importing `virtual:app-config`, resolve it to the `app.config.ts` file in the project.
@@ -1,10 +1,10 @@
import { Plugin } from 'vite';
import { ResolvedConfig } from '~/types';
import { normalizePath } from '~/core/utils/paths';
import { ResolvedConfig } from '../../../../types';
import { normalizePath } from '../../../utils/paths';
import {
VirtualModuleId,
virtualModuleNames,
} from '~/core/utils/virtual-modules';
} from '../../../utils/virtual-modules';
import fs from 'fs-extra';
import { resolve } from 'path';
@@ -31,7 +31,7 @@ export function resolveVirtualModules(config: ResolvedConfig): Plugin[] {
const inputPath = id.replace(resolvedVirtualId, '');
const template = await fs.readFile(
resolve(config.wxtModuleDir, `dist/virtual/${name}.js`),
resolve(config.wxtModuleDir, `dist/virtual/${name}.mjs`),
'utf-8',
);
return template.replace(`virtual:user-${name}`, inputPath);
@@ -1,4 +1,4 @@
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
import type * as vite from 'vite';
export function tsconfigPaths(config: ResolvedConfig): vite.Plugin {
@@ -1,6 +1,6 @@
import path from 'node:path';
import type * as vite from 'vite';
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../../../types';
/**
* Mock `webextension-polyfill` by inlining all dependencies that import it and adding a custom
@@ -1,7 +1,7 @@
import { parseHTML } from 'linkedom';
import type * as vite from 'vite';
import { normalizePath } from '~/core/utils/paths';
import { ResolvedConfig } from '~/types';
import { normalizePath } from '../../../utils/paths';
import { ResolvedConfig } from '../../../../types';
/**
* Resolve and load plugins for each entrypoint. This handles both JS entrypoints via the `virtual:wxt-plugins` import, and HTML files by adding `virtual:wxt-html-plugins` to the document's `<head>`
+1 -1
View File
@@ -2,7 +2,7 @@ import path from 'node:path';
import glob from 'fast-glob';
import fs from 'fs-extra';
import pc from 'picocolors';
import { InlineConfig } from '~/types';
import { InlineConfig } from '../types';
import { registerWxt, wxt } from './wxt';
/**
+5 -8
View File
@@ -4,22 +4,19 @@ import {
InlineConfig,
ServerInfo,
WxtDevServer,
} from '~/types';
import {
getEntrypointBundlePath,
isHtmlEntrypoint,
} from '~/core/utils/entrypoints';
} from '../types';
import { getEntrypointBundlePath, isHtmlEntrypoint } from './utils/entrypoints';
import {
getContentScriptCssFiles,
getContentScriptsCssMap,
} from '~/core/utils/manifest';
} from './utils/manifest';
import {
internalBuild,
detectDevChanges,
rebuild,
findEntrypoints,
} from '~/core/utils/building';
import { createExtensionRunner } from '~/core/runners';
} from './utils/building';
import { createExtensionRunner } from './runners';
import { Mutex } from 'async-mutex';
import pc from 'picocolors';
import { relative } from 'node:path';
+1 -1
View File
@@ -1,4 +1,4 @@
import { UserConfig } from '~/types';
import { UserConfig } from '../types';
export function defineConfig(config: UserConfig): UserConfig {
return config;
@@ -1,4 +1,4 @@
import { ExtensionRunnerConfig } from '~/types';
import { ExtensionRunnerConfig } from '../types';
export function defineRunnerConfig(
config: ExtensionRunnerConfig,
@@ -8,7 +8,7 @@ import {
PackageManager,
PackageManagerName,
} from 'nypm';
import { WxtPackageManager } from '~/types';
import { WxtPackageManager } from '../../types';
import { bun } from './bun';
import { WxtPackageManagerImpl } from './types';
import { yarn } from './yarn';
@@ -1,4 +1,4 @@
import { Dependency } from '~/types';
import { Dependency } from '../../types';
import { WxtPackageManagerImpl } from './types';
import path from 'node:path';
import { ensureDir } from 'fs-extra';
@@ -1,4 +1,4 @@
import { WxtPackageManager } from '~/types';
import { WxtPackageManager } from '../../types';
export type WxtPackageManagerImpl = Pick<
WxtPackageManager,
@@ -1,4 +1,4 @@
import { Dependency } from '~/types';
import { Dependency } from '../../types';
import { WxtPackageManagerImpl } from './types';
import { dedupeDependencies, npm } from './npm';
+2 -2
View File
@@ -1,5 +1,5 @@
import { InlineConfig } from '~/types';
import { findEntrypoints, generateTypesDir } from '~/core/utils/building';
import { InlineConfig } from '../types';
import { findEntrypoints, generateTypesDir } from './utils/building';
import { registerWxt, wxt } from './wxt';
export async function prepare(config: InlineConfig) {
@@ -1,13 +1,13 @@
import { describe, expect, it, vi } from 'vitest';
import { createExtensionRunner } from '..';
import { setFakeWxt } from '~/core/utils/testing/fake-objects';
import { setFakeWxt } from '../../utils/testing/fake-objects';
import { mock } from 'vitest-mock-extended';
import { createSafariRunner } from '../safari';
import { createWslRunner } from '../wsl';
import { createManualRunner } from '../manual';
import { isWsl } from '../../utils/wsl';
import { createWebExtRunner } from '../web-ext';
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../../types';
vi.mock('../../utils/wsl');
const isWslMock = vi.mocked(isWsl);
+2 -2
View File
@@ -1,9 +1,9 @@
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../types';
import { createWslRunner } from './wsl';
import { createWebExtRunner } from './web-ext';
import { createSafariRunner } from './safari';
import { createManualRunner } from './manual';
import { isWsl } from '~/core/utils/wsl';
import { isWsl } from '../utils/wsl';
import { wxt } from '../wxt';
export async function createExtensionRunner(): Promise<ExtensionRunner> {
+1 -1
View File
@@ -1,4 +1,4 @@
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../types';
import { relative } from 'node:path';
import { wxt } from '../wxt';
+1 -1
View File
@@ -1,4 +1,4 @@
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../types';
import { relative } from 'node:path';
import { wxt } from '../wxt';
+1 -1
View File
@@ -1,5 +1,5 @@
import type { WebExtRunInstance } from 'web-ext-run';
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../types';
import { formatDuration } from '../utils/time';
import defu from 'defu';
import { wxt } from '../wxt';
+1 -1
View File
@@ -1,4 +1,4 @@
import { ExtensionRunner } from '~/types';
import { ExtensionRunner } from '../../types';
import { relative } from 'node:path';
import { wxt } from '../wxt';
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { every, some } from '~/core/utils/arrays';
import { every, some } from '../arrays';
describe('Array Utils', () => {
describe('every', () => {
@@ -1,6 +1,6 @@
import { describe, expect, it, beforeEach } from 'vitest';
import { hashContentScriptOptions } from '~/core/utils/content-scripts';
import { setFakeWxt } from '~/core/utils/testing/fake-objects';
import { hashContentScriptOptions } from '../content-scripts';
import { setFakeWxt } from '../testing/fake-objects';
describe('Content Script Utils', () => {
beforeEach(() => {
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { ContentSecurityPolicy } from '~/core/utils/content-security-policy';
import { ContentSecurityPolicy } from '../content-security-policy';
describe('Content Security Policy Builder', () => {
it('should add values to new directives correctly', () => {
@@ -3,8 +3,8 @@ import {
getEntrypointName,
getEntrypointOutputFile,
resolvePerBrowserOption,
} from '~/core/utils/entrypoints';
import { Entrypoint } from '~/types';
} from '../entrypoints';
import { Entrypoint } from '../../../types';
import { resolve } from 'path';
describe('Entrypoint Utils', () => {
@@ -19,7 +19,7 @@ import {
ContentScriptEntrypoint,
Entrypoint,
OutputAsset,
} from '~/types';
} from '../../../types';
import { wxt } from '../../wxt';
const outDir = '/output';
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
import { getPackageJson } from '../package';
import { setFakeWxt } from '../testing/fake-objects';
import { mock } from 'vitest-mock-extended';
import { Logger } from '~/types';
import { Logger } from '../../../types';
import { WXT_PACKAGE_DIR } from '../../../../e2e/utils';
describe('Package JSON Utils', () => {
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { DevModeChange, detectDevChanges } from '~/core/utils/building';
import { DevModeChange, detectDevChanges } from '../../../utils/building';
import {
fakeBackgroundEntrypoint,
fakeContentScriptEntrypoint,
@@ -12,8 +12,8 @@ import {
fakeOutputChunk,
fakeWxt,
setFakeWxt,
} from '~/core/utils/testing/fake-objects';
import { BuildOutput, BuildStepOutput } from '~/types';
} from '../../../utils/testing/fake-objects';
import { BuildOutput, BuildStepOutput } from '../../../../types';
import { setWxtForTesting } from '../../../wxt';
describe('Detect Dev Changes', () => {
@@ -8,7 +8,7 @@ import {
OptionsEntrypoint,
PopupEntrypoint,
SidepanelEntrypoint,
} from '~/types';
} from '../../../../types';
import { resolve } from 'path';
import { findEntrypoints } from '../find-entrypoints';
import fs from 'fs-extra';
@@ -16,9 +16,9 @@ import glob from 'fast-glob';
import {
fakeResolvedConfig,
setFakeWxt,
} from '~/core/utils/testing/fake-objects';
import { unnormalizePath } from '~/core/utils/paths';
import { wxt } from '~/core/wxt';
} from '../../../utils/testing/fake-objects';
import { unnormalizePath } from '../../../utils/paths';
import { wxt } from '../../../wxt';
vi.mock('fast-glob');
const globMock = vi.mocked(glob);
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { Entrypoint } from '~/types';
import { Entrypoint } from '../../../../types';
import { groupEntrypoints } from '../group-entrypoints';
import {
fakeBackgroundEntrypoint,
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { importEntrypointFile } from '~/core/utils/building';
import { importEntrypointFile } from '../../../utils/building';
import { resolve } from 'node:path';
import { setFakeWxt } from '~/core/utils/testing/fake-objects';
import { setFakeWxt } from '../../../utils/testing/fake-objects';
const entrypointPath = (filename: string) =>
resolve(__dirname, 'test-entrypoints', filename);
@@ -1,4 +1,4 @@
import { defineBackground } from '~/sandbox';
import { defineBackground } from '../../../../../sandbox';
export default defineBackground({
main() {},
@@ -1,4 +1,4 @@
import { defineContentScript } from '~/sandbox';
import { defineContentScript } from '../../../../../sandbox';
export default defineContentScript({
matches: ['<all_urls>'],
@@ -1,4 +1,4 @@
import { defineContentScript } from '~/sandbox';
import { defineContentScript } from '../../../../../sandbox';
import { faker } from '@faker-js/faker';
export default defineContentScript({
@@ -1,3 +1,3 @@
import { defineUnlistedScript } from '~/sandbox';
import { defineUnlistedScript } from '../../../../../sandbox';
export default defineUnlistedScript(() => {});
@@ -1,3 +1,3 @@
import { defineUnlistedScript } from '~/sandbox';
import { defineUnlistedScript } from '../../../../../sandbox';
export default defineUnlistedScript(() => {});
@@ -1,4 +1,4 @@
import { defineBackground } from '~/sandbox';
import { defineBackground } from '../../../../../sandbox';
export const a = {};
@@ -3,8 +3,8 @@ import {
BuildStepOutput,
EntrypointGroup,
ResolvedPublicFile,
} from '~/types';
import { getPublicFiles } from '~/core/utils/fs';
} from '../../../types';
import { getPublicFiles } from '../../utils/fs';
import fs from 'fs-extra';
import { dirname, resolve } from 'path';
import type { Ora } from 'ora';
@@ -3,9 +3,9 @@ import {
BuildStepOutput,
EntrypointGroup,
OutputFile,
} from '~/types';
import { every, some } from '~/core/utils/arrays';
import { normalizePath } from '~/core/utils/paths';
} from '../../../types';
import { every, some } from '../../utils/arrays';
import { normalizePath } from '../../utils/paths';
import { wxt } from '../../wxt';
/**
@@ -14,7 +14,7 @@ import {
OptionsEntrypointOptions,
SidepanelEntrypoint,
SidepanelEntrypointOptions,
} from '~/types';
} from '../../../types';
import fs from 'fs-extra';
import { minimatch } from 'minimatch';
import { parseHTML } from 'linkedom';
@@ -23,9 +23,9 @@ import glob from 'fast-glob';
import {
getEntrypointName,
resolvePerBrowserOptions,
} from '~/core/utils/entrypoints';
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '~/core/utils/constants';
import { CSS_EXTENSIONS_PATTERN } from '~/core/utils/paths';
} from '../../utils/entrypoints';
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../../utils/constants';
import { CSS_EXTENSIONS_PATTERN } from '../../utils/paths';
import pc from 'picocolors';
import { wxt } from '../../wxt';
@@ -1,15 +1,15 @@
import { Entrypoint, WxtDirEntry, WxtDirFileEntry } from '~/types';
import { Entrypoint, WxtDirEntry, WxtDirFileEntry } from '../../../types';
import fs from 'fs-extra';
import { dirname, relative, resolve } from 'node:path';
import {
getEntrypointBundlePath,
isHtmlEntrypoint,
} from '~/core/utils/entrypoints';
import { getEntrypointGlobals, getGlobals } from '~/core/utils/globals';
import { normalizePath } from '~/core/utils/paths';
} from '../../utils/entrypoints';
import { getEntrypointGlobals, getGlobals } from '../../utils/globals';
import { normalizePath } from '../../utils/paths';
import path from 'node:path';
import { Message, parseI18nMessages } from '~/core/utils/i18n';
import { writeFileIfDifferent, getPublicFiles } from '~/core/utils/fs';
import { Message, parseI18nMessages } from '../../utils/i18n';
import { writeFileIfDifferent, getPublicFiles } from '../../utils/fs';
import { wxt } from '../../wxt';
/**
@@ -1,4 +1,4 @@
import { Entrypoint, EntrypointGroup } from '~/types';
import { Entrypoint, EntrypointGroup } from '../../../types';
/**
* Entrypoints can be build in groups. HTML pages can all be built together in a single step, while
@@ -2,8 +2,8 @@ import createJITI, { TransformOptions as JitiTransformOptions } from 'jiti';
import { createUnimport } from 'unimport';
import fs from 'fs-extra';
import { relative, resolve } from 'node:path';
import { removeProjectImportStatements } from '~/core/utils/strings';
import { normalizePath } from '~/core/utils/paths';
import { removeProjectImportStatements } from '../../utils/strings';
import { normalizePath } from '../../utils/paths';
import { TransformOptions, transformSync } from 'esbuild';
import { fileURLToPath } from 'node:url';
import { wxt } from '../../wxt';
@@ -53,14 +53,14 @@ export async function importEntrypointFile<T>(path: string): Promise<T> {
alias: {
'webextension-polyfill': resolve(
wxt.config.wxtModuleDir,
'dist/virtual/mock-browser.js',
'dist/virtual/mock-browser.mjs',
),
// TODO: Resolve this virtual module to some file with
// `export default {}` instead of this hack of using another file with
// a default export.
'virtual:app-config': resolve(
wxt.config.wxtModuleDir,
'dist/virtual/mock-browser.js',
'dist/virtual/mock-browser.mjs',
),
},
// Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
@@ -1,12 +1,12 @@
import { findEntrypoints } from './find-entrypoints';
import { BuildOutput, Entrypoint } from '~/types';
import { BuildOutput, Entrypoint } from '../../../types';
import pc from 'picocolors';
import fs from 'fs-extra';
import { groupEntrypoints } from './group-entrypoints';
import { formatDuration } from '~/core/utils/time';
import { printBuildSummary } from '~/core/utils/log';
import { formatDuration } from '../../utils/time';
import { printBuildSummary } from '../../utils/log';
import glob from 'fast-glob';
import { unnormalizePath } from '~/core/utils/paths';
import { unnormalizePath } from '../../utils/paths';
import { rebuild } from './rebuild';
import { relative } from 'node:path';
import {
@@ -1,8 +1,8 @@
import type { Manifest } from '~/browser';
import { BuildOutput, Entrypoint, EntrypointGroup } from '~/types';
import type { Manifest } from '../../../browser';
import { BuildOutput, Entrypoint, EntrypointGroup } from '../../../types';
import { generateTypesDir } from './generate-wxt-dir';
import { buildEntrypoints } from './build-entrypoints';
import { generateManifest, writeManifest } from '~/core/utils/manifest';
import { generateManifest, writeManifest } from '../../utils/manifest';
import { wxt } from '../../wxt';
/**
@@ -14,16 +14,16 @@ import {
WxtModuleWithMetadata,
ResolvedEslintrc,
Eslintrc,
} from '~/types';
} from '../../../types';
import path from 'node:path';
import { createFsCache } from '~/core/utils/cache';
import { createFsCache } from '../../utils/cache';
import consola, { LogLevels } from 'consola';
import defu from 'defu';
import { NullablyRequired } from '../types';
import fs from 'fs-extra';
import { normalizePath } from '../paths';
import glob from 'fast-glob';
import { builtinModules } from '~/builtin-modules';
import { builtinModules } from '../../../builtin-modules';
import { getEslintVersion } from '../eslint';
/**
@@ -317,7 +317,13 @@ async function getUnimportOptions(
{ name: 'fakeBrowser', from: 'wxt/testing' },
],
presets: [
{ package: 'wxt/client' },
{
package: 'wxt/client',
// There seems to be a bug in unimport that thinks "options" is an
// export from wxt/client, but it doesn't actually exist... so it's
// ignored.
ignore: ['options'],
},
{ package: 'wxt/browser' },
{ package: 'wxt/sandbox' },
{ package: 'wxt/storage' },
@@ -374,11 +380,19 @@ async function getUnimportEslintOptions(
* Returns the path to `node_modules/wxt`.
*/
async function resolveWxtModuleDir() {
// TODO: Use this once we're fully running in ESM, see https://github.com/wxt-dev/wxt/issues/277
// const url = import.meta.resolve('wxt', import.meta.url);
// resolve() returns the "wxt/dist/index.mjs" file, not the package's root
// directory, which we want to return from this function.
// return path.resolve(fileURLToPath(url), '../..');
const requireResolve =
require?.resolve ??
globalThis.require?.resolve ??
(await import('node:module')).default.createRequire(import.meta.url)
.resolve;
// require.resolve returns the wxt/dist/index file, not the package's root directory, which we want to return
// resolve() returns the "wxt/dist/index.mjs" file, not the package's root
// directory, which we want to return from this function.
return path.resolve(requireResolve('wxt'), '../..');
}
+1 -1
View File
@@ -1,5 +1,5 @@
import fs, { ensureDir } from 'fs-extra';
import { FsCache } from '~/types';
import { FsCache } from '../../types';
import { dirname, resolve } from 'path';
import { writeFileIfDifferent } from './fs';
@@ -1,5 +1,5 @@
import type { Manifest, Scripting } from '~/browser';
import { ContentScriptEntrypoint, ResolvedConfig } from '~/types';
import type { Manifest, Scripting } from '../../browser';
import { ContentScriptEntrypoint, ResolvedConfig } from '../../types';
import { getEntrypointBundlePath } from './entrypoints';
/**
+1 -1
View File
@@ -3,7 +3,7 @@ import {
PerBrowserOption,
ResolvedPerBrowserOptions,
TargetBrowser,
} from '~/types';
} from '../../types';
import path, { relative, resolve } from 'node:path';
import { normalizePath } from './paths';
+1 -1
View File
@@ -1,4 +1,4 @@
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../types';
export function getGlobals(
config: ResolvedConfig,
@@ -1,5 +1,5 @@
import { resolve } from 'path';
import { BuildOutput } from '~/types';
import { BuildOutput } from '../../../types';
import { printFileList } from './printFileList';
import { wxt } from '../../wxt';
@@ -1,5 +1,5 @@
import pc from 'picocolors';
import { version } from '~/version';
import { version } from '../../../version';
import { consola } from 'consola';
export function printHeader() {
+2 -2
View File
@@ -1,4 +1,4 @@
import type { Manifest } from '~/browser';
import type { Manifest } from '../../browser';
import {
Entrypoint,
BackgroundEntrypoint,
@@ -7,7 +7,7 @@ import {
OptionsEntrypoint,
PopupEntrypoint,
SidepanelEntrypoint,
} from '~/types';
} from '../../types';
import fs from 'fs-extra';
import { resolve } from 'path';
import { getEntrypointBundlePath } from './entrypoints';
+1 -1
View File
@@ -1,5 +1,5 @@
import dns from 'node:dns';
import { ResolvedConfig } from '~/types';
import { ResolvedConfig } from '../../types';
import { withTimeout } from './time';
function isOffline(): Promise<boolean> {
@@ -4,7 +4,7 @@
import { resolve } from 'path';
import { faker } from '@faker-js/faker';
import merge from 'lodash.merge';
import { Commands, type Manifest } from '~/browser';
import { Commands, type Manifest } from '../../../browser';
import {
FsCache,
ResolvedConfig,
@@ -22,10 +22,10 @@ import {
UserManifest,
Wxt,
SidepanelEntrypoint,
} from '~/types';
} from '../../../types';
import { mock } from 'vitest-mock-extended';
import { vi } from 'vitest';
import { setWxtForTesting } from '~/core/wxt';
import { setWxtForTesting } from '../../../core/wxt';
faker.seed(import.meta.test.SEED);
+1 -1
View File
@@ -1,4 +1,4 @@
import { ContentScriptEntrypoint, Entrypoint } from '~/types';
import { ContentScriptEntrypoint, Entrypoint } from '../../types';
export function validateEntrypoints(
entrypoints: Entrypoint[],
+2 -2
View File
@@ -6,12 +6,12 @@ import {
WxtDevServer,
WxtHooks,
WxtModule,
} from '~/types';
} from '../types';
import { resolveConfig } from './utils/building';
import { createHooks } from 'hookable';
import { createWxtPackageManager } from './package-managers';
import { createViteBuilder } from './builders/vite';
import { builtinModules } from '~/builtin-modules';
import { builtinModules } from '../builtin-modules';
/**
* Global variable set once `createWxt` is called once. Since this variable is used everywhere, this
+6 -6
View File
@@ -1,12 +1,12 @@
import { InlineConfig } from '~/types';
import { InlineConfig } from '../types';
import path from 'node:path';
import fs from 'fs-extra';
import { kebabCaseAlphanumeric } from '~/core/utils/strings';
import { getPackageJson } from '~/core/utils/package';
import { kebabCaseAlphanumeric } from './utils/strings';
import { getPackageJson } from './utils/package';
import { minimatch } from 'minimatch';
import { formatDuration } from '~/core/utils/time';
import { printFileList } from '~/core/utils/log/printFileList';
import { internalBuild } from '~/core/utils/building';
import { formatDuration } from './utils/time';
import { printFileList } from './utils/log/printFileList';
import { internalBuild } from './utils/building';
import { registerWxt, wxt } from './wxt';
import JSZip from 'jszip';
import glob from 'fast-glob';
+3 -3
View File
@@ -1,6 +1,6 @@
/**
* @module wxt
*/
export * from '~/core';
export * from '~/types';
export * from '~/version';
export * from './core';
export * from './types';
export * from './version';
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest';
import { defineBackground } from '~/sandbox/define-background';
import { BackgroundDefinition } from '~/types';
import { defineBackground } from '../define-background';
import { BackgroundDefinition } from '../../types';
describe('defineBackground', () => {
it('should return the object definition when given an object', () => {
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest';
import { defineContentScript } from '~/sandbox/define-content-script';
import { ContentScriptDefinition } from '~/types';
import { defineContentScript } from '../define-content-script';
import { ContentScriptDefinition } from '../../types';
describe('defineContentScript', () => {
it('should return the object passed in', () => {
@@ -1,4 +1,4 @@
import type { BackgroundDefinition } from '~/types';
import type { BackgroundDefinition } from '../types';
export function defineBackground(main: () => void): BackgroundDefinition;
export function defineBackground(
@@ -1,4 +1,4 @@
import type { ContentScriptDefinition } from '~/types';
import type { ContentScriptDefinition } from '../types';
export function defineContentScript(
definition: ContentScriptDefinition,

Some files were not shown because too many files have changed in this diff Show More