mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix: improved using declaration support (#20959)
Upgrades to deno_ast 0.30.
This commit is contained in:
parent
9df36b33c6
commit
8f065a60e7
17 changed files with 152 additions and 122 deletions
|
@ -55,8 +55,8 @@
|
|||
"ext/websocket/autobahn/reports"
|
||||
],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/typescript-0.88.1.wasm",
|
||||
"https://plugins.dprint.dev/json-0.17.4.wasm",
|
||||
"https://plugins.dprint.dev/typescript-0.88.2.wasm",
|
||||
"https://plugins.dprint.dev/json-0.19.0.wasm",
|
||||
"https://plugins.dprint.dev/markdown-0.16.2.wasm",
|
||||
"https://plugins.dprint.dev/toml-0.5.4.wasm",
|
||||
"https://plugins.dprint.dev/exec-0.4.3.json@42343548b8022c99b1d750be6b894fe6b6c7ee25f72ae9f9082226dd2e515072"
|
||||
|
|
115
Cargo.lock
generated
115
Cargo.lock
generated
|
@ -1089,9 +1089,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_ast"
|
||||
version = "0.29.3"
|
||||
version = "0.30.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "577ec3850834c2578eb44afa9250f9a807f8497664e6e2aaae19cea0aac2fe3b"
|
||||
checksum = "52171349bf71cf79c91264d56ff097574ff9ddfdf665ce3c6cc737b51c416b58"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.1",
|
||||
|
@ -1265,9 +1265,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_doc"
|
||||
version = "0.68.0"
|
||||
version = "0.69.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7f5649a3e8c8da3e73d27eff6306c522f1bb0c54e75fad5530f3a4746eea81f"
|
||||
checksum = "a1e756efaa9a9c6c0a952281f6f94bbab4ce0acb5641fd9aa4a49f491b7a049c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"deno_ast",
|
||||
|
@ -1283,9 +1283,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_emit"
|
||||
version = "0.29.0"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac5e585450dbafc39a2161bc9c8f861409cec08c014c4f82c62fdbce5ae335c2"
|
||||
checksum = "cd52f6f700236a5a9e653538969210016f8ff5563f93dfd053e97640acc7a2f4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.1",
|
||||
|
@ -1350,9 +1350,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_graph"
|
||||
version = "0.56.3"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f02ddb53a0d3201895566ef3c1c5861c62d06df3b0fac6a7dcf826dd081eec27"
|
||||
checksum = "95542a83b6c071b2966f7b35a5ec90d56353ced1c2aaba4831377745db40935b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -1451,9 +1451,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_lint"
|
||||
version = "0.51.0"
|
||||
version = "0.52.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15d1ec49429172b9ae411848038ef41eb06ef7b5902ebd3c0e8d6b9f74c15468"
|
||||
checksum = "c5f6e83a85385555c43884f18a25a6b7d73ad491155e0efd8c1cee73036bbde2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_ast",
|
||||
|
@ -1933,9 +1933,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dprint-plugin-json"
|
||||
version = "0.17.4"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63039b53a600a7dc078cf9d76d6b5aad9bdb665e5a107ecdb06aef7bcc2e345"
|
||||
checksum = "8631287de4a33f7246c846e7a6cbbfd42ab8eef89520ae414e371e7bfbb85401"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dprint-core",
|
||||
|
@ -1960,9 +1960,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dprint-plugin-typescript"
|
||||
version = "0.88.1"
|
||||
version = "0.88.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "726638912cda718e8c5dc9e2f65eb7c14c7a99b5ce1a7a1bbf3950e72ec39562"
|
||||
checksum = "726e373a4d4af8a42544206d8585f464f31b2f9837d6b4c8a04b07d51b8e0e2d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_ast",
|
||||
|
@ -1973,9 +1973,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dprint-swc-ext"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a0a2492465344a58a37ae119de59e81fe5a2885f2711c7b5048ef0dfa14ce42"
|
||||
checksum = "7b2f24ce6b89a06ae3eb08d5d4f88c05d0aef1fa58e2eba8dd92c97b84210c25"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"num-bigint",
|
||||
|
@ -2229,9 +2229,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "eszip"
|
||||
version = "0.54.0"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4032916b1567b2588723ea4d1aa47537ae0f580f64a0aba5dedc8bf13e20c6e0"
|
||||
checksum = "9ba11bdb068e55f2e0830b1d5c7d4829c98ab8fc1ce3513bf32d976852743069"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.4",
|
||||
|
@ -4580,6 +4580,12 @@ version = "1.0.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "ryu-js"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4950d85bc52415f8432144c97c4791bd0c4f7954de32a7270ee9cccd3c22b12b"
|
||||
|
||||
[[package]]
|
||||
name = "salsa20"
|
||||
version = "0.10.2"
|
||||
|
@ -5112,9 +5118,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
|||
|
||||
[[package]]
|
||||
name = "swc_atoms"
|
||||
version = "0.5.9"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f54563d7dcba626d4acfe14ed12def7ecc28e004debe3ecd2c3ee07cc47e449"
|
||||
checksum = "ebf7a12229f0c0efb654a6a0f8cbfd94fbd320a57c764857a82d8abe9342b450"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
|
@ -5126,9 +5132,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_bundler"
|
||||
version = "0.219.5"
|
||||
version = "0.222.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "421cc659acd7807306c5a422eb95d09c20975464fe3ad5004e1e62ee2a6fc304"
|
||||
checksum = "aaf08a312740da9aa47c211db099d05f446db6e9050d2cde91ba79f35f024a60"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crc",
|
||||
|
@ -5156,9 +5162,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_common"
|
||||
version = "0.32.0"
|
||||
version = "0.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cb7fcd56655c8ae7dcf2344f0be6cbff4d9c7cb401fe3ec8e56e1de8dfe582"
|
||||
checksum = "490e199e25d2aa3fbef675524fa81408651f4e7178b51110470ddd1b3e3bbe75"
|
||||
dependencies = [
|
||||
"ast_node",
|
||||
"better_scoped_tls",
|
||||
|
@ -5208,9 +5214,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_ast"
|
||||
version = "0.109.0"
|
||||
version = "0.110.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bc2286cedd688a68f214faa1c19bb5cceab7c9c54d0cbe3273e4c1704e38f69"
|
||||
checksum = "5cbbf9918976a7e7fbdb4f76fe659d08e291a8b56b524b424183fc67d1189679"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"is-macro",
|
||||
|
@ -5225,9 +5231,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_codegen"
|
||||
version = "0.144.1"
|
||||
version = "0.146.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e62ba2c0ed1f119fc1a76542d007f1b2c12854d54dea15f5491363227debe11"
|
||||
checksum = "063562340cb1f928babd78951a0aa3d42feec8b8693c7a4db2b07b7d9e838659"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
|
@ -5257,9 +5263,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_dep_graph"
|
||||
version = "0.111.1"
|
||||
version = "0.113.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5526adf6a434f145c8caf7e3a2dba554a2ad09b84467b6a62210f9ef0af0f71"
|
||||
checksum = "f3281df0c205727acf3584339533f093706205c9996e04964825625c932672db"
|
||||
dependencies = [
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -5269,9 +5275,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_loader"
|
||||
version = "0.44.2"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d7c322462657ae27ac090a2c89f7e456c94416284a2f5ecf66c43a6a3c19d1"
|
||||
checksum = "a7fe06d942fe20a5a81cc14f4a53e64a5efdc851fa895a869224b2d41df73276"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"pathdiff",
|
||||
|
@ -5282,9 +5288,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_parser"
|
||||
version = "0.139.0"
|
||||
version = "0.141.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3eab46cb863bc5cd61535464e07e5b74d5f792fa26a27b9f6fd4c8daca9903b7"
|
||||
checksum = "1a23445c5da841d4a5859b4e3a9cee0eb7c09a7b6fb0c0cc7eda2616b1204b12"
|
||||
dependencies = [
|
||||
"either",
|
||||
"num-bigint",
|
||||
|
@ -5302,9 +5308,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.132.2"
|
||||
version = "0.134.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01ffd4a8149052bfc1ec1832fcbe04f317846ce635a49ec438df33b06db27d26"
|
||||
checksum = "5a47ed8caf6d1c435e9e00bde780b1d449a2050b2689ff109fadeb30e3ffdefd"
|
||||
dependencies = [
|
||||
"better_scoped_tls",
|
||||
"bitflags 2.4.0",
|
||||
|
@ -5325,9 +5331,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_classes"
|
||||
version = "0.121.2"
|
||||
version = "0.123.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4b7fee0e2c6f12456d2aefb2418f2f26529b995945d493e1dce35a5a22584fc"
|
||||
checksum = "95df25cfcc0429c2ea11d7c74082d587e09df9704e6ad1dfbfc14386cb421106"
|
||||
dependencies = [
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -5352,9 +5358,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_optimization"
|
||||
version = "0.192.3"
|
||||
version = "0.195.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "880fd2a588ac88a61cd1d21b10203bbabe31d7adacbd22de3bb4d702bf2c42b4"
|
||||
checksum = "f63859bfb30259360411c507d87e4eb5ad322fc5ff18c190ee316042715edc96"
|
||||
dependencies = [
|
||||
"dashmap 5.5.3",
|
||||
"indexmap 1.9.3",
|
||||
|
@ -5376,9 +5382,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_proposal"
|
||||
version = "0.166.3"
|
||||
version = "0.168.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "122fd9a69f464694edefbf9c59106b3c15e5cc8cb8575a97836e4fb79018e98f"
|
||||
checksum = "d5b084515f9a4ced2637dcbb55897c99c0a6e48089eeb94be7806b35d3646264"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rustc-hash",
|
||||
|
@ -5396,9 +5402,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_react"
|
||||
version = "0.178.3"
|
||||
version = "0.180.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "675b5c755b0448268830e85e59429095d3423c0ce4a850b209c6f0eeab069f63"
|
||||
checksum = "2aa0a0c071551b412034c9c3d8164f8aeae3ade2cf673877f8b9176c0b7c66ed"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"dashmap 5.5.3",
|
||||
|
@ -5420,10 +5426,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_typescript"
|
||||
version = "0.182.3"
|
||||
version = "0.185.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eba97b1ea71739fcf278aedad4677a3cacb52288a3f3566191b70d16a889de6"
|
||||
checksum = "5c40f2e9444f793693400a3114b947a358da8d52eb8ff1b76ffcbd8068e853e0"
|
||||
dependencies = [
|
||||
"ryu-js",
|
||||
"serde",
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -5436,9 +5443,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_utils"
|
||||
version = "0.122.0"
|
||||
version = "0.124.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11006a3398ffd4693c4d3b0a1b1a5030edbdc04228159f5301120a6178144708"
|
||||
checksum = "fd601a7d7088a95b93afde1dfcfdbf12fe2654a407629446ab42c758a47ba293"
|
||||
dependencies = [
|
||||
"indexmap 1.9.3",
|
||||
"num_cpus",
|
||||
|
@ -5454,9 +5461,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_visit"
|
||||
version = "0.95.0"
|
||||
version = "0.96.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f628ec196e76e67892441e14eef2e423a738543d32bffdabfeec20c29582117"
|
||||
checksum = "47081acd84cdb2d49d6340ed3204e17738b444da10a3e1dd1eb3d7c8e4d47091"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"swc_atoms",
|
||||
|
@ -5480,9 +5487,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_fast_graph"
|
||||
version = "0.20.0"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a407fff2eb5ce3bee7513bdd9531a7be0285bc1213500b6d98ad235428d94cce"
|
||||
checksum = "b97e69e9617913611e39284cf724a412ab7fc6081708d0ef2820855774da5357"
|
||||
dependencies = [
|
||||
"indexmap 1.9.3",
|
||||
"petgraph",
|
||||
|
@ -5492,9 +5499,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_graph_analyzer"
|
||||
version = "0.21.0"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90b996222612382d0d297d0315f5eedc5a830c37e62476c69774884633d31177"
|
||||
checksum = "0f59cccef405565b041a8fa1fc2e7059856149f7fc658544c4bafd1a001ea483"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"petgraph",
|
||||
|
|
|
@ -38,8 +38,7 @@ license = "MIT"
|
|||
repository = "https://github.com/denoland/deno"
|
||||
|
||||
[workspace.dependencies]
|
||||
deno_ast = { version = "0.29.3", features = ["transpiling"] }
|
||||
|
||||
deno_ast = { version = "0.30.2", features = ["transpiling"] }
|
||||
deno_core = { version = "0.222.0" }
|
||||
|
||||
deno_runtime = { version = "0.129.0", path = "./runtime" }
|
||||
|
|
|
@ -49,16 +49,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra
|
|||
deno_cache_dir = "=0.6.0"
|
||||
deno_config = "=0.4.0"
|
||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_doc = "=0.68.0"
|
||||
deno_emit = "=0.29.0"
|
||||
deno_graph = "=0.56.3"
|
||||
deno_lint = { version = "=0.51.0", features = ["docs"] }
|
||||
deno_doc = "=0.69.1"
|
||||
deno_emit = "=0.31.0"
|
||||
deno_graph = "=0.58.0"
|
||||
deno_lint = { version = "=0.52.1", features = ["docs"] }
|
||||
deno_lockfile.workspace = true
|
||||
deno_npm = "0.15.2"
|
||||
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] }
|
||||
deno_semver = "0.5.1"
|
||||
deno_task_shell = "=0.13.2"
|
||||
eszip = "=0.54.0"
|
||||
eszip = "=0.55.1"
|
||||
napi_sym.workspace = true
|
||||
|
||||
async-trait.workspace = true
|
||||
|
@ -76,9 +76,9 @@ dashmap = "5.5.3"
|
|||
data-encoding.workspace = true
|
||||
data-url.workspace = true
|
||||
dissimilar = "=1.0.4"
|
||||
dprint-plugin-json = "=0.17.4"
|
||||
dprint-plugin-json = "=0.19.0"
|
||||
dprint-plugin-markdown = "=0.16.2"
|
||||
dprint-plugin-typescript = "=0.88.1"
|
||||
dprint-plugin-typescript = "=0.88.2"
|
||||
encoding_rs.workspace = true
|
||||
env_logger = "=0.10.0"
|
||||
fancy-regex = "=0.10.0"
|
||||
|
|
|
@ -153,9 +153,9 @@ impl Visit for DenoTestCollector {
|
|||
}
|
||||
ast::Expr::Member(member_expr) => {
|
||||
if let ast::MemberProp::Ident(ns_prop_ident) = &member_expr.prop {
|
||||
if ns_prop_ident.sym.to_string() == "test" {
|
||||
if ns_prop_ident.sym == "test" {
|
||||
if let ast::Expr::Ident(ident) = member_expr.obj.as_ref() {
|
||||
if ident.sym.to_string() == "Deno" {
|
||||
if ident.sym == "Deno" {
|
||||
self.check_call_expr(node, &ns_prop_ident.range());
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ impl Visit for DenoTestCollector {
|
|||
match init.as_ref() {
|
||||
// Identify destructured assignments of `test` from `Deno`
|
||||
ast::Expr::Ident(ident) => {
|
||||
if ident.sym.to_string() == "Deno" {
|
||||
if ident.sym == "Deno" {
|
||||
if let ast::Pat::Object(object_pat) = &decl.name {
|
||||
for prop in &object_pat.props {
|
||||
match prop {
|
||||
|
@ -185,7 +185,7 @@ impl Visit for DenoTestCollector {
|
|||
}
|
||||
ast::ObjectPatProp::KeyValue(prop) => {
|
||||
if let ast::PropName::Ident(key_ident) = &prop.key {
|
||||
if key_ident.sym.to_string() == "test" {
|
||||
if key_ident.sym == "test" {
|
||||
if let ast::Pat::Ident(value_ident) =
|
||||
&prop.value.as_ref()
|
||||
{
|
||||
|
@ -205,9 +205,9 @@ impl Visit for DenoTestCollector {
|
|||
// Identify variable assignments where the init is `Deno.test`
|
||||
ast::Expr::Member(member_expr) => {
|
||||
if let ast::Expr::Ident(obj_ident) = member_expr.obj.as_ref() {
|
||||
if obj_ident.sym.to_string() == "Deno" {
|
||||
if obj_ident.sym == "Deno" {
|
||||
if let ast::MemberProp::Ident(prop_ident) = &member_expr.prop {
|
||||
if prop_ident.sym.to_string() == "test" {
|
||||
if prop_ident.sym == "test" {
|
||||
if let ast::Pat::Ident(binding_ident) = &decl.name {
|
||||
self.test_vars.insert(binding_ident.id.sym.to_string());
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ use deno_core::futures::FutureExt;
|
|||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::url;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::GraphImport;
|
||||
use deno_graph::Resolution;
|
||||
use deno_runtime::deno_node;
|
||||
|
@ -1073,7 +1074,10 @@ impl Documents {
|
|||
specifier: &str,
|
||||
referrer: &ModuleSpecifier,
|
||||
) -> bool {
|
||||
let maybe_specifier = self.get_resolver().resolve(specifier, referrer).ok();
|
||||
let maybe_specifier = self
|
||||
.get_resolver()
|
||||
.resolve(specifier, referrer, ResolutionMode::Types)
|
||||
.ok();
|
||||
if let Some(import_specifier) = maybe_specifier {
|
||||
self.exists(&import_specifier)
|
||||
} else {
|
||||
|
|
|
@ -479,12 +479,12 @@ impl Visit for TestCollector {
|
|||
ns_prop_ident: &ast::Ident,
|
||||
member_expr: &ast::MemberExpr,
|
||||
) {
|
||||
if ns_prop_ident.sym.to_string() == "test" {
|
||||
if ns_prop_ident.sym == "test" {
|
||||
let ast::Expr::Ident(ident) = member_expr.obj.as_ref() else {
|
||||
return;
|
||||
};
|
||||
|
||||
if ident.sym.to_string() != "Deno" {
|
||||
if ident.sym != "Deno" {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ impl Visit for TestCollector {
|
|||
match init.as_ref() {
|
||||
// Identify destructured assignments of `test` from `Deno`
|
||||
ast::Expr::Ident(ident) => {
|
||||
if ident.sym.to_string() != "Deno" {
|
||||
if ident.sym != "Deno" {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,7 @@ impl Visit for TestCollector {
|
|||
continue;
|
||||
};
|
||||
|
||||
if key_ident.sym.to_string() == "test" {
|
||||
if key_ident.sym == "test" {
|
||||
if let ast::Pat::Ident(value_ident) = &prop.value.as_ref() {
|
||||
self.vars.insert(value_ident.id.sym.to_string());
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ impl Visit for TestCollector {
|
|||
continue;
|
||||
};
|
||||
|
||||
if obj_ident.sym.to_string() != "Deno" {
|
||||
if obj_ident.sym != "Deno" {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -608,7 +608,7 @@ impl Visit for TestCollector {
|
|||
continue;
|
||||
};
|
||||
|
||||
if prop_ident.sym.to_string() != "test" {
|
||||
if prop_ident.sym != "test" {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ use deno_core::ModuleSpecifier;
|
|||
use deno_core::ModuleType;
|
||||
use deno_core::ResolutionKind;
|
||||
use deno_core::SourceMapGetter;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::source::Resolver;
|
||||
use deno_graph::EsmModule;
|
||||
use deno_graph::JsonModule;
|
||||
|
@ -549,7 +550,11 @@ impl ModuleLoader for CliModuleLoader {
|
|||
|
||||
// FIXME(bartlomieju): this is another hack way to provide NPM specifier
|
||||
// support in REPL. This should be fixed.
|
||||
let resolution = self.shared.resolver.resolve(specifier, &referrer);
|
||||
let resolution = self.shared.resolver.resolve(
|
||||
specifier,
|
||||
&referrer,
|
||||
ResolutionMode::Execution,
|
||||
);
|
||||
|
||||
if self.shared.is_repl {
|
||||
let specifier = resolution
|
||||
|
|
|
@ -8,6 +8,7 @@ use deno_core::futures::FutureExt;
|
|||
use deno_core::ModuleSpecifier;
|
||||
use deno_graph::source::NpmPackageReqResolution;
|
||||
use deno_graph::source::NpmResolver;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::source::ResolveError;
|
||||
use deno_graph::source::Resolver;
|
||||
use deno_graph::source::UnknownBuiltInNodeModuleError;
|
||||
|
@ -170,6 +171,7 @@ impl Resolver for CliGraphResolver {
|
|||
&self,
|
||||
specifier: &str,
|
||||
referrer: &ModuleSpecifier,
|
||||
_mode: ResolutionMode,
|
||||
) -> Result<ModuleSpecifier, ResolveError> {
|
||||
let result = match self
|
||||
.mapped_specifier_resolver
|
||||
|
|
|
@ -148,6 +148,7 @@ fn bundle_module_graph(
|
|||
deno_emit::bundle_graph(
|
||||
graph,
|
||||
deno_emit::BundleOptions {
|
||||
minify: false,
|
||||
bundle_type: deno_emit::BundleType::Module,
|
||||
emit_options: crate::args::ts_config_to_emit_options(
|
||||
ts_config_result.ts_config,
|
||||
|
|
|
@ -138,9 +138,10 @@ impl CoverageCollector {
|
|||
let filename = format!("{}.json", Uuid::new_v4());
|
||||
let filepath = self.dir.join(filename);
|
||||
|
||||
let mut out = BufWriter::new(File::create(filepath)?);
|
||||
let mut out = BufWriter::new(File::create(&filepath)?);
|
||||
let coverage = serde_json::to_string(&script_coverage)?;
|
||||
let formatted_coverage = format_json(&coverage, &Default::default())
|
||||
let formatted_coverage =
|
||||
format_json(&filepath, &coverage, &Default::default())
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap_or(coverage);
|
||||
|
|
|
@ -191,13 +191,13 @@ fn format_markdown(
|
|||
rest => rest,
|
||||
};
|
||||
|
||||
let fake_filename =
|
||||
PathBuf::from(format!("deno_fmt_stdin.{extension}"));
|
||||
if matches!(extension, "json" | "jsonc") {
|
||||
let mut json_config = get_resolved_json_config(fmt_options);
|
||||
json_config.line_width = line_width;
|
||||
dprint_plugin_json::format_text(text, &json_config)
|
||||
dprint_plugin_json::format_text(&fake_filename, text, &json_config)
|
||||
} else {
|
||||
let fake_filename =
|
||||
PathBuf::from(format!("deno_fmt_stdin.{extension}"));
|
||||
let mut codeblock_config =
|
||||
get_resolved_typescript_config(fmt_options);
|
||||
codeblock_config.line_width = line_width;
|
||||
|
@ -218,11 +218,12 @@ fn format_markdown(
|
|||
/// of configuration builder of <https://github.com/dprint/dprint-plugin-json>.
|
||||
/// See <https://github.com/dprint/dprint-plugin-json/blob/cfa1052dbfa0b54eb3d814318034cdc514c813d7/src/configuration/builder.rs#L87> for configuration.
|
||||
pub fn format_json(
|
||||
file_path: &Path,
|
||||
file_text: &str,
|
||||
fmt_options: &FmtOptionsConfig,
|
||||
) -> Result<Option<String>, AnyError> {
|
||||
let config = get_resolved_json_config(fmt_options);
|
||||
dprint_plugin_json::format_text(file_text, &config)
|
||||
dprint_plugin_json::format_text(file_path, file_text, &config)
|
||||
}
|
||||
|
||||
/// Formats a single TS, TSX, JS, JSX, JSONC, JSON, or MD file.
|
||||
|
@ -238,7 +239,7 @@ pub fn format_file(
|
|||
) {
|
||||
format_markdown(file_text, fmt_options)
|
||||
} else if matches!(ext.as_str(), "json" | "jsonc") {
|
||||
format_json(file_text, fmt_options)
|
||||
format_json(file_path, file_text, fmt_options)
|
||||
} else {
|
||||
let config = get_resolved_typescript_config(fmt_options);
|
||||
dprint_plugin_typescript::format_text(file_path, file_text, &config)
|
||||
|
|
|
@ -374,13 +374,13 @@ impl Highlighter for EditorHelper {
|
|||
}
|
||||
Word::Keyword(_) => colors::cyan(&line[range]).to_string(),
|
||||
Word::Ident(ident) => {
|
||||
if ident == *"undefined" {
|
||||
colors::gray(&line[range]).to_string()
|
||||
} else if ident == *"Infinity" || ident == *"NaN" {
|
||||
match ident.as_ref() {
|
||||
"undefined" => colors::gray(&line[range]).to_string(),
|
||||
"Infinity" | "NaN" => {
|
||||
colors::yellow(&line[range]).to_string()
|
||||
} else if ident == *"async" || ident == *"of" {
|
||||
colors::cyan(&line[range]).to_string()
|
||||
} else {
|
||||
}
|
||||
"async" | "of" => colors::cyan(&line[range]).to_string(),
|
||||
_ => {
|
||||
let next = lexed_items.peek().map(|item| &item.inner);
|
||||
if matches!(
|
||||
next,
|
||||
|
@ -389,10 +389,12 @@ impl Highlighter for EditorHelper {
|
|||
// We're looking for something that looks like a function
|
||||
// We use a simple heuristic: 'ident' followed by 'LParen'
|
||||
colors::intense_blue(&line[range]).to_string()
|
||||
} else if ident == *"from"
|
||||
} else if ident.as_ref() == "from"
|
||||
&& matches!(
|
||||
next,
|
||||
Some(deno_ast::TokenOrComment::Token(Token::Str { .. }))
|
||||
Some(deno_ast::TokenOrComment::Token(
|
||||
Token::Str { .. }
|
||||
))
|
||||
)
|
||||
{
|
||||
// When ident 'from' is followed by a string literal, highlight it
|
||||
|
@ -403,6 +405,7 @@ impl Highlighter for EditorHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => line[range].to_string(),
|
||||
},
|
||||
|
|
|
@ -32,6 +32,7 @@ use deno_core::serde_json;
|
|||
use deno_core::serde_json::Value;
|
||||
use deno_core::unsync::spawn;
|
||||
use deno_core::LocalInspectorSession;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::source::Resolver;
|
||||
use deno_runtime::worker::MainWorker;
|
||||
use deno_semver::npm::NpmPackageReqReference;
|
||||
|
@ -572,7 +573,7 @@ impl ReplSession {
|
|||
.flat_map(|i| {
|
||||
self
|
||||
.resolver
|
||||
.resolve(i, &self.referrer)
|
||||
.resolve(i, &self.referrer, ResolutionMode::Execution)
|
||||
.ok()
|
||||
.or_else(|| ModuleSpecifier::parse(i).ok())
|
||||
})
|
||||
|
|
9
cli/tools/vendor/build.rs
vendored
9
cli/tools/vendor/build.rs
vendored
|
@ -11,6 +11,7 @@ use deno_core::anyhow::Context;
|
|||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::future::LocalBoxFuture;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::EsmModule;
|
||||
use deno_graph::Module;
|
||||
use deno_graph::ModuleGraph;
|
||||
|
@ -111,9 +112,11 @@ pub async fn build<
|
|||
// add the jsx import source to the entry points to ensure it is always vendored
|
||||
if let Some(jsx_import_source) = jsx_import_source {
|
||||
if let Some(specifier_text) = jsx_import_source.maybe_specifier_text() {
|
||||
if let Ok(specifier) =
|
||||
resolver.resolve(&specifier_text, &jsx_import_source.base_url)
|
||||
{
|
||||
if let Ok(specifier) = resolver.resolve(
|
||||
&specifier_text,
|
||||
&jsx_import_source.base_url,
|
||||
ResolutionMode::Execution,
|
||||
) {
|
||||
entry_points.push(specifier);
|
||||
}
|
||||
}
|
||||
|
|
9
cli/tools/vendor/import_map.rs
vendored
9
cli/tools/vendor/import_map.rs
vendored
|
@ -4,6 +4,7 @@ use deno_ast::LineAndColumnIndex;
|
|||
use deno_ast::ModuleSpecifier;
|
||||
use deno_ast::SourceTextInfo;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_graph::source::ResolutionMode;
|
||||
use deno_graph::Module;
|
||||
use deno_graph::ModuleGraph;
|
||||
use deno_graph::Position;
|
||||
|
@ -213,9 +214,11 @@ pub fn build_import_map(
|
|||
// add the jsx import source to the destination import map, if mapped in the original import map
|
||||
if let Some(jsx_import_source) = jsx_import_source {
|
||||
if let Some(specifier_text) = jsx_import_source.maybe_specifier_text() {
|
||||
if let Ok(resolved_url) =
|
||||
resolver.resolve(&specifier_text, &jsx_import_source.base_url)
|
||||
{
|
||||
if let Ok(resolved_url) = resolver.resolve(
|
||||
&specifier_text,
|
||||
&jsx_import_source.base_url,
|
||||
ResolutionMode::Execution,
|
||||
) {
|
||||
builder.imports.add(specifier_text, &resolved_url);
|
||||
}
|
||||
}
|
||||
|
|
2
cli/tools/vendor/mod.rs
vendored
2
cli/tools/vendor/mod.rs
vendored
|
@ -355,7 +355,7 @@ fn update_config_text(
|
|||
|
||||
let new_text = deno_ast::apply_text_changes(text, text_changes);
|
||||
modified_result.new_text = if should_format {
|
||||
format_json(&new_text, fmt_options)
|
||||
format_json(&PathBuf::from("deno.json"), &new_text, fmt_options)
|
||||
.ok()
|
||||
.map(|formatted_text| formatted_text.unwrap_or(new_text))
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue