@blocklet/pages-kit-inner-components 0.4.89 → 0.4.91
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/{draft-data-CMqq2YH1.js → draft-data-CE4YeR_n.js} +1 -1
- package/lib/cjs/chunks/{home-O1tb16Jn.js → home-BW7VfExi.js} +35 -35
- package/lib/cjs/chunks/{publish-button-DEx0XGBW.js → publish-button-BRVXtU3n.js} +1 -1
- package/lib/cjs/chunks/{site-state-C1M4mrHD.js → site-state-B0YNPQJU.js} +4 -4
- package/lib/cjs/chunks/state-oKsa8z3D.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/project-html.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/es/chunks/{draft-data-vlK5oTGT.js → draft-data-rHmtmftB.js} +1 -1
- package/lib/es/chunks/{home-Y2IIftcZ.js → home-DQvcjT5p.js} +402 -401
- package/lib/es/chunks/{publish-button-BTed0K41.js → publish-button-DtE5FP5v.js} +3 -3
- package/lib/es/chunks/{site-state-eOo5A_KN.js → site-state-BVJJFXxb.js} +106 -105
- package/lib/es/chunks/{state-DqChB5ys.js → state-JDvNqLu1.js} +121 -116
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +2 -2
- package/lib/es/locales.js +67 -6
- package/lib/es/project-html.js +1 -1
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +1 -1
- package/lib/es/site-state.js +1 -1
- package/lib/es/theme.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/chunks/state-BjeG4kYg.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { u as R, l as J, f as q, P as G } from "./state-
|
|
2
|
+
import { u as R, l as J, f as q, P as G } from "./state-JDvNqLu1.js";
|
|
3
3
|
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import I from "@arcblock/ux/lib/Toast";
|
|
5
5
|
import { Warning as F, Sync as Q, VisibilityOff as U } from "@mui/icons-material";
|
|
@@ -9,7 +9,7 @@ import { produce as oe } from "immer";
|
|
|
9
9
|
import N from "lodash/difference";
|
|
10
10
|
import { useState as D, useMemo as j, useCallback as L, forwardRef as se, useImperativeHandle as le, useEffect as ce } from "react";
|
|
11
11
|
import { useAsync as ae } from "react-use";
|
|
12
|
-
import { p as de, g as ue, L as me } from "./home-
|
|
12
|
+
import { p as de, g as ue, L as me } from "./home-DQvcjT5p.js";
|
|
13
13
|
function ge(r) {
|
|
14
14
|
const [a, y] = D(!1);
|
|
15
15
|
return /* @__PURE__ */ e(
|
|
@@ -174,7 +174,7 @@ const Ie = se(({ mode: r, state: a }, y) => {
|
|
|
174
174
|
color: "primary",
|
|
175
175
|
variant: "contained",
|
|
176
176
|
size: "small",
|
|
177
|
-
sx: { mr:
|
|
177
|
+
sx: { mr: 1 },
|
|
178
178
|
onClick: w,
|
|
179
179
|
loading: d,
|
|
180
180
|
disabled: d,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var pt = Object.defineProperty;
|
|
2
2
|
var ut = (t, o, e) => o in t ? pt(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e;
|
|
3
|
-
var
|
|
3
|
+
var T = (t, o, e) => ut(t, typeof o != "symbol" ? o + "" : o, e);
|
|
4
4
|
import { getComponentMountPoint as dt } from "@blocklet/pages-kit/builtin/utils";
|
|
5
5
|
import { PreloadComponentScriptModule as ae } from "@blocklet/pages-kit/types";
|
|
6
6
|
import { componentUMDName as mt, RenderNestedComponent as Le, mergeComponent as ft, getComponentDependencies as gt } from "@blocklet/pages-kit/utils/property";
|
|
@@ -12,8 +12,8 @@ import { joinURL as G, getQuery as wt, withQuery as Et, parseURL as Re, withHttp
|
|
|
12
12
|
import { createHash as ge } from "crypto";
|
|
13
13
|
import It from "@blocklet/logger";
|
|
14
14
|
import { BuiltinModules as Ot } from "@blocklet/pages-kit/utils/builtin";
|
|
15
|
-
import { createBuiltinModuleTransformer as
|
|
16
|
-
import { getResources as At, getComponentWebEndpoint as
|
|
15
|
+
import { createBuiltinModuleTransformer as vt, isRelativeModule as Ct } from "@blocklet/pages-kit/utils/typescript/builtin-module-transformer";
|
|
16
|
+
import { getResources as At, getComponentWebEndpoint as Pt, call as Tt } from "@blocklet/sdk/lib/component";
|
|
17
17
|
import xt from "autoprefixer";
|
|
18
18
|
import * as jt from "esbuild";
|
|
19
19
|
import { readFileSync as X, existsSync as V, lstatSync as ie, readdirSync as kt, rmSync as qe, mkdtempSync as Dt, renameSync as Ue, mkdirSync as B, writeFileSync as le, copyFileSync as Nt, createWriteStream as Lt } from "fs";
|
|
@@ -27,7 +27,7 @@ import * as Ee from "lib0/decoding";
|
|
|
27
27
|
import * as x from "lib0/encoding";
|
|
28
28
|
import $t from "lodash/cloneDeep";
|
|
29
29
|
import Qe from "lodash/debounce";
|
|
30
|
-
import
|
|
30
|
+
import Pe from "lodash/get";
|
|
31
31
|
import Ft from "lodash/isEmpty";
|
|
32
32
|
import Bt from "lodash/pick";
|
|
33
33
|
import Me from "lodash/set";
|
|
@@ -43,17 +43,18 @@ import { writeUpdate as Xt, writeSyncStep1 as Zt, readSyncMessage as es } from "
|
|
|
43
43
|
import * as Z from "yaml";
|
|
44
44
|
import * as z from "yjs";
|
|
45
45
|
import ts from "lodash/isNil";
|
|
46
|
-
import { DataTypes as
|
|
46
|
+
import { DataTypes as P, Sequelize as ss, Model as Xe, Op as os } from "sequelize";
|
|
47
47
|
import "sqlite3";
|
|
48
48
|
import "@blocklet/pages-kit/types/state";
|
|
49
49
|
y.env.mode;
|
|
50
|
+
process.env.OPENAI_API_KEY;
|
|
50
51
|
const ns = "image-bin";
|
|
51
52
|
y.env.INIT_TEMPLATE_PATH;
|
|
52
53
|
const rs = process.env.DATABASE_URL || Ht.join(y.env.dataDir, "db/pages-kit.db"), $e = y, bo = () => y.env.tenantMode === "multiple", Io = () => {
|
|
53
54
|
var t;
|
|
54
55
|
return (ts($e.env.preferences.multiTenantAllProjectAccessPassports) ? [] : (t = $e.env.preferences.multiTenantAllProjectAccessPassports) == null ? void 0 : t.split(",")) || [];
|
|
55
|
-
}, b = It("pages-kit"), as =
|
|
56
|
-
|
|
56
|
+
}, b = It("pages-kit"), as = P.sqlite.DATE.parse;
|
|
57
|
+
P.sqlite.DATE.parse = (t, o) => typeof t == "number" ? new Date(t) : as(t, o);
|
|
57
58
|
const se = new ss({
|
|
58
59
|
dialect: "sqlite",
|
|
59
60
|
storage: rs,
|
|
@@ -76,17 +77,17 @@ class he extends Xe {
|
|
|
76
77
|
he.init(
|
|
77
78
|
{
|
|
78
79
|
id: {
|
|
79
|
-
type:
|
|
80
|
+
type: P.UUID,
|
|
80
81
|
allowNull: !1,
|
|
81
82
|
primaryKey: !0,
|
|
82
|
-
defaultValue:
|
|
83
|
+
defaultValue: P.UUIDV4
|
|
83
84
|
},
|
|
84
85
|
projectId: {
|
|
85
|
-
type:
|
|
86
|
+
type: P.UUID,
|
|
86
87
|
allowNull: !1
|
|
87
88
|
},
|
|
88
89
|
componentId: {
|
|
89
|
-
type:
|
|
90
|
+
type: P.STRING,
|
|
90
91
|
allowNull: !1
|
|
91
92
|
}
|
|
92
93
|
},
|
|
@@ -104,32 +105,32 @@ class Y extends Xe {
|
|
|
104
105
|
Y.init(
|
|
105
106
|
{
|
|
106
107
|
id: {
|
|
107
|
-
type:
|
|
108
|
-
defaultValue:
|
|
108
|
+
type: P.UUID,
|
|
109
|
+
defaultValue: P.UUIDV4,
|
|
109
110
|
primaryKey: !0
|
|
110
111
|
},
|
|
111
112
|
name: {
|
|
112
|
-
type:
|
|
113
|
+
type: P.STRING,
|
|
113
114
|
allowNull: !1
|
|
114
115
|
},
|
|
115
|
-
description:
|
|
116
|
-
createdAt:
|
|
117
|
-
updatedAt:
|
|
116
|
+
description: P.TEXT,
|
|
117
|
+
createdAt: P.DATE,
|
|
118
|
+
updatedAt: P.DATE,
|
|
118
119
|
createdBy: {
|
|
119
|
-
type:
|
|
120
|
+
type: P.STRING,
|
|
120
121
|
allowNull: !1
|
|
121
122
|
},
|
|
122
123
|
updatedBy: {
|
|
123
|
-
type:
|
|
124
|
+
type: P.STRING,
|
|
124
125
|
allowNull: !1
|
|
125
126
|
},
|
|
126
|
-
slug:
|
|
127
|
-
icon:
|
|
128
|
-
pinnedAt:
|
|
129
|
-
useAllResources:
|
|
130
|
-
npmSecret:
|
|
127
|
+
slug: P.STRING,
|
|
128
|
+
icon: P.STRING,
|
|
129
|
+
pinnedAt: P.DATE,
|
|
130
|
+
useAllResources: P.BOOLEAN,
|
|
131
|
+
npmSecret: P.STRING,
|
|
131
132
|
relatedBlocklets: {
|
|
132
|
-
type:
|
|
133
|
+
type: P.JSON,
|
|
133
134
|
allowNull: !1,
|
|
134
135
|
defaultValue: {},
|
|
135
136
|
get() {
|
|
@@ -179,7 +180,7 @@ ${t}
|
|
|
179
180
|
module: k.ModuleKind.ESNext
|
|
180
181
|
},
|
|
181
182
|
transformers: {
|
|
182
|
-
before: [
|
|
183
|
+
before: [vt(k)]
|
|
183
184
|
}
|
|
184
185
|
}).outputText;
|
|
185
186
|
if (o.tailwind && (e = await cs(e, { componentId: o.componentId })), o.module === ae.ESM) return e;
|
|
@@ -231,7 +232,7 @@ ${t}
|
|
|
231
232
|
return { contents: `export { ${o} } from './component'`, loader: "tsx" };
|
|
232
233
|
if (p.path === "component.tsx")
|
|
233
234
|
return { contents: t, loader: "tsx" };
|
|
234
|
-
if (
|
|
235
|
+
if (Ct(p.path)) {
|
|
235
236
|
const d = p.path.split("/").pop();
|
|
236
237
|
if (c || (c = await De({ ensureLoaded: !1 })), (u = c == null ? void 0 : c.chunks) != null && u[d])
|
|
237
238
|
try {
|
|
@@ -485,7 +486,7 @@ function pe({ state: t, componentId: o }) {
|
|
|
485
486
|
var e, s, n;
|
|
486
487
|
return ((e = t.components[o]) == null ? void 0 : e.data) ?? ((n = (s = t.resources.components) == null ? void 0 : s[o]) == null ? void 0 : n.component);
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
+
function vo({ state: t, name: o }) {
|
|
489
490
|
var s, n;
|
|
490
491
|
const e = o.toLowerCase();
|
|
491
492
|
return ((s = Object.values(t.components).find((r) => {
|
|
@@ -625,13 +626,13 @@ const ws = fe(
|
|
|
625
626
|
ttl: 1e3 * 60 * 60
|
|
626
627
|
}
|
|
627
628
|
}
|
|
628
|
-
), Es = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o", Ge = "page",
|
|
629
|
+
), Es = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o", Ge = "page", ve = "trigger-reload-project-resource", tt = Es, bs = "z2qa7BQdkEb3TwYyEYC1psK6uvmGnHSUHt5RM", { uploadToMediaKit: Is } = require("@blocklet/uploader-server"), Ve = Vt("abcdefghijklmnopqrstuvwxyz0123456789", 16), Te = /^\w+(\w|-|\.)+\w+\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm)$/, te = /mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/i, Je = /mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/gi, Os = 1e4, vs = 3e4, ne = 0, be = 1, Cs = 0, As = 1, Ce = y, re = E(process.env.BLOCKLET_DATA_DIR, "site-state"), Co = ["production", "draft"], Ao = ["production"];
|
|
629
630
|
function st(t) {
|
|
630
631
|
return (t == null ? void 0 : t.replace(/\//g, "|")) || "";
|
|
631
632
|
}
|
|
632
|
-
function
|
|
633
|
+
function Ps() {
|
|
633
634
|
var e;
|
|
634
|
-
const t =
|
|
635
|
+
const t = Ce.env.languages.map((s) => ({ locale: s.code, name: s.name })), o = (e = t[0]) == null ? void 0 : e.locale;
|
|
635
636
|
return {
|
|
636
637
|
pageIds: [],
|
|
637
638
|
pages: {},
|
|
@@ -644,11 +645,11 @@ function Cs() {
|
|
|
644
645
|
const F = class F extends z.Doc {
|
|
645
646
|
constructor(e) {
|
|
646
647
|
super();
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
648
|
+
T(this, "states", {});
|
|
649
|
+
T(this, "syncedStore");
|
|
650
|
+
T(this, "conns", /* @__PURE__ */ new Map());
|
|
651
|
+
T(this, "awareness");
|
|
652
|
+
T(this, "awarenessChangeHandler", ({ added: e, updated: s, removed: n }, r) => {
|
|
652
653
|
const l = e.concat(s, n);
|
|
653
654
|
if (r !== null) {
|
|
654
655
|
const c = this.conns.get(r);
|
|
@@ -663,13 +664,13 @@ const F = class F extends z.Doc {
|
|
|
663
664
|
const i = x.toUint8Array(a);
|
|
664
665
|
this.conns.forEach((c, p) => this.send(p, i));
|
|
665
666
|
});
|
|
666
|
-
|
|
667
|
+
T(this, "updateHandler", (e) => {
|
|
667
668
|
const s = x.createEncoder();
|
|
668
669
|
x.writeVarUint(s, ne), Xt(s, e);
|
|
669
670
|
const n = x.toUint8Array(s);
|
|
670
671
|
this.conns.forEach((r, l) => this.send(l, n));
|
|
671
672
|
});
|
|
672
|
-
|
|
673
|
+
T(this, "ensureDataStructure", () => {
|
|
673
674
|
var l;
|
|
674
675
|
const { supportedLocales: e, pages: s, pageIds: n, config: r } = this.syncedStore;
|
|
675
676
|
{
|
|
@@ -680,7 +681,7 @@ const F = class F extends z.Doc {
|
|
|
680
681
|
a.has(c) ? (a.delete(c), i++) : n.splice(i, 1);
|
|
681
682
|
}
|
|
682
683
|
}
|
|
683
|
-
e.splice(0, e.length), e.push(...
|
|
684
|
+
e.splice(0, e.length), e.push(...Ce.env.languages.map((a) => ({ locale: a.code, name: a.name }))), r.defaultLocale = (l = e[0]) == null ? void 0 : l.locale;
|
|
684
685
|
{
|
|
685
686
|
let a = 0;
|
|
686
687
|
const i = /* @__PURE__ */ new Set();
|
|
@@ -690,8 +691,8 @@ const F = class F extends z.Doc {
|
|
|
690
691
|
}
|
|
691
692
|
}
|
|
692
693
|
});
|
|
693
|
-
|
|
694
|
-
e.readyState !==
|
|
694
|
+
T(this, "send", (e, s) => {
|
|
695
|
+
e.readyState !== Cs && e.readyState !== As && this.closeConn(e);
|
|
695
696
|
try {
|
|
696
697
|
e.send(s, (n) => {
|
|
697
698
|
n && this.closeConn(e);
|
|
@@ -700,27 +701,27 @@ const F = class F extends z.Doc {
|
|
|
700
701
|
this.closeConn(e);
|
|
701
702
|
}
|
|
702
703
|
});
|
|
703
|
-
|
|
704
|
+
T(this, "closeConn", (e) => {
|
|
704
705
|
if (e.removeAllListeners(), this.conns.has(e)) {
|
|
705
706
|
const s = this.conns.get(e);
|
|
706
707
|
this.conns.delete(e), s && qt(this.awareness, Array.from(s), null);
|
|
707
708
|
}
|
|
708
709
|
e.close();
|
|
709
710
|
});
|
|
710
|
-
|
|
711
|
+
T(this, "autoSave", Qe(() => {
|
|
711
712
|
B(R(this.draftYjsFilePath), { recursive: !0 }), le(this.draftYjsFilePath, z.encodeStateAsUpdate(this));
|
|
712
713
|
}, Os));
|
|
713
|
-
|
|
714
|
+
T(this, "save", ({ flush: e = !1 } = {}) => {
|
|
714
715
|
this.autoSave(), e && this.autoSave.flush();
|
|
715
716
|
});
|
|
716
|
-
|
|
717
|
+
T(this, "publish", async ({ mode: e, pages: s }) => {
|
|
717
718
|
const n = await this.getState("draft"), r = await this.getState("production");
|
|
718
719
|
await ze(n, r, { pages: s, pageMergeMode: "replace", deletePages: !0, publishMode: e }), r.config.publishedAt = (/* @__PURE__ */ new Date()).getTime();
|
|
719
720
|
for (const l of s || Object.keys(this.syncedStore.pages))
|
|
720
721
|
this.syncedStore.pages[l] && (this.syncedStore.pages[l].publishedAt = (/* @__PURE__ */ new Date()).toISOString());
|
|
721
722
|
await this.setState(e, r);
|
|
722
723
|
});
|
|
723
|
-
|
|
724
|
+
T(this, "mergeState", async (e, s) => {
|
|
724
725
|
var a, i, c;
|
|
725
726
|
const n = JSON.parse(JSON.stringify(s));
|
|
726
727
|
(a = e.config).fontFamily ?? (a.fontFamily = {});
|
|
@@ -736,7 +737,7 @@ const F = class F extends z.Doc {
|
|
|
736
737
|
});
|
|
737
738
|
});
|
|
738
739
|
});
|
|
739
|
-
|
|
740
|
+
T(this, "addConnection", (e) => {
|
|
740
741
|
if (this.conns.has(e))
|
|
741
742
|
return;
|
|
742
743
|
e.binaryType = "arraybuffer", this.conns.set(e, /* @__PURE__ */ new Set()), e.on("message", (r) => this.messageListener(e, new Uint8Array(r)));
|
|
@@ -752,7 +753,7 @@ const F = class F extends z.Doc {
|
|
|
752
753
|
this.closeConn(e), clearInterval(n);
|
|
753
754
|
}
|
|
754
755
|
}
|
|
755
|
-
},
|
|
756
|
+
}, vs);
|
|
756
757
|
e.on("close", () => {
|
|
757
758
|
this.closeConn(e), clearInterval(n);
|
|
758
759
|
}), e.on("pong", () => {
|
|
@@ -768,7 +769,7 @@ const F = class F extends z.Doc {
|
|
|
768
769
|
}
|
|
769
770
|
}
|
|
770
771
|
});
|
|
771
|
-
|
|
772
|
+
T(this, "messageListener", (e, s) => {
|
|
772
773
|
try {
|
|
773
774
|
const n = x.createEncoder(), r = Ee.createDecoder(s), l = Ee.readVarUint(r);
|
|
774
775
|
switch (l) {
|
|
@@ -853,9 +854,9 @@ const F = class F extends z.Doc {
|
|
|
853
854
|
var s, n, r, l;
|
|
854
855
|
if (e === "draft")
|
|
855
856
|
return JSON.parse(JSON.stringify(this.syncedStore));
|
|
856
|
-
if (!this.states[e] && (this.states[e] = await rt(this.getPublishDir(e), { includeResources: !0 }) ??
|
|
857
|
+
if (!this.states[e] && (this.states[e] = await rt(this.getPublishDir(e), { includeResources: !0 }) ?? Ps(), !((n = (s = this.states[e]) == null ? void 0 : s.config) != null && n.defaultLocale))) {
|
|
857
858
|
(r = this.states[e]).config ?? (r.config = {});
|
|
858
|
-
const a =
|
|
859
|
+
const a = Ce.env.languages.map((i) => ({ locale: i.code, name: i.name }));
|
|
859
860
|
this.states[e].config.defaultLocale = (l = a[0]) == null ? void 0 : l.locale;
|
|
860
861
|
}
|
|
861
862
|
return {
|
|
@@ -913,7 +914,7 @@ const F = class F extends z.Doc {
|
|
|
913
914
|
locales: i,
|
|
914
915
|
publishedAt: a.config.publishedAt,
|
|
915
916
|
isPublic: p.isPublic,
|
|
916
|
-
|
|
917
|
+
templateConfig: p.templateConfig
|
|
917
918
|
};
|
|
918
919
|
d && (n[G("/", d, u)] = {
|
|
919
920
|
...f,
|
|
@@ -949,8 +950,8 @@ const F = class F extends z.Doc {
|
|
|
949
950
|
return e;
|
|
950
951
|
}
|
|
951
952
|
};
|
|
952
|
-
|
|
953
|
-
|
|
953
|
+
T(F, "INSTANCE_TTL", 30 * 60 * 1e3), // 30 minutes
|
|
954
|
+
T(F, "sharedInstances", new Ae({
|
|
954
955
|
max: 100,
|
|
955
956
|
// Maximum number of instances to store
|
|
956
957
|
ttl: F.INSTANCE_TTL,
|
|
@@ -968,7 +969,7 @@ function de(t, o, e = []) {
|
|
|
968
969
|
function U(t) {
|
|
969
970
|
return t.filter((o) => o != null);
|
|
970
971
|
}
|
|
971
|
-
async function
|
|
972
|
+
async function Ts(t, o, e) {
|
|
972
973
|
if (!t || !V(t) || !ie(t).isFile())
|
|
973
974
|
return null;
|
|
974
975
|
let s = e[t];
|
|
@@ -986,7 +987,7 @@ async function Ps(t, o, e) {
|
|
|
986
987
|
})(), e[t] = s), s;
|
|
987
988
|
}
|
|
988
989
|
const xs = async (t, o) => {
|
|
989
|
-
const e = q(t), s = await
|
|
990
|
+
const e = q(t), s = await Tt({
|
|
990
991
|
name: tt,
|
|
991
992
|
path: G("/uploads", e),
|
|
992
993
|
responseType: "stream",
|
|
@@ -1009,16 +1010,16 @@ const xs = async (t, o) => {
|
|
|
1009
1010
|
);
|
|
1010
1011
|
};
|
|
1011
1012
|
function nt(t) {
|
|
1012
|
-
return
|
|
1013
|
+
return Te.test(t) ? [t] : te.test(t) ? (Je.lastIndex = 0, Array.from(t.matchAll(Je)).map((e) => e[1]).filter((e) => !!e)) : [];
|
|
1013
1014
|
}
|
|
1014
1015
|
async function Ie(t, o, e) {
|
|
1015
1016
|
const { getFilename: s, exportAssets: n } = e, r = E(o, s(t));
|
|
1016
1017
|
if (B(R(r), { recursive: !0 }), le(r, Z.stringify(t)), n) {
|
|
1017
1018
|
const a = de(
|
|
1018
1019
|
t,
|
|
1019
|
-
(i) => typeof i == "string" && (
|
|
1020
|
+
(i) => typeof i == "string" && (Te.test(i) || te.test(i))
|
|
1020
1021
|
).map((i) => {
|
|
1021
|
-
const c =
|
|
1022
|
+
const c = Pe(t, i);
|
|
1022
1023
|
return nt(c);
|
|
1023
1024
|
}).flat().filter(Boolean);
|
|
1024
1025
|
await js(a, R(r));
|
|
@@ -1032,18 +1033,18 @@ async function Ke(t, o, e) {
|
|
|
1032
1033
|
var a;
|
|
1033
1034
|
const s = de(
|
|
1034
1035
|
t,
|
|
1035
|
-
(i) => typeof i == "string" && (
|
|
1036
|
+
(i) => typeof i == "string" && (Te.test(i) || te.test(i))
|
|
1036
1037
|
), n = Jt(2), r = s.map(
|
|
1037
1038
|
(i) => n(async () => {
|
|
1038
1039
|
try {
|
|
1039
|
-
const c =
|
|
1040
|
+
const c = Pe(t, i), p = nt(c);
|
|
1040
1041
|
for (const u of p) {
|
|
1041
1042
|
const d = q(u), f = e.getFilePath(u, i), h = f ? `${f}:${d}` : d, A = He.get(h);
|
|
1042
1043
|
if (A) {
|
|
1043
1044
|
te.test(c) || Me(t, i, A);
|
|
1044
1045
|
return;
|
|
1045
1046
|
}
|
|
1046
|
-
const j = await
|
|
1047
|
+
const j = await Ts(f, d, o);
|
|
1047
1048
|
j && (te.test(c) || Me(t, i, j), He.set(h, j));
|
|
1048
1049
|
}
|
|
1049
1050
|
} catch (c) {
|
|
@@ -1065,8 +1066,8 @@ async function ks(t, {
|
|
|
1065
1066
|
state: t,
|
|
1066
1067
|
pageIds: l,
|
|
1067
1068
|
componentIds: s === "all" ? Object.keys(t.components) : s
|
|
1068
|
-
}), i = (m,
|
|
1069
|
-
var
|
|
1069
|
+
}), i = (m, v) => {
|
|
1070
|
+
var C;
|
|
1070
1071
|
return {
|
|
1071
1072
|
id: m.id,
|
|
1072
1073
|
name: m.name,
|
|
@@ -1076,33 +1077,33 @@ async function ks(t, {
|
|
|
1076
1077
|
component: m.component,
|
|
1077
1078
|
config: m.config,
|
|
1078
1079
|
visibility: m.visibility,
|
|
1079
|
-
properties: ((
|
|
1080
|
+
properties: ((C = m.locales) == null ? void 0 : C[v]) ?? {}
|
|
1080
1081
|
};
|
|
1081
|
-
}, c = (m,
|
|
1082
|
-
var
|
|
1082
|
+
}, c = (m, v) => {
|
|
1083
|
+
var C;
|
|
1083
1084
|
return {
|
|
1084
1085
|
id: m.id,
|
|
1085
1086
|
createdAt: m.createdAt,
|
|
1086
1087
|
updatedAt: m.updatedAt,
|
|
1087
1088
|
publishedAt: m.publishedAt,
|
|
1088
1089
|
isPublic: m.isPublic ?? !0,
|
|
1089
|
-
|
|
1090
|
-
meta: ((
|
|
1090
|
+
templateConfig: m.templateConfig,
|
|
1091
|
+
meta: ((C = m.locales) == null ? void 0 : C[v]) ?? {},
|
|
1091
1092
|
sections: U(
|
|
1092
1093
|
m.sectionIds.map(($) => {
|
|
1093
1094
|
const _ = m.sections[$];
|
|
1094
|
-
return _ && i(_,
|
|
1095
|
+
return _ && i(_, v);
|
|
1095
1096
|
})
|
|
1096
1097
|
)
|
|
1097
1098
|
};
|
|
1098
1099
|
}, p = U(
|
|
1099
1100
|
t.supportedLocales.map((m) => m.locale).flatMap(
|
|
1100
|
-
(m) => l.map((
|
|
1101
|
-
const
|
|
1102
|
-
return
|
|
1101
|
+
(m) => l.map((v) => {
|
|
1102
|
+
const C = t.pages[v];
|
|
1103
|
+
return C && {
|
|
1103
1104
|
locale: m,
|
|
1104
|
-
slug:
|
|
1105
|
-
page: c(
|
|
1105
|
+
slug: C.slug,
|
|
1106
|
+
page: c(C, m)
|
|
1106
1107
|
};
|
|
1107
1108
|
})
|
|
1108
1109
|
)
|
|
@@ -1110,15 +1111,15 @@ async function ks(t, {
|
|
|
1110
1111
|
B(d, { recursive: !0 });
|
|
1111
1112
|
const f = E(u, "components");
|
|
1112
1113
|
B(f, { recursive: !0 });
|
|
1113
|
-
for (const { locale: m, slug:
|
|
1114
|
-
await Ie(
|
|
1115
|
-
getFilename: () => `${st(
|
|
1114
|
+
for (const { locale: m, slug: v, page: C } of p)
|
|
1115
|
+
await Ie(C, d, {
|
|
1116
|
+
getFilename: () => `${st(v) || "index"}.${m}.yml`,
|
|
1116
1117
|
exportAssets: o
|
|
1117
1118
|
});
|
|
1118
1119
|
for (const m of a) {
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1121
|
-
getFilename: (
|
|
1120
|
+
const v = (M = t.components[m]) == null ? void 0 : M.data;
|
|
1121
|
+
v && await Ie(v, f, {
|
|
1122
|
+
getFilename: (C) => `${C.name || "unnamed"}.${C.id}.yml`,
|
|
1122
1123
|
exportAssets: o
|
|
1123
1124
|
});
|
|
1124
1125
|
}
|
|
@@ -1127,17 +1128,17 @@ async function ks(t, {
|
|
|
1127
1128
|
const A = {
|
|
1128
1129
|
pages: U(
|
|
1129
1130
|
l.map((m) => {
|
|
1130
|
-
const
|
|
1131
|
-
return
|
|
1131
|
+
const v = t.pages[m];
|
|
1132
|
+
return v && { id: m, slug: v.slug };
|
|
1132
1133
|
})
|
|
1133
1134
|
),
|
|
1134
1135
|
components: U(
|
|
1135
1136
|
a.map((m) => {
|
|
1136
|
-
var
|
|
1137
|
-
const
|
|
1138
|
-
return
|
|
1137
|
+
var C;
|
|
1138
|
+
const v = (C = t.components[m]) == null ? void 0 : C.data;
|
|
1139
|
+
return v && {
|
|
1139
1140
|
id: m,
|
|
1140
|
-
name:
|
|
1141
|
+
name: v.name
|
|
1141
1142
|
};
|
|
1142
1143
|
})
|
|
1143
1144
|
),
|
|
@@ -1145,10 +1146,10 @@ async function ks(t, {
|
|
|
1145
1146
|
resources: {
|
|
1146
1147
|
components: U(
|
|
1147
1148
|
Object.keys(((D = t.resources) == null ? void 0 : D.components) || {}).filter((m) => a.includes(m)).map((m) => {
|
|
1148
|
-
var
|
|
1149
|
+
var v, C, $, _;
|
|
1149
1150
|
return {
|
|
1150
1151
|
id: m,
|
|
1151
|
-
name: (_ = ($ = (
|
|
1152
|
+
name: (_ = ($ = (C = (v = t.resources) == null ? void 0 : v.components) == null ? void 0 : C[m]) == null ? void 0 : $.component) == null ? void 0 : _.name
|
|
1152
1153
|
};
|
|
1153
1154
|
})
|
|
1154
1155
|
)
|
|
@@ -1160,19 +1161,19 @@ async function ks(t, {
|
|
|
1160
1161
|
le(h, Z.stringify(A));
|
|
1161
1162
|
const j = E(u, "config.source.json");
|
|
1162
1163
|
if (n && le(j, JSON.stringify(n)), r) {
|
|
1163
|
-
const m = E(u, "resources"),
|
|
1164
|
-
B(
|
|
1164
|
+
const m = E(u, "resources"), v = E(m, "components");
|
|
1165
|
+
B(v, { recursive: !0 });
|
|
1165
1166
|
for (const _ of Object.keys(((g = t == null ? void 0 : t.resources) == null ? void 0 : g.components) ?? {}).filter(
|
|
1166
1167
|
(L) => a.includes(L)
|
|
1167
1168
|
)) {
|
|
1168
1169
|
const L = (I = (w = (S = t.resources) == null ? void 0 : S.components) == null ? void 0 : w[_]) == null ? void 0 : I.component;
|
|
1169
|
-
L && await Ie(L,
|
|
1170
|
+
L && await Ie(L, v, {
|
|
1170
1171
|
getFilename: (K) => `${K.name || "unnamed"}.${K.id}.yml`,
|
|
1171
1172
|
exportAssets: o
|
|
1172
1173
|
});
|
|
1173
1174
|
}
|
|
1174
|
-
const
|
|
1175
|
-
B(
|
|
1175
|
+
const C = E(u, "chunks");
|
|
1176
|
+
B(C, { recursive: !0 });
|
|
1176
1177
|
const { chunks: $ } = await De();
|
|
1177
1178
|
for (const _ of Object.keys(((J = t == null ? void 0 : t.resources) == null ? void 0 : J.components) ?? {}).filter(
|
|
1178
1179
|
(L) => a.includes(L)
|
|
@@ -1182,7 +1183,7 @@ async function ks(t, {
|
|
|
1182
1183
|
const K = ((Q = L.renderer) == null ? void 0 : Q.chunks) ?? [];
|
|
1183
1184
|
if ((K == null ? void 0 : K.length) > 0)
|
|
1184
1185
|
for (const ye of K) {
|
|
1185
|
-
const Ne = E(
|
|
1186
|
+
const Ne = E(C, ye), Se = $ == null ? void 0 : $[ye];
|
|
1186
1187
|
try {
|
|
1187
1188
|
Se && V(Se) && !V(Ne) && Nt(Se, Ne);
|
|
1188
1189
|
} catch (lt) {
|
|
@@ -1256,7 +1257,7 @@ async function rt(t, { importAssets: o, includeResources: e } = {}) {
|
|
|
1256
1257
|
updatedAt: w.updatedAt,
|
|
1257
1258
|
publishedAt: w.publishedAt,
|
|
1258
1259
|
isPublic: w.isPublic ?? !0,
|
|
1259
|
-
|
|
1260
|
+
templateConfig: w.templateConfig,
|
|
1260
1261
|
slug: g,
|
|
1261
1262
|
sections: Object.fromEntries(I.map((O) => [O.id, O])),
|
|
1262
1263
|
sectionIds: I.map((O) => O.id),
|
|
@@ -1270,7 +1271,7 @@ async function rt(t, { importAssets: o, includeResources: e } = {}) {
|
|
|
1270
1271
|
};
|
|
1271
1272
|
try {
|
|
1272
1273
|
g("wait image-bin api ready"), await Yt({
|
|
1273
|
-
resources: [`${
|
|
1274
|
+
resources: [`${Pt(ns)}/api/sdk/uploads`],
|
|
1274
1275
|
validateStatus: (I) => I >= 200 && I <= 500
|
|
1275
1276
|
}), g("image-bin api is ready");
|
|
1276
1277
|
const S = {}, w = {};
|
|
@@ -1283,7 +1284,7 @@ async function rt(t, { importAssets: o, includeResources: e } = {}) {
|
|
|
1283
1284
|
}),
|
|
1284
1285
|
Ke(A, w, {
|
|
1285
1286
|
getFilePath: (I, J) => {
|
|
1286
|
-
const O =
|
|
1287
|
+
const O = Pe(A, J.slice(0, 1));
|
|
1287
1288
|
return c && E(c, R(O.slug), I);
|
|
1288
1289
|
},
|
|
1289
1290
|
onFinish: (I) => {
|
|
@@ -1472,8 +1473,8 @@ function Ds(t) {
|
|
|
1472
1473
|
// 3s
|
|
1473
1474
|
{ leading: !1, trailing: !0 }
|
|
1474
1475
|
);
|
|
1475
|
-
return o(), y.events.on(y.Events.componentAdded, o), y.events.on(y.Events.componentRemoved, o), y.events.on(y.Events.componentStarted, o), y.events.on(y.Events.componentStopped, o), y.events.on(y.Events.componentUpdated, o), y.events.on(
|
|
1476
|
-
y.events.off(y.Events.componentAdded, o), y.events.off(y.Events.componentRemoved, o), y.events.off(y.Events.componentStarted, o), y.events.off(y.Events.componentStopped, o), y.events.off(y.Events.componentUpdated, o), y.events.off(
|
|
1476
|
+
return o(), y.events.on(y.Events.componentAdded, o), y.events.on(y.Events.componentRemoved, o), y.events.on(y.Events.componentStarted, o), y.events.on(y.Events.componentStopped, o), y.events.on(y.Events.componentUpdated, o), y.events.on(ve, o), () => {
|
|
1477
|
+
y.events.off(y.Events.componentAdded, o), y.events.off(y.Events.componentRemoved, o), y.events.off(y.Events.componentStarted, o), y.events.off(y.Events.componentStopped, o), y.events.off(y.Events.componentUpdated, o), y.events.off(ve, o);
|
|
1477
1478
|
};
|
|
1478
1479
|
}
|
|
1479
1480
|
const ct = Symbol.for("GLOBAL_RESOURCE_STATES_LISTENER_KEY"), ce = globalThis;
|
|
@@ -1510,8 +1511,8 @@ ce[ct] = Ds(async ({ pages: t, components: o }) => {
|
|
|
1510
1511
|
b.error("update resource states failed:", s);
|
|
1511
1512
|
});
|
|
1512
1513
|
});
|
|
1513
|
-
async function
|
|
1514
|
-
b.info("trigger reload all project resource"), y.events.emit(
|
|
1514
|
+
async function Po() {
|
|
1515
|
+
b.info("trigger reload all project resource"), y.events.emit(ve);
|
|
1515
1516
|
}
|
|
1516
1517
|
async function De({
|
|
1517
1518
|
ensureLoaded: t = !0
|
|
@@ -1534,16 +1535,16 @@ export {
|
|
|
1534
1535
|
gs as h,
|
|
1535
1536
|
bo as i,
|
|
1536
1537
|
pe as j,
|
|
1537
|
-
|
|
1538
|
+
vo as k,
|
|
1538
1539
|
b as l,
|
|
1539
1540
|
ws as m,
|
|
1540
1541
|
Ve as n,
|
|
1541
1542
|
re as o,
|
|
1542
|
-
|
|
1543
|
+
Co as p,
|
|
1543
1544
|
Ao as q,
|
|
1544
1545
|
rt as r,
|
|
1545
1546
|
ze as s,
|
|
1546
1547
|
ks as t,
|
|
1547
1548
|
Ds as u,
|
|
1548
|
-
|
|
1549
|
+
Po as v
|
|
1549
1550
|
};
|