Skip to content

Commit

Permalink
Merge branch 'canary' into swc-30
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Nov 29, 2022
2 parents 1751643 + ae626c5 commit 8cb6cc2
Show file tree
Hide file tree
Showing 24 changed files with 102 additions and 67 deletions.
17 changes: 17 additions & 0 deletions errors/fast-refresh-reload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Fast Refresh had to perform full reload

#### Why This Error Occurred

Fast Refresh had to perform a full reload when you edited a file. It may be because:

- The file you're editing might have other exports in addition to a React component.
- Your React component is an anonymous function.

#### Possible Ways to Fix It

- Move your other exports to a separate file.
- Use a named function for your React component.

### Useful Links

[Fast Refresh documentation](https://nextjs.org/docs/basic-features/fast-refresh)
4 changes: 4 additions & 0 deletions errors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@
{
"title": "app-dir-dynamic-href",
"path": "/errors/app-dir-dynamic-href.md"
},
{
"title": "fast-refresh-reload",
"path": "/errors/fast-refresh-reload.md"
}
]
}
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.0.6-canary.1"
"version": "13.0.6-canary.2"
}
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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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": "13.0.6-canary.1",
"@next/eslint-plugin-next": "13.0.6-canary.2",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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": "13.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"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.0.6-canary.1",
"version": "13.0.6-canary.2",
"private": true,
"scripts": {
"build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin --js false native",
Expand Down
1 change: 1 addition & 0 deletions packages/next/client/dev/error-overlay/hot-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ function performFullReload(err) {
JSON.stringify({
event: 'client-full-reload',
stackTrace,
hadRuntimeError: !!hadRuntimeError,
})
)

Expand Down
4 changes: 2 additions & 2 deletions packages/next/compiled/undici/index.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.0.6-canary.1",
"version": "13.0.6-canary.2",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -75,7 +75,7 @@
]
},
"dependencies": {
"@next/env": "13.0.6-canary.1",
"@next/env": "13.0.6-canary.2",
"@swc/helpers": "0.4.14",
"caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14",
Expand Down Expand Up @@ -125,11 +125,11 @@
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.12.0",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.0.6-canary.1",
"@next/polyfill-nomodule": "13.0.6-canary.1",
"@next/react-dev-overlay": "13.0.6-canary.1",
"@next/react-refresh-utils": "13.0.6-canary.1",
"@next/swc": "13.0.6-canary.1",
"@next/polyfill-module": "13.0.6-canary.2",
"@next/polyfill-nomodule": "13.0.6-canary.2",
"@next/react-dev-overlay": "13.0.6-canary.2",
"@next/react-refresh-utils": "13.0.6-canary.2",
"@next/swc": "13.0.6-canary.2",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
Expand Down Expand Up @@ -276,7 +276,7 @@
"timers-browserify": "2.0.12",
"tty-browserify": "0.0.1",
"ua-parser-js": "0.7.28",
"undici": "5.12.0",
"undici": "5.13.0",
"unistore": "3.4.1",
"util": "0.12.4",
"uuid": "8.3.2",
Expand Down
29 changes: 23 additions & 6 deletions packages/next/server/dev/hot-reloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,33 @@ export default class HotReloader {
break
}
case 'client-full-reload': {
const { event, stackTrace, hadRuntimeError } = payload

traceChild = {
name: payload.event,
attrs: { stackTrace: payload.stackTrace ?? '' },
name: event,
attrs: { stackTrace: stackTrace ?? '' },
}

if (hadRuntimeError) {
Log.warn(
`Fast Refresh had to perform a full reload due to a runtime error.`
)
break
}

let fileMessage = ''
if (stackTrace) {
const file = /Aborted because (.+) is not accepted/.exec(
stackTrace
)?.[1]
if (file) {
fileMessage = ` when ${file} changed`
}
}

Log.warn(
'Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works'
`Fast Refresh had to perform a full reload${fileMessage}. Read more: https://nextjs.org/docs/messages/fast-refresh-reload`
)
if (payload.stackTrace) {
console.warn(payload.stackTrace)
}
break
}
default: {
Expand Down
12 changes: 8 additions & 4 deletions packages/next/server/next-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,20 @@ export function createTSPlugin(modules: {
}

function create(info: ts.server.PluginCreateInfo) {
const appDir = path.join(info.project.getCurrentDirectory(), 'app')
const projectDir = info.project.getCurrentDirectory()
const appDir = new RegExp(
'^' + (projectDir + '(/src)?/app').replace(/[\\/]/g, '[\\/]')
)

const isAppEntryFile = (filePath: string) => {
return (
filePath.startsWith(appDir) &&
appDir.test(filePath) &&
/^(page|layout)\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath))
)
}
const isPageFile = (filePath: string) => {
return (
filePath.startsWith(appDir) &&
appDir.test(filePath) &&
/^page\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath))
)
}
Expand Down Expand Up @@ -292,7 +296,7 @@ export function createTSPlugin(modules: {
info.project.projectService.logger.info(message)
}

log('Starting Next.js TypeScript plugin: ' + appDir)
log('Starting Next.js TypeScript plugin: ' + projectDir)

// Set up decorator object
const proxy = Object.create(null)
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "13.0.6-canary.1",
"version": "13.0.6-canary.2",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "13.0.6-canary.1",
"version": "13.0.6-canary.2",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8cb6cc2

Please sign in to comment.