@vercel/build-utils 2.12.3-canary.35 → 2.12.3-canary.39
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.
- package/dist/convert-runtime-to-plugin.js +18 -64
- package/dist/index.js +24 -135
- package/package.json +3 -3
@@ -78,7 +78,8 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
78
78
|
`api-routes-${pluginName}`);
|
79
79
|
await fs_extra_1.default.ensureDir(traceDir);
|
80
80
|
let newPathsRuntime = new Set();
|
81
|
-
|
81
|
+
const entryDir = path_1.join('.output', 'server', 'pages');
|
82
|
+
const entryRoot = path_1.join(workPath, entryDir);
|
82
83
|
for (const entrypoint of Object.keys(entrypoints)) {
|
83
84
|
const { output } = await buildRuntime({
|
84
85
|
files: sourceFilesPreBuild,
|
@@ -89,6 +90,7 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
89
90
|
},
|
90
91
|
meta: {
|
91
92
|
avoidTopLevelInstall: true,
|
93
|
+
skipDownload: true,
|
92
94
|
},
|
93
95
|
});
|
94
96
|
// Legacy Runtimes tend to pollute the `workPath` with compiled results,
|
@@ -127,7 +129,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
127
129
|
throw new Error(`Could not find a handler file. Please ensure that \`files\` for the returned \`Lambda\` contains an \`FileFsRef\` named "${handlerFileBase}" with a valid \`fsPath\`.`);
|
128
130
|
}
|
129
131
|
const handlerExtName = path_1.extname(handlerFile.fsPath);
|
130
|
-
const entryRoot = path_1.join(workPath, '.output', 'server', 'pages');
|
131
132
|
const entryBase = path_1.basename(entrypoint).replace(ext, handlerExtName);
|
132
133
|
const entryPath = path_1.join(path_1.dirname(entrypoint), entryBase);
|
133
134
|
const entry = path_1.join(entryRoot, entryPath);
|
@@ -183,54 +184,22 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
183
184
|
}
|
184
185
|
}
|
185
186
|
}
|
186
|
-
const tracedFiles = [];
|
187
|
-
const linkers = Object.entries(lambdaFiles).map(async ([relPath, file]) => {
|
188
|
-
const newPath = path_1.join(traceDir, relPath);
|
189
|
-
// The handler was already moved into position above.
|
190
|
-
if (relPath === handlerFileBase) {
|
191
|
-
return;
|
192
|
-
}
|
193
|
-
tracedFiles.push({ absolutePath: newPath, relativePath: relPath });
|
194
|
-
const { fsPath, type } = file;
|
195
|
-
if (fsPath) {
|
196
|
-
await fs_extra_1.default.ensureDir(path_1.dirname(newPath));
|
197
|
-
const isNewFile = newFilesEntrypoint.includes(fsPath);
|
198
|
-
const isInsideNewDirectory = newDirectoriesEntrypoint.some(dirPath => {
|
199
|
-
return fsPath.startsWith(dirPath);
|
200
|
-
});
|
201
|
-
// With this, we're making sure that files in the `workPath` that existed
|
202
|
-
// before the Legacy Runtime was invoked (source files) are linked from
|
203
|
-
// `.output` instead of copying there (the latter only happens if linking fails),
|
204
|
-
// which is the fastest solution. However, files that are created fresh
|
205
|
-
// by the Legacy Runtimes are always copied, because their link destinations
|
206
|
-
// are likely to be overwritten every time an entrypoint is processed by
|
207
|
-
// the Legacy Runtime. This is likely to overwrite the destination on subsequent
|
208
|
-
// runs, but that's also how `workPath` used to work originally, without
|
209
|
-
// the File System API (meaning that there was one `workPath` for all entrypoints).
|
210
|
-
if (isNewFile || isInsideNewDirectory) {
|
211
|
-
_1.debug(`Copying from ${fsPath} to ${newPath}`);
|
212
|
-
await fs_extra_1.default.copy(fsPath, newPath);
|
213
|
-
}
|
214
|
-
else {
|
215
|
-
await linkOrCopy(fsPath, newPath);
|
216
|
-
}
|
217
|
-
}
|
218
|
-
else if (type === 'FileBlob') {
|
219
|
-
const { data, mode } = file;
|
220
|
-
await fs_extra_1.default.writeFile(newPath, data, { mode });
|
221
|
-
}
|
222
|
-
else {
|
223
|
-
throw new Error(`Unknown file type: ${type}`);
|
224
|
-
}
|
225
|
-
});
|
226
|
-
linkersRuntime = linkersRuntime.concat(linkers);
|
227
187
|
const nft = `${entry}.nft.json`;
|
228
188
|
const json = JSON.stringify({
|
229
|
-
version:
|
230
|
-
files:
|
231
|
-
|
232
|
-
|
233
|
-
|
189
|
+
version: 2,
|
190
|
+
files: Object.keys(lambdaFiles)
|
191
|
+
.map(file => {
|
192
|
+
const { fsPath } = lambdaFiles[file];
|
193
|
+
if (!fsPath) {
|
194
|
+
throw new Error(`File "${file}" is missing valid \`fsPath\` property`);
|
195
|
+
}
|
196
|
+
// The handler was already moved into position above.
|
197
|
+
if (file === handlerFileBase) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
return normalize_path_1.normalizePath(path_1.relative(path_1.dirname(nft), fsPath));
|
201
|
+
})
|
202
|
+
.filter(Boolean),
|
234
203
|
});
|
235
204
|
await fs_extra_1.default.ensureDir(path_1.dirname(nft));
|
236
205
|
await fs_extra_1.default.writeFile(nft, json);
|
@@ -257,11 +226,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
257
226
|
allowQuery: output.allowQuery,
|
258
227
|
};
|
259
228
|
}
|
260
|
-
// Instead of of waiting for all of the linking to be done for every
|
261
|
-
// entrypoint before processing the next one, we immediately handle all
|
262
|
-
// of them one after the other, while then waiting for the linking
|
263
|
-
// to finish right here, before we clean up newly created files below.
|
264
|
-
await Promise.all(linkersRuntime);
|
265
229
|
// A list of all the files that were created by the Legacy Runtime,
|
266
230
|
// which we'd like to remove from the File System.
|
267
231
|
const toRemove = Array.from(newPathsRuntime).map(path => {
|
@@ -280,16 +244,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
280
244
|
};
|
281
245
|
}
|
282
246
|
exports.convertRuntimeToPlugin = convertRuntimeToPlugin;
|
283
|
-
async function linkOrCopy(existingPath, newPath) {
|
284
|
-
try {
|
285
|
-
await fs_extra_1.default.createLink(existingPath, newPath);
|
286
|
-
}
|
287
|
-
catch (err) {
|
288
|
-
if (err.code !== 'EEXIST') {
|
289
|
-
await fs_extra_1.default.copyFile(existingPath, newPath);
|
290
|
-
}
|
291
|
-
}
|
292
|
-
}
|
293
247
|
async function readJson(filePath) {
|
294
248
|
try {
|
295
249
|
const str = await fs_extra_1.default.readFile(filePath, 'utf8');
|
@@ -310,7 +264,7 @@ async function updateFunctionsManifest({ workPath, pages, }) {
|
|
310
264
|
const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
|
311
265
|
const functionsManifest = await readJson(functionsManifestPath);
|
312
266
|
if (!functionsManifest.version)
|
313
|
-
functionsManifest.version =
|
267
|
+
functionsManifest.version = 2;
|
314
268
|
if (!functionsManifest.pages)
|
315
269
|
functionsManifest.pages = {};
|
316
270
|
for (const [pageKey, pageConfig] of Object.entries(pages)) {
|
package/dist/index.js
CHANGED
@@ -26693,7 +26693,6 @@ exports.frameworks = [
|
|
26693
26693
|
},
|
26694
26694
|
dependency: 'gatsby',
|
26695
26695
|
getOutputDirName: async () => 'public',
|
26696
|
-
getFsOutputDir: async () => 'public',
|
26697
26696
|
defaultRoutes: async (dirPrefix) => {
|
26698
26697
|
// This file could be generated by gatsby-plugin-now or gatsby-plugin-zeit-now
|
26699
26698
|
try {
|
@@ -26774,7 +26773,6 @@ exports.frameworks = [
|
|
26774
26773
|
},
|
26775
26774
|
},
|
26776
26775
|
dependency: 'remix',
|
26777
|
-
getFsOutputDir: async () => 'public',
|
26778
26776
|
getOutputDirName: async () => 'public',
|
26779
26777
|
defaultRoutes: [
|
26780
26778
|
{
|
@@ -26802,10 +26800,13 @@ exports.frameworks = [
|
|
26802
26800
|
source: '/build/(.*)',
|
26803
26801
|
regex: '/build/(.*)',
|
26804
26802
|
headers: [
|
26805
|
-
{
|
26803
|
+
{
|
26804
|
+
key: 'cache-control',
|
26805
|
+
value: 'public, max-age=31536000, immutable',
|
26806
|
+
},
|
26806
26807
|
],
|
26807
26808
|
},
|
26808
|
-
]
|
26809
|
+
],
|
26809
26810
|
},
|
26810
26811
|
{
|
26811
26812
|
name: 'Hexo',
|
@@ -26840,7 +26841,6 @@ exports.frameworks = [
|
|
26840
26841
|
},
|
26841
26842
|
},
|
26842
26843
|
dependency: 'hexo',
|
26843
|
-
getFsOutputDir: async () => 'public',
|
26844
26844
|
getOutputDirName: async () => 'public',
|
26845
26845
|
},
|
26846
26846
|
{
|
@@ -26876,7 +26876,6 @@ exports.frameworks = [
|
|
26876
26876
|
},
|
26877
26877
|
},
|
26878
26878
|
dependency: '@11ty/eleventy',
|
26879
|
-
getFsOutputDir: async () => '_site',
|
26880
26879
|
getOutputDirName: async () => '_site',
|
26881
26880
|
cachePattern: '.cache/**',
|
26882
26881
|
},
|
@@ -26913,21 +26912,6 @@ exports.frameworks = [
|
|
26913
26912
|
},
|
26914
26913
|
},
|
26915
26914
|
dependency: '@docusaurus/core',
|
26916
|
-
getFsOutputDir: async (dirPrefix) => {
|
26917
|
-
const base = 'build';
|
26918
|
-
try {
|
26919
|
-
const location = path_1.join(dirPrefix, base);
|
26920
|
-
const content = await readdir(location, { withFileTypes: true });
|
26921
|
-
// If there is only one file in it that is a dir we'll use it as dist dir
|
26922
|
-
if (content.length === 1 && content[0].isDirectory()) {
|
26923
|
-
return path_1.join(base, content[0].name);
|
26924
|
-
}
|
26925
|
-
}
|
26926
|
-
catch (error) {
|
26927
|
-
console.error(`Error detecting output directory: `, error);
|
26928
|
-
}
|
26929
|
-
return base;
|
26930
|
-
},
|
26931
26915
|
getOutputDirName: async (dirPrefix) => {
|
26932
26916
|
const base = 'build';
|
26933
26917
|
try {
|
@@ -27057,21 +27041,6 @@ exports.frameworks = [
|
|
27057
27041
|
},
|
27058
27042
|
},
|
27059
27043
|
dependency: 'docusaurus',
|
27060
|
-
getFsOutputDir: async (dirPrefix) => {
|
27061
|
-
const base = 'build';
|
27062
|
-
try {
|
27063
|
-
const location = path_1.join(dirPrefix, base);
|
27064
|
-
const content = await readdir(location, { withFileTypes: true });
|
27065
|
-
// If there is only one file in it that is a dir we'll use it as dist dir
|
27066
|
-
if (content.length === 1 && content[0].isDirectory()) {
|
27067
|
-
return path_1.join(base, content[0].name);
|
27068
|
-
}
|
27069
|
-
}
|
27070
|
-
catch (error) {
|
27071
|
-
console.error(`Error detecting output directory: `, error);
|
27072
|
-
}
|
27073
|
-
return base;
|
27074
|
-
},
|
27075
27044
|
getOutputDirName: async (dirPrefix) => {
|
27076
27045
|
const base = 'build';
|
27077
27046
|
try {
|
@@ -27121,7 +27090,6 @@ exports.frameworks = [
|
|
27121
27090
|
},
|
27122
27091
|
},
|
27123
27092
|
dependency: 'preact-cli',
|
27124
|
-
getFsOutputDir: async () => 'build',
|
27125
27093
|
getOutputDirName: async () => 'build',
|
27126
27094
|
defaultRoutes: [
|
27127
27095
|
{
|
@@ -27176,7 +27144,6 @@ exports.frameworks = [
|
|
27176
27144
|
},
|
27177
27145
|
},
|
27178
27146
|
dependency: '@dojo/cli',
|
27179
|
-
getFsOutputDir: async () => 'output/dist',
|
27180
27147
|
getOutputDirName: async () => path_1.join('output', 'dist'),
|
27181
27148
|
defaultRoutes: [
|
27182
27149
|
{
|
@@ -27241,7 +27208,6 @@ exports.frameworks = [
|
|
27241
27208
|
},
|
27242
27209
|
},
|
27243
27210
|
dependency: 'ember-cli',
|
27244
|
-
getFsOutputDir: async () => 'dist',
|
27245
27211
|
getOutputDirName: async () => 'dist',
|
27246
27212
|
defaultRoutes: [
|
27247
27213
|
{
|
@@ -27294,7 +27260,6 @@ exports.frameworks = [
|
|
27294
27260
|
},
|
27295
27261
|
},
|
27296
27262
|
dependency: '@vue/cli-service',
|
27297
|
-
getFsOutputDir: async () => 'dist',
|
27298
27263
|
getOutputDirName: async () => 'dist',
|
27299
27264
|
defaultRoutes: [
|
27300
27265
|
{
|
@@ -27370,7 +27335,6 @@ exports.frameworks = [
|
|
27370
27335
|
},
|
27371
27336
|
},
|
27372
27337
|
dependency: '@scullyio/init',
|
27373
|
-
getFsOutputDir: async () => 'dist',
|
27374
27338
|
getOutputDirName: async () => 'dist/static',
|
27375
27339
|
},
|
27376
27340
|
{
|
@@ -27405,7 +27369,6 @@ exports.frameworks = [
|
|
27405
27369
|
},
|
27406
27370
|
},
|
27407
27371
|
dependency: '@ionic/angular',
|
27408
|
-
getFsOutputDir: async () => 'www',
|
27409
27372
|
getOutputDirName: async () => 'www',
|
27410
27373
|
defaultRoutes: [
|
27411
27374
|
{
|
@@ -27457,7 +27420,6 @@ exports.frameworks = [
|
|
27457
27420
|
},
|
27458
27421
|
},
|
27459
27422
|
dependency: '@angular/cli',
|
27460
|
-
getFsOutputDir: async () => 'dist',
|
27461
27423
|
getOutputDirName: async (dirPrefix) => {
|
27462
27424
|
const base = 'dist';
|
27463
27425
|
try {
|
@@ -27523,7 +27485,6 @@ exports.frameworks = [
|
|
27523
27485
|
},
|
27524
27486
|
},
|
27525
27487
|
dependency: 'polymer-cli',
|
27526
|
-
getFsOutputDir: async () => 'build',
|
27527
27488
|
getOutputDirName: async (dirPrefix) => {
|
27528
27489
|
const base = 'build';
|
27529
27490
|
try {
|
@@ -27591,7 +27552,6 @@ exports.frameworks = [
|
|
27591
27552
|
},
|
27592
27553
|
},
|
27593
27554
|
dependency: 'sirv-cli',
|
27594
|
-
getFsOutputDir: async () => 'public',
|
27595
27555
|
getOutputDirName: async () => 'public',
|
27596
27556
|
defaultRoutes: [
|
27597
27557
|
{
|
@@ -27639,10 +27599,9 @@ exports.frameworks = [
|
|
27639
27599
|
placeholder: 'svelte-kit dev',
|
27640
27600
|
},
|
27641
27601
|
outputDirectory: {
|
27642
|
-
|
27602
|
+
value: 'public',
|
27643
27603
|
},
|
27644
27604
|
},
|
27645
|
-
getFsOutputDir: async () => '.output',
|
27646
27605
|
getOutputDirName: async () => 'public',
|
27647
27606
|
},
|
27648
27607
|
{
|
@@ -27677,7 +27636,6 @@ exports.frameworks = [
|
|
27677
27636
|
},
|
27678
27637
|
},
|
27679
27638
|
dependency: '@ionic/react',
|
27680
|
-
getFsOutputDir: async () => 'build',
|
27681
27639
|
getOutputDirName: async () => 'build',
|
27682
27640
|
defaultRoutes: [
|
27683
27641
|
{
|
@@ -27782,7 +27740,6 @@ exports.frameworks = [
|
|
27782
27740
|
},
|
27783
27741
|
},
|
27784
27742
|
dependency: 'react-scripts',
|
27785
|
-
getFsOutputDir: async () => 'build',
|
27786
27743
|
getOutputDirName: async () => 'build',
|
27787
27744
|
defaultRoutes: [
|
27788
27745
|
{
|
@@ -27882,7 +27839,6 @@ exports.frameworks = [
|
|
27882
27839
|
},
|
27883
27840
|
},
|
27884
27841
|
dependency: 'gridsome',
|
27885
|
-
getFsOutputDir: async () => 'dist',
|
27886
27842
|
getOutputDirName: async () => 'dist',
|
27887
27843
|
},
|
27888
27844
|
{
|
@@ -27918,7 +27874,6 @@ exports.frameworks = [
|
|
27918
27874
|
},
|
27919
27875
|
},
|
27920
27876
|
dependency: 'umi',
|
27921
|
-
getFsOutputDir: async () => 'dist',
|
27922
27877
|
getOutputDirName: async () => 'dist',
|
27923
27878
|
defaultRoutes: [
|
27924
27879
|
{
|
@@ -27970,7 +27925,6 @@ exports.frameworks = [
|
|
27970
27925
|
},
|
27971
27926
|
},
|
27972
27927
|
dependency: 'sapper',
|
27973
|
-
getFsOutputDir: async () => '__sapper__/export',
|
27974
27928
|
getOutputDirName: async () => '__sapper__/export',
|
27975
27929
|
},
|
27976
27930
|
{
|
@@ -28006,7 +27960,6 @@ exports.frameworks = [
|
|
28006
27960
|
},
|
28007
27961
|
},
|
28008
27962
|
dependency: 'saber',
|
28009
|
-
getFsOutputDir: async () => 'public',
|
28010
27963
|
getOutputDirName: async () => 'public',
|
28011
27964
|
defaultRoutes: [
|
28012
27965
|
{
|
@@ -28073,7 +28026,6 @@ exports.frameworks = [
|
|
28073
28026
|
},
|
28074
28027
|
},
|
28075
28028
|
dependency: '@stencil/core',
|
28076
|
-
getFsOutputDir: async () => 'www',
|
28077
28029
|
getOutputDirName: async () => 'www',
|
28078
28030
|
defaultRoutes: [
|
28079
28031
|
{
|
@@ -28160,7 +28112,6 @@ exports.frameworks = [
|
|
28160
28112
|
},
|
28161
28113
|
},
|
28162
28114
|
dependency: 'nuxt',
|
28163
|
-
getFsOutputDir: async () => '.output',
|
28164
28115
|
getOutputDirName: async () => 'dist',
|
28165
28116
|
cachePattern: '.nuxt/**',
|
28166
28117
|
defaultRoutes: [
|
@@ -28217,7 +28168,6 @@ exports.frameworks = [
|
|
28217
28168
|
placeholder: 'RedwoodJS default',
|
28218
28169
|
},
|
28219
28170
|
},
|
28220
|
-
getFsOutputDir: async () => 'public',
|
28221
28171
|
getOutputDirName: async () => 'public',
|
28222
28172
|
},
|
28223
28173
|
{
|
@@ -28260,12 +28210,6 @@ exports.frameworks = [
|
|
28260
28210
|
placeholder: '`public` or `publishDir` from the `config` file',
|
28261
28211
|
},
|
28262
28212
|
},
|
28263
|
-
getFsOutputDir: async (dirPrefix) => {
|
28264
|
-
const config = await read_config_file_1.readConfigFile(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
|
28265
|
-
return path_1.join(dirPrefix, fileName);
|
28266
|
-
}));
|
28267
|
-
return (config && config.publishDir) || 'public';
|
28268
|
-
},
|
28269
28213
|
getOutputDirName: async (dirPrefix) => {
|
28270
28214
|
const config = await read_config_file_1.readConfigFile(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
|
28271
28215
|
return path_1.join(dirPrefix, fileName);
|
@@ -28305,10 +28249,6 @@ exports.frameworks = [
|
|
28305
28249
|
placeholder: '`_site` or `destination` from `_config.yml`',
|
28306
28250
|
},
|
28307
28251
|
},
|
28308
|
-
getFsOutputDir: async (dirPrefix) => {
|
28309
|
-
const config = await read_config_file_1.readConfigFile(path_1.join(dirPrefix, '_config.yml'));
|
28310
|
-
return (config && config.destination) || '_site';
|
28311
|
-
},
|
28312
28252
|
getOutputDirName: async (dirPrefix) => {
|
28313
28253
|
const config = await read_config_file_1.readConfigFile(path_1.join(dirPrefix, '_config.yml'));
|
28314
28254
|
return (config && config.destination) || '_site';
|
@@ -28346,7 +28286,6 @@ exports.frameworks = [
|
|
28346
28286
|
value: 'public',
|
28347
28287
|
},
|
28348
28288
|
},
|
28349
|
-
getFsOutputDir: async () => 'public',
|
28350
28289
|
getOutputDirName: async () => 'public',
|
28351
28290
|
},
|
28352
28291
|
{
|
@@ -28380,7 +28319,6 @@ exports.frameworks = [
|
|
28380
28319
|
value: 'build',
|
28381
28320
|
},
|
28382
28321
|
},
|
28383
|
-
getFsOutputDir: async () => 'build',
|
28384
28322
|
getOutputDirName: async () => 'build',
|
28385
28323
|
cachePattern: '{vendor/bin,vendor/cache,vendor/bundle}/**',
|
28386
28324
|
},
|
@@ -28415,7 +28353,6 @@ exports.frameworks = [
|
|
28415
28353
|
value: 'public',
|
28416
28354
|
},
|
28417
28355
|
},
|
28418
|
-
getFsOutputDir: async () => 'public',
|
28419
28356
|
getOutputDirName: async () => 'public',
|
28420
28357
|
defaultVersion: '0.13.0',
|
28421
28358
|
},
|
@@ -28453,7 +28390,6 @@ exports.frameworks = [
|
|
28453
28390
|
},
|
28454
28391
|
},
|
28455
28392
|
dependency: 'vite',
|
28456
|
-
getFsOutputDir: async () => 'dist',
|
28457
28393
|
getOutputDirName: async () => 'dist',
|
28458
28394
|
},
|
28459
28395
|
{
|
@@ -28489,7 +28425,6 @@ exports.frameworks = [
|
|
28489
28425
|
},
|
28490
28426
|
},
|
28491
28427
|
dependency: 'parcel',
|
28492
|
-
getFsOutputDir: async () => 'dist',
|
28493
28428
|
getOutputDirName: async () => 'dist',
|
28494
28429
|
defaultRoutes: [
|
28495
28430
|
{
|
@@ -32825,7 +32760,8 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
32825
32760
|
`api-routes-${pluginName}`);
|
32826
32761
|
await fs_extra_1.default.ensureDir(traceDir);
|
32827
32762
|
let newPathsRuntime = new Set();
|
32828
|
-
|
32763
|
+
const entryDir = path_1.join('.output', 'server', 'pages');
|
32764
|
+
const entryRoot = path_1.join(workPath, entryDir);
|
32829
32765
|
for (const entrypoint of Object.keys(entrypoints)) {
|
32830
32766
|
const { output } = await buildRuntime({
|
32831
32767
|
files: sourceFilesPreBuild,
|
@@ -32836,6 +32772,7 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
32836
32772
|
},
|
32837
32773
|
meta: {
|
32838
32774
|
avoidTopLevelInstall: true,
|
32775
|
+
skipDownload: true,
|
32839
32776
|
},
|
32840
32777
|
});
|
32841
32778
|
// Legacy Runtimes tend to pollute the `workPath` with compiled results,
|
@@ -32874,7 +32811,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
32874
32811
|
throw new Error(`Could not find a handler file. Please ensure that \`files\` for the returned \`Lambda\` contains an \`FileFsRef\` named "${handlerFileBase}" with a valid \`fsPath\`.`);
|
32875
32812
|
}
|
32876
32813
|
const handlerExtName = path_1.extname(handlerFile.fsPath);
|
32877
|
-
const entryRoot = path_1.join(workPath, '.output', 'server', 'pages');
|
32878
32814
|
const entryBase = path_1.basename(entrypoint).replace(ext, handlerExtName);
|
32879
32815
|
const entryPath = path_1.join(path_1.dirname(entrypoint), entryBase);
|
32880
32816
|
const entry = path_1.join(entryRoot, entryPath);
|
@@ -32930,54 +32866,22 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
32930
32866
|
}
|
32931
32867
|
}
|
32932
32868
|
}
|
32933
|
-
const tracedFiles = [];
|
32934
|
-
const linkers = Object.entries(lambdaFiles).map(async ([relPath, file]) => {
|
32935
|
-
const newPath = path_1.join(traceDir, relPath);
|
32936
|
-
// The handler was already moved into position above.
|
32937
|
-
if (relPath === handlerFileBase) {
|
32938
|
-
return;
|
32939
|
-
}
|
32940
|
-
tracedFiles.push({ absolutePath: newPath, relativePath: relPath });
|
32941
|
-
const { fsPath, type } = file;
|
32942
|
-
if (fsPath) {
|
32943
|
-
await fs_extra_1.default.ensureDir(path_1.dirname(newPath));
|
32944
|
-
const isNewFile = newFilesEntrypoint.includes(fsPath);
|
32945
|
-
const isInsideNewDirectory = newDirectoriesEntrypoint.some(dirPath => {
|
32946
|
-
return fsPath.startsWith(dirPath);
|
32947
|
-
});
|
32948
|
-
// With this, we're making sure that files in the `workPath` that existed
|
32949
|
-
// before the Legacy Runtime was invoked (source files) are linked from
|
32950
|
-
// `.output` instead of copying there (the latter only happens if linking fails),
|
32951
|
-
// which is the fastest solution. However, files that are created fresh
|
32952
|
-
// by the Legacy Runtimes are always copied, because their link destinations
|
32953
|
-
// are likely to be overwritten every time an entrypoint is processed by
|
32954
|
-
// the Legacy Runtime. This is likely to overwrite the destination on subsequent
|
32955
|
-
// runs, but that's also how `workPath` used to work originally, without
|
32956
|
-
// the File System API (meaning that there was one `workPath` for all entrypoints).
|
32957
|
-
if (isNewFile || isInsideNewDirectory) {
|
32958
|
-
_1.debug(`Copying from ${fsPath} to ${newPath}`);
|
32959
|
-
await fs_extra_1.default.copy(fsPath, newPath);
|
32960
|
-
}
|
32961
|
-
else {
|
32962
|
-
await linkOrCopy(fsPath, newPath);
|
32963
|
-
}
|
32964
|
-
}
|
32965
|
-
else if (type === 'FileBlob') {
|
32966
|
-
const { data, mode } = file;
|
32967
|
-
await fs_extra_1.default.writeFile(newPath, data, { mode });
|
32968
|
-
}
|
32969
|
-
else {
|
32970
|
-
throw new Error(`Unknown file type: ${type}`);
|
32971
|
-
}
|
32972
|
-
});
|
32973
|
-
linkersRuntime = linkersRuntime.concat(linkers);
|
32974
32869
|
const nft = `${entry}.nft.json`;
|
32975
32870
|
const json = JSON.stringify({
|
32976
|
-
version:
|
32977
|
-
files:
|
32978
|
-
|
32979
|
-
|
32980
|
-
|
32871
|
+
version: 2,
|
32872
|
+
files: Object.keys(lambdaFiles)
|
32873
|
+
.map(file => {
|
32874
|
+
const { fsPath } = lambdaFiles[file];
|
32875
|
+
if (!fsPath) {
|
32876
|
+
throw new Error(`File "${file}" is missing valid \`fsPath\` property`);
|
32877
|
+
}
|
32878
|
+
// The handler was already moved into position above.
|
32879
|
+
if (file === handlerFileBase) {
|
32880
|
+
return;
|
32881
|
+
}
|
32882
|
+
return normalize_path_1.normalizePath(path_1.relative(path_1.dirname(nft), fsPath));
|
32883
|
+
})
|
32884
|
+
.filter(Boolean),
|
32981
32885
|
});
|
32982
32886
|
await fs_extra_1.default.ensureDir(path_1.dirname(nft));
|
32983
32887
|
await fs_extra_1.default.writeFile(nft, json);
|
@@ -33004,11 +32908,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
33004
32908
|
allowQuery: output.allowQuery,
|
33005
32909
|
};
|
33006
32910
|
}
|
33007
|
-
// Instead of of waiting for all of the linking to be done for every
|
33008
|
-
// entrypoint before processing the next one, we immediately handle all
|
33009
|
-
// of them one after the other, while then waiting for the linking
|
33010
|
-
// to finish right here, before we clean up newly created files below.
|
33011
|
-
await Promise.all(linkersRuntime);
|
33012
32911
|
// A list of all the files that were created by the Legacy Runtime,
|
33013
32912
|
// which we'd like to remove from the File System.
|
33014
32913
|
const toRemove = Array.from(newPathsRuntime).map(path => {
|
@@ -33027,16 +32926,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
33027
32926
|
};
|
33028
32927
|
}
|
33029
32928
|
exports.convertRuntimeToPlugin = convertRuntimeToPlugin;
|
33030
|
-
async function linkOrCopy(existingPath, newPath) {
|
33031
|
-
try {
|
33032
|
-
await fs_extra_1.default.createLink(existingPath, newPath);
|
33033
|
-
}
|
33034
|
-
catch (err) {
|
33035
|
-
if (err.code !== 'EEXIST') {
|
33036
|
-
await fs_extra_1.default.copyFile(existingPath, newPath);
|
33037
|
-
}
|
33038
|
-
}
|
33039
|
-
}
|
33040
32929
|
async function readJson(filePath) {
|
33041
32930
|
try {
|
33042
32931
|
const str = await fs_extra_1.default.readFile(filePath, 'utf8');
|
@@ -33057,7 +32946,7 @@ async function updateFunctionsManifest({ workPath, pages, }) {
|
|
33057
32946
|
const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
|
33058
32947
|
const functionsManifest = await readJson(functionsManifestPath);
|
33059
32948
|
if (!functionsManifest.version)
|
33060
|
-
functionsManifest.version =
|
32949
|
+
functionsManifest.version = 2;
|
33061
32950
|
if (!functionsManifest.pages)
|
33062
32951
|
functionsManifest.pages = {};
|
33063
32952
|
for (const [pageKey, pageConfig] of Object.entries(pages)) {
|
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.39",
|
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.17",
|
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": "2c86ac654ccde97426127fd0a6ffd04253227c50"
|
53
53
|
}
|