[build-utils] Deprecate EdgeFunction#name property (#11010)

The `name` property of the `EdgeFunction` class is no longer necessary
on the infra side. Instead, its value is inferred based on the URL path
that the function is representing. So deprecate the property on the
class, and remove its usage throughout the codebase.
This commit is contained in:
Nathan Rajlich
2024-01-10 12:32:38 -08:00
committed by GitHub
parent 21c700aa93
commit 98040ec24e
6 changed files with 14 additions and 23 deletions

View File

@@ -540,17 +540,7 @@ module.exports = config;`;
throw new Error(`Could not determine server bundle for "${route.id}"`);
}
output[path] =
func instanceof EdgeFunction
? // `EdgeFunction` currently requires the "name" property to be set.
// Ideally this property will be removed, at which point we can
// return the same `edgeFunction` instance instead of creating a
// new one for each page.
new EdgeFunction({
...func,
name: path,
})
: func;
output[path] = func;
// If this is a dynamic route then add a Vercel route
const re = getRegExpFromPath(rePath);
@@ -573,10 +563,7 @@ module.exports = config;`;
);
const func =
edgeFunctionIndex !== -1 ? functions[edgeFunctionIndex] : functions[0];
output['404'] =
func instanceof EdgeFunction
? new EdgeFunction({ ...func, name: '404' })
: func;
output['404'] = func;
}
routes.push({
src: '/(.*)',
@@ -767,7 +754,6 @@ async function createRenderEdgeFunction(
const fn = new EdgeFunction({
files,
deploymentTarget: 'v8-worker',
name: 'render',
entrypoint: handler,
regions: config.regions,
framework: {