Skip to content

Commit 6ec6c42

Browse files
Merge branch 'canary' into 10-02-enable_source_maps_bundled
2 parents b500f19 + 033e8a5 commit 6ec6c42

File tree

30 files changed

+170
-78
lines changed

30 files changed

+170
-78
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
"registry": "https://registry.npmjs.org/"
1717
}
1818
},
19-
"version": "13.5.4-canary.8"
19+
"version": "13.5.4-canary.9"
2020
}

packages/create-next-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"description": "ESLint configuration used by Next.js.",
55
"main": "index.js",
66
"license": "MIT",
@@ -10,7 +10,7 @@
1010
},
1111
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
1212
"dependencies": {
13-
"@next/eslint-plugin-next": "13.5.4-canary.8",
13+
"@next/eslint-plugin-next": "13.5.4-canary.9",
1414
"@rushstack/eslint-patch": "^1.3.3",
1515
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0",
1616
"eslint-import-resolver-node": "^0.3.6",

packages/eslint-plugin-next/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/eslint-plugin-next",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"description": "ESLint plugin for Next.js.",
55
"main": "dist/index.js",
66
"license": "MIT",

packages/font/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/font",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"repository": {
55
"url": "vercel/next.js",
66
"directory": "packages/font"

packages/next-bundle-analyzer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/bundle-analyzer",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"main": "index.js",
55
"types": "index.d.ts",
66
"license": "MIT",

packages/next-codemod/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/codemod",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

packages/next-env/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/env",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"keywords": [
55
"react",
66
"next",

packages/next-mdx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/mdx",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"main": "index.js",
55
"license": "MIT",
66
"repository": {

packages/next-plugin-storybook/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/plugin-storybook",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"repository": {
55
"url": "vercel/next.js",
66
"directory": "packages/next-plugin-storybook"

packages/next-polyfill-module/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/polyfill-module",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
55
"main": "dist/polyfill-module.js",
66
"license": "MIT",

packages/next-polyfill-nomodule/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/polyfill-nomodule",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"description": "A polyfill for non-dead, nomodule browsers.",
55
"main": "dist/polyfill-nomodule.js",
66
"license": "MIT",

packages/next-swc/crates/napi/src/next_api/endpoint.rs

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use std::ops::Deref;
22

33
use napi::{bindgen_prelude::External, JsFunction};
4-
use next_api::route::{Endpoint, WrittenEndpoint};
4+
use next_api::{
5+
route::{Endpoint, WrittenEndpoint},
6+
server_paths::ServerPath,
7+
};
58
use turbo_tasks::Vc;
69
use turbopack_binding::turbopack::core::error::PrettyPrintError;
710

@@ -14,12 +17,28 @@ use super::utils::{
1417
#[derive(Default)]
1518
pub struct NapiEndpointConfig {}
1619

20+
#[napi(object)]
21+
#[derive(Default)]
22+
pub struct NapiServerPath {
23+
pub path: String,
24+
pub content_hash: String,
25+
}
26+
27+
impl From<&ServerPath> for NapiServerPath {
28+
fn from(server_path: &ServerPath) -> Self {
29+
Self {
30+
path: server_path.path.clone(),
31+
content_hash: format!("{:x}", server_path.content_hash),
32+
}
33+
}
34+
}
35+
1736
#[napi(object)]
1837
#[derive(Default)]
1938
pub struct NapiWrittenEndpoint {
2039
pub r#type: String,
2140
pub entry_path: Option<String>,
22-
pub server_paths: Option<Vec<String>>,
41+
pub server_paths: Option<Vec<NapiServerPath>>,
2342
pub files: Option<Vec<String>>,
2443
pub global_var_name: Option<String>,
2544
pub config: NapiEndpointConfig,
@@ -34,7 +53,7 @@ impl From<&WrittenEndpoint> for NapiWrittenEndpoint {
3453
} => Self {
3554
r#type: "nodejs".to_string(),
3655
entry_path: Some(server_entry_path.clone()),
37-
server_paths: Some(server_paths.clone()),
56+
server_paths: Some(server_paths.iter().map(From::from).collect()),
3857
..Default::default()
3958
},
4059
WrittenEndpoint::Edge {
@@ -44,7 +63,7 @@ impl From<&WrittenEndpoint> for NapiWrittenEndpoint {
4463
} => Self {
4564
r#type: "edge".to_string(),
4665
files: Some(files.clone()),
47-
server_paths: Some(server_paths.clone()),
66+
server_paths: Some(server_paths.iter().map(From::from).collect()),
4867
global_var_name: Some(global_var_name.clone()),
4968
..Default::default()
5069
},

packages/next-swc/crates/next-api/src/app.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::{bail, Context, Result};
22
use next_core::{
3-
all_server_paths,
43
app_structure::{
54
get_entrypoints, Entrypoint as AppEntrypoint, Entrypoints as AppEntrypoints, LoaderTree,
65
MetadataItem,
@@ -55,6 +54,7 @@ use turbopack_binding::{
5554
use crate::{
5655
project::Project,
5756
route::{Endpoint, Route, Routes, WrittenEndpoint},
57+
server_paths::all_server_paths,
5858
};
5959

6060
#[turbo_tasks::value]

packages/next-swc/crates/next-api/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod middleware;
88
mod pages;
99
pub mod project;
1010
pub mod route;
11+
pub mod server_paths;
1112
mod versioned_content_map;
1213

1314
// Declare build-time information variables generated in build.rs

packages/next-swc/crates/next-api/src/middleware.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::{bail, Context, Result};
22
use next_core::{
3-
all_server_paths,
43
middleware::get_middleware_module,
54
mode::NextMode,
65
next_edge::entry::wrap_edge_entry,
@@ -27,6 +26,7 @@ use turbopack_binding::{
2726
use crate::{
2827
project::Project,
2928
route::{Endpoint, WrittenEndpoint},
29+
server_paths::all_server_paths,
3030
};
3131

3232
#[turbo_tasks::value]

packages/next-swc/crates/next-api/src/pages.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::{bail, Context, Result};
22
use indexmap::IndexMap;
33
use next_core::{
4-
all_server_paths, create_page_loader_entry_module, get_asset_path_from_pathname,
4+
create_page_loader_entry_module, get_asset_path_from_pathname,
55
get_edge_resolve_options_context,
66
mode::NextMode,
77
next_client::{
@@ -64,6 +64,7 @@ use turbopack_binding::{
6464
use crate::{
6565
project::Project,
6666
route::{Endpoint, Route, Routes, WrittenEndpoint},
67+
server_paths::all_server_paths,
6768
};
6869

6970
#[turbo_tasks::value]

packages/next-swc/crates/next-api/src/route.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use indexmap::IndexMap;
22
use turbo_tasks::{Completion, Vc};
33

4+
use crate::server_paths::ServerPath;
5+
46
#[turbo_tasks::value(shared)]
57
#[derive(Copy, Clone, Debug)]
68
pub enum Route {
@@ -34,15 +36,13 @@ pub enum WrittenEndpoint {
3436
NodeJs {
3537
/// Relative to the root_path
3638
server_entry_path: String,
37-
/// Relative to the root_path
38-
server_paths: Vec<String>,
39+
server_paths: Vec<ServerPath>,
3940
},
4041
Edge {
4142
/// Relative to the root_path
4243
files: Vec<String>,
4344
global_var_name: String,
44-
/// Relative to the root_path
45-
server_paths: Vec<String>,
45+
server_paths: Vec<ServerPath>,
4646
},
4747
}
4848

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
use anyhow::Result;
2+
use next_core::all_assets_from_entries;
3+
use serde::{Deserialize, Serialize};
4+
use turbo_tasks::{trace::TraceRawVcs, TryFlatJoinIterExt, Vc};
5+
use turbopack_binding::{
6+
turbo::tasks_fs::FileSystemPath,
7+
turbopack::core::{
8+
asset::{Asset, AssetContent},
9+
output::{OutputAsset, OutputAssets},
10+
},
11+
};
12+
13+
/// A reference to a server file with content hash for change detection
14+
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, TraceRawVcs)]
15+
pub struct ServerPath {
16+
/// Relative to the root_path
17+
pub path: String,
18+
pub content_hash: u64,
19+
}
20+
21+
/// A list of server paths
22+
#[turbo_tasks::value(transparent)]
23+
pub struct ServerPaths(Vec<ServerPath>);
24+
25+
/// Return a list of all server paths with filename and hash for all output
26+
/// assets references from the `assets` list. Server paths are identified by
27+
/// being inside of `node_root`.
28+
#[turbo_tasks::function]
29+
pub async fn all_server_paths(
30+
assets: Vc<OutputAssets>,
31+
node_root: Vc<FileSystemPath>,
32+
) -> Result<Vc<ServerPaths>> {
33+
let all_assets = all_assets_from_entries(assets).await?;
34+
let node_root = &node_root.await?;
35+
Ok(Vc::cell(
36+
all_assets
37+
.iter()
38+
.map(|&asset| async move {
39+
Ok(
40+
if let Some(path) = node_root.get_path_to(&*asset.ident().path().await?) {
41+
let content_hash = match *asset.content().await? {
42+
AssetContent::File(file) => *file.hash().await?,
43+
AssetContent::Redirect { .. } => 0,
44+
};
45+
Some(ServerPath {
46+
path: path.to_string(),
47+
content_hash,
48+
})
49+
} else {
50+
None
51+
},
52+
)
53+
})
54+
.try_flat_join()
55+
.await?,
56+
))
57+
}

packages/next-swc/crates/next-core/src/emit.rs

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
11
use anyhow::Result;
22
use turbo_tasks::{
33
graph::{AdjacencyMap, GraphTraversal},
4-
Completion, Completions, TryFlatJoinIterExt, TryJoinIterExt, Vc,
4+
Completion, Completions, TryFlatJoinIterExt, Vc,
55
};
66
use turbo_tasks_fs::{rebase, FileSystemPath};
77
use turbopack_binding::turbopack::core::{
88
asset::Asset,
99
output::{OutputAsset, OutputAssets},
1010
};
1111

12-
#[turbo_tasks::function]
13-
pub async fn all_server_paths(
14-
assets: Vc<OutputAssets>,
15-
node_root: Vc<FileSystemPath>,
16-
) -> Result<Vc<Vec<String>>> {
17-
let all_assets = all_assets_from_entries(assets).await?;
18-
let node_root = &node_root.await?;
19-
Ok(Vc::cell(
20-
all_assets
21-
.iter()
22-
.map(|&asset| async move {
23-
Ok(node_root
24-
.get_path_to(&*asset.ident().path().await?)
25-
.map(|s| s.to_string()))
26-
})
27-
.try_join()
28-
.await?
29-
.into_iter()
30-
.flatten()
31-
.collect(),
32-
))
33-
}
34-
3512
/// Emits all assets transitively reachable from the given chunks, that are
3613
/// inside the node root or the client root.
3714
///

packages/next-swc/crates/next-core/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ pub mod util;
4646
pub use app_segment_config::{
4747
parse_segment_config_from_loader_tree, parse_segment_config_from_source,
4848
};
49-
pub use emit::{
50-
all_assets_from_entries, all_server_paths, emit_all_assets, emit_assets, emit_client_assets,
51-
};
49+
pub use emit::{all_assets_from_entries, emit_all_assets, emit_assets, emit_client_assets};
5250
pub use next_edge::context::{
5351
get_edge_chunking_context, get_edge_compile_time_info, get_edge_resolve_options_context,
5452
};

packages/next-swc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/swc",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"private": true,
55
"scripts": {
66
"clean": "node ../../scripts/rm.mjs native",

packages/next/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next",
3-
"version": "13.5.4-canary.8",
3+
"version": "13.5.4-canary.9",
44
"description": "The React Framework",
55
"main": "./dist/server/next.js",
66
"license": "MIT",
@@ -90,7 +90,7 @@
9090
]
9191
},
9292
"dependencies": {
93-
"@next/env": "13.5.4-canary.8",
93+
"@next/env": "13.5.4-canary.9",
9494
"@swc/helpers": "0.5.2",
9595
"busboy": "1.6.0",
9696
"caniuse-lite": "^1.0.30001406",
@@ -144,11 +144,11 @@
144144
"@mswjs/interceptors": "0.23.0",
145145
"@napi-rs/cli": "2.16.2",
146146
"@napi-rs/triples": "1.1.0",
147-
"@next/polyfill-module": "13.5.4-canary.8",
148-
"@next/polyfill-nomodule": "13.5.4-canary.8",
149-
"@next/react-dev-overlay": "13.5.4-canary.8",
150-
"@next/react-refresh-utils": "13.5.4-canary.8",
151-
"@next/swc": "13.5.4-canary.8",
147+
"@next/polyfill-module": "13.5.4-canary.9",
148+
"@next/polyfill-nomodule": "13.5.4-canary.9",
149+
"@next/react-dev-overlay": "13.5.4-canary.9",
150+
"@next/react-refresh-utils": "13.5.4-canary.9",
151+
"@next/swc": "13.5.4-canary.9",
152152
"@opentelemetry/api": "1.4.1",
153153
"@playwright/test": "^1.35.1",
154154
"@segment/ajv-human-errors": "2.1.2",

0 commit comments

Comments
 (0)