Skip to content

Commit 2dc856a

Browse files
committed
chore: renaming and adding gen to dev edge
1 parent f0ffb8f commit 2dc856a

File tree

3 files changed

+59
-58
lines changed

3 files changed

+59
-58
lines changed

packages/runtime/src/helpers/edge.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ export interface FunctionManifest {
5757
name?: string
5858
path: string
5959
cache?: 'manual'
60-
generator?: string
60+
generator: string
6161
}
6262
| {
6363
function: string
6464
name?: string
6565
pattern: string
6666
cache?: 'manual'
67-
generator?: string
67+
generator: string
6868
}
6969
>
7070
layers?: Array<{ name: `https://${string}/mod.ts`; flag: string }>
@@ -230,7 +230,7 @@ const middlewareMatcherToEdgeFunctionDefinition = (
230230
name?: string
231231
pattern: string
232232
cache?: 'manual'
233-
generator?: string
233+
generator: string
234234
} => {
235235
const pattern = transformCaptureGroups(stripLookahead(matcher.regexp))
236236
return { function: name, pattern, name, cache, generator }
@@ -243,12 +243,14 @@ export const cleanupEdgeFunctions = ({
243243
export const writeDevEdgeFunction = async ({
244244
INTERNAL_EDGE_FUNCTIONS_SRC = '.netlify/edge-functions',
245245
}: NetlifyPluginConstants) => {
246+
const generator = await getPluginVersion()
246247
const manifest: FunctionManifest = {
247248
functions: [
248249
{
249250
function: 'next-dev',
250251
name: 'netlify dev handler',
251252
path: '/*',
253+
generator,
252254
},
253255
],
254256
version: 1,
@@ -274,7 +276,7 @@ export const writeRscDataEdgeFunction = async ({
274276
prerenderManifest?: PrerenderManifest
275277
appPathRoutesManifest?: Record<string, string>
276278
}): Promise<FunctionManifest['functions']> => {
277-
const nextjsPluginVersion = await getPluginVersion()
279+
const generator = await getPluginVersion()
278280
if (!prerenderManifest || !appPathRoutesManifest) {
279281
return []
280282
}
@@ -305,13 +307,13 @@ export const writeRscDataEdgeFunction = async ({
305307
function: 'rsc-data',
306308
name: 'RSC data routing',
307309
path,
308-
generator: nextjsPluginVersion,
310+
generator,
309311
})),
310312
...dynamicAppDirRoutes.map((pattern) => ({
311313
function: 'rsc-data',
312314
name: 'RSC data routing',
313315
pattern,
314-
generator: nextjsPluginVersion,
316+
generator,
315317
})),
316318
]
317319
}
@@ -351,7 +353,7 @@ export const writeEdgeFunctions = async ({
351353
netlifyConfig: NetlifyConfig
352354
routesManifest: RoutesManifest
353355
}) => {
354-
const nextjsPluginVersion = await getPluginVersion()
356+
const generator = await getPluginVersion()
355357

356358
const manifest: FunctionManifest = {
357359
functions: [],
@@ -411,9 +413,7 @@ export const writeEdgeFunctions = async ({
411413
})
412414

413415
manifest.functions.push(
414-
...matchers.map((matcher) =>
415-
middlewareMatcherToEdgeFunctionDefinition(matcher, functionName, nextjsPluginVersion),
416-
),
416+
...matchers.map((matcher) => middlewareMatcherToEdgeFunctionDefinition(matcher, functionName, generator)),
417417
)
418418
}
419419
// Functions (i.e. not middleware, but edge SSR and API routes)
@@ -453,7 +453,7 @@ export const writeEdgeFunctions = async ({
453453
pattern,
454454
// cache: "manual" is currently experimental, so we restrict it to sites that use experimental appDir
455455
cache: usesAppDir ? 'manual' : undefined,
456-
generator: nextjsPluginVersion,
456+
generator,
457457
})
458458
// pages-dir page routes also have a data route. If there's a match, add an entry mapping that to the function too
459459
const dataRoute = dataRoutesMap.get(edgeFunctionDefinition.page)
@@ -463,7 +463,7 @@ export const writeEdgeFunctions = async ({
463463
name: edgeFunctionDefinition.name,
464464
pattern: dataRoute,
465465
cache: usesAppDir ? 'manual' : undefined,
466-
generator: nextjsPluginVersion,
466+
generator,
467467
})
468468
}
469469
}
@@ -489,7 +489,7 @@ export const writeEdgeFunctions = async ({
489489
function: 'ipx',
490490
name: 'next/image handler',
491491
path: nextConfig.images.path || '/_next/image',
492-
generator: nextjsPluginVersion,
492+
generator,
493493
})
494494

495495
manifest.layers.push({

packages/runtime/src/helpers/functionsMetaData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ export interface FunctionInfo {
5050
*/
5151
export const writeFunctionConfiguration = async (functionInfo: FunctionInfo) => {
5252
const { functionName, functionTitle, functionsDir } = functionInfo
53+
const generator = await getPluginVersion()
5354

5455
const metadata = {
5556
config: {
5657
name: functionTitle,
57-
generator: await getPluginVersion(),
58+
generator,
5859
},
5960
version: 1,
6061
}

0 commit comments

Comments
 (0)