1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix: upgrade deno_ast to 0.23 (#17269)

Closes #17172
Closes #15669
Closes #8529
This commit is contained in:
David Sherret 2023-01-04 18:54:54 -05:00 committed by GitHub
parent 319f607476
commit 0ee64ad847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 145 additions and 116 deletions

View file

@ -7,7 +7,7 @@ rustflags = [
"target-feature=+crt-static",
"-C",
# increase the stack size to prevent swc overflowing the stack in debug
"link-arg=/STACK:2097152",
"link-arg=/STACK:3145728",
]
[target.aarch64-apple-darwin]

View file

@ -43,10 +43,10 @@
"tools/wpt/manifest.json"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.79.0.wasm",
"https://plugins.dprint.dev/typescript-0.80.2.wasm",
"https://plugins.dprint.dev/json-0.17.0.wasm",
"https://plugins.dprint.dev/markdown-0.15.1.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm",
"https://plugins.dprint.dev/exec-0.3.2.json@8efbbb3fcfbdf84142c3c438fbdeaf1637152a020032127c837b2b14e23261c3"
"https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
]
}

151
Cargo.lock generated
View file

@ -753,15 +753,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
[[package]]
name = "debug_unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"
dependencies = [
"unreachable",
]
[[package]]
name = "deno"
version = "1.29.1"
@ -848,9 +839,9 @@ dependencies = [
[[package]]
name = "deno_ast"
version = "0.21.0"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e95105b29938cac5c987017a3c3d245776d71de77838658e5abe917ad75b1929"
checksum = "e51afb5385ac30f59a1f4a80c986b7b4f02a1bf9da8bba5173aed80ab75ad8bf"
dependencies = [
"anyhow",
"base64",
@ -978,9 +969,9 @@ dependencies = [
[[package]]
name = "deno_doc"
version = "0.51.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5f0f24f690e9c0c1d22fe9c9da68b65d7378a5c10afe4a61398134eb031e21"
checksum = "5a4d646da7094c8c4005c1ecfeb9649a1f3875e5e964a1ecf6d44899c5692ebb"
dependencies = [
"cfg-if",
"deno_ast",
@ -996,14 +987,15 @@ dependencies = [
[[package]]
name = "deno_emit"
version = "0.12.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c721cb4e2ca7d94702f6987c2050aedfd270d18f87020080e396865a65dd957e"
checksum = "33d7152339bef69b44316be53d6b34cf40718c3084a22565d729b4131c53f462"
dependencies = [
"anyhow",
"base64",
"deno_ast",
"deno_graph",
"escape8259",
"futures",
"parking_lot 0.11.2",
]
@ -1059,9 +1051,9 @@ dependencies = [
[[package]]
name = "deno_graph"
version = "0.39.0"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87b3758993b62cf234fac6e922b2217aac6c3086d6d9a4fa36ddf7779abb0890"
checksum = "88980ad969ef1922782f4b19159bb3c46919e883292f1c71ddc3bcd8ba1a5a46"
dependencies = [
"anyhow",
"cfg-if",
@ -1073,7 +1065,6 @@ dependencies = [
"regex",
"serde",
"serde_json",
"sourcemap",
"url",
]
@ -1104,9 +1095,9 @@ dependencies = [
[[package]]
name = "deno_lint"
version = "0.35.0"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2c4e416322d10531eb0ebc6f3fa355380e4d25bbcd4109e3edd0b0aa71ed77"
checksum = "82424506123f05de694106aa906a20cd1aabde637213187cfb3c6f0eba794e4a"
dependencies = [
"anyhow",
"deno_ast",
@ -1456,9 +1447,9 @@ dependencies = [
[[package]]
name = "dprint-plugin-typescript"
version = "0.79.0"
version = "0.80.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf79285ae7a27047ab90162fefab77367478e08fffc42f8158143f8b33b69c22"
checksum = "74eb3bfe4a29790f676d30159fca39ddd1450308185b2bd412517493d2449e52"
dependencies = [
"anyhow",
"deno_ast",
@ -1469,9 +1460,9 @@ dependencies = [
[[package]]
name = "dprint-swc-ext"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ac3ba92d2cf3b87b8f48551d1720ff63a134545c830476aaffd8cf9d80e84e"
checksum = "ba1b7bac9133524358ec340b52b30a72df03c6252e327c22ad230637cc357306"
dependencies = [
"bumpalo",
"num-bigint",
@ -1639,10 +1630,19 @@ dependencies = [
]
[[package]]
name = "eszip"
version = "0.31.0"
name = "escape8259"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8119eb19b5b7f9c6b6da550781249bb05562fbdadb10f80f0a3afb96dde4944"
checksum = "ba4f4911e3666fcd7826997b4745c8224295a6f3072f1418c3067b97a67557ee"
dependencies = [
"rustversion",
]
[[package]]
name = "eszip"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "584906c722ca9751a4e1dd1fde7ca3387e2af2b4b3608e8d44bd29f22095a4a2"
dependencies = [
"anyhow",
"base64",
@ -1653,7 +1653,6 @@ dependencies = [
"serde_json",
"sha2",
"thiserror",
"tokio",
"url",
]
@ -3727,6 +3726,12 @@ dependencies = [
"base64",
]
[[package]]
name = "rustversion"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
[[package]]
name = "rustyline"
version = "10.0.0"
@ -4165,9 +4170,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "swc_atoms"
version = "0.4.23"
version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01b878052680dcec3421ab50384279443dbf93651b05da38e5133e0894a18096"
checksum = "9ad59af21529fcd3f4f8fa6b1ae399c2b183ec42c68347d76d68d6e5b657956e"
dependencies = [
"once_cell",
"rustc-hash",
@ -4179,9 +4184,9 @@ dependencies = [
[[package]]
name = "swc_bundler"
version = "0.192.45"
version = "0.193.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b3b6d8aba63acb7baf2d2b5aed930322259ccd8fcdc5f4e3ddefb9cff62bb1d"
checksum = "dc9c11d11591e011e4131febcc366fb0401446a5ac71813de08437237be43668"
dependencies = [
"ahash",
"anyhow",
@ -4211,17 +4216,17 @@ dependencies = [
[[package]]
name = "swc_common"
version = "0.29.10"
version = "0.29.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd844dfbd9969a9ef8430e954661de43edde353d65e987f935a328619698883"
checksum = "506321cad7393893018aac83a3b3bd25203883e8c47ab0864bb43195d43b22dd"
dependencies = [
"ahash",
"ast_node",
"better_scoped_tls",
"cfg-if",
"debug_unreachable",
"either",
"from_variant",
"new_debug_unreachable",
"num-bigint",
"once_cell",
"rustc-hash",
@ -4264,9 +4269,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.94.14"
version = "0.95.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c3303de79adce1137e6514e5939686173e7d26c71d91c3067056caa45183547"
checksum = "3cc936f04c4e671ae5918b573a50945c5189d3dcdd57e4faddd47889717e1416"
dependencies = [
"bitflags",
"is-macro",
@ -4281,9 +4286,9 @@ dependencies = [
[[package]]
name = "swc_ecma_codegen"
version = "0.127.23"
version = "0.128.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cb696997765db4832aabc142cd0f95d38f3d746556d99ad0c7b06c68642d37a"
checksum = "121caf2dde74cbd143035a92cfd249be7744ee31622c4e66ee19a8249e3f6855"
dependencies = [
"memchr",
"num-bigint",
@ -4313,9 +4318,9 @@ dependencies = [
[[package]]
name = "swc_ecma_dep_graph"
version = "0.94.19"
version = "0.95.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c1b4e4e7928d9d41fe951551edc19829c878c84df242b85320a4c950f3a7a24"
checksum = "42a9122bcff80fba41cadd123fc9136424755144de16dfabeee4031144d204a9"
dependencies = [
"swc_atoms",
"swc_common",
@ -4325,9 +4330,9 @@ dependencies = [
[[package]]
name = "swc_ecma_loader"
version = "0.41.11"
version = "0.41.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c0aac15ea4dfdceec8b04389f2d6ff27ea0f0d243aa89904e420a6d0a96e512"
checksum = "42710b93ec010a5e0354cc86d621a3dd0243351d649d0c273c1887035a256151"
dependencies = [
"ahash",
"anyhow",
@ -4339,9 +4344,9 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.122.19"
version = "0.123.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cec064f10003ea47bd5e97d6456a683643da9f705670b97eb1c90bc434f58f3"
checksum = "22225f792dcbcd3d3e77498d6e6fb86161cdd05ba4e24456361768dc41ee2948"
dependencies = [
"either",
"enum_kind",
@ -4358,9 +4363,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_base"
version = "0.111.33"
version = "0.112.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26e2a38941b0b8dee1ed90de0c7eb0d31e5370378d8747ee8d078c0d214ddcb8"
checksum = "44bc36990f42ceea1370426a2f3e923f43c4277342a8583edb4c4bef2f27e63d"
dependencies = [
"better_scoped_tls",
"bitflags",
@ -4380,9 +4385,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_classes"
version = "0.100.32"
version = "0.101.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0120315ca713614946d146e241b63657f6e327b35517af8f48ffc495fcd41fe7"
checksum = "7b247a889b92f088e5ecd66ccbdc5915a102d4d9f54823e9a93ec7344a1c080f"
dependencies = [
"swc_atoms",
"swc_common",
@ -4407,9 +4412,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_optimization"
version = "0.167.26"
version = "0.168.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a70f693c2f33d606453c6e4d701be809c59e12ddb0ff6c0afd3a6dc6ee41c940"
checksum = "f8d291756dcb423ea457c65ac463fbfd52d5917a7cda9ea4a097591afabe2ca5"
dependencies = [
"ahash",
"dashmap",
@ -4432,9 +4437,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_proposal"
version = "0.144.20"
version = "0.145.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ef43c950a86d2b577a011a3b665d084780bd5cdb9b28fcc5b41ba3a1b1592b2"
checksum = "d1850fce438ac6d3f31a1e4bcf8e385df7fe6603cb4a09d3a281472b2b937518"
dependencies = [
"either",
"serde",
@ -4451,9 +4456,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_react"
version = "0.155.21"
version = "0.156.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad10f89e09579dfe89b088db9ce864764e834f7bbb2a8e729b3803dbcc813b1"
checksum = "dd4b1e06d0c517dbc308d6ba9004c1d8bd3e271f2bff445ac2226536e3893e67"
dependencies = [
"ahash",
"base64",
@ -4477,9 +4482,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.159.22"
version = "0.160.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f72f7070b8184b2c6d682ce3481797c0045cbccac0f1b271e66b95d773bdd1"
checksum = "795677b92c36308ff444952aa1eb7ce041964f7f823dda69de406401b73e0d6e"
dependencies = [
"serde",
"swc_atoms",
@ -4493,13 +4498,14 @@ dependencies = [
[[package]]
name = "swc_ecma_utils"
version = "0.105.24"
version = "0.106.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8efe8af0ab5c899bacba887f86dea3e47e477df041782d11bce91a22cec2a1f5"
checksum = "20675f180e890897386295825bb6297640f7843282410545479dce02ac98b563"
dependencies = [
"indexmap",
"num_cpus",
"once_cell",
"rustc-hash",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
@ -4510,9 +4516,9 @@ dependencies = [
[[package]]
name = "swc_ecma_visit"
version = "0.80.14"
version = "0.81.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47d7de36b60fb0f72b19417a988fe71c800d1a07071421720e469325990a5d7a"
checksum = "0ebf5de90444c90b1905b7618800a7572fc757faa8c90cc1c6031d1f6ca179df"
dependencies = [
"num-bigint",
"swc_atoms",
@ -4536,9 +4542,9 @@ dependencies = [
[[package]]
name = "swc_fast_graph"
version = "0.17.11"
version = "0.17.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed0262f3338afdf976e85290653b9170f4f3272e05f35c2bac3f2cecc8544f2"
checksum = "06584f28662339e1972d164d263b3bfacdc13e1acb5fbe6d568c132a4693034b"
dependencies = [
"ahash",
"indexmap",
@ -4548,9 +4554,9 @@ dependencies = [
[[package]]
name = "swc_graph_analyzer"
version = "0.18.11"
version = "0.18.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "085d076c5cf0d27e1b1fedc73d6c356357b8d56e8e1750913906090ffa398e7d"
checksum = "2b052b885bcf22f52a0d279a88191f8df2787dca5105409998aa3890460c5e77"
dependencies = [
"ahash",
"auto_impl",
@ -5267,15 +5273,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
dependencies = [
"void",
]
[[package]]
name = "untrusted"
version = "0.7.1"
@ -5353,12 +5350,6 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "vte"
version = "0.11.0"

View file

@ -41,7 +41,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
v8 = { version = "0.60.0", default-features = false }
deno_ast = { version = "0.21.0", features = ["transpiling"] }
deno_ast = { version = "0.23.2", features = ["transpiling"] }
deno_core = { version = "0.164.0", path = "./core" }
deno_ops = { version = "0.42.0", path = "./ops" }

View file

@ -44,10 +44,10 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_core.workspace = true
deno_doc = "0.51.0"
deno_emit = "0.12.0"
deno_graph = "0.39.0"
deno_lint = { version = "0.35.0", features = ["docs"] }
deno_doc = "0.52.0"
deno_emit = "0.13.0"
deno_graph = "0.41.0"
deno_lint = { version = "0.37.0", features = ["docs"] }
deno_runtime.workspace = true
deno_task_shell = "0.8.1"
napi_sym.workspace = true
@ -65,10 +65,10 @@ data-url.workspace = true
dissimilar = "=1.0.4"
dprint-plugin-json = "=0.17.0"
dprint-plugin-markdown = "=0.15.1"
dprint-plugin-typescript = "=0.79.0"
dprint-plugin-typescript = "=0.80.2"
encoding_rs.workspace = true
env_logger = "=0.9.0"
eszip = "=0.31.0"
eszip = "=0.32.0"
fancy-regex = "=0.10.0"
flate2.workspace = true
http.workspace = true

View file

@ -1069,7 +1069,7 @@
if (shuffle !== null) {
// http://en.wikipedia.org/wiki/Linear_congruential_generator
// Use BigInt for everything because the random seed is u64.
const nextInt = (function (state) {
const nextInt = function (state) {
const m = 0x80000000n;
const a = 1103515245n;
const c = 12345n;
@ -1077,7 +1077,7 @@
return function (max) {
return state = ((a * state + c) % m) % BigInt(max);
};
}(BigInt(shuffle)));
}(BigInt(shuffle));
for (let i = filtered.length - 1; i > 0; i--) {
const j = nextInt(i);

View file

@ -11,6 +11,9 @@ use deno_core::anyhow::anyhow;
use deno_core::anyhow::Context;
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::futures::io::AllowStdIo;
use deno_core::futures::AsyncReadExt;
use deno_core::futures::AsyncSeekExt;
use deno_core::futures::FutureExt;
use deno_core::located_script_name;
use deno_core::serde::Deserialize;
@ -40,7 +43,6 @@ use std::iter::once;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::Arc;
use tokio::io::{AsyncReadExt, AsyncSeekExt};
#[derive(Deserialize, Serialize)]
pub struct Metadata {
@ -74,9 +76,10 @@ pub async fn extract_standalone(
) -> Result<Option<(Metadata, eszip::EszipV2)>, AnyError> {
let current_exe_path = current_exe()?;
let file = tokio::fs::File::open(current_exe_path).await?;
let file = std::fs::File::open(current_exe_path)?;
let mut bufreader = tokio::io::BufReader::new(file);
let mut bufreader =
deno_core::futures::io::BufReader::new(AllowStdIo::new(file));
let trailer_pos = bufreader.seek(SeekFrom::End(-24)).await?;
let mut trailer = [0; 24];

View file

@ -52,17 +52,15 @@ mod repl {
#[test]
fn pty_unpaired_braces() {
util::with_pty(&["repl"], |mut console| {
console.write_line(")");
console.write_line("]");
console.write_line("}");
console.write_line("close();");
for right_brace in &[")", "]", "}"] {
util::with_pty(&["repl"], |mut console| {
console.write_line(right_brace);
console.write_line("close();");
let output = console.read_all_output();
assert_contains!(output, "Unexpected token `)`");
assert_contains!(output, "Unexpected token `]`");
assert_contains!(output, "Unexpected token `}`");
});
let output = console.read_all_output();
assert_contains!(output, "Expression expected");
});
}
}
#[test]
@ -518,7 +516,7 @@ mod repl {
None,
false,
);
assert_contains!(out, "Unexpected token");
assert_contains!(out, "Expression expected");
assert!(err.is_empty());
}
}
@ -565,7 +563,7 @@ mod repl {
Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]),
false,
);
assert_contains!(out, "Unexpected token `>`");
assert_contains!(out, "Expression expected");
assert!(err.is_empty());
}

View file

@ -1,6 +1,6 @@
Error checking: [WILDCARD]
Line 2, column 7: Expected '{', got '<eof>'
Error checking: [WILDCARD]parse_error.ts
Expected '{', got '<eof>' at [WILDCARD]parse_error.ts:2:7
class Test
~~~~
class Test
~~~~
error: Found 1 not formatted file in 1 file

View file

@ -58,7 +58,7 @@
"errors": [
{
"file_path": "[WILDCARD]malformed.js",
"message": "Expected '{', got 'B' at [WILDCARD]malformed.js:4:16"
"message": "Expected '{', got 'B' at [WILDCARD]malformed.js:4:16\n\n export class A B C\n ~"
}
]
}

View file

@ -1 +1,4 @@
error: The module's source code could not be parsed: Expected ',', got 'following' at [WILDCARD]/error_syntax.js:3:6
(the following is a syntax error ^^ ! )
~~~~~~~~~

View file

@ -1 +1,4 @@
error: The module's source code could not be parsed: Unexpected eof at [WILDCARD]/error_syntax_empty_trailing_line.mjs:2:22
setTimeout(() => {}),
~

View file

@ -1 +1,4 @@
error: The module's source code could not be parsed: Unexpected token `}`. Expected an identifier, void, yield, null, await, break, a string literal, a numeric literal, true, false, `, -, import, this, typeof, {, [, ( at [WILDCARD]syntax_error.ts:4:1
}
~

View file

@ -470,6 +470,9 @@ mod watcher {
let next_line = stderr_lines.next().unwrap();
assert_contains!(&next_line, "Bundle started");
assert_contains!(stderr_lines.next().unwrap(), "error:");
assert_eq!(stderr_lines.next().unwrap(), "");
assert_eq!(stderr_lines.next().unwrap(), " syntax error ^^");
assert_eq!(stderr_lines.next().unwrap(), " ~~~~~");
assert_contains!(stderr_lines.next().unwrap(), "Bundle failed");
// the target file hasn't been created yet
assert!(!target_file.is_file());
@ -929,6 +932,9 @@ mod watcher {
write(&another_test, "syntax error ^^").unwrap();
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stderr_lines.next().unwrap(), "error:");
assert_eq!(stderr_lines.next().unwrap(), "");
assert_eq!(stderr_lines.next().unwrap(), " syntax error ^^");
assert_eq!(stderr_lines.next().unwrap(), " ~~~~~");
assert_contains!(stderr_lines.next().unwrap(), "Test failed");
// Then restore the file

View file

@ -327,7 +327,20 @@ async fn check_source_files(
not_formatted_files_count.fetch_add(1, Ordering::Relaxed);
let _g = output_lock.lock();
warn!("Error checking: {}", file_path.to_string_lossy());
warn!(" {}", e);
warn!(
"{}",
format!("{}", e)
.split('\n')
.map(|l| {
if l.trim().is_empty() {
String::new()
} else {
format!(" {}", l)
}
})
.collect::<Vec<_>>()
.join("\n")
);
}
}
Ok(())

View file

@ -2,8 +2,10 @@
use crate::colors;
use deno_ast::swc::parser::error::SyntaxError;
use deno_ast::swc::parser::token::BinOpToken;
use deno_ast::swc::parser::token::Token;
use deno_ast::swc::parser::token::Word;
use deno_ast::view::AssignOp;
use deno_core::anyhow::Context as _;
use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex;
@ -235,6 +237,12 @@ impl Validator for EditorHelper {
for item in deno_ast::lex(ctx.input(), deno_ast::MediaType::TypeScript) {
if let deno_ast::TokenOrComment::Token(token) = item.inner {
match token {
Token::BinOp(BinOpToken::Div)
| Token::AssignOp(AssignOp::DivAssign) => {
// it's too complicated to write code to detect regular expression literals
// which are no longer tokenized, so if a `/` or `/=` happens, then we bail
return Ok(ValidationResult::Valid(None));
}
Token::BackQuote => in_template = !in_template,
Token::LParen
| Token::LBracket

View file

@ -193,12 +193,13 @@ impl ReplSession {
line: &str,
) -> EvaluationOutput {
fn format_diagnostic(diagnostic: &deno_ast::Diagnostic) -> String {
let display_position = diagnostic.display_position();
format!(
"{}: {} at {}:{}",
colors::red("parse error"),
diagnostic.message(),
diagnostic.display_position.line_number,
diagnostic.display_position.column_number,
display_position.line_number,
display_position.column_number,
)
}

View file

@ -1005,7 +1005,7 @@
}
ArrayPrototypeShift(causes);
let finalMessage = (MapPrototypeGet(refMap, value) ?? "");
let finalMessage = MapPrototypeGet(refMap, value) ?? "";
if (ObjectPrototypeIsPrototypeOf(AggregateErrorPrototype, value)) {
const stackLines = StringPrototypeSplit(value.stack, "\n");