eddev 2.3.10 → 2.3.11-beta.1
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/app/lib/blocks/editor/blocks-by-tag.js +1 -1
- package/dist/app/lib/blocks/editor/editor-config.d.ts +1 -1
- package/dist/app/lib/blocks/editor/root-blocks.js +3 -3
- package/dist/app/server/render-ssr-page.d.ts.map +1 -1
- package/dist/app/server/render-ssr-page.js +3 -0
- package/dist/app/server/server-context.d.ts +3 -0
- package/dist/app/server/server-context.d.ts.map +1 -1
- package/dist/app/server/server-context.js +139 -123
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.d.ts.map +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/cache-config.d.ts +1 -0
- package/dist/node/compiler/cache-config.d.ts.map +1 -1
- package/dist/node/compiler/cache-config.js +41 -3
- package/dist/node/compiler/vinxi-app.d.ts +1 -1
- package/dist/node/compiler/vinxi-app.d.ts.map +1 -1
- package/dist/node/compiler/vinxi-app.js +38 -33
- package/dist/node/project/config.d.ts +0 -10
- package/dist/node/project/config.d.ts.map +1 -1
- package/dist/node/project/config.js +5 -7
- package/package.json +4 -2
- package/types.meta.d.ts +3 -3
|
@@ -21,7 +21,7 @@ export const blocksByTag = {
|
|
|
21
21
|
if (Array.isArray(blocks)) {
|
|
22
22
|
for (let name of blocks) {
|
|
23
23
|
result.add(name);
|
|
24
|
-
if (name === "root") {
|
|
24
|
+
if (name === "root" || name === "#root") {
|
|
25
25
|
result.add("core/post-content");
|
|
26
26
|
}
|
|
27
27
|
if (name.match(/^[a-z0-9\-\_]+\/[a-z0-9\-\_]+$/)) {
|
|
@@ -12,7 +12,7 @@ export type EditorConfigItem = {
|
|
|
12
12
|
*
|
|
13
13
|
* The default is "root".
|
|
14
14
|
*
|
|
15
|
-
* @default ["root"]
|
|
15
|
+
* @default ["root", "#root"]
|
|
16
16
|
**/
|
|
17
17
|
rootBlocks?: (ChildBlockTypeName | BlockTagName)[];
|
|
18
18
|
/** Allows you to add additional class names to blocks, depending on their type and state */
|
|
@@ -2,13 +2,13 @@ import { hash } from "object-code";
|
|
|
2
2
|
import { subscribe, snapshot } from "valtio";
|
|
3
3
|
import { editorConfigStore } from "./editor-config";
|
|
4
4
|
import { blocksByTag } from "./blocks-by-tag";
|
|
5
|
-
let constraint = ["root"];
|
|
6
|
-
let rootBlockList = new Set(["root"]);
|
|
5
|
+
let constraint = ["root", "#root"];
|
|
6
|
+
let rootBlockList = new Set(["root", "#root"]);
|
|
7
7
|
export const rootBlocks = {
|
|
8
8
|
listen() {
|
|
9
9
|
let key = hash(rootBlocks);
|
|
10
10
|
subscribe(editorConfigStore, () => {
|
|
11
|
-
constraint = snapshot(editorConfigStore.currentBlocksConfig).rootBlocks ?? ["root"];
|
|
11
|
+
constraint = snapshot(editorConfigStore.currentBlocksConfig).rootBlocks ?? ["root", "#root"];
|
|
12
12
|
let newKey = hash(constraint);
|
|
13
13
|
if (key === newKey)
|
|
14
14
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-ssr-page.d.ts","sourceRoot":"","sources":["../../../src/app/server/render-ssr-page.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAKrF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,qBAAqB,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,OAAO,wDAyH/C;AAED,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,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K,GAAG;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,UA8B1D"}
|
|
@@ -167,6 +167,9 @@ export async function renderPage(args) {
|
|
|
167
167
|
});
|
|
168
168
|
responseHeaders.set("Content-Type", "text/html; charset=utf-8");
|
|
169
169
|
responseHeaders.set("X-Ed-Rendered-At", new Date().toUTCString());
|
|
170
|
+
if (!serverContext.cacheConfig.serverless.isr) {
|
|
171
|
+
responseHeaders.set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
|
172
|
+
}
|
|
170
173
|
if (args.statusCode) {
|
|
171
174
|
responseInit.status = args.statusCode;
|
|
172
175
|
}
|
|
@@ -33,6 +33,9 @@ export declare class ServerContext {
|
|
|
33
33
|
constructor(conf: ServerContextArgs);
|
|
34
34
|
replaceUrls(text: string, origin?: string): string;
|
|
35
35
|
get runtime(): ServerContextRuntime;
|
|
36
|
+
get useDataCache(): boolean;
|
|
37
|
+
private createCacheContext;
|
|
38
|
+
private applyServerlessCacheHeaders;
|
|
36
39
|
static setRuntime(rt: ServerContextRuntime): void;
|
|
37
40
|
getOriginUrl(url: string): string;
|
|
38
41
|
fetchOrigin(url: string, opts?: RequestInit & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-context.d.ts","sourceRoot":"","sources":["../../../src/app/server/server-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAoC,MAAM,YAAY,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE3E,OAAO,EAAiC,W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AS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IA4C1F,qBAAqB,CAAC,GAAG,CAAC,EAAE,cAAc;IAYpC,eAAe,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,CAAA;KAAE;IAoE/F,aAAa,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,CAAA;KAAE;IA0BhF,IAAI,kBAAkB,aAcrB;IAED,YAAY,CAAC,KAAK,EAAE,OAAO;IAc3B,aAAa,CAAC,YAAY,EAAE,MAAM;IAUlC,cAAc,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;CAiD9B"}
|
|
@@ -49,6 +49,20 @@ export class ServerContext {
|
|
|
49
49
|
get runtime() {
|
|
50
50
|
return runtime;
|
|
51
51
|
}
|
|
52
|
+
get useDataCache() {
|
|
53
|
+
return this.cacheConfig.serverless.dataCache !== "none";
|
|
54
|
+
}
|
|
55
|
+
createCacheContext() {
|
|
56
|
+
return { metadata: {} };
|
|
57
|
+
}
|
|
58
|
+
applyServerlessCacheHeaders(headers) {
|
|
59
|
+
if (this.cacheConfig.serverless.isr) {
|
|
60
|
+
headers.delete("cache-control");
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
headers.set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
52
66
|
static setRuntime(rt) {
|
|
53
67
|
runtime = rt;
|
|
54
68
|
}
|
|
@@ -190,135 +204,139 @@ export class ServerContext {
|
|
|
190
204
|
* TODO: Potential support for Vercel draft mode.
|
|
191
205
|
*/
|
|
192
206
|
let cacheKey = "fetchRouteData:" + withTrailingSlash(req.pathname.toLowerCase());
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
let
|
|
222
|
-
let
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (result.headers.has("location")) {
|
|
226
|
-
let location = result.headers.get("location");
|
|
227
|
-
let status = result.status;
|
|
228
|
-
if (this.replaceUrls) {
|
|
229
|
-
location = this.replaceUrls(location);
|
|
230
|
-
}
|
|
231
|
-
return {
|
|
232
|
-
status: 200,
|
|
233
|
-
headers: new Headers({
|
|
234
|
-
"Content-Type": "application/json",
|
|
235
|
-
}),
|
|
236
|
-
data: JSON.stringify({ redirect: location, status: status }),
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
try {
|
|
240
|
-
resultData = await result.json();
|
|
241
|
-
}
|
|
242
|
-
catch (err) {
|
|
243
|
-
console.error(`Invalid JSON response from '${fetchUrl}'. An error page will be displayed.`);
|
|
244
|
-
ctx.metadata.ttl = 0;
|
|
245
|
-
return {
|
|
246
|
-
status: 500,
|
|
247
|
-
headers: resultHeaders,
|
|
248
|
-
data: JSON.stringify({
|
|
249
|
-
view: "_error",
|
|
250
|
-
viewData: {
|
|
251
|
-
data: {
|
|
252
|
-
statusCode: 500,
|
|
253
|
-
title: "Internal Server Error",
|
|
254
|
-
userMessage: "An internal server error occurred.",
|
|
255
|
-
report: {
|
|
256
|
-
details: "A JSON parsing error occurred while fetching route data.",
|
|
257
|
-
message: err.message,
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
}),
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
if (resultData && typeof resultData === "object") {
|
|
265
|
-
resultData.__generated = new Date().toISOString();
|
|
266
|
-
}
|
|
267
|
-
if (resultData.queryMonitor) {
|
|
268
|
-
this.debugLogQueryMonitor("props", req.pathname, resultData.queryMonitor);
|
|
207
|
+
const getFreshValue = async (ctx) => {
|
|
208
|
+
const fetchUrl = withQuery(withTrailingSlash(req.pathname), {
|
|
209
|
+
_props: "1",
|
|
210
|
+
_ssr: "1",
|
|
211
|
+
_debug: this.dev ? "1" : undefined,
|
|
212
|
+
});
|
|
213
|
+
const result = await this.fetchOrigin(fetchUrl, {
|
|
214
|
+
cache: "no-cache",
|
|
215
|
+
replaceUrls: true,
|
|
216
|
+
newOrigin: req.newOrigin,
|
|
217
|
+
headers: {
|
|
218
|
+
"Content-Type": "application/json",
|
|
219
|
+
Accept: "application/json",
|
|
220
|
+
},
|
|
221
|
+
redirect: "manual",
|
|
222
|
+
});
|
|
223
|
+
const preferredCacheDuration = parseInt(result.headers.get("x-ed-cache-duration") ?? "");
|
|
224
|
+
if (this.cacheConfig.serverless.isr) {
|
|
225
|
+
ctx.metadata.ttl = 5000;
|
|
226
|
+
}
|
|
227
|
+
else if (isFinite(preferredCacheDuration)) {
|
|
228
|
+
ctx.metadata.ttl = preferredCacheDuration * 1000;
|
|
229
|
+
}
|
|
230
|
+
let resultStatus = result.status;
|
|
231
|
+
let resultHeaders = new Headers(result.headers);
|
|
232
|
+
let resultData = {};
|
|
233
|
+
// Special case for redirects
|
|
234
|
+
if (result.headers.has("location")) {
|
|
235
|
+
let location = result.headers.get("location");
|
|
236
|
+
let status = result.status;
|
|
237
|
+
if (this.replaceUrls) {
|
|
238
|
+
location = this.replaceUrls(location);
|
|
269
239
|
}
|
|
270
|
-
// if (isFinite(preferredCacheDuration)) {
|
|
271
|
-
// const maxAge = isFinite(preferredCacheDuration) ? preferredCacheDuration * 1000 : undefined
|
|
272
|
-
// resultHeaders.set("Cache-Control", `max-age=0, s-maxage=${maxAge}, stale-while-revalidate`)
|
|
273
|
-
// }
|
|
274
|
-
resultHeaders.set("X-Ed-Fetched-At", new Date().toUTCString());
|
|
275
240
|
return {
|
|
276
|
-
status:
|
|
241
|
+
status: 200,
|
|
242
|
+
headers: new Headers({
|
|
243
|
+
"Content-Type": "application/json",
|
|
244
|
+
}),
|
|
245
|
+
data: JSON.stringify({ redirect: location, status: status }),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
resultData = await result.json();
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
console.error(`Invalid JSON response from '${fetchUrl}'. An error page will be displayed.`);
|
|
253
|
+
ctx.metadata.ttl = 0;
|
|
254
|
+
return {
|
|
255
|
+
status: 500,
|
|
277
256
|
headers: resultHeaders,
|
|
278
|
-
data: JSON.stringify(
|
|
257
|
+
data: JSON.stringify({
|
|
258
|
+
view: "_error",
|
|
259
|
+
viewData: {
|
|
260
|
+
data: {
|
|
261
|
+
statusCode: 500,
|
|
262
|
+
title: "Internal Server Error",
|
|
263
|
+
userMessage: "An internal server error occurred.",
|
|
264
|
+
report: {
|
|
265
|
+
details: "A JSON parsing error occurred while fetching route data.",
|
|
266
|
+
message: err.message,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
279
271
|
};
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
272
|
+
}
|
|
273
|
+
if (resultData && typeof resultData === "object") {
|
|
274
|
+
resultData.__generated = new Date().toISOString();
|
|
275
|
+
}
|
|
276
|
+
if (resultData.queryMonitor) {
|
|
277
|
+
this.debugLogQueryMonitor("props", req.pathname, resultData.queryMonitor);
|
|
278
|
+
}
|
|
279
|
+
// if (isFinite(preferredCacheDuration)) {
|
|
280
|
+
// const maxAge = isFinite(preferredCacheDuration) ? preferredCacheDuration * 1000 : undefined
|
|
281
|
+
// resultHeaders.set("Cache-Control", `max-age=0, s-maxage=${maxAge}, stale-while-revalidate`)
|
|
282
|
+
// }
|
|
283
|
+
resultHeaders.set("X-Ed-Fetched-At", new Date().toUTCString());
|
|
284
|
+
return {
|
|
285
|
+
status: resultStatus,
|
|
286
|
+
headers: resultHeaders,
|
|
287
|
+
data: JSON.stringify(resultData),
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
const result = this.useDataCache
|
|
291
|
+
? await swr({
|
|
292
|
+
key: cacheKey,
|
|
293
|
+
cache: pageCache,
|
|
294
|
+
forceFresh: this.dev || req.bypass,
|
|
295
|
+
staleWhileRevalidate: 10000,
|
|
296
|
+
getFreshValue,
|
|
297
|
+
})
|
|
298
|
+
: await getFreshValue(this.createCacheContext());
|
|
299
|
+
this.applyServerlessCacheHeaders(result.headers);
|
|
285
300
|
return new Response(result.data, {
|
|
286
301
|
status: result.status,
|
|
287
302
|
headers: result.headers,
|
|
288
303
|
});
|
|
289
304
|
}
|
|
290
305
|
async fetchAppData(args) {
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
306
|
+
const getFreshValue = async (ctx) => {
|
|
307
|
+
const response = await this.fetchOrigin("/_appdata", {
|
|
308
|
+
cache: "no-cache",
|
|
309
|
+
replaceUrls: true,
|
|
310
|
+
newOrigin: args.newOrigin,
|
|
311
|
+
headers: {
|
|
312
|
+
"Content-Type": "application/json",
|
|
313
|
+
Accept: "application/json",
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
const result = await response.json();
|
|
317
|
+
const preferredCacheDuration = parseInt(response.headers.get("x-ed-cache-duration") ?? "");
|
|
318
|
+
if (isFinite(preferredCacheDuration)) {
|
|
319
|
+
ctx.metadata.ttl = preferredCacheDuration * 1000;
|
|
320
|
+
}
|
|
321
|
+
// In ISR mode, set a super short TTL to avoid caching, but preventing constant revalidation
|
|
322
|
+
if (this.cacheConfig.serverless.isr) {
|
|
323
|
+
ctx.metadata.ttl = 5000;
|
|
324
|
+
}
|
|
325
|
+
if (result.queryMonitor) {
|
|
326
|
+
this.debugLogQueryMonitor("app", "", result.queryMonitor);
|
|
327
|
+
}
|
|
328
|
+
result.__generated = new Date().toISOString();
|
|
329
|
+
return result;
|
|
330
|
+
};
|
|
331
|
+
const data = this.useDataCache
|
|
332
|
+
? await swr({
|
|
333
|
+
key: "fetchAppData",
|
|
334
|
+
cache: pageCache,
|
|
335
|
+
forceFresh: this.dev || args.bypass,
|
|
336
|
+
staleWhileRevalidate: 10000,
|
|
337
|
+
getFreshValue,
|
|
338
|
+
})
|
|
339
|
+
: await getFreshValue(this.createCacheContext());
|
|
322
340
|
return data;
|
|
323
341
|
}
|
|
324
342
|
extractRequestHeaders(req) {
|
|
@@ -366,7 +384,7 @@ export class ServerContext {
|
|
|
366
384
|
// If headers like 'Authorization' are set, then we shouldn't cache.
|
|
367
385
|
const hasVariedHeaders = VARIES_HEADERS.some((key) => !!req.headers[key]);
|
|
368
386
|
// Get the result, either from cache or by fetching.
|
|
369
|
-
const result = hasVariedHeaders
|
|
387
|
+
const result = hasVariedHeaders || !this.useDataCache
|
|
370
388
|
? await fetch()
|
|
371
389
|
: await swr({
|
|
372
390
|
key,
|
|
@@ -382,9 +400,7 @@ export class ServerContext {
|
|
|
382
400
|
return result;
|
|
383
401
|
},
|
|
384
402
|
});
|
|
385
|
-
|
|
386
|
-
result.headers.delete("cache-control");
|
|
387
|
-
}
|
|
403
|
+
this.applyServerlessCacheHeaders(result.headers);
|
|
388
404
|
return new Response(result.data, {
|
|
389
405
|
status: result.status,
|
|
390
406
|
headers: result.headers,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.11-beta.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/node/cli/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/node/cli/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,kBAAkB,CAAA"}
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.11-beta.1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-config.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/cache-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEnF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"cache-config.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/cache-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,UAWnD;AA2BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,aAAa,CAyB9E"}
|
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
import { EDCacheConfigSchema } from "../project/config.js";
|
|
2
|
+
export function normalizeCacheHostname(input) {
|
|
3
|
+
const value = input.trim().toLowerCase();
|
|
4
|
+
try {
|
|
5
|
+
const url = new URL(value.includes("://") ? value : `https://${value}`);
|
|
6
|
+
return url.hostname;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return value
|
|
10
|
+
.replace(/^https?:\/\//, "")
|
|
11
|
+
.replace(/\/.*$/, "")
|
|
12
|
+
.replace(/:\d+$/, "");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function cacheHostMatchScore(pattern, hostname) {
|
|
16
|
+
const normalizedPattern = normalizeCacheHostname(pattern);
|
|
17
|
+
if (normalizedPattern === hostname) {
|
|
18
|
+
return 1_000_000 + normalizedPattern.length;
|
|
19
|
+
}
|
|
20
|
+
if (normalizedPattern === "*") {
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
if (!normalizedPattern.includes("*")) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const regex = new RegExp("^" + normalizedPattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$", "i");
|
|
27
|
+
if (regex.test(hostname)) {
|
|
28
|
+
return normalizedPattern.replace(/\*/g, "").length;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
2
32
|
export function getCacheConfig(origin, config) {
|
|
3
|
-
const originDomain =
|
|
4
|
-
let
|
|
5
|
-
|
|
33
|
+
const originDomain = normalizeCacheHostname(origin);
|
|
34
|
+
let bestMatch = null;
|
|
35
|
+
for (const [host, cacheConfig] of Object.entries(config.cache ?? {})) {
|
|
36
|
+
const score = cacheHostMatchScore(host, originDomain);
|
|
37
|
+
if (score === null)
|
|
38
|
+
continue;
|
|
39
|
+
if (!bestMatch || score > bestMatch.score) {
|
|
40
|
+
bestMatch = { score, config: cacheConfig };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let cacheConfig = bestMatch?.config ??
|
|
6
44
|
EDCacheConfigSchema.parse({
|
|
7
45
|
appDataTTL: 0,
|
|
8
46
|
pageDataTTL: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vinxi-app.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/vinxi-app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vinxi-app.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/vinxi-app.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAKtD,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAA;AAC7D,KAAK,mBAAmB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,CAAA;AACrD,KAAK,iBAAiB,GAAG,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAA;AAEhE,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC1C,CAAA;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,uBAuP3C"}
|
|
@@ -2,9 +2,9 @@ import { joinURL } from "ufo";
|
|
|
2
2
|
import { createApp } from "vinxi";
|
|
3
3
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4
4
|
import { StatefulLog } from "../utils/stateful-log.js";
|
|
5
|
+
import { getCacheConfig } from "./cache-config.js";
|
|
5
6
|
import { corePlugins, envPlugin } from "./get-vite-config.js";
|
|
6
7
|
import { getVinxiFolder } from "./vinxi-codegen.js";
|
|
7
|
-
import { getCacheConfig } from "./cache-config.js";
|
|
8
8
|
export function createVinxiApp(args) {
|
|
9
9
|
const log = args.log ?? new StatefulLog({ label: "Build" });
|
|
10
10
|
const folder = "./.eddev/" +
|
|
@@ -13,6 +13,40 @@ export function createVinxiApp(args) {
|
|
|
13
13
|
serverless: true,
|
|
14
14
|
});
|
|
15
15
|
const cacheConfig = getCacheConfig(args.origin, args.config);
|
|
16
|
+
const serverlessDataRoute = (expiration) => cacheConfig.serverless.isr
|
|
17
|
+
? {
|
|
18
|
+
isr: {
|
|
19
|
+
expiration,
|
|
20
|
+
allowQuery: [],
|
|
21
|
+
passQuery: false,
|
|
22
|
+
group: 32,
|
|
23
|
+
},
|
|
24
|
+
cache: {
|
|
25
|
+
varies: ["Authorization", "woocommerce-session"],
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
isr: false,
|
|
30
|
+
cache: false,
|
|
31
|
+
};
|
|
32
|
+
const serverlessPageRoute = (expiration) => cacheConfig.serverless.isr
|
|
33
|
+
? {
|
|
34
|
+
isr: {
|
|
35
|
+
expiration,
|
|
36
|
+
allowQuery: [],
|
|
37
|
+
passQuery: false,
|
|
38
|
+
group: 32,
|
|
39
|
+
},
|
|
40
|
+
cache: {
|
|
41
|
+
maxAge: expiration,
|
|
42
|
+
// swr: true,
|
|
43
|
+
staleMaxAge: 3600,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
: {
|
|
47
|
+
isr: false,
|
|
48
|
+
cache: false,
|
|
49
|
+
};
|
|
16
50
|
return createApp({
|
|
17
51
|
server: {
|
|
18
52
|
// experimental: {
|
|
@@ -64,26 +98,8 @@ export function createVinxiApp(args) {
|
|
|
64
98
|
},
|
|
65
99
|
"/wp-content/**": { proxy: joinURL(args.origin, "wp-content/**") },
|
|
66
100
|
"/wp-includes/**": { proxy: joinURL(args.origin, "wp-includes/**") },
|
|
67
|
-
"/_data/route/**":
|
|
68
|
-
|
|
69
|
-
expiration: cacheConfig.pageDataTTL ?? 0,
|
|
70
|
-
allowQuery: [],
|
|
71
|
-
passQuery: false,
|
|
72
|
-
},
|
|
73
|
-
cache: {
|
|
74
|
-
varies: ["Authorization", "woocommerce-session"],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
"/_data/query/**": {
|
|
78
|
-
isr: {
|
|
79
|
-
expiration: cacheConfig.queryHooksTTL ?? 0,
|
|
80
|
-
allowQuery: [],
|
|
81
|
-
passQuery: false,
|
|
82
|
-
},
|
|
83
|
-
cache: {
|
|
84
|
-
varies: ["Authorization", "woocommerce-session"],
|
|
85
|
-
},
|
|
86
|
-
},
|
|
101
|
+
"/_data/route/**": serverlessDataRoute(cacheConfig.pageDataTTL ?? 0),
|
|
102
|
+
"/_data/query/**": serverlessDataRoute(cacheConfig.queryHooksTTL ?? 0),
|
|
87
103
|
"/_data/mutation/**": {
|
|
88
104
|
isr: false,
|
|
89
105
|
cache: false,
|
|
@@ -101,18 +117,7 @@ export function createVinxiApp(args) {
|
|
|
101
117
|
},
|
|
102
118
|
};
|
|
103
119
|
}, {}),
|
|
104
|
-
"/**/*":
|
|
105
|
-
isr: {
|
|
106
|
-
expiration: cacheConfig.pageDataTTL ?? 0,
|
|
107
|
-
allowQuery: [],
|
|
108
|
-
passQuery: false,
|
|
109
|
-
},
|
|
110
|
-
cache: {
|
|
111
|
-
maxAge: cacheConfig.pageDataTTL ?? 0,
|
|
112
|
-
// swr: true,
|
|
113
|
-
staleMaxAge: 3600,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
120
|
+
"/**/*": serverlessPageRoute(cacheConfig.pageDataTTL ?? 0),
|
|
116
121
|
},
|
|
117
122
|
vercel: {
|
|
118
123
|
config: {
|
|
@@ -2,10 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
import { Project } from "./project.js";
|
|
3
3
|
export declare const EDCacheConfigSchema: z.ZodObject<{
|
|
4
4
|
wordpress: z.ZodDefault<z.ZodObject<{
|
|
5
|
-
strategy: z.ZodEnum<{
|
|
6
|
-
always: "always";
|
|
7
|
-
"ssr-always-fresh": "ssr-always-fresh";
|
|
8
|
-
}>;
|
|
9
5
|
cacheHeaders: z.ZodDefault<z.ZodBoolean>;
|
|
10
6
|
transients: z.ZodDefault<z.ZodBoolean>;
|
|
11
7
|
}, z.core.$strip>>;
|
|
@@ -14,7 +10,6 @@ export declare const EDCacheConfigSchema: z.ZodObject<{
|
|
|
14
10
|
dataCache: z.ZodDefault<z.ZodEnum<{
|
|
15
11
|
none: "none";
|
|
16
12
|
"in-memory": "in-memory";
|
|
17
|
-
kv: "kv";
|
|
18
13
|
}>>;
|
|
19
14
|
}, z.core.$strip>>;
|
|
20
15
|
pageDataTTL: z.ZodDefault<z.ZodNumber>;
|
|
@@ -94,10 +89,6 @@ export declare const EDConfigSchema: z.ZodObject<{
|
|
|
94
89
|
}, z.core.$strip>;
|
|
95
90
|
cache: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
96
91
|
wordpress: z.ZodDefault<z.ZodObject<{
|
|
97
|
-
strategy: z.ZodEnum<{
|
|
98
|
-
always: "always";
|
|
99
|
-
"ssr-always-fresh": "ssr-always-fresh";
|
|
100
|
-
}>;
|
|
101
92
|
cacheHeaders: z.ZodDefault<z.ZodBoolean>;
|
|
102
93
|
transients: z.ZodDefault<z.ZodBoolean>;
|
|
103
94
|
}, z.core.$strip>>;
|
|
@@ -106,7 +97,6 @@ export declare const EDConfigSchema: z.ZodObject<{
|
|
|
106
97
|
dataCache: z.ZodDefault<z.ZodEnum<{
|
|
107
98
|
none: "none";
|
|
108
99
|
"in-memory": "in-memory";
|
|
109
|
-
kv: "kv";
|
|
110
100
|
}>>;
|
|
111
101
|
}, z.core.$strip>>;
|
|
112
102
|
pageDataTTL: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/project/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAA;AAE7D,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/project/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAA;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;iBAmB9B,CAAA;AAqBF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAwChC,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwHzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,qBAAa,YAAY;IAGI,OAAO,EAAE,OAAO;IAF3C,MAAM,CAAC,EAAE,QAAQ,CAAA;IAEjB,OAAO;WAEM,MAAM,CAAC,OAAO,EAAE,OAAO;IAM9B,IAAI;YAQI,kBAAkB;YAclB,UAAU;IAiCxB,OAAO,CAAC,WAAW;IAOnB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;CAUzD"}
|
|
@@ -8,19 +8,17 @@ import { projectLog as console } from "./project.js";
|
|
|
8
8
|
export const EDCacheConfigSchema = z.object({
|
|
9
9
|
wordpress: z
|
|
10
10
|
.object({
|
|
11
|
-
/** @deprecated */
|
|
12
|
-
strategy: z.enum(["always", "ssr-always-fresh"]).describe("Deprecated. Use cacheHeaders/transients instead."),
|
|
13
11
|
cacheHeaders: z.boolean().default(true).describe("Whether to add caching headers to data requests."),
|
|
14
12
|
transients: z.boolean().default(true).describe("Whether to cache within transients."),
|
|
15
13
|
})
|
|
16
|
-
.default({
|
|
14
|
+
.default({ cacheHeaders: true, transients: true }),
|
|
17
15
|
serverless: z
|
|
18
16
|
.object({
|
|
19
|
-
isr: z.boolean().default(true).describe("Whether to use
|
|
17
|
+
isr: z.boolean().default(true).describe("Whether to use serverless response caching/ISR for this origin."),
|
|
20
18
|
dataCache: z
|
|
21
|
-
.enum(["in-memory", "
|
|
19
|
+
.enum(["in-memory", "none"])
|
|
22
20
|
.default("in-memory")
|
|
23
|
-
.describe("The cache strategy
|
|
21
|
+
.describe("The serverless origin-data cache strategy."),
|
|
24
22
|
})
|
|
25
23
|
.default({ isr: true, dataCache: "in-memory" }),
|
|
26
24
|
pageDataTTL: z.number().default(300).describe("The number of seconds to cache page data."),
|
|
@@ -175,7 +173,7 @@ export const EDConfigSchema = z.object({
|
|
|
175
173
|
appDataTTL: 300,
|
|
176
174
|
queryHooksTTL: 300,
|
|
177
175
|
serverless: { isr: true, dataCache: "in-memory" },
|
|
178
|
-
wordpress: {
|
|
176
|
+
wordpress: { cacheHeaders: true, transients: true },
|
|
179
177
|
},
|
|
180
178
|
})
|
|
181
179
|
.describe("A map of WordPress origin hostnames -> cache settings. Wildcards can be used for each domain."),
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.11-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"bin":
|
|
7
|
+
"bin": {
|
|
8
|
+
"eddev": "./bin/eddev.js"
|
|
9
|
+
},
|
|
8
10
|
"exports": {
|
|
9
11
|
"./routing": {
|
|
10
12
|
"types": "./dist/app/lib/routing/index.d.ts",
|
package/types.meta.d.ts
CHANGED
|
@@ -73,8 +73,8 @@ declare global {
|
|
|
73
73
|
*
|
|
74
74
|
* * *Not to be confused with `flags`*!
|
|
75
75
|
*
|
|
76
|
-
* "root" is a special tag that allows the block to be used at the root level of the post.
|
|
77
|
-
* "inline" is a convention which applies to blocks which can be used within rich text areas.
|
|
76
|
+
* "#root" is a special tag that allows the block to be used at the root level of the post.
|
|
77
|
+
* "#inline" is a convention which applies to blocks which can be used within rich text areas.
|
|
78
78
|
*
|
|
79
79
|
* For child blocks, you can either:
|
|
80
80
|
*
|
|
@@ -82,7 +82,7 @@ declare global {
|
|
|
82
82
|
* - Leave this blank, and use `conditions: { parent: ['some-parent-block'] }`
|
|
83
83
|
* - Set this to a value, such as `["accordion-item"]`, and use `<InnerBlocks allowedBlocks={["accordion-item"]}` (Best for sites with many nested block types)
|
|
84
84
|
*/
|
|
85
|
-
tags?: ("root" | "inline" | BlockTagName | (string & {}))[]
|
|
85
|
+
tags?: ("#root" | "#inline" | BlockTagName | (string & {}))[]
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Conditions allow you to limit the availability of this block to specific post types and templates.
|