mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-12 12:57:47 +00:00
Compare commits
7 Commits
@vercel/py
...
@vercel/ru
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e3381c6d | ||
|
|
33aefdc029 | ||
|
|
30fe76a0cf | ||
|
|
97ef88dc28 | ||
|
|
f679098d7a | ||
|
|
2b57e12ad3 | ||
|
|
c4e94ad03f |
@@ -35,6 +35,6 @@ For details on how to use Vercel, check out our [documentation](https://vercel.c
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
- [Code of Conduct](https://github.com/vercel/vercel/blob/main/.github/CODE_OF_CONDUCT.md)
|
- [Code of Conduct](./.github/CODE_OF_CONDUCT.md)
|
||||||
- [Contributing Guidelines](https://github.com/vercel/vercel/blob/main/.github/CONTRIBUTING.md)
|
- [Contributing Guidelines](./.github/CONTRIBUTING.md)
|
||||||
- [MIT License](https://github.com/vercel/vercel/blob/main/LICENSE)
|
- [MIT License](./LICENSE)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "5.2.0",
|
"version": "5.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.js",
|
"types": "./dist/index.d.js",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const allOptions = [
|
|||||||
major: 12,
|
major: 12,
|
||||||
range: '12.x',
|
range: '12.x',
|
||||||
runtime: 'nodejs12.x',
|
runtime: 'nodejs12.x',
|
||||||
discontinueDate: new Date('2022-08-09'),
|
discontinueDate: new Date('2022-10-01'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
major: 10,
|
major: 10,
|
||||||
|
|||||||
32
packages/build-utils/src/get-prefixed-env-vars.ts
Normal file
32
packages/build-utils/src/get-prefixed-env-vars.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
type Envs = { [key: string]: string | undefined };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the framework-specific prefixed System Environment Variables.
|
||||||
|
* See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
|
||||||
|
* @param envPrefix - Prefix, typically from `@vercel/frameworks`
|
||||||
|
* @param envs - Environment Variables, typically from `process.env`
|
||||||
|
*/
|
||||||
|
export function getPrefixedEnvVars({
|
||||||
|
envPrefix,
|
||||||
|
envs,
|
||||||
|
}: {
|
||||||
|
envPrefix: string | undefined;
|
||||||
|
envs: Envs;
|
||||||
|
}): Envs {
|
||||||
|
const vercelSystemEnvPrefix = 'VERCEL_';
|
||||||
|
const newEnvs: Envs = {};
|
||||||
|
if (envPrefix && envs.VERCEL_URL) {
|
||||||
|
Object.keys(envs)
|
||||||
|
.filter(key => key.startsWith(vercelSystemEnvPrefix))
|
||||||
|
.forEach(key => {
|
||||||
|
const newKey = `${envPrefix}${key}`;
|
||||||
|
if (!(newKey in envs)) {
|
||||||
|
newEnvs[newKey] = envs[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Tell turbo to exclude all Vercel System Env Vars
|
||||||
|
// See https://github.com/vercel/turborepo/pull/1622
|
||||||
|
newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
|
||||||
|
}
|
||||||
|
return newEnvs;
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ import streamToBuffer from './fs/stream-to-buffer';
|
|||||||
import debug from './debug';
|
import debug from './debug';
|
||||||
import getIgnoreFilter from './get-ignore-filter';
|
import getIgnoreFilter from './get-ignore-filter';
|
||||||
import { getPlatformEnv } from './get-platform-env';
|
import { getPlatformEnv } from './get-platform-env';
|
||||||
|
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
FileBlob,
|
FileBlob,
|
||||||
@@ -76,6 +77,7 @@ export {
|
|||||||
getDiscontinuedNodeVersions,
|
getDiscontinuedNodeVersions,
|
||||||
getSpawnOptions,
|
getSpawnOptions,
|
||||||
getPlatformEnv,
|
getPlatformEnv,
|
||||||
|
getPrefixedEnvVars,
|
||||||
streamToBuffer,
|
streamToBuffer,
|
||||||
debug,
|
debug,
|
||||||
isSymbolicLink,
|
isSymbolicLink,
|
||||||
|
|||||||
87
packages/build-utils/test/unit.get-prefixed-env-vars.test.ts
vendored
Normal file
87
packages/build-utils/test/unit.get-prefixed-env-vars.test.ts
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { getPrefixedEnvVars } from '../src';
|
||||||
|
|
||||||
|
describe('Test `getPrefixedEnvVars()`', () => {
|
||||||
|
const cases: Array<{
|
||||||
|
name: string;
|
||||||
|
args: Parameters<typeof getPrefixedEnvVars>[0];
|
||||||
|
want: ReturnType<typeof getPrefixedEnvVars>;
|
||||||
|
}> = [
|
||||||
|
{
|
||||||
|
name: 'should work with NEXT_PUBLIC_',
|
||||||
|
args: {
|
||||||
|
envPrefix: 'NEXT_PUBLIC_',
|
||||||
|
envs: {
|
||||||
|
VERCEL: '1',
|
||||||
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
|
FOO: 'bar',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {
|
||||||
|
NEXT_PUBLIC_VERCEL_URL: 'example.vercel.sh',
|
||||||
|
TURBO_CI_VENDOR_ENV_KEY: 'NEXT_PUBLIC_VERCEL_',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'should work with GATSBY_',
|
||||||
|
args: {
|
||||||
|
envPrefix: 'GATSBY_',
|
||||||
|
envs: {
|
||||||
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
|
FOO: 'bar',
|
||||||
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
|
VERCEL_ENV: 'production',
|
||||||
|
VERCEL_REGION: 'iad1',
|
||||||
|
VERCEL_GIT_COMMIT_AUTHOR_LOGIN: 'rauchg',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {
|
||||||
|
GATSBY_VERCEL_URL: 'example.vercel.sh',
|
||||||
|
GATSBY_VERCEL_ENV: 'production',
|
||||||
|
GATSBY_VERCEL_REGION: 'iad1',
|
||||||
|
GATSBY_VERCEL_GIT_COMMIT_AUTHOR_LOGIN: 'rauchg',
|
||||||
|
TURBO_CI_VENDOR_ENV_KEY: 'GATSBY_VERCEL_',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'should not return anything if no system env vars detected',
|
||||||
|
args: {
|
||||||
|
envPrefix: 'GATSBY_',
|
||||||
|
envs: {
|
||||||
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
|
FOO: 'bar',
|
||||||
|
BLARG_VERCEL_THING: 'fake',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'should not return anything if envPrefix is empty string',
|
||||||
|
args: {
|
||||||
|
envPrefix: '',
|
||||||
|
envs: {
|
||||||
|
VERCEL: '1',
|
||||||
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'should not return anything if envPrefix is undefined',
|
||||||
|
args: {
|
||||||
|
envPrefix: undefined,
|
||||||
|
envs: {
|
||||||
|
VERCEL: '1',
|
||||||
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const { name, args, want } of cases) {
|
||||||
|
it(name, () => {
|
||||||
|
expect(getPrefixedEnvVars(args)).toEqual(want);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
6
packages/build-utils/test/unit.test.ts
vendored
6
packages/build-utils/test/unit.test.ts
vendored
@@ -394,7 +394,7 @@ it('should get latest node version', async () => {
|
|||||||
it('should throw for discontinued versions', async () => {
|
it('should throw for discontinued versions', async () => {
|
||||||
// Mock a future date so that Node 8 and 10 become discontinued
|
// Mock a future date so that Node 8 and 10 become discontinued
|
||||||
const realDateNow = Date.now.bind(global.Date);
|
const realDateNow = Date.now.bind(global.Date);
|
||||||
global.Date.now = () => new Date('2022-09-01').getTime();
|
global.Date.now = () => new Date('2022-10-15').getTime();
|
||||||
|
|
||||||
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
|
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
|
||||||
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
|
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
|
||||||
@@ -436,8 +436,8 @@ it('should warn for deprecated versions, soon to be discontinued', async () => {
|
|||||||
expect(warningMessages).toStrictEqual([
|
expect(warningMessages).toStrictEqual([
|
||||||
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16.',
|
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16.',
|
||||||
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16.',
|
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16.',
|
||||||
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-08-09 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16.',
|
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-01 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16.',
|
||||||
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-08-09 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16.',
|
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-01 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
global.Date.now = realDateNow;
|
global.Date.now = realDateNow;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vercel",
|
"name": "vercel",
|
||||||
"version": "27.3.7",
|
"version": "27.3.8",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"description": "The command-line interface for Vercel",
|
"description": "The command-line interface for Vercel",
|
||||||
@@ -41,16 +41,16 @@
|
|||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/go": "2.0.15",
|
"@vercel/go": "2.0.16",
|
||||||
"@vercel/hydrogen": "0.0.12",
|
"@vercel/hydrogen": "0.0.13",
|
||||||
"@vercel/next": "3.1.15",
|
"@vercel/next": "3.1.16",
|
||||||
"@vercel/node": "2.5.6",
|
"@vercel/node": "2.5.7",
|
||||||
"@vercel/python": "3.1.7",
|
"@vercel/python": "3.1.8",
|
||||||
"@vercel/redwood": "1.0.16",
|
"@vercel/redwood": "1.0.17",
|
||||||
"@vercel/remix": "1.0.17",
|
"@vercel/remix": "1.0.18",
|
||||||
"@vercel/ruby": "1.3.23",
|
"@vercel/ruby": "1.3.24",
|
||||||
"@vercel/static-build": "1.0.16",
|
"@vercel/static-build": "1.0.17",
|
||||||
"update-notifier": "5.1.0"
|
"update-notifier": "5.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
"@types/which": "1.3.2",
|
"@types/which": "1.3.2",
|
||||||
"@types/write-json-file": "2.2.1",
|
"@types/write-json-file": "2.2.1",
|
||||||
"@types/yauzl-promise": "2.1.0",
|
"@types/yauzl-promise": "2.1.0",
|
||||||
"@vercel/client": "12.1.10",
|
"@vercel/client": "12.1.11",
|
||||||
"@vercel/frameworks": "1.1.3",
|
"@vercel/frameworks": "1.1.3",
|
||||||
"@vercel/fs-detectors": "2.0.5",
|
"@vercel/fs-detectors": "2.0.5",
|
||||||
"@vercel/fun": "1.0.4",
|
"@vercel/fun": "1.0.4",
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export default async function main(client: Client): Promise<number> {
|
|||||||
client.output.print(
|
client.output.print(
|
||||||
`No Project Settings found locally. Run ${cli.getCommandName(
|
`No Project Settings found locally. Run ${cli.getCommandName(
|
||||||
'pull --yes'
|
'pull --yes'
|
||||||
)} to retreive them.`
|
)} to retrieve them.`
|
||||||
);
|
);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ export default async function dev(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let devCommand: string | undefined;
|
let devCommand: string | undefined;
|
||||||
let frameworkSlug: string | undefined;
|
|
||||||
let projectSettings: ProjectSettings | undefined;
|
let projectSettings: ProjectSettings | undefined;
|
||||||
let projectEnvs: ProjectEnvVariable[] = [];
|
let projectEnvs: ProjectEnvVariable[] = [];
|
||||||
let systemEnvValues: string[] = [];
|
let systemEnvValues: string[] = [];
|
||||||
@@ -77,10 +76,6 @@ export default async function dev(
|
|||||||
const framework = frameworks.find(f => f.slug === project.framework);
|
const framework = frameworks.find(f => f.slug === project.framework);
|
||||||
|
|
||||||
if (framework) {
|
if (framework) {
|
||||||
if (framework.slug) {
|
|
||||||
frameworkSlug = framework.slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaults = framework.settings.devCommand.value;
|
const defaults = framework.settings.devCommand.value;
|
||||||
if (defaults) {
|
if (defaults) {
|
||||||
devCommand = defaults;
|
devCommand = defaults;
|
||||||
@@ -120,7 +115,6 @@ export default async function dev(
|
|||||||
const devServer = new DevServer(cwd, {
|
const devServer = new DevServer(cwd, {
|
||||||
output,
|
output,
|
||||||
devCommand,
|
devCommand,
|
||||||
frameworkSlug,
|
|
||||||
projectSettings,
|
projectSettings,
|
||||||
projectEnvs,
|
projectEnvs,
|
||||||
systemEnvValues,
|
systemEnvValues,
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ export default class DevServer {
|
|||||||
public output: Output;
|
public output: Output;
|
||||||
public proxy: httpProxy;
|
public proxy: httpProxy;
|
||||||
public envConfigs: EnvConfigs;
|
public envConfigs: EnvConfigs;
|
||||||
public frameworkSlug?: string;
|
|
||||||
public files: BuilderInputs;
|
public files: BuilderInputs;
|
||||||
public address: string;
|
public address: string;
|
||||||
public devCacheDir: string;
|
public devCacheDir: string;
|
||||||
@@ -175,7 +174,6 @@ export default class DevServer {
|
|||||||
this.address = '';
|
this.address = '';
|
||||||
this.devCommand = options.devCommand;
|
this.devCommand = options.devCommand;
|
||||||
this.projectSettings = options.projectSettings;
|
this.projectSettings = options.projectSettings;
|
||||||
this.frameworkSlug = options.frameworkSlug;
|
|
||||||
this.caseSensitive = false;
|
this.caseSensitive = false;
|
||||||
this.apiDir = null;
|
this.apiDir = null;
|
||||||
this.apiExtensions = new Set();
|
this.apiExtensions = new Set();
|
||||||
@@ -2210,7 +2208,10 @@ export default class DevServer {
|
|||||||
// Because of child process 'pipe' below, isTTY will be false.
|
// Because of child process 'pipe' below, isTTY will be false.
|
||||||
// Most frameworks use `chalk`/`supports-color` so we enable it anyway.
|
// Most frameworks use `chalk`/`supports-color` so we enable it anyway.
|
||||||
FORCE_COLOR: process.stdout.isTTY ? '1' : '0',
|
FORCE_COLOR: process.stdout.isTTY ? '1' : '0',
|
||||||
...(this.frameworkSlug === 'create-react-app' ? { BROWSER: 'none' } : {}),
|
// Prevent framework dev servers from automatically opening a web
|
||||||
|
// browser window, since it will not be the port that `vc dev`
|
||||||
|
// is listening on and thus will be missing Vercel features.
|
||||||
|
BROWSER: 'none',
|
||||||
...process.env,
|
...process.env,
|
||||||
...this.envConfigs.allEnv,
|
...this.envConfigs.allEnv,
|
||||||
PORT: `${port}`,
|
PORT: `${port}`,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export { VercelConfig };
|
|||||||
export interface DevServerOptions {
|
export interface DevServerOptions {
|
||||||
output: Output;
|
output: Output;
|
||||||
devCommand?: string;
|
devCommand?: string;
|
||||||
frameworkSlug?: string;
|
|
||||||
projectSettings?: ProjectSettings;
|
projectSettings?: ProjectSettings;
|
||||||
systemEnvValues?: string[];
|
systemEnvValues?: string[];
|
||||||
projectEnvs?: ProjectEnvVariable[];
|
projectEnvs?: ProjectEnvVariable[];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/client",
|
"name": "@vercel/client",
|
||||||
"version": "12.1.10",
|
"version": "12.1.11",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"homepage": "https://vercel.com",
|
"homepage": "https://vercel.com",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/routing-utils": "2.0.2",
|
"@vercel/routing-utils": "2.0.2",
|
||||||
"@zeit/fetch": "5.2.0",
|
"@zeit/fetch": "5.2.0",
|
||||||
"async-retry": "1.2.3",
|
"async-retry": "1.2.3",
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ type UndoFileAction = {
|
|||||||
to: string | undefined;
|
to: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type UndoFunctionRename = {
|
||||||
|
fsPath: string;
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
};
|
||||||
|
|
||||||
export const version = 3;
|
export const version = 3;
|
||||||
|
|
||||||
export async function build({
|
export async function build({
|
||||||
@@ -109,6 +115,7 @@ export async function build({
|
|||||||
// in order to undo the action, not what the original action was
|
// in order to undo the action, not what the original action was
|
||||||
const undoFileActions: UndoFileAction[] = [];
|
const undoFileActions: UndoFileAction[] = [];
|
||||||
const undoDirectoryCreation: string[] = [];
|
const undoDirectoryCreation: string[] = [];
|
||||||
|
const undoFunctionRenames: UndoFunctionRename[] = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (process.env.GIT_CREDENTIALS) {
|
if (process.env.GIT_CREDENTIALS) {
|
||||||
@@ -128,6 +135,7 @@ export async function build({
|
|||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const originalEntrypointAbsolute = join(workPath, entrypoint);
|
||||||
const renamedEntrypoint = getRenamedEntrypoint(entrypoint);
|
const renamedEntrypoint = getRenamedEntrypoint(entrypoint);
|
||||||
if (renamedEntrypoint) {
|
if (renamedEntrypoint) {
|
||||||
await move(join(workPath, entrypoint), join(workPath, renamedEntrypoint));
|
await move(join(workPath, entrypoint), join(workPath, renamedEntrypoint));
|
||||||
@@ -245,10 +253,21 @@ export async function build({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlerFunctionName = parsedAnalyzed.functionName;
|
const originalFunctionName = parsedAnalyzed.functionName;
|
||||||
debug(
|
const handlerFunctionName = getNewHandlerFunctionName(
|
||||||
`Found exported function "${handlerFunctionName}" in "${entrypoint}"`
|
originalFunctionName,
|
||||||
|
entrypoint
|
||||||
);
|
);
|
||||||
|
await renameHandlerFunction(
|
||||||
|
entrypointAbsolute,
|
||||||
|
originalFunctionName,
|
||||||
|
handlerFunctionName
|
||||||
|
);
|
||||||
|
undoFunctionRenames.push({
|
||||||
|
fsPath: originalEntrypointAbsolute,
|
||||||
|
from: handlerFunctionName,
|
||||||
|
to: originalFunctionName,
|
||||||
|
});
|
||||||
|
|
||||||
if (!isGoModExist) {
|
if (!isGoModExist) {
|
||||||
if (await pathExists(join(workPath, 'vendor'))) {
|
if (await pathExists(join(workPath, 'vendor'))) {
|
||||||
@@ -501,7 +520,11 @@ export async function build({
|
|||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
await cleanupFileSystem(undoFileActions, undoDirectoryCreation);
|
await cleanupFileSystem(
|
||||||
|
undoFileActions,
|
||||||
|
undoDirectoryCreation,
|
||||||
|
undoFunctionRenames
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Build cleanup failed: ${error.message}`);
|
console.log(`Build cleanup failed: ${error.message}`);
|
||||||
debug('Cleanup Error: ' + error);
|
debug('Cleanup Error: ' + error);
|
||||||
@@ -509,9 +532,47 @@ export async function build({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function renameHandlerFunction(fsPath: string, from: string, to: string) {
|
||||||
|
let fileContents = await readFile(fsPath, 'utf8');
|
||||||
|
|
||||||
|
const fromRegex = new RegExp(`\\b${from}\\b`, 'g');
|
||||||
|
fileContents = fileContents.replace(fromRegex, to);
|
||||||
|
|
||||||
|
await writeFile(fsPath, fileContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getNewHandlerFunctionName(
|
||||||
|
originalFunctionName: string,
|
||||||
|
entrypoint: string
|
||||||
|
) {
|
||||||
|
if (!originalFunctionName) {
|
||||||
|
throw new Error(
|
||||||
|
'Handler function renaming failed because original function name was empty.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entrypoint) {
|
||||||
|
throw new Error(
|
||||||
|
'Handler function renaming failed because entrypoint was empty.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug(`Found exported function "${originalFunctionName}" in "${entrypoint}"`);
|
||||||
|
|
||||||
|
const pathSlug = entrypoint.replace(/(\s|\\|\/|\]|\[|-|\.)/g, '_');
|
||||||
|
|
||||||
|
const newHandlerName = `${originalFunctionName}_${pathSlug}`;
|
||||||
|
debug(
|
||||||
|
`Renaming handler function temporarily from "${originalFunctionName}" to "${newHandlerName}"`
|
||||||
|
);
|
||||||
|
|
||||||
|
return newHandlerName;
|
||||||
|
}
|
||||||
|
|
||||||
async function cleanupFileSystem(
|
async function cleanupFileSystem(
|
||||||
undoFileActions: UndoFileAction[],
|
undoFileActions: UndoFileAction[],
|
||||||
undoDirectoryCreation: string[]
|
undoDirectoryCreation: string[],
|
||||||
|
undoFunctionRenames: UndoFunctionRename[]
|
||||||
) {
|
) {
|
||||||
// we have to undo the actions in reverse order in cases
|
// we have to undo the actions in reverse order in cases
|
||||||
// where one file was moved multiple times, which happens
|
// where one file was moved multiple times, which happens
|
||||||
@@ -524,6 +585,12 @@ async function cleanupFileSystem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// after files are moved back, we can undo function renames
|
||||||
|
// these reference the original file location
|
||||||
|
for (const rename of undoFunctionRenames) {
|
||||||
|
await renameHandlerFunction(rename.fsPath, rename.from, rename.to);
|
||||||
|
}
|
||||||
|
|
||||||
const undoDirectoryPromises = undoDirectoryCreation.map(async directory => {
|
const undoDirectoryPromises = undoDirectoryCreation.map(async directory => {
|
||||||
const contents = await readdir(directory);
|
const contents = await readdir(directory);
|
||||||
// only delete an empty directory
|
// only delete an empty directory
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/go",
|
"name": "@vercel/go",
|
||||||
"version": "2.0.15",
|
"version": "2.0.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
||||||
@@ -17,14 +17,25 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
"jest": {
|
||||||
|
"preset": "ts-jest",
|
||||||
|
"testEnvironment": "node",
|
||||||
|
"globals": {
|
||||||
|
"ts-jest": {
|
||||||
|
"diagnostics": true,
|
||||||
|
"isolatedModules": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tootallnate/once": "1.1.2",
|
"@tootallnate/once": "1.1.2",
|
||||||
"@types/async-retry": "1.4.2",
|
"@types/async-retry": "1.4.2",
|
||||||
"@types/execa": "^0.9.0",
|
"@types/execa": "^0.9.0",
|
||||||
"@types/fs-extra": "^5.0.5",
|
"@types/fs-extra": "^5.0.5",
|
||||||
|
"@types/jest": "28.1.6",
|
||||||
"@types/node-fetch": "^2.3.0",
|
"@types/node-fetch": "^2.3.0",
|
||||||
"@types/tar": "^4.0.0",
|
"@types/tar": "^4.0.0",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"async-retry": "1.3.1",
|
"async-retry": "1.3.1",
|
||||||
"execa": "^1.0.0",
|
"execa": "^1.0.0",
|
||||||
|
|||||||
12
packages/go/test/fixtures/21-func-conflicts/dupe-handler.go
vendored
Normal file
12
packages/go/test/fixtures/21-func-conflicts/dupe-handler.go
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// "Handler" conflicts with the other files' exported function,
|
||||||
|
// but should still work
|
||||||
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "from dupe-handler.go")
|
||||||
|
}
|
||||||
3
packages/go/test/fixtures/21-func-conflicts/go.mod
vendored
Normal file
3
packages/go/test/fixtures/21-func-conflicts/go.mod
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module go-mod
|
||||||
|
|
||||||
|
go 1.15
|
||||||
11
packages/go/test/fixtures/21-func-conflicts/index.go
vendored
Normal file
11
packages/go/test/fixtures/21-func-conflicts/index.go
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Handler func
|
||||||
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "from index.go")
|
||||||
|
}
|
||||||
12
packages/go/test/fixtures/21-func-conflicts/other-package.go
vendored
Normal file
12
packages/go/test/fixtures/21-func-conflicts/other-package.go
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package other
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// "Handler" conflicts with the other files' exported function,
|
||||||
|
// but not in the same package
|
||||||
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "from other-package.go")
|
||||||
|
}
|
||||||
11
packages/go/test/fixtures/21-func-conflicts/sub/one.go
vendored
Normal file
11
packages/go/test/fixtures/21-func-conflicts/sub/one.go
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// "Handler" conflicts with the other files' exported function
|
||||||
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "from /sub/one.go")
|
||||||
|
}
|
||||||
11
packages/go/test/fixtures/21-func-conflicts/sub/two.go
vendored
Normal file
11
packages/go/test/fixtures/21-func-conflicts/sub/two.go
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// "Handler" conflicts with the other files' exported function
|
||||||
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "from /sub/two.go")
|
||||||
|
}
|
||||||
11
packages/go/test/fixtures/21-func-conflicts/vercel.json
vendored
Normal file
11
packages/go/test/fixtures/21-func-conflicts/vercel.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"builds": [{ "src": "**/*.go", "use": "@vercel/go" }],
|
||||||
|
"probes": [
|
||||||
|
{ "path": "/", "mustContain": "from index.go" },
|
||||||
|
{ "path": "/dupe-handler.go", "mustContain": "from dupe-handler.go" },
|
||||||
|
{ "path": "/other-package.go", "mustContain": "from other-package.go" },
|
||||||
|
{ "path": "/sub/one.go", "mustContain": "from /sub/one.go" },
|
||||||
|
{ "path": "/sub/two.go", "mustContain": "from /sub/two.go" }
|
||||||
|
]
|
||||||
|
}
|
||||||
92
packages/go/test/index.test.ts
vendored
Normal file
92
packages/go/test/index.test.ts
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import { getNewHandlerFunctionName } from '../index';
|
||||||
|
|
||||||
|
describe('getNewHandlerFunctionName', function () {
|
||||||
|
it('does nothing with empty original function name', async () => {
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
getNewHandlerFunctionName('', 'some/kind-of-file.js');
|
||||||
|
} catch (err) {
|
||||||
|
error = err;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeDefined();
|
||||||
|
expect(error.message).toEqual(
|
||||||
|
'Handler function renaming failed because original function name was empty.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does nothing with empty original function name', async () => {
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
getNewHandlerFunctionName('Handler', '');
|
||||||
|
} catch (err) {
|
||||||
|
error = err;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeDefined();
|
||||||
|
expect(error.message).toEqual(
|
||||||
|
'Handler function renaming failed because entrypoint was empty.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with back slashes in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'some\\file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_some_file_js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with forward slashes in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'some/file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_some_file_js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with dashes in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'kind-of-file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_kind_of_file_js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with dashes in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'kind-of-file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_kind_of_file_js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with brackets in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'[segment].js'
|
||||||
|
);
|
||||||
|
// this expects two underscores on each side intentionally
|
||||||
|
// left (1): there's an added separator between original function name and slug;
|
||||||
|
// left (2): the opening bracket is replaced
|
||||||
|
// right (1): the closing bracket is replaced
|
||||||
|
// right (2): the period is replaced
|
||||||
|
expect(newFunctionName).toEqual('Handler__segment__js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with space in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'kind of file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_kind_of_file_js');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates slug with periods in file path', async () => {
|
||||||
|
const newFunctionName = getNewHandlerFunctionName(
|
||||||
|
'Handler',
|
||||||
|
'kind.of.file.js'
|
||||||
|
);
|
||||||
|
expect(newFunctionName).toEqual('Handler_kind_of_file_js');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitThis": false,
|
"noImplicitThis": false,
|
||||||
"types": ["node"],
|
"types": ["node", "jest"],
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ES2020"
|
"target": "ES2020"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/hydrogen",
|
"name": "@vercel/hydrogen",
|
||||||
"version": "0.0.12",
|
"version": "0.0.13",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"homepage": "https://vercel.com/docs",
|
"homepage": "https://vercel.com/docs",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "27.5.1",
|
"@types/jest": "27.5.1",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"typescript": "4.6.4"
|
"typescript": "4.6.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/next",
|
"name": "@vercel/next",
|
||||||
"version": "3.1.15",
|
"version": "3.1.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@types/text-table": "0.2.1",
|
"@types/text-table": "0.2.1",
|
||||||
"@types/webpack-sources": "3.2.0",
|
"@types/webpack-sources": "3.2.0",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/nft": "0.21.0",
|
"@vercel/nft": "0.21.0",
|
||||||
"@vercel/routing-utils": "2.0.2",
|
"@vercel/routing-utils": "2.0.2",
|
||||||
"async-sema": "3.0.1",
|
"async-sema": "3.0.1",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
download,
|
download,
|
||||||
getLambdaOptionsFromFunction,
|
getLambdaOptionsFromFunction,
|
||||||
getNodeVersion,
|
getNodeVersion,
|
||||||
|
getPrefixedEnvVars,
|
||||||
getSpawnOptions,
|
getSpawnOptions,
|
||||||
getScriptName,
|
getScriptName,
|
||||||
glob,
|
glob,
|
||||||
@@ -224,15 +225,15 @@ export const build: BuildV2 = async ({
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.keys(process.env)
|
const prefixedEnvs = getPrefixedEnvVars({
|
||||||
.filter(key => key.startsWith('VERCEL_'))
|
envPrefix: 'NEXT_PUBLIC_',
|
||||||
.forEach(key => {
|
envs: process.env,
|
||||||
const newKey = `NEXT_PUBLIC_${key}`;
|
|
||||||
if (!(newKey in process.env)) {
|
|
||||||
process.env[newKey] = process.env[key];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(prefixedEnvs)) {
|
||||||
|
process.env[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
await download(files, workPath, meta);
|
await download(files, workPath, meta);
|
||||||
|
|
||||||
if (config.rootDirectory) {
|
if (config.rootDirectory) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/node",
|
"name": "@vercel/node",
|
||||||
"version": "2.5.6",
|
"version": "2.5.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@edge-runtime/vm": "1.1.0-beta.23",
|
"@edge-runtime/vm": "1.1.0-beta.23",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/node-bridge": "3.0.0",
|
"@vercel/node-bridge": "3.0.0",
|
||||||
"@vercel/static-config": "2.0.3",
|
"@vercel/static-config": "2.0.3",
|
||||||
"edge-runtime": "1.1.0-beta.23",
|
"edge-runtime": "1.1.0-beta.23",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/python",
|
"name": "@vercel/python",
|
||||||
"version": "3.1.7",
|
"version": "3.1.8",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/execa": "^0.9.0",
|
"@types/execa": "^0.9.0",
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.4.1",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"execa": "^1.0.0",
|
"execa": "^1.0.0",
|
||||||
"typescript": "4.3.4"
|
"typescript": "4.3.4"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/redwood",
|
"name": "@vercel/redwood",
|
||||||
"version": "1.0.16",
|
"version": "1.0.17",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://vercel.com/docs",
|
"homepage": "https://vercel.com/docs",
|
||||||
@@ -27,6 +27,6 @@
|
|||||||
"@types/aws-lambda": "8.10.19",
|
"@types/aws-lambda": "8.10.19",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@vercel/build-utils": "5.2.0"
|
"@vercel/build-utils": "5.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
glob,
|
glob,
|
||||||
debug,
|
debug,
|
||||||
getNodeVersion,
|
getNodeVersion,
|
||||||
|
getPrefixedEnvVars,
|
||||||
getSpawnOptions,
|
getSpawnOptions,
|
||||||
runNpmInstall,
|
runNpmInstall,
|
||||||
runPackageJsonScript,
|
runPackageJsonScript,
|
||||||
@@ -54,15 +55,15 @@ export const build: BuildV2 = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
await download(files, workPath, meta);
|
await download(files, workPath, meta);
|
||||||
|
|
||||||
Object.keys(process.env)
|
const prefixedEnvs = getPrefixedEnvVars({
|
||||||
.filter(key => key.startsWith('VERCEL_'))
|
envPrefix: 'REDWOOD_ENV_',
|
||||||
.forEach(key => {
|
envs: process.env,
|
||||||
const newKey = `REDWOOD_ENV_${key}`;
|
|
||||||
if (!(newKey in process.env)) {
|
|
||||||
process.env[newKey] = process.env[key];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(prefixedEnvs)) {
|
||||||
|
process.env[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
const { installCommand, buildCommand } = config;
|
const { installCommand, buildCommand } = config;
|
||||||
const mountpoint = dirname(entrypoint);
|
const mountpoint = dirname(entrypoint);
|
||||||
const entrypointFsDirname = join(workPath, mountpoint);
|
const entrypointFsDirname = join(workPath, mountpoint);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/remix",
|
"name": "@vercel/remix",
|
||||||
"version": "1.0.17",
|
"version": "1.0.18",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"homepage": "https://vercel.com/docs",
|
"homepage": "https://vercel.com/docs",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "27.5.1",
|
"@types/jest": "27.5.1",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"typescript": "4.6.4"
|
"typescript": "4.6.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/ruby",
|
"name": "@vercel/ruby",
|
||||||
"author": "Nathan Cahill <nathan@nathancahill.com>",
|
"author": "Nathan Cahill <nathan@nathancahill.com>",
|
||||||
"version": "1.3.23",
|
"version": "1.3.24",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "8.0.0",
|
"@types/fs-extra": "8.0.0",
|
||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"execa": "2.0.4",
|
"execa": "2.0.4",
|
||||||
"fs-extra": "^7.0.1",
|
"fs-extra": "^7.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/static-build",
|
"name": "@vercel/static-build",
|
||||||
"version": "1.0.16",
|
"version": "1.0.17",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/build-step",
|
"homepage": "https://vercel.com/docs/build-step",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"@types/ms": "0.7.31",
|
"@types/ms": "0.7.31",
|
||||||
"@types/node-fetch": "2.5.4",
|
"@types/node-fetch": "2.5.4",
|
||||||
"@types/promise-timeout": "1.3.0",
|
"@types/promise-timeout": "1.3.0",
|
||||||
"@vercel/build-utils": "5.2.0",
|
"@vercel/build-utils": "5.3.0",
|
||||||
"@vercel/frameworks": "1.1.3",
|
"@vercel/frameworks": "1.1.3",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"@vercel/routing-utils": "2.0.2",
|
"@vercel/routing-utils": "2.0.2",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
spawnCommand,
|
spawnCommand,
|
||||||
runNpmInstall,
|
runNpmInstall,
|
||||||
getEnvForPackageManager,
|
getEnvForPackageManager,
|
||||||
|
getPrefixedEnvVars,
|
||||||
getNodeBinPath,
|
getNodeBinPath,
|
||||||
runBundleInstall,
|
runBundleInstall,
|
||||||
runPipInstall,
|
runPipInstall,
|
||||||
@@ -366,22 +367,13 @@ export const build: BuildV2 = async ({
|
|||||||
`Detected ${framework.name} framework. Optimizing your deployment...`
|
`Detected ${framework.name} framework. Optimizing your deployment...`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (process.env.VERCEL_URL) {
|
const prefixedEnvs = getPrefixedEnvVars({
|
||||||
const vercelSystemEnvPrefix = 'VERCEL_';
|
envPrefix: framework.envPrefix,
|
||||||
const { envPrefix } = framework;
|
envs: process.env,
|
||||||
if (envPrefix) {
|
|
||||||
Object.keys(process.env)
|
|
||||||
.filter(key => key.startsWith(vercelSystemEnvPrefix))
|
|
||||||
.forEach(key => {
|
|
||||||
const newKey = `${envPrefix}${key}`;
|
|
||||||
if (!(newKey in process.env)) {
|
|
||||||
process.env[newKey] = process.env[key];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// tell turbo to exclude all vercel system env vars (envPrefix includes trailing underscore)
|
for (const [key, value] of Object.entries(prefixedEnvs)) {
|
||||||
process.env.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
|
process.env[key] = value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.VERCEL_ANALYTICS_ID) {
|
if (process.env.VERCEL_ANALYTICS_ID) {
|
||||||
|
|||||||
55
yarn.lock
55
yarn.lock
@@ -1035,6 +1035,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@sinclair/typebox" "^0.23.3"
|
"@sinclair/typebox" "^0.23.3"
|
||||||
|
|
||||||
|
"@jest/schemas@^28.1.3":
|
||||||
|
version "28.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905"
|
||||||
|
integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg==
|
||||||
|
dependencies:
|
||||||
|
"@sinclair/typebox" "^0.24.1"
|
||||||
|
|
||||||
"@jest/source-map@^28.0.2":
|
"@jest/source-map@^28.0.2":
|
||||||
version "28.0.2"
|
version "28.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.0.2.tgz#914546f4410b67b1d42c262a1da7e0406b52dc90"
|
resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.0.2.tgz#914546f4410b67b1d42c262a1da7e0406b52dc90"
|
||||||
@@ -2060,6 +2067,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.4.tgz#6ff93fd2585ce44f7481c9ff6af610fbb5de98a4"
|
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.4.tgz#6ff93fd2585ce44f7481c9ff6af610fbb5de98a4"
|
||||||
integrity sha512-0/WqSvpVbCBAV1yPeko7eAczKbs78dNVAaX14quVlwOb2wxfKuXCx91h4NrEfkYK9zEnyVSW4JVI/trP3iS+Qg==
|
integrity sha512-0/WqSvpVbCBAV1yPeko7eAczKbs78dNVAaX14quVlwOb2wxfKuXCx91h4NrEfkYK9zEnyVSW4JVI/trP3iS+Qg==
|
||||||
|
|
||||||
|
"@sinclair/typebox@^0.24.1":
|
||||||
|
version "0.24.27"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.27.tgz#d55643516a1546174e10da681a8aaa81e757452d"
|
||||||
|
integrity sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==
|
||||||
|
|
||||||
"@sindresorhus/is@^0.14.0":
|
"@sindresorhus/is@^0.14.0":
|
||||||
version "0.14.0"
|
version "0.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
||||||
@@ -2653,6 +2665,14 @@
|
|||||||
jest-matcher-utils "^27.0.0"
|
jest-matcher-utils "^27.0.0"
|
||||||
pretty-format "^27.0.0"
|
pretty-format "^27.0.0"
|
||||||
|
|
||||||
|
"@types/jest@28.1.6":
|
||||||
|
version "28.1.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.6.tgz#d6a9cdd38967d2d746861fb5be6b120e38284dd4"
|
||||||
|
integrity sha512-0RbGAFMfcBJKOmqRazM8L98uokwuwD5F8rHrv/ZMbrZBwVOWZUyPG6VFNscjYr/vjM3Vu4fRrCPbOs42AfemaQ==
|
||||||
|
dependencies:
|
||||||
|
jest-matcher-utils "^28.0.0"
|
||||||
|
pretty-format "^28.0.0"
|
||||||
|
|
||||||
"@types/js-yaml@3.12.1":
|
"@types/js-yaml@3.12.1":
|
||||||
version "3.12.1"
|
version "3.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.1.tgz#5c6f4a1eabca84792fbd916f0cb40847f123c656"
|
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.1.tgz#5c6f4a1eabca84792fbd916f0cb40847f123c656"
|
||||||
@@ -5343,6 +5363,11 @@ diff-sequences@^28.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.0.2.tgz#40f8d4ffa081acbd8902ba35c798458d0ff1af41"
|
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.0.2.tgz#40f8d4ffa081acbd8902ba35c798458d0ff1af41"
|
||||||
integrity sha512-YtEoNynLDFCRznv/XDalsKGSZDoj0U5kLnXvY0JSq3nBboRrZXjD81+eSiwi+nzcZDwedMmcowcxNwwgFW23mQ==
|
integrity sha512-YtEoNynLDFCRznv/XDalsKGSZDoj0U5kLnXvY0JSq3nBboRrZXjD81+eSiwi+nzcZDwedMmcowcxNwwgFW23mQ==
|
||||||
|
|
||||||
|
diff-sequences@^28.1.1:
|
||||||
|
version "28.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6"
|
||||||
|
integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==
|
||||||
|
|
||||||
diff@^4.0.1:
|
diff@^4.0.1:
|
||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
||||||
@@ -8016,6 +8041,16 @@ jest-diff@^28.0.2:
|
|||||||
jest-get-type "^28.0.2"
|
jest-get-type "^28.0.2"
|
||||||
pretty-format "^28.0.2"
|
pretty-format "^28.0.2"
|
||||||
|
|
||||||
|
jest-diff@^28.1.3:
|
||||||
|
version "28.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f"
|
||||||
|
integrity sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw==
|
||||||
|
dependencies:
|
||||||
|
chalk "^4.0.0"
|
||||||
|
diff-sequences "^28.1.1"
|
||||||
|
jest-get-type "^28.0.2"
|
||||||
|
pretty-format "^28.1.3"
|
||||||
|
|
||||||
jest-docblock@^28.0.2:
|
jest-docblock@^28.0.2:
|
||||||
version "28.0.2"
|
version "28.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.0.2.tgz#3cab8abea53275c9d670cdca814fc89fba1298c2"
|
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.0.2.tgz#3cab8abea53275c9d670cdca814fc89fba1298c2"
|
||||||
@@ -8093,6 +8128,16 @@ jest-matcher-utils@^27.0.0:
|
|||||||
jest-get-type "^27.5.1"
|
jest-get-type "^27.5.1"
|
||||||
pretty-format "^27.5.1"
|
pretty-format "^27.5.1"
|
||||||
|
|
||||||
|
jest-matcher-utils@^28.0.0:
|
||||||
|
version "28.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz#5a77f1c129dd5ba3b4d7fc20728806c78893146e"
|
||||||
|
integrity sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw==
|
||||||
|
dependencies:
|
||||||
|
chalk "^4.0.0"
|
||||||
|
jest-diff "^28.1.3"
|
||||||
|
jest-get-type "^28.0.2"
|
||||||
|
pretty-format "^28.1.3"
|
||||||
|
|
||||||
jest-matcher-utils@^28.0.2:
|
jest-matcher-utils@^28.0.2:
|
||||||
version "28.0.2"
|
version "28.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.0.2.tgz#eb461af204b6d0f05281e9228094f0ab7e9e8537"
|
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.0.2.tgz#eb461af204b6d0f05281e9228094f0ab7e9e8537"
|
||||||
@@ -10420,6 +10465,16 @@ pretty-format@^27.5.1:
|
|||||||
ansi-styles "^5.0.0"
|
ansi-styles "^5.0.0"
|
||||||
react-is "^17.0.1"
|
react-is "^17.0.1"
|
||||||
|
|
||||||
|
pretty-format@^28.0.0, pretty-format@^28.1.3:
|
||||||
|
version "28.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5"
|
||||||
|
integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==
|
||||||
|
dependencies:
|
||||||
|
"@jest/schemas" "^28.1.3"
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
ansi-styles "^5.0.0"
|
||||||
|
react-is "^18.0.0"
|
||||||
|
|
||||||
pretty-format@^28.0.2:
|
pretty-format@^28.0.2:
|
||||||
version "28.0.2"
|
version "28.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.0.2.tgz#6a24d71cbb61a5e5794ba7513fe22101675481bc"
|
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.0.2.tgz#6a24d71cbb61a5e5794ba7513fe22101675481bc"
|
||||||
|
|||||||
Reference in New Issue
Block a user