Skip to content

Commit

Permalink
Merge branch 'canary' into update/fonts-data-1701216604906
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens authored Nov 29, 2023
2 parents ac890ef + 809164d commit 380b9c7
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 78 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,10 @@ jobs:
fail-fast: false
matrix:
group: [1, 2, 3]

uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --type development

secrets: inherit

test-prod:
Expand All @@ -198,7 +196,6 @@ jobs:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]

uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
Expand All @@ -212,7 +209,6 @@ jobs:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.17.0
Expand All @@ -230,13 +226,58 @@ jobs:
afterBuild: pnpm playwright install && BROWSER_NAME=firefox node run-tests.js test/production/pages-dir/production/test/index.test.ts && BROWSER_NAME=safari NEXT_TEST_MODE=start node run-tests.js -c 1 test/production/pages-dir/production/test/index.test.ts test/e2e/basepath.test.ts && BROWSER_NAME=safari DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts
secrets: inherit

# TODO: remove these jobs once PPR is the default
# Manifest generated via: https://gist.github.com/wyattjoh/2ceaebd82a5bcff4819600fd60126431
test-ppr-integration:
name: test ppr integration
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.17.0
skipForDocsOnly: 'yes'
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --type integration
secrets: inherit

test-ppr-dev:
name: test ppr dev
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --type development
secrets: inherit

test-ppr-prod:
name: test ppr prod
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --type production
secrets: inherit

report-test-results:
needs:
[
'test-unit',
'test-dev',
'test-prod',
'test-integration',
'test-ppr-dev',
'test-ppr-prod',
'test-ppr-integration',
'test-turbopack-dev',
'test-turbopack-integration',
]
Expand Down Expand Up @@ -275,6 +316,9 @@ jobs:
'test-dev',
'test-prod',
'test-integration',
'test-ppr-dev',
'test-ppr-prod',
'test-ppr-integration',
'test-cargo-unit',
'test-cargo-integration',
'test-cargo-bench',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
"webpack": "5.86.0",
"webpack-bundle-analyzer": "4.7.0",
"whatwg-fetch": "3.0.0",
"ws": "8.2.3"
"ws": "8.2.3",
"yargs": "16.2.0"
},
"resolutions": {
"webpack": "5.86.0",
Expand Down
26 changes: 15 additions & 11 deletions packages/next/src/bin/next.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
performance.mark('next-start')

import '../server/require-hook'
import * as log from '../build/output/log'
import arg from 'next/dist/compiled/arg/index.js'
Expand All @@ -9,7 +9,6 @@ import { commands } from '../lib/commands'
import { commandArgs } from '../lib/command-args'
import { getValidatedArgs } from '../lib/get-validated-args'

const defaultCommand = 'dev'
const args = arg(
{
// Types
Expand Down Expand Up @@ -56,6 +55,20 @@ if (!foundCommand && args['--help']) {
process.exit(0)
}

// Check supported Node.js version first
if (
semver.lt(process.versions.node, process.env.__NEXT_REQUIRED_NODE_VERSION!)
) {
console.error(
`You are using Node.js ${process.versions.node}. For Next.js, Node.js version >= v${process.env.__NEXT_REQUIRED_NODE_VERSION} is required.`
)
process.exit(1)
}

// Start performance profiling after Node.js version is checked
performance.mark('next-start')

const defaultCommand = 'dev'
const command = foundCommand ? args._[0] : defaultCommand

if (['experimental-compile', 'experimental-generate'].includes(command)) {
Expand Down Expand Up @@ -116,15 +129,6 @@ async function main() {
}
}

if (
semver.lt(process.versions.node, process.env.__NEXT_REQUIRED_NODE_VERSION!)
) {
console.error(
`You are using Node.js ${process.versions.node}. For Next.js, Node.js version >= v${process.env.__NEXT_REQUIRED_NODE_VERSION} is required.`
)
process.exit(1)
}

await commands[command]()
.then((exec) => exec(validatedArgs))
.then(() => {
Expand Down
10 changes: 9 additions & 1 deletion packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,15 @@ export const defaultConfig: NextConfig = {
typedRoutes: false,
instrumentationHook: false,
bundlePagesExternals: false,
ppr: false,
ppr:
// TODO: remove once we've made PPR default
// If we're testing, and the `__NEXT_EXPERIMENTAL_PPR` environment variable
// has been set to `true`, enable the experimental PPR feature so long as it
// wasn't explicitly disabled in the config.
process.env.__NEXT_TEST_MODE &&
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
? true
: false,
},
}

Expand Down
9 changes: 9 additions & 0 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ function assignDefaults(
{}
)

// TODO: remove once we've made PPR default
// If this was defaulted to true, it implies that the configuration was
// overridden for testing to be defaulted on.
if (defaultConfig.experimental?.ppr) {
Log.warn(
`\`experimental.ppr\` has been defaulted to \`true\` because \`__NEXT_EXPERIMENTAL_PPR\` was set to \`true\` during testing.`
)
}

const result = { ...defaultConfig, ...config }

if (
Expand Down
4 changes: 1 addition & 3 deletions packages/next/src/server/lib/incremental-cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ export class IncrementalCache implements IncrementalCacheType {
}

revalidate = revalidate || cacheData.value.revalidate
const age = Math.round(
(Date.now() - (cacheData.lastModified || 0)) / 1000
)
const age = (Date.now() - (cacheData.lastModified || 0)) / 1000

const isStale = age > revalidate
const data = cacheData.value.data
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

Loading

0 comments on commit 380b9c7

Please # to comment.