summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/type_directives.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/js/type_directives.ts b/js/type_directives.ts
index 3e903a80b..4817738c7 100644
--- a/js/type_directives.ts
+++ b/js/type_directives.ts
@@ -1,5 +1,4 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-
interface DirectiveInfo {
path: string;
start: number;
@@ -33,15 +32,16 @@ export function getMappedModuleName(
*/
const typeDirectiveRegEx = /@deno-types\s*=\s*(["'])((?:(?=(\\?))\3.)*?)\1/gi;
-/** Matches `import` or `export from` statements and parses out the value of the
+/** Matches `import`, `import from` or `export from` statements and parses out the value of the
* module specifier in the second capture group:
*
+ * import "./foo.js"
* import * as foo from "./foo.js"
* export { a, b, c } from "./bar.js"
*
- * [See Diagram](http://bit.ly/2GSkJlF)
+ * [See Diagram](https://bit.ly/2lK0izL)
*/
-const importExportRegEx = /(?:import|export)\s+[\s\S]*?from\s+(["'])((?:(?=(\\?))\3.)*?)\1/;
+const importExportRegEx = /(?:import|export)\s+(?:[\s\S]*?from\s+)?(["'])((?:(?=(\\?))\3.)*?)\1/;
/** Parses out any Deno type directives that are part of the source code, or
* returns `undefined` if there are not any.