mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
Bundles can be sync or async based on top level await (#4124)
Previously, bundles always utilised top level await, even if the bundled modules didn't require top level await. Now, analysis of the bundle is done and if none of the bundled modules are asynchronously executed, then the bundle as a whole will be synchronously executed. Fixes #4055 Fixes #4123
This commit is contained in:
parent
942e67c00b
commit
671f0b83be
4 changed files with 58 additions and 36 deletions
|
@ -94,14 +94,14 @@ test(async function bundleApiSources() {
|
|||
"/bar.ts": `export const bar = "bar";\n`
|
||||
});
|
||||
assert(diagnostics == null);
|
||||
assert(actual.includes(`__inst("foo")`));
|
||||
assert(actual.includes(`__inst_s("foo")`));
|
||||
assert(actual.includes(`__exp["bar"]`));
|
||||
});
|
||||
|
||||
test(async function bundleApiNoSources() {
|
||||
const [diagnostics, actual] = await bundle("./cli/tests/subdir/mod1.ts");
|
||||
assert(diagnostics == null);
|
||||
assert(actual.includes(`__inst("mod1")`));
|
||||
assert(actual.includes(`__inst_s("mod1")`));
|
||||
assert(actual.includes(`__exp["printHello3"]`));
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue