@vercel/build-utils 2.12.3-canary.33 → 2.12.3-canary.34

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.
@@ -106,14 +106,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
106
106
  const handler = output.handler;
107
107
  const handlerMethod = handler.split('.').reverse()[0];
108
108
  const handlerFileName = handler.replace(`.${handlerMethod}`, '');
109
- pages[entrypoint] = {
110
- handler: handler,
111
- runtime: output.runtime,
112
- memory: output.memory,
113
- maxDuration: output.maxDuration,
114
- environment: output.environment,
115
- allowQuery: output.allowQuery,
116
- };
117
109
  // @ts-ignore This symbol is a private API
118
110
  const lambdaFiles = output[lambda_1.FILES_SYMBOL];
119
111
  // When deploying, the `files` that are passed to the Legacy Runtimes already
@@ -133,8 +125,12 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
133
125
  throw new Error(`Could not find a handler file. Please ensure that the list of \`files\` defined for the returned \`Lambda\` contains a file with the name ${handlerFileName} (+ any extension).`);
134
126
  }
135
127
  const entry = path_1.join(workPath, '.output', 'server', 'pages', entrypoint);
128
+ // We never want to link here, only copy, because the launcher
129
+ // file often has the same name for every entrypoint, which means that
130
+ // every build for every entrypoint overwrites the launcher of the previous
131
+ // one, so linking would end with a broken reference.
136
132
  await fs_extra_1.default.ensureDir(path_1.dirname(entry));
137
- await linkOrCopy(handlerFileOrigin, entry);
133
+ await fs_extra_1.default.copy(handlerFileOrigin, entry);
138
134
  const newFilesEntrypoint = [];
139
135
  const newDirectoriesEntrypoint = [];
140
136
  const preBuildFiles = Object.values(sourceFilesPreBuild).map(file => {
@@ -240,6 +236,17 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
240
236
  ...newFilesEntrypoint,
241
237
  ...newDirectoriesEntrypoint,
242
238
  ]);
239
+ const apiRouteHandler = `${path_1.parse(entry).name}.${handlerMethod}`;
240
+ // Add an entry that will later on be added to the `functions-manifest.json`
241
+ // file that is placed inside of the `.output` directory.
242
+ pages[entrypoint] = {
243
+ handler: apiRouteHandler,
244
+ runtime: output.runtime,
245
+ memory: output.memory,
246
+ maxDuration: output.maxDuration,
247
+ environment: output.environment,
248
+ allowQuery: output.allowQuery,
249
+ };
243
250
  }
244
251
  // Instead of of waiting for all of the linking to be done for every
245
252
  // entrypoint before processing the next one, we immediately handle all
package/dist/index.js CHANGED
@@ -32853,14 +32853,6 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
32853
32853
  const handler = output.handler;
32854
32854
  const handlerMethod = handler.split('.').reverse()[0];
32855
32855
  const handlerFileName = handler.replace(`.${handlerMethod}`, '');
32856
- pages[entrypoint] = {
32857
- handler: handler,
32858
- runtime: output.runtime,
32859
- memory: output.memory,
32860
- maxDuration: output.maxDuration,
32861
- environment: output.environment,
32862
- allowQuery: output.allowQuery,
32863
- };
32864
32856
  // @ts-ignore This symbol is a private API
32865
32857
  const lambdaFiles = output[lambda_1.FILES_SYMBOL];
32866
32858
  // When deploying, the `files` that are passed to the Legacy Runtimes already
@@ -32880,8 +32872,12 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
32880
32872
  throw new Error(`Could not find a handler file. Please ensure that the list of \`files\` defined for the returned \`Lambda\` contains a file with the name ${handlerFileName} (+ any extension).`);
32881
32873
  }
32882
32874
  const entry = path_1.join(workPath, '.output', 'server', 'pages', entrypoint);
32875
+ // We never want to link here, only copy, because the launcher
32876
+ // file often has the same name for every entrypoint, which means that
32877
+ // every build for every entrypoint overwrites the launcher of the previous
32878
+ // one, so linking would end with a broken reference.
32883
32879
  await fs_extra_1.default.ensureDir(path_1.dirname(entry));
32884
- await linkOrCopy(handlerFileOrigin, entry);
32880
+ await fs_extra_1.default.copy(handlerFileOrigin, entry);
32885
32881
  const newFilesEntrypoint = [];
32886
32882
  const newDirectoriesEntrypoint = [];
32887
32883
  const preBuildFiles = Object.values(sourceFilesPreBuild).map(file => {
@@ -32987,6 +32983,17 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
32987
32983
  ...newFilesEntrypoint,
32988
32984
  ...newDirectoriesEntrypoint,
32989
32985
  ]);
32986
+ const apiRouteHandler = `${path_1.parse(entry).name}.${handlerMethod}`;
32987
+ // Add an entry that will later on be added to the `functions-manifest.json`
32988
+ // file that is placed inside of the `.output` directory.
32989
+ pages[entrypoint] = {
32990
+ handler: apiRouteHandler,
32991
+ runtime: output.runtime,
32992
+ memory: output.memory,
32993
+ maxDuration: output.maxDuration,
32994
+ environment: output.environment,
32995
+ allowQuery: output.allowQuery,
32996
+ };
32990
32997
  }
32991
32998
  // Instead of of waiting for all of the linking to be done for every
32992
32999
  // entrypoint before processing the next one, we immediately handle all
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.12.3-canary.33",
3
+ "version": "2.12.3-canary.34",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -49,5 +49,5 @@
49
49
  "typescript": "4.3.4",
50
50
  "yazl": "2.4.3"
51
51
  },
52
- "gitHead": "5efd3b98deb33029180ac40b0e30df1155c1ea5d"
52
+ "gitHead": "34f4222ca2d3cc5134469daa355a7f67c2054c9b"
53
53
  }