Skip to content

Commit

Permalink
Merge branches 'fix/cache-preload-issue' and 'fix/cache-preload-issue…
Browse files Browse the repository at this point in the history
…' of github.com:timneutkens/next.js into fix/cache-preload-issue
  • Loading branch information
timneutkens committed Nov 22, 2022
2 parents 7d37792 + 8a4fdab commit 712def4
Show file tree
Hide file tree
Showing 50 changed files with 436 additions and 204 deletions.
147 changes: 71 additions & 76 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -297,25 +297,24 @@ jobs:
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

# - run: npx @replayio/playwright install chromium
# if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type development --timings -g ${{ matrix.group }}/2
name: Run test/development
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDev / Group ${{ matrix.group }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
# env:
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDev / Group ${{ matrix.group }}
# RECORD_ALL_CONTENT: 1
# RECORD_REPLAY: 1
# RECORD_REPLAY_TEST_METRICS: 1
# RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
# - uses: replayio/action-upload@v0.4.5
# if: always()
# with:
# api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
# public: true
# filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

- name: Upload test trace
if: always()
Expand Down Expand Up @@ -375,26 +374,25 @@ jobs:
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

# - run: npx @replayio/playwright install chromium
# if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (dev)
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
NEXT_TEST_MODE: dev
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
# RECORD_ALL_CONTENT: 1
# RECORD_REPLAY: 1
# RECORD_REPLAY_TEST_METRICS: 1
# RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

# - uses: replayio/action-upload@v0.4.5
# if: always()
# with:
# api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
# public: true
# filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

- name: Upload test trace
if: always()
Expand Down Expand Up @@ -453,25 +451,24 @@ jobs:
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

# - run: npx @replayio/playwright install chromium
# if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type production --timings -g ${{ matrix.group }}/2
name: Run test/production
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testProd / Group ${{ matrix.group }} / Node ${{ matrix.node }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
# env:
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testProd / Group ${{ matrix.group }} / Node ${{ matrix.node }}
# RECORD_ALL_CONTENT: 1
# RECORD_REPLAY: 1
# RECORD_REPLAY_TEST_METRICS: 1
# RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
# - uses: replayio/action-upload@v0.4.5
# if: always()
# with:
# api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
# public: true
# filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

testProdE2E:
name: Test Production (E2E)
Expand Down Expand Up @@ -521,26 +518,25 @@ jobs:
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

# - run: npx @replayio/playwright install chromium
# if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (production)
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testProdE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
NEXT_TEST_MODE: start
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testProdE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
# RECORD_ALL_CONTENT: 1
# RECORD_REPLAY: 1
# RECORD_REPLAY_TEST_METRICS: 1
# RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

# - uses: replayio/action-upload@v0.4.5
# if: always()
# with:
# api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
# public: true
# filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

testIntegration:
name: Test Integration
Expand Down Expand Up @@ -611,24 +607,23 @@ jobs:
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

# - run: npx @replayio/playwright install chromium
# if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/20
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testIntegration / Group ${{ matrix.group }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
# env:
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testIntegration / Group ${{ matrix.group }}
# RECORD_ALL_CONTENT: 1
# RECORD_REPLAY: 1
# RECORD_REPLAY_TEST_METRICS: 1
# RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}

# - uses: replayio/action-upload@v0.4.5
# if: always()
# with:
# api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
# public: true
# filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

- name: Upload test trace
if: always()
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/next/script.md
Expand Up @@ -37,7 +37,7 @@ Here's a summary of the props available for the Script Component:
| Prop | Example | Values | Required |
| ----------------------- | --------------------------------- | -------- | ------------------------------------- |
| [`src`](#src) | `src="http://example.com/script"` | String | Required unless inline script is used |
| [`strategy`](#strategy) | `strategy="lazyOnload` | String | Optional |
| [`strategy`](#strategy) | `strategy="lazyOnload"` | String | Optional |
| [`onLoad`](#onload) | `onLoad={onLoadFunc}` | Function | Optional |
| [`onReady`](#onReady) | `onReady={onReadyFunc}` | Function | Optional |
| [`onError`](#onerror) | `onError={onErrorFunc}` | Function | Optional |
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/next/server.md
Expand Up @@ -56,7 +56,7 @@ The `waitUntil()` method can be used to prolong the execution of the function if
import { NextResponse } from 'next/server'
import type { NextFetchEvent, NextRequest } from 'next/server'

export async function middleware(req: NextRequest, event: NextFetchEvent) {
export function middleware(req: NextRequest, event: NextFetchEvent) {
event.waitUntil(
fetch('https://my-analytics-platform.com', {
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-features/static-file-serving.md
Expand Up @@ -22,7 +22,7 @@ export default Avatar
This folder is also useful for `robots.txt`, `favicon.ico`, Google Site Verification, and any other static files (including `.html`)!

> **Note**: Don't name the `public` directory anything else. The name cannot be changed and is the only directory used to serve static assets.
> **Note**: Be sure the directory is named `public`. The name cannot be changed and is the only directory used to serve static assets.
> **Note**: Be sure to not have a static file with the same name as a file in the `pages/` directory, as this will result in an error.
>
Expand Down
1 change: 1 addition & 0 deletions errors/node-module-in-edge-runtime.md
Expand Up @@ -16,3 +16,4 @@ For example, you might replace the Node.js `crypto` module with the [Web Crypto

- [Edge Runtime Supported APIs](https://nextjs.org/docs/api-reference/edge-runtime)
- [Next.js Middleware](https://nextjs.org/docs/advanced-features/middleware)
- [JWT Example](https://github.com/vercel/examples/tree/main/edge-functions/jwt-authentication)
2 changes: 1 addition & 1 deletion examples/with-msw/package.json
Expand Up @@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
"msw": "0.47.3",
"msw": "^0.49.0",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
6 changes: 3 additions & 3 deletions examples/with-passport/package.json
Expand Up @@ -10,11 +10,11 @@
"cookie": "0.4.1",
"next": "latest",
"next-connect": "0.8.1",
"passport": "0.4.1",
"passport-local": "1.0.0",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^0.5.5",
"swr": "^1.3.0",
"uuid": "8.3.1"
}
}
2 changes: 1 addition & 1 deletion examples/with-redux-wrapper/package.json
Expand Up @@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
"next": "9.4.1",
"next": "latest",
"next-redux-wrapper": "^7.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/with-styled-components-babel/pages/_app.tsx
@@ -1,3 +1,4 @@
import type { AppProps } from 'next/app'
import { createGlobalStyle, ThemeProvider } from 'styled-components'

const GlobalStyle = createGlobalStyle`
Expand All @@ -20,7 +21,7 @@ const theme: ThemeInterface = {
},
}

export default function App({ Component, pageProps }) {
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<GlobalStyle />
Expand Down
11 changes: 6 additions & 5 deletions examples/with-supertokens/pages/index.tsx
Expand Up @@ -16,19 +16,20 @@ export async function getServerSideProps(context) {
supertokensNode.init(backendConfig())
let session
try {
session = await Session.getSession(context.req, context.res)
session = await Session.getSession(context.req, context.res, {
overrideGlobalClaimValidators: async function () {
return []
},
})
} catch (err) {
if (err.type === Session.Error.TRY_REFRESH_TOKEN) {
return { props: { fromSupertokens: 'needs-refresh' } }
} else if (err.type === Session.Error.UNAUTHORISED) {
// this will force the frontend to try and refresh which will fail
// clearing all cookies and redirecting the user to the login screen.
return { props: { fromSupertokens: 'needs-refresh' } }
} else if (err.type === Session.Error.INVALID_CLAIMS) {
return { props: {} }
} else {
throw err
}
throw err
}

return {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.0.5-canary.3"
"version": "13.0.5-canary.4"
}
4 changes: 3 additions & 1 deletion packages/create-next-app/helpers/examples.ts
Expand Up @@ -102,7 +102,9 @@ export async function downloadAndExtractRepo(
strip: filePath ? filePath.split('/').length + 1 : 1,
filter: (p) =>
p.startsWith(
`${name}-${branch.replace(/\//g, '-')}${filePath ? `/${filePath}` : ''}`
`${name}-${branch.replace(/\//g, '-')}${
filePath ? `/${filePath}/` : '/'
}`
),
})

Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.0.5-canary.3",
"version": "13.0.5-canary.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": "13.0.5-canary.3",
"version": "13.0.5-canary.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": "13.0.5-canary.3",
"@next/eslint-plugin-next": "13.0.5-canary.4",
"@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
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.0.5-canary.3",
"version": "13.0.5-canary.4",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.0.5-canary.3",
"version": "13.0.5-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.0.5-canary.3",
"version": "13.0.5-canary.4",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.0.5-canary.3",
"version": "13.0.5-canary.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": "13.0.5-canary.3",
"version": "13.0.5-canary.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": "13.0.5-canary.3",
"version": "13.0.5-canary.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 712def4

Please sign in to comment.