Skip to content

Commit

Permalink
Merge branch 'canary' into enenable-test-app-static
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Sep 8, 2023
2 parents 8207979 + 56eeedf commit 8caa55b
Show file tree
Hide file tree
Showing 65 changed files with 1,025 additions and 529 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Choose the right checklist for the change(s) that you're making:
- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md
Expand Down
9 changes: 2 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@
],
// Disable Jest autoRun as otherwise it will start running all tests the first time.
"jest.autoRun": "off",

// Debugging.
"debug.javascript.unmapMissingSources": true,

"files.exclude": {
"**/node_modules": false,
"node_modules": true,
"*[!test]**/node_modules": true
},

// Ensure enough terminal history is preserved when running tests.
"terminal.integrated.scrollback": 10000,

// Configure todo-tree to exclude node_modules, dist, and compiled.
"todo-tree.filtering.excludeGlobs": [
"**/node_modules",
Expand All @@ -48,10 +44,8 @@
"[x]",
"TODO-APP"
],

// Disable TypeScript surveys.
"typescript.surveys.enabled": false,

// Enable file nesting for unit test files.
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
Expand Down Expand Up @@ -82,5 +76,6 @@
"language": "markdown",
"scheme": "file"
}
]
],
"typescript.tsdk": "node_modules/typescript/lib"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There are a couple of benefits to doing the rendering work on the server, includ

## Using Server Components in Next.js

By default, Next.js uses Server Components. This allows you to automatically implement server rendering with no additional configuration, and you can opt into using Client Components when you needed, see [Client Components](/docs/app/building-your-application/rendering/client-components).
By default, Next.js uses Server Components. This allows you to automatically implement server rendering with no additional configuration, and you can opt into using Client Components when needed, see [Client Components](/docs/app/building-your-application/rendering/client-components).

## How are Server Components rendered?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For example:
import { NextRequest, NextResponse } from 'next/server'

export function middleware(request: NextRequest) {
const nonce = crypto.randomUUID()
const nonce = Buffer.from(crypto.randomUUID()).toString('base64')
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic';
Expand Down Expand Up @@ -76,7 +76,7 @@ export function middleware(request: NextRequest) {
import { NextResponse } from 'next/server'

export function middleware(request) {
const nonce = crypto.randomUUID()
const nonce = Buffer.from(crypto.randomUUID()).toString('base64')
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic';
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": "13.4.20-canary.18"
"version": "13.4.20-canary.21"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@types/node-fetch": "2.6.1",
"@types/react": "18.2.8",
"@types/react-dom": "18.2.4",
"@types/relay-runtime": "13.0.0",
"@types/relay-runtime": "14.1.13",
"@types/selenium-webdriver": "4.0.15",
"@types/sharp": "0.29.3",
"@types/string-hash": "1.1.1",
Expand Down Expand Up @@ -226,7 +226,7 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "1.10.9",
"typescript": "5.1.3",
"typescript": "5.2.2",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.86.0",
Expand Down
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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "13.4.20-canary.18",
"@next/eslint-plugin-next": "13.4.20-canary.21",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0",
"eslint-import-resolver-node": "^0.3.6",
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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"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": "13.4.20-canary.18",
"version": "13.4.20-canary.21",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
34 changes: 10 additions & 24 deletions packages/next-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use next_core::{
mode::NextMode,
next_app::{
get_app_client_references_chunks, get_app_client_shared_chunks, get_app_page_entry,
get_app_route_entry, AppEntry,
get_app_route_entry, AppEntry, AppPage,
},
next_client::{
get_client_module_options_context, get_client_resolve_options_context,
Expand Down Expand Up @@ -344,8 +344,7 @@ impl AppProject {
.map(|(pathname, app_entrypoint)| async {
Ok((
pathname.clone(),
*app_entry_point_to_route(self, app_entrypoint.clone(), pathname.clone())
.await?,
*app_entry_point_to_route(self, app_entrypoint.clone()).await?,
))
})
.try_join()
Expand All @@ -360,22 +359,17 @@ impl AppProject {
pub async fn app_entry_point_to_route(
app_project: Vc<AppProject>,
entrypoint: AppEntrypoint,
pathname: String,
) -> Vc<Route> {
match entrypoint {
AppEntrypoint::AppPage {
original_name,
loader_tree,
} => Route::AppPage {
AppEntrypoint::AppPage { page, loader_tree } => Route::AppPage {
html_endpoint: Vc::upcast(
AppEndpoint {
ty: AppEndpointType::Page {
ty: AppPageEndpointType::Html,
loader_tree,
},
app_project,
pathname: pathname.clone(),
original_name: original_name.clone(),
page: page.clone(),
}
.cell(),
),
Expand All @@ -386,22 +380,17 @@ pub async fn app_entry_point_to_route(
loader_tree,
},
app_project,
pathname,
original_name,
page,
}
.cell(),
),
},
AppEntrypoint::AppRoute {
original_name,
path,
} => Route::AppRoute {
AppEntrypoint::AppRoute { page, path } => Route::AppRoute {
endpoint: Vc::upcast(
AppEndpoint {
ty: AppEndpointType::Route { path },
app_project,
pathname,
original_name,
page,
}
.cell(),
),
Expand Down Expand Up @@ -431,8 +420,7 @@ enum AppEndpointType {
struct AppEndpoint {
ty: AppEndpointType,
app_project: Vc<AppProject>,
pathname: String,
original_name: String,
page: AppPage,
}

#[turbo_tasks::value_impl]
Expand All @@ -444,8 +432,7 @@ impl AppEndpoint {
self.app_project.edge_rsc_module_context(),
loader_tree,
self.app_project.app_dir(),
self.pathname.clone(),
self.original_name.clone(),
self.page.clone(),
self.app_project.project().project_path(),
)
}
Expand All @@ -456,8 +443,7 @@ impl AppEndpoint {
self.app_project.rsc_module_context(),
self.app_project.edge_rsc_module_context(),
Vc::upcast(FileSource::new(path)),
self.pathname.clone(),
self.original_name.clone(),
self.page.clone(),
self.app_project.project().project_path(),
)
}
Expand Down
18 changes: 5 additions & 13 deletions packages/next-swc/crates/next-build/src/next_app/app_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,31 +187,23 @@ pub async fn get_app_entries(
let mut entries = entrypoints
.await?
.iter()
.map(|(pathname, entrypoint)| async move {
.map(|(_, entrypoint)| async move {
Ok(match entrypoint {
Entrypoint::AppPage {
original_name,
loader_tree,
} => get_app_page_entry(
Entrypoint::AppPage { page, loader_tree } => get_app_page_entry(
rsc_context,
// TODO add edge support
rsc_context,
*loader_tree,
app_dir,
pathname.clone(),
original_name.clone(),
page.clone(),
project_root,
),
Entrypoint::AppRoute {
original_name,
path,
} => get_app_route_entry(
Entrypoint::AppRoute { page, path } => get_app_route_entry(
rsc_context,
// TODO add edge support
rsc_context,
Vc::upcast(FileSource::new(*path)),
pathname.clone(),
original_name.clone(),
page.clone(),
project_root,
),
})
Expand Down
1 change: 1 addition & 0 deletions packages/next-swc/crates/next-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ turbopack-binding = { workspace = true, features = [
"__turbo_tasks_hash",
"__turbopack",
"__turbopack_build",
"__turbopack_cli_utils",
"__turbopack_core",
"__turbopack_dev",
"__turbopack_dev_server",
Expand Down
7 changes: 1 addition & 6 deletions packages/next-swc/crates/next-core/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@
"strict": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,

// interop constraints
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,

// js support
"allowJs": true,
"checkJs": false,

// environment
"jsx": "react-jsx",
"lib": ["ESNext", "DOM"],
"target": "esnext",

// modules
"baseUrl": ".",
"module": "esnext",
"module": "node16",
"moduleResolution": "node16",
"paths": {
"@vercel/turbopack-next/*": ["src/*"],
Expand All @@ -31,7 +27,6 @@
},
"resolveJsonModule": true,
"types": ["react/next"],

// emit
"noEmit": true,
"stripInternal": true
Expand Down
Loading

0 comments on commit 8caa55b

Please sign in to comment.