@blocklet/pages-kit-inner-components 0.4.132 → 0.4.134
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/package.json +24 -24
- package/lib/.nojekyll +0 -0
- package/lib/cjs/add-component.js +0 -398
- package/lib/cjs/chunks/array-D-LDfLBW.js +0 -441
- package/lib/cjs/chunks/config-string-BMi-8GXv.js +0 -1
- package/lib/cjs/chunks/draft-data-C-aBMmuZ.js +0 -1
- package/lib/cjs/chunks/home-BWklFLCu.js +0 -38
- package/lib/cjs/chunks/publish-button-kozBI0aZ.js +0 -1
- package/lib/cjs/chunks/site-state-C8qhC6pw.js +0 -57
- package/lib/cjs/chunks/state-DPSTH2vo.js +0 -1
- package/lib/cjs/chunks-map.json +0 -1
- package/lib/cjs/components.js +0 -1
- package/lib/cjs/home.js +0 -1
- package/lib/cjs/locales.js +0 -1
- package/lib/cjs/project-html.js +0 -23
- package/lib/cjs/resources.js +0 -1
- package/lib/cjs/setting.js +0 -11
- package/lib/cjs/site-state.js +0 -1
- package/lib/cjs/theme.js +0 -239
- package/lib/cjs/uploader.js +0 -1
- package/lib/es/add-component.js +0 -3017
- package/lib/es/chunks/array-BfSgATE1.js +0 -1971
- package/lib/es/chunks/config-string-BObBTkZS.js +0 -88
- package/lib/es/chunks/draft-data-PScFOAJJ.js +0 -13
- package/lib/es/chunks/home-qQe9H8C9.js +0 -527
- package/lib/es/chunks/publish-button-DMQRXAVS.js +0 -455
- package/lib/es/chunks/site-state-qF6lXjrQ.js +0 -1833
- package/lib/es/chunks/state-DGyH1TW3.js +0 -456
- package/lib/es/chunks-map.json +0 -1
- package/lib/es/components.js +0 -22
- package/lib/es/home.js +0 -34
- package/lib/es/locales.js +0 -972
- package/lib/es/project-html.js +0 -220
- package/lib/es/resources.js +0 -168
- package/lib/es/setting.js +0 -1728
- package/lib/es/site-state.js +0 -47
- package/lib/es/theme.js +0 -769
- package/lib/es/uploader.js +0 -8
package/lib/es/project-html.js
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import N from "@arcblock/did-auth-storage-nedb";
|
|
2
|
-
import s, { getBlockletJs as J } from "@blocklet/sdk/lib/config";
|
|
3
|
-
import G from "@blocklet/sdk/lib/service/auth";
|
|
4
|
-
import K from "@blocklet/sdk/lib/wallet";
|
|
5
|
-
import z from "@blocklet/sdk/lib/wallet-authenticator";
|
|
6
|
-
import Q from "@blocklet/sdk/lib/wallet-handler";
|
|
7
|
-
import V, { resolve as x } from "path";
|
|
8
|
-
import { l as I, g as X } from "./chunks/site-state-qF6lXjrQ.js";
|
|
9
|
-
import { initCronCrawlBlocklet as Y, cancelCronCrawlBlocklet as Z, initSEOMiddleware as q } from "@blocklet/crawler/middlewares";
|
|
10
|
-
import { PreloadComponentScriptModule as F } from "@blocklet/pages-kit/types";
|
|
11
|
-
import { isMuiColorKey as ee } from "@blocklet/pages-kit/utils/common";
|
|
12
|
-
import { injectPreloadComponents as te } from "@blocklet/pages-kit/utils/preload";
|
|
13
|
-
import { getComponentMountPoint as oe } from "@blocklet/sdk/lib/component";
|
|
14
|
-
import * as L from "cheerio/slim";
|
|
15
|
-
import { Router as re } from "express";
|
|
16
|
-
import { readFileSync as M } from "fs";
|
|
17
|
-
import ne from "lodash/get";
|
|
18
|
-
import le from "mustache";
|
|
19
|
-
import { withQuery as ie, joinURL as W } from "ufo";
|
|
20
|
-
const ce = (o = {}) => {
|
|
21
|
-
const t = {
|
|
22
|
-
data: /* @__PURE__ */ new Map(),
|
|
23
|
-
timers: /* @__PURE__ */ new Map(),
|
|
24
|
-
set: (e, d, w = o.ttl || 36e5) => {
|
|
25
|
-
o.max && t.data.size >= o.max && t.delete(t.data.keys().next().value), t.timers.has(e) && clearTimeout(t.timers.get(e)), t.timers.set(
|
|
26
|
-
e,
|
|
27
|
-
setTimeout(() => t.delete(e), w)
|
|
28
|
-
), t.data.set(e, d);
|
|
29
|
-
},
|
|
30
|
-
get: (e) => t.data.get(e),
|
|
31
|
-
has: (e) => t.data.has(e),
|
|
32
|
-
delete: (e) => (t.timers.has(e) && clearTimeout(t.timers.get(e)), t.timers.delete(e), t.data.delete(e)),
|
|
33
|
-
clear: () => {
|
|
34
|
-
t.data.clear();
|
|
35
|
-
for (const e of t.timers.values())
|
|
36
|
-
clearTimeout(e);
|
|
37
|
-
t.timers.clear();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return t;
|
|
41
|
-
}, j = ce({
|
|
42
|
-
max: 1,
|
|
43
|
-
ttl: 1e3 * 30
|
|
44
|
-
// 30 seconds
|
|
45
|
-
});
|
|
46
|
-
K();
|
|
47
|
-
const se = new z();
|
|
48
|
-
new Q({
|
|
49
|
-
authenticator: se,
|
|
50
|
-
tokenStorage: new N({
|
|
51
|
-
dbPath: V.join(s.env.dataDir, "auth.db")
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
const ae = new G(), me = async () => {
|
|
55
|
-
try {
|
|
56
|
-
const o = j.get("blockletInfo");
|
|
57
|
-
if (o)
|
|
58
|
-
return o;
|
|
59
|
-
const { blocklet: t } = await ae.getBlocklet();
|
|
60
|
-
return j.set("blockletInfo", t), t;
|
|
61
|
-
} catch {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}, pe = ["/assets/"], B = () => [!0, "true"].includes(s.env.preferences.allowCrawler);
|
|
65
|
-
function U() {
|
|
66
|
-
B() ? Y({
|
|
67
|
-
time: "0 0 */12 * * *",
|
|
68
|
-
options: {}
|
|
69
|
-
}) : Z();
|
|
70
|
-
}
|
|
71
|
-
U();
|
|
72
|
-
s.events.on(s.Events.envUpdate, U);
|
|
73
|
-
function Le({
|
|
74
|
-
app: o,
|
|
75
|
-
viteDevServer: t,
|
|
76
|
-
// projectId,
|
|
77
|
-
state: e
|
|
78
|
-
}) {
|
|
79
|
-
let d;
|
|
80
|
-
if (t) {
|
|
81
|
-
const r = M(x(process.cwd(), "./index.html"), "utf-8");
|
|
82
|
-
o.use(async (C, y, T) => {
|
|
83
|
-
const _ = C.originalUrl;
|
|
84
|
-
d = await t.transformIndexHtml(_, r), T();
|
|
85
|
-
});
|
|
86
|
-
} else
|
|
87
|
-
d = M(x(process.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
|
|
88
|
-
const w = re();
|
|
89
|
-
w.use(
|
|
90
|
-
(r, C, y) => {
|
|
91
|
-
if (r.headers["x-unique-record"] === "dial_http") {
|
|
92
|
-
I.info("[html] dial http request, return 200 status code"), C.status(200).send("ok");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
y();
|
|
96
|
-
},
|
|
97
|
-
q({
|
|
98
|
-
autoReturnHtml: !0,
|
|
99
|
-
allowCrawler: B
|
|
100
|
-
})
|
|
101
|
-
), w.get("/:path(*)?", async (r, C, y) => {
|
|
102
|
-
var $, P, A;
|
|
103
|
-
if (pe.some((i) => {
|
|
104
|
-
var m;
|
|
105
|
-
return (m = r.path) == null ? void 0 : m.startsWith(i);
|
|
106
|
-
})) {
|
|
107
|
-
y();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const T = performance.now(), _ = () => Math.round(performance.now() - T), D = "production";
|
|
111
|
-
let l, u, k = d;
|
|
112
|
-
if (r.path.startsWith("/pages")) {
|
|
113
|
-
const i = r.params.lang, m = r.cookies.nf_lang, b = /* @__PURE__ */ new Set([...s.env.languages.map((g) => g.code)]);
|
|
114
|
-
let f = (i && b.has(i) ? i : void 0) || (b.has(m) ? m : void 0) || [...b][0];
|
|
115
|
-
if ((!f || !(($ = e.supportedLocales) != null && $.find((g) => g.locale === f))) && (f = ((A = (P = e.supportedLocales) == null ? void 0 : P[0]) == null ? void 0 : A.locale) || ""), f) {
|
|
116
|
-
const g = [];
|
|
117
|
-
Object.values(e.pages).forEach((c) => {
|
|
118
|
-
const R = Object.values((c == null ? void 0 : c.sections) ?? {}).filter(
|
|
119
|
-
(p) => {
|
|
120
|
-
var v;
|
|
121
|
-
return p.component === "custom-component" && ((v = p.config) == null ? void 0 : v.componentId);
|
|
122
|
-
}
|
|
123
|
-
).map((p) => {
|
|
124
|
-
var v, E;
|
|
125
|
-
return {
|
|
126
|
-
id: p.id,
|
|
127
|
-
componentId: p.config.componentId,
|
|
128
|
-
useCache: p.config.useCache,
|
|
129
|
-
cacheDuration: p.config.cacheDuration,
|
|
130
|
-
properties: (E = (v = p.locales) == null ? void 0 : v[f]) == null ? void 0 : E.properties
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
g.push(...R);
|
|
134
|
-
});
|
|
135
|
-
const O = new Promise((c) => {
|
|
136
|
-
setTimeout(() => {
|
|
137
|
-
c({});
|
|
138
|
-
}, 90 * 1e3);
|
|
139
|
-
});
|
|
140
|
-
try {
|
|
141
|
-
await Promise.race([
|
|
142
|
-
O,
|
|
143
|
-
X({
|
|
144
|
-
mode: D,
|
|
145
|
-
req: r,
|
|
146
|
-
state: e,
|
|
147
|
-
locale: f,
|
|
148
|
-
instances: g,
|
|
149
|
-
module: F.UMD_FN
|
|
150
|
-
}).then((c) => {
|
|
151
|
-
c && (u = te(c));
|
|
152
|
-
})
|
|
153
|
-
]);
|
|
154
|
-
} catch (c) {
|
|
155
|
-
I.warn("getPreloadComponents timeout in promise race, skip inject html elements", c);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
const i = (l == null ? void 0 : l.title) || s.env.appName, m = (l == null ? void 0 : l.description) || s.env.appDescription, b = ie(W(s.env.appUrl, "/.well-known/service/blocklet/og.png"), {
|
|
161
|
-
title: i,
|
|
162
|
-
description: m
|
|
163
|
-
});
|
|
164
|
-
k = le.render(d, {
|
|
165
|
-
ogTitle: i,
|
|
166
|
-
ogDescription: m,
|
|
167
|
-
ogImage: de(l == null ? void 0 : l.image) || b,
|
|
168
|
-
pagesPublishedAt: (e == null ? void 0 : e.config.publishedAt) || (/* @__PURE__ */ new Date()).getTime()
|
|
169
|
-
});
|
|
170
|
-
} catch {
|
|
171
|
-
}
|
|
172
|
-
const n = e == null ? void 0 : e.config.fontFamily, H = r.query.mode === "draft" || r.url.includes("preview"), h = L.load(k);
|
|
173
|
-
let a = l == null ? void 0 : l.backgroundColor;
|
|
174
|
-
if (a && ee(a)) {
|
|
175
|
-
const i = await me();
|
|
176
|
-
a = ne(
|
|
177
|
-
i,
|
|
178
|
-
// 目前 dark 和 light 还是前端行为,后端通过 从 light 中获取
|
|
179
|
-
`settings.theme.light.palette.${a}`,
|
|
180
|
-
a
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
h("head").find("#injected-head-elements").replaceWith(`
|
|
184
|
-
${a ? `<meta name="theme-color" content="${a}" /><style>html,body,#app {background-color: ${a};}</style>` : ""}
|
|
185
|
-
${n != null && n.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${n.title}&display=swap">` : ""}
|
|
186
|
-
${n != null && n.description && (n == null ? void 0 : n.description) !== (n == null ? void 0 : n.title) ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${n.description}&display=swap">` : ""}
|
|
187
|
-
<script>
|
|
188
|
-
|
|
189
|
-
window.__PAGE_STATE__ = ${JSON.stringify(e, null, 0)}
|
|
190
|
-
|
|
191
|
-
document.querySelectorAll('link[rel="preload"][as="style"]').forEach(function (link) {
|
|
192
|
-
const l = document.createElement('link');
|
|
193
|
-
l.rel = 'stylesheet';
|
|
194
|
-
l.href = link.href;
|
|
195
|
-
document.head.appendChild(l);
|
|
196
|
-
});
|
|
197
|
-
<\/script>
|
|
198
|
-
|
|
199
|
-
${H ? `<script src="https://cdn.tailwindcss.com"><\/script>
|
|
200
|
-
<script>
|
|
201
|
-
window.tailwind.config = {
|
|
202
|
-
darkMode: "class",
|
|
203
|
-
};
|
|
204
|
-
<\/script>` : ""}
|
|
205
|
-
`);
|
|
206
|
-
const S = J();
|
|
207
|
-
if (S && h('script[src="__blocklet__.js"]').replaceWith(`<script>${S}<\/script>`), u != null && u.html && h("head").find("#injected-html-elements").replaceWith(u.html), r.cachedHtml) {
|
|
208
|
-
const i = L.load(r.cachedHtml);
|
|
209
|
-
h("body").html(i("body").html() || "");
|
|
210
|
-
}
|
|
211
|
-
k = h.html(), C.send(k), I.info(`[html] render: ${r.path}, ${_()}ms`), h.root().children().remove(), k = null, l = null, u = null;
|
|
212
|
-
}), o.use(w);
|
|
213
|
-
}
|
|
214
|
-
function de(o) {
|
|
215
|
-
const t = oe("image-bin");
|
|
216
|
-
return t && o && !/^(https?:\/\/|\/)/.test(o) ? s.env.appUrl + W(t, "uploads", o) : o;
|
|
217
|
-
}
|
|
218
|
-
export {
|
|
219
|
-
Le as default
|
|
220
|
-
};
|
package/lib/es/resources.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { P as S, i as b, a as M, l as x, C as J, R as X, S as N, t as W, b as G } from "./chunks/site-state-qF6lXjrQ.js";
|
|
2
|
-
import { AsyncLocalStorage as K } from "async_hooks";
|
|
3
|
-
import { Router as Y } from "express";
|
|
4
|
-
import d from "fs";
|
|
5
|
-
import g from "joi";
|
|
6
|
-
import _ from "lodash/groupBy";
|
|
7
|
-
import $ from "lodash/sortBy";
|
|
8
|
-
import C, { join as z } from "path";
|
|
9
|
-
import D from "@blocklet/sdk/lib/middlewares/auth";
|
|
10
|
-
import { getResourceExportDir as H } from "@blocklet/sdk/lib/component";
|
|
11
|
-
new K();
|
|
12
|
-
const Q = async (e, t, o) => {
|
|
13
|
-
var n, s, r, i;
|
|
14
|
-
try {
|
|
15
|
-
const { projectId: a } = e.params;
|
|
16
|
-
if (!a)
|
|
17
|
-
return o();
|
|
18
|
-
const m = await S.findByPk(a);
|
|
19
|
-
if (!m)
|
|
20
|
-
return t == null ? void 0 : t.status(404).json({ error: "Project not found" });
|
|
21
|
-
const y = (n = e.user) == null ? void 0 : n.did, w = ((s = e.user) == null ? void 0 : s.role) || "UNKNOWN_ROLE";
|
|
22
|
-
if (!y)
|
|
23
|
-
return t == null ? void 0 : t.status(401).json({ error: "Authentication required" });
|
|
24
|
-
if (b()) {
|
|
25
|
-
const P = m.createdBy === y, c = (i = (r = M()) == null ? void 0 : r.includes) == null ? void 0 : i.call(r, w);
|
|
26
|
-
if (!P && !c)
|
|
27
|
-
return t == null ? void 0 : t.status(403).json({ error: "No permission to access this project in multi-tenant mode" });
|
|
28
|
-
} else if (!["owner", "admin", "pagesEditor"].includes(w))
|
|
29
|
-
return t == null ? void 0 : t.status(403).json({ error: "No permission to access this project in single-tenant mode" });
|
|
30
|
-
e.project = m, e.projectId = a, o();
|
|
31
|
-
} catch (a) {
|
|
32
|
-
x.error("Project middleware error:", a), t == null || t.status(500).json({ error: "Internal server error" });
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
function T(e, t) {
|
|
36
|
-
return new Promise((o, n) => {
|
|
37
|
-
const s = d.createReadStream(e), r = d.createWriteStream(t);
|
|
38
|
-
s.on("error", n), r.on("error", n), r.on("finish", o), s.pipe(r);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async function B(e, t) {
|
|
42
|
-
await d.promises.mkdir(t, { recursive: !0 });
|
|
43
|
-
const o = await d.promises.readdir(e, { withFileTypes: !0 });
|
|
44
|
-
for (const n of o) {
|
|
45
|
-
const s = C.join(e, n.name), r = C.join(t, n.name);
|
|
46
|
-
n.isDirectory() ? await B(s, r) : await T(s, r);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async function V(e, t) {
|
|
50
|
-
(await d.promises.stat(e)).isDirectory() ? await B(e, t) : await T(e, t);
|
|
51
|
-
}
|
|
52
|
-
const h = (e, t, o) => b() ? D()(e, t, o) : D({ roles: ["owner", "admin", "pagesEditor"] })(e, t, o), Z = (e, t) => {
|
|
53
|
-
const o = H({ projectId: e, releaseId: t });
|
|
54
|
-
return z(o, J, X);
|
|
55
|
-
}, O = Y(), L = "@page", U = "@component", I = ":", E = "ALL", F = "@project", k = ({ pageId: e, projectId: t }) => [L, t, e].join(I), q = (e) => {
|
|
56
|
-
const [t, o, n] = e.split(I);
|
|
57
|
-
if (t === L) return { pageId: n, projectId: o };
|
|
58
|
-
}, v = ({ componentId: e, projectId: t }) => [U, t, e].join(I), tt = (e) => {
|
|
59
|
-
const [t, o, n] = e.split(I);
|
|
60
|
-
if (t === U) return { componentId: n, projectId: o };
|
|
61
|
-
}, et = (e) => [F, e].join(I), ot = (e) => {
|
|
62
|
-
const [t, o] = e.split(I);
|
|
63
|
-
if (t === F) return o;
|
|
64
|
-
}, rt = (e) => {
|
|
65
|
-
try {
|
|
66
|
-
return JSON.parse(e);
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
|
-
return {};
|
|
70
|
-
};
|
|
71
|
-
async function A(e) {
|
|
72
|
-
const t = await N.shared(e).getState("production"), o = await S.findByPk(e), n = t.pageIds.map((r) => {
|
|
73
|
-
const i = t.pages[r];
|
|
74
|
-
if (i)
|
|
75
|
-
return { id: k({ pageId: r, projectId: e }), name: i.slug };
|
|
76
|
-
}).filter(Boolean), s = $(Object.values(t.components), (r) => r.index).map(({ data: r }) => ({
|
|
77
|
-
id: v({ componentId: r.id, projectId: e }),
|
|
78
|
-
name: r.name || r.id
|
|
79
|
-
}));
|
|
80
|
-
return {
|
|
81
|
-
id: et(e),
|
|
82
|
-
name: (o == null ? void 0 : o.name) || "Unnamed Project",
|
|
83
|
-
children: [
|
|
84
|
-
{ id: k({ pageId: E, projectId: e }), name: "Pages", children: n },
|
|
85
|
-
{
|
|
86
|
-
id: v({ componentId: E, projectId: e }),
|
|
87
|
-
name: "Components",
|
|
88
|
-
children: s
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
O.get("/resources", h, async (e, t) => {
|
|
94
|
-
const { projectId: o } = rt(e.query.resourcesParams);
|
|
95
|
-
if (o) {
|
|
96
|
-
e.params = { ...e.params, projectId: o }, await Q(e, t, () => {
|
|
97
|
-
});
|
|
98
|
-
const r = await A(o);
|
|
99
|
-
t.json({ resources: [r] });
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const n = await S.findAll({
|
|
103
|
-
where: {
|
|
104
|
-
// Add your permission check conditions here
|
|
105
|
-
// For example: userId: req.user.id
|
|
106
|
-
}
|
|
107
|
-
}), s = await Promise.all(n.map((r) => A(r.id)));
|
|
108
|
-
t.json({ resources: s });
|
|
109
|
-
});
|
|
110
|
-
const nt = g.object({
|
|
111
|
-
projectId: g.string().required().min(1),
|
|
112
|
-
releaseId: g.string().allow(""),
|
|
113
|
-
resources: g.array().items(g.string()).required(),
|
|
114
|
-
locale: g.string().allow("")
|
|
115
|
-
});
|
|
116
|
-
O.post("/resources", h, async (e, t) => {
|
|
117
|
-
const { resources: o, projectId: n, releaseId: s } = await nt.validateAsync(e.body), r = "production", i = [], a = [];
|
|
118
|
-
for (const c of o) {
|
|
119
|
-
if (ot(c))
|
|
120
|
-
continue;
|
|
121
|
-
const { pageId: l, projectId: f } = q(c) || {};
|
|
122
|
-
if (l)
|
|
123
|
-
l === E || l && f && i.push({
|
|
124
|
-
pageId: l,
|
|
125
|
-
projectId: f
|
|
126
|
-
});
|
|
127
|
-
else {
|
|
128
|
-
const { componentId: u, projectId: p } = tt(c) || {};
|
|
129
|
-
u === E || u && p && a.push({
|
|
130
|
-
componentId: u,
|
|
131
|
-
projectId: p
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const m = _(i, "projectId"), y = _(a, "projectId"), w = /* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(y)]), P = Z(n, s);
|
|
136
|
-
d.rmSync(P, { recursive: !0, force: !0 }), d.mkdirSync(P, { recursive: !0 });
|
|
137
|
-
for (const c of w) {
|
|
138
|
-
const l = await N.shared(c).getState(r), f = m[c], u = y[c], p = f == null ? void 0 : f.map((j) => j.pageId), R = u == null ? void 0 : u.map((j) => j.componentId);
|
|
139
|
-
if (p != null && p.length || R != null && R.length) {
|
|
140
|
-
const j = await W(l, {
|
|
141
|
-
exportAssets: !0,
|
|
142
|
-
pageIds: p,
|
|
143
|
-
componentIds: R
|
|
144
|
-
});
|
|
145
|
-
await V(j, P), d.rmSync(j, { recursive: !0, force: !0 });
|
|
146
|
-
}
|
|
147
|
-
x.info(`Exported resources for project ${c}`, {
|
|
148
|
-
pageIds: p,
|
|
149
|
-
componentIds: R
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
t.json({});
|
|
153
|
-
});
|
|
154
|
-
O.get("/all-resources", h, async (e, t) => {
|
|
155
|
-
const { states: o } = await G(), n = o == null ? void 0 : o.map((s) => {
|
|
156
|
-
const r = {
|
|
157
|
-
blockletId: s.blockletId,
|
|
158
|
-
blockletTitle: s.blockletTitle,
|
|
159
|
-
components: {}
|
|
160
|
-
};
|
|
161
|
-
if (s.state.components && (r.components = s.state.components), Object.keys(r.components).length !== 0)
|
|
162
|
-
return r;
|
|
163
|
-
}).filter(Boolean);
|
|
164
|
-
t.json(n);
|
|
165
|
-
});
|
|
166
|
-
export {
|
|
167
|
-
O as default
|
|
168
|
-
};
|