Skip to content

Commit

Permalink
fix!: Remove transformManfiest option
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Nov 16, 2024
1 parent 96445c9 commit 55f19b8
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 60 deletions.
8 changes: 0 additions & 8 deletions packages/wxt/src/core/resolve-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export async function resolveConfig(
typesDir,
wxtDir,
zip: resolveZipConfig(root, browser, outBaseDir, mergedConfig),
transformManifest: mergedConfig.transformManifest,
analysis: resolveAnalysisConfig(root, mergedConfig),
userConfigMetadata: userConfigMetadata ?? {},
alias,
Expand Down Expand Up @@ -242,12 +241,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
Expand All @@ -260,7 +253,6 @@ async function mergeInlineConfig(
return {
...merged,
// Custom merge values
transformManifest,
imports,
manifest,
...builderConfig,
Expand Down
25 changes: 0 additions & 25 deletions packages/wxt/src/core/utils/__tests__/manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,31 +1107,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',
Expand Down
2 changes: 0 additions & 2 deletions packages/wxt/src/core/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,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) {
Expand Down
1 change: 0 additions & 1 deletion packages/wxt/src/core/utils/testing/fake-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ export const fakeResolvedConfig = fakeObjectCreator<ResolvedConfig>(() => {
compressionLevel: 9,
zipSources: false,
},
transformManifest: () => {},
userConfigMetadata: {},
alias: {},
experimental: {},
Expand Down
24 changes: 0 additions & 24 deletions packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,26 +252,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: chrome.runtime.Manifest) => void;
analysis?: {
/**
* Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
Expand Down Expand Up @@ -1293,10 +1273,6 @@ export interface ResolvedConfig {
*/
zipSources: boolean;
};
/**
* @deprecated Use `build:manifestGenerated` hook instead.
*/
transformManifest?: (manifest: chrome.runtime.Manifest) => void;
analysis: {
enabled: boolean;
open: boolean;
Expand Down

0 comments on commit 55f19b8

Please sign in to comment.