mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat: support import attributes (#20342)
This commit is contained in:
parent
01a761f1d4
commit
3fc19dab47
61 changed files with 434 additions and 225 deletions
|
@ -35,7 +35,7 @@
|
|||
"cli/tests/testdata/fmt/",
|
||||
"cli/tests/testdata/lint/glob/",
|
||||
"cli/tests/testdata/test/glob/",
|
||||
"cli/tests/testdata/import_assertions/json_with_shebang.json",
|
||||
"cli/tests/testdata/import_attributes/json_with_shebang.json",
|
||||
"cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs",
|
||||
"cli/tests/testdata/run/inline_js_source_map*",
|
||||
"cli/tests/testdata/malformed_config/",
|
||||
|
@ -55,7 +55,7 @@
|
|||
"ext/websocket/autobahn/reports"
|
||||
],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/typescript-0.86.2.wasm",
|
||||
"https://plugins.dprint.dev/typescript-0.87.1.wasm",
|
||||
"https://plugins.dprint.dev/json-0.17.4.wasm",
|
||||
"https://plugins.dprint.dev/markdown-0.16.0.wasm",
|
||||
"https://plugins.dprint.dev/toml-0.5.4.wasm",
|
||||
|
|
133
Cargo.lock
generated
133
Cargo.lock
generated
|
@ -823,12 +823,6 @@ version = "2.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
|
||||
[[package]]
|
||||
name = "data-url"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
|
||||
|
||||
[[package]]
|
||||
name = "data-url"
|
||||
version = "0.3.0"
|
||||
|
@ -859,7 +853,7 @@ dependencies = [
|
|||
"clap_complete",
|
||||
"clap_complete_fig",
|
||||
"console_static_text",
|
||||
"data-url 0.3.0",
|
||||
"data-url",
|
||||
"deno_ast",
|
||||
"deno_bench_util",
|
||||
"deno_cache_dir",
|
||||
|
@ -964,9 +958,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_ast"
|
||||
version = "0.28.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00c93119b1c487a85603406a988a0ca9a1d0e5315404cccc5c158fb484b1f5a2"
|
||||
checksum = "e8bb902bcaa072210ca7b2f28c391f77bb16f6ef64664331c5d928d99943303c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.1",
|
||||
|
@ -1036,9 +1030,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_cache_dir"
|
||||
version = "0.5.2"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85e4ee308992ed5bd4977d251c0ce4bdfa4cc59efa4ee93d17ebe46eae1e4563"
|
||||
checksum = "026d622a8251c427bdb506798b003926b059640a247d524e1f773751cce9f0bf"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_media_type",
|
||||
|
@ -1141,9 +1135,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_doc"
|
||||
version = "0.65.0"
|
||||
version = "0.66.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10bb7c24a702ae82d8eaee95a325a9853b951dd0e01bb4950dd427e61e4fd0fe"
|
||||
checksum = "4cc42f49e0aa338e438f59b8367c0ca73c789e9321bd6e1ee086d57733826190"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"deno_ast",
|
||||
|
@ -1159,9 +1153,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_emit"
|
||||
version = "0.26.0"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10663feb7be359aa447e7be4bc76a25a2d470fc9dfa8cd1b09a0a3916e0586e0"
|
||||
checksum = "ae90c86c7cd7b828bc8503703dc06fa750a2f49ce7ae78968c04f91b244a6f31"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.1",
|
||||
|
@ -1179,7 +1173,7 @@ name = "deno_fetch"
|
|||
version = "0.142.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"data-url 0.3.0",
|
||||
"data-url",
|
||||
"deno_core",
|
||||
"deno_tls",
|
||||
"dyn-clone",
|
||||
|
@ -1226,16 +1220,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_graph"
|
||||
version = "0.52.0"
|
||||
version = "0.54.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6acc743895f5e83c985d632998e58af1395c862b28acabd3d290540ef4d57354"
|
||||
checksum = "dcb7464fab13748a26407d0250ab3fb412a88d8b95c30b8a96aa5d49c79d4ee6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"data-url 0.2.0",
|
||||
"async-trait",
|
||||
"data-url",
|
||||
"deno_ast",
|
||||
"deno_semver",
|
||||
"futures",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.0.0",
|
||||
"monch",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.1",
|
||||
|
@ -1323,9 +1318,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_lint"
|
||||
version = "0.50.2"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53f9885a21010c312e84bc6f276a4c97047c3c734bde5f71cb4a71e8121fbe74"
|
||||
checksum = "15d1ec49429172b9ae411848038ef41eb06ef7b5902ebd3c0e8d6b9f74c15468"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_ast",
|
||||
|
@ -1356,7 +1351,7 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a798670c20308e5770cc0775de821424ff9e85665b602928509c8c70430b3ee0"
|
||||
dependencies = [
|
||||
"data-url 0.3.0",
|
||||
"data-url",
|
||||
"serde",
|
||||
"url",
|
||||
]
|
||||
|
@ -1820,9 +1815,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dprint-plugin-typescript"
|
||||
version = "0.86.2"
|
||||
version = "0.87.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "384b423bfa289e57a0fab8eadc5ced6a0890ccc3570258daf4a12b1d0412cfb9"
|
||||
checksum = "c6be002070326615a3faf423ad398dac631fc5e3289ff7a6ea5bfe2919c21ad6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_ast",
|
||||
|
@ -1833,9 +1828,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dprint-swc-ext"
|
||||
version = "0.11.1"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f115ea5b6f5d0d02a25a9364f41b8c4f857452c299309dcfd29a694724d0566"
|
||||
checksum = "6a0a2492465344a58a37ae119de59e81fe5a2885f2711c7b5048ef0dfa14ce42"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"num-bigint",
|
||||
|
@ -2078,9 +2073,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "eszip"
|
||||
version = "0.50.1"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96c51f197ceba98354cd4bf2db99db68c082e531685c634cea3453fbbcb071ba"
|
||||
checksum = "15bfd903f4d76ae830b12b5b159d38d8def03e21be1bb93ad631d522b1191573"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.2",
|
||||
|
@ -3144,9 +3139,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
version = "2.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
|
@ -4911,9 +4906,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
|||
|
||||
[[package]]
|
||||
name = "swc_atoms"
|
||||
version = "0.5.8"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8066e17abb484602da673e2d35138ab32ce53f26368d9c92113510e1659220b"
|
||||
checksum = "9f54563d7dcba626d4acfe14ed12def7ecc28e004debe3ecd2c3ee07cc47e449"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
|
@ -4925,9 +4920,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_bundler"
|
||||
version = "0.217.49"
|
||||
version = "0.219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce78d316b33559330cb4348144bbd03181369aa62049f540d792c220ed389570"
|
||||
checksum = "421cc659acd7807306c5a422eb95d09c20975464fe3ad5004e1e62ee2a6fc304"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crc",
|
||||
|
@ -4955,9 +4950,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_common"
|
||||
version = "0.31.21"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de5823ef063f116ad281cde9700f5be6dfb182e543ce3f62c42cee1c03ffbc6b"
|
||||
checksum = "39cb7fcd56655c8ae7dcf2344f0be6cbff4d9c7cb401fe3ec8e56e1de8dfe582"
|
||||
dependencies = [
|
||||
"ast_node",
|
||||
"better_scoped_tls",
|
||||
|
@ -5007,9 +5002,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_ast"
|
||||
version = "0.107.7"
|
||||
version = "0.109.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7191c8c57af059b75a2aadc927a2608c3962d19e4d09ce8f9c3f03739ddf833"
|
||||
checksum = "7bc2286cedd688a68f214faa1c19bb5cceab7c9c54d0cbe3273e4c1704e38f69"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"is-macro",
|
||||
|
@ -5024,9 +5019,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_codegen"
|
||||
version = "0.142.17"
|
||||
version = "0.144.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e4e3ee8a1f0bfaf630febbe0f6a03f2c28d66d373a9bbdb3f500f6bfb536b43"
|
||||
checksum = "8e62ba2c0ed1f119fc1a76542d007f1b2c12854d54dea15f5491363227debe11"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
|
@ -5056,9 +5051,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_dep_graph"
|
||||
version = "0.109.15"
|
||||
version = "0.111.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1295557b5960eb97ec63fc2008be0a101d1ff7d2163a1031b3d31d3c898d5bb3"
|
||||
checksum = "c5526adf6a434f145c8caf7e3a2dba554a2ad09b84467b6a62210f9ef0af0f71"
|
||||
dependencies = [
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -5068,9 +5063,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_loader"
|
||||
version = "0.43.23"
|
||||
version = "0.44.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82f47bb1ab686f603da93a8b6e559d69b42369ab47d5dee6bdda38ae5902dc2a"
|
||||
checksum = "e7d7c322462657ae27ac090a2c89f7e456c94416284a2f5ecf66c43a6a3c19d1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"pathdiff",
|
||||
|
@ -5081,9 +5076,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_parser"
|
||||
version = "0.137.15"
|
||||
version = "0.139.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29c0d554865a63bfa58cf1c433fa91d7d4adf40030fa8e4530e8065d0578166a"
|
||||
checksum = "3eab46cb863bc5cd61535464e07e5b74d5f792fa26a27b9f6fd4c8daca9903b7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"num-bigint",
|
||||
|
@ -5101,9 +5096,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.130.24"
|
||||
version = "0.132.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8d8ca5dd849cea79e6a9792d725f4082ad3ade7a9541fba960c42d55ae778f2"
|
||||
checksum = "01ffd4a8149052bfc1ec1832fcbe04f317846ce635a49ec438df33b06db27d26"
|
||||
dependencies = [
|
||||
"better_scoped_tls",
|
||||
"bitflags 2.4.0",
|
||||
|
@ -5124,9 +5119,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_classes"
|
||||
version = "0.119.24"
|
||||
version = "0.121.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a09d0e350963d4fb14bf9dc31c85eb28e58a88614e779c75f49296710f9cb381"
|
||||
checksum = "f4b7fee0e2c6f12456d2aefb2418f2f26529b995945d493e1dce35a5a22584fc"
|
||||
dependencies = [
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -5138,9 +5133,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_macros"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f59c4b6ed5d78d3ad9fc7c6f8ab4f85bba99573d31d9a2c0a712077a6b45efd2"
|
||||
checksum = "8188eab297da773836ef5cf2af03ee5cca7a563e1be4b146f8141452c28cc690"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.66",
|
||||
|
@ -5151,9 +5146,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_optimization"
|
||||
version = "0.190.38"
|
||||
version = "0.192.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93c2801884a19a5d35dd6ac6f7e7a3147502325337f3f7fd11cda7c7b4202007"
|
||||
checksum = "880fd2a588ac88a61cd1d21b10203bbabe31d7adacbd22de3bb4d702bf2c42b4"
|
||||
dependencies = [
|
||||
"dashmap",
|
||||
"indexmap 1.9.3",
|
||||
|
@ -5175,9 +5170,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_proposal"
|
||||
version = "0.164.30"
|
||||
version = "0.166.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62d3a04de35f6c79d8f343822138e7313934d3530cc4e4f891a079f7e2415c1a"
|
||||
checksum = "122fd9a69f464694edefbf9c59106b3c15e5cc8cb8575a97836e4fb79018e98f"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rustc-hash",
|
||||
|
@ -5195,9 +5190,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_react"
|
||||
version = "0.176.34"
|
||||
version = "0.178.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "607017e6fbfe3229b69ffce7b47383eb9b62025ea93a50cd1cc1788d2a29a4ca"
|
||||
checksum = "675b5c755b0448268830e85e59429095d3423c0ce4a850b209c6f0eeab069f63"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"dashmap",
|
||||
|
@ -5219,9 +5214,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_typescript"
|
||||
version = "0.180.33"
|
||||
version = "0.182.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea349e787a62af0dcf1b8b52d507045345871571c18cb78a2f892912f7d6b753"
|
||||
checksum = "4eba97b1ea71739fcf278aedad4677a3cacb52288a3f3566191b70d16a889de6"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"swc_atoms",
|
||||
|
@ -5235,9 +5230,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_utils"
|
||||
version = "0.120.19"
|
||||
version = "0.122.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cb60e20e1eb9e9f7c88d99ac8659fd0561d70abd27853f550fbd907a448c878"
|
||||
checksum = "11006a3398ffd4693c4d3b0a1b1a5030edbdc04228159f5301120a6178144708"
|
||||
dependencies = [
|
||||
"indexmap 1.9.3",
|
||||
"num_cpus",
|
||||
|
@ -5253,9 +5248,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_visit"
|
||||
version = "0.93.7"
|
||||
version = "0.95.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb23a48abd9f5731b6275dbf4ea89f6e03dc60b7c8e3e1e383bb4a6c39fd7e25"
|
||||
checksum = "0f628ec196e76e67892441e14eef2e423a738543d32bffdabfeec20c29582117"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"swc_atoms",
|
||||
|
@ -5279,9 +5274,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_fast_graph"
|
||||
version = "0.19.21"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b07b6c9a4d1659b7e6826fb384b3994b47c5ac35cb76a98a15ca483dd0a5d7b7"
|
||||
checksum = "a407fff2eb5ce3bee7513bdd9531a7be0285bc1213500b6d98ad235428d94cce"
|
||||
dependencies = [
|
||||
"indexmap 1.9.3",
|
||||
"petgraph",
|
||||
|
@ -5291,9 +5286,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_graph_analyzer"
|
||||
version = "0.20.24"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2126bce41c5c755f649bc5fc74fbd5e1ea01306acbf26b49f8aab2bd53f8025f"
|
||||
checksum = "90b996222612382d0d297d0315f5eedc5a830c37e62476c69774884633d31177"
|
||||
dependencies = [
|
||||
"auto_impl 1.1.0",
|
||||
"petgraph",
|
||||
|
|
|
@ -38,7 +38,7 @@ license = "MIT"
|
|||
repository = "https://github.com/denoland/deno"
|
||||
|
||||
[workspace.dependencies]
|
||||
deno_ast = { version = "0.28.0", features = ["transpiling"] }
|
||||
deno_ast = { version = "0.29.1", features = ["transpiling"] }
|
||||
|
||||
deno_core = { version = "0.208.0" }
|
||||
|
||||
|
|
|
@ -46,19 +46,19 @@ winres.workspace = true
|
|||
|
||||
[dependencies]
|
||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||
deno_cache_dir = "=0.5.2"
|
||||
deno_cache_dir = "=0.6.0"
|
||||
deno_config = "=0.2.4"
|
||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_doc = "=0.65.0"
|
||||
deno_emit = "=0.26.0"
|
||||
deno_graph = "=0.52.0"
|
||||
deno_lint = { version = "=0.50.2", features = ["docs"] }
|
||||
deno_doc = "=0.66.0"
|
||||
deno_emit = "=0.27.0"
|
||||
deno_graph = "=0.54.0"
|
||||
deno_lint = { version = "=0.51.0", features = ["docs"] }
|
||||
deno_lockfile.workspace = true
|
||||
deno_npm.workspace = true
|
||||
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] }
|
||||
deno_semver.workspace = true
|
||||
deno_task_shell = "=0.13.2"
|
||||
eszip = "=0.50.1"
|
||||
eszip = "=0.51.0"
|
||||
napi_sym.workspace = true
|
||||
|
||||
async-trait.workspace = true
|
||||
|
@ -75,7 +75,7 @@ data-url.workspace = true
|
|||
dissimilar = "=1.0.4"
|
||||
dprint-plugin-json = "=0.17.4"
|
||||
dprint-plugin-markdown = "=0.16.0"
|
||||
dprint-plugin-typescript = "=0.86.2"
|
||||
dprint-plugin-typescript = "=0.87.1"
|
||||
encoding_rs.workspace = true
|
||||
env_logger = "=0.10.0"
|
||||
fancy-regex = "=0.10.0"
|
||||
|
|
|
@ -7,7 +7,6 @@ Deno.bench("date_now", { n: 5e5 }, () => {
|
|||
|
||||
// Fast API calls
|
||||
{
|
||||
// deno-lint-ignore camelcase
|
||||
const { op_add } = Deno[Deno.internal].core.ops;
|
||||
// deno-lint-ignore no-inner-declarations
|
||||
function add(a, b) {
|
||||
|
@ -21,7 +20,6 @@ Deno.bench("date_now", { n: 5e5 }, () => {
|
|||
Deno.bench("add_js", () => addJS(1, 2));
|
||||
}
|
||||
|
||||
// deno-lint-ignore camelcase
|
||||
const { op_void_sync } = Deno[Deno.internal].core.ops;
|
||||
function sync() {
|
||||
return op_void_sync();
|
||||
|
|
75
cli/cache/mod.rs
vendored
75
cli/cache/mod.rs
vendored
|
@ -1,17 +1,22 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::args::CacheSetting;
|
||||
use crate::errors::get_error_class_name;
|
||||
use crate::file_fetcher::FetchOptions;
|
||||
use crate::file_fetcher::FileFetcher;
|
||||
use crate::util::fs::atomic_write_file;
|
||||
|
||||
use deno_ast::MediaType;
|
||||
use deno_core::futures;
|
||||
use deno_core::futures::FutureExt;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_graph::source::CacheInfo;
|
||||
use deno_graph::source::LoadFuture;
|
||||
use deno_graph::source::LoadResponse;
|
||||
use deno_graph::source::Loader;
|
||||
use deno_runtime::permissions::PermissionsContainer;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
@ -96,6 +101,7 @@ pub struct FetchCacher {
|
|||
file_fetcher: Arc<FileFetcher>,
|
||||
file_header_overrides: HashMap<ModuleSpecifier, HashMap<String, String>>,
|
||||
global_http_cache: Arc<GlobalHttpCache>,
|
||||
parsed_source_cache: Arc<ParsedSourceCache>,
|
||||
permissions: PermissionsContainer,
|
||||
cache_info_enabled: bool,
|
||||
maybe_local_node_modules_url: Option<ModuleSpecifier>,
|
||||
|
@ -107,6 +113,7 @@ impl FetchCacher {
|
|||
file_fetcher: Arc<FileFetcher>,
|
||||
file_header_overrides: HashMap<ModuleSpecifier, HashMap<String, String>>,
|
||||
global_http_cache: Arc<GlobalHttpCache>,
|
||||
parsed_source_cache: Arc<ParsedSourceCache>,
|
||||
permissions: PermissionsContainer,
|
||||
maybe_local_node_modules_url: Option<ModuleSpecifier>,
|
||||
) -> Self {
|
||||
|
@ -115,6 +122,7 @@ impl FetchCacher {
|
|||
file_fetcher,
|
||||
file_header_overrides,
|
||||
global_http_cache,
|
||||
parsed_source_cache,
|
||||
permissions,
|
||||
cache_info_enabled: false,
|
||||
maybe_local_node_modules_url,
|
||||
|
@ -153,7 +161,29 @@ impl FetchCacher {
|
|||
}
|
||||
}
|
||||
|
||||
static DENO_REGISTRY_URL: Lazy<Url> = Lazy::new(|| {
|
||||
let env_var_name = "DENO_REGISTRY_URL";
|
||||
if let Ok(registry_url) = std::env::var(env_var_name) {
|
||||
// ensure there is a trailing slash for the directory
|
||||
let registry_url = format!("{}/", registry_url.trim_end_matches('/'));
|
||||
match Url::parse(®istry_url) {
|
||||
Ok(url) => {
|
||||
return url;
|
||||
}
|
||||
Err(err) => {
|
||||
log::debug!("Invalid {} environment variable: {:#}", env_var_name, err,);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deno_graph::source::DEFAULT_DENO_REGISTRY_URL.clone()
|
||||
});
|
||||
|
||||
impl Loader for FetchCacher {
|
||||
fn registry_url(&self) -> &Url {
|
||||
&DENO_REGISTRY_URL
|
||||
}
|
||||
|
||||
fn get_cache_info(&self, specifier: &ModuleSpecifier) -> Option<CacheInfo> {
|
||||
if !self.cache_info_enabled {
|
||||
return None;
|
||||
|
@ -180,7 +210,10 @@ impl Loader for FetchCacher {
|
|||
&mut self,
|
||||
specifier: &ModuleSpecifier,
|
||||
_is_dynamic: bool,
|
||||
cache_setting: deno_graph::source::CacheSetting,
|
||||
) -> LoadFuture {
|
||||
use deno_graph::source::CacheSetting as LoaderCacheSetting;
|
||||
|
||||
if let Some(node_modules_url) = self.maybe_local_node_modules_url.as_ref() {
|
||||
// The specifier might be in a completely different symlinked tree than
|
||||
// what the resolved node_modules_url is in (ex. `/my-project-1/node_modules`
|
||||
|
@ -198,14 +231,31 @@ impl Loader for FetchCacher {
|
|||
}
|
||||
}
|
||||
|
||||
let permissions = self.permissions.clone();
|
||||
let file_fetcher = self.file_fetcher.clone();
|
||||
let file_header_overrides = self.file_header_overrides.clone();
|
||||
let permissions = self.permissions.clone();
|
||||
let specifier = specifier.clone();
|
||||
|
||||
async move {
|
||||
let maybe_cache_setting = match cache_setting {
|
||||
LoaderCacheSetting::Use => None,
|
||||
LoaderCacheSetting::Reload => {
|
||||
if matches!(file_fetcher.cache_setting(), CacheSetting::Only) {
|
||||
return Err(deno_core::anyhow::anyhow!(
|
||||
"Failed to resolve version constraint. Try running again without --cached-only"
|
||||
));
|
||||
}
|
||||
Some(CacheSetting::ReloadAll)
|
||||
}
|
||||
LoaderCacheSetting::Only => Some(CacheSetting::Only),
|
||||
};
|
||||
file_fetcher
|
||||
.fetch(&specifier, permissions)
|
||||
.fetch_with_options(FetchOptions {
|
||||
specifier: &specifier,
|
||||
permissions,
|
||||
maybe_accept: None,
|
||||
maybe_cache_setting: maybe_cache_setting.as_ref(),
|
||||
})
|
||||
.await
|
||||
.map(|file| {
|
||||
let maybe_headers =
|
||||
|
@ -236,4 +286,25 @@ impl Loader for FetchCacher {
|
|||
}
|
||||
.boxed()
|
||||
}
|
||||
|
||||
fn cache_module_info(
|
||||
&mut self,
|
||||
specifier: &ModuleSpecifier,
|
||||
source: &str,
|
||||
module_info: &deno_graph::ModuleInfo,
|
||||
) {
|
||||
let result = self.parsed_source_cache.cache_module_info(
|
||||
specifier,
|
||||
MediaType::from_specifier(specifier),
|
||||
source,
|
||||
module_info,
|
||||
);
|
||||
if let Err(err) = result {
|
||||
log::debug!(
|
||||
"Error saving module cache info for {}. {:#}",
|
||||
specifier,
|
||||
err
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
cli/cache/parsed_source.rs
vendored
12
cli/cache/parsed_source.rs
vendored
|
@ -135,6 +135,18 @@ impl ParsedSourceCache {
|
|||
pub fn as_capturing_parser(&self) -> CapturingModuleParser {
|
||||
CapturingModuleParser::new(None, &self.sources)
|
||||
}
|
||||
|
||||
pub fn cache_module_info(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
media_type: MediaType,
|
||||
source: &str,
|
||||
module_info: &ModuleInfo,
|
||||
) -> Result<(), AnyError> {
|
||||
let source_hash = compute_source_hash(source.as_bytes());
|
||||
ParsedSourceCacheModuleAnalyzer::new(self.db.clone(), self.sources.clone())
|
||||
.set_module_info(specifier, media_type, &source_hash, module_info)
|
||||
}
|
||||
}
|
||||
|
||||
struct ParsedSourceCacheModuleAnalyzer {
|
||||
|
|
|
@ -31,10 +31,11 @@ fn get_module_graph_error_class(err: &ModuleGraphError) -> &'static str {
|
|||
ModuleError::InvalidTypeAssertion { .. } => "SyntaxError",
|
||||
ModuleError::ParseErr(_, diagnostic) => get_diagnostic_class(diagnostic),
|
||||
ModuleError::UnsupportedMediaType { .. }
|
||||
| ModuleError::UnsupportedImportAssertionType { .. } => "TypeError",
|
||||
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
|
||||
"NotFound"
|
||||
}
|
||||
| ModuleError::UnsupportedImportAttributeType { .. } => "TypeError",
|
||||
ModuleError::Missing(_, _)
|
||||
| ModuleError::MissingDynamic(_, _)
|
||||
| ModuleError::UnknownPackage { .. }
|
||||
| ModuleError::UnknownPackageReq { .. } => "NotFound",
|
||||
},
|
||||
ModuleGraphError::ResolutionError(err) => get_resolution_error_class(err),
|
||||
}
|
||||
|
|
|
@ -163,6 +163,13 @@ pub fn map_content_type(
|
|||
}
|
||||
}
|
||||
|
||||
pub struct FetchOptions<'a> {
|
||||
pub specifier: &'a ModuleSpecifier,
|
||||
pub permissions: PermissionsContainer,
|
||||
pub maybe_accept: Option<&'a str>,
|
||||
pub maybe_cache_setting: Option<&'a CacheSetting>,
|
||||
}
|
||||
|
||||
/// A structure for resolving, fetching and caching source files.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FileFetcher {
|
||||
|
@ -199,6 +206,10 @@ impl FileFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn cache_setting(&self) -> &CacheSetting {
|
||||
&self.cache_setting
|
||||
}
|
||||
|
||||
/// Sets the log level to use when outputting the download message.
|
||||
pub fn set_download_log_level(&mut self, level: log::Level) {
|
||||
self.download_log_level = level;
|
||||
|
@ -328,6 +339,7 @@ impl FileFetcher {
|
|||
permissions: PermissionsContainer,
|
||||
redirect_limit: i64,
|
||||
maybe_accept: Option<String>,
|
||||
cache_setting: &CacheSetting,
|
||||
) -> Pin<Box<dyn Future<Output = Result<File, AnyError>> + Send>> {
|
||||
debug!("FileFetcher::fetch_remote() - specifier: {}", specifier);
|
||||
if redirect_limit < 0 {
|
||||
|
@ -339,7 +351,7 @@ impl FileFetcher {
|
|||
return futures::future::err(err).boxed();
|
||||
}
|
||||
|
||||
if self.should_use_cache(specifier) {
|
||||
if self.should_use_cache(specifier, cache_setting) {
|
||||
match self.fetch_cached(specifier, redirect_limit) {
|
||||
Ok(Some(file)) => {
|
||||
return futures::future::ok(file).boxed();
|
||||
|
@ -351,7 +363,7 @@ impl FileFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
if self.cache_setting == CacheSetting::Only {
|
||||
if *cache_setting == CacheSetting::Only {
|
||||
return futures::future::err(custom_error(
|
||||
"NotCached",
|
||||
format!(
|
||||
|
@ -383,6 +395,7 @@ impl FileFetcher {
|
|||
let specifier = specifier.clone();
|
||||
let client = self.http_client.clone();
|
||||
let file_fetcher = self.clone();
|
||||
let cache_setting = cache_setting.clone();
|
||||
// A single pass of fetch either yields code or yields a redirect, server
|
||||
// error causes a single retry to avoid crashing hard on intermittent failures.
|
||||
|
||||
|
@ -432,6 +445,7 @@ impl FileFetcher {
|
|||
permissions,
|
||||
redirect_limit - 1,
|
||||
maybe_accept,
|
||||
&cache_setting,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
@ -468,8 +482,12 @@ impl FileFetcher {
|
|||
}
|
||||
|
||||
/// Returns if the cache should be used for a given specifier.
|
||||
fn should_use_cache(&self, specifier: &ModuleSpecifier) -> bool {
|
||||
match &self.cache_setting {
|
||||
fn should_use_cache(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
cache_setting: &CacheSetting,
|
||||
) -> bool {
|
||||
match cache_setting {
|
||||
CacheSetting::ReloadAll => false,
|
||||
CacheSetting::Use | CacheSetting::Only => true,
|
||||
CacheSetting::RespectHeaders => {
|
||||
|
@ -514,18 +532,24 @@ impl FileFetcher {
|
|||
specifier: &ModuleSpecifier,
|
||||
permissions: PermissionsContainer,
|
||||
) -> Result<File, AnyError> {
|
||||
debug!("FileFetcher::fetch() - specifier: {}", specifier);
|
||||
self.fetch_with_accept(specifier, permissions, None).await
|
||||
self
|
||||
.fetch_with_options(FetchOptions {
|
||||
specifier,
|
||||
permissions,
|
||||
maybe_accept: None,
|
||||
maybe_cache_setting: None,
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn fetch_with_accept(
|
||||
pub async fn fetch_with_options(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
permissions: PermissionsContainer,
|
||||
maybe_accept: Option<&str>,
|
||||
options: FetchOptions<'_>,
|
||||
) -> Result<File, AnyError> {
|
||||
let specifier = options.specifier;
|
||||
debug!("FileFetcher::fetch() - specifier: {}", specifier);
|
||||
let scheme = get_validated_scheme(specifier)?;
|
||||
permissions.check_specifier(specifier)?;
|
||||
options.permissions.check_specifier(specifier)?;
|
||||
if let Some(file) = self.cache.get(specifier) {
|
||||
Ok(file)
|
||||
} else if scheme == "file" {
|
||||
|
@ -545,9 +569,10 @@ impl FileFetcher {
|
|||
let result = self
|
||||
.fetch_remote(
|
||||
specifier,
|
||||
permissions,
|
||||
options.permissions,
|
||||
10,
|
||||
maybe_accept.map(String::from),
|
||||
options.maybe_accept.map(String::from),
|
||||
options.maybe_cache_setting.unwrap_or(&self.cache_setting),
|
||||
)
|
||||
.await;
|
||||
if let Ok(file) = &result {
|
||||
|
@ -764,7 +789,13 @@ mod tests {
|
|||
let _http_server_guard = test_util::http_server();
|
||||
let (file_fetcher, _) = setup(CacheSetting::ReloadAll, None);
|
||||
let result: Result<File, AnyError> = file_fetcher
|
||||
.fetch_remote(specifier, PermissionsContainer::allow_all(), 1, None)
|
||||
.fetch_remote(
|
||||
specifier,
|
||||
PermissionsContainer::allow_all(),
|
||||
1,
|
||||
None,
|
||||
&file_fetcher.cache_setting,
|
||||
)
|
||||
.await;
|
||||
let cache_key = file_fetcher.http_cache.cache_item_key(specifier).unwrap();
|
||||
(
|
||||
|
@ -1452,12 +1483,24 @@ mod tests {
|
|||
.unwrap();
|
||||
|
||||
let result = file_fetcher
|
||||
.fetch_remote(&specifier, PermissionsContainer::allow_all(), 2, None)
|
||||
.fetch_remote(
|
||||
&specifier,
|
||||
PermissionsContainer::allow_all(),
|
||||
2,
|
||||
None,
|
||||
&file_fetcher.cache_setting,
|
||||
)
|
||||
.await;
|
||||
assert!(result.is_ok());
|
||||
|
||||
let result = file_fetcher
|
||||
.fetch_remote(&specifier, PermissionsContainer::allow_all(), 1, None)
|
||||
.fetch_remote(
|
||||
&specifier,
|
||||
PermissionsContainer::allow_all(),
|
||||
1,
|
||||
None,
|
||||
&file_fetcher.cache_setting,
|
||||
)
|
||||
.await;
|
||||
assert!(result.is_err());
|
||||
|
||||
|
|
|
@ -237,6 +237,8 @@ impl ModuleGraphBuilder {
|
|||
npm_resolver: Some(graph_npm_resolver),
|
||||
module_analyzer: Some(&*analyzer),
|
||||
reporter: maybe_file_watcher_reporter,
|
||||
// todo(dsherret): workspace support
|
||||
workspace_members: vec![],
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
@ -280,6 +282,8 @@ impl ModuleGraphBuilder {
|
|||
npm_resolver: Some(graph_npm_resolver),
|
||||
module_analyzer: Some(&*analyzer),
|
||||
reporter: maybe_file_watcher_reporter,
|
||||
// todo(dsherret): workspace support
|
||||
workspace_members: vec![],
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
@ -338,15 +342,35 @@ impl ModuleGraphBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
// todo(dsherret): uncomment when adding deno: specifier support
|
||||
// add the deno specifiers to the graph if it's the first time executing
|
||||
// if graph.deno_specifiers.is_empty() {
|
||||
// if let Some(lockfile) = &self.lockfile {
|
||||
// let lockfile = lockfile.lock();
|
||||
// for (key, value) in &lockfile.content.packages.specifiers {
|
||||
// if let Some(key) = key
|
||||
// .strip_prefix("deno:")
|
||||
// .and_then(|key| PackageReq::from_str(key))
|
||||
// {
|
||||
// if let Ok(value) = value
|
||||
// .strip_prefix("deno:")
|
||||
// .and_then(|value| PackageNv::from_str(value))
|
||||
// {
|
||||
// graph.deno_specifiers.add(key, value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
graph.build(roots, loader, options).await;
|
||||
|
||||
// add the redirects in the graph to the lockfile
|
||||
if !graph.redirects.is_empty() {
|
||||
if let Some(lockfile) = &self.lockfile {
|
||||
let graph_redirects = graph
|
||||
.redirects
|
||||
.iter()
|
||||
.filter(|(from, _)| !matches!(from.scheme(), "npm" | "file"));
|
||||
let graph_redirects = graph.redirects.iter().filter(|(from, _)| {
|
||||
!matches!(from.scheme(), "npm" | "file" | "deno")
|
||||
});
|
||||
let mut lockfile = lockfile.lock();
|
||||
for (from, to) in graph_redirects {
|
||||
lockfile.insert_redirect(from.to_string(), to.to_string());
|
||||
|
@ -354,6 +378,21 @@ impl ModuleGraphBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
// todo(dsherret): uncomment when adding support for deno specifiers
|
||||
// add the deno specifiers in the graph to the lockfile
|
||||
// if !graph.deno_specifiers.is_empty() {
|
||||
// if let Some(lockfile) = &self.lockfile {
|
||||
// let mappings = graph.deno_specifiers.mappings();
|
||||
// let mut lockfile = lockfile.lock();
|
||||
// for (from, to) in mappings {
|
||||
// lockfile.insert_package_specifier(
|
||||
// format!("deno:{}", from),
|
||||
// format!("deno:{}", to),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// ensure that the top level package.json is installed if a
|
||||
// specifier was matched in the package.json
|
||||
self
|
||||
|
@ -382,6 +421,7 @@ impl ModuleGraphBuilder {
|
|||
self.file_fetcher.clone(),
|
||||
self.options.resolve_file_header_overrides(),
|
||||
self.global_http_cache.clone(),
|
||||
self.parsed_source_cache.clone(),
|
||||
permissions,
|
||||
self.options.node_modules_dir_specifier(),
|
||||
)
|
||||
|
|
|
@ -871,9 +871,9 @@ pub enum DenoDiagnostic {
|
|||
/// remapped to an import map import specifier.
|
||||
ImportMapRemap { from: String, to: String },
|
||||
/// The import assertion type is incorrect.
|
||||
InvalidAssertType(String),
|
||||
/// A module requires an assertion type to be a valid import.
|
||||
NoAssertType,
|
||||
InvalidAttributeType(String),
|
||||
/// A module requires an attribute type to be a valid import.
|
||||
NoAttributeType,
|
||||
/// A remote module was not found in the cache.
|
||||
NoCache(ModuleSpecifier),
|
||||
/// A remote npm package reference was not found in the cache.
|
||||
|
@ -897,8 +897,8 @@ impl DenoDiagnostic {
|
|||
match self {
|
||||
Self::DenoWarn(_) => "deno-warn",
|
||||
Self::ImportMapRemap { .. } => "import-map-remap",
|
||||
Self::InvalidAssertType(_) => "invalid-assert-type",
|
||||
Self::NoAssertType => "no-assert-type",
|
||||
Self::InvalidAttributeType(_) => "invalid-attribute-type",
|
||||
Self::NoAttributeType => "no-attribute-type",
|
||||
Self::NoCache(_) => "no-cache",
|
||||
Self::NoCacheNpm(_, _) => "no-cache-npm",
|
||||
Self::NoLocal(_) => "no-local",
|
||||
|
@ -958,15 +958,15 @@ impl DenoDiagnostic {
|
|||
..Default::default()
|
||||
}
|
||||
}
|
||||
"no-assert-type" => lsp::CodeAction {
|
||||
title: "Insert import assertion.".to_string(),
|
||||
"no-attribute-type" => lsp::CodeAction {
|
||||
title: "Insert import attribute.".to_string(),
|
||||
kind: Some(lsp::CodeActionKind::QUICKFIX),
|
||||
diagnostics: Some(vec![diagnostic.clone()]),
|
||||
edit: Some(lsp::WorkspaceEdit {
|
||||
changes: Some(HashMap::from([(
|
||||
specifier.clone(),
|
||||
vec![lsp::TextEdit {
|
||||
new_text: " assert { type: \"json\" }".to_string(),
|
||||
new_text: " with { type: \"json\" }".to_string(),
|
||||
range: lsp::Range {
|
||||
start: diagnostic.range.end,
|
||||
end: diagnostic.range.end,
|
||||
|
@ -1069,7 +1069,7 @@ impl DenoDiagnostic {
|
|||
"import-map-remap"
|
||||
| "no-cache"
|
||||
| "no-cache-npm"
|
||||
| "no-assert-type"
|
||||
| "no-attribute-type"
|
||||
| "redirect"
|
||||
| "import-node-prefix-missing"
|
||||
)
|
||||
|
@ -1084,8 +1084,8 @@ impl DenoDiagnostic {
|
|||
let (severity, message, data) = match self {
|
||||
Self::DenoWarn(message) => (lsp::DiagnosticSeverity::WARNING, message.to_string(), None),
|
||||
Self::ImportMapRemap { from, to } => (lsp::DiagnosticSeverity::HINT, format!("The import specifier can be remapped to \"{to}\" which will resolve it via the active import map."), Some(json!({ "from": from, "to": to }))),
|
||||
Self::InvalidAssertType(assert_type) => (lsp::DiagnosticSeverity::ERROR, format!("The module is a JSON module and expected an assertion type of \"json\". Instead got \"{assert_type}\"."), None),
|
||||
Self::NoAssertType => (lsp::DiagnosticSeverity::ERROR, "The module is a JSON module and not being imported with an import assertion. Consider adding `assert { type: \"json\" }` to the import statement.".to_string(), None),
|
||||
Self::InvalidAttributeType(assert_type) => (lsp::DiagnosticSeverity::ERROR, format!("The module is a JSON module and expected an attribute type of \"json\". Instead got \"{assert_type}\"."), None),
|
||||
Self::NoAttributeType => (lsp::DiagnosticSeverity::ERROR, "The module is a JSON module and not being imported with an import attribute. Consider adding `with { type: \"json\" }` to the import statement.".to_string(), None),
|
||||
Self::NoCache(specifier) => (lsp::DiagnosticSeverity::ERROR, format!("Uncached or missing remote URL: {specifier}"), Some(json!({ "specifier": specifier }))),
|
||||
Self::NoCacheNpm(pkg_req, specifier) => (lsp::DiagnosticSeverity::ERROR, format!("Uncached or missing npm package: {}", pkg_req), Some(json!({ "specifier": specifier }))),
|
||||
Self::NoLocal(specifier) => (lsp::DiagnosticSeverity::ERROR, format!("Unable to load a local module: {specifier}\n Please check the file path."), None),
|
||||
|
@ -1144,15 +1144,16 @@ fn diagnose_resolution(
|
|||
match maybe_assert_type {
|
||||
// The module has the correct assertion type, no diagnostic
|
||||
Some("json") => (),
|
||||
// The dynamic import statement is missing an assertion type, which
|
||||
// The dynamic import statement is missing an attribute type, which
|
||||
// we might not be able to statically detect, therefore we will
|
||||
// not provide a potentially incorrect diagnostic.
|
||||
None if is_dynamic => (),
|
||||
// The module has an incorrect assertion type, diagnostic
|
||||
Some(assert_type) => diagnostics
|
||||
.push(DenoDiagnostic::InvalidAssertType(assert_type.to_string())),
|
||||
// The module is missing an assertion type, diagnostic
|
||||
None => diagnostics.push(DenoDiagnostic::NoAssertType),
|
||||
Some(assert_type) => diagnostics.push(
|
||||
DenoDiagnostic::InvalidAttributeType(assert_type.to_string()),
|
||||
),
|
||||
// The module is missing an attribute type, diagnostic
|
||||
None => diagnostics.push(DenoDiagnostic::NoAttributeType),
|
||||
}
|
||||
}
|
||||
} else if let Ok(pkg_ref) =
|
||||
|
@ -1249,7 +1250,7 @@ fn diagnose_dependency(
|
|||
&dependency.maybe_code
|
||||
},
|
||||
dependency.is_dynamic,
|
||||
dependency.maybe_assert_type.as_deref(),
|
||||
dependency.maybe_attribute_type.as_deref(),
|
||||
)
|
||||
.iter()
|
||||
.flat_map(|diag| {
|
||||
|
@ -1278,7 +1279,7 @@ fn diagnose_dependency(
|
|||
snapshot,
|
||||
&dependency.maybe_type,
|
||||
dependency.is_dynamic,
|
||||
dependency.maybe_assert_type.as_deref(),
|
||||
dependency.maybe_attribute_type.as_deref(),
|
||||
)
|
||||
.iter()
|
||||
.map(|diag| diag.to_lsp_diagnostic(&range)),
|
||||
|
|
|
@ -32,6 +32,7 @@ use deno_ast::SourceTextInfo;
|
|||
use deno_core::error::custom_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::future;
|
||||
use deno_core::futures::FutureExt;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::url;
|
||||
use deno_core::ModuleSpecifier;
|
||||
|
@ -45,7 +46,7 @@ use deno_runtime::deno_node::PackageJson;
|
|||
use deno_runtime::permissions::PermissionsContainer;
|
||||
use deno_semver::npm::NpmPackageReqReference;
|
||||
use deno_semver::package::PackageReq;
|
||||
use indexmap1::IndexMap;
|
||||
use indexmap::IndexMap;
|
||||
use lsp::Url;
|
||||
use once_cell::sync::Lazy;
|
||||
use package_json::PackageJsonDepsProvider;
|
||||
|
@ -1551,24 +1552,53 @@ pub struct OpenDocumentsGraphLoader<'a> {
|
|||
pub open_docs: &'a HashMap<ModuleSpecifier, Document>,
|
||||
}
|
||||
|
||||
impl<'a> OpenDocumentsGraphLoader<'a> {
|
||||
fn load_from_docs(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
) -> Option<deno_graph::source::LoadFuture> {
|
||||
if specifier.scheme() == "file" {
|
||||
if let Some(doc) = self.open_docs.get(specifier) {
|
||||
return Some(
|
||||
future::ready(Ok(Some(deno_graph::source::LoadResponse::Module {
|
||||
content: doc.content(),
|
||||
specifier: doc.specifier().clone(),
|
||||
maybe_headers: None,
|
||||
})))
|
||||
.boxed_local(),
|
||||
);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> deno_graph::source::Loader for OpenDocumentsGraphLoader<'a> {
|
||||
fn registry_url(&self) -> &Url {
|
||||
self.inner_loader.registry_url()
|
||||
}
|
||||
|
||||
fn load(
|
||||
&mut self,
|
||||
specifier: &ModuleSpecifier,
|
||||
is_dynamic: bool,
|
||||
cache_setting: deno_graph::source::CacheSetting,
|
||||
) -> deno_graph::source::LoadFuture {
|
||||
if specifier.scheme() == "file" {
|
||||
if let Some(doc) = self.open_docs.get(specifier) {
|
||||
return Box::pin(future::ready(Ok(Some(
|
||||
deno_graph::source::LoadResponse::Module {
|
||||
content: doc.content(),
|
||||
specifier: doc.specifier().clone(),
|
||||
maybe_headers: None,
|
||||
},
|
||||
))));
|
||||
}
|
||||
match self.load_from_docs(specifier) {
|
||||
Some(fut) => fut,
|
||||
None => self.inner_loader.load(specifier, is_dynamic, cache_setting),
|
||||
}
|
||||
self.inner_loader.load(specifier, is_dynamic)
|
||||
}
|
||||
|
||||
fn cache_module_info(
|
||||
&mut self,
|
||||
specifier: &deno_ast::ModuleSpecifier,
|
||||
source: &str,
|
||||
module_info: &deno_graph::ModuleInfo,
|
||||
) {
|
||||
self
|
||||
.inner_loader
|
||||
.cache_module_info(specifier, source, module_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use super::path_to_regex::Token;
|
|||
use crate::args::CacheSetting;
|
||||
use crate::cache::GlobalHttpCache;
|
||||
use crate::cache::HttpCache;
|
||||
use crate::file_fetcher::FetchOptions;
|
||||
use crate::file_fetcher::FileFetcher;
|
||||
use crate::http_util::HttpClient;
|
||||
|
||||
|
@ -509,11 +510,12 @@ impl ModuleRegistry {
|
|||
) -> Result<Vec<RegistryConfiguration>, AnyError> {
|
||||
let fetch_result = self
|
||||
.file_fetcher
|
||||
.fetch_with_accept(
|
||||
.fetch_with_options(FetchOptions {
|
||||
specifier,
|
||||
PermissionsContainer::allow_all(),
|
||||
Some("application/vnd.deno.reg.v2+json, application/vnd.deno.reg.v1+json;q=0.9, application/json;q=0.8"),
|
||||
)
|
||||
permissions: PermissionsContainer::allow_all(),
|
||||
maybe_accept: Some("application/vnd.deno.reg.v2+json, application/vnd.deno.reg.v1+json;q=0.9, application/json;q=0.8"),
|
||||
maybe_cache_setting: None,
|
||||
})
|
||||
.await;
|
||||
// if there is an error fetching, we will cache an empty file, so that
|
||||
// subsequent requests they are just an empty doc which will error without
|
||||
|
|
|
@ -145,6 +145,8 @@ impl ModuleLoadPreparer {
|
|||
npm_resolver: Some(graph_npm_resolver),
|
||||
module_analyzer: Some(&*analyzer),
|
||||
reporter: maybe_file_watcher_reporter,
|
||||
// todo(dsherret): workspace support
|
||||
workspace_members: vec![],
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
|
|
@ -8,8 +8,8 @@ use deno_core::futures::future::LocalBoxFuture;
|
|||
use deno_core::futures::FutureExt;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_core::TaskQueue;
|
||||
use deno_graph::source::NpmPackageReqResolution;
|
||||
use deno_graph::source::NpmResolver;
|
||||
use deno_graph::source::PackageReqResolution;
|
||||
use deno_graph::source::Resolver;
|
||||
use deno_graph::source::UnknownBuiltInNodeModuleError;
|
||||
use deno_graph::source::DEFAULT_JSX_IMPORT_SOURCE_MODULE;
|
||||
|
@ -333,9 +333,9 @@ impl NpmResolver for CliGraphResolver {
|
|||
.boxed()
|
||||
}
|
||||
|
||||
fn resolve_npm(&self, package_req: &PackageReq) -> PackageReqResolution {
|
||||
fn resolve_npm(&self, package_req: &PackageReq) -> NpmPackageReqResolution {
|
||||
if self.no_npm {
|
||||
return PackageReqResolution::Err(anyhow!(
|
||||
return NpmPackageReqResolution::Err(anyhow!(
|
||||
"npm specifiers were requested; but --no-npm is specified"
|
||||
));
|
||||
}
|
||||
|
@ -344,13 +344,13 @@ impl NpmResolver for CliGraphResolver {
|
|||
.npm_resolution
|
||||
.resolve_package_req_as_pending(package_req);
|
||||
match result {
|
||||
Ok(nv) => PackageReqResolution::Ok(nv),
|
||||
Ok(nv) => NpmPackageReqResolution::Ok(nv),
|
||||
Err(err) => {
|
||||
if self.npm_registry_api.mark_force_reload() {
|
||||
log::debug!("Restarting npm specifier resolution to check for new registry information. Error: {:#}", err);
|
||||
PackageReqResolution::ReloadRegistryInfo(err.into())
|
||||
NpmPackageReqResolution::ReloadRegistryInfo(err.into())
|
||||
} else {
|
||||
PackageReqResolution::Err(err.into())
|
||||
NpmPackageReqResolution::Err(err.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -760,7 +760,7 @@ fn lsp_deno_task() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_import_assertions() {
|
||||
fn lsp_import_attributes() {
|
||||
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||
let mut client = context.new_lsp_command().build();
|
||||
client.initialize(|builder| {
|
||||
|
@ -806,9 +806,9 @@ fn lsp_import_assertions() {
|
|||
"end": { "line": 0, "character": 27 }
|
||||
},
|
||||
"severity": 1,
|
||||
"code": "no-assert-type",
|
||||
"code": "no-attribute-type",
|
||||
"source": "deno",
|
||||
"message": "The module is a JSON module and not being imported with an import assertion. Consider adding `assert { type: \"json\" }` to the import statement."
|
||||
"message": "The module is a JSON module and not being imported with an import attribute. Consider adding `with { type: \"json\" }` to the import statement."
|
||||
}
|
||||
])
|
||||
);
|
||||
|
@ -831,9 +831,9 @@ fn lsp_import_assertions() {
|
|||
"end": { "line": 0, "character": 27 }
|
||||
},
|
||||
"severity": 1,
|
||||
"code": "no-assert-type",
|
||||
"code": "no-attribute-type",
|
||||
"source": "deno",
|
||||
"message": "The module is a JSON module and not being imported with an import assertion. Consider adding `assert { type: \"json\" }` to the import statement."
|
||||
"message": "The module is a JSON module and not being imported with an import attribute. Consider adding `with { type: \"json\" }` to the import statement."
|
||||
}],
|
||||
"only": ["quickfix"]
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ fn lsp_import_assertions() {
|
|||
assert_eq!(
|
||||
res,
|
||||
json!([{
|
||||
"title": "Insert import assertion.",
|
||||
"title": "Insert import attribute.",
|
||||
"kind": "quickfix",
|
||||
"diagnostics": [
|
||||
{
|
||||
|
@ -852,9 +852,9 @@ fn lsp_import_assertions() {
|
|||
"end": { "line": 0, "character": 27 }
|
||||
},
|
||||
"severity": 1,
|
||||
"code": "no-assert-type",
|
||||
"code": "no-attribute-type",
|
||||
"source": "deno",
|
||||
"message": "The module is a JSON module and not being imported with an import assertion. Consider adding `assert { type: \"json\" }` to the import statement."
|
||||
"message": "The module is a JSON module and not being imported with an import attribute. Consider adding `with { type: \"json\" }` to the import statement."
|
||||
}
|
||||
],
|
||||
"edit": {
|
||||
|
@ -865,7 +865,7 @@ fn lsp_import_assertions() {
|
|||
"start": { "line": 0, "character": 27 },
|
||||
"end": { "line": 0, "character": 27 }
|
||||
},
|
||||
"newText": " assert { type: \"json\" }"
|
||||
"newText": " with { type: \"json\" }"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2066,14 +2066,14 @@ itest!(shebang_swc {
|
|||
});
|
||||
|
||||
itest!(shebang_with_json_imports_tsc {
|
||||
args: "run --quiet import_assertions/json_with_shebang.ts",
|
||||
output: "import_assertions/json_with_shebang.ts.out",
|
||||
args: "run --quiet import_attributes/json_with_shebang.ts",
|
||||
output: "import_attributes/json_with_shebang.ts.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(shebang_with_json_imports_swc {
|
||||
args: "run --quiet --no-check import_assertions/json_with_shebang.ts",
|
||||
output: "import_assertions/json_with_shebang.ts.out",
|
||||
args: "run --quiet --no-check import_attributes/json_with_shebang.ts",
|
||||
output: "import_attributes/json_with_shebang.ts.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
|
@ -3050,36 +3050,36 @@ itest!(issue_13562 {
|
|||
output: "run/issue13562.ts.out",
|
||||
});
|
||||
|
||||
itest!(import_assertions_static_import {
|
||||
args: "run --allow-read import_assertions/static_import.ts",
|
||||
output: "import_assertions/static_import.out",
|
||||
itest!(import_attributes_static_import {
|
||||
args: "run --allow-read import_attributes/static_import.ts",
|
||||
output: "import_attributes/static_import.out",
|
||||
});
|
||||
|
||||
itest!(import_assertions_static_export {
|
||||
args: "run --allow-read import_assertions/static_export.ts",
|
||||
output: "import_assertions/static_export.out",
|
||||
itest!(import_attributes_static_export {
|
||||
args: "run --allow-read import_attributes/static_export.ts",
|
||||
output: "import_attributes/static_export.out",
|
||||
});
|
||||
|
||||
itest!(import_assertions_static_error {
|
||||
args: "run --allow-read import_assertions/static_error.ts",
|
||||
output: "import_assertions/static_error.out",
|
||||
itest!(import_attributes_static_error {
|
||||
args: "run --allow-read import_attributes/static_error.ts",
|
||||
output: "import_attributes/static_error.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(import_assertions_dynamic_import {
|
||||
args: "run --allow-read import_assertions/dynamic_import.ts",
|
||||
output: "import_assertions/dynamic_import.out",
|
||||
itest!(import_attributes_dynamic_import {
|
||||
args: "run --allow-read --check import_attributes/dynamic_import.ts",
|
||||
output: "import_attributes/dynamic_import.out",
|
||||
});
|
||||
|
||||
itest!(import_assertions_dynamic_error {
|
||||
args: "run --allow-read import_assertions/dynamic_error.ts",
|
||||
output: "import_assertions/dynamic_error.out",
|
||||
itest!(import_attributes_dynamic_error {
|
||||
args: "run --allow-read import_attributes/dynamic_error.ts",
|
||||
output: "import_attributes/dynamic_error.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(import_assertions_type_check {
|
||||
args: "run --allow-read --check import_assertions/type_check.ts",
|
||||
output: "import_assertions/type_check.out",
|
||||
itest!(import_attributes_type_check {
|
||||
args: "run --allow-read --check import_attributes/type_check.ts",
|
||||
output: "import_attributes/type_check.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
const data = await import("./data.json", { assert: { type: "json" } });
|
||||
|
||||
console.log(data);
|
|
@ -1,3 +0,0 @@
|
|||
import data from "./data.json" assert { type: "json" };
|
||||
|
||||
console.log(data);
|
|
@ -1,5 +0,0 @@
|
|||
[WILDCARD]
|
||||
error: TS2339 [ERROR]: Property 'foo' does not exist on type '{ a: string; c: { d: number; }; }'.
|
||||
console.log(data.foo);
|
||||
~~~
|
||||
at [WILDCARD]type_check.ts:3:18
|
|
@ -1,3 +0,0 @@
|
|||
import data from "./data.json" assert { type: "json" };
|
||||
|
||||
console.log(data.foo);
|
|
@ -1,2 +1,3 @@
|
|||
[WILDCARD]
|
||||
[Module: null prototype] { default: { a: "b", c: { d: 10 } } }
|
||||
[Module: null prototype] { default: { a: "b", c: { d: 10 } } }
|
5
cli/tests/testdata/import_attributes/dynamic_import.ts
vendored
Normal file
5
cli/tests/testdata/import_attributes/dynamic_import.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
const data1 = await import("./data.json", { with: { type: "json" } });
|
||||
const data2 = await import("./data.json", { assert: { type: "json" } });
|
||||
|
||||
console.log(data1);
|
||||
console.log(data2);
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]
|
||||
error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import assertion with the type of "json".
|
||||
error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json".
|
||||
Specifier: [WILDCARD]/data.json
|
||||
at [WILDCARD]static_error.ts:1:18
|
|
@ -1,2 +1,3 @@
|
|||
[WILDCARD]
|
||||
{ a: "b", c: { d: 10 } }
|
||||
{ a: "b", c: { d: 10 } }
|
5
cli/tests/testdata/import_attributes/static_import.ts
vendored
Normal file
5
cli/tests/testdata/import_attributes/static_import.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import data1 from "./data.json" with { type: "json" };
|
||||
import data2 from "./data.json" assert { type: "json" };
|
||||
|
||||
console.log(data1);
|
||||
console.log(data2);
|
12
cli/tests/testdata/import_attributes/type_check.out
vendored
Normal file
12
cli/tests/testdata/import_attributes/type_check.out
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
Check file:///[WILDCARD]/type_check.ts
|
||||
error: TS2339 [ERROR]: Property 'foo' does not exist on type '{ a: string; c: { d: number; }; }'.
|
||||
console.log(data1.foo);
|
||||
~~~
|
||||
at [WILDCARD]type_check.ts:4:19
|
||||
|
||||
TS2339 [ERROR]: Property 'foo' does not exist on type '{ a: string; c: { d: number; }; }'.
|
||||
console.log(data2.foo);
|
||||
~~~
|
||||
at [WILDCARD]type_check.ts:5:19
|
||||
|
||||
Found 2 errors.
|
5
cli/tests/testdata/import_attributes/type_check.ts
vendored
Normal file
5
cli/tests/testdata/import_attributes/type_check.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import data1 from "./data.json" with { type: "json" };
|
||||
import data2 from "./data.json" assert { type: "json" };
|
||||
|
||||
console.log(data1.foo);
|
||||
console.log(data2.foo);
|
|
@ -1,4 +1,4 @@
|
|||
[WILDCARD]
|
||||
error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import assertion with the type of "json".
|
||||
error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json".
|
||||
Specifier: [WILDCARD]/subdir/config.json
|
||||
[WILDCARD]
|
|
@ -645,7 +645,7 @@ impl<'a> GraphDisplayContext<'a> {
|
|||
match err {
|
||||
ModuleGraphError::ModuleError(err) => match err {
|
||||
ModuleError::InvalidTypeAssertion { .. } => {
|
||||
self.build_error_msg(specifier, "(invalid import assertion)")
|
||||
self.build_error_msg(specifier, "(invalid import attribute)")
|
||||
}
|
||||
ModuleError::LoadingErr(_, _, _) => {
|
||||
self.build_error_msg(specifier, "(loading error)")
|
||||
|
@ -653,8 +653,8 @@ impl<'a> GraphDisplayContext<'a> {
|
|||
ModuleError::ParseErr(_, _) => {
|
||||
self.build_error_msg(specifier, "(parsing error)")
|
||||
}
|
||||
ModuleError::UnsupportedImportAssertionType { .. } => {
|
||||
self.build_error_msg(specifier, "(unsupported import assertion)")
|
||||
ModuleError::UnsupportedImportAttributeType { .. } => {
|
||||
self.build_error_msg(specifier, "(unsupported import attribute)")
|
||||
}
|
||||
ModuleError::UnsupportedMediaType { .. } => {
|
||||
self.build_error_msg(specifier, "(unsupported)")
|
||||
|
@ -662,6 +662,12 @@ impl<'a> GraphDisplayContext<'a> {
|
|||
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
|
||||
self.build_error_msg(specifier, "(missing)")
|
||||
}
|
||||
ModuleError::UnknownPackage { .. } => {
|
||||
self.build_error_msg(specifier, "(unknown package)")
|
||||
}
|
||||
ModuleError::UnknownPackageReq { .. } => {
|
||||
self.build_error_msg(specifier, "(unknown package constraint)")
|
||||
}
|
||||
},
|
||||
ModuleGraphError::ResolutionError(_) => {
|
||||
self.build_error_msg(specifier, "(resolution error)")
|
||||
|
|
1
cli/tools/vendor/test.rs
vendored
1
cli/tools/vendor/test.rs
vendored
|
@ -116,6 +116,7 @@ impl Loader for TestLoader {
|
|||
&mut self,
|
||||
specifier: &ModuleSpecifier,
|
||||
_is_dynamic: bool,
|
||||
_cache_setting: deno_graph::source::CacheSetting,
|
||||
) -> LoadFuture {
|
||||
let specifier = self.redirects.get(specifier).unwrap_or(specifier);
|
||||
let result = self.files.get(specifier).map(|result| match result {
|
||||
|
|
9
cli/tsc/00_typescript.js
vendored
9
cli/tsc/00_typescript.js
vendored
|
@ -33936,7 +33936,8 @@ ${lanes.join("\n")}
|
|||
}
|
||||
const moduleSpecifier = parseModuleSpecifier();
|
||||
let assertClause;
|
||||
if (token() === 132 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) {
|
||||
const hasAssertKeyword = token() === 132 /* AssertKeyword */ || token() === 118 /* WithKeyword */;
|
||||
if (hasAssertKeyword && !scanner2.hasPrecedingLineBreak()) {
|
||||
assertClause = parseAssertClause();
|
||||
}
|
||||
parseSemicolon();
|
||||
|
@ -33956,7 +33957,11 @@ ${lanes.join("\n")}
|
|||
function parseAssertClause(skipAssertKeyword) {
|
||||
const pos = getNodePos();
|
||||
if (!skipAssertKeyword) {
|
||||
parseExpected(132 /* AssertKeyword */);
|
||||
if (token() === 118 /* WithKeyword */) {
|
||||
parseExpected(118 /* WithKeyword */);
|
||||
} else {
|
||||
parseExpected(132 /* AssertKeyword */);
|
||||
}
|
||||
}
|
||||
const openBracePosition = scanner2.getTokenStart();
|
||||
if (parseExpected(19 /* OpenBraceToken */)) {
|
||||
|
|
1
cli/tsc/dts/lib.es5.d.ts
vendored
1
cli/tsc/dts/lib.es5.d.ts
vendored
|
@ -639,6 +639,7 @@ interface ImportMeta {
|
|||
*/
|
||||
interface ImportCallOptions {
|
||||
assert?: ImportAssertions;
|
||||
with?: ImportAssertions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -870,6 +870,7 @@ mod tests {
|
|||
&mut self,
|
||||
specifier: &ModuleSpecifier,
|
||||
_is_dynamic: bool,
|
||||
_cache_setting: deno_graph::source::CacheSetting,
|
||||
) -> deno_graph::source::LoadFuture {
|
||||
let specifier_text = specifier
|
||||
.to_string()
|
||||
|
|
1
ext/cache/01_cache.js
vendored
1
ext/cache/01_cache.js
vendored
|
@ -1,5 +1,4 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file camelcase
|
||||
const core = globalThis.Deno.core;
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file camelcase
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
const {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file camelcase
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const internals = globalThis.__bootstrap.internals;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file camelcase
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
const internals = globalThis.__bootstrap.internals;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
|
|
|
@ -27,7 +27,6 @@ import {
|
|||
defaultTriggerAsyncIdScope,
|
||||
symbols,
|
||||
} from "ext:deno_node/internal/async_hooks.ts";
|
||||
// deno-lint-ignore camelcase
|
||||
const { async_id_symbol } = symbols;
|
||||
import {
|
||||
ERR_HTTP_HEADERS_SENT,
|
||||
|
|
|
@ -139,7 +139,6 @@ export function equal(c: unknown, d: unknown): boolean {
|
|||
})(c, d);
|
||||
}
|
||||
|
||||
// deno-lint-ignore ban-types
|
||||
function constructorsEqual(a: object, b: object) {
|
||||
return a.constructor === b.constructor ||
|
||||
a.constructor === Object && !b.constructor ||
|
||||
|
|
|
@ -54,7 +54,6 @@ const active_hooks: ActiveHooks = {
|
|||
|
||||
export const registerDestroyHook = async_wrap.registerDestroyHook;
|
||||
const {
|
||||
// deno-lint-ignore camelcase
|
||||
async_hook_fields,
|
||||
// deno-lint-ignore camelcase
|
||||
asyncIdFields: async_id_fields,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
||||
|
||||
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
||||
// deno-lint-ignore-file camelcase prefer-primordials
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||
import randomBytes from "ext:deno_node/internal/crypto/_randomBytes.ts";
|
||||
|
@ -32,6 +32,9 @@ export {
|
|||
} from "ext:deno_node/internal/crypto/_randomFill.ts";
|
||||
export { default as randomInt } from "ext:deno_node/internal/crypto/_randomInt.ts";
|
||||
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const { StringPrototypePadStart, StringPrototypeToString } = primordials;
|
||||
|
||||
const { core } = globalThis.__bootstrap;
|
||||
const { ops } = core;
|
||||
const {
|
||||
|
@ -286,8 +289,8 @@ function unsignedBigIntToBuffer(bigint: bigint, name: string) {
|
|||
throw new ERR_OUT_OF_RANGE(name, ">= 0", bigint);
|
||||
}
|
||||
|
||||
const hex = bigint.toString(16);
|
||||
const padded = hex.padStart(hex.length + (hex.length % 2), 0);
|
||||
const hex = StringPrototypeToString(bigint, 16);
|
||||
const padded = StringPrototypePadStart(hex, hex.length + (hex.length % 2), 0);
|
||||
return Buffer.from(padded, "hex");
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import {
|
|||
AsyncWrap,
|
||||
providerType,
|
||||
} from "ext:deno_node/internal_binding/async_wrap.ts";
|
||||
// deno-lint-ignore camelcase
|
||||
import { ares_strerror } from "ext:deno_node/internal_binding/ares.ts";
|
||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||
import { isWindows } from "ext:deno_node/_util/os.ts";
|
||||
|
|
|
@ -85,7 +85,6 @@ export function isArrayIndex(value: unknown): value is number | string {
|
|||
}
|
||||
|
||||
export function getOwnNonIndexProperties(
|
||||
// deno-lint-ignore ban-types
|
||||
obj: object,
|
||||
filter: number,
|
||||
): (string | symbol)[] {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file camelcase
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file camelcase
|
||||
|
||||
// @ts-check
|
||||
/// <reference path="../webidl/internal.d.ts" />
|
||||
|
|
|
@ -36,9 +36,7 @@ const {
|
|||
Number,
|
||||
NumberIsFinite,
|
||||
NumberIsNaN,
|
||||
// deno-lint-ignore camelcase
|
||||
NumberMAX_SAFE_INTEGER,
|
||||
// deno-lint-ignore camelcase
|
||||
NumberMIN_SAFE_INTEGER,
|
||||
ObjectAssign,
|
||||
ObjectCreate,
|
||||
|
|
2
ext/webidl/internal.d.ts
vendored
2
ext/webidl/internal.d.ts
vendored
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file no-explicit-any ban-types
|
||||
// deno-lint-ignore-file no-explicit-any
|
||||
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="esnext" />
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file camelcase
|
||||
/// <reference path="../../core/internal.d.ts" />
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
|
@ -46,8 +45,7 @@ const {
|
|||
SymbolFor,
|
||||
TypedArrayPrototypeGetByteLength,
|
||||
} = primordials;
|
||||
const op_ws_check_permission_and_cancel_handle =
|
||||
core.ops.op_ws_check_permission_and_cancel_handle;
|
||||
const { op_ws_check_permission_and_cancel_handle } = core.ops;
|
||||
const {
|
||||
op_ws_create,
|
||||
op_ws_close,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file camelcase
|
||||
/// <reference path="../../core/internal.d.ts" />
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
|
|
|
@ -15,7 +15,7 @@ export { delay } from "../test_util/std/async/delay.ts";
|
|||
// [toolName] --version output
|
||||
const versions = {
|
||||
"dprint": "dprint 0.40.0",
|
||||
"dlint": "dlint 0.47.0",
|
||||
"dlint": "dlint 0.51.0",
|
||||
};
|
||||
|
||||
export const ROOT_PATH = dirname(dirname(fromFileUrl(import.meta.url)));
|
||||
|
@ -138,7 +138,7 @@ export function getPrebuiltToolPath(toolName) {
|
|||
}
|
||||
|
||||
const downloadUrl =
|
||||
`https://raw.githubusercontent.com/denoland/deno_third_party/7f1a41fee1bfbffd56674269db8f1e19263cf751/prebuilt/${platformDirName}`;
|
||||
`https://raw.githubusercontent.com/denoland/deno_third_party/69ffd968c0c435f5f9dbba713a92b4fb6a3e2301/prebuilt/${platformDirName}`;
|
||||
|
||||
export async function downloadPrebuilt(toolName) {
|
||||
const spinner = wait("Downloading prebuilt tool: " + toolName).start();
|
||||
|
|
Loading…
Reference in a new issue