You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forgive me if I'm naieve I'm not sure what already exists, please point me in the right direction if this is a non-issue or solved problem.
Because deno import maps don't chain recursively you can't really use them in modules unless the project also implements the same imports. This can be a pain.
I'd love some third-party scripts / tooling around this, and I'm sure others will as well here are some ideas perhaps projects will surface that already exist or this will guide people to what needs to be created.
It seems that import_maps serve two purposes,
make it more convient for devs to use a remote module
be able to change the dep of a dep (something that's broken upstream)
I think most of this tooling focuses on (1), but if someone upstream fixes an issue upstream I want that to be fixed for me too see eveningkid/denodb#348 (comment).
Deno adding multiple import_maps to deno.json?
Some of these tools become irrelevant if Deno just handles this out of the box. As of right now you can only have one import_map but we could make it an array? An array that supports urls? 👀
Potential Commands
Merge import_maps
Abiding by the one import_map standard then I think the right way to do this is to have a import_maps directory and save a snapshot of the current custom imports. Then new import files are downloaded and put into this directory. The tool then merges all the import maps and spits out a new single ./import_map.json. Errors occur if there's conflicts. This will allow you to "undo" a merge because all the files are separate, all you have to do is remove the file.
import_maps merge
Download single import_map
Check a url for ./import_map.json and pull into your project. The name of the source can be included via metadata file or in the json, and this allows the ability to revert / remove imports. The api could look like this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Forgive me if I'm naieve I'm not sure what already exists, please point me in the right direction if this is a non-issue or solved problem.
Because deno import maps don't chain recursively you can't really use them in modules unless the project also implements the same imports. This can be a pain.
I'd love some third-party scripts / tooling around this, and I'm sure others will as well here are some ideas perhaps projects will surface that already exist or this will guide people to what needs to be created.
It seems that
import_mapsserve two purposes,I think most of this tooling focuses on (1), but if someone upstream fixes an issue upstream I want that to be fixed for me too see eveningkid/denodb#348 (comment).
Deno adding multiple
import_mapstodeno.json?Some of these tools become irrelevant if Deno just handles this out of the box. As of right now you can only have one
import_mapbut we could make it an array? An array that supports urls? 👀Potential Commands
Merge
import_mapsAbiding by the one
import_mapstandard then I think the right way to do this is to have aimport_mapsdirectory and save a snapshot of the current custom imports. Then new import files are downloaded and put into this directory. The tool then merges all the import maps and spits out a new single./import_map.json. Errors occur if there's conflicts. This will allow you to "undo" a merge because all the files are separate, all you have to do is remove the file.import_maps mergeDownload single
import_mapCheck a url for ./import_map.json and pull into your project. The name of the source can be included via metadata file or in the json, and this allows the ability to revert / remove imports. The api could look like this:
import_maps download http://deno.land/x/example@1.1.1Download project-wide
import_mapsScan all the code in a deno project, check all potental deps for import maps, download them all.
import_maps find ./main.tsReplace map key with dep
import_mapsThis would go through the codebase and replace (inline) all the import maps with their value / url counterparts.
import_maps replace-map-key-with-depReplace dep with map key
import_mapsThis would go through the codebase and replace (inline) all the urls with their import_map key counterparts.
import_maps replace-dep-with-map-keyShow unused
import_mapsThis would give you a readout of any import maps that aren't being used.
Remove unused
import_mapsThis would remove any unused import maps from
./import_maps.json.Import map local-file generator
You could just use the import maps to generate local files, like this:
This:
./import_maps.json{ "imports": { "lodash": "https://deno.land/x/lodash@4.17.19" } }Generates this:
./imports/lodash.tsUsage like this:
./main.tsBeta Was this translation helpful? Give feedback.
All reactions