@blocklet/pages-kit-inner-components 0.5.0 → 0.5.2
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/lib/cjs/chunks/site-state-DSnl0gAG.js +57 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/project-html.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/chunks/{site-state-Ct-Mnf1U.js → site-state-BECrO8OM.js} +352 -344
- package/lib/es/components.js +1 -1
- package/lib/es/project-html.js +1 -1
- package/lib/es/resources.js +1 -1
- package/lib/es/site-state.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/chunks/site-state-Bd3-qe58.js +0 -57
|
@@ -43,7 +43,7 @@ import { pipeline as ns } from "stream/promises";
|
|
|
43
43
|
import { x as os } from "tar";
|
|
44
44
|
import rs from "wait-on";
|
|
45
45
|
import { Awareness as as, encodeAwarenessUpdate as Ye, removeAwarenessStates as is, applyAwarenessUpdate as cs } from "y-protocols/awareness";
|
|
46
|
-
import { writeUpdate as
|
|
46
|
+
import { writeUpdate as ls, writeSyncStep1 as ps, readSyncMessage as ds } from "y-protocols/sync";
|
|
47
47
|
import * as Z from "yaml";
|
|
48
48
|
import us from "lodash/isNil";
|
|
49
49
|
import { DataTypes as x, Sequelize as ms, Model as it, Op as fs } from "sequelize";
|
|
@@ -164,8 +164,8 @@ const Ss = async (e, { componentId: s }) => {
|
|
|
164
164
|
stats: {}
|
|
165
165
|
}),
|
|
166
166
|
(r) => {
|
|
167
|
-
r.walkRules((
|
|
168
|
-
|
|
167
|
+
r.walkRules((d) => {
|
|
168
|
+
d.selectors = d.selectors.map((l) => l.replace(/\.(.+)/g, `${n}.$1,${n} .$1`));
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
// FIXME: cssnano use browserslist, it is not working with the fs isolation
|
|
@@ -219,8 +219,8 @@ ${e}
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
), bs = async (e, s) => {
|
|
222
|
-
var
|
|
223
|
-
const n = (
|
|
222
|
+
var d, l;
|
|
223
|
+
const n = (l = (d = (await Ut.build({
|
|
224
224
|
entryPoints: ["index.tsx"],
|
|
225
225
|
external: Object.keys(jt),
|
|
226
226
|
format: "esm",
|
|
@@ -230,20 +230,20 @@ ${e}
|
|
|
230
230
|
plugins: [
|
|
231
231
|
{
|
|
232
232
|
name: "vfs",
|
|
233
|
-
setup(
|
|
234
|
-
let
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
if (
|
|
233
|
+
setup(u) {
|
|
234
|
+
let c = null;
|
|
235
|
+
u.onResolve({ filter: /.*/ }, (p) => p.path === "index.tsx" ? { path: "index.tsx", namespace: "vfs" } : p.path === "./component" ? { path: "component.tsx", namespace: "vfs" } : null), u.onLoad({ filter: /.*/, namespace: "vfs" }, async (p) => {
|
|
236
|
+
var g;
|
|
237
|
+
if (p.path === "index.tsx")
|
|
238
238
|
return { contents: `export { ${s} } from './component'`, loader: "tsx" };
|
|
239
|
-
if (
|
|
239
|
+
if (p.path === "component.tsx")
|
|
240
240
|
return { contents: e, loader: "tsx" };
|
|
241
|
-
if (Nt(
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
241
|
+
if (Nt(p.path)) {
|
|
242
|
+
const y = p.path.split("/").pop();
|
|
243
|
+
if (c || (c = await Ge({ ensureLoaded: !1 })), (g = c == null ? void 0 : c.chunks) != null && g[y])
|
|
244
244
|
try {
|
|
245
|
-
const a = X(
|
|
246
|
-
return b.info("get chunk from local file system",
|
|
245
|
+
const a = X(c.chunks[y], "utf-8");
|
|
246
|
+
return b.info("get chunk from local file system", y), { contents: a, loader: "tsx" };
|
|
247
247
|
} catch {
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -252,7 +252,7 @@ ${e}
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
]
|
|
255
|
-
})).outputFiles) == null ? void 0 :
|
|
255
|
+
})).outputFiles) == null ? void 0 : d[0]) == null ? void 0 : l.contents;
|
|
256
256
|
if (!n) throw new Error("Failed to build server code");
|
|
257
257
|
const o = Buffer.from(n).toString();
|
|
258
258
|
return L.transpileModule(o, {
|
|
@@ -326,11 +326,11 @@ async function Fn({
|
|
|
326
326
|
module: r
|
|
327
327
|
}) {
|
|
328
328
|
const {
|
|
329
|
-
supportedLocales:
|
|
330
|
-
config: { defaultLocale:
|
|
329
|
+
supportedLocales: d,
|
|
330
|
+
config: { defaultLocale: l }
|
|
331
331
|
} = t;
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
332
|
+
if (!l) return null;
|
|
333
|
+
const u = (await Promise.all(
|
|
334
334
|
o.map(async (a) => {
|
|
335
335
|
try {
|
|
336
336
|
const i = Ts({
|
|
@@ -348,7 +348,7 @@ async function Fn({
|
|
|
348
348
|
state: t,
|
|
349
349
|
componentId: m.id,
|
|
350
350
|
locale: n,
|
|
351
|
-
defaultLocale:
|
|
351
|
+
defaultLocale: l,
|
|
352
352
|
properties: a.properties
|
|
353
353
|
});
|
|
354
354
|
if (!w) return null;
|
|
@@ -364,12 +364,12 @@ async function Fn({
|
|
|
364
364
|
return b.error("get preload component error", { instanceId: a.id, componentId: a.componentId }, { error: i }), null;
|
|
365
365
|
}
|
|
366
366
|
})
|
|
367
|
-
)).filter((a) => !!a),
|
|
368
|
-
|
|
367
|
+
)).filter((a) => !!a), c = Object.values(
|
|
368
|
+
u.reduce((a, i) => ({ ...a, ...i.preload.components }), {})
|
|
369
369
|
);
|
|
370
|
-
async function
|
|
370
|
+
async function p() {
|
|
371
371
|
const a = await Promise.all(
|
|
372
|
-
|
|
372
|
+
c.map(async (i) => {
|
|
373
373
|
const m = It({ componentId: i.component.id }), w = r === ge.ESM ? {
|
|
374
374
|
module: r,
|
|
375
375
|
script: await qe(i.script, {
|
|
@@ -392,11 +392,11 @@ async function Fn({
|
|
|
392
392
|
);
|
|
393
393
|
return Object.fromEntries(a);
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const g = await p();
|
|
396
396
|
return {
|
|
397
|
-
config: { defaultLocale:
|
|
398
|
-
components:
|
|
399
|
-
instances:
|
|
397
|
+
config: { defaultLocale: l, supportedLocales: d },
|
|
398
|
+
components: g,
|
|
399
|
+
instances: u.map((a) => ({
|
|
400
400
|
id: a.instanceId,
|
|
401
401
|
componentId: a.preload.component.id,
|
|
402
402
|
locales: { [a.preload.locale]: { props: a.preload.props } }
|
|
@@ -411,62 +411,62 @@ async function vs({
|
|
|
411
411
|
defaultLocale: o,
|
|
412
412
|
properties: r
|
|
413
413
|
}) {
|
|
414
|
-
const { supportedLocales:
|
|
415
|
-
if (!
|
|
416
|
-
const
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
return
|
|
420
|
-
component:
|
|
421
|
-
...
|
|
414
|
+
const { supportedLocales: d } = s, l = Se({ state: s, componentId: t });
|
|
415
|
+
if (!l) return null;
|
|
416
|
+
const u = d.some((p) => p.locale === n) ? n : o;
|
|
417
|
+
if (!u) return null;
|
|
418
|
+
const c = await lt({ req: e, state: s, componentId: t, locale: u, defaultLocale: o, properties: r });
|
|
419
|
+
return c ? {
|
|
420
|
+
component: l,
|
|
421
|
+
...c
|
|
422
422
|
} : null;
|
|
423
423
|
}
|
|
424
424
|
const Ps = 20;
|
|
425
|
-
async function
|
|
425
|
+
async function lt({
|
|
426
426
|
req: e,
|
|
427
427
|
depth: s = 0,
|
|
428
428
|
state: t,
|
|
429
429
|
componentId: n,
|
|
430
430
|
locale: o,
|
|
431
431
|
defaultLocale: r,
|
|
432
|
-
properties:
|
|
432
|
+
properties: d
|
|
433
433
|
}) {
|
|
434
434
|
if (s > Ps) throw new RangeError("max component depth exceeded");
|
|
435
|
-
const
|
|
436
|
-
if (!
|
|
437
|
-
const { props:
|
|
435
|
+
const l = Cs({ state: t, componentId: n, properties: d, locale: o });
|
|
436
|
+
if (!l) return null;
|
|
437
|
+
const { props: u } = l, c = {
|
|
438
438
|
locale: o || r,
|
|
439
|
-
components: { [
|
|
440
|
-
props: { ...
|
|
439
|
+
components: { [l.component.id]: { component: l.component, script: l.script } },
|
|
440
|
+
props: { ...u }
|
|
441
441
|
};
|
|
442
442
|
try {
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
} catch (
|
|
446
|
-
b.error("preload data at server side error", { componentId: n, name:
|
|
443
|
+
const p = await Ds({ ...l, req: e });
|
|
444
|
+
p != null && p.props && Object.assign(c.props, p.props);
|
|
445
|
+
} catch (p) {
|
|
446
|
+
b.error("preload data at server side error", { componentId: n, name: l.component.name }, { error: p });
|
|
447
447
|
}
|
|
448
448
|
return await Promise.all(
|
|
449
|
-
Object.entries(
|
|
450
|
-
if ((
|
|
451
|
-
const
|
|
449
|
+
Object.entries(u).map(async ([p, g]) => {
|
|
450
|
+
if ((g == null ? void 0 : g.type) === Je) {
|
|
451
|
+
const y = await lt({
|
|
452
452
|
req: e,
|
|
453
453
|
depth: s + 1,
|
|
454
454
|
state: t,
|
|
455
|
-
componentId:
|
|
455
|
+
componentId: g.componentId,
|
|
456
456
|
locale: o,
|
|
457
457
|
defaultLocale: r,
|
|
458
|
-
properties:
|
|
458
|
+
properties: g.properties
|
|
459
459
|
});
|
|
460
|
-
|
|
461
|
-
[
|
|
460
|
+
y && (Object.assign(c.components, y.components), Object.assign(c.props, {
|
|
461
|
+
[p]: {
|
|
462
462
|
type: Je,
|
|
463
|
-
componentId:
|
|
464
|
-
props:
|
|
463
|
+
componentId: g.componentId,
|
|
464
|
+
props: y.props
|
|
465
465
|
}
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
468
|
})
|
|
469
|
-
),
|
|
469
|
+
), c;
|
|
470
470
|
}
|
|
471
471
|
function Cs({
|
|
472
472
|
state: e,
|
|
@@ -478,7 +478,7 @@ function Cs({
|
|
|
478
478
|
if (!o) return null;
|
|
479
479
|
const r = Et({
|
|
480
480
|
componentId: s,
|
|
481
|
-
getComponent: (
|
|
481
|
+
getComponent: (d) => Se({ state: e, componentId: d }),
|
|
482
482
|
locale: t,
|
|
483
483
|
defaultLocale: e.config.defaultLocale,
|
|
484
484
|
properties: n
|
|
@@ -493,11 +493,11 @@ function Bn({ state: e, name: s }) {
|
|
|
493
493
|
var n, o;
|
|
494
494
|
const t = s.toLowerCase();
|
|
495
495
|
return ((n = Object.values(e.components).find((r) => {
|
|
496
|
-
var
|
|
497
|
-
return ((
|
|
496
|
+
var d;
|
|
497
|
+
return ((d = r.data.name) == null ? void 0 : d.toLowerCase()) === t;
|
|
498
498
|
})) == null ? void 0 : n.data) ?? ((o = e.resources.components && Object.values(e.resources.components).find((r) => {
|
|
499
|
-
var
|
|
500
|
-
return ((
|
|
499
|
+
var d;
|
|
500
|
+
return ((d = r.component.name) == null ? void 0 : d.toLowerCase()) === t;
|
|
501
501
|
})) == null ? void 0 : o.component);
|
|
502
502
|
}
|
|
503
503
|
async function Ds({
|
|
@@ -510,9 +510,9 @@ async function Ds({
|
|
|
510
510
|
return null;
|
|
511
511
|
const o = await ct(s, "getServerSideProps");
|
|
512
512
|
if (!o) return null;
|
|
513
|
-
const r = new Promise((
|
|
513
|
+
const r = new Promise((l) => {
|
|
514
514
|
setTimeout(() => {
|
|
515
|
-
|
|
515
|
+
l({});
|
|
516
516
|
}, Qe * 1e3);
|
|
517
517
|
});
|
|
518
518
|
return await Promise.race([
|
|
@@ -537,26 +537,26 @@ export async function getServerSidePropsWrapper(props) {
|
|
|
537
537
|
}
|
|
538
538
|
}`,
|
|
539
539
|
filename: `${e.name || e.id}.js`,
|
|
540
|
-
moduleLoader: (
|
|
541
|
-
if (
|
|
540
|
+
moduleLoader: (l) => {
|
|
541
|
+
if (l === "@blocklet/pages-kit/builtin/utils")
|
|
542
542
|
return `const { joinURL, withQuery, getQuery, getComponentMountPoint } = globalThis
|
|
543
543
|
export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
544
544
|
`;
|
|
545
|
-
if (
|
|
545
|
+
if (l === "@blocklet/pages-kit/builtin/dayjs")
|
|
546
546
|
return Ot.dayjs;
|
|
547
547
|
},
|
|
548
548
|
global: {
|
|
549
549
|
console: {
|
|
550
550
|
// NOTE: do not return logger.xxx result, it will cause memory leak
|
|
551
551
|
// eslint-disable-next-line prettier/prettier
|
|
552
|
-
log: (...
|
|
553
|
-
b.info(...
|
|
552
|
+
log: (...l) => {
|
|
553
|
+
b.info(...l);
|
|
554
554
|
},
|
|
555
|
-
warn: (...
|
|
556
|
-
b.warn(...
|
|
555
|
+
warn: (...l) => {
|
|
556
|
+
b.warn(...l);
|
|
557
557
|
},
|
|
558
|
-
error: (...
|
|
559
|
-
b.error(...
|
|
558
|
+
error: (...l) => {
|
|
559
|
+
b.error(...l);
|
|
560
560
|
}
|
|
561
561
|
},
|
|
562
562
|
getComponentMountPoint: bt,
|
|
@@ -570,24 +570,24 @@ export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
|
570
570
|
// NOTE: IMPORTANT! place location and fetch (has side effect) at the args not global
|
|
571
571
|
// because the global is shared between all runtime and just init once
|
|
572
572
|
location: { href: K(Dt(n.hostname), n.originalUrl) },
|
|
573
|
-
fetch: (
|
|
574
|
-
const
|
|
575
|
-
if (typeof
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
const
|
|
579
|
-
|
|
573
|
+
fetch: (l, { ...u } = {}) => {
|
|
574
|
+
const c = typeof l == "string" && l.startsWith("/") ? K(I.env.appUrl, l) : l;
|
|
575
|
+
if (typeof c == "string" && Ve(c).host === Ve(I.env.appUrl).host) {
|
|
576
|
+
const p = n.get("cookie");
|
|
577
|
+
if (p) {
|
|
578
|
+
const g = new vt(u.headers);
|
|
579
|
+
g.set("cookie", p), u.headers = g;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
return Tt(
|
|
583
|
-
...
|
|
582
|
+
return Tt(c, {
|
|
583
|
+
...u,
|
|
584
584
|
timeout: Qe * 1e3
|
|
585
|
-
}).then((
|
|
586
|
-
ok:
|
|
587
|
-
status:
|
|
588
|
-
statusText:
|
|
589
|
-
headers: Object.fromEntries(
|
|
590
|
-
json: () =>
|
|
585
|
+
}).then((p) => ({
|
|
586
|
+
ok: p.ok,
|
|
587
|
+
status: p.status,
|
|
588
|
+
statusText: p.statusText,
|
|
589
|
+
headers: Object.fromEntries(p.headers.entries()),
|
|
590
|
+
json: () => p.json()
|
|
591
591
|
}));
|
|
592
592
|
},
|
|
593
593
|
props: t
|
|
@@ -629,7 +629,7 @@ const xs = Oe(
|
|
|
629
629
|
ttl: 1e3 * 60 * 60
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
), js = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o", Xe = "page", Ne = "trigger-reload-project-resource",
|
|
632
|
+
), js = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o", Xe = "page", Ne = "trigger-reload-project-resource", pt = js, ks = "z2qa7BQdkEb3TwYyEYC1psK6uvmGnHSUHt5RM";
|
|
633
633
|
function we(e) {
|
|
634
634
|
e.observeDeep((s) => {
|
|
635
635
|
s.some((t) => t.changes.keys.has("updatedAt") || t.changes.keys.has("publishedAt")) || e.set("updatedAt", (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -670,8 +670,8 @@ function Ls(e) {
|
|
|
670
670
|
t.changes.keys.forEach((n, o) => {
|
|
671
671
|
var r;
|
|
672
672
|
if (n.action === "add") {
|
|
673
|
-
const
|
|
674
|
-
|
|
673
|
+
const d = se((r = e.routes) == null ? void 0 : r[o]);
|
|
674
|
+
d && d instanceof B.Map && we(d);
|
|
675
675
|
}
|
|
676
676
|
});
|
|
677
677
|
});
|
|
@@ -681,31 +681,31 @@ function Rs(e, s) {
|
|
|
681
681
|
for (const n of s || Object.keys(e.routes || {})) {
|
|
682
682
|
let o = n, r = [];
|
|
683
683
|
if (n.includes("-")) {
|
|
684
|
-
const [
|
|
685
|
-
o =
|
|
684
|
+
const [d, ...l] = n.split("-");
|
|
685
|
+
o = d, r = l || [];
|
|
686
686
|
}
|
|
687
687
|
if (((t = e.routes) == null ? void 0 : t[o]) !== void 0) {
|
|
688
688
|
e.routes[o].publishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
689
|
+
const d = e.routes[o];
|
|
690
|
+
if (!d || !d.params || d.params.length === 0)
|
|
691
691
|
continue;
|
|
692
692
|
if (n.includes("-") && r.length > 0) {
|
|
693
|
-
const
|
|
694
|
-
|
|
693
|
+
const l = Yt(r, d);
|
|
694
|
+
l && (l.publishedAt = (/* @__PURE__ */ new Date()).toISOString());
|
|
695
695
|
}
|
|
696
696
|
if (!s) {
|
|
697
|
-
const
|
|
698
|
-
basePath:
|
|
699
|
-
params:
|
|
700
|
-
routeId:
|
|
701
|
-
paramsOptions:
|
|
697
|
+
const l = _e({
|
|
698
|
+
basePath: d.path,
|
|
699
|
+
params: d.params,
|
|
700
|
+
routeId: d.id,
|
|
701
|
+
paramsOptions: d.paramsOptions,
|
|
702
702
|
currentIndex: 0,
|
|
703
703
|
currentParams: [],
|
|
704
704
|
currentOptionIds: [],
|
|
705
705
|
result: []
|
|
706
706
|
});
|
|
707
|
-
for (const
|
|
708
|
-
|
|
707
|
+
for (const u of l)
|
|
708
|
+
u.routeMetaData ?? (u.routeMetaData = {}), u.routeMetaData.publishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
}
|
|
@@ -717,7 +717,7 @@ function De({
|
|
|
717
717
|
routeId: n,
|
|
718
718
|
routePathInfo: o
|
|
719
719
|
}) {
|
|
720
|
-
var l,
|
|
720
|
+
var d, l, u, c, p, g, y, a, i;
|
|
721
721
|
b.info(
|
|
722
722
|
`Executing datasource data assembly, routeId: ${n}, routePathInfo: ${JSON.stringify(o)}`
|
|
723
723
|
);
|
|
@@ -726,15 +726,15 @@ function De({
|
|
|
726
726
|
id: n,
|
|
727
727
|
slug: (o == null ? void 0 : o.path) ?? s.path,
|
|
728
728
|
createdAt: s.createdAt,
|
|
729
|
-
updatedAt: ((
|
|
730
|
-
publishedAt: ((
|
|
731
|
-
isPublic: (((
|
|
729
|
+
updatedAt: ((d = o == null ? void 0 : o.routeMetaData) == null ? void 0 : d.updatedAt) ?? s.updatedAt,
|
|
730
|
+
publishedAt: ((l = o == null ? void 0 : o.routeMetaData) == null ? void 0 : l.publishedAt) ?? s.publishedAt,
|
|
731
|
+
isPublic: (((u = o == null ? void 0 : o.routeMetaData) == null ? void 0 : u.isPublic) ?? s.isPublic) && s.isPublic
|
|
732
732
|
};
|
|
733
733
|
for (const m of t.supportedLocales) {
|
|
734
734
|
if (s.dataSource) {
|
|
735
735
|
let w = s.id;
|
|
736
736
|
o && (w = o.paramOptionIds.join("-"));
|
|
737
|
-
const D = ((
|
|
737
|
+
const D = ((g = (p = (c = s.dataSource.pathDataMappings) == null ? void 0 : c[w]) == null ? void 0 : p.dataCache) == null ? void 0 : g[m.locale]) ?? ((i = (a = (y = s.dataSource.pathDataMappings) == null ? void 0 : y[w]) == null ? void 0 : a.dataCache) == null ? void 0 : i[t.config.defaultLocale || "en"]);
|
|
738
738
|
if (!D)
|
|
739
739
|
continue;
|
|
740
740
|
zt(r, t, m.locale, D);
|
|
@@ -771,44 +771,52 @@ const V = class V extends B.Doc {
|
|
|
771
771
|
j(this, "conns", /* @__PURE__ */ new Map());
|
|
772
772
|
j(this, "awareness");
|
|
773
773
|
j(this, "awarenessChangeHandler", ({ added: t, updated: n, removed: o }, r) => {
|
|
774
|
-
const
|
|
774
|
+
const d = t.concat(n, o);
|
|
775
775
|
if (r !== null) {
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}), o.forEach((
|
|
780
|
-
|
|
776
|
+
const c = this.conns.get(r);
|
|
777
|
+
c && (t.forEach((p) => {
|
|
778
|
+
c.add(p);
|
|
779
|
+
}), o.forEach((p) => {
|
|
780
|
+
c.delete(p);
|
|
781
781
|
}));
|
|
782
782
|
}
|
|
783
|
-
const
|
|
784
|
-
k.writeVarUint(
|
|
785
|
-
const
|
|
786
|
-
this.conns.forEach((
|
|
783
|
+
const l = k.createEncoder();
|
|
784
|
+
k.writeVarUint(l, je), k.writeVarUint8Array(l, Ye(this.awareness, d));
|
|
785
|
+
const u = k.toUint8Array(l);
|
|
786
|
+
this.conns.forEach((c, p) => this.send(p, u));
|
|
787
787
|
});
|
|
788
788
|
j(this, "updateHandler", (t) => {
|
|
789
789
|
const n = k.createEncoder();
|
|
790
|
-
k.writeVarUint(n, ue),
|
|
790
|
+
k.writeVarUint(n, ue), ls(n, t);
|
|
791
791
|
const o = k.toUint8Array(n);
|
|
792
|
-
this.conns.forEach((r,
|
|
792
|
+
this.conns.forEach((r, d) => this.send(d, o));
|
|
793
793
|
});
|
|
794
794
|
j(this, "ensureDataStructure", () => {
|
|
795
|
-
var
|
|
796
|
-
const { supportedLocales: t, pages: n, pageIds: o, config: r } = this.syncedStore;
|
|
795
|
+
var u;
|
|
796
|
+
const { supportedLocales: t, pages: n, pageIds: o, config: r, routes: d, routeIds: l } = this.syncedStore;
|
|
797
797
|
{
|
|
798
798
|
const c = new Set(Object.keys(n));
|
|
799
|
-
let
|
|
800
|
-
for (;
|
|
801
|
-
const
|
|
802
|
-
c.has(
|
|
799
|
+
let p = 0;
|
|
800
|
+
for (; p < o.length; ) {
|
|
801
|
+
const g = o[p];
|
|
802
|
+
c.has(g) ? (c.delete(g), p++) : o.splice(p, 1);
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
|
|
805
|
+
{
|
|
806
|
+
const c = new Set(Object.keys(d));
|
|
807
|
+
let p = 0;
|
|
808
|
+
for (; p < l.length; ) {
|
|
809
|
+
const g = l[p];
|
|
810
|
+
c.has(g) ? (c.delete(g), p++) : l.splice(p, 1);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
t.splice(0, t.length), t.push(...Le.env.languages.map((c) => ({ locale: c.code, name: c.name }))), r.defaultLocale = (u = t[0]) == null ? void 0 : u.locale;
|
|
806
814
|
{
|
|
807
815
|
let c = 0;
|
|
808
|
-
const
|
|
816
|
+
const p = /* @__PURE__ */ new Set();
|
|
809
817
|
for (; c < t.length; ) {
|
|
810
|
-
const { locale:
|
|
811
|
-
|
|
818
|
+
const { locale: g } = t[c];
|
|
819
|
+
p.has(g) ? t.splice(c, 1) : (c++, p.add(g));
|
|
812
820
|
}
|
|
813
821
|
}
|
|
814
822
|
});
|
|
@@ -840,17 +848,17 @@ const V = class V extends B.Doc {
|
|
|
840
848
|
await st(o, r, { routes: n, mergeMode: "replace", deleteRoutes: !0, publishMode: t }), r.config.publishedAt = (/* @__PURE__ */ new Date()).getTime(), Rs(this.syncedStore, n), await this.setState(t, r);
|
|
841
849
|
});
|
|
842
850
|
j(this, "mergeState", async (t, n) => {
|
|
843
|
-
var
|
|
851
|
+
var l, u, c;
|
|
844
852
|
const o = JSON.parse(JSON.stringify(n));
|
|
845
|
-
(
|
|
846
|
-
const r = (
|
|
847
|
-
t.config.fontFamily.title = (r == null ? void 0 : r.title) || (
|
|
853
|
+
(l = t.config).fontFamily ?? (l.fontFamily = {});
|
|
854
|
+
const r = (u = o.config) == null ? void 0 : u.fontFamily, d = (c = t.config) == null ? void 0 : c.fontFamily;
|
|
855
|
+
t.config.fontFamily.title = (r == null ? void 0 : r.title) || (d == null ? void 0 : d.title), t.config.fontFamily.description = (r == null ? void 0 : r.description) || (d == null ? void 0 : d.description), await new Promise((p, g) => {
|
|
848
856
|
this.transact(async () => {
|
|
849
857
|
try {
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
} catch (
|
|
853
|
-
y
|
|
858
|
+
const y = await st(t, n);
|
|
859
|
+
p(y);
|
|
860
|
+
} catch (y) {
|
|
861
|
+
g(y);
|
|
854
862
|
}
|
|
855
863
|
});
|
|
856
864
|
});
|
|
@@ -879,18 +887,18 @@ const V = class V extends B.Doc {
|
|
|
879
887
|
});
|
|
880
888
|
{
|
|
881
889
|
const r = k.createEncoder();
|
|
882
|
-
k.writeVarUint(r, ue),
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
885
|
-
const
|
|
886
|
-
k.writeVarUint(
|
|
890
|
+
k.writeVarUint(r, ue), ps(r, this), this.send(t, k.toUint8Array(r));
|
|
891
|
+
const d = this.awareness.getStates();
|
|
892
|
+
if (d.size > 0) {
|
|
893
|
+
const l = k.createEncoder();
|
|
894
|
+
k.writeVarUint(l, je), k.writeVarUint8Array(l, Ye(this.awareness, Array.from(d.keys()))), this.send(t, k.toUint8Array(l));
|
|
887
895
|
}
|
|
888
896
|
}
|
|
889
897
|
});
|
|
890
898
|
j(this, "messageListener", (t, n) => {
|
|
891
899
|
try {
|
|
892
|
-
const o = k.createEncoder(), r = Ce.createDecoder(n),
|
|
893
|
-
switch (
|
|
900
|
+
const o = k.createEncoder(), r = Ce.createDecoder(n), d = Ce.readVarUint(r);
|
|
901
|
+
switch (d) {
|
|
894
902
|
case ue:
|
|
895
903
|
k.writeVarUint(o, ue), ds(r, o, this, null), k.length(o) > 1 && (this.ensureDataStructure(), this.send(t, k.toUint8Array(o)));
|
|
896
904
|
break;
|
|
@@ -899,7 +907,7 @@ const V = class V extends B.Doc {
|
|
|
899
907
|
break;
|
|
900
908
|
}
|
|
901
909
|
default:
|
|
902
|
-
b.warn(`Unsupported messageType ${
|
|
910
|
+
b.warn(`Unsupported messageType ${d}`);
|
|
903
911
|
}
|
|
904
912
|
} catch (o) {
|
|
905
913
|
b.error(o);
|
|
@@ -963,33 +971,33 @@ const V = class V extends B.Doc {
|
|
|
963
971
|
return O(this.options.path, "draft.yjs");
|
|
964
972
|
}
|
|
965
973
|
async getState(t) {
|
|
966
|
-
var n, o, r,
|
|
974
|
+
var n, o, r, d;
|
|
967
975
|
if (t === "draft")
|
|
968
976
|
return JSON.parse(JSON.stringify(this.syncedStore));
|
|
969
977
|
if (!this.states[t] && (this.states[t] = await mt(this.getPublishDir(t), { includeResources: !0 }) ?? Bs(), !((o = (n = this.states[t]) == null ? void 0 : n.config) != null && o.defaultLocale))) {
|
|
970
978
|
(r = this.states[t]).config ?? (r.config = {});
|
|
971
|
-
const
|
|
972
|
-
this.states[t].config.defaultLocale = (
|
|
979
|
+
const l = Le.env.languages.map((u) => ({ locale: u.code, name: u.name }));
|
|
980
|
+
this.states[t].config.defaultLocale = (d = l[0]) == null ? void 0 : d.locale;
|
|
973
981
|
}
|
|
974
982
|
return {
|
|
975
983
|
...this.states[t],
|
|
976
|
-
resources: await Ge().then(async (
|
|
984
|
+
resources: await Ge().then(async (l) => {
|
|
977
985
|
var a, i, m, w;
|
|
978
|
-
const { pages:
|
|
979
|
-
let
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
|
|
986
|
+
const { pages: u, components: c } = Zt(l, "pages", "components");
|
|
987
|
+
let p = c;
|
|
988
|
+
const g = ne(this.options.path), y = await q.findByPk(g);
|
|
989
|
+
if (y != null && y.useAllResources)
|
|
990
|
+
p = c;
|
|
983
991
|
else {
|
|
984
|
-
const A = (await Te.findAll({ where: { projectId:
|
|
985
|
-
|
|
986
|
-
Object.entries(
|
|
992
|
+
const A = (await Te.findAll({ where: { projectId: g } })).map((M) => M.componentId);
|
|
993
|
+
p = Object.fromEntries(
|
|
994
|
+
Object.entries(c || {}).filter(([M]) => A.includes(M))
|
|
987
995
|
);
|
|
988
996
|
}
|
|
989
|
-
return Object.keys(((i = (a = this.states[t]) == null ? void 0 : a.resources) == null ? void 0 : i.components) || {}).length > 0 && (
|
|
990
|
-
...
|
|
997
|
+
return Object.keys(((i = (a = this.states[t]) == null ? void 0 : a.resources) == null ? void 0 : i.components) || {}).length > 0 && (p = {
|
|
998
|
+
...p,
|
|
991
999
|
...(w = (m = this.states[t]) == null ? void 0 : m.resources) == null ? void 0 : w.components
|
|
992
|
-
}), { pages:
|
|
1000
|
+
}), { pages: u, components: p };
|
|
993
1001
|
}).catch(() => ({}))
|
|
994
1002
|
};
|
|
995
1003
|
}
|
|
@@ -1001,32 +1009,32 @@ const V = class V extends B.Doc {
|
|
|
1001
1009
|
return O(this.options.path, t);
|
|
1002
1010
|
}
|
|
1003
1011
|
static async pageUrlMap(t) {
|
|
1004
|
-
var r,
|
|
1012
|
+
var r, d;
|
|
1005
1013
|
const { projectIds: n } = this, o = {};
|
|
1006
|
-
for (const
|
|
1007
|
-
const
|
|
1008
|
-
if (!
|
|
1009
|
-
const
|
|
1014
|
+
for (const l of n) {
|
|
1015
|
+
const u = await q.findByPk(l);
|
|
1016
|
+
if (!u) continue;
|
|
1017
|
+
const c = await V.shared(l).getState(t), p = u.slug || l, g = es(
|
|
1010
1018
|
I.env.languages.map((a) => a.code),
|
|
1011
|
-
|
|
1012
|
-
),
|
|
1013
|
-
|
|
1019
|
+
c.supportedLocales.map((a) => a.locale)
|
|
1020
|
+
), y = (a, i) => {
|
|
1021
|
+
p && (o[K("/", p, a)] = {
|
|
1014
1022
|
...i,
|
|
1015
1023
|
shouldRedirect: !0,
|
|
1016
1024
|
mainPage: !0
|
|
1017
|
-
}), o[K("/",
|
|
1025
|
+
}), o[K("/", l, a)] = {
|
|
1018
1026
|
...i,
|
|
1019
1027
|
shouldRedirect: !0,
|
|
1020
1028
|
mainPage: !0
|
|
1021
1029
|
};
|
|
1022
|
-
for (const m of
|
|
1030
|
+
for (const m of g) {
|
|
1023
1031
|
const w = { ...i, locale: m };
|
|
1024
|
-
o[K("/", m,
|
|
1032
|
+
o[K("/", m, l, a)] = w, p && (o[K("/", m, p, a)] = w);
|
|
1025
1033
|
}
|
|
1026
1034
|
};
|
|
1027
1035
|
if (t === "draft")
|
|
1028
|
-
for (const a of
|
|
1029
|
-
const i = (r =
|
|
1036
|
+
for (const a of c.routeIds || []) {
|
|
1037
|
+
const i = (r = c == null ? void 0 : c.routes) == null ? void 0 : r[a];
|
|
1030
1038
|
if (!i) continue;
|
|
1031
1039
|
if (i.params && i.params.length > 0) {
|
|
1032
1040
|
const D = _e({
|
|
@@ -1041,51 +1049,51 @@ const V = class V extends B.Doc {
|
|
|
1041
1049
|
});
|
|
1042
1050
|
for (const A of D) {
|
|
1043
1051
|
const N = A.path, M = {
|
|
1044
|
-
projectId:
|
|
1045
|
-
projectSlug:
|
|
1052
|
+
projectId: l,
|
|
1053
|
+
projectSlug: p,
|
|
1046
1054
|
pageSlug: N,
|
|
1047
1055
|
pageId: i.displayTemplateId || "",
|
|
1048
1056
|
routeId: a,
|
|
1049
1057
|
// default locale
|
|
1050
|
-
defaultLocale:
|
|
1051
|
-
locales:
|
|
1052
|
-
publishedAt:
|
|
1053
|
-
isPublic: i.isPublic && ((
|
|
1058
|
+
defaultLocale: g == null ? void 0 : g[0],
|
|
1059
|
+
locales: g,
|
|
1060
|
+
publishedAt: c.config.publishedAt,
|
|
1061
|
+
isPublic: i.isPublic && ((d = A == null ? void 0 : A.routeMetaData) == null ? void 0 : d.isPublic)
|
|
1054
1062
|
};
|
|
1055
|
-
|
|
1063
|
+
y(N, M);
|
|
1056
1064
|
}
|
|
1057
1065
|
}
|
|
1058
1066
|
const m = i.path, w = {
|
|
1059
|
-
projectId:
|
|
1060
|
-
projectSlug:
|
|
1067
|
+
projectId: l,
|
|
1068
|
+
projectSlug: p,
|
|
1061
1069
|
pageSlug: m,
|
|
1062
1070
|
pageId: i.displayTemplateId || "",
|
|
1063
1071
|
routeId: a,
|
|
1064
1072
|
// default locale
|
|
1065
|
-
defaultLocale:
|
|
1066
|
-
locales:
|
|
1067
|
-
publishedAt:
|
|
1073
|
+
defaultLocale: g == null ? void 0 : g[0],
|
|
1074
|
+
locales: g,
|
|
1075
|
+
publishedAt: c.config.publishedAt,
|
|
1068
1076
|
isPublic: i.isPublic
|
|
1069
1077
|
};
|
|
1070
|
-
|
|
1078
|
+
y(m, w);
|
|
1071
1079
|
}
|
|
1072
|
-
for (const a of
|
|
1073
|
-
const i =
|
|
1080
|
+
for (const a of c.pageIds) {
|
|
1081
|
+
const i = c.pages[a];
|
|
1074
1082
|
if (!i || t === "production" && !i.isPublic)
|
|
1075
1083
|
continue;
|
|
1076
|
-
const m = i.slug, w =
|
|
1077
|
-
projectId:
|
|
1084
|
+
const m = i.slug, w = u.slug || l, D = {
|
|
1085
|
+
projectId: l,
|
|
1078
1086
|
projectSlug: w,
|
|
1079
1087
|
pageSlug: m,
|
|
1080
1088
|
pageId: a,
|
|
1081
1089
|
// default locale
|
|
1082
|
-
defaultLocale:
|
|
1083
|
-
locales:
|
|
1084
|
-
publishedAt:
|
|
1090
|
+
defaultLocale: g == null ? void 0 : g[0],
|
|
1091
|
+
locales: g,
|
|
1092
|
+
publishedAt: c.config.publishedAt,
|
|
1085
1093
|
isPublic: i.isPublic,
|
|
1086
1094
|
templateConfig: i.templateConfig
|
|
1087
1095
|
};
|
|
1088
|
-
|
|
1096
|
+
y(m, D);
|
|
1089
1097
|
}
|
|
1090
1098
|
}
|
|
1091
1099
|
return o;
|
|
@@ -1136,7 +1144,7 @@ async function Gs(e, s, t) {
|
|
|
1136
1144
|
}
|
|
1137
1145
|
const Hs = async (e, s) => {
|
|
1138
1146
|
const t = ne(e), n = await _t({
|
|
1139
|
-
name:
|
|
1147
|
+
name: pt,
|
|
1140
1148
|
path: K("/uploads", t),
|
|
1141
1149
|
responseType: "stream",
|
|
1142
1150
|
method: "GET"
|
|
@@ -1163,14 +1171,14 @@ function ut(e) {
|
|
|
1163
1171
|
async function fe(e, s, t) {
|
|
1164
1172
|
const { getFilename: n, exportAssets: o } = t, r = O(s, n(e));
|
|
1165
1173
|
if (H(_(r), { recursive: !0 }), ye(r, Z.stringify(e)), o) {
|
|
1166
|
-
const
|
|
1174
|
+
const l = be(
|
|
1167
1175
|
e,
|
|
1168
|
-
(
|
|
1169
|
-
).map((
|
|
1170
|
-
const
|
|
1171
|
-
return ut(
|
|
1176
|
+
(u) => typeof u == "string" && (Ue.test(u) || ie.test(u))
|
|
1177
|
+
).map((u) => {
|
|
1178
|
+
const c = Me(e, u);
|
|
1179
|
+
return ut(c);
|
|
1172
1180
|
}).flat().filter(Boolean);
|
|
1173
|
-
await Js(
|
|
1181
|
+
await Js(l, _(r));
|
|
1174
1182
|
}
|
|
1175
1183
|
}
|
|
1176
1184
|
const et = new Re({
|
|
@@ -1178,29 +1186,29 @@ const et = new Re({
|
|
|
1178
1186
|
ttl: 30 * 24 * 60 * 60 * 1e3
|
|
1179
1187
|
});
|
|
1180
1188
|
async function tt(e, s, t) {
|
|
1181
|
-
var
|
|
1189
|
+
var l;
|
|
1182
1190
|
const n = be(
|
|
1183
1191
|
e,
|
|
1184
|
-
(
|
|
1192
|
+
(u) => typeof u == "string" && (Ue.test(u) || ie.test(u))
|
|
1185
1193
|
), o = ss(2), r = n.map(
|
|
1186
|
-
(
|
|
1194
|
+
(u) => o(async () => {
|
|
1187
1195
|
try {
|
|
1188
|
-
const
|
|
1189
|
-
for (const
|
|
1190
|
-
const
|
|
1196
|
+
const c = Me(e, u), p = ut(c);
|
|
1197
|
+
for (const g of p) {
|
|
1198
|
+
const y = ne(g), a = t.getFilePath(g, u), i = a ? `${a}:${y}` : y, m = et.get(i);
|
|
1191
1199
|
if (m) {
|
|
1192
|
-
ie.test(
|
|
1200
|
+
ie.test(c) || ze(e, u, m);
|
|
1193
1201
|
return;
|
|
1194
1202
|
}
|
|
1195
|
-
const w = await Gs(a,
|
|
1196
|
-
w && (ie.test(
|
|
1203
|
+
const w = await Gs(a, y, s);
|
|
1204
|
+
w && (ie.test(c) || ze(e, u, w), et.set(i, w));
|
|
1197
1205
|
}
|
|
1198
|
-
} catch (
|
|
1199
|
-
b.error(`Failed to process upload for path ${
|
|
1206
|
+
} catch (c) {
|
|
1207
|
+
b.error(`Failed to process upload for path ${u.join(".")}:`, c.message || c.reason);
|
|
1200
1208
|
}
|
|
1201
1209
|
})
|
|
1202
|
-
),
|
|
1203
|
-
(
|
|
1210
|
+
), d = await Promise.allSettled(r);
|
|
1211
|
+
(l = t.onFinish) == null || l.call(t, d);
|
|
1204
1212
|
}
|
|
1205
1213
|
async function Vs(e, {
|
|
1206
1214
|
exportAssets: s,
|
|
@@ -1208,68 +1216,68 @@ async function Vs(e, {
|
|
|
1208
1216
|
componentIds: n = "all",
|
|
1209
1217
|
rawConfig: o,
|
|
1210
1218
|
includeResources: r = !1,
|
|
1211
|
-
routeIds:
|
|
1219
|
+
routeIds: d = "all"
|
|
1212
1220
|
} = {}) {
|
|
1213
|
-
var oe, S, f, E, v, z, P, U, Y,
|
|
1214
|
-
const
|
|
1221
|
+
var oe, S, f, E, v, z, P, U, Y, pe, re, de;
|
|
1222
|
+
const l = t === "all" ? e.pageIds : t, u = At({
|
|
1215
1223
|
state: e,
|
|
1216
|
-
pageIds:
|
|
1224
|
+
pageIds: l,
|
|
1217
1225
|
componentIds: n === "all" ? Object.keys(e.components) : n
|
|
1218
|
-
}),
|
|
1226
|
+
}), c = d === "all" ? e.routeIds : d, p = (h, T) => {
|
|
1219
1227
|
var C;
|
|
1220
1228
|
return {
|
|
1221
|
-
id:
|
|
1222
|
-
name:
|
|
1223
|
-
isTemplateSection:
|
|
1224
|
-
templateDescription:
|
|
1225
|
-
llmConfig:
|
|
1226
|
-
component:
|
|
1227
|
-
config:
|
|
1228
|
-
visibility:
|
|
1229
|
-
properties: ((C =
|
|
1229
|
+
id: h.id,
|
|
1230
|
+
name: h.name,
|
|
1231
|
+
isTemplateSection: h.isTemplateSection ?? !1,
|
|
1232
|
+
templateDescription: h.templateDescription,
|
|
1233
|
+
llmConfig: h.llmConfig,
|
|
1234
|
+
component: h.component,
|
|
1235
|
+
config: h.config,
|
|
1236
|
+
visibility: h.visibility,
|
|
1237
|
+
properties: ((C = h.locales) == null ? void 0 : C[T]) ?? {}
|
|
1230
1238
|
};
|
|
1231
|
-
},
|
|
1239
|
+
}, g = (h, T) => {
|
|
1232
1240
|
var C;
|
|
1233
1241
|
return {
|
|
1234
|
-
id:
|
|
1235
|
-
createdAt:
|
|
1236
|
-
updatedAt:
|
|
1237
|
-
publishedAt:
|
|
1238
|
-
isPublic:
|
|
1239
|
-
templateConfig:
|
|
1240
|
-
meta: ((C =
|
|
1242
|
+
id: h.id,
|
|
1243
|
+
createdAt: h.createdAt,
|
|
1244
|
+
updatedAt: h.updatedAt,
|
|
1245
|
+
publishedAt: h.publishedAt,
|
|
1246
|
+
isPublic: h.isPublic ?? !0,
|
|
1247
|
+
templateConfig: h.templateConfig,
|
|
1248
|
+
meta: ((C = h.locales) == null ? void 0 : C[T]) ?? {},
|
|
1241
1249
|
sections: R(
|
|
1242
|
-
|
|
1243
|
-
const G =
|
|
1244
|
-
return G &&
|
|
1250
|
+
h.sectionIds.map((J) => {
|
|
1251
|
+
const G = h.sections[J];
|
|
1252
|
+
return G && p(G, T);
|
|
1245
1253
|
})
|
|
1246
1254
|
)
|
|
1247
1255
|
};
|
|
1248
|
-
},
|
|
1249
|
-
id:
|
|
1250
|
-
createdAt:
|
|
1251
|
-
updatedAt:
|
|
1252
|
-
publishedAt:
|
|
1253
|
-
path:
|
|
1254
|
-
handler:
|
|
1255
|
-
isPublic:
|
|
1256
|
-
params:
|
|
1257
|
-
enabledGenerate:
|
|
1258
|
-
displayTemplateId:
|
|
1259
|
-
dataSource:
|
|
1256
|
+
}, y = (h) => ({
|
|
1257
|
+
id: h.id,
|
|
1258
|
+
createdAt: h.createdAt,
|
|
1259
|
+
updatedAt: h.updatedAt,
|
|
1260
|
+
publishedAt: h.publishedAt,
|
|
1261
|
+
path: h.path,
|
|
1262
|
+
handler: h.handler,
|
|
1263
|
+
isPublic: h.isPublic ?? !0,
|
|
1264
|
+
params: h.params ?? [],
|
|
1265
|
+
enabledGenerate: h.enabledGenerate ?? !1,
|
|
1266
|
+
displayTemplateId: h.displayTemplateId,
|
|
1267
|
+
dataSource: h.dataSource
|
|
1260
1268
|
}), a = R(
|
|
1261
|
-
|
|
1262
|
-
const T = e.routes[
|
|
1263
|
-
return T &&
|
|
1269
|
+
c.map((h) => {
|
|
1270
|
+
const T = e.routes[h];
|
|
1271
|
+
return T && y(T);
|
|
1264
1272
|
})
|
|
1265
1273
|
), i = R(
|
|
1266
|
-
e.supportedLocales.map((
|
|
1267
|
-
(
|
|
1274
|
+
e.supportedLocales.map((h) => h.locale).flatMap(
|
|
1275
|
+
(h) => l.map((T) => {
|
|
1268
1276
|
const C = e.pages[T];
|
|
1269
1277
|
return C && {
|
|
1270
|
-
locale:
|
|
1278
|
+
locale: h,
|
|
1271
1279
|
slug: C.slug,
|
|
1272
|
-
page:
|
|
1280
|
+
page: g(C, h)
|
|
1273
1281
|
};
|
|
1274
1282
|
})
|
|
1275
1283
|
)
|
|
@@ -1279,19 +1287,19 @@ async function Vs(e, {
|
|
|
1279
1287
|
H(D, { recursive: !0 });
|
|
1280
1288
|
const A = O(m, "routes");
|
|
1281
1289
|
H(A, { recursive: !0 });
|
|
1282
|
-
for (const { locale:
|
|
1290
|
+
for (const { locale: h, slug: T, page: C } of i)
|
|
1283
1291
|
await fe(C, w, {
|
|
1284
|
-
getFilename: () => `${Ie(T) || "index"}.${
|
|
1292
|
+
getFilename: () => `${Ie(T) || "index"}.${h}.yml`,
|
|
1285
1293
|
exportAssets: s
|
|
1286
1294
|
});
|
|
1287
|
-
for (const
|
|
1288
|
-
await fe(
|
|
1295
|
+
for (const h of a)
|
|
1296
|
+
await fe(h, A, {
|
|
1289
1297
|
// getFilename: () => `${sanitizeSlug(route.path)}.yml`,
|
|
1290
|
-
getFilename: () => `${Ie(
|
|
1298
|
+
getFilename: () => `${Ie(h.path) || "index"}.yml`,
|
|
1291
1299
|
exportAssets: s
|
|
1292
1300
|
});
|
|
1293
|
-
for (const
|
|
1294
|
-
const T = (oe = e.components[
|
|
1301
|
+
for (const h of u) {
|
|
1302
|
+
const T = (oe = e.components[h]) == null ? void 0 : oe.data;
|
|
1295
1303
|
T && await fe(T, D, {
|
|
1296
1304
|
getFilename: (C) => `${C.name || "unnamed"}.${C.id}.yml`,
|
|
1297
1305
|
exportAssets: s
|
|
@@ -1301,23 +1309,23 @@ async function Vs(e, {
|
|
|
1301
1309
|
H(_(N), { recursive: !0 });
|
|
1302
1310
|
const M = {
|
|
1303
1311
|
pages: R(
|
|
1304
|
-
|
|
1305
|
-
const T = e.pages[
|
|
1306
|
-
return T && { id:
|
|
1312
|
+
l.map((h) => {
|
|
1313
|
+
const T = e.pages[h];
|
|
1314
|
+
return T && { id: h, slug: T.slug };
|
|
1307
1315
|
})
|
|
1308
1316
|
),
|
|
1309
1317
|
routes: R(
|
|
1310
|
-
|
|
1311
|
-
const T = e.routes[
|
|
1312
|
-
return T && { id:
|
|
1318
|
+
c.map((h) => {
|
|
1319
|
+
const T = e.routes[h];
|
|
1320
|
+
return T && { id: h, path: T.path };
|
|
1313
1321
|
})
|
|
1314
1322
|
),
|
|
1315
1323
|
components: R(
|
|
1316
|
-
|
|
1324
|
+
u.map((h) => {
|
|
1317
1325
|
var C;
|
|
1318
|
-
const T = (C = e.components[
|
|
1326
|
+
const T = (C = e.components[h]) == null ? void 0 : C.data;
|
|
1319
1327
|
return T && {
|
|
1320
|
-
id:
|
|
1328
|
+
id: h,
|
|
1321
1329
|
name: T.name
|
|
1322
1330
|
};
|
|
1323
1331
|
})
|
|
@@ -1325,11 +1333,11 @@ async function Vs(e, {
|
|
|
1325
1333
|
...r ? {
|
|
1326
1334
|
resources: {
|
|
1327
1335
|
components: R(
|
|
1328
|
-
Object.keys(((S = e.resources) == null ? void 0 : S.components) || {}).filter((
|
|
1336
|
+
Object.keys(((S = e.resources) == null ? void 0 : S.components) || {}).filter((h) => u.includes(h)).map((h) => {
|
|
1329
1337
|
var T, C, J, G;
|
|
1330
1338
|
return {
|
|
1331
|
-
id:
|
|
1332
|
-
name: (G = (J = (C = (T = e.resources) == null ? void 0 : T.components) == null ? void 0 : C[
|
|
1339
|
+
id: h,
|
|
1340
|
+
name: (G = (J = (C = (T = e.resources) == null ? void 0 : T.components) == null ? void 0 : C[h]) == null ? void 0 : J.component) == null ? void 0 : G.name
|
|
1333
1341
|
};
|
|
1334
1342
|
})
|
|
1335
1343
|
)
|
|
@@ -1339,12 +1347,12 @@ async function Vs(e, {
|
|
|
1339
1347
|
config: e.config
|
|
1340
1348
|
};
|
|
1341
1349
|
ye(N, Z.stringify(M));
|
|
1342
|
-
const
|
|
1343
|
-
if (o && ye(
|
|
1344
|
-
const
|
|
1350
|
+
const le = O(m, "config.source.json");
|
|
1351
|
+
if (o && ye(le, JSON.stringify(o)), r) {
|
|
1352
|
+
const h = O(m, "resources"), T = O(h, "components");
|
|
1345
1353
|
H(T, { recursive: !0 });
|
|
1346
1354
|
for (const G of Object.keys(((f = e == null ? void 0 : e.resources) == null ? void 0 : f.components) ?? {}).filter(
|
|
1347
|
-
($) =>
|
|
1355
|
+
($) => u.includes($)
|
|
1348
1356
|
)) {
|
|
1349
1357
|
const $ = (z = (v = (E = e.resources) == null ? void 0 : E.components) == null ? void 0 : v[G]) == null ? void 0 : z.component;
|
|
1350
1358
|
$ && await fe($, T, {
|
|
@@ -1356,9 +1364,9 @@ async function Vs(e, {
|
|
|
1356
1364
|
H(C, { recursive: !0 });
|
|
1357
1365
|
const { chunks: J } = await Ge();
|
|
1358
1366
|
for (const G of Object.keys(((P = e == null ? void 0 : e.resources) == null ? void 0 : P.components) ?? {}).filter(
|
|
1359
|
-
($) =>
|
|
1367
|
+
($) => u.includes($)
|
|
1360
1368
|
)) {
|
|
1361
|
-
const $ = (
|
|
1369
|
+
const $ = (pe = (Y = (U = e.resources) == null ? void 0 : U.components) == null ? void 0 : Y[G]) == null ? void 0 : pe.component;
|
|
1362
1370
|
if ($ && ((re = $.renderer) == null ? void 0 : re.type) === "react-component") {
|
|
1363
1371
|
const W = ((de = $.renderer) == null ? void 0 : de.chunks) ?? [];
|
|
1364
1372
|
if ((W == null ? void 0 : W.length) > 0)
|
|
@@ -1376,16 +1384,16 @@ async function Vs(e, {
|
|
|
1376
1384
|
return m;
|
|
1377
1385
|
}
|
|
1378
1386
|
async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
1379
|
-
var r,
|
|
1387
|
+
var r, d, l, u;
|
|
1380
1388
|
if (!F(e))
|
|
1381
1389
|
return null;
|
|
1382
1390
|
let n, o = !1;
|
|
1383
1391
|
try {
|
|
1384
1392
|
Q(e).isDirectory() ? n = e : /\.(tgz|gz|tar)$/.test(e) && (o = !0, n = dt(), await os({ file: e, C: n }));
|
|
1385
|
-
const
|
|
1386
|
-
if (!
|
|
1393
|
+
const c = ke("**/.blocklet/pages/pages.config.yml", { cwd: n, absolute: !0 }).at(0), p = c && O(_(c), "../../pages"), g = c && O(_(c), "../../components"), y = c && O(_(c), "../../chunks"), a = c && O(_(c), "../../routes");
|
|
1394
|
+
if (!c)
|
|
1387
1395
|
return null;
|
|
1388
|
-
const i = Z.parse(X(
|
|
1396
|
+
const i = Z.parse(X(c).toString()), m = (S, f, E) => {
|
|
1389
1397
|
let v = O(S, `${f}${E ? `.${E}` : ""}.yml`);
|
|
1390
1398
|
return (!F(v) || !Q(v).isFile()) && (v = O(S, f, `index${E ? `.${E}` : ""}.yml`), !F(v) || !Q(v)) ? null : Z.parse(X(v).toString());
|
|
1391
1399
|
}, w = (S, f) => {
|
|
@@ -1404,10 +1412,10 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1404
1412
|
var z;
|
|
1405
1413
|
const f = R(
|
|
1406
1414
|
i.supportedLocales.map(({ locale: P }) => {
|
|
1407
|
-
const U =
|
|
1415
|
+
const U = p ? m(p, Ie(S), P) : void 0;
|
|
1408
1416
|
if (U)
|
|
1409
1417
|
return { locale: P, page: U };
|
|
1410
|
-
const Y =
|
|
1418
|
+
const Y = p ? m(p, S, P) : void 0;
|
|
1411
1419
|
return Y && { locale: P, page: Y };
|
|
1412
1420
|
})
|
|
1413
1421
|
), E = (z = f[0]) == null ? void 0 : z.page;
|
|
@@ -1426,8 +1434,8 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1426
1434
|
visibility: P.visibility,
|
|
1427
1435
|
locales: Object.fromEntries(
|
|
1428
1436
|
R(
|
|
1429
|
-
f.map(({ locale: Y, page:
|
|
1430
|
-
const re =
|
|
1437
|
+
f.map(({ locale: Y, page: pe }) => {
|
|
1438
|
+
const re = pe.sections.find((de) => de.id === U);
|
|
1431
1439
|
return re && [Y, re.properties];
|
|
1432
1440
|
})
|
|
1433
1441
|
)
|
|
@@ -1465,7 +1473,7 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1465
1473
|
dataSource: (f == null ? void 0 : f.dataSource) ?? {}
|
|
1466
1474
|
};
|
|
1467
1475
|
})) ?? []
|
|
1468
|
-
), M =
|
|
1476
|
+
), M = g ? R(((d = i.components) == null ? void 0 : d.map(({ id: S }) => w(g, S))) ?? []) : [];
|
|
1469
1477
|
if (s) {
|
|
1470
1478
|
const S = (...f) => {
|
|
1471
1479
|
b.info(`[${o ? ne(e) : ne(O(e, "../../../../"))}] importAssets:`, ...f);
|
|
@@ -1478,7 +1486,7 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1478
1486
|
const f = {}, E = {};
|
|
1479
1487
|
S("start to upload assets"), await Promise.allSettled([
|
|
1480
1488
|
tt(M, f, {
|
|
1481
|
-
getFilePath: (v) =>
|
|
1489
|
+
getFilePath: (v) => g && O(g, v),
|
|
1482
1490
|
onFinish: (v) => {
|
|
1483
1491
|
S(`upload ${v.length} component assets`);
|
|
1484
1492
|
}
|
|
@@ -1486,7 +1494,7 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1486
1494
|
tt(A, E, {
|
|
1487
1495
|
getFilePath: (v, z) => {
|
|
1488
1496
|
const P = Me(A, z.slice(0, 1));
|
|
1489
|
-
return
|
|
1497
|
+
return p && O(p, _(P.slug), v);
|
|
1490
1498
|
},
|
|
1491
1499
|
onFinish: (v) => {
|
|
1492
1500
|
S(`upload ${v.length} page assets`);
|
|
@@ -1497,20 +1505,20 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1497
1505
|
S("Error during asset import:", f);
|
|
1498
1506
|
}
|
|
1499
1507
|
}
|
|
1500
|
-
const
|
|
1508
|
+
const le = {};
|
|
1501
1509
|
if (t) {
|
|
1502
|
-
const S =
|
|
1503
|
-
((
|
|
1510
|
+
const S = c && O(_(c), "../../resources/components"), f = R(
|
|
1511
|
+
((u = (l = i.resources) == null ? void 0 : l.components) == null ? void 0 : u.map(({ id: E }) => w(S, E))) ?? []
|
|
1504
1512
|
);
|
|
1505
|
-
f.length > 0 && (
|
|
1513
|
+
f.length > 0 && (le.components = Object.fromEntries(
|
|
1506
1514
|
f.map((E, v) => [E.id, { index: v, component: E }])
|
|
1507
1515
|
));
|
|
1508
1516
|
}
|
|
1509
1517
|
const oe = {};
|
|
1510
|
-
if (
|
|
1511
|
-
const S = Ft(
|
|
1518
|
+
if (y && F(y)) {
|
|
1519
|
+
const S = Ft(y);
|
|
1512
1520
|
for (const f of S)
|
|
1513
|
-
oe[f] = O(
|
|
1521
|
+
oe[f] = O(y, f);
|
|
1514
1522
|
}
|
|
1515
1523
|
return {
|
|
1516
1524
|
supportedLocales: i.supportedLocales,
|
|
@@ -1518,7 +1526,7 @@ async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
|
1518
1526
|
components: Object.fromEntries(M.map((S, f) => [S.id, { index: f, data: S }])),
|
|
1519
1527
|
pages: Object.fromEntries(A.map((S) => [S.id, S])),
|
|
1520
1528
|
config: i.config || {},
|
|
1521
|
-
resources:
|
|
1529
|
+
resources: le,
|
|
1522
1530
|
chunks: oe,
|
|
1523
1531
|
routeIds: N.map((S) => S.id),
|
|
1524
1532
|
routes: Object.fromEntries(N.map((S) => [S.id, S])),
|
|
@@ -1537,14 +1545,14 @@ async function st(e, s, {
|
|
|
1537
1545
|
} = {}) {
|
|
1538
1546
|
try {
|
|
1539
1547
|
r && Os(r);
|
|
1540
|
-
} catch (
|
|
1541
|
-
b.error("clear preload page cache error", { error:
|
|
1548
|
+
} catch (y) {
|
|
1549
|
+
b.error("clear preload page cache error", { error: y });
|
|
1542
1550
|
}
|
|
1543
|
-
const { pages:
|
|
1551
|
+
const { pages: d, pageIds: l, routeIds: u, routes: c, supportedLocales: p } = e;
|
|
1544
1552
|
if (r === "production") {
|
|
1545
|
-
let
|
|
1546
|
-
for (const i of
|
|
1547
|
-
const m =
|
|
1553
|
+
let y = t ?? [], a = null;
|
|
1554
|
+
for (const i of u ?? []) {
|
|
1555
|
+
const m = c == null ? void 0 : c[i];
|
|
1548
1556
|
if (m != null && m.params && (m == null ? void 0 : m.params.length) > 0 && (m != null && m.paramsOptions) && (m == null ? void 0 : m.paramsOptions.length) > 0) {
|
|
1549
1557
|
const w = _e({
|
|
1550
1558
|
basePath: m.path,
|
|
@@ -1556,17 +1564,17 @@ async function st(e, s, {
|
|
|
1556
1564
|
currentOptionIds: [],
|
|
1557
1565
|
result: []
|
|
1558
1566
|
}), D = Object.fromEntries(w.map((A) => [`${i}-${A.paramOptionIds.join("-")}`, A]));
|
|
1559
|
-
a = { ...a || {}, ...D }, t || (
|
|
1560
|
-
} else t ||
|
|
1567
|
+
a = { ...a || {}, ...D }, t || (y = [...y, ...w.map((A) => `${i}-${A.paramOptionIds.join("-")}`)]);
|
|
1568
|
+
} else t || y.push(i);
|
|
1561
1569
|
}
|
|
1562
|
-
b.info("routeIds to be published: ",
|
|
1563
|
-
for (const i of
|
|
1570
|
+
b.info("routeIds to be published: ", y);
|
|
1571
|
+
for (const i of y) {
|
|
1564
1572
|
let m = i;
|
|
1565
1573
|
if (m.includes("-")) {
|
|
1566
1574
|
const [A] = m.split("-");
|
|
1567
1575
|
m = A;
|
|
1568
1576
|
}
|
|
1569
|
-
const w =
|
|
1577
|
+
const w = c == null ? void 0 : c[m];
|
|
1570
1578
|
if (!w) {
|
|
1571
1579
|
const A = s.pageIds.indexOf(m);
|
|
1572
1580
|
A !== -1 && o && (s.pageIds.splice(A, 1), delete s.pages[m]);
|
|
@@ -1584,7 +1592,7 @@ async function st(e, s, {
|
|
|
1584
1592
|
b.info("no display template", i);
|
|
1585
1593
|
continue;
|
|
1586
1594
|
}
|
|
1587
|
-
const D =
|
|
1595
|
+
const D = d[w.displayTemplateId];
|
|
1588
1596
|
if (!D) {
|
|
1589
1597
|
b.info("no template page", i);
|
|
1590
1598
|
continue;
|
|
@@ -1619,10 +1627,10 @@ async function st(e, s, {
|
|
|
1619
1627
|
}
|
|
1620
1628
|
if (o && !t)
|
|
1621
1629
|
for (const i of s.pageIds)
|
|
1622
|
-
|
|
1630
|
+
y != null && y.includes(i) || (delete s.pages[i], b.info("delete page", i)), s.pageIds = [...s.pageIds].filter((m) => y == null ? void 0 : y.includes(m));
|
|
1623
1631
|
} else {
|
|
1624
|
-
for (const
|
|
1625
|
-
const a =
|
|
1632
|
+
for (const y of l) {
|
|
1633
|
+
const a = d[y];
|
|
1626
1634
|
if (a)
|
|
1627
1635
|
if (s.pageIds.includes(a.id)) {
|
|
1628
1636
|
if (n === "replace")
|
|
@@ -1634,10 +1642,10 @@ async function st(e, s, {
|
|
|
1634
1642
|
} else
|
|
1635
1643
|
s.pageIds.push(a.id), s.pages[a.id] = a;
|
|
1636
1644
|
}
|
|
1637
|
-
for (const
|
|
1638
|
-
const a =
|
|
1645
|
+
for (const y of u) {
|
|
1646
|
+
const a = c[y];
|
|
1639
1647
|
if (a)
|
|
1640
|
-
if (s.
|
|
1648
|
+
if (s.routeIds.includes(a.id)) {
|
|
1641
1649
|
if (n === "replace")
|
|
1642
1650
|
s.routes[a.id] = a;
|
|
1643
1651
|
else if (n === "byUpdateTime") {
|
|
@@ -1648,16 +1656,16 @@ async function st(e, s, {
|
|
|
1648
1656
|
s.routeIds.push(a.id), s.routes[a.id] = a;
|
|
1649
1657
|
}
|
|
1650
1658
|
}
|
|
1651
|
-
if (s.supportedLocales.splice(0, s.supportedLocales.length), s.supportedLocales.push(...Qt(
|
|
1652
|
-
for (const
|
|
1653
|
-
delete s.components[
|
|
1654
|
-
let
|
|
1655
|
-
|
|
1659
|
+
if (s.supportedLocales.splice(0, s.supportedLocales.length), s.supportedLocales.push(...Qt(p)), o)
|
|
1660
|
+
for (const y of Object.keys(s.components))
|
|
1661
|
+
delete s.components[y];
|
|
1662
|
+
let g = JSON.parse(JSON.stringify(e.components));
|
|
1663
|
+
g = Object.fromEntries(
|
|
1656
1664
|
await Promise.all(
|
|
1657
|
-
Object.entries(
|
|
1665
|
+
Object.entries(g).map(async ([y, a]) => {
|
|
1658
1666
|
const i = await ft(a == null ? void 0 : a.data);
|
|
1659
1667
|
return [
|
|
1660
|
-
|
|
1668
|
+
y,
|
|
1661
1669
|
{
|
|
1662
1670
|
...a,
|
|
1663
1671
|
data: i
|
|
@@ -1665,7 +1673,7 @@ async function st(e, s, {
|
|
|
1665
1673
|
];
|
|
1666
1674
|
})
|
|
1667
1675
|
)
|
|
1668
|
-
), Object.assign(s.components,
|
|
1676
|
+
), Object.assign(s.components, g), Object.assign(s.config, JSON.parse(JSON.stringify(e.config))), s.resources.components = JSON.parse(JSON.stringify(e.resources.components || {}));
|
|
1669
1677
|
}
|
|
1670
1678
|
const ft = Oe(
|
|
1671
1679
|
async (e) => {
|
|
@@ -1691,18 +1699,18 @@ const ft = Oe(
|
|
|
1691
1699
|
},
|
|
1692
1700
|
{
|
|
1693
1701
|
keyGenerator: (e) => {
|
|
1694
|
-
var p,
|
|
1695
|
-
const s = (e == null ? void 0 : e.id) || "", t = (e == null ? void 0 : e.name) || "", n = ((
|
|
1696
|
-
let
|
|
1697
|
-
return ((
|
|
1702
|
+
var c, p, g, y;
|
|
1703
|
+
const s = (e == null ? void 0 : e.id) || "", t = (e == null ? void 0 : e.name) || "", n = ((c = e == null ? void 0 : e.renderer) == null ? void 0 : c.type) || "", o = (e == null ? void 0 : e.properties) || {}, r = (e == null ? void 0 : e.updatedAt) || "", d = te("md5").update(JSON.stringify(o)).digest("hex");
|
|
1704
|
+
let l = "", u = "";
|
|
1705
|
+
return ((p = e == null ? void 0 : e.renderer) == null ? void 0 : p.type) === "react-component" && (l = te("md5").update(((g = e == null ? void 0 : e.renderer) == null ? void 0 : g.script) || "").digest("hex"), u = te("md5").update(((y = e == null ? void 0 : e.renderer) == null ? void 0 : y.editComponent) || "").digest("hex")), JSON.stringify([
|
|
1698
1706
|
"checkPropertiesFromCode",
|
|
1699
1707
|
s,
|
|
1700
1708
|
t,
|
|
1701
1709
|
n,
|
|
1702
|
-
|
|
1710
|
+
d,
|
|
1703
1711
|
r,
|
|
1704
|
-
|
|
1705
|
-
|
|
1712
|
+
l,
|
|
1713
|
+
u
|
|
1706
1714
|
]);
|
|
1707
1715
|
},
|
|
1708
1716
|
lruOptions: {
|
|
@@ -1716,7 +1724,7 @@ function gt() {
|
|
|
1716
1724
|
return Ae = (async () => {
|
|
1717
1725
|
const e = Lt({
|
|
1718
1726
|
types: [
|
|
1719
|
-
{ did:
|
|
1727
|
+
{ did: pt, type: Xe },
|
|
1720
1728
|
{ did: ks, type: Xe }
|
|
1721
1729
|
]
|
|
1722
1730
|
});
|
|
@@ -1798,10 +1806,10 @@ he[ht] = Ks(async ({ pages: e, components: s }) => {
|
|
|
1798
1806
|
if (r != null && r.useAllResources)
|
|
1799
1807
|
o.syncedStore.resources.components = s;
|
|
1800
1808
|
else {
|
|
1801
|
-
const
|
|
1802
|
-
Object.entries(s || {}).filter(([
|
|
1809
|
+
const l = (await Te.findAll({ where: { projectId: n } })).map((c) => c.componentId), u = Object.fromEntries(
|
|
1810
|
+
Object.entries(s || {}).filter(([c]) => l.includes(c))
|
|
1803
1811
|
);
|
|
1804
|
-
o.syncedStore.resources.components =
|
|
1812
|
+
o.syncedStore.resources.components = u;
|
|
1805
1813
|
}
|
|
1806
1814
|
b.info(`update [${n}] resource states:`, {
|
|
1807
1815
|
pages: Object.keys(o.syncedStore.resources.pages || {}).length,
|
|
@@ -1822,7 +1830,7 @@ async function Ge({
|
|
|
1822
1830
|
return e && (Ae ?? (Ae = gt()), await Ae), { states: ee, pages: $e, components: Fe, chunks: Be };
|
|
1823
1831
|
}
|
|
1824
1832
|
export {
|
|
1825
|
-
|
|
1833
|
+
pt as C,
|
|
1826
1834
|
Qe as G,
|
|
1827
1835
|
q as P,
|
|
1828
1836
|
Xe as R,
|