Compare commits

..

5 Commits

Author SHA1 Message Date
Steven
40f38948a0 Publish Stable
- @vercel/build-utils@5.5.5
 - vercel@28.4.11
 - @vercel/client@12.2.13
 - @vercel/frameworks@1.1.8
 - @vercel/fs-detectors@3.4.5
 - @vercel/go@2.2.13
 - @vercel/hydrogen@0.0.26
 - @vercel/next@3.2.5
 - @vercel/node@2.5.25
 - @vercel/python@3.1.22
 - @vercel/redwood@1.0.31
 - @vercel/remix@1.0.32
 - @vercel/ruby@1.3.39
 - @vercel/static-build@1.0.32
2022-10-16 14:11:02 -04:00
Sean Massa
87eba56063 [node] update typescript detection message (#8727)
When deploying a project that uses typescript, but typescript is not a dependency, the default typescript is used. The message that's logged when this happens says:

> Using TypeScript 4.3.4 (no local tsconfig.json)

which is not necessarily true. You can have a `tsconfig.json` file with no typescript dependency.

This message leads to bad debugging paths.

This PR updates the message to be more specific. Now the message will say:

> Using TypeScript 4.3.4 (no local "typescript" package detected)
2022-10-14 21:31:13 +00:00
JJ Kasper
d0a5676c26 [next] Fix index rsc route handling (#8729)
### Related Issues

This ensures we probably route the `/` rsc route properly and adds a regression test along with enabling some now patched tests that were skipped. 

Fixes: [slack thread](https://vercel.slack.com/archives/C043ANYDB24/p1665746921485109)

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a reviewer
- [ ] Issue from task tracker has a link to this PR
2022-10-14 21:18:32 +00:00
Siarhei
da9fa997ed [tests] Update the checkout action to V3 in publish.yml (#8721) 2022-10-11 19:57:55 -04:00
Peter van der Zee
3d79a9d4d4 [build-utils] Cleanup getNodeVersion (#8720)
- `meta.isDev` is unconditionally read after the first check (even though it could technically still be `null`, ignoring typescript)
- `meta.isDev` is explicitly asserted to be falsy, since the first `if` will return early if it's truthy, so the later checks are all redundant
- added `?.` for the `packageJson?.engines?.node` read

The rest is auto formatting (and if my local eslint warnings are correct then I'm just gonna close this PR...)
2022-10-11 23:47:52 +00:00
27 changed files with 176 additions and 76 deletions

View File

@@ -18,7 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "5.5.4",
"version": "5.5.5",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -251,33 +251,24 @@ export async function getNodeVersion(
meta: Meta = {}
): Promise<NodeVersion> {
const latest = getLatestNodeVersion();
if (meta && meta.isDev) {
if (meta.isDev) {
// Use the system-installed version of `node` in PATH for `vercel dev`
return { ...latest, runtime: 'nodejs' };
}
const { packageJson } = await scanParentDirs(destPath, true);
let { nodeVersion } = config;
let isAuto = true;
if (packageJson && packageJson.engines && packageJson.engines.node) {
if (packageJson?.engines?.node) {
const { node } = packageJson.engines;
if (
nodeVersion &&
validRange(node) &&
!intersects(nodeVersion, node) &&
!meta.isDev
) {
if (nodeVersion && validRange(node) && !intersects(nodeVersion, node)) {
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`
);
} else if (coerce(node)?.raw === node && !meta.isDev) {
} else 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) &&
!meta.isDev
) {
} else if (validRange(node) && intersects(`${latest.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`
);

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "28.4.10",
"version": "28.4.11",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -41,16 +41,16 @@
"node": ">= 14"
},
"dependencies": {
"@vercel/build-utils": "5.5.4",
"@vercel/go": "2.2.12",
"@vercel/hydrogen": "0.0.25",
"@vercel/next": "3.2.4",
"@vercel/node": "2.5.24",
"@vercel/python": "3.1.21",
"@vercel/redwood": "1.0.30",
"@vercel/remix": "1.0.31",
"@vercel/ruby": "1.3.38",
"@vercel/static-build": "1.0.31",
"@vercel/build-utils": "5.5.5",
"@vercel/go": "2.2.13",
"@vercel/hydrogen": "0.0.26",
"@vercel/next": "3.2.5",
"@vercel/node": "2.5.25",
"@vercel/python": "3.1.22",
"@vercel/redwood": "1.0.31",
"@vercel/remix": "1.0.32",
"@vercel/ruby": "1.3.39",
"@vercel/static-build": "1.0.32",
"update-notifier": "5.1.0"
},
"devDependencies": {
@@ -95,9 +95,9 @@
"@types/which": "1.3.2",
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel/client": "12.2.12",
"@vercel/frameworks": "1.1.7",
"@vercel/fs-detectors": "3.4.4",
"@vercel/client": "12.2.13",
"@vercel/frameworks": "1.1.8",
"@vercel/fs-detectors": "3.4.5",
"@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0",
"@zeit/source-map-support": "0.6.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "12.2.12",
"version": "12.2.13",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -43,7 +43,7 @@
]
},
"dependencies": {
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/routing-utils": "2.0.2",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/frameworks",
"version": "1.1.7",
"version": "1.1.8",
"main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts",
"files": [

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "3.4.4",
"version": "3.4.5",
"description": "Vercel filesystem detectors",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -19,7 +19,7 @@
"test-unit": "yarn test"
},
"dependencies": {
"@vercel/frameworks": "1.1.7",
"@vercel/frameworks": "1.1.8",
"@vercel/routing-utils": "2.0.2",
"glob": "8.0.3",
"js-yaml": "4.1.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/go",
"version": "2.2.12",
"version": "2.2.13",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -35,7 +35,7 @@
"@types/jest": "28.1.6",
"@types/node-fetch": "^2.3.0",
"@types/tar": "^4.0.0",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/ncc": "0.24.0",
"async-retry": "1.3.1",
"execa": "^1.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/hydrogen",
"version": "0.0.25",
"version": "0.0.26",
"license": "MIT",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -21,7 +21,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "*",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"typescript": "4.6.4"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "3.2.4",
"version": "3.2.5",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -44,7 +44,7 @@
"@types/semver": "6.0.0",
"@types/text-table": "0.2.1",
"@types/webpack-sources": "3.2.0",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/nft": "0.22.1",
"@vercel/routing-utils": "2.0.2",
"async-sema": "3.0.1",

View File

@@ -1144,7 +1144,8 @@ export async function serverBuild({
if (lambdas[route]) {
lambdas[`${route}.rsc`] = lambdas[route];
} else if (edgeFunctions[route]) {
}
if (edgeFunctions[route]) {
edgeFunctions[`${route}.rsc`] = edgeFunctions[route];
}
}
@@ -1402,6 +1403,17 @@ export async function serverBuild({
...(appDir
? [
{
src: `^${path.posix.join('/', entryDirectory, '/')}`,
has: [
{
type: 'header',
key: '__rsc__',
},
],
dest: path.posix.join('/', entryDirectory, '/index.rsc'),
check: true,
},
{
src: `^${path.posix.join('/', entryDirectory, '/(.*)$')}`,
has: [
@@ -1635,6 +1647,18 @@ export async function serverBuild({
continue: true,
important: true,
},
...(appDir
? [
{
src: path.posix.join('/', entryDirectory, '/(.*).rsc$'),
headers: {
'content-type': 'application/octet-stream',
},
continue: true,
important: true,
},
]
: []),
// TODO: remove below workaround when `/` is allowed to be output
// different than `/index`

View File

@@ -0,0 +1,10 @@
export default function Root({ children }) {
return (
<html>
<head>
<title>test app</title>
</head>
<body>{children}</body>
</html>
);
}

View File

@@ -0,0 +1,12 @@
/* eslint-env jest */
const path = require('path');
const { deployAndTest } = require('../../utils');
const ctx = {};
describe(`${__dirname.split(path.sep).pop()}`, () => {
it('should deploy and pass probe checks', async () => {
const info = await deployAndTest(__dirname);
Object.assign(ctx, info);
});
});

View File

@@ -10,6 +10,49 @@
"path": "/edge",
"status": 200,
"mustContain": "edge"
},
{
"path": "/edge",
"status": 200,
"headers": {
"__rsc__": "1"
},
"mustContain": "M1:{",
"mustNotContain": "<html"
},
{
"path": "/edge",
"status": 200,
"headers": {
"__rsc__": "1"
},
"responseHeaders": {
"content-type": "application/octet-stream"
}
},
{
"path": "/",
"status": 200,
"mustContain": "page"
},
{
"path": "/",
"status": 200,
"headers": {
"__rsc__": "1"
},
"mustContain": "M1:{",
"mustNotContain": "<html"
},
{
"path": "/",
"status": 200,
"headers": {
"__rsc__": "1"
},
"responseHeaders": {
"content-type": "application/octet-stream"
}
}
]
}

View File

@@ -1,4 +1,4 @@
'client';
'use client';
import { useState, useEffect } from 'react';

View File

@@ -1,4 +1,4 @@
'client';
'use client';
import { useState, useEffect } from 'react';

View File

@@ -1,4 +1,4 @@
'client';
'use client';
export default function LazyComponent() {
return (

View File

@@ -1,11 +1,11 @@
'client';
'use client';
import { useState, lazy } from 'react';
const Lazy = lazy(() => import('./lazy.js'));
export function ClientComponent() {
let [state] = useState('client');
let [state] = useState('use client');
return (
<>
<Lazy />

View File

@@ -1,4 +1,4 @@
'client';
'use client';
export default function ShouldNotServeClientDotJs(props) {
return (

View File

@@ -20,18 +20,26 @@
"mustContain": "M1:{",
"mustNotContain": "<html"
},
{
"path": "/dashboard",
"status": 200,
"headers": {
"__rsc__": "1"
},
"responseHeaders": {
"content-type": "application/octet-stream"
}
},
{
"path": "/dashboard/another",
"status": 200,
"mustContain": "hello from newroot/dashboard/another"
},
// TODO: uncomment after this is fixed upstream
// x-ref: https://vercel.slack.com/archives/C035J346QQL/p1663820032810519?thread_ts=1663775935.504379&cid=C035J346QQL
// {
// "path": "/dashboard/deployments/123",
// "status": 200,
// "mustContain": "hello from app/dashboard/deployments/[id]. ID is: <!-- -->123"
// },
{
"path": "/dashboard/deployments/123",
"status": 200,
"mustContain": "hello from app/dashboard/deployments/[id]. ID is: <!-- -->123"
},
{
"path": "/",
"status": 200,
@@ -42,16 +50,24 @@
"status": 200,
"mustContain": "hello from pages/blog/[slug]"
},
// TODO: uncomment after this is fixed upstream
// {
// "path": "/dynamic/category-1/id-1",
// "status": 200,
// "mustContain": "{&quot;category&quot;:&quot;category-1&quot;,&quot;id&quot;:&quot;id-1&quot;}"
// },
{
"path": "/dynamic/category-1/id-1",
"status": 200,
"mustContain": "{&quot;category&quot;:&quot;category-1&quot;,&quot;id&quot;:&quot;id-1&quot;}"
},
{
"path": "/dashboard/changelog",
"status": 200,
"mustContain": "hello from app/dashboard/changelog"
},
{
"path": "/",
"status": 200,
"headers": {
"__rsc__": "1"
},
"mustContain": "M1:{",
"mustNotContain": "<html"
}
]
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "2.5.24",
"version": "2.5.25",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -31,7 +31,7 @@
"dependencies": {
"@edge-runtime/vm": "1.1.0-beta.36",
"@types/node": "*",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/node-bridge": "3.0.0",
"@vercel/static-config": "2.0.3",
"edge-runtime": "1.1.0-beta.38",

View File

@@ -141,9 +141,11 @@ export function register(opts: Options = {}): Register {
//eslint-disable-next-line @typescript-eslint/no-var-requires
const ts: typeof _ts = require_(compiler);
if (compiler.startsWith(nowNodeBase)) {
console.log('Using TypeScript ' + ts.version + ' (no local tsconfig.json)');
console.log(
`Using built-in TypeScript ${ts.version} since "typescript" missing from "devDependencies"`
);
} else {
console.log('Using TypeScript ' + ts.version + ' (local user-provided)');
console.log(`Using TypeScript ${ts.version} (local user-provided)`);
}
const transformers = options.transformers || undefined;
const readFile = options.readFile || ts.sys.readFile;

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/python",
"version": "3.1.21",
"version": "3.1.22",
"main": "./dist/index.js",
"license": "MIT",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -22,7 +22,7 @@
"devDependencies": {
"@types/execa": "^0.9.0",
"@types/jest": "27.4.1",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/ncc": "0.24.0",
"execa": "^1.0.0",
"typescript": "4.3.4"

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/redwood",
"version": "1.0.30",
"version": "1.0.31",
"main": "./dist/index.js",
"license": "MIT",
"homepage": "https://vercel.com/docs",
@@ -27,6 +27,6 @@
"@types/aws-lambda": "8.10.19",
"@types/node": "*",
"@types/semver": "6.0.0",
"@vercel/build-utils": "5.5.4"
"@vercel/build-utils": "5.5.5"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix",
"version": "1.0.31",
"version": "1.0.32",
"license": "MIT",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -25,7 +25,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "*",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"typescript": "4.6.4"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "@vercel/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "1.3.38",
"version": "1.3.39",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -22,7 +22,7 @@
"devDependencies": {
"@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0",
"@vercel/build-utils": "5.5.4",
"@vercel/build-utils": "5.5.5",
"@vercel/ncc": "0.24.0",
"execa": "2.0.4",
"fs-extra": "^7.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/static-build",
"version": "1.0.31",
"version": "1.0.32",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/build-step",
@@ -36,8 +36,8 @@
"@types/ms": "0.7.31",
"@types/node-fetch": "2.5.4",
"@types/promise-timeout": "1.3.0",
"@vercel/build-utils": "5.5.4",
"@vercel/frameworks": "1.1.7",
"@vercel/build-utils": "5.5.5",
"@vercel/frameworks": "1.1.8",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.0.2",
"fs-extra": "10.0.0",