Skip to content

Commit 9af78ce

Browse files
committed
fixup
1 parent ec3453f commit 9af78ce

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/bundle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ export const TransactionCacheEntry = globalThis.TransactionCacheEntry;
115115
},
116116
};
117117

118-
export async function bundle(input, enableExperimentalTopLevelAwait = false) {
118+
export async function bundle(input, moduleMode = false) {
119119
return await build({
120120
conditions: ['fastly'],
121121
entryPoints: [input],
122122
bundle: true,
123123
write: false,
124-
format: enableExperimentalTopLevelAwait ? 'esm' : 'iife',
124+
format: moduleMode ? 'esm' : 'iife',
125125
tsconfig: undefined,
126126
plugins: [fastlyPlugin],
127127
});

src/compileApplicationToWasm.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export async function compileApplicationToWasm(
124124
} else {
125125
let contents;
126126
try {
127-
contents = await bundle(input, enableExperimentalTopLevelAwait);
127+
contents = await bundle(input, moduleMode);
128128
} catch (error) {
129129
console.error(`Error:`, error.message);
130130
process.exit(1);
@@ -133,7 +133,7 @@ export async function compileApplicationToWasm(
133133
let wizerInput = precompile(
134134
contents.outputFiles[0].text,
135135
undefined,
136-
enableExperimentalTopLevelAwait,
136+
moduleMode,
137137
);
138138

139139
// for StarlingMonkey, we need to write to a tmpdir pending streaming source hooks or similar

src/precompile.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ const POSTAMBLE = '}';
1212
/// will intern regular expressions, duplicating them at the top level and testing them with both
1313
/// an ascii and utf8 string should ensure that they won't be re-compiled when run in the fetch
1414
/// handler.
15-
export function precompile(
16-
source,
17-
filename = '<input>',
18-
enableExperimentalTopLevelAwait = false,
19-
) {
15+
export function precompile(source, filename = '<input>', moduleMode = false) {
2016
const magicString = new MagicString(source, {
2117
filename,
2218
});
2319

2420
const ast = parse(source, {
2521
ecmaVersion: 'latest',
26-
sourceType: enableExperimentalTopLevelAwait ? 'module' : 'script',
22+
sourceType: moduleMode ? 'module' : 'script',
2723
});
2824

2925
const precompileCalls = [];

0 commit comments

Comments
 (0)