mirror of
https://github.com/denoland/deno.git
synced 2025-12-23 08:48:24 +00:00
chore(cli): new error message for missing dependency (#30901)
This commit is contained in:
parent
379789b209
commit
a51be5f0fa
24 changed files with 41 additions and 41 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
|
@ -2034,9 +2034,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_doc"
|
||||
version = "0.184.0"
|
||||
version = "0.185.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "797807db545563a88096326f0a380dee181b21b7b8184eaac3aed5096cabcc37"
|
||||
checksum = "2d8e72f463807d2a6385f3342301d36e37f90dd1c9d02345a7845f5ae9e97c99"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-if",
|
||||
|
|
@ -2187,9 +2187,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_graph"
|
||||
version = "0.101.0"
|
||||
version = "0.102.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0419813ac1469cfbb2b987dac6870de13cdff4bea6609f70fd99b3c2bc48403"
|
||||
checksum = "3ff633db1c343707713aec1f6f95f8c5b6658d2fb544e3f000de678184c2bd48"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"boxed_error",
|
||||
|
|
@ -3951,9 +3951,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "eszip"
|
||||
version = "0.101.0"
|
||||
version = "0.102.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9810ce37bf4fccdc4d7a00bb68ced2dfecce6cab4ee3b142e049ab406972bf4"
|
||||
checksum = "6658e0c84409a293b851f88fb8daa69e16c7598ba1cef321af485e51282ba8e7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -5357,9 +5357,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "import_map"
|
||||
version = "0.23.0"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce93e07f4819f0db4d2948fffce3ef4760a9940c4ff4f9369dfaf5e357a0d415"
|
||||
checksum = "f83a4958a41489355816028239fee373797435384d162f4908e7980c83c3bb1b"
|
||||
dependencies = [
|
||||
"boxed_error",
|
||||
"deno_error",
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ deno_ast = { version = "=0.50.0", features = ["transpiling"] }
|
|||
deno_core = { version = "0.362.0" }
|
||||
|
||||
deno_cache_dir = "=0.25.0"
|
||||
deno_doc = "=0.184.0"
|
||||
deno_doc = "=0.185.0"
|
||||
deno_error = "=0.7.0"
|
||||
deno_graph = { version = "=0.101.0", default-features = false }
|
||||
deno_graph = { version = "=0.102.0", default-features = false }
|
||||
deno_lint = "=0.80.0"
|
||||
deno_lockfile = "=0.32.0"
|
||||
deno_media_type = { version = "=0.2.9", features = ["module_specifier"] }
|
||||
|
|
@ -79,7 +79,7 @@ deno_task_shell = "=0.26.0"
|
|||
deno_terminal = "=0.2.2"
|
||||
deno_unsync = { version = "0.4.4", default-features = false }
|
||||
deno_whoami = "0.1.0"
|
||||
eszip = "=0.101.0"
|
||||
eszip = "=0.102.0"
|
||||
|
||||
denokv_proto = "0.12.0"
|
||||
denokv_remote = "0.12.0"
|
||||
|
|
@ -194,7 +194,7 @@ hyper-util = { version = "0.1.17", features = ["tokio", "client", "client-legacy
|
|||
hyper_v014 = { package = "hyper", version = "0.14.26", features = ["runtime", "http1"] }
|
||||
idna = "1.0.3"
|
||||
ignore = "0.4"
|
||||
import_map = { version = "0.23.0", features = ["ext"] }
|
||||
import_map = { version = "0.24.0", features = ["ext"] }
|
||||
indexmap = { version = "2", features = ["serde"] }
|
||||
ipnet = "2.3"
|
||||
ipnetwork = "0.20.0"
|
||||
|
|
|
|||
4
cli/bench/testdata/deco_apps_requests.json
vendored
4
cli/bench/testdata/deco_apps_requests.json
vendored
|
|
@ -1781,7 +1781,7 @@
|
|||
"character": 26
|
||||
}
|
||||
},
|
||||
"message": "Relative import path \"\" not prefixed with / or ./ or ../ and not in import map from \"file:///decohub/mod.ts\"",
|
||||
"message": "Import \"\" not a dependency and not in import map from \"file:///decohub/mod.ts\"",
|
||||
"code": "resolver-error",
|
||||
"severity": 1,
|
||||
"source": "deno"
|
||||
|
|
@ -1862,7 +1862,7 @@
|
|||
"character": 26
|
||||
}
|
||||
},
|
||||
"message": "Relative import path \"\" not prefixed with / or ./ or ../ and not in import map from \"file:///decohub/mod.ts\"",
|
||||
"message": "Import \"\" not a dependency and not in import map from \"file:///decohub/mod.ts\"",
|
||||
"code": "resolver-error",
|
||||
"severity": 1,
|
||||
"source": "deno"
|
||||
|
|
|
|||
|
|
@ -1685,7 +1685,7 @@ mod tests {
|
|||
"severity": 1,
|
||||
"code": "import-prefix-missing",
|
||||
"source": "deno",
|
||||
"message": "Relative import path \"bad.js\" not prefixed with / or ./ or ../",
|
||||
"message": "Import \"bad.js\" not a dependency",
|
||||
},
|
||||
{
|
||||
"range": {
|
||||
|
|
@ -1695,7 +1695,7 @@ mod tests {
|
|||
"severity": 1,
|
||||
"code": "import-prefix-missing",
|
||||
"source": "deno",
|
||||
"message": "Relative import path \"bad.js\" not prefixed with / or ./ or ../",
|
||||
"message": "Import \"bad.js\" not a dependency",
|
||||
},
|
||||
{
|
||||
"range": {
|
||||
|
|
@ -1705,7 +1705,7 @@ mod tests {
|
|||
"severity": 1,
|
||||
"code": "import-prefix-missing",
|
||||
"source": "deno",
|
||||
"message": "Relative import path \"bad.d.ts\" not prefixed with / or ./ or ../",
|
||||
"message": "Import \"bad.d.ts\" not a dependency",
|
||||
},
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ fn unadded_dependency_message_with_import_map() {
|
|||
let mut expected_lsp_messages = Vec::from([
|
||||
"`x` is never used\nIf this is intentional, prefix it with an underscore like `_x`",
|
||||
"'x' is declared but its value is never read.",
|
||||
"Relative import path \"@std/fs\" not prefixed with / or ./ or ../ and not in import map from \" hint: If you want to use the JSR package, try running `deno add jsr:@std/fs`",
|
||||
"Import \"@std/fs\" not a dependency and not in import map from \" hint: If you want to use the JSR package, try running `deno add jsr:@std/fs`",
|
||||
]);
|
||||
expected_lsp_messages.sort();
|
||||
let all_diagnostics = diagnostics.all();
|
||||
|
|
@ -282,7 +282,7 @@ fn unadded_dependency_message() {
|
|||
let mut expected_lsp_messages = Vec::from([
|
||||
"`x` is never used\nIf this is intentional, prefix it with an underscore like `_x`",
|
||||
"'x' is declared but its value is never read.",
|
||||
"Relative import path \"@std/fs\" not prefixed with / or ./ or ../ and not in import map from \" hint: If you want to use the JSR package, try running `deno add jsr:@std/fs`",
|
||||
"Import \"@std/fs\" not a dependency and not in import map from \" hint: If you want to use the JSR package, try running `deno add jsr:@std/fs`",
|
||||
]);
|
||||
expected_lsp_messages.sort();
|
||||
let all_diagnostics = diagnostics.all();
|
||||
|
|
@ -10680,7 +10680,7 @@ fn lsp_completions_node_builtin() {
|
|||
"severity": 1,
|
||||
"code": "import-node-prefix-missing",
|
||||
"source": "deno",
|
||||
"message": "Relative import path \"fs\" not prefixed with / or ./ or ../\n hint: If you want to use a built-in Node module, add a \"node:\" prefix (ex. \"node:fs\").",
|
||||
"message": "Import \"fs\" not a dependency\n hint: If you want to use a built-in Node module, add a \"node:\" prefix (ex. \"node:fs\").",
|
||||
"data": {
|
||||
"specifier": "fs"
|
||||
},
|
||||
|
|
@ -19618,7 +19618,7 @@ fn lsp_push_diagnostics() {
|
|||
"severity": 1,
|
||||
"code": "import-prefix-missing",
|
||||
"source": "deno",
|
||||
"message": "Relative import path \"foo\" not prefixed with / or ./ or ../\n hint: If you want to use the npm package, try running `deno add npm:foo`",
|
||||
"message": "Import \"foo\" not a dependency\n hint: If you want to use the npm package, try running `deno add npm:foo`",
|
||||
},
|
||||
],
|
||||
"version": 1,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[WILDCARD]
|
||||
error: Relative import path "bad" not prefixed with / or ./ or ../ and not in import map from "[WILDLINE]local_bad.ts"
|
||||
error: Import "bad" not a dependency and not in import map from "[WILDLINE]local_bad.ts"
|
||||
at [WILDLINE]/local_bad.ts:1:13
|
||||
note: You can mark the path "bad" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.
|
||||
error: bundling failed
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../
|
||||
[WILDCARD]error: Import "foo" not a dependency
|
||||
hint: If you want to use the npm package, try running `deno add npm:foo`
|
||||
at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]TS2307 [ERROR]: Relative import path "@scope/BAZ" not prefixed with / or ./ or ../ and not in import map from "file:///[WILDLINE]/main.ts"
|
||||
[WILDCARD]TS2307 [ERROR]: Import "@scope/BAZ" not a dependency and not in import map from "file:///[WILDLINE]/main.ts"
|
||||
hint: If you want to use a JSR or npm package, try running `deno add jsr:@scope/BAZ` or `deno add npm:@scope/BAZ`
|
||||
at file:///[WILDLINE]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]TS2307 [ERROR]: Relative import path "@scope/BAZ" not prefixed with / or ./ or ../
|
||||
[WILDCARD]TS2307 [ERROR]: Import "@scope/BAZ" not a dependency
|
||||
hint: If you want to use a JSR or npm package, try running `deno add jsr:@scope/BAZ` or `deno add npm:@scope/BAZ`
|
||||
at file:///[WILDLINE]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]TS2307 [ERROR]: Relative import path "foo" not prefixed with / or ./ or ../
|
||||
[WILDCARD]TS2307 [ERROR]: Import "foo" not a dependency
|
||||
hint: If you want to use the npm package, try running `deno add npm:foo`
|
||||
at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD]
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
error: Relative import path [WILDCARD] not prefixed with / or ./ or ../ and not in import map [WILDCARD]
|
||||
error: Import [WILDCARD] not a dependency and not in import map [WILDCARD]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: Uncaught (in promise) TypeError: Relative import path "unmapped" not prefixed with / or ./ or ../ and not in import map from "file://[WILDCARD]/unmapped_bare_specifier.ts"
|
||||
error: Uncaught (in promise) TypeError: Import "unmapped" not a dependency and not in import map from "file://[WILDCARD]/unmapped_bare_specifier.ts"
|
||||
at file://[WILDCARD]/unmapped_bare_specifier.ts:1:14
|
||||
|
||||
await import("unmapped");
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../
|
||||
error: Import "@std/dotenv/load" not a dependency
|
||||
hint: If you want to use the JSR package, try running `deno add jsr:@std/dotenv/load`
|
||||
at [WILDCARD]bare_specifier_without_import/main.ts:1:8
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
[WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../
|
||||
[WILDCARD]error: Import "bad-module.ts" not a dependency
|
||||
at [WILDCARD]/error_011_bad_module_specifier.ts:1:28
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Check [WILDCARD]error_012_bad_dynamic_import_specifier.ts
|
||||
error: Uncaught (in promise) TypeError: Relative import path "bad-module.ts" not prefixed with / or ./ or ../
|
||||
error: Uncaught (in promise) TypeError: Import "bad-module.ts" not a dependency
|
||||
at [WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:35
|
||||
|
||||
const _badModule = await import("bad-module.ts");
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
Caught direct dynamic import error.
|
||||
TypeError: Relative import path "does not exist" not prefixed with / or ./ or ../
|
||||
TypeError: Import "does not exist" not a dependency
|
||||
at [WILDCARD]/error_014_catch_dynamic_import_error.js:3:18
|
||||
|
||||
at [WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 {
|
||||
code: "ERR_MODULE_NOT_FOUND"
|
||||
}
|
||||
Caught indirect direct dynamic import error.
|
||||
TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../
|
||||
TypeError: Import "does not exist either" not a dependency
|
||||
at [WILDCARD]/indirect_import_error.js:1:15
|
||||
at async [WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 {
|
||||
code: "ERR_MODULE_NOT_FOUND"
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
error: Relative import path "env" not prefixed with / or ./ or ../
|
||||
error: Import "env" not a dependency
|
||||
at file:///[WILDLINE]/toolkit.wasm:1:65
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]TS2307 [ERROR]: Relative import path "baz" not prefixed with / or ./ or ../
|
||||
[WILDCARD]TS2307 [ERROR]: Import "baz" not a dependency
|
||||
hint: If you want to use the npm package, try running `deno add npm:baz`
|
||||
at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
error: Relative import path "fs" not prefixed with / or ./ or ../
|
||||
error: Import "fs" not a dependency
|
||||
hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
|
||||
at file:///[WILDLINE]/missing.ts:1:16
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
error: Relative import path "fs" not prefixed with / or ./ or ../ and not in import map from "[WILDLINE]/main.ts"
|
||||
error: Import "fs" not a dependency and not in import map from "[WILDLINE]/main.ts"
|
||||
hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
|
||||
at file:///[WILDCARD]/main.ts:1:16
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
error: Relative import path "fs" not prefixed with / or ./ or ../
|
||||
error: Import "fs" not a dependency
|
||||
hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
|
||||
at file:///[WILDCARD]/main.ts:1:16
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[WILDCARD]Config file found at '[WILDCARD]deno.json'
|
||||
[WILDCARD]
|
||||
error: Relative import path "chalk" not prefixed with / or ./ or ../
|
||||
error: Import "chalk" not a dependency
|
||||
hint: If you want to use the npm package, try running `deno add npm:chalk`
|
||||
at file:///[WILDCARD]/main.ts:3:19
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../
|
||||
[WILDCARD]error: Import "foo" not a dependency
|
||||
at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD]
|
||||
|
|
|
|||
2
tests/testdata/npm/dynamic_import/main.out
vendored
2
tests/testdata/npm/dynamic_import/main.out
vendored
|
|
@ -3,4 +3,4 @@ Download http://localhost:4260/chalk
|
|||
Download http://localhost:4260/chalk/chalk-5.0.1.tgz
|
||||
B
|
||||
C
|
||||
devDependency import failed: TypeError: Relative import path "xo"[WILDCARD]
|
||||
devDependency import failed: TypeError: Import "xo"[WILDCARD]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue