Skip to content

Commit

Permalink
Merge branch 'canary' into eslint8
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts committed Nov 15, 2021
2 parents cb18a61 + abd87a5 commit 5711312
Show file tree
Hide file tree
Showing 50 changed files with 431 additions and 314 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Expand Up @@ -30,14 +30,15 @@
},
"overrides": [
{
"files": ["test/**/*.test.js"],
"files": ["test/**/*.js", "test/**/*.ts", "**/*.test.ts"],
"extends": ["plugin:jest/recommended"],
"rules": {
"jest/expect-expect": "off",
"jest/no-disabled-tests": "off",
"jest/no-conditional-expect": "off",
"jest/valid-title": "off",
"jest/no-interpolation-in-snapshots": "off"
"jest/no-interpolation-in-snapshots": "off",
"jest/no-export": "off"
}
},
{ "files": ["**/__tests__/**"], "env": { "jest": true } },
Expand Down
2 changes: 1 addition & 1 deletion docs/api-routes/response-helpers.md
Expand Up @@ -89,7 +89,7 @@ type ResponseData {
message: string
}

export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) => {
export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
res.status(200).json({ message: 'Hello from Next.js!' })
}
```
Expand Down
9 changes: 3 additions & 6 deletions docs/authentication.md
Expand Up @@ -48,7 +48,7 @@ const Profile = () => {
export default Profile
```

You can view this [example in action](https://next-with-iron-session.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works.
You can view this [example in action](https://iron-session-example.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works.

### Authenticating Server-Rendered Pages

Expand All @@ -71,10 +71,7 @@ import withSession from '../lib/session'
import Layout from '../components/Layout'

export const getServerSideProps = withSession(async function ({ req, res }) {
// Get the user's session based on the request
const user = req.session.get('user')

if (!user) {
if (!req.session.user) {
return {
redirect: {
destination: '/login',
Expand Down Expand Up @@ -119,7 +116,7 @@ Now that we've discussed authentication patterns, let's look at specific provide

If you have an existing database with user data, you'll likely want to utilize an open-source solution that's provider agnostic.

- If you want a low-level, encrypted, and stateless session utility use [`next-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session).
- If you want a low-level, encrypted, and stateless session utility use [`iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session).
- If you want a full-featured authentication system with built-in providers (Google, Facebook, GitHub…), JWT, JWE, email/password, magic links and more… use [`next-auth`](https://github.com/nextauthjs/next-auth-example).

Both of these libraries support either authentication pattern. If you're interested in [Passport](http://www.passportjs.org/), we also have examples for it using secure and encrypted cookies:
Expand Down
8 changes: 4 additions & 4 deletions docs/routing/introduction.md
Expand Up @@ -6,7 +6,7 @@ description: Next.js has a built-in, opinionated, and file-system based Router.

Next.js has a file-system based router built on the [concept of pages](/docs/basic-features/pages.md).

When a file is added to the `pages` directory it's automatically available as a route.
When a file is added to the `pages` directory, it's automatically available as a route.

The files inside the `pages` directory can be used to define most common patterns.

Expand All @@ -19,14 +19,14 @@ The router will automatically route files named `index` to the root of the direc

#### Nested routes

The router supports nested files. If you create a nested folder structure files will be automatically routed in the same way still.
The router supports nested files. If you create a nested folder structure, files will automatically be routed in the same way still.

- `pages/blog/first-post.js``/blog/first-post`
- `pages/dashboard/settings/username.js``/dashboard/settings/username`

#### Dynamic route segments

To match a dynamic segment you can use the bracket syntax. This allows you to match named parameters.
To match a dynamic segment, you can use the bracket syntax. This allows you to match named parameters.

- `pages/blog/[slug].js``/blog/:slug` (`/blog/hello-world`)
- `pages/[username]/settings.js``/:username/settings` (`/foo/settings`)
Expand Down Expand Up @@ -68,7 +68,7 @@ function Home() {
export default Home
```

In the example above we have multiple links, each one maps a path (`href`) to a known page:
The example above uses multiple links. Each one maps a path (`href`) to a known page:

- `/``pages/index.js`
- `/about``pages/about.js`
Expand Down
10 changes: 10 additions & 0 deletions examples/with-storybook-styled-jsx-scss/.storybook/preview.js
@@ -1,3 +1,13 @@
import { StyleRegistry } from 'styled-jsx'

export const decorators = [
(Story) => (
<StyleRegistry>
<Story />
</StyleRegistry>
),
]

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
}
2 changes: 1 addition & 1 deletion examples/with-storybook-styled-jsx-scss/package.json
Expand Up @@ -9,7 +9,7 @@
"build-storybook": "build-storybook --no-dll"
},
"dependencies": {
"next": "^10.0.0",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "12.0.4-canary.12"
"version": "12.0.4"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"next-no-sourcemaps": "node --trace-deprecation packages/next/dist/bin/next",
"clean-trace-jaeger": "rm -rf test/integration/basic/.next && TRACE_TARGET=JAEGER node --trace-deprecation --enable-source-maps packages/next/dist/bin/next build test/integration/basic",
"debug": "node --inspect packages/next/dist/bin/next",
"postinstall": "node scripts/install-native.mjs"
"postinstall": "git config feature.manyFiles true && node scripts/install-native.mjs"
},
"pre-commit": "lint-staged",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"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": "12.0.4-canary.12",
"version": "12.0.4",
"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.0.4-canary.12",
"@next/eslint-plugin-next": "12.0.4",
"@rushstack/eslint-patch": "^1.0.8",
"@typescript-eslint/parser": "^5.0.0",
"eslint-import-resolver-node": "^0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "12.0.4-canary.12",
"version": "12.0.4",
"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": "12.0.4-canary.12",
"version": "12.0.4",
"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": "12.0.4-canary.12",
"version": "12.0.4",
"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": "12.0.4-canary.12",
"version": "12.0.4",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
Expand Up @@ -40,6 +40,7 @@ export default function NoAnonymousDefaultExport({
chalk.yellow.bold(
'Anonymous arrow functions cause Fast Refresh to not preserve local component state.'
),
chalk.cyan(this.file.opts.filename),
'Please add a name to your function, for example:',
'',
chalk.bold('Before'),
Expand All @@ -64,6 +65,7 @@ export default function NoAnonymousDefaultExport({
chalk.yellow.bold(
'Anonymous function declarations cause Fast Refresh to not preserve local component state.'
),
chalk.cyan(this.file.opts.filename),
'Please add a name to your function, for example:',
'',
chalk.bold('Before'),
Expand Down
1 change: 1 addition & 0 deletions packages/next/build/entries.ts
Expand Up @@ -162,6 +162,7 @@ export function createEntrypoints(
page,
absoluteAppPath: pages['/_app'],
absoluteDocumentPath: pages['/_document'],
absoluteErrorPath: pages['/_error'],
absolutePagePath,
isServerComponent: isFlight,
buildId,
Expand Down
6 changes: 0 additions & 6 deletions packages/next/build/webpack-config.ts
Expand Up @@ -1759,12 +1759,6 @@ export default async function getBaseWebpackConfig(
webpackConfig.module?.rules &&
webpackConfig.plugins
) {
// CRA prevents loading all locales by default
// https://github.com/facebook/create-react-app/blob/fddce8a9e21bf68f37054586deb0c8636a45f50b/packages/react-scripts/config/webpack.config.js#L721
webpackConfig.plugins.push(
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
)

// CRA allows importing non-webpack handled files with file-loader
// these need to be the last rule to prevent catching other items
// https://github.com/facebook/create-react-app/blob/fddce8a9e21bf68f37054586deb0c8636a45f50b/packages/react-scripts/config/webpack.config.js#L594
Expand Down

0 comments on commit 5711312

Please sign in to comment.