diff options
Diffstat (limited to 'runtime/js/40_compiler_api.js')
-rw-r--r-- | runtime/js/40_compiler_api.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/js/40_compiler_api.js b/runtime/js/40_compiler_api.js index 75c21b8dd..4d5cda398 100644 --- a/runtime/js/40_compiler_api.js +++ b/runtime/js/40_compiler_api.js @@ -8,6 +8,11 @@ ((window) => { const core = window.Deno.core; const util = window.__bootstrap.util; + const { + StringPrototypeMatch, + PromiseReject, + TypeError, + } = window.__bootstrap.primordials; /** * @typedef {object} ImportMap @@ -47,7 +52,10 @@ * @returns {string} */ function checkRelative(specifier) { - return specifier.match(/^([\.\/\\]|https?:\/{2}|file:\/{2})/) + return StringPrototypeMatch( + specifier, + /^([\.\/\\]|https?:\/{2}|file:\/{2})/, + ) ? specifier : `./${specifier}`; } @@ -70,7 +78,7 @@ function emit(rootSpecifier, options = {}) { util.log(`Deno.emit`, { rootSpecifier }); if (!rootSpecifier) { - return Promise.reject( + return PromiseReject( new TypeError("A root specifier must be supplied."), ); } |