1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00
David Sherret 2024-04-11 19:00:17 -04:00 committed by GitHub
parent f1ea8ca358
commit ade0cd5e97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 219 additions and 158 deletions

View file

@ -56,7 +56,7 @@
"ext/websocket/autobahn/reports"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.89.3.wasm",
"https://plugins.dprint.dev/typescript-0.90.1.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
"https://plugins.dprint.dev/toml-0.6.1.wasm",

120
Cargo.lock generated
View file

@ -200,9 +200,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.79"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]]
name = "arrayvec"
@ -447,9 +447,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
dependencies = [
"serde",
]
@ -951,7 +951,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"libloading 0.8.1",
"winapi",
]
@ -1131,9 +1131,9 @@ dependencies = [
[[package]]
name = "deno_ast"
version = "0.34.2"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58d986a1df3f1538ffa04162b5c5f00b856121391b860dc003bde2a6a741e878"
checksum = "ff757b9a40f67682e34c2806a2d5a0331449acad467ab53e783cad8092675e50"
dependencies = [
"anyhow",
"base64",
@ -1346,9 +1346,9 @@ dependencies = [
[[package]]
name = "deno_doc"
version = "0.119.0"
version = "0.123.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbaec0d12c5f161bc96cf077874b586e860538663791d3e5d7df867af2d5f3ec"
checksum = "a185c2d8aa17865002e9c5ee5652534ff11406b1633833306366e1aaa37a273a"
dependencies = [
"ammonia",
"anyhow",
@ -1370,9 +1370,9 @@ dependencies = [
[[package]]
name = "deno_emit"
version = "0.38.2"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23593513889bc5d607f9750c858f9cc113f47cb045d87eea7c6cd6605639915c"
checksum = "9f13249307b7c8ae93989de7752f512acaea63ba1653717d432e69f22b2cd8af"
dependencies = [
"anyhow",
"base64",
@ -1442,9 +1442,9 @@ dependencies = [
[[package]]
name = "deno_graph"
version = "0.69.10"
version = "0.71.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e6442f864bb39619f9485220f5cd18ca73ad3a5fb352accd5dc39b24bc88543"
checksum = "198e0be3da5754b2c1bc6e4c53280c79ca101eb9065f98db8fbae423c64edae5"
dependencies = [
"anyhow",
"async-trait",
@ -1557,9 +1557,9 @@ dependencies = [
[[package]]
name = "deno_lint"
version = "0.58.0"
version = "0.58.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3344701fc527a920b4f00562052d3feca8ce315bb9327305b07d5820019a9ead"
checksum = "7b00040be64c6ef7b64feff6bc85c4622baad854f3677ed3ab9e90c8884918e5"
dependencies = [
"anyhow",
"deno_ast",
@ -2266,9 +2266,9 @@ dependencies = [
[[package]]
name = "dprint-plugin-typescript"
version = "0.89.3"
version = "0.90.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d572ba77c357e38c0bc08290fa5a1cf191e772c26bb030bd8eedc1c5faae649"
checksum = "d7a7c11f665ef4e305eee57b7643fe5f639ae9c322b64cda115ab78b183c8dc1"
dependencies = [
"anyhow",
"deno_ast",
@ -2369,9 +2369,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "elliptic-curve"
@ -2494,9 +2494,9 @@ dependencies = [
[[package]]
name = "eszip"
version = "0.64.2"
version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97374d7fd863b2b44ca217e739a1eb83361d0e5e2358d201145dac1aa3fa6a21"
checksum = "fcdec9b6ed381fb66c53ec7563f55db04885b7646fccfb7a58a807804c813db9"
dependencies = [
"anyhow",
"base64",
@ -2958,7 +2958,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"gpu-alloc-types",
]
@ -2968,7 +2968,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
]
[[package]]
@ -2991,7 +2991,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"gpu-descriptor-types",
"hashbrown 0.14.3",
]
@ -3002,7 +3002,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
]
[[package]]
@ -3180,15 +3180,16 @@ dependencies = [
[[package]]
name = "hstr"
version = "0.2.6"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de90d3db62411eb62eddabe402d706ac4970f7ac8d088c05f11069cad9be9857"
checksum = "5a9de2bdef6354361892492bab5e316b2d78a0ee9971db4d36da9b1eb0e11999"
dependencies = [
"hashbrown 0.14.3",
"new_debug_unreachable",
"once_cell",
"phf 0.11.2",
"rustc-hash",
"smallvec",
"triomphe",
]
[[package]]
@ -3454,9 +3455,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
@ -3531,12 +3532,11 @@ dependencies = [
[[package]]
name = "is-macro"
version = "0.3.1"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc74b7abae208af9314a406bd7dcc65091230b6e749c09e07a645885fecf34f9"
checksum = "59a85abdc13717906baccb5a1e435556ce0df215f242892f721dff62bf25288f"
dependencies = [
"Inflector",
"pmutil",
"proc-macro2",
"quote",
"syn 2.0.48",
@ -4001,7 +4001,7 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"block",
"core-graphics-types",
"foreign-types",
@ -4063,7 +4063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e"
dependencies = [
"bit-set",
"bitflags 2.4.1",
"bitflags 2.5.0",
"codespan-reporting",
"hexf-parse",
"indexmap",
@ -4154,7 +4154,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"cfg-if",
"libc",
]
@ -5249,7 +5249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
dependencies = [
"base64",
"bitflags 2.4.1",
"bitflags 2.5.0",
"serde",
"serde_derive",
]
@ -5280,7 +5280,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
@ -5333,7 +5333,7 @@ version = "0.38.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfeae074e687625746172d639330f1de242a178bf3189b51e35a7a21573513ac"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"errno 0.3.8",
"libc",
"linux-raw-sys",
@ -5407,7 +5407,7 @@ version = "13.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a2d683a4ac90aeef5b1013933f6d977bd37d51ff3f4dad829d4931a7e6be86"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"cfg-if",
"clipboard-win",
"fd-lock",
@ -5577,9 +5577,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.195"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
@ -5605,9 +5605,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.195"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
@ -5616,9 +5616,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.111"
version = "1.0.115"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
dependencies = [
"indexmap",
"itoa",
@ -5894,6 +5894,12 @@ dependencies = [
"der",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stacker"
version = "0.1.15"
@ -6108,7 +6114,7 @@ version = "0.112.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36226eb87bfd2f5620bde04f149a4b869ab34e78496d60cb0d8eb9da765d0732"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"is-macro",
"num-bigint",
"phf 0.11.2",
@ -6194,7 +6200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66539401f619730b26d380a120b91b499f80cbdd9bb15d00aa73bc3a4d4cc394"
dependencies = [
"better_scoped_tls",
"bitflags 2.4.1",
"bitflags 2.5.0",
"indexmap",
"once_cell",
"phf 0.11.2",
@ -6847,6 +6853,16 @@ dependencies = [
"once_cell",
]
[[package]]
name = "triomphe"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3"
dependencies = [
"serde",
"stable_deref_trait",
]
[[package]]
name = "trust-dns-client"
version = "0.22.0"
@ -7147,7 +7163,7 @@ version = "0.89.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe2197fbef82c98f7953d13568a961d4e1c663793b5caf3c74455a13918cdf33"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"fslock",
"gzip-header",
"home",
@ -7342,7 +7358,7 @@ checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726"
dependencies = [
"arrayvec",
"bit-vec",
"bitflags 2.4.1",
"bitflags 2.5.0",
"codespan-reporting",
"log",
"naga",
@ -7369,7 +7385,7 @@ dependencies = [
"arrayvec",
"ash",
"bit-set",
"bitflags 2.4.1",
"bitflags 2.5.0",
"block",
"core-graphics-types",
"d3d12",
@ -7406,7 +7422,7 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.5.0",
"js-sys",
"serde",
"web-sys",

View file

@ -43,7 +43,7 @@ license = "MIT"
repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "0.34.1", features = ["transpiling"] }
deno_ast = { version = "0.36.1", features = ["transpiling"] }
deno_core = { version = "0.272.0" }
deno_bench_util = { version = "0.139.0", path = "./bench_util" }

View file

@ -66,17 +66,17 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa
deno_cache_dir = { workspace = true }
deno_config = "=0.15.0"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.119.0", features = ["html"] }
deno_emit = "=0.38.2"
deno_graph = { version = "=0.69.10", features = ["tokio_executor"] }
deno_lint = { version = "=0.58.0", features = ["docs"] }
deno_doc = { version = "=0.123.1", features = ["html"] }
deno_emit = "=0.39.0"
deno_graph = { version = "=0.71.1", features = ["tokio_executor"] }
deno_lint = { version = "=0.58.2", features = ["docs"] }
deno_lockfile.workspace = true
deno_npm = "=0.17.0"
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_semver = "=0.5.4"
deno_task_shell = "=0.16.0"
deno_terminal.workspace = true
eszip = "=0.64.2"
eszip = "=0.66.0"
napi_sym.workspace = true
async-trait.workspace = true
@ -98,7 +98,7 @@ dotenvy = "0.15.7"
dprint-plugin-json = "=0.19.2"
dprint-plugin-jupyter = "=0.1.3"
dprint-plugin-markdown = "=0.16.4"
dprint-plugin-typescript = "=0.89.3"
dprint-plugin-typescript = "=0.90.1"
env_logger = "=0.10.0"
fancy-regex = "=0.10.0"
faster-hex.workspace = true

View file

@ -10,6 +10,7 @@ pub mod package_json;
pub use self::import_map::resolve_import_map;
use self::package_json::PackageJsonDeps;
use ::import_map::ImportMap;
use deno_ast::SourceMapOption;
use deno_core::resolve_url_or_path;
use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmSystemInfo;
@ -146,9 +147,9 @@ pub fn jsr_api_url() -> &'static Url {
&JSR_API_URL
}
pub fn ts_config_to_emit_options(
pub fn ts_config_to_transpile_and_emit_options(
config: deno_config::TsConfig,
) -> deno_ast::EmitOptions {
) -> (deno_ast::TranspileOptions, deno_ast::EmitOptions) {
let options: deno_config::EmitConfigOptions =
serde_json::from_value(config.0).unwrap();
let imports_not_used_as_values =
@ -165,23 +166,34 @@ pub fn ts_config_to_emit_options(
"precompile" => (false, false, false, true),
_ => (false, false, false, false),
};
deno_ast::EmitOptions {
use_ts_decorators: options.experimental_decorators,
use_decorators_proposal: !options.experimental_decorators,
emit_metadata: options.emit_decorator_metadata,
imports_not_used_as_values,
inline_source_map: options.inline_source_map,
inline_sources: options.inline_sources,
source_map: options.source_map,
jsx_automatic,
jsx_development,
jsx_factory: options.jsx_factory,
jsx_fragment_factory: options.jsx_fragment_factory,
jsx_import_source: options.jsx_import_source,
precompile_jsx,
transform_jsx,
var_decl_imports: false,
}
let source_map = if options.inline_source_map {
SourceMapOption::Inline
} else if options.source_map {
SourceMapOption::Separate
} else {
SourceMapOption::None
};
(
deno_ast::TranspileOptions {
use_ts_decorators: options.experimental_decorators,
use_decorators_proposal: !options.experimental_decorators,
emit_metadata: options.emit_decorator_metadata,
imports_not_used_as_values,
jsx_automatic,
jsx_development,
jsx_factory: options.jsx_factory,
jsx_fragment_factory: options.jsx_fragment_factory,
jsx_import_source: options.jsx_import_source,
precompile_jsx,
transform_jsx,
var_decl_imports: false,
},
deno_ast::EmitOptions {
inline_sources: options.inline_sources,
keep_comments: false,
source_map,
},
)
}
/// Indicates how cached source files should be handled.

View file

@ -6,9 +6,9 @@ use deno_ast::MediaType;
use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_graph::DefaultModuleAnalyzer;
use deno_graph::ModuleInfo;
use deno_graph::ModuleParser;
use deno_graph::ParserModuleAnalyzer;
use deno_runtime::deno_webstorage::rusqlite::params;
use super::cache_db::CacheDB;
@ -169,7 +169,7 @@ impl<'a> deno_graph::ModuleAnalyzer for ModuleInfoCacheModuleAnalyzer<'a> {
}
// otherwise, get the module info from the parsed source cache
let analyzer = DefaultModuleAnalyzer::new(self.parser);
let analyzer = ParserModuleAnalyzer::new(self.parser);
let module_info = analyzer.analyze(specifier, source, media_type)?;
// then attempt to cache it

View file

@ -4,6 +4,7 @@ use crate::cache::EmitCache;
use crate::cache::FastInsecureHasher;
use crate::cache::ParsedSourceCache;
use deno_ast::SourceMapOption;
use deno_core::error::AnyError;
use deno_core::ModuleCodeString;
use deno_core::ModuleSpecifier;
@ -15,23 +16,31 @@ use std::sync::Arc;
pub struct Emitter {
emit_cache: EmitCache,
parsed_source_cache: Arc<ParsedSourceCache>,
transpile_options: deno_ast::TranspileOptions,
emit_options: deno_ast::EmitOptions,
// cached hash of the emit options
emit_options_hash: u64,
// cached hash of the transpile and emit options
transpile_and_emit_options_hash: u64,
}
impl Emitter {
pub fn new(
emit_cache: EmitCache,
parsed_source_cache: Arc<ParsedSourceCache>,
transpile_options: deno_ast::TranspileOptions,
emit_options: deno_ast::EmitOptions,
) -> Self {
let emit_options_hash = FastInsecureHasher::hash(&emit_options);
let transpile_and_emit_options_hash = {
let mut hasher = FastInsecureHasher::default();
hasher.write_hashable(&transpile_options);
hasher.write_hashable(emit_options);
hasher.finish()
};
Self {
emit_cache,
parsed_source_cache,
emit_options,
emit_options_hash,
transpile_options,
transpile_and_emit_options_hash,
}
}
@ -90,7 +99,8 @@ impl Emitter {
source.clone(),
media_type,
)?;
let transpiled_source = parsed_source.transpile(&self.emit_options)?;
let transpiled_source =
parsed_source.transpile(&self.transpile_options, &self.emit_options)?;
debug_assert!(transpiled_source.source_map.is_none());
self.emit_cache.set_emit_code(
specifier,
@ -115,9 +125,10 @@ impl Emitter {
let parsed_source = self
.parsed_source_cache
.get_or_parse_module(specifier, source_arc, media_type)?;
let mut options = self.emit_options.clone();
options.inline_source_map = false;
let transpiled_source = parsed_source.transpile(&options)?;
let mut options = self.emit_options;
options.source_map = SourceMapOption::None;
let transpiled_source =
parsed_source.transpile(&self.transpile_options, &options)?;
Ok(transpiled_source.text)
}
@ -127,7 +138,7 @@ impl Emitter {
fn get_source_hash(&self, source_text: &str) -> u64 {
FastInsecureHasher::new()
.write_str(source_text)
.write_u64(self.emit_options_hash)
.write_u64(self.transpile_and_emit_options_hash)
.finish()
}
}

View file

@ -549,11 +549,14 @@ impl CliFactory {
if let Some(ignored_options) = ts_config_result.maybe_ignored_options {
warn!("{}", ignored_options);
}
let emit_options =
crate::args::ts_config_to_emit_options(ts_config_result.ts_config);
let (transpile_options, emit_options) =
crate::args::ts_config_to_transpile_and_emit_options(
ts_config_result.ts_config,
);
Ok(Arc::new(Emitter::new(
self.emit_cache()?.clone(),
self.parsed_source_cache().clone(),
transpile_options,
emit_options,
)))
})

View file

@ -76,6 +76,7 @@ pub fn graph_valid(
check_js: options.check_js,
follow_type_only: options.follow_type_only,
follow_dynamic: options.is_vendoring,
prefer_fast_check_graph: false,
},
)
.errors()
@ -441,14 +442,13 @@ impl ModuleGraphBuilder {
loader.as_mut_loader(),
deno_graph::BuildOptions {
is_dynamic: options.is_dynamic,
jsr_url_provider: Some(&CliJsrUrlProvider),
jsr_url_provider: &CliJsrUrlProvider,
executor: Default::default(),
imports: maybe_imports,
resolver: Some(graph_resolver),
file_system: Some(&DenoGraphFsAdapter(self.fs.as_ref())),
file_system: &DenoGraphFsAdapter(self.fs.as_ref()),
npm_resolver: Some(graph_npm_resolver),
module_analyzer: Some(&analyzer),
module_parser: Some(&parser),
module_analyzer: &analyzer,
reporter: maybe_file_watcher_reporter,
workspace_members: &workspace_members,
},
@ -799,6 +799,7 @@ pub fn has_graph_root_local_dependent_changed(
deno_graph::WalkOptions {
follow_dynamic: true,
follow_type_only: true,
prefer_fast_check_graph: true,
check_js: true,
},
);

View file

@ -144,15 +144,18 @@ fn bundle_module_graph(
}
}
let (transpile_options, emit_options) =
crate::args::ts_config_to_transpile_and_emit_options(
ts_config_result.ts_config,
);
deno_emit::bundle_graph(
graph,
deno_emit::BundleOptions {
minify: false,
bundle_type: deno_emit::BundleType::Module,
emit_options: crate::args::ts_config_to_emit_options(
ts_config_result.ts_config,
),
emit_options,
emit_ignore_directives: true,
transpile_options,
},
)
}

View file

@ -73,10 +73,17 @@ pub async fn compile(
let ts_config_for_emit =
cli_options.resolve_ts_config_for_emit(deno_config::TsConfigType::Emit)?;
let emit_options =
crate::args::ts_config_to_emit_options(ts_config_for_emit.ts_config);
let (transpile_options, emit_options) =
crate::args::ts_config_to_transpile_and_emit_options(
ts_config_for_emit.ts_config,
);
let parser = parsed_source_cache.as_capturing_parser();
let eszip = eszip::EszipV2::from_graph(graph, &parser, emit_options)?;
let eszip = eszip::EszipV2::from_graph(
graph,
&parser,
transpile_options,
emit_options,
)?;
log::info!(
"{} {} to {}",

View file

@ -18,6 +18,7 @@ use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_doc as doc;
use deno_graph::source::NullFileSystem;
use deno_graph::GraphKind;
use deno_graph::ModuleAnalyzer;
use deno_graph::ModuleParser;
@ -53,8 +54,16 @@ async fn generate_doc_nodes_for_builtin_types(
vec![source_file_specifier.clone()],
&mut loader,
deno_graph::BuildOptions {
module_analyzer: Some(analyzer),
..Default::default()
module_analyzer: analyzer,
file_system: &NullFileSystem,
is_dynamic: false,
imports: Vec::new(),
executor: Default::default(),
jsr_url_provider: Default::default(),
npm_resolver: None,
reporter: None,
resolver: None,
workspace_members: &[],
},
)
.await;
@ -159,6 +168,7 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> {
kind_with_drilldown:
deno_doc::html::DocNodeKindWithDrilldown::Other(node.kind),
inner: std::sync::Arc::new(node),
drilldown_parent_kind: None,
})
.collect(),
&[],

View file

@ -59,6 +59,8 @@ pub fn collect_invalid_external_imports(
let options = WalkOptions {
check_js: true,
follow_dynamic: true,
// this being disabled will cause it to follow everything in the graph
prefer_fast_check_graph: false,
follow_type_only: true,
};
let mut iter = graph.walk(&graph.roots, options);

View file

@ -4,9 +4,9 @@ use deno_ast::ParsedSource;
use deno_ast::SourceRange;
use deno_ast::SourceTextInfo;
use deno_core::ModuleSpecifier;
use deno_graph::DefaultModuleAnalyzer;
use deno_graph::DependencyDescriptor;
use deno_graph::DynamicTemplatePart;
use deno_graph::ParserModuleAnalyzer;
use deno_graph::TypeScriptReference;
use deno_runtime::deno_node::is_builtin_node_module;
@ -192,7 +192,7 @@ impl<'a> SpecifierUnfurler<'a> {
diagnostic_reporter: &mut dyn FnMut(SpecifierUnfurlerDiagnostic),
) -> String {
let mut text_changes = Vec::new();
let module_info = DefaultModuleAnalyzer::module_info(parsed_source);
let module_info = ParserModuleAnalyzer::module_info(parsed_source);
let analyze_specifier =
|specifier: &str,
range: &deno_graph::PositionRange,

View file

@ -254,9 +254,11 @@ impl ReplSession {
})?;
let ts_config_for_emit = cli_options
.resolve_ts_config_for_emit(deno_config::TsConfigType::Emit)?;
let emit_options =
crate::args::ts_config_to_emit_options(ts_config_for_emit.ts_config);
let experimental_decorators = emit_options.use_ts_decorators;
let (transpile_options, _) =
crate::args::ts_config_to_transpile_and_emit_options(
ts_config_for_emit.ts_config,
);
let experimental_decorators = transpile_options.use_ts_decorators;
let mut repl_session = ReplSession {
npm_resolver,
resolver,
@ -619,23 +621,27 @@ impl ReplSession {
self.analyze_and_handle_jsx(&parsed_source);
let transpiled_src = parsed_source
.transpile(&deno_ast::EmitOptions {
use_ts_decorators: self.experimental_decorators,
use_decorators_proposal: !self.experimental_decorators,
emit_metadata: false,
source_map: false,
inline_source_map: false,
inline_sources: false,
imports_not_used_as_values: ImportsNotUsedAsValues::Preserve,
transform_jsx: true,
precompile_jsx: false,
jsx_automatic: self.jsx.import_source.is_some(),
jsx_development: false,
jsx_factory: self.jsx.factory.clone(),
jsx_fragment_factory: self.jsx.frag_factory.clone(),
jsx_import_source: self.jsx.import_source.clone(),
var_decl_imports: true,
})?
.transpile(
&deno_ast::TranspileOptions {
use_ts_decorators: self.experimental_decorators,
use_decorators_proposal: !self.experimental_decorators,
emit_metadata: false,
imports_not_used_as_values: ImportsNotUsedAsValues::Preserve,
transform_jsx: true,
precompile_jsx: false,
jsx_automatic: self.jsx.import_source.is_some(),
jsx_development: false,
jsx_factory: self.jsx.factory.clone(),
jsx_fragment_factory: self.jsx.frag_factory.clone(),
jsx_import_source: self.jsx.import_source.clone(),
var_decl_imports: true,
},
&deno_ast::EmitOptions {
source_map: deno_ast::SourceMapOption::None,
inline_sources: false,
keep_comments: false,
},
)?
.text;
let value = self

View file

@ -236,13 +236,12 @@ impl VendorTestBuilder {
let resolver = resolver.clone();
move |entry_points| {
async move {
let analyzer = DefaultModuleAnalyzer::default();
Ok(
build_test_graph(
entry_points,
loader,
resolver.as_graph_resolver(),
&analyzer,
&DefaultModuleAnalyzer,
)
.await,
)
@ -310,7 +309,7 @@ async fn build_test_graph(
&mut loader,
deno_graph::BuildOptions {
resolver: Some(resolver),
module_analyzer: Some(analyzer),
module_analyzer: analyzer,
..Default::default()
},
)

View file

@ -4,6 +4,7 @@
import { $ } from "https://deno.land/x/dax@0.31.0/mod.ts";
$.setPrintCommand(true);
const pwd = new URL(".", import.meta.url).pathname;
const AUTOBAHN_TESTSUITE_DOCKER =

View file

@ -3,6 +3,7 @@
use deno_ast::MediaType;
use deno_ast::ParseParams;
use deno_ast::SourceMapOption;
use deno_ast::SourceTextInfo;
use deno_core::error::AnyError;
use deno_core::extension;
@ -94,12 +95,20 @@ pub fn maybe_transpile_source(
scope_analysis: false,
maybe_syntax: None,
})?;
let transpiled_source = parsed.transpile(&deno_ast::EmitOptions {
imports_not_used_as_values: deno_ast::ImportsNotUsedAsValues::Remove,
inline_source_map: false,
source_map: cfg!(debug_assertions),
..Default::default()
})?;
let transpiled_source = parsed.transpile(
&deno_ast::TranspileOptions {
imports_not_used_as_values: deno_ast::ImportsNotUsedAsValues::Remove,
..Default::default()
},
&deno_ast::EmitOptions {
source_map: if cfg!(debug_assertions) {
SourceMapOption::Separate
} else {
SourceMapOption::None
},
..Default::default()
},
)?;
let maybe_source_map: Option<SourceMapData> = transpiled_source
.source_map

View file

@ -149,10 +149,7 @@ fn deno_doc_html() {
assert!(temp_dir.path().join("search_index.js").exists());
assert!(temp_dir.path().join("styles.css").exists());
assert!(temp_dir.path().join("~/MyInterface.html").exists());
assert!(temp_dir
.path()
.join("~/MyInterface.prototype.prop.html")
.exists());
assert!(temp_dir.path().join("~/MyInterface.prop.html").exists());
assert!(temp_dir.path().join("~/MyClass.html").exists());
assert!(temp_dir.path().join("~/MyClass.prototype.html").exists());
assert!(temp_dir

View file

@ -11,11 +11,6 @@ FNF:4
FNH:2
BRF:0
BRH:0
DA:1,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:17,2
DA:18,2
DA:19,2
@ -26,9 +21,6 @@ DA:24,2
DA:25,2
DA:26,2
DA:27,2
DA:29,1
DA:30,1
DA:31,1
DA:32,1
DA:33,1
DA:34,1
@ -38,8 +30,6 @@ DA:38,2
DA:39,2
DA:40,2
DA:42,2
DA:44,1
DA:45,1
DA:46,0
DA:47,0
DA:48,0
@ -49,19 +39,13 @@ DA:52,0
DA:53,0
DA:54,0
DA:56,0
DA:58,1
DA:59,1
DA:60,1
DA:62,1
DA:63,1
DA:64,0
DA:65,0
DA:66,0
DA:68,0
DA:70,1
DA:71,0
DA:73,1
DA:74,1
LH:37
LF:51
LH:21
LF:35
end_of_record

View file

@ -1,4 +1,4 @@
cover [WILDCARD]/coverage/complex.ts ... 72.549% (37/51)
cover [WILDCARD]/coverage/complex.ts ... 60.000% (21/35)
46 | export function unused(
47 | foo: string,
48 | bar: string,