Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adf9d39d69 | |||
| b1699592e4 | |||
| 8675abfced | |||
| a1fc19e47c | |||
| 8235de04d2 | |||
| 46a324adc2 | |||
| c0af62316d | |||
| 2fd3503694 | |||
| e6529e6e41 | |||
| 72673ca366 | |||
| cbda49ba7b | |||
| 0ab32e5afa | |||
| 36cfcd0acb | |||
| f746d46247 | |||
| a2de6cbe44 | |||
| e632a2964a |
@@ -21,3 +21,4 @@ docs/api/reference
|
||||
stats.html
|
||||
.tool-versions
|
||||
.cache
|
||||
*-stats.txt
|
||||
|
||||
@@ -57,6 +57,21 @@ pnpm test
|
||||
pnpm docs:dev
|
||||
```
|
||||
|
||||
## Profiling
|
||||
|
||||
```sh
|
||||
# Build the latest version
|
||||
pnpm --filter wxt build
|
||||
|
||||
# CD to the demo directory
|
||||
cd packages/wxt-demo
|
||||
|
||||
# 1. Generate a flamechart with 0x
|
||||
pnpm dlx 0x node_modules/wxt/bin/wxt.mjs build
|
||||
# 2. Inspect the process with chrome @ chrome://inspect
|
||||
pnpm node --inspect node_modules/wxt/bin/wxt.mjs build
|
||||
```
|
||||
|
||||
## Updating Docs
|
||||
|
||||
Documentation is written with VitePress, and is located in the `docs/` directory.
|
||||
|
||||
@@ -35,4 +35,6 @@ Only MV3 support ESM background scripts/service workers. When targeting MV2, the
|
||||
|
||||
## Content Scripts
|
||||
|
||||
Coming soon. Follow [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for updates.
|
||||
WXT does not include built-in support for ESM content scripts. There are several technical issues that make implementing a generic solution impossible. See [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for details.
|
||||
|
||||
Instead, depending on your requirements, you can implement ESM support manually. See the [ESM Content Script UI](https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui) example to get started.
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.0...module-react-v1.1.1)
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Bump all non-major dependencies ([#834](https://github.com/wxt-dev/wxt/pull/834))
|
||||
- **deps:** Upgrade all dependencies ([#869](https://github.com/wxt-dev/wxt/pull/869))
|
||||
- Add more metadata for npm ([#885](https://github.com/wxt-dev/wxt/pull/885))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
|
||||
|
||||
## v1.1.0
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.0.0...module-react-v1.1.0)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"email": "aaronklinker1+wxt@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.1...module-solid-v1.1.2)
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Bump all non-major dependencies ([#834](https://github.com/wxt-dev/wxt/pull/834))
|
||||
- **deps:** Upgrade all dependencies ([#869](https://github.com/wxt-dev/wxt/pull/869))
|
||||
- Add more metadata for npm ([#885](https://github.com/wxt-dev/wxt/pull/885))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
|
||||
|
||||
## v1.1.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.0...module-solid-v1.1.1)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"email": "aaronklinker1+wxt@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# Changelog
|
||||
|
||||
## v1.0.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v1.0.0...module-svelte-v1.0.1)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Upgrade wxt peer to >= 0.18.6 ([7edf1c8](https://github.com/wxt-dev/wxt/commit/7edf1c8))
|
||||
|
||||
### 📖 Documentation
|
||||
|
||||
- Fix link to unimport ([#826](https://github.com/wxt-dev/wxt/pull/826))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Add changelog ([21e8ca0](https://github.com/wxt-dev/wxt/commit/21e8ca0))
|
||||
- Extract build cache script to NPM package ([#737](https://github.com/wxt-dev/wxt/pull/737))
|
||||
- **deps:** Upgrade non-major deps ([#778](https://github.com/wxt-dev/wxt/pull/778))
|
||||
- **deps:** Bump all non-major dependencies ([#834](https://github.com/wxt-dev/wxt/pull/834))
|
||||
- **deps:** Upgrade all dependencies ([#869](https://github.com/wxt-dev/wxt/pull/869))
|
||||
- Add more metadata for npm ([#885](https://github.com/wxt-dev/wxt/pull/885))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
|
||||
- Eetann ([@eetann](http://github.com/eetann))
|
||||
|
||||
## v1.0.0
|
||||
|
||||
Initial release 🎉
|
||||
Initial release 🎉
|
||||
@@ -17,7 +17,7 @@
|
||||
"email": "aaronklinker1+wxt@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# Changelog
|
||||
|
||||
## v1.0.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-vue-v1.0.0...module-vue-v1.0.1)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Upgrade wxt peer to >= 0.18.6 ([7edf1c8](https://github.com/wxt-dev/wxt/commit/7edf1c8))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Add changelog ([21e8ca0](https://github.com/wxt-dev/wxt/commit/21e8ca0))
|
||||
- Extract build cache script to NPM package ([#737](https://github.com/wxt-dev/wxt/pull/737))
|
||||
- **deps:** Upgrade non-major deps ([#778](https://github.com/wxt-dev/wxt/pull/778))
|
||||
- **deps:** Bump all non-major dependencies ([#834](https://github.com/wxt-dev/wxt/pull/834))
|
||||
- **deps:** Upgrade all dependencies ([#869](https://github.com/wxt-dev/wxt/pull/869))
|
||||
- Add more metadata for npm ([#885](https://github.com/wxt-dev/wxt/pull/885))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
|
||||
|
||||
## v1.0.0
|
||||
|
||||
Initial release 🎉
|
||||
Initial release 🎉
|
||||
@@ -17,7 +17,7 @@
|
||||
"email": "aaronklinker1+wxt@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
# Changelog
|
||||
|
||||
## v0.19.6
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.5...wxt-v0.19.6)
|
||||
|
||||
### 🔥 Performance
|
||||
|
||||
- Ignore non-source code from the file watcher ([#919](https://github.com/wxt-dev/wxt/pull/919))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Typo in sidepanel options (`browse_style` → `browser_style`) ([#914](https://github.com/wxt-dev/wxt/pull/914))
|
||||
- **types:** Don't report type errors when using string templates with `browser.i18n.getMessage` ([#916](https://github.com/wxt-dev/wxt/pull/916))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- 1natsu
|
||||
|
||||
## v0.19.5
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.4...wxt-v0.19.5)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Allow zipping hidden files by listing them explicitly in `includeSources` ([#902](https://github.com/wxt-dev/wxt/pull/902))
|
||||
- Allow excluding files when zipping ([#906](https://github.com/wxt-dev/wxt/pull/906))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- #907 move wxt devDeps execa to dependencies ([#908](https://github.com/wxt-dev/wxt/pull/908), [#907](https://github.com/wxt-dev/wxt/issues/907))
|
||||
- Update chromium setting for enabling content script sourcemaps ([e6529e6](https://github.com/wxt-dev/wxt/commit/e6529e6))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- 1natsu
|
||||
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
|
||||
- Hikiko4ern ([@hikiko4ern](http://github.com/hikiko4ern))
|
||||
|
||||
## v0.19.4
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.3...wxt-v0.19.4)
|
||||
@@ -2353,4 +2390,4 @@ Initial release of WXT. Full support for production builds and initial toolkit f
|
||||
### 🤖 CI
|
||||
|
||||
- Create validation workflow ([#12](https://github.com/wxt-dev/wxt/pull/12))
|
||||
- Create release workflow ([#13](https://github.com/wxt-dev/wxt/pull/13))
|
||||
- Create release workflow ([#13](https://github.com/wxt-dev/wxt/pull/13))
|
||||
@@ -126,7 +126,7 @@ describe('TypeScript Project', () => {
|
||||
export interface WxtI18n extends I18n.Static {
|
||||
/**
|
||||
* The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.
|
||||
Note: You can't use this message in a manifest file.
|
||||
* Note: You can't use this message in a manifest file.
|
||||
*
|
||||
* "<browser.runtime.id>"
|
||||
*/
|
||||
@@ -136,8 +136,6 @@ describe('TypeScript Project', () => {
|
||||
options?: GetMessageOptions,
|
||||
): string;
|
||||
/**
|
||||
* No message description.
|
||||
*
|
||||
* "<browser.i18n.getUiLocale()>"
|
||||
*/
|
||||
getMessage(
|
||||
@@ -215,6 +213,11 @@ describe('TypeScript Project', () => {
|
||||
substitutions?: string | string[],
|
||||
options?: GetMessageOptions,
|
||||
): string;
|
||||
getMessage(
|
||||
messageName: "@@extension_id" | "@@ui_locale" | "@@bidi_dir" | "@@bidi_reversed_dir" | "@@bidi_start_edge" | "@@bidi_end_edge" | "prompt_for_name" | "hello" | "bye",
|
||||
substitutions?: string | string[],
|
||||
options?: GetMessageOptions,
|
||||
): string;
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
@@ -97,8 +97,7 @@ describe('Zipping', () => {
|
||||
expect(await project.fileExists(sourcesZip)).toBe(true);
|
||||
});
|
||||
|
||||
// TODO: Fix #738 and re-enable
|
||||
it.skip('should not zip hidden files into sources by default', async () => {
|
||||
it('should not zip hidden files into sources by default', async () => {
|
||||
const project = new TestProject({
|
||||
name: 'test',
|
||||
version: '1.0.0',
|
||||
@@ -108,6 +107,7 @@ describe('Zipping', () => {
|
||||
'export default defineBackground(() => {});',
|
||||
);
|
||||
project.addFile('.env');
|
||||
project.addFile('.hidden-dir/file');
|
||||
const unzipDir = project.resolvePath('.output/test-1.0.0-sources');
|
||||
const sourcesZip = project.resolvePath('.output/test-1.0.0-sources.zip');
|
||||
|
||||
@@ -116,10 +116,37 @@ describe('Zipping', () => {
|
||||
});
|
||||
await extract(sourcesZip, { dir: unzipDir });
|
||||
expect(await project.fileExists(unzipDir, '.env')).toBe(false);
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/file')).toBe(false);
|
||||
});
|
||||
|
||||
// TODO: Fix #738 and re-enable
|
||||
it.skip('should allow zipping hidden files into sources when explicitly listed', async () => {
|
||||
it('should not zip files inside hidden directories if only the directory is specified', async () => {
|
||||
const project = new TestProject({
|
||||
name: 'test',
|
||||
version: '1.0.0',
|
||||
});
|
||||
project.addFile(
|
||||
'entrypoints/background.ts',
|
||||
'export default defineBackground(() => {});',
|
||||
);
|
||||
project.addFile('.hidden-dir/file');
|
||||
project.addFile('.hidden-dir/nested/file');
|
||||
const unzipDir = project.resolvePath('.output/test-1.0.0-sources');
|
||||
const sourcesZip = project.resolvePath('.output/test-1.0.0-sources.zip');
|
||||
|
||||
await project.zip({
|
||||
browser: 'firefox',
|
||||
zip: {
|
||||
includeSources: ['.hidden-dir'],
|
||||
},
|
||||
});
|
||||
await extract(sourcesZip, { dir: unzipDir });
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/file')).toBe(false);
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/nested/file')).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it('should allow zipping hidden files into sources when explicitly listed', async () => {
|
||||
const project = new TestProject({
|
||||
name: 'test',
|
||||
version: '1.0.0',
|
||||
@@ -129,16 +156,26 @@ describe('Zipping', () => {
|
||||
'export default defineBackground(() => {});',
|
||||
);
|
||||
project.addFile('.env');
|
||||
project.addFile('.hidden-dir/file');
|
||||
project.addFile('.hidden-dir/nested/file1');
|
||||
project.addFile('.hidden-dir/nested/file2');
|
||||
const unzipDir = project.resolvePath('.output/test-1.0.0-sources');
|
||||
const sourcesZip = project.resolvePath('.output/test-1.0.0-sources.zip');
|
||||
|
||||
await project.zip({
|
||||
browser: 'firefox',
|
||||
zip: {
|
||||
includeSources: ['.env'],
|
||||
includeSources: ['.env', '.hidden-dir/file', '.hidden-dir/nested/**'],
|
||||
},
|
||||
});
|
||||
await extract(sourcesZip, { dir: unzipDir });
|
||||
expect(await project.fileExists(unzipDir, '.env')).toBe(true);
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/file')).toBe(true);
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/nested/file1')).toBe(
|
||||
true,
|
||||
);
|
||||
expect(await project.fileExists(unzipDir, '.hidden-dir/nested/file2')).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wxt",
|
||||
"type": "module",
|
||||
"version": "0.19.4",
|
||||
"version": "0.19.6",
|
||||
"description": "Next gen framework for developing web extensions",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -95,6 +95,7 @@
|
||||
"defu": "^6.1.4",
|
||||
"dequal": "^2.0.3",
|
||||
"esbuild": "^0.23.0",
|
||||
"execa": "^9.3.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"filesize": "^10.1.4",
|
||||
"fs-extra": "^11.2.0",
|
||||
@@ -133,7 +134,6 @@
|
||||
"@types/node": "^20.14.12",
|
||||
"@types/normalize-path": "^3.0.2",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"execa": "^9.3.0",
|
||||
"extract-zip": "^2.0.1",
|
||||
"happy-dom": "^14.12.3",
|
||||
"lodash.merge": "^4.6.2",
|
||||
|
||||
@@ -287,6 +287,9 @@ export async function createViteBuilder(
|
||||
strictPort: true,
|
||||
host: info.hostname,
|
||||
origin: info.origin,
|
||||
watch: {
|
||||
ignored: [`${wxtConfig.outBaseDir}/**`, `${wxtConfig.wxtDir}/**`],
|
||||
},
|
||||
},
|
||||
};
|
||||
const baseConfig = await getBaseConfig();
|
||||
|
||||
@@ -6,7 +6,6 @@ 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(
|
||||
|
||||
@@ -145,11 +145,6 @@ function createFileReloader(server: WxtDevServer) {
|
||||
const changeQueue: Array<[string, string]> = [];
|
||||
|
||||
return async (event: string, path: string) => {
|
||||
await wxt.reloadConfig();
|
||||
|
||||
// Here, "path" is a non-normalized path (ie: C:\\users\\... instead of C:/users/...)
|
||||
if (path.startsWith(wxt.config.outBaseDir)) return;
|
||||
if (path.startsWith(wxt.config.wxtDir)) return;
|
||||
changeQueue.push([event, path]);
|
||||
|
||||
await fileChangedMutex.runExclusive(async () => {
|
||||
@@ -160,6 +155,8 @@ function createFileReloader(server: WxtDevServer) {
|
||||
.map(([_, file]) => file);
|
||||
if (fileChanges.length === 0) return;
|
||||
|
||||
await wxt.reloadConfig();
|
||||
|
||||
const changes = detectDevChanges(fileChanges, server.currentOutput);
|
||||
if (changes.type === 'no-change') return;
|
||||
|
||||
|
||||
@@ -97,6 +97,9 @@ const DEFAULT_CHROMIUM_PREFS = {
|
||||
// and log locations show up properly, see:
|
||||
// https://github.com/wxt-dev/wxt/issues/236#issuecomment-1915364520
|
||||
skipContentScripts: false,
|
||||
// Was renamed at some point, see:
|
||||
// https://github.com/wxt-dev/wxt/issues/912#issuecomment-2284288171
|
||||
'skip-content-scripts': false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -387,7 +387,7 @@ async function getSidepanelEntrypoint(
|
||||
const options = await getHtmlEntrypointOptions<SidepanelEntrypointOptions>(
|
||||
info,
|
||||
{
|
||||
browserStyle: 'browse_style',
|
||||
browserStyle: 'browser_style',
|
||||
exclude: 'exclude',
|
||||
include: 'include',
|
||||
defaultIcon: 'default_icon',
|
||||
|
||||
@@ -150,18 +150,43 @@ declare module "wxt/browser" {
|
||||
messages = parseI18nMessages({});
|
||||
}
|
||||
|
||||
const overrides = messages.map((message) => {
|
||||
return ` /**
|
||||
* ${message.description || 'No message description.'}
|
||||
*
|
||||
* "${message.message}"
|
||||
*/
|
||||
getMessage(
|
||||
messageName: "${message.name}",
|
||||
const renderGetMessageOverload = (
|
||||
keyType: string,
|
||||
description?: string,
|
||||
translation?: string,
|
||||
) => {
|
||||
const commentLines: string[] = [];
|
||||
if (description) commentLines.push(...description.split('\n'));
|
||||
if (translation) {
|
||||
if (commentLines.length > 0) commentLines.push('');
|
||||
commentLines.push(`"${translation}"`);
|
||||
}
|
||||
const comment =
|
||||
commentLines.length > 0
|
||||
? `/**\n${commentLines.map((line) => ` * ${line}`.trimEnd()).join('\n')}\n */\n `
|
||||
: '';
|
||||
return ` ${comment}getMessage(
|
||||
messageName: ${keyType},
|
||||
substitutions?: string | string[],
|
||||
options?: GetMessageOptions,
|
||||
): string;`;
|
||||
});
|
||||
};
|
||||
|
||||
const overrides = [
|
||||
// Generate individual overloads for each message so JSDoc contains description and base translation.
|
||||
...messages.map((message) =>
|
||||
renderGetMessageOverload(
|
||||
`"${message.name}"`,
|
||||
message.description,
|
||||
message.message,
|
||||
),
|
||||
),
|
||||
// Include a final union-based override so TS accepts valid string templates or concatinations
|
||||
// ie: browser.i18n.getMessage(`some_enum_${enumValue}`)
|
||||
renderGetMessageOverload(
|
||||
messages.map((message) => `"${message.name}"`).join(' | '),
|
||||
),
|
||||
];
|
||||
|
||||
return {
|
||||
path: 'types/i18n.d.ts',
|
||||
|
||||
@@ -268,6 +268,7 @@ function resolveZipConfig(
|
||||
includeSources: [],
|
||||
compressionLevel: 9,
|
||||
...mergedConfig.zip,
|
||||
exclude: mergedConfig.zip?.exclude ?? [],
|
||||
excludeSources: [
|
||||
'**/node_modules',
|
||||
// WXT files
|
||||
|
||||
@@ -286,6 +286,7 @@ export const fakeResolvedConfig = fakeObjectCreator<ResolvedConfig>(() => {
|
||||
artifactTemplate: '{{name}}-{{version}}.zip',
|
||||
includeSources: [],
|
||||
excludeSources: [],
|
||||
exclude: [],
|
||||
sourcesRoot: fakeDir(),
|
||||
sourcesTemplate: '{{name}}-sources.zip',
|
||||
name: faker.person.firstName().toLowerCase(),
|
||||
|
||||
@@ -47,7 +47,9 @@ export async function zip(config?: InlineConfig): Promise<string[]> {
|
||||
|
||||
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
||||
const outZipPath = path.resolve(wxt.config.outBaseDir, outZipFilename);
|
||||
await zipDir(wxt.config.outDir, outZipPath);
|
||||
await zipDir(wxt.config.outDir, outZipPath, {
|
||||
exclude: wxt.config.zip.exclude,
|
||||
});
|
||||
zipFiles.push(outZipPath);
|
||||
|
||||
// ZIP sources for Firefox
|
||||
@@ -99,13 +101,11 @@ async function zipDir(
|
||||
): Promise<void> {
|
||||
const archive = new JSZip();
|
||||
const files = (
|
||||
await glob('**/*', {
|
||||
await glob(['**/*', ...(options?.include || [])], {
|
||||
cwd: directory,
|
||||
// Ignore node_modules, otherwise this glob step takes forever
|
||||
ignore: ['**/node_modules'],
|
||||
onlyFiles: true,
|
||||
// TODO: Fix #738
|
||||
// dot: true,
|
||||
})
|
||||
).filter((relativePath) => {
|
||||
return (
|
||||
|
||||
@@ -181,6 +181,16 @@ export interface InlineConfig {
|
||||
* ]
|
||||
*/
|
||||
excludeSources?: string[];
|
||||
/**
|
||||
* [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
|
||||
* zipping the extension.
|
||||
*
|
||||
* @example
|
||||
* [
|
||||
* "**\/*.map", // Exclude all sourcemaps
|
||||
* ]
|
||||
*/
|
||||
exclude?: string[];
|
||||
/**
|
||||
* The Firefox review process requires the extension be buildable from source to make reviewing
|
||||
* easier. This field allows you to use private packages without exposing your auth tokens.
|
||||
@@ -1192,6 +1202,7 @@ export interface ResolvedConfig {
|
||||
downloadedPackagesDir: string;
|
||||
downloadPackages: string[];
|
||||
compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
||||
exclude: string[];
|
||||
};
|
||||
/**
|
||||
* @deprecated Use `build:manifestGenerated` hook instead.
|
||||
|
||||
Generated
+17
-9
@@ -219,7 +219,7 @@ importers:
|
||||
dependencies:
|
||||
'@aklinker1/rollup-plugin-visualizer':
|
||||
specifier: 5.12.0
|
||||
version: 5.12.0(rollup@3.29.4)
|
||||
version: 5.12.0(rollup@4.19.0)
|
||||
'@types/webextension-polyfill':
|
||||
specifier: ^0.10.7
|
||||
version: 0.10.7
|
||||
@@ -259,6 +259,9 @@ importers:
|
||||
esbuild:
|
||||
specifier: ^0.23.0
|
||||
version: 0.23.0
|
||||
execa:
|
||||
specifier: ^9.3.0
|
||||
version: 9.3.0
|
||||
fast-glob:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
@@ -327,7 +330,7 @@ importers:
|
||||
version: 2.1.3
|
||||
unimport:
|
||||
specifier: ^3.9.1
|
||||
version: 3.9.1(rollup@3.29.4)
|
||||
version: 3.9.1(rollup@4.19.0)
|
||||
vite:
|
||||
specifier: ^5.3.5
|
||||
version: 5.3.5(@types/node@20.14.12)(sass@1.77.8)
|
||||
@@ -368,9 +371,6 @@ importers:
|
||||
'@types/prompts':
|
||||
specifier: ^2.4.9
|
||||
version: 2.4.9
|
||||
execa:
|
||||
specifier: ^9.3.0
|
||||
version: 9.3.0
|
||||
extract-zip:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
@@ -4691,14 +4691,14 @@ snapshots:
|
||||
citty: 0.1.6
|
||||
typescript: 5.5.4
|
||||
|
||||
'@aklinker1/rollup-plugin-visualizer@5.12.0(rollup@3.29.4)':
|
||||
'@aklinker1/rollup-plugin-visualizer@5.12.0(rollup@4.19.0)':
|
||||
dependencies:
|
||||
open: 8.4.2
|
||||
picomatch: 2.3.1
|
||||
source-map: 0.7.4
|
||||
yargs: 17.7.2
|
||||
optionalDependencies:
|
||||
rollup: 3.29.4
|
||||
rollup: 4.19.0
|
||||
|
||||
'@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.20.0)(algoliasearch@4.20.0)(search-insights@2.15.0)':
|
||||
dependencies:
|
||||
@@ -5417,6 +5417,14 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 3.29.4
|
||||
|
||||
'@rollup/pluginutils@5.1.0(rollup@4.19.0)':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.5
|
||||
estree-walker: 2.0.2
|
||||
picomatch: 2.3.1
|
||||
optionalDependencies:
|
||||
rollup: 4.19.0
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.19.0':
|
||||
optional: true
|
||||
|
||||
@@ -8659,9 +8667,9 @@ snapshots:
|
||||
|
||||
undici-types@5.26.5: {}
|
||||
|
||||
unimport@3.9.1(rollup@3.29.4):
|
||||
unimport@3.9.1(rollup@4.19.0):
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.0(rollup@3.29.4)
|
||||
'@rollup/pluginutils': 5.1.0(rollup@4.19.0)
|
||||
acorn: 8.12.1
|
||||
escape-string-regexp: 5.0.0
|
||||
estree-walker: 3.0.3
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/packages/wxt/src/core/runners/web-ext.ts b/packages/wxt/src/core/runners/web-ext.ts
|
||||
index 09819c3..a0f0df2 100644
|
||||
--- a/packages/wxt/src/core/runners/web-ext.ts
|
||||
+++ b/packages/wxt/src/core/runners/web-ext.ts
|
||||
@@ -3,6 +3,8 @@ import { ExtensionRunner } from '../../types';
|
||||
import { formatDuration } from '../utils/time';
|
||||
import defu from 'defu';
|
||||
import { wxt } from '../wxt';
|
||||
+import fs from 'node:fs';
|
||||
+import stream from 'node:stream/promises';
|
||||
|
||||
/**
|
||||
* Create an `ExtensionRunner` backed by `web-ext`.
|
||||
@@ -78,6 +80,12 @@ export function createWebExtRunner(): ExtensionRunner {
|
||||
|
||||
const duration = Date.now() - startTime;
|
||||
wxt.logger.success(`Opened browser in ${formatDuration(duration)}`);
|
||||
+ await runner.exit();
|
||||
+ const s = fs.createWriteStream('stats.txt', { flags: 'a' });
|
||||
+ s.write(duration + ' ');
|
||||
+ s.end();
|
||||
+ await stream.finished(s);
|
||||
+ process.exit(0);
|
||||
},
|
||||
|
||||
async closeBrowser() {
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
#
|
||||
# Benchmark how long it takes for the browser to open in dev mode.
|
||||
#
|
||||
# To run:
|
||||
# cd <root>
|
||||
# ./scripts/benchmarks/browser-startup.sh
|
||||
#
|
||||
# You can set N below to change the number of samples per git ref.
|
||||
#
|
||||
|
||||
N=20
|
||||
|
||||
function benchmark_ref() {
|
||||
# Prep
|
||||
git checkout $1
|
||||
pnpm buildc clean
|
||||
git apply scripts/benchmarks/browser-startup.patch
|
||||
pnpm i --ignore-scripts
|
||||
pnpm -r --filter wxt build
|
||||
echo -n "$1 " >> stats.txt
|
||||
|
||||
# Run benchmark
|
||||
for i in $(seq $N); do
|
||||
pnpm wxt packages/wxt-demo
|
||||
done
|
||||
git checkout HEAD -- packages/wxt/src/core/runners/web-ext.ts pnpm-lock.yaml
|
||||
echo "" >> stats.txt
|
||||
}
|
||||
|
||||
rm -f stats.txt
|
||||
|
||||
benchmark_ref "HEAD"
|
||||
|
||||
# Benchmark a commit:
|
||||
# benchmark_ref "3109bba"
|
||||
#
|
||||
# Benchmark a version:
|
||||
# benchmark_ref "v0.19.0"
|
||||
Reference in New Issue
Block a user