Skip to content

Commit

Permalink
Merge branch 'canary' into 27925-add-remote-patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed May 5, 2022
2 parents 72db874 + 0dd6211 commit e20ce59
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 203 deletions.
331 changes: 181 additions & 150 deletions .github/workflows/build_test_deploy.yml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions .github/workflows/pull_request_stats.yml
Expand Up @@ -13,18 +13,18 @@ jobs:
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 25

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change

- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
with:
node-version: 14
node-version: 16
check-latest: true

- name: Install
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
with:
path: .turbo
Expand All @@ -68,7 +68,7 @@ jobs:
# "If there are multiple partial matches for a restore key, the action returns the most recently created cache."
# So we get latest cache
- name: Cache built files
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ./packages/next-target
key: next-swc-cargo-cache-ubuntu-18.04--${{ hashFiles('**/Cargo.lock') }}
Expand All @@ -77,8 +77,8 @@ jobs:
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/cli@1.2.1
- run: npm i -g turbo@1.0.28
- run: npm i -g @napi-rs/cli@2.7.0
- run: npm i -g turbo@1.2.6

- name: Build
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
Expand All @@ -90,7 +90,7 @@ jobs:
TURBO_PROJECT: nextjs

- name: Upload artifact
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v3
with:
name: next-swc-dev-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
Expand All @@ -106,14 +106,14 @@ jobs:
needs: build-native-dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 25

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
with:
name: next-swc-dev-binary
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_react_experimental.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- run: yarn install --frozen-lockfile --check-files
env:
Expand All @@ -19,7 +19,7 @@ jobs:

- run: node run-tests.js --timings --write-timings -g 1/1

- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache-build
with:
path: ./*
Expand All @@ -38,7 +38,7 @@ jobs:
matrix:
group: [1, 2, 3, 4, 5, 6]
steps:
- uses: actions/cache@v2
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_react_next.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- run: yarn install --frozen-lockfile --check-files
env:
Expand All @@ -19,7 +19,7 @@ jobs:

- run: node run-tests.js --timings --write-timings -g 1/1

- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache-build
with:
path: ./*
Expand All @@ -38,7 +38,7 @@ jobs:
matrix:
group: [1, 2, 3, 4, 5, 6]
steps:
- uses: actions/cache@v2
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/data-fetching/get-server-side-props.md
Expand Up @@ -31,7 +31,7 @@ You can import modules in top-level scope for use in `getServerSideProps`. Impor
The `context` parameter is an object containing the following keys:

- `params`: If this page uses a [dynamic route](/docs/routing/dynamic-routes.md), `params` contains the route parameters. If the page name is `[id].js` , then `params` will look like `{ id: ... }`.
- `req`: [The `HTTP` IncomingMessage object](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
- `req`: [The `HTTP` IncomingMessage object](https://nodejs.org/api/http.html#http_class_http_incomingmessage), with an additional `cookies` prop, which is an object with string keys mapping to string values of cookies.
- `res`: [The `HTTP` response object](https://nodejs.org/api/http.html#http_class_http_serverresponse).
- `query`: An object representing the query string.
- `preview`: `preview` is `true` if the page is in the [Preview Mode](/docs/advanced-features/preview-mode.md) and `false` otherwise.
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/next.config.js/custom-webpack-config.md
Expand Up @@ -36,6 +36,7 @@ The second argument to the `webpack` function is an object with the following pr
- `buildId`: `String` - The build id, used as a unique identifier between builds
- `dev`: `Boolean` - Indicates if the compilation will be done in development
- `isServer`: `Boolean` - It's `true` for server-side compilation, and `false` for client-side compilation
- `nextRuntime`: `String` - The target runtime for server-side compilation; either `"edge"` or `"nodejs"`
- `defaultLoaders`: `Object` - Default loaders used internally by Next.js:
- `babel`: `Object` - Default `babel-loader` configuration

Expand Down
2 changes: 1 addition & 1 deletion errors/no-cache.md
Expand Up @@ -78,7 +78,7 @@ cache:
Using GitHub's [actions/cache](https://github.com/actions/cache), add the following step in your workflow file:

```yaml
uses: actions/cache@v2
uses: actions/cache@v3
with:
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
Expand Down
20 changes: 0 additions & 20 deletions package.json
Expand Up @@ -181,25 +181,5 @@
},
"engines": {
"node": ">=12.22.0"
},
"turbo": {
"pipeline": {
"build-native": {
"dependsOn": [
"^build-native"
],
"outputs": [
"native/*.node"
]
},
"build-wasm": {
"dependsOn": [
"^build-wasm"
],
"outputs": [
"crates/wasm/pkg/*"
]
}
}
}
}
5 changes: 4 additions & 1 deletion packages/next/client/dev/fouc.ts
@@ -1,9 +1,12 @@
// This wrapper function is used to avoid raising a Trusted Types violation.
const safeSetTimeout = (callback: () => void) => setTimeout(callback)

// This function is used to remove Next.js' no-FOUC styles workaround for using
// `style-loader` in development. It must be called before hydration, or else
// rendering won't have the correct computed values in effects.
export function displayContent(): Promise<void> {
return new Promise((resolve) => {
;(window.requestAnimationFrame || setTimeout)(function () {
;(window.requestAnimationFrame || safeSetTimeout)(function () {
for (
var x = document.querySelectorAll('[data-next-hide-fouc]'),
i = x.length;
Expand Down
4 changes: 2 additions & 2 deletions packages/next/lib/recursive-delete.ts
@@ -1,9 +1,9 @@
import { Dirent, promises } from 'fs'
import { join, isAbsolute, dirname } from 'path'
import { promisify } from 'util'
import isError from './is-error'

const sleep = promisify(setTimeout)
const sleep = (timeout: number) =>
new Promise((resolve) => setTimeout(resolve, timeout))

const unlinkPath = async (p: string, isDir = false, t = 1): Promise<void> => {
try {
Expand Down
Expand Up @@ -804,11 +804,18 @@ var focusSummary = {
}

function makeFocusableForeignObject() {
var fragment = document.createElement('div')
fragment.innerHTML =
'<svg><foreignObject width="30" height="30">\n <input type="text"/>\n </foreignObject></svg>'
// Constructs <foreignObject width="30" height="30"><input type="text"/></foreignObject>
// without raising a Trusted Types violation
var foreignObject = document.createElementNS(
'http://www.w3.org/2000/svg',
'foreignObject'
)
foreignObject.width.baseVal.value = 30
foreignObject.height.baseVal.value = 30
foreignObject.appendChild(document.createElement('input'))
foreignObject.lastChild.type = 'text'

return fragment.firstChild.firstChild
return foreignObject
}

function focusSvgForeignObjectHack(element) {
Expand Down
4 changes: 3 additions & 1 deletion test/integration/chunking/pages/page3.js
@@ -1,5 +1,7 @@
import Link from 'next/link'
import('lodash').then((_) => console.log(_.chunk(['a', 'b', 'c', 'd'], 2)))
import('lodash').then(({ default: _ }) =>
console.log(_.chunk(['a', 'b', 'c', 'd'], 2))
)

const Page = () => {
return (
Expand Down
9 changes: 2 additions & 7 deletions tsec-exemptions.json
@@ -1,18 +1,13 @@
{
"ban-element-innerhtml-assignments": [
"packages/next/client/head-manager.ts",
"packages/next/client/script.tsx",
"packages/react-dev-overlay/src/internal/components/Overlay/maintain--tab-focus.ts"
"packages/next/client/script.tsx"
],
"ban-element-setattribute": [
"packages/next/client/head-manager.ts",
"packages/next/client/script.tsx"
],
"ban-script-content-assignments": ["packages/next/client/script.tsx"],
"ban-script-src-assignments": ["packages/next/client/script.tsx"],
"ban-trustedtypes-createpolicy": ["packages/next/client/trusted-types.ts"],
"ban-window-stringfunctiondef": [
"packages/next/lib/recursive-delete.ts",
"packages/next/client/dev/fouc.ts"
]
"ban-trustedtypes-createpolicy": ["packages/next/client/trusted-types.ts"]
}
12 changes: 12 additions & 0 deletions turbo.json
@@ -0,0 +1,12 @@
{
"pipeline": {
"build-native": {
"dependsOn": ["^build-native"],
"outputs": ["native/*.node"]
},
"build-wasm": {
"dependsOn": ["^build-wasm"],
"outputs": ["crates/wasm/pkg/*"]
}
}
}

0 comments on commit e20ce59

Please sign in to comment.