diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-07-04 00:17:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 00:17:52 +0200 |
commit | 5addba2abc2e384e751e8884b4ac3219688c2473 (patch) | |
tree | a5249a82092909f32a852a910e5e144ddeffa497 /runtime/js/40_compiler_api.js | |
parent | ffa75be48044255ed49a822a7a61a2a130123a4a (diff) |
refactor: use primordials in runtime/, part2 (#11248)
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."), ); } |