Unverified Commit 085b7015 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: Remove unused turbopack-node rendering code (#83414)

- Remove dead code back from the old days
- Update a few crates

Codspeed didn't really have anything breaking in v3? https://github.com/CodSpeedHQ/codspeed-rust/releases
parent 38c4caf2
...@@ -251,6 +251,15 @@ dependencies = [ ...@@ -251,6 +251,15 @@ dependencies = [
"backtrace", "backtrace",
] ]
[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "arbitrary" name = "arbitrary"
version = "1.4.1" version = "1.4.1"
...@@ -971,12 +980,6 @@ version = "1.0.1" ...@@ -971,12 +980,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]] [[package]]
name = "cfg_aliases" name = "cfg_aliases"
version = "0.2.1" version = "0.2.1"
...@@ -1162,22 +1165,27 @@ dependencies = [ ...@@ -1162,22 +1165,27 @@ dependencies = [
[[package]] [[package]]
name = "codspeed" name = "codspeed"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f4cce9c27c49c4f101fffeebb1826f41a9df2e7498b7cd4d95c0658b796c6c" checksum = "35584c5fcba8059780748866387fb97c5a203bcfc563fc3d0790af406727a117"
dependencies = [ dependencies = [
"anyhow",
"bincode",
"colored", "colored",
"glob",
"libc", "libc",
"nix 0.29.0",
"serde", "serde",
"serde_json", "serde_json",
"statrs",
"uuid", "uuid",
] ]
[[package]] [[package]]
name = "codspeed-criterion-compat" name = "codspeed-criterion-compat"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c23d880a28a2aab52d38ca8481dd7a3187157d0a952196b6db1db3c8499725" checksum = "78f6c1c6bed5fd84d319e8b0889da051daa361c79b7709c9394dfe1a882bba67"
dependencies = [ dependencies = [
"codspeed", "codspeed",
"codspeed-criterion-compat-walltime", "codspeed-criterion-compat-walltime",
...@@ -1188,9 +1196,9 @@ dependencies = [ ...@@ -1188,9 +1196,9 @@ dependencies = [
[[package]] [[package]]
name = "codspeed-criterion-compat-walltime" name = "codspeed-criterion-compat-walltime"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a2f7365e347f4f22a67e9ea689bf7bc89900a354e22e26cf8a531a42c8fbb" checksum = "c989289ce6b1cbde72ed560496cb8fbf5aa14d5ef5666f168e7f87751038352e"
dependencies = [ dependencies = [
"anes", "anes",
"cast", "cast",
...@@ -1217,9 +1225,9 @@ dependencies = [ ...@@ -1217,9 +1225,9 @@ dependencies = [
[[package]] [[package]]
name = "codspeed-divan-compat" name = "codspeed-divan-compat"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8620a09dfaf37b3c45f982c4b65bd8f9b0203944da3ffa705c0fcae6b84655ff" checksum = "adf64eda57508448d59efd940bad62ede7c50b0d451a150b8d6a0eca642792a6"
dependencies = [ dependencies = [
"codspeed", "codspeed",
"codspeed-divan-compat-macros", "codspeed-divan-compat-macros",
...@@ -1228,9 +1236,9 @@ dependencies = [ ...@@ -1228,9 +1236,9 @@ dependencies = [
[[package]] [[package]]
name = "codspeed-divan-compat-macros" name = "codspeed-divan-compat-macros"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30fe872bc4214626b35d3a1706a905d0243503bb6ba3bb7be2fc59083d5d680c" checksum = "058167258e819b16a4ba601fdfe270349ef191154758dbce122c62a698f70ba8"
dependencies = [ dependencies = [
"divan-macros", "divan-macros",
"itertools 0.14.0", "itertools 0.14.0",
...@@ -1242,9 +1250,9 @@ dependencies = [ ...@@ -1242,9 +1250,9 @@ dependencies = [
[[package]] [[package]]
name = "codspeed-divan-compat-walltime" name = "codspeed-divan-compat-walltime"
version = "2.10.1" version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "104caa97b36d4092d89e24e4b103b40ede1edab03c0372d19e14a33f9393132b" checksum = "48f9866ee3a4ef9d2868823ea5811886763af244f2df584ca247f49281c43f1f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"clap", "clap",
...@@ -1618,7 +1626,7 @@ dependencies = [ ...@@ -1618,7 +1626,7 @@ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
"crossbeam-utils", "crossbeam-utils",
"memoffset 0.9.0", "memoffset",
"scopeguard", "scopeguard",
] ]
...@@ -1740,12 +1748,12 @@ dependencies = [ ...@@ -1740,12 +1748,12 @@ dependencies = [
[[package]] [[package]]
name = "ctrlc" name = "ctrlc"
version = "3.4.4" version = "3.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345" checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73"
dependencies = [ dependencies = [
"nix 0.28.0", "nix 0.30.1",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
...@@ -2510,9 +2518,9 @@ dependencies = [ ...@@ -2510,9 +2518,9 @@ dependencies = [
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]] [[package]]
name = "globset" name = "globset"
...@@ -3963,15 +3971,6 @@ dependencies = [ ...@@ -3963,15 +3971,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.9.0" version = "0.9.0"
...@@ -3989,7 +3988,7 @@ checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" ...@@ -3989,7 +3988,7 @@ checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"miette-derive", "miette-derive",
"owo-colors 4.0.0", "owo-colors",
"textwrap", "textwrap",
"thiserror 1.0.69", "thiserror 1.0.69",
"unicode-width 0.1.13", "unicode-width 0.1.13",
...@@ -4441,7 +4440,7 @@ dependencies = [ ...@@ -4441,7 +4440,7 @@ dependencies = [
"next-custom-transforms", "next-custom-transforms",
"next-taskless", "next-taskless",
"once_cell", "once_cell",
"owo-colors 3.5.0", "owo-colors",
"rand 0.9.0", "rand 0.9.0",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"serde", "serde",
...@@ -4481,26 +4480,25 @@ dependencies = [ ...@@ -4481,26 +4480,25 @@ dependencies = [
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.26.4" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.9.1",
"cfg-if", "cfg-if",
"cfg_aliases",
"libc", "libc",
"memoffset 0.7.1",
"pin-utils",
] ]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.28.0" version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"cfg-if", "cfg-if",
"cfg_aliases 0.1.1", "cfg_aliases",
"libc", "libc",
] ]
...@@ -4817,15 +4815,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" ...@@ -4817,15 +4815,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "owo-colors" name = "owo-colors"
version = "3.5.0" version = "4.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "owo-colors"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e"
[[package]] [[package]]
name = "papergrid" name = "papergrid"
...@@ -5498,7 +5490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -5498,7 +5490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8"
dependencies = [ dependencies = [
"bytes", "bytes",
"cfg_aliases 0.2.1", "cfg_aliases",
"pin-project-lite", "pin-project-lite",
"quinn-proto", "quinn-proto",
"quinn-udp", "quinn-udp",
...@@ -5538,7 +5530,7 @@ version = "0.5.12" ...@@ -5538,7 +5530,7 @@ version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842"
dependencies = [ dependencies = [
"cfg_aliases 0.2.1", "cfg_aliases",
"libc", "libc",
"once_cell", "once_cell",
"socket2 0.5.10", "socket2 0.5.10",
...@@ -6890,6 +6882,16 @@ version = "1.1.0" ...@@ -6890,6 +6882,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "statrs"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e"
dependencies = [
"approx",
"num-traits",
]
[[package]] [[package]]
name = "string_enum" name = "string_enum"
version = "1.0.2" version = "1.0.2"
...@@ -7038,7 +7040,7 @@ version = "0.1.0" ...@@ -7038,7 +7040,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
"owo-colors 3.5.0", "owo-colors",
"regex", "regex",
"swc_core", "swc_core",
] ]
...@@ -9505,9 +9507,9 @@ dependencies = [ ...@@ -9505,9 +9507,9 @@ dependencies = [
"chromiumoxide", "chromiumoxide",
"codspeed-criterion-compat", "codspeed-criterion-compat",
"futures", "futures",
"nix 0.26.4", "nix 0.30.1",
"once_cell", "once_cell",
"owo-colors 3.5.0", "owo-colors",
"parking_lot", "parking_lot",
"portpicker", "portpicker",
"rand 0.9.0", "rand 0.9.0",
...@@ -9555,7 +9557,7 @@ dependencies = [ ...@@ -9555,7 +9557,7 @@ dependencies = [
"console-subscriber", "console-subscriber",
"dunce", "dunce",
"futures", "futures",
"owo-colors 3.5.0", "owo-colors",
"regex", "regex",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"serde", "serde",
...@@ -9590,9 +9592,8 @@ name = "turbopack-cli-utils" ...@@ -9590,9 +9592,8 @@ name = "turbopack-cli-utils"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap",
"crossterm 0.26.1", "crossterm 0.26.1",
"owo-colors 3.5.0", "owo-colors",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"serde", "serde",
"turbo-rcstr", "turbo-rcstr",
...@@ -9909,7 +9910,7 @@ dependencies = [ ...@@ -9909,7 +9910,7 @@ dependencies = [
"futures-retry", "futures-retry",
"indoc", "indoc",
"once_cell", "once_cell",
"owo-colors 3.5.0", "owo-colors",
"parking_lot", "parking_lot",
"regex", "regex",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
...@@ -9925,7 +9926,6 @@ dependencies = [ ...@@ -9925,7 +9926,6 @@ dependencies = [
"turbo-tasks-fs", "turbo-tasks-fs",
"turbopack-cli-utils", "turbopack-cli-utils",
"turbopack-core", "turbopack-core",
"turbopack-dev-server",
"turbopack-ecmascript", "turbopack-ecmascript",
"turbopack-resolve", "turbopack-resolve",
] ]
...@@ -10886,7 +10886,7 @@ dependencies = [ ...@@ -10886,7 +10886,7 @@ dependencies = [
"libc", "libc",
"libunwind", "libunwind",
"mach2", "mach2",
"memoffset 0.9.0", "memoffset",
"more-asserts", "more-asserts",
"region", "region",
"rustversion", "rustversion",
...@@ -11580,7 +11580,7 @@ dependencies = [ ...@@ -11580,7 +11580,7 @@ dependencies = [
"indexmap 2.9.0", "indexmap 2.9.0",
"inquire", "inquire",
"num-format", "num-format",
"owo-colors 3.5.0", "owo-colors",
"plotters", "plotters",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"semver", "semver",
......
...@@ -352,11 +352,11 @@ clap = { version = "4.5.2", features = ["derive"] } ...@@ -352,11 +352,11 @@ clap = { version = "4.5.2", features = ["derive"] }
concurrent-queue = "2.5.0" concurrent-queue = "2.5.0"
console-subscriber = "0.4.1" console-subscriber = "0.4.1"
const_format = "0.2.30" const_format = "0.2.30"
criterion = { package = "codspeed-criterion-compat", version = "2.10.1" } criterion = { package = "codspeed-criterion-compat", version = "3.0.5" }
crossbeam-channel = "0.5.8" crossbeam-channel = "0.5.8"
dashmap = "6.1.0" dashmap = "6.1.0"
data-encoding = "2.3.3" data-encoding = "2.3.3"
divan = { version = "2.10.1", package = "codspeed-divan-compat" } divan = { package = "codspeed-divan-compat", version = "3.0.5" }
dhat = { version = "0.3.2" } dhat = { version = "0.3.2" }
dunce = "1.0.3" dunce = "1.0.3"
either = "1.9.0" either = "1.9.0"
...@@ -392,7 +392,7 @@ napi = { version = "2", default-features = false, features = [ ...@@ -392,7 +392,7 @@ napi = { version = "2", default-features = false, features = [
] } ] }
notify = "8.1.0" notify = "8.1.0"
once_cell = "1.17.1" once_cell = "1.17.1"
owo-colors = "3.5.0" owo-colors = "4.2.2"
parcel_selectors = "0.28.2" parcel_selectors = "0.28.2"
parking_lot = "0.12.1" parking_lot = "0.12.1"
pathdiff = "0.2.1" pathdiff = "0.2.1"
......
...@@ -40,4 +40,4 @@ turbopack-create-test-app = { workspace = true } ...@@ -40,4 +40,4 @@ turbopack-create-test-app = { workspace = true }
url = { workspace = true } url = { workspace = true }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
nix = "0.26.1" nix = "0.30.1"
...@@ -16,7 +16,6 @@ workspace = true ...@@ -16,7 +16,6 @@ workspace = true
[dependencies] [dependencies]
anyhow = { workspace = true } anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
crossterm = "0.26.0" crossterm = "0.26.0"
owo-colors = { workspace = true } owo-colors = { workspace = true }
rustc-hash = { workspace = true } rustc-hash = { workspace = true }
......
...@@ -4,11 +4,10 @@ use std::{ ...@@ -4,11 +4,10 @@ use std::{
collections::hash_map::Entry, collections::hash_map::Entry,
fmt::Write as _, fmt::Write as _,
path::{Path, PathBuf}, path::{Path, PathBuf},
str::FromStr,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
use anyhow::{Result, anyhow}; use anyhow::Result;
use crossterm::style::{StyledContent, Stylize}; use crossterm::style::{StyledContent, Stylize};
use owo_colors::{OwoColorize as _, Style}; use owo_colors::{OwoColorize as _, Style};
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
...@@ -22,50 +21,6 @@ use turbopack_core::issue::{ ...@@ -22,50 +21,6 @@ use turbopack_core::issue::{
use crate::source_context::format_source_context_lines; use crate::source_context::format_source_context_lines;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct IssueSeverityCliOption(pub IssueSeverity);
impl serde::Serialize for IssueSeverityCliOption {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.serialize_str(&self.0.to_string())
}
}
impl<'de> serde::Deserialize<'de> for IssueSeverityCliOption {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let s = String::deserialize(deserializer)?;
IssueSeverityCliOption::from_str(&s).map_err(serde::de::Error::custom)
}
}
impl clap::ValueEnum for IssueSeverityCliOption {
fn value_variants<'a>() -> &'a [Self] {
const VARIANTS: [IssueSeverityCliOption; 8] = [
IssueSeverityCliOption(IssueSeverity::Bug),
IssueSeverityCliOption(IssueSeverity::Fatal),
IssueSeverityCliOption(IssueSeverity::Error),
IssueSeverityCliOption(IssueSeverity::Warning),
IssueSeverityCliOption(IssueSeverity::Hint),
IssueSeverityCliOption(IssueSeverity::Note),
IssueSeverityCliOption(IssueSeverity::Suggestion),
IssueSeverityCliOption(IssueSeverity::Info),
];
&VARIANTS
}
fn to_possible_value<'a>(&self) -> Option<clap::builder::PossibleValue> {
Some(clap::builder::PossibleValue::new(self.0.as_str()).help(self.0.as_help_str()))
}
}
impl FromStr for IssueSeverityCliOption {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
<IssueSeverityCliOption as clap::ValueEnum>::from_str(s, true).map_err(|s| anyhow!("{}", s))
}
}
fn severity_to_style(severity: IssueSeverity) -> Style { fn severity_to_style(severity: IssueSeverity) -> Style {
match severity { match severity {
IssueSeverity::Bug => Style::new().bright_red().underline(), IssueSeverity::Bug => Style::new().bright_red().underline(),
......
use std::{ use std::{
net::IpAddr, net::IpAddr,
path::{Path, PathBuf}, path::{Path, PathBuf},
str::FromStr,
}; };
use anyhow::anyhow;
use clap::{Args, Parser, ValueEnum}; use clap::{Args, Parser, ValueEnum};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs};
use turbopack_cli_utils::issue::IssueSeverityCliOption; use turbopack_core::issue::IssueSeverity;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(author, version, about, long_about = None)] #[clap(author, version, about, long_about = None)]
...@@ -146,3 +148,48 @@ pub struct BuildArguments { ...@@ -146,3 +148,48 @@ pub struct BuildArguments {
#[clap(long, hide = true)] #[clap(long, hide = true)]
pub force_memory_cleanup: bool, pub force_memory_cleanup: bool,
} }
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct IssueSeverityCliOption(pub IssueSeverity);
impl serde::Serialize for IssueSeverityCliOption {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.serialize_str(&self.0.to_string())
}
}
impl<'de> serde::Deserialize<'de> for IssueSeverityCliOption {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let s = String::deserialize(deserializer)?;
<IssueSeverityCliOption as std::str::FromStr>::from_str(&s)
.map_err(serde::de::Error::custom)
}
}
impl ValueEnum for IssueSeverityCliOption {
fn value_variants<'a>() -> &'a [Self] {
const VARIANTS: [IssueSeverityCliOption; 8] = [
IssueSeverityCliOption(IssueSeverity::Bug),
IssueSeverityCliOption(IssueSeverity::Fatal),
IssueSeverityCliOption(IssueSeverity::Error),
IssueSeverityCliOption(IssueSeverity::Warning),
IssueSeverityCliOption(IssueSeverity::Hint),
IssueSeverityCliOption(IssueSeverity::Note),
IssueSeverityCliOption(IssueSeverity::Suggestion),
IssueSeverityCliOption(IssueSeverity::Info),
];
&VARIANTS
}
fn to_possible_value<'a>(&self) -> Option<clap::builder::PossibleValue> {
Some(clap::builder::PossibleValue::new(self.0.as_str()).help(self.0.as_help_str()))
}
}
impl FromStr for IssueSeverityCliOption {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
<IssueSeverityCliOption as clap::ValueEnum>::from_str(s, true).map_err(|s| anyhow!("{}", s))
}
}
...@@ -43,7 +43,6 @@ turbo-tasks-env = { workspace = true } ...@@ -43,7 +43,6 @@ turbo-tasks-env = { workspace = true }
turbo-tasks-fs = { workspace = true } turbo-tasks-fs = { workspace = true }
turbopack-cli-utils = { workspace = true } turbopack-cli-utils = { workspace = true }
turbopack-core = { workspace = true } turbopack-core = { workspace = true }
turbopack-dev-server = { workspace = true }
turbopack-ecmascript = { workspace = true } turbopack-ecmascript = { workspace = true }
turbopack-resolve = { workspace = true } turbopack-resolve = { workspace = true }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
use std::{iter::once, thread::available_parallelism}; use std::{iter::once, thread::available_parallelism};
use anyhow::{Result, bail}; use anyhow::{Result, bail};
pub use node_entry::{NodeEntry, NodeRenderingEntries, NodeRenderingEntry};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
...@@ -25,16 +24,14 @@ use turbopack_core::{ ...@@ -25,16 +24,14 @@ use turbopack_core::{
virtual_output::VirtualOutputAsset, virtual_output::VirtualOutputAsset,
}; };
use self::{pool::NodeJsPool, source_map::StructuredError}; use self::pool::NodeJsPool;
pub mod debug; pub mod debug;
pub mod embed_js; pub mod embed_js;
pub mod evaluate; pub mod evaluate;
pub mod execution_context; pub mod execution_context;
mod heap_queue; mod heap_queue;
mod node_entry;
mod pool; mod pool;
pub mod render;
pub mod route_matcher; pub mod route_matcher;
pub mod source_map; pub mod source_map;
pub mod transforms; pub mod transforms;
......
use anyhow::Result;
use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::chunk::{ChunkingContext, EvaluatableAsset, EvaluatableAssets};
use turbopack_dev_server::source::ContentSourceData;
#[turbo_tasks::value(shared)]
pub struct NodeRenderingEntry {
pub runtime_entries: ResolvedVc<EvaluatableAssets>,
pub module: ResolvedVc<Box<dyn EvaluatableAsset>>,
pub chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
pub intermediate_output_path: FileSystemPath,
pub output_root: FileSystemPath,
pub project_dir: FileSystemPath,
}
#[turbo_tasks::value(transparent)]
pub struct NodeRenderingEntries(Vec<ResolvedVc<NodeRenderingEntry>>);
/// Trait that allows to get the entry module for rendering something in Node.js
#[turbo_tasks::value_trait]
pub trait NodeEntry {
#[turbo_tasks::function]
fn entry(self: Vc<Self>, data: ContentSourceData) -> Vc<NodeRenderingEntry>;
#[turbo_tasks::function]
async fn entries(self: Vc<Self>) -> Result<Vc<NodeRenderingEntries>> {
Ok(Vc::cell(vec![
self.entry(Default::default()).to_resolved().await?,
]))
}
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>${TITLE}</title>
</head>
<body>
<div id="__next">
<!-- put it in here, so we can just use the body -->
<style>
body {
color: #000;
background: #fff;
margin: 0;
}
.next-error-h1 {
border-right: 1px solid rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
body {
color: #fff;
background: #000;
}
.next-error-h1 {
border-right: 1px solid rgba(255, 255, 255, 0.3);
}
}
.error {
/* https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52 */
font-family:
system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji';
height: 100vh;
max-height: 100vh;
overflow: hidden;
/*text-align: center;*/
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.error > div {
max-width: 100%;
}
.desc {
display: inline-block;
text-align: left;
}
h1 {
display: inline-block;
margin: 0 20px 0 0;
padding-right: 23px;
font-size: 24px;
font-weight: 500;
vertical-align: top;
line-height: 49px;
}
h2 {
font-size: 14px;
font-weight: 400;
line-height: 49px;
margin: 0;
}
h3 {
margin-left: 15px;
font-size: 14px;
font-weight: 600;
}
.details {
margin-top: 100px;
overflow: hidden;
max-height: 70%;
}
pre {
padding: 15px;
background: #ddd;
/*white-space: pre-wrap;*/
/*word-break: keep-all;*/
max-width: 80vw;
overflow: scroll;
max-height: 90%;
border-radius: 10px;
}
@media (prefers-color-scheme: dark) {
pre {
background: #222;
}
}
</style>
<div class="error">
<div>
<h1 class="next-error-h1">${STATUS_CODE}</h1>
<div class="desc">
<h2>${TITLE}.</h2>
</div>
</div>
<section class="details">
<h3>Details</h3>
<pre>${DETAILS}</pre>
</section>
</div>
</div>
</body>
</html>
use anyhow::{Context, Result};
use turbo_rcstr::RcStr;
use turbo_tasks::Vc;
use turbo_tasks_fs::embed_file;
#[turbo_tasks::function]
pub(super) async fn error_html(
status_code: u16,
title: RcStr,
details: RcStr,
) -> Result<Vc<RcStr>> {
let html = create_html(status_code, title, details).await?;
Ok(Vc::cell(html.into()))
}
#[turbo_tasks::function]
pub(super) async fn error_html_body(
status_code: u16,
title: RcStr,
details: RcStr,
) -> Result<Vc<RcStr>> {
let html = create_html(status_code, title, details).await?;
let (_, body) = html.split_once("<body>").context("no body in html")?;
let (body, _) = body.split_once("</body>").context("no body in html")?;
Ok(Vc::cell(body.into()))
}
async fn create_html(status_code: u16, title: RcStr, details: RcStr) -> Result<String> {
let file_content = embed_file!("src/render/error.html").await?;
let file = file_content
.as_content()
.context("embedded file not found (this should not happen)")?;
let html = file
.content()
.to_str()
.context("couldn't convert embedded html to string")?;
let html = html.replace("${TITLE}", &title);
let html = html.replace("${STATUS_CODE}", &status_code.to_string());
let html = html.replace("${DETAILS}", &details);
Ok(html)
}
use turbo_rcstr::rcstr;
use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::issue::{Issue, IssueStage, OptionStyledString, StyledString};
#[turbo_tasks::value(shared)]
#[derive(Clone)]
pub struct RenderingIssue {
pub file_path: FileSystemPath,
pub message: ResolvedVc<StyledString>,
pub status: Option<i32>,
}
#[turbo_tasks::value_impl]
impl Issue for RenderingIssue {
#[turbo_tasks::function]
fn title(&self) -> Vc<StyledString> {
StyledString::Text(rcstr!("Error during SSR Rendering")).cell()
}
#[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> {
IssueStage::CodeGen.cell()
}
#[turbo_tasks::function]
fn file_path(&self) -> Vc<FileSystemPath> {
self.file_path.clone().cell()
}
#[turbo_tasks::function]
fn description(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(self.message))
}
#[turbo_tasks::function]
fn detail(&self) -> Vc<OptionStyledString> {
let mut details = vec![];
if let Some(status) = self.status
&& status != 0
{
details.push(StyledString::Text(
format!("Node.js exit code: {status}").into(),
));
}
Vc::cell(Some(StyledString::Stack(details).resolved_cell()))
}
// TODO parse stack trace into source location
}
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use turbo_rcstr::RcStr;
use turbo_tasks::{FxIndexMap, ReadRef};
use crate::{ResponseHeaders, StructuredError, route_matcher::Param};
pub(crate) mod error_page;
pub mod issue;
pub mod node_api_source;
pub mod render_proxy;
pub mod render_static;
pub mod rendered_source;
#[turbo_tasks::value(shared)]
#[serde(rename_all = "camelCase")]
pub struct RenderData {
params: FxIndexMap<RcStr, Param>,
method: RcStr,
url: RcStr,
original_url: RcStr,
raw_query: RcStr,
raw_headers: Vec<(RcStr, RcStr)>,
path: RcStr,
data: Option<ReadRef<JsonValue>>,
}
#[derive(Serialize)]
#[serde(tag = "type", rename_all = "camelCase")]
enum RenderStaticOutgoingMessage<'a> {
Headers { data: &'a RenderData },
}
#[derive(Serialize)]
#[serde(tag = "type", rename_all = "camelCase")]
enum RenderProxyOutgoingMessage<'a> {
Headers { data: &'a RenderData },
BodyChunk { data: &'a [u8] },
BodyEnd,
}
#[derive(Deserialize, Debug)]
#[serde(tag = "type", rename_all = "camelCase")]
enum RenderProxyIncomingMessage {
Headers { data: ResponseHeaders },
BodyChunk { data: Vec<u8> },
BodyEnd,
Error(StructuredError),
}
#[derive(Deserialize, Debug)]
#[serde(tag = "type", rename_all = "camelCase")]
enum RenderStaticIncomingMessage {
#[serde(rename_all = "camelCase")]
Response {
status_code: u16,
headers: Vec<(RcStr, RcStr)>,
body: RcStr,
},
Headers {
data: ResponseHeaders,
},
BodyChunk {
data: Vec<u8>,
},
BodyEnd,
Rewrite {
path: RcStr,
},
Error(StructuredError),
}
use anyhow::Result;
use serde_json::Value as JsonValue;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{FxIndexSet, ResolvedVc, Vc};
use turbo_tasks_env::ProcessEnv;
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::introspect::{
Introspectable, IntrospectableChildren, module::IntrospectableModule,
output_asset::IntrospectableOutputAsset,
};
use turbopack_dev_server::source::{
ContentSource, ContentSourceContent, ContentSourceData, ContentSourceDataVary,
GetContentSourceContent,
route_tree::{BaseSegment, RouteTree, RouteType},
};
use super::{RenderData, render_proxy::render_proxy_operation};
use crate::{get_intermediate_asset, node_entry::NodeEntry, route_matcher::RouteMatcher};
/// Creates a [NodeApiContentSource].
#[turbo_tasks::function]
pub fn create_node_api_source(
cwd: FileSystemPath,
env: ResolvedVc<Box<dyn ProcessEnv>>,
base_segments: Vec<BaseSegment>,
route_type: RouteType,
server_root: FileSystemPath,
route_match: ResolvedVc<Box<dyn RouteMatcher>>,
pathname: ResolvedVc<RcStr>,
entry: ResolvedVc<Box<dyn NodeEntry>>,
render_data: ResolvedVc<JsonValue>,
debug: bool,
) -> Vc<Box<dyn ContentSource>> {
Vc::upcast(
NodeApiContentSource {
cwd,
env,
base_segments,
route_type,
server_root,
pathname,
route_match,
entry,
render_data,
debug,
}
.cell(),
)
}
/// A content source that proxies API requests to one-off Node.js
/// servers running the passed `entry` when it matches a `path_regex`.
///
/// It needs a temporary directory (`intermediate_output_path`) to place file
/// for Node.js execution during rendering. The `chunking_context` should emit
/// to this directory.
#[turbo_tasks::value]
pub struct NodeApiContentSource {
cwd: FileSystemPath,
env: ResolvedVc<Box<dyn ProcessEnv>>,
base_segments: Vec<BaseSegment>,
route_type: RouteType,
server_root: FileSystemPath,
pathname: ResolvedVc<RcStr>,
route_match: ResolvedVc<Box<dyn RouteMatcher>>,
entry: ResolvedVc<Box<dyn NodeEntry>>,
render_data: ResolvedVc<JsonValue>,
debug: bool,
}
#[turbo_tasks::value_impl]
impl NodeApiContentSource {
#[turbo_tasks::function]
pub fn get_pathname(&self) -> Vc<RcStr> {
*self.pathname
}
}
#[turbo_tasks::value_impl]
impl ContentSource for NodeApiContentSource {
#[turbo_tasks::function]
async fn get_routes(self: Vc<Self>) -> Result<Vc<RouteTree>> {
let this = self.await?;
Ok(RouteTree::new_route(
this.base_segments.clone(),
this.route_type.clone(),
Vc::upcast(self),
))
}
}
#[turbo_tasks::value_impl]
impl GetContentSourceContent for NodeApiContentSource {
#[turbo_tasks::function]
fn vary(&self) -> Vc<ContentSourceDataVary> {
ContentSourceDataVary {
method: true,
url: true,
original_url: true,
raw_headers: true,
raw_query: true,
body: true,
cache_buster: true,
..Default::default()
}
.cell()
}
#[turbo_tasks::function]
async fn get(&self, path: RcStr, data: ContentSourceData) -> Result<Vc<ContentSourceContent>> {
let Some(params) = &*self.route_match.params(path.clone()).await? else {
anyhow::bail!("Non matching path provided")
};
let ContentSourceData {
method: Some(method),
url: Some(url),
original_url: Some(original_url),
raw_headers: Some(raw_headers),
raw_query: Some(raw_query),
body: Some(body),
..
} = &data
else {
anyhow::bail!("Missing request data")
};
let entry = (*self.entry).entry(data.clone()).await?;
Ok(ContentSourceContent::HttpProxy(render_proxy_operation(
self.cwd.clone(),
self.env,
self.server_root.join(&path)?,
ResolvedVc::upcast(entry.module),
entry.runtime_entries,
entry.chunking_context,
entry.intermediate_output_path.clone(),
entry.output_root.clone(),
entry.project_dir.clone(),
RenderData {
params: params.clone(),
method: method.clone(),
url: url.clone(),
original_url: original_url.clone(),
raw_query: raw_query.clone(),
raw_headers: raw_headers.clone(),
path: format!("/{path}").into(),
data: Some(self.render_data.await?),
}
.resolved_cell(),
*body,
self.debug,
))
.cell())
}
}
#[turbo_tasks::value_impl]
impl Introspectable for NodeApiContentSource {
#[turbo_tasks::function]
fn ty(&self) -> Vc<RcStr> {
Vc::cell(rcstr!("node api content source"))
}
#[turbo_tasks::function]
fn title(&self) -> Vc<RcStr> {
*self.pathname
}
#[turbo_tasks::function]
fn details(&self) -> Vc<RcStr> {
Vc::cell(
format!(
"base: {:?}\ntype: {:?}",
self.base_segments, self.route_type
)
.into(),
)
}
#[turbo_tasks::function]
async fn children(&self) -> Result<Vc<IntrospectableChildren>> {
let mut set = FxIndexSet::default();
for &entry in self.entry.entries().await?.iter() {
let entry = entry.await?;
set.insert((
rcstr!("module"),
IntrospectableModule::new(Vc::upcast(*entry.module))
.to_resolved()
.await?,
));
set.insert((
rcstr!("intermediate asset"),
IntrospectableOutputAsset::new(get_intermediate_asset(
*entry.chunking_context,
Vc::upcast(*entry.module),
*entry.runtime_entries,
))
.to_resolved()
.await?,
));
}
Ok(Vc::cell(set))
}
}
use anyhow::Result;
use serde_json::Value as JsonValue;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{FxIndexSet, OperationVc, ResolvedVc, Vc};
use turbo_tasks_env::ProcessEnv;
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::{
introspect::{
Introspectable, IntrospectableChildren, module::IntrospectableModule,
output_asset::IntrospectableOutputAsset,
},
issue::IssueDescriptionExt,
module::Module,
output::OutputAsset,
version::VersionedContentExt,
};
use turbopack_dev_server::{
html::DevHtmlAsset,
source::{
ContentSource, ContentSourceContent, ContentSourceData, ContentSourceDataVary,
GetContentSourceContent, ProxyResult,
asset_graph::AssetGraphContentSource,
conditional::ConditionalContentSource,
lazy_instantiated::{GetContentSource, LazyInstantiatedContentSource},
route_tree::{BaseSegment, RouteTree, RouteType},
},
};
use super::{
RenderData,
render_static::{StaticResult, render_static_operation},
};
use crate::{
external_asset_entrypoints, get_intermediate_asset, node_entry::NodeEntry,
route_matcher::RouteMatcher,
};
/// Creates a content source that renders something in Node.js with the passed
/// `entry` when it matches a `path_regex`. Once rendered it serves
/// all assets referenced by the `entry` that are within the `server_root`.
/// It needs a temporary directory (`intermediate_output_path`) to place file
/// for Node.js execution during rendering. The `chunking_context` should emit
/// to this directory.
#[turbo_tasks::function]
pub fn create_node_rendered_source(
cwd: FileSystemPath,
env: ResolvedVc<Box<dyn ProcessEnv>>,
base_segments: Vec<BaseSegment>,
route_type: RouteType,
server_root: FileSystemPath,
route_match: ResolvedVc<Box<dyn RouteMatcher>>,
pathname: ResolvedVc<RcStr>,
entry: ResolvedVc<Box<dyn NodeEntry>>,
fallback_page: ResolvedVc<DevHtmlAsset>,
render_data: ResolvedVc<JsonValue>,
debug: bool,
) -> Vc<Box<dyn ContentSource>> {
let source = NodeRenderContentSource {
cwd,
env,
base_segments,
route_type,
server_root,
route_match,
pathname,
entry,
fallback_page,
render_data,
debug,
}
.resolved_cell();
Vc::upcast(ConditionalContentSource::new(
Vc::upcast(*source),
Vc::upcast(
LazyInstantiatedContentSource {
get_source: ResolvedVc::upcast(source),
}
.cell(),
),
))
}
/// see [create_node_rendered_source]
#[turbo_tasks::value]
pub struct NodeRenderContentSource {
cwd: FileSystemPath,
env: ResolvedVc<Box<dyn ProcessEnv>>,
base_segments: Vec<BaseSegment>,
route_type: RouteType,
server_root: FileSystemPath,
route_match: ResolvedVc<Box<dyn RouteMatcher>>,
pathname: ResolvedVc<RcStr>,
entry: ResolvedVc<Box<dyn NodeEntry>>,
fallback_page: ResolvedVc<DevHtmlAsset>,
render_data: ResolvedVc<JsonValue>,
debug: bool,
}
#[turbo_tasks::value_impl]
impl NodeRenderContentSource {
#[turbo_tasks::function]
pub fn get_pathname(&self) -> Vc<RcStr> {
*self.pathname
}
}
#[turbo_tasks::value_impl]
impl GetContentSource for NodeRenderContentSource {
/// Returns the [ContentSource] that serves all referenced external
/// assets. This is wrapped into [LazyInstantiatedContentSource].
#[turbo_tasks::function]
async fn content_source(&self) -> Result<Vc<Box<dyn ContentSource>>> {
let entries = self.entry.entries();
let mut set = FxIndexSet::default();
for &reference in self.fallback_page.references().await?.iter() {
set.insert(reference);
}
for &entry in entries.await?.iter() {
let entry = entry.await?;
set.extend(
external_asset_entrypoints(
*entry.module,
*entry.runtime_entries,
*entry.chunking_context,
entry.intermediate_output_path.clone(),
)
.await?
.iter()
.copied(),
)
}
Ok(Vc::upcast(AssetGraphContentSource::new_lazy_multiple(
self.server_root.clone(),
Vc::cell(set),
)))
}
}
#[turbo_tasks::value_impl]
impl ContentSource for NodeRenderContentSource {
#[turbo_tasks::function]
async fn get_routes(self: Vc<Self>) -> Result<Vc<RouteTree>> {
let this = self.await?;
Ok(RouteTree::new_route(
this.base_segments.clone(),
this.route_type.clone(),
Vc::upcast(self),
))
}
}
#[turbo_tasks::value_impl]
impl GetContentSourceContent for NodeRenderContentSource {
#[turbo_tasks::function]
fn vary(&self) -> Vc<ContentSourceDataVary> {
ContentSourceDataVary {
method: true,
url: true,
original_url: true,
raw_headers: true,
raw_query: true,
..Default::default()
}
.cell()
}
#[turbo_tasks::function]
async fn get(&self, path: RcStr, data: ContentSourceData) -> Result<Vc<ContentSourceContent>> {
let pathname = self.pathname.await?;
let Some(params) = &*self.route_match.params(path.clone()).await? else {
anyhow::bail!("Non matching path ({}) provided for {}", path, pathname)
};
let ContentSourceData {
method: Some(method),
url: Some(url),
original_url: Some(original_url),
raw_headers: Some(raw_headers),
raw_query: Some(raw_query),
..
} = &data
else {
anyhow::bail!("Missing request data")
};
let entry = (*self.entry).entry(data.clone()).await?;
let result_op = render_static_operation(
self.cwd.clone(),
self.env,
self.server_root.join(&path)?,
ResolvedVc::upcast(entry.module),
entry.runtime_entries,
self.fallback_page,
entry.chunking_context,
entry.intermediate_output_path.clone(),
entry.output_root.clone(),
entry.project_dir.clone(),
RenderData {
params: params.clone(),
method: method.clone(),
url: url.clone(),
original_url: original_url.clone(),
raw_query: raw_query.clone(),
raw_headers: raw_headers.clone(),
path: pathname.as_str().into(),
data: Some(self.render_data.await?),
}
.resolved_cell(),
self.debug,
)
.issue_file_path(
entry.module.ident().path().owned().await?,
format!("server-side rendering {pathname}"),
)
.await?;
Ok(match *result_op.connect().await? {
StaticResult::Content {
content,
status_code,
headers,
} => ContentSourceContent::static_with_headers(
content.versioned(),
status_code,
*headers,
),
StaticResult::StreamedContent {
status,
headers,
ref body,
} => {
ContentSourceContent::HttpProxy(static_streamed_content_to_proxy_result_operation(
result_op,
ProxyResult {
status,
headers: headers.owned().await?,
body: body.clone(),
}
.resolved_cell(),
))
.cell()
}
StaticResult::Rewrite(rewrite) => ContentSourceContent::Rewrite(rewrite).cell(),
})
}
}
#[turbo_tasks::function(operation)]
async fn static_streamed_content_to_proxy_result_operation(
result_op: OperationVc<StaticResult>,
proxy_result: ResolvedVc<ProxyResult>,
) -> Result<Vc<ProxyResult>> {
// we already assume `result_op`'s value here because we're called inside of a match arm, but
// await `result_op` anyways, so that if it generates any collectible issues, they're captured
// here.
let _ = result_op.connect().await?;
Ok(*proxy_result)
}
#[turbo_tasks::value_impl]
impl Introspectable for NodeRenderContentSource {
#[turbo_tasks::function]
fn ty(&self) -> Vc<RcStr> {
Vc::cell(rcstr!("node render content source"))
}
#[turbo_tasks::function]
fn title(&self) -> Vc<RcStr> {
*self.pathname
}
#[turbo_tasks::function]
fn details(&self) -> Vc<RcStr> {
Vc::cell(
format!(
"base: {:?}\ntype: {:?}",
self.base_segments, self.route_type
)
.into(),
)
}
#[turbo_tasks::function]
async fn children(&self) -> Result<Vc<IntrospectableChildren>> {
let mut set = FxIndexSet::default();
for &entry in self.entry.entries().await?.iter() {
let entry = entry.await?;
set.insert((
rcstr!("module"),
IntrospectableModule::new(Vc::upcast(*entry.module))
.to_resolved()
.await?,
));
set.insert((
rcstr!("intermediate asset"),
IntrospectableOutputAsset::new(get_intermediate_asset(
*entry.chunking_context,
*entry.module,
*entry.runtime_entries,
))
.to_resolved()
.await?,
));
}
Ok(Vc::cell(set))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment