1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

Fix issue with detecting AMD like imports (#4009)

This commit is contained in:
Kitson Kelly 2020-02-16 21:11:44 +11:00 committed by GitHub
parent 503d8bfef2
commit 98e585a284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 1 deletions

View file

@ -100,7 +100,12 @@ export class SourceFile {
log(`Skipping imports for "${this.filename}"`);
return [];
}
const preProcessedFileInfo = ts.preProcessFile(this.sourceCode, true, true);
const preProcessedFileInfo = ts.preProcessFile(
this.sourceCode,
true,
this.mediaType === MediaType.JavaScript ||
this.mediaType === MediaType.JSX
);
this.processed = true;
const files = (this.importedFiles = [] as Array<[string, string]>);

View file

@ -588,6 +588,12 @@ itest!(_054_info_local_imports {
exit_code: 0,
});
itest!(js_import_detect {
args: "run --reload js_import_detect.ts",
output: "js_import_detect.ts.out",
exit_code: 0,
});
itest!(lock_write_fetch {
args:
"run --allow-read --allow-write --allow-env --allow-run lock_write_fetch.ts",

View file

@ -0,0 +1,3 @@
function define(_foo: string[]): void {}
define(["long"]);
console.log("ok");

View file

@ -0,0 +1 @@
ok