@blocklet/pages-kit-inner-components 0.4.155 → 0.4.157
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-Cio9RMaq.js → site-state-Bd3-qe58.js} +5 -5
- 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-BjimJvYN.js → site-state-Ct-Mnf1U.js} +418 -408
- 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
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var St = Object.defineProperty;
|
|
2
|
-
var wt = (
|
|
3
|
-
var j = (
|
|
2
|
+
var wt = (e, s, t) => s in e ? St(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
3
|
+
var j = (e, s, t) => wt(e, typeof s != "symbol" ? s + "" : s, t);
|
|
4
4
|
import { getComponentMountPoint as bt } from "@blocklet/pages-kit/builtin/utils";
|
|
5
|
-
import { PreloadComponentScriptModule as
|
|
6
|
-
import { componentUMDName as It, RenderNestedComponent as
|
|
7
|
-
import { memoize as
|
|
5
|
+
import { PreloadComponentScriptModule as ge } from "@blocklet/pages-kit/types";
|
|
6
|
+
import { componentUMDName as It, RenderNestedComponent as Je, mergeComponent as Et, getComponentDependencies as At } from "@blocklet/pages-kit/utils/property";
|
|
7
|
+
import { memoize as Oe, Sandbox as ot, BuiltinModules as Ot } from "@blocklet/quickjs";
|
|
8
8
|
import I from "@blocklet/sdk/lib/config";
|
|
9
9
|
import { LRUCache as Re } from "lru-cache";
|
|
10
10
|
import Tt, { Headers as vt } from "node-fetch";
|
|
11
|
-
import { joinURL as K, getQuery as Pt, withQuery as Ct, parseURL as
|
|
12
|
-
import { createHash as
|
|
11
|
+
import { joinURL as K, getQuery as Pt, withQuery as Ct, parseURL as Ve, withHttps as Dt } from "ufo";
|
|
12
|
+
import { createHash as te } from "crypto";
|
|
13
13
|
import xt from "@blocklet/logger";
|
|
14
14
|
import { BuiltinModules as jt } from "@blocklet/pages-kit/utils/builtin";
|
|
15
15
|
import { createBuiltinModuleTransformer as kt, isRelativeModule as Nt } from "@blocklet/pages-kit/utils/typescript/builtin-module-transformer";
|
|
16
16
|
import { getResources as Lt, getComponentWebEndpoint as Rt, call as _t } from "@blocklet/sdk/lib/component";
|
|
17
17
|
import Mt from "autoprefixer";
|
|
18
18
|
import * as Ut from "esbuild";
|
|
19
|
-
import { readFileSync as X, mkdtempSync as $t, existsSync as F, lstatSync as Q, readdirSync as Ft, rmSync as rt, renameSync as Ke, mkdirSync as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import { readFileSync as X, mkdtempSync as $t, existsSync as F, lstatSync as Q, readdirSync as Ft, rmSync as rt, renameSync as Ke, mkdirSync as H, writeFileSync as ye, copyFileSync as Bt, createWriteStream as Gt } from "fs";
|
|
20
|
+
import Ht from "postcss";
|
|
21
|
+
import Jt from "tailwindcss";
|
|
22
22
|
import L from "typescript";
|
|
23
|
-
import { getYjsValue as
|
|
23
|
+
import { getYjsValue as se, syncedStore as Vt } from "@syncedstore/core";
|
|
24
24
|
import * as B from "yjs";
|
|
25
|
-
import Kt, { join as O, dirname as _, basename as
|
|
25
|
+
import Kt, { join as O, dirname as _, basename as ne } from "path";
|
|
26
26
|
import { setPageDataSource as zt } from "@blocklet/pages-kit/utils/data-source";
|
|
27
27
|
import { getRouteMetaDataByOptionIds as Yt, generateParamCombinations as _e } from "@blocklet/pages-kit/utils/route";
|
|
28
28
|
import { cloneDeep as Wt } from "lodash";
|
|
@@ -57,11 +57,11 @@ I.env.PAGE_CONTENT_ADDITIONAL_PROMPT || process.env.PAGE_CONTENT_ADDITIONAL_PROM
|
|
|
57
57
|
const gs = "image-bin";
|
|
58
58
|
I.env.INIT_TEMPLATE_PATH;
|
|
59
59
|
const hs = process.env.DATABASE_URL || Kt.join(I.env.dataDir, "db/pages-kit.db"), We = I, Un = () => I.env.tenantMode === "multiple", $n = () => {
|
|
60
|
-
var
|
|
61
|
-
return (us(We.env.preferences.multiTenantAllProjectAccessPassports) ? [] : (
|
|
60
|
+
var e;
|
|
61
|
+
return (us(We.env.preferences.multiTenantAllProjectAccessPassports) ? [] : (e = We.env.preferences.multiTenantAllProjectAccessPassports) == null ? void 0 : e.split(",")) || [];
|
|
62
62
|
}, b = xt("pages-kit"), ys = x.sqlite.DATE.parse;
|
|
63
|
-
x.sqlite.DATE.parse = (
|
|
64
|
-
const
|
|
63
|
+
x.sqlite.DATE.parse = (e, s) => typeof e == "number" ? new Date(e) : ys(e, s);
|
|
64
|
+
const ce = new ms({
|
|
65
65
|
dialect: "sqlite",
|
|
66
66
|
storage: hs,
|
|
67
67
|
benchmark: process.env.ENABLE_SEQUELIZE_BENCHMARK === "true",
|
|
@@ -74,9 +74,9 @@ const ie = new ms({
|
|
|
74
74
|
logging: process.env.ENABLE_SEQUELIZE_LOGGING === "true" ? console.log : !1
|
|
75
75
|
// logQueryParameters: true,
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
ce.query("pragma journal_mode = WAL;");
|
|
78
|
+
ce.query("pragma synchronous = normal;");
|
|
79
|
+
ce.query("pragma journal_size_limit = 67108864;");
|
|
80
80
|
class Te extends it {
|
|
81
81
|
// Foreign key to Component
|
|
82
82
|
}
|
|
@@ -97,7 +97,7 @@ Te.init(
|
|
|
97
97
|
allowNull: !1
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
{ sequelize:
|
|
100
|
+
{ sequelize: ce, tableName: "ProjectComponents", timestamps: !1 }
|
|
101
101
|
);
|
|
102
102
|
class q extends it {
|
|
103
103
|
static async getProjectByIdOrSlug(s) {
|
|
@@ -142,23 +142,23 @@ q.init(
|
|
|
142
142
|
get() {
|
|
143
143
|
return this.getDataValue("relatedBlocklets") || {};
|
|
144
144
|
},
|
|
145
|
-
set(
|
|
146
|
-
this.setDataValue("relatedBlocklets", JSON.stringify(
|
|
145
|
+
set(e) {
|
|
146
|
+
this.setDataValue("relatedBlocklets", JSON.stringify(e || {}));
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
|
-
{ sequelize:
|
|
150
|
+
{ sequelize: ce, paranoid: !0 }
|
|
151
151
|
);
|
|
152
152
|
q.hasMany(Te, {
|
|
153
153
|
foreignKey: "projectId",
|
|
154
154
|
as: "components"
|
|
155
155
|
});
|
|
156
|
-
const Ss = async (
|
|
157
|
-
const
|
|
156
|
+
const Ss = async (e, { componentId: s }) => {
|
|
157
|
+
const t = `@tailwind components;
|
|
158
158
|
@tailwind utilities;
|
|
159
159
|
`, n = `.CustomComponent_${s}`;
|
|
160
|
-
return (await
|
|
161
|
-
|
|
160
|
+
return (await Ht([
|
|
161
|
+
Jt({ content: [{ raw: e, extension: "tsx" }] }),
|
|
162
162
|
Mt({
|
|
163
163
|
overrideBrowserslist: ["> 1%", "last 2 versions"],
|
|
164
164
|
stats: {}
|
|
@@ -170,16 +170,16 @@ const Ss = async (t, { componentId: s }) => {
|
|
|
170
170
|
}
|
|
171
171
|
// FIXME: cssnano use browserslist, it is not working with the fs isolation
|
|
172
172
|
// cssnano({ preset: 'default' }),
|
|
173
|
-
]).process(
|
|
174
|
-
}, ws = async (
|
|
175
|
-
const
|
|
176
|
-
return `export const __PagesKit_CSS__ = ${JSON.stringify(
|
|
173
|
+
]).process(t)).css;
|
|
174
|
+
}, ws = async (e, { componentId: s }) => {
|
|
175
|
+
const t = await Ss(e, { componentId: s });
|
|
176
|
+
return `export const __PagesKit_CSS__ = ${JSON.stringify(t)};
|
|
177
177
|
|
|
178
|
-
${
|
|
178
|
+
${e}
|
|
179
179
|
`;
|
|
180
|
-
}, qe =
|
|
181
|
-
async (
|
|
182
|
-
let
|
|
180
|
+
}, qe = Oe(
|
|
181
|
+
async (e, s) => {
|
|
182
|
+
let t = L.transpileModule(e, {
|
|
183
183
|
compilerOptions: {
|
|
184
184
|
jsx: L.JsxEmit.React,
|
|
185
185
|
target: L.ScriptTarget.ES2016,
|
|
@@ -189,8 +189,8 @@ ${t}
|
|
|
189
189
|
before: [kt(L)]
|
|
190
190
|
}
|
|
191
191
|
}).outputText;
|
|
192
|
-
if (s.tailwind && (
|
|
193
|
-
const n = L.transpileModule(
|
|
192
|
+
if (s.tailwind && (t = await ws(t, { componentId: s.componentId })), s.module === ge.ESM) return t;
|
|
193
|
+
const n = L.transpileModule(t, {
|
|
194
194
|
compilerOptions: {
|
|
195
195
|
jsx: L.JsxEmit.React,
|
|
196
196
|
target: L.ScriptTarget.ES2016,
|
|
@@ -198,18 +198,18 @@ ${t}
|
|
|
198
198
|
moduleResolution: L.ModuleResolutionKind.Node16
|
|
199
199
|
}
|
|
200
200
|
}).outputText;
|
|
201
|
-
return s.module ===
|
|
201
|
+
return s.module === ge.CJS ? n : Is(s.moduleName, n);
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
keyGenerator: (
|
|
205
|
-
const
|
|
204
|
+
keyGenerator: (e, s) => {
|
|
205
|
+
const t = te("md5").update(e).digest("hex"), n = {
|
|
206
206
|
...s,
|
|
207
207
|
componentId: s.componentId,
|
|
208
208
|
module: s.module,
|
|
209
|
-
...s.module !==
|
|
209
|
+
...s.module !== ge.ESM ? { moduleName: s.moduleName } : {},
|
|
210
210
|
tailwind: s.tailwind
|
|
211
211
|
};
|
|
212
|
-
return JSON.stringify(["transpileModule",
|
|
212
|
+
return JSON.stringify(["transpileModule", t, n]);
|
|
213
213
|
},
|
|
214
214
|
lruOptions: {
|
|
215
215
|
max: 100,
|
|
@@ -218,7 +218,7 @@ ${t}
|
|
|
218
218
|
// 1小时过期时间
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
), bs = async (
|
|
221
|
+
), bs = async (e, s) => {
|
|
222
222
|
var l, c;
|
|
223
223
|
const n = (c = (l = (await Ut.build({
|
|
224
224
|
entryPoints: ["index.tsx"],
|
|
@@ -237,7 +237,7 @@ ${t}
|
|
|
237
237
|
if (u.path === "index.tsx")
|
|
238
238
|
return { contents: `export { ${s} } from './component'`, loader: "tsx" };
|
|
239
239
|
if (u.path === "component.tsx")
|
|
240
|
-
return { contents:
|
|
240
|
+
return { contents: e, loader: "tsx" };
|
|
241
241
|
if (Nt(u.path)) {
|
|
242
242
|
const h = u.path.split("/").pop();
|
|
243
243
|
if (p || (p = await Ge({ ensureLoaded: !1 })), (y = p == null ? void 0 : p.chunks) != null && y[h])
|
|
@@ -258,23 +258,23 @@ ${t}
|
|
|
258
258
|
return L.transpileModule(o, {
|
|
259
259
|
compilerOptions: { module: L.ModuleKind.ESNext, target: L.ScriptTarget.ES2020 }
|
|
260
260
|
}).outputText;
|
|
261
|
-
}, ct =
|
|
262
|
-
async (
|
|
263
|
-
const
|
|
264
|
-
return new RegExp(`export\\s+\\{\\s+${s}\\s+\\}`, "m").test(
|
|
261
|
+
}, ct = Oe(
|
|
262
|
+
async (e, s) => {
|
|
263
|
+
const t = await bs(e, s);
|
|
264
|
+
return new RegExp(`export\\s+\\{\\s+${s}\\s+\\}`, "m").test(t) ? t : void 0;
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
|
-
keyGenerator: (
|
|
268
|
-
const
|
|
269
|
-
return JSON.stringify(["extractExportValueSchema",
|
|
267
|
+
keyGenerator: (e, s) => {
|
|
268
|
+
const t = te("md5").update(e).digest("hex");
|
|
269
|
+
return JSON.stringify(["extractExportValueSchema", t, s]);
|
|
270
270
|
},
|
|
271
271
|
lruOptions: {
|
|
272
272
|
max: 100,
|
|
273
273
|
ttl: 1e3 * 60 * 60
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
), Is = (
|
|
277
|
-
var ${
|
|
276
|
+
), Is = (e, s) => `// GENERATED FILE. DO NOT EDIT.
|
|
277
|
+
var ${e} = function () {
|
|
278
278
|
|
|
279
279
|
const exports = {};
|
|
280
280
|
let moduleExports = null;
|
|
@@ -299,28 +299,28 @@ var ${t} = function () {
|
|
|
299
299
|
|
|
300
300
|
return exports;
|
|
301
301
|
};
|
|
302
|
-
`,
|
|
302
|
+
`, ae = new Re({
|
|
303
303
|
max: 100
|
|
304
304
|
}), Es = 60 * 60, Qe = 60;
|
|
305
|
-
function As(
|
|
306
|
-
b.info("clear preload components cache", { cacheKey:
|
|
305
|
+
function As(e) {
|
|
306
|
+
b.info("clear preload components cache", { cacheKey: e }), ae.delete(e);
|
|
307
307
|
}
|
|
308
|
-
function Os(
|
|
309
|
-
for (const s of
|
|
310
|
-
s.includes(
|
|
308
|
+
function Os(e) {
|
|
309
|
+
for (const s of ae.keys())
|
|
310
|
+
s.includes(e) && (b.info("clear preload components cache", { cacheKey: s }), As(s));
|
|
311
311
|
}
|
|
312
312
|
function Ts({
|
|
313
|
-
mode:
|
|
313
|
+
mode: e,
|
|
314
314
|
instanceId: s,
|
|
315
|
-
componentId:
|
|
315
|
+
componentId: t,
|
|
316
316
|
locale: n
|
|
317
317
|
}) {
|
|
318
|
-
return ["getPreloadComponents",
|
|
318
|
+
return ["getPreloadComponents", e, s, t, n].join("-");
|
|
319
319
|
}
|
|
320
320
|
async function Fn({
|
|
321
|
-
mode:
|
|
321
|
+
mode: e,
|
|
322
322
|
req: s,
|
|
323
|
-
state:
|
|
323
|
+
state: t,
|
|
324
324
|
locale: n,
|
|
325
325
|
instances: o,
|
|
326
326
|
module: r
|
|
@@ -328,24 +328,24 @@ async function Fn({
|
|
|
328
328
|
const {
|
|
329
329
|
supportedLocales: l,
|
|
330
330
|
config: { defaultLocale: c }
|
|
331
|
-
} =
|
|
331
|
+
} = t;
|
|
332
332
|
if (!c) return null;
|
|
333
333
|
const d = (await Promise.all(
|
|
334
334
|
o.map(async (a) => {
|
|
335
335
|
try {
|
|
336
336
|
const i = Ts({
|
|
337
|
-
mode:
|
|
337
|
+
mode: e,
|
|
338
338
|
instanceId: a.id,
|
|
339
339
|
componentId: a.componentId,
|
|
340
340
|
locale: n
|
|
341
341
|
});
|
|
342
|
-
if (
|
|
343
|
-
return b.info(`get preload component from cache: ${i}`),
|
|
344
|
-
const m =
|
|
342
|
+
if (e !== "draft" && a.useCache && ae.has(i))
|
|
343
|
+
return b.info(`get preload component from cache: ${i}`), ae.get(i);
|
|
344
|
+
const m = Se({ state: t, componentId: a.componentId });
|
|
345
345
|
if (!m) return null;
|
|
346
346
|
const w = await vs({
|
|
347
347
|
req: s,
|
|
348
|
-
state:
|
|
348
|
+
state: t,
|
|
349
349
|
componentId: m.id,
|
|
350
350
|
locale: n,
|
|
351
351
|
defaultLocale: c,
|
|
@@ -353,9 +353,9 @@ async function Fn({
|
|
|
353
353
|
});
|
|
354
354
|
if (!w) return null;
|
|
355
355
|
const D = { instanceId: a.id, preload: w };
|
|
356
|
-
if (
|
|
356
|
+
if (e !== "draft" && a.useCache) {
|
|
357
357
|
let A = Es;
|
|
358
|
-
a.cacheDuration && (A = a.cacheDuration), b.info(`set preload component to cache(${A}s): ${i}`),
|
|
358
|
+
a.cacheDuration && (A = a.cacheDuration), b.info(`set preload component to cache(${A}s): ${i}`), ae.set(i, D, {
|
|
359
359
|
ttl: A * 1e3
|
|
360
360
|
});
|
|
361
361
|
}
|
|
@@ -370,12 +370,12 @@ async function Fn({
|
|
|
370
370
|
async function u() {
|
|
371
371
|
const a = await Promise.all(
|
|
372
372
|
p.map(async (i) => {
|
|
373
|
-
const m = It({ componentId: i.component.id }), w = r ===
|
|
373
|
+
const m = It({ componentId: i.component.id }), w = r === ge.ESM ? {
|
|
374
374
|
module: r,
|
|
375
375
|
script: await qe(i.script, {
|
|
376
376
|
componentId: i.component.id,
|
|
377
377
|
module: r,
|
|
378
|
-
tailwind:
|
|
378
|
+
tailwind: e !== "draft"
|
|
379
379
|
})
|
|
380
380
|
} : {
|
|
381
381
|
module: r,
|
|
@@ -383,7 +383,7 @@ async function Fn({
|
|
|
383
383
|
componentId: i.component.id,
|
|
384
384
|
module: r,
|
|
385
385
|
moduleName: m,
|
|
386
|
-
tailwind:
|
|
386
|
+
tailwind: e !== "draft"
|
|
387
387
|
}),
|
|
388
388
|
moduleName: m
|
|
389
389
|
};
|
|
@@ -404,18 +404,18 @@ async function Fn({
|
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
406
|
async function vs({
|
|
407
|
-
req:
|
|
407
|
+
req: e,
|
|
408
408
|
state: s,
|
|
409
|
-
componentId:
|
|
409
|
+
componentId: t,
|
|
410
410
|
locale: n,
|
|
411
411
|
defaultLocale: o,
|
|
412
412
|
properties: r
|
|
413
413
|
}) {
|
|
414
|
-
const { supportedLocales: l } = s, c =
|
|
414
|
+
const { supportedLocales: l } = s, c = Se({ state: s, componentId: t });
|
|
415
415
|
if (!c) return null;
|
|
416
416
|
const d = l.some((u) => u.locale === n) ? n : o;
|
|
417
417
|
if (!d) return null;
|
|
418
|
-
const p = await pt({ req:
|
|
418
|
+
const p = await pt({ req: e, state: s, componentId: t, locale: d, defaultLocale: o, properties: r });
|
|
419
419
|
return p ? {
|
|
420
420
|
component: c,
|
|
421
421
|
...p
|
|
@@ -423,16 +423,16 @@ async function vs({
|
|
|
423
423
|
}
|
|
424
424
|
const Ps = 20;
|
|
425
425
|
async function pt({
|
|
426
|
-
req:
|
|
426
|
+
req: e,
|
|
427
427
|
depth: s = 0,
|
|
428
|
-
state:
|
|
428
|
+
state: t,
|
|
429
429
|
componentId: n,
|
|
430
430
|
locale: o,
|
|
431
431
|
defaultLocale: r,
|
|
432
432
|
properties: l
|
|
433
433
|
}) {
|
|
434
434
|
if (s > Ps) throw new RangeError("max component depth exceeded");
|
|
435
|
-
const c = Cs({ state:
|
|
435
|
+
const c = Cs({ state: t, componentId: n, properties: l, locale: o });
|
|
436
436
|
if (!c) return null;
|
|
437
437
|
const { props: d } = c, p = {
|
|
438
438
|
locale: o || r,
|
|
@@ -440,18 +440,18 @@ async function pt({
|
|
|
440
440
|
props: { ...d }
|
|
441
441
|
};
|
|
442
442
|
try {
|
|
443
|
-
const u = await Ds({ ...c, req:
|
|
443
|
+
const u = await Ds({ ...c, req: e });
|
|
444
444
|
u != null && u.props && Object.assign(p.props, u.props);
|
|
445
445
|
} catch (u) {
|
|
446
446
|
b.error("preload data at server side error", { componentId: n, name: c.component.name }, { error: u });
|
|
447
447
|
}
|
|
448
448
|
return await Promise.all(
|
|
449
449
|
Object.entries(d).map(async ([u, y]) => {
|
|
450
|
-
if ((y == null ? void 0 : y.type) ===
|
|
450
|
+
if ((y == null ? void 0 : y.type) === Je) {
|
|
451
451
|
const h = await pt({
|
|
452
|
-
req:
|
|
452
|
+
req: e,
|
|
453
453
|
depth: s + 1,
|
|
454
|
-
state:
|
|
454
|
+
state: t,
|
|
455
455
|
componentId: y.componentId,
|
|
456
456
|
locale: o,
|
|
457
457
|
defaultLocale: r,
|
|
@@ -459,7 +459,7 @@ async function pt({
|
|
|
459
459
|
});
|
|
460
460
|
h && (Object.assign(p.components, h.components), Object.assign(p.props, {
|
|
461
461
|
[u]: {
|
|
462
|
-
type:
|
|
462
|
+
type: Je,
|
|
463
463
|
componentId: y.componentId,
|
|
464
464
|
props: h.props
|
|
465
465
|
}
|
|
@@ -469,41 +469,41 @@ async function pt({
|
|
|
469
469
|
), p;
|
|
470
470
|
}
|
|
471
471
|
function Cs({
|
|
472
|
-
state:
|
|
472
|
+
state: e,
|
|
473
473
|
componentId: s,
|
|
474
|
-
locale:
|
|
474
|
+
locale: t,
|
|
475
475
|
properties: n
|
|
476
476
|
}) {
|
|
477
|
-
const o =
|
|
477
|
+
const o = Se({ state: e, componentId: s });
|
|
478
478
|
if (!o) return null;
|
|
479
479
|
const r = Et({
|
|
480
480
|
componentId: s,
|
|
481
|
-
getComponent: (l) =>
|
|
482
|
-
locale:
|
|
483
|
-
defaultLocale:
|
|
481
|
+
getComponent: (l) => Se({ state: e, componentId: l }),
|
|
482
|
+
locale: t,
|
|
483
|
+
defaultLocale: e.config.defaultLocale,
|
|
484
484
|
properties: n
|
|
485
485
|
});
|
|
486
|
-
return r ? { component: o, script: r.script, props: { locale:
|
|
486
|
+
return r ? { component: o, script: r.script, props: { locale: t, ...r.props } } : null;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
var
|
|
490
|
-
return ((
|
|
488
|
+
function Se({ state: e, componentId: s }) {
|
|
489
|
+
var t, n, o;
|
|
490
|
+
return ((t = e.components[s]) == null ? void 0 : t.data) ?? ((o = (n = e.resources.components) == null ? void 0 : n[s]) == null ? void 0 : o.component);
|
|
491
491
|
}
|
|
492
|
-
function Bn({ state:
|
|
492
|
+
function Bn({ state: e, name: s }) {
|
|
493
493
|
var n, o;
|
|
494
|
-
const
|
|
495
|
-
return ((n = Object.values(
|
|
494
|
+
const t = s.toLowerCase();
|
|
495
|
+
return ((n = Object.values(e.components).find((r) => {
|
|
496
496
|
var l;
|
|
497
|
-
return ((l = r.data.name) == null ? void 0 : l.toLowerCase()) ===
|
|
498
|
-
})) == null ? void 0 : n.data) ?? ((o =
|
|
497
|
+
return ((l = r.data.name) == null ? void 0 : l.toLowerCase()) === t;
|
|
498
|
+
})) == null ? void 0 : n.data) ?? ((o = e.resources.components && Object.values(e.resources.components).find((r) => {
|
|
499
499
|
var l;
|
|
500
|
-
return ((l = r.component.name) == null ? void 0 : l.toLowerCase()) ===
|
|
500
|
+
return ((l = r.component.name) == null ? void 0 : l.toLowerCase()) === t;
|
|
501
501
|
})) == null ? void 0 : o.component);
|
|
502
502
|
}
|
|
503
503
|
async function Ds({
|
|
504
|
-
component:
|
|
504
|
+
component: e,
|
|
505
505
|
script: s,
|
|
506
|
-
props:
|
|
506
|
+
props: t,
|
|
507
507
|
req: n
|
|
508
508
|
}) {
|
|
509
509
|
if (!(s != null && s.includes("getServerSideProps")))
|
|
@@ -536,7 +536,7 @@ export async function getServerSidePropsWrapper(props) {
|
|
|
536
536
|
if (originalFetch) globalThis.fetch = originalFetch;
|
|
537
537
|
}
|
|
538
538
|
}`,
|
|
539
|
-
filename: `${
|
|
539
|
+
filename: `${e.name || e.id}.js`,
|
|
540
540
|
moduleLoader: (c) => {
|
|
541
541
|
if (c === "@blocklet/pages-kit/builtin/utils")
|
|
542
542
|
return `const { joinURL, withQuery, getQuery, getComponentMountPoint } = globalThis
|
|
@@ -572,7 +572,7 @@ export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
|
572
572
|
location: { href: K(Dt(n.hostname), n.originalUrl) },
|
|
573
573
|
fetch: (c, { ...d } = {}) => {
|
|
574
574
|
const p = typeof c == "string" && c.startsWith("/") ? K(I.env.appUrl, c) : c;
|
|
575
|
-
if (typeof p == "string" &&
|
|
575
|
+
if (typeof p == "string" && Ve(p).host === Ve(I.env.appUrl).host) {
|
|
576
576
|
const u = n.get("cookie");
|
|
577
577
|
if (u) {
|
|
578
578
|
const y = new vt(d.headers);
|
|
@@ -590,17 +590,17 @@ export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
|
590
590
|
json: () => u.json()
|
|
591
591
|
}));
|
|
592
592
|
},
|
|
593
|
-
props:
|
|
593
|
+
props: t
|
|
594
594
|
}
|
|
595
595
|
]
|
|
596
596
|
})
|
|
597
597
|
]);
|
|
598
598
|
}
|
|
599
|
-
const xs =
|
|
600
|
-
async (
|
|
601
|
-
if (!(
|
|
599
|
+
const xs = Oe(
|
|
600
|
+
async (e, s, t) => {
|
|
601
|
+
if (!(e != null && e.includes(s)))
|
|
602
602
|
return null;
|
|
603
|
-
const n = await ct(
|
|
603
|
+
const n = await ct(e, s);
|
|
604
604
|
if (n)
|
|
605
605
|
try {
|
|
606
606
|
return await ot.callFunction({
|
|
@@ -611,18 +611,18 @@ const xs = Ae(
|
|
|
611
611
|
return ${s};
|
|
612
612
|
}
|
|
613
613
|
`,
|
|
614
|
-
filename: `${
|
|
614
|
+
filename: `${t}.js`,
|
|
615
615
|
functionName: `get${s}SchemaWrapper`
|
|
616
616
|
});
|
|
617
617
|
} catch (o) {
|
|
618
|
-
return b.error(`获取 ${s} 失败`, { componentId:
|
|
618
|
+
return b.error(`获取 ${s} 失败`, { componentId: t, error: o }), null;
|
|
619
619
|
}
|
|
620
620
|
return null;
|
|
621
621
|
},
|
|
622
622
|
{
|
|
623
|
-
keyGenerator: (
|
|
624
|
-
const n =
|
|
625
|
-
return JSON.stringify(["getExportSchemaValueFromCode", n, s,
|
|
623
|
+
keyGenerator: (e, s, t) => {
|
|
624
|
+
const n = te("md5").update(e).digest("hex");
|
|
625
|
+
return JSON.stringify(["getExportSchemaValueFromCode", n, s, t]);
|
|
626
626
|
},
|
|
627
627
|
lruOptions: {
|
|
628
628
|
max: 100,
|
|
@@ -630,63 +630,63 @@ const xs = Ae(
|
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
), js = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o", Xe = "page", Ne = "trigger-reload-project-resource", lt = js, ks = "z2qa7BQdkEb3TwYyEYC1psK6uvmGnHSUHt5RM";
|
|
633
|
-
function
|
|
634
|
-
|
|
635
|
-
s.some((
|
|
633
|
+
function we(e) {
|
|
634
|
+
e.observeDeep((s) => {
|
|
635
|
+
s.some((t) => t.changes.keys.has("updatedAt") || t.changes.keys.has("publishedAt")) || e.set("updatedAt", (/* @__PURE__ */ new Date()).toISOString());
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
638
|
function dt() {
|
|
639
639
|
return $t(O(I.env.dataDir, "tmp-"));
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
return Array.isArray(
|
|
641
|
+
function be(e, s, t = []) {
|
|
642
|
+
return Array.isArray(e) ? e.flatMap((n, o) => be(n, s, [...t, o])) : typeof e == "object" ? e === null ? [] : Object.entries(e).flatMap(([n, o]) => be(o, s, [...t, n])) : s(e) ? [t] : [];
|
|
643
643
|
}
|
|
644
|
-
function R(
|
|
645
|
-
return
|
|
644
|
+
function R(e) {
|
|
645
|
+
return e.filter((s) => s != null);
|
|
646
646
|
}
|
|
647
|
-
function Ns(
|
|
648
|
-
|
|
649
|
-
const n =
|
|
650
|
-
n && n instanceof B.Map &&
|
|
647
|
+
function Ns(e) {
|
|
648
|
+
e.pages && Object.keys(e.pages).forEach((t) => {
|
|
649
|
+
const n = se(e.pages[t]);
|
|
650
|
+
n && n instanceof B.Map && we(n);
|
|
651
651
|
});
|
|
652
|
-
const s =
|
|
653
|
-
s && s instanceof B.Map && s.observe((
|
|
654
|
-
|
|
652
|
+
const s = se(e.pages);
|
|
653
|
+
s && s instanceof B.Map && s.observe((t) => {
|
|
654
|
+
t.changes.keys.forEach((n, o) => {
|
|
655
655
|
if (n.action === "add") {
|
|
656
|
-
const r =
|
|
657
|
-
r && r instanceof B.Map &&
|
|
656
|
+
const r = se(e.pages[o]);
|
|
657
|
+
r && r instanceof B.Map && we(r);
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
660
|
});
|
|
661
661
|
}
|
|
662
|
-
function Ls(
|
|
663
|
-
|
|
662
|
+
function Ls(e) {
|
|
663
|
+
e.routes && Object.keys(e.routes).forEach((t) => {
|
|
664
664
|
var o;
|
|
665
|
-
const n =
|
|
666
|
-
n && n instanceof B.Map &&
|
|
665
|
+
const n = se((o = e.routes) == null ? void 0 : o[t]);
|
|
666
|
+
n && n instanceof B.Map && we(n);
|
|
667
667
|
});
|
|
668
|
-
const s =
|
|
669
|
-
s && s instanceof B.Map && s.observe((
|
|
670
|
-
|
|
668
|
+
const s = se(e.routes);
|
|
669
|
+
s && s instanceof B.Map && s.observe((t) => {
|
|
670
|
+
t.changes.keys.forEach((n, o) => {
|
|
671
671
|
var r;
|
|
672
672
|
if (n.action === "add") {
|
|
673
|
-
const l =
|
|
674
|
-
l && l instanceof B.Map &&
|
|
673
|
+
const l = se((r = e.routes) == null ? void 0 : r[o]);
|
|
674
|
+
l && l instanceof B.Map && we(l);
|
|
675
675
|
}
|
|
676
676
|
});
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
-
function Rs(
|
|
680
|
-
var
|
|
681
|
-
for (const n of s || Object.keys(
|
|
679
|
+
function Rs(e, s) {
|
|
680
|
+
var t;
|
|
681
|
+
for (const n of s || Object.keys(e.routes || {})) {
|
|
682
682
|
let o = n, r = [];
|
|
683
683
|
if (n.includes("-")) {
|
|
684
684
|
const [l, ...c] = n.split("-");
|
|
685
685
|
o = l, r = c || [];
|
|
686
686
|
}
|
|
687
|
-
if (((
|
|
688
|
-
|
|
689
|
-
const l =
|
|
687
|
+
if (((t = e.routes) == null ? void 0 : t[o]) !== void 0) {
|
|
688
|
+
e.routes[o].publishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
689
|
+
const l = e.routes[o];
|
|
690
690
|
if (!l || !l.params || l.params.length === 0)
|
|
691
691
|
continue;
|
|
692
692
|
if (n.includes("-") && r.length > 0) {
|
|
@@ -711,9 +711,9 @@ function Rs(t, s) {
|
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
function De({
|
|
714
|
-
page:
|
|
714
|
+
page: e,
|
|
715
715
|
route: s,
|
|
716
|
-
state:
|
|
716
|
+
state: t,
|
|
717
717
|
routeId: n,
|
|
718
718
|
routePathInfo: o
|
|
719
719
|
}) {
|
|
@@ -722,7 +722,7 @@ function De({
|
|
|
722
722
|
`Executing datasource data assembly, routeId: ${n}, routePathInfo: ${JSON.stringify(o)}`
|
|
723
723
|
);
|
|
724
724
|
const r = {
|
|
725
|
-
...Wt(
|
|
725
|
+
...Wt(e),
|
|
726
726
|
id: n,
|
|
727
727
|
slug: (o == null ? void 0 : o.path) ?? s.path,
|
|
728
728
|
createdAt: s.createdAt,
|
|
@@ -730,26 +730,26 @@ function De({
|
|
|
730
730
|
publishedAt: ((c = o == null ? void 0 : o.routeMetaData) == null ? void 0 : c.publishedAt) ?? s.publishedAt,
|
|
731
731
|
isPublic: (((d = o == null ? void 0 : o.routeMetaData) == null ? void 0 : d.isPublic) ?? s.isPublic) && s.isPublic
|
|
732
732
|
};
|
|
733
|
-
for (const m of
|
|
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 = ((y = (u = (p = s.dataSource.pathDataMappings) == null ? void 0 : p[w]) == null ? void 0 : u.dataCache) == null ? void 0 : y[m.locale]) ?? ((i = (a = (h = s.dataSource.pathDataMappings) == null ? void 0 : h[w]) == null ? void 0 : a.dataCache) == null ? void 0 : i[
|
|
737
|
+
const D = ((y = (u = (p = s.dataSource.pathDataMappings) == null ? void 0 : p[w]) == null ? void 0 : u.dataCache) == null ? void 0 : y[m.locale]) ?? ((i = (a = (h = s.dataSource.pathDataMappings) == null ? void 0 : h[w]) == null ? void 0 : a.dataCache) == null ? void 0 : i[t.config.defaultLocale || "en"]);
|
|
738
738
|
if (!D)
|
|
739
739
|
continue;
|
|
740
|
-
zt(r,
|
|
740
|
+
zt(r, t, m.locale, D);
|
|
741
741
|
}
|
|
742
742
|
o && o.routeMetaData && (o.routeMetaData.publishedAt = (/* @__PURE__ */ new Date()).toISOString());
|
|
743
743
|
}
|
|
744
744
|
return r;
|
|
745
745
|
}
|
|
746
|
-
const { uploadToMediaKit: _s } = require("@blocklet/uploader-server"), xe = ts("abcdefghijklmnopqrstuvwxyz0123456789", 16), Ue = /^\w+(\w|-|\.)+\w+\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm)$/,
|
|
747
|
-
function
|
|
748
|
-
return (
|
|
746
|
+
const { uploadToMediaKit: _s } = require("@blocklet/uploader-server"), xe = ts("abcdefghijklmnopqrstuvwxyz0123456789", 16), Ue = /^\w+(\w|-|\.)+\w+\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm)$/, ie = /mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/i, Ze = /mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/gi, Ms = 1e4, Us = 3e4, ue = 0, je = 1, $s = 0, Fs = 1, Le = I, me = O(process.env.BLOCKLET_DATA_DIR, "site-state"), Gn = ["production", "draft"], Hn = ["production"];
|
|
747
|
+
function Ie(e) {
|
|
748
|
+
return (e == null ? void 0 : e.replace(/\//g, "|")) || "";
|
|
749
749
|
}
|
|
750
750
|
function Bs() {
|
|
751
|
-
var
|
|
752
|
-
const
|
|
751
|
+
var t;
|
|
752
|
+
const e = Le.env.languages.map((n) => ({ locale: n.code, name: n.name })), s = (t = e[0]) == null ? void 0 : t.locale;
|
|
753
753
|
return {
|
|
754
754
|
pageIds: [],
|
|
755
755
|
pages: {},
|
|
@@ -758,23 +758,23 @@ function Bs() {
|
|
|
758
758
|
dataSourceIds: [],
|
|
759
759
|
dataSources: {},
|
|
760
760
|
components: {},
|
|
761
|
-
supportedLocales:
|
|
761
|
+
supportedLocales: e,
|
|
762
762
|
config: { defaultLocale: s },
|
|
763
763
|
resources: {}
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
|
-
const
|
|
767
|
-
constructor(
|
|
766
|
+
const V = class V extends B.Doc {
|
|
767
|
+
constructor(t) {
|
|
768
768
|
super();
|
|
769
769
|
j(this, "states", {});
|
|
770
770
|
j(this, "syncedStore");
|
|
771
771
|
j(this, "conns", /* @__PURE__ */ new Map());
|
|
772
772
|
j(this, "awareness");
|
|
773
|
-
j(this, "awarenessChangeHandler", ({ added:
|
|
774
|
-
const l =
|
|
773
|
+
j(this, "awarenessChangeHandler", ({ added: t, updated: n, removed: o }, r) => {
|
|
774
|
+
const l = t.concat(n, o);
|
|
775
775
|
if (r !== null) {
|
|
776
776
|
const p = this.conns.get(r);
|
|
777
|
-
p && (
|
|
777
|
+
p && (t.forEach((u) => {
|
|
778
778
|
p.add(u);
|
|
779
779
|
}), o.forEach((u) => {
|
|
780
780
|
p.delete(u);
|
|
@@ -785,15 +785,15 @@ const H = class H extends B.Doc {
|
|
|
785
785
|
const d = k.toUint8Array(c);
|
|
786
786
|
this.conns.forEach((p, u) => this.send(u, d));
|
|
787
787
|
});
|
|
788
|
-
j(this, "updateHandler", (
|
|
788
|
+
j(this, "updateHandler", (t) => {
|
|
789
789
|
const n = k.createEncoder();
|
|
790
|
-
k.writeVarUint(n,
|
|
790
|
+
k.writeVarUint(n, ue), ps(n, t);
|
|
791
791
|
const o = k.toUint8Array(n);
|
|
792
792
|
this.conns.forEach((r, l) => this.send(l, o));
|
|
793
793
|
});
|
|
794
794
|
j(this, "ensureDataStructure", () => {
|
|
795
795
|
var l;
|
|
796
|
-
const { supportedLocales:
|
|
796
|
+
const { supportedLocales: t, pages: n, pageIds: o, config: r } = this.syncedStore;
|
|
797
797
|
{
|
|
798
798
|
const c = new Set(Object.keys(n));
|
|
799
799
|
let d = 0;
|
|
@@ -802,52 +802,52 @@ const H = class H extends B.Doc {
|
|
|
802
802
|
c.has(p) ? (c.delete(p), d++) : o.splice(d, 1);
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
|
|
805
|
+
t.splice(0, t.length), t.push(...Le.env.languages.map((c) => ({ locale: c.code, name: c.name }))), r.defaultLocale = (l = t[0]) == null ? void 0 : l.locale;
|
|
806
806
|
{
|
|
807
807
|
let c = 0;
|
|
808
808
|
const d = /* @__PURE__ */ new Set();
|
|
809
|
-
for (; c <
|
|
810
|
-
const { locale: p } =
|
|
811
|
-
d.has(p) ?
|
|
809
|
+
for (; c < t.length; ) {
|
|
810
|
+
const { locale: p } = t[c];
|
|
811
|
+
d.has(p) ? t.splice(c, 1) : (c++, d.add(p));
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
});
|
|
815
|
-
j(this, "send", (
|
|
816
|
-
|
|
815
|
+
j(this, "send", (t, n) => {
|
|
816
|
+
t.readyState !== $s && t.readyState !== Fs && this.closeConn(t);
|
|
817
817
|
try {
|
|
818
|
-
|
|
819
|
-
o && this.closeConn(
|
|
818
|
+
t.send(n, (o) => {
|
|
819
|
+
o && this.closeConn(t);
|
|
820
820
|
});
|
|
821
821
|
} catch {
|
|
822
|
-
this.closeConn(
|
|
822
|
+
this.closeConn(t);
|
|
823
823
|
}
|
|
824
824
|
});
|
|
825
|
-
j(this, "closeConn", (
|
|
826
|
-
if (
|
|
827
|
-
const n = this.conns.get(
|
|
828
|
-
this.conns.delete(
|
|
825
|
+
j(this, "closeConn", (t) => {
|
|
826
|
+
if (t.removeAllListeners(), this.conns.has(t)) {
|
|
827
|
+
const n = this.conns.get(t);
|
|
828
|
+
this.conns.delete(t), n && is(this.awareness, Array.from(n), null);
|
|
829
829
|
}
|
|
830
|
-
|
|
830
|
+
t.close();
|
|
831
831
|
});
|
|
832
832
|
j(this, "autoSave", at(() => {
|
|
833
|
-
|
|
833
|
+
H(_(this.draftYjsFilePath), { recursive: !0 }), ye(this.draftYjsFilePath, B.encodeStateAsUpdate(this));
|
|
834
834
|
}, Ms));
|
|
835
|
-
j(this, "save", ({ flush:
|
|
836
|
-
this.autoSave(),
|
|
835
|
+
j(this, "save", ({ flush: t = !1 } = {}) => {
|
|
836
|
+
this.autoSave(), t && this.autoSave.flush();
|
|
837
837
|
});
|
|
838
|
-
j(this, "publish", async ({ mode:
|
|
838
|
+
j(this, "publish", async ({ mode: t, routes: n }) => {
|
|
839
839
|
const o = await this.getState("draft"), r = await this.getState("production");
|
|
840
|
-
await st(o, r, { routes: n, mergeMode: "replace", deleteRoutes: !0, publishMode:
|
|
840
|
+
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
841
|
});
|
|
842
|
-
j(this, "mergeState", async (
|
|
842
|
+
j(this, "mergeState", async (t, n) => {
|
|
843
843
|
var c, d, p;
|
|
844
844
|
const o = JSON.parse(JSON.stringify(n));
|
|
845
|
-
(c =
|
|
846
|
-
const r = (d = o.config) == null ? void 0 : d.fontFamily, l = (p =
|
|
847
|
-
|
|
845
|
+
(c = t.config).fontFamily ?? (c.fontFamily = {});
|
|
846
|
+
const r = (d = o.config) == null ? void 0 : d.fontFamily, l = (p = t.config) == null ? void 0 : p.fontFamily;
|
|
847
|
+
t.config.fontFamily.title = (r == null ? void 0 : r.title) || (l == null ? void 0 : l.title), t.config.fontFamily.description = (r == null ? void 0 : r.description) || (l == null ? void 0 : l.description), await new Promise((u, y) => {
|
|
848
848
|
this.transact(async () => {
|
|
849
849
|
try {
|
|
850
|
-
const h = await st(
|
|
850
|
+
const h = await st(t, n);
|
|
851
851
|
u(h);
|
|
852
852
|
} catch (h) {
|
|
853
853
|
y(h);
|
|
@@ -855,47 +855,47 @@ const H = class H extends B.Doc {
|
|
|
855
855
|
});
|
|
856
856
|
});
|
|
857
857
|
});
|
|
858
|
-
j(this, "addConnection", (
|
|
859
|
-
if (this.conns.has(
|
|
858
|
+
j(this, "addConnection", (t) => {
|
|
859
|
+
if (this.conns.has(t))
|
|
860
860
|
return;
|
|
861
|
-
|
|
861
|
+
t.binaryType = "arraybuffer", this.conns.set(t, /* @__PURE__ */ new Set()), t.on("message", (r) => this.messageListener(t, new Uint8Array(r)));
|
|
862
862
|
let n = !0;
|
|
863
863
|
const o = setInterval(() => {
|
|
864
864
|
if (!n)
|
|
865
|
-
this.conns.has(
|
|
866
|
-
else if (this.conns.has(
|
|
865
|
+
this.conns.has(t) && this.closeConn(t), clearInterval(o);
|
|
866
|
+
else if (this.conns.has(t)) {
|
|
867
867
|
n = !1;
|
|
868
868
|
try {
|
|
869
|
-
|
|
869
|
+
t.ping();
|
|
870
870
|
} catch {
|
|
871
|
-
this.closeConn(
|
|
871
|
+
this.closeConn(t), clearInterval(o);
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
}, Us);
|
|
875
|
-
|
|
876
|
-
this.closeConn(
|
|
877
|
-
}),
|
|
875
|
+
t.on("close", () => {
|
|
876
|
+
this.closeConn(t), clearInterval(o);
|
|
877
|
+
}), t.on("pong", () => {
|
|
878
878
|
n = !0;
|
|
879
879
|
});
|
|
880
880
|
{
|
|
881
881
|
const r = k.createEncoder();
|
|
882
|
-
k.writeVarUint(r,
|
|
882
|
+
k.writeVarUint(r, ue), ls(r, this), this.send(t, k.toUint8Array(r));
|
|
883
883
|
const l = this.awareness.getStates();
|
|
884
884
|
if (l.size > 0) {
|
|
885
885
|
const c = k.createEncoder();
|
|
886
|
-
k.writeVarUint(c, je), k.writeVarUint8Array(c, Ye(this.awareness, Array.from(l.keys()))), this.send(
|
|
886
|
+
k.writeVarUint(c, je), k.writeVarUint8Array(c, Ye(this.awareness, Array.from(l.keys()))), this.send(t, k.toUint8Array(c));
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
});
|
|
890
|
-
j(this, "messageListener", (
|
|
890
|
+
j(this, "messageListener", (t, n) => {
|
|
891
891
|
try {
|
|
892
892
|
const o = k.createEncoder(), r = Ce.createDecoder(n), l = Ce.readVarUint(r);
|
|
893
893
|
switch (l) {
|
|
894
|
-
case
|
|
895
|
-
k.writeVarUint(o,
|
|
894
|
+
case ue:
|
|
895
|
+
k.writeVarUint(o, ue), ds(r, o, this, null), k.length(o) > 1 && (this.ensureDataStructure(), this.send(t, k.toUint8Array(o)));
|
|
896
896
|
break;
|
|
897
897
|
case je: {
|
|
898
|
-
cs(this.awareness, Ce.readVarUint8Array(r),
|
|
898
|
+
cs(this.awareness, Ce.readVarUint8Array(r), t);
|
|
899
899
|
break;
|
|
900
900
|
}
|
|
901
901
|
default:
|
|
@@ -906,8 +906,8 @@ const H = class H extends B.Doc {
|
|
|
906
906
|
}
|
|
907
907
|
this.save();
|
|
908
908
|
});
|
|
909
|
-
this.options =
|
|
910
|
-
|
|
909
|
+
this.options = t, F(this.draftYjsFilePath) && B.applyUpdate(this, X(this.draftYjsFilePath)), this.syncedStore = qt(
|
|
910
|
+
Vt(
|
|
911
911
|
{
|
|
912
912
|
pages: {},
|
|
913
913
|
pageIds: [],
|
|
@@ -925,11 +925,11 @@ const H = class H extends B.Doc {
|
|
|
925
925
|
), this.initObserver(), this.on("update", this.updateHandler), this.awareness = new as(this), this.awareness.on("update", this.awarenessChangeHandler), this.ensureDataStructure();
|
|
926
926
|
}
|
|
927
927
|
// safe delete project state dir
|
|
928
|
-
static safeDeleteProjectStateDir(
|
|
929
|
-
if (!
|
|
928
|
+
static safeDeleteProjectStateDir(t) {
|
|
929
|
+
if (!t)
|
|
930
930
|
throw new Error("Should provide project context");
|
|
931
931
|
try {
|
|
932
|
-
const n = O(
|
|
932
|
+
const n = O(me, t), o = O(me, `@del-${t}`);
|
|
933
933
|
Ke(n, o);
|
|
934
934
|
} catch (n) {
|
|
935
935
|
b.error("Failed to safe delete project state dir:", n);
|
|
@@ -937,24 +937,24 @@ const H = class H extends B.Doc {
|
|
|
937
937
|
}
|
|
938
938
|
static get projectIds() {
|
|
939
939
|
return ke("*/", {
|
|
940
|
-
cwd:
|
|
940
|
+
cwd: me,
|
|
941
941
|
ignore: ["@del-*", "@tmp-*", ".*", "staging", "production", "@backup-*"]
|
|
942
942
|
// Ignore temp directories and hidden files
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
static get allShared() {
|
|
946
|
-
return this.projectIds.map((
|
|
946
|
+
return this.projectIds.map((t) => V.shared(t));
|
|
947
947
|
}
|
|
948
|
-
static shared(
|
|
949
|
-
if (!
|
|
948
|
+
static shared(t) {
|
|
949
|
+
if (!t)
|
|
950
950
|
throw new Error("Should provide project context");
|
|
951
|
-
let n = this.sharedInstances.get(
|
|
952
|
-
return n || (n = new
|
|
953
|
-
path: O(
|
|
954
|
-
}), this.sharedInstances.set(
|
|
951
|
+
let n = this.sharedInstances.get(t);
|
|
952
|
+
return n || (n = new V({
|
|
953
|
+
path: O(me, t)
|
|
954
|
+
}), this.sharedInstances.set(t, n), n);
|
|
955
955
|
}
|
|
956
956
|
destroy() {
|
|
957
|
-
this.conns.forEach((
|
|
957
|
+
this.conns.forEach((t, n) => this.closeConn(n)), this.awareness.destroy(), super.destroy();
|
|
958
958
|
}
|
|
959
959
|
initObserver() {
|
|
960
960
|
Ns(this.syncedStore), Ls(this.syncedStore);
|
|
@@ -962,22 +962,22 @@ const H = class H extends B.Doc {
|
|
|
962
962
|
get draftYjsFilePath() {
|
|
963
963
|
return O(this.options.path, "draft.yjs");
|
|
964
964
|
}
|
|
965
|
-
async getState(
|
|
965
|
+
async getState(t) {
|
|
966
966
|
var n, o, r, l;
|
|
967
|
-
if (
|
|
967
|
+
if (t === "draft")
|
|
968
968
|
return JSON.parse(JSON.stringify(this.syncedStore));
|
|
969
|
-
if (!this.states[
|
|
970
|
-
(r = this.states[
|
|
969
|
+
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
|
+
(r = this.states[t]).config ?? (r.config = {});
|
|
971
971
|
const c = Le.env.languages.map((d) => ({ locale: d.code, name: d.name }));
|
|
972
|
-
this.states[
|
|
972
|
+
this.states[t].config.defaultLocale = (l = c[0]) == null ? void 0 : l.locale;
|
|
973
973
|
}
|
|
974
974
|
return {
|
|
975
|
-
...this.states[
|
|
975
|
+
...this.states[t],
|
|
976
976
|
resources: await Ge().then(async (c) => {
|
|
977
977
|
var a, i, m, w;
|
|
978
978
|
const { pages: d, components: p } = Zt(c, "pages", "components");
|
|
979
979
|
let u = p;
|
|
980
|
-
const y =
|
|
980
|
+
const y = ne(this.options.path), h = await q.findByPk(y);
|
|
981
981
|
if (h != null && h.useAllResources)
|
|
982
982
|
u = p;
|
|
983
983
|
else {
|
|
@@ -986,27 +986,27 @@ const H = class H extends B.Doc {
|
|
|
986
986
|
Object.entries(p || {}).filter(([M]) => A.includes(M))
|
|
987
987
|
);
|
|
988
988
|
}
|
|
989
|
-
return Object.keys(((i = (a = this.states[
|
|
989
|
+
return Object.keys(((i = (a = this.states[t]) == null ? void 0 : a.resources) == null ? void 0 : i.components) || {}).length > 0 && (u = {
|
|
990
990
|
...u,
|
|
991
|
-
...(w = (m = this.states[
|
|
991
|
+
...(w = (m = this.states[t]) == null ? void 0 : m.resources) == null ? void 0 : w.components
|
|
992
992
|
}), { pages: d, components: u };
|
|
993
993
|
}).catch(() => ({}))
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
|
-
async setState(
|
|
997
|
-
const o = await
|
|
998
|
-
|
|
996
|
+
async setState(t, n) {
|
|
997
|
+
const o = await Vs(n, { exportAssets: !1, includeResources: !0 }), r = this.getPublishDir(t);
|
|
998
|
+
H(_(r), { recursive: !0 }), rt(r, { force: !0, recursive: !0 }), Ke(o, r), this.states[t] = n;
|
|
999
999
|
}
|
|
1000
|
-
getPublishDir(
|
|
1001
|
-
return O(this.options.path,
|
|
1000
|
+
getPublishDir(t) {
|
|
1001
|
+
return O(this.options.path, t);
|
|
1002
1002
|
}
|
|
1003
|
-
static async pageUrlMap(
|
|
1003
|
+
static async pageUrlMap(t) {
|
|
1004
1004
|
var r, l;
|
|
1005
1005
|
const { projectIds: n } = this, o = {};
|
|
1006
1006
|
for (const c of n) {
|
|
1007
1007
|
const d = await q.findByPk(c);
|
|
1008
1008
|
if (!d) continue;
|
|
1009
|
-
const p = await
|
|
1009
|
+
const p = await V.shared(c).getState(t), u = d.slug || c, y = es(
|
|
1010
1010
|
I.env.languages.map((a) => a.code),
|
|
1011
1011
|
p.supportedLocales.map((a) => a.locale)
|
|
1012
1012
|
), h = (a, i) => {
|
|
@@ -1024,7 +1024,7 @@ const H = class H extends B.Doc {
|
|
|
1024
1024
|
o[K("/", m, c, a)] = w, u && (o[K("/", m, u, a)] = w);
|
|
1025
1025
|
}
|
|
1026
1026
|
};
|
|
1027
|
-
if (
|
|
1027
|
+
if (t === "draft")
|
|
1028
1028
|
for (const a of p.routeIds || []) {
|
|
1029
1029
|
const i = (r = p == null ? void 0 : p.routes) == null ? void 0 : r[a];
|
|
1030
1030
|
if (!i) continue;
|
|
@@ -1071,7 +1071,7 @@ const H = class H extends B.Doc {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
for (const a of p.pageIds) {
|
|
1073
1073
|
const i = p.pages[a];
|
|
1074
|
-
if (!i ||
|
|
1074
|
+
if (!i || t === "production" && !i.isPublic)
|
|
1075
1075
|
continue;
|
|
1076
1076
|
const m = i.slug, w = d.slug || c, D = {
|
|
1077
1077
|
projectId: c,
|
|
@@ -1094,50 +1094,50 @@ const H = class H extends B.Doc {
|
|
|
1094
1094
|
return B.encodeStateAsUpdate(this).byteLength;
|
|
1095
1095
|
}
|
|
1096
1096
|
static getInstancesSizeInfo() {
|
|
1097
|
-
const
|
|
1097
|
+
const t = [];
|
|
1098
1098
|
for (const [n, o] of this.sharedInstances.entries()) {
|
|
1099
1099
|
const r = o.getDocumentSize();
|
|
1100
|
-
|
|
1100
|
+
t.push({
|
|
1101
1101
|
projectId: n,
|
|
1102
1102
|
sizeInBytes: r,
|
|
1103
1103
|
sizeInMB: `${(r / (1024 * 1024)).toFixed(2)} MB`,
|
|
1104
1104
|
activeConnections: o.conns.size
|
|
1105
1105
|
});
|
|
1106
1106
|
}
|
|
1107
|
-
return
|
|
1107
|
+
return t;
|
|
1108
1108
|
}
|
|
1109
1109
|
};
|
|
1110
|
-
j(
|
|
1111
|
-
j(
|
|
1110
|
+
j(V, "INSTANCE_TTL", 30 * 60 * 1e3), // 30 minutes
|
|
1111
|
+
j(V, "sharedInstances", new Re({
|
|
1112
1112
|
max: 100,
|
|
1113
1113
|
// Maximum number of instances to store
|
|
1114
|
-
ttl:
|
|
1115
|
-
dispose: (
|
|
1116
|
-
|
|
1114
|
+
ttl: V.INSTANCE_TTL,
|
|
1115
|
+
dispose: (t) => {
|
|
1116
|
+
t.destroy();
|
|
1117
1117
|
}
|
|
1118
1118
|
}));
|
|
1119
|
-
let
|
|
1120
|
-
async function Gs(
|
|
1121
|
-
if (!
|
|
1119
|
+
let Ee = V;
|
|
1120
|
+
async function Gs(e, s, t) {
|
|
1121
|
+
if (!e || !F(e) || !Q(e).isFile())
|
|
1122
1122
|
return null;
|
|
1123
|
-
let n = e
|
|
1123
|
+
let n = t[e];
|
|
1124
1124
|
return n || (n = (async () => {
|
|
1125
1125
|
var o;
|
|
1126
1126
|
try {
|
|
1127
1127
|
const r = (o = await _s({
|
|
1128
|
-
filePath:
|
|
1128
|
+
filePath: e,
|
|
1129
1129
|
fileName: s
|
|
1130
1130
|
})) == null ? void 0 : o.data;
|
|
1131
1131
|
return r == null ? void 0 : r.filename;
|
|
1132
1132
|
} catch (r) {
|
|
1133
|
-
return b.error(`Failed to upload asset ${
|
|
1133
|
+
return b.error(`Failed to upload asset ${e}:`, r), null;
|
|
1134
1134
|
}
|
|
1135
|
-
})(), e
|
|
1135
|
+
})(), t[e] = n), n;
|
|
1136
1136
|
}
|
|
1137
|
-
const
|
|
1138
|
-
const
|
|
1137
|
+
const Hs = async (e, s) => {
|
|
1138
|
+
const t = ne(e), n = await _t({
|
|
1139
1139
|
name: lt,
|
|
1140
|
-
path: K("/uploads",
|
|
1140
|
+
path: K("/uploads", t),
|
|
1141
1141
|
responseType: "stream",
|
|
1142
1142
|
method: "GET"
|
|
1143
1143
|
});
|
|
@@ -1146,76 +1146,76 @@ const Js = async (t, s) => {
|
|
|
1146
1146
|
await ns(n.data, o);
|
|
1147
1147
|
} else
|
|
1148
1148
|
throw new Error(`download asset failed ${n.status}`);
|
|
1149
|
-
},
|
|
1149
|
+
}, Js = async (e, s) => {
|
|
1150
1150
|
await Promise.all(
|
|
1151
|
-
|
|
1151
|
+
e.map(async (t) => {
|
|
1152
1152
|
try {
|
|
1153
|
-
await
|
|
1153
|
+
await Hs(t, O(s, ne(t)));
|
|
1154
1154
|
} catch (n) {
|
|
1155
|
-
b.error(`Failed to export assets: ${
|
|
1155
|
+
b.error(`Failed to export assets: ${t}, ${n}`);
|
|
1156
1156
|
}
|
|
1157
1157
|
})
|
|
1158
1158
|
);
|
|
1159
1159
|
};
|
|
1160
|
-
function ut(
|
|
1161
|
-
return Ue.test(
|
|
1160
|
+
function ut(e) {
|
|
1161
|
+
return Ue.test(e) ? [e] : ie.test(e) ? (Ze.lastIndex = 0, Array.from(e.matchAll(Ze)).map((t) => t[1]).filter((t) => !!t)) : [];
|
|
1162
1162
|
}
|
|
1163
|
-
async function
|
|
1164
|
-
const { getFilename: n, exportAssets: o } =
|
|
1165
|
-
if (
|
|
1166
|
-
const c =
|
|
1167
|
-
|
|
1168
|
-
(d) => typeof d == "string" && (Ue.test(d) ||
|
|
1163
|
+
async function fe(e, s, t) {
|
|
1164
|
+
const { getFilename: n, exportAssets: o } = t, r = O(s, n(e));
|
|
1165
|
+
if (H(_(r), { recursive: !0 }), ye(r, Z.stringify(e)), o) {
|
|
1166
|
+
const c = be(
|
|
1167
|
+
e,
|
|
1168
|
+
(d) => typeof d == "string" && (Ue.test(d) || ie.test(d))
|
|
1169
1169
|
).map((d) => {
|
|
1170
|
-
const p = Me(
|
|
1170
|
+
const p = Me(e, d);
|
|
1171
1171
|
return ut(p);
|
|
1172
1172
|
}).flat().filter(Boolean);
|
|
1173
|
-
await
|
|
1173
|
+
await Js(c, _(r));
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
const et = new Re({
|
|
1177
1177
|
max: 1e3,
|
|
1178
1178
|
ttl: 30 * 24 * 60 * 60 * 1e3
|
|
1179
1179
|
});
|
|
1180
|
-
async function tt(
|
|
1180
|
+
async function tt(e, s, t) {
|
|
1181
1181
|
var c;
|
|
1182
|
-
const n =
|
|
1183
|
-
|
|
1184
|
-
(d) => typeof d == "string" && (Ue.test(d) ||
|
|
1182
|
+
const n = be(
|
|
1183
|
+
e,
|
|
1184
|
+
(d) => typeof d == "string" && (Ue.test(d) || ie.test(d))
|
|
1185
1185
|
), o = ss(2), r = n.map(
|
|
1186
1186
|
(d) => o(async () => {
|
|
1187
1187
|
try {
|
|
1188
|
-
const p = Me(
|
|
1188
|
+
const p = Me(e, d), u = ut(p);
|
|
1189
1189
|
for (const y of u) {
|
|
1190
|
-
const h =
|
|
1190
|
+
const h = ne(y), a = t.getFilePath(y, d), i = a ? `${a}:${h}` : h, m = et.get(i);
|
|
1191
1191
|
if (m) {
|
|
1192
|
-
|
|
1192
|
+
ie.test(p) || ze(e, d, m);
|
|
1193
1193
|
return;
|
|
1194
1194
|
}
|
|
1195
1195
|
const w = await Gs(a, h, s);
|
|
1196
|
-
w && (
|
|
1196
|
+
w && (ie.test(p) || ze(e, d, w), et.set(i, w));
|
|
1197
1197
|
}
|
|
1198
1198
|
} catch (p) {
|
|
1199
1199
|
b.error(`Failed to process upload for path ${d.join(".")}:`, p.message || p.reason);
|
|
1200
1200
|
}
|
|
1201
1201
|
})
|
|
1202
1202
|
), l = await Promise.allSettled(r);
|
|
1203
|
-
(c =
|
|
1203
|
+
(c = t.onFinish) == null || c.call(t, l);
|
|
1204
1204
|
}
|
|
1205
|
-
async function
|
|
1205
|
+
async function Vs(e, {
|
|
1206
1206
|
exportAssets: s,
|
|
1207
|
-
pageIds:
|
|
1207
|
+
pageIds: t = "all",
|
|
1208
1208
|
componentIds: n = "all",
|
|
1209
1209
|
rawConfig: o,
|
|
1210
1210
|
includeResources: r = !1,
|
|
1211
1211
|
routeIds: l = "all"
|
|
1212
1212
|
} = {}) {
|
|
1213
|
-
var
|
|
1214
|
-
const c =
|
|
1215
|
-
state:
|
|
1213
|
+
var oe, S, f, E, v, z, P, U, Y, le, re, de;
|
|
1214
|
+
const c = t === "all" ? e.pageIds : t, d = At({
|
|
1215
|
+
state: e,
|
|
1216
1216
|
pageIds: c,
|
|
1217
|
-
componentIds: n === "all" ? Object.keys(
|
|
1218
|
-
}), p = l === "all" ?
|
|
1217
|
+
componentIds: n === "all" ? Object.keys(e.components) : n
|
|
1218
|
+
}), p = l === "all" ? e.routeIds : l, u = (g, T) => {
|
|
1219
1219
|
var C;
|
|
1220
1220
|
return {
|
|
1221
1221
|
id: g.id,
|
|
@@ -1239,8 +1239,8 @@ async function Hs(t, {
|
|
|
1239
1239
|
templateConfig: g.templateConfig,
|
|
1240
1240
|
meta: ((C = g.locales) == null ? void 0 : C[T]) ?? {},
|
|
1241
1241
|
sections: R(
|
|
1242
|
-
g.sectionIds.map((
|
|
1243
|
-
const G = g.sections[
|
|
1242
|
+
g.sectionIds.map((J) => {
|
|
1243
|
+
const G = g.sections[J];
|
|
1244
1244
|
return G && u(G, T);
|
|
1245
1245
|
})
|
|
1246
1246
|
)
|
|
@@ -1259,13 +1259,13 @@ async function Hs(t, {
|
|
|
1259
1259
|
dataSource: g.dataSource
|
|
1260
1260
|
}), a = R(
|
|
1261
1261
|
p.map((g) => {
|
|
1262
|
-
const T =
|
|
1262
|
+
const T = e.routes[g];
|
|
1263
1263
|
return T && h(T);
|
|
1264
1264
|
})
|
|
1265
1265
|
), i = R(
|
|
1266
|
-
|
|
1266
|
+
e.supportedLocales.map((g) => g.locale).flatMap(
|
|
1267
1267
|
(g) => c.map((T) => {
|
|
1268
|
-
const C =
|
|
1268
|
+
const C = e.pages[T];
|
|
1269
1269
|
return C && {
|
|
1270
1270
|
locale: g,
|
|
1271
1271
|
slug: C.slug,
|
|
@@ -1274,48 +1274,48 @@ async function Hs(t, {
|
|
|
1274
1274
|
})
|
|
1275
1275
|
)
|
|
1276
1276
|
), m = dt(), w = O(m, "pages");
|
|
1277
|
-
|
|
1277
|
+
H(w, { recursive: !0 });
|
|
1278
1278
|
const D = O(m, "components");
|
|
1279
|
-
|
|
1279
|
+
H(D, { recursive: !0 });
|
|
1280
1280
|
const A = O(m, "routes");
|
|
1281
|
-
|
|
1281
|
+
H(A, { recursive: !0 });
|
|
1282
1282
|
for (const { locale: g, slug: T, page: C } of i)
|
|
1283
|
-
await
|
|
1284
|
-
getFilename: () => `${
|
|
1283
|
+
await fe(C, w, {
|
|
1284
|
+
getFilename: () => `${Ie(T) || "index"}.${g}.yml`,
|
|
1285
1285
|
exportAssets: s
|
|
1286
1286
|
});
|
|
1287
1287
|
for (const g of a)
|
|
1288
|
-
await
|
|
1288
|
+
await fe(g, A, {
|
|
1289
1289
|
// getFilename: () => `${sanitizeSlug(route.path)}.yml`,
|
|
1290
|
-
getFilename: () => `${
|
|
1290
|
+
getFilename: () => `${Ie(g.path) || "index"}.yml`,
|
|
1291
1291
|
exportAssets: s
|
|
1292
1292
|
});
|
|
1293
1293
|
for (const g of d) {
|
|
1294
|
-
const T = (
|
|
1295
|
-
T && await
|
|
1294
|
+
const T = (oe = e.components[g]) == null ? void 0 : oe.data;
|
|
1295
|
+
T && await fe(T, D, {
|
|
1296
1296
|
getFilename: (C) => `${C.name || "unnamed"}.${C.id}.yml`,
|
|
1297
1297
|
exportAssets: s
|
|
1298
1298
|
});
|
|
1299
1299
|
}
|
|
1300
1300
|
const N = O(m, ".blocklet/pages/pages.config.yml");
|
|
1301
|
-
|
|
1301
|
+
H(_(N), { recursive: !0 });
|
|
1302
1302
|
const M = {
|
|
1303
1303
|
pages: R(
|
|
1304
1304
|
c.map((g) => {
|
|
1305
|
-
const T =
|
|
1305
|
+
const T = e.pages[g];
|
|
1306
1306
|
return T && { id: g, slug: T.slug };
|
|
1307
1307
|
})
|
|
1308
1308
|
),
|
|
1309
1309
|
routes: R(
|
|
1310
1310
|
p.map((g) => {
|
|
1311
|
-
const T =
|
|
1311
|
+
const T = e.routes[g];
|
|
1312
1312
|
return T && { id: g, path: T.path };
|
|
1313
1313
|
})
|
|
1314
1314
|
),
|
|
1315
1315
|
components: R(
|
|
1316
1316
|
d.map((g) => {
|
|
1317
1317
|
var C;
|
|
1318
|
-
const T = (C =
|
|
1318
|
+
const T = (C = e.components[g]) == null ? void 0 : C.data;
|
|
1319
1319
|
return T && {
|
|
1320
1320
|
id: g,
|
|
1321
1321
|
name: T.name
|
|
@@ -1325,47 +1325,47 @@ async function Hs(t, {
|
|
|
1325
1325
|
...r ? {
|
|
1326
1326
|
resources: {
|
|
1327
1327
|
components: R(
|
|
1328
|
-
Object.keys(((S =
|
|
1329
|
-
var T, C,
|
|
1328
|
+
Object.keys(((S = e.resources) == null ? void 0 : S.components) || {}).filter((g) => d.includes(g)).map((g) => {
|
|
1329
|
+
var T, C, J, G;
|
|
1330
1330
|
return {
|
|
1331
1331
|
id: g,
|
|
1332
|
-
name: (G = (
|
|
1332
|
+
name: (G = (J = (C = (T = e.resources) == null ? void 0 : T.components) == null ? void 0 : C[g]) == null ? void 0 : J.component) == null ? void 0 : G.name
|
|
1333
1333
|
};
|
|
1334
1334
|
})
|
|
1335
1335
|
)
|
|
1336
1336
|
}
|
|
1337
1337
|
} : {},
|
|
1338
|
-
supportedLocales:
|
|
1339
|
-
config:
|
|
1338
|
+
supportedLocales: e.supportedLocales,
|
|
1339
|
+
config: e.config
|
|
1340
1340
|
};
|
|
1341
|
-
|
|
1342
|
-
const
|
|
1343
|
-
if (o &&
|
|
1341
|
+
ye(N, Z.stringify(M));
|
|
1342
|
+
const pe = O(m, "config.source.json");
|
|
1343
|
+
if (o && ye(pe, JSON.stringify(o)), r) {
|
|
1344
1344
|
const g = O(m, "resources"), T = O(g, "components");
|
|
1345
|
-
|
|
1346
|
-
for (const G of Object.keys(((f =
|
|
1345
|
+
H(T, { recursive: !0 });
|
|
1346
|
+
for (const G of Object.keys(((f = e == null ? void 0 : e.resources) == null ? void 0 : f.components) ?? {}).filter(
|
|
1347
1347
|
($) => d.includes($)
|
|
1348
1348
|
)) {
|
|
1349
|
-
const $ = (z = (v = (E =
|
|
1350
|
-
$ && await
|
|
1349
|
+
const $ = (z = (v = (E = e.resources) == null ? void 0 : E.components) == null ? void 0 : v[G]) == null ? void 0 : z.component;
|
|
1350
|
+
$ && await fe($, T, {
|
|
1351
1351
|
getFilename: (W) => `${W.name || "unnamed"}.${W.id}.yml`,
|
|
1352
1352
|
exportAssets: s
|
|
1353
1353
|
});
|
|
1354
1354
|
}
|
|
1355
1355
|
const C = O(m, "chunks");
|
|
1356
|
-
|
|
1357
|
-
const { chunks:
|
|
1358
|
-
for (const G of Object.keys(((P =
|
|
1356
|
+
H(C, { recursive: !0 });
|
|
1357
|
+
const { chunks: J } = await Ge();
|
|
1358
|
+
for (const G of Object.keys(((P = e == null ? void 0 : e.resources) == null ? void 0 : P.components) ?? {}).filter(
|
|
1359
1359
|
($) => d.includes($)
|
|
1360
1360
|
)) {
|
|
1361
|
-
const $ = (
|
|
1362
|
-
if ($ && ((
|
|
1363
|
-
const W = ((
|
|
1361
|
+
const $ = (le = (Y = (U = e.resources) == null ? void 0 : U.components) == null ? void 0 : Y[G]) == null ? void 0 : le.component;
|
|
1362
|
+
if ($ && ((re = $.renderer) == null ? void 0 : re.type) === "react-component") {
|
|
1363
|
+
const W = ((de = $.renderer) == null ? void 0 : de.chunks) ?? [];
|
|
1364
1364
|
if ((W == null ? void 0 : W.length) > 0)
|
|
1365
1365
|
for (const ve of W) {
|
|
1366
|
-
const
|
|
1366
|
+
const He = O(C, ve), Pe = J == null ? void 0 : J[ve];
|
|
1367
1367
|
try {
|
|
1368
|
-
Pe && F(Pe) && !F(
|
|
1368
|
+
Pe && F(Pe) && !F(He) && Bt(Pe, He);
|
|
1369
1369
|
} catch (yt) {
|
|
1370
1370
|
b.error(`copy chunk ${ve} error`, yt.message);
|
|
1371
1371
|
}
|
|
@@ -1375,13 +1375,13 @@ async function Hs(t, {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
return m;
|
|
1377
1377
|
}
|
|
1378
|
-
async function mt(
|
|
1378
|
+
async function mt(e, { importAssets: s, includeResources: t } = {}) {
|
|
1379
1379
|
var r, l, c, d;
|
|
1380
|
-
if (!F(
|
|
1380
|
+
if (!F(e))
|
|
1381
1381
|
return null;
|
|
1382
1382
|
let n, o = !1;
|
|
1383
1383
|
try {
|
|
1384
|
-
Q(
|
|
1384
|
+
Q(e).isDirectory() ? n = e : /\.(tgz|gz|tar)$/.test(e) && (o = !0, n = dt(), await os({ file: e, C: n }));
|
|
1385
1385
|
const p = ke("**/.blocklet/pages/pages.config.yml", { cwd: n, absolute: !0 }).at(0), u = p && O(_(p), "../../pages"), y = p && O(_(p), "../../components"), h = p && O(_(p), "../../chunks"), a = p && O(_(p), "../../routes");
|
|
1386
1386
|
if (!p)
|
|
1387
1387
|
return null;
|
|
@@ -1404,7 +1404,7 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1404
1404
|
var z;
|
|
1405
1405
|
const f = R(
|
|
1406
1406
|
i.supportedLocales.map(({ locale: P }) => {
|
|
1407
|
-
const U = u ? m(u,
|
|
1407
|
+
const U = u ? m(u, Ie(S), P) : void 0;
|
|
1408
1408
|
if (U)
|
|
1409
1409
|
return { locale: P, page: U };
|
|
1410
1410
|
const Y = u ? m(u, S, P) : void 0;
|
|
@@ -1426,9 +1426,9 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1426
1426
|
visibility: P.visibility,
|
|
1427
1427
|
locales: Object.fromEntries(
|
|
1428
1428
|
R(
|
|
1429
|
-
f.map(({ locale: Y, page:
|
|
1430
|
-
const
|
|
1431
|
-
return
|
|
1429
|
+
f.map(({ locale: Y, page: le }) => {
|
|
1430
|
+
const re = le.sections.find((de) => de.id === U);
|
|
1431
|
+
return re && [Y, re.properties];
|
|
1432
1432
|
})
|
|
1433
1433
|
)
|
|
1434
1434
|
)
|
|
@@ -1449,7 +1449,7 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1449
1449
|
})
|
|
1450
1450
|
), N = R(
|
|
1451
1451
|
((r = i == null ? void 0 : i.routes) == null ? void 0 : r.map(({ path: S }) => {
|
|
1452
|
-
const f = a ? D(a,
|
|
1452
|
+
const f = a ? D(a, Ie(S)) : void 0;
|
|
1453
1453
|
return {
|
|
1454
1454
|
...f,
|
|
1455
1455
|
id: (f == null ? void 0 : f.id) || xe(),
|
|
@@ -1468,7 +1468,7 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1468
1468
|
), M = y ? R(((l = i.components) == null ? void 0 : l.map(({ id: S }) => w(y, S))) ?? []) : [];
|
|
1469
1469
|
if (s) {
|
|
1470
1470
|
const S = (...f) => {
|
|
1471
|
-
b.info(`[${o ?
|
|
1471
|
+
b.info(`[${o ? ne(e) : ne(O(e, "../../../../"))}] importAssets:`, ...f);
|
|
1472
1472
|
};
|
|
1473
1473
|
try {
|
|
1474
1474
|
S("wait image-bin api ready"), await rs({
|
|
@@ -1497,20 +1497,20 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1497
1497
|
S("Error during asset import:", f);
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1500
|
+
const pe = {};
|
|
1501
|
+
if (t) {
|
|
1502
1502
|
const S = p && O(_(p), "../../resources/components"), f = R(
|
|
1503
1503
|
((d = (c = i.resources) == null ? void 0 : c.components) == null ? void 0 : d.map(({ id: E }) => w(S, E))) ?? []
|
|
1504
1504
|
);
|
|
1505
|
-
f.length > 0 && (
|
|
1505
|
+
f.length > 0 && (pe.components = Object.fromEntries(
|
|
1506
1506
|
f.map((E, v) => [E.id, { index: v, component: E }])
|
|
1507
1507
|
));
|
|
1508
1508
|
}
|
|
1509
|
-
const
|
|
1509
|
+
const oe = {};
|
|
1510
1510
|
if (h && F(h)) {
|
|
1511
1511
|
const S = Ft(h);
|
|
1512
1512
|
for (const f of S)
|
|
1513
|
-
|
|
1513
|
+
oe[f] = O(h, f);
|
|
1514
1514
|
}
|
|
1515
1515
|
return {
|
|
1516
1516
|
supportedLocales: i.supportedLocales,
|
|
@@ -1518,8 +1518,8 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1518
1518
|
components: Object.fromEntries(M.map((S, f) => [S.id, { index: f, data: S }])),
|
|
1519
1519
|
pages: Object.fromEntries(A.map((S) => [S.id, S])),
|
|
1520
1520
|
config: i.config || {},
|
|
1521
|
-
resources:
|
|
1522
|
-
chunks:
|
|
1521
|
+
resources: pe,
|
|
1522
|
+
chunks: oe,
|
|
1523
1523
|
routeIds: N.map((S) => S.id),
|
|
1524
1524
|
routes: Object.fromEntries(N.map((S) => [S.id, S])),
|
|
1525
1525
|
dataSourceIds: [],
|
|
@@ -1529,8 +1529,8 @@ async function mt(t, { importAssets: s, includeResources: e } = {}) {
|
|
|
1529
1529
|
o && n && rt(n, { force: !0, recursive: !0 });
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
|
-
async function st(
|
|
1533
|
-
routes:
|
|
1532
|
+
async function st(e, s, {
|
|
1533
|
+
routes: t,
|
|
1534
1534
|
mergeMode: n = "byUpdateTime",
|
|
1535
1535
|
deleteRoutes: o = !1,
|
|
1536
1536
|
publishMode: r = void 0
|
|
@@ -1540,9 +1540,9 @@ async function st(t, s, {
|
|
|
1540
1540
|
} catch (h) {
|
|
1541
1541
|
b.error("clear preload page cache error", { error: h });
|
|
1542
1542
|
}
|
|
1543
|
-
const { pages: l, pageIds: c, routeIds: d, routes: p, supportedLocales: u } =
|
|
1543
|
+
const { pages: l, pageIds: c, routeIds: d, routes: p, supportedLocales: u } = e;
|
|
1544
1544
|
if (r === "production") {
|
|
1545
|
-
let h =
|
|
1545
|
+
let h = t ?? [], a = null;
|
|
1546
1546
|
for (const i of d ?? []) {
|
|
1547
1547
|
const m = p == null ? void 0 : p[i];
|
|
1548
1548
|
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) {
|
|
@@ -1556,8 +1556,8 @@ async function st(t, s, {
|
|
|
1556
1556
|
currentOptionIds: [],
|
|
1557
1557
|
result: []
|
|
1558
1558
|
}), D = Object.fromEntries(w.map((A) => [`${i}-${A.paramOptionIds.join("-")}`, A]));
|
|
1559
|
-
a = { ...a || {}, ...D },
|
|
1560
|
-
} else
|
|
1559
|
+
a = { ...a || {}, ...D }, t || (h = [...h, ...w.map((A) => `${i}-${A.paramOptionIds.join("-")}`)]);
|
|
1560
|
+
} else t || h.push(i);
|
|
1561
1561
|
}
|
|
1562
1562
|
b.info("routeIds to be published: ", h);
|
|
1563
1563
|
for (const i of h) {
|
|
@@ -1594,7 +1594,7 @@ async function st(t, s, {
|
|
|
1594
1594
|
s.pages[i] = De({
|
|
1595
1595
|
page: D,
|
|
1596
1596
|
route: w,
|
|
1597
|
-
state:
|
|
1597
|
+
state: e,
|
|
1598
1598
|
routeId: i,
|
|
1599
1599
|
routePathInfo: a == null ? void 0 : a[i]
|
|
1600
1600
|
}), b.info("replace page", i);
|
|
@@ -1603,7 +1603,7 @@ async function st(t, s, {
|
|
|
1603
1603
|
(!A || w.updatedAt && w.updatedAt > A.updatedAt) && (s.pages[i] = De({
|
|
1604
1604
|
page: D,
|
|
1605
1605
|
route: w,
|
|
1606
|
-
state:
|
|
1606
|
+
state: e,
|
|
1607
1607
|
routeId: i,
|
|
1608
1608
|
routePathInfo: a == null ? void 0 : a[i]
|
|
1609
1609
|
}), b.info("replace page by update time", i));
|
|
@@ -1612,12 +1612,12 @@ async function st(t, s, {
|
|
|
1612
1612
|
s.pageIds.push(i), s.pages[i] = De({
|
|
1613
1613
|
page: D,
|
|
1614
1614
|
route: w,
|
|
1615
|
-
state:
|
|
1615
|
+
state: e,
|
|
1616
1616
|
routeId: i,
|
|
1617
1617
|
routePathInfo: a == null ? void 0 : a[i]
|
|
1618
1618
|
}), b.info("add page", i);
|
|
1619
1619
|
}
|
|
1620
|
-
if (o && !
|
|
1620
|
+
if (o && !t)
|
|
1621
1621
|
for (const i of s.pageIds)
|
|
1622
1622
|
h != null && h.includes(i) || (delete s.pages[i], b.info("delete page", i)), s.pageIds = [...s.pageIds].filter((m) => h == null ? void 0 : h.includes(m));
|
|
1623
1623
|
} else {
|
|
@@ -1651,7 +1651,7 @@ async function st(t, s, {
|
|
|
1651
1651
|
if (s.supportedLocales.splice(0, s.supportedLocales.length), s.supportedLocales.push(...Qt(u)), o)
|
|
1652
1652
|
for (const h of Object.keys(s.components))
|
|
1653
1653
|
delete s.components[h];
|
|
1654
|
-
let y = JSON.parse(JSON.stringify(
|
|
1654
|
+
let y = JSON.parse(JSON.stringify(e.components));
|
|
1655
1655
|
y = Object.fromEntries(
|
|
1656
1656
|
await Promise.all(
|
|
1657
1657
|
Object.entries(y).map(async ([h, a]) => {
|
|
@@ -1665,35 +1665,45 @@ async function st(t, s, {
|
|
|
1665
1665
|
];
|
|
1666
1666
|
})
|
|
1667
1667
|
)
|
|
1668
|
-
), Object.assign(s.components, y), Object.assign(s.config, JSON.parse(JSON.stringify(
|
|
1668
|
+
), Object.assign(s.components, y), Object.assign(s.config, JSON.parse(JSON.stringify(e.config))), s.resources.components = JSON.parse(JSON.stringify(e.resources.components || {}));
|
|
1669
1669
|
}
|
|
1670
|
-
const ft =
|
|
1671
|
-
async (
|
|
1670
|
+
const ft = Oe(
|
|
1671
|
+
async (e) => {
|
|
1672
1672
|
var s;
|
|
1673
|
-
if (!Xt(
|
|
1674
|
-
return
|
|
1675
|
-
if (((s =
|
|
1676
|
-
const { script:
|
|
1677
|
-
if (
|
|
1673
|
+
if (!Xt(e == null ? void 0 : e.properties))
|
|
1674
|
+
return e;
|
|
1675
|
+
if (((s = e == null ? void 0 : e.renderer) == null ? void 0 : s.type) === "react-component") {
|
|
1676
|
+
const { script: t } = (e == null ? void 0 : e.renderer) || {};
|
|
1677
|
+
if (t && t.includes("PROPERTIES_SCHEMA"))
|
|
1678
1678
|
try {
|
|
1679
|
-
const n = await xs(
|
|
1680
|
-
n && n.length > 0 &&
|
|
1681
|
-
|
|
1679
|
+
const n = await xs(t, "PROPERTIES_SCHEMA", e.id);
|
|
1680
|
+
n && n.length > 0 && e && (e.properties = {}, n.forEach((o, r) => {
|
|
1681
|
+
e != null && e.properties && (e.properties[o.id] = {
|
|
1682
1682
|
index: r,
|
|
1683
1683
|
data: o
|
|
1684
1684
|
});
|
|
1685
1685
|
}));
|
|
1686
1686
|
} catch (n) {
|
|
1687
|
-
b.error("checkPropertiesFromCode error", { componentId:
|
|
1687
|
+
b.error("checkPropertiesFromCode error", { componentId: e.id, name: e.name }, { error: n });
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
1690
|
-
return
|
|
1690
|
+
return e;
|
|
1691
1691
|
},
|
|
1692
1692
|
{
|
|
1693
|
-
keyGenerator: (
|
|
1694
|
-
var
|
|
1695
|
-
const s = (
|
|
1696
|
-
|
|
1693
|
+
keyGenerator: (e) => {
|
|
1694
|
+
var p, u, y, h;
|
|
1695
|
+
const s = (e == null ? void 0 : e.id) || "", t = (e == null ? void 0 : e.name) || "", n = ((p = e == null ? void 0 : e.renderer) == null ? void 0 : p.type) || "", o = (e == null ? void 0 : e.properties) || {}, r = (e == null ? void 0 : e.updatedAt) || "", l = te("md5").update(JSON.stringify(o)).digest("hex");
|
|
1696
|
+
let c = "", d = "";
|
|
1697
|
+
return ((u = e == null ? void 0 : e.renderer) == null ? void 0 : u.type) === "react-component" && (c = te("md5").update(((y = e == null ? void 0 : e.renderer) == null ? void 0 : y.script) || "").digest("hex"), d = te("md5").update(((h = e == null ? void 0 : e.renderer) == null ? void 0 : h.editComponent) || "").digest("hex")), JSON.stringify([
|
|
1698
|
+
"checkPropertiesFromCode",
|
|
1699
|
+
s,
|
|
1700
|
+
t,
|
|
1701
|
+
n,
|
|
1702
|
+
l,
|
|
1703
|
+
r,
|
|
1704
|
+
c,
|
|
1705
|
+
d
|
|
1706
|
+
]);
|
|
1697
1707
|
},
|
|
1698
1708
|
lruOptions: {
|
|
1699
1709
|
max: 100,
|
|
@@ -1701,23 +1711,23 @@ const ft = Ae(
|
|
|
1701
1711
|
}
|
|
1702
1712
|
}
|
|
1703
1713
|
);
|
|
1704
|
-
let
|
|
1714
|
+
let Ae, ee, $e, Fe, Be;
|
|
1705
1715
|
function gt() {
|
|
1706
|
-
return
|
|
1707
|
-
const
|
|
1716
|
+
return Ae = (async () => {
|
|
1717
|
+
const e = Lt({
|
|
1708
1718
|
types: [
|
|
1709
1719
|
{ did: lt, type: Xe },
|
|
1710
1720
|
{ did: ks, type: Xe }
|
|
1711
1721
|
]
|
|
1712
1722
|
});
|
|
1713
1723
|
ee = (await Promise.all(
|
|
1714
|
-
|
|
1715
|
-
const n =
|
|
1716
|
-
return n ? { blockletId:
|
|
1724
|
+
e.map(async (t) => {
|
|
1725
|
+
const n = t.path ? await mt(t.path, { importAssets: !1 }) : void 0;
|
|
1726
|
+
return n ? { blockletId: t.did, state: n, blockletTitle: t.title } : void 0;
|
|
1717
1727
|
})
|
|
1718
|
-
)).filter((
|
|
1719
|
-
(
|
|
1720
|
-
|
|
1728
|
+
)).filter((t) => !!t), $e = ee.reduce(
|
|
1729
|
+
(t, n) => Object.assign(
|
|
1730
|
+
t,
|
|
1721
1731
|
Object.fromEntries(
|
|
1722
1732
|
Object.values(n.state.pages).map((o) => o ? [o == null ? void 0 : o.id, { page: o, blockletId: n.blockletId }] : [])
|
|
1723
1733
|
)
|
|
@@ -1725,8 +1735,8 @@ function gt() {
|
|
|
1725
1735
|
{}
|
|
1726
1736
|
);
|
|
1727
1737
|
const s = ee.reduce(
|
|
1728
|
-
(
|
|
1729
|
-
|
|
1738
|
+
(t, n) => Object.assign(
|
|
1739
|
+
t,
|
|
1730
1740
|
Object.fromEntries(
|
|
1731
1741
|
Object.values(n.state.components).map((o) => [o.data.id, { blockletId: n.blockletId, component: o.data }])
|
|
1732
1742
|
)
|
|
@@ -1735,10 +1745,10 @@ function gt() {
|
|
|
1735
1745
|
);
|
|
1736
1746
|
Fe = Object.fromEntries(
|
|
1737
1747
|
await Promise.all(
|
|
1738
|
-
Object.entries(s).map(async ([
|
|
1748
|
+
Object.entries(s).map(async ([t, n]) => {
|
|
1739
1749
|
const o = await ft(n.component);
|
|
1740
1750
|
return [
|
|
1741
|
-
|
|
1751
|
+
t,
|
|
1742
1752
|
{
|
|
1743
1753
|
...n,
|
|
1744
1754
|
component: o
|
|
@@ -1746,15 +1756,15 @@ function gt() {
|
|
|
1746
1756
|
];
|
|
1747
1757
|
})
|
|
1748
1758
|
)
|
|
1749
|
-
), Be = ee.reduce((
|
|
1750
|
-
})(),
|
|
1759
|
+
), Be = ee.reduce((t, n) => Object.assign(t, n.state.chunks), {});
|
|
1760
|
+
})(), Ae;
|
|
1751
1761
|
}
|
|
1752
|
-
function Ks(
|
|
1762
|
+
function Ks(e) {
|
|
1753
1763
|
const s = at(
|
|
1754
1764
|
async () => {
|
|
1755
|
-
await gt().catch((
|
|
1756
|
-
b.error("load resource states error", { error:
|
|
1757
|
-
}), await (
|
|
1765
|
+
await gt().catch((t) => {
|
|
1766
|
+
b.error("load resource states error", { error: t });
|
|
1767
|
+
}), await (e == null ? void 0 : e({
|
|
1758
1768
|
states: ee,
|
|
1759
1769
|
pages: $e,
|
|
1760
1770
|
components: Fe,
|
|
@@ -1769,21 +1779,21 @@ function Ks(t) {
|
|
|
1769
1779
|
I.events.off(I.Events.componentAdded, s), I.events.off(I.Events.componentRemoved, s), I.events.off(I.Events.componentStarted, s), I.events.off(I.Events.componentStopped, s), I.events.off(I.Events.componentUpdated, s), I.events.off(Ne, s);
|
|
1770
1780
|
};
|
|
1771
1781
|
}
|
|
1772
|
-
const ht = Symbol.for("GLOBAL_RESOURCE_STATES_LISTENER_KEY"),
|
|
1782
|
+
const ht = Symbol.for("GLOBAL_RESOURCE_STATES_LISTENER_KEY"), he = globalThis;
|
|
1773
1783
|
var nt;
|
|
1774
|
-
(nt =
|
|
1775
|
-
|
|
1776
|
-
const { projectIds:
|
|
1777
|
-
b.info(`start update resource states projects(${
|
|
1784
|
+
(nt = he[ht]) == null || nt.call(he);
|
|
1785
|
+
he[ht] = Ks(async ({ pages: e, components: s }) => {
|
|
1786
|
+
const { projectIds: t } = Ee;
|
|
1787
|
+
b.info(`start update resource states projects(${t.length})`, t), await Promise.race([
|
|
1778
1788
|
new Promise((n) => {
|
|
1779
1789
|
setTimeout(() => {
|
|
1780
1790
|
n({});
|
|
1781
1791
|
}, 30 * 1e3);
|
|
1782
1792
|
}),
|
|
1783
1793
|
Promise.all(
|
|
1784
|
-
|
|
1785
|
-
const o =
|
|
1786
|
-
o.syncedStore.resources.pages =
|
|
1794
|
+
t.map(async (n) => {
|
|
1795
|
+
const o = Ee.shared(n);
|
|
1796
|
+
o.syncedStore.resources.pages = e;
|
|
1787
1797
|
const r = await q.findByPk(n);
|
|
1788
1798
|
if (r != null && r.useAllResources)
|
|
1789
1799
|
o.syncedStore.resources.components = s;
|
|
@@ -1803,20 +1813,20 @@ ge[ht] = Ks(async ({ pages: t, components: s }) => {
|
|
|
1803
1813
|
b.error("update resource states failed:", n);
|
|
1804
1814
|
});
|
|
1805
1815
|
});
|
|
1806
|
-
async function
|
|
1816
|
+
async function Jn() {
|
|
1807
1817
|
b.info("trigger reload all project resource"), I.events.emit(Ne);
|
|
1808
1818
|
}
|
|
1809
1819
|
async function Ge({
|
|
1810
|
-
ensureLoaded:
|
|
1820
|
+
ensureLoaded: e = !0
|
|
1811
1821
|
} = {}) {
|
|
1812
|
-
return
|
|
1822
|
+
return e && (Ae ?? (Ae = gt()), await Ae), { states: ee, pages: $e, components: Fe, chunks: Be };
|
|
1813
1823
|
}
|
|
1814
1824
|
export {
|
|
1815
1825
|
lt as C,
|
|
1816
1826
|
Qe as G,
|
|
1817
1827
|
q as P,
|
|
1818
1828
|
Xe as R,
|
|
1819
|
-
|
|
1829
|
+
Ee as S,
|
|
1820
1830
|
$n as a,
|
|
1821
1831
|
Ge as b,
|
|
1822
1832
|
Es as c,
|
|
@@ -1826,19 +1836,19 @@ export {
|
|
|
1826
1836
|
Fn as g,
|
|
1827
1837
|
vs as h,
|
|
1828
1838
|
Un as i,
|
|
1829
|
-
|
|
1839
|
+
Se as j,
|
|
1830
1840
|
Bn as k,
|
|
1831
1841
|
b as l,
|
|
1832
1842
|
xs as m,
|
|
1833
1843
|
xe as n,
|
|
1834
|
-
|
|
1844
|
+
me as o,
|
|
1835
1845
|
Gn as p,
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1846
|
+
Hn as q,
|
|
1847
|
+
Hs as r,
|
|
1848
|
+
Js as s,
|
|
1849
|
+
Vs as t,
|
|
1840
1850
|
mt as u,
|
|
1841
1851
|
st as v,
|
|
1842
1852
|
Ks as w,
|
|
1843
|
-
|
|
1853
|
+
Jn as x
|
|
1844
1854
|
};
|