mirror of
https://github.com/denoland/deno.git
synced 2025-09-25 03:42:30 +00:00
Create an old program to be used in snapshot. (#3644)
This commit is contained in:
parent
8fac8ab130
commit
737ab94ea1
14 changed files with 85 additions and 60 deletions
|
@ -18,7 +18,7 @@ export interface ConfigureResponse {
|
|||
diagnostics?: ts.Diagnostic[];
|
||||
}
|
||||
|
||||
const ASSETS = "$asset$";
|
||||
export const ASSETS = "$asset$";
|
||||
|
||||
/** Options that need to be used when generating a bundle (either trusted or
|
||||
* runtime). */
|
||||
|
@ -129,11 +129,11 @@ export class Host implements ts.CompilerHost {
|
|||
private _writeFile: WriteFileCallback;
|
||||
|
||||
private _getAsset(filename: string): SourceFile {
|
||||
const sourceFile = SourceFile.get(filename);
|
||||
const url = filename.split("/").pop()!;
|
||||
const sourceFile = SourceFile.get(url);
|
||||
if (sourceFile) {
|
||||
return sourceFile;
|
||||
}
|
||||
const url = filename.split("/").pop()!;
|
||||
const name = url.includes(".") ? url : `${url}.d.ts`;
|
||||
const sourceCode = sendSync(dispatch.OP_FETCH_ASSET, { name });
|
||||
return new SourceFile({
|
||||
|
@ -238,13 +238,15 @@ export class Host implements ts.CompilerHost {
|
|||
: SourceFile.get(fileName);
|
||||
assert(sourceFile != null);
|
||||
if (!sourceFile.tsSourceFile) {
|
||||
assert(sourceFile.sourceCode != null);
|
||||
sourceFile.tsSourceFile = ts.createSourceFile(
|
||||
fileName,
|
||||
sourceFile.sourceCode,
|
||||
languageVersion
|
||||
);
|
||||
delete sourceFile.sourceCode;
|
||||
}
|
||||
return sourceFile!.tsSourceFile;
|
||||
return sourceFile.tsSourceFile;
|
||||
} catch (e) {
|
||||
if (onError) {
|
||||
onError(String(e));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue