Skip to content

[pull] canary from vercel:canary #222

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

Merged
merged 2 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use turbo_tasks::{
trace::TraceRawVcs,
};
use turbo_tasks_env::{EnvMap, ProcessEnv};
use turbo_tasks_fetch::ReqwestClientConfig;
use turbo_tasks_fetch::FetchClient;
use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{
ConditionItem, ConditionPath, LoaderRuleItem, OptionWebpackRules,
Expand Down Expand Up @@ -1725,10 +1725,7 @@ impl NextConfig {
}

#[turbo_tasks::function]
pub async fn reqwest_client_config(
&self,
env: Vc<Box<dyn ProcessEnv>>,
) -> Result<Vc<ReqwestClientConfig>> {
pub async fn fetch_client(&self, env: Vc<Box<dyn ProcessEnv>>) -> Result<Vc<FetchClient>> {
// Support both an env var and the experimental flag to provide more flexibility to
// developers on locked down systems, depending on if they want to configure this on a
// per-system or per-project basis.
Expand All @@ -1742,7 +1739,7 @@ impl NextConfig {
})
.or(self.experimental.turbopack_use_system_tls_certs)
.unwrap_or(false);
Ok(ReqwestClientConfig {
Ok(FetchClient {
tls_built_in_webpki_certs: !use_system_tls_certs,
tls_built_in_native_certs: use_system_tls_certs,
}
Expand Down
44 changes: 17 additions & 27 deletions crates/next-core/src/next_font/google/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{Completion, FxIndexMap, ResolvedVc, Vc};
use turbo_tasks_bytes::stream::SingleValue;
use turbo_tasks_env::{CommandLineProcessEnv, ProcessEnv};
use turbo_tasks_fetch::{HttpResponseBody, ReqwestClientConfig, fetch};
use turbo_tasks_fetch::{FetchClient, HttpResponseBody};
use turbo_tasks_fs::{
DiskFileSystem, File, FileContent, FileSystem, FileSystemPath,
json::parse_json_with_source_context,
Expand Down Expand Up @@ -182,7 +182,7 @@ pub struct NextFontGoogleCssModuleReplacer {
project_path: FileSystemPath,
execution_context: ResolvedVc<ExecutionContext>,
next_mode: ResolvedVc<NextMode>,
reqwest_client_config: ResolvedVc<ReqwestClientConfig>,
fetch_client: ResolvedVc<FetchClient>,
}

#[turbo_tasks::value_impl]
Expand All @@ -192,13 +192,13 @@ impl NextFontGoogleCssModuleReplacer {
project_path: FileSystemPath,
execution_context: ResolvedVc<ExecutionContext>,
next_mode: ResolvedVc<NextMode>,
reqwest_client_config: ResolvedVc<ReqwestClientConfig>,
fetch_client: ResolvedVc<FetchClient>,
) -> Vc<Self> {
Self::cell(NextFontGoogleCssModuleReplacer {
project_path,
execution_context,
next_mode,
reqwest_client_config,
fetch_client,
})
}

Expand Down Expand Up @@ -233,9 +233,9 @@ impl NextFontGoogleCssModuleReplacer {
.map_or_else(
|| {
fetch_real_stylesheet(
*self.fetch_client,
stylesheet_url.clone(),
css_virtual_path.clone(),
*self.reqwest_client_config,
)
.boxed()
},
Expand Down Expand Up @@ -375,19 +375,16 @@ struct NextFontGoogleFontFileOptions {
#[turbo_tasks::value(shared)]
pub struct NextFontGoogleFontFileReplacer {
project_path: FileSystemPath,
reqwest_client_config: ResolvedVc<ReqwestClientConfig>,
fetch_client: ResolvedVc<FetchClient>,
}

#[turbo_tasks::value_impl]
impl NextFontGoogleFontFileReplacer {
#[turbo_tasks::function]
pub fn new(
project_path: FileSystemPath,
reqwest_client_config: ResolvedVc<ReqwestClientConfig>,
) -> Vc<Self> {
pub fn new(project_path: FileSystemPath, fetch_client: ResolvedVc<FetchClient>) -> Vc<Self> {
Self::cell(NextFontGoogleFontFileReplacer {
project_path,
reqwest_client_config,
fetch_client,
})
}
}
Expand Down Expand Up @@ -443,12 +440,9 @@ impl ImportMappingReplacement for NextFontGoogleFontFileReplacer {

// doesn't seem ideal to download the font into a string, but probably doesn't
// really matter either.
let Some(font) = fetch_from_google_fonts(
url.into(),
font_virtual_path.clone(),
*self.reqwest_client_config,
)
.await?
let Some(font) =
fetch_from_google_fonts(*self.fetch_client, url.into(), font_virtual_path.clone())
.await?
else {
return Ok(ImportMapResult::Result(ResolveResult::unresolvable()).cell());
};
Expand Down Expand Up @@ -670,27 +664,23 @@ fn font_file_options_from_query_map(query: &RcStr) -> Result<NextFontGoogleFontF
}

async fn fetch_real_stylesheet(
fetch_client: Vc<FetchClient>,
stylesheet_url: RcStr,
css_virtual_path: FileSystemPath,
reqwest_client_config: Vc<ReqwestClientConfig>,
) -> Result<Option<Vc<RcStr>>> {
let body =
fetch_from_google_fonts(stylesheet_url, css_virtual_path, reqwest_client_config).await?;
let body = fetch_from_google_fonts(fetch_client, stylesheet_url, css_virtual_path).await?;

Ok(body.map(|body| body.to_string()))
}

async fn fetch_from_google_fonts(
fetch_client: Vc<FetchClient>,
url: RcStr,
virtual_path: FileSystemPath,
reqwest_client_config: Vc<ReqwestClientConfig>,
) -> Result<Option<Vc<HttpResponseBody>>> {
let result = fetch(
url,
Some(rcstr!(USER_AGENT_FOR_GOOGLE_FONTS)),
reqwest_client_config,
)
.await?;
let result = fetch_client
.fetch(url, Some(rcstr!(USER_AGENT_FOR_GOOGLE_FONTS)))
.await?;

Ok(match *result {
Ok(r) => Some(*r.await?.body),
Expand Down
6 changes: 3 additions & 3 deletions crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,15 +1022,15 @@ async fn insert_next_shared_aliases(
next_font_google_replacer_mapping,
);

let reqwest_client_config = next_config.reqwest_client_config(execution_context.env());
let fetch_client = next_config.fetch_client(execution_context.env());
import_map.insert_alias(
AliasPattern::exact("@vercel/turbopack-next/internal/font/google/cssmodule.module.css"),
ImportMapping::Dynamic(ResolvedVc::upcast(
NextFontGoogleCssModuleReplacer::new(
project_path.clone(),
execution_context,
next_mode,
reqwest_client_config,
fetch_client,
)
.to_resolved()
.await?,
Expand All @@ -1041,7 +1041,7 @@ async fn insert_next_shared_aliases(
import_map.insert_alias(
AliasPattern::exact(GOOGLE_FONTS_INTERNAL_PREFIX),
ImportMapping::Dynamic(ResolvedVc::upcast(
NextFontGoogleFontFileReplacer::new(project_path.clone(), reqwest_client_config)
NextFontGoogleFontFileReplacer::new(project_path.clone(), fetch_client)
.to_resolved()
.await?,
))
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "15.4.2-canary.15"
"version": "15.4.2-canary.16"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/api-reference/config/eslint",
"dependencies": {
"@next/eslint-plugin-next": "15.4.2-canary.15",
"@next/eslint-plugin-next": "15.4.2-canary.16",
"@rushstack/eslint-patch": "^1.10.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/eslint-plugin-internal",
"private": true,
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "ESLint plugin for working on Next.js.",
"exports": {
".": "./src/eslint-plugin-internal.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-rspack",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"private": true,
"files": [
"native/"
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -100,7 +100,7 @@
]
},
"dependencies": {
"@next/env": "15.4.2-canary.15",
"@next/env": "15.4.2-canary.16",
"@swc/helpers": "0.5.15",
"caniuse-lite": "^1.0.30001579",
"postcss": "8.4.31",
Expand Down Expand Up @@ -168,11 +168,11 @@
"@modelcontextprotocol/sdk": "1.15.1",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/font": "15.4.2-canary.15",
"@next/polyfill-module": "15.4.2-canary.15",
"@next/polyfill-nomodule": "15.4.2-canary.15",
"@next/react-refresh-utils": "15.4.2-canary.15",
"@next/swc": "15.4.2-canary.15",
"@next/font": "15.4.2-canary.16",
"@next/polyfill-module": "15.4.2-canary.16",
"@next/polyfill-nomodule": "15.4.2-canary.16",
"@next/react-refresh-utils": "15.4.2-canary.16",
"@next/swc": "15.4.2-canary.16",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.51.1",
"@rspack/core": "1.4.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/third-parties/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/third-parties",
"version": "15.4.2-canary.15",
"version": "15.4.2-canary.16",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
Expand All @@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "15.4.2-canary.15",
"next": "15.4.2-canary.16",
"outdent": "0.8.0",
"prettier": "2.5.1",
"typescript": "5.8.2"
Expand Down
Loading
Loading