mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
refactor(cli): migrate runtime compile/bundle to new infrastructure (#8192)
Fixes #8060
This commit is contained in:
parent
3558769d46
commit
fdcc78500c
23 changed files with 852 additions and 2770 deletions
|
@ -52,19 +52,14 @@
|
|||
sources: !!sources,
|
||||
options,
|
||||
});
|
||||
/** @type {{ emittedFiles: Record<string, string>, diagnostics: any[] }} */
|
||||
const result = await opCompile(payload);
|
||||
util.assert(result.emitMap);
|
||||
util.assert(result.emittedFiles);
|
||||
const maybeDiagnostics = result.diagnostics.length === 0
|
||||
? undefined
|
||||
: result.diagnostics;
|
||||
|
||||
const emitMap = {};
|
||||
|
||||
for (const [key, emittedSource] of Object.entries(result.emitMap)) {
|
||||
emitMap[key] = emittedSource.contents;
|
||||
}
|
||||
|
||||
return [maybeDiagnostics, emitMap];
|
||||
return [maybeDiagnostics, result.emittedFiles];
|
||||
}
|
||||
|
||||
// TODO(bartlomieju): change return type to interface?
|
||||
|
@ -84,12 +79,14 @@
|
|||
sources: !!sources,
|
||||
options,
|
||||
});
|
||||
/** @type {{ emittedFiles: Record<string, string>, diagnostics: any[] }} */
|
||||
const result = await opCompile(payload);
|
||||
util.assert(result.output);
|
||||
let output = result.emittedFiles["deno:///bundle.js"];
|
||||
util.assert(output);
|
||||
const maybeDiagnostics = result.diagnostics.length === 0
|
||||
? undefined
|
||||
: result.diagnostics;
|
||||
return [maybeDiagnostics, result.output];
|
||||
return [maybeDiagnostics, output];
|
||||
}
|
||||
|
||||
window.__bootstrap.compilerApi = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue