Skip to content

Commit

Permalink
Merge branch 'canary' into url-should-not-be-used-as-page-path
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 2, 2022
2 parents 7faf22d + 39d3210 commit 94084be
Show file tree
Hide file tree
Showing 74 changed files with 1,815 additions and 168 deletions.
20 changes: 20 additions & 0 deletions docs/advanced-features/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ const customJestConfig = {
module.exports = createJestConfig(customJestConfig)
```

### Relay

To enable [Relay](https://relay.dev/) support:

```js
// next.config.js
module.exports = {
experimental: {
relay: {
// This should match relay.config.js
src: './',
artifactDirectory: './__generated__'
language: 'typescript',
},
},
}
```

NOTE: In Next.js all JavaScript files in `pages` directory are considered routes. So, for `relay-compiler` you'll need to specify `artifactDirectory` configuration settings outside of the `pages`, otherwise `relay-compiler` will generate files next to the source file in the `__generated__` directory, and this file will be considered a route, which will break production builds.

### Remove React Properties

Allows to remove JSX properties. This is often used for testing. Similar to `babel-plugin-react-remove-properties`.
Expand Down
2 changes: 2 additions & 0 deletions docs/basic-features/font-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ Automatic Webfont Optimization currently supports Google Fonts and Typekit with
See [Google Font Display](https://nextjs.org/docs/messages/google-font-display) for more information.
> **Note**: Font Optimization does not currently support self-hosted fonts.
## Disabling Optimization
If you do not want Next.js to optimize your fonts, you can opt-out.
Expand Down
400 changes: 400 additions & 0 deletions docs/guides/building-forms.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@
}
]
},
{
"title": "Guides",
"routes": [
{
"title": "Building Forms",
"path": "/docs/guides/building-forms.md"
}
]
},
{
"title": "Middleware",
"path": "/docs/middleware.md"
Expand Down
4 changes: 2 additions & 2 deletions examples/with-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json /
# RUN npm install
# COPY package.json package-lock.json ./
# RUN npm ci

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
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": "12.0.10"
"version": "12.0.11-canary.1"
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@types/http-proxy": "1.17.3",
"@types/jest": "24.0.13",
"@types/node": "13.11.0",
"@types/relay-runtime": "13.0.0",
"@types/selenium-webdriver": "4.0.15",
"@types/sharp": "0.29.3",
"@types/string-hash": "1.1.1",
Expand Down Expand Up @@ -147,6 +148,8 @@
"react-dom": "17.0.2",
"react-dom-18": "npm:react-dom@18.0.0-rc.0",
"react-ssr-prepass": "1.0.8",
"relay-compiler": "13.0.2",
"relay-runtime": "13.0.2",
"react-virtualized": "9.22.3",
"release": "6.3.0",
"request-promise-core": "1.1.2",
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": "12.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"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.10",
"@next/eslint-plugin-next": "12.0.11-canary.1",
"@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/lib/rules/link-passhref.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
},

JSXOpeningElement(node) {
if (node.name.name !== 'Link' || node.name.name !== linkImport) {
if (node.name.name !== linkImport) {
return
}

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.0.10",
"version": "12.0.11-canary.1",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "12.0.10",
"version": "12.0.11-canary.1",
"main": "index.js",
"license": "MIT",
"repository": {
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.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"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.0.10",
"version": "12.0.11-canary.1",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions packages/next-swc/Cargo.lock

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

3 changes: 1 addition & 2 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
chrono = "0.4"
once_cell = "1.8.0"
easy-error = "1.0.0"
either = "1"
fxhash = "0.2.1"
Expand All @@ -30,5 +31,3 @@ regex = "1.5"
swc_ecma_transforms_testing = "0.59.0"
testing = "0.18.0"
walkdir = "2.3.2"


21 changes: 20 additions & 1 deletion packages/next-swc/crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub mod next_dynamic;
pub mod next_ssg;
pub mod page_config;
pub mod react_remove_properties;
#[cfg(not(target_arch = "wasm32"))]
pub mod relay;
pub mod remove_console;
pub mod shake_exports;
pub mod styled_jsx;
Expand Down Expand Up @@ -91,6 +93,10 @@ pub struct TransformOptions {
#[serde(default)]
pub react_remove_properties: Option<react_remove_properties::Config>,

#[serde(default)]
#[cfg(not(target_arch = "wasm32"))]
pub relay: Option<relay::Config>,

#[serde(default)]
pub shake_exports: Option<shake_exports::Config>,
}
Expand All @@ -99,7 +105,19 @@ pub fn custom_before_pass(
cm: Arc<SourceMap>,
file: Arc<SourceFile>,
opts: &TransformOptions,
) -> impl Fold {
) -> impl Fold + '_ {
#[cfg(target_arch = "wasm32")]
let relay_plugin = noop();

#[cfg(not(target_arch = "wasm32"))]
let relay_plugin = {
if let Some(config) = &opts.relay {
Either::Left(relay::relay(config, file.name.clone()))
} else {
Either::Right(noop())
}
};

chain!(
disallow_re_export_all_in_page::disallow_re_export_all_in_page(opts.is_page_file),
styled_jsx::styled_jsx(cm.clone()),
Expand Down Expand Up @@ -130,6 +148,7 @@ pub fn custom_before_pass(
page_config::page_config(opts.is_development, opts.is_page_file),
!opts.disable_page_config
),
relay_plugin,
match &opts.remove_console {
Some(config) if config.truthy() =>
Either::Left(remove_console::remove_console(config.clone())),
Expand Down
Loading

0 comments on commit 94084be

Please sign in to comment.