fix!: Remove transformManfiest option (#1181)

This commit is contained in:
Aaron
2024-11-16 15:44:42 -06:00
parent d153c54534
commit c2f77b1036
5 changed files with 0 additions and 60 deletions
-8
View File
@@ -202,7 +202,6 @@ export async function resolveConfig(
typesDir,
wxtDir,
zip: resolveZipConfig(root, browser, outBaseDir, mergedConfig),
transformManifest: mergedConfig.transformManifest,
analysis: resolveAnalysisConfig(root, mergedConfig),
userConfigMetadata: userConfigMetadata ?? {},
alias,
@@ -251,12 +250,6 @@ async function mergeInlineConfig(
return defu(inline, user);
};
// Merge transformManifest option
const transformManifest: InlineConfig['transformManifest'] = (manifest) => {
userConfig.transformManifest?.(manifest);
inlineConfig.transformManifest?.(manifest);
};
const merged = defu(inlineConfig, userConfig);
// Builders
@@ -269,7 +262,6 @@ async function mergeInlineConfig(
return {
...merged,
// Custom merge values
transformManifest,
imports,
manifest,
...builderConfig,
@@ -1091,31 +1091,6 @@ describe('Manifest Utils', () => {
});
});
describe('transformManifest option', () => {
it("should call the transformManifest option after the manifest is generated, but before it's returned", async () => {
const entrypoints: Entrypoint[] = [];
const buildOutput = fakeBuildOutput();
const newAuthor = 'Custom Author';
setFakeWxt({
config: {
transformManifest(manifest: any) {
manifest.author = newAuthor;
},
},
});
const expected = {
author: newAuthor,
};
const { manifest: actual } = await generateManifest(
entrypoints,
buildOutput,
);
expect(actual).toMatchObject(expected);
});
});
describe('version', () => {
it.each(['chrome', 'safari', 'edge'] as const)(
'should include version and version_name as is on %s',
-2
View File
@@ -123,8 +123,6 @@ export async function generateManifest(
if (wxt.config.command === 'serve') addDevModeCsp(manifest);
if (wxt.config.command === 'serve') addDevModePermissions(manifest);
// TODO: Remove in v1
wxt.config.transformManifest?.(manifest);
await wxt.hooks.callHook('build:manifestGenerated', wxt, manifest);
if (wxt.config.manifestVersion === 2) {
@@ -294,7 +294,6 @@ export const fakeResolvedConfig = fakeObjectCreator<ResolvedConfig>(() => {
compressionLevel: 9,
zipSources: false,
},
transformManifest: () => {},
userConfigMetadata: {},
alias: {},
experimental: {},
-24
View File
@@ -253,26 +253,6 @@ export interface InlineConfig {
*/
compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
};
/**
* @deprecated Use `hooks.build.manifestGenerated` to modify your manifest instead. This option
* will be removed in v1.0
*
* Transform the final manifest before it's written to the file system. Edit the `manifest`
* parameter directly, do not return a new object. Return values are ignored.
*
* @example
* defineConfig({
* // Add a CSS-only content script.
* transformManifest(manifest) {
* manifest.content_scripts.push({
* matches: ["*://google.com/*"],
* css: ["content-scripts/some-example.css"],
* });
* }
* })
*/
transformManifest?: (manifest: Browser.runtime.Manifest) => void;
analysis?: {
/**
* Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
@@ -1337,10 +1317,6 @@ export interface ResolvedConfig {
*/
zipSources: boolean;
};
/**
* @deprecated Use `build:manifestGenerated` hook instead.
*/
transformManifest?: (manifest: Browser.runtime.Manifest) => void;
analysis: {
enabled: boolean;
open: boolean;