Compare commits

..

2 Commits

Author SHA1 Message Date
Vercel Release Bot
13769106cb Version Packages (#10156)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@31.0.1

### Patch Changes

- Updated dependencies
\[[`aa734efc6`](aa734efc6c)]:
    -   @vercel/next@3.8.8

## @vercel/next@3.8.8

### Patch Changes

- [next] Ensure RSC paths handle basePath
([#10155](https://github.com/vercel/vercel/pull/10155))
2023-06-28 14:49:14 -07:00
JJ Kasper
aa734efc6c [next] Ensure RSC paths handle basePath (#10155)
This ensures we properly create the `.rsc` variant of outputs when `basePath` is configured and adds a regression test for this. 

x-ref: [slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1687944744404289)
Fixes: https://github.com/vercel/next.js/issues/48305
2023-06-28 21:00:43 +00:00
9 changed files with 254 additions and 6 deletions

View File

@@ -1,5 +1,12 @@
# vercel
## 31.0.1
### Patch Changes
- Updated dependencies [[`aa734efc6`](https://github.com/vercel/vercel/commit/aa734efc6c42badd4aa9bf64487904aa64e9bd49)]:
- @vercel/next@3.8.8
## 31.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "31.0.0",
"version": "31.0.1",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -35,7 +35,7 @@
"@vercel/build-utils": "6.8.0",
"@vercel/go": "2.5.1",
"@vercel/hydrogen": "0.0.64",
"@vercel/next": "3.8.7",
"@vercel/next": "3.8.8",
"@vercel/node": "2.15.3",
"@vercel/python": "3.1.60",
"@vercel/redwood": "1.1.15",

View File

@@ -1,2 +1,3 @@
/dist
test/builder-info.json
test/builder-info.json
test/fixtures/**/tmp-contents

View File

@@ -1,5 +1,11 @@
# @vercel/next
## 3.8.8
### Patch Changes
- [next] Ensure RSC paths handle basePath ([#10155](https://github.com/vercel/vercel/pull/10155))
## 3.8.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "3.8.7",
"version": "3.8.8",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",

View File

@@ -1198,7 +1198,11 @@ export async function serverBuild({
if (ogRoute.endsWith('/route')) {
continue;
}
route = path.posix.join('./', route === '/' ? '/index' : route);
route = path.posix.join(
'./',
entryDirectory,
route === '/' ? '/index' : route
);
if (lambdas[route]) {
lambdas[`${route}.rsc`] = lambdas[route];

View File

@@ -0,0 +1,32 @@
/* eslint-env jest */
const path = require('path');
const fs = require('fs-extra');
const { deployAndTest } = require('../../utils');
const ctx = {};
describe(`${__dirname.split(path.sep).pop()}`, () => {
const fixtureDir = path.join(__dirname, 'tmp-contents');
afterAll(() => fs.remove(fixtureDir));
it('should deploy and pass probe checks', async () => {
await fs.copy(path.join(__dirname, '../00-app-dir'), fixtureDir);
const nextConfigPath = path.join(fixtureDir, 'next.config.js');
await fs.writeFile(
nextConfigPath,
(
await fs.readFile(nextConfigPath, 'utf8')
).replace('experimental:', 'basePath: "/hello/world",experimental:')
);
await fs.copy(
path.join(__dirname, 'vercel.json'),
path.join(fixtureDir, 'vercel.json')
);
const info = await deployAndTest(fixtureDir);
Object.assign(ctx, info);
});
});

View File

@@ -0,0 +1,198 @@
{
"builds": [
{
"src": "package.json",
"use": "@vercel/next",
"config": {
"functions": {
"app/**/*": {
"maxDuration": 5,
"memory": 512
},
"pages/api/**/*": {
"maxDuration": 5,
"memory": 512
}
}
}
}
],
"probes": [
{
"path": "/hello/world/dashboard/hello",
"status": 200,
"mustContain": "hello from app/dashboard/rootonly/hello"
},
{
"path": "/hello/world/dashboard/another-edge",
"status": 200,
"mustContain": "hello from newroot/dashboard/another"
},
{
"path": "/hello/world/dynamic/category-1/id-1",
"status": 200,
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/hello/world/ssg",
"status": 200,
"mustContain": "hello from /ssg",
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
}
},
{
"path": "/hello/world/ssg",
"status": 200,
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
},
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/hello/world/ssg?override=1",
"status": 307,
"responseHeaders": {
"location": "/overridden/"
},
"fetchOptions": {
"redirect": "manual"
}
},
{
"path": "/hello/world/ssg?override=1",
"status": 307,
"responseHeaders": {
"location": "/overridden/"
},
"fetchOptions": {
"redirect": "manual"
}
},
{
"path": "/hello/world/dashboard/deployments/123/settings",
"status": 200,
"mustContain": "hello from app/dashboard/deployments/[id]/settings",
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
}
},
{
"path": "/hello/world/dashboard/deployments/123/settings",
"status": 200,
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
},
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/hello/world/dashboard/deployments/catchall/something",
"status": 200,
"mustContain": "catchall",
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
}
},
{
"path": "/hello/world/dashboard/deployments/catchall/something",
"status": 200,
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
},
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/hello/world/dashboard",
"status": 200,
"mustContain": "hello from app/dashboard",
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
}
},
{
"path": "/hello/world/dashboard",
"status": 200,
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/hello/world/dashboard",
"status": 200,
"headers": {
"RSC": "1"
},
"responseHeaders": {
"content-type": "text/x-component",
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
}
},
{
"path": "/hello/world/dashboard/another",
"status": 200,
"mustContain": "hello from newroot/dashboard/another"
},
{
"path": "/hello/world/dashboard/deployments/123",
"status": 200,
"mustContain": "hello from app/dashboard/deployments/[id]. ID is: <!-- -->123"
},
{
"path": "/hello/world/",
"status": 200,
"mustContain": "index app page"
},
{
"path": "/hello/world/blog/123",
"status": 200,
"mustContain": "hello from pages/blog/[slug]"
},
{
"path": "/hello/world/blog-ssr/123",
"status": 200,
"mustContain": "hello from pages/blog-ssr/[slug]"
},
{
"path": "/hello/world/blog-ssr/321",
"status": 200,
"mustContain": "hello context"
},
{
"path": "/hello/world/dynamic/category-1/id-1",
"status": 200,
"mustContain": "{&quot;category&quot;:&quot;category-1&quot;,&quot;id&quot;:&quot;id-1&quot;}"
},
{
"path": "/hello/world/dashboard/changelog",
"status": 200,
"mustContain": "hello from app/dashboard/changelog"
},
{
"path": "/hello/world/",
"status": 200,
"headers": {
"RSC": "1"
},
"mustContain": ":{",
"mustNotContain": "<html"
}
]
}

2
pnpm-lock.yaml generated
View File

@@ -323,7 +323,7 @@ importers:
specifier: 0.0.64
version: link:../hydrogen
'@vercel/next':
specifier: 3.8.7
specifier: 3.8.8
version: link:../next
'@vercel/node':
specifier: 2.15.3