Skip to content

Commit

Permalink
Make InvalidImportResolvePlugin a BeforeResolvePlugin (vercel#66622)
Browse files Browse the repository at this point in the history
vercel/turborepo#8165 introduced plugins that
operate before resolving occurs, meaning that plugins like
`InvalidImportResolvePlugin` which never use the initial resolve result
and report issues can avoid that work.

Test Plan: `TURBOPACK_DEV=1 TURBOPACK=1 pnpm test-dev
test/development/acceptance-app/invalid-imports.test.ts`
  • Loading branch information
wbinnssmith authored Jun 12, 2024
1 parent 8f67469 commit 33872bf
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 210 deletions.
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ swc_core = { version = "0.93.2", features = [
testing = { version = "0.35.25" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.1" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.3" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.1" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.3" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.1" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240612.3" }

# General Deps

Expand Down
13 changes: 7 additions & 6 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use crate::{
next_shared::{
resolve::{
get_invalid_server_only_resolve_plugin, ModuleFeatureReportResolvePlugin,
NextSharedRuntimeResolvePlugin, UnsupportedModulesResolvePlugin,
NextSharedRuntimeResolvePlugin,
},
transforms::{
emotion::get_emotion_transform_rule, relay::get_relay_transform_rule,
Expand Down Expand Up @@ -158,13 +158,14 @@ pub async fn get_client_resolve_options_context(
resolved_map: Some(next_client_resolved_map),
browser: true,
module: true,
before_resolve_plugins: vec![Vc::upcast(NextFontLocalResolvePlugin::new(project_path))],
after_resolve_plugins: vec![
Vc::upcast(ModuleFeatureReportResolvePlugin::new(project_path)),
Vc::upcast(UnsupportedModulesResolvePlugin::new(project_path)),
Vc::upcast(NextSharedRuntimeResolvePlugin::new(project_path)),
before_resolve_plugins: vec![
Vc::upcast(get_invalid_server_only_resolve_plugin(project_path)),
Vc::upcast(ModuleFeatureReportResolvePlugin::new(project_path)),
Vc::upcast(NextFontLocalResolvePlugin::new(project_path)),
],
after_resolve_plugins: vec![Vc::upcast(NextSharedRuntimeResolvePlugin::new(
project_path,
))],
..Default::default()
};
Ok(ResolveOptionsContext {
Expand Down
Loading

0 comments on commit 33872bf

Please sign in to comment.