mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
30 Commits
@vercel/fu
...
@vercel/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eb76a3ae7 | ||
|
|
ccd7eb1fb7 | ||
|
|
41c44d6594 | ||
|
|
446ac49e2b | ||
|
|
d3c1267e24 | ||
|
|
b09d7b6130 | ||
|
|
f78b315a50 | ||
|
|
ad69454352 | ||
|
|
14059906d3 | ||
|
|
1682ad43d0 | ||
|
|
423630a168 | ||
|
|
2f7a6ed5f9 | ||
|
|
67afc26085 | ||
|
|
c224fb1d2e | ||
|
|
5014b1e82a | ||
|
|
6a8a84907b | ||
|
|
722adf0e10 | ||
|
|
bc5fd41158 | ||
|
|
e87d4c14d0 | ||
|
|
bc95d764b4 | ||
|
|
1b5ce5644f | ||
|
|
18d1703d5b | ||
|
|
5c6f9c0b66 | ||
|
|
809740b385 | ||
|
|
bf9acd023d | ||
|
|
f4ba9cdcf8 | ||
|
|
11584b0e9b | ||
|
|
3023122d4e | ||
|
|
0e774b6be0 | ||
|
|
119f80e961 |
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@@ -5,13 +5,13 @@
|
||||
* @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads
|
||||
/.github/workflows @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @ijjk
|
||||
/packages/fs-detectors @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @agadzik @chloetedder
|
||||
/packages/next @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @timneutkens @ijjk @ztanner @huozhi @Ethan-Arrowood @styfle
|
||||
/packages/next @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @timneutkens @ijjk @ztanner @huozhi @Ethan-Arrowood
|
||||
/packages/routing-utils @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @ijjk
|
||||
/packages/static-build @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads
|
||||
/packages/edge @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @vercel/compute
|
||||
/examples @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @leerob
|
||||
/examples/create-react-app @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @Timer
|
||||
/examples/nextjs @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @timneutkens @ijjk @ztanner @huozhi @Ethan-Arrowood @styfle
|
||||
/examples/nextjs @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @timneutkens @ijjk @ztanner @huozhi @Ethan-Arrowood
|
||||
/packages/node @TooTallNate @EndangeredMassa @trek @onsclom @jeffsee55 @erikareads @Kikobeats
|
||||
|
||||
# Unrestricted Paths
|
||||
|
||||
124
.github/workflows/test-18.yml
vendored
Normal file
124
.github/workflows/test-18.yml
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
name: Tests Node.js v18
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
NODE_VERSION: '18'
|
||||
TURBO_REMOTE_ONLY: 'true'
|
||||
TURBO_TEAM: 'vercel'
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
name: Find Changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tests: ${{ steps['set-tests'].outputs['tests'] }}
|
||||
dplUrl: ${{ steps.waitForTarball.outputs.url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- name: install pnpm@8.3.1
|
||||
run: npm i -g pnpm@8.3.1
|
||||
- run: pnpm install
|
||||
- id: set-tests
|
||||
run: |
|
||||
TESTS_ARRAY=$(node utils/chunk-tests-18.js $SCRIPT_NAME)
|
||||
echo "Files to test:"
|
||||
echo "$TESTS_ARRAY"
|
||||
echo "tests=$TESTS_ARRAY" >> $GITHUB_OUTPUT
|
||||
- uses: patrickedqvist/wait-for-vercel-preview@bfdff514ff78a669f2536e9f4dd4ef5813a704a2
|
||||
id: waitForTarball
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
max_timeout: 360
|
||||
check_interval: 5
|
||||
test:
|
||||
timeout-minutes: 120
|
||||
runs-on: ${{ matrix.runner }}
|
||||
name: ${{matrix.scriptName}} (${{matrix.packageName}}, ${{matrix.chunkNumber}}, ${{ matrix.runner }})
|
||||
if: ${{ needs.setup.outputs['tests'] != '[]' }}
|
||||
needs:
|
||||
- setup
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJson(needs.setup.outputs['tests']) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.nodeVersion || env.NODE_VERSION }}
|
||||
|
||||
# yarn 1.22.21 introduced a Corepack bug when running tests.
|
||||
# this can be removed once https://github.com/yarnpkg/yarn/issues/9015 is resolved
|
||||
- name: install yarn@1.22.19
|
||||
run: npm i -g yarn@1.22.19
|
||||
|
||||
- name: install pnpm@8.3.1
|
||||
run: npm i -g pnpm@8.3.1
|
||||
|
||||
- run: pnpm install
|
||||
|
||||
- name: Build ${{matrix.packageName}} and all its dependencies
|
||||
run: node utils/gen.js && node_modules/.bin/turbo run build --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --include-dependencies --no-deps
|
||||
env:
|
||||
FORCE_COLOR: '1'
|
||||
- name: Test ${{matrix.packageName}}
|
||||
run: node utils/gen.js && node_modules/.bin/turbo run ${{matrix.testScript}} --summarize --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
|
||||
shell: bash
|
||||
env:
|
||||
JEST_JUNIT_OUTPUT_FILE: ${{github.workspace}}/.junit-reports/${{matrix.scriptName}}-${{matrix.packageName}}-${{matrix.chunkNumber}}-${{ matrix.runner }}.xml
|
||||
VERCEL_CLI_VERSION: ${{ needs.setup.outputs.dplUrl }}/tarballs/vercel.tgz
|
||||
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
|
||||
VERCEL_TEST_REGISTRATION_URL: ${{ secrets.VERCEL_TEST_REGISTRATION_URL }}
|
||||
FORCE_COLOR: '1'
|
||||
- name: 'Determine Turbo HIT or MISS'
|
||||
if: ${{ !cancelled() }}
|
||||
id: turbo-summary
|
||||
shell: bash
|
||||
run: |
|
||||
TURBO_MISS_COUNT=`node utils/determine-turbo-hit-or-miss.js`
|
||||
echo "MISS COUNT: $TURBO_MISS_COUNT"
|
||||
echo "misses=$TURBO_MISS_COUNT" >> $GITHUB_OUTPUT
|
||||
- name: 'Upload Test Report to Datadog'
|
||||
if: ${{ steps['turbo-summary'].outputs.misses != '0' && !cancelled() }}
|
||||
run: 'npx @datadog/datadog-ci@2.18.1 junit upload --service vercel-cli .junit-reports'
|
||||
env:
|
||||
DATADOG_API_KEY: ${{secrets.DATADOG_API_KEY_CLI}}
|
||||
DD_ENV: ci
|
||||
|
||||
summary:
|
||||
name: Summary
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
if: always()
|
||||
needs:
|
||||
- test
|
||||
steps:
|
||||
- name: Check All
|
||||
run: |-
|
||||
for status in ${{ join(needs.*.result, ' ') }}
|
||||
do
|
||||
if [ "$status" != "success" ] && [ "$status" != "skipped" ]
|
||||
then
|
||||
echo "Some checks failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Tests
|
||||
name: Tests Node.js v16
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
2
examples/package.json
vendored
2
examples/package.json
vendored
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "27.4.1",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/frameworks": "3.0.2"
|
||||
},
|
||||
"version": null
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@remix-run/node": "^2.8.0",
|
||||
"@remix-run/react": "^2.8.0",
|
||||
"@remix-run/server-runtime": "^2.8.0",
|
||||
"@remix-run/node": "^2.9.2",
|
||||
"@remix-run/react": "^2.9.2",
|
||||
"@remix-run/server-runtime": "^2.9.2",
|
||||
"@vercel/analytics": "^1.2.2",
|
||||
"@vercel/remix": "^2.8.0",
|
||||
"@vercel/remix": "2.9.2-patch.2",
|
||||
"isbot": "^4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@remix-run/dev": "^2.8.0",
|
||||
"@remix-run/eslint-config": "^2.8.0",
|
||||
"@remix-run/dev": "^2.9.2",
|
||||
"@remix-run/eslint-config": "^2.9.2",
|
||||
"@types/react": "^18.2.20",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"eslint": "^8.38.0",
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
# @vercel-internals/types
|
||||
|
||||
## 1.0.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d3c1267e2`](https://github.com/vercel/vercel/commit/d3c1267e24082789ea6382cf6af81dd40df288ff), [`ccd7eb1fb`](https://github.com/vercel/vercel/commit/ccd7eb1fb78f7ac9effdbe1935de3bda82c97fe3)]:
|
||||
- @vercel/build-utils@8.2.0
|
||||
|
||||
## 1.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ad6945435`](https://github.com/vercel/vercel/commit/ad69454352b519b2b0ed326f245c779530554bf2)]:
|
||||
- @vercel/build-utils@8.1.3
|
||||
|
||||
## 1.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1682ad43d`](https://github.com/vercel/vercel/commit/1682ad43d0064b22b1248a7e946746b838f00076)]:
|
||||
- @vercel/build-utils@8.1.2
|
||||
|
||||
## 1.0.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2f7a6ed5f`](https://github.com/vercel/vercel/commit/2f7a6ed5f92d454000f92247d3b6548e2064f4e6)]:
|
||||
- @vercel/build-utils@8.1.1
|
||||
|
||||
## 1.0.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`5014b1e82`](https://github.com/vercel/vercel/commit/5014b1e82a46181baeb727ffe6d14000b6a4b1d7)]:
|
||||
- @vercel/build-utils@8.1.0
|
||||
|
||||
## 1.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@vercel-internals/types",
|
||||
"version": "1.0.31",
|
||||
"version": "1.0.36",
|
||||
"types": "index.d.ts",
|
||||
"main": "index.d.ts",
|
||||
"files": [
|
||||
@@ -10,7 +10,7 @@
|
||||
"dependencies": {
|
||||
"@types/node": "14.14.31",
|
||||
"@vercel-internals/constants": "1.0.4",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/routing-utils": "3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
# @vercel/build-utils
|
||||
|
||||
## 8.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- fix corepack detection for package manager version determination ([#11596](https://github.com/vercel/vercel/pull/11596))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix triggering of ignored project settings node version warning ([#11550](https://github.com/vercel/vercel/pull/11550))
|
||||
|
||||
## 8.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [build-utils] log more around package manager detection ([#11594](https://github.com/vercel/vercel/pull/11594))
|
||||
|
||||
## 8.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- add log to package manager version detection ([#11592](https://github.com/vercel/vercel/pull/11592))
|
||||
|
||||
## 8.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [build-utils] pnpm lockfile testing and fixing ([#11591](https://github.com/vercel/vercel/pull/11591))
|
||||
|
||||
## 8.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Update pnpm version detection logic ([#11445](https://github.com/vercel/vercel/pull/11445))
|
||||
Add support for pnpm 9
|
||||
|
||||
## 8.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/build-utils",
|
||||
"version": "8.0.0",
|
||||
"version": "8.2.0",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
|
||||
@@ -240,38 +240,51 @@ export function getSpawnOptions(
|
||||
|
||||
export async function getNodeVersion(
|
||||
destPath: string,
|
||||
nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION,
|
||||
fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION,
|
||||
config: Config = {},
|
||||
meta: Meta = {},
|
||||
availableVersions = getAvailableNodeVersions()
|
||||
): Promise<NodeVersion> {
|
||||
const latest = getLatestNodeVersion(availableVersions);
|
||||
const latestVersion = getLatestNodeVersion(availableVersions);
|
||||
if (meta.isDev) {
|
||||
// Use the system-installed version of `node` in PATH for `vercel dev`
|
||||
return { ...latest, runtime: 'nodejs' };
|
||||
return { ...latestVersion, runtime: 'nodejs' };
|
||||
}
|
||||
const { packageJson } = await scanParentDirs(destPath, true);
|
||||
let nodeVersion = config.nodeVersion || nodeVersionFallback;
|
||||
let isAuto = true;
|
||||
const configuredVersion = config.nodeVersion || fallbackVersion;
|
||||
|
||||
const packageJsonVersion = packageJson?.engines?.node;
|
||||
const supportedNodeVersion = await getSupportedNodeVersion(
|
||||
packageJsonVersion || configuredVersion,
|
||||
!packageJsonVersion,
|
||||
availableVersions
|
||||
);
|
||||
|
||||
if (packageJson?.engines?.node) {
|
||||
const { node } = packageJson.engines;
|
||||
if (nodeVersion && validRange(node) && !intersects(nodeVersion, node)) {
|
||||
if (
|
||||
configuredVersion &&
|
||||
!intersects(configuredVersion, supportedNodeVersion.range)
|
||||
) {
|
||||
console.warn(
|
||||
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`
|
||||
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply. Learn More: http://vercel.link/node-version`
|
||||
);
|
||||
} else if (coerce(node)?.raw === node) {
|
||||
}
|
||||
|
||||
if (coerce(node)?.raw === node) {
|
||||
console.warn(
|
||||
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`
|
||||
);
|
||||
} else if (validRange(node) && intersects(`${latest.major + 1}.x`, node)) {
|
||||
} else if (
|
||||
validRange(node) &&
|
||||
intersects(`${latestVersion.major + 1}.x`, node)
|
||||
) {
|
||||
console.warn(
|
||||
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`
|
||||
);
|
||||
}
|
||||
nodeVersion = node;
|
||||
isAuto = false;
|
||||
}
|
||||
return getSupportedNodeVersion(nodeVersion, isAuto, availableVersions);
|
||||
return supportedNodeVersion;
|
||||
}
|
||||
|
||||
export async function scanParentDirs(
|
||||
@@ -413,9 +426,8 @@ export async function runNpmInstall(
|
||||
|
||||
try {
|
||||
await runNpmInstallSema.acquire();
|
||||
const { cliType, packageJsonPath, lockfileVersion } = await scanParentDirs(
|
||||
destPath
|
||||
);
|
||||
const { cliType, packageJsonPath, packageJson, lockfileVersion } =
|
||||
await scanParentDirs(destPath, true);
|
||||
|
||||
if (!packageJsonPath) {
|
||||
debug(
|
||||
@@ -450,6 +462,7 @@ export async function runNpmInstall(
|
||||
opts.env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env,
|
||||
});
|
||||
@@ -534,64 +547,217 @@ export async function runNpmInstall(
|
||||
export function getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager,
|
||||
nodeVersion,
|
||||
env,
|
||||
}: {
|
||||
cliType: CliType;
|
||||
lockfileVersion: number | undefined;
|
||||
packageJsonPackageManager?: string | undefined;
|
||||
nodeVersion: NodeVersion | undefined;
|
||||
env: { [x: string]: string | undefined };
|
||||
}) {
|
||||
const corepackFlagged = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
||||
const corepackEnabled = corepackFlagged && Boolean(packageJsonPackageManager);
|
||||
|
||||
const {
|
||||
detectedLockfile,
|
||||
detectedPackageManager,
|
||||
path: newPath,
|
||||
yarnNodeLinker,
|
||||
} = getPathForPackageManager({
|
||||
} = getPathOverrideForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
corepackEnabled,
|
||||
nodeVersion,
|
||||
env,
|
||||
});
|
||||
|
||||
if (corepackEnabled) {
|
||||
debug(
|
||||
`Detected corepack use for "${packageJsonPackageManager}". Not overriding package manager version.`
|
||||
);
|
||||
} else {
|
||||
debug(
|
||||
`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`
|
||||
);
|
||||
}
|
||||
|
||||
const newEnv: { [x: string]: string | undefined } = {
|
||||
...env,
|
||||
};
|
||||
|
||||
if (newPath) {
|
||||
const alreadyInPath = (newPath: string) => {
|
||||
const oldPath = env.PATH ?? '';
|
||||
return oldPath.split(path.delimiter).includes(newPath);
|
||||
};
|
||||
|
||||
if (newPath && !alreadyInPath(newPath)) {
|
||||
// Ensure that the binaries of the detected package manager are at the
|
||||
// beginning of the `$PATH`.
|
||||
const oldPath = env.PATH + '';
|
||||
newEnv.PATH = `${newPath}${path.delimiter}${oldPath}`;
|
||||
}
|
||||
|
||||
if (yarnNodeLinker) {
|
||||
newEnv.YARN_NODE_LINKER = yarnNodeLinker;
|
||||
}
|
||||
if (detectedLockfile && detectedPackageManager) {
|
||||
// For pnpm we also show the version of the lockfile we found
|
||||
const versionString =
|
||||
cliType === 'pnpm' ? `version ${lockfileVersion} ` : '';
|
||||
|
||||
if (detectedLockfile && detectedPackageManager) {
|
||||
// For pnpm we also show the version of the lockfile we found
|
||||
const versionString =
|
||||
cliType === 'pnpm' ? `version ${lockfileVersion} ` : '';
|
||||
|
||||
console.log(
|
||||
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
|
||||
);
|
||||
|
||||
if (cliType === 'bun') {
|
||||
console.warn(
|
||||
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
|
||||
console.log(
|
||||
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
|
||||
);
|
||||
|
||||
if (cliType === 'bun') {
|
||||
console.warn(
|
||||
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cliType === 'yarn' && !env.YARN_NODE_LINKER) {
|
||||
newEnv.YARN_NODE_LINKER = 'node-modules';
|
||||
}
|
||||
|
||||
return newEnv;
|
||||
}
|
||||
|
||||
type DetectedPnpmVersion =
|
||||
| 'not found'
|
||||
| 'pnpm 6'
|
||||
| 'pnpm 7'
|
||||
| 'pnpm 8'
|
||||
| 'pnpm 9'
|
||||
| 'corepack_enabled';
|
||||
|
||||
function detectPnpmVersion(
|
||||
lockfileVersion: number | undefined,
|
||||
corepackEnabled: boolean
|
||||
): DetectedPnpmVersion {
|
||||
switch (true) {
|
||||
case corepackEnabled:
|
||||
return 'corepack_enabled';
|
||||
case lockfileVersion === undefined:
|
||||
return 'not found';
|
||||
case lockfileVersion === 5.3:
|
||||
return 'pnpm 6';
|
||||
case lockfileVersion === 5.4:
|
||||
return 'pnpm 7';
|
||||
case lockfileVersion === 6.0 || lockfileVersion === 6.1:
|
||||
return 'pnpm 8';
|
||||
case lockfileVersion === 7.0 || lockfileVersion === 9.0:
|
||||
return 'pnpm 9';
|
||||
default:
|
||||
return 'not found';
|
||||
}
|
||||
}
|
||||
|
||||
function shouldUseNpm7(
|
||||
lockfileVersion: number | undefined,
|
||||
nodeVersion: NodeVersion | undefined
|
||||
): boolean {
|
||||
if (lockfileVersion === undefined) return false;
|
||||
return lockfileVersion >= 2 && (nodeVersion?.major || 0) < 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the binary paths that link to the used package manager.
|
||||
* Note: Make sure it doesn't contain any `console.log` calls.
|
||||
*/
|
||||
export function getPathOverrideForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
corepackEnabled,
|
||||
nodeVersion,
|
||||
}: {
|
||||
cliType: CliType;
|
||||
lockfileVersion: number | undefined;
|
||||
corepackEnabled: boolean;
|
||||
nodeVersion: NodeVersion | undefined;
|
||||
}): {
|
||||
/**
|
||||
* Which lockfile was detected.
|
||||
*/
|
||||
detectedLockfile: string | undefined;
|
||||
/**
|
||||
* Detected package manager that generated the found lockfile.
|
||||
*/
|
||||
detectedPackageManager: string | undefined;
|
||||
/**
|
||||
* Value of $PATH that includes the binaries for the detected package manager.
|
||||
* Undefined if no $PATH are necessary.
|
||||
*/
|
||||
path: string | undefined;
|
||||
} {
|
||||
const no_override = {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
};
|
||||
|
||||
switch (cliType) {
|
||||
case 'npm':
|
||||
switch (true) {
|
||||
case corepackEnabled:
|
||||
return no_override;
|
||||
case shouldUseNpm7(lockfileVersion, nodeVersion):
|
||||
return {
|
||||
path: '/node16/bin-npm7',
|
||||
detectedLockfile: 'package-lock.json',
|
||||
detectedPackageManager: 'npm 7+',
|
||||
};
|
||||
default:
|
||||
return no_override;
|
||||
}
|
||||
case 'pnpm':
|
||||
switch (detectPnpmVersion(lockfileVersion, corepackEnabled)) {
|
||||
case 'corepack_enabled':
|
||||
return no_override;
|
||||
case 'pnpm 7':
|
||||
// pnpm 7
|
||||
return {
|
||||
path: '/pnpm7/node_modules/.bin',
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 7',
|
||||
};
|
||||
case 'pnpm 8':
|
||||
// pnpm 8
|
||||
return {
|
||||
path: '/pnpm8/node_modules/.bin',
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 8',
|
||||
};
|
||||
case 'pnpm 9':
|
||||
// pnpm 9
|
||||
return {
|
||||
path: '/pnpm9/node_modules/.bin',
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 9',
|
||||
};
|
||||
case 'pnpm 6':
|
||||
default:
|
||||
return no_override;
|
||||
}
|
||||
case 'bun':
|
||||
switch (true) {
|
||||
case corepackEnabled:
|
||||
return no_override;
|
||||
default:
|
||||
// Bun 1
|
||||
return {
|
||||
path: '/bun1',
|
||||
detectedLockfile: 'bun.lockb',
|
||||
detectedPackageManager: 'Bun',
|
||||
};
|
||||
}
|
||||
case 'yarn':
|
||||
return no_override;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the binary paths that link to the used package manager.
|
||||
* Note: Make sure it doesn't contain any `console.log` calls.
|
||||
* @deprecated use `getEnvForPackageManager` instead
|
||||
*/
|
||||
export function getPathForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
@@ -622,70 +788,36 @@ export function getPathForPackageManager({
|
||||
*/
|
||||
yarnNodeLinker: string | undefined;
|
||||
} {
|
||||
let detectedLockfile: string | undefined;
|
||||
let detectedPackageManager: string | undefined;
|
||||
let pathValue: string | undefined;
|
||||
let yarnNodeLinker: string | undefined;
|
||||
const oldPath = env.PATH + '';
|
||||
const npm7 = '/node16/bin-npm7';
|
||||
const pnpm7 = '/pnpm7/node_modules/.bin';
|
||||
const pnpm8 = '/pnpm8/node_modules/.bin';
|
||||
const bun1 = '/bun1';
|
||||
// This is not the correct check for whether or not corepack is being used. For that, you'd have to check
|
||||
// the package.json's `packageManager` property. However, this deprecated function is keeping it's old,
|
||||
// broken behavior.
|
||||
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
||||
if (cliType === 'npm') {
|
||||
if (
|
||||
typeof lockfileVersion === 'number' &&
|
||||
lockfileVersion >= 2 &&
|
||||
(nodeVersion?.major || 0) < 16 &&
|
||||
!oldPath.includes(npm7) &&
|
||||
!corepackEnabled
|
||||
) {
|
||||
// npm 7
|
||||
pathValue = npm7;
|
||||
detectedLockfile = 'package-lock.json';
|
||||
detectedPackageManager = 'npm 7+';
|
||||
}
|
||||
} else if (cliType === 'pnpm') {
|
||||
if (
|
||||
typeof lockfileVersion === 'number' &&
|
||||
lockfileVersion === 5.4 &&
|
||||
!oldPath.includes(pnpm7) &&
|
||||
!corepackEnabled
|
||||
) {
|
||||
// pnpm 7
|
||||
pathValue = pnpm7;
|
||||
detectedLockfile = 'pnpm-lock.yaml';
|
||||
detectedPackageManager = 'pnpm 7';
|
||||
} else if (
|
||||
typeof lockfileVersion === 'number' &&
|
||||
lockfileVersion >= 6 &&
|
||||
!oldPath.includes(pnpm8) &&
|
||||
!corepackEnabled
|
||||
) {
|
||||
// pnpm 8
|
||||
pathValue = pnpm8;
|
||||
detectedLockfile = 'pnpm-lock.yaml';
|
||||
detectedPackageManager = 'pnpm 8';
|
||||
}
|
||||
} else if (cliType === 'bun') {
|
||||
if (!oldPath.includes(bun1) && !corepackEnabled) {
|
||||
// Bun 1
|
||||
pathValue = bun1;
|
||||
detectedLockfile = 'bun.lockb';
|
||||
detectedPackageManager = 'Bun';
|
||||
}
|
||||
} else {
|
||||
// Yarn v2 PnP mode may be activated, so force "node-modules" linker style
|
||||
if (!env.YARN_NODE_LINKER) {
|
||||
yarnNodeLinker = 'node-modules';
|
||||
}
|
||||
}
|
||||
return {
|
||||
detectedLockfile,
|
||||
detectedPackageManager,
|
||||
path: pathValue,
|
||||
yarnNodeLinker,
|
||||
|
||||
const overrides = getPathOverrideForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
corepackEnabled,
|
||||
nodeVersion,
|
||||
});
|
||||
|
||||
const alreadyInPath = (newPath: string) => {
|
||||
const oldPath = env.PATH ?? '';
|
||||
return oldPath.split(path.delimiter).includes(newPath);
|
||||
};
|
||||
|
||||
switch (true) {
|
||||
case cliType === 'yarn' && !env.YARN_NODE_LINKER:
|
||||
return { ...overrides, yarnNodeLinker: 'node-modules' };
|
||||
case alreadyInPath(overrides.path ?? ''):
|
||||
return {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
yarnNodeLinker: undefined,
|
||||
};
|
||||
default:
|
||||
return { ...overrides, yarnNodeLinker: undefined };
|
||||
}
|
||||
}
|
||||
|
||||
export async function runCustomInstallCommand({
|
||||
@@ -700,10 +832,14 @@ export async function runCustomInstallCommand({
|
||||
spawnOpts?: SpawnOptions;
|
||||
}) {
|
||||
console.log(`Running "install" command: \`${installCommand}\`...`);
|
||||
const { cliType, lockfileVersion } = await scanParentDirs(destPath);
|
||||
const { cliType, lockfileVersion, packageJson } = await scanParentDirs(
|
||||
destPath,
|
||||
true
|
||||
);
|
||||
const env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env: spawnOpts?.env || {},
|
||||
});
|
||||
@@ -741,6 +877,7 @@ export async function runPackageJsonScript(
|
||||
env: getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion: undefined,
|
||||
env: cloneEnv(process.env, spawnOpts?.env),
|
||||
}),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "pnpm version: 6",
|
||||
"mustContain": "pnpm version: 7",
|
||||
"logMustContain": "pnpm run build"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { delimiter } from 'path';
|
||||
import { getEnvForPackageManager, getPathForPackageManager } from '../src';
|
||||
import { getPathOverrideForPackageManager } from '../src/fs/run-user-scripts';
|
||||
|
||||
describe('Test `getEnvForPackageManager()`', () => {
|
||||
let consoleLogSpy: jest.SpyInstance;
|
||||
@@ -34,6 +35,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 1,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -50,6 +52,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -68,6 +71,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: 'pnpm@latest',
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -86,6 +90,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -104,6 +109,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -122,6 +128,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'yarn',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -139,6 +146,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'yarn',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -157,6 +165,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 5.4,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -171,11 +180,52 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
'Detected `pnpm-lock.yaml` version 5.4 generated by pnpm 7',
|
||||
consoleWarnOutput: null,
|
||||
},
|
||||
{
|
||||
name: 'should set path if pnpm 8 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 6.0,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
FOO: 'bar',
|
||||
PATH: `/pnpm8/node_modules/.bin${delimiter}foo`,
|
||||
},
|
||||
consoleLogOutput:
|
||||
'Detected `pnpm-lock.yaml` version 6 generated by pnpm 8',
|
||||
consoleWarnOutput: null,
|
||||
},
|
||||
{
|
||||
name: 'should set path if pnpm 8 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 9.0,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
FOO: 'bar',
|
||||
PATH: `/pnpm9/node_modules/.bin${delimiter}foo`,
|
||||
},
|
||||
consoleLogOutput:
|
||||
'Detected `pnpm-lock.yaml` version 9 generated by pnpm 9',
|
||||
consoleWarnOutput: null,
|
||||
},
|
||||
{
|
||||
name: 'should set path if bun v1 is detected',
|
||||
args: {
|
||||
cliType: 'bun',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 0,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -195,6 +245,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: 'npm@latest',
|
||||
lockfileVersion: 5.4,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -213,6 +264,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 5.4,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
@@ -226,27 +278,12 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
consoleLogOutput: null,
|
||||
consoleWarnOutput: null,
|
||||
},
|
||||
{
|
||||
name: 'should not set path if pnpm 6 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
lockfileVersion: 5.3,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
FOO: 'bar',
|
||||
},
|
||||
consoleLogOutput: null,
|
||||
consoleWarnOutput: null,
|
||||
},
|
||||
])('$name', ({ args, want, consoleLogOutput, consoleWarnOutput }) => {
|
||||
expect(
|
||||
getEnvForPackageManager({
|
||||
cliType: args.cliType,
|
||||
lockfileVersion: args.lockfileVersion,
|
||||
packageJsonPackageManager: args.packageJsonPackageManager,
|
||||
nodeVersion: args.nodeVersion,
|
||||
env: args.env,
|
||||
})
|
||||
@@ -268,11 +305,210 @@ describe('Test `getEnvForPackageManager()`', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test `getPathForPackageManager()`', () => {
|
||||
describe('Test `getPathOverrideForPackageManager()`', () => {
|
||||
test.each<{
|
||||
name: string;
|
||||
args: Parameters<typeof getEnvForPackageManager>[0];
|
||||
want: unknown;
|
||||
}>([
|
||||
{
|
||||
name: 'should do nothing to env for npm < 6 and node < 16',
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 1,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should set path if npm 7+ is detected and node < 16',
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: 'package-lock.json',
|
||||
detectedPackageManager: 'npm 7+',
|
||||
path: '/node16/bin-npm7',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should not set npm path if corepack enabled',
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
packageJsonPackageManager: 'pnpm@latest',
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
ENABLE_EXPERIMENTAL_COREPACK: '1',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: 'should not set path if node is 16 and npm 7+ is detected',
|
||||
args: {
|
||||
cliType: 'npm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 2,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should not set path if pnpm 6 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 5.3, // detects as pnpm@6, which is the default
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should set path if pnpm 7+ is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 5.4,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 7',
|
||||
path: '/pnpm7/node_modules/.bin',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should set path if pnpm 8 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 6.1,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 8',
|
||||
path: '/pnpm8/node_modules/.bin',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should set path if pnpm 9 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 7.0,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: 'foo',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: 'pnpm-lock.yaml',
|
||||
detectedPackageManager: 'pnpm 9',
|
||||
path: '/pnpm9/node_modules/.bin',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should set path if bun v1 is detected',
|
||||
args: {
|
||||
cliType: 'bun',
|
||||
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||
packageJsonPackageManager: undefined,
|
||||
lockfileVersion: 0,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
PATH: '/usr/local/bin',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: 'bun.lockb',
|
||||
detectedPackageManager: 'Bun',
|
||||
path: '/bun1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should not set pnpm path if corepack is enabled',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||
packageJsonPackageManager: 'npm@latest',
|
||||
lockfileVersion: 5.4,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
ENABLE_EXPERIMENTAL_COREPACK: '1',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
},
|
||||
},
|
||||
])('$name', ({ args, want }) => {
|
||||
expect(
|
||||
getPathOverrideForPackageManager({
|
||||
cliType: args.cliType,
|
||||
lockfileVersion: args.lockfileVersion,
|
||||
// naive assumption that enabling corepack as a feature means it's used, but this is fine for tests
|
||||
corepackEnabled: Boolean(args.env.ENABLE_EXPERIMENTAL_COREPACK),
|
||||
nodeVersion: args.nodeVersion,
|
||||
})
|
||||
).toStrictEqual(want);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test `getPathForPackageManager()`', () => {
|
||||
test.each<{
|
||||
name: string;
|
||||
args: Parameters<typeof getPathForPackageManager>[0];
|
||||
want: unknown;
|
||||
}>([
|
||||
{
|
||||
name: 'should do nothing to env for npm < 6 and node < 16',
|
||||
@@ -470,23 +706,6 @@ describe('Test `getPathForPackageManager()`', () => {
|
||||
yarnNodeLinker: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'should not set path if pnpm 6 is detected',
|
||||
args: {
|
||||
cliType: 'pnpm',
|
||||
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||
lockfileVersion: 5.3,
|
||||
env: {
|
||||
FOO: 'bar',
|
||||
},
|
||||
},
|
||||
want: {
|
||||
detectedLockfile: undefined,
|
||||
detectedPackageManager: undefined,
|
||||
path: undefined,
|
||||
yarnNodeLinker: undefined,
|
||||
},
|
||||
},
|
||||
])('$name', ({ args, want }) => {
|
||||
expect(
|
||||
getPathForPackageManager({
|
||||
|
||||
15
packages/build-utils/test/unit.test.ts
vendored
15
packages/build-utils/test/unit.test.ts
vendored
@@ -221,6 +221,21 @@ it('should warn when package.json engines is greater than', async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should warn when project settings gets overrided', async () => {
|
||||
expect(
|
||||
await getNodeVersion(
|
||||
path.join(__dirname, 'pkg-engine-node-greaterthan'),
|
||||
undefined,
|
||||
{ nodeVersion: '16.x' },
|
||||
{}
|
||||
)
|
||||
).toHaveProperty('range', '20.x');
|
||||
expect(warningMessages).toStrictEqual([
|
||||
'Warning: Due to "engines": { "node": ">=16" } in your `package.json` file, the Node.js Version defined in your Project Settings ("16.x") will not apply. Learn More: http://vercel.link/node-version',
|
||||
'Warning: Detected "engines": { "node": ">=16" } in your `package.json` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version',
|
||||
]);
|
||||
});
|
||||
|
||||
it('should not warn when package.json engines matches project setting from config', async () => {
|
||||
expect(
|
||||
await getNodeVersion(
|
||||
|
||||
@@ -1,5 +1,66 @@
|
||||
# vercel
|
||||
|
||||
## 34.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Stop sending system environment variables in dev ([#11526](https://github.com/vercel/vercel/pull/11526))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d3c1267e2`](https://github.com/vercel/vercel/commit/d3c1267e24082789ea6382cf6af81dd40df288ff), [`ccd7eb1fb`](https://github.com/vercel/vercel/commit/ccd7eb1fb78f7ac9effdbe1935de3bda82c97fe3)]:
|
||||
- @vercel/build-utils@8.2.0
|
||||
- @vercel/node@3.1.5
|
||||
- @vercel/static-build@2.5.9
|
||||
|
||||
## 34.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ad6945435`](https://github.com/vercel/vercel/commit/ad69454352b519b2b0ed326f245c779530554bf2)]:
|
||||
- @vercel/build-utils@8.1.3
|
||||
- @vercel/node@3.1.4
|
||||
- @vercel/static-build@2.5.8
|
||||
|
||||
## 34.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1682ad43d`](https://github.com/vercel/vercel/commit/1682ad43d0064b22b1248a7e946746b838f00076)]:
|
||||
- @vercel/build-utils@8.1.2
|
||||
- @vercel/node@3.1.3
|
||||
- @vercel/static-build@2.5.7
|
||||
|
||||
## 34.1.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`67afc2608`](https://github.com/vercel/vercel/commit/67afc26085e2ebdaa33a8cbce112afec4cb1c4f5), [`2f7a6ed5f`](https://github.com/vercel/vercel/commit/2f7a6ed5f92d454000f92247d3b6548e2064f4e6)]:
|
||||
- @vercel/next@4.2.11
|
||||
- @vercel/build-utils@8.1.1
|
||||
- @vercel/node@3.1.2
|
||||
- @vercel/static-build@2.5.6
|
||||
|
||||
## 34.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`5014b1e82`](https://github.com/vercel/vercel/commit/5014b1e82a46181baeb727ffe6d14000b6a4b1d7), [`18d1703d5`](https://github.com/vercel/vercel/commit/18d1703d5b4f2adc61fd56011f874c393fa57d0d), [`e87d4c14d`](https://github.com/vercel/vercel/commit/e87d4c14d0e718281f9ba91c9ec1cc6e142d383d), [`bc5fd4115`](https://github.com/vercel/vercel/commit/bc5fd41158ec9f36e5db1fe749589adcbaec6950)]:
|
||||
- @vercel/build-utils@8.1.0
|
||||
- @vercel/next@4.2.10
|
||||
- @vercel/redwood@2.0.9
|
||||
- @vercel/remix-builder@2.1.6
|
||||
- @vercel/node@3.1.1
|
||||
- @vercel/static-build@2.5.5
|
||||
|
||||
## 34.1.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`119f80e96`](https://github.com/vercel/vercel/commit/119f80e9611a7a5a755aa689502dcdab323194aa), [`11584b0e9`](https://github.com/vercel/vercel/commit/11584b0e9b55f312f34d0d6467ab498e472ac9df), [`3023122d4`](https://github.com/vercel/vercel/commit/3023122d4e0dd292340d9e9e61ef232baf6e610d), [`0e774b6be`](https://github.com/vercel/vercel/commit/0e774b6be0c832213a64124e1f4fc6d150e87d9f)]:
|
||||
- @vercel/next@4.2.9
|
||||
- @vercel/static-build@2.5.4
|
||||
|
||||
## 34.1.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel",
|
||||
"version": "34.1.9",
|
||||
"version": "34.2.0",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Vercel",
|
||||
@@ -32,17 +32,17 @@
|
||||
"node": ">= 16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/fun": "1.1.0",
|
||||
"@vercel/go": "3.1.1",
|
||||
"@vercel/hydrogen": "1.0.2",
|
||||
"@vercel/next": "4.2.8",
|
||||
"@vercel/node": "3.1.0",
|
||||
"@vercel/next": "4.2.11",
|
||||
"@vercel/node": "3.1.5",
|
||||
"@vercel/python": "4.2.0",
|
||||
"@vercel/redwood": "2.0.8",
|
||||
"@vercel/remix-builder": "2.1.5",
|
||||
"@vercel/redwood": "2.0.9",
|
||||
"@vercel/remix-builder": "2.1.6",
|
||||
"@vercel/ruby": "2.1.0",
|
||||
"@vercel/static-build": "2.5.3",
|
||||
"@vercel/static-build": "2.5.9",
|
||||
"chokidar": "3.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -92,8 +92,8 @@
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel-internals/constants": "1.0.4",
|
||||
"@vercel-internals/get-package-json": "1.0.0",
|
||||
"@vercel-internals/types": "1.0.31",
|
||||
"@vercel/client": "13.2.2",
|
||||
"@vercel-internals/types": "1.0.36",
|
||||
"@vercel/client": "13.2.7",
|
||||
"@vercel/error-utils": "2.0.2",
|
||||
"@vercel/frameworks": "3.0.2",
|
||||
"@vercel/fs-detectors": "5.2.3",
|
||||
|
||||
2
packages/cli/src/util/env/get-env-records.ts
vendored
2
packages/cli/src/util/env/get-env-records.ts
vendored
@@ -70,7 +70,7 @@ export async function pullEnvRecords(
|
||||
);
|
||||
const query = new URLSearchParams();
|
||||
|
||||
let url = `/v1/env/pull/${projectId}`;
|
||||
let url = `/v2/env/pull/${projectId}`;
|
||||
|
||||
if (target) {
|
||||
url += `/${encodeURIComponent(target)}`;
|
||||
|
||||
30
packages/cli/test/integration-1.test.ts
vendored
30
packages/cli/test/integration-1.test.ts
vendored
@@ -917,9 +917,9 @@ test('Deploy `api-env` fixture and test `vercel env` command', async () => {
|
||||
expect(homeJson['MY_STDIN_VAR']).toBe('{"expect":"quotes"}');
|
||||
expect(homeJson['MY_DECRYPTABLE_SECRET_ENV']).toBe('decryptable value');
|
||||
|
||||
// system env vars are automatically exposed
|
||||
expect(apiJson['VERCEL']).toBe('1');
|
||||
expect(homeJson['VERCEL']).toBe('1');
|
||||
// system env vars are hidden in dev
|
||||
expect(apiJson['VERCEL']).toBeUndefined();
|
||||
expect(homeJson['VERCEL']).toBeUndefined();
|
||||
|
||||
// sleep before kill, otherwise the dev process doesn't clean up and exit properly
|
||||
await sleep(100);
|
||||
@@ -949,7 +949,7 @@ test('Deploy `api-env` fixture and test `vercel env` command', async () => {
|
||||
async function vcEnvPullFetchSystemVars() {
|
||||
const { exitCode, stdout, stderr } = await execCli(
|
||||
binaryPath,
|
||||
['env', 'pull', '-y'],
|
||||
['env', 'pull', '-y', '--environment', 'production'],
|
||||
{
|
||||
cwd: target,
|
||||
}
|
||||
@@ -963,7 +963,7 @@ test('Deploy `api-env` fixture and test `vercel env` command', async () => {
|
||||
|
||||
expect(lines).toContain('VERCEL="1"');
|
||||
expect(lines).toContain('VERCEL_URL=""');
|
||||
expect(lines).toContain('VERCEL_ENV="development"');
|
||||
expect(lines).toContain('VERCEL_ENV="production"');
|
||||
expect(lines).toContain('VERCEL_GIT_PROVIDER=""');
|
||||
expect(lines).toContain('VERCEL_GIT_REPO_SLUG=""');
|
||||
}
|
||||
@@ -980,22 +980,24 @@ test('Deploy `api-env` fixture and test `vercel env` command', async () => {
|
||||
const localhostNoProtocol = localhost[0].slice('http://'.length);
|
||||
|
||||
const apiJson = await apiRes.json();
|
||||
expect(apiJson['VERCEL']).toBe('1');
|
||||
// environment variables are not set in dev
|
||||
expect(apiJson['VERCEL']).toBeUndefined();
|
||||
expect(apiJson['VERCEL_ENV']).toBeUndefined();
|
||||
expect(apiJson['VERCEL_GIT_PROVIDER']).toBeUndefined();
|
||||
expect(apiJson['VERCEL_GIT_REPO_SLUG']).toBeUndefined();
|
||||
// except for these because vc dev
|
||||
expect(apiJson['VERCEL_URL']).toBe(localhostNoProtocol);
|
||||
expect(apiJson['VERCEL_ENV']).toBe('development');
|
||||
expect(apiJson['VERCEL_REGION']).toBe('dev1');
|
||||
expect(apiJson['VERCEL_GIT_PROVIDER']).toBe('');
|
||||
expect(apiJson['VERCEL_GIT_REPO_SLUG']).toBe('');
|
||||
|
||||
const homeUrl = localhost[0];
|
||||
const homeRes = await fetch(homeUrl);
|
||||
const homeJson = await homeRes.json();
|
||||
expect(homeJson['VERCEL']).toBe('1');
|
||||
expect(homeJson['VERCEL']).toBeUndefined();
|
||||
expect(homeJson['VERCEL_URL']).toBe(localhostNoProtocol);
|
||||
expect(homeJson['VERCEL_ENV']).toBe('development');
|
||||
expect(homeJson['VERCEL_REGION']).toBe(undefined);
|
||||
expect(homeJson['VERCEL_GIT_PROVIDER']).toBe('');
|
||||
expect(homeJson['VERCEL_GIT_REPO_SLUG']).toBe('');
|
||||
expect(homeJson['VERCEL_ENV']).toBeUndefined();
|
||||
expect(homeJson['VERCEL_REGION']).toBeUndefined();
|
||||
expect(homeJson['VERCEL_GIT_PROVIDER']).toBeUndefined();
|
||||
expect(homeJson['VERCEL_GIT_REPO_SLUG']).toBeUndefined();
|
||||
|
||||
// sleep before kill, otherwise the dev process doesn't clean up and exit properly
|
||||
await sleep(100);
|
||||
|
||||
2
packages/cli/test/integration-3.test.ts
vendored
2
packages/cli/test/integration-3.test.ts
vendored
@@ -1255,7 +1255,7 @@ test('fail to deploy a Lambda with an incorrect value for maxDuration', async ()
|
||||
|
||||
expect(output.exitCode, formatOutput(output)).toBe(1);
|
||||
expect(output.stderr).toMatch(
|
||||
/maxDuration must be between 1 second and 10 seconds/gm
|
||||
/maxDuration must be between \d+ second and \d+ seconds/gm
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ export function useProject(
|
||||
res.json(project);
|
||||
});
|
||||
client.scenario.get(
|
||||
`/v1/env/pull/${project.id}/:target?/:gitBranch?`,
|
||||
`/v2/env/pull/${project.id}/:target?/:gitBranch?`,
|
||||
(req, res) => {
|
||||
const target =
|
||||
typeof req.params.target === 'string'
|
||||
@@ -390,7 +390,7 @@ function exposeSystemEnvs(
|
||||
) {
|
||||
const envs: Env = {};
|
||||
|
||||
if (autoExposeSystemEnvs) {
|
||||
if (autoExposeSystemEnvs && target !== 'development') {
|
||||
envs['VERCEL'] = '1';
|
||||
envs['VERCEL_ENV'] = target || 'development';
|
||||
|
||||
|
||||
@@ -205,10 +205,17 @@ describe('env', () => {
|
||||
});
|
||||
const cwd = setupUnitFixture('vercel-env-pull');
|
||||
client.cwd = cwd;
|
||||
client.setArgv('env', 'pull', 'other.env', '--yes');
|
||||
client.setArgv(
|
||||
'env',
|
||||
'pull',
|
||||
'other.env',
|
||||
'--yes',
|
||||
'--environment',
|
||||
'production'
|
||||
);
|
||||
const exitCodePromise = env(client);
|
||||
await expect(client.stderr).toOutput(
|
||||
'Downloading `development` Environment Variables for Project vercel-env-pull'
|
||||
'Downloading `production` Environment Variables for Project vercel-env-pull'
|
||||
);
|
||||
await expect(client.stderr).toOutput('Created other.env file');
|
||||
await expect(client.stderr).not.toOutput('and added it to .gitignore');
|
||||
@@ -218,10 +225,44 @@ describe('env', () => {
|
||||
|
||||
const productionFileHasVercelEnv = rawDevEnv
|
||||
.toString()
|
||||
.includes('VERCEL_ENV="development"');
|
||||
.includes('VERCEL_ENV="production"');
|
||||
expect(productionFileHasVercelEnv).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not expose system env variables in dev', async () => {
|
||||
useUser();
|
||||
useTeams('team_dummy');
|
||||
useProject({
|
||||
...defaultProject,
|
||||
id: 'vercel-env-pull',
|
||||
name: 'vercel-env-pull',
|
||||
autoExposeSystemEnvs: true,
|
||||
});
|
||||
const cwd = setupUnitFixture('vercel-env-pull');
|
||||
client.cwd = cwd;
|
||||
client.setArgv('env', 'pull', 'other.env', '--yes');
|
||||
const exitCodePromise = env(client);
|
||||
await expect(client.stderr).toOutput(
|
||||
'Downloading `development` Environment Variables for Project vercel-env-pull'
|
||||
);
|
||||
await expect(client.stderr).toOutput('Created other.env file');
|
||||
await expect(client.stderr).not.toOutput('and added it to .gitignore');
|
||||
await expect(exitCodePromise).resolves.toEqual(0);
|
||||
|
||||
const devEnv = (
|
||||
await fs.readFile(path.join(cwd, 'other.env'))
|
||||
).toString();
|
||||
|
||||
const devFileHasVercelEnv = [
|
||||
'VERCEL',
|
||||
'VERCEL_ENV',
|
||||
'VERCEL_URL',
|
||||
'VERCEL_REGION',
|
||||
'VERCEL_DEPLOYMENT_ID',
|
||||
].some(envVar => devEnv.includes(envVar));
|
||||
expect(devFileHasVercelEnv).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should show a delta string', async () => {
|
||||
const cwd = setupUnitFixture('vercel-env-pull-delta');
|
||||
client.cwd = cwd;
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
# @vercel/client
|
||||
|
||||
## 13.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d3c1267e2`](https://github.com/vercel/vercel/commit/d3c1267e24082789ea6382cf6af81dd40df288ff), [`ccd7eb1fb`](https://github.com/vercel/vercel/commit/ccd7eb1fb78f7ac9effdbe1935de3bda82c97fe3)]:
|
||||
- @vercel/build-utils@8.2.0
|
||||
|
||||
## 13.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ad6945435`](https://github.com/vercel/vercel/commit/ad69454352b519b2b0ed326f245c779530554bf2)]:
|
||||
- @vercel/build-utils@8.1.3
|
||||
|
||||
## 13.2.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1682ad43d`](https://github.com/vercel/vercel/commit/1682ad43d0064b22b1248a7e946746b838f00076)]:
|
||||
- @vercel/build-utils@8.1.2
|
||||
|
||||
## 13.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2f7a6ed5f`](https://github.com/vercel/vercel/commit/2f7a6ed5f92d454000f92247d3b6548e2064f4e6)]:
|
||||
- @vercel/build-utils@8.1.1
|
||||
|
||||
## 13.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`5014b1e82`](https://github.com/vercel/vercel/commit/5014b1e82a46181baeb727ffe6d14000b6a4b1d7)]:
|
||||
- @vercel/build-utils@8.1.0
|
||||
|
||||
## 13.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/client",
|
||||
"version": "13.2.2",
|
||||
"version": "13.2.7",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"homepage": "https://vercel.com",
|
||||
@@ -37,7 +37,7 @@
|
||||
"typescript": "4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/error-utils": "2.0.2",
|
||||
"@vercel/routing-utils": "3.1.0",
|
||||
"@zeit/fetch": "5.2.0",
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"@types/minimatch": "3.0.5",
|
||||
"@types/node": "14.18.33",
|
||||
"@types/semver": "7.3.10",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"jest-junit": "16.0.0",
|
||||
"typescript": "4.9.5"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @vercel/functions
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Convert package to CommonJS ([#11569](https://github.com/vercel/vercel/pull/11569))
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
2
packages/functions/index.d.ts
vendored
2
packages/functions/index.d.ts
vendored
@@ -14,4 +14,4 @@
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export const waitUntil: (promise: Promise<unknown>) => void;
|
||||
export function waitUntil(promise: Promise<unknown>): void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global globalThis */
|
||||
|
||||
export const waitUntil = promise => {
|
||||
exports.waitUntil = promise => {
|
||||
if (
|
||||
promise === null ||
|
||||
typeof promise !== 'object' ||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@vercel/functions",
|
||||
"description": "Runtime functions to be used with your Vercel Functions",
|
||||
"homepage": "https://vercel.com",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"types": "index.d.ts",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
# @vercel/gatsby-plugin-vercel-builder
|
||||
|
||||
## 2.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d3c1267e2`](https://github.com/vercel/vercel/commit/d3c1267e24082789ea6382cf6af81dd40df288ff), [`ccd7eb1fb`](https://github.com/vercel/vercel/commit/ccd7eb1fb78f7ac9effdbe1935de3bda82c97fe3)]:
|
||||
- @vercel/build-utils@8.2.0
|
||||
|
||||
## 2.0.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ad6945435`](https://github.com/vercel/vercel/commit/ad69454352b519b2b0ed326f245c779530554bf2)]:
|
||||
- @vercel/build-utils@8.1.3
|
||||
|
||||
## 2.0.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1682ad43d`](https://github.com/vercel/vercel/commit/1682ad43d0064b22b1248a7e946746b838f00076)]:
|
||||
- @vercel/build-utils@8.1.2
|
||||
|
||||
## 2.0.28
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2f7a6ed5f`](https://github.com/vercel/vercel/commit/2f7a6ed5f92d454000f92247d3b6548e2064f4e6)]:
|
||||
- @vercel/build-utils@8.1.1
|
||||
|
||||
## 2.0.27
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`5014b1e82`](https://github.com/vercel/vercel/commit/5014b1e82a46181baeb727ffe6d14000b6a4b1d7)]:
|
||||
- @vercel/build-utils@8.1.0
|
||||
|
||||
## 2.0.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/gatsby-plugin-vercel-builder",
|
||||
"version": "2.0.26",
|
||||
"version": "2.0.31",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "0.25.24",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/routing-utils": "3.1.0",
|
||||
"esbuild": "0.14.47",
|
||||
"etag": "1.8.1",
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@types/node-fetch": "^2.3.0",
|
||||
"@types/tar": "6.1.5",
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"async-retry": "1.3.3",
|
||||
"execa": "^1.0.0",
|
||||
"fs-extra": "^7.0.0",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"devDependencies": {
|
||||
"@types/jest": "27.5.1",
|
||||
"@types/node": "14.18.33",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"execa": "3.2.0",
|
||||
"fs-extra": "11.1.0",
|
||||
"jest-junit": "16.0.0"
|
||||
|
||||
@@ -51,11 +51,15 @@ export const build: BuildV2 = async ({
|
||||
);
|
||||
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
const { cliType, lockfileVersion } = await scanParentDirs(entrypointDir);
|
||||
const { cliType, lockfileVersion, packageJson } = await scanParentDirs(
|
||||
entrypointDir,
|
||||
true
|
||||
);
|
||||
|
||||
spawnOpts.env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env: spawnOpts.env || {},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
# @vercel/next
|
||||
|
||||
## 4.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- normalize source file locations for special metadata files ([#11579](https://github.com/vercel/vercel/pull/11579))
|
||||
|
||||
## 4.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- skip action rewrites for RSC requests ([#11576](https://github.com/vercel/vercel/pull/11576))
|
||||
|
||||
- Bump `@vercel/nft@0.27.0` ([#11580](https://github.com/vercel/vercel/pull/11580))
|
||||
|
||||
## 4.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Support incremental partial prerendering ([#11560](https://github.com/vercel/vercel/pull/11560))
|
||||
|
||||
- ensure `.action` outputs are created for edge functions ([#11568](https://github.com/vercel/vercel/pull/11568))
|
||||
|
||||
- ([#11566](https://github.com/vercel/vercel/pull/11566))
|
||||
|
||||
## 4.2.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/next",
|
||||
"version": "4.2.8",
|
||||
"version": "4.2.11",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
||||
@@ -23,7 +23,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@vercel/nft": "0.26.4"
|
||||
"@vercel/nft": "0.27.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/aws-lambda": "8.10.19",
|
||||
@@ -40,7 +40,7 @@
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/text-table": "0.2.1",
|
||||
"@types/webpack-sources": "3.2.0",
|
||||
"@vercel/build-utils": "8.0.0",
|
||||
"@vercel/build-utils": "8.2.0",
|
||||
"@vercel/routing-utils": "3.1.0",
|
||||
"async-sema": "3.0.1",
|
||||
"buffer-crc32": "0.2.13",
|
||||
|
||||
@@ -257,10 +257,15 @@ export const build: BuildV2 = async ({
|
||||
const nextVersionRange = await getNextVersionRange(entryPath);
|
||||
const nodeVersion = await getNodeVersion(entryPath, undefined, config, meta);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
const { cliType, lockfileVersion } = await scanParentDirs(entryPath);
|
||||
const { cliType, lockfileVersion, packageJson } = await scanParentDirs(
|
||||
entryPath,
|
||||
true
|
||||
);
|
||||
|
||||
spawnOpts.env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env: spawnOpts.env || {},
|
||||
});
|
||||
|
||||
@@ -218,7 +218,9 @@ export async function serverBuild({
|
||||
}
|
||||
|
||||
const experimental = {
|
||||
ppr: requiredServerFilesManifest.config.experimental?.ppr === true,
|
||||
ppr:
|
||||
requiredServerFilesManifest.config.experimental?.ppr === true ||
|
||||
requiredServerFilesManifest.config.experimental?.ppr === 'incremental',
|
||||
};
|
||||
|
||||
let appRscPrefetches: UnwrapPromise<ReturnType<typeof glob>> = {};
|
||||
@@ -228,8 +230,6 @@ export async function serverBuild({
|
||||
if (appPathRoutesManifest) {
|
||||
appDir = path.join(pagesDir, '../app');
|
||||
appBuildTraces = await glob('**/*.js.nft.json', appDir);
|
||||
|
||||
// TODO: maybe?
|
||||
appRscPrefetches = experimental.ppr
|
||||
? {}
|
||||
: await glob(`**/*${RSC_PREFETCH_SUFFIX}`, appDir);
|
||||
@@ -1601,6 +1601,10 @@ export async function serverBuild({
|
||||
edgeFunctions[`${pathname}${RSC_PREFETCH_SUFFIX}`] =
|
||||
edgeFunctions[pathname];
|
||||
}
|
||||
|
||||
if (hasActionOutputSupport) {
|
||||
edgeFunctions[`${pathname}.action`] = edgeFunctions[pathname];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1952,7 +1956,7 @@ export async function serverBuild({
|
||||
// Also includes separate handling for index routes which should match to /index.action.
|
||||
// This follows the same pattern as the rewrites for .rsc files.
|
||||
{
|
||||
src: `^${path.posix.join('/', entryDirectory, '/')}`,
|
||||
src: `^${path.posix.join('/', entryDirectory, '/?')}`,
|
||||
dest: path.posix.join('/', entryDirectory, '/index.action'),
|
||||
has: [
|
||||
{
|
||||
@@ -1960,6 +1964,12 @@ export async function serverBuild({
|
||||
key: 'next-action',
|
||||
},
|
||||
],
|
||||
missing: [
|
||||
{
|
||||
type: 'header',
|
||||
key: rscHeader,
|
||||
},
|
||||
],
|
||||
continue: true,
|
||||
override: true,
|
||||
},
|
||||
@@ -1976,6 +1986,12 @@ export async function serverBuild({
|
||||
key: 'next-action',
|
||||
},
|
||||
],
|
||||
missing: [
|
||||
{
|
||||
type: 'header',
|
||||
key: rscHeader,
|
||||
},
|
||||
],
|
||||
continue: true,
|
||||
override: true,
|
||||
},
|
||||
|
||||
@@ -1439,6 +1439,13 @@ async function getSourceFilePathFromPage({
|
||||
}
|
||||
}
|
||||
|
||||
// if we got here, and didn't find a source not-found file, then it was the one injected
|
||||
// by Next.js. There's no need to warn or return a source file in this case, as it won't have
|
||||
// any configuration applied to it.
|
||||
if (page === '/_not-found/page') {
|
||||
return '';
|
||||
}
|
||||
|
||||
console.log(
|
||||
`WARNING: Unable to find source file for page ${page} with extensions: ${extensionsToTry.join(
|
||||
', '
|
||||
@@ -1565,15 +1572,13 @@ export async function getPageLambdaGroups({
|
||||
}
|
||||
|
||||
if (config && config.functions) {
|
||||
// `pages` are normalized without route groups (e.g., /app/(group)/page.js).
|
||||
// we keep track of that mapping in `inversedAppPathManifest`
|
||||
// `getSourceFilePathFromPage` needs to use the path from source to properly match the config
|
||||
const pageFromManifest = inversedAppPathManifest?.[routeName];
|
||||
const sourceFile = await getSourceFilePathFromPage({
|
||||
workPath: entryPath,
|
||||
// since this function is used by both `pages` and `app`, the manifest might not be provided
|
||||
// so fallback to normal behavior of just checking the `page`.
|
||||
page: pageFromManifest ?? page,
|
||||
page: normalizeSourceFilePageFromManifest(
|
||||
routeName,
|
||||
page,
|
||||
inversedAppPathManifest
|
||||
),
|
||||
pageExtensions,
|
||||
});
|
||||
|
||||
@@ -1657,6 +1662,43 @@ export async function getPageLambdaGroups({
|
||||
return groups;
|
||||
}
|
||||
|
||||
// `pages` are normalized without route groups (e.g., /app/(group)/page.js).
|
||||
// we keep track of that mapping in `inversedAppPathManifest`
|
||||
// `getSourceFilePathFromPage` needs to use the path from source to properly match the config
|
||||
function normalizeSourceFilePageFromManifest(
|
||||
routeName: string,
|
||||
page: string,
|
||||
inversedAppPathManifest?: Record<string, string>
|
||||
) {
|
||||
const pageFromManifest = inversedAppPathManifest?.[routeName];
|
||||
if (!pageFromManifest) {
|
||||
// since this function is used by both `pages` and `app`, the manifest might not be provided
|
||||
// so fallback to normal behavior of just checking the `page`.
|
||||
return page;
|
||||
}
|
||||
|
||||
const metadataConventions = [
|
||||
'/favicon.',
|
||||
'/icon.',
|
||||
'/apple-icon.',
|
||||
'/opengraph-image.',
|
||||
'/twitter-image.',
|
||||
'/sitemap.',
|
||||
'/robots.',
|
||||
];
|
||||
|
||||
// these special metadata files for will not contain `/route` or `/page` suffix, so return the routeName as-is.
|
||||
const isSpecialFile = metadataConventions.some(convention =>
|
||||
routeName.startsWith(convention)
|
||||
);
|
||||
|
||||
if (isSpecialFile) {
|
||||
return routeName;
|
||||
}
|
||||
|
||||
return pageFromManifest;
|
||||
}
|
||||
|
||||
export const outputFunctionFileSizeInfo = (
|
||||
pages: string[],
|
||||
pseudoLayer: PseudoLayer,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { increment } from '../../../../actions';
|
||||
|
||||
export default function Page() {
|
||||
const [count, setCount] = useState(0);
|
||||
async function updateCount() {
|
||||
const newCount = await increment(count);
|
||||
setCount(newCount);
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={updateCount}>
|
||||
<div id="count">{count}</div>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return children;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { increment } from '../../../../actions';
|
||||
|
||||
export default function Page() {
|
||||
const [count, setCount] = useState(0);
|
||||
async function updateCount() {
|
||||
const newCount = await increment(count);
|
||||
setCount(newCount);
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={updateCount}>
|
||||
<div id="count">{count}</div>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export const dynamic = 'force-static';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return children;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { increment } from '../../../actions';
|
||||
|
||||
export default function Page() {
|
||||
const [count, setCount] = useState(0);
|
||||
async function updateCount() {
|
||||
const newCount = await increment(count);
|
||||
setCount(newCount);
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={updateCount}>
|
||||
<div id="count">{count}</div>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
5
packages/next/test/fixtures/00-app-dir-actions-experimental-streaming/app/edge/layout.js
vendored
Normal file
5
packages/next/test/fixtures/00-app-dir-actions-experimental-streaming/app/edge/layout.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export const runtime = 'edge';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return <div>{children}</div>;
|
||||
}
|
||||
45
packages/next/test/fixtures/00-app-dir-actions-experimental-streaming/app/edge/other/page.js
vendored
Normal file
45
packages/next/test/fixtures/00-app-dir-actions-experimental-streaming/app/edge/other/page.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use client';
|
||||
|
||||
// @ts-ignore
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
function request(method) {
|
||||
return fetch('/api/test', {
|
||||
method,
|
||||
headers: {
|
||||
'content-type': 'multipart/form-data;.*',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
const [result, setResult] = useState('Press submit');
|
||||
const onClick = useCallback(async method => {
|
||||
const res = await request(method);
|
||||
const text = await res.text();
|
||||
|
||||
setResult(res.ok ? `${method} ${text}` : 'Error: ' + res.status);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col items-center justify-center h-screen">
|
||||
<div className="flex flex-row space-x-2 items-center justify-center">
|
||||
<button
|
||||
className="border border-white rounded-sm p-4 mb-4"
|
||||
onClick={() => onClick('GET')}
|
||||
>
|
||||
Submit GET
|
||||
</button>
|
||||
<button
|
||||
className="border border-white rounded-sm p-4 mb-4"
|
||||
onClick={() => onClick('POST')}
|
||||
>
|
||||
Submit POST
|
||||
</button>
|
||||
</div>
|
||||
<div className="text-white">{result}</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return children;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { revalidatePath } from 'next/cache';
|
||||
|
||||
export default async function Page() {
|
||||
async function serverAction() {
|
||||
'use server';
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
revalidatePath('/dynamic');
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={serverAction}>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { revalidatePath } from 'next/cache';
|
||||
|
||||
export default async function Page() {
|
||||
async function serverAction() {
|
||||
'use server';
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
revalidatePath('/dynamic');
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={serverAction}>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { revalidatePath } from 'next/cache';
|
||||
|
||||
export default async function Page() {
|
||||
async function serverAction() {
|
||||
'use server';
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
revalidatePath('/dynamic');
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={serverAction}>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return [{ slug: 'pre-generated' }];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export const dynamic = 'force-static';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return children;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
export default async function Page() {
|
||||
async function serverAction() {
|
||||
'use server';
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
revalidatePath('/dynamic');
|
||||
}
|
||||
|
||||
return (
|
||||
<form action={serverAction}>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -5,10 +5,12 @@ const fetch = require('../../../../../test/lib/deployment/fetch-retry');
|
||||
|
||||
const ctx = {};
|
||||
|
||||
function findActionId(page) {
|
||||
function findActionId(page, runtime) {
|
||||
page = `app${page}/page`; // add /app prefix and /page suffix
|
||||
|
||||
for (const [actionId, details] of Object.entries(ctx.actionManifest.node)) {
|
||||
for (const [actionId, details] of Object.entries(
|
||||
ctx.actionManifest[runtime]
|
||||
)) {
|
||||
if (details.workers[page]) {
|
||||
return actionId;
|
||||
}
|
||||
@@ -41,141 +43,115 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
|
||||
Object.assign(ctx, info);
|
||||
});
|
||||
|
||||
describe('client component', () => {
|
||||
it('should bypass the static cache for a server action', async () => {
|
||||
const path = '/client/static';
|
||||
const actionId = findActionId(path);
|
||||
describe.each(['node', 'edge'])('runtime: %s', runtime => {
|
||||
const basePath = runtime === 'edge' ? '/edge' : '';
|
||||
describe('client component', () => {
|
||||
it('should bypass the static cache for a server action', async () => {
|
||||
const path = `${basePath}/client/static`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
// in edge runtime, x-vercel-cache is not returned on MISSes for some reason.
|
||||
// this checks to ensure it was routed to the edge function instead.
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
it('should bypass the static cache for a server action on a page with dynamic params', async () => {
|
||||
const path = `${basePath}/client/static/[dynamic-static]`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
it('should bypass the static cache for a server action on a page with dynamic params', async () => {
|
||||
const path = '/client/static/[dynamic-static]';
|
||||
const actionId = findActionId(path);
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
});
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
it('should bypass the static cache for a multipart request (no action header)', async () => {
|
||||
const path = `${basePath}/client/static`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
it('should bypass the static cache for a multipart request (no action header)', async () => {
|
||||
const path = '/client/static';
|
||||
const actionId = findActionId(path);
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: `------WebKitFormBoundaryHcVuFa30AN0QV3uZ\r\nContent-Disposition: form-data; name=\"1_$ACTION_ID_${actionId}\"\r\n\r\n\r\n------WebKitFormBoundaryHcVuFa30AN0QV3uZ\r\nContent-Disposition: form-data; name=\"0\"\r\n\r\n[\"$K1\"]\r\n------WebKitFormBoundaryHcVuFa30AN0QV3uZ--\r\n`,
|
||||
headers: {
|
||||
'Content-Type':
|
||||
'multipart/form-data; boundary=----WebKitFormBoundaryHcVuFa30AN0QV3uZ',
|
||||
},
|
||||
});
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: `------WebKitFormBoundaryHcVuFa30AN0QV3uZ\r\nContent-Disposition: form-data; name=\"1_$ACTION_ID_${actionId}\"\r\n\r\n\r\n------WebKitFormBoundaryHcVuFa30AN0QV3uZ\r\nContent-Disposition: form-data; name=\"0\"\r\n\r\n[\"$K1\"]\r\n------WebKitFormBoundaryHcVuFa30AN0QV3uZ--\r\n`,
|
||||
headers: {
|
||||
'Content-Type':
|
||||
'multipart/form-data; boundary=----WebKitFormBoundaryHcVuFa30AN0QV3uZ',
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('content-type')).toBe('text/html; charset=utf-8');
|
||||
// This is a "BYPASS" because no action ID was provided, so it'll fall back to
|
||||
// `experimentalBypassFor` handling.
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('BYPASS');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path);
|
||||
});
|
||||
|
||||
it('should properly invoke the action on a dynamic page', async () => {
|
||||
const path = '/client/dynamic/[id]';
|
||||
const actionId = findActionId(path);
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
});
|
||||
|
||||
describe('server component', () => {
|
||||
it('should bypass the static cache for a server action', async () => {
|
||||
const path = '/rsc/static';
|
||||
const actionId = findActionId(path);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
|
||||
it('should bypass the static cache for a server action on a page with dynamic params', async () => {
|
||||
const path = '/rsc/static/[dynamic-static]';
|
||||
const actionId = findActionId(path);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
|
||||
it('should properly invoke the action on a dynamic page', async () => {
|
||||
const path = '/rsc/dynamic';
|
||||
const actionId = findActionId(path);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
});
|
||||
|
||||
describe('generateStaticParams', () => {
|
||||
it('should bypass the static cache for a server action when pre-generated', async () => {
|
||||
const path = '/rsc/static/generate-static-params/pre-generated';
|
||||
const actionId = findActionId(
|
||||
'/rsc/static/generate-static-params/[slug]'
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('content-type')).toBe(
|
||||
'text/html; charset=utf-8'
|
||||
);
|
||||
if (runtime === 'node') {
|
||||
// This is a "BYPASS" because no action ID was provided, so it'll fall back to
|
||||
// `experimentalBypassFor` handling.
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('BYPASS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
expect(res.headers.get('x-matched-path')).toBe(path);
|
||||
});
|
||||
|
||||
it('should properly invoke the action on a dynamic page', async () => {
|
||||
const path = `${basePath}/client/dynamic/[id]`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${path}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
const body = await res.text();
|
||||
expect(body).toContain('1338');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('server component', () => {
|
||||
it('should bypass the static cache for a server action', async () => {
|
||||
const path = `${basePath}/rsc/static`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
@@ -183,27 +159,119 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(
|
||||
'/rsc/static/generate-static-params/[slug].action'
|
||||
);
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
it('should bypass the static cache for a server action when not pre-generated', async () => {
|
||||
const page = '/rsc/static/generate-static-params/[slug]';
|
||||
const actionId = findActionId(page);
|
||||
it('should bypass the static cache for a server action on a page with dynamic params', async () => {
|
||||
const path = `${basePath}/rsc/static/[dynamic-static]`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}/rsc/static/generate-static-params/not-pre-generated`,
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(page + '.action');
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
it('should properly invoke the action on a dynamic page', async () => {
|
||||
const path = `${basePath}/rsc/dynamic`;
|
||||
const actionId = findActionId(path, runtime);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(path + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
describe('generateStaticParams', () => {
|
||||
it('should bypass the static cache for a server action when pre-generated', async () => {
|
||||
const path = `${basePath}/rsc/static/generate-static-params/pre-generated`;
|
||||
const dynamicPath = `${basePath}/rsc/static/generate-static-params/[slug]`;
|
||||
const actionId = findActionId(dynamicPath, runtime);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}${path}`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(
|
||||
dynamicPath + '.action'
|
||||
);
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
|
||||
it('should bypass the static cache for a server action when not pre-generated', async () => {
|
||||
const page = `${basePath}/rsc/static/generate-static-params/[slug]`;
|
||||
const actionId = findActionId(page, runtime);
|
||||
|
||||
const res = await fetch(
|
||||
`${ctx.deploymentUrl}/${basePath}/rsc/static/generate-static-params/not-pre-generated`,
|
||||
generateFormDataPayload(actionId)
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(page + '.action');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
if (runtime === 'node') {
|
||||
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
|
||||
} else {
|
||||
expect(res.headers.get('x-edge-runtime')).toBe('1');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should not match to an action output when the RSC header is present', async () => {
|
||||
const canonicalPath = `${basePath}/client/dynamic/1`;
|
||||
const pagePath = `${basePath}/client/dynamic/[id]`;
|
||||
const actionId = findActionId(pagePath, runtime);
|
||||
|
||||
const res = await fetch(`${ctx.deploymentUrl}${canonicalPath}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify([1337]),
|
||||
headers: {
|
||||
'Content-Type': 'text/plain;charset=UTF-8',
|
||||
'Next-Action': actionId,
|
||||
'Next-Response': 'rsc',
|
||||
RSC: '1',
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers.get('x-matched-path')).toBe(pagePath + '.rsc');
|
||||
expect(res.headers.get('content-type')).toBe('text/x-component');
|
||||
const body = await res.text();
|
||||
expect(body).toContain(JSON.stringify(['id', '1', 'd']));
|
||||
expect(body).not.toContain(JSON.stringify(['id', '1.action', 'd']));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
3
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/disabled/page.jsx
vendored
Normal file
3
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/disabled/page.jsx
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from '../page';
|
||||
|
||||
export const experimental_ppr = false;
|
||||
7
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/layout.jsx
vendored
Normal file
7
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/layout.jsx
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function Layout({ children }) {
|
||||
return (
|
||||
<html>
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
17
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/page.jsx
vendored
Normal file
17
packages/next/test/fixtures/00-app-dir-incremental-ppr/app/page.jsx
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { unstable_noStore } from 'next/cache';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
export const experimental_ppr = true;
|
||||
|
||||
function Dynamic() {
|
||||
unstable_noStore();
|
||||
return <div id="sentinel:dynamic">Dynamic</div>;
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<Suspense fallback={<div id="sentinel:loading">Loading...</div>}>
|
||||
<Dynamic />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
13
packages/next/test/fixtures/00-app-dir-incremental-ppr/index.test.js
vendored
Normal file
13
packages/next/test/fixtures/00-app-dir-incremental-ppr/index.test.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* eslint-env jest */
|
||||
const path = require('path');
|
||||
const { deployAndTest } = require('../../utils');
|
||||
|
||||
const ctx = {};
|
||||
|
||||
// TODO: investigate invariant
|
||||
describe.skip(`${__dirname.split(path.sep).pop()}`, () => {
|
||||
it('should deploy and pass probe checks', async () => {
|
||||
const info = await deployAndTest(__dirname);
|
||||
Object.assign(ctx, info);
|
||||
});
|
||||
});
|
||||
5
packages/next/test/fixtures/00-app-dir-incremental-ppr/next.config.js
vendored
Normal file
5
packages/next/test/fixtures/00-app-dir-incremental-ppr/next.config.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
experimental: {
|
||||
ppr: 'incremental',
|
||||
},
|
||||
};
|
||||
8
packages/next/test/fixtures/00-app-dir-incremental-ppr/package.json
vendored
Normal file
8
packages/next/test/fixtures/00-app-dir-incremental-ppr/package.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
77
packages/next/test/fixtures/00-app-dir-incremental-ppr/vercel.json
vendored
Normal file
77
packages/next/test/fixtures/00-app-dir-incremental-ppr/vercel.json
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"builds": [
|
||||
{
|
||||
"src": "package.json",
|
||||
"use": "@vercel/next",
|
||||
"config": {
|
||||
"functions": {
|
||||
"app/**/*": {
|
||||
"maxDuration": 5,
|
||||
"memory": 512
|
||||
},
|
||||
"pages/api/**/*": {
|
||||
"maxDuration": 5,
|
||||
"memory": 512
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:loading"
|
||||
},
|
||||
{
|
||||
"path": "/",
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:dynamic"
|
||||
},
|
||||
{
|
||||
"path": "/",
|
||||
"headers": {
|
||||
"RSC": "1",
|
||||
"Next-Router-Prefetch": "1"
|
||||
},
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:loading",
|
||||
"mustNotContain": "sentinel:dynamic"
|
||||
},
|
||||
{
|
||||
"path": "/",
|
||||
"headers": {
|
||||
"RSC": "1"
|
||||
},
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:dynamic"
|
||||
},
|
||||
{
|
||||
"path": "/disabled",
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:loading"
|
||||
},
|
||||
{
|
||||
"path": "/disabled",
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:dynamic"
|
||||
},
|
||||
{
|
||||
"path": "/disabled",
|
||||
"headers": {
|
||||
"RSC": "1",
|
||||
"Next-Router-Prefetch": "1"
|
||||
},
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:dynamic"
|
||||
},
|
||||
{
|
||||
"path": "/disabled",
|
||||
"headers": {
|
||||
"RSC": "1"
|
||||
},
|
||||
"status": 200,
|
||||
"mustContain": "sentinel:dynamic"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/apple-icon.png
vendored
Normal file
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/apple-icon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/favicon.ico
vendored
Normal file
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/favicon.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/icon.png
vendored
Normal file
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/icon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -1,3 +1,7 @@
|
||||
export const metadata = {
|
||||
metadataBase: new URL(process.env.VERCEL_PROJECT_PRODUCTION_URL ?? 'http://localhost:3000'),
|
||||
};
|
||||
|
||||
export default function Root({ children }) {
|
||||
return (
|
||||
<html className="this-is-the-document-html">
|
||||
|
||||
1
packages/next/test/fixtures/00-app-dir-no-ppr/app/opengraph-image.alt
vendored
Normal file
1
packages/next/test/fixtures/00-app-dir-no-ppr/app/opengraph-image.alt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Alt text for opengraph-image
|
||||
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/opengraph-image.png
vendored
Normal file
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/opengraph-image.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 582 KiB |
2
packages/next/test/fixtures/00-app-dir-no-ppr/app/robots.txt
vendored
Normal file
2
packages/next/test/fixtures/00-app-dir-no-ppr/app/robots.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow:
|
||||
7
packages/next/test/fixtures/00-app-dir-no-ppr/app/sitemap.xml
vendored
Normal file
7
packages/next/test/fixtures/00-app-dir-no-ppr/app/sitemap.xml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://vercel.com/</loc>
|
||||
<lastmod>2023-03-06T18:04:14.008Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
1
packages/next/test/fixtures/00-app-dir-no-ppr/app/twitter-image.alt
vendored
Normal file
1
packages/next/test/fixtures/00-app-dir-no-ppr/app/twitter-image.alt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Alt text for twitter image
|
||||
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/twitter-image.png
vendored
Normal file
BIN
packages/next/test/fixtures/00-app-dir-no-ppr/app/twitter-image.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 582 KiB |
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.4.5",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "experimental",
|
||||
"react-dom": "experimental"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "canary",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
"react": "19.0.0-beta-4508873393-20240430",
|
||||
"react-dom": "19.0.0-beta-4508873393-20240430"
|
||||
},
|
||||
"ignoreNextjsUpdates": true
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user