Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rules to alter resolve/module context depending on context path #3108

Merged
merged 5 commits into from Dec 21, 2022

Conversation

sokra
Copy link
Member

@sokra sokra commented Dec 21, 2022

Fixes WEB-43
Closes #3104

@vercel
Copy link

vercel bot commented Dec 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-designsystem-docs 🔄 Building (Inspect) Dec 21, 2022 at 5:03PM (UTC)
examples-kitchensink-blog 🔄 Building (Inspect) Dec 21, 2022 at 5:03PM (UTC)
examples-native-web 🔄 Building (Inspect) Dec 21, 2022 at 5:03PM (UTC)
5 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Dec 21, 2022 at 5:03PM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Dec 21, 2022 at 5:03PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Dec 21, 2022 at 5:03PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Dec 21, 2022 at 5:03PM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Dec 21, 2022 at 5:03PM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 21, 2022

🟢 CI successful 🟢

Thanks

@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

Benchmark for 706125d

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 7296.09µs ± 39.77µs 7342.25µs ± 58.91µs +0.63%
bench_hmr_to_commit/Turbopack RCC/1000 modules 7791.98µs ± 84.74µs 7647.30µs ± 64.53µs -1.86%
bench_hmr_to_commit/Turbopack RSC/1000 modules 740.33ms ± 2.21ms 739.34ms ± 4.45ms -0.13%
bench_hmr_to_commit/Turbopack SSR/1000 modules 7505.64µs ± 42.27µs 7480.74µs ± 44.31µs -0.33%
bench_hmr_to_eval/Turbopack CSR/1000 modules 6443.16µs ± 58.99µs 6468.67µs ± 74.00µs +0.40%
bench_hmr_to_eval/Turbopack RCC/1000 modules 6654.43µs ± 26.71µs 6767.02µs ± 69.79µs +1.69%
bench_hmr_to_eval/Turbopack SSR/1000 modules 6579.58µs ± 73.78µs 6598.89µs ± 55.84µs +0.29%
bench_hydration/Turbopack RCC/1000 modules 3213.40ms ± 13.62ms 3198.80ms ± 12.16ms -0.45%
bench_hydration/Turbopack RSC/1000 modules 2652.34ms ± 8.64ms 2655.74ms ± 7.81ms +0.13%
bench_hydration/Turbopack SSR/1000 modules 2547.95ms ± 8.01ms 2538.67ms ± 6.49ms -0.36%
bench_startup/Turbopack CSR/1000 modules 1562.88ms ± 3.26ms 1562.31ms ± 3.50ms -0.04%
bench_startup/Turbopack RCC/1000 modules 2416.26ms ± 6.16ms 2396.71ms ± 8.02ms -0.81%
bench_startup/Turbopack RSC/1000 modules 2293.28ms ± 7.57ms 2291.36ms ± 3.77ms -0.08%
bench_startup/Turbopack SSR/1000 modules 1974.53ms ± 7.51ms 1967.23ms ± 9.20ms -0.37%

@sokra sokra marked this pull request as ready for review December 21, 2022 14:07
@sokra sokra requested a review from a team as a code owner December 21, 2022 14:07
Comment on lines 85 to 100
rules: vec![(
ContextCondition::InDirectory("node_modules".to_string()),
Some(
ResolveOptionsContext {
enable_node_modules: true,
custom_conditions: vec!["development".to_string()],
import_map: Some(next_client_import_map),
fallback_import_map: Some(next_client_fallback_import_map),
resolved_map: Some(next_client_resolved_map),
browser: true,
module: true,
..Default::default()
}
.cell(),
),
)],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be:

let shared_options = ResolveOptionsContext {
    enable_node_modules: true,
    custom_conditions: vec!["development".to_string()],
    import_map: Some(next_client_import_map),
    fallback_import_map: Some(next_client_fallback_import_map),
    resolved_map: Some(next_client_resolved_map),
    browser: true,
    module: true,
    ..Default::default()
};

Then spread that into both this and the one above. This way, if we ever add new keys in the future, they will be applied to both correctly.

The same remark applies to all of the below.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments to the public items.

if let &Some(new_context) = new_context {
return Ok(ModuleOptionsVc::new(path, new_context));
} else {
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever run into that case? I think we only have Some( above, maybe it shouldn't be an option?

@sokra sokra added the pr: automerge Kodiak will merge these automatically after checks pass label Dec 21, 2022
@github-actions
Copy link
Contributor

Benchmark for e9099ad

Test Base PR % Significant %
bench_hydration/Turbopack RCC/1000 modules 3397.62ms ± 16.50ms 3339.07ms ± 12.01ms -1.72% -0.05%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8531.12µs ± 88.76µs 8595.55µs ± 77.56µs +0.76%
bench_hmr_to_commit/Turbopack RCC/1000 modules 8905.61µs ± 78.86µs 8951.22µs ± 88.16µs +0.51%
bench_hmr_to_commit/Turbopack RSC/1000 modules 473.86ms ± 1.87ms 468.20ms ± 2.87ms -1.20%
bench_hmr_to_commit/Turbopack SSR/1000 modules 8629.66µs ± 103.92µs 8610.82µs ± 56.36µs -0.22%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7730.93µs ± 63.62µs 7744.54µs ± 90.31µs +0.18%
bench_hmr_to_eval/Turbopack RCC/1000 modules 7759.38µs ± 57.31µs 7741.56µs ± 39.88µs -0.23%
bench_hmr_to_eval/Turbopack SSR/1000 modules 7612.83µs ± 78.96µs 7710.13µs ± 74.42µs +1.28%
bench_hydration/Turbopack RCC/1000 modules 3397.62ms ± 16.50ms 3339.07ms ± 12.01ms -1.72% -0.05%
bench_hydration/Turbopack RSC/1000 modules 2790.77ms ± 4.47ms 2778.04ms ± 6.59ms -0.46%
bench_hydration/Turbopack SSR/1000 modules 2666.34ms ± 10.19ms 2651.28ms ± 8.18ms -0.56%
bench_startup/Turbopack CSR/1000 modules 1667.88ms ± 7.23ms 1668.29ms ± 5.30ms +0.02%
bench_startup/Turbopack RCC/1000 modules 2508.58ms ± 8.54ms 2507.17ms ± 8.92ms -0.06%
bench_startup/Turbopack RSC/1000 modules 2400.86ms ± 9.58ms 2390.64ms ± 6.65ms -0.43%
bench_startup/Turbopack SSR/1000 modules 2081.68ms ± 6.49ms 2059.32ms ± 5.59ms -1.07%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants