Skip to content

Commit

Permalink
Merge branch 'canary' into feat/eslint-date-hydration
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 authored Oct 3, 2022
2 parents af5b591 + 3e8af93 commit 2f5298c
Show file tree
Hide file tree
Showing 57 changed files with 236 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/actions/next-stats-action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL repository="https://github.com/vercel/next-stats-action"
COPY . /next-stats

# Install node_modules
RUN npm i -g pnpm@7.2.1
RUN npm i -g pnpm@7.3.0
RUN cd /next-stats && pnpm install --production

RUN git config --global user.email 'stats@localhost'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-09-23
PNPM_VERSION: 7.2.1
PNPM_VERSION: 7.3.0

jobs:
check-examples:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-09-23
PNPM_VERSION: 7.2.1
PNPM_VERSION: 7.3.0

jobs:
build-native-dev:
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pr:

variables:
PNPM_CACHE_FOLDER: $(Pipeline.Workspace)/.pnpm-store
PNPM_VERSION: 7.2.1
PNPM_VERSION: 7.3.0
NEXT_TELEMETRY_DISABLED: '1'
node_version: ^14.19.0

Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/edge-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Running `console.log` on `process.env` **will not** show all your Environment Va
console.log(process.env)
// { NEXT_RUNTIME: 'edge' }
console.log(process.env.TEST_VARIABLE)
// { NEXT_RUNTIME: 'edge', TEST_VARIABLE: 'value' }
// value
```

## Unsupported APIs
Expand Down
File renamed without changes.
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": "12.3.2-canary.16"
"version": "12.3.2-canary.17"
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@
"@babel/traverse": "7.18.0"
},
"engines": {
"node": ">=12.22.0",
"pnpm": ">= 7.2.1"
"node": ">=12.22.0"
},
"packageManager": "[email protected]"
}
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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "12.3.2-canary.16",
"@next/eslint-plugin-next": "12.3.2-canary.17",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.21.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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"private": true,
"scripts": {
"build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi native --features plugin",
Expand Down
22 changes: 22 additions & 0 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,28 @@ export default async function build(
: undefined,
}

if (pageKeys.app) {
const conflictingAppPagePaths = []

for (const appPath of pageKeys.app) {
if (pageKeys.pages.includes(appPath)) {
conflictingAppPagePaths.push(`pages${appPath} - app${appPath}`)
}
}
const numConflicting = conflictingAppPagePaths.length

if (numConflicting > 0) {
Log.error(
`Conflicting app and page file${
numConflicting === 1 ? ' was' : 's were'
} found, please remove the conflicting files to continue. \n${conflictingAppPagePaths.join(
'\n'
)}\n`
)
process.exit(1)
}
}

const conflictingPublicFiles: string[] = []
const hasPages404 = mappedPages['/404']?.startsWith(PAGES_DIR_ALIAS)
const hasCustomErrorPage =
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const BABEL_CONFIG_FILES = [
]

const rscSharedRegex =
/(node_modules[\\/]react\/|[\\/]shared[\\/]lib[\\/](head-manager-context|router-context|flush-effects)\.js|node_modules[\\/]styled-jsx[\\/])/
/(node_modules[\\/]react\/|[\\/]shared[\\/]lib[\\/](head-manager-context|router-context|server-inserted-html)\.js|node_modules[\\/]styled-jsx[\\/])/

// Support for NODE_PATH
const nodePathList = (process.env.NODE_PATH || '')
Expand Down
58 changes: 28 additions & 30 deletions packages/next/client/components/app-router.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
import type { FlightRouterState, FlightData } from '../../server/app-render'
import {
ACTION_NAVIGATE,
ACTION_PREFETCH,
// ACTION_PREFETCH,
ACTION_RELOAD,
ACTION_RESTORE,
ACTION_SERVER_PATCH,
Expand Down Expand Up @@ -97,7 +97,7 @@ function ErrorOverlay({ children }: PropsWithChildren<{}>): ReactElement {
let initialParallelRoutes: CacheNode['parallelRoutes'] =
typeof window === 'undefined' ? null! : new Map()

const prefetched = new Set<string>()
// const prefetched = new Set<string>()

/**
* The global router that wraps the application components.
Expand Down Expand Up @@ -208,34 +208,32 @@ export default function AppRouter({

const routerInstance: AppRouterInstance = {
// TODO-APP: implement prefetching of flight
prefetch: async (href) => {
prefetch: async (_href) => {
// If prefetch has already been triggered, don't trigger it again.
if (prefetched.has(href)) {
return
}

prefetched.add(href)
const url = new URL(href, location.origin)

try {
// TODO-APP: handle case where history.state is not the new router history entry
const serverResponse = await fetchServerResponse(
url,
// initialTree is used when history.state.tree is missing because the history state is set in `useEffect` below, it being missing means this is the hydration case.
window.history.state?.tree || initialTree,
true
)
// @ts-ignore startTransition exists
React.startTransition(() => {
dispatch({
type: ACTION_PREFETCH,
url,
serverResponse,
})
})
} catch (err) {
console.error('PREFETCH ERROR', err)
}
// if (prefetched.has(href)) {
// return
// }
// prefetched.add(href)
// const url = new URL(href, location.origin)
// try {
// // TODO-APP: handle case where history.state is not the new router history entry
// const serverResponse = await fetchServerResponse(
// url,
// // initialTree is used when history.state.tree is missing because the history state is set in `useEffect` below, it being missing means this is the hydration case.
// window.history.state?.tree || initialTree,
// true
// )
// // @ts-ignore startTransition exists
// React.startTransition(() => {
// dispatch({
// type: ACTION_PREFETCH,
// url,
// serverResponse,
// })
// })
// } catch (err) {
// console.error('PREFETCH ERROR', err)
// }
},
replace: (href, options = {}) => {
// @ts-ignore startTransition exists
Expand Down Expand Up @@ -268,7 +266,7 @@ export default function AppRouter({
}

return routerInstance
}, [dispatch, initialTree])
}, [dispatch /*, initialTree*/])

useEffect(() => {
// When mpaNavigation flag is set do a hard navigation to the new url.
Expand Down
6 changes: 3 additions & 3 deletions packages/next/client/components/hooks-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from '../../shared/lib/app-router-context'

export {
FlushEffectsContext,
useFlushEffects,
} from '../../shared/lib/flush-effects'
ServerInsertedHTMLContext,
useServerInsertedHTML,
} from '../../shared/lib/server-inserted-html'

/**
* Get the current search params. For example useSearchParams() would return {"foo": "bar"} when ?foo=bar
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": "12.3.2-canary.16",
"version": "12.3.2-canary.17",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -69,7 +69,7 @@
]
},
"dependencies": {
"@next/env": "12.3.2-canary.16",
"@next/env": "12.3.2-canary.17",
"@swc/helpers": "0.4.11",
"caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14",
Expand Down Expand Up @@ -120,11 +120,11 @@
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.7.0",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "12.3.2-canary.16",
"@next/polyfill-nomodule": "12.3.2-canary.16",
"@next/react-dev-overlay": "12.3.2-canary.16",
"@next/react-refresh-utils": "12.3.2-canary.16",
"@next/swc": "12.3.2-canary.16",
"@next/polyfill-module": "12.3.2-canary.17",
"@next/polyfill-nomodule": "12.3.2-canary.17",
"@next/react-dev-overlay": "12.3.2-canary.17",
"@next/react-refresh-utils": "12.3.2-canary.17",
"@next/swc": "12.3.2-canary.17",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
Expand Down
Loading

0 comments on commit 2f5298c

Please sign in to comment.