@teyik0/furin 0.9.0-alpha.5 → 0.9.0-alpha.6
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/adapter/vercel.js +9 -6
- package/dist/build/index.js +9 -6
- package/dist/cli/index.js +9 -6
- package/package.json +1 -1
- package/src/adapter/vercel.ts +21 -8
package/dist/adapter/vercel.js
CHANGED
|
@@ -267,6 +267,9 @@ function expirationFor(route) {
|
|
|
267
267
|
function prerenderAllowQuery(route) {
|
|
268
268
|
return route.queryKeys === null ? undefined : [ISR_PATH_PARAM, ...route.queryKeys];
|
|
269
269
|
}
|
|
270
|
+
function pprChain(route, functionName, pprResumeKey) {
|
|
271
|
+
return route.ppr ? { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: functionName } : undefined;
|
|
272
|
+
}
|
|
270
273
|
function createPrerenderSpecs(apps, pprResumeKey) {
|
|
271
274
|
const specs = new Map;
|
|
272
275
|
const names = new Map;
|
|
@@ -278,17 +281,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
278
281
|
}
|
|
279
282
|
const physicalPattern = physicalPath(app.prefix, route.pattern);
|
|
280
283
|
const source = routePatternSource(app.prefix, route.pattern);
|
|
284
|
+
const functionName = functionNameForPath(physicalPattern, route.mode, names);
|
|
281
285
|
specs.set(source, {
|
|
282
286
|
config: {
|
|
283
287
|
allowQuery: prerenderAllowQuery(route),
|
|
284
288
|
expiration: expirationFor(route),
|
|
285
289
|
passQuery: true,
|
|
286
|
-
|
|
287
|
-
chain: { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: "__server" }
|
|
288
|
-
} : {}
|
|
290
|
+
chain: pprChain(route, functionName, pprResumeKey)
|
|
289
291
|
},
|
|
290
292
|
exact: !DYNAMIC_SEGMENT_RE.test(route.pattern),
|
|
291
|
-
functionName
|
|
293
|
+
functionName,
|
|
292
294
|
pattern: physicalPattern,
|
|
293
295
|
source
|
|
294
296
|
});
|
|
@@ -303,15 +305,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
303
305
|
const path = physicalPath(app.prefix, prerender.path);
|
|
304
306
|
let spec = specs.get(routePatternSource(app.prefix, route.pattern));
|
|
305
307
|
if (DYNAMIC_SEGMENT_RE.test(route.pattern)) {
|
|
308
|
+
const functionName = functionNameForPath(path, route.mode, names);
|
|
306
309
|
spec = {
|
|
307
310
|
config: {
|
|
308
311
|
allowQuery: spec.config.allowQuery,
|
|
309
|
-
chain:
|
|
312
|
+
chain: pprChain(route, functionName, pprResumeKey),
|
|
310
313
|
expiration: expirationFor(route),
|
|
311
314
|
passQuery: true
|
|
312
315
|
},
|
|
313
316
|
exact: true,
|
|
314
|
-
functionName
|
|
317
|
+
functionName,
|
|
315
318
|
pattern: path,
|
|
316
319
|
source: exactPathSource(path)
|
|
317
320
|
};
|
package/dist/build/index.js
CHANGED
|
@@ -9717,6 +9717,9 @@ function expirationFor(route) {
|
|
|
9717
9717
|
function prerenderAllowQuery(route) {
|
|
9718
9718
|
return route.queryKeys === null ? undefined : [ISR_PATH_PARAM, ...route.queryKeys];
|
|
9719
9719
|
}
|
|
9720
|
+
function pprChain(route, functionName, pprResumeKey) {
|
|
9721
|
+
return route.ppr ? { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: functionName } : undefined;
|
|
9722
|
+
}
|
|
9720
9723
|
function createPrerenderSpecs(apps, pprResumeKey) {
|
|
9721
9724
|
const specs = new Map;
|
|
9722
9725
|
const names = new Map;
|
|
@@ -9728,17 +9731,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
9728
9731
|
}
|
|
9729
9732
|
const physicalPattern = physicalPath(app.prefix, route.pattern);
|
|
9730
9733
|
const source = routePatternSource(app.prefix, route.pattern);
|
|
9734
|
+
const functionName = functionNameForPath(physicalPattern, route.mode, names);
|
|
9731
9735
|
specs.set(source, {
|
|
9732
9736
|
config: {
|
|
9733
9737
|
allowQuery: prerenderAllowQuery(route),
|
|
9734
9738
|
expiration: expirationFor(route),
|
|
9735
9739
|
passQuery: true,
|
|
9736
|
-
|
|
9737
|
-
chain: { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: "__server" }
|
|
9738
|
-
} : {}
|
|
9740
|
+
chain: pprChain(route, functionName, pprResumeKey)
|
|
9739
9741
|
},
|
|
9740
9742
|
exact: !DYNAMIC_SEGMENT_RE.test(route.pattern),
|
|
9741
|
-
functionName
|
|
9743
|
+
functionName,
|
|
9742
9744
|
pattern: physicalPattern,
|
|
9743
9745
|
source
|
|
9744
9746
|
});
|
|
@@ -9753,15 +9755,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
9753
9755
|
const path = physicalPath(app.prefix, prerender.path);
|
|
9754
9756
|
let spec = specs.get(routePatternSource(app.prefix, route.pattern));
|
|
9755
9757
|
if (DYNAMIC_SEGMENT_RE.test(route.pattern)) {
|
|
9758
|
+
const functionName = functionNameForPath(path, route.mode, names);
|
|
9756
9759
|
spec = {
|
|
9757
9760
|
config: {
|
|
9758
9761
|
allowQuery: spec.config.allowQuery,
|
|
9759
|
-
chain:
|
|
9762
|
+
chain: pprChain(route, functionName, pprResumeKey),
|
|
9760
9763
|
expiration: expirationFor(route),
|
|
9761
9764
|
passQuery: true
|
|
9762
9765
|
},
|
|
9763
9766
|
exact: true,
|
|
9764
|
-
functionName
|
|
9767
|
+
functionName,
|
|
9765
9768
|
pattern: path,
|
|
9766
9769
|
source: exactPathSource(path)
|
|
9767
9770
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -9724,6 +9724,9 @@ function expirationFor(route) {
|
|
|
9724
9724
|
function prerenderAllowQuery(route) {
|
|
9725
9725
|
return route.queryKeys === null ? undefined : [ISR_PATH_PARAM, ...route.queryKeys];
|
|
9726
9726
|
}
|
|
9727
|
+
function pprChain(route, functionName, pprResumeKey) {
|
|
9728
|
+
return route.ppr ? { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: functionName } : undefined;
|
|
9729
|
+
}
|
|
9727
9730
|
function createPrerenderSpecs(apps, pprResumeKey) {
|
|
9728
9731
|
const specs = new Map;
|
|
9729
9732
|
const names = new Map;
|
|
@@ -9735,17 +9738,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
9735
9738
|
}
|
|
9736
9739
|
const physicalPattern = physicalPath(app.prefix, route.pattern);
|
|
9737
9740
|
const source = routePatternSource(app.prefix, route.pattern);
|
|
9741
|
+
const functionName = functionNameForPath(physicalPattern, route.mode, names);
|
|
9738
9742
|
specs.set(source, {
|
|
9739
9743
|
config: {
|
|
9740
9744
|
allowQuery: prerenderAllowQuery(route),
|
|
9741
9745
|
expiration: expirationFor(route),
|
|
9742
9746
|
passQuery: true,
|
|
9743
|
-
|
|
9744
|
-
chain: { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: "__server" }
|
|
9745
|
-
} : {}
|
|
9747
|
+
chain: pprChain(route, functionName, pprResumeKey)
|
|
9746
9748
|
},
|
|
9747
9749
|
exact: !DYNAMIC_SEGMENT_RE.test(route.pattern),
|
|
9748
|
-
functionName
|
|
9750
|
+
functionName,
|
|
9749
9751
|
pattern: physicalPattern,
|
|
9750
9752
|
source
|
|
9751
9753
|
});
|
|
@@ -9760,15 +9762,16 @@ function createPrerenderSpecs(apps, pprResumeKey) {
|
|
|
9760
9762
|
const path = physicalPath(app.prefix, prerender.path);
|
|
9761
9763
|
let spec = specs.get(routePatternSource(app.prefix, route.pattern));
|
|
9762
9764
|
if (DYNAMIC_SEGMENT_RE.test(route.pattern)) {
|
|
9765
|
+
const functionName = functionNameForPath(path, route.mode, names);
|
|
9763
9766
|
spec = {
|
|
9764
9767
|
config: {
|
|
9765
9768
|
allowQuery: spec.config.allowQuery,
|
|
9766
|
-
chain:
|
|
9769
|
+
chain: pprChain(route, functionName, pprResumeKey),
|
|
9767
9770
|
expiration: expirationFor(route),
|
|
9768
9771
|
passQuery: true
|
|
9769
9772
|
},
|
|
9770
9773
|
exact: true,
|
|
9771
|
-
functionName
|
|
9774
|
+
functionName,
|
|
9772
9775
|
pattern: path,
|
|
9773
9776
|
source: exactPathSource(path)
|
|
9774
9777
|
};
|
package/package.json
CHANGED
package/src/adapter/vercel.ts
CHANGED
|
@@ -200,6 +200,21 @@ function prerenderAllowQuery(route: AdapterRoute): string[] | undefined {
|
|
|
200
200
|
return route.queryKeys === null ? undefined : [ISR_PATH_PARAM, ...route.queryKeys];
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* A PPR shell resumes on its own output path, as Next.js does. Vercel stops
|
|
205
|
+
* routing to an output that another prerender targets through `chain`, so
|
|
206
|
+
* chaining to `__server` would 404 every request routed to it.
|
|
207
|
+
*/
|
|
208
|
+
function pprChain(
|
|
209
|
+
route: AdapterRoute,
|
|
210
|
+
functionName: string,
|
|
211
|
+
pprResumeKey: string
|
|
212
|
+
): PrerenderConfig["chain"] {
|
|
213
|
+
return route.ppr
|
|
214
|
+
? { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: functionName }
|
|
215
|
+
: undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
203
218
|
function createPrerenderSpecs(
|
|
204
219
|
apps: AdapterApp[],
|
|
205
220
|
pprResumeKey: string
|
|
@@ -215,6 +230,7 @@ function createPrerenderSpecs(
|
|
|
215
230
|
}
|
|
216
231
|
const physicalPattern = physicalPath(app.prefix, route.pattern);
|
|
217
232
|
const source = routePatternSource(app.prefix, route.pattern);
|
|
233
|
+
const functionName = functionNameForPath(physicalPattern, route.mode, names);
|
|
218
234
|
specs.set(source, {
|
|
219
235
|
config: {
|
|
220
236
|
// PPR holes resume with the query the shell recorded, which is the
|
|
@@ -222,14 +238,10 @@ function createPrerenderSpecs(
|
|
|
222
238
|
allowQuery: prerenderAllowQuery(route),
|
|
223
239
|
expiration: expirationFor(route),
|
|
224
240
|
passQuery: true,
|
|
225
|
-
|
|
226
|
-
? {
|
|
227
|
-
chain: { headers: { "x-furin-ppr-resume": pprResumeKey }, outputPath: "__server" },
|
|
228
|
-
}
|
|
229
|
-
: {}),
|
|
241
|
+
chain: pprChain(route, functionName, pprResumeKey),
|
|
230
242
|
},
|
|
231
243
|
exact: !DYNAMIC_SEGMENT_RE.test(route.pattern),
|
|
232
|
-
functionName
|
|
244
|
+
functionName,
|
|
233
245
|
pattern: physicalPattern,
|
|
234
246
|
source,
|
|
235
247
|
});
|
|
@@ -245,15 +257,16 @@ function createPrerenderSpecs(
|
|
|
245
257
|
const path = physicalPath(app.prefix, prerender.path);
|
|
246
258
|
let spec = specs.get(routePatternSource(app.prefix, route.pattern)) as PrerenderSpec;
|
|
247
259
|
if (DYNAMIC_SEGMENT_RE.test(route.pattern)) {
|
|
260
|
+
const functionName = functionNameForPath(path, route.mode, names);
|
|
248
261
|
spec = {
|
|
249
262
|
config: {
|
|
250
263
|
allowQuery: spec.config.allowQuery,
|
|
251
|
-
chain:
|
|
264
|
+
chain: pprChain(route, functionName, pprResumeKey),
|
|
252
265
|
expiration: expirationFor(route),
|
|
253
266
|
passQuery: true,
|
|
254
267
|
},
|
|
255
268
|
exact: true,
|
|
256
|
-
functionName
|
|
269
|
+
functionName,
|
|
257
270
|
pattern: path,
|
|
258
271
|
source: exactPathSource(path),
|
|
259
272
|
};
|