Skip to content

Commit

Permalink
Change writeBundle signature to match generateBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jan 29, 2020
1 parent 771189e commit f4bacc3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rollup/rollup.ts
Expand Up @@ -316,7 +316,7 @@ export async function rollupInternal(
await Promise.all(
Object.keys(bundle).map(chunkId => writeOutputFile(bundle[chunkId], outputOptions))
);
await outputPluginDriver.hookParallel('writeBundle', [bundle]);
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, bundle]);
return createOutput(bundle);
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/rollup/types.d.ts
Expand Up @@ -332,7 +332,11 @@ interface OutputPluginHooks {
resolveAssetUrl: ResolveAssetUrlHook;
resolveDynamicImport: ResolveDynamicImportHook;
resolveFileUrl: ResolveFileUrlHook;
writeBundle: (this: PluginContext, bundle: OutputBundle) => void | Promise<void>;
writeBundle: (
this: PluginContext,
options: OutputOptions,
bundle: OutputBundle
) => void | Promise<void>;
}

export interface PluginHooks extends OutputPluginHooks {
Expand Down
3 changes: 2 additions & 1 deletion test/hooks/index.js
Expand Up @@ -620,7 +620,8 @@ describe('hooks', () => {
}
},
{
writeBundle(outputBundle) {
writeBundle(options, outputBundle) {
assert.deepStrictEqual(options.file, file);
assert.deepStrictEqual(outputBundle, bundle);
callCount++;
}
Expand Down

0 comments on commit f4bacc3

Please sign in to comment.