Skip to content

Commit

Permalink
Merge branch 'vercel:canary' into canary
Browse files Browse the repository at this point in the history
  • Loading branch information
X-oss-byte committed Aug 13, 2023
2 parents 96c0fea + 261db49 commit b4a5f73
Show file tree
Hide file tree
Showing 74 changed files with 3,241 additions and 2,297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ export async function POST(request) {

### Request Body FormData

You can read the `FormData` using the the `request.formData()` function:
You can read the `FormData` using the `request.formData()` function:

```ts filename="app/items/route.ts" switcher
import { NextResponse } from 'next/server'
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.14-canary.2"
"version": "13.4.14-canary.3"
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:[email protected]",
"react-builtin": "npm:[email protected]cb3404a0c-20230807",
"react-builtin": "npm:[email protected]1a001dac6-20230812",
"react-dom": "18.2.0",
"react-dom-17": "npm:[email protected]",
"react-dom-builtin": "npm:[email protected]cb3404a0c-20230807",
"react-dom-experimental-builtin": "npm:[email protected]cb3404a0c-20230807",
"react-experimental-builtin": "npm:[email protected]cb3404a0c-20230807",
"react-server-dom-webpack": "18.3.0-canary-cb3404a0c-20230807",
"react-server-dom-webpack-experimental": "npm:[email protected]cb3404a0c-20230807",
"react-dom-builtin": "npm:[email protected]1a001dac6-20230812",
"react-dom-experimental-builtin": "npm:[email protected]1a001dac6-20230812",
"react-experimental-builtin": "npm:[email protected]1a001dac6-20230812",
"react-server-dom-webpack": "18.3.0-canary-1a001dac6-20230812",
"react-server-dom-webpack-experimental": "npm:[email protected]1a001dac6-20230812",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -206,8 +206,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.1",
"scheduler-builtin": "npm:[email protected]cb3404a0c-20230807",
"scheduler-experimental-builtin": "npm:[email protected]cb3404a0c-20230807",
"scheduler-builtin": "npm:[email protected]1a001dac6-20230812",
"scheduler-experimental-builtin": "npm:[email protected]1a001dac6-20230812",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"@next/eslint-plugin-next": "13.4.14-canary.3",
"@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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.4.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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.14-canary.2",
"version": "13.4.14-canary.3",
"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-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.14-canary.2",
"version": "13.4.14-canary.3",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs 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": "13.4.14-canary.2",
"version": "13.4.14-canary.3",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -83,7 +83,7 @@
]
},
"dependencies": {
"@next/env": "13.4.14-canary.2",
"@next/env": "13.4.14-canary.3",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -137,11 +137,11 @@
"@jest/types": "29.5.0",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.14-canary.2",
"@next/polyfill-nomodule": "13.4.14-canary.2",
"@next/react-dev-overlay": "13.4.14-canary.2",
"@next/react-refresh-utils": "13.4.14-canary.2",
"@next/swc": "13.4.14-canary.2",
"@next/polyfill-module": "13.4.14-canary.3",
"@next/polyfill-nomodule": "13.4.14-canary.3",
"@next/react-dev-overlay": "13.4.14-canary.3",
"@next/react-refresh-utils": "13.4.14-canary.3",
"@next/swc": "13.4.14-canary.3",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require("next/dist/compiled/react-experimental");
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-experimental-cb3404a0c-20230807';
var ReactVersion = '18.3.0-experimental-1a001dac6-20230812';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -3693,6 +3693,75 @@ function pushStyleContents(target, props) {
return;
}

function getImagePreloadKey(href, imageSrcSet, imageSizes) {
var uniquePart = '';

if (typeof imageSrcSet === 'string' && imageSrcSet !== '') {
uniquePart += '[' + imageSrcSet + ']';

if (typeof imageSizes === 'string') {
uniquePart += '[' + imageSizes + ']';
}
} else {
uniquePart += '[][]' + href;
}

return getResourceKey('image', uniquePart);
}

function pushImg(target, props, resources) {
var src = props.src,
srcSet = props.srcSet;

if (props.loading !== 'lazy' && (typeof src === 'string' || typeof srcSet === 'string') && props.fetchPriority !== 'low' && // We exclude data URIs in src and srcSet since these should not be preloaded
!(typeof src === 'string' && src[4] === ':' && (src[0] === 'd' || src[0] === 'D') && (src[1] === 'a' || src[1] === 'A') && (src[2] === 't' || src[2] === 'T') && (src[3] === 'a' || src[3] === 'A')) && !(typeof srcSet === 'string' && srcSet[4] === ':' && (srcSet[0] === 'd' || srcSet[0] === 'D') && (srcSet[1] === 'a' || srcSet[1] === 'A') && (srcSet[2] === 't' || srcSet[2] === 'T') && (srcSet[3] === 'a' || srcSet[3] === 'A'))) {
// We have a suspensey image and ought to preload it to optimize the loading of display blocking
// resources.
var sizes = props.sizes;
var key = getImagePreloadKey(src, srcSet, sizes);
var resource = resources.preloadsMap.get(key);

if (!resource) {
resource = {
type: 'preload',
chunks: [],
state: NoState,
props: {
rel: 'preload',
as: 'image',
// There is a bug in Safari where imageSrcSet is not respected on preload links
// so we omit the href here if we have imageSrcSet b/c safari will load the wrong image.
// This harms older browers that do not support imageSrcSet by making their preloads not work
// but this population is shrinking fast and is already small so we accept this tradeoff.
href: srcSet ? undefined : src,
imageSrcSet: srcSet,
imageSizes: sizes,
crossOrigin: props.crossOrigin,
integrity: props.integrity,
type: props.type,
fetchPriority: props.fetchPriority,
referrerPolicy: props.referrerPolicy
}
};
resources.preloadsMap.set(key, resource);

{
markAsRenderedResourceDEV(resource, props);
}

pushLinkImpl(resource.chunks, resource.props);
}

if (props.fetchPriority === 'high' || resources.highImagePreloads.size < 10) {
resources.highImagePreloads.add(resource);
} else {
resources.bulkPreloads.add(resource);
}
}

return pushSelfClosing(target, props, 'img');
}

function pushSelfClosing(target, props, tag) {
target.push(startChunkForTag(tag));

Expand Down Expand Up @@ -4263,6 +4332,11 @@ function pushStartInstance(target, type, props, resources, responseState, format
{
return pushStartPreformattedElement(target, props, type);
}

case 'img':
{
return pushImg(target, props, resources) ;
}
// Omitted close tags

case 'base':
Expand All @@ -4271,7 +4345,6 @@ function pushStartInstance(target, type, props, resources, responseState, format
case 'col':
case 'embed':
case 'hr':
case 'img':
case 'keygen':
case 'param':
case 'source':
Expand Down Expand Up @@ -5160,14 +5233,16 @@ function writePreamble(destination, resources, responseState, willFlushAllSegmen

preconnectChunks.length = 0;
resources.fontPreloads.forEach(flushResourceInPreamble, destination);
resources.fontPreloads.clear(); // Flush unblocked stylesheets by precedence
resources.fontPreloads.clear();
resources.highImagePreloads.forEach(flushResourceInPreamble, destination);
resources.highImagePreloads.clear(); // Flush unblocked stylesheets by precedence

resources.precedences.forEach(flushAllStylesInPreamble, destination);
resources.bootstrapScripts.forEach(flushResourceInPreamble, destination);
resources.scripts.forEach(flushResourceInPreamble, destination);
resources.scripts.clear();
resources.explicitPreloads.forEach(flushResourceInPreamble, destination);
resources.explicitPreloads.clear(); // Write embedding preloadChunks
resources.bulkPreloads.forEach(flushResourceInPreamble, destination);
resources.bulkPreloads.clear(); // Write embedding preloadChunks

var preloadChunks = responseState.preloadChunks;

Expand Down Expand Up @@ -5215,16 +5290,18 @@ function writeHoistables(destination, resources, responseState) {

preconnectChunks.length = 0;
resources.fontPreloads.forEach(flushResourceLate, destination);
resources.fontPreloads.clear(); // Preload any stylesheets. these will emit in a render instruction that follows this
resources.fontPreloads.clear();
resources.highImagePreloads.forEach(flushResourceInPreamble, destination);
resources.highImagePreloads.clear(); // Preload any stylesheets. these will emit in a render instruction that follows this
// but we want to kick off preloading as soon as possible

resources.precedences.forEach(preloadLateStyles, destination); // bootstrap scripts should flush above script priority but these can only flush in the preamble
// so we elide the code here for performance

resources.scripts.forEach(flushResourceLate, destination);
resources.scripts.clear();
resources.explicitPreloads.forEach(flushResourceLate, destination);
resources.explicitPreloads.clear(); // Write embedding preloadChunks
resources.bulkPreloads.forEach(flushResourceLate, destination);
resources.bulkPreloads.clear(); // Write embedding preloadChunks

var preloadChunks = responseState.preloadChunks;

Expand Down Expand Up @@ -5641,12 +5718,13 @@ function createResources() {
// cleared on flush
preconnects: new Set(),
fontPreloads: new Set(),
highImagePreloads: new Set(),
// usedImagePreloads: new Set(),
precedences: new Map(),
stylePrecedences: new Map(),
bootstrapScripts: new Set(),
scripts: new Set(),
explicitPreloads: new Set(),
bulkPreloads: new Set(),
// like a module global for currently rendering boundary
boundaryResources: null
};
Expand Down Expand Up @@ -5803,19 +5881,7 @@ function preload(href, options) {
// by varying the href. this is an edge case but it is the most correct behavior.
var imageSrcSet = options.imageSrcSet,
imageSizes = options.imageSizes;
var uniquePart = '';

if (typeof imageSrcSet === 'string' && imageSrcSet !== '') {
uniquePart += '[' + imageSrcSet + ']';

if (typeof imageSizes === 'string') {
uniquePart += '[' + imageSizes + ']';
}
} else {
uniquePart += '[][]' + href;
}

key = getResourceKey(as, uniquePart);
key = getImagePreloadKey(href, imageSrcSet, imageSizes);
} else {
key = getResourceKey(as, href);
}
Expand Down Expand Up @@ -5874,8 +5940,10 @@ function preload(href, options) {

if (as === 'font') {
resources.fontPreloads.add(resource);
} else if (as === 'image' && options.fetchPriority === 'high') {
resources.highImagePreloads.add(resource);
} else {
resources.explicitPreloads.add(resource);
resources.bulkPreloads.add(resource);
}

flushResources(request);
Expand Down
Loading

0 comments on commit b4a5f73

Please sign in to comment.