Compare commits

...

5 Commits

Author SHA1 Message Date
GitHub Actions 2fd3503694 chore(release): wxt v0.19.5 2024-08-12 15:36:58 +00:00
Aaron e6529e6e41 fix: Update chromium setting for enabling content script sourcemaps 2024-08-12 10:32:25 -05:00
1natsu 72673ca366 fix: #907 move wxt devDeps execa to dependencies (#908) 2024-08-10 12:01:44 -05:00
Florian Metz cbda49ba7b feat: allow excluding files when zipping (#906) 2024-08-07 20:15:33 -05:00
hikiko4ern 0ab32e5afa feat: allow zipping hidden files by listing them explicitly in includeSources (#902) 2024-08-07 20:13:33 -05:00
10 changed files with 102 additions and 22 deletions
+21 -1
View File
@@ -1,5 +1,25 @@
# Changelog
## 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 +2373,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))
+42 -5
View File
@@ -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,
);
});
});
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "wxt",
"type": "module",
"version": "0.19.4",
"version": "0.19.5",
"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",
@@ -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(
+3
View File
@@ -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,
},
},
};
@@ -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(),
+4 -4
View File
@@ -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 (
+11
View File
@@ -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.
+17 -9
View File
@@ -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