Skip to content

Commit 7053c8b

Browse files
committed
fix: Update BundleOptions type enum
This was a breaking change in Deno 1.10: https://github.com/denoland/deno/releases/tag/v1.10.1 denoland/deno#10332
1 parent c4d3b08 commit 7053c8b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

bundler/mod.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ export {baseCompilerOptions, browserCompilerOptions} from './options.ts';
33

44
export type BundleOptions = {
55

6+
/** Default: `"module"` */
7+
bundleType?: Deno.EmitOptions['bundle'];
8+
69
/**
710
* TypeScript compiler options used by Deno. If not provided, a set of default
811
* options will be used, targeted for a browser and ESNext features
@@ -19,9 +22,6 @@ export type BundleOptions = {
1922
* Print any compilation diagnostic messages to the console. Default: `false`
2023
*/
2124
logDiagnostics?: boolean;
22-
23-
/** Default: `"esm"` */
24-
moduleType?: Deno.EmitOptions['bundle'];
2525
};
2626

2727
export type BundleResult = {
@@ -34,7 +34,7 @@ export async function bundleModule (
3434
options?: BundleOptions,
3535
): Promise<BundleResult> {
3636
const result = await Deno.emit(entrypointPath, {
37-
bundle: options?.moduleType ?? emitOptions.bundle,
37+
bundle: options?.bundleType ?? emitOptions.bundle,
3838
compilerOptions: options?.compilerOptions ?? emitOptions.compilerOptions,
3939
});
4040

bundler/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const browserCompilerOptions: Deno.CompilerOptions = {
2929
};
3030

3131
export const emitOptions: Deno.EmitOptions = {
32-
bundle: 'esm',
32+
bundle: 'module',
3333
compilerOptions: browserCompilerOptions,
3434
// sources: {},
3535
};

mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export async function bundleUserscript (
7777
const metablock = metablockEntries.toString();
7878

7979
const {bundle} = await bundler.bundleModule(entrypointPath, {
80+
bundleType: 'classic',
8081
header: metablock,
8182
logDiagnostics: options?.logDiagnostics ?? true,
82-
moduleType: 'iife',
8383
});
8484

8585
await requestPermission(

0 commit comments

Comments
 (0)