@wix/himalaya-cli 0.1430.0 → 0.1431.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/data-resources/src/base44/ownership.d.ts +38 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/data-resources/src/base44/schema.d.ts +65 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/data-resources/src/schema.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/base44-entities.d.ts +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +12 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +209 -26
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/data-resources.mjs +184 -1
- package/dist/cli.mjs +1245 -620
- package/guides/base44-app-to-himi-app.md +19 -1
- package/guides/base44-entities.md +150 -0
- package/guides/himi-json-output.md +30 -0
- package/guides/index.json +6 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -212,6 +212,187 @@ var init_config = __esm({
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
+
// ../../core/data-resources/src/base44/schema.ts
|
|
216
|
+
var BASE44_FIELD_TYPES, BASE44_STRING_FORMATS, BASE44_BUILTIN_FIELDS;
|
|
217
|
+
var init_schema = __esm({
|
|
218
|
+
"../../core/data-resources/src/base44/schema.ts"() {
|
|
219
|
+
BASE44_FIELD_TYPES = ["string", "number", "integer", "boolean", "array", "object"];
|
|
220
|
+
BASE44_STRING_FORMATS = ["date", "date-time", "time", "email", "uri", "uuid", "file", "richtext"];
|
|
221
|
+
BASE44_BUILTIN_FIELDS = ["id", "created_date", "updated_date", "created_by", "created_by_id"];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ../../core/data-resources/src/base44/ownership.ts
|
|
226
|
+
function base44Prefix(app) {
|
|
227
|
+
const runs = app.match(/[A-Za-z0-9]+/g) ?? [];
|
|
228
|
+
return `Himi${runs.map((r2) => r2.charAt(0).toUpperCase() + r2.slice(1)).join("")}`;
|
|
229
|
+
}
|
|
230
|
+
function nonEmpty(value) {
|
|
231
|
+
return typeof value === "string" && value.trim() !== "";
|
|
232
|
+
}
|
|
233
|
+
function isAdoptedEntity(spec) {
|
|
234
|
+
return nonEmpty(spec.base44Name);
|
|
235
|
+
}
|
|
236
|
+
function isOwnedEntity(spec) {
|
|
237
|
+
return !isAdoptedEntity(spec) && nonEmpty(spec.name);
|
|
238
|
+
}
|
|
239
|
+
function physicalEntityName(spec, app) {
|
|
240
|
+
if (isAdoptedEntity(spec)) return spec.base44Name;
|
|
241
|
+
return nonEmpty(spec.name) ? `${base44Prefix(app)}${spec.name}` : "";
|
|
242
|
+
}
|
|
243
|
+
function physicalFunctionName(spec) {
|
|
244
|
+
return nonEmpty(spec.base44Name) ? spec.base44Name : nonEmpty(spec.name) ? spec.name : "";
|
|
245
|
+
}
|
|
246
|
+
function label(spec) {
|
|
247
|
+
if (nonEmpty(spec.base44Name)) return spec.base44Name;
|
|
248
|
+
if (nonEmpty(spec.name)) return spec.name;
|
|
249
|
+
return "<unnamed>";
|
|
250
|
+
}
|
|
251
|
+
function userScoped(rule) {
|
|
252
|
+
if (rule === void 0) return false;
|
|
253
|
+
try {
|
|
254
|
+
return (JSON.stringify(rule) ?? "").includes("{{user.");
|
|
255
|
+
} catch {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function validateBase44Entities(cfg, app) {
|
|
260
|
+
if (!cfg) return [];
|
|
261
|
+
const issues = [];
|
|
262
|
+
const add = (severity, ruleCode, entity, message) => issues.push({ severity, ruleCode, message, ...entity !== void 0 ? { entity } : {} });
|
|
263
|
+
const err = (ruleCode, entity, message) => add("error", ruleCode, entity, message);
|
|
264
|
+
const prefix = base44Prefix(app);
|
|
265
|
+
const types = new Set(BASE44_FIELD_TYPES);
|
|
266
|
+
const formats = new Set(BASE44_STRING_FORMATS);
|
|
267
|
+
const builtins = new Set(BASE44_BUILTIN_FIELDS);
|
|
268
|
+
if (cfg.entities !== void 0 && !Array.isArray(cfg.entities)) err("shape-invalid", void 0, "base44.entities must be an array");
|
|
269
|
+
const seen = /* @__PURE__ */ new Set();
|
|
270
|
+
for (const raw of Array.isArray(cfg.entities) ? cfg.entities : []) {
|
|
271
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
272
|
+
err("shape-invalid", void 0, "every base44 entity declaration must be an object");
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const spec = raw;
|
|
276
|
+
const name = label(spec);
|
|
277
|
+
const rawName = spec.name;
|
|
278
|
+
const rawAdopted = spec.base44Name;
|
|
279
|
+
const hasName = rawName !== void 0;
|
|
280
|
+
const hasAdopted = rawAdopted !== void 0;
|
|
281
|
+
if (hasName && hasAdopted) {
|
|
282
|
+
err("entity-owned-and-adopted", name, "declare either `name` (owned) or `base44Name` (adopted), not both");
|
|
283
|
+
} else if (!hasName && !hasAdopted) {
|
|
284
|
+
err("entity-neither-owned-nor-adopted", name, "needs `name` (owned, namespaced) or `base44Name` (adopted, an entity the Base44 app already has)");
|
|
285
|
+
} else {
|
|
286
|
+
const value = hasName ? rawName : rawAdopted;
|
|
287
|
+
if (typeof value !== "string" || !ENTITY_NAME.test(value)) {
|
|
288
|
+
err("entity-name-invalid", name, `entity ${hasName ? "name" : "base44Name"} ${JSON.stringify(value)} must be alphanumeric and start with a letter \u2014 Base44 entity names allow nothing else`);
|
|
289
|
+
} else if (hasAdopted && value.startsWith(prefix)) {
|
|
290
|
+
err("adopted-in-owned-namespace", name, `adopted entity "${value}" starts with this app's owned prefix "${prefix}" \u2014 himi would treat a foreign entity as its own. Declare it with \`name\` if himi owns it, or rename it.`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const physical = physicalEntityName(spec, app);
|
|
294
|
+
if (physical) {
|
|
295
|
+
if (seen.has(physical)) err("entity-duplicate", name, `duplicate entity "${physical}"`);
|
|
296
|
+
seen.add(physical);
|
|
297
|
+
}
|
|
298
|
+
const keys = /* @__PURE__ */ new Set();
|
|
299
|
+
if (!Array.isArray(spec.fields)) {
|
|
300
|
+
err("shape-invalid", name, "`fields` must be an array");
|
|
301
|
+
} else {
|
|
302
|
+
for (const rawField of spec.fields) {
|
|
303
|
+
if (!rawField || typeof rawField !== "object" || Array.isArray(rawField)) {
|
|
304
|
+
err("shape-invalid", name, "every field declaration must be an object");
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const field = rawField;
|
|
308
|
+
if (typeof field.key !== "string" || !field.key) {
|
|
309
|
+
err("shape-invalid", name, "every field needs a string `key`");
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (builtins.has(field.key)) {
|
|
313
|
+
err("field-builtin", name, `field "${field.key}" is built in \u2014 Base44 adds ${BASE44_BUILTIN_FIELDS.join(", ")} to every row. Remove it from the declaration.`);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (keys.has(field.key)) err("field-duplicate", name, `duplicate field key "${field.key}"`);
|
|
317
|
+
keys.add(field.key);
|
|
318
|
+
if (!types.has(field.type)) err("field-type-unsupported", name, `field "${field.key}" has unsupported type ${JSON.stringify(field.type)} \u2014 supported: ${BASE44_FIELD_TYPES.join(", ")}`);
|
|
319
|
+
if (field.format !== void 0) {
|
|
320
|
+
if (field.type !== "string") err("field-format-invalid", name, `field "${field.key}" declares a format but only string fields take one`);
|
|
321
|
+
else if (!formats.has(field.format)) err("field-format-invalid", name, `field "${field.key}" has unsupported format ${JSON.stringify(field.format)} \u2014 supported: ${BASE44_STRING_FORMATS.join(", ")}`);
|
|
322
|
+
}
|
|
323
|
+
if (field.items !== void 0 && (field.type !== "array" || !types.has(field.items?.type))) {
|
|
324
|
+
err("field-type-unsupported", name, field.type !== "array" ? `field "${field.key}" declares \`items\` but only array fields take one` : `field "${field.key}" has unsupported items type ${JSON.stringify(field.items?.type)} \u2014 supported: ${BASE44_FIELD_TYPES.join(", ")}`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (spec.displayField !== void 0 && !keys.has(spec.displayField) && !builtins.has(spec.displayField)) {
|
|
329
|
+
err("display-field-unknown", name, `displayField "${spec.displayField}" is not one of the declared fields (${[...keys].join(", ") || "none"})`);
|
|
330
|
+
}
|
|
331
|
+
if (spec.required !== void 0) {
|
|
332
|
+
if (!Array.isArray(spec.required)) err("shape-invalid", name, "`required` must be an array of field keys");
|
|
333
|
+
else for (const key2 of spec.required) {
|
|
334
|
+
if (!keys.has(key2)) err("required-unknown", name, `required field "${key2}" is not declared`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (spec.seed !== void 0) {
|
|
338
|
+
if (hasAdopted) {
|
|
339
|
+
err("seed-on-adopted", name, "an adopted entity cannot declare `seed` \u2014 himi never writes to entities it does not own");
|
|
340
|
+
} else if (!Array.isArray(spec.seed)) {
|
|
341
|
+
err("shape-invalid", name, "seed must be an array of row objects");
|
|
342
|
+
} else {
|
|
343
|
+
spec.seed.forEach((row, index) => {
|
|
344
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) {
|
|
345
|
+
err("shape-invalid", name, `seed row ${index} must be an object`);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
for (const key2 of Object.keys(row)) {
|
|
349
|
+
if (!keys.has(key2)) err("seed-key-unknown", name, `seed row ${index} sets undeclared field "${key2}"`);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (userScoped(spec.rls?.read)) {
|
|
355
|
+
add("warning", "read-rule-user-scoped", name, "rls.read is scoped to the signed-in user ({{user.\u2026}}), so a signed-out viewer sees an empty list. Gate the screen behind a sign-in, or widen the read rule if the rows are public.");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (cfg.functions !== void 0 && !Array.isArray(cfg.functions)) err("shape-invalid", void 0, "base44.functions must be an array");
|
|
359
|
+
const seenFns = /* @__PURE__ */ new Set();
|
|
360
|
+
for (const raw of Array.isArray(cfg.functions) ? cfg.functions : []) {
|
|
361
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
362
|
+
err("shape-invalid", void 0, "every base44 function declaration must be an object");
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const spec = raw;
|
|
366
|
+
const name = label(spec);
|
|
367
|
+
const hasName = spec.name !== void 0;
|
|
368
|
+
const hasAdopted = spec.base44Name !== void 0;
|
|
369
|
+
if (hasName && hasAdopted) {
|
|
370
|
+
err("function-owned-and-adopted", name, "declare either `name` (owned) or `base44Name` (adopted), not both");
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (!hasName && !hasAdopted) {
|
|
374
|
+
err("function-neither-owned-nor-adopted", name, "needs `name` (owned, source under base44/functions/<name>/) or `base44Name` (adopted, an existing backend function)");
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const value = hasName ? spec.name : spec.base44Name;
|
|
378
|
+
if (typeof value !== "string" || !FUNCTION_NAME.test(value)) {
|
|
379
|
+
err("function-name-invalid", name, `function name ${JSON.stringify(value)} must be letters, digits, "-" or "_"`);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (seenFns.has(value)) err("function-duplicate", name, `duplicate function "${value}"`);
|
|
383
|
+
seenFns.add(value);
|
|
384
|
+
}
|
|
385
|
+
return issues;
|
|
386
|
+
}
|
|
387
|
+
var ENTITY_NAME, FUNCTION_NAME;
|
|
388
|
+
var init_ownership = __esm({
|
|
389
|
+
"../../core/data-resources/src/base44/ownership.ts"() {
|
|
390
|
+
init_schema();
|
|
391
|
+
ENTITY_NAME = /^[A-Za-z][A-Za-z0-9]*$/;
|
|
392
|
+
FUNCTION_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
215
396
|
// ../../core/data-resources/src/schema.ts
|
|
216
397
|
function provisionedKvSpec(spec) {
|
|
217
398
|
const metadata2 = { name: spec.name };
|
|
@@ -231,8 +412,9 @@ function mergeDataResources(input) {
|
|
|
231
412
|
};
|
|
232
413
|
}
|
|
233
414
|
var WIX_FIELD_TYPES, KV_DEFAULT_MAX_VALUE_BYTES, KV_MAX_VALUE_BYTES, KV_MAX_TTL_SECONDS;
|
|
234
|
-
var
|
|
415
|
+
var init_schema2 = __esm({
|
|
235
416
|
"../../core/data-resources/src/schema.ts"() {
|
|
417
|
+
init_ownership();
|
|
236
418
|
WIX_FIELD_TYPES = [
|
|
237
419
|
"TEXT",
|
|
238
420
|
"NUMBER",
|
|
@@ -287,7 +469,7 @@ function isOwned(spec, app) {
|
|
|
287
469
|
function physicalId(spec, _app) {
|
|
288
470
|
return adoptedId(spec) ?? (typeof spec.id === "string" ? spec.id : "");
|
|
289
471
|
}
|
|
290
|
-
function
|
|
472
|
+
function label2(spec) {
|
|
291
473
|
if (typeof spec.wixId === "string") return spec.wixId;
|
|
292
474
|
if (typeof spec.id === "string") return spec.id;
|
|
293
475
|
return "<unnamed>";
|
|
@@ -327,7 +509,7 @@ function validateCmsConfig(cms, app, opts = {}) {
|
|
|
327
509
|
continue;
|
|
328
510
|
}
|
|
329
511
|
const spec = rawSpec;
|
|
330
|
-
const name =
|
|
512
|
+
const name = label2(spec);
|
|
331
513
|
const rawId = spec.id;
|
|
332
514
|
if (rawId !== void 0 && (typeof rawId !== "string" || rawId.trim() === "")) {
|
|
333
515
|
err(name, "`id` must be a non-empty string");
|
|
@@ -476,9 +658,9 @@ function kvResourceKey(scope, store) {
|
|
|
476
658
|
return `${scopePrefix(scope)}kv/${encodeURIComponent(store)}`;
|
|
477
659
|
}
|
|
478
660
|
var WIX_COLLECTION_ID_MAX_LENGTH, SAFE_APP_ID, KV_NAME;
|
|
479
|
-
var
|
|
661
|
+
var init_ownership2 = __esm({
|
|
480
662
|
"../../core/data-resources/src/ownership.ts"() {
|
|
481
|
-
|
|
663
|
+
init_schema2();
|
|
482
664
|
WIX_COLLECTION_ID_MAX_LENGTH = 256;
|
|
483
665
|
SAFE_APP_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)?$/;
|
|
484
666
|
KV_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -592,7 +774,7 @@ async function retainedReleaseRefs(store, app, keepRecent = 20, keepReleaseIds =
|
|
|
592
774
|
var TEMPLATE_APP_PREFIX;
|
|
593
775
|
var init_store = __esm({
|
|
594
776
|
"../../core/serve-storage/src/store.ts"() {
|
|
595
|
-
|
|
777
|
+
init_ownership2();
|
|
596
778
|
init_wip_pointer();
|
|
597
779
|
TEMPLATE_APP_PREFIX = "himi-template-";
|
|
598
780
|
}
|
|
@@ -3523,9 +3705,9 @@ var init_preview_surfaces = __esm({
|
|
|
3523
3705
|
};
|
|
3524
3706
|
CAR_TEMPLATES = ["list"];
|
|
3525
3707
|
PROJECTION_SNAPSHOT_SIZE = "large";
|
|
3526
|
-
widgetSurface = (family,
|
|
3708
|
+
widgetSurface = (family, label3, width, height, platformKey = null) => ({
|
|
3527
3709
|
id: `widget:${family}`,
|
|
3528
|
-
label:
|
|
3710
|
+
label: label3,
|
|
3529
3711
|
chassis: "widget",
|
|
3530
3712
|
viewport: { width, height },
|
|
3531
3713
|
orientations: ["portrait"],
|
|
@@ -3738,7 +3920,7 @@ async function browserLogin(opts) {
|
|
|
3738
3920
|
const log = opts.log ?? (() => {
|
|
3739
3921
|
});
|
|
3740
3922
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
3741
|
-
return await new Promise((
|
|
3923
|
+
return await new Promise((resolve66, reject) => {
|
|
3742
3924
|
let settled = false;
|
|
3743
3925
|
let loginUrl = "";
|
|
3744
3926
|
const server = createServer();
|
|
@@ -3804,7 +3986,7 @@ async function browserLogin(opts) {
|
|
|
3804
3986
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", connection: "close" }).end(closePage(opts.doneTitle ?? "Signed in to himi"));
|
|
3805
3987
|
const extra = {};
|
|
3806
3988
|
for (const [k2, v2] of params) if (k2 !== "token" && k2 !== "state") extra[k2] = v2;
|
|
3807
|
-
finish2(() =>
|
|
3989
|
+
finish2(() => resolve66({ token, loginUrl, extra }));
|
|
3808
3990
|
});
|
|
3809
3991
|
});
|
|
3810
3992
|
server.on("error", (err) => finish2(() => reject(err)));
|
|
@@ -3860,7 +4042,7 @@ __export(cms_schema_exports, {
|
|
|
3860
4042
|
});
|
|
3861
4043
|
var init_cms_schema = __esm({
|
|
3862
4044
|
"src/cms-schema.ts"() {
|
|
3863
|
-
|
|
4045
|
+
init_ownership2();
|
|
3864
4046
|
}
|
|
3865
4047
|
});
|
|
3866
4048
|
|
|
@@ -3908,7 +4090,7 @@ async function accountToken(spawnImpl = spawn2) {
|
|
|
3908
4090
|
}
|
|
3909
4091
|
return await mintToken(["token"], "wix token", ACCOUNT_TOKEN_KEY, spawnImpl);
|
|
3910
4092
|
}
|
|
3911
|
-
async function mintToken(args,
|
|
4093
|
+
async function mintToken(args, label3, cacheKey, spawnImpl) {
|
|
3912
4094
|
const cached3 = tokenCache.get(cacheKey);
|
|
3913
4095
|
if (cached3) return cached3;
|
|
3914
4096
|
const fromEnv = process.env.WIX_TEST_TOKEN?.trim();
|
|
@@ -3916,12 +4098,12 @@ async function mintToken(args, label2, cacheKey, spawnImpl) {
|
|
|
3916
4098
|
tokenCache.set(cacheKey, fromEnv);
|
|
3917
4099
|
return fromEnv;
|
|
3918
4100
|
}
|
|
3919
|
-
const token = await new Promise((
|
|
4101
|
+
const token = await new Promise((resolve66, reject) => {
|
|
3920
4102
|
let child;
|
|
3921
4103
|
try {
|
|
3922
4104
|
child = spawnImpl("wix", [...args]);
|
|
3923
4105
|
} catch (e2) {
|
|
3924
|
-
reject(new Error(mintHelp(
|
|
4106
|
+
reject(new Error(mintHelp(label3, e2.message)));
|
|
3925
4107
|
return;
|
|
3926
4108
|
}
|
|
3927
4109
|
let out2 = "";
|
|
@@ -3938,23 +4120,23 @@ async function mintToken(args, label2, cacheKey, spawnImpl) {
|
|
|
3938
4120
|
};
|
|
3939
4121
|
const timer = setTimeout(
|
|
3940
4122
|
() => done(() => reject(new Error(
|
|
3941
|
-
`\`${
|
|
4123
|
+
`\`${label3}\` printed no OauthNG token within ${TOKEN_MINT_TIMEOUT_MS}ms. Is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
|
|
3942
4124
|
))),
|
|
3943
4125
|
TOKEN_MINT_TIMEOUT_MS
|
|
3944
4126
|
);
|
|
3945
4127
|
child.stdout?.on("data", (d2) => {
|
|
3946
4128
|
out2 += String(d2);
|
|
3947
4129
|
const m2 = out2.match(TOKEN_RE);
|
|
3948
|
-
if (m2) done(() =>
|
|
4130
|
+
if (m2) done(() => resolve66(m2[0]));
|
|
3949
4131
|
});
|
|
3950
4132
|
child.stderr?.on("data", (d2) => {
|
|
3951
4133
|
out2 += String(d2);
|
|
3952
4134
|
const m2 = out2.match(TOKEN_RE);
|
|
3953
|
-
if (m2) done(() =>
|
|
4135
|
+
if (m2) done(() => resolve66(m2[0]));
|
|
3954
4136
|
});
|
|
3955
|
-
child.on("error", (e2) => done(() => reject(new Error(mintHelp(
|
|
4137
|
+
child.on("error", (e2) => done(() => reject(new Error(mintHelp(label3, e2.message)))));
|
|
3956
4138
|
child.on("exit", (code) => done(() => reject(new Error(
|
|
3957
|
-
`\`${
|
|
4139
|
+
`\`${label3}\` exited (code ${code}) without printing an OauthNG token \u2014 is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
|
|
3958
4140
|
))));
|
|
3959
4141
|
});
|
|
3960
4142
|
tokenCache.set(cacheKey, token);
|
|
@@ -3966,8 +4148,8 @@ function redactForError(buf) {
|
|
|
3966
4148
|
return trimmed ? `Output (credentials redacted):
|
|
3967
4149
|
${trimmed.slice(0, 300)}` : "It printed nothing.";
|
|
3968
4150
|
}
|
|
3969
|
-
function mintHelp(
|
|
3970
|
-
return `could not run \`${
|
|
4151
|
+
function mintHelp(label3, detail) {
|
|
4152
|
+
return `could not run \`${label3}\` (${detail}). Install the Wix CLI and log in (\`npm i -g @wix/cli && wix login\`), or, with no browser, export WIX_API_KEY (manage.wix.com/account/api-keys).`;
|
|
3971
4153
|
}
|
|
3972
4154
|
function ownerTransport(msid, fetchImpl = fetch, timeoutMs = DEFAULT_TIMEOUT_MS2, mint = siteToken) {
|
|
3973
4155
|
return async (method, path2, body) => {
|
|
@@ -4005,7 +4187,7 @@ function ownerTransport(msid, fetchImpl = fetch, timeoutMs = DEFAULT_TIMEOUT_MS2
|
|
|
4005
4187
|
return parsed;
|
|
4006
4188
|
};
|
|
4007
4189
|
}
|
|
4008
|
-
async function withRetry(
|
|
4190
|
+
async function withRetry(label3, fn2, attempts = 3) {
|
|
4009
4191
|
let lastErr;
|
|
4010
4192
|
for (let i2 = 0; i2 < attempts; i2++) {
|
|
4011
4193
|
try {
|
|
@@ -4016,7 +4198,7 @@ async function withRetry(label2, fn2, attempts = 3) {
|
|
|
4016
4198
|
if (status && status !== 429 && status < 500) throw err;
|
|
4017
4199
|
if (i2 < attempts - 1) {
|
|
4018
4200
|
const backoff = 500 * 2 ** i2;
|
|
4019
|
-
console.warn(` \u21BB ${
|
|
4201
|
+
console.warn(` \u21BB ${label3} failed (${status || "network"}), retrying in ${backoff}ms`);
|
|
4020
4202
|
await new Promise((r2) => setTimeout(r2, backoff));
|
|
4021
4203
|
}
|
|
4022
4204
|
}
|
|
@@ -7733,12 +7915,12 @@ function resolveButtonTokens(tokens2, size, style) {
|
|
|
7733
7915
|
set("height", nonNegative(own(s2, "height")));
|
|
7734
7916
|
set("paddingH", nonNegative(own(s2, "paddingH")));
|
|
7735
7917
|
set("paddingV", nonNegative(own(s2, "paddingV")));
|
|
7736
|
-
set("text",
|
|
7918
|
+
set("text", nonEmpty2(own(s2, "text")));
|
|
7737
7919
|
set("icon", nonNegative(own(s2, "icon")));
|
|
7738
7920
|
set("radius", nonNegative(own(v2, "radius")) ?? nonNegative(own(s2, "radius")));
|
|
7739
|
-
set("fill",
|
|
7740
|
-
set("label",
|
|
7741
|
-
set("border",
|
|
7921
|
+
set("fill", nonEmpty2(own(v2, "fill")));
|
|
7922
|
+
set("label", nonEmpty2(own(v2, "label")));
|
|
7923
|
+
set("border", nonEmpty2(own(v2, "border")));
|
|
7742
7924
|
set("borderWidth", nonNegative(own(v2, "borderWidth")));
|
|
7743
7925
|
return out2;
|
|
7744
7926
|
}
|
|
@@ -7834,7 +8016,7 @@ function buttonVariant(style) {
|
|
|
7834
8016
|
return "text";
|
|
7835
8017
|
}
|
|
7836
8018
|
}
|
|
7837
|
-
var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA, BUTTON_MIN_HIT_TARGET, nonNegative,
|
|
8019
|
+
var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA, BUTTON_MIN_HIT_TARGET, nonNegative, nonEmpty2, own, COLOR_TOKEN_PROPS, TYPOGRAPHY_TOKEN_PROPS, BUTTON_VARIANTS;
|
|
7838
8020
|
var init_tokens = __esm({
|
|
7839
8021
|
"../../core/ts/src/tokens.ts"() {
|
|
7840
8022
|
"use strict";
|
|
@@ -7842,7 +8024,7 @@ var init_tokens = __esm({
|
|
|
7842
8024
|
TONAL_ELEVATION_ALPHA = [0, 0.05, 0.08, 0.11, 0.12, 0.14];
|
|
7843
8025
|
BUTTON_MIN_HIT_TARGET = 44;
|
|
7844
8026
|
nonNegative = (v2) => typeof v2 === "number" && Number.isFinite(v2) && v2 >= 0 ? v2 : void 0;
|
|
7845
|
-
|
|
8027
|
+
nonEmpty2 = (v2) => typeof v2 === "string" && v2 !== "" ? v2 : void 0;
|
|
7846
8028
|
own = (o2, k2) => o2 && typeof o2 === "object" && Object.prototype.hasOwnProperty.call(o2, k2) ? o2[k2] : void 0;
|
|
7847
8029
|
COLOR_TOKEN_PROPS = {
|
|
7848
8030
|
Badge: ["token"],
|
|
@@ -9290,14 +9472,14 @@ function collectDescriptorStrings(descriptor, options = {}) {
|
|
|
9290
9472
|
const props = body?.props;
|
|
9291
9473
|
if (type && props && typeof props === "object") {
|
|
9292
9474
|
const mapped = STRING_FIELDS_BY_TYPE[type] ?? [];
|
|
9293
|
-
for (const [
|
|
9475
|
+
for (const [prop2, v2] of Object.entries(props)) {
|
|
9294
9476
|
if (typeof v2 !== "string" || BINDING_SIGIL.test(v2)) continue;
|
|
9295
9477
|
if (!isCopy2(v2)) continue;
|
|
9296
|
-
const at2 = `${path2}.body.props.${
|
|
9297
|
-
if (mapped.includes(
|
|
9298
|
-
push({ value: v2, bucket: "reachable", type, prop, path: at2 });
|
|
9299
|
-
} else if (UNREACHED_VISIBLE_FIELDS.has(
|
|
9300
|
-
push({ value: v2, bucket: "unreached-prop", type, prop, path: at2 });
|
|
9478
|
+
const at2 = `${path2}.body.props.${prop2}`;
|
|
9479
|
+
if (mapped.includes(prop2) || SECONDARY_FIELDS.has(prop2)) {
|
|
9480
|
+
push({ value: v2, bucket: "reachable", type, prop: prop2, path: at2 });
|
|
9481
|
+
} else if (UNREACHED_VISIBLE_FIELDS.has(prop2)) {
|
|
9482
|
+
push({ value: v2, bucket: "unreached-prop", type, prop: prop2, path: at2 });
|
|
9301
9483
|
}
|
|
9302
9484
|
}
|
|
9303
9485
|
const templ = props.template;
|
|
@@ -9713,7 +9895,7 @@ var init_a11y_contract = __esm({
|
|
|
9713
9895
|
|
|
9714
9896
|
// ../../core/ts/src/schema.ts
|
|
9715
9897
|
var RICH_CONTENT_EDITOR_TOOLS;
|
|
9716
|
-
var
|
|
9898
|
+
var init_schema3 = __esm({
|
|
9717
9899
|
"../../core/ts/src/schema.ts"() {
|
|
9718
9900
|
RICH_CONTENT_EDITOR_TOOLS = ["bold", "italic", "underline", "heading", "bullet", "ordered", "quote", "link", "image", "divider", "undo", "redo"];
|
|
9719
9901
|
}
|
|
@@ -10628,10 +10810,10 @@ function makeInert() {
|
|
|
10628
10810
|
return inert;
|
|
10629
10811
|
};
|
|
10630
10812
|
const inert = new Proxy(fn2, {
|
|
10631
|
-
get: (_t2,
|
|
10632
|
-
if (
|
|
10633
|
-
if (
|
|
10634
|
-
if (
|
|
10813
|
+
get: (_t2, prop2) => {
|
|
10814
|
+
if (prop2 === "then") return void 0;
|
|
10815
|
+
if (prop2 === Symbol.toPrimitive) return () => "";
|
|
10816
|
+
if (prop2 === "toString" || prop2 === "valueOf") return () => "";
|
|
10635
10817
|
return inert;
|
|
10636
10818
|
},
|
|
10637
10819
|
apply: () => inert,
|
|
@@ -10700,7 +10882,7 @@ function runBundleSandbox(bundleJs, opts) {
|
|
|
10700
10882
|
}
|
|
10701
10883
|
};
|
|
10702
10884
|
const himalaya = new Proxy(himalayaTarget, {
|
|
10703
|
-
get: (t2,
|
|
10885
|
+
get: (t2, prop2) => prop2 in t2 ? t2[prop2] : inert
|
|
10704
10886
|
});
|
|
10705
10887
|
const mkConsole = () => {
|
|
10706
10888
|
const sink = (level) => (message) => {
|
|
@@ -10904,14 +11086,14 @@ async function bootBundleWorker(bundleJs, opts) {
|
|
|
10904
11086
|
// than the ambient one (`site.forSite(msid)` → `wix-site-id`), and a wrapper that drops
|
|
10905
11087
|
// it answers for the wrong business while every caller renders the result as correct.
|
|
10906
11088
|
call: (method, path2, body, headers2) => {
|
|
10907
|
-
const
|
|
10908
|
-
calls.push(
|
|
11089
|
+
const label3 = `${String(method)} ${String(path2)}`;
|
|
11090
|
+
calls.push(label3);
|
|
10909
11091
|
return Promise.resolve(opts.wixCall(method, path2, body, headers2)).then((value) => {
|
|
10910
11092
|
const bytes2 = responseBytes(value);
|
|
10911
11093
|
if (bytes2 > MAX_FRAME_MESSAGE_BYTES) {
|
|
10912
|
-
oversizeWixResponses.push({ call:
|
|
11094
|
+
oversizeWixResponses.push({ call: label3, bytes: bytes2 });
|
|
10913
11095
|
diagnose(
|
|
10914
|
-
`[web-bridge] ${
|
|
11096
|
+
`[web-bridge] ${label3} answered ${bytes2} bytes \u2014 over the web Tier-5 frame bridge's ${MAX_FRAME_MESSAGE_BYTES}-byte per-message ceiling, so on web it must be chunked across the bridge. This realm has no serialization boundary, which is why it passes here. Page or narrow the request if you can.`
|
|
10915
11097
|
);
|
|
10916
11098
|
}
|
|
10917
11099
|
return value;
|
|
@@ -10958,7 +11140,7 @@ async function bootBundleWorker(bundleJs, opts) {
|
|
|
10958
11140
|
return handle;
|
|
10959
11141
|
}
|
|
10960
11142
|
};
|
|
10961
|
-
const himalaya = new Proxy(himalayaTarget, { get: (t2,
|
|
11143
|
+
const himalaya = new Proxy(himalayaTarget, { get: (t2, prop2) => prop2 in t2 ? t2[prop2] : inert });
|
|
10962
11144
|
const timers = /* @__PURE__ */ new Set();
|
|
10963
11145
|
const sbSetTimeout = (fn2, ms2, ...args) => {
|
|
10964
11146
|
if (typeof fn2 !== "function") return 0;
|
|
@@ -11168,11 +11350,11 @@ async function bootBundleWorker(bundleJs, opts) {
|
|
|
11168
11350
|
if (typeof prev.error === "string") failed3.error = message;
|
|
11169
11351
|
def.state = failed3;
|
|
11170
11352
|
};
|
|
11171
|
-
const runAction = async (def,
|
|
11353
|
+
const runAction = async (def, label3, fn2, args) => {
|
|
11172
11354
|
let timer;
|
|
11173
11355
|
try {
|
|
11174
11356
|
const timeout = new Promise((_2, rej) => {
|
|
11175
|
-
timer = setTimeout(() => rej(new Error(`${
|
|
11357
|
+
timer = setTimeout(() => rej(new Error(`${label3} exceeded ${budgetMs}ms budget`)), budgetMs);
|
|
11176
11358
|
});
|
|
11177
11359
|
const next = await Promise.race([Promise.resolve(fn2(def.state, ...args)), timeout]);
|
|
11178
11360
|
applyResult(def, next);
|
|
@@ -11523,10 +11705,10 @@ function nativeRequiredFindings(descriptor) {
|
|
|
11523
11705
|
message: `${type}.${name} is REQUIRED by the native decoder but is missing \u2014 native decode rejects it ("Field '${name}' is required for type with serial name 'io.himalaya.core.${type}Props', but it was missing") and drops the WHOLE screen from the seed, while web renders it fine${hint}`
|
|
11524
11706
|
});
|
|
11525
11707
|
}
|
|
11526
|
-
for (const [
|
|
11527
|
-
const value = own3(bag,
|
|
11708
|
+
for (const [prop2, cls] of Object.entries(own3(NATIVE_NESTED_PROPS, type) ?? {})) {
|
|
11709
|
+
const value = own3(bag, prop2);
|
|
11528
11710
|
if (value === void 0 || value === null) continue;
|
|
11529
|
-
checkNested(value, cls, `${base}.${
|
|
11711
|
+
checkNested(value, cls, `${base}.${prop2}`, `${type}.${prop2}`);
|
|
11530
11712
|
}
|
|
11531
11713
|
}
|
|
11532
11714
|
if (body && typeof body === "object" && typeof body.type === "string" && typeof body.package === "string") {
|
|
@@ -12224,8 +12406,8 @@ function emptyStateFindings(descriptor) {
|
|
|
12224
12406
|
if (body?.package === "himalaya" && body.type === "EmptyState") {
|
|
12225
12407
|
const p2 = body.props ?? {};
|
|
12226
12408
|
const base = path2 ? `${path2}.body.props` : "body.props";
|
|
12227
|
-
const
|
|
12228
|
-
if (p2.action != null && (typeof
|
|
12409
|
+
const label3 = p2.actionLabel;
|
|
12410
|
+
if (p2.action != null && (typeof label3 !== "string" || label3.trim() === "")) {
|
|
12229
12411
|
out2.push({
|
|
12230
12412
|
path: `${base}.actionLabel`,
|
|
12231
12413
|
message: "EmptyState.action is set but EmptyState.actionLabel is missing. There is no default label: the renderers draw no button, so the action is unreachable. Set `actionLabel` to the button text (it is also the accessibility label), or remove `action`"
|
|
@@ -12913,7 +13095,7 @@ var init_validate_descriptor_core = __esm({
|
|
|
12913
13095
|
init_l10n_strings();
|
|
12914
13096
|
init_a11y_contract();
|
|
12915
13097
|
init_bindings();
|
|
12916
|
-
|
|
13098
|
+
init_schema3();
|
|
12917
13099
|
init_media_value();
|
|
12918
13100
|
init_frame_limits();
|
|
12919
13101
|
init_rich_content();
|
|
@@ -15767,12 +15949,12 @@ function installWebGlobals(ctx) {
|
|
|
15767
15949
|
ctx.setProp(ctx.global, "__himiSetUrlPart", setPart);
|
|
15768
15950
|
setPart.dispose();
|
|
15769
15951
|
const decoderInfo = ctx.newFunction("__himiDecoderInfo", (labelH) => {
|
|
15770
|
-
const
|
|
15952
|
+
const label3 = ctx.getString(labelH);
|
|
15771
15953
|
try {
|
|
15772
|
-
const d2 = new TextDecoder(
|
|
15954
|
+
const d2 = new TextDecoder(label3);
|
|
15773
15955
|
return ctx.newString(JSON.stringify({ encoding: d2.encoding }));
|
|
15774
15956
|
} catch (err) {
|
|
15775
|
-
return ctx.newString(JSON.stringify({ error: err?.message ?? `Invalid label: ${
|
|
15957
|
+
return ctx.newString(JSON.stringify({ error: err?.message ?? `Invalid label: ${label3}` }));
|
|
15776
15958
|
}
|
|
15777
15959
|
});
|
|
15778
15960
|
ctx.setProp(ctx.global, "__himiDecoderInfo", decoderInfo);
|
|
@@ -19368,9 +19550,9 @@ function renderableFamilies(catalog3 = loadCatalog()) {
|
|
|
19368
19550
|
function findFamily(name, catalog3 = loadCatalog()) {
|
|
19369
19551
|
const exact = catalog3.families[name] ?? catalog3.bundled[name];
|
|
19370
19552
|
if (exact) return exact;
|
|
19371
|
-
const
|
|
19372
|
-
if (!
|
|
19373
|
-
return catalog3.families[
|
|
19553
|
+
const canonical5 = familyIndex(catalog3).get(normalizeFamily(name));
|
|
19554
|
+
if (!canonical5) return void 0;
|
|
19555
|
+
return catalog3.families[canonical5] ?? catalog3.bundled[canonical5];
|
|
19374
19556
|
}
|
|
19375
19557
|
function canonicalFamilyName(name, catalog3 = loadCatalog()) {
|
|
19376
19558
|
if (catalog3.families[name] ?? catalog3.bundled[name] ?? catalog3.system[name]) return name;
|
|
@@ -22909,9 +23091,9 @@ function isKnownCapability(id) {
|
|
|
22909
23091
|
function needsNativeBuild(id) {
|
|
22910
23092
|
const req = CAPABILITY_NATIVE[catalogKey(id)];
|
|
22911
23093
|
if (!req) return false;
|
|
22912
|
-
const
|
|
23094
|
+
const nonEmpty4 = (v2) => Array.isArray(v2) ? v2.length > 0 : v2 != null && typeof v2 === "object" ? Object.keys(v2).length > 0 : false;
|
|
22913
23095
|
const { ios, android } = req;
|
|
22914
|
-
return
|
|
23096
|
+
return nonEmpty4(ios?.usageStrings) || nonEmpty4(ios?.infoPlist) || nonEmpty4(ios?.entitlements) || nonEmpty4(ios?.spmProducts) || nonEmpty4(android?.permissions) || nonEmpty4(android?.features) || nonEmpty4(android?.services) || nonEmpty4(android?.foregroundServiceTypes) || nonEmpty4(android?.gradleDeps);
|
|
22915
23097
|
}
|
|
22916
23098
|
function capabilitiesUsedBy(bundleJs) {
|
|
22917
23099
|
const out2 = /* @__PURE__ */ new Set();
|
|
@@ -24346,30 +24528,30 @@ function assertSingleModuleInstall(app, paths) {
|
|
|
24346
24528
|
);
|
|
24347
24529
|
}
|
|
24348
24530
|
}
|
|
24349
|
-
function isBegin(line, kind,
|
|
24531
|
+
function isBegin(line, kind, label3) {
|
|
24350
24532
|
const s2 = line.trim();
|
|
24351
|
-
const open = kind === "yaml" ? `# >>> ${
|
|
24533
|
+
const open = kind === "yaml" ? `# >>> ${label3}` : kind === "xml" ? `<!-- >>> ${label3}` : `// >>> ${label3}`;
|
|
24352
24534
|
const close = kind === "xml" ? "-->" : ">>>";
|
|
24353
24535
|
if (!s2.startsWith(open) || !s2.endsWith(close)) return false;
|
|
24354
24536
|
const rest = s2.slice(open.length);
|
|
24355
24537
|
return /^\s/.test(rest) || rest.startsWith(close) || kind === "xml" && rest.startsWith(">>>");
|
|
24356
24538
|
}
|
|
24357
|
-
function isEnd(line, kind,
|
|
24539
|
+
function isEnd(line, kind, label3) {
|
|
24358
24540
|
const s2 = line.trim();
|
|
24359
|
-
if (kind === "yaml") return s2 === `# <<< ${
|
|
24360
|
-
if (kind === "xml") return s2 === `<!-- <<< ${
|
|
24361
|
-
return s2 === `// <<< ${
|
|
24541
|
+
if (kind === "yaml") return s2 === `# <<< ${label3} <<<`;
|
|
24542
|
+
if (kind === "xml") return s2 === `<!-- <<< ${label3} <<< -->`;
|
|
24543
|
+
return s2 === `// <<< ${label3} <<<`;
|
|
24362
24544
|
}
|
|
24363
|
-
function beginText(kind,
|
|
24364
|
-
const note = `${
|
|
24545
|
+
function beginText(kind, label3, indent) {
|
|
24546
|
+
const note = `${label3} (generated by gen-native-config \u2014 do not edit)`;
|
|
24365
24547
|
if (kind === "yaml") return `${indent}# >>> ${note} >>>`;
|
|
24366
24548
|
if (kind === "xml") return `${indent}<!-- >>> ${note} >>> -->`;
|
|
24367
24549
|
return `${indent}// >>> ${note} >>>`;
|
|
24368
24550
|
}
|
|
24369
|
-
function endText(kind,
|
|
24370
|
-
if (kind === "yaml") return `${indent}# <<< ${
|
|
24371
|
-
if (kind === "xml") return `${indent}<!-- <<< ${
|
|
24372
|
-
return `${indent}// <<< ${
|
|
24551
|
+
function endText(kind, label3, indent) {
|
|
24552
|
+
if (kind === "yaml") return `${indent}# <<< ${label3} <<<`;
|
|
24553
|
+
if (kind === "xml") return `${indent}<!-- <<< ${label3} <<< -->`;
|
|
24554
|
+
return `${indent}// <<< ${label3} <<<`;
|
|
24373
24555
|
}
|
|
24374
24556
|
function hostAppliesDeferredWidgetActions(app) {
|
|
24375
24557
|
const root = join34(appDir(app), "ios");
|
|
@@ -24390,36 +24572,36 @@ function hostAppliesDeferredWidgetActions(app) {
|
|
|
24390
24572
|
}
|
|
24391
24573
|
return false;
|
|
24392
24574
|
}
|
|
24393
|
-
function countBeginMarkers(text9, kind,
|
|
24394
|
-
return text9.split("\n").filter((l2) => isBegin(l2, kind,
|
|
24575
|
+
function countBeginMarkers(text9, kind, label3) {
|
|
24576
|
+
return text9.split("\n").filter((l2) => isBegin(l2, kind, label3)).length;
|
|
24395
24577
|
}
|
|
24396
|
-
function countEndMarkers(text9, kind,
|
|
24397
|
-
return text9.split("\n").filter((l2) => isEnd(l2, kind,
|
|
24578
|
+
function countEndMarkers(text9, kind, label3) {
|
|
24579
|
+
return text9.split("\n").filter((l2) => isEnd(l2, kind, label3)).length;
|
|
24398
24580
|
}
|
|
24399
|
-
function hasMarkers(text9, kind,
|
|
24581
|
+
function hasMarkers(text9, kind, label3) {
|
|
24400
24582
|
const lines = text9.split("\n");
|
|
24401
|
-
return lines.some((l2) => isBegin(l2, kind,
|
|
24583
|
+
return lines.some((l2) => isBegin(l2, kind, label3)) && lines.some((l2) => isEnd(l2, kind, label3));
|
|
24402
24584
|
}
|
|
24403
|
-
function assertSingleMarkerPair(text9, kind,
|
|
24404
|
-
const opens = countBeginMarkers(text9, kind,
|
|
24405
|
-
const closes = countEndMarkers(text9, kind,
|
|
24585
|
+
function assertSingleMarkerPair(text9, kind, label3, where = "the file") {
|
|
24586
|
+
const opens = countBeginMarkers(text9, kind, label3);
|
|
24587
|
+
const closes = countEndMarkers(text9, kind, label3);
|
|
24406
24588
|
if (opens > 1 || closes > 1) {
|
|
24407
|
-
const which = opens > 1 ? `">>> ${
|
|
24589
|
+
const which = opens > 1 ? `">>> ${label3}" opens ${opens} times` : `"<<< ${label3}" closes ${closes} times`;
|
|
24408
24590
|
throw new Error(
|
|
24409
24591
|
`native-config: managed marker ${which} in ${where} \u2014 a merge duplicated the generated block; delete every copy but one, then run \`npm run native-config -- --all\``
|
|
24410
24592
|
);
|
|
24411
24593
|
}
|
|
24412
24594
|
}
|
|
24413
|
-
function injectBlock(text9, kind,
|
|
24414
|
-
assertSingleMarkerPair(text9, kind,
|
|
24595
|
+
function injectBlock(text9, kind, label3, render, where = "the file") {
|
|
24596
|
+
assertSingleMarkerPair(text9, kind, label3, where);
|
|
24415
24597
|
const lines = text9.split("\n");
|
|
24416
|
-
const beginIdx = lines.findIndex((l2) => isBegin(l2, kind,
|
|
24417
|
-
const endIdx = lines.findIndex((l2) => isEnd(l2, kind,
|
|
24598
|
+
const beginIdx = lines.findIndex((l2) => isBegin(l2, kind, label3));
|
|
24599
|
+
const endIdx = lines.findIndex((l2) => isEnd(l2, kind, label3));
|
|
24418
24600
|
if (beginIdx === -1 || endIdx === -1 || endIdx < beginIdx) {
|
|
24419
|
-
throw new Error(`native-config: managed markers for "${
|
|
24601
|
+
throw new Error(`native-config: managed markers for "${label3}" not found or mis-ordered`);
|
|
24420
24602
|
}
|
|
24421
24603
|
const indent = /^([ \t]*)/.exec(lines[beginIdx])[1];
|
|
24422
|
-
const block = [beginText(kind,
|
|
24604
|
+
const block = [beginText(kind, label3, indent), ...render(indent), endText(kind, label3, indent)];
|
|
24423
24605
|
return [...lines.slice(0, beginIdx), ...block, ...lines.slice(endIdx + 1)].join("\n");
|
|
24424
24606
|
}
|
|
24425
24607
|
function androidSettingsGradle(app) {
|
|
@@ -24438,12 +24620,12 @@ function androidManifestPath2(app) {
|
|
|
24438
24620
|
function automotiveAppDescPath(app) {
|
|
24439
24621
|
return join34(dirname21(androidManifestPath2(app)), "res", "xml", "automotive_app_desc.xml");
|
|
24440
24622
|
}
|
|
24441
|
-
function applyToFile(path2, kind,
|
|
24623
|
+
function applyToFile(path2, kind, label3, render, check) {
|
|
24442
24624
|
if (!existsSync34(path2)) return { path: path2, outcome: "skipped" };
|
|
24443
24625
|
const before = readFileSync33(path2, "utf8");
|
|
24444
|
-
assertSingleMarkerPair(before, kind,
|
|
24445
|
-
if (!hasMarkers(before, kind,
|
|
24446
|
-
const after = injectBlock(before, kind,
|
|
24626
|
+
assertSingleMarkerPair(before, kind, label3, path2);
|
|
24627
|
+
if (!hasMarkers(before, kind, label3)) return { path: path2, outcome: "skipped" };
|
|
24628
|
+
const after = injectBlock(before, kind, label3, render, path2);
|
|
24447
24629
|
if (after === before) return { path: path2, outcome: "unchanged" };
|
|
24448
24630
|
if (check) return { path: path2, outcome: "drift" };
|
|
24449
24631
|
writeFileSync13(path2, after);
|
|
@@ -24663,7 +24845,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
24663
24845
|
];
|
|
24664
24846
|
if (dist) {
|
|
24665
24847
|
const manifestPath = androidManifestPath2(app);
|
|
24666
|
-
const marked = (path2, kind,
|
|
24848
|
+
const marked = (path2, kind, label3) => !existsSync34(path2) || hasMarkers(readFileSync33(path2, "utf8"), kind, label3);
|
|
24667
24849
|
if (!marked(iosYml, "yaml", LABEL_IOS_INFO)) throw new Error(`${app}: dist capabilities need the ${LABEL_IOS_INFO} markers in ${iosYml}`);
|
|
24668
24850
|
if (!marked(manifestPath, "xml", LABEL_ANDROID_SERVICES)) {
|
|
24669
24851
|
throw new Error(`${app}: dist capabilities need the ${LABEL_ANDROID_SERVICES} markers inside <application> in ${manifestPath}`);
|
|
@@ -24673,9 +24855,9 @@ function genNativeConfig(app, opts = {}) {
|
|
|
24673
24855
|
const addsSpm = added.spm.some((p2) => !ownModules.spm.includes(p2));
|
|
24674
24856
|
const addsGradle = added.gradle.some((p2) => !ownModules.gradle.includes(p2));
|
|
24675
24857
|
if (addsSpm || addsGradle) {
|
|
24676
|
-
const requireMarkers = (path2, kind,
|
|
24677
|
-
if (!existsSync34(path2) || !hasMarkers(readFileSync33(path2, "utf8"), kind,
|
|
24678
|
-
throw new Error(`${app}: dist added ${dist.added.join(", ")} but ${path2} has no ${
|
|
24858
|
+
const requireMarkers = (path2, kind, label3) => {
|
|
24859
|
+
if (!existsSync34(path2) || !hasMarkers(readFileSync33(path2, "utf8"), kind, label3)) {
|
|
24860
|
+
throw new Error(`${app}: dist added ${dist.added.join(", ")} but ${path2} has no ${label3} markers \u2014 the module would stay unlinked and every verb would answer module_not_linked`);
|
|
24679
24861
|
}
|
|
24680
24862
|
};
|
|
24681
24863
|
if (addsSpm) {
|
|
@@ -26328,10 +26510,10 @@ var init_preview = __esm({
|
|
|
26328
26510
|
}
|
|
26329
26511
|
},
|
|
26330
26512
|
kill: (pid, signal) => process.kill(pid, signal),
|
|
26331
|
-
portFree: (port) => new Promise((
|
|
26513
|
+
portFree: (port) => new Promise((resolve66) => {
|
|
26332
26514
|
const s2 = createServer2();
|
|
26333
|
-
s2.once("error", () =>
|
|
26334
|
-
s2.listen(port, "127.0.0.1", () => s2.close(() =>
|
|
26515
|
+
s2.once("error", () => resolve66(false));
|
|
26516
|
+
s2.listen(port, "127.0.0.1", () => s2.close(() => resolve66(true)));
|
|
26335
26517
|
}),
|
|
26336
26518
|
sleep: (ms2) => new Promise((r2) => setTimeout(r2, ms2)),
|
|
26337
26519
|
servingIdentity: async (origin) => {
|
|
@@ -26909,9 +27091,9 @@ function validateScreenMetadata(screens) {
|
|
|
26909
27091
|
labels.set(key2, { viewId, explicit: name !== void 0 || other?.explicit === true });
|
|
26910
27092
|
}
|
|
26911
27093
|
}
|
|
26912
|
-
function screenMetadataFor(definitions2, id,
|
|
27094
|
+
function screenMetadataFor(definitions2, id, canonical5) {
|
|
26913
27095
|
if (definitions2 && Object.hasOwn(definitions2, id)) return definitions2[id];
|
|
26914
|
-
if (
|
|
27096
|
+
if (canonical5 && definitions2 && Object.hasOwn(definitions2, canonical5)) return { ...definitions2[canonical5], viewId: definitions2[canonical5].viewId ?? canonical5 };
|
|
26915
27097
|
return {};
|
|
26916
27098
|
}
|
|
26917
27099
|
function screenViewRepresentatives(screens) {
|
|
@@ -27555,8 +27737,8 @@ function parseApp(dev, config) {
|
|
|
27555
27737
|
throw new TrimRefusal(`dev/index.ts: the templated route ${display} has a pattern trim does not recognise (${JSON.stringify(pattern)}); trim compiles a route pattern only when it is anchored and cannot backtrack exponentially (no repeated group whose body repeats or alternates, no backreferences or lookarounds)`);
|
|
27556
27738
|
}
|
|
27557
27739
|
const block = parseJson2(dev.slice(open, close), `the templated route ${display} in dev/index.ts`);
|
|
27558
|
-
const
|
|
27559
|
-
const route = { kind: "templated", label:
|
|
27740
|
+
const label3 = display.replace(/[[{].*$/, "").replace(/[_/]+$/, "") || display;
|
|
27741
|
+
const route = { kind: "templated", label: label3, lineStart: pos, end: close + 4, open, close, block, re: re2, bundles: bundlesOf(block) };
|
|
27560
27742
|
routes.push(route);
|
|
27561
27743
|
templated.push(route);
|
|
27562
27744
|
pos = close + 4;
|
|
@@ -30345,7 +30527,7 @@ function deriveNavigationConfig(app, bundleCtx) {
|
|
|
30345
30527
|
if (authConfig !== void 0) config.authConfig = authConfig;
|
|
30346
30528
|
if (app.iap !== void 0) config.iapConfig = app.iap;
|
|
30347
30529
|
if (app.cashier !== void 0) config.cashierConfig = app.cashier;
|
|
30348
|
-
if (app.base44 !== void 0) config.base44Config = app.base44;
|
|
30530
|
+
if (app.base44 !== void 0) config.base44Config = { appId: app.base44.appId, ...app.base44.serverUrl !== void 0 ? { serverUrl: app.base44.serverUrl } : {} };
|
|
30349
30531
|
if (app.wixIap !== void 0) config.wixIapConfig = app.wixIap;
|
|
30350
30532
|
if (app.wixPlatform !== void 0) config.wixPlatformConfig = app.wixPlatform;
|
|
30351
30533
|
if (app.devGateway !== void 0) config.devGatewayConfig = app.devGateway;
|
|
@@ -30450,7 +30632,7 @@ async function injectRequest(listener, request) {
|
|
|
30450
30632
|
req.headers.host ??= url.host;
|
|
30451
30633
|
if (body && body.length > 0) req.push(body);
|
|
30452
30634
|
req.push(null);
|
|
30453
|
-
return await new Promise((
|
|
30635
|
+
return await new Promise((resolve66, reject) => {
|
|
30454
30636
|
const streamed = () => {
|
|
30455
30637
|
queueMicrotask(() => {
|
|
30456
30638
|
req.emit("close");
|
|
@@ -30466,7 +30648,7 @@ async function injectRequest(listener, request) {
|
|
|
30466
30648
|
else headers2.set(name, value);
|
|
30467
30649
|
}
|
|
30468
30650
|
const bodyless = out2.status === 204 || out2.status === 304 || request.method === "HEAD";
|
|
30469
|
-
|
|
30651
|
+
resolve66(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
|
|
30470
30652
|
}, streamed);
|
|
30471
30653
|
res.on("inject-error", reject);
|
|
30472
30654
|
try {
|
|
@@ -31045,6 +31227,13 @@ var init_distribution = __esm({
|
|
|
31045
31227
|
}
|
|
31046
31228
|
});
|
|
31047
31229
|
|
|
31230
|
+
// ../../core/ts/src/base44-entities.ts
|
|
31231
|
+
var init_base44_entities = __esm({
|
|
31232
|
+
"../../core/ts/src/base44-entities.ts"() {
|
|
31233
|
+
init_schema2();
|
|
31234
|
+
}
|
|
31235
|
+
});
|
|
31236
|
+
|
|
31048
31237
|
// ../../core/sdk/functions/src/index.ts
|
|
31049
31238
|
function fail2(message) {
|
|
31050
31239
|
throw new Error(`defineFunction: ${message}`);
|
|
@@ -31165,7 +31354,7 @@ var init_src3 = __esm({
|
|
|
31165
31354
|
// ../../core/ts/src/cms.ts
|
|
31166
31355
|
var init_cms = __esm({
|
|
31167
31356
|
"../../core/ts/src/cms.ts"() {
|
|
31168
|
-
|
|
31357
|
+
init_schema2();
|
|
31169
31358
|
}
|
|
31170
31359
|
});
|
|
31171
31360
|
|
|
@@ -31175,9 +31364,11 @@ var init_define_app = __esm({
|
|
|
31175
31364
|
"../../core/ts/src/define-app.ts"() {
|
|
31176
31365
|
init_locale();
|
|
31177
31366
|
init_distribution();
|
|
31178
|
-
|
|
31367
|
+
init_schema2();
|
|
31368
|
+
init_base44_entities();
|
|
31179
31369
|
init_src3();
|
|
31180
31370
|
init_cms();
|
|
31371
|
+
init_base44_entities();
|
|
31181
31372
|
ALL_ORIENTATIONS2 = [
|
|
31182
31373
|
"portrait",
|
|
31183
31374
|
"portraitUpsideDown",
|
|
@@ -34169,7 +34360,7 @@ var init_site_menu = __esm({
|
|
|
34169
34360
|
var init_src4 = __esm({
|
|
34170
34361
|
"../../core/ts/src/index.ts"() {
|
|
34171
34362
|
"use strict";
|
|
34172
|
-
|
|
34363
|
+
init_schema3();
|
|
34173
34364
|
init_stream_policy();
|
|
34174
34365
|
init_locale();
|
|
34175
34366
|
init_media();
|
|
@@ -36787,12 +36978,12 @@ function finalizeRecording(key2, rec) {
|
|
|
36787
36978
|
if (rec.finalize) return rec.finalize;
|
|
36788
36979
|
rec.finalize = (async () => {
|
|
36789
36980
|
clearTimeout(rec.autoStop);
|
|
36790
|
-
await new Promise((
|
|
36981
|
+
await new Promise((resolve66) => {
|
|
36791
36982
|
let done = false;
|
|
36792
36983
|
const finish2 = () => {
|
|
36793
36984
|
if (!done) {
|
|
36794
36985
|
done = true;
|
|
36795
|
-
|
|
36986
|
+
resolve66();
|
|
36796
36987
|
}
|
|
36797
36988
|
};
|
|
36798
36989
|
rec.child.once("close", finish2);
|
|
@@ -36903,7 +37094,7 @@ var init_preview2 = __esm({
|
|
|
36903
37094
|
DEVICE_LIST_TIMEOUT_MS = 5e3;
|
|
36904
37095
|
defaultRunner2 = {
|
|
36905
37096
|
capture(cmd, args, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
|
|
36906
|
-
return new Promise((
|
|
37097
|
+
return new Promise((resolve66, reject) => {
|
|
36907
37098
|
const child = spawn4(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
36908
37099
|
const out2 = [];
|
|
36909
37100
|
const err = [];
|
|
@@ -36925,7 +37116,7 @@ var init_preview2 = __esm({
|
|
|
36925
37116
|
child.stderr.on("data", (b2) => err.push(b2));
|
|
36926
37117
|
child.on("error", (e2) => settle(reject, e2));
|
|
36927
37118
|
child.on("close", (code) => {
|
|
36928
|
-
if (code === 0) settle(
|
|
37119
|
+
if (code === 0) settle(resolve66, Buffer.concat(out2));
|
|
36929
37120
|
else settle(reject, new Error(`${cmd} exited ${code}: ${Buffer.concat(err).toString("utf8")}`));
|
|
36930
37121
|
});
|
|
36931
37122
|
});
|
|
@@ -38073,14 +38264,14 @@ function mdScan(src, linkStyle = "") {
|
|
|
38073
38264
|
let out2 = "";
|
|
38074
38265
|
let last = 0;
|
|
38075
38266
|
for (let m2 = re2.exec(src); m2; m2 = re2.exec(src)) {
|
|
38076
|
-
const [whole, code,
|
|
38267
|
+
const [whole, code, label3, url, bold, italic] = m2;
|
|
38077
38268
|
out2 += mdEsc(src.slice(last, m2.index));
|
|
38078
38269
|
if (code !== void 0) {
|
|
38079
38270
|
out2 += `<code style="${CODE_STYLE}">${mdEsc(code)}</code>`;
|
|
38080
|
-
} else if (
|
|
38271
|
+
} else if (label3 !== void 0) {
|
|
38081
38272
|
if (/^https?:\/\//i.test(url)) {
|
|
38082
38273
|
const href = mdEsc(url).replace(/"/g, """);
|
|
38083
|
-
out2 += `<a href="${href}" target="_blank" rel="noopener noreferrer"${linkStyle}>${mdScan(
|
|
38274
|
+
out2 += `<a href="${href}" target="_blank" rel="noopener noreferrer"${linkStyle}>${mdScan(label3, linkStyle)}</a>`;
|
|
38084
38275
|
} else {
|
|
38085
38276
|
out2 += mdEsc(whole);
|
|
38086
38277
|
}
|
|
@@ -38629,7 +38820,7 @@ var init_icons = __esm({
|
|
|
38629
38820
|
// table by the NORMALIZED name, so those separator-free spellings were in the accepted set and
|
|
38630
38821
|
// are authored in the wild (#473). The validator compares literally against this list, so
|
|
38631
38822
|
// omitting them would silently start flagging descriptors that render perfectly.
|
|
38632
|
-
...Object.entries(ICON_NORMALIZED_INDEX).filter(([,
|
|
38823
|
+
...Object.entries(ICON_NORMALIZED_INDEX).filter(([, canonical5]) => !canonical5.startsWith("_")).map(([normalized]) => normalized)
|
|
38633
38824
|
])
|
|
38634
38825
|
].sort();
|
|
38635
38826
|
FALLBACK = ICON_CATALOG[ICON_FALLBACK];
|
|
@@ -38896,13 +39087,13 @@ function webViewWebConfig(raw) {
|
|
|
38896
39087
|
return {
|
|
38897
39088
|
allowedOrigins: Array.isArray(c2.allowedOrigins) ? c2.allowedOrigins.filter((o2) => typeof o2 === "string" && o2.length > 0) : [],
|
|
38898
39089
|
allow: allow.join("; "),
|
|
38899
|
-
injectStart:
|
|
38900
|
-
injectEnd:
|
|
39090
|
+
injectStart: nonEmpty3(c2.injectJsDocumentStart),
|
|
39091
|
+
injectEnd: nonEmpty3(c2.injectJsDocumentEnd),
|
|
38901
39092
|
gestureCss: css.join(""),
|
|
38902
39093
|
disableContextMenu,
|
|
38903
|
-
loadingText:
|
|
39094
|
+
loadingText: nonEmpty3(c2.loadingText),
|
|
38904
39095
|
showProgressBar: c2.showProgressBar === true,
|
|
38905
|
-
coverBandColor:
|
|
39096
|
+
coverBandColor: nonEmpty3(c2.coverBandColor)
|
|
38906
39097
|
};
|
|
38907
39098
|
}
|
|
38908
39099
|
function maskInertHtml(html) {
|
|
@@ -38993,12 +39184,12 @@ function webViewOriginAllowed(url, origins) {
|
|
|
38993
39184
|
}
|
|
38994
39185
|
return false;
|
|
38995
39186
|
}
|
|
38996
|
-
var NETWORK_SCHEMES, asRecord,
|
|
39187
|
+
var NETWORK_SCHEMES, asRecord, nonEmpty3, scriptBody;
|
|
38997
39188
|
var init_webviewFrame = __esm({
|
|
38998
39189
|
"../../core/web-renderer/src/webviewFrame.ts"() {
|
|
38999
39190
|
NETWORK_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
39000
39191
|
asRecord = (v2) => v2 && typeof v2 === "object" ? v2 : {};
|
|
39001
|
-
|
|
39192
|
+
nonEmpty3 = (v2) => typeof v2 === "string" && v2.length > 0 ? v2 : void 0;
|
|
39002
39193
|
scriptBody = (js2) => js2.replace(/<\/(script)/gi, "<\\/$1");
|
|
39003
39194
|
}
|
|
39004
39195
|
});
|
|
@@ -39273,12 +39464,12 @@ function createRicosHostSession(o2) {
|
|
|
39273
39464
|
flush() {
|
|
39274
39465
|
if (!state.ready || state.unavailable || disposed) return Promise.resolve(null);
|
|
39275
39466
|
const requestId2 = newId();
|
|
39276
|
-
return new Promise((
|
|
39467
|
+
return new Promise((resolve66) => {
|
|
39277
39468
|
const timer = t2.setTimeout(() => {
|
|
39278
39469
|
flushes.delete(requestId2);
|
|
39279
|
-
|
|
39470
|
+
resolve66(null);
|
|
39280
39471
|
}, flushMs);
|
|
39281
|
-
flushes.set(requestId2, { resolve:
|
|
39472
|
+
flushes.set(requestId2, { resolve: resolve66, timer });
|
|
39282
39473
|
o2.send({ v: 1, type: "requestContent", requestId: requestId2 });
|
|
39283
39474
|
});
|
|
39284
39475
|
},
|
|
@@ -39337,7 +39528,7 @@ async function runRicosImageUpload(o2) {
|
|
|
39337
39528
|
};
|
|
39338
39529
|
session.insertMediaPlaceholder(requestId2);
|
|
39339
39530
|
try {
|
|
39340
|
-
const entry = await new Promise((
|
|
39531
|
+
const entry = await new Promise((resolve66) => {
|
|
39341
39532
|
let done = false;
|
|
39342
39533
|
let unsub = () => {
|
|
39343
39534
|
};
|
|
@@ -39346,7 +39537,7 @@ async function runRicosImageUpload(o2) {
|
|
|
39346
39537
|
done = true;
|
|
39347
39538
|
t2.clearTimeout(timer);
|
|
39348
39539
|
queueMicrotask(() => unsub());
|
|
39349
|
-
|
|
39540
|
+
resolve66(v2);
|
|
39350
39541
|
};
|
|
39351
39542
|
const timer = t2.setTimeout(() => finish2(null), o2.timeoutMs ?? RICOS_UPLOAD_TIMEOUT_MS);
|
|
39352
39543
|
unsub = deps.subscribe(`${svc}.uploads.${requestId2}`, (v2) => {
|
|
@@ -39833,8 +40024,8 @@ var init_presigned_upload_policy = __esm({
|
|
|
39833
40024
|
});
|
|
39834
40025
|
|
|
39835
40026
|
// ../../core/web-renderer/src/mediaFieldUpload.ts
|
|
39836
|
-
function mediaFieldName(
|
|
39837
|
-
return typeof
|
|
40027
|
+
function mediaFieldName(label3) {
|
|
40028
|
+
return typeof label3 === "string" && label3.trim() !== "" ? label3 : MEDIA_FIELD_DEFAULT_LABEL;
|
|
39838
40029
|
}
|
|
39839
40030
|
function mediaFieldState(uploading, hasPhoto, failed3 = false) {
|
|
39840
40031
|
if (uploading) return "Uploading";
|
|
@@ -39868,10 +40059,10 @@ async function runMediaFieldUpload(o2) {
|
|
|
39868
40059
|
}, o2.timeoutMs ?? MEDIA_FIELD_UPLOAD_TIMEOUT_MS);
|
|
39869
40060
|
const bounded2 = (p2) => {
|
|
39870
40061
|
if (expired) return Promise.reject(new Deadline());
|
|
39871
|
-
return new Promise((
|
|
40062
|
+
return new Promise((resolve66, reject) => {
|
|
39872
40063
|
const stop = () => reject(new Deadline());
|
|
39873
40064
|
onExpire.push(stop);
|
|
39874
|
-
p2.then(
|
|
40065
|
+
p2.then(resolve66, reject).finally(() => {
|
|
39875
40066
|
onExpire = onExpire.filter((f2) => f2 !== stop);
|
|
39876
40067
|
});
|
|
39877
40068
|
});
|
|
@@ -39894,7 +40085,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
39894
40085
|
const before = deps.value(urlPath);
|
|
39895
40086
|
let uploadUrl;
|
|
39896
40087
|
try {
|
|
39897
|
-
uploadUrl = await bounded2(new Promise((
|
|
40088
|
+
uploadUrl = await bounded2(new Promise((resolve66, reject) => {
|
|
39898
40089
|
let done = false;
|
|
39899
40090
|
let unsub = () => {
|
|
39900
40091
|
};
|
|
@@ -39902,7 +40093,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
39902
40093
|
if (done || typeof v2 !== "string" || v2 === "" || v2 === before) return;
|
|
39903
40094
|
done = true;
|
|
39904
40095
|
queueMicrotask(() => unsub());
|
|
39905
|
-
|
|
40096
|
+
resolve66(v2);
|
|
39906
40097
|
});
|
|
39907
40098
|
onExpire.push(() => {
|
|
39908
40099
|
if (!done) {
|
|
@@ -39917,7 +40108,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
39917
40108
|
if (typeof now === "string" && now !== "" && now !== before) {
|
|
39918
40109
|
done = true;
|
|
39919
40110
|
queueMicrotask(() => unsub());
|
|
39920
|
-
|
|
40111
|
+
resolve66(now);
|
|
39921
40112
|
return;
|
|
39922
40113
|
}
|
|
39923
40114
|
}
|
|
@@ -40023,12 +40214,12 @@ var init_pdfSource = __esm({
|
|
|
40023
40214
|
// ../../core/web-renderer/src/a11y/controls.tsx
|
|
40024
40215
|
import React5 from "react";
|
|
40025
40216
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
40026
|
-
function labelText(
|
|
40027
|
-
if (typeof
|
|
40028
|
-
const v2 = resolveScalarStatic(
|
|
40217
|
+
function labelText(label3, ctx) {
|
|
40218
|
+
if (typeof label3 === "string" && isBinding(label3)) {
|
|
40219
|
+
const v2 = resolveScalarStatic(label3, ctx);
|
|
40029
40220
|
return v2 == null ? "" : asText2(v2);
|
|
40030
40221
|
}
|
|
40031
|
-
return asText2(
|
|
40222
|
+
return asText2(label3);
|
|
40032
40223
|
}
|
|
40033
40224
|
function resolveRowAction(action, ctx) {
|
|
40034
40225
|
const resolved2 = resolveItemDeep(action, ctx);
|
|
@@ -40743,7 +40934,7 @@ var init_listGestures = __esm({
|
|
|
40743
40934
|
init_tokens2();
|
|
40744
40935
|
PULL_THRESHOLD = 56;
|
|
40745
40936
|
SWIPE_OPEN = 76;
|
|
40746
|
-
PullToRefreshList = ({ onRefresh, accent, fg, surface, label:
|
|
40937
|
+
PullToRefreshList = ({ onRefresh, accent, fg, surface, label: label3 = "Pull to refresh", fontFamily = '"Wix Madefor Text", system-ui', style, children }) => {
|
|
40747
40938
|
const [pull, setPull] = useState2(0);
|
|
40748
40939
|
const [busy, setBusy] = useState2(false);
|
|
40749
40940
|
const startY = useRef(null);
|
|
@@ -40782,7 +40973,7 @@ var init_listGestures = __esm({
|
|
|
40782
40973
|
type: "button",
|
|
40783
40974
|
"data-testid": "list-pull-refresh",
|
|
40784
40975
|
"data-himalaya-pull-refresh": true,
|
|
40785
|
-
"aria-label": busy ? "Refreshing" :
|
|
40976
|
+
"aria-label": busy ? "Refreshing" : label3,
|
|
40786
40977
|
onClick: fire,
|
|
40787
40978
|
style: {
|
|
40788
40979
|
display: "flex",
|
|
@@ -41622,7 +41813,7 @@ function Spans({ spans, env }) {
|
|
|
41622
41813
|
}, children: s2.text }, i2);
|
|
41623
41814
|
}) });
|
|
41624
41815
|
}
|
|
41625
|
-
function LinkButton({ label:
|
|
41816
|
+
function LinkButton({ label: label3, url, env, testId }) {
|
|
41626
41817
|
const { ctx } = env;
|
|
41627
41818
|
const fg = accentTextColor(ctx);
|
|
41628
41819
|
const f2 = ctx.font("bodyEmphasis");
|
|
@@ -41660,7 +41851,7 @@ function LinkButton({ label: label2, url, env, testId }) {
|
|
|
41660
41851
|
maxWidth: "100%",
|
|
41661
41852
|
overflowWrap: "anywhere"
|
|
41662
41853
|
},
|
|
41663
|
-
children:
|
|
41854
|
+
children: label3
|
|
41664
41855
|
}
|
|
41665
41856
|
);
|
|
41666
41857
|
}
|
|
@@ -41949,8 +42140,8 @@ function updateUrlHash(url, hash2, allowRel = false) {
|
|
|
41949
42140
|
function stripPath(str11) {
|
|
41950
42141
|
return str11.substring(str11.lastIndexOf("/") + 1);
|
|
41951
42142
|
}
|
|
41952
|
-
function shadow(obj4,
|
|
41953
|
-
Object.defineProperty(obj4,
|
|
42143
|
+
function shadow(obj4, prop2, value, nonSerializable2 = false) {
|
|
42144
|
+
Object.defineProperty(obj4, prop2, {
|
|
41954
42145
|
value,
|
|
41955
42146
|
enumerable: !nonSerializable2,
|
|
41956
42147
|
configurable: true,
|
|
@@ -42070,7 +42261,7 @@ async function fetchData(url, type = "text") {
|
|
|
42070
42261
|
}
|
|
42071
42262
|
return response.text();
|
|
42072
42263
|
}
|
|
42073
|
-
return new Promise((
|
|
42264
|
+
return new Promise((resolve66, reject) => {
|
|
42074
42265
|
const request = new XMLHttpRequest();
|
|
42075
42266
|
request.open("GET", url, true);
|
|
42076
42267
|
request.responseType = type === "bytes" ? "arraybuffer" : type;
|
|
@@ -42081,14 +42272,14 @@ async function fetchData(url, type = "text") {
|
|
|
42081
42272
|
if (request.status === 200 || request.status === 0) {
|
|
42082
42273
|
switch (type) {
|
|
42083
42274
|
case "bytes":
|
|
42084
|
-
|
|
42275
|
+
resolve66(new Uint8Array(request.response));
|
|
42085
42276
|
return;
|
|
42086
42277
|
case "blob":
|
|
42087
42278
|
case "json":
|
|
42088
|
-
|
|
42279
|
+
resolve66(request.response);
|
|
42089
42280
|
return;
|
|
42090
42281
|
}
|
|
42091
|
-
|
|
42282
|
+
resolve66(request.responseText);
|
|
42092
42283
|
return;
|
|
42093
42284
|
}
|
|
42094
42285
|
reject(new Error(request.statusText));
|
|
@@ -45020,7 +45211,7 @@ var init_pdf = __esm({
|
|
|
45020
45211
|
var defineProperty = Object.defineProperty;
|
|
45021
45212
|
var stringSlice = uncurryThis("".slice);
|
|
45022
45213
|
var replace = uncurryThis("".replace);
|
|
45023
|
-
var
|
|
45214
|
+
var join89 = uncurryThis([].join);
|
|
45024
45215
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
45025
45216
|
return defineProperty(function() {
|
|
45026
45217
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -45047,7 +45238,7 @@ var init_pdf = __esm({
|
|
|
45047
45238
|
}
|
|
45048
45239
|
var state = enforceInternalState(value);
|
|
45049
45240
|
if (!hasOwn(state, "source")) {
|
|
45050
|
-
state.source =
|
|
45241
|
+
state.source = join89(TEMPLATE, typeof name == "string" ? name : "");
|
|
45051
45242
|
}
|
|
45052
45243
|
return value;
|
|
45053
45244
|
};
|
|
@@ -45092,13 +45283,13 @@ var init_pdf = __esm({
|
|
|
45092
45283
|
var aCallable = __webpack_require__3(9306);
|
|
45093
45284
|
var $TypeError = TypeError;
|
|
45094
45285
|
var PromiseCapability = function(C2) {
|
|
45095
|
-
var
|
|
45286
|
+
var resolve66, reject;
|
|
45096
45287
|
this.promise = new C2(function($$resolve, $$reject) {
|
|
45097
|
-
if (
|
|
45098
|
-
|
|
45288
|
+
if (resolve66 !== void 0 || reject !== void 0) throw new $TypeError("Bad Promise constructor");
|
|
45289
|
+
resolve66 = $$resolve;
|
|
45099
45290
|
reject = $$reject;
|
|
45100
45291
|
});
|
|
45101
|
-
this.resolve = aCallable(
|
|
45292
|
+
this.resolve = aCallable(resolve66);
|
|
45102
45293
|
this.reject = aCallable(reject);
|
|
45103
45294
|
};
|
|
45104
45295
|
module.exports.f = function(C2) {
|
|
@@ -45466,8 +45657,8 @@ var init_pdf = __esm({
|
|
|
45466
45657
|
anObject(C2);
|
|
45467
45658
|
if (isObject3(x2) && x2.constructor === C2) return x2;
|
|
45468
45659
|
var promiseCapability = newPromiseCapability.f(C2);
|
|
45469
|
-
var
|
|
45470
|
-
|
|
45660
|
+
var resolve66 = promiseCapability.resolve;
|
|
45661
|
+
resolve66(x2);
|
|
45471
45662
|
return promiseCapability.promise;
|
|
45472
45663
|
};
|
|
45473
45664
|
},
|
|
@@ -47570,7 +47761,7 @@ var init_pdf = __esm({
|
|
|
47570
47761
|
var charAt = uncurryThis("".charAt);
|
|
47571
47762
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
47572
47763
|
var $Array = globalThis2.Array;
|
|
47573
|
-
var
|
|
47764
|
+
var join89 = uncurryThis([].join);
|
|
47574
47765
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
47575
47766
|
try {
|
|
47576
47767
|
var target = new Uint8Array2();
|
|
@@ -47616,7 +47807,7 @@ var init_pdf = __esm({
|
|
|
47616
47807
|
result[written++] = "=";
|
|
47617
47808
|
}
|
|
47618
47809
|
}
|
|
47619
|
-
return
|
|
47810
|
+
return join89(result, "");
|
|
47620
47811
|
}
|
|
47621
47812
|
});
|
|
47622
47813
|
},
|
|
@@ -47628,7 +47819,7 @@ var init_pdf = __esm({
|
|
|
47628
47819
|
var anUint8Array = __webpack_require__3(4154);
|
|
47629
47820
|
var notDetached = __webpack_require__3(5169);
|
|
47630
47821
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
47631
|
-
var
|
|
47822
|
+
var join89 = uncurryThis([].join);
|
|
47632
47823
|
var $Array = Array;
|
|
47633
47824
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
47634
47825
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -47648,7 +47839,7 @@ var init_pdf = __esm({
|
|
|
47648
47839
|
var hex2 = numberToString2(this[i2], 16);
|
|
47649
47840
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
47650
47841
|
}
|
|
47651
|
-
return
|
|
47842
|
+
return join89(result, "");
|
|
47652
47843
|
}
|
|
47653
47844
|
});
|
|
47654
47845
|
},
|
|
@@ -47806,7 +47997,7 @@ var init_pdf = __esm({
|
|
|
47806
47997
|
};
|
|
47807
47998
|
})();
|
|
47808
47999
|
(() => {
|
|
47809
|
-
__webpack_require__.o = (obj4,
|
|
48000
|
+
__webpack_require__.o = (obj4, prop2) => Object.prototype.hasOwnProperty.call(obj4, prop2);
|
|
47810
48001
|
})();
|
|
47811
48002
|
es_array_includes = __webpack_require__(4423);
|
|
47812
48003
|
es_array_push = __webpack_require__(4114);
|
|
@@ -49321,11 +49512,11 @@ var init_pdf = __esm({
|
|
|
49321
49512
|
const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
|
|
49322
49513
|
const fileReader = new FileReader();
|
|
49323
49514
|
const imageElement = new Image();
|
|
49324
|
-
const imagePromise = new Promise((
|
|
49515
|
+
const imagePromise = new Promise((resolve66, reject) => {
|
|
49325
49516
|
imageElement.onload = () => {
|
|
49326
49517
|
data.bitmap = imageElement;
|
|
49327
49518
|
data.isSvg = true;
|
|
49328
|
-
|
|
49519
|
+
resolve66();
|
|
49329
49520
|
};
|
|
49330
49521
|
fileReader.onload = async () => {
|
|
49331
49522
|
const url = data.svgUrl = fileReader.result;
|
|
@@ -50011,13 +50202,13 @@ var init_pdf = __esm({
|
|
|
50011
50202
|
return;
|
|
50012
50203
|
}
|
|
50013
50204
|
const {
|
|
50014
|
-
resolve:
|
|
50205
|
+
resolve: resolve66,
|
|
50015
50206
|
promise
|
|
50016
50207
|
} = Promise.withResolvers();
|
|
50017
50208
|
const onEditorsRendered = (evt) => {
|
|
50018
50209
|
if (evt.pageNumber === pageNumber) {
|
|
50019
50210
|
this._eventBus.off("editorsrendered", onEditorsRendered);
|
|
50020
|
-
|
|
50211
|
+
resolve66();
|
|
50021
50212
|
}
|
|
50022
50213
|
};
|
|
50023
50214
|
this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
|
|
@@ -51425,15 +51616,15 @@ var init_pdf = __esm({
|
|
|
51425
51616
|
const altText = this.#altTextButton = document.createElement("button");
|
|
51426
51617
|
altText.className = "altText";
|
|
51427
51618
|
altText.tabIndex = "0";
|
|
51428
|
-
const
|
|
51429
|
-
altText.append(
|
|
51619
|
+
const label3 = this.#altTextButtonLabel = document.createElement("span");
|
|
51620
|
+
altText.append(label3);
|
|
51430
51621
|
if (this.#useNewAltTextFlow) {
|
|
51431
51622
|
altText.classList.add("new");
|
|
51432
51623
|
altText.setAttribute("data-l10n-id", _AltText.#l10nNewButton.missing);
|
|
51433
|
-
|
|
51624
|
+
label3.setAttribute("data-l10n-id", _AltText.#l10nNewButton["missing-label"]);
|
|
51434
51625
|
} else {
|
|
51435
51626
|
altText.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button");
|
|
51436
|
-
|
|
51627
|
+
label3.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button-label");
|
|
51437
51628
|
}
|
|
51438
51629
|
const signal = this.#editor._uiManager._signal;
|
|
51439
51630
|
altText.addEventListener("contextmenu", noContextMenu, {
|
|
@@ -55055,8 +55246,8 @@ var init_pdf = __esm({
|
|
|
55055
55246
|
if (this.isSyncFontLoadingSupported) {
|
|
55056
55247
|
return;
|
|
55057
55248
|
}
|
|
55058
|
-
await new Promise((
|
|
55059
|
-
const request = this._queueLoadingCallback(
|
|
55249
|
+
await new Promise((resolve66) => {
|
|
55250
|
+
const request = this._queueLoadingCallback(resolve66);
|
|
55060
55251
|
this._prepareFontLoadEvent(font, request);
|
|
55061
55252
|
});
|
|
55062
55253
|
}
|
|
@@ -72096,7 +72287,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
72096
72287
|
input.type = "file";
|
|
72097
72288
|
input.accept = SupportedImageMimeTypes.join(",");
|
|
72098
72289
|
const signal = this._uiManager._signal;
|
|
72099
|
-
this.#bitmapPromise = new Promise((
|
|
72290
|
+
this.#bitmapPromise = new Promise((resolve66) => {
|
|
72100
72291
|
input.addEventListener("change", async () => {
|
|
72101
72292
|
if (!input.files || input.files.length === 0) {
|
|
72102
72293
|
this.remove();
|
|
@@ -72111,13 +72302,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
72111
72302
|
});
|
|
72112
72303
|
this.#getBitmapFetched(data);
|
|
72113
72304
|
}
|
|
72114
|
-
|
|
72305
|
+
resolve66();
|
|
72115
72306
|
}, {
|
|
72116
72307
|
signal
|
|
72117
72308
|
});
|
|
72118
72309
|
input.addEventListener("cancel", () => {
|
|
72119
72310
|
this.remove();
|
|
72120
|
-
|
|
72311
|
+
resolve66();
|
|
72121
72312
|
}, {
|
|
72122
72313
|
signal
|
|
72123
72314
|
});
|
|
@@ -123276,7 +123467,7 @@ function autoGrowBox(contentHeight, lineHeight, verticalPadding, maxLines) {
|
|
|
123276
123467
|
const cap = Math.max(floor2, lineHeight * lines + verticalPadding);
|
|
123277
123468
|
return { height: Math.max(floor2, Math.min(contentHeight, cap)), scrolls: contentHeight > cap };
|
|
123278
123469
|
}
|
|
123279
|
-
function PreviewMenuOverlay({ label:
|
|
123470
|
+
function PreviewMenuOverlay({ label: label3, dialogRef, preview, ctx, onClose, anchorHost, children }) {
|
|
123280
123471
|
const host = anchorHost?.closest(`[${MODAL_SCOPE_ATTR}]`) ?? (typeof document !== "undefined" ? document.body : null);
|
|
123281
123472
|
const reduce = ctx.reduceMotion();
|
|
123282
123473
|
const [shown2, setShown] = React9.useState(reduce);
|
|
@@ -123299,7 +123490,7 @@ function PreviewMenuOverlay({ label: label2, dialogRef, preview, ctx, onClose, a
|
|
|
123299
123490
|
ref: dialogRef,
|
|
123300
123491
|
role: "dialog",
|
|
123301
123492
|
"aria-modal": "true",
|
|
123302
|
-
"aria-label":
|
|
123493
|
+
"aria-label": label3,
|
|
123303
123494
|
"data-testid": "menu.preview-overlay",
|
|
123304
123495
|
onClick: (e2) => {
|
|
123305
123496
|
e2.stopPropagation();
|
|
@@ -123326,8 +123517,8 @@ function PreviewMenuOverlay({ label: label2, dialogRef, preview, ctx, onClose, a
|
|
|
123326
123517
|
);
|
|
123327
123518
|
return host ? createPortal(overlay, host) : null;
|
|
123328
123519
|
}
|
|
123329
|
-
function wrapModalMenu(modal,
|
|
123330
|
-
return modal ? /* @__PURE__ */ jsx10("div", { ref, role: "dialog", "aria-modal": "true", "aria-label":
|
|
123520
|
+
function wrapModalMenu(modal, label3, placement, ref, menu) {
|
|
123521
|
+
return modal ? /* @__PURE__ */ jsx10("div", { ref, role: "dialog", "aria-modal": "true", "aria-label": label3, style: placement, children: menu }) : menu;
|
|
123331
123522
|
}
|
|
123332
123523
|
function bindMediaSlot(value, sessionId) {
|
|
123333
123524
|
if (typeof value === "string") {
|
|
@@ -123549,18 +123740,18 @@ function trackActivatorName(activator) {
|
|
|
123549
123740
|
});
|
|
123550
123741
|
activatorNameObservers.set(activator, observer);
|
|
123551
123742
|
}
|
|
123552
|
-
function TapActivator({ label:
|
|
123743
|
+
function TapActivator({ label: label3, state, tabIndex = 0, role = "button", hint, initialFocus }) {
|
|
123553
123744
|
const ref = React9.useRef(null);
|
|
123554
123745
|
const hintId = `hm-tap-hint${React9.useId()}`;
|
|
123555
123746
|
useIsomorphicLayoutEffect(() => {
|
|
123556
123747
|
const el2 = ref.current;
|
|
123557
|
-
if (!el2 ||
|
|
123748
|
+
if (!el2 || label3) return;
|
|
123558
123749
|
trackActivatorName(el2);
|
|
123559
123750
|
return () => {
|
|
123560
123751
|
activatorNameObservers.get(el2)?.disconnect();
|
|
123561
123752
|
activatorNameObservers.delete(el2);
|
|
123562
123753
|
};
|
|
123563
|
-
}, [
|
|
123754
|
+
}, [label3]);
|
|
123564
123755
|
const activator = /* @__PURE__ */ jsx10(
|
|
123565
123756
|
"span",
|
|
123566
123757
|
{
|
|
@@ -123568,7 +123759,7 @@ function TapActivator({ label: label2, state, tabIndex = 0, role = "button", hin
|
|
|
123568
123759
|
...{ [TAP_ACTIVATOR_ATTR]: "" },
|
|
123569
123760
|
role,
|
|
123570
123761
|
tabIndex,
|
|
123571
|
-
"aria-label":
|
|
123762
|
+
"aria-label": label3 || void 0,
|
|
123572
123763
|
"aria-describedby": hint ? hintId : void 0,
|
|
123573
123764
|
...initialFocus !== void 0 ? { "data-himalaya-initial-focus": initialFocus } : {},
|
|
123574
123765
|
...state,
|
|
@@ -124210,7 +124401,7 @@ function actionClick(ctx, action) {
|
|
|
124210
124401
|
ctx.onAction(resolveItemDeep2(action, ctx));
|
|
124211
124402
|
};
|
|
124212
124403
|
}
|
|
124213
|
-
function actionTextButton(ctx, action,
|
|
124404
|
+
function actionTextButton(ctx, action, label3, color, extra) {
|
|
124214
124405
|
if (action == null) return null;
|
|
124215
124406
|
const onClick = actionClick(ctx, action);
|
|
124216
124407
|
return /* @__PURE__ */ jsx10(
|
|
@@ -124219,7 +124410,7 @@ function actionTextButton(ctx, action, label2, color, extra) {
|
|
|
124219
124410
|
type: "button",
|
|
124220
124411
|
onClick,
|
|
124221
124412
|
style: { display: "block", margin: 0, padding: 0, appearance: "none", WebkitAppearance: "none", background: "none", border: "none", textAlign: "left", fontFamily: bodyFont(ctx), fontWeight: 600, fontSize: pxToRem(13), color, cursor: onClick ? "pointer" : "default", ...extra },
|
|
124222
|
-
children:
|
|
124413
|
+
children: label3
|
|
124223
124414
|
}
|
|
124224
124415
|
);
|
|
124225
124416
|
}
|
|
@@ -127414,13 +127605,13 @@ var init_renderNode = __esm({
|
|
|
127414
127605
|
if (dateBag && dateFieldId) dateBag.set(dateFieldId, dateBagVal);
|
|
127415
127606
|
}, [dateBagVal, dateFieldId, dateBag]);
|
|
127416
127607
|
if (!ctx.onAction) {
|
|
127417
|
-
let
|
|
127608
|
+
let label3 = "Select date";
|
|
127418
127609
|
if (!ctx.empty && props.valueUnix) {
|
|
127419
127610
|
const d2 = new Date(props.valueUnix * 1e3);
|
|
127420
|
-
|
|
127611
|
+
label3 = timeMode ? d2.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : dateTimeMode ? d2.toLocaleString(void 0, { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : d2.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
127421
127612
|
}
|
|
127422
127613
|
return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", background: C2("surfacePrimary", "#fff"), border: `1px solid ${C2("border", "#e3e3e3")}`, borderRadius: ctx.radius("md", 8), padding: "12px 14px", boxSizing: "border-box", fontFamily: bodyFont(ctx), fontSize: pxToRem(15), color: C2("textPrimary", "#111"), ...wrap }, children: [
|
|
127423
|
-
/* @__PURE__ */ jsx10("span", { children:
|
|
127614
|
+
/* @__PURE__ */ jsx10("span", { children: label3 }),
|
|
127424
127615
|
/* @__PURE__ */ jsx10("span", { style: { fontSize: pxToRem(18) }, children: "\u{1F4C5}" })
|
|
127425
127616
|
] });
|
|
127426
127617
|
}
|
|
@@ -128027,8 +128218,8 @@ var init_renderNode = __esm({
|
|
|
128027
128218
|
});
|
|
128028
128219
|
const hasIcon2 = typeof props.icon === "string" ? props.icon.length > 0 : props.icon != null;
|
|
128029
128220
|
const hasSubtitle = subtitleText.trim().length > 0;
|
|
128030
|
-
const
|
|
128031
|
-
const hasAction = props.action != null && typeof
|
|
128221
|
+
const label3 = props.actionLabel;
|
|
128222
|
+
const hasAction = props.action != null && typeof label3 === "string" && label3.trim().length > 0;
|
|
128032
128223
|
const padding = spacingToken(ctx, EMPTY_STATE_SPACING.padding);
|
|
128033
128224
|
return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", width: "100%", padding, boxSizing: "border-box", ...wrap }, children: [
|
|
128034
128225
|
hasIcon2 && /* @__PURE__ */ jsx10("div", { "data-empty-state-part": "icon", "aria-hidden": "true", style: { width: 46, height: 46, borderRadius: 13, background: C2("surfaceTertiary", "#eee"), display: "grid", placeItems: "center", color: C2("textSecondary", "#9aa2ad"), flexShrink: 0 }, children: iconSvg(props.icon, { size: 24 }) }),
|
|
@@ -128040,7 +128231,7 @@ var init_renderNode = __esm({
|
|
|
128040
128231
|
package: "himalaya",
|
|
128041
128232
|
type: "Button",
|
|
128042
128233
|
props: {
|
|
128043
|
-
title:
|
|
128234
|
+
title: label3,
|
|
128044
128235
|
action: props.action,
|
|
128045
128236
|
style: props.actionStyle ?? "secondary",
|
|
128046
128237
|
size: props.actionSize ?? "sm",
|
|
@@ -128410,7 +128601,7 @@ var init_renderNode = __esm({
|
|
|
128410
128601
|
});
|
|
128411
128602
|
BottomDrawerNode = withExtras("BottomDrawerNode", ({ props, ctx, wrap, nodeId, nodeExtras = {} }) => {
|
|
128412
128603
|
const C2 = ctx.color;
|
|
128413
|
-
const
|
|
128604
|
+
const label3 = useBoundString(props.label, ctx);
|
|
128414
128605
|
const bound = useResolvedScalar(props.presentedPath, ctx);
|
|
128415
128606
|
const gated = props.presentedPath != null || props.presented != null;
|
|
128416
128607
|
const presented = props.presentedPath != null ? bound : props.presented;
|
|
@@ -128565,7 +128756,7 @@ var init_renderNode = __esm({
|
|
|
128565
128756
|
if (!shown2 && !mounted) return /* @__PURE__ */ jsx10("span", { ref: anchorRef, "data-bottom-drawer-anchor": "", hidden: true, ...{ [NODE_EXTRAS_TARGET]: "bottom-drawer-panel" } });
|
|
128566
128757
|
const sheet = idiomControls(ctx.idiom).sheet;
|
|
128567
128758
|
const r2 = `${sheet.cornerRadius}px`;
|
|
128568
|
-
const name =
|
|
128759
|
+
const name = label3 || DRAWER_DEFAULT_LABEL;
|
|
128569
128760
|
const portaled = host != null;
|
|
128570
128761
|
const index = Math.min(detentIndex, Math.max(detents.length - 1, 0));
|
|
128571
128762
|
dragState.current = { index, count: detents.length, dismissible };
|
|
@@ -130888,13 +131079,13 @@ __export(render_descriptor_exports, {
|
|
|
130888
131079
|
stabilizePngPage: () => stabilizePngPage,
|
|
130889
131080
|
withRetry: () => withRetry2
|
|
130890
131081
|
});
|
|
130891
|
-
function a11ySemantics(type, props, modifiers, ancestorHidden,
|
|
131082
|
+
function a11ySemantics(type, props, modifiers, ancestorHidden, resolve66) {
|
|
130892
131083
|
if (!A11Y_MODIFIER_KEYS.some((k2) => modifiers[k2] !== void 0)) return void 0;
|
|
130893
131084
|
const literal = (v2) => typeof v2 === "string" && v2.trim() !== "" && !isDynamicValue(v2) ? v2 : void 0;
|
|
130894
131085
|
const spoken = (v2) => {
|
|
130895
131086
|
const lit = literal(v2);
|
|
130896
|
-
if (lit !== void 0 || !
|
|
130897
|
-
const r2 =
|
|
131087
|
+
if (lit !== void 0 || !resolve66 || typeof v2 !== "string" || !isDynamicValue(v2)) return lit;
|
|
131088
|
+
const r2 = resolve66(v2);
|
|
130898
131089
|
if (r2 === v2) return void 0;
|
|
130899
131090
|
return typeof r2 === "string" && r2.trim() !== "" ? r2 : typeof r2 === "number" ? String(r2) : void 0;
|
|
130900
131091
|
};
|
|
@@ -130908,7 +131099,7 @@ function a11ySemantics(type, props, modifiers, ancestorHidden, resolve65) {
|
|
|
130908
131099
|
if (name !== void 0 && exposure === "exposed") out2.name = name;
|
|
130909
131100
|
const hint = spoken(modifiers.accessibilityHint);
|
|
130910
131101
|
if (hint !== void 0) out2.hint = hint;
|
|
130911
|
-
const value = spoken(modifiers.accessibilityValue) ?? controlState(role, props,
|
|
131102
|
+
const value = spoken(modifiers.accessibilityValue) ?? controlState(role, props, resolve66);
|
|
130912
131103
|
if (value !== void 0) out2.value = value;
|
|
130913
131104
|
if (typeof modifiers.headingLevel === "number") out2.headingLevel = modifiers.headingLevel;
|
|
130914
131105
|
if (exposure !== "exposed") out2.exposure = exposure;
|
|
@@ -130929,13 +131120,13 @@ function a11ySemantics(type, props, modifiers, ancestorHidden, resolve65) {
|
|
|
130929
131120
|
}
|
|
130930
131121
|
return out2;
|
|
130931
131122
|
}
|
|
130932
|
-
function controlState(role, props,
|
|
131123
|
+
function controlState(role, props, resolve66) {
|
|
130933
131124
|
if (role !== "toggle" && role !== "checkbox" && role !== "radio") return void 0;
|
|
130934
131125
|
if (role === "checkbox" && props.indeterminate === true) return "mixed";
|
|
130935
131126
|
const binding2 = typeof props.valuePath === "string" ? props.valuePath : typeof props.value === "string" && isDynamicValue(props.value) ? props.value : void 0;
|
|
130936
131127
|
let on4;
|
|
130937
131128
|
if (binding2 !== void 0) {
|
|
130938
|
-
const v2 =
|
|
131129
|
+
const v2 = resolve66 ? resolve66(binding2) : void 0;
|
|
130939
131130
|
if (v2 === true || v2 === 1 || v2 === "true" || v2 === "1") on4 = true;
|
|
130940
131131
|
else if (v2 === false || v2 === 0 || v2 === "false" || v2 === "0") on4 = false;
|
|
130941
131132
|
else return void 0;
|
|
@@ -131271,7 +131462,7 @@ async function stabilizePngPage(page, scheme) {
|
|
|
131271
131462
|
const browser = globalThis;
|
|
131272
131463
|
browser.document.documentElement.style.colorScheme = selected;
|
|
131273
131464
|
await browser.document.fonts?.ready;
|
|
131274
|
-
await new Promise((
|
|
131465
|
+
await new Promise((resolve66) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve66())));
|
|
131275
131466
|
}, scheme);
|
|
131276
131467
|
}
|
|
131277
131468
|
async function renderPngBatch(items) {
|
|
@@ -131949,7 +132140,7 @@ ${bundleJs}
|
|
|
131949
132140
|
function makeInert2() {
|
|
131950
132141
|
const fn2 = () => inert;
|
|
131951
132142
|
const inert = new Proxy(fn2, {
|
|
131952
|
-
get: (_t2,
|
|
132143
|
+
get: (_t2, prop2) => prop2 === "then" ? void 0 : inert,
|
|
131953
132144
|
apply: () => inert,
|
|
131954
132145
|
construct: () => ({})
|
|
131955
132146
|
});
|
|
@@ -132029,7 +132220,7 @@ function runProduce(evaluator, bundleJs, timeoutMs, clock) {
|
|
|
132029
132220
|
}
|
|
132030
132221
|
};
|
|
132031
132222
|
const sandbox = {
|
|
132032
|
-
himalaya: new Proxy(himalayaTarget, { get: (t2,
|
|
132223
|
+
himalaya: new Proxy(himalayaTarget, { get: (t2, prop2) => prop2 in t2 ? t2[prop2] : inert }),
|
|
132033
132224
|
globalThis: void 0,
|
|
132034
132225
|
// #4546 — every method a device worker console has, as no-ops: a bundle calling console.group
|
|
132035
132226
|
// or console.time must not fail here when it works on every phone, web host and wrist.
|
|
@@ -132120,7 +132311,7 @@ function interpretProduce(services, parsed) {
|
|
|
132120
132311
|
return { services, widgets, views };
|
|
132121
132312
|
}
|
|
132122
132313
|
function contentEtag(snapshot2) {
|
|
132123
|
-
const
|
|
132314
|
+
const canonical5 = JSON.stringify({
|
|
132124
132315
|
widgetId: snapshot2.widgetId,
|
|
132125
132316
|
family: snapshot2.family,
|
|
132126
132317
|
size: snapshot2.size,
|
|
@@ -132129,7 +132320,7 @@ function contentEtag(snapshot2) {
|
|
|
132129
132320
|
// Lever A — a timeline change must bump the etag (frame values/times are content).
|
|
132130
132321
|
frames: snapshot2.frames ?? null
|
|
132131
132322
|
});
|
|
132132
|
-
return "sha256-" + createHash20("sha256").update(
|
|
132323
|
+
return "sha256-" + createHash20("sha256").update(canonical5).digest("base64");
|
|
132133
132324
|
}
|
|
132134
132325
|
async function buildWidgetSnapshot(bundleJs, widgetId, opts = {}) {
|
|
132135
132326
|
const { widgets } = await extractWidgets(bundleJs, opts);
|
|
@@ -133880,14 +134071,14 @@ async function pipeWebWixStream(upstream, res, signal, recordStream) {
|
|
|
133880
134071
|
const chunk = await reader.read();
|
|
133881
134072
|
if (chunk.done) break;
|
|
133882
134073
|
if (chunk.value && !res.write(chunk.value)) {
|
|
133883
|
-
await new Promise((
|
|
134074
|
+
await new Promise((resolve66) => {
|
|
133884
134075
|
let settled = false;
|
|
133885
134076
|
const finish2 = () => {
|
|
133886
134077
|
if (settled) return;
|
|
133887
134078
|
settled = true;
|
|
133888
134079
|
res.off("drain", finish2);
|
|
133889
134080
|
res.off("close", finish2);
|
|
133890
|
-
|
|
134081
|
+
resolve66();
|
|
133891
134082
|
};
|
|
133892
134083
|
if (res.destroyed || !res.writable) finish2();
|
|
133893
134084
|
else {
|
|
@@ -133975,7 +134166,7 @@ async function handleWebWix(req, res, state) {
|
|
|
133975
134166
|
}
|
|
133976
134167
|
if (match) {
|
|
133977
134168
|
const mocked = match.rule.response;
|
|
133978
|
-
if (mocked.delayMs) await new Promise((
|
|
134169
|
+
if (mocked.delayMs) await new Promise((resolve66) => setTimeout(resolve66, mocked.delayMs));
|
|
133979
134170
|
const payload = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
133980
134171
|
recordStream("mock", mocked.status, match.rule.id, mocked.headers);
|
|
133981
134172
|
res.statusCode = mocked.status;
|
|
@@ -134255,7 +134446,7 @@ async function handleWebWix(req, res, state) {
|
|
|
134255
134446
|
}
|
|
134256
134447
|
if (match) {
|
|
134257
134448
|
const mocked = match.rule.response;
|
|
134258
|
-
if (mocked.delayMs) await new Promise((
|
|
134449
|
+
if (mocked.delayMs) await new Promise((resolve66) => setTimeout(resolve66, mocked.delayMs));
|
|
134259
134450
|
const responseBody = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
134260
134451
|
record2("mock", mocked.status, responseBody, match.rule.id, mocked.headers);
|
|
134261
134452
|
return reply(200, { status: mocked.status, body: responseBody ?? "" });
|
|
@@ -136491,12 +136682,12 @@ var init_query = __esm({
|
|
|
136491
136682
|
});
|
|
136492
136683
|
|
|
136493
136684
|
// ../../core/dev-server/src/crawl-input.ts
|
|
136494
|
-
function resolved(v2,
|
|
136495
|
-
if (typeof v2 === "string") return v2.startsWith("$service:") ?
|
|
136685
|
+
function resolved(v2, resolve66) {
|
|
136686
|
+
if (typeof v2 === "string") return v2.startsWith("$service:") ? resolve66(v2) : v2;
|
|
136496
136687
|
if (Array.isArray(v2)) {
|
|
136497
136688
|
const out2 = v2.flatMap((el2) => {
|
|
136498
136689
|
if (typeof el2 !== "string" || !el2.startsWith("$service:")) return [el2];
|
|
136499
|
-
const r2 =
|
|
136690
|
+
const r2 = resolve66(el2);
|
|
136500
136691
|
return Array.isArray(r2) ? r2 : [r2];
|
|
136501
136692
|
});
|
|
136502
136693
|
return out2;
|
|
@@ -136510,9 +136701,9 @@ function hasRowBinding(props) {
|
|
|
136510
136701
|
return itemToken(v2) || Array.isArray(v2) && v2.some(itemToken);
|
|
136511
136702
|
});
|
|
136512
136703
|
}
|
|
136513
|
-
function declaredOptionIds(props,
|
|
136704
|
+
function declaredOptionIds(props, resolve66) {
|
|
136514
136705
|
const literal = props.options ?? props.tabs ?? props.chips;
|
|
136515
|
-
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath,
|
|
136706
|
+
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath, resolve66) : void 0;
|
|
136516
136707
|
const raw = Array.isArray(bound) ? bound : literal;
|
|
136517
136708
|
if (!Array.isArray(raw)) return [];
|
|
136518
136709
|
const out2 = [];
|
|
@@ -136555,24 +136746,24 @@ function seedTokens(state, limit = 48) {
|
|
|
136555
136746
|
walk2(state, 0);
|
|
136556
136747
|
return out2;
|
|
136557
136748
|
}
|
|
136558
|
-
function synthesizeInput(control,
|
|
136749
|
+
function synthesizeInput(control, resolve66, tokens2) {
|
|
136559
136750
|
const id = `${control.type}.${control.callback}`;
|
|
136560
136751
|
const row = SYNTHESIZED_CONTROLS[id];
|
|
136561
136752
|
if (!row) return null;
|
|
136562
136753
|
const props = control.props;
|
|
136563
136754
|
if (hasRowBinding(props)) return null;
|
|
136564
136755
|
if (row.from === "declared-options") {
|
|
136565
|
-
const ids = declaredOptionIds(props,
|
|
136756
|
+
const ids = declaredOptionIds(props, resolve66);
|
|
136566
136757
|
if (!ids.length) return null;
|
|
136567
136758
|
if (row.encoding === "string-array") {
|
|
136568
|
-
const currentRaw2 = resolved(props.selectedIds,
|
|
136759
|
+
const currentRaw2 = resolved(props.selectedIds, resolve66);
|
|
136569
136760
|
const current3 = (Array.isArray(currentRaw2) ? currentRaw2 : []).filter((x2) => typeof x2 === "string");
|
|
136570
136761
|
const pick5 = ids.find((o2) => !current3.includes(o2));
|
|
136571
136762
|
if (pick5 === void 0) return null;
|
|
136572
136763
|
const value = props.multiSelect === true ? [...current3, pick5] : [pick5];
|
|
136573
136764
|
return { key: row.key, value, from: row.from, current: current3, control: id };
|
|
136574
136765
|
}
|
|
136575
|
-
const currentRaw = resolved(props.selectedId,
|
|
136766
|
+
const currentRaw = resolved(props.selectedId, resolve66);
|
|
136576
136767
|
const current2 = typeof currentRaw === "string" ? currentRaw : void 0;
|
|
136577
136768
|
const pick4 = ids.find((o2) => o2 !== current2);
|
|
136578
136769
|
if (pick4 === void 0) return null;
|
|
@@ -136580,7 +136771,7 @@ function synthesizeInput(control, resolve65, tokens2) {
|
|
|
136580
136771
|
}
|
|
136581
136772
|
if (!acceptsWords(props) || !acceptsWords(control.wrapper ?? {})) return null;
|
|
136582
136773
|
const binding2 = typeof props.valuePath === "string" ? props.valuePath : typeof props.value === "string" && props.value.startsWith("$service:") ? props.value : void 0;
|
|
136583
|
-
const bound = binding2 === void 0 ? void 0 :
|
|
136774
|
+
const bound = binding2 === void 0 ? void 0 : resolve66(binding2);
|
|
136584
136775
|
const literal = typeof props.value === "string" && !props.value.startsWith("$") ? props.value : void 0;
|
|
136585
136776
|
const current = typeof bound === "string" ? bound : typeof bound === "number" ? String(bound) : literal ?? "";
|
|
136586
136777
|
const max = typeof props.maxLength === "number" && props.maxLength > 0 ? props.maxLength : void 0;
|
|
@@ -136980,7 +137171,7 @@ function layeredTransport(layers3) {
|
|
|
136980
137171
|
const rules = layers3.rules?.length ? [...layers3.rules] : null;
|
|
136981
137172
|
const cms = layers3.cmsSeed && Object.keys(layers3.cmsSeed).length ? layers3.cmsSeed : null;
|
|
136982
137173
|
const canned = layers3.canned && Object.keys(layers3.canned).length ? layers3.canned : null;
|
|
136983
|
-
const
|
|
137174
|
+
const label3 = [rules && "mocked", cms && "cms", canned && "canned"].filter(Boolean).join("+") || "offline";
|
|
136984
137175
|
const call = async (method, path2, body) => {
|
|
136985
137176
|
const m2 = String(method).toUpperCase();
|
|
136986
137177
|
const p2 = String(path2);
|
|
@@ -137018,10 +137209,10 @@ function layeredTransport(layers3) {
|
|
|
137018
137209
|
const hit = canned[`${m2} ${bare}`] ?? canned[`${m2} ${p2}`];
|
|
137019
137210
|
if (hit !== void 0) return structuredClone(hit);
|
|
137020
137211
|
}
|
|
137021
|
-
if (
|
|
137022
|
-
throw new Error(`no data layer served ${m2} ${bare} (layers: ${
|
|
137212
|
+
if (label3 === "offline") throw new Error(REJECT_ALL_MESSAGE);
|
|
137213
|
+
throw new Error(`no data layer served ${m2} ${bare} (layers: ${label3}) \u2014 add a net-mocks rule for it, or handle the failure in the worker`);
|
|
137023
137214
|
};
|
|
137024
|
-
return { call, label:
|
|
137215
|
+
return { call, label: label3 };
|
|
137025
137216
|
}
|
|
137026
137217
|
function emptiedArrays(value) {
|
|
137027
137218
|
if (Array.isArray(value)) return [];
|
|
@@ -137797,7 +137988,7 @@ async function crawlScreenInner(opts) {
|
|
|
137797
137988
|
const drainPollDirectives = (w2, trigger) => {
|
|
137798
137989
|
const declared = Object.keys(w2.handles);
|
|
137799
137990
|
for (const d2 of w2.pollDirectives.splice(0)) {
|
|
137800
|
-
const
|
|
137991
|
+
const label3 = d2.id ? `_poll "${d2.id}"` : "_poll";
|
|
137801
137992
|
if (!d2.id) {
|
|
137802
137993
|
findings.push({
|
|
137803
137994
|
screen: screenId,
|
|
@@ -137817,7 +138008,7 @@ async function crawlScreenInner(opts) {
|
|
|
137817
138008
|
trigger,
|
|
137818
138009
|
invariant: "poll-action-missing",
|
|
137819
138010
|
severity: "error",
|
|
137820
|
-
message: `${
|
|
138011
|
+
message: `${label3} names action "${d2.action}", which is not "<service>.<action>" \u2014 every host ignores it, so the screen never refreshes`,
|
|
137821
138012
|
actual: d2.action || void 0,
|
|
137822
138013
|
hint: `\`action\` is exactly two dot-separated segments, the same contract _stream's onEvent uses. Services defined: ${declared.join(", ") || "none"}`
|
|
137823
138014
|
});
|
|
@@ -137831,7 +138022,7 @@ async function crawlScreenInner(opts) {
|
|
|
137831
138022
|
trigger,
|
|
137832
138023
|
invariant: "poll-action-missing",
|
|
137833
138024
|
severity: "error",
|
|
137834
|
-
message: `${
|
|
138025
|
+
message: `${label3} polls ${d2.action}, but the bundle defines no service "${service}" \u2014 the tick fires forever and does nothing`,
|
|
137835
138026
|
actual: d2.action,
|
|
137836
138027
|
hint: `services defined: ${declared.join(", ") || "none"}. The host invokes the poll on THIS screen's worker, so the service has to be one this bundle defines.`
|
|
137837
138028
|
});
|
|
@@ -137843,7 +138034,7 @@ async function crawlScreenInner(opts) {
|
|
|
137843
138034
|
trigger,
|
|
137844
138035
|
invariant: "poll-action-missing",
|
|
137845
138036
|
severity: "error",
|
|
137846
|
-
message: `${
|
|
138037
|
+
message: `${label3} polls ${d2.action}, but service "${service}" declares no action "${action}" \u2014 the tick fires forever and does nothing`,
|
|
137847
138038
|
actual: d2.action,
|
|
137848
138039
|
hint: `${service} actions: ${handle.actionNames().join(", ") || "none"}`
|
|
137849
138040
|
});
|
|
@@ -137855,7 +138046,7 @@ async function crawlScreenInner(opts) {
|
|
|
137855
138046
|
trigger,
|
|
137856
138047
|
invariant: "poll-action-missing",
|
|
137857
138048
|
severity: "error",
|
|
137858
|
-
message: `${
|
|
138049
|
+
message: `${label3} asks for an intervalMs of ${d2.intervalMs === null ? "(absent)" : d2.intervalMs} \u2014 every host rejects a non-positive/non-finite interval outright, so no timer is ever armed`,
|
|
137859
138050
|
actual: d2.intervalMs === null ? "(absent)" : String(d2.intervalMs),
|
|
137860
138051
|
hint: "give a positive number of milliseconds; the host clamps anything under the 1000ms floor and logs the clamp, so a small-but-coherent request is fine"
|
|
137861
138052
|
});
|
|
@@ -139639,7 +139830,7 @@ async function liveRenderServices(bundleJs, opts) {
|
|
|
139639
139830
|
return loadBundleServicesLive(bundleJs, liveBootOptions(opts, bus));
|
|
139640
139831
|
}
|
|
139641
139832
|
async function settleUnawaitedWork() {
|
|
139642
|
-
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((
|
|
139833
|
+
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((resolve66) => setTimeout(resolve66, 0));
|
|
139643
139834
|
}
|
|
139644
139835
|
async function loadAndSettle(bundleJs, options) {
|
|
139645
139836
|
const w2 = await bootBundleWorker(bundleJs, options);
|
|
@@ -139828,12 +140019,12 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
139828
140019
|
localDbSchema: appLocalDbSchema,
|
|
139829
140020
|
...collect2.render.loadBudgetMs ? { budgetMs: collect2.render.loadBudgetMs } : {},
|
|
139830
140021
|
transportWrap: (call) => async (method, path2, body) => {
|
|
139831
|
-
const
|
|
139832
|
-
calls.push(
|
|
140022
|
+
const label3 = `${String(method).toUpperCase()} ${String(path2).split("?")[0]}`;
|
|
140023
|
+
calls.push(label3);
|
|
139833
140024
|
try {
|
|
139834
140025
|
return await call(method, path2, body);
|
|
139835
140026
|
} catch (e2) {
|
|
139836
|
-
if (isUnservedRequest(e2)) unserved.push(
|
|
140027
|
+
if (isUnservedRequest(e2)) unserved.push(label3);
|
|
139837
140028
|
throw e2;
|
|
139838
140029
|
}
|
|
139839
140030
|
}
|
|
@@ -140235,7 +140426,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
140235
140426
|
const src = t2.pattern.source;
|
|
140236
140427
|
const raw = src.startsWith("^") && src.endsWith(DUAL_FORM_TAIL) ? src.slice(1, src.length - DUAL_FORM_TAIL.length) : null;
|
|
140237
140428
|
return { t: t2, canonical: raw && /^[A-Za-z0-9_]+$/.test(raw) ? raw : null };
|
|
140238
|
-
}).filter(({ t: t2, canonical:
|
|
140429
|
+
}).filter(({ t: t2, canonical: canonical5 }) => canonical5 !== null || typeof t2.seedIds === "function");
|
|
140239
140430
|
if (bakeRoutes.length) {
|
|
140240
140431
|
const seedCtx = {
|
|
140241
140432
|
store: preloaded.module.createStore(app),
|
|
@@ -140251,7 +140442,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
140251
140442
|
// carry a working URL + digest into the release, not a null.
|
|
140252
140443
|
asset: (name) => resolveAssetForBuild(preloaded.dir, name, base, app)
|
|
140253
140444
|
};
|
|
140254
|
-
for (const { t: t2, canonical:
|
|
140445
|
+
for (const { t: t2, canonical: canonical5 } of bakeRoutes) {
|
|
140255
140446
|
let ids = [];
|
|
140256
140447
|
try {
|
|
140257
140448
|
ids = typeof t2.seedIds === "function" ? await t2.seedIds(seedCtx) ?? [] : [];
|
|
@@ -140262,7 +140453,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
140262
140453
|
`[release-build] seedIds threw for templated route ${String(t2.pattern)} in "${app}" \u2014 no instances of it will be baked. If it reaches the network, note that the bake origin is ${base} and a plain bake opens no socket. ${String(err)}`
|
|
140263
140454
|
);
|
|
140264
140455
|
}
|
|
140265
|
-
if (
|
|
140456
|
+
if (canonical5) ids = [canonical5, ...ids.filter((id) => id !== canonical5)];
|
|
140266
140457
|
for (const screenId of ids) {
|
|
140267
140458
|
if (screens[screenId]) continue;
|
|
140268
140459
|
if (screenId.includes("/") || screenId.includes("..")) continue;
|
|
@@ -140309,7 +140500,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
140309
140500
|
}
|
|
140310
140501
|
const json7 = pinBakedServerBaseUrl(JSON.stringify(descriptor), base);
|
|
140311
140502
|
await store.putScreen(app, screenId, json7);
|
|
140312
|
-
screens[screenId] = { descriptorHash: sha2564(json7), bundle: bundleName, ...screenMetadataFor(screenMetadata, screenId,
|
|
140503
|
+
screens[screenId] = { descriptorHash: sha2564(json7), bundle: bundleName, ...screenMetadataFor(screenMetadata, screenId, canonical5) };
|
|
140313
140504
|
rememberInput(bundleName, JSON.parse(json7));
|
|
140314
140505
|
if (collect2?.descriptors) {
|
|
140315
140506
|
baked.push({
|
|
@@ -140626,8 +140817,8 @@ var init_build3 = __esm({
|
|
|
140626
140817
|
init_icons();
|
|
140627
140818
|
init_build2();
|
|
140628
140819
|
init_release_pin();
|
|
140629
|
-
|
|
140630
|
-
|
|
140820
|
+
init_schema2();
|
|
140821
|
+
init_ownership2();
|
|
140631
140822
|
init_src2();
|
|
140632
140823
|
init_tier_caps();
|
|
140633
140824
|
init_stream_policy2();
|
|
@@ -142524,10 +142715,10 @@ function isInsideRepo(p2) {
|
|
|
142524
142715
|
const rel = relative10(REPO_ROOT3, resolve42(p2));
|
|
142525
142716
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute4(rel);
|
|
142526
142717
|
}
|
|
142527
|
-
function assertCredentialOutsideRepo(
|
|
142718
|
+
function assertCredentialOutsideRepo(label3, p2) {
|
|
142528
142719
|
if (isInsideRepo(p2)) {
|
|
142529
142720
|
throw new Error(
|
|
142530
|
-
`${
|
|
142721
|
+
`${label3} resolves inside the repo (${p2}). Store credentials/keystores must live outside the tree and be gitignored \u2014 move it and reference an absolute external path.`
|
|
142531
142722
|
);
|
|
142532
142723
|
}
|
|
142533
142724
|
}
|
|
@@ -152034,9 +152225,9 @@ function testPostcardMessage(s2) {
|
|
|
152034
152225
|
function testPostcardCounts(message) {
|
|
152035
152226
|
const head = message.split(". ")[0];
|
|
152036
152227
|
const counts = /* @__PURE__ */ new Map();
|
|
152037
|
-
const num4 = (re2,
|
|
152228
|
+
const num4 = (re2, label3) => {
|
|
152038
152229
|
const m2 = re2.exec(head);
|
|
152039
|
-
if (m2) counts.set(
|
|
152230
|
+
if (m2) counts.set(label3, Number(m2[1]));
|
|
152040
152231
|
};
|
|
152041
152232
|
if (head.startsWith("Test crawl in the browser: ")) {
|
|
152042
152233
|
num4(/ — (\d+) findings? to fix\.?$/, "findings");
|
|
@@ -152055,12 +152246,12 @@ function testChangeNote(headline2, change) {
|
|
|
152055
152246
|
const was = testPostcardCounts(change.previous);
|
|
152056
152247
|
const now = testPostcardCounts(headline2);
|
|
152057
152248
|
const sameKind = headline2.startsWith("Test crawl in the browser: ") === change.previous.startsWith("Test crawl in the browser: ");
|
|
152058
|
-
const read = (m2,
|
|
152249
|
+
const read = (m2, label3) => m2.get(label3) ?? (label3 === "unlinked screens" && m2.has("broken links") ? 0 : void 0);
|
|
152059
152250
|
const labels = [.../* @__PURE__ */ new Set([...now.keys(), ...was.keys()])];
|
|
152060
|
-
const moved = sameKind ? labels.flatMap((
|
|
152061
|
-
const a2 = read(was,
|
|
152062
|
-
const b2 = read(now,
|
|
152063
|
-
return a2 !== void 0 && b2 !== void 0 && a2 !== b2 ? [`${
|
|
152251
|
+
const moved = sameKind ? labels.flatMap((label3) => {
|
|
152252
|
+
const a2 = read(was, label3);
|
|
152253
|
+
const b2 = read(now, label3);
|
|
152254
|
+
return a2 !== void 0 && b2 !== void 0 && a2 !== b2 ? [`${label3} ${a2} \u2192 ${b2}`] : [];
|
|
152064
152255
|
}) : [];
|
|
152065
152256
|
const picture = !change.pictureChanged ? void 0 : change.hadPicture && change.hasPicture ? "the home screen changed" : change.hasPicture ? "a home picture this time" : "no home picture this time";
|
|
152066
152257
|
if (moved.length) return `Since the last crawl: ${moved.join(", ")}${picture ? `; ${picture}` : ""}.`;
|
|
@@ -153223,7 +153414,7 @@ function pushRouteAdvisories(pushRoutes) {
|
|
|
153223
153414
|
];
|
|
153224
153415
|
}
|
|
153225
153416
|
function unmappedAdvisory({ destination, vertical, reason, screenId, paramKey }) {
|
|
153226
|
-
const
|
|
153417
|
+
const canonical5 = WIX_MEMBER_PUSH_DESTINATIONS.find((d2) => d2.id === destination)?.canonicalScreen;
|
|
153227
153418
|
if (reason === "param_not_declared") {
|
|
153228
153419
|
return `push-route-unmapped: push.screens sends "${destination}" notifications to "${screenId}" with paramKey "${paramKey}", which "${screenId}" does not declare, so a shell would drop it. Use one of the keys its linkable screen declares, or add "${paramKey}" to its paramKeys.`;
|
|
153229
153420
|
}
|
|
@@ -153233,7 +153424,7 @@ function unmappedAdvisory({ destination, vertical, reason, screenId, paramKey })
|
|
|
153233
153424
|
if (screenId) {
|
|
153234
153425
|
return `push-route-unmapped: push.screens maps "${destination}" to "${screenId}", which is not a linkable screen, so the device could not open it. Add it to navigation.linkableScreens, or map another screen.`;
|
|
153235
153426
|
}
|
|
153236
|
-
return `push-route-unmapped: the site has ${vertical}, but no screen opens "${destination}" notifications. Name that screen "${
|
|
153427
|
+
return `push-route-unmapped: the site has ${vertical}, but no screen opens "${destination}" notifications. Name that screen "${canonical5}", or map it: push.screens: { "${destination}": "<screenId>" }.`;
|
|
153237
153428
|
}
|
|
153238
153429
|
function navSharedIdErrors(nav) {
|
|
153239
153430
|
const items = (key2) => {
|
|
@@ -153316,6 +153507,63 @@ var init_nav_lint = __esm({
|
|
|
153316
153507
|
}
|
|
153317
153508
|
});
|
|
153318
153509
|
|
|
153510
|
+
// src/base44-schema.ts
|
|
153511
|
+
var base44_schema_exports = {};
|
|
153512
|
+
__export(base44_schema_exports, {
|
|
153513
|
+
BASE44_BUILTIN_FIELDS: () => BASE44_BUILTIN_FIELDS,
|
|
153514
|
+
BASE44_FIELD_TYPES: () => BASE44_FIELD_TYPES,
|
|
153515
|
+
BASE44_STRING_FORMATS: () => BASE44_STRING_FORMATS,
|
|
153516
|
+
base44Prefix: () => base44Prefix,
|
|
153517
|
+
isAdoptedEntity: () => isAdoptedEntity,
|
|
153518
|
+
isOwnedEntity: () => isOwnedEntity,
|
|
153519
|
+
physicalEntityName: () => physicalEntityName,
|
|
153520
|
+
physicalFunctionName: () => physicalFunctionName,
|
|
153521
|
+
validateBase44Entities: () => validateBase44Entities
|
|
153522
|
+
});
|
|
153523
|
+
var init_base44_schema = __esm({
|
|
153524
|
+
"src/base44-schema.ts"() {
|
|
153525
|
+
init_ownership();
|
|
153526
|
+
}
|
|
153527
|
+
});
|
|
153528
|
+
|
|
153529
|
+
// src/base44-lint.ts
|
|
153530
|
+
var base44_lint_exports = {};
|
|
153531
|
+
__export(base44_lint_exports, {
|
|
153532
|
+
base44DefineAppFinding: () => base44DefineAppFinding,
|
|
153533
|
+
base44Issues: () => base44Issues
|
|
153534
|
+
});
|
|
153535
|
+
function base44DefineAppFinding(err) {
|
|
153536
|
+
const m2 = DEFINE_APP_THROW.exec(err instanceof Error ? err.message : String(err));
|
|
153537
|
+
return m2 ? { ruleCode: m2[2], message: m2[1] } : null;
|
|
153538
|
+
}
|
|
153539
|
+
async function base44Issues(dir, app, strict, opts) {
|
|
153540
|
+
let base44;
|
|
153541
|
+
try {
|
|
153542
|
+
const cfg = await loadAppConfigModule(dir);
|
|
153543
|
+
base44 = cfg?.base44;
|
|
153544
|
+
} catch (err) {
|
|
153545
|
+
const m2 = opts?.local === true ? base44DefineAppFinding(err) : null;
|
|
153546
|
+
if (!m2) return [];
|
|
153547
|
+
return [{ screen: null, pass: "base44", severity: "error", ruleCode: m2.ruleCode, message: `base44: ${m2.message}` }];
|
|
153548
|
+
}
|
|
153549
|
+
if (!base44 || typeof base44 !== "object") return [];
|
|
153550
|
+
return validateBase44Entities({ entities: base44.entities, functions: base44.functions }, app).map((i2) => ({
|
|
153551
|
+
screen: null,
|
|
153552
|
+
pass: "base44",
|
|
153553
|
+
severity: strict && i2.severity === "warning" ? "error" : i2.severity,
|
|
153554
|
+
ruleCode: i2.ruleCode,
|
|
153555
|
+
message: i2.entity ? `base44 "${i2.entity}": ${i2.message}` : `base44: ${i2.message}`
|
|
153556
|
+
}));
|
|
153557
|
+
}
|
|
153558
|
+
var DEFINE_APP_THROW;
|
|
153559
|
+
var init_base44_lint = __esm({
|
|
153560
|
+
"src/base44-lint.ts"() {
|
|
153561
|
+
init_app_config_loader();
|
|
153562
|
+
init_base44_schema();
|
|
153563
|
+
DEFINE_APP_THROW = /defineApp: base44\.entities: (.*) \(([a-z-]+)\)$/s;
|
|
153564
|
+
}
|
|
153565
|
+
});
|
|
153566
|
+
|
|
153319
153567
|
// src/eject.ts
|
|
153320
153568
|
var eject_exports = {};
|
|
153321
153569
|
__export(eject_exports, {
|
|
@@ -154768,7 +155016,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
154768
155016
|
const headers2 = Object.fromEntries(new Headers(init.headers).entries());
|
|
154769
155017
|
const request = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
154770
155018
|
const hostname3 = url.hostname.replace(/^\[|\]$/g, "");
|
|
154771
|
-
return await new Promise((
|
|
155019
|
+
return await new Promise((resolve66, reject) => {
|
|
154772
155020
|
let settled = false;
|
|
154773
155021
|
const finish2 = (fn2) => {
|
|
154774
155022
|
if (settled) return;
|
|
@@ -154805,7 +155053,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
154805
155053
|
}
|
|
154806
155054
|
const responseHeaders = new Headers();
|
|
154807
155055
|
for (const [key2, value] of Object.entries(response.headers)) if (value !== void 0) responseHeaders.set(key2, Array.isArray(value) ? value.join(", ") : value);
|
|
154808
|
-
|
|
155056
|
+
resolve66(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
|
|
154809
155057
|
}));
|
|
154810
155058
|
});
|
|
154811
155059
|
req.once("error", (error) => finish2(() => reject(error)));
|
|
@@ -155105,7 +155353,7 @@ function createLocalTestSandbox() {
|
|
|
155105
155353
|
}
|
|
155106
155354
|
})();
|
|
155107
155355
|
`;
|
|
155108
|
-
return await new Promise((
|
|
155356
|
+
return await new Promise((resolve66, reject) => {
|
|
155109
155357
|
const { port1, port2 } = new MessageChannel();
|
|
155110
155358
|
const serializableContext = {
|
|
155111
155359
|
auth: context.auth,
|
|
@@ -155181,7 +155429,7 @@ function createLocalTestSandbox() {
|
|
|
155181
155429
|
timer = setTimeout(() => finish2(() => reject(new SandboxError("timeout", `execution exceeded ${limits.timeoutMs}ms`))), Math.max(1, limits.timeoutMs));
|
|
155182
155430
|
return;
|
|
155183
155431
|
}
|
|
155184
|
-
if (message.ok) finish2(() =>
|
|
155432
|
+
if (message.ok) finish2(() => resolve66({ value: message.value, durationMs: Date.now() - started }));
|
|
155185
155433
|
else finish2(() => reject(new SandboxError("execution_failed", message.message ?? "handler failed")));
|
|
155186
155434
|
});
|
|
155187
155435
|
worker.once("error", (error) => finish2(() => reject(new SandboxError("execution_failed", error.message))));
|
|
@@ -155478,9 +155726,9 @@ function planResourceChange(input) {
|
|
|
155478
155726
|
}
|
|
155479
155727
|
var init_plan3 = __esm({
|
|
155480
155728
|
"../../core/data-resources/src/plan.ts"() {
|
|
155481
|
-
|
|
155482
|
-
|
|
155483
|
-
|
|
155729
|
+
init_ownership2();
|
|
155730
|
+
init_ownership2();
|
|
155731
|
+
init_schema2();
|
|
155484
155732
|
}
|
|
155485
155733
|
});
|
|
155486
155734
|
|
|
@@ -155573,8 +155821,8 @@ var ResourceApplyError;
|
|
|
155573
155821
|
var init_apply = __esm({
|
|
155574
155822
|
"../../core/data-resources/src/apply.ts"() {
|
|
155575
155823
|
init_plan3();
|
|
155576
|
-
|
|
155577
|
-
|
|
155824
|
+
init_ownership2();
|
|
155825
|
+
init_schema2();
|
|
155578
155826
|
init_tombstones();
|
|
155579
155827
|
ResourceApplyError = class extends Error {
|
|
155580
155828
|
constructor(code, message) {
|
|
@@ -155790,8 +156038,8 @@ function createFunctionDataCapability(options) {
|
|
|
155790
156038
|
}
|
|
155791
156039
|
var init_data = __esm({
|
|
155792
156040
|
"../../core/functions-runtime/src/data.ts"() {
|
|
155793
|
-
|
|
155794
|
-
|
|
156041
|
+
init_schema2();
|
|
156042
|
+
init_ownership2();
|
|
155795
156043
|
init_plan3();
|
|
155796
156044
|
init_apply();
|
|
155797
156045
|
init_tombstones();
|
|
@@ -156313,8 +156561,8 @@ var init_functions = __esm({
|
|
|
156313
156561
|
init_build2();
|
|
156314
156562
|
init_gateway();
|
|
156315
156563
|
init_sandbox();
|
|
156316
|
-
|
|
156317
|
-
|
|
156564
|
+
init_schema2();
|
|
156565
|
+
init_ownership2();
|
|
156318
156566
|
BO_FUNCTIONS_BASE_URL = "https://bo.wix.com/_api/himalaya-functions";
|
|
156319
156567
|
}
|
|
156320
156568
|
});
|
|
@@ -157080,12 +157328,12 @@ function createLoginSession(deps) {
|
|
|
157080
157328
|
current = pending;
|
|
157081
157329
|
const out2 = [];
|
|
157082
157330
|
const err = [];
|
|
157083
|
-
return new Promise((
|
|
157331
|
+
return new Promise((resolve66) => {
|
|
157084
157332
|
let answered = false;
|
|
157085
157333
|
const answer = () => {
|
|
157086
157334
|
if (answered) return;
|
|
157087
157335
|
answered = true;
|
|
157088
|
-
|
|
157336
|
+
resolve66(current);
|
|
157089
157337
|
};
|
|
157090
157338
|
let child;
|
|
157091
157339
|
try {
|
|
@@ -157208,9 +157456,9 @@ async function startMcpServer(opts) {
|
|
|
157208
157456
|
login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
|
|
157209
157457
|
...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
|
|
157210
157458
|
};
|
|
157211
|
-
const closed = new Promise((
|
|
157212
|
-
stdin.once("end",
|
|
157213
|
-
stdin.once("close",
|
|
157459
|
+
const closed = new Promise((resolve66) => {
|
|
157460
|
+
stdin.once("end", resolve66);
|
|
157461
|
+
stdin.once("close", resolve66);
|
|
157214
157462
|
});
|
|
157215
157463
|
const handle = serveStdio(
|
|
157216
157464
|
() => {
|
|
@@ -157590,10 +157838,10 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
157590
157838
|
for (const source of Object.values(files)) visit(source);
|
|
157591
157839
|
return { modules, unsupported };
|
|
157592
157840
|
}
|
|
157593
|
-
function sdkSubpathReader(
|
|
157841
|
+
function sdkSubpathReader(resolve66) {
|
|
157594
157842
|
return (sub) => {
|
|
157595
157843
|
try {
|
|
157596
|
-
return readFileSync79(
|
|
157844
|
+
return readFileSync79(resolve66(`@wix/himalaya/${sub}`), "utf8");
|
|
157597
157845
|
} catch {
|
|
157598
157846
|
return null;
|
|
157599
157847
|
}
|
|
@@ -157671,7 +157919,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
157671
157919
|
const token = mintToken2(payload);
|
|
157672
157920
|
const unusable = await probeAuthoringPage(opts.authoringBase, opts.fetchImpl, opts.probeTimeoutMs);
|
|
157673
157921
|
if (unusable) throw new Error(unusable);
|
|
157674
|
-
return await new Promise((
|
|
157922
|
+
return await new Promise((resolve66, reject) => {
|
|
157675
157923
|
let settled = false;
|
|
157676
157924
|
let url = "";
|
|
157677
157925
|
const server = createServer5();
|
|
@@ -157723,7 +157971,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
157723
157971
|
}
|
|
157724
157972
|
res.writeHead(200, { "content-type": "text/plain" }).end("ok");
|
|
157725
157973
|
const report3 = body.result;
|
|
157726
|
-
finish2(() =>
|
|
157974
|
+
finish2(() => resolve66({ report: report3, url }));
|
|
157727
157975
|
})();
|
|
157728
157976
|
});
|
|
157729
157977
|
server.on("error", (e2) => finish2(() => reject(e2)));
|
|
@@ -160674,12 +160922,12 @@ function defaultGitOps(cwd = process.cwd()) {
|
|
|
160674
160922
|
}
|
|
160675
160923
|
};
|
|
160676
160924
|
}
|
|
160677
|
-
function slugForTag(
|
|
160678
|
-
const s2 =
|
|
160925
|
+
function slugForTag(label3) {
|
|
160926
|
+
const s2 = label3.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
160679
160927
|
return s2 || "release";
|
|
160680
160928
|
}
|
|
160681
|
-
function tagName(app,
|
|
160682
|
-
return `serve/${app}/${slugForTag(
|
|
160929
|
+
function tagName(app, label3) {
|
|
160930
|
+
return `serve/${app}/${slugForTag(label3)}`;
|
|
160683
160931
|
}
|
|
160684
160932
|
var init_git = __esm({
|
|
160685
160933
|
"../serve-cli/src/git.ts"() {
|
|
@@ -160822,11 +161070,11 @@ async function main() {
|
|
|
160822
161070
|
const ni2 = rest.indexOf("--name");
|
|
160823
161071
|
const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
|
|
160824
161072
|
const yml = readFileSync86(iosProjectYml(app), "utf8");
|
|
160825
|
-
for (const { id, label:
|
|
161073
|
+
for (const { id, label: label3 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
|
|
160826
161074
|
id: embeddedBundleId(identifier, b2),
|
|
160827
161075
|
label: `${name} ${embeddedAppIdLabel(b2)}`
|
|
160828
161076
|
}))]) {
|
|
160829
|
-
const r2 = await registerBundleId({ identifier: id, name:
|
|
161077
|
+
const r2 = await registerBundleId({ identifier: id, name: label3 });
|
|
160830
161078
|
console.log(`bundle id ${id}: ${r2.status}${r2.id ? ` (${r2.id})` : ""}`);
|
|
160831
161079
|
}
|
|
160832
161080
|
}
|
|
@@ -160930,7 +161178,7 @@ var init_iap_client = __esm({
|
|
|
160930
161178
|
this.options = options;
|
|
160931
161179
|
this.fetchImpl = options.fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
|
|
160932
161180
|
this.now = options.now ?? Date.now;
|
|
160933
|
-
this.sleep = options.sleep ?? ((ms2) => new Promise((
|
|
161181
|
+
this.sleep = options.sleep ?? ((ms2) => new Promise((resolve66) => setTimeout(resolve66, ms2)));
|
|
160934
161182
|
}
|
|
160935
161183
|
fetchImpl;
|
|
160936
161184
|
now;
|
|
@@ -161444,15 +161692,15 @@ function reportCredentialMaterial(reader, value, path2) {
|
|
|
161444
161692
|
for (const [key2, v2] of Object.entries(value)) reportCredentialMaterial(reader, v2, childPath(path2, key2));
|
|
161445
161693
|
}
|
|
161446
161694
|
}
|
|
161447
|
-
function parseJson3(text9,
|
|
161695
|
+
function parseJson3(text9, label3) {
|
|
161448
161696
|
try {
|
|
161449
161697
|
return JSON.parse(text9);
|
|
161450
161698
|
} catch (e2) {
|
|
161451
|
-
throw new Error(`${
|
|
161699
|
+
throw new Error(`${label3} is not valid JSON: ${e2.message}`);
|
|
161452
161700
|
}
|
|
161453
161701
|
}
|
|
161454
|
-
function parseIapManifest(text9,
|
|
161455
|
-
const doc = parseJson3(text9,
|
|
161702
|
+
function parseIapManifest(text9, label3) {
|
|
161703
|
+
const doc = parseJson3(text9, label3);
|
|
161456
161704
|
const reader = new ManifestReader();
|
|
161457
161705
|
const obj4 = reader.object(doc, "", MANIFEST_KEYS);
|
|
161458
161706
|
if (obj4.manifestVersion !== 1) reader.problems.push("manifestVersion must be 1");
|
|
@@ -161460,7 +161708,7 @@ function parseIapManifest(text9, label2) {
|
|
|
161460
161708
|
const items = reader.list(obj4, "items", "").map((item, i2) => readItem(reader, item, i2));
|
|
161461
161709
|
reportDuplicateMappings(reader, items);
|
|
161462
161710
|
reportCredentialMaterial(reader, doc, "");
|
|
161463
|
-
if (reader.problems.length) throw new IapManifestError(
|
|
161711
|
+
if (reader.problems.length) throw new IapManifestError(label3, reader.problems);
|
|
161464
161712
|
return { manifestVersion: 1, target, items };
|
|
161465
161713
|
}
|
|
161466
161714
|
function sortKeys(value) {
|
|
@@ -161482,10 +161730,10 @@ var IapManifestError, APPLE_APP_ID, TEAM_ID, BUNDLE_ID, PRODUCT_ID, TERRITORY, C
|
|
|
161482
161730
|
var init_iap_manifest = __esm({
|
|
161483
161731
|
"../store-release/iap-manifest.ts"() {
|
|
161484
161732
|
IapManifestError = class extends Error {
|
|
161485
|
-
constructor(
|
|
161486
|
-
super(`${
|
|
161733
|
+
constructor(label3, problems) {
|
|
161734
|
+
super(`${label3} is not a valid IAP manifest:
|
|
161487
161735
|
- ${problems.join("\n - ")}`);
|
|
161488
|
-
this.label =
|
|
161736
|
+
this.label = label3;
|
|
161489
161737
|
this.problems = problems;
|
|
161490
161738
|
}
|
|
161491
161739
|
};
|
|
@@ -162685,22 +162933,22 @@ function profilePath(name, home = homedir9()) {
|
|
|
162685
162933
|
}
|
|
162686
162934
|
return join74(credentialsDir(home), `${name}.json`);
|
|
162687
162935
|
}
|
|
162688
|
-
function parseProfile(text9,
|
|
162936
|
+
function parseProfile(text9, label3) {
|
|
162689
162937
|
let doc;
|
|
162690
162938
|
try {
|
|
162691
162939
|
doc = JSON.parse(text9);
|
|
162692
162940
|
} catch (e2) {
|
|
162693
|
-
throw new Error(`${
|
|
162941
|
+
throw new Error(`${label3} is not valid JSON: ${e2.message}`);
|
|
162694
162942
|
}
|
|
162695
162943
|
if (!doc || typeof doc !== "object" || Array.isArray(doc)) {
|
|
162696
|
-
throw new Error(`${
|
|
162944
|
+
throw new Error(`${label3} must be a JSON object with ${FIELDS.join(", ")}.`);
|
|
162697
162945
|
}
|
|
162698
162946
|
const rec = doc;
|
|
162699
162947
|
const out2 = {};
|
|
162700
162948
|
for (const f2 of FIELDS) {
|
|
162701
162949
|
const v2 = rec[f2];
|
|
162702
162950
|
if (typeof v2 !== "string" || !v2.trim() || /^TODO/i.test(v2.trim())) {
|
|
162703
|
-
throw new Error(`${
|
|
162951
|
+
throw new Error(`${label3} is missing a usable "${f2}" (got ${JSON.stringify(v2)}).`);
|
|
162704
162952
|
}
|
|
162705
162953
|
out2[f2] = v2.trim();
|
|
162706
162954
|
}
|
|
@@ -162942,15 +163190,15 @@ function tierPrice(amount, applePoint, options) {
|
|
|
162942
163190
|
return { baseTerritory: options.baseTerritory, currency: options.currency, amount: normalizeAmount(applePoint) };
|
|
162943
163191
|
}
|
|
162944
163192
|
function newTier(key2, price, options, names) {
|
|
162945
|
-
const
|
|
163193
|
+
const label3 = `${price.amount} ${options.currency}`;
|
|
162946
163194
|
return {
|
|
162947
163195
|
unlocks: [],
|
|
162948
163196
|
classification: "digital",
|
|
162949
163197
|
entitlement: `tier:${key2}`,
|
|
162950
163198
|
productId: tierProductId(options, key2),
|
|
162951
163199
|
type: "consumable",
|
|
162952
|
-
referenceName: names.claim(`Credit ${
|
|
162953
|
-
localizations: [{ locale: options.locale, name: displayName(`Unlock (${
|
|
163200
|
+
referenceName: names.claim(`Credit ${label3}`, key2),
|
|
163201
|
+
localizations: [{ locale: options.locale, name: displayName(`Unlock (${label3})`), description: TIER_DESCRIPTION }],
|
|
162954
163202
|
price,
|
|
162955
163203
|
territories: options.territories
|
|
162956
163204
|
};
|
|
@@ -163499,15 +163747,15 @@ async function allByCursor(wix, path2, key2, extra = {}) {
|
|
|
163499
163747
|
}
|
|
163500
163748
|
throw new Error(`${path2} had more than ${MAX_PAGES2} pages \u2014 refusing to draft from a partial catalog`);
|
|
163501
163749
|
}
|
|
163502
|
-
async function allByOffset(fetchPage,
|
|
163750
|
+
async function allByOffset(fetchPage, label3) {
|
|
163503
163751
|
const rows = [];
|
|
163504
163752
|
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
163505
|
-
const { rows: batch, total } = await withRetry(
|
|
163753
|
+
const { rows: batch, total } = await withRetry(label3, () => fetchPage(rows.length));
|
|
163506
163754
|
rows.push(...batch);
|
|
163507
163755
|
const done = batch.length === 0 || (total !== void 0 ? rows.length >= total : batch.length < PAGE2);
|
|
163508
163756
|
if (done) return rows;
|
|
163509
163757
|
}
|
|
163510
|
-
throw new Error(`${
|
|
163758
|
+
throw new Error(`${label3} had more than ${MAX_PAGES2} pages \u2014 refusing to draft from a partial catalog`);
|
|
163511
163759
|
}
|
|
163512
163760
|
function fromV3Product(p2) {
|
|
163513
163761
|
return catalogItem({
|
|
@@ -164572,7 +164820,7 @@ function firstProblem(report3) {
|
|
|
164572
164820
|
function printConnect(out2, report3, heading) {
|
|
164573
164821
|
out2.line(`himi store iap connect \u2014 ${heading}`);
|
|
164574
164822
|
out2.line(` ${pad("site")}${report3.site} \xB7 bundle ${report3.bundleId}`);
|
|
164575
|
-
const row = (
|
|
164823
|
+
const row = (label3, step) => out2.line(` ${pad(label3)}${step.state.padEnd(9)}${step.detail}`);
|
|
164576
164824
|
row("app", report3.app);
|
|
164577
164825
|
row("key", report3.credentials);
|
|
164578
164826
|
row("provider", report3.provider);
|
|
@@ -164832,7 +165080,7 @@ function defaultStoreIapDeps() {
|
|
|
164832
165080
|
profileTeam: (profile) => resolveStoreCredentials({ app: profile, cfg: {}, profileFlag: profile, env: {} }).team,
|
|
164833
165081
|
confirm: confirmOnTerminal,
|
|
164834
165082
|
now: () => /* @__PURE__ */ new Date(),
|
|
164835
|
-
sleep: (ms2) => new Promise((
|
|
165083
|
+
sleep: (ms2) => new Promise((resolve66) => setTimeout(resolve66, ms2))
|
|
164836
165084
|
};
|
|
164837
165085
|
}
|
|
164838
165086
|
var STORE_IAP_USAGE, SUMMARY_THRESHOLD, SUMMARY_DETAIL_LIMIT, UsageError, CommandOutput, pad, DECISION_ORDER, OUTCOME_ORDER, COMPLETE, DRAFT_MODES, TERRITORY_CODE, LOCALE_CODE, GRID_UNAVAILABLE_NOTE, KeyError, CredentialsError, writesPlanned, COMMANDS;
|
|
@@ -164902,7 +165150,7 @@ var init_store_iap = __esm({
|
|
|
164902
165150
|
return scrubString(out2);
|
|
164903
165151
|
}
|
|
164904
165152
|
};
|
|
164905
|
-
pad = (
|
|
165153
|
+
pad = (label3, width = 12) => label3.padEnd(width);
|
|
164906
165154
|
DECISION_ORDER = ["create", "update", "reuse", "conflict"];
|
|
164907
165155
|
OUTCOME_ORDER = ["created", "updated", "reused", "conflict", "partial", "failed", "deferred", "absent", "incomplete"];
|
|
164908
165156
|
COMPLETE = /* @__PURE__ */ new Set(["created", "updated", "reused"]);
|
|
@@ -165007,8 +165255,8 @@ __export(store_exports, {
|
|
|
165007
165255
|
partitionFindings: () => partitionFindings,
|
|
165008
165256
|
runStore: () => runStore
|
|
165009
165257
|
});
|
|
165010
|
-
function pad2(
|
|
165011
|
-
return
|
|
165258
|
+
function pad2(label3, width = 12) {
|
|
165259
|
+
return label3.length >= width ? label3 : label3 + " ".repeat(width - label3.length);
|
|
165012
165260
|
}
|
|
165013
165261
|
function accountHeader(args) {
|
|
165014
165262
|
const { app, bundleId, version: version4, nextBuild, creds, track } = args;
|
|
@@ -166527,7 +166775,7 @@ async function runAllMembers(args) {
|
|
|
166527
166775
|
const result = await sendCampaign({
|
|
166528
166776
|
recipients,
|
|
166529
166777
|
campaignId: requestId2,
|
|
166530
|
-
wait: deps.wait ?? ((ms2) => new Promise((
|
|
166778
|
+
wait: deps.wait ?? ((ms2) => new Promise((resolve66) => setTimeout(resolve66, ms2))),
|
|
166531
166779
|
onProgress: (completed) => {
|
|
166532
166780
|
if (completed % 10 === 0 || completed === recipients.length) {
|
|
166533
166781
|
io2.log(JSON.stringify({ ok: true, state: "progress", campaignId: requestId2, completed, recipients: recipients.length }));
|
|
@@ -166998,6 +167246,150 @@ var init_base44_auth_check = __esm({
|
|
|
166998
167246
|
}
|
|
166999
167247
|
});
|
|
167000
167248
|
|
|
167249
|
+
// src/base44-adopt.ts
|
|
167250
|
+
var base44_adopt_exports = {};
|
|
167251
|
+
__export(base44_adopt_exports, {
|
|
167252
|
+
ADOPT_MODULE_FILENAME: () => ADOPT_MODULE_FILENAME,
|
|
167253
|
+
AdoptError: () => AdoptError,
|
|
167254
|
+
adoptFromBook: () => adoptFromBook,
|
|
167255
|
+
renderAdoptModule: () => renderAdoptModule,
|
|
167256
|
+
runBase44Adopt: () => runBase44Adopt
|
|
167257
|
+
});
|
|
167258
|
+
import { existsSync as existsSync77, readFileSync as readFileSync97, writeFileSync as writeFileSync32 } from "node:fs";
|
|
167259
|
+
import { join as join81, resolve as resolve59 } from "node:path";
|
|
167260
|
+
function prop(entity, key2) {
|
|
167261
|
+
const props = entity.schema?.properties;
|
|
167262
|
+
const p2 = props && typeof props === "object" ? props[key2] : void 0;
|
|
167263
|
+
return p2 && typeof p2 === "object" && !Array.isArray(p2) ? p2 : {};
|
|
167264
|
+
}
|
|
167265
|
+
function adoptEntity(entity, skipped, prefix) {
|
|
167266
|
+
if (typeof entity.name !== "string" || !ENTITY_NAME2.test(entity.name)) {
|
|
167267
|
+
skipped.push({ entity: String(entity.name), reason: "entity name is not alphanumeric, so it cannot be declared" });
|
|
167268
|
+
return null;
|
|
167269
|
+
}
|
|
167270
|
+
if (prefix && entity.name.startsWith(prefix)) {
|
|
167271
|
+
skipped.push({ entity: entity.name, reason: `in this app's owned namespace "${prefix}" \u2014 declare it with \`name\` if himi owns it` });
|
|
167272
|
+
return null;
|
|
167273
|
+
}
|
|
167274
|
+
const fields = [];
|
|
167275
|
+
for (const f2 of entity.fields) {
|
|
167276
|
+
if (BUILTINS.has(f2.name)) {
|
|
167277
|
+
skipped.push({ entity: entity.name, field: f2.name, reason: "built-in field \u2014 Base44 adds it to every row" });
|
|
167278
|
+
continue;
|
|
167279
|
+
}
|
|
167280
|
+
if (!TYPES.has(f2.type)) {
|
|
167281
|
+
skipped.push({ entity: entity.name, field: f2.name, reason: `unsupported type "${f2.type}" \u2014 supported: ${BASE44_FIELD_TYPES.join(", ")}` });
|
|
167282
|
+
continue;
|
|
167283
|
+
}
|
|
167284
|
+
const p2 = prop(entity, f2.name);
|
|
167285
|
+
const field = { key: f2.name, type: f2.type };
|
|
167286
|
+
if (f2.format !== void 0) {
|
|
167287
|
+
if (f2.type === "string" && FORMATS2.has(f2.format)) field.format = f2.format;
|
|
167288
|
+
else skipped.push({ entity: entity.name, field: f2.name, reason: `format "${f2.format}" dropped \u2014 only ${BASE44_STRING_FORMATS.join(", ")} on string fields` });
|
|
167289
|
+
}
|
|
167290
|
+
if (Array.isArray(f2.enum)) {
|
|
167291
|
+
const values = f2.enum.filter((v2) => typeof v2 === "string" || typeof v2 === "number");
|
|
167292
|
+
if (values.length) field.enum = values;
|
|
167293
|
+
}
|
|
167294
|
+
if (p2.default !== void 0) field.default = p2.default;
|
|
167295
|
+
const items = p2.items;
|
|
167296
|
+
if (f2.type === "array" && items !== void 0) {
|
|
167297
|
+
if (items && typeof items.type === "string" && TYPES.has(items.type)) field.items = { type: items.type };
|
|
167298
|
+
else skipped.push({ entity: entity.name, field: f2.name, reason: `array item schema ${JSON.stringify(items)} dropped \u2014 only ${BASE44_FIELD_TYPES.join(", ")} item types` });
|
|
167299
|
+
}
|
|
167300
|
+
if (f2.description) field.description = f2.description;
|
|
167301
|
+
if (f2.rls !== void 0) field.rls = f2.rls;
|
|
167302
|
+
fields.push(field);
|
|
167303
|
+
}
|
|
167304
|
+
const keys = new Set(fields.map((f2) => f2.key));
|
|
167305
|
+
const required3 = entity.required.filter((k2) => keys.has(k2));
|
|
167306
|
+
return {
|
|
167307
|
+
base44Name: entity.name,
|
|
167308
|
+
...entity.title ? { title: entity.title } : {},
|
|
167309
|
+
fields,
|
|
167310
|
+
...required3.length ? { required: required3 } : {},
|
|
167311
|
+
// Verbatim: the access rule is Base44's own document, and himi does not reinterpret it.
|
|
167312
|
+
...entity.rls ? { rls: entity.rls } : {}
|
|
167313
|
+
};
|
|
167314
|
+
}
|
|
167315
|
+
function adoptFromBook(book, opts = {}) {
|
|
167316
|
+
const prefix = opts.app ? base44Prefix(opts.app) : void 0;
|
|
167317
|
+
const skipped = [];
|
|
167318
|
+
const only = opts.only?.length ? new Set(opts.only) : void 0;
|
|
167319
|
+
const entities = (book.entities ?? []).filter((e2) => !only || only.has(e2.name)).map((e2) => adoptEntity(e2, skipped, prefix)).filter((e2) => e2 !== null);
|
|
167320
|
+
const seen = /* @__PURE__ */ new Set();
|
|
167321
|
+
const functions = [];
|
|
167322
|
+
for (const f2 of book.functions ?? []) {
|
|
167323
|
+
if (!f2?.name || seen.has(f2.name)) continue;
|
|
167324
|
+
seen.add(f2.name);
|
|
167325
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(f2.name)) {
|
|
167326
|
+
skipped.push({ entity: f2.name, reason: "function name is not letters, digits, - or _" });
|
|
167327
|
+
continue;
|
|
167328
|
+
}
|
|
167329
|
+
functions.push({ base44Name: f2.name });
|
|
167330
|
+
}
|
|
167331
|
+
return { entities, functions, skipped };
|
|
167332
|
+
}
|
|
167333
|
+
function renderAdoptModule(r2, source = ".himi/base44-book/book.json") {
|
|
167334
|
+
const json7 = (v2) => JSON.stringify(v2, null, 2);
|
|
167335
|
+
return [
|
|
167336
|
+
`// Generated by \`himi base44 adopt\` from ${source}. Every entry is ADOPTED: the Base44 app's`,
|
|
167337
|
+
`// own entity or function, read-only to himi. Review it, then wire it into config.ts:`,
|
|
167338
|
+
`// defineApp({ \u2026, base44: { appId, entities: base44Entities, functions: base44Functions } })`,
|
|
167339
|
+
`// See docs/base44-entities.md.`,
|
|
167340
|
+
`import type { Base44EntitySpec, Base44FunctionSpec } from "@wix/himalaya/core";`,
|
|
167341
|
+
``,
|
|
167342
|
+
`export const base44Entities = ${json7(r2.entities)} satisfies Base44EntitySpec[];`,
|
|
167343
|
+
``,
|
|
167344
|
+
`export const base44Functions = ${json7(r2.functions)} satisfies Base44FunctionSpec[];`,
|
|
167345
|
+
``
|
|
167346
|
+
].join("\n");
|
|
167347
|
+
}
|
|
167348
|
+
function runBase44Adopt(opts) {
|
|
167349
|
+
const bookDir = resolve59(opts.cwd, opts.book ?? ".himi/base44-book");
|
|
167350
|
+
const bookPath = join81(bookDir, "book.json");
|
|
167351
|
+
let book;
|
|
167352
|
+
try {
|
|
167353
|
+
book = JSON.parse(readFileSync97(bookPath, "utf8"));
|
|
167354
|
+
if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
|
|
167355
|
+
} catch (e2) {
|
|
167356
|
+
throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
|
|
167357
|
+
}
|
|
167358
|
+
const unknown = (opts.only ?? []).filter((n2) => !book.entities.some((e2) => e2.name === n2));
|
|
167359
|
+
if (unknown.length) {
|
|
167360
|
+
throw new AdoptError("unknown_entity", `--entities names ${unknown.map((n2) => `"${n2}"`).join(", ")}, which the book does not have`, 2, { known: book.entities.map((e2) => e2.name) });
|
|
167361
|
+
}
|
|
167362
|
+
const result = adoptFromBook(book, { only: opts.only, app: opts.app });
|
|
167363
|
+
const module = renderAdoptModule(result, opts.book ? join81(opts.book, "book.json") : void 0);
|
|
167364
|
+
const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
|
|
167365
|
+
if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
|
|
167366
|
+
const target = typeof opts.write === "string" ? resolve59(opts.cwd, opts.write) : join81(opts.cwd, ADOPT_MODULE_FILENAME);
|
|
167367
|
+
if (existsSync77(target)) {
|
|
167368
|
+
throw new AdoptError("adopt_target_exists", `${target} already exists \u2014 adopt never overwrites. Delete or rename it, or pass --write <other path>.`, 1, { path: target });
|
|
167369
|
+
}
|
|
167370
|
+
writeFileSync32(target, module);
|
|
167371
|
+
return { result, module, issues, written: target };
|
|
167372
|
+
}
|
|
167373
|
+
var ADOPT_MODULE_FILENAME, TYPES, FORMATS2, BUILTINS, ENTITY_NAME2, AdoptError;
|
|
167374
|
+
var init_base44_adopt = __esm({
|
|
167375
|
+
"src/base44-adopt.ts"() {
|
|
167376
|
+
init_base44_schema();
|
|
167377
|
+
ADOPT_MODULE_FILENAME = "base44-entities.ts";
|
|
167378
|
+
TYPES = new Set(BASE44_FIELD_TYPES);
|
|
167379
|
+
FORMATS2 = new Set(BASE44_STRING_FORMATS);
|
|
167380
|
+
BUILTINS = new Set(BASE44_BUILTIN_FIELDS);
|
|
167381
|
+
ENTITY_NAME2 = /^[A-Za-z][A-Za-z0-9]*$/;
|
|
167382
|
+
AdoptError = class extends Error {
|
|
167383
|
+
constructor(code, message, exit = 1, extra = {}) {
|
|
167384
|
+
super(message);
|
|
167385
|
+
this.code = code;
|
|
167386
|
+
this.exit = exit;
|
|
167387
|
+
this.extra = extra;
|
|
167388
|
+
}
|
|
167389
|
+
};
|
|
167390
|
+
}
|
|
167391
|
+
});
|
|
167392
|
+
|
|
167001
167393
|
// src/base44-auth.ts
|
|
167002
167394
|
var base44_auth_exports = {};
|
|
167003
167395
|
__export(base44_auth_exports, {
|
|
@@ -167015,20 +167407,20 @@ __export(base44_auth_exports, {
|
|
|
167015
167407
|
usableBase44Auth: () => usableBase44Auth,
|
|
167016
167408
|
writeBase44Session: () => writeBase44Session
|
|
167017
167409
|
});
|
|
167018
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
167410
|
+
import { chmodSync as chmodSync4, existsSync as existsSync78, mkdirSync as mkdirSync36, readFileSync as readFileSync98, rmSync as rmSync20, writeFileSync as writeFileSync33 } from "node:fs";
|
|
167019
167411
|
import { homedir as homedir13 } from "node:os";
|
|
167020
|
-
import { dirname as dirname45, join as
|
|
167412
|
+
import { dirname as dirname45, join as join82 } from "node:path";
|
|
167021
167413
|
function base44ApiBase(env = process.env) {
|
|
167022
167414
|
return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
|
|
167023
167415
|
}
|
|
167024
167416
|
function base44SessionPath(home = homedir13()) {
|
|
167025
|
-
return
|
|
167417
|
+
return join82(home, ".himi", "base44", "session.json");
|
|
167026
167418
|
}
|
|
167027
167419
|
function readBase44Session(home) {
|
|
167028
167420
|
const p2 = base44SessionPath(home);
|
|
167029
|
-
if (!
|
|
167421
|
+
if (!existsSync78(p2)) return void 0;
|
|
167030
167422
|
try {
|
|
167031
|
-
const s2 = JSON.parse(
|
|
167423
|
+
const s2 = JSON.parse(readFileSync98(p2, "utf8"));
|
|
167032
167424
|
return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
|
|
167033
167425
|
} catch {
|
|
167034
167426
|
return void 0;
|
|
@@ -167037,14 +167429,14 @@ function readBase44Session(home) {
|
|
|
167037
167429
|
function writeBase44Session(session, home) {
|
|
167038
167430
|
const p2 = base44SessionPath(home);
|
|
167039
167431
|
mkdirSync36(dirname45(p2), { recursive: true, mode: 448 });
|
|
167040
|
-
|
|
167432
|
+
writeFileSync33(p2, `${JSON.stringify(session, null, 2)}
|
|
167041
167433
|
`, { mode: 384 });
|
|
167042
167434
|
chmodSync4(p2, 384);
|
|
167043
167435
|
return p2;
|
|
167044
167436
|
}
|
|
167045
167437
|
function deleteBase44Session(home) {
|
|
167046
167438
|
const p2 = base44SessionPath(home);
|
|
167047
|
-
if (!
|
|
167439
|
+
if (!existsSync78(p2)) return false;
|
|
167048
167440
|
rmSync20(p2, { force: true });
|
|
167049
167441
|
return true;
|
|
167050
167442
|
}
|
|
@@ -167139,9 +167531,9 @@ async function base44DeviceLogin(opts) {
|
|
|
167139
167531
|
throw new Error("the Base44 sign-in code expired before it was approved \u2014 run `himi base44 login` again");
|
|
167140
167532
|
}
|
|
167141
167533
|
function importBase44CliSession(home = homedir13(), env = process.env) {
|
|
167142
|
-
const src =
|
|
167143
|
-
if (!
|
|
167144
|
-
const a2 = JSON.parse(
|
|
167534
|
+
const src = join82(home, ".base44", "auth", "auth.json");
|
|
167535
|
+
if (!existsSync78(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
167536
|
+
const a2 = JSON.parse(readFileSync98(src, "utf8"));
|
|
167145
167537
|
if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
|
|
167146
167538
|
const session = {
|
|
167147
167539
|
accessToken: a2.accessToken,
|
|
@@ -167312,10 +167704,10 @@ function assertPublicSiteUrl(raw) {
|
|
|
167312
167704
|
if (refusal) throw new Error(refusal);
|
|
167313
167705
|
}
|
|
167314
167706
|
function resolveAll(hostname3) {
|
|
167315
|
-
return new Promise((
|
|
167707
|
+
return new Promise((resolve66, reject) => {
|
|
167316
167708
|
dnsLookup(hostname3, { all: true, verbatim: true }, (err, addresses) => {
|
|
167317
167709
|
if (err) reject(err);
|
|
167318
|
-
else
|
|
167710
|
+
else resolve66(addresses);
|
|
167319
167711
|
});
|
|
167320
167712
|
});
|
|
167321
167713
|
}
|
|
@@ -167323,13 +167715,13 @@ function withAbort(start, signal, what) {
|
|
|
167323
167715
|
if (signal?.aborted) return Promise.reject(new Error(`${what} aborted`));
|
|
167324
167716
|
const work = start();
|
|
167325
167717
|
if (!signal) return work;
|
|
167326
|
-
return new Promise((
|
|
167718
|
+
return new Promise((resolve66, reject) => {
|
|
167327
167719
|
const onAbort = () => reject(new Error(`${what} aborted`));
|
|
167328
167720
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
167329
|
-
work.then(
|
|
167721
|
+
work.then(resolve66, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
167330
167722
|
});
|
|
167331
167723
|
}
|
|
167332
|
-
async function pinAddress(url,
|
|
167724
|
+
async function pinAddress(url, resolve66 = resolveAll, signal) {
|
|
167333
167725
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
167334
167726
|
if (ipv4Octets(host)) {
|
|
167335
167727
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
@@ -167339,7 +167731,7 @@ async function pinAddress(url, resolve65 = resolveAll, signal) {
|
|
|
167339
167731
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
167340
167732
|
return { address: host, family: 6 };
|
|
167341
167733
|
}
|
|
167342
|
-
const addresses = await withAbort(() =>
|
|
167734
|
+
const addresses = await withAbort(() => resolve66(host), signal, `${host} lookup`);
|
|
167343
167735
|
if (!addresses.length) throw new Error(`${host} resolved to no address`);
|
|
167344
167736
|
const blocked = addresses.filter((a2) => isBlockedAddress(a2.address)).map((a2) => a2.address);
|
|
167345
167737
|
if (blocked.length) throw new Error(`${host} resolves to a blocked address (${blocked.join(", ")})`);
|
|
@@ -167379,7 +167771,7 @@ function copyIncomingHeaders(headers2) {
|
|
|
167379
167771
|
return out2;
|
|
167380
167772
|
}
|
|
167381
167773
|
function requestOnce(url, pinned, init) {
|
|
167382
|
-
return new Promise((
|
|
167774
|
+
return new Promise((resolve66, reject) => {
|
|
167383
167775
|
const headers2 = { host: url.host, "accept-encoding": "identity" };
|
|
167384
167776
|
new Headers(init.headers ?? {}).forEach((value, key2) => {
|
|
167385
167777
|
if (key2.toLowerCase() !== "host") headers2[key2] = value;
|
|
@@ -167409,7 +167801,7 @@ function requestOnce(url, pinned, init) {
|
|
|
167409
167801
|
reject(err);
|
|
167410
167802
|
return;
|
|
167411
167803
|
}
|
|
167412
|
-
|
|
167804
|
+
resolve66(new Response(body, { status, statusText: res.statusMessage ?? "", headers: out2 }));
|
|
167413
167805
|
}
|
|
167414
167806
|
);
|
|
167415
167807
|
req.on("error", reject);
|
|
@@ -167444,17 +167836,17 @@ async function followPinned(href, init, perform, pin = (u2, s2) => pinAddress(u2
|
|
|
167444
167836
|
url = new URL(location, url);
|
|
167445
167837
|
}
|
|
167446
167838
|
}
|
|
167447
|
-
function makePinnedFetch(allow,
|
|
167839
|
+
function makePinnedFetch(allow, label3, pin = realPin, perform = requestOnce) {
|
|
167448
167840
|
const transport = (async (input, init) => {
|
|
167449
167841
|
if (typeof input !== "string" && !(input instanceof URL)) {
|
|
167450
|
-
throw new TypeError(`${
|
|
167842
|
+
throw new TypeError(`${label3} takes a url \u2014 the analyzer's Request-shaped calls use the API transport`);
|
|
167451
167843
|
}
|
|
167452
167844
|
if (init?.body != null) {
|
|
167453
|
-
throw new TypeError(`${
|
|
167845
|
+
throw new TypeError(`${label3} is GET-only \u2014 a request with a body belongs on the API transport`);
|
|
167454
167846
|
}
|
|
167455
167847
|
const method = (init?.method ?? "GET").toUpperCase();
|
|
167456
167848
|
if (method !== "GET" && method !== "HEAD") {
|
|
167457
|
-
throw new TypeError(`${
|
|
167849
|
+
throw new TypeError(`${label3} is GET-only, refusing ${method}`);
|
|
167458
167850
|
}
|
|
167459
167851
|
return followPinned(input instanceof URL ? input.href : input, init ?? {}, perform, pin, allow);
|
|
167460
167852
|
});
|
|
@@ -167985,9 +168377,9 @@ function scanVeloAuthSignals(files) {
|
|
|
167985
168377
|
if (HAS_ROLE_RE.test(src)) usesHasRole = true;
|
|
167986
168378
|
if (!LOGIN_CHECK_RE.test(src) && !HAS_ROLE_RE.test(src) && !AUTH_IMPORT_RE.test(src)) continue;
|
|
167987
168379
|
if (!LOGIN_CHECK_RE.test(src) && !HAS_ROLE_RE.test(src)) continue;
|
|
167988
|
-
const
|
|
168380
|
+
const label3 = f2.pageTitle || f2.pageUrl || f2.path;
|
|
167989
168381
|
if ((f2.kind === "page" || f2.kind === "public") && LOGIN_CHECK_RE.test(src)) {
|
|
167990
|
-
if (!pagesCheckingLogin.includes(
|
|
168382
|
+
if (!pagesCheckingLogin.includes(label3)) pagesCheckingLogin.push(label3);
|
|
167991
168383
|
} else if (LOGIN_CHECK_RE.test(src) || HAS_ROLE_RE.test(src)) {
|
|
167992
168384
|
if (!modulesCheckingLoggedIn.includes(f2.path)) modulesCheckingLoggedIn.push(f2.path);
|
|
167993
168385
|
}
|
|
@@ -168181,8 +168573,8 @@ function formLabels(x2, depth = 0, out2 = []) {
|
|
|
168181
168573
|
}
|
|
168182
168574
|
if (typeof x2 !== "object") return out2;
|
|
168183
168575
|
const o2 = x2;
|
|
168184
|
-
const
|
|
168185
|
-
if (
|
|
168576
|
+
const label3 = str7(o2.label ?? o2.displayName ?? o2.fieldTitle ?? o2.title);
|
|
168577
|
+
if (label3 && !UUID_RE2.test(label3) && label3.length < 80 && !out2.includes(label3)) out2.push(label3);
|
|
168186
168578
|
for (const k2 of ["fields", "formFields", "form", "schema", "properties"]) {
|
|
168187
168579
|
if (o2[k2] != null) formLabels(o2[k2], depth + 1, out2);
|
|
168188
168580
|
}
|
|
@@ -169239,12 +169631,12 @@ var init_velo = __esm({
|
|
|
169239
169631
|
|
|
169240
169632
|
// src/site-analyze/tokens.ts
|
|
169241
169633
|
function channels2(css) {
|
|
169242
|
-
const
|
|
169243
|
-
if (!
|
|
169634
|
+
const canonical5 = canonicalHex(css);
|
|
169635
|
+
if (!canonical5) return null;
|
|
169244
169636
|
return [
|
|
169245
|
-
parseInt(
|
|
169246
|
-
parseInt(
|
|
169247
|
-
parseInt(
|
|
169637
|
+
parseInt(canonical5.slice(1, 3), 16),
|
|
169638
|
+
parseInt(canonical5.slice(3, 5), 16),
|
|
169639
|
+
parseInt(canonical5.slice(5, 7), 16)
|
|
169248
169640
|
];
|
|
169249
169641
|
}
|
|
169250
169642
|
function isNearWhite(css) {
|
|
@@ -169434,8 +169826,8 @@ var init_brand_font = __esm({
|
|
|
169434
169826
|
});
|
|
169435
169827
|
|
|
169436
169828
|
// src/site-analyze/write-artifacts.ts
|
|
169437
|
-
import { mkdirSync as mkdirSync37, rmSync as rmSync21, writeFileSync as
|
|
169438
|
-
import { join as
|
|
169829
|
+
import { mkdirSync as mkdirSync37, rmSync as rmSync21, writeFileSync as writeFileSync34 } from "node:fs";
|
|
169830
|
+
import { join as join83 } from "node:path";
|
|
169439
169831
|
function attachVeloSources(book, sources, put) {
|
|
169440
169832
|
const byPath = new Map((sources ?? []).map((s2) => [s2.path, s2.text]));
|
|
169441
169833
|
for (const f2 of book.velo.files) {
|
|
@@ -169590,13 +169982,13 @@ async function downloadMedia(book, fetchImpl, put) {
|
|
|
169590
169982
|
}
|
|
169591
169983
|
async function writeBusinessBook(result, opts) {
|
|
169592
169984
|
const out2 = opts.outDir;
|
|
169593
|
-
mkdirSync37(
|
|
169594
|
-
mkdirSync37(
|
|
169985
|
+
mkdirSync37(join83(out2, "evidence/pages"), { recursive: true });
|
|
169986
|
+
mkdirSync37(join83(out2, "media/catalog"), { recursive: true });
|
|
169595
169987
|
const files = [];
|
|
169596
169988
|
const put = (rel, body) => {
|
|
169597
|
-
const p2 =
|
|
169598
|
-
mkdirSync37(
|
|
169599
|
-
|
|
169989
|
+
const p2 = join83(out2, rel);
|
|
169990
|
+
mkdirSync37(join83(p2, ".."), { recursive: true });
|
|
169991
|
+
writeFileSync34(p2, body);
|
|
169600
169992
|
files.push(rel);
|
|
169601
169993
|
};
|
|
169602
169994
|
const book = result.book;
|
|
@@ -169638,7 +170030,7 @@ async function writeBusinessBook(result, opts) {
|
|
|
169638
170030
|
const allGated = shots.length > 0 && gatedPages.length > 0 && usablePages.length === 0;
|
|
169639
170031
|
put("README.md", folderReadme(shots.length > 0 && !allGated, book.look.unavailable, allGated));
|
|
169640
170032
|
put("evidence/probes.json", JSON.stringify(book.probes, null, 2) + "\n");
|
|
169641
|
-
rmSync21(
|
|
170033
|
+
rmSync21(join83(out2, "evidence/mobile-app"), { recursive: true, force: true });
|
|
169642
170034
|
for (const [name, value] of Object.entries(result.mobileAppEvidence ?? {})) {
|
|
169643
170035
|
if (/^[a-z-]+\.json$/.test(name)) put(`evidence/mobile-app/${name}`, JSON.stringify(value, null, 2) + "\n");
|
|
169644
170036
|
}
|
|
@@ -170503,11 +170895,11 @@ var init_analyze = __esm({
|
|
|
170503
170895
|
});
|
|
170504
170896
|
|
|
170505
170897
|
// src/base44-analyze/write-artifacts.ts
|
|
170506
|
-
import { existsSync as
|
|
170507
|
-
import { dirname as dirname46, join as
|
|
170898
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync38, readFileSync as readFileSync99, rmSync as rmSync22, writeFileSync as writeFileSync35 } from "node:fs";
|
|
170899
|
+
import { dirname as dirname46, join as join84, resolve as resolve60, sep as sep19 } from "node:path";
|
|
170508
170900
|
function isBookFolder(dir) {
|
|
170509
170901
|
try {
|
|
170510
|
-
return JSON.parse(
|
|
170902
|
+
return JSON.parse(readFileSync99(join84(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
170511
170903
|
} catch {
|
|
170512
170904
|
return false;
|
|
170513
170905
|
}
|
|
@@ -170581,7 +170973,7 @@ function renderBookMd(book) {
|
|
|
170581
170973
|
return L2.join("\n");
|
|
170582
170974
|
}
|
|
170583
170975
|
function writeBase44Book(result, outDir, opts = {}) {
|
|
170584
|
-
const out2 =
|
|
170976
|
+
const out2 = resolve60(outDir);
|
|
170585
170977
|
const book = result.book;
|
|
170586
170978
|
const files = [];
|
|
170587
170979
|
const shots = (opts.screenshots ?? []).filter((s2) => safeRel(s2.filename) && !s2.filename.includes("/"));
|
|
@@ -170594,27 +170986,27 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
170594
170986
|
const md = renderBookMd(book);
|
|
170595
170987
|
assertNoSecrets(json7);
|
|
170596
170988
|
assertNoSecrets(md);
|
|
170597
|
-
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) =>
|
|
170989
|
+
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync79(join84(out2, n2)));
|
|
170598
170990
|
if (owned.length) {
|
|
170599
170991
|
if (!isBookFolder(out2)) throw new Error(`refusing to write the app book into ${out2}: it already has ${owned.join(", ")} that ${owned.length === 1 ? "is" : "are"} not from an app book \u2014 pick an empty --out`);
|
|
170600
|
-
for (const d2 of ["source", "screenshots"]) rmSync22(
|
|
170992
|
+
for (const d2 of ["source", "screenshots"]) rmSync22(join84(out2, d2), { recursive: true, force: true });
|
|
170601
170993
|
}
|
|
170602
170994
|
mkdirSync38(out2, { recursive: true });
|
|
170603
|
-
|
|
170604
|
-
|
|
170995
|
+
writeFileSync35(join84(out2, "book.json"), json7);
|
|
170996
|
+
writeFileSync35(join84(out2, "BOOK.md"), md);
|
|
170605
170997
|
files.push("book.json", "BOOK.md");
|
|
170606
170998
|
for (const s2 of shots) {
|
|
170607
|
-
mkdirSync38(
|
|
170608
|
-
|
|
170999
|
+
mkdirSync38(join84(out2, "screenshots"), { recursive: true });
|
|
171000
|
+
writeFileSync35(join84(out2, "screenshots", s2.filename), s2.bytes);
|
|
170609
171001
|
files.push(`screenshots/${s2.filename}`);
|
|
170610
171002
|
}
|
|
170611
|
-
const sourceRoot =
|
|
171003
|
+
const sourceRoot = join84(out2, "source");
|
|
170612
171004
|
for (const f2 of result.sourceFiles) {
|
|
170613
171005
|
if (!safeRel(f2.path)) continue;
|
|
170614
|
-
const dest =
|
|
171006
|
+
const dest = join84(sourceRoot, ...f2.path.split("/"));
|
|
170615
171007
|
if (!dest.startsWith(sourceRoot + sep19)) continue;
|
|
170616
171008
|
mkdirSync38(dirname46(dest), { recursive: true });
|
|
170617
|
-
|
|
171009
|
+
writeFileSync35(dest, f2.bytes);
|
|
170618
171010
|
}
|
|
170619
171011
|
if (result.sourceFiles.length) files.push(`source/ (${result.sourceFiles.length} files)`);
|
|
170620
171012
|
return { outDir: out2, files };
|
|
@@ -171484,10 +171876,10 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
|
|
171484
171876
|
}
|
|
171485
171877
|
function createPromiseCallback(cb) {
|
|
171486
171878
|
let callback;
|
|
171487
|
-
let
|
|
171879
|
+
let resolve66;
|
|
171488
171880
|
let reject;
|
|
171489
171881
|
const promise = new Promise((_resolve, _reject) => {
|
|
171490
|
-
|
|
171882
|
+
resolve66 = _resolve;
|
|
171491
171883
|
reject = _reject;
|
|
171492
171884
|
});
|
|
171493
171885
|
if (typeof cb === "function") {
|
|
@@ -171503,7 +171895,7 @@ function createPromiseCallback(cb) {
|
|
|
171503
171895
|
callback = (err, result) => {
|
|
171504
171896
|
try {
|
|
171505
171897
|
if (err) reject(err);
|
|
171506
|
-
else
|
|
171898
|
+
else resolve66(result);
|
|
171507
171899
|
} catch (e2) {
|
|
171508
171900
|
reject(e2 instanceof Error ? e2 : new Error());
|
|
171509
171901
|
}
|
|
@@ -171810,58 +172202,58 @@ function fromJSON(str11) {
|
|
|
171810
172202
|
obj4 = str11;
|
|
171811
172203
|
}
|
|
171812
172204
|
const c2 = new Cookie();
|
|
171813
|
-
Cookie.serializableProperties.forEach((
|
|
171814
|
-
if (obj4 && typeof obj4 === "object" && inOperator(
|
|
171815
|
-
const val = obj4[
|
|
172205
|
+
Cookie.serializableProperties.forEach((prop2) => {
|
|
172206
|
+
if (obj4 && typeof obj4 === "object" && inOperator(prop2, obj4)) {
|
|
172207
|
+
const val = obj4[prop2];
|
|
171816
172208
|
if (val === void 0) {
|
|
171817
172209
|
return;
|
|
171818
172210
|
}
|
|
171819
|
-
if (inOperator(
|
|
172211
|
+
if (inOperator(prop2, cookieDefaults) && val === cookieDefaults[prop2]) {
|
|
171820
172212
|
return;
|
|
171821
172213
|
}
|
|
171822
|
-
switch (
|
|
172214
|
+
switch (prop2) {
|
|
171823
172215
|
case "key":
|
|
171824
172216
|
case "value":
|
|
171825
172217
|
case "sameSite":
|
|
171826
172218
|
if (typeof val === "string") {
|
|
171827
|
-
c2[
|
|
172219
|
+
c2[prop2] = val;
|
|
171828
172220
|
}
|
|
171829
172221
|
break;
|
|
171830
172222
|
case "expires":
|
|
171831
172223
|
case "creation":
|
|
171832
172224
|
case "lastAccessed":
|
|
171833
172225
|
if (typeof val === "number" || typeof val === "string" || val instanceof Date) {
|
|
171834
|
-
c2[
|
|
172226
|
+
c2[prop2] = obj4[prop2] == "Infinity" ? "Infinity" : new Date(val);
|
|
171835
172227
|
} else if (val === null) {
|
|
171836
|
-
c2[
|
|
172228
|
+
c2[prop2] = null;
|
|
171837
172229
|
}
|
|
171838
172230
|
break;
|
|
171839
172231
|
case "maxAge":
|
|
171840
172232
|
if (typeof val === "number" || val === "Infinity" || val === "-Infinity") {
|
|
171841
|
-
c2[
|
|
172233
|
+
c2[prop2] = val;
|
|
171842
172234
|
}
|
|
171843
172235
|
break;
|
|
171844
172236
|
case "domain":
|
|
171845
172237
|
case "path":
|
|
171846
172238
|
if (typeof val === "string" || val === null) {
|
|
171847
|
-
c2[
|
|
172239
|
+
c2[prop2] = val;
|
|
171848
172240
|
}
|
|
171849
172241
|
break;
|
|
171850
172242
|
case "secure":
|
|
171851
172243
|
case "httpOnly":
|
|
171852
172244
|
if (typeof val === "boolean") {
|
|
171853
|
-
c2[
|
|
172245
|
+
c2[prop2] = val;
|
|
171854
172246
|
}
|
|
171855
172247
|
break;
|
|
171856
172248
|
case "extensions":
|
|
171857
172249
|
if (Array.isArray(val) && val.every((item) => typeof item === "string")) {
|
|
171858
|
-
c2[
|
|
172250
|
+
c2[prop2] = val;
|
|
171859
172251
|
}
|
|
171860
172252
|
break;
|
|
171861
172253
|
case "hostOnly":
|
|
171862
172254
|
case "pathIsDefault":
|
|
171863
172255
|
if (typeof val === "boolean" || val === null) {
|
|
171864
|
-
c2[
|
|
172256
|
+
c2[prop2] = val;
|
|
171865
172257
|
}
|
|
171866
172258
|
break;
|
|
171867
172259
|
}
|
|
@@ -172381,54 +172773,54 @@ var init_dist = __esm({
|
|
|
172381
172773
|
*/
|
|
172382
172774
|
toJSON() {
|
|
172383
172775
|
const obj4 = {};
|
|
172384
|
-
for (const
|
|
172385
|
-
const val = this[
|
|
172386
|
-
if (val === cookieDefaults[
|
|
172776
|
+
for (const prop2 of _Cookie2.serializableProperties) {
|
|
172777
|
+
const val = this[prop2];
|
|
172778
|
+
if (val === cookieDefaults[prop2]) {
|
|
172387
172779
|
continue;
|
|
172388
172780
|
}
|
|
172389
|
-
switch (
|
|
172781
|
+
switch (prop2) {
|
|
172390
172782
|
case "key":
|
|
172391
172783
|
case "value":
|
|
172392
172784
|
case "sameSite":
|
|
172393
172785
|
if (typeof val === "string") {
|
|
172394
|
-
obj4[
|
|
172786
|
+
obj4[prop2] = val;
|
|
172395
172787
|
}
|
|
172396
172788
|
break;
|
|
172397
172789
|
case "expires":
|
|
172398
172790
|
case "creation":
|
|
172399
172791
|
case "lastAccessed":
|
|
172400
172792
|
if (typeof val === "number" || typeof val === "string" || val instanceof Date) {
|
|
172401
|
-
obj4[
|
|
172793
|
+
obj4[prop2] = val == "Infinity" ? "Infinity" : new Date(val).toISOString();
|
|
172402
172794
|
} else if (val === null) {
|
|
172403
|
-
obj4[
|
|
172795
|
+
obj4[prop2] = null;
|
|
172404
172796
|
}
|
|
172405
172797
|
break;
|
|
172406
172798
|
case "maxAge":
|
|
172407
172799
|
if (typeof val === "number" || val === "Infinity" || val === "-Infinity") {
|
|
172408
|
-
obj4[
|
|
172800
|
+
obj4[prop2] = val;
|
|
172409
172801
|
}
|
|
172410
172802
|
break;
|
|
172411
172803
|
case "domain":
|
|
172412
172804
|
case "path":
|
|
172413
172805
|
if (typeof val === "string" || val === null) {
|
|
172414
|
-
obj4[
|
|
172806
|
+
obj4[prop2] = val;
|
|
172415
172807
|
}
|
|
172416
172808
|
break;
|
|
172417
172809
|
case "secure":
|
|
172418
172810
|
case "httpOnly":
|
|
172419
172811
|
if (typeof val === "boolean") {
|
|
172420
|
-
obj4[
|
|
172812
|
+
obj4[prop2] = val;
|
|
172421
172813
|
}
|
|
172422
172814
|
break;
|
|
172423
172815
|
case "extensions":
|
|
172424
172816
|
if (Array.isArray(val)) {
|
|
172425
|
-
obj4[
|
|
172817
|
+
obj4[prop2] = val;
|
|
172426
172818
|
}
|
|
172427
172819
|
break;
|
|
172428
172820
|
case "hostOnly":
|
|
172429
172821
|
case "pathIsDefault":
|
|
172430
172822
|
if (typeof val === "boolean" || val === null) {
|
|
172431
|
-
obj4[
|
|
172823
|
+
obj4[prop2] = val;
|
|
172432
172824
|
}
|
|
172433
172825
|
break;
|
|
172434
172826
|
}
|
|
@@ -174155,9 +174547,9 @@ __export(cli_exports, {
|
|
|
174155
174547
|
systemTar: () => systemTar
|
|
174156
174548
|
});
|
|
174157
174549
|
import { execFile } from "node:child_process";
|
|
174158
|
-
import { mkdirSync as mkdirSync39, mkdtempSync as mkdtempSync5, rmSync as rmSync23, writeFileSync as
|
|
174550
|
+
import { mkdirSync as mkdirSync39, mkdtempSync as mkdtempSync5, rmSync as rmSync23, writeFileSync as writeFileSync36 } from "node:fs";
|
|
174159
174551
|
import { tmpdir as tmpdir6 } from "node:os";
|
|
174160
|
-
import { join as
|
|
174552
|
+
import { join as join85, resolve as resolve61 } from "node:path";
|
|
174161
174553
|
import { promisify } from "node:util";
|
|
174162
174554
|
function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
174163
174555
|
return async (appId2) => {
|
|
@@ -174170,12 +174562,12 @@ function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
|
174170
174562
|
}
|
|
174171
174563
|
const bytes2 = await readCapped(res, MAX_TARBALL_BYTES);
|
|
174172
174564
|
if (!bytes2) throw new Error(`project download is over the ${MAX_TARBALL_BYTES}-byte cap`);
|
|
174173
|
-
const root = mkdtempSync5(
|
|
174565
|
+
const root = mkdtempSync5(join85(tmpdir6(), "himi-base44-"));
|
|
174174
174566
|
const cleanup = () => rmSync23(root, { recursive: true, force: true });
|
|
174175
174567
|
try {
|
|
174176
|
-
const archive =
|
|
174177
|
-
const dir =
|
|
174178
|
-
|
|
174568
|
+
const archive = join85(root, "project.tar");
|
|
174569
|
+
const dir = join85(root, "project");
|
|
174570
|
+
writeFileSync36(archive, bytes2);
|
|
174179
174571
|
mkdirSync39(dir);
|
|
174180
174572
|
await extract(archive, dir);
|
|
174181
174573
|
return { dir, cleanup };
|
|
@@ -174212,7 +174604,7 @@ async function runBase44Analyze(opts) {
|
|
|
174212
174604
|
now: opts.now ?? (() => /* @__PURE__ */ new Date())
|
|
174213
174605
|
};
|
|
174214
174606
|
const result = await analyzeBase44({ url: opts.url, appId: opts.appId, sample: opts.sample }, ports);
|
|
174215
|
-
const written = writeBase44Book(result,
|
|
174607
|
+
const written = writeBase44Book(result, resolve61(opts.cwd ?? process.cwd(), opts.outDir ?? ".himi/base44-book"), { screenshots });
|
|
174216
174608
|
return { ok: true, out: written.outDir, files: written.files, mode: result.book.mode, gaps: result.book.gaps, book: result.book };
|
|
174217
174609
|
}
|
|
174218
174610
|
var MAX_TARBALL_BYTES, systemTar;
|
|
@@ -174230,6 +174622,155 @@ var init_cli = __esm({
|
|
|
174230
174622
|
}
|
|
174231
174623
|
});
|
|
174232
174624
|
|
|
174625
|
+
// src/base44-entities.ts
|
|
174626
|
+
var base44_entities_exports = {};
|
|
174627
|
+
__export(base44_entities_exports, {
|
|
174628
|
+
ROW_COUNT_CAP: () => ROW_COUNT_CAP,
|
|
174629
|
+
ROW_PAGE: () => ROW_PAGE,
|
|
174630
|
+
countRows: () => countRows,
|
|
174631
|
+
diffEntityFields: () => diffEntityFields,
|
|
174632
|
+
queryBase44Entities: () => queryBase44Entities
|
|
174633
|
+
});
|
|
174634
|
+
function typeLabel(type, format) {
|
|
174635
|
+
return format ? `${type} (${format})` : type;
|
|
174636
|
+
}
|
|
174637
|
+
function canonical4(v2) {
|
|
174638
|
+
if (Array.isArray(v2)) return `[${v2.map(canonical4).join(",")}]`;
|
|
174639
|
+
if (v2 && typeof v2 === "object") {
|
|
174640
|
+
return `{${Object.keys(v2).sort().map((k2) => `${JSON.stringify(k2)}:${canonical4(v2[k2])}`).join(",")}}`;
|
|
174641
|
+
}
|
|
174642
|
+
return JSON.stringify(v2) ?? "undefined";
|
|
174643
|
+
}
|
|
174644
|
+
function liveItemType(live3, key2) {
|
|
174645
|
+
const props = live3.schema?.properties;
|
|
174646
|
+
const items = props?.[key2]?.items;
|
|
174647
|
+
const t2 = items && typeof items === "object" ? items.type : void 0;
|
|
174648
|
+
return typeof t2 === "string" ? t2 : void 0;
|
|
174649
|
+
}
|
|
174650
|
+
function diffEntityFields(spec, live3) {
|
|
174651
|
+
const entity = live3.name;
|
|
174652
|
+
const out2 = [];
|
|
174653
|
+
const liveFields = new Map(live3.fields.filter((f2) => !BUILTINS2.has(f2.name)).map((f2) => [f2.name, f2]));
|
|
174654
|
+
for (const f2 of spec.fields ?? []) {
|
|
174655
|
+
const remote = liveFields.get(f2.key);
|
|
174656
|
+
const declared = typeLabel(f2.type, f2.format);
|
|
174657
|
+
if (!remote) {
|
|
174658
|
+
out2.push({ entity, kind: "missing-field", detail: `field "${f2.key}" (${declared}) is declared but not on the live entity` });
|
|
174659
|
+
} else {
|
|
174660
|
+
const actual = typeLabel(remote.type, remote.format && remote.type === "string" && DECLARABLE_FORMATS.has(remote.format) ? remote.format : void 0);
|
|
174661
|
+
if (actual !== declared) out2.push({ entity, kind: "type-mismatch", detail: `field "${f2.key}" is declared ${declared} but the live entity has ${actual}` });
|
|
174662
|
+
else if (f2.type === "array") {
|
|
174663
|
+
const declaredItems = f2.items?.type;
|
|
174664
|
+
const liveItems = liveItemType(live3, f2.key);
|
|
174665
|
+
if (declaredItems !== liveItems) {
|
|
174666
|
+
out2.push({ entity, kind: "type-mismatch", detail: `field "${f2.key}" is declared array of ${declaredItems ?? "unspecified"} but the live entity has array of ${liveItems ?? "unspecified"}` });
|
|
174667
|
+
}
|
|
174668
|
+
}
|
|
174669
|
+
}
|
|
174670
|
+
liveFields.delete(f2.key);
|
|
174671
|
+
}
|
|
174672
|
+
for (const [key2, f2] of liveFields) {
|
|
174673
|
+
if (!DECLARABLE_TYPES.has(f2.type)) continue;
|
|
174674
|
+
out2.push({ entity, kind: "extra-field", detail: `field "${key2}" (${typeLabel(f2.type, f2.format)}) exists on the live entity but is not declared` });
|
|
174675
|
+
}
|
|
174676
|
+
if (spec.rls !== void 0 && canonical4(spec.rls) !== canonical4(live3.rls ?? {})) {
|
|
174677
|
+
out2.push({ entity, kind: "rls-mismatch", detail: `declared rls ${canonical4(spec.rls)} differs from the live rls ${canonical4(live3.rls ?? {})} \u2014 informational; nothing is changed` });
|
|
174678
|
+
}
|
|
174679
|
+
return out2;
|
|
174680
|
+
}
|
|
174681
|
+
async function readLiveSchemas(ports, appId2) {
|
|
174682
|
+
if (!ports.downloadSource) throw new Error("no project download available");
|
|
174683
|
+
const dl2 = await ports.downloadSource(appId2);
|
|
174684
|
+
try {
|
|
174685
|
+
const files = new Map(collectAppSource(dl2.dir).entries.map((e2) => [e2.path, e2.bytes.toString("utf8")]));
|
|
174686
|
+
return new Map(readEntities(files, projectDirs(files)).map((e2) => [e2.name, e2]));
|
|
174687
|
+
} finally {
|
|
174688
|
+
dl2.cleanup();
|
|
174689
|
+
}
|
|
174690
|
+
}
|
|
174691
|
+
async function countRows(ports, appId2, entity, cap = ROW_COUNT_CAP) {
|
|
174692
|
+
const root = new URL(`/api/apps/${encodeURIComponent(appId2)}/entities/${encodeURIComponent(entity)}`, ports.apiBase).href;
|
|
174693
|
+
let rows = 0;
|
|
174694
|
+
for (let skip = 0; ; skip += ROW_PAGE) {
|
|
174695
|
+
const res = await ports.apiFetch(`${root}?fields=id&limit=${ROW_PAGE}&skip=${skip}`, {
|
|
174696
|
+
method: "GET",
|
|
174697
|
+
headers: { ...ports.token ? { Authorization: `Bearer ${ports.token}` } : {}, Accept: "application/json", "User-Agent": "himi base44 entities" }
|
|
174698
|
+
});
|
|
174699
|
+
if (!res.ok) throw new Error(res.status === 401 || res.status === 403 ? `refused (${res.status}) \u2014 the signed-in user cannot list ${entity}` : `HTTP ${res.status} listing ${entity}`);
|
|
174700
|
+
const body = await res.json();
|
|
174701
|
+
const page = Array.isArray(body) ? body : Array.isArray(body?.items) ? body.items : [];
|
|
174702
|
+
rows += page.length;
|
|
174703
|
+
if (page.length < ROW_PAGE) return rows > cap ? { rows: cap, capped: true } : { rows };
|
|
174704
|
+
if (rows > cap) return { rows: cap, capped: true };
|
|
174705
|
+
}
|
|
174706
|
+
}
|
|
174707
|
+
async function queryBase44Entities(opts) {
|
|
174708
|
+
const { app, appId: appId2, ports } = opts;
|
|
174709
|
+
const cap = opts.cap ?? ROW_COUNT_CAP;
|
|
174710
|
+
let live3;
|
|
174711
|
+
let sourceError;
|
|
174712
|
+
try {
|
|
174713
|
+
live3 = await readLiveSchemas(ports, appId2);
|
|
174714
|
+
} catch (e2) {
|
|
174715
|
+
sourceError = e2.message;
|
|
174716
|
+
}
|
|
174717
|
+
if (live3 && live3.size === 0) {
|
|
174718
|
+
live3 = void 0;
|
|
174719
|
+
sourceError = "the downloaded project files contain no entity schemas \u2014 drift not checked";
|
|
174720
|
+
}
|
|
174721
|
+
const specs = (opts.base44.entities ?? []).filter((s2) => !!s2 && typeof s2 === "object" && !!physicalEntityName(s2, app));
|
|
174722
|
+
const declared = [];
|
|
174723
|
+
for (const spec of specs) {
|
|
174724
|
+
const physical = physicalEntityName(spec, app);
|
|
174725
|
+
const row = {
|
|
174726
|
+
entity: isAdoptedEntity(spec) ? spec.base44Name : spec.name,
|
|
174727
|
+
physical,
|
|
174728
|
+
ownership: isAdoptedEntity(spec) ? "adopted" : "owned",
|
|
174729
|
+
rows: null,
|
|
174730
|
+
drift: []
|
|
174731
|
+
};
|
|
174732
|
+
const remote = live3?.get(physical);
|
|
174733
|
+
if (live3 && !remote) {
|
|
174734
|
+
row.drift.push({ entity: physical, kind: "missing", detail: `entity "${physical}" is declared but the live app does not have it` });
|
|
174735
|
+
} else {
|
|
174736
|
+
if (remote) row.drift = diffEntityFields(spec, remote);
|
|
174737
|
+
try {
|
|
174738
|
+
const c2 = await countRows(ports, appId2, physical, cap);
|
|
174739
|
+
row.rows = c2.rows;
|
|
174740
|
+
if (c2.capped) row.capped = true;
|
|
174741
|
+
} catch (e2) {
|
|
174742
|
+
row.countError = e2.message;
|
|
174743
|
+
}
|
|
174744
|
+
}
|
|
174745
|
+
declared.push(row);
|
|
174746
|
+
}
|
|
174747
|
+
const known = new Set(declared.map((d2) => d2.physical));
|
|
174748
|
+
const foreignNames = live3 ? [...live3.keys()].filter((n2) => !known.has(n2)).sort() : [];
|
|
174749
|
+
return {
|
|
174750
|
+
ok: true,
|
|
174751
|
+
app,
|
|
174752
|
+
appId: appId2,
|
|
174753
|
+
prefix: base44Prefix(app),
|
|
174754
|
+
declared,
|
|
174755
|
+
foreign: opts.all ? foreignNames : { count: foreignNames.length },
|
|
174756
|
+
sourceRead: live3 ? "ok" : "unavailable",
|
|
174757
|
+
...sourceError ? { sourceError } : {}
|
|
174758
|
+
};
|
|
174759
|
+
}
|
|
174760
|
+
var ROW_PAGE, ROW_COUNT_CAP, BUILTINS2, DECLARABLE_FORMATS, DECLARABLE_TYPES;
|
|
174761
|
+
var init_base44_entities2 = __esm({
|
|
174762
|
+
"src/base44-entities.ts"() {
|
|
174763
|
+
init_app_source();
|
|
174764
|
+
init_project();
|
|
174765
|
+
init_base44_schema();
|
|
174766
|
+
ROW_PAGE = 500;
|
|
174767
|
+
ROW_COUNT_CAP = 5e3;
|
|
174768
|
+
BUILTINS2 = new Set(BASE44_BUILTIN_FIELDS);
|
|
174769
|
+
DECLARABLE_FORMATS = new Set(BASE44_STRING_FORMATS);
|
|
174770
|
+
DECLARABLE_TYPES = new Set(BASE44_FIELD_TYPES);
|
|
174771
|
+
}
|
|
174772
|
+
});
|
|
174773
|
+
|
|
174233
174774
|
// src/one-app/errors.ts
|
|
174234
174775
|
var OneAppError;
|
|
174235
174776
|
var init_errors2 = __esm({
|
|
@@ -174311,14 +174852,14 @@ function boundedSetting(value, ceiling) {
|
|
|
174311
174852
|
return value !== void 0 && Number.isFinite(value) && value > 0 ? Math.min(value, ceiling) : ceiling;
|
|
174312
174853
|
}
|
|
174313
174854
|
function semanticFingerprint(structure) {
|
|
174314
|
-
const
|
|
174315
|
-
if (Array.isArray(value)) return `[${value.map((item) =>
|
|
174855
|
+
const canonical5 = (value, root = false) => {
|
|
174856
|
+
if (Array.isArray(value)) return `[${value.map((item) => canonical5(item)).join(",")}]`;
|
|
174316
174857
|
if (isObject2(value)) {
|
|
174317
|
-
return `{${Object.keys(value).filter((key2) => !root || !LIFECYCLE_FIELDS.has(key2)).sort().map((key2) => `${JSON.stringify(key2)}:${
|
|
174858
|
+
return `{${Object.keys(value).filter((key2) => !root || !LIFECYCLE_FIELDS.has(key2)).sort().map((key2) => `${JSON.stringify(key2)}:${canonical5(value[key2])}`).join(",")}}`;
|
|
174318
174859
|
}
|
|
174319
174860
|
return JSON.stringify(value);
|
|
174320
174861
|
};
|
|
174321
|
-
return createHash43("sha256").update(
|
|
174862
|
+
return createHash43("sha256").update(canonical5(structure, true)).digest("hex");
|
|
174322
174863
|
}
|
|
174323
174864
|
async function collectOneApp(input, deps = {}) {
|
|
174324
174865
|
if (typeof input.metaSiteId !== "string" || !UUID.test(input.metaSiteId)) {
|
|
@@ -174883,15 +175424,15 @@ function planNavigation(raw, policy = "bottom-tabs") {
|
|
|
174883
175424
|
return;
|
|
174884
175425
|
}
|
|
174885
175426
|
const layoutPointer = `/layoutItems/${part2(layoutItemId)}`;
|
|
174886
|
-
const
|
|
174887
|
-
if (
|
|
175427
|
+
const label3 = string4(layout.title) ?? null;
|
|
175428
|
+
if (label3 === null) warnings.push({ code: "missing_label", pointer: `${layoutPointer}/title` });
|
|
174888
175429
|
const fallback = tabs.length === 0 ? string4(firstEntry.icon) : void 0;
|
|
174889
175430
|
const icon = string4(layout.icon) ?? fallback ?? null;
|
|
174890
175431
|
if (icon === null) warnings.push({ code: "missing_icon", pointer: `${layoutPointer}/icon` });
|
|
174891
175432
|
tabs.push({
|
|
174892
175433
|
layoutItemId,
|
|
174893
175434
|
pointer: itemPointer,
|
|
174894
|
-
label:
|
|
175435
|
+
label: label3,
|
|
174895
175436
|
icon,
|
|
174896
175437
|
iconSource: string4(layout.icon) ? "layout-item" : fallback ? "bottom-entry" : "missing",
|
|
174897
175438
|
header: tabs.length === 0 ? { kind: "source", headerId: string4(rootScreen.headerId) ?? null } : { kind: "default" }
|
|
@@ -174942,9 +175483,9 @@ __export(cli_exports2, {
|
|
|
174942
175483
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
174943
175484
|
runOneAppCommand: () => runOneAppCommand
|
|
174944
175485
|
});
|
|
174945
|
-
import { closeSync as closeSync7, constants as constants4, lstatSync as lstatSync21, mkdirSync as mkdirSync40, openSync as openSync6, readFileSync as
|
|
175486
|
+
import { closeSync as closeSync7, constants as constants4, lstatSync as lstatSync21, mkdirSync as mkdirSync40, openSync as openSync6, readFileSync as readFileSync100, realpathSync as realpathSync14, writeFileSync as writeFileSync37 } from "node:fs";
|
|
174946
175487
|
import { createHash as createHash44 } from "node:crypto";
|
|
174947
|
-
import { dirname as dirname47, join as
|
|
175488
|
+
import { dirname as dirname47, join as join86, parse as parse3, resolve as resolve62 } from "node:path";
|
|
174948
175489
|
function readOptions(argv, cwd, commandIncluded) {
|
|
174949
175490
|
let cursor = 0;
|
|
174950
175491
|
const skipGlobalSwitches = () => {
|
|
@@ -174989,10 +175530,10 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
174989
175530
|
let prompt = flags.prompt ?? "";
|
|
174990
175531
|
if (flags["prompt-file"] !== void 0) {
|
|
174991
175532
|
try {
|
|
174992
|
-
const file2 =
|
|
175533
|
+
const file2 = resolve62(cwd, flags["prompt-file"]);
|
|
174993
175534
|
const stat2 = lstatSync21(file2);
|
|
174994
175535
|
if (!stat2.isFile() || stat2.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
174995
|
-
prompt =
|
|
175536
|
+
prompt = readFileSync100(file2, "utf8");
|
|
174996
175537
|
} catch {
|
|
174997
175538
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
174998
175539
|
}
|
|
@@ -175007,8 +175548,8 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
175007
175548
|
if (flags.dir !== void 0 && !flags.dir.trim()) {
|
|
175008
175549
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
175009
175550
|
}
|
|
175010
|
-
const parentDir =
|
|
175011
|
-
const workspace =
|
|
175551
|
+
const parentDir = resolve62(cwd, flags.dir ?? ".");
|
|
175552
|
+
const workspace = join86(parentDir, name);
|
|
175012
175553
|
assertSafeParents(parentDir);
|
|
175013
175554
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
175014
175555
|
return { metaSiteId, appInstance, prompt, name, parentDir, workspace, target, topTabs };
|
|
@@ -175043,7 +175584,7 @@ function assertSafeParents(path2) {
|
|
|
175043
175584
|
function writePrivate(path2, contents, append) {
|
|
175044
175585
|
const fd = openSync6(path2, constants4.O_WRONLY | constants4.O_CREAT | constants4.O_NOFOLLOW | (append ? constants4.O_APPEND : constants4.O_EXCL), 384);
|
|
175045
175586
|
try {
|
|
175046
|
-
|
|
175587
|
+
writeFileSync37(fd, contents, { encoding: "utf8" });
|
|
175047
175588
|
} finally {
|
|
175048
175589
|
closeSync7(fd);
|
|
175049
175590
|
}
|
|
@@ -175065,7 +175606,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
175065
175606
|
const hashes = {};
|
|
175066
175607
|
const diskWrite = deps.writeFile ?? writePrivate;
|
|
175067
175608
|
const put = (name, content) => {
|
|
175068
|
-
const path2 =
|
|
175609
|
+
const path2 = join86(evidenceDir, name);
|
|
175069
175610
|
try {
|
|
175070
175611
|
assertSafeParents(evidenceDir);
|
|
175071
175612
|
diskWrite(path2, content, false);
|
|
@@ -175081,7 +175622,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
175081
175622
|
if (!evidenceDir) return;
|
|
175082
175623
|
try {
|
|
175083
175624
|
assertSafeParents(evidenceDir);
|
|
175084
|
-
diskWrite(
|
|
175625
|
+
diskWrite(join86(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
|
|
175085
175626
|
} catch {
|
|
175086
175627
|
throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
|
|
175087
175628
|
}
|
|
@@ -175097,7 +175638,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
175097
175638
|
assertSafeParents(options.parentDir);
|
|
175098
175639
|
mkdirSync40(options.workspace, { mode: 448 });
|
|
175099
175640
|
if (realpathSync14(options.workspace) !== options.workspace) throw new Error("destination changed");
|
|
175100
|
-
evidenceDir =
|
|
175641
|
+
evidenceDir = join86(options.workspace, ".himi", "one-app");
|
|
175101
175642
|
mkdirSync40(evidenceDir, { recursive: true, mode: 448 });
|
|
175102
175643
|
} catch (error) {
|
|
175103
175644
|
if (error.code === "EEXIST") {
|
|
@@ -175867,16 +176408,16 @@ function deriveAdoptedCmsCollections(cms) {
|
|
|
175867
176408
|
const dropped = [];
|
|
175868
176409
|
const seen = /* @__PURE__ */ new Set();
|
|
175869
176410
|
for (const collection of cms) {
|
|
175870
|
-
const
|
|
175871
|
-
if (!
|
|
176411
|
+
const label3 = typeof collection.id === "string" ? collection.id.trim().slice(0, 60) : "";
|
|
176412
|
+
if (!label3) continue;
|
|
175872
176413
|
if (collection.ownerAppId) {
|
|
175873
|
-
dropped.push({ id:
|
|
176414
|
+
dropped.push({ id: label3, reason: "owned by a Wix app \u2014 its own vertical covers it" });
|
|
175874
176415
|
continue;
|
|
175875
176416
|
}
|
|
175876
176417
|
const readRole = collection.readRole;
|
|
175877
176418
|
if (readRole !== "ANYONE") {
|
|
175878
176419
|
dropped.push({
|
|
175879
|
-
id:
|
|
176420
|
+
id: label3,
|
|
175880
176421
|
reason: readRole === "SITE_MEMBER" || readRole === "SITE_MEMBER_AUTHOR" ? `read permission "${readRole}" \u2014 member-only rows would be cached unencrypted on the device and served to a later visitor` : `read permission ${readRole ? `"${readRole}"` : "unknown"} \u2014 a shipped app can only read ANYONE`
|
|
175881
176422
|
});
|
|
175882
176423
|
continue;
|
|
@@ -175888,7 +176429,7 @@ function deriveAdoptedCmsCollections(cms) {
|
|
|
175888
176429
|
}
|
|
175889
176430
|
const id = collection.id;
|
|
175890
176431
|
if (seen.has(id)) {
|
|
175891
|
-
dropped.push({ id:
|
|
176432
|
+
dropped.push({ id: label3, reason: "duplicate id" });
|
|
175892
176433
|
continue;
|
|
175893
176434
|
}
|
|
175894
176435
|
const fields = collection.fields.flatMap((field) => {
|
|
@@ -175908,7 +176449,7 @@ function deriveAdoptedCmsCollections(cms) {
|
|
|
175908
176449
|
const requested = collection.displayField;
|
|
175909
176450
|
const displayField = fields.some((field) => field.key === requested) ? requested : fields[0]?.key;
|
|
175910
176451
|
if (!displayField) {
|
|
175911
|
-
dropped.push({ id:
|
|
176452
|
+
dropped.push({ id: label3, reason: "no readable field to show as a row title" });
|
|
175912
176453
|
continue;
|
|
175913
176454
|
}
|
|
175914
176455
|
seen.add(id);
|
|
@@ -176164,9 +176705,9 @@ function taglineFrom(identity, pages2, published) {
|
|
|
176164
176705
|
const hero = copyOrDrop(home?.heroCopy, CAP3.tagline);
|
|
176165
176706
|
return hero ? { text: hero, source: "hero" } : null;
|
|
176166
176707
|
}
|
|
176167
|
-
function tabLabel(
|
|
176168
|
-
const trimmed =
|
|
176169
|
-
return trimmed && trimmed !==
|
|
176708
|
+
function tabLabel(label3) {
|
|
176709
|
+
const trimmed = label3.replace(/\s+page$/i, "").trim();
|
|
176710
|
+
return trimmed && trimmed !== label3.trim() && !/^(front|landing|title|web)$/i.test(trimmed) ? trimmed : label3;
|
|
176170
176711
|
}
|
|
176171
176712
|
function suggestKeys(args) {
|
|
176172
176713
|
const { nav, sections, tagline, installedVerticals } = args;
|
|
@@ -176179,9 +176720,9 @@ function suggestKeys(args) {
|
|
|
176179
176720
|
out2[key2] = value.slice(0, CAP3.value);
|
|
176180
176721
|
};
|
|
176181
176722
|
const allowed2 = (rule) => !rule.vertical || installed.has(rule.vertical);
|
|
176182
|
-
for (const
|
|
176723
|
+
for (const label3 of nav) {
|
|
176183
176724
|
for (const rule of KEY_RULES) {
|
|
176184
|
-
if (rule.tab && allowed2(rule) && rule.re.test(
|
|
176725
|
+
if (rule.tab && allowed2(rule) && rule.re.test(label3)) set(rule.tab, tabLabel(label3));
|
|
176185
176726
|
}
|
|
176186
176727
|
}
|
|
176187
176728
|
for (const section3 of sections) {
|
|
@@ -176334,9 +176875,9 @@ function textFields(look) {
|
|
|
176334
176875
|
const add = (text9, where, narrative = false) => {
|
|
176335
176876
|
if (text9 && text9.trim()) out2.push({ text: text9, where, narrative });
|
|
176336
176877
|
};
|
|
176337
|
-
for (const
|
|
176878
|
+
for (const label3 of look.navLabels) add(label3, "nav");
|
|
176338
176879
|
for (const p2 of look.pages) {
|
|
176339
|
-
for (const
|
|
176880
|
+
for (const label3 of p2.navLabels) add(label3, "nav");
|
|
176340
176881
|
add(p2.title, `${p2.url} (title)`);
|
|
176341
176882
|
add(p2.heroCopy, p2.url, true);
|
|
176342
176883
|
for (const h2 of p2.headings) add(h2, p2.url);
|
|
@@ -177234,15 +177775,15 @@ var init_customer_build = __esm({
|
|
|
177234
177775
|
});
|
|
177235
177776
|
|
|
177236
177777
|
// src/site-analyze/apply.ts
|
|
177237
|
-
import { existsSync as
|
|
177238
|
-
import { dirname as dirname48, isAbsolute as isAbsolute8, join as
|
|
177778
|
+
import { existsSync as existsSync80, readFileSync as readFileSync101, writeFileSync as writeFileSync38, copyFileSync as copyFileSync2, mkdirSync as mkdirSync41, realpathSync as realpathSync15, statSync as statSync22 } from "node:fs";
|
|
177779
|
+
import { dirname as dirname48, isAbsolute as isAbsolute8, join as join87, resolve as resolve63, sep as sep20 } from "node:path";
|
|
177239
177780
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
177240
177781
|
function unpairedRedirectNote(overlay) {
|
|
177241
177782
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
177242
177783
|
return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
|
|
177243
177784
|
}
|
|
177244
177785
|
function posix4(p2) {
|
|
177245
|
-
return
|
|
177786
|
+
return resolve63(p2).replace(/\\/g, "/");
|
|
177246
177787
|
}
|
|
177247
177788
|
function committedShellProvisioning(path2) {
|
|
177248
177789
|
return committedShellFor(posix4(path2));
|
|
@@ -177250,7 +177791,7 @@ function committedShellProvisioning(path2) {
|
|
|
177250
177791
|
function findRepoRoot(cwd) {
|
|
177251
177792
|
let dir = cwd;
|
|
177252
177793
|
for (let i2 = 0; i2 < 8; i2++) {
|
|
177253
|
-
if (SHELL_NAMES2.some((name) =>
|
|
177794
|
+
if (SHELL_NAMES2.some((name) => existsSync80(join87(dir, shellAppDir(name), "package.json")))) return dir;
|
|
177254
177795
|
const next = dirname48(dir);
|
|
177255
177796
|
if (next === dir) break;
|
|
177256
177797
|
dir = next;
|
|
@@ -177276,7 +177817,7 @@ function assertNotCommitted(path2, forbidden2) {
|
|
|
177276
177817
|
`refusing to overwrite committed ${committedProvisioningPath(committed)} \u2014 use prepare:customer --contract`
|
|
177277
177818
|
);
|
|
177278
177819
|
}
|
|
177279
|
-
if (forbidden2 &&
|
|
177820
|
+
if (forbidden2 && resolve63(path2) === resolve63(forbidden2)) {
|
|
177280
177821
|
const named = committedShellProvisioning(forbidden2);
|
|
177281
177822
|
throw new Error(
|
|
177282
177823
|
`refusing to overwrite committed ${named ? committedProvisioningPath(named) : forbidden2} \u2014 pass a content-package provisioning.json or use prepare:customer --contract`
|
|
@@ -177353,24 +177894,24 @@ function sameKnownSite(previous, next) {
|
|
|
177353
177894
|
}
|
|
177354
177895
|
function buildMergedContract(options) {
|
|
177355
177896
|
const { appDir: appDir3, packageDir, overlay } = options;
|
|
177356
|
-
const committedPath =
|
|
177357
|
-
if (!
|
|
177897
|
+
const committedPath = join87(appDir3, "provisioning.json");
|
|
177898
|
+
if (!existsSync80(committedPath)) {
|
|
177358
177899
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
177359
177900
|
}
|
|
177360
|
-
const committed = JSON.parse(
|
|
177901
|
+
const committed = JSON.parse(readFileSync101(committedPath, "utf8"));
|
|
177361
177902
|
const merged = mergeCustomerOwned(committed, overlay);
|
|
177362
177903
|
const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
|
|
177363
177904
|
const branding = merged.branding ?? {};
|
|
177364
177905
|
const staged = [];
|
|
177365
177906
|
const contained = (root, rel) => {
|
|
177366
177907
|
if (isAbsolute8(rel)) return void 0;
|
|
177367
|
-
const full =
|
|
177368
|
-
return full.startsWith(
|
|
177908
|
+
const full = resolve63(root, rel);
|
|
177909
|
+
return full.startsWith(resolve63(root) + sep20) ? full : void 0;
|
|
177369
177910
|
};
|
|
177370
177911
|
const stage = (fromRel, toRel) => {
|
|
177371
177912
|
const from = contained(packageDir, fromRel);
|
|
177372
|
-
const to2 = contained(
|
|
177373
|
-
if (!from || !to2 || !
|
|
177913
|
+
const to2 = contained(join87(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
177914
|
+
if (!from || !to2 || !existsSync80(from)) return void 0;
|
|
177374
177915
|
let real;
|
|
177375
177916
|
let realRoot;
|
|
177376
177917
|
try {
|
|
@@ -177392,11 +177933,11 @@ function buildMergedContract(options) {
|
|
|
177392
177933
|
};
|
|
177393
177934
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
177394
177935
|
if (icon) branding.appIconPath = icon;
|
|
177395
|
-
const facesPath =
|
|
177396
|
-
if (
|
|
177936
|
+
const facesPath = join87(packageDir, "media/fonts/faces.json");
|
|
177937
|
+
if (existsSync80(facesPath)) {
|
|
177397
177938
|
let faces = [];
|
|
177398
177939
|
try {
|
|
177399
|
-
const parsed = JSON.parse(
|
|
177940
|
+
const parsed = JSON.parse(readFileSync101(facesPath, "utf8"));
|
|
177400
177941
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
177401
177942
|
} catch {
|
|
177402
177943
|
faces = [];
|
|
@@ -177417,11 +177958,11 @@ function buildMergedContract(options) {
|
|
|
177417
177958
|
merged.branding = branding;
|
|
177418
177959
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
177419
177960
|
`;
|
|
177420
|
-
const path2 =
|
|
177421
|
-
|
|
177422
|
-
const localPath2 =
|
|
177961
|
+
const path2 = join87(packageDir, "provisioning.contract.json");
|
|
177962
|
+
writeFileSync38(path2, body);
|
|
177963
|
+
const localPath2 = join87(appDir3, LOCAL_CONTRACT_REL);
|
|
177423
177964
|
mkdirSync41(dirname48(localPath2), { recursive: true });
|
|
177424
|
-
|
|
177965
|
+
writeFileSync38(localPath2, body);
|
|
177425
177966
|
staged.push(localPath2);
|
|
177426
177967
|
return { path: path2, staged };
|
|
177427
177968
|
}
|
|
@@ -177440,9 +177981,9 @@ function catalogTypography(overlay, template) {
|
|
|
177440
177981
|
typography[role] = token;
|
|
177441
177982
|
continue;
|
|
177442
177983
|
}
|
|
177443
|
-
const
|
|
177444
|
-
if (
|
|
177445
|
-
typography[role] = { ...token, family:
|
|
177984
|
+
const canonical5 = canonicalFamilyName(family.trim());
|
|
177985
|
+
if (canonical5) {
|
|
177986
|
+
typography[role] = { ...token, family: canonical5 };
|
|
177446
177987
|
continue;
|
|
177447
177988
|
}
|
|
177448
177989
|
const kept = base[role]?.family;
|
|
@@ -177454,10 +177995,10 @@ function catalogTypography(overlay, template) {
|
|
|
177454
177995
|
function staticFaqFor(overlay, overlayPath) {
|
|
177455
177996
|
const own5 = overlay.faq;
|
|
177456
177997
|
if (own5 !== void 0) return deriveStaticFaq(own5);
|
|
177457
|
-
const bookPath =
|
|
177458
|
-
if (!
|
|
177998
|
+
const bookPath = join87(dirname48(resolve63(overlayPath)), "book.json");
|
|
177999
|
+
if (!existsSync80(bookPath)) return void 0;
|
|
177459
178000
|
try {
|
|
177460
|
-
const book = JSON.parse(
|
|
178001
|
+
const book = JSON.parse(readFileSync101(bookPath, "utf8"));
|
|
177461
178002
|
const copy = book?.copy;
|
|
177462
178003
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
177463
178004
|
const pairs = deriveStaticFaq(copy.faq);
|
|
@@ -177471,10 +178012,10 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
177471
178012
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
177472
178013
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
177473
178014
|
);
|
|
177474
|
-
const bookPath =
|
|
177475
|
-
if (!
|
|
178015
|
+
const bookPath = join87(dirname48(resolve63(overlayPath)), "book.json");
|
|
178016
|
+
if (!existsSync80(bookPath)) return void 0;
|
|
177476
178017
|
try {
|
|
177477
|
-
const book = JSON.parse(
|
|
178018
|
+
const book = JSON.parse(readFileSync101(bookPath, "utf8"));
|
|
177478
178019
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
177479
178020
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
177480
178021
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -177483,11 +178024,11 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
177483
178024
|
}
|
|
177484
178025
|
}
|
|
177485
178026
|
async function applyOverlays(input) {
|
|
177486
|
-
const cwd =
|
|
178027
|
+
const cwd = resolve63(input.cwd);
|
|
177487
178028
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
177488
178029
|
assertKnownShell(shell);
|
|
177489
|
-
const overlay = JSON.parse(
|
|
177490
|
-
const tokens2 = JSON.parse(
|
|
178030
|
+
const overlay = JSON.parse(readFileSync101(input.overlayPath, "utf8"));
|
|
178031
|
+
const tokens2 = JSON.parse(readFileSync101(input.tokensPath, "utf8"));
|
|
177491
178032
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
177492
178033
|
if (faq !== void 0) overlay.faq = faq;
|
|
177493
178034
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -177504,15 +178045,15 @@ async function applyOverlays(input) {
|
|
|
177504
178045
|
`shell "${shell}" cannot bake a customer brand \u2014 it ships no prepare:customer script`
|
|
177505
178046
|
);
|
|
177506
178047
|
}
|
|
177507
|
-
const appDir3 =
|
|
177508
|
-
const committedPath =
|
|
177509
|
-
const committedSite =
|
|
178048
|
+
const appDir3 = join87(repoRoot2, shellAppDir(shell));
|
|
178049
|
+
const committedPath = join87(appDir3, "provisioning.json");
|
|
178050
|
+
const committedSite = existsSync80(committedPath) ? JSON.parse(readFileSync101(committedPath, "utf8")).site : void 0;
|
|
177510
178051
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
177511
178052
|
throw new Error(
|
|
177512
178053
|
`shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), and this overlay has none. Re-run \`himi site analyze --url <site> --shell ${shell}\` to derive the site's page map (edit \`site.pages\` in provisioning.overlay.json if needed), then --apply.`
|
|
177513
178054
|
);
|
|
177514
178055
|
}
|
|
177515
|
-
const packageDir = dirname48(
|
|
178056
|
+
const packageDir = dirname48(resolve63(input.overlayPath));
|
|
177516
178057
|
const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay });
|
|
177517
178058
|
wrote.push(...staged);
|
|
177518
178059
|
const r2 = spawnSync4("npm", ["run", "prepare:customer", "--", "--contract", contract], {
|
|
@@ -177533,9 +178074,9 @@ async function applyOverlays(input) {
|
|
|
177533
178074
|
note: `prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
|
|
177534
178075
|
};
|
|
177535
178076
|
}
|
|
177536
|
-
const pkgProv =
|
|
178077
|
+
const pkgProv = join87(cwd, "provisioning.json");
|
|
177537
178078
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
177538
|
-
const contentPath =
|
|
178079
|
+
const contentPath = join87(cwd, "himalaya.content.json");
|
|
177539
178080
|
const syncViewNames = (before, after) => {
|
|
177540
178081
|
const content = readContentManifest(cwd);
|
|
177541
178082
|
if (!content) return;
|
|
@@ -177547,26 +178088,26 @@ async function applyOverlays(input) {
|
|
|
177547
178088
|
};
|
|
177548
178089
|
let packageFaq = faq;
|
|
177549
178090
|
let packageGalleries = galleries;
|
|
177550
|
-
if (
|
|
177551
|
-
const cur = JSON.parse(
|
|
178091
|
+
if (existsSync80(pkgProv)) {
|
|
178092
|
+
const cur = JSON.parse(readFileSync101(pkgProv, "utf8"));
|
|
177552
178093
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
177553
178094
|
const merged = deepMerge4(cur, overlay);
|
|
177554
178095
|
packageFaq = merged.faq;
|
|
177555
178096
|
packageGalleries = merged.galleries;
|
|
177556
178097
|
syncViewNames(cur.site, merged.site);
|
|
177557
|
-
|
|
178098
|
+
writeFileSync38(pkgProv, JSON.stringify(merged, null, 2) + "\n");
|
|
177558
178099
|
wrote.push(pkgProv);
|
|
177559
178100
|
} else {
|
|
177560
178101
|
syncViewNames(void 0, overlay.site);
|
|
177561
|
-
|
|
178102
|
+
writeFileSync38(pkgProv, JSON.stringify(overlay, null, 2) + "\n");
|
|
177562
178103
|
wrote.push(pkgProv);
|
|
177563
178104
|
}
|
|
177564
178105
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
177565
178106
|
overlay.installedVerticals.push("galleries");
|
|
177566
178107
|
}
|
|
177567
|
-
const pkgTokens =
|
|
177568
|
-
if (
|
|
177569
|
-
const cur = JSON.parse(
|
|
178108
|
+
const pkgTokens = join87(cwd, "tokens.json");
|
|
178109
|
+
if (existsSync80(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
178110
|
+
const cur = JSON.parse(readFileSync101(pkgTokens, "utf8"));
|
|
177570
178111
|
let tokensIn = tokens2;
|
|
177571
178112
|
if (tokens2.typography) {
|
|
177572
178113
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -177587,13 +178128,13 @@ async function applyOverlays(input) {
|
|
|
177587
178128
|
if (primary && glow && typeof glow.color === "string") glow.color = primary;
|
|
177588
178129
|
stripBrandFromIdiom(merged);
|
|
177589
178130
|
}
|
|
177590
|
-
|
|
178131
|
+
writeFileSync38(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
|
|
177591
178132
|
wrote.push(pkgTokens);
|
|
177592
178133
|
}
|
|
177593
178134
|
const homeAction = homeRefreshActionId(shell);
|
|
177594
|
-
const homeSrc =
|
|
177595
|
-
if (homeAction &&
|
|
177596
|
-
const prev =
|
|
178135
|
+
const homeSrc = join87(cwd, "dev/index.ts");
|
|
178136
|
+
if (homeAction && existsSync80(homeSrc)) {
|
|
178137
|
+
const prev = readFileSync101(homeSrc, "utf8");
|
|
177597
178138
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
177598
178139
|
let next = patched.src;
|
|
177599
178140
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -177621,20 +178162,20 @@ async function applyOverlays(input) {
|
|
|
177621
178162
|
}
|
|
177622
178163
|
}
|
|
177623
178164
|
if (next !== prev) {
|
|
177624
|
-
|
|
178165
|
+
writeFileSync38(homeSrc, next);
|
|
177625
178166
|
wrote.push(homeSrc);
|
|
177626
178167
|
}
|
|
177627
178168
|
if (patched.unparsed) {
|
|
177628
178169
|
notes.push(`${patched.unparsed} onAppear params block(s) in ${homeSrc} could not be read \u2014 any brand values inside them were not applied`);
|
|
177629
178170
|
}
|
|
177630
178171
|
}
|
|
177631
|
-
if (!input.iconPath || !
|
|
177632
|
-
const book = input.iconPath ? dirname48(dirname48(
|
|
178172
|
+
if (!input.iconPath || !existsSync80(input.iconPath)) {
|
|
178173
|
+
const book = input.iconPath ? dirname48(dirname48(resolve63(input.iconPath))) : void 0;
|
|
177633
178174
|
notes.push(
|
|
177634
178175
|
book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
|
|
177635
178176
|
);
|
|
177636
178177
|
}
|
|
177637
|
-
if (input.iconPath &&
|
|
178178
|
+
if (input.iconPath && existsSync80(input.iconPath)) {
|
|
177638
178179
|
try {
|
|
177639
178180
|
const installed = await installIcon(cwd, input.iconPath, { derivePlay: true });
|
|
177640
178181
|
wrote.push(...installed.wrote);
|
|
@@ -177825,11 +178366,11 @@ function deriveSiteShell(input) {
|
|
|
177825
178366
|
}
|
|
177826
178367
|
} else if (input.look.navLabels.length && published.length) {
|
|
177827
178368
|
const byTitle = new Map(published.map((p2) => [oneLine2(p2.title).toLowerCase(), p2]));
|
|
177828
|
-
for (const
|
|
177829
|
-
if (homeTitle === "Home" && HOME_WORD.test(oneLine2(
|
|
177830
|
-
const page = byTitle.get(oneLine2(
|
|
178369
|
+
for (const label3 of input.look.navLabels) {
|
|
178370
|
+
if (homeTitle === "Home" && HOME_WORD.test(oneLine2(label3))) homeTitle = boundedTitle(label3);
|
|
178371
|
+
const page = byTitle.get(oneLine2(label3).toLowerCase());
|
|
177831
178372
|
const path2 = page?.url ? pathOnSite(origin, page.url) : null;
|
|
177832
|
-
if (page && path2 !== null) add(
|
|
178373
|
+
if (page && path2 !== null) add(label3, path2, page.url);
|
|
177833
178374
|
}
|
|
177834
178375
|
}
|
|
177835
178376
|
if (!candidates.length && navLinks.length) {
|
|
@@ -178593,8 +179134,8 @@ __export(cli_exports3, {
|
|
|
178593
179134
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
178594
179135
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
178595
179136
|
});
|
|
178596
|
-
import { existsSync as
|
|
178597
|
-
import { resolve as
|
|
179137
|
+
import { existsSync as existsSync81, readFileSync as readFileSync102 } from "node:fs";
|
|
179138
|
+
import { resolve as resolve64 } from "node:path";
|
|
178598
179139
|
function applyNeedsClient(shell) {
|
|
178599
179140
|
if (shell === void 0 || !SHELL_NAMES2.includes(shell)) return true;
|
|
178600
179141
|
return !isSiteShell(shell);
|
|
@@ -178627,7 +179168,7 @@ async function runSiteAnalyze(opts) {
|
|
|
178627
179168
|
const assetFetch = assetFetchFor(opts);
|
|
178628
179169
|
const siteFetch = guardedSiteFetch;
|
|
178629
179170
|
const cwd = opts.cwd ?? process.cwd();
|
|
178630
|
-
const outDir =
|
|
179171
|
+
const outDir = resolve64(cwd, opts.outDir ?? ".himi/business-book");
|
|
178631
179172
|
let ownerAuth;
|
|
178632
179173
|
let msid;
|
|
178633
179174
|
const ownerSite = ownerSiteFor(opts);
|
|
@@ -178656,14 +179197,14 @@ async function runSiteAnalyze(opts) {
|
|
|
178656
179197
|
if (opts.shell !== void 0 && isSiteShell(opts.shell)) {
|
|
178657
179198
|
try {
|
|
178658
179199
|
const kind = siteKindForOrigin(result.book.input.siteUrl);
|
|
178659
|
-
const book = kind === "base44" ? base44BookRoutes(
|
|
179200
|
+
const book = kind === "base44" ? base44BookRoutes(resolve64(cwd, ".himi/base44-book/book.json"), result.book.input.siteUrl) : void 0;
|
|
178660
179201
|
const routes = book?.routes;
|
|
178661
179202
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
178662
179203
|
const derived = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
178663
|
-
const prevOverlayPath =
|
|
178664
|
-
const prevSite =
|
|
179204
|
+
const prevOverlayPath = resolve64(outDir, "provisioning.overlay.json");
|
|
179205
|
+
const prevSite = existsSync81(prevOverlayPath) ? (() => {
|
|
178665
179206
|
try {
|
|
178666
|
-
return JSON.parse(
|
|
179207
|
+
return JSON.parse(readFileSync102(prevOverlayPath, "utf8")).site;
|
|
178667
179208
|
} catch {
|
|
178668
179209
|
return void 0;
|
|
178669
179210
|
}
|
|
@@ -178680,9 +179221,9 @@ async function runSiteAnalyze(opts) {
|
|
|
178680
179221
|
];
|
|
178681
179222
|
}
|
|
178682
179223
|
}
|
|
178683
|
-
const previousOverlay =
|
|
179224
|
+
const previousOverlay = resolve64(outDir, "provisioning.overlay.json");
|
|
178684
179225
|
carryOverGoals(
|
|
178685
|
-
|
|
179226
|
+
existsSync81(previousOverlay) ? readFileSync102(previousOverlay, "utf8") : void 0,
|
|
178686
179227
|
result.provisioningOverlay
|
|
178687
179228
|
);
|
|
178688
179229
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -178701,9 +179242,9 @@ async function runSiteAnalyze(opts) {
|
|
|
178701
179242
|
if (opts.apply) {
|
|
178702
179243
|
applied = await applyOverlays({
|
|
178703
179244
|
cwd,
|
|
178704
|
-
overlayPath:
|
|
178705
|
-
tokensPath:
|
|
178706
|
-
iconPath:
|
|
179245
|
+
overlayPath: resolve64(outDir, "provisioning.overlay.json"),
|
|
179246
|
+
tokensPath: resolve64(outDir, "tokens.overlay.json"),
|
|
179247
|
+
iconPath: resolve64(outDir, "media/icon.png"),
|
|
178707
179248
|
shell: opts.shell
|
|
178708
179249
|
});
|
|
178709
179250
|
const note = noteWithWarnings(applied.note, warnings);
|
|
@@ -178739,8 +179280,8 @@ async function runSiteFunctionCli(opts) {
|
|
|
178739
179280
|
const token = opts.token ?? await siteToken(msid);
|
|
178740
179281
|
let source;
|
|
178741
179282
|
if (opts.sourcePath) {
|
|
178742
|
-
const p2 =
|
|
178743
|
-
source =
|
|
179283
|
+
const p2 = resolve64(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
179284
|
+
source = readFileSync102(p2, "utf8");
|
|
178744
179285
|
}
|
|
178745
179286
|
let body;
|
|
178746
179287
|
if (opts.bodyRaw != null) {
|
|
@@ -178768,9 +179309,9 @@ async function runSiteFunctionCli(opts) {
|
|
|
178768
179309
|
});
|
|
178769
179310
|
}
|
|
178770
179311
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
178771
|
-
if (!
|
|
179312
|
+
if (!existsSync81(bookPath)) return void 0;
|
|
178772
179313
|
try {
|
|
178773
|
-
const book = JSON.parse(
|
|
179314
|
+
const book = JSON.parse(readFileSync102(bookPath, "utf8"));
|
|
178774
179315
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
178775
179316
|
const host = (u2) => {
|
|
178776
179317
|
try {
|
|
@@ -178819,7 +179360,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
178819
179360
|
cached2 = fromEnv;
|
|
178820
179361
|
return fromEnv;
|
|
178821
179362
|
}
|
|
178822
|
-
const token = await new Promise((
|
|
179363
|
+
const token = await new Promise((resolve66, reject) => {
|
|
178823
179364
|
let child;
|
|
178824
179365
|
try {
|
|
178825
179366
|
child = spawnImpl("wix", ["token"]);
|
|
@@ -178848,7 +179389,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
178848
179389
|
const scan = (d2) => {
|
|
178849
179390
|
out2 += String(d2);
|
|
178850
179391
|
const m2 = out2.match(TOKEN_RE2);
|
|
178851
|
-
if (m2) done(() =>
|
|
179392
|
+
if (m2) done(() => resolve66(m2[0]));
|
|
178852
179393
|
};
|
|
178853
179394
|
child.stdout?.on("data", scan);
|
|
178854
179395
|
child.stderr?.on("data", scan);
|
|
@@ -179025,7 +179566,7 @@ __export(site_create_exports, {
|
|
|
179025
179566
|
runSiteList: () => runSiteList,
|
|
179026
179567
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
179027
179568
|
});
|
|
179028
|
-
import { existsSync as
|
|
179569
|
+
import { existsSync as existsSync82, readFileSync as readFileSync103, writeFileSync as writeFileSync39 } from "node:fs";
|
|
179029
179570
|
import { resolve as resolvePath2 } from "node:path";
|
|
179030
179571
|
function oauthClientName(projectName) {
|
|
179031
179572
|
return `${projectName} client`;
|
|
@@ -179174,7 +179715,7 @@ async function runSiteCreate(opts) {
|
|
|
179174
179715
|
if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
|
|
179175
179716
|
return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
179176
179717
|
}
|
|
179177
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync:
|
|
179718
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync82, readFileSync: readFileSync103, writeFileSync: writeFileSync39 }) {
|
|
179178
179719
|
const msid = binding2.siteId;
|
|
179179
179720
|
const path2 = resolvePath2(target);
|
|
179180
179721
|
const committed = committedShellProvisioning(path2);
|
|
@@ -179871,12 +180412,12 @@ var init_context = __esm({
|
|
|
179871
180412
|
});
|
|
179872
180413
|
|
|
179873
180414
|
// src/cli.ts
|
|
179874
|
-
import { mkdtempSync as mkdtempSync6, readFileSync as
|
|
180415
|
+
import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync104, mkdirSync as mkdirSync42, writeFileSync as writeFileSync40, existsSync as existsSync83, rmSync as rmSync24, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync22, accessSync, constants as constants5, renameSync as renameSync13, cpSync as cpSync3 } from "node:fs";
|
|
179875
180416
|
import { execFile as execFile2, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
|
|
179876
180417
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
179877
180418
|
import { createHash as createHash45, randomUUID as randomUUID11 } from "node:crypto";
|
|
179878
180419
|
import { tmpdir as tmpdir7, homedir as homedir14, hostname as hostname2 } from "node:os";
|
|
179879
|
-
import { join as
|
|
180420
|
+
import { join as join88, resolve as resolve65, relative as relative16, basename as basename21, dirname as dirname49 } from "node:path";
|
|
179880
180421
|
import { fileURLToPath as fileURLToPath29 } from "node:url";
|
|
179881
180422
|
|
|
179882
180423
|
// ../serve-cli/src/client.ts
|
|
@@ -181193,7 +181734,7 @@ ${s2.fields.map((f2) => ` ${f2.key} (${f2.type})`).join("\n")}`
|
|
|
181193
181734
|
}
|
|
181194
181735
|
|
|
181195
181736
|
// src/data.ts
|
|
181196
|
-
|
|
181737
|
+
init_schema2();
|
|
181197
181738
|
import { createHash as createHash4 } from "node:crypto";
|
|
181198
181739
|
async function planData(options) {
|
|
181199
181740
|
const kv = [];
|
|
@@ -181273,8 +181814,8 @@ var HttpDataKvAdminProvider = class {
|
|
|
181273
181814
|
};
|
|
181274
181815
|
|
|
181275
181816
|
// src/cli.ts
|
|
181276
|
-
|
|
181277
|
-
|
|
181817
|
+
init_schema2();
|
|
181818
|
+
init_ownership2();
|
|
181278
181819
|
init_wix_owner();
|
|
181279
181820
|
init_brandable_shells();
|
|
181280
181821
|
init_splash();
|
|
@@ -181430,9 +181971,9 @@ function summarizeLint(app, bres, outcome, strict, extraIssues = []) {
|
|
|
181430
181971
|
}
|
|
181431
181972
|
|
|
181432
181973
|
// src/cms-lint.ts
|
|
181433
|
-
|
|
181974
|
+
init_schema2();
|
|
181434
181975
|
init_app_config_loader();
|
|
181435
|
-
|
|
181976
|
+
init_ownership2();
|
|
181436
181977
|
function bootsAsVisitor(auth) {
|
|
181437
181978
|
if (!auth) return false;
|
|
181438
181979
|
const flag = auth.config?.bootAsVisitor;
|
|
@@ -181962,8 +182503,8 @@ var str10 = (v2) => typeof v2 === "string" ? v2 : void 0;
|
|
|
181962
182503
|
var num3 = (v2) => typeof v2 === "string" && v2 !== "" && Number.isFinite(Number(v2)) ? Number(v2) : void 0;
|
|
181963
182504
|
function embeddedTemplateCatalog() {
|
|
181964
182505
|
return availableTemplates().map((name) => {
|
|
181965
|
-
const path2 =
|
|
181966
|
-
const meta = JSON.parse(
|
|
182506
|
+
const path2 = join88(templateSourceDir(name), TEMPLATE_META_FILE);
|
|
182507
|
+
const meta = JSON.parse(readFileSync104(path2, "utf8"));
|
|
181967
182508
|
if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
|
|
181968
182509
|
throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
|
|
181969
182510
|
}
|
|
@@ -182671,6 +183212,14 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
182671
183212
|
RLS + redacted samples (--sample, default 5), functions,
|
|
182672
183213
|
agents, connectors and secret NAMES. himi docs
|
|
182673
183214
|
base44-app-context.
|
|
183215
|
+
himi base44 adopt [--book <dir>] [--entities A,B] [--write [path]] [--json]
|
|
183216
|
+
turn an app book into a reviewable base44-entities.ts of
|
|
183217
|
+
ADOPTED entity + function declarations to wire into
|
|
183218
|
+
config.ts. Never edits config.ts, never overwrites a file.
|
|
183219
|
+
himi base44 entities query [--content <dir>] [--all] [--json]
|
|
183220
|
+
READ-ONLY: per declared entity, ownership, row count and
|
|
183221
|
+
schema drift against the live app, plus foreign entities.
|
|
183222
|
+
Needs a session. himi docs base44-entities.
|
|
182674
183223
|
himi base44 login [--from-base44-cli] | whoami | logout
|
|
182675
183224
|
the Base44 session, in ~/.himi/base44/ (never the repo).
|
|
182676
183225
|
BASE44_ACCESS_TOKEN wins, for CI.
|
|
@@ -182818,7 +183367,7 @@ var COMMANDS2 = [
|
|
|
182818
183367
|
{ name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files; `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
|
|
182819
183368
|
{ name: "signing", summary: "READ-ONLY App Store Connect inventory for customer BYO TestFlight readiness. `inspect` lists whether the bundle id, distribution certificate, IOS_APP_STORE profile, and ASC app record exist for --bundle-id / --team-id using a local ASC .p8 (flags or ASC_KEY_* env). Never uploads or mutates Apple resources. Optional --cert-file/--profile-file classify on-disk material.", required: "inspect --bundle-id <id> --team-id <id> --asc-key-file <path> --asc-key-id <id> --asc-issuer-id <id> [--cert-file <p12> --cert-password <pw> --profile-file <mobileprovision>] [--json]" },
|
|
182820
183369
|
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (`wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. `--shell brandy` (the site shell, RFC 0062) also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
182821
|
-
{ name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | login [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
|
|
183370
|
+
{ name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context. `adopt` turns the book into a reviewable base44-entities.ts of ADOPTED entity + function declarations for config.ts (never edits config.ts, never overwrites); `entities query` is READ-ONLY and reports, per declared entity, ownership, row count and schema drift against the live app, plus foreign entities. himi docs base44-entities", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | entities query [--content <dir>] [--all] [--json] | login [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
|
|
182822
183371
|
{ name: "doctor", summary: 'off-VPN preflight in one shot: probe the PUBLIC data plane (www.wixapis.com \u2014 reachable off-VPN), the INTERNAL serve/control plane for the selected target (VPN-gated), and report auth state (dpx session on disk + stored control token). --dpx additionally runs a live, EADDRINUSE-safe `dpx whoami`. Machine-readable with --json (an unreachable internal plane carries a stable code:"needs_vpn" so an agent branches on the code, not the prose); human-readable otherwise. Never loads the authoring runtime \u2014 works off-repo.', required: "[--target <t>] [--dpx] [--json] [--data-url <url>] [--timeout <ms>]" },
|
|
182823
183372
|
{ name: "upgrade", summary: "install the newest published CLI (`npm i -g @wix/himalaya-cli@latest`) and report what moved. This is the explicit door: himi also updates itself when the running build is more than a week old \u2014 unattended it just does it and re-runs your command, at a terminal it asks first \u2014 and `HIMI_NO_UPDATE_CHECK=1` turns that off, leaving this command as the way to catch up. Reports `unchanged` rather than claiming success when npm exits 0 without moving the version, which is what a registry mirror serving its own pinned copy looks like.", required: "[--json]" },
|
|
182824
183373
|
{ name: "push", summary: "lint + build + publish a release (default --draft: servable via ?release= but NOT live). REFUSES to publish on any error unless --force; --strict promotes warnings. Prints preview + agent-context links. A successful draft push also rebuilds the making-of (.himi/making-of.html, local and offline) and names it as `reel` \u2014 the file to hand the owner beside the preview link. Its postcard carries the home shot only when that shot is newer than the last source edit; a repeat draft's postcard adds what changed since the last one (\"Since the last draft: the home screen changed.\", from the release manifests' screen hashes, remembered in .himi/last-draft.json); otherwise the postcard says why and names `himi render <home> --png`, and the envelope's `postcardPicture: {skipped, render}` leads next[] with that render (the push never renders it itself). The published slug is NAMESPACED per owner \u2014 `<ownerPrefix>.<name>`, composed offline from the control token's ownerPrefix claim, so the CLI and the server derive the identical string and himalaya.content.json is NOT rewritten (a legacy token with no ownerPrefix publishes the declared name unchanged). An app claimed BEFORE namespacing is stored under its FLAT slug, so the claim route answers `alreadyYours` naming that slug and the push adopts it \u2014 reported as `adoptedSlug`, since it is the one case where the published `app` differs from what the declared name composes to. `--no-claim` skips the route that knows this, so a pre-namespacing app pushed with it still fails 403. --visibility public|unlisted decides whether /v1/apps + the Himi Player picker LIST the app (also declarable as `visibility` in himalaya.content.json; omitted, a brand-new app defaults to unlisted \u2014 share by link \u2014 and an existing setting is kept). --account-id names which account owns the app when your Wix session resolves to several (the auto-claim of a brand-new slug cannot guess \u2014 without it a multi-account caller is told to name one). An unforced push of a release that carries SCREENS also refuses when `.himi/ux-audit.json` holds no mobile-UX drive recorded against that release id, or holds one that FAILED (#2955) \u2014 a published draft IS the owner-private preview a customer is handed; `himi ux record` clears it and `--force` overrides it, which the success envelope then says out loud. `--only <selector>` publishes ONLY the named items as a release derived from the app's live release (or `--from-release <id>`), running the identical build + lint gate and simply publishing less; it requires an explicit `--draft` or `--live` because a partial publish has no safe default, never claims a slug, and carries neither attestation nor a source archive (both named in the output). Selectors are comma-separated in ONE `--only`: `changed` (every item whose bytes differ from the base), `screen:<id|glob>`, `bundle:<name>`, `tokens`, `app-config` \u2014 a selected screen drags its logic bundle and a selected bundle drags the screens that reference it, or the bytes land under a key nothing reads. The plane REFUSES (409 binary_capability_gap) a release declaring a PERMISSION-BEARING capability (iOS usage string or entitlement, Android permission \u2014 camera, location, push, \u2026) that the app's last successful `himi dist` was not built with: an OTA push cannot add an OS permission, and on iOS asking for one whose purpose string is missing kills the app. Run `himi dist` first, or pass `--allow-binary-gap` when every installed binary already carries it \u2014 recorded on the release as `allowedBinaryGap`. A gap in a permission-free capability (share, clipboard, \u2026) stays the `needsBinary` advice.", required: "[--content <dir>] [--draft] [--live] [--force] [--strict] [--label] [--notes] [--visibility public|unlisted] [--allow-binary-gap] [--no-claim] [--account-id <id>] [--only <selector>] [--from-release <id>] [--accept-regressions] [--accept-partial] [--app <slug>] (--control-token)" },
|
|
@@ -182860,7 +183409,7 @@ var COMMANDS2 = [
|
|
|
182860
183409
|
];
|
|
182861
183410
|
function cliVersion() {
|
|
182862
183411
|
try {
|
|
182863
|
-
return JSON.parse(
|
|
183412
|
+
return JSON.parse(readFileSync104(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
|
|
182864
183413
|
} catch {
|
|
182865
183414
|
return "unknown";
|
|
182866
183415
|
}
|
|
@@ -182911,18 +183460,18 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
|
|
|
182911
183460
|
}
|
|
182912
183461
|
var SCOPED_REGISTRY_TIMEOUT_MS = 5e3;
|
|
182913
183462
|
function execNpmConfig(file2, args, options) {
|
|
182914
|
-
return new Promise((
|
|
182915
|
-
execFile2(file2, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) :
|
|
183463
|
+
return new Promise((resolve66, reject) => {
|
|
183464
|
+
execFile2(file2, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve66(String(stdout)));
|
|
182916
183465
|
});
|
|
182917
183466
|
}
|
|
182918
183467
|
var npmScopedWixRegistry = createScopedRegistryResolver();
|
|
182919
183468
|
async function scopedRegistryBefore(lookup3, deadline, onTimeout) {
|
|
182920
183469
|
let cancel = () => {
|
|
182921
183470
|
};
|
|
182922
|
-
const expired = new Promise((
|
|
183471
|
+
const expired = new Promise((resolve66) => {
|
|
182923
183472
|
const timer = setTimeout(() => {
|
|
182924
183473
|
onTimeout?.();
|
|
182925
|
-
|
|
183474
|
+
resolve66(void 0);
|
|
182926
183475
|
}, Math.max(0, deadline - Date.now()));
|
|
182927
183476
|
cancel = () => clearTimeout(timer);
|
|
182928
183477
|
});
|
|
@@ -182985,16 +183534,16 @@ function ageInDays(publishedAt, now = Date.now()) {
|
|
|
182985
183534
|
}
|
|
182986
183535
|
function packageVersion(path2) {
|
|
182987
183536
|
try {
|
|
182988
|
-
const version4 = JSON.parse(
|
|
183537
|
+
const version4 = JSON.parse(readFileSync104(path2, "utf8")).version;
|
|
182989
183538
|
return typeof version4 === "string" && version4 ? version4 : void 0;
|
|
182990
183539
|
} catch {
|
|
182991
183540
|
return void 0;
|
|
182992
183541
|
}
|
|
182993
183542
|
}
|
|
182994
183543
|
function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("./authoring-runtime/node_modules/@wix/himalaya/package.json", import.meta.url)) {
|
|
182995
|
-
let dir =
|
|
183544
|
+
let dir = resolve65(fromDir);
|
|
182996
183545
|
for (; ; ) {
|
|
182997
|
-
const version4 = packageVersion(
|
|
183546
|
+
const version4 = packageVersion(join88(dir, "node_modules", "@wix", "himalaya", "package.json"));
|
|
182998
183547
|
if (version4) return { version: version4, source: "local" };
|
|
182999
183548
|
const parent = dirname49(dir);
|
|
183000
183549
|
if (parent === dir) break;
|
|
@@ -183004,7 +183553,7 @@ function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("
|
|
|
183004
183553
|
if (bundled) return { version: bundled, source: "bundled" };
|
|
183005
183554
|
try {
|
|
183006
183555
|
const root = execFileSync7("npm", ["root", "-g"], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
|
|
183007
|
-
const version4 = root ? packageVersion(
|
|
183556
|
+
const version4 = root ? packageVersion(join88(root, "@wix", "himalaya", "package.json")) : void 0;
|
|
183008
183557
|
return version4 ? { version: version4, source: "global" } : {};
|
|
183009
183558
|
} catch {
|
|
183010
183559
|
return {};
|
|
@@ -183051,11 +183600,11 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
|
|
|
183051
183600
|
var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
|
|
183052
183601
|
var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
|
|
183053
183602
|
function updateCachePath(env = process.env) {
|
|
183054
|
-
return env.HIMI_UPDATE_CACHE_FILE ??
|
|
183603
|
+
return env.HIMI_UPDATE_CACHE_FILE ?? join88(homedir14(), ".himalaya", "update-check.json");
|
|
183055
183604
|
}
|
|
183056
183605
|
function readUpdateCache(path2) {
|
|
183057
183606
|
try {
|
|
183058
|
-
const parsed = JSON.parse(
|
|
183607
|
+
const parsed = JSON.parse(readFileSync104(path2, "utf8"));
|
|
183059
183608
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
183060
183609
|
} catch {
|
|
183061
183610
|
return {};
|
|
@@ -183064,7 +183613,7 @@ function readUpdateCache(path2) {
|
|
|
183064
183613
|
function writeUpdateCache(path2, cache) {
|
|
183065
183614
|
try {
|
|
183066
183615
|
mkdirSync42(dirname49(path2), { recursive: true, mode: 448 });
|
|
183067
|
-
|
|
183616
|
+
writeFileSync40(path2, JSON.stringify(cache, null, 2) + "\n", { mode: 384 });
|
|
183068
183617
|
} catch {
|
|
183069
183618
|
}
|
|
183070
183619
|
}
|
|
@@ -183124,12 +183673,12 @@ function createUpdateRunner(spawn8 = spawnSync5) {
|
|
|
183124
183673
|
},
|
|
183125
183674
|
installedVersion: () => {
|
|
183126
183675
|
const root = globalNodeModulesRoot();
|
|
183127
|
-
return root ? packageVersion(
|
|
183676
|
+
return root ? packageVersion(join88(root, "@wix", "himalaya-cli", "package.json")) : void 0;
|
|
183128
183677
|
},
|
|
183129
183678
|
reexec: (argv) => {
|
|
183130
183679
|
const root = globalNodeModulesRoot();
|
|
183131
|
-
const entry = root ?
|
|
183132
|
-
if (!entry || !
|
|
183680
|
+
const entry = root ? join88(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
|
|
183681
|
+
if (!entry || !existsSync83(entry)) return void 0;
|
|
183133
183682
|
const result = spawnSync5(process.execPath, [entry, ...argv], {
|
|
183134
183683
|
// inherit keeps PIPED STDIN working — commands that read stdin must survive a re-exec.
|
|
183135
183684
|
stdio: "inherit",
|
|
@@ -183176,7 +183725,7 @@ function staleUpdateLockFile(cachePath, now) {
|
|
|
183176
183725
|
for (const path2 of [`${cachePath}.lock.break`, `${cachePath}.lock`]) {
|
|
183177
183726
|
let content;
|
|
183178
183727
|
try {
|
|
183179
|
-
content =
|
|
183728
|
+
content = readFileSync104(path2, "utf8");
|
|
183180
183729
|
} catch {
|
|
183181
183730
|
continue;
|
|
183182
183731
|
}
|
|
@@ -183199,14 +183748,14 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
|
|
|
183199
183748
|
const mine = lockStamp(now);
|
|
183200
183749
|
const readLock = (path2) => {
|
|
183201
183750
|
try {
|
|
183202
|
-
return
|
|
183751
|
+
return readFileSync104(path2, "utf8");
|
|
183203
183752
|
} catch {
|
|
183204
183753
|
return void 0;
|
|
183205
183754
|
}
|
|
183206
183755
|
};
|
|
183207
183756
|
const tryCreate = (path2) => {
|
|
183208
183757
|
try {
|
|
183209
|
-
|
|
183758
|
+
writeFileSync40(path2, mine, { flag: "wx", mode: 384 });
|
|
183210
183759
|
return true;
|
|
183211
183760
|
} catch {
|
|
183212
183761
|
return false;
|
|
@@ -183333,7 +183882,7 @@ function createTrimValidator(deps = {}, spawnFn = spawn7) {
|
|
|
183333
183882
|
return { code, counts, ...errors ? { errors } : {}, ...code !== 0 ? { tail: said.slice(-4e3) } : {} };
|
|
183334
183883
|
};
|
|
183335
183884
|
return async (dir, opts = {}) => {
|
|
183336
|
-
const argv = ["validate", "--content",
|
|
183885
|
+
const argv = ["validate", "--content", resolve65(dir), "--strict", "--skip-version-check"];
|
|
183337
183886
|
if (!opts.fresh) {
|
|
183338
183887
|
const out2 = [];
|
|
183339
183888
|
const err = [];
|
|
@@ -183791,7 +184340,7 @@ function executableOnPath(name, env = process.env) {
|
|
|
183791
184340
|
const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
183792
184341
|
for (const dir of entries) {
|
|
183793
184342
|
for (const suffix of suffixes) {
|
|
183794
|
-
const candidate =
|
|
184343
|
+
const candidate = join88(dir, `${name}${suffix}`);
|
|
183795
184344
|
try {
|
|
183796
184345
|
if (!statSync23(candidate).isFile()) continue;
|
|
183797
184346
|
if (process.platform !== "win32") accessSync(candidate, constants5.X_OK);
|
|
@@ -183900,7 +184449,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
183900
184449
|
const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths2(), paths_exports));
|
|
183901
184450
|
const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
|
|
183902
184451
|
const iosYmlPath = iosProjectYml2(app);
|
|
183903
|
-
const iosYml =
|
|
184452
|
+
const iosYml = existsSync83(iosYmlPath) ? readFileSync104(iosYmlPath, "utf8") : "";
|
|
183904
184453
|
let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
|
|
183905
184454
|
if (!optedIn) {
|
|
183906
184455
|
const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
|
|
@@ -183914,14 +184463,14 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
183914
184463
|
}
|
|
183915
184464
|
function readConfigSource(dir) {
|
|
183916
184465
|
try {
|
|
183917
|
-
return
|
|
184466
|
+
return readFileSync104(join88(dir, "config.ts"), "utf8");
|
|
183918
184467
|
} catch {
|
|
183919
184468
|
return null;
|
|
183920
184469
|
}
|
|
183921
184470
|
}
|
|
183922
184471
|
function writePngFile(path2, base64) {
|
|
183923
184472
|
mkdirSync42(dirname49(path2), { recursive: true });
|
|
183924
|
-
|
|
184473
|
+
writeFileSync40(path2, Buffer.from(base64, "base64"));
|
|
183925
184474
|
return path2;
|
|
183926
184475
|
}
|
|
183927
184476
|
async function seedAgentFilesFor(dir, flags, mode = "init") {
|
|
@@ -183967,8 +184516,8 @@ function keptPlan(kept) {
|
|
|
183967
184516
|
var NoBase44SlotError = class extends Error {
|
|
183968
184517
|
};
|
|
183969
184518
|
async function initFromRemoteTemplate(name, parentDir, template, c2, opts = {}) {
|
|
183970
|
-
const dir =
|
|
183971
|
-
if (
|
|
184519
|
+
const dir = resolve65(parentDir, name);
|
|
184520
|
+
if (existsSync83(join88(dir, "himalaya.content.json"))) {
|
|
183972
184521
|
throw new Error(`content package already exists at ${dir}`);
|
|
183973
184522
|
}
|
|
183974
184523
|
const r2 = await c2.fetchTemplateSource(TEMPLATE_APP_PREFIX + template);
|
|
@@ -183983,7 +184532,7 @@ async function initFromRemoteTemplate(name, parentDir, template, c2, opts = {})
|
|
|
183983
184532
|
return finishScaffold(materializeSource(archive.files, name, dir), template);
|
|
183984
184533
|
}
|
|
183985
184534
|
function contentDir(flags) {
|
|
183986
|
-
return
|
|
184535
|
+
return resolve65(str10(flags.content) ?? process.cwd());
|
|
183987
184536
|
}
|
|
183988
184537
|
function renameRestoredSource(restored, declaredApp, renamed) {
|
|
183989
184538
|
const text9 = {};
|
|
@@ -184014,7 +184563,7 @@ function symlinkDestinationIssue(dest) {
|
|
|
184014
184563
|
function restoreDestinationIssue(dest, force) {
|
|
184015
184564
|
const link = symlinkDestinationIssue(dest);
|
|
184016
184565
|
if (link) return link;
|
|
184017
|
-
if (!
|
|
184566
|
+
if (!existsSync83(dest)) return null;
|
|
184018
184567
|
if (!statSync23(dest).isDirectory()) {
|
|
184019
184568
|
return { error: `${dest} exists and is not a directory`, hint: "pass --out/--name to land somewhere else, or remove the file" };
|
|
184020
184569
|
}
|
|
@@ -184027,9 +184576,9 @@ function restoreDestinationIssue(dest, force) {
|
|
|
184027
184576
|
return null;
|
|
184028
184577
|
}
|
|
184029
184578
|
function isHimalayaMonorepoCheckout(start) {
|
|
184030
|
-
let dir =
|
|
184579
|
+
let dir = resolve65(start);
|
|
184031
184580
|
for (; ; ) {
|
|
184032
|
-
if (
|
|
184581
|
+
if (existsSync83(join88(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync83(join88(dir, "core", "serve", "src", "server.ts"))) return true;
|
|
184033
184582
|
const parent = dirname49(dir);
|
|
184034
184583
|
if (parent === dir) return false;
|
|
184035
184584
|
dir = parent;
|
|
@@ -184089,8 +184638,8 @@ function materializeForPreview(appDir3, slug, displayName2) {
|
|
|
184089
184638
|
const forBuild = Object.fromEntries(
|
|
184090
184639
|
Object.entries(files).map(([rel, body]) => [rel, rel === "himalaya.content.json" ? substituteIdentity(body, slug) : body])
|
|
184091
184640
|
);
|
|
184092
|
-
const repoRoot2 =
|
|
184093
|
-
const root =
|
|
184641
|
+
const repoRoot2 = resolve65(fileURLToPath29(new URL("../../..", import.meta.url)));
|
|
184642
|
+
const root = join88(repoRoot2, "node_modules", ".cache", "himi-template-preview");
|
|
184094
184643
|
const stillRunning = (pid) => {
|
|
184095
184644
|
try {
|
|
184096
184645
|
process.kill(pid, 0);
|
|
@@ -184104,12 +184653,12 @@ function materializeForPreview(appDir3, slug, displayName2) {
|
|
|
184104
184653
|
if (!entry.isDirectory()) continue;
|
|
184105
184654
|
const pid = Number(entry.name.startsWith(`${slug}-`) ? entry.name.slice(slug.length + 1) : NaN);
|
|
184106
184655
|
if (Number.isInteger(pid) && pid > 0 && pid !== process.pid && !stillRunning(pid)) {
|
|
184107
|
-
rmSync24(
|
|
184656
|
+
rmSync24(join88(root, entry.name), { recursive: true, force: true });
|
|
184108
184657
|
}
|
|
184109
184658
|
}
|
|
184110
184659
|
} catch {
|
|
184111
184660
|
}
|
|
184112
|
-
const dest =
|
|
184661
|
+
const dest = join88(root, `${slug}-${process.pid}`);
|
|
184113
184662
|
rmSync24(dest, { recursive: true, force: true });
|
|
184114
184663
|
mkdirSync42(dest, { recursive: true });
|
|
184115
184664
|
try {
|
|
@@ -184122,8 +184671,8 @@ function materializeForPreview(appDir3, slug, displayName2) {
|
|
|
184122
184671
|
}
|
|
184123
184672
|
async function appId(dir) {
|
|
184124
184673
|
try {
|
|
184125
|
-
const { readFileSync:
|
|
184126
|
-
const m2 = JSON.parse(
|
|
184674
|
+
const { readFileSync: readFileSync105 } = await import("node:fs");
|
|
184675
|
+
const m2 = JSON.parse(readFileSync105(join88(dir, "himalaya.content.json"), "utf8"));
|
|
184127
184676
|
if (m2.name) return m2.name;
|
|
184128
184677
|
} catch {
|
|
184129
184678
|
}
|
|
@@ -184131,8 +184680,8 @@ async function appId(dir) {
|
|
|
184131
184680
|
}
|
|
184132
184681
|
async function contentVisibility(dir) {
|
|
184133
184682
|
try {
|
|
184134
|
-
const { readFileSync:
|
|
184135
|
-
const m2 = JSON.parse(
|
|
184683
|
+
const { readFileSync: readFileSync105 } = await import("node:fs");
|
|
184684
|
+
const m2 = JSON.parse(readFileSync105(join88(dir, "himalaya.content.json"), "utf8"));
|
|
184136
184685
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
184137
184686
|
} catch {
|
|
184138
184687
|
}
|
|
@@ -184315,8 +184864,8 @@ Guides in your browser: ${idx.portalUrl}`);
|
|
|
184315
184864
|
const sdks = loadSdkReference();
|
|
184316
184865
|
const arg = pos[1];
|
|
184317
184866
|
if (arg) {
|
|
184318
|
-
const
|
|
184319
|
-
const want =
|
|
184867
|
+
const canonical5 = arg.replace(/^@wix\/himalaya\//, "@himalaya/");
|
|
184868
|
+
const want = canonical5.startsWith("@himalaya/") ? canonical5 : `@himalaya/${canonical5}`;
|
|
184320
184869
|
const s2 = sdks.find((x2) => x2.name === want || x2.name === arg);
|
|
184321
184870
|
if (!s2) {
|
|
184322
184871
|
io2.error(JSON.stringify({ error: `unknown sdk: ${arg}`, sdks: sdks.map((x2) => x2.name) }));
|
|
@@ -184402,7 +184951,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
184402
184951
|
return 0;
|
|
184403
184952
|
}
|
|
184404
184953
|
case "agent-init": {
|
|
184405
|
-
const dir =
|
|
184954
|
+
const dir = resolve65(str10(flags.dir) ?? process.cwd());
|
|
184406
184955
|
const { seedAgentFiles: seedAgentFiles2, NotAContentPackage: NotAContentPackage2 } = await Promise.resolve().then(() => (init_agent_context(), agent_context_exports));
|
|
184407
184956
|
let res;
|
|
184408
184957
|
try {
|
|
@@ -184424,7 +184973,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
184424
184973
|
...res.removed.length ? { removed: res.removed, note: "older copies at the app root, moved to .himi/legacy-agent-files/ (a backup, in case one became app code) \u2014 the current ones live in .agents/skills/himalaya/" } : {},
|
|
184425
184974
|
// In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
|
|
184426
184975
|
// hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
|
|
184427
|
-
...
|
|
184976
|
+
...existsSync83(join88(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
|
|
184428
184977
|
...res.skipped.length ? { skipped: res.skipped } : {},
|
|
184429
184978
|
portalUrl: idx.portalUrl
|
|
184430
184979
|
});
|
|
@@ -184447,7 +184996,7 @@ async function recordedReleaseForContentQuietly(dir, resolution, onDrift) {
|
|
|
184447
184996
|
try {
|
|
184448
184997
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
184449
184998
|
const bres = await buildContentForValidation2(dir, { resolution });
|
|
184450
|
-
out2 = mkdtempSync6(
|
|
184999
|
+
out2 = mkdtempSync6(join88(tmpdir7(), "himi-ux-record-"));
|
|
184451
185000
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
184452
185001
|
const outcome = await buildReleaseFromContent2(dir, out2, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, collect: { lint: true } });
|
|
184453
185002
|
const releaseId = outcome.manifest.releaseId;
|
|
@@ -184626,7 +185175,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
184626
185175
|
let js2;
|
|
184627
185176
|
for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
|
|
184628
185177
|
try {
|
|
184629
|
-
js2 =
|
|
185178
|
+
js2 = readFileSync104(join88(outDir, candidate), "utf8");
|
|
184630
185179
|
break;
|
|
184631
185180
|
} catch {
|
|
184632
185181
|
}
|
|
@@ -184657,7 +185206,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
184657
185206
|
}
|
|
184658
185207
|
return { families, source: "dist/bundles" };
|
|
184659
185208
|
}
|
|
184660
|
-
var boardOpen = (dir) =>
|
|
185209
|
+
var boardOpen = (dir) => existsSync83(join88(dir, ".himi", "studio", "index.html"));
|
|
184661
185210
|
var BOARD_REFRESHERS = /* @__PURE__ */ new Set(["render", "test", "validate", "build", "push", "icon", "site", "ux", "progress"]);
|
|
184662
185211
|
async function leaveForBoard(dir, record2, value) {
|
|
184663
185212
|
if (!boardOpen(dir)) return;
|
|
@@ -184681,7 +185230,7 @@ async function liveMapFor(dir) {
|
|
|
184681
185230
|
}
|
|
184682
185231
|
var commandScratch = new AsyncLocalStorage2();
|
|
184683
185232
|
function commandScratchDir(prefix) {
|
|
184684
|
-
const dir = mkdtempSync6(
|
|
185233
|
+
const dir = mkdtempSync6(join88(tmpdir7(), prefix));
|
|
184685
185234
|
commandScratch.getStore()?.push(dir);
|
|
184686
185235
|
return dir;
|
|
184687
185236
|
}
|
|
@@ -184992,7 +185541,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
184992
185541
|
return 2;
|
|
184993
185542
|
}
|
|
184994
185543
|
const template = str10(flags.template);
|
|
184995
|
-
const parentDir =
|
|
185544
|
+
const parentDir = resolve65(str10(flags.dir) ?? process.cwd());
|
|
184996
185545
|
const base44AppId = flags["base44-app-id"] === void 0 ? void 0 : String(flags["base44-app-id"]);
|
|
184997
185546
|
const base44AppUrl = flags["base44-app-url"] === void 0 ? void 0 : String(flags["base44-app-url"]);
|
|
184998
185547
|
if (base44AppUrl !== void 0) {
|
|
@@ -185035,7 +185584,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
185035
185584
|
const owed = openApprovals2(readApprovals2(dir).events).length;
|
|
185036
185585
|
next.push(`carried the planning journal into the app (${carried.join(", ")}${owed ? `; ${owed} approval${owed === 1 ? "" : "s"} still owed` : ""}) \u2014 \`himi progress --brief\` there shows it`);
|
|
185037
185586
|
}
|
|
185038
|
-
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) =>
|
|
185587
|
+
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) => existsSync83(join88(parentDir, f2)));
|
|
185039
185588
|
if (planInParent.length) {
|
|
185040
185589
|
next.push(`${planInParent.join(" and ")} in ${parentDir} ${planInParent.length > 1 ? "are" : "is"} not the app's \u2014 if that is the approved plan, move it over the template's boilerplate in ${dir}`);
|
|
185041
185590
|
}
|
|
@@ -185196,13 +185745,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185196
185745
|
if (adding) {
|
|
185197
185746
|
const from = str10(flags.from);
|
|
185198
185747
|
if (!from) throw new TrimRefusal2('--add <id> needs --from <file> holding the whole new SCREENS entry (` "<id>": { "screenId": "<id>", \u2026 },`)');
|
|
185199
|
-
print(adopt.addScreen(dir, adding,
|
|
185748
|
+
print(adopt.addScreen(dir, adding, readFileSync104(from, "utf8"), { parent: str10(flags.parent), tab: str10(flags.tab), displayName: str10(flags["display-name"]) }));
|
|
185200
185749
|
return 0;
|
|
185201
185750
|
}
|
|
185202
185751
|
if (target) {
|
|
185203
185752
|
const from = str10(flags.from);
|
|
185204
185753
|
if (!from) throw new TrimRefusal2("--write <id> needs --from <file> holding the whole entry, as --show prints it");
|
|
185205
|
-
print(adopt.replaceScreen(dir, target,
|
|
185754
|
+
print(adopt.replaceScreen(dir, target, readFileSync104(from, "utf8")));
|
|
185206
185755
|
return 0;
|
|
185207
185756
|
}
|
|
185208
185757
|
if (show) {
|
|
@@ -185284,7 +185833,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185284
185833
|
const { keepFromSpec: keepFromSpec2 } = await Promise.resolve().then(() => (init_template_adopt(), template_adopt_exports));
|
|
185285
185834
|
const dir = contentDir(flags);
|
|
185286
185835
|
try {
|
|
185287
|
-
const spec = keepFromSpec2(dir, str10(flags["from-spec"]) ??
|
|
185836
|
+
const spec = keepFromSpec2(dir, str10(flags["from-spec"]) ?? join88(dir, "SPEC.md"));
|
|
185288
185837
|
const own5 = typeof keep === "string" ? keep.split(",").map((k2) => k2.trim()).filter(Boolean) : [];
|
|
185289
185838
|
keep = [.../* @__PURE__ */ new Set([...spec.keep, ...own5])].join(",");
|
|
185290
185839
|
fromSpec = { fromSpec: {
|
|
@@ -185325,7 +185874,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185325
185874
|
const result = { ...outcome.result, ...fromSpec };
|
|
185326
185875
|
const adoptDir = contentDir(flags);
|
|
185327
185876
|
const kept = flags["dry-run"] !== true && (outcome.code === 0 || outcome.result.forcedKeep === true);
|
|
185328
|
-
if (kept &&
|
|
185877
|
+
if (kept && existsSync83(join88(adoptDir, adoptBits.ADOPT_FILE))) {
|
|
185329
185878
|
try {
|
|
185330
185879
|
const inv = adoptBits.inspectApp(adoptDir);
|
|
185331
185880
|
adoptBits.writeInventory(adoptDir, inv, { companions: "if-missing" });
|
|
@@ -185350,11 +185899,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185350
185899
|
return 2;
|
|
185351
185900
|
}
|
|
185352
185901
|
}
|
|
185353
|
-
const appDir3 =
|
|
185354
|
-
const sourceDir =
|
|
185902
|
+
const appDir3 = resolve65(str10(flags.dir) ?? process.cwd());
|
|
185903
|
+
const sourceDir = resolve65(str10(flags["source-dir"]) ?? appDir3);
|
|
185355
185904
|
let meta;
|
|
185356
185905
|
try {
|
|
185357
|
-
meta = JSON.parse(
|
|
185906
|
+
meta = JSON.parse(readFileSync104(join88(sourceDir, TEMPLATE_META_FILE), "utf8"));
|
|
185358
185907
|
} catch {
|
|
185359
185908
|
io2.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
|
|
185360
185909
|
return 2;
|
|
@@ -185364,7 +185913,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185364
185913
|
return 2;
|
|
185365
185914
|
}
|
|
185366
185915
|
try {
|
|
185367
|
-
const appearance = extractTemplateAppearance(JSON.parse(
|
|
185916
|
+
const appearance = extractTemplateAppearance(JSON.parse(readFileSync104(join88(sourceDir, "tokens.json"), "utf8")));
|
|
185368
185917
|
meta = { ...appearance, ...meta };
|
|
185369
185918
|
} catch {
|
|
185370
185919
|
}
|
|
@@ -185386,14 +185935,14 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185386
185935
|
const force = flags.force === true;
|
|
185387
185936
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
185388
185937
|
const bres = await buildContentForValidation2(buildDir, { resolution: resolutionFlag(flags) });
|
|
185389
|
-
const out2 = mkdtempSync6(
|
|
185938
|
+
const out2 = mkdtempSync6(join88(tmpdir7(), "himi-template-"));
|
|
185390
185939
|
publishScratch.push(out2);
|
|
185391
185940
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
185392
185941
|
const outcome = await buildReleaseFromContent2(buildDir, out2, {
|
|
185393
185942
|
...hasWorkers ? { tier5Dir: bundleOutDir2(buildDir) } : {},
|
|
185394
185943
|
collect: { lint: true, strict }
|
|
185395
185944
|
});
|
|
185396
|
-
const scaffoldSourceFindings =
|
|
185945
|
+
const scaffoldSourceFindings = resolve65(sourceDir) === resolve65(appDir3) ? [] : [
|
|
185397
185946
|
...(await Promise.resolve().then(() => (init_capabilities(), capabilities_exports))).capabilityConfigFindings(sourceDir, buildDir),
|
|
185398
185947
|
...tokenColorIssues(sourceDir),
|
|
185399
185948
|
...surfaceIssues(sourceDir, void 0, strict),
|
|
@@ -185410,6 +185959,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185410
185959
|
const { report: report3, hasErrors } = summarizeLint(app, bres, outcome, strict, [
|
|
185411
185960
|
...capabilityIssues2(outcome.capabilityUsage, contentShell2(buildDir, str10(flags.shell)), strict, readLastDist2(buildDir)),
|
|
185412
185961
|
...await cmsIssues(buildDir, app, strict, { local: true }),
|
|
185962
|
+
...await (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44Issues(buildDir, app, strict, { local: true }),
|
|
185413
185963
|
...surfaceIssues(buildDir, outcome.surfaceNav, strict),
|
|
185414
185964
|
...tokenColorIssues(buildDir),
|
|
185415
185965
|
...await fontIssues(buildDir, strict),
|
|
@@ -185443,11 +185993,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185443
185993
|
}));
|
|
185444
185994
|
return 1;
|
|
185445
185995
|
}
|
|
185446
|
-
const iconPath = str10(flags.icon) ?
|
|
185996
|
+
const iconPath = str10(flags.icon) ? resolve65(str10(flags.icon)) : templateIconPath(name);
|
|
185447
185997
|
let iconHash;
|
|
185448
185998
|
if (iconPath) {
|
|
185449
185999
|
try {
|
|
185450
|
-
const bytes2 =
|
|
186000
|
+
const bytes2 = readFileSync104(iconPath);
|
|
185451
186001
|
payload.icon = bytes2.toString("base64");
|
|
185452
186002
|
iconHash = createHash45("sha256").update(bytes2).digest("hex");
|
|
185453
186003
|
} catch {
|
|
@@ -185706,6 +186256,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185706
186256
|
const { report: report3, hasErrors } = summarizeLint(app, bres, outcome, strict, [
|
|
185707
186257
|
...capabilityIssues2(outcome.capabilityUsage, contentShell2(dir, str10(flags.shell)), strict, readLastDist2(dir)),
|
|
185708
186258
|
...await cmsIssues(dir, app, strict, { local: true }),
|
|
186259
|
+
...await (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44Issues(dir, app, strict, { local: true }),
|
|
185709
186260
|
...surfaceIssues(dir, outcome.surfaceNav, strict),
|
|
185710
186261
|
...tokenColorIssues(dir),
|
|
185711
186262
|
...await iconIssues(dir, strict),
|
|
@@ -185751,7 +186302,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185751
186302
|
const path2 = dpxSessionTokenPath();
|
|
185752
186303
|
let raw;
|
|
185753
186304
|
try {
|
|
185754
|
-
raw =
|
|
186305
|
+
raw = readFileSync104(path2, "utf8");
|
|
185755
186306
|
} catch {
|
|
185756
186307
|
throw new Error(`no DPX BO session at ${path2}; run dpx auth login, write dpx auth token to that path, then himi login --dpx --target bo`);
|
|
185757
186308
|
}
|
|
@@ -185882,11 +186433,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185882
186433
|
return 1;
|
|
185883
186434
|
}
|
|
185884
186435
|
const { himiPluginFiles: himiPluginFiles2 } = await Promise.resolve().then(() => (init_claude_plugin(), claude_plugin_exports));
|
|
185885
|
-
const dir =
|
|
186436
|
+
const dir = resolve65(out2);
|
|
185886
186437
|
const files = himiPluginFiles2(skills.skillMd);
|
|
185887
186438
|
for (const f2 of files) {
|
|
185888
|
-
mkdirSync42(dirname49(
|
|
185889
|
-
|
|
186439
|
+
mkdirSync42(dirname49(join88(dir, f2.path)), { recursive: true });
|
|
186440
|
+
writeFileSync40(join88(dir, f2.path), f2.text);
|
|
185890
186441
|
}
|
|
185891
186442
|
print({ ok: true, dir, files: files.map((f2) => f2.path), next: [`claude plugin validate ${dir}`, `claude --plugin-dir ${dir}`] });
|
|
185892
186443
|
return 0;
|
|
@@ -185896,23 +186447,23 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
185896
186447
|
run,
|
|
185897
186448
|
version: cliVersion(),
|
|
185898
186449
|
withFiles: flags["with-files"] === true,
|
|
185899
|
-
...process.env.HIMI_WORKSPACE ? { workspace:
|
|
186450
|
+
...process.env.HIMI_WORKSPACE ? { workspace: resolve65(process.env.HIMI_WORKSPACE) } : {}
|
|
185900
186451
|
});
|
|
185901
186452
|
return 0;
|
|
185902
186453
|
}
|
|
185903
186454
|
case "studio": {
|
|
185904
186455
|
const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
185905
186456
|
const dir = contentDir(flags);
|
|
185906
|
-
if (!
|
|
186457
|
+
if (!existsSync83(join88(dir, "himalaya.content.json"))) {
|
|
185907
186458
|
io2.error(JSON.stringify({ ok: false, error: "not_a_content_package", dir, hint: "run from the app directory (or pass --content <dir>) \u2014 the board reads that package's .himi/" }));
|
|
185908
186459
|
return 2;
|
|
185909
186460
|
}
|
|
185910
186461
|
if (pos[1] === "reel") {
|
|
185911
186462
|
const { buildReel: buildReel2 } = await Promise.resolve().then(() => (init_studio_reel(), studio_reel_exports));
|
|
185912
|
-
const out2 =
|
|
186463
|
+
const out2 = resolve65(str10(flags.out) ?? join88(dir, ".himi", "making-of.html"));
|
|
185913
186464
|
const { html, plan } = buildReel2(dir);
|
|
185914
186465
|
mkdirSync42(dirname49(out2), { recursive: true });
|
|
185915
|
-
|
|
186466
|
+
writeFileSync40(out2, html);
|
|
185916
186467
|
const { pathToFileURL: pathToFileURL9 } = await import("node:url");
|
|
185917
186468
|
const url2 = pathToFileURL9(out2).href;
|
|
185918
186469
|
const open2 = flags["no-open"] !== true;
|
|
@@ -185981,7 +186532,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
185981
186532
|
} = await Promise.resolve().then(() => (init_progress(), progress_exports));
|
|
185982
186533
|
const dir = contentDir(flags);
|
|
185983
186534
|
const journal2 = journalPath2(dir);
|
|
185984
|
-
const isContentPackage =
|
|
186535
|
+
const isContentPackage = existsSync83(join88(dir, "himalaya.content.json"));
|
|
185985
186536
|
const hint = isContentPackage ? {} : { hint: "no himalaya.content.json here \u2014 run from the app directory (or pass --content <dir>) so the build board finds this journal" };
|
|
185986
186537
|
const message = pos.slice(1).join(" ").trim();
|
|
185987
186538
|
const approvalFlags = ["approve", "done", "drop"].filter((f2) => flags[f2] !== void 0);
|
|
@@ -186133,7 +186684,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
186133
186684
|
case "test": {
|
|
186134
186685
|
const dir = contentDir(flags);
|
|
186135
186686
|
const structuredOutput = flags.json === true || io2.isTTY !== true;
|
|
186136
|
-
if (
|
|
186687
|
+
if (existsSync83(join88(dir, "functions"))) {
|
|
186137
186688
|
const { invokeLocalFunction: invokeLocalFunction2, loadFunctionsApp: loadFunctionsApp2 } = await Promise.resolve().then(() => (init_functions(), functions_exports));
|
|
186138
186689
|
const loaded = await loadFunctionsApp2(dir);
|
|
186139
186690
|
const results = [];
|
|
@@ -186226,7 +186777,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
186226
186777
|
...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
|
|
186227
186778
|
collect: { lint: true, descriptors: true }
|
|
186228
186779
|
});
|
|
186229
|
-
const { report: lintReport } = summarizeLint(app, bres, outcome, false, await cmsIssues(dir, app, false, { local: true }));
|
|
186780
|
+
const { report: lintReport } = summarizeLint(app, bres, outcome, false, [...await cmsIssues(dir, app, false, { local: true }), ...await (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44Issues(dir, app, false, { local: true })]);
|
|
186230
186781
|
if (bres.compileErrors.length || outcome.failedToBuild.length || outcome.missingBundles.length) {
|
|
186231
186782
|
print({ ...lintReport, ok: false, stage: "build", hint: "`himi test` needs something that builds \u2014 fix these, then re-run (same findings as `himi validate`)" });
|
|
186232
186783
|
return 1;
|
|
@@ -186265,7 +186816,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
186265
186816
|
io2.error(JSON.stringify({ error: `screen "${screen.screenId}" has no Tier-5 worker, so there is nothing for the browser loop to build` }));
|
|
186266
186817
|
return 2;
|
|
186267
186818
|
}
|
|
186268
|
-
const sources = collectWorkerSources2(
|
|
186819
|
+
const sources = collectWorkerSources2(join88(dir, "tier5-src"), screen.bundleName);
|
|
186269
186820
|
if (!sources) {
|
|
186270
186821
|
io2.error(JSON.stringify({ error: `no worker source found at tier5-src/${screen.bundleName} \u2014 the browser loop compiles SOURCE, not the built bundle` }));
|
|
186271
186822
|
return 2;
|
|
@@ -186443,7 +186994,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
186443
186994
|
const sp = await runShotsPass2({
|
|
186444
186995
|
descriptors: scopeDescriptors2(outcome.descriptors ?? [], pos.slice(1), invalidScreens),
|
|
186445
186996
|
tokens: outcome.tokens,
|
|
186446
|
-
outDir:
|
|
186997
|
+
outDir: join88(dir, ".himi", "shots"),
|
|
186447
186998
|
width: 390,
|
|
186448
186999
|
layers: { rules: shotRules, ...cmsSeed ? { cmsSeed } : {}, ...canned ? { canned: canned.byKey } : {} },
|
|
186449
187000
|
...budgetMs ? { budgetMs } : {},
|
|
@@ -186483,7 +187034,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
186483
187034
|
releaseId: result.releaseId,
|
|
186484
187035
|
releasePayload: release2,
|
|
186485
187036
|
descriptors: attestedDescriptors,
|
|
186486
|
-
screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""),
|
|
187037
|
+
screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join88(dir, ".himi", "shots", name)])),
|
|
186487
187038
|
coverage: {
|
|
186488
187039
|
screens: crawledScreens.size,
|
|
186489
187040
|
actionsDispatched: result.actions.exercised,
|
|
@@ -186608,7 +187159,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
186608
187159
|
return 2;
|
|
186609
187160
|
}
|
|
186610
187161
|
try {
|
|
186611
|
-
const raw = stateArg.trim().startsWith("{") ? stateArg :
|
|
187162
|
+
const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync104(stateArg.replace(/^@/, ""), "utf8");
|
|
186612
187163
|
injectedState = JSON.parse(raw);
|
|
186613
187164
|
} catch (e2) {
|
|
186614
187165
|
io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
|
|
@@ -186623,7 +187174,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
186623
187174
|
return 2;
|
|
186624
187175
|
}
|
|
186625
187176
|
try {
|
|
186626
|
-
const raw = inputArg.trim().startsWith("{") ? inputArg :
|
|
187177
|
+
const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync104(inputArg.replace(/^@/, ""), "utf8");
|
|
186627
187178
|
const parsed = JSON.parse(raw);
|
|
186628
187179
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
|
|
186629
187180
|
injectedInput = parsed;
|
|
@@ -186706,11 +187257,11 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
186706
187257
|
const diagnostics = (outcome.lint ?? []).find((s2) => s2.screenId === screenId)?.issues ?? [];
|
|
186707
187258
|
let pngFile;
|
|
186708
187259
|
let attestationPngFile;
|
|
186709
|
-
const shotPath =
|
|
187260
|
+
const shotPath = join88(dir, ".himi", "shots", `${screenId}.png`);
|
|
186710
187261
|
const pngTarget = typeof flags.png === "string" ? str10(flags.png) : flags.png === true ? shotPath : void 0;
|
|
186711
187262
|
if (pngTarget && r2.pngBase64) {
|
|
186712
187263
|
pngFile = writePngFile(pngTarget, r2.pngBase64);
|
|
186713
|
-
attestationPngFile =
|
|
187264
|
+
attestationPngFile = resolve65(pngTarget) === resolve65(shotPath) ? pngFile : writePngFile(shotPath, r2.pngBase64);
|
|
186714
187265
|
}
|
|
186715
187266
|
if (renderWidth !== void 0 && r2.renderable) {
|
|
186716
187267
|
recordRenderWidth(dir, {
|
|
@@ -187057,7 +187608,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187057
187608
|
return 2;
|
|
187058
187609
|
}
|
|
187059
187610
|
const renamed = str10(flags.name);
|
|
187060
|
-
const dest =
|
|
187611
|
+
const dest = resolve65(str10(flags.out) ?? process.cwd(), renamed ?? wanted);
|
|
187061
187612
|
const replace = flags.replace === true;
|
|
187062
187613
|
const force = replace || flags.force === true;
|
|
187063
187614
|
const linked = symlinkDestinationIssue(dest);
|
|
@@ -187065,7 +187616,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187065
187616
|
io2.error(JSON.stringify(linked));
|
|
187066
187617
|
return 1;
|
|
187067
187618
|
}
|
|
187068
|
-
if (
|
|
187619
|
+
if (existsSync83(dest)) {
|
|
187069
187620
|
if (!statSync23(dest).isDirectory()) {
|
|
187070
187621
|
io2.error(JSON.stringify({
|
|
187071
187622
|
error: `${dest} exists and is not a directory`,
|
|
@@ -187078,7 +187629,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187078
187629
|
io2.error(JSON.stringify({ error: `${dest} already exists and is not empty`, hint: "pass --force to write into it anyway (merging, and naming what it keeps), --replace to restore exactly what was archived, or --out/--name to land somewhere else" }));
|
|
187079
187630
|
return 1;
|
|
187080
187631
|
}
|
|
187081
|
-
if (replace && occupied && !
|
|
187632
|
+
if (replace && occupied && !existsSync83(join88(dest, "himalaya.content.json"))) {
|
|
187082
187633
|
io2.error(JSON.stringify({
|
|
187083
187634
|
error: `${dest} is not a content package \u2014 refusing to --replace it`,
|
|
187084
187635
|
hint: "--replace only clears a directory that holds himalaya.content.json. Check --out/--name, or pass --force to merge into it instead."
|
|
@@ -187230,6 +187781,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187230
187781
|
const { report: report3, hasErrors } = summarizeLint(declared, bres, outcome, strict, [
|
|
187231
187782
|
...capabilityIssues2(outcome.capabilityUsage, contentShell2(dir, str10(flags.shell)), strict, readLastDist2(dir)),
|
|
187232
187783
|
...await cmsIssues(dir, declared, strict, { local: true }),
|
|
187784
|
+
...await (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44Issues(dir, declared, strict, { local: true }),
|
|
187233
187785
|
...surfaceIssues(dir, outcome.surfaceNav, strict),
|
|
187234
187786
|
...tokenColorIssues(dir),
|
|
187235
187787
|
...await iconIssues(dir, strict),
|
|
@@ -187741,7 +188293,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187741
188293
|
return 2;
|
|
187742
188294
|
}
|
|
187743
188295
|
try {
|
|
187744
|
-
const res = writePack(
|
|
188296
|
+
const res = writePack(resolve65(releaseDir), only, resolve65(str10(flags.out) ?? process.cwd()));
|
|
187745
188297
|
print({
|
|
187746
188298
|
ok: true,
|
|
187747
188299
|
app: res.app,
|
|
@@ -187790,7 +188342,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187790
188342
|
}
|
|
187791
188343
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
187792
188344
|
const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
|
|
187793
|
-
const built = mkdtempSync6(
|
|
188345
|
+
const built = mkdtempSync6(join88(tmpdir7(), "himi-pack-"));
|
|
187794
188346
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
187795
188347
|
const outcome = await buildReleaseFromContent2(dir, built, {
|
|
187796
188348
|
...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
|
|
@@ -187801,6 +188353,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187801
188353
|
const { report: report3, hasErrors } = summarizeLint(app, bres, outcome, strict, [
|
|
187802
188354
|
...capabilityIssues2(outcome.capabilityUsage, contentShell2(dir, str10(flags.shell)), strict, readLastDist2(dir)),
|
|
187803
188355
|
...await cmsIssues(dir, app, strict, { local: true }),
|
|
188356
|
+
...await (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44Issues(dir, app, strict, { local: true }),
|
|
187804
188357
|
...surfaceIssues(dir, outcome.surfaceNav, strict),
|
|
187805
188358
|
...tokenColorIssues(dir),
|
|
187806
188359
|
...await iconIssues(dir, strict),
|
|
@@ -187819,7 +188372,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187819
188372
|
return 1;
|
|
187820
188373
|
}
|
|
187821
188374
|
try {
|
|
187822
|
-
const res = writePack(built, app,
|
|
188375
|
+
const res = writePack(built, app, resolve65(str10(flags.out) ?? dir), sourceArchive);
|
|
187823
188376
|
print({
|
|
187824
188377
|
ok: true,
|
|
187825
188378
|
app: res.app,
|
|
@@ -187864,7 +188417,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187864
188417
|
const { HIMI_PACKAGE_SOURCE_PATH: HIMI_PACKAGE_SOURCE_PATH2, isSafeAppId: isSafeAppId2, packageContents: packageContents2 } = await Promise.resolve().then(() => (init_himi_package(), himi_package_exports));
|
|
187865
188418
|
let opened;
|
|
187866
188419
|
try {
|
|
187867
|
-
opened = openPackageFile2(
|
|
188420
|
+
opened = openPackageFile2(resolve65(file2));
|
|
187868
188421
|
} catch (e2) {
|
|
187869
188422
|
io2.error(JSON.stringify({ error: e2.message }));
|
|
187870
188423
|
return 1;
|
|
@@ -187877,7 +188430,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187877
188430
|
io2.error(JSON.stringify({
|
|
187878
188431
|
ok: false,
|
|
187879
188432
|
error: "app_source_not_in_package",
|
|
187880
|
-
detail: `${
|
|
188433
|
+
detail: `${resolve65(file2)} is a release package: it carries built output (screens, bundles, tokens) and no source`,
|
|
187881
188434
|
hint: "re-pack it from the content package with `himi pack --dev`, or restore from the serve plane with `himi pull <app>`"
|
|
187882
188435
|
}));
|
|
187883
188436
|
return 1;
|
|
@@ -187900,7 +188453,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187900
188453
|
return 1;
|
|
187901
188454
|
}
|
|
187902
188455
|
}
|
|
187903
|
-
const dest =
|
|
188456
|
+
const dest = resolve65(str10(flags.out) ?? process.cwd(), renamed ?? opened.header.app);
|
|
187904
188457
|
const issue2 = restoreDestinationIssue(dest, flags.force === true);
|
|
187905
188458
|
if (issue2) {
|
|
187906
188459
|
io2.error(JSON.stringify(issue2));
|
|
@@ -187987,7 +188540,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187987
188540
|
}
|
|
187988
188541
|
try {
|
|
187989
188542
|
const { openPackageFile: openPackageFile2 } = await Promise.resolve().then(() => (init_pack(), pack_exports));
|
|
187990
|
-
const opened = openPackageFile2(
|
|
188543
|
+
const opened = openPackageFile2(resolve65(file2));
|
|
187991
188544
|
if (!opened.validation.ok || !opened.header) {
|
|
187992
188545
|
io2.error(JSON.stringify({ error: "refusing to share an invalid package", issues: opened.validation.errors }));
|
|
187993
188546
|
return 1;
|
|
@@ -187997,12 +188550,12 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
187997
188550
|
io2.error(JSON.stringify({
|
|
187998
188551
|
ok: false,
|
|
187999
188552
|
error: "refusing to share a package that carries the app's source",
|
|
188000
|
-
detail: `${
|
|
188553
|
+
detail: `${resolve65(file2)} was packed with --dev, and a share link is public and unauthenticated \u2014 anyone with the URL could \`himi import\` your codebase`,
|
|
188001
188554
|
hint: "share a release package instead (`himi pack` with no --dev), or hand the dev package over directly"
|
|
188002
188555
|
}));
|
|
188003
188556
|
return 1;
|
|
188004
188557
|
}
|
|
188005
|
-
const archive =
|
|
188558
|
+
const archive = readFileSync104(resolve65(file2));
|
|
188006
188559
|
const result = await client2().createPackageShare({
|
|
188007
188560
|
app: opened.header.app,
|
|
188008
188561
|
releaseId: opened.header.releaseId,
|
|
@@ -188099,11 +188652,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188099
188652
|
const app = await appId(dir2);
|
|
188100
188653
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
188101
188654
|
const bres = await buildContentBundles2(dir2, { resolution: resolutionFlag(flags) });
|
|
188102
|
-
temp = mkdtempSync6(
|
|
188655
|
+
temp = mkdtempSync6(join88(tmpdir7(), "himi-run-build-"));
|
|
188103
188656
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
188104
188657
|
const initial = await buildReleaseFromContent2(dir2, temp, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir2) } : {} });
|
|
188105
188658
|
servedMissing = initial.missingBundles;
|
|
188106
|
-
source =
|
|
188659
|
+
source = join88(temp, app);
|
|
188107
188660
|
}
|
|
188108
188661
|
const chromeArg = str10(flags.chrome) ?? "preview";
|
|
188109
188662
|
if (chromeArg !== "preview" && chromeArg !== "app") {
|
|
@@ -188142,7 +188695,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188142
188695
|
if (!recordKit) return;
|
|
188143
188696
|
startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
188144
188697
|
const failure = record2(served2, { ok: true, at: startedAt });
|
|
188145
|
-
if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${
|
|
188698
|
+
if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${join88(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
|
|
188146
188699
|
await refreshBoard();
|
|
188147
188700
|
};
|
|
188148
188701
|
const retract = async () => {
|
|
@@ -188165,9 +188718,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188165
188718
|
});
|
|
188166
188719
|
await announce(run2);
|
|
188167
188720
|
print({ ok: true, app: run2.app, url: run2.url, port: run2.port, plane: "browser" });
|
|
188168
|
-
await new Promise((
|
|
188721
|
+
await new Promise((resolve66) => {
|
|
188169
188722
|
const stop = () => {
|
|
188170
|
-
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run2.close().finally(() =>
|
|
188723
|
+
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run2.close().finally(() => resolve66()));
|
|
188171
188724
|
};
|
|
188172
188725
|
dropEarlySignals?.();
|
|
188173
188726
|
process.once("SIGINT", stop);
|
|
@@ -188178,7 +188731,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188178
188731
|
const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
|
|
188179
188732
|
const hhpPreviewRoute = watch2 ? (await Promise.resolve().then(() => (init_hhp_preview(), hhp_preview_exports))).hhpPreviewResponse : null;
|
|
188180
188733
|
const bus = watchKit ? new watchKit.ReloadBus() : void 0;
|
|
188181
|
-
if (watch2) served = mkdtempSync6(
|
|
188734
|
+
if (watch2) served = mkdtempSync6(join88(tmpdir7(), "himi-run-served-"));
|
|
188182
188735
|
const running = await runPackage2(source, {
|
|
188183
188736
|
port,
|
|
188184
188737
|
chrome: chromeArg,
|
|
@@ -188207,8 +188760,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188207
188760
|
await announce(running);
|
|
188208
188761
|
if (watchKit && bus) {
|
|
188209
188762
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
188210
|
-
const live3 =
|
|
188211
|
-
const manifestOf = (tree) => JSON.parse(
|
|
188763
|
+
const live3 = join88(running.releaseRoot, running.app);
|
|
188764
|
+
const manifestOf = (tree) => JSON.parse(readFileSync104(join88(tree, "release-manifest.json"), "utf8"));
|
|
188212
188765
|
let current = manifestOf(live3);
|
|
188213
188766
|
const failed3 = async (message) => {
|
|
188214
188767
|
if (stopping) return;
|
|
@@ -188219,7 +188772,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188219
188772
|
};
|
|
188220
188773
|
rebuild = watchKit.serialize(async () => {
|
|
188221
188774
|
const t0 = Date.now();
|
|
188222
|
-
const next = mkdtempSync6(
|
|
188775
|
+
const next = mkdtempSync6(join88(tmpdir7(), "himi-run-build-"));
|
|
188223
188776
|
try {
|
|
188224
188777
|
const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
|
|
188225
188778
|
if (bres.compileErrors.length) {
|
|
@@ -188236,16 +188789,16 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188236
188789
|
return;
|
|
188237
188790
|
}
|
|
188238
188791
|
if (stopping) return;
|
|
188239
|
-
const fresh = manifestOf(
|
|
188792
|
+
const fresh = manifestOf(join88(next, running.app));
|
|
188240
188793
|
const diff = watchKit.diffReleases(current, fresh);
|
|
188241
188794
|
const { describeChanges: describeChanges2, headline: headline2 } = await Promise.resolve().then(() => (init_build_changes(), build_changes_exports));
|
|
188242
|
-
const changes = describeChanges2(live3,
|
|
188795
|
+
const changes = describeChanges2(live3, join88(next, running.app), diff);
|
|
188243
188796
|
const retired = `${live3}.retired-${Date.now()}`;
|
|
188244
188797
|
renameSync13(live3, retired);
|
|
188245
188798
|
try {
|
|
188246
|
-
renameSync13(
|
|
188799
|
+
renameSync13(join88(next, running.app), live3);
|
|
188247
188800
|
} catch {
|
|
188248
|
-
cpSync3(
|
|
188801
|
+
cpSync3(join88(next, running.app), live3, { recursive: true });
|
|
188249
188802
|
}
|
|
188250
188803
|
rmSync24(retired, { recursive: true, force: true });
|
|
188251
188804
|
current = fresh;
|
|
@@ -188872,7 +189425,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188872
189425
|
io2.error(JSON.stringify({ error: `patch ${kind} needs --file`, usage: PATCH_USAGE }));
|
|
188873
189426
|
return 2;
|
|
188874
189427
|
}
|
|
188875
|
-
if (!
|
|
189428
|
+
if (!existsSync83(file2)) {
|
|
188876
189429
|
io2.error(JSON.stringify({ error: `no such file: ${file2}` }));
|
|
188877
189430
|
return 2;
|
|
188878
189431
|
}
|
|
@@ -188928,7 +189481,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188928
189481
|
lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
|
|
188929
189482
|
};
|
|
188930
189483
|
if (kind === "tokens" || kind === "app-config") {
|
|
188931
|
-
const body =
|
|
189484
|
+
const body = readFileSync104(file2, "utf8");
|
|
188932
189485
|
const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
|
|
188933
189486
|
return runReleasePatch({
|
|
188934
189487
|
...common,
|
|
@@ -188943,7 +189496,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
188943
189496
|
io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
|
|
188944
189497
|
return 2;
|
|
188945
189498
|
}
|
|
188946
|
-
const descriptor =
|
|
189499
|
+
const descriptor = readFileSync104(file2, "utf8");
|
|
188947
189500
|
let parsed;
|
|
188948
189501
|
try {
|
|
188949
189502
|
parsed = JSON.parse(descriptor);
|
|
@@ -189000,7 +189553,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189000
189553
|
extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
|
|
189001
189554
|
});
|
|
189002
189555
|
}
|
|
189003
|
-
const bytes2 =
|
|
189556
|
+
const bytes2 = readFileSync104(file2);
|
|
189004
189557
|
const sha2 = createHash45("sha256").update(bytes2).digest("hex");
|
|
189005
189558
|
const forScreens = (str10(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
189006
189559
|
if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
|
|
@@ -189144,7 +189697,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189144
189697
|
}
|
|
189145
189698
|
let def;
|
|
189146
189699
|
try {
|
|
189147
|
-
const parsed = JSON.parse(arg.startsWith("@") ?
|
|
189700
|
+
const parsed = JSON.parse(arg.startsWith("@") ? readFileSync104(arg.slice(1), "utf8") : arg);
|
|
189148
189701
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
189149
189702
|
io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
|
|
189150
189703
|
return 2;
|
|
@@ -189426,7 +189979,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189426
189979
|
const rememberLastDist = async (jobs2) => {
|
|
189427
189980
|
try {
|
|
189428
189981
|
const dir = contentDir(flags);
|
|
189429
|
-
if (!
|
|
189982
|
+
if (!existsSync83(join88(dir, "himalaya.content.json"))) return;
|
|
189430
189983
|
const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
|
|
189431
189984
|
const own5 = await appId(dir);
|
|
189432
189985
|
for (const job of jobs2) {
|
|
@@ -189447,9 +190000,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189447
190000
|
const app2 = typeof job.app === "string" ? job.app : void 0;
|
|
189448
190001
|
const jobId = typeof job.jobId === "string" ? job.jobId : void 0;
|
|
189449
190002
|
if (!player || !app2 || !jobId) return;
|
|
189450
|
-
const render = (
|
|
190003
|
+
const render = (label3, payload, literal) => {
|
|
189451
190004
|
io2.log(`
|
|
189452
|
-
${
|
|
190005
|
+
${label3}`);
|
|
189453
190006
|
try {
|
|
189454
190007
|
const qr2 = qrTerminal(payload);
|
|
189455
190008
|
if (qr2.cols <= 50) io2.log(qr2.text);
|
|
@@ -189666,7 +190219,7 @@ ${label2}`);
|
|
|
189666
190219
|
const platform = str10(flags.platform)?.split(",").map((p2) => p2.trim()).filter(Boolean);
|
|
189667
190220
|
{
|
|
189668
190221
|
const distDir = contentDir(flags);
|
|
189669
|
-
if (
|
|
190222
|
+
if (existsSync83(join88(distDir, "himalaya.content.json"))) {
|
|
189670
190223
|
const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
|
|
189671
190224
|
const errors = issues.filter((i2) => i2.severity === "error");
|
|
189672
190225
|
for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
|
|
@@ -190006,7 +190559,7 @@ ${label2}`);
|
|
|
190006
190559
|
const dpxPath = dpxSessionTokenPath();
|
|
190007
190560
|
let dpx;
|
|
190008
190561
|
try {
|
|
190009
|
-
dpx =
|
|
190562
|
+
dpx = readFileSync104(dpxPath, "utf8").trim();
|
|
190010
190563
|
} catch {
|
|
190011
190564
|
io2.error(JSON.stringify({ error: `no dpx session at ${dpxPath} \u2014 run \`dpx auth login\` then \`dpx auth token > ${dpxPath}\` (dpx 2.x keeps its own state in ~/.dpx/auth.json and does NOT write the legacy session file), or omit --dpx` }));
|
|
190012
190565
|
return 1;
|
|
@@ -190469,7 +191022,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
190469
191022
|
const path2 = dpxSessionTokenPath();
|
|
190470
191023
|
let raw;
|
|
190471
191024
|
try {
|
|
190472
|
-
raw =
|
|
191025
|
+
raw = readFileSync104(path2, "utf8");
|
|
190473
191026
|
} catch {
|
|
190474
191027
|
io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
|
|
190475
191028
|
return 1;
|
|
@@ -190663,7 +191216,79 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
190663
191216
|
}
|
|
190664
191217
|
}
|
|
190665
191218
|
const sub = pos[1];
|
|
190666
|
-
const b44Usage = "himi base44 analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | himi base44 login [--from-base44-cli] | himi base44 whoami | himi base44 logout";
|
|
191219
|
+
const b44Usage = "himi base44 analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | himi base44 adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | himi base44 entities query [--content <dir>] [--all] [--json] | himi base44 login [--from-base44-cli] | himi base44 whoami | himi base44 logout";
|
|
191220
|
+
if (sub === "adopt") {
|
|
191221
|
+
const { runBase44Adopt: runBase44Adopt2, AdoptError: AdoptError2 } = await Promise.resolve().then(() => (init_base44_adopt(), base44_adopt_exports));
|
|
191222
|
+
const dir = contentDir(flags);
|
|
191223
|
+
const only = str10(flags.entities)?.split(",").map((n2) => n2.trim()).filter(Boolean);
|
|
191224
|
+
try {
|
|
191225
|
+
const write2 = flags.write === true ? true : str10(flags.write);
|
|
191226
|
+
const r2 = runBase44Adopt2({ cwd: dir, app: await appId(dir), book: str10(flags.book), only, write: write2 });
|
|
191227
|
+
const errors = r2.issues.filter((i2) => i2.severity === "error");
|
|
191228
|
+
const lint = errors.length ? { ok: false, code: "adopt_lint_errors" } : { ok: true };
|
|
191229
|
+
if (r2.written) print({ ...lint, written: r2.written, entities: r2.result.entities.length, functions: r2.result.functions.length, skipped: r2.result.skipped, issues: r2.issues });
|
|
191230
|
+
else if (flags.json === true) print({ ...lint, ...r2.result, issues: r2.issues, module: r2.module });
|
|
191231
|
+
else {
|
|
191232
|
+
io2.log(r2.module);
|
|
191233
|
+
if (errors.length || r2.result.skipped.length) io2.error(JSON.stringify({ ...lint, skipped: r2.result.skipped, ...errors.length ? { issues: errors } : {} }));
|
|
191234
|
+
}
|
|
191235
|
+
return errors.length === 0 ? 0 : 1;
|
|
191236
|
+
} catch (e2) {
|
|
191237
|
+
if (e2 instanceof AdoptError2) {
|
|
191238
|
+
io2.error(JSON.stringify({ ok: false, code: e2.code, error: e2.message, ...e2.extra, ...e2.exit === 2 ? { usage: b44Usage } : {} }));
|
|
191239
|
+
return e2.exit;
|
|
191240
|
+
}
|
|
191241
|
+
throw e2;
|
|
191242
|
+
}
|
|
191243
|
+
}
|
|
191244
|
+
if (sub === "entities") {
|
|
191245
|
+
if (pos[2] !== "query") {
|
|
191246
|
+
io2.error(JSON.stringify({ ok: false, code: "unknown_subcommand", error: pos[2] ? `unknown base44 entities subcommand "${pos[2]}" \u2014 use query` : "base44 entities needs a subcommand: query", usage: b44Usage }));
|
|
191247
|
+
return 2;
|
|
191248
|
+
}
|
|
191249
|
+
const dir = contentDir(flags);
|
|
191250
|
+
const app = await appId(dir);
|
|
191251
|
+
let base44;
|
|
191252
|
+
try {
|
|
191253
|
+
const { loadAppConfigModule: loadAppConfigModule2 } = await Promise.resolve().then(() => (init_app_config_loader(), app_config_loader_exports));
|
|
191254
|
+
base44 = (await loadAppConfigModule2(dir))?.base44;
|
|
191255
|
+
} catch (e2) {
|
|
191256
|
+
const finding = (await Promise.resolve().then(() => (init_base44_lint(), base44_lint_exports))).base44DefineAppFinding(e2);
|
|
191257
|
+
if (finding) {
|
|
191258
|
+
io2.error(JSON.stringify({ ok: false, code: "invalid_config", app, issues: [{ severity: "error", ...finding }], hint: '`himi validate` reports these with pass: "base44"' }));
|
|
191259
|
+
return 1;
|
|
191260
|
+
}
|
|
191261
|
+
io2.error(JSON.stringify({ ok: false, code: "config_unloadable", app, error: e2.message, hint: "fix the config so it imports cleanly, then re-run. `himi validate` shows the underlying error." }));
|
|
191262
|
+
return 1;
|
|
191263
|
+
}
|
|
191264
|
+
if (!base44 || typeof base44 !== "object") {
|
|
191265
|
+
print({ ok: true, code: "no_base44_block", app, declared: 0, note: "no `base44` block in config.ts \u2014 nothing to query. `himi base44 adopt` writes declarations from a book. See `himi docs base44-entities`." });
|
|
191266
|
+
return 0;
|
|
191267
|
+
}
|
|
191268
|
+
const { validateBase44Entities: validateBase44Entities2 } = await Promise.resolve().then(() => (init_base44_schema(), base44_schema_exports));
|
|
191269
|
+
const errors = validateBase44Entities2(base44, app).filter((i2) => i2.severity === "error");
|
|
191270
|
+
if (typeof base44.appId !== "string" || !base44.appId) errors.unshift({ severity: "error", ruleCode: "shape-invalid", message: "base44.appId is missing" });
|
|
191271
|
+
if (errors.length) {
|
|
191272
|
+
io2.error(JSON.stringify({ ok: false, code: "invalid_config", app, issues: errors, hint: '`himi validate` reports these with pass: "base44"' }));
|
|
191273
|
+
return 1;
|
|
191274
|
+
}
|
|
191275
|
+
const auth2 = await (await Promise.resolve().then(() => (init_base44_auth(), base44_auth_exports))).usableBase44Auth();
|
|
191276
|
+
if (!auth2) {
|
|
191277
|
+
io2.error(JSON.stringify({ ok: false, code: "not_signed_in", app, error: "entities query needs a Base44 session: run `himi base44 login` (or set BASE44_ACCESS_TOKEN)" }));
|
|
191278
|
+
return 2;
|
|
191279
|
+
}
|
|
191280
|
+
const { projectDownloader: projectDownloader2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
|
|
191281
|
+
const { queryBase44Entities: queryBase44Entities2 } = await Promise.resolve().then(() => (init_base44_entities2(), base44_entities_exports));
|
|
191282
|
+
const report3 = await queryBase44Entities2({
|
|
191283
|
+
app,
|
|
191284
|
+
appId: base44.appId,
|
|
191285
|
+
base44,
|
|
191286
|
+
all: flags.all === true,
|
|
191287
|
+
ports: { apiFetch: fetch, apiBase: auth2.apiBase, token: auth2.token, downloadSource: projectDownloader2(fetch, auth2.apiBase, auth2.token) }
|
|
191288
|
+
});
|
|
191289
|
+
print(report3.sourceRead === "unavailable" ? { ...report3, code: "source_unavailable" } : report3);
|
|
191290
|
+
return 0;
|
|
191291
|
+
}
|
|
190667
191292
|
const auth = await Promise.resolve().then(() => (init_base44_auth(), base44_auth_exports));
|
|
190668
191293
|
if (sub === "whoami") {
|
|
190669
191294
|
const w2 = auth.base44Whoami(auth.currentBase44Auth());
|