Compare commits

..

1 Commits

Author SHA1 Message Date
Leo Lamprecht
b7cbdaf721 Publish Canary
- vercel-plugin-go@1.0.0-canary.14
 - vercel-plugin-python@1.0.0-canary.15
 - vercel-plugin-ruby@1.0.0-canary.13
2021-12-01 23:20:12 +01:00
24 changed files with 76 additions and 98 deletions

View File

@@ -5,7 +5,7 @@
"description": "API for the vercel/vercel repo",
"main": "index.js",
"scripts": {
"vercel-build": "node ../utils/run.js build all"
"vercel-build": "yarn --cwd .. && node ../utils/run.js build all"
},
"dependencies": {
"@sentry/node": "5.11.1",

View File

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

View File

@@ -7,28 +7,6 @@ import type FileBlob from './file-blob';
import type { BuildOptions, Files } from './types';
import { getIgnoreFilter } from '.';
// `.output` was already created by the Build Command, so we have
// to ensure its contents don't get bundled into the Lambda. Similarily,
// we don't want to bundle anything from `.vercel` either. Lastly,
// Builders/Runtimes didn't have `vercel.json` or `now.json`.
const ignoredPaths = ['.output', '.vercel', 'vercel.json', 'now.json'];
const shouldIgnorePath = (
file: string,
ignoreFilter: any,
ignoreFile: boolean
) => {
const isNative = ignoredPaths.some(item => {
return file.startsWith(item);
});
if (!ignoreFile) {
return isNative;
}
return isNative || ignoreFilter(file);
};
/**
* Convert legacy Runtime to a Plugin.
* @param buildRuntime - a legacy build() function from a Runtime
@@ -45,16 +23,25 @@ export function convertRuntimeToPlugin(
const opts = { cwd: workPath };
const files = await glob('**', opts);
// `.output` was already created by the Build Command, so we have
// to ensure its contents don't get bundled into the Lambda. Similarily,
// we don't want to bundle anything from `.vercel` either. Lastly,
// Builders/Runtimes didn't have `vercel.json` or `now.json`.
const ignoredPaths = ['.output', '.vercel', 'vercel.json', 'now.json'];
// We also don't want to provide any files to Runtimes that were ignored
// through `.vercelignore` or `.nowignore`, because the Build Step does the same.
const ignoreFilter = await getIgnoreFilter(workPath);
// We're not passing this as an `ignore` filter to the `glob` function above,
// so that we can re-use exactly the same `getIgnoreFilter` method that the
// Build Step uses (literally the same code). Note that this exclusion only applies
// when deploying. Locally, another exclusion further below is needed.
// Build Step uses (literally the same code).
for (const file in files) {
if (shouldIgnorePath(file, ignoreFilter, true)) {
const isNative = ignoredPaths.some(item => {
return file.startsWith(item);
});
if (isNative || ignoreFilter(file)) {
delete files[file];
}
}
@@ -102,16 +89,6 @@ export function convertRuntimeToPlugin(
// @ts-ignore This symbol is a private API
const lambdaFiles: Files = output[FILES_SYMBOL];
// When deploying, the `files` that are passed to the Legacy Runtimes already
// have certain files that are ignored stripped, but locally, that list of
// files isn't used by the Legacy Runtimes, so we need to apply the filters
// to the outputs that they are returning instead.
for (const file in lambdaFiles) {
if (shouldIgnorePath(file, ignoreFilter, false)) {
delete files[file];
}
}
const entry = join(workPath, '.output', 'server', 'pages', entrypoint);
await fs.ensureDir(dirname(entry));
await linkOrCopy(files[entrypoint].fsPath, entry);

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "23.1.3-canary.50",
"version": "23.1.3-canary.47",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -43,14 +43,14 @@
"node": ">= 12"
},
"dependencies": {
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@vercel/go": "1.2.4-canary.4",
"@vercel/node": "1.12.2-canary.7",
"@vercel/python": "2.1.2-canary.1",
"@vercel/ruby": "1.2.8-canary.6",
"update-notifier": "4.1.0",
"vercel-plugin-middleware": "0.0.0-canary.7",
"vercel-plugin-node": "1.12.2-canary.21"
"vercel-plugin-node": "1.12.2-canary.19"
},
"devDependencies": {
"@next/env": "11.1.2",

View File

@@ -612,37 +612,32 @@ export default async function main(client: Client) {
}
}
client.output.debug(`Resolve ${param('required-server-files.json')}.`);
const requiredServerFilesPath = join(
OUTPUT_DIR,
'required-server-files.json'
);
const requiredServerFilesJson = await fs.readJSON(
requiredServerFilesPath
);
await fs.writeJSON(requiredServerFilesPath, {
...requiredServerFilesJson,
appDir: '.',
files: requiredServerFilesJson.files.map((i: string) => {
const originalPath = join(requiredServerFilesJson.appDir, i);
const relPath = join(OUTPUT_DIR, relative(distDir, originalPath));
if (fs.existsSync(requiredServerFilesPath)) {
client.output.debug(`Resolve ${param('required-server-files.json')}.`);
const absolutePath = join(cwd, relPath);
const output = relative(baseDir, absolutePath);
const requiredServerFilesJson = await fs.readJSON(
requiredServerFilesPath
);
await fs.writeJSON(requiredServerFilesPath, {
...requiredServerFilesJson,
appDir: '.',
files: requiredServerFilesJson.files.map((i: string) => {
const originalPath = join(requiredServerFilesJson.appDir, i);
const relPath = join(OUTPUT_DIR, relative(distDir, originalPath));
const absolutePath = join(cwd, relPath);
const output = relative(baseDir, absolutePath);
return relPath === output
? relPath
: {
input: relPath,
output,
};
}),
});
}
return relPath === output
? relPath
: {
input: relPath,
output,
};
}),
});
}
}

View File

@@ -968,7 +968,7 @@ export default class DevServer {
socket.destroy();
return;
}
const target = `http://127.0.0.1:${this.devProcessPort}`;
const target = `http://localhost:${this.devProcessPort}`;
this.output.debug(`Detected "upgrade" event, proxying to ${target}`);
this.proxy.ws(req, socket, head, { target });
});
@@ -1663,7 +1663,7 @@ export default class DevServer {
if (!match) {
// If the dev command is started, then proxy to it
if (this.devProcessPort) {
const upstream = `http://127.0.0.1:${this.devProcessPort}`;
const upstream = `http://localhost:${this.devProcessPort}`;
debug(`Proxying to frontend dev server: ${upstream}`);
// Add the Vercel platform proxy request headers
@@ -1810,7 +1810,7 @@ export default class DevServer {
return proxyPass(
req,
res,
`http://127.0.0.1:${port}`,
`http://localhost:${port}`,
this,
requestId,
false
@@ -1847,7 +1847,7 @@ export default class DevServer {
return proxyPass(
req,
res,
`http://127.0.0.1:${this.devProcessPort}`,
`http://localhost:${this.devProcessPort}`,
this,
requestId,
false

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "10.2.3-canary.30",
"version": "10.2.3-canary.29",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -40,7 +40,7 @@
]
},
"dependencies": {
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",
"async-sema": "3.0.0",

View File

@@ -1,8 +1,8 @@
{
"private": false,
"name": "vercel-plugin-go",
"version": "1.0.0-canary.17",
"main": "dist/index.js",
"version": "1.0.0-canary.14",
"main": "dist/src/index.js",
"license": "MIT",
"files": [
"dist"
@@ -17,7 +17,7 @@
"prepublishOnly": "tsc"
},
"dependencies": {
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@vercel/go": "1.2.4-canary.4"
},
"devDependencies": {

View File

@@ -1,6 +1,7 @@
import { convertRuntimeToPlugin } from '@vercel/build-utils';
import * as go from '@vercel/go';
import { name } from '../package.json';
export const build = convertRuntimeToPlugin(go.build, 'vercel-plugin-go', '.go');
export const build = convertRuntimeToPlugin(go.build, name, '.go');
export const startDevServer = go.startDevServer;

View File

@@ -12,6 +12,7 @@
"noUnusedParameters": true,
"outDir": "dist",
"strict": true,
"target": "esnext"
"target": "esnext",
"resolveJsonModule": true
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "vercel-plugin-node",
"version": "1.12.2-canary.21",
"version": "1.12.2-canary.19",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -34,12 +34,12 @@
"@types/node-fetch": "2",
"@types/test-listen": "1.1.0",
"@types/yazl": "2.4.2",
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@vercel/fun": "1.0.3",
"@vercel/ncc": "0.24.0",
"@vercel/nft": "0.14.0",
"@vercel/node-bridge": "2.1.1-canary.2",
"@vercel/static-config": "0.0.1-canary.1",
"@vercel/static-config": "0.0.1-canary.0",
"abort-controller": "3.0.0",
"content-type": "1.0.4",
"cookie": "0.4.0",

View File

@@ -401,9 +401,9 @@ export async function build({ workPath }: { workPath: string }) {
getConfig(project, absEntrypoint, FunctionConfigSchema) || {};
// No config exported means "node", but if there is a config
// and "use" is defined, but it is not "node" then don't
// and "runtime" is defined, but it is not "node" then don't
// compile this file.
if (config.use && config.use !== 'node') {
if (config.runtime && config.runtime !== 'node') {
continue;
}

View File

@@ -1,8 +1,8 @@
{
"private": false,
"name": "vercel-plugin-python",
"version": "1.0.0-canary.18",
"main": "dist/index.js",
"version": "1.0.0-canary.15",
"main": "dist/src/index.js",
"license": "MIT",
"files": [
"dist"
@@ -17,7 +17,7 @@
"prepublishOnly": "tsc"
},
"dependencies": {
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@vercel/python": "2.1.2-canary.1"
},
"devDependencies": {

View File

@@ -1,6 +1,7 @@
import { convertRuntimeToPlugin } from '@vercel/build-utils';
import * as python from '@vercel/python';
import { name } from '../package.json';
export const build = convertRuntimeToPlugin(python.build, 'vercel-plugin-python', '.py');
export const build = convertRuntimeToPlugin(python.build, name, '.py');
//export const startDevServer = python.startDevServer;

View File

@@ -13,6 +13,7 @@
"outDir": "dist",
"types": ["node"],
"strict": true,
"target": "esnext"
"target": "esnext",
"resolveJsonModule": true
}
}

View File

@@ -1,8 +1,8 @@
{
"private": false,
"name": "vercel-plugin-ruby",
"version": "1.0.0-canary.16",
"main": "dist/index.js",
"version": "1.0.0-canary.13",
"main": "dist/src/index.js",
"license": "MIT",
"files": [
"dist"
@@ -17,7 +17,7 @@
"prepublishOnly": "tsc"
},
"dependencies": {
"@vercel/build-utils": "2.12.3-canary.29",
"@vercel/build-utils": "2.12.3-canary.28",
"@vercel/ruby": "1.2.8-canary.6"
},
"devDependencies": {

View File

@@ -1,6 +1,7 @@
import { convertRuntimeToPlugin } from '@vercel/build-utils';
import * as ruby from '@vercel/ruby';
import { name } from '../package.json';
export const build = convertRuntimeToPlugin(ruby.build, 'vercel-plugin-ruby', '.rb');
export const build = convertRuntimeToPlugin(ruby.build, name, '.rb');
//export const startDevServer = ruby.startDevServer;

View File

@@ -13,6 +13,7 @@
"outDir": "dist",
"types": ["node"],
"strict": true,
"target": "esnext"
"target": "esnext",
"resolveJsonModule": true
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/static-config",
"version": "0.0.1-canary.1",
"version": "0.0.1-canary.0",
"license": "MIT",
"main": "./dist/index",
"repository": {

View File

@@ -15,7 +15,7 @@ const ajv = new Ajv();
export const BaseFunctionConfigSchema = {
type: 'object',
properties: {
use: { type: 'string' },
runtime: { type: 'string' },
memory: { type: 'number' },
maxDuration: { type: 'number' },
regions: {

View File

@@ -2,7 +2,7 @@ import ms from 'https://denopkg.com/TooTallNate/ms';
import { readerFromStreamReader } from 'https://deno.land/std@0.107.0/io/streams.ts';
export const config = {
use: 'deno',
runtime: 'deno',
location: 'https://example.com/page',
};

View File

@@ -1,3 +1,3 @@
export const config = {
use: 0,
runtime: 0,
};

View File

@@ -1,7 +1,7 @@
import fs from 'fs';
export const config = {
use: 'node',
runtime: 'node',
memory: 1024,
};

View File

@@ -10,7 +10,7 @@ describe('getConfig()', () => {
expect(config).toMatchInlineSnapshot(`
Object {
"memory": 1024,
"use": "node",
"runtime": "node",
}
`);
});
@@ -27,7 +27,7 @@ describe('getConfig()', () => {
expect(config).toMatchInlineSnapshot(`
Object {
"location": "https://example.com/page",
"use": "deno",
"runtime": "deno",
}
`);
});