Skip to content

Commit f48db23

Browse files
authored
refactor(turbopack): remove next.js specific unsupported warn (vercel/turborepo#4697)
### Description WEB-953. This PR removes check for next.js specific unsupported packages. Instead, let next-* (next-core) handles it via resolve plugin. See #48837 for the corresponding change. This change makes turbopack does not need to aware specific next.js package names.
1 parent 000dd9e commit f48db23

File tree

1 file changed

+3
-54
lines changed

1 file changed

+3
-54
lines changed

crates/turbopack/src/lib.rs

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use ecmascript::{
2121
EcmascriptModuleAssetVc,
2222
};
2323
use graph::{aggregate, AggregatedGraphNodeContent, AggregatedGraphVc};
24-
use lazy_static::lazy_static;
2524
use module_options::{
2625
ModuleOptionsContextVc, ModuleOptionsVc, ModuleRuleEffect, ModuleType, ModuleTypeVc,
2726
};
@@ -36,16 +35,13 @@ use turbopack_core::{
3635
compile_time_info::CompileTimeInfoVc,
3736
context::{AssetContext, AssetContextVc},
3837
ident::AssetIdentVc,
39-
issue::{unsupported_module::UnsupportedModuleIssue, Issue, IssueVc},
38+
issue::{Issue, IssueVc},
4039
plugin::CustomModuleType,
4140
reference::all_referenced_assets,
4241
reference_type::{EcmaScriptModulesReferenceSubType, ReferenceType},
4342
resolve::{
44-
options::ResolveOptionsVc,
45-
origin::PlainResolveOriginVc,
46-
parse::{Request, RequestVc},
47-
pattern::Pattern,
48-
resolve, ModulePartVc, ResolveResultVc,
43+
options::ResolveOptionsVc, origin::PlainResolveOriginVc, parse::RequestVc, resolve,
44+
ModulePartVc, ResolveResultVc,
4945
},
5046
};
5147

@@ -71,12 +67,6 @@ use self::{
7167
transition::{TransitionVc, TransitionsByNameVc},
7268
};
7369

74-
lazy_static! {
75-
static ref UNSUPPORTED_PACKAGES: HashSet<String> = ["@vercel/og".to_owned()].into();
76-
static ref UNSUPPORTED_PACKAGE_PATHS: HashSet<(String, String)> =
77-
[("@next/font".to_owned(), "/local".to_owned())].into();
78-
}
79-
8070
#[turbo_tasks::value]
8171
struct ModuleIssue {
8272
ident: AssetIdentVc,
@@ -393,8 +383,6 @@ impl AssetContext for ModuleAssetContext {
393383
resolve_options: ResolveOptionsVc,
394384
reference_type: Value<ReferenceType>,
395385
) -> Result<ResolveResultVc> {
396-
warn_on_unsupported_modules(request, origin_path).await?;
397-
398386
let context_path = origin_path.parent().resolve().await?;
399387

400388
let result = resolve(context_path, request, resolve_options);
@@ -574,45 +562,6 @@ async fn top_references(list: ReferencesListVc) -> Result<ReferencesListVc> {
574562
.into())
575563
}
576564

577-
async fn warn_on_unsupported_modules(
578-
request: RequestVc,
579-
origin_path: FileSystemPathVc,
580-
) -> Result<()> {
581-
if let Request::Module {
582-
module,
583-
path,
584-
query: _,
585-
} = &*request.await?
586-
{
587-
// Warn if the package is known not to be supported by Turbopack at the moment.
588-
if UNSUPPORTED_PACKAGES.contains(module) {
589-
UnsupportedModuleIssue {
590-
context: origin_path,
591-
package: module.into(),
592-
package_path: None,
593-
}
594-
.cell()
595-
.as_issue()
596-
.emit();
597-
}
598-
599-
if let Pattern::Constant(path) = path {
600-
if UNSUPPORTED_PACKAGE_PATHS.contains(&(module.to_string(), path.to_owned())) {
601-
UnsupportedModuleIssue {
602-
context: origin_path,
603-
package: module.into(),
604-
package_path: Some(path.to_owned()),
605-
}
606-
.cell()
607-
.as_issue()
608-
.emit();
609-
}
610-
}
611-
}
612-
613-
Ok(())
614-
}
615-
616565
pub fn register() {
617566
turbo_tasks::register();
618567
turbo_tasks_fs::register();

0 commit comments

Comments
 (0)