Closed yacinehmito closed 1 year ago
I just realized that the proposed API in this PR is different than the ones of Deno.emit()
(see docs).
The proposed API attempts to be consistent with Deno's config, at the cost of introducing baseUrl
which is "weird". Deno.emit()
does not have this issues as it defines both importMap
and importMapPath
, which is more elegant, but inconsistent with Deno's config.
@dsherret @bartlomieju Any opinions as to which design is preferable? I don't mind changing.
@dsherret This is ready.
I performed the required API changes in this commit: https://github.com/denoland/deno_emit/pull/114/commits/97010086d2aff5c5d7284652c04a049bff779818
Then, I modified the implementation so that the import map is loaded on the Rust side instead of the JS side. This also means that we reuse the loader instead of doing an ad-hoc fetch, which matches how dnt
works.
Adds import map support to both
bundle
andtranspile
.Like with Deno config, there are two ways to define an import map. You can either:SetimportMap
to the path or URL of an import map file in JSON, orSetimports
and/orscopes
directly in the code.If the later is chosen, relative paths are resolved from the current working directory (output ofDeno.cwd()
). This can be overridden with the propertybaseUrl
. I welcome suggestions of other names for that property.To provide an import map, you can set the property ˋimportMapˋ with either:
Closes #67. Closes #56. Closes #14.