Skip to content

Commit a388c0a

Browse files
authored
Turbopack: clean up some old TODOs (#82364)
I looked through all TODOs if there are any remaining "todo fix this for prod builds"-style comments, but there weren't any. But some of them are outdated now
1 parent 5c38caa commit a388c0a

File tree

22 files changed

+62
-155
lines changed

22 files changed

+62
-155
lines changed

crates/next-api/src/app.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use turbopack_core::{
6666
},
6767
output::{OutputAsset, OutputAssets},
6868
raw_output::RawOutput,
69-
reference_type::{CssReferenceSubType, ReferenceType},
69+
reference_type::{CommonJsReferenceSubType, CssReferenceSubType, ReferenceType},
7070
resolve::{origin::PlainResolveOrigin, parse::Request, pattern::Pattern},
7171
source::Source,
7272
virtual_output::VirtualOutputAsset,
@@ -852,6 +852,7 @@ impl AppProject {
852852
Request::parse(Pattern::Constant(rcstr!(
853853
"next/dist/client/app-next-turbopack.js"
854854
))),
855+
CommonJsReferenceSubType::Undefined,
855856
None,
856857
false,
857858
)

crates/next-core/src/next_client/runtime_entry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use turbopack_core::{
55
chunk::{EvaluatableAsset, EvaluatableAssetExt, EvaluatableAssets},
66
context::AssetContext,
77
module::Module,
8+
reference_type::CommonJsReferenceSubType,
89
resolve::{origin::PlainResolveOrigin, parse::Request},
910
source::Source,
1011
};
@@ -35,6 +36,7 @@ impl RuntimeEntry {
3536
let modules = cjs_resolve(
3637
Vc::upcast(PlainResolveOrigin::new(asset_context, path.clone())),
3738
*request,
39+
CommonJsReferenceSubType::Undefined,
3840
None,
3941
false,
4042
)

turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use turbopack_core::{
55
chunk::{EvaluatableAsset, EvaluatableAssetExt, EvaluatableAssets},
66
context::AssetContext,
77
module::Module,
8+
reference_type::CommonJsReferenceSubType,
89
resolve::{origin::PlainResolveOrigin, parse::Request},
910
source::Source,
1011
};
@@ -35,6 +36,7 @@ impl RuntimeEntry {
3536
let modules = cjs_resolve(
3637
Vc::upcast(PlainResolveOrigin::new(asset_context, path.clone())),
3738
**request,
39+
CommonJsReferenceSubType::Undefined,
3840
None,
3941
false,
4042
)

turbopack/crates/turbopack-core/src/module_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ pub mod tests {
20742074
impl Asset for MockModule {
20752075
#[turbo_tasks::function]
20762076
fn content(&self) -> Vc<AssetContent> {
2077-
todo!()
2077+
panic!("MockModule::content shouldn't be called")
20782078
}
20792079
}
20802080

turbopack/crates/turbopack-core/src/output.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,3 @@ impl OutputAssets {
5959
/// A set of [OutputAsset]s
6060
#[turbo_tasks::value(transparent)]
6161
pub struct OutputAssetsSet(FxIndexSet<ResolvedVc<Box<dyn OutputAsset>>>);
62-
63-
// TODO All Vc::try_resolve_downcast::<Box<dyn OutputAsset>> calls should be
64-
// removed

turbopack/crates/turbopack-core/src/source.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ pub struct OptionSource(Option<ResolvedVc<Box<dyn Source>>>);
1717

1818
#[turbo_tasks::value(transparent)]
1919
pub struct Sources(Vec<ResolvedVc<Box<dyn Source>>>);
20-
21-
// TODO All Vc::try_resolve_downcast::<Box<dyn Source>> calls should be removed

turbopack/crates/turbopack-css/src/references/compose.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ impl ModuleReference for CssModuleComposeReference {
3838
*self.origin,
3939
*self.request,
4040
CssReferenceSubType::Compose,
41-
// TODO: add real issue source, currently impossible because `CssClassName` doesn't
42-
// contain the source span
43-
// https://docs.rs/swc_css_modules/0.21.16/swc_css_modules/enum.CssClassName.html
41+
// TODO: add real issue source, currently impossible
4442
None,
4543
)
4644
}

turbopack/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,12 @@ impl EmotionTransformer {
102102
enabled: Some(true),
103103
sourcemap: config.sourcemap,
104104
label_format: config.label_format.as_deref().map(From::from),
105-
auto_label: if let Some(auto_label) = config.auto_label.as_ref() {
106-
match auto_label {
107-
EmotionLabelKind::Always => Some(true),
108-
EmotionLabelKind::Never => Some(false),
109-
// [TODO]: this is not correct coerece, need to be fixed
110-
EmotionLabelKind::DevOnly => None,
111-
}
112-
} else {
113-
None
105+
auto_label: match config.auto_label.as_ref() {
106+
Some(EmotionLabelKind::Always) => Some(true),
107+
Some(EmotionLabelKind::Never) => Some(false),
108+
// [TODO]: this is not correct (doesn't take current mode into account)
109+
Some(EmotionLabelKind::DevOnly) => None,
110+
None => None,
114111
},
115112
import_map: config.import_map.as_ref().map(|map| {
116113
map.iter()

turbopack/crates/turbopack-ecmascript-runtime/src/asset_context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pub async fn get_runtime_asset_context(
2222
),
2323
..Default::default()
2424
},
25-
// TODO: Somehow this fails to compile when enabled.
25+
// TODO: This fails when enabled, we cannot insert helpers for the runtime code as this
26+
// happens after bundling.
2627
// environment: Some(environment),
2728
environment: None,
2829
tree_shaking_mode: Some(TreeShakingMode::ReexportsOnly),

turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub async fn get_browser_runtime_code(
7373
runtime_backend_code.push("browser/runtime/dom/dev-backend-dom.ts");
7474
}
7575
(ChunkLoading::Dom, RuntimeType::Production) => {
76-
// TODO
7776
runtime_backend_code.push("browser/runtime/dom/runtime-backend-dom.ts");
7877
}
7978

0 commit comments

Comments
 (0)