mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 08:39:09 -05:00
135053486c
This commit changes implementation of top-level-await in "deno_core". Previously promise returned from module evaluation was not awaited, leading to out-of-order execution of modules that have TLA. It's been fixed by changing "JsRuntime::mod_evaluate" to be an async function that resolves when the promise returned from module evaluation also resolves. When waiting for promise resolution event loop is polled repeatedly, until there are no more dynamic imports or pending ops.
18 lines
431 B
JavaScript
18 lines
431 B
JavaScript
const importsDir = Deno.readDirSync(Deno.realPathSync("./tla2"));
|
|
|
|
const resolvedPaths = [];
|
|
|
|
for (const { name } of importsDir) {
|
|
const filePath = Deno.realPathSync(`./tla2/${name}`);
|
|
resolvedPaths.push(filePath);
|
|
}
|
|
|
|
resolvedPaths.sort();
|
|
|
|
for (const filePath of resolvedPaths) {
|
|
console.log("loading", filePath);
|
|
const mod = await import(`file://${filePath}`);
|
|
console.log("loaded", mod);
|
|
}
|
|
|
|
console.log("all loaded");
|