@vercel/build-utils 2.12.3-canary.20 → 2.12.3-canary.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Lambda } from './lambda';
|
2
|
-
import type { BuildOptions } from './types';
|
2
|
+
import type { BuilderFunctions, BuildOptions } from './types';
|
3
3
|
/**
|
4
4
|
* Convert legacy Runtime to a Plugin.
|
5
5
|
* @param buildRuntime - a legacy build() function from a Runtime
|
@@ -7,7 +7,11 @@ import type { BuildOptions } from './types';
|
|
7
7
|
*/
|
8
8
|
export declare function convertRuntimeToPlugin(buildRuntime: (options: BuildOptions) => Promise<{
|
9
9
|
output: Lambda;
|
10
|
-
}>, ext: string): ({ workPath }: {
|
10
|
+
}>, ext: string): ({ vercelConfig, workPath, }: {
|
11
|
+
vercelConfig: {
|
12
|
+
functions?: BuilderFunctions;
|
13
|
+
regions?: string[];
|
14
|
+
};
|
11
15
|
workPath: string;
|
12
16
|
}) => Promise<void>;
|
13
17
|
/**
|
@@ -15,7 +19,11 @@ export declare function convertRuntimeToPlugin(buildRuntime: (options: BuildOpti
|
|
15
19
|
* property. Otherwise write a new file. This will also read `vercel.json`
|
16
20
|
* and apply relevant `functions` property config.
|
17
21
|
*/
|
18
|
-
export declare function updateFunctionsManifest({ workPath, pages, }: {
|
22
|
+
export declare function updateFunctionsManifest({ vercelConfig, workPath, pages, }: {
|
23
|
+
vercelConfig: {
|
24
|
+
functions?: BuilderFunctions;
|
25
|
+
regions?: string[];
|
26
|
+
};
|
19
27
|
workPath: string;
|
20
28
|
pages: {
|
21
29
|
[key: string]: any;
|
@@ -16,13 +16,14 @@ const minimatch_1 = __importDefault(require("minimatch"));
|
|
16
16
|
* @param ext - the file extension, for example `.py`
|
17
17
|
*/
|
18
18
|
function convertRuntimeToPlugin(buildRuntime, ext) {
|
19
|
-
|
19
|
+
// This `build()` signature should match `plugin.build()` signature in `vercel build`.
|
20
|
+
return async function build({ vercelConfig, workPath, }) {
|
20
21
|
const opts = { cwd: workPath };
|
21
22
|
const files = await glob_1.default('**', opts);
|
22
23
|
delete files['vercel.json']; // Builders/Runtimes didn't have vercel.json
|
23
24
|
const entrypoints = await glob_1.default(`api/**/*${ext}`, opts);
|
24
25
|
const pages = {};
|
25
|
-
const { functions = {} } =
|
26
|
+
const { functions = {} } = vercelConfig;
|
26
27
|
const traceDir = path_1.join(workPath, '.output', 'runtime-traced-files');
|
27
28
|
await fs_extra_1.default.ensureDir(traceDir);
|
28
29
|
for (const entrypoint of Object.keys(entrypoints)) {
|
@@ -78,7 +79,7 @@ function convertRuntimeToPlugin(buildRuntime, ext) {
|
|
78
79
|
await fs_extra_1.default.ensureDir(path_1.dirname(nft));
|
79
80
|
await fs_extra_1.default.writeFile(nft, json);
|
80
81
|
}
|
81
|
-
await updateFunctionsManifest({ workPath, pages });
|
82
|
+
await updateFunctionsManifest({ vercelConfig, workPath, pages });
|
82
83
|
};
|
83
84
|
}
|
84
85
|
exports.convertRuntimeToPlugin = convertRuntimeToPlugin;
|
@@ -104,18 +105,13 @@ async function readJson(filePath) {
|
|
104
105
|
throw err;
|
105
106
|
}
|
106
107
|
}
|
107
|
-
async function readVercelConfig(workPath) {
|
108
|
-
const vercelJsonPath = path_1.join(workPath, 'vercel.json');
|
109
|
-
return readJson(vercelJsonPath);
|
110
|
-
}
|
111
108
|
/**
|
112
109
|
* If `.output/functions-manifest.json` exists, append to the pages
|
113
110
|
* property. Otherwise write a new file. This will also read `vercel.json`
|
114
111
|
* and apply relevant `functions` property config.
|
115
112
|
*/
|
116
|
-
async function updateFunctionsManifest({ workPath, pages, }) {
|
113
|
+
async function updateFunctionsManifest({ vercelConfig, workPath, pages, }) {
|
117
114
|
const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
|
118
|
-
const vercelConfig = await readVercelConfig(workPath);
|
119
115
|
const functionsManifest = await readJson(functionsManifestPath);
|
120
116
|
if (!functionsManifest.version)
|
121
117
|
functionsManifest.version = 1;
|
package/dist/index.js
CHANGED
@@ -26195,7 +26195,7 @@ exports.frameworks = [
|
|
26195
26195
|
tagline: 'Gatsby helps developers build blazing fast websites and apps with React.',
|
26196
26196
|
description: 'A Gatsby app, using the default starter theme and a Serverless Function API.',
|
26197
26197
|
website: 'https://gatsbyjs.org',
|
26198
|
-
sort:
|
26198
|
+
sort: 5,
|
26199
26199
|
envPrefix: 'GATSBY_',
|
26200
26200
|
detectors: {
|
26201
26201
|
every: [
|
@@ -26270,6 +26270,73 @@ exports.frameworks = [
|
|
26270
26270
|
},
|
26271
26271
|
cachePattern: '{.cache,public}/**',
|
26272
26272
|
},
|
26273
|
+
{
|
26274
|
+
name: 'Remix',
|
26275
|
+
slug: 'remix',
|
26276
|
+
demo: 'https://remix.examples.vercel.com',
|
26277
|
+
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/remix.svg',
|
26278
|
+
tagline: 'Build Better Websites',
|
26279
|
+
description: 'A new Remix app — the result of running `npx create-remix`.',
|
26280
|
+
website: 'https://remix.run',
|
26281
|
+
sort: 6,
|
26282
|
+
detectors: {
|
26283
|
+
every: [
|
26284
|
+
{
|
26285
|
+
path: 'package.json',
|
26286
|
+
matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"remix":\\s*".+?"[^}]*}',
|
26287
|
+
},
|
26288
|
+
],
|
26289
|
+
},
|
26290
|
+
settings: {
|
26291
|
+
installCommand: {
|
26292
|
+
placeholder: '`yarn install` or `npm install`',
|
26293
|
+
},
|
26294
|
+
buildCommand: {
|
26295
|
+
value: 'remix build',
|
26296
|
+
placeholder: '`npm run build` or `remix build`',
|
26297
|
+
},
|
26298
|
+
devCommand: {
|
26299
|
+
value: 'remix dev',
|
26300
|
+
placeholder: 'remix dev',
|
26301
|
+
},
|
26302
|
+
outputDirectory: {
|
26303
|
+
value: 'public',
|
26304
|
+
},
|
26305
|
+
},
|
26306
|
+
dependency: 'remix',
|
26307
|
+
getFsOutputDir: async () => 'public',
|
26308
|
+
getOutputDirName: async () => 'public',
|
26309
|
+
defaultRoutes: [
|
26310
|
+
{
|
26311
|
+
src: '^/build/(.*)$',
|
26312
|
+
headers: { 'cache-control': 'public, max-age=31536000, immutable' },
|
26313
|
+
continue: true,
|
26314
|
+
},
|
26315
|
+
{
|
26316
|
+
handle: 'filesystem',
|
26317
|
+
},
|
26318
|
+
{
|
26319
|
+
src: '/(.*)',
|
26320
|
+
dest: '/api',
|
26321
|
+
},
|
26322
|
+
],
|
26323
|
+
defaultRewrites: [
|
26324
|
+
{
|
26325
|
+
source: '/(.*)',
|
26326
|
+
regex: '/(.*)',
|
26327
|
+
destination: '/api',
|
26328
|
+
},
|
26329
|
+
],
|
26330
|
+
defaultHeaders: [
|
26331
|
+
{
|
26332
|
+
source: '^/build/(.*)$',
|
26333
|
+
regex: '^/build/(.*)$',
|
26334
|
+
headers: [
|
26335
|
+
{ key: 'cache-control', value: 'public, max-age=31536000, immutable' },
|
26336
|
+
],
|
26337
|
+
},
|
26338
|
+
]
|
26339
|
+
},
|
26273
26340
|
{
|
26274
26341
|
name: 'Hexo',
|
26275
26342
|
slug: 'hexo',
|
@@ -26278,7 +26345,6 @@ exports.frameworks = [
|
|
26278
26345
|
tagline: 'Hexo is a fast, simple & powerful blog framework powered by Node.js.',
|
26279
26346
|
description: 'A Hexo site, created with the Hexo CLI.',
|
26280
26347
|
website: 'https://hexo.io',
|
26281
|
-
sort: 3,
|
26282
26348
|
detectors: {
|
26283
26349
|
every: [
|
26284
26350
|
{
|
@@ -26315,7 +26381,6 @@ exports.frameworks = [
|
|
26315
26381
|
tagline: '11ty is a simpler static site generator written in JavaScript, created to be an alternative to Jekyll.',
|
26316
26382
|
description: 'An Eleventy site, created with npm init.',
|
26317
26383
|
website: 'https://www.11ty.dev',
|
26318
|
-
sort: 4,
|
26319
26384
|
detectors: {
|
26320
26385
|
every: [
|
26321
26386
|
{
|
@@ -27027,6 +27092,7 @@ exports.frameworks = [
|
|
27027
27092
|
tagline: 'Svelte lets you write high performance reactive apps with significantly less boilerplate.',
|
27028
27093
|
description: 'A basic Svelte app using the default template.',
|
27029
27094
|
website: 'https://svelte.dev',
|
27095
|
+
sort: 3,
|
27030
27096
|
detectors: {
|
27031
27097
|
every: [
|
27032
27098
|
{
|
@@ -27216,6 +27282,7 @@ exports.frameworks = [
|
|
27216
27282
|
tagline: 'Create React App allows you to get going with React in no time.',
|
27217
27283
|
description: 'A React app, bootstrapped with create-react-app, and a Serverless Function API.',
|
27218
27284
|
website: 'https://create-react-app.dev',
|
27285
|
+
sort: 4,
|
27219
27286
|
envPrefix: 'REACT_APP_',
|
27220
27287
|
detectors: {
|
27221
27288
|
some: [
|
@@ -27597,6 +27664,7 @@ exports.frameworks = [
|
|
27597
27664
|
tagline: 'Nuxt.js is the web comprehensive framework that lets you dream big with Vue.js.',
|
27598
27665
|
description: 'A Nuxt.js app, bootstrapped with create-nuxt-app.',
|
27599
27666
|
website: 'https://nuxtjs.org',
|
27667
|
+
sort: 2,
|
27600
27668
|
envPrefix: 'NUXT_ENV_',
|
27601
27669
|
detectors: {
|
27602
27670
|
every: [
|
@@ -27690,7 +27758,6 @@ exports.frameworks = [
|
|
27690
27758
|
tagline: 'Hugo is the world’s fastest framework for building websites, written in Go.',
|
27691
27759
|
description: 'A Hugo site, created with the Hugo CLI.',
|
27692
27760
|
website: 'https://gohugo.io',
|
27693
|
-
sort: 5,
|
27694
27761
|
detectors: {
|
27695
27762
|
some: [
|
27696
27763
|
{
|
@@ -32226,13 +32293,14 @@ const minimatch_1 = __importDefault(__webpack_require__(9566));
|
|
32226
32293
|
* @param ext - the file extension, for example `.py`
|
32227
32294
|
*/
|
32228
32295
|
function convertRuntimeToPlugin(buildRuntime, ext) {
|
32229
|
-
|
32296
|
+
// This `build()` signature should match `plugin.build()` signature in `vercel build`.
|
32297
|
+
return async function build({ vercelConfig, workPath, }) {
|
32230
32298
|
const opts = { cwd: workPath };
|
32231
32299
|
const files = await glob_1.default('**', opts);
|
32232
32300
|
delete files['vercel.json']; // Builders/Runtimes didn't have vercel.json
|
32233
32301
|
const entrypoints = await glob_1.default(`api/**/*${ext}`, opts);
|
32234
32302
|
const pages = {};
|
32235
|
-
const { functions = {} } =
|
32303
|
+
const { functions = {} } = vercelConfig;
|
32236
32304
|
const traceDir = path_1.join(workPath, '.output', 'runtime-traced-files');
|
32237
32305
|
await fs_extra_1.default.ensureDir(traceDir);
|
32238
32306
|
for (const entrypoint of Object.keys(entrypoints)) {
|
@@ -32288,7 +32356,7 @@ function convertRuntimeToPlugin(buildRuntime, ext) {
|
|
32288
32356
|
await fs_extra_1.default.ensureDir(path_1.dirname(nft));
|
32289
32357
|
await fs_extra_1.default.writeFile(nft, json);
|
32290
32358
|
}
|
32291
|
-
await updateFunctionsManifest({ workPath, pages });
|
32359
|
+
await updateFunctionsManifest({ vercelConfig, workPath, pages });
|
32292
32360
|
};
|
32293
32361
|
}
|
32294
32362
|
exports.convertRuntimeToPlugin = convertRuntimeToPlugin;
|
@@ -32314,18 +32382,13 @@ async function readJson(filePath) {
|
|
32314
32382
|
throw err;
|
32315
32383
|
}
|
32316
32384
|
}
|
32317
|
-
async function readVercelConfig(workPath) {
|
32318
|
-
const vercelJsonPath = path_1.join(workPath, 'vercel.json');
|
32319
|
-
return readJson(vercelJsonPath);
|
32320
|
-
}
|
32321
32385
|
/**
|
32322
32386
|
* If `.output/functions-manifest.json` exists, append to the pages
|
32323
32387
|
* property. Otherwise write a new file. This will also read `vercel.json`
|
32324
32388
|
* and apply relevant `functions` property config.
|
32325
32389
|
*/
|
32326
|
-
async function updateFunctionsManifest({ workPath, pages, }) {
|
32390
|
+
async function updateFunctionsManifest({ vercelConfig, workPath, pages, }) {
|
32327
32391
|
const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
|
32328
|
-
const vercelConfig = await readVercelConfig(workPath);
|
32329
32392
|
const functionsManifest = await readJson(functionsManifestPath);
|
32330
32393
|
if (!functionsManifest.version)
|
32331
32394
|
functionsManifest.version = 1;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.12.3-canary.
|
3
|
+
"version": "2.12.3-canary.21",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
32
|
"@types/yazl": "^2.4.1",
|
33
|
-
"@vercel/frameworks": "0.5.1-canary.
|
33
|
+
"@vercel/frameworks": "0.5.1-canary.13",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "cc7b2691c1d43ecb19f1dd6e88f29137d85da61a"
|
53
53
|
}
|