@@ -45,8 +45,11 @@ const writeCacheEntry = async (
45
45
*/
46
46
const routeToFilePath = ( path : string ) => ( path === '/' ? '/index' : path )
47
47
48
- const buildPagesCacheValue = async ( path : string ) : Promise < NetlifyCachedPageValue > => ( {
49
- kind : 'PAGES' ,
48
+ const buildPagesCacheValue = async (
49
+ path : string ,
50
+ shouldUseEnumKind : boolean ,
51
+ ) : Promise < NetlifyCachedPageValue > => ( {
52
+ kind : shouldUseEnumKind ? 'PAGES' : 'PAGE' ,
50
53
html : await readFile ( `${ path } .html` , 'utf-8' ) ,
51
54
pageData : JSON . parse ( await readFile ( `${ path } .json` , 'utf-8' ) ) ,
52
55
headers : undefined ,
@@ -96,8 +99,9 @@ const buildAppCacheValue = async (
96
99
const buildRouteCacheValue = async (
97
100
path : string ,
98
101
initialRevalidateSeconds : number | false ,
102
+ shouldUseEnumKind : boolean ,
99
103
) : Promise < NetlifyCachedRouteValue > => ( {
100
- kind : 'APP_ROUTE' ,
104
+ kind : shouldUseEnumKind ? 'APP_ROUTE' : 'ROUTE ',
101
105
body : await readFile ( `${ path } .body` , 'base64' ) ,
102
106
...JSON . parse ( await readFile ( `${ path } .meta` , 'utf-8' ) ) ,
103
107
revalidate : initialRevalidateSeconds ,
@@ -133,6 +137,12 @@ export const copyPrerenderedContent = async (ctx: PluginContext): Promise<void>
133
137
} )
134
138
: false
135
139
140
+ const shouldUseEnumKind = ctx . nextVersion
141
+ ? satisfies ( ctx . nextVersion , '>=15.0.0-canary.114 <15.0.0-d || >15.0.0-rc.0' , {
142
+ includePrerelease : true ,
143
+ } )
144
+ : false
145
+
136
146
await Promise . all (
137
147
Object . entries ( manifest . routes ) . map (
138
148
( [ route , meta ] ) : Promise < void > =>
@@ -152,7 +162,10 @@ export const copyPrerenderedContent = async (ctx: PluginContext): Promise<void>
152
162
// if pages router returns 'notFound: true', build won't produce html and json files
153
163
return
154
164
}
155
- value = await buildPagesCacheValue ( join ( ctx . publishDir , 'server/pages' , key ) )
165
+ value = await buildPagesCacheValue (
166
+ join ( ctx . publishDir , 'server/pages' , key ) ,
167
+ shouldUseEnumKind ,
168
+ )
156
169
break
157
170
case meta . dataRoute ?. endsWith ( '.rsc' ) :
158
171
value = await buildAppCacheValue (
@@ -164,6 +177,7 @@ export const copyPrerenderedContent = async (ctx: PluginContext): Promise<void>
164
177
value = await buildRouteCacheValue (
165
178
join ( ctx . publishDir , 'server/app' , key ) ,
166
179
meta . initialRevalidateSeconds ,
180
+ shouldUseEnumKind ,
167
181
)
168
182
break
169
183
default :
0 commit comments