feat: @deno-types map in build options #418
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for a
deno.json
field like:All specifiers written there are resolved through provided resolver with the
deno.json
as the referrer. So an import-mapped key (or value) will just work:We can make it so that
deno add npm:@types/<package>
adds the entry to"types"
instead of"imports"
. Sodeno add npm:@types/express
will be the equivalent ofnpm i --save @types/express
.These mappings will only apply to referrers within the passed 'scope' associated with the
deno.json
. In CLI we would presumably pass the parent directory of thedeno.json
file.JSR will inline these mappings to pragmas on publish. This has parity with the above behaviour.
This is essentially
// @deno-types
pragmas in config file form. Reasons we want to do this:// @deno-types
pragmas for dependencies.compilerOptions.jsxImportSource
.@types
packages can be referenced and version-pinned in the config file next to their runtime counterparts.