mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 04:51:22 +00:00
fix: update deno_graph to fix importing config as JSON module (#15388)
Ref: denoland/deno_graph#166
This commit is contained in:
parent
1f54d87789
commit
1c2ec1f48f
57
Cargo.lock
generated
57
Cargo.lock
generated
@ -822,7 +822,7 @@ dependencies = [
|
||||
"fwdansi",
|
||||
"google-storage1",
|
||||
"http",
|
||||
"import_map 0.12.1",
|
||||
"import_map",
|
||||
"indexmap",
|
||||
"jsonc-parser",
|
||||
"libc",
|
||||
@ -979,15 +979,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_doc"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d323053b586448ee4b69d2f0b62f70463d27034586fa290b69b9fc5dd186bec"
|
||||
checksum = "f8afd542bb96b192f9cc640f0bc04daab2f7f93508627330511d5791bef86e44"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"deno_ast",
|
||||
"deno_graph",
|
||||
"futures",
|
||||
"import_map 0.11.0",
|
||||
"import_map",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"serde",
|
||||
@ -997,9 +997,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_emit"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2e2a0076182afa41ee8e697e7646facdcc069cca89df3b12ca982b5069758f4"
|
||||
checksum = "c73eaad7056d2fb8473236c8edecd3e24ad2eafc637d06534fe1620da4fd6cff"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.0",
|
||||
@ -1040,9 +1040,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_graph"
|
||||
version = "0.29.0"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91c6cc4d05b21c0dc80825a5dfb911ee09826004c89215c1bb92cbc1c44118d5"
|
||||
checksum = "d9f3c87eee6a5cf75a74f64d05ee34a3e17a13cec72c708c5b0251daf1423ef7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-if",
|
||||
@ -1575,9 +1575,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "eszip"
|
||||
version = "0.22.0"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d836148f2b8c14961b55faf3a88076dee3b9a51793cf01d420393d6235996c6"
|
||||
checksum = "abe2b413131dc7b90bc12e0e2cd4971b766c078ebb735ce38546ddb587c4109d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.0",
|
||||
@ -1606,9 +1606,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||
|
||||
[[package]]
|
||||
name = "fancy-regex"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "367dc842ccf982f1cebf8be5ecb65b347db9fd18bdd7fd255c5ad0d3fc02f6a6"
|
||||
checksum = "0678ab2d46fa5195aaf59ad034c083d351377d4af57f3e073c074d0da3e3c766"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"regex",
|
||||
@ -2191,19 +2191,6 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
|
||||
|
||||
[[package]]
|
||||
name = "import_map"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5247edf057fe57036112a1fec3864baa68052b52116760dbea4909115731272f"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"log 0.4.17",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"url 2.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "import_map"
|
||||
version = "0.12.1"
|
||||
@ -3392,9 +3379,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.6"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
|
||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -3409,9 +3396,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.26"
|
||||
version = "0.6.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
|
||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||
|
||||
[[package]]
|
||||
name = "relative-path"
|
||||
@ -3799,9 +3786,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.139"
|
||||
version = "1.0.141"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6"
|
||||
checksum = "7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -3817,9 +3804,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.139"
|
||||
version = "1.0.141"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb"
|
||||
checksum = "75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.39",
|
||||
"quote 1.0.18",
|
||||
@ -3828,9 +3815,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.81"
|
||||
version = "1.0.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
|
||||
checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa 1.0.2",
|
||||
|
@ -37,8 +37,8 @@ deno_web = { version = "0.95.0", path = "../ext/web" }
|
||||
deno_webgpu = { version = "0.65.0", path = "../ext/webgpu" }
|
||||
deno_websocket = { version = "0.69.0", path = "../ext/websocket" }
|
||||
deno_webstorage = { version = "0.59.0", path = "../ext/webstorage" }
|
||||
regex = "=1.5.6"
|
||||
serde = { version = "=1.0.139", features = ["derive"] }
|
||||
regex = "=1.6.0"
|
||||
serde = { version = "=1.0.141", features = ["derive"] }
|
||||
zstd = '=0.11.1'
|
||||
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
@ -48,9 +48,9 @@ winres = "=0.1.12"
|
||||
[dependencies]
|
||||
deno_ast = { version = "0.17.0", features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "transpiling", "typescript", "view", "visit"] }
|
||||
deno_core = { version = "0.146.0", path = "../core" }
|
||||
deno_doc = "0.38.0"
|
||||
deno_emit = "0.4.0"
|
||||
deno_graph = "0.29.0"
|
||||
deno_doc = "0.40.0"
|
||||
deno_emit = "0.5.0"
|
||||
deno_graph = "0.30.0"
|
||||
deno_lint = { version = "0.32.0", features = ["docs"] }
|
||||
deno_runtime = { version = "0.72.0", path = "../runtime" }
|
||||
deno_task_shell = "0.5.0"
|
||||
@ -69,8 +69,8 @@ dprint-plugin-markdown = "=0.14.0"
|
||||
dprint-plugin-typescript = "=0.71.2"
|
||||
encoding_rs = "=0.8.31"
|
||||
env_logger = "=0.9.0"
|
||||
eszip = "=0.22.0"
|
||||
fancy-regex = "=0.9.0"
|
||||
eszip = "=0.23.0"
|
||||
fancy-regex = "=0.10.0"
|
||||
http = "=0.2.6"
|
||||
import_map = "=0.12.1"
|
||||
indexmap = "1.8.1"
|
||||
@ -85,13 +85,13 @@ os_pipe = "=1.0.1"
|
||||
percent-encoding = "=2.1.0"
|
||||
pin-project = "1.0.11" # don't pin because they yank crates from cargo
|
||||
rand = { version = "=0.8.5", features = ["small_rng"] }
|
||||
regex = "=1.5.6"
|
||||
regex = "=1.6.0"
|
||||
ring = "=0.16.20"
|
||||
rustyline = { version = "=10.0.0", default-features = false, features = ["custom-bindings"] }
|
||||
rustyline-derive = "=0.7.0"
|
||||
secure_tempfile = { version = "=3.3.0", package = "tempfile" } # different name to discourage use in tests
|
||||
semver-parser = "=0.10.2"
|
||||
serde = { version = "=1.0.139", features = ["derive"] }
|
||||
serde = { version = "=1.0.141", features = ["derive"] }
|
||||
serde_repr = "=0.1.8"
|
||||
shell-escape = "=0.1.5"
|
||||
text-size = "=1.1.0"
|
||||
|
@ -70,6 +70,27 @@ pub struct GraphData {
|
||||
impl GraphData {
|
||||
/// Store data from `graph` into `self`.
|
||||
pub fn add_graph(&mut self, graph: &ModuleGraph, reload: bool) {
|
||||
for graph_import in &graph.imports {
|
||||
let mut dependencies = BTreeMap::new();
|
||||
for (specifier, dependency) in &graph_import.dependencies {
|
||||
if !matches!(dependency.maybe_type, Resolved::None) {
|
||||
dependencies.insert(specifier.clone(), dependency.maybe_type.clone());
|
||||
if let Resolved::Ok {
|
||||
specifier, range, ..
|
||||
} = &dependency.maybe_type
|
||||
{
|
||||
let entry = self.referrer_map.entry(specifier.clone());
|
||||
entry.or_insert_with(|| range.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
self.modules.insert(
|
||||
graph_import.referrer.clone(),
|
||||
ModuleEntry::Configuration { dependencies },
|
||||
);
|
||||
self.configurations.insert(graph_import.referrer.clone());
|
||||
}
|
||||
|
||||
for (specifier, result) in graph.specifiers() {
|
||||
if !reload && self.modules.contains_key(&specifier) {
|
||||
continue;
|
||||
@ -82,27 +103,6 @@ impl GraphData {
|
||||
match result {
|
||||
Ok((_, _, media_type)) => {
|
||||
let module = graph.get(&specifier).unwrap();
|
||||
if module.kind == ModuleKind::Synthetic {
|
||||
let mut dependencies = BTreeMap::new();
|
||||
for (specifier, dependency) in &module.dependencies {
|
||||
if !matches!(dependency.maybe_type, Resolved::None) {
|
||||
dependencies
|
||||
.insert(specifier.clone(), dependency.maybe_type.clone());
|
||||
if let Resolved::Ok {
|
||||
specifier, range, ..
|
||||
} = &dependency.maybe_type
|
||||
{
|
||||
let entry = self.referrer_map.entry(specifier.clone());
|
||||
entry.or_insert_with(|| range.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
self.modules.insert(
|
||||
module.specifier.clone(),
|
||||
ModuleEntry::Configuration { dependencies },
|
||||
);
|
||||
self.configurations.insert(module.specifier.clone());
|
||||
}
|
||||
let code = match &module.maybe_source {
|
||||
Some(source) => source.clone(),
|
||||
None => continue,
|
||||
|
@ -23,7 +23,7 @@ use deno_core::error::AnyError;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::url;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_graph::Module;
|
||||
use deno_graph::GraphImport;
|
||||
use deno_graph::Resolved;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::BTreeMap;
|
||||
@ -719,7 +719,7 @@ pub struct Documents {
|
||||
file_system_docs: Arc<Mutex<FileSystemDocuments>>,
|
||||
/// Any imports to the context supplied by configuration files. This is like
|
||||
/// the imports into the a module graph in CLI.
|
||||
imports: Arc<HashMap<ModuleSpecifier, Module>>,
|
||||
imports: Arc<HashMap<ModuleSpecifier, GraphImport>>,
|
||||
/// The optional import map that should be used when resolving dependencies.
|
||||
maybe_import_map: Option<ImportMapResolver>,
|
||||
/// The optional JSX resolver, which is used when JSX imports are configured.
|
||||
@ -1035,12 +1035,12 @@ impl Documents {
|
||||
imports
|
||||
.into_iter()
|
||||
.map(|(referrer, dependencies)| {
|
||||
let module = Module::new_from_type_imports(
|
||||
let graph_import = GraphImport::new(
|
||||
referrer.clone(),
|
||||
dependencies,
|
||||
self.get_maybe_resolver(),
|
||||
);
|
||||
(referrer, module)
|
||||
(referrer, graph_import)
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
@ -1128,8 +1128,8 @@ impl Documents {
|
||||
&self,
|
||||
specifier: &str,
|
||||
) -> Option<&deno_graph::Resolved> {
|
||||
for module in self.imports.values() {
|
||||
let maybe_dep = module.dependencies.get(specifier);
|
||||
for graph_imports in self.imports.values() {
|
||||
let maybe_dep = graph_imports.dependencies.get(specifier);
|
||||
if maybe_dep.is_some() {
|
||||
return maybe_dep.map(|d| &d.maybe_type);
|
||||
}
|
||||
|
3
cli/tests/testdata/035_cached_only_flag.out
vendored
3
cli/tests/testdata/035_cached_only_flag.out
vendored
@ -1 +1,4 @@
|
||||
error: Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified.
|
||||
|
||||
Caused by:
|
||||
Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified.
|
||||
|
3
cli/tests/testdata/052_no_remote_flag.out
vendored
3
cli/tests/testdata/052_no_remote_flag.out
vendored
@ -1 +1,4 @@
|
||||
error: A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified.
|
||||
|
||||
Caused by:
|
||||
A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified.
|
||||
|
@ -6,7 +6,4 @@ Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2
|
||||
|
||||
function test(options: object): void
|
||||
|
||||
Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:5:2
|
||||
|
||||
function test(name: string | object, fn?: Function): void
|
||||
|
||||
|
@ -15,5 +15,5 @@ once_cell = "1.10.0"
|
||||
proc-macro-crate = "1.1.3"
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
regex = "1.5.6"
|
||||
regex = "1.6.0"
|
||||
syn = { version = "1", features = ["full", "extra-traits"] }
|
||||
|
@ -76,7 +76,7 @@ lzzzz = '1.0'
|
||||
netif = "0.1.3"
|
||||
notify = "=5.0.0-pre.15"
|
||||
once_cell = "1.10.0"
|
||||
regex = "1.5.5"
|
||||
regex = "1.6.0"
|
||||
ring = "0.16.20"
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
signal-hook-registry = "1.4.0"
|
||||
|
@ -23,7 +23,7 @@ once_cell = "1.10.0"
|
||||
os_pipe = "1.0.1"
|
||||
parking_lot = "0.12.0"
|
||||
pretty_assertions = "=1.2.1"
|
||||
regex = "1.5.5"
|
||||
regex = "1.6.0"
|
||||
rustls-pemfile = "1.0.0"
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
serde_json = "1.0.79"
|
||||
|
Loading…
Reference in New Issue
Block a user