Skip to content

Commit

Permalink
Merge branch 'canary' into fix/app-route-cookies-has
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Aug 16, 2023
2 parents 8f05915 + 93259ca commit 862b404
Show file tree
Hide file tree
Showing 27 changed files with 295 additions and 67 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.4.16"
"version": "13.4.17-canary.0"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"description": "ESLint configuration used by NextJS.",
"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.16",
"@next/eslint-plugin-next": "13.4.17-canary.0",
"@rushstack/eslint-patch": "^1.1.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
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"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
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
75 changes: 46 additions & 29 deletions packages/next-swc/crates/next-build/src/next_build.rs
Expand Up @@ -4,7 +4,7 @@ use std::{
path::{PathBuf, MAIN_SEPARATOR},
};

use anyhow::{anyhow, Context, Result};
use anyhow::{Context, Result};
use dunce::canonicalize;
use next_core::{
mode::NextMode,
Expand All @@ -25,7 +25,7 @@ use next_core::{
use serde::Serialize;
use turbo_tasks::{
graph::{AdjacencyMap, GraphTraversal},
Completion, Completions, TransientInstance, TransientValue, TryJoinIterExt, Vc,
Completion, Completions, TransientInstance, TryJoinIterExt, Vc,
};
use turbopack_binding::{
turbo::tasks_fs::{rebase, DiskFileSystem, FileContent, FileSystem, FileSystemPath},
Expand All @@ -35,7 +35,7 @@ use turbopack_binding::{
asset::Asset,
chunk::ChunkingContext,
environment::ServerAddr,
issue::{IssueDescriptionExt, IssueReporter, IssueSeverity},
issue::{handle_issues, IssueReporter, IssueSeverity},
output::{OutputAsset, OutputAssets},
virtual_fs::VirtualFileSystem,
},
Expand All @@ -53,6 +53,9 @@ use crate::{
next_pages::page_entries::{compute_page_entries_chunks, get_page_entries},
};

// TODO this should be Error, but we need to fix the errors happening first
static MIN_FAILING_SEVERITY: IssueSeverity = IssueSeverity::Fatal;

#[turbo_tasks::function]
pub(crate) async fn next_build(options: TransientInstance<BuildOptions>) -> Result<Vc<Completion>> {
let project_root = options
Expand Down Expand Up @@ -149,8 +152,22 @@ pub(crate) async fn next_build(options: TransientInstance<BuildOptions>) -> Resu
next_config,
);

handle_issues(page_entries, issue_reporter).await?;
handle_issues(app_entries, issue_reporter).await?;
handle_issues(
page_entries,
issue_reporter,
MIN_FAILING_SEVERITY.cell(),
None,
None,
)
.await?;
handle_issues(
app_entries,
issue_reporter,
MIN_FAILING_SEVERITY.cell(),
None,
None,
)
.await?;

let page_entries = page_entries.await?;
let app_entries = app_entries.await?;
Expand Down Expand Up @@ -436,7 +453,14 @@ async fn workspace_fs(
issue_reporter: Vc<Box<dyn IssueReporter>>,
) -> Result<Vc<Box<dyn FileSystem>>> {
let disk_fs = DiskFileSystem::new("workspace".to_string(), workspace_root.to_string());
handle_issues(disk_fs, issue_reporter).await?;
handle_issues(
disk_fs,
issue_reporter,
MIN_FAILING_SEVERITY.cell(),
None,
None,
)
.await?;
Ok(Vc::upcast(disk_fs))
}

Expand All @@ -446,7 +470,14 @@ async fn node_fs(
issue_reporter: Vc<Box<dyn IssueReporter>>,
) -> Result<Vc<Box<dyn FileSystem>>> {
let disk_fs = DiskFileSystem::new("node".to_string(), node_root.to_string());
handle_issues(disk_fs, issue_reporter).await?;
handle_issues(
disk_fs,
issue_reporter,
MIN_FAILING_SEVERITY.cell(),
None,
None,
)
.await?;
Ok(Vc::upcast(disk_fs))
}

Expand All @@ -456,31 +487,17 @@ async fn client_fs(
issue_reporter: Vc<Box<dyn IssueReporter>>,
) -> Result<Vc<Box<dyn FileSystem>>> {
let disk_fs = DiskFileSystem::new("client".to_string(), client_root.to_string());
handle_issues(disk_fs, issue_reporter).await?;
handle_issues(
disk_fs,
issue_reporter,
MIN_FAILING_SEVERITY.cell(),
None,
None,
)
.await?;
Ok(Vc::upcast(disk_fs))
}

async fn handle_issues<T>(source: Vc<T>, issue_reporter: Vc<Box<dyn IssueReporter>>) -> Result<()> {
let issues = source
.peek_issues_with_path()
.await?
.strongly_consistent()
.await?;

let has_fatal = issue_reporter.report_issues(
TransientInstance::new(issues.clone()),
TransientValue::new(Vc::into_raw(source)),
// TODO this should be Error, but we need to fix the errors happing first
IssueSeverity::Fatal.cell(),
);

if *has_fatal.await? {
Err(anyhow!("Fatal issue(s) occurred"))
} else {
Ok(())
}
}

/// Emits all assets transitively reachable from the given chunks, that are
/// inside the node root or the client root.
async fn emit_all_assets(
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.16",
"version": "13.4.17-canary.0",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -89,7 +89,7 @@
]
},
"dependencies": {
"@next/env": "13.4.16",
"@next/env": "13.4.17-canary.0",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -144,11 +144,11 @@
"@mswjs/interceptors": "0.23.0",
"@napi-rs/cli": "2.16.2",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.16",
"@next/polyfill-nomodule": "13.4.16",
"@next/react-dev-overlay": "13.4.16",
"@next/react-refresh-utils": "13.4.16",
"@next/swc": "13.4.16",
"@next/polyfill-module": "13.4.17-canary.0",
"@next/polyfill-nomodule": "13.4.17-canary.0",
"@next/react-dev-overlay": "13.4.17-canary.0",
"@next/react-refresh-utils": "13.4.17-canary.0",
"@next/swc": "13.4.17-canary.0",
"@opentelemetry/api": "1.4.1",
"@playwright/test": "^1.35.1",
"@segment/ajv-human-errors": "2.1.2",
Expand Down
18 changes: 18 additions & 0 deletions packages/next/src/cli/next-dev.ts
Expand Up @@ -25,10 +25,12 @@ import { getValidatedArgs } from '../lib/get-validated-args'
import { Worker } from 'next/dist/compiled/jest-worker'
import type { ChildProcess } from 'child_process'
import { checkIsNodeDebugging } from '../server/lib/is-node-debugging'
import uploadTrace from '../trace/upload-trace'

let dir: string
let config: NextConfigComplete
let isTurboSession = false
let traceUploadUrl: string
let sessionStopHandled = false
let sessionStarted = Date.now()

Expand Down Expand Up @@ -86,6 +88,16 @@ const handleSessionStop = async () => {
// noise to the output
}

if (traceUploadUrl) {
uploadTrace({
traceUploadUrl,
mode: 'dev',
isTurboSession,
projectDir: dir,
distDir: config.distDir,
})
}

// ensure we re-enable the terminal cursor before exiting
// the program, or the cursor could remain hidden
process.stdout.write('\x1B[?25h')
Expand Down Expand Up @@ -190,6 +202,7 @@ const nextDev: CliCommand = async (argv) => {
'--turbo': Boolean,
'--experimental-turbo': Boolean,
'--experimental-test-proxy': Boolean,
'--experimental-upload-trace': String,

// To align current messages with native binary.
// Will need to adjust subcommand later.
Expand Down Expand Up @@ -217,6 +230,7 @@ const nextDev: CliCommand = async (argv) => {
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application (default: 0.0.0.0)
--experimental-upload-trace=<trace-url> [EXPERIMENTAL] Report a subset of the debugging trace to a remote http url. Includes sensitive data. Disabled by default and url must be provided.
--help, -h Displays this message
`)
process.exit(0)
Expand Down Expand Up @@ -277,6 +291,10 @@ const nextDev: CliCommand = async (argv) => {
config = await loadConfig(PHASE_DEVELOPMENT_SERVER, dir)
const isExperimentalTestProxy = args['--experimental-test-proxy']

if (args['--experimental-upload-trace']) {
traceUploadUrl = args['--experimental-upload-trace']
}

const devServerOptions: StartServerOptions = {
dir,
port,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/app-router.tsx
Expand Up @@ -387,7 +387,7 @@ function Router({
return () => {
window.removeEventListener('pageshow', handlePageShow)
}
}, [dispatch, initialTree])
}, [dispatch])

// When mpaNavigation flag is set do a hard navigation to the new url.
// Infinitely suspend because we don't actually want to rerender any child
Expand Down
10 changes: 7 additions & 3 deletions packages/next/src/server/lib/patch-fetch.ts
@@ -1,7 +1,7 @@
import type { StaticGenerationAsyncStorage } from '../../client/components/static-generation-async-storage'
import type * as ServerHooks from '../../client/components/hooks-server-context'

import { AppRenderSpan } from './trace/constants'
import { AppRenderSpan, NextNodeServerSpan } from './trace/constants'
import { getTracer, SpanKind } from './trace/tracer'
import { CACHE_ONE_YEAR } from '../../lib/constants'

Expand Down Expand Up @@ -100,8 +100,12 @@ export function patchFetch({
const fetchStart = Date.now()
const method = init?.method?.toUpperCase() || 'GET'

// Do create a new span trace for internal fetches in the
// non-verbose mode.
const isInternal = (init?.next as any)?.internal === true

return await getTracer().trace(
AppRenderSpan.fetch,
isInternal ? NextNodeServerSpan.internalFetch : AppRenderSpan.fetch,
{
kind: SpanKind.CLIENT,
spanName: ['fetch', method, fetchUrl].filter(Boolean).join(' '),
Expand Down Expand Up @@ -131,7 +135,7 @@ export function patchFetch({
// fetch implementation.
if (
!staticGenerationStore ||
(init?.next as any)?.internal ||
isInternal ||
staticGenerationStore.isDraftMode
) {
return originFetch(input, init)
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/lib/trace/constants.ts
Expand Up @@ -64,6 +64,7 @@ enum NextNodeServerSpan {
route = 'route',
onProxyReq = 'onProxyReq',
apiResolver = 'apiResolver',
internalFetch = 'internalFetch',
}

enum StartServerSpan {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/web/spec-extension/request.ts
Expand Up @@ -20,7 +20,7 @@ export class NextRequest extends Request {
const url =
typeof input !== 'string' && 'url' in input ? input.url : String(input)
validateURL(url)
if (input instanceof Request) super(input)
if (input instanceof Request) super(input, init)
else super(url, init)
const nextUrl = new NextURL(url, {
headers: toNodeOutgoingHttpHeaders(this.headers),
Expand Down

0 comments on commit 862b404

Please sign in to comment.