mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 15:14:33 +00:00
fix(npm): resolve dynamic npm imports individually (#24170)
* https://github.com/denoland/deno_npm/pull/57 * https://github.com/denoland/deno_graph/pull/498 Closes https://github.com/denoland/deno/issues/17802
This commit is contained in:
parent
6a356aff13
commit
4bc96c5d2a
19 changed files with 263 additions and 453 deletions
|
@ -12868,14 +12868,10 @@ fn lsp_uses_lockfile_for_npm_initialization() {
|
|||
client.initialize_default();
|
||||
let mut skipping_count = 0;
|
||||
client.wait_until_stderr_line(|line| {
|
||||
if line.contains("Skipping pending npm resolution.") {
|
||||
if line.contains("Skipping npm resolution.") {
|
||||
skipping_count += 1;
|
||||
}
|
||||
assert!(
|
||||
!line.contains("Running pending npm resolution."),
|
||||
"Line: {}",
|
||||
line
|
||||
);
|
||||
assert!(!line.contains("Running npm resolution."), "Line: {}", line);
|
||||
line.contains("Server ready.")
|
||||
});
|
||||
assert_eq!(skipping_count, 1);
|
||||
|
|
|
@ -1822,6 +1822,7 @@ fn reload_info_not_found_cache_but_exists_remote() {
|
|||
.run();
|
||||
output.assert_matches_text(concat!(
|
||||
"error: Could not find npm package '@denotest/esm-import-cjs-default' matching '1.0.0'.\n",
|
||||
" at file:///[WILDCARD]/main.ts:1:8\n",
|
||||
));
|
||||
output.assert_exit_code(1);
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@denotest/dep-cannot-parse",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@denotest/esm-basic": "unknown-scheme:unknown"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"args": "run -A main.ts",
|
||||
"output": "main.out"
|
||||
}
|
15
tests/specs/npm/dynamic_npm_resolution_failure/main.out
Normal file
15
tests/specs/npm/dynamic_npm_resolution_failure/main.out
Normal file
|
@ -0,0 +1,15 @@
|
|||
[UNORDERED_START]
|
||||
Download http://localhost:4260/chalk
|
||||
Download http://localhost:4260/@denotest/dep-cannot-parse
|
||||
[UNORDERED_END]
|
||||
Download http://localhost:4260/chalk/chalk-5.0.1.tgz
|
||||
Hi
|
||||
TypeError: Error in @denotest/dep-cannot-parse@1.0.0 parsing version requirement for dependency: @denotest/esm-basic@unknown-scheme:unknown
|
||||
|
||||
Invalid npm version requirement. Unexpected character.
|
||||
unknown-scheme:unknown
|
||||
~
|
||||
at async file:///[WILDLINE]main.ts:5:3 {
|
||||
code: "ERR_MODULE_NOT_FOUND"
|
||||
}
|
||||
Bye
|
9
tests/specs/npm/dynamic_npm_resolution_failure/main.ts
Normal file
9
tests/specs/npm/dynamic_npm_resolution_failure/main.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import chalk from "npm:chalk";
|
||||
|
||||
console.log(chalk.green("Hi"));
|
||||
try {
|
||||
await import("npm:@denotest/dep-cannot-parse");
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
console.log(chalk.green("Bye"));
|
Loading…
Add table
Add a link
Reference in a new issue