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

chore: update deno_ast and deno_graph (#22033)

This upgrade unblocks support for ES decorator proposal.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
This commit is contained in:
Bartek Iwańczuk 2024-01-23 11:25:44 +01:00 committed by GitHub
parent ec97c7dd4b
commit e49973d96d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 65 additions and 62 deletions

52
Cargo.lock generated
View file

@ -1047,9 +1047,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ast" name = "deno_ast"
version = "1.0.1" version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d87c67f73e749f78096f517cbb57967d98a8c713b39cf88b1f0b8750a84aa29" checksum = "6fa239d4d69bb6c61bd73e0fc23e3688c7e87e1f47f2f37f4cff7a0080017299"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -1250,9 +1250,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_doc" name = "deno_doc"
version = "0.93.0" version = "0.94.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4e7c393786c7a7e99dfb720b1b0fe0a9128072f2cf40edf8dac78c8f6bc93f" checksum = "b325fd3ab5731c22b00979389065669617530c4976cb7fe533831a7adbbdf7a6"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
@ -1282,9 +1282,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_emit" name = "deno_emit"
version = "0.33.0" version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "480cde74f7e7937e74e43f71c0fa9af7c629387b3847eb4697505741842f0d02" checksum = "b568ac3d8f6fba012d7cb0d9fc792bfd7ee0ed70e1dfc0784030aeada0a8b31d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -1352,9 +1352,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_graph" name = "deno_graph"
version = "0.63.4" version = "0.63.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be751db3da720bcd35d42f9c0967a04cafd52d554d79262426d1c00179b0c085" checksum = "81e4dafc06b0025d3a2920977a1e2ef87d8521d774ad9a167f5049cb31b76ccc"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -1461,9 +1461,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_lint" name = "deno_lint"
version = "0.53.0" version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6c91f26393905a81d960cf9473729660e5b5b889fa2712ba5405ac5a7598014" checksum = "b328d3abd54ff84f99f016a378effd02056365e0734db5c5ac142f6dc9ad47ea"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",
@ -2124,9 +2124,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-typescript" name = "dprint-plugin-typescript"
version = "0.88.8" version = "0.88.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b16993dd982116fc2c429a1cce62e927fd4856708666c9cbd86cdbefd79dd97" checksum = "ff4df63bcc9131ef68094ed468bf7b252e5771ed120545ea42983e99e411d467"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",
@ -2349,9 +2349,9 @@ dependencies = [
[[package]] [[package]]
name = "eszip" name = "eszip"
version = "0.58.0" version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "214f3a524473bb2c76385c02fdada6c2791ba5e07e9ac72a6c1e373d665b1680" checksum = "c44cb502967cc1602a5a7ed1ae7022fc371f83ae709e95bfb9b510eb25d71a5a"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -5649,9 +5649,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_bundler" name = "swc_bundler"
version = "0.223.15" version = "0.223.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e912d8387fc8592465c081b2e6b8df89443117ae4ca5160f21e08d47d7d58d7a" checksum = "4d7530df85b1a56f6a879ca102dc59718db4bcd6bfff55fb8bb379fbeab6c88c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crc", "crc",
@ -5874,9 +5874,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_optimization" name = "swc_ecma_transforms_optimization"
version = "0.196.14" version = "0.196.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eefef9f5a80afdbd4b517401dc053825d1ac0d95bb63f3ae92d2b335d8d7d4f8" checksum = "fec185cf4d18e90b7c8b18b0d1f04a5707e6f4c7b57c1bfd5086392cd07b75a9"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"indexmap", "indexmap",
@ -5898,9 +5898,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_proposal" name = "swc_ecma_transforms_proposal"
version = "0.169.14" version = "0.169.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86de99757fc31d8977f47c02a26e5c9a243cb63b03fe8aa8b36d79924b8fa29c" checksum = "ed89d6ff74f60de490fb56e1cc505b057905e36c13d405d7d61dd5c9f6ee8fc9"
dependencies = [ dependencies = [
"either", "either",
"rustc-hash", "rustc-hash",
@ -5918,9 +5918,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_react" name = "swc_ecma_transforms_react"
version = "0.181.15" version = "0.181.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9918e22caf1ea4a71085f5d818d6c0bf5c19d669cfb9d38f9fdc3da0496abdc7" checksum = "e31a2f879fd21d18080b6c42e633e0ae8c6f3d54b83c1de876767d82b458c999"
dependencies = [ dependencies = [
"base64", "base64",
"dashmap", "dashmap",
@ -5942,9 +5942,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_typescript" name = "swc_ecma_transforms_typescript"
version = "0.186.14" version = "0.186.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d1495c969ffdc224384f1fb73646b9c1b170779f20fdb984518deb054aa522" checksum = "3e4263372cc7cd1a3b4570ccf7438f3c1e1575f134fd05cdf074edb322480a5b"
dependencies = [ dependencies = [
"ryu-js", "ryu-js",
"serde", "serde",
@ -7051,7 +7051,7 @@ dependencies = [
"codespan-reporting", "codespan-reporting",
"log", "log",
"naga", "naga",
"parking_lot 0.12.1", "parking_lot 0.11.2",
"profiling", "profiling",
"raw-window-handle", "raw-window-handle",
"ron", "ron",
@ -7092,7 +7092,7 @@ dependencies = [
"naga", "naga",
"objc", "objc",
"once_cell", "once_cell",
"parking_lot 0.12.1", "parking_lot 0.11.2",
"profiling", "profiling",
"range-alloc", "range-alloc",
"raw-window-handle", "raw-window-handle",

View file

@ -41,7 +41,7 @@ license = "MIT"
repository = "https://github.com/denoland/deno" repository = "https://github.com/denoland/deno"
[workspace.dependencies] [workspace.dependencies]
deno_ast = { version = "1.0.1", features = ["transpiling"] } deno_ast = { version = "0.32.0", features = ["transpiling"] }
deno_core = { version = "0.248.0" } deno_core = { version = "0.248.0" }
deno_runtime = { version = "0.140.0", path = "./runtime" } deno_runtime = { version = "0.140.0", path = "./runtime" }

View file

@ -57,16 +57,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra
deno_cache_dir = "=0.6.1" deno_cache_dir = "=0.6.1"
deno_config = "=0.8.1" deno_config = "=0.8.1"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.93.0", features = ["html"] } deno_doc = { version = "=0.94.1", features = ["html"] }
deno_emit = "=0.33.0" deno_emit = "=0.34.0"
deno_graph = "=0.63.4" deno_graph = "=0.63.5"
deno_lint = { version = "=0.53.0", features = ["docs"] } deno_lint = { version = "=0.54.0", features = ["docs"] }
deno_lockfile.workspace = true deno_lockfile.workspace = true
deno_npm = "=0.16.0" deno_npm = "=0.16.0"
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_semver = "=0.5.4" deno_semver = "=0.5.4"
deno_task_shell = "=0.14.3" deno_task_shell = "=0.14.3"
eszip = "=0.58.0" eszip = "=0.59.0"
napi_sym.workspace = true napi_sym.workspace = true
async-trait.workspace = true async-trait.workspace = true
@ -88,7 +88,7 @@ dotenvy = "0.15.7"
dprint-plugin-json = "=0.19.1" dprint-plugin-json = "=0.19.1"
dprint-plugin-jupyter = "=0.1.2" dprint-plugin-jupyter = "=0.1.2"
dprint-plugin-markdown = "=0.16.3" dprint-plugin-markdown = "=0.16.3"
dprint-plugin-typescript = "=0.88.8" dprint-plugin-typescript = "=0.88.10"
encoding_rs.workspace = true encoding_rs.workspace = true
env_logger = "=0.10.0" env_logger = "=0.10.0"
fancy-regex = "=0.10.0" fancy-regex = "=0.10.0"

View file

@ -158,6 +158,10 @@ pub fn ts_config_to_emit_options(
_ => (false, false, false, false), _ => (false, false, false, false),
}; };
deno_ast::EmitOptions { deno_ast::EmitOptions {
// TODO(bartlomieju): change it to default to `false` and only enable
// if tsconfig.json enabled experimental decorators
use_ts_decorators: true,
use_decorators_proposal: false,
emit_metadata: options.emit_decorator_metadata, emit_metadata: options.emit_decorator_metadata,
imports_not_used_as_values, imports_not_used_as_values,
inline_source_map: options.inline_source_map, inline_source_map: options.inline_source_map,

View file

@ -5,7 +5,8 @@
"location": { "location": {
"filename": "file:///[WILDCARD]/lint_success.ts", "filename": "file:///[WILDCARD]/lint_success.ts",
"line": 2, "line": 2,
"col": 0 "col": 0,
"byteIndex": 22
}, },
"declarationKind": "export", "declarationKind": "export",
"jsDoc": { "jsDoc": {
@ -33,7 +34,8 @@
"location": { "location": {
"filename": "file:///[WILDCARD]/lint_success.ts", "filename": "file:///[WILDCARD]/lint_success.ts",
"line": 4, "line": 4,
"col": 2 "col": 2,
"byteIndex": 66
} }
} }
], ],

View file

@ -1,7 +1,7 @@
Checking fast check type graph for errors... Checking fast check type graph for errors...
Missing explicit return type in the public API. missing explicit return type in the public API
at file:///[WILDCARD]/publish/invalid_fast_check/mod.ts:2:17 at file:///[WILDCARD]/publish/invalid_fast_check/mod.ts@68
Fixing these fast check errors is required to make the code fast check compatible which enables type checking your package's TypeScript code with the same performance as if you had distributed declaration files. Do any of these errors seem too restrictive or incorrect? Please open an issue if so to help us improve: https://github.com/denoland/deno/issues Fixing these fast check errors is required to make the code fast check compatible which enables type checking your package's TypeScript code with the same performance as if you had distributed declaration files. Do any of these errors seem too restrictive or incorrect? Please open an issue if so to help us improve: https://github.com/denoland/deno/issues

View file

@ -146,12 +146,9 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> {
.await?; .await?;
let (_, deno_ns) = deno_ns.first().unwrap(); let (_, deno_ns) = deno_ns.first().unwrap();
let deno_ns_symbols = deno_doc::html::compute_namespaced_symbols(deno_ns, &[])
deno_doc::html::compute_namespaced_symbols(deno_ns, &[]);
Some(deno_ns_symbols)
} else { } else {
None Default::default()
}; };
generate_docs_directory(&doc_nodes_by_url, html_options, deno_ns) generate_docs_directory(&doc_nodes_by_url, html_options, deno_ns)
@ -178,15 +175,21 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> {
} }
} }
struct DocResolver {} struct DocResolver {
deno_ns: std::collections::HashSet<Vec<String>>,
}
impl deno_doc::html::HrefResolver for DocResolver { impl deno_doc::html::HrefResolver for DocResolver {
fn resolve_global_symbol(&self, symbol: &[String], _context: &str) -> String { fn resolve_global_symbol(&self, symbol: &[String]) -> Option<String> {
format!( if self.deno_ns.contains(symbol) {
Some(format!(
"https://deno.land/api@{}?s={}", "https://deno.land/api@{}?s={}",
env!("CARGO_PKG_VERSION"), env!("CARGO_PKG_VERSION"),
symbol.join(".") symbol.join(".")
) ))
} else {
None
}
} }
fn resolve_import_href( fn resolve_import_href(
@ -220,7 +223,7 @@ impl deno_doc::html::HrefResolver for DocResolver {
async fn generate_docs_directory( async fn generate_docs_directory(
doc_nodes_by_url: &IndexMap<ModuleSpecifier, Vec<doc::DocNode>>, doc_nodes_by_url: &IndexMap<ModuleSpecifier, Vec<doc::DocNode>>,
html_options: &DocHtmlFlag, html_options: &DocHtmlFlag,
deno_ns: Option<std::collections::HashSet<Vec<String>>>, deno_ns: std::collections::HashSet<Vec<String>>,
) -> Result<(), AnyError> { ) -> Result<(), AnyError> {
let cwd = std::env::current_dir().context("Failed to get CWD")?; let cwd = std::env::current_dir().context("Failed to get CWD")?;
let output_dir_resolved = cwd.join(&html_options.output); let output_dir_resolved = cwd.join(&html_options.output);
@ -228,19 +231,9 @@ async fn generate_docs_directory(
let options = deno_doc::html::GenerateOptions { let options = deno_doc::html::GenerateOptions {
package_name: Some(html_options.name.to_owned()), package_name: Some(html_options.name.to_owned()),
main_entrypoint: None, main_entrypoint: None,
global_symbols: deno_doc::html::NamespacedGlobalSymbols::new(
deno_ns
.map(|deno_ns| {
deno_ns
.into_iter()
.map(|symbol| (symbol, "deno".to_string()))
.collect()
})
.unwrap_or_default(),
),
rewrite_map: None, rewrite_map: None,
hide_module_doc_title: false, hide_module_doc_title: false,
href_resolver: Rc::new(DocResolver {}), href_resolver: Rc::new(DocResolver { deno_ns }),
sidebar_flatten_namespaces: false, sidebar_flatten_namespaces: false,
}; };

View file

@ -103,7 +103,7 @@ pub fn surface_fast_check_type_graph_errors(
); );
break 'analyze_package; // no need to keep analyzing this package break 'analyze_package; // no need to keep analyzing this package
} else { } else {
let message = diagnostic.message_with_range(); let message = diagnostic.message_with_range_for_test();
if !seen_diagnostics.insert(message.clone()) { if !seen_diagnostics.insert(message.clone()) {
continue; continue;
} }

View file

@ -596,6 +596,10 @@ impl ReplSession {
let transpiled_src = parsed_source let transpiled_src = parsed_source
.transpile(&deno_ast::EmitOptions { .transpile(&deno_ast::EmitOptions {
// TODO(bartlomieju): change it to default to `false` and only enable
// if tsconfig.json enabled experimental decorators
use_ts_decorators: true,
use_decorators_proposal: false,
emit_metadata: false, emit_metadata: false,
source_map: false, source_map: false,
inline_source_map: false, inline_source_map: false,