1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

feat(cli): support data url (#13667)

Closes #11141
This commit is contained in:
Simon Lecoq 2022-02-25 01:26:13 +01:00 committed by GitHub
parent cd04b6852f
commit c59152e400
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -45,6 +45,22 @@ Deno.test({
},
});
Deno.test({
name: "Deno.emit() - data url",
async fn() {
const data =
"data:application/javascript;base64,Y29uc29sZS5sb2coImhlbGxvIHdvcmxkIik7";
const { diagnostics, files, ignoredOptions, stats } = await Deno.emit(data);
assertEquals(diagnostics.length, 0);
assert(!ignoredOptions);
assertEquals(stats.length, 0);
const keys = Object.keys(files);
assertEquals(keys.length, 1);
assertEquals(keys[0], data);
assertStringIncludes(files[keys[0]], 'console.log("hello world");');
},
});
Deno.test({
name: "Deno.emit() - compiler options effects emit",
async fn() {

View file

@ -54,7 +54,7 @@
function checkRelative(specifier) {
return StringPrototypeMatch(
specifier,
/^([\.\/\\]|https?:\/{2}|file:\/{2})/,
/^([\.\/\\]|https?:\/{2}|file:\/{2}|data:)/,
)
? specifier
: `./${specifier}`;