mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat: Support named exports on bundles. (#3352)
This commit is contained in:
parent
1912ed6740
commit
8d977d0117
7 changed files with 222 additions and 72 deletions
|
@ -6,14 +6,16 @@
|
|||
// bundles when creating snapshots, but is also used when emitting bundles from
|
||||
// Deno cli.
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
/**
|
||||
* @type {(name: string, deps: ReadonlyArray<string>, factory: (...deps: any[]) => void) => void}
|
||||
* @type {(name: string, deps: ReadonlyArray<string>, factory: (...deps: any[]) => void) => void=}
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let define;
|
||||
|
||||
/**
|
||||
* @type {(mod: string | string[]) => void}
|
||||
* @type {(mod: string) => any=}
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let instantiate;
|
||||
|
@ -111,14 +113,9 @@ let instantiate;
|
|||
|
||||
instantiate = dep => {
|
||||
define = undefined;
|
||||
if (Array.isArray(dep)) {
|
||||
for (const d of dep) {
|
||||
getExports(d);
|
||||
}
|
||||
} else {
|
||||
getExports(dep);
|
||||
}
|
||||
const result = getExports(dep);
|
||||
// clean up, or otherwise these end up in the runtime environment
|
||||
instantiate = undefined;
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue