mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
parent
bd79baea5e
commit
4a5aaceb26
6 changed files with 57 additions and 1 deletions
|
@ -147,3 +147,10 @@ itest!(package_json_basic {
|
|||
copy_temp_dir: Some("package_json/basic"),
|
||||
exit_code: 0,
|
||||
});
|
||||
|
||||
itest!(info_import_map {
|
||||
args: "info preact/debug",
|
||||
output: "info/with_import_map/with_import_map.out",
|
||||
cwd: Some("info/with_import_map"),
|
||||
exit_code: 0,
|
||||
});
|
||||
|
|
6
cli/tests/testdata/info/with_import_map/deno.json
vendored
Normal file
6
cli/tests/testdata/info/with_import_map/deno.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"imports": {
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/"
|
||||
}
|
||||
}
|
7
cli/tests/testdata/info/with_import_map/deno.lock
vendored
Normal file
7
cli/tests/testdata/info/with_import_map/deno.lock
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"version": "2",
|
||||
"remote": {
|
||||
"https://esm.sh/preact@10.15.1": "2b79349676a4942fbcf835c4efa909791c2f0aeca195225bf22bac9866e94b4e",
|
||||
"https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs": "30710ac1d5ff3711ae0c04eddbeb706f34f82d97489f61aaf09897bc75d2a628"
|
||||
}
|
||||
}
|
2
cli/tests/testdata/info/with_import_map/main.tsx
vendored
Normal file
2
cli/tests/testdata/info/with_import_map/main.tsx
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
import { render } from "preact";
|
||||
console.log(render);
|
16
cli/tests/testdata/info/with_import_map/with_import_map.out
vendored
Normal file
16
cli/tests/testdata/info/with_import_map/with_import_map.out
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
Download https://esm.sh/preact@10.15.1/debug
|
||||
Download https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs
|
||||
Download https://esm.sh/stable/preact@10.15.1/denonext/devtools.js
|
||||
Download https://esm.sh/stable/preact@10.15.1/denonext/debug.js
|
||||
local: [WILDCARD]
|
||||
type: JavaScript
|
||||
dependencies: 3 unique
|
||||
size: [WILDCARD]
|
||||
|
||||
https://esm.sh/preact@10.15.1/debug [WILDCARD]
|
||||
├── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD]
|
||||
├─┬ https://esm.sh/stable/preact@10.15.1/denonext/devtools.js [WILDCARD]
|
||||
│ └── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD]
|
||||
└─┬ https://esm.sh/stable/preact@10.15.1/denonext/debug.js [WILDCARD]
|
||||
├── https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs [WILDCARD]
|
||||
└── https://esm.sh/stable/preact@10.15.1/denonext/devtools.js [WILDCARD]
|
|
@ -40,7 +40,25 @@ pub async fn info(flags: Flags, info_flags: InfoFlags) -> Result<(), AnyError> {
|
|||
let module_graph_builder = factory.module_graph_builder().await?;
|
||||
let npm_resolver = factory.npm_resolver().await?;
|
||||
let maybe_lockfile = factory.maybe_lockfile();
|
||||
let specifier = resolve_url_or_path(&specifier, cli_options.initial_cwd())?;
|
||||
let maybe_imports_map = factory.maybe_import_map().await?;
|
||||
|
||||
let maybe_import_specifier = if let Some(imports_map) = maybe_imports_map {
|
||||
if let Ok(imports_specifier) =
|
||||
imports_map.resolve(&specifier, imports_map.base_url())
|
||||
{
|
||||
Some(imports_specifier)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let specifier = match maybe_import_specifier {
|
||||
Some(specifier) => specifier,
|
||||
None => resolve_url_or_path(&specifier, cli_options.initial_cwd())?,
|
||||
};
|
||||
|
||||
let mut loader = module_graph_builder.create_graph_loader();
|
||||
loader.enable_loading_cache_info(); // for displaying the cache information
|
||||
let graph = module_graph_builder
|
||||
|
|
Loading…
Reference in a new issue