@wix/himalaya-cli 0.1453.0 → 0.1454.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/cli.mjs +787 -553
- package/guides/himi-json-output.md +16 -0
- package/guides/one-app-to-himi-app.md +7 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -3923,7 +3923,7 @@ async function browserLogin(opts) {
|
|
|
3923
3923
|
const log = opts.log ?? (() => {
|
|
3924
3924
|
});
|
|
3925
3925
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
3926
|
-
return await new Promise((
|
|
3926
|
+
return await new Promise((resolve67, reject) => {
|
|
3927
3927
|
let settled = false;
|
|
3928
3928
|
let loginUrl = "";
|
|
3929
3929
|
const server = createServer();
|
|
@@ -3989,7 +3989,7 @@ async function browserLogin(opts) {
|
|
|
3989
3989
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", connection: "close" }).end(closePage(opts.doneTitle ?? "Signed in to himi"));
|
|
3990
3990
|
const extra = {};
|
|
3991
3991
|
for (const [k2, v2] of params) if (k2 !== "token" && k2 !== "state") extra[k2] = v2;
|
|
3992
|
-
finish2(() =>
|
|
3992
|
+
finish2(() => resolve67({ token, loginUrl, extra }));
|
|
3993
3993
|
});
|
|
3994
3994
|
});
|
|
3995
3995
|
server.on("error", (err) => finish2(() => reject(err)));
|
|
@@ -4101,7 +4101,7 @@ async function mintToken(args, label3, cacheKey, spawnImpl) {
|
|
|
4101
4101
|
tokenCache.set(cacheKey, fromEnv);
|
|
4102
4102
|
return fromEnv;
|
|
4103
4103
|
}
|
|
4104
|
-
const token = await new Promise((
|
|
4104
|
+
const token = await new Promise((resolve67, reject) => {
|
|
4105
4105
|
let child;
|
|
4106
4106
|
try {
|
|
4107
4107
|
child = spawnImpl("wix", [...args]);
|
|
@@ -4130,12 +4130,12 @@ async function mintToken(args, label3, cacheKey, spawnImpl) {
|
|
|
4130
4130
|
child.stdout?.on("data", (d2) => {
|
|
4131
4131
|
out2 += String(d2);
|
|
4132
4132
|
const m2 = out2.match(TOKEN_RE);
|
|
4133
|
-
if (m2) done(() =>
|
|
4133
|
+
if (m2) done(() => resolve67(m2[0]));
|
|
4134
4134
|
});
|
|
4135
4135
|
child.stderr?.on("data", (d2) => {
|
|
4136
4136
|
out2 += String(d2);
|
|
4137
4137
|
const m2 = out2.match(TOKEN_RE);
|
|
4138
|
-
if (m2) done(() =>
|
|
4138
|
+
if (m2) done(() => resolve67(m2[0]));
|
|
4139
4139
|
});
|
|
4140
4140
|
child.on("error", (e2) => done(() => reject(new Error(mintHelp(label3, e2.message)))));
|
|
4141
4141
|
child.on("exit", (code) => done(() => reject(new Error(
|
|
@@ -5058,8 +5058,8 @@ function tsExtResolvePlugin() {
|
|
|
5058
5058
|
setup(b2) {
|
|
5059
5059
|
b2.onResolve({ filter: /\.js$/ }, (args) => {
|
|
5060
5060
|
if (args.kind === "entry-point" || !args.path.startsWith(".")) return void 0;
|
|
5061
|
-
const
|
|
5062
|
-
return existsSync8(
|
|
5061
|
+
const ts11 = resolve8(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
|
|
5062
|
+
return existsSync8(ts11) ? { path: ts11 } : void 0;
|
|
5063
5063
|
});
|
|
5064
5064
|
}
|
|
5065
5065
|
};
|
|
@@ -5804,7 +5804,7 @@ function bundleFor(file2) {
|
|
|
5804
5804
|
const match = /^tier5-src\/([^/]+)\//.exec(file2);
|
|
5805
5805
|
return match?.[1] ?? "_shared";
|
|
5806
5806
|
}
|
|
5807
|
-
function toIssue(
|
|
5807
|
+
function toIssue(ts11, contentDir2, diagnostic) {
|
|
5808
5808
|
const file2 = diagnostic.file ? relativeFile(contentDir2, diagnostic.file.fileName) : void 0;
|
|
5809
5809
|
const position = diagnostic.file && diagnostic.start !== void 0 ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : void 0;
|
|
5810
5810
|
return {
|
|
@@ -5812,13 +5812,13 @@ function toIssue(ts10, contentDir2, diagnostic) {
|
|
|
5812
5812
|
...file2 ? { file: file2 } : {},
|
|
5813
5813
|
...position ? { line: position.line + 1, column: position.character + 1 } : {},
|
|
5814
5814
|
code: `TS${diagnostic.code}`,
|
|
5815
|
-
message:
|
|
5815
|
+
message: ts11.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
5816
5816
|
};
|
|
5817
5817
|
}
|
|
5818
|
-
function confinedHost(
|
|
5818
|
+
function confinedHost(ts11, contentDir2, options) {
|
|
5819
5819
|
if (!buildConfinementRequired()) return void 0;
|
|
5820
|
-
const host =
|
|
5821
|
-
const libDir = resolve10(
|
|
5820
|
+
const host = ts11.createCompilerHost(options);
|
|
5821
|
+
const libDir = resolve10(ts11.getDefaultLibFilePath(options), "..");
|
|
5822
5822
|
const allows = confinementMatcher(contentDir2, [libDir]);
|
|
5823
5823
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
5824
5824
|
const readFile3 = host.readFile.bind(host);
|
|
@@ -5847,7 +5847,7 @@ function confinedHost(ts10, contentDir2, options) {
|
|
|
5847
5847
|
}
|
|
5848
5848
|
async function typecheckContentWorkers(contentDir2, options) {
|
|
5849
5849
|
if (!existsSync9(resolve10(contentDir2, "tier5-src"))) return [];
|
|
5850
|
-
const
|
|
5850
|
+
const ts11 = await compiler2();
|
|
5851
5851
|
const config = {
|
|
5852
5852
|
compilerOptions: {
|
|
5853
5853
|
...CONTENT_WORKER_COMPILER_OPTIONS,
|
|
@@ -5856,18 +5856,18 @@ async function typecheckContentWorkers(contentDir2, options) {
|
|
|
5856
5856
|
// The deployed authoring runtime stages TypeScript 6, which requires an explicit
|
|
5857
5857
|
// acknowledgement for this compatibility `baseUrl`; the repository's TypeScript 5 lane
|
|
5858
5858
|
// rejects that 6.0 value, so keep it specific to the compiler that needs it.
|
|
5859
|
-
...Number.parseInt(
|
|
5859
|
+
...Number.parseInt(ts11.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
|
|
5860
5860
|
},
|
|
5861
5861
|
include: ["tier5-src/*/index.ts", "tier5-src/_shared/**/*.ts"]
|
|
5862
5862
|
};
|
|
5863
|
-
const parsed =
|
|
5863
|
+
const parsed = ts11.parseJsonConfigFileContent(config, ts11.sys, contentDir2);
|
|
5864
5864
|
if (parsed.fileNames.length === 0) return [];
|
|
5865
|
-
const program =
|
|
5865
|
+
const program = ts11.createProgram({
|
|
5866
5866
|
rootNames: parsed.fileNames,
|
|
5867
5867
|
options: parsed.options,
|
|
5868
|
-
host: confinedHost(
|
|
5868
|
+
host: confinedHost(ts11, contentDir2, parsed.options)
|
|
5869
5869
|
});
|
|
5870
|
-
return [...parsed.errors, ...
|
|
5870
|
+
return [...parsed.errors, ...ts11.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts11.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts11, contentDir2, diagnostic));
|
|
5871
5871
|
}
|
|
5872
5872
|
var compilerPromise;
|
|
5873
5873
|
var init_tier5_typecheck = __esm({
|
|
@@ -6186,15 +6186,15 @@ function analyzeController(source, file2, profile, diagnostics) {
|
|
|
6186
6186
|
error(declaration ?? sf2, "Default-export defineController({ initialState, handlers }).");
|
|
6187
6187
|
return;
|
|
6188
6188
|
}
|
|
6189
|
-
const
|
|
6190
|
-
if (!
|
|
6189
|
+
const object7 = declaration.expression.arguments[0];
|
|
6190
|
+
if (!object7 || !ts2.isObjectLiteralExpression(object7)) {
|
|
6191
6191
|
error(declaration, "Controller definition must be an object literal.");
|
|
6192
6192
|
return;
|
|
6193
6193
|
}
|
|
6194
|
-
const props = new Map(
|
|
6194
|
+
const props = new Map(object7.properties.map((p2) => [p2.name?.getText(sf2).replace(/^["']|["']$/g, ""), p2]));
|
|
6195
6195
|
const state = props.get("initialState"), handlers = props.get("handlers");
|
|
6196
6196
|
if (!state || !ts2.isPropertyAssignment(state) || !handlers || !ts2.isPropertyAssignment(handlers) || !ts2.isObjectLiteralExpression(handlers.initializer)) {
|
|
6197
|
-
error(
|
|
6197
|
+
error(object7, "initialState and handlers must be object literals.");
|
|
6198
6198
|
return;
|
|
6199
6199
|
}
|
|
6200
6200
|
function literal(n2) {
|
|
@@ -6932,12 +6932,12 @@ import * as cheerio2 from "cheerio";
|
|
|
6932
6932
|
import Ajv from "ajv";
|
|
6933
6933
|
import { createHash as createHash6 } from "node:crypto";
|
|
6934
6934
|
function validator(schema) {
|
|
6935
|
-
let
|
|
6936
|
-
if (!
|
|
6937
|
-
|
|
6938
|
-
validators.set(schema,
|
|
6935
|
+
let validate5 = validators.get(schema);
|
|
6936
|
+
if (!validate5) {
|
|
6937
|
+
validate5 = ajv.compile({ ...schema, $defs: catalog.schema.$defs });
|
|
6938
|
+
validators.set(schema, validate5);
|
|
6939
6939
|
}
|
|
6940
|
-
return
|
|
6940
|
+
return validate5;
|
|
6941
6941
|
}
|
|
6942
6942
|
function compileV2(html, profile, options) {
|
|
6943
6943
|
const diagnostics = [], sourceMap2 = {}, dependencies = [options.file];
|
|
@@ -7007,7 +7007,7 @@ function compileV2(html, profile, options) {
|
|
|
7007
7007
|
});
|
|
7008
7008
|
for (const rule of rules) {
|
|
7009
7009
|
const type = rule.declarations.display === "grid" || rule.declarations["grid-template-columns"] ? "Grid" : "VStack";
|
|
7010
|
-
translateStyle(rule.declarations, profile, type, {}, {}, (message, hint,
|
|
7010
|
+
translateStyle(rule.declarations, profile, type, {}, {}, (message, hint, property2) => diagnostics.push({ code: "HHP-CSS-VALUE", severity: "error", ...rule.locations[property2 ?? ""] ?? { file: rule.file, line: rule.line, column: 1 }, message, ...hint ? { hint } : {} }));
|
|
7011
7011
|
}
|
|
7012
7012
|
rules.sort((a2, b2) => a2.specificity - b2.specificity);
|
|
7013
7013
|
const tags = new Map(Object.entries(profile.components).map(([name, spec]) => [spec.tag, name]));
|
|
@@ -7060,8 +7060,8 @@ function compileV2(html, profile, options) {
|
|
|
7060
7060
|
for (const child of Object.values(record2)) structured(el2, child);
|
|
7061
7061
|
}
|
|
7062
7062
|
function checkValue(el2, field, value, name) {
|
|
7063
|
-
const
|
|
7064
|
-
if (!
|
|
7063
|
+
const validate5 = validator(field.schema);
|
|
7064
|
+
if (!validate5(value)) error(el2, "HHP-PROP-VALUE", `${name}: ${ajv.errorsText(validate5.errors)}.`);
|
|
7065
7065
|
if (!profile.surfaces.every((s2) => field.surfaces.includes(s2))) error(el2, "HHP-FIELD-SURFACE", `${name} is unsupported on an enabled surface.`);
|
|
7066
7066
|
}
|
|
7067
7067
|
const statePath = (raw) => raw.startsWith(`${serviceName}.`) ? raw.slice(serviceName.length + 1) : raw;
|
|
@@ -7121,7 +7121,7 @@ function compileV2(html, profile, options) {
|
|
|
7121
7121
|
}
|
|
7122
7122
|
if (style.display && !["main", "div", "header", "footer", "nav", "himi-v-stack", "himi-h-stack", "himi-grid"].includes(tag))
|
|
7123
7123
|
error(el2, "HHP-CSS-COMPONENT", "display layout rules require a stack or grid container.");
|
|
7124
|
-
type = translateStyle(style, profile, type, props, mods, (message, hint,
|
|
7124
|
+
type = translateStyle(style, profile, type, props, mods, (message, hint, property2) => diagnostics.push({ code: "HHP-CSS-VALUE", severity: "error", ...styleLocations[property2 ?? ""] ?? loc(el2), message, ...hint ? { hint } : {} }));
|
|
7125
7125
|
const spec = Object.hasOwn(profile.components, type) ? profile.components[type] : void 0;
|
|
7126
7126
|
let id = attrs["data-id"] ?? attrs.id ?? `hhp.${screenId}.${treePath}`;
|
|
7127
7127
|
if (row && !id.includes("$item.")) id += ".$item.id";
|
|
@@ -7330,7 +7330,7 @@ function compileV2(html, profile, options) {
|
|
|
7330
7330
|
}
|
|
7331
7331
|
for (const rule of matching.filter((r2) => r2.breakpoint)) {
|
|
7332
7332
|
const responsiveProps = {};
|
|
7333
|
-
translateStyle(rule.declarations, profile, type, responsiveProps, {}, (message, hint,
|
|
7333
|
+
translateStyle(rule.declarations, profile, type, responsiveProps, {}, (message, hint, property2) => diagnostics.push({ code: "HHP-CSS-VALUE", severity: "error", ...rule.locations[property2 ?? ""] ?? { file: rule.file, line: rule.line, column: 1 }, message, ...hint ? { hint } : {} }));
|
|
7334
7334
|
if (type !== "Grid") error(el2, "HHP-CSS-RESPONSIVE", "Container column overrides require a Grid.");
|
|
7335
7335
|
}
|
|
7336
7336
|
for (const breakpoint of [600, 840]) {
|
|
@@ -7411,8 +7411,8 @@ function compileV2(html, profile, options) {
|
|
|
7411
7411
|
if (!cases.length || new Set(cases.map((entry) => entry.id)).size !== cases.length || !cases.some((entry) => entry.id === props.defaultCase)) error(el2, "HHP-COMPOSITION-POLICY", "FragmentSlot requires unique cases and a matching defaultCase.");
|
|
7412
7412
|
}
|
|
7413
7413
|
if (spec.propsSchema) {
|
|
7414
|
-
const
|
|
7415
|
-
if (!
|
|
7414
|
+
const validate5 = validator(spec.propsSchema);
|
|
7415
|
+
if (!validate5(props)) error(el2, "HHP-PROP-SHAPE", `${type}: ${ajv.errorsText(validate5.errors)}.`);
|
|
7416
7416
|
}
|
|
7417
7417
|
for (const required3 of spec.required) if (!Object.hasOwn(props, required3)) error(el2, "HHP-PROP-REQUIRED", `${type} requires ${required3}.`);
|
|
7418
7418
|
for (const [name, value] of Object.entries(props)) {
|
|
@@ -8261,9 +8261,9 @@ function scanWidgetPayload(node, family, path2, bindings, disallowed, timeRefs,
|
|
|
8261
8261
|
}
|
|
8262
8262
|
}
|
|
8263
8263
|
function validateWidget(snapshot2) {
|
|
8264
|
-
const
|
|
8265
|
-
const schemaOk =
|
|
8266
|
-
const schemaErrors = schemaOk ? [] :
|
|
8264
|
+
const validate5 = compileWidgetSchema();
|
|
8265
|
+
const schemaOk = validate5(snapshot2);
|
|
8266
|
+
const schemaErrors = schemaOk ? [] : validate5.errors ?? [];
|
|
8267
8267
|
const bindingViolations = [];
|
|
8268
8268
|
const disallowedComponents = [];
|
|
8269
8269
|
const timeRefViolations = [];
|
|
@@ -10026,16 +10026,16 @@ var init_src = __esm({
|
|
|
10026
10026
|
});
|
|
10027
10027
|
|
|
10028
10028
|
// ../../core/dev-server/src/media-value.ts
|
|
10029
|
-
function isMediaValueProperty(
|
|
10030
|
-
const normalized =
|
|
10031
|
-
return MEDIA_NAMED_PROPERTY.test(
|
|
10029
|
+
function isMediaValueProperty(property2) {
|
|
10030
|
+
const normalized = property2.toLowerCase();
|
|
10031
|
+
return MEDIA_NAMED_PROPERTY.test(property2) || normalized === "url" || normalized === "src" || normalized === "source" || MEDIA_LOCATION_SUFFIX.test(property2);
|
|
10032
10032
|
}
|
|
10033
|
-
function isComponentMediaValueProperty(componentType,
|
|
10034
|
-
return isMediaValueProperty(
|
|
10033
|
+
function isComponentMediaValueProperty(componentType, property2) {
|
|
10034
|
+
return isMediaValueProperty(property2) || componentType === "Image" && property2 === "asset";
|
|
10035
10035
|
}
|
|
10036
|
-
function isMediaLocationProperty(
|
|
10037
|
-
const normalized =
|
|
10038
|
-
return normalized === "url" || normalized === "src" || normalized === "source" || MEDIA_LOCATION_SUFFIX.test(
|
|
10036
|
+
function isMediaLocationProperty(property2) {
|
|
10037
|
+
const normalized = property2.toLowerCase();
|
|
10038
|
+
return normalized === "url" || normalized === "src" || normalized === "source" || MEDIA_LOCATION_SUFFIX.test(property2) || MEDIA_NAMED_PROPERTY.test(property2) && MEDIA_PATH_SUFFIX.test(property2);
|
|
10039
10039
|
}
|
|
10040
10040
|
function unresolvedWixMediaReference(value, allowBareId = false) {
|
|
10041
10041
|
if (typeof value !== "string") return null;
|
|
@@ -26816,10 +26816,10 @@ var init_preview = __esm({
|
|
|
26816
26816
|
}
|
|
26817
26817
|
},
|
|
26818
26818
|
kill: (pid, signal) => process.kill(pid, signal),
|
|
26819
|
-
portFree: (port) => new Promise((
|
|
26819
|
+
portFree: (port) => new Promise((resolve67) => {
|
|
26820
26820
|
const s2 = createServer2();
|
|
26821
|
-
s2.once("error", () =>
|
|
26822
|
-
s2.listen(port, "127.0.0.1", () => s2.close(() =>
|
|
26821
|
+
s2.once("error", () => resolve67(false));
|
|
26822
|
+
s2.listen(port, "127.0.0.1", () => s2.close(() => resolve67(true)));
|
|
26823
26823
|
}),
|
|
26824
26824
|
sleep: (ms2) => new Promise((r2) => setTimeout(r2, ms2)),
|
|
26825
26825
|
servingIdentity: async (origin) => {
|
|
@@ -28747,23 +28747,23 @@ async function runTemplateTrim(req, deps) {
|
|
|
28747
28747
|
}
|
|
28748
28748
|
}
|
|
28749
28749
|
};
|
|
28750
|
-
const base = (
|
|
28750
|
+
const base = (validate6) => ({
|
|
28751
28751
|
dryRun: false,
|
|
28752
28752
|
...plan.report,
|
|
28753
|
-
validate:
|
|
28753
|
+
validate: validate6 ? { counts: validate6.counts ?? null, ...validate6.tail ? { tail: validate6.tail } : {} } : null
|
|
28754
28754
|
});
|
|
28755
|
-
const abort = (error, cause,
|
|
28755
|
+
const abort = (error, cause, validate6) => {
|
|
28756
28756
|
const message = cause?.message ?? String(cause);
|
|
28757
28757
|
try {
|
|
28758
28758
|
restore();
|
|
28759
28759
|
} catch (e2) {
|
|
28760
28760
|
return {
|
|
28761
28761
|
code: 1,
|
|
28762
|
-
result: { ok: false, error: `${error} (${message}), and restoring the originals failed too (${e2.message})`, rolledBack: false, backup: backupRel, hint: `the originals are in ${backupRel} \u2014 copy dev/index.ts, config.ts and tier5-src/* back by hand`, ...base(
|
|
28762
|
+
result: { ok: false, error: `${error} (${message}), and restoring the originals failed too (${e2.message})`, rolledBack: false, backup: backupRel, hint: `the originals are in ${backupRel} \u2014 copy dev/index.ts, config.ts and tier5-src/* back by hand`, ...base(validate6) }
|
|
28763
28763
|
};
|
|
28764
28764
|
}
|
|
28765
28765
|
dropBackup();
|
|
28766
|
-
return { code: 1, result: { ok: false, error: `${error} (${message}); every file was restored`, rolledBack: true, ...base(
|
|
28766
|
+
return { code: 1, result: { ok: false, error: `${error} (${message}); every file was restored`, rolledBack: true, ...base(validate6) } };
|
|
28767
28767
|
};
|
|
28768
28768
|
try {
|
|
28769
28769
|
mkdirSync19(join40(backup, "dev"), { recursive: true });
|
|
@@ -28779,24 +28779,24 @@ async function runTemplateTrim(req, deps) {
|
|
|
28779
28779
|
return abort("the trim failed while writing", e2);
|
|
28780
28780
|
}
|
|
28781
28781
|
let failure;
|
|
28782
|
-
let
|
|
28782
|
+
let validate5;
|
|
28783
28783
|
try {
|
|
28784
28784
|
const written = parseApp(readFileSync39(devPath, "utf8"), readFileSync39(configPath, "utf8"));
|
|
28785
28785
|
const leftovers = leftoverNavRefs(written.nav.value, plan.removedIds);
|
|
28786
28786
|
if (leftovers.length) failure = { error: "navigation still names screens this trim removed", leftovers };
|
|
28787
28787
|
else {
|
|
28788
|
-
|
|
28789
|
-
if (
|
|
28788
|
+
validate5 = await deps.validate(dir);
|
|
28789
|
+
if (validate5.code !== 0) failure = { error: "himi validate --strict failed on the trimmed app" };
|
|
28790
28790
|
}
|
|
28791
28791
|
} catch (e2) {
|
|
28792
|
-
return abort("the trim could not be checked", e2,
|
|
28792
|
+
return abort("the trim could not be checked", e2, validate5);
|
|
28793
28793
|
}
|
|
28794
28794
|
let compared;
|
|
28795
|
-
if (failure &&
|
|
28795
|
+
if (failure && validate5 && validate5.code !== 0 && comparable(validate5)) {
|
|
28796
28796
|
try {
|
|
28797
28797
|
restore();
|
|
28798
28798
|
} catch (e2) {
|
|
28799
|
-
return abort(String(failure.error), e2,
|
|
28799
|
+
return abort(String(failure.error), e2, validate5);
|
|
28800
28800
|
}
|
|
28801
28801
|
let original;
|
|
28802
28802
|
try {
|
|
@@ -28804,14 +28804,14 @@ async function runTemplateTrim(req, deps) {
|
|
|
28804
28804
|
} catch {
|
|
28805
28805
|
}
|
|
28806
28806
|
if (original && comparable(original)) {
|
|
28807
|
-
compared = compareErrors(
|
|
28807
|
+
compared = compareErrors(validate5.errors ?? [], original.code === 0 ? [] : original.errors ?? []);
|
|
28808
28808
|
}
|
|
28809
28809
|
const clean2 = compared !== void 0 && compared.introduced.length === 0;
|
|
28810
28810
|
if (clean2 || req.force) {
|
|
28811
28811
|
try {
|
|
28812
28812
|
apply();
|
|
28813
28813
|
} catch (e2) {
|
|
28814
|
-
return abort("the trim failed while re-applying it after validating the untrimmed app", e2,
|
|
28814
|
+
return abort("the trim failed while re-applying it after validating the untrimmed app", e2, validate5);
|
|
28815
28815
|
}
|
|
28816
28816
|
}
|
|
28817
28817
|
if (clean2) failure = void 0;
|
|
@@ -28831,7 +28831,7 @@ async function runTemplateTrim(req, deps) {
|
|
|
28831
28831
|
code: 0,
|
|
28832
28832
|
result: {
|
|
28833
28833
|
ok: true,
|
|
28834
|
-
...base(
|
|
28834
|
+
...base(validate5),
|
|
28835
28835
|
...preExisting.length ? {
|
|
28836
28836
|
preExistingErrors: preExisting,
|
|
28837
28837
|
note: `trimmed; ${plural(preExisting.length, "error")} ${preExisting.length === 1 ? "was" : "were"} already present before trim: ${summarize2(preExisting)}`
|
|
@@ -28842,18 +28842,18 @@ async function runTemplateTrim(req, deps) {
|
|
|
28842
28842
|
if (req.force) {
|
|
28843
28843
|
return {
|
|
28844
28844
|
code: 1,
|
|
28845
|
-
result: { ok: false, ...failure, rolledBack: false, forcedKeep: true, backup: backupRel, hint: `--force kept the trimmed tree; the originals are in ${backupRel}`, ...base(
|
|
28845
|
+
result: { ok: false, ...failure, rolledBack: false, forcedKeep: true, backup: backupRel, hint: `--force kept the trimmed tree; the originals are in ${backupRel}`, ...base(validate5) }
|
|
28846
28846
|
};
|
|
28847
28847
|
}
|
|
28848
28848
|
try {
|
|
28849
28849
|
restore();
|
|
28850
28850
|
} catch (e2) {
|
|
28851
|
-
return abort(String(failure.error), e2,
|
|
28851
|
+
return abort(String(failure.error), e2, validate5);
|
|
28852
28852
|
}
|
|
28853
28853
|
dropBackup();
|
|
28854
28854
|
return {
|
|
28855
28855
|
code: 1,
|
|
28856
|
-
result: { ok: false, ...failure, rolledBack: true, hint: "nothing changed \u2014 fix what validate reports (or keep more screens) and trim again, or pass --force to keep the trimmed tree anyway", ...base(
|
|
28856
|
+
result: { ok: false, ...failure, rolledBack: true, hint: "nothing changed \u2014 fix what validate reports (or keep more screens) and trim again, or pass --force to keep the trimmed tree anyway", ...base(validate5) }
|
|
28857
28857
|
};
|
|
28858
28858
|
}
|
|
28859
28859
|
function comparable(v2) {
|
|
@@ -31066,7 +31066,7 @@ async function injectRequest(listener, request) {
|
|
|
31066
31066
|
req.headers.host ??= url.host;
|
|
31067
31067
|
if (body && body.length > 0) req.push(body);
|
|
31068
31068
|
req.push(null);
|
|
31069
|
-
return await new Promise((
|
|
31069
|
+
return await new Promise((resolve67, reject) => {
|
|
31070
31070
|
const streamed = () => {
|
|
31071
31071
|
queueMicrotask(() => {
|
|
31072
31072
|
req.emit("close");
|
|
@@ -31082,7 +31082,7 @@ async function injectRequest(listener, request) {
|
|
|
31082
31082
|
else headers2.set(name, value);
|
|
31083
31083
|
}
|
|
31084
31084
|
const bodyless = out2.status === 204 || out2.status === 304 || request.method === "HEAD";
|
|
31085
|
-
|
|
31085
|
+
resolve67(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
|
|
31086
31086
|
}, streamed);
|
|
31087
31087
|
res.on("inject-error", reject);
|
|
31088
31088
|
try {
|
|
@@ -37412,12 +37412,12 @@ function finalizeRecording(key3, rec) {
|
|
|
37412
37412
|
if (rec.finalize) return rec.finalize;
|
|
37413
37413
|
rec.finalize = (async () => {
|
|
37414
37414
|
clearTimeout(rec.autoStop);
|
|
37415
|
-
await new Promise((
|
|
37415
|
+
await new Promise((resolve67) => {
|
|
37416
37416
|
let done = false;
|
|
37417
37417
|
const finish2 = () => {
|
|
37418
37418
|
if (!done) {
|
|
37419
37419
|
done = true;
|
|
37420
|
-
|
|
37420
|
+
resolve67();
|
|
37421
37421
|
}
|
|
37422
37422
|
};
|
|
37423
37423
|
rec.child.once("close", finish2);
|
|
@@ -37528,7 +37528,7 @@ var init_preview2 = __esm({
|
|
|
37528
37528
|
DEVICE_LIST_TIMEOUT_MS = 5e3;
|
|
37529
37529
|
defaultRunner2 = {
|
|
37530
37530
|
capture(cmd, args, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
|
|
37531
|
-
return new Promise((
|
|
37531
|
+
return new Promise((resolve67, reject) => {
|
|
37532
37532
|
const child = spawn4(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
37533
37533
|
const out2 = [];
|
|
37534
37534
|
const err = [];
|
|
@@ -37550,7 +37550,7 @@ var init_preview2 = __esm({
|
|
|
37550
37550
|
child.stderr.on("data", (b2) => err.push(b2));
|
|
37551
37551
|
child.on("error", (e2) => settle(reject, e2));
|
|
37552
37552
|
child.on("close", (code) => {
|
|
37553
|
-
if (code === 0) settle(
|
|
37553
|
+
if (code === 0) settle(resolve67, Buffer.concat(out2));
|
|
37554
37554
|
else settle(reject, new Error(`${cmd} exited ${code}: ${Buffer.concat(err).toString("utf8")}`));
|
|
37555
37555
|
});
|
|
37556
37556
|
});
|
|
@@ -39905,12 +39905,12 @@ function createRicosHostSession(o2) {
|
|
|
39905
39905
|
flush() {
|
|
39906
39906
|
if (!state.ready || state.unavailable || disposed) return Promise.resolve(null);
|
|
39907
39907
|
const requestId2 = newId();
|
|
39908
|
-
return new Promise((
|
|
39908
|
+
return new Promise((resolve67) => {
|
|
39909
39909
|
const timer = t2.setTimeout(() => {
|
|
39910
39910
|
flushes.delete(requestId2);
|
|
39911
|
-
|
|
39911
|
+
resolve67(null);
|
|
39912
39912
|
}, flushMs);
|
|
39913
|
-
flushes.set(requestId2, { resolve:
|
|
39913
|
+
flushes.set(requestId2, { resolve: resolve67, timer });
|
|
39914
39914
|
o2.send({ v: 1, type: "requestContent", requestId: requestId2 });
|
|
39915
39915
|
});
|
|
39916
39916
|
},
|
|
@@ -39969,7 +39969,7 @@ async function runRicosImageUpload(o2) {
|
|
|
39969
39969
|
};
|
|
39970
39970
|
session.insertMediaPlaceholder(requestId2);
|
|
39971
39971
|
try {
|
|
39972
|
-
const entry = await new Promise((
|
|
39972
|
+
const entry = await new Promise((resolve67) => {
|
|
39973
39973
|
let done = false;
|
|
39974
39974
|
let unsub = () => {
|
|
39975
39975
|
};
|
|
@@ -39978,7 +39978,7 @@ async function runRicosImageUpload(o2) {
|
|
|
39978
39978
|
done = true;
|
|
39979
39979
|
t2.clearTimeout(timer);
|
|
39980
39980
|
queueMicrotask(() => unsub());
|
|
39981
|
-
|
|
39981
|
+
resolve67(v2);
|
|
39982
39982
|
};
|
|
39983
39983
|
const timer = t2.setTimeout(() => finish2(null), o2.timeoutMs ?? RICOS_UPLOAD_TIMEOUT_MS);
|
|
39984
39984
|
unsub = deps.subscribe(`${svc}.uploads.${requestId2}`, (v2) => {
|
|
@@ -40500,10 +40500,10 @@ async function runMediaFieldUpload(o2) {
|
|
|
40500
40500
|
}, o2.timeoutMs ?? MEDIA_FIELD_UPLOAD_TIMEOUT_MS);
|
|
40501
40501
|
const bounded2 = (p2) => {
|
|
40502
40502
|
if (expired) return Promise.reject(new Deadline());
|
|
40503
|
-
return new Promise((
|
|
40503
|
+
return new Promise((resolve67, reject) => {
|
|
40504
40504
|
const stop = () => reject(new Deadline());
|
|
40505
40505
|
onExpire.push(stop);
|
|
40506
|
-
p2.then(
|
|
40506
|
+
p2.then(resolve67, reject).finally(() => {
|
|
40507
40507
|
onExpire = onExpire.filter((f2) => f2 !== stop);
|
|
40508
40508
|
});
|
|
40509
40509
|
});
|
|
@@ -40526,7 +40526,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
40526
40526
|
const before = deps.value(urlPath);
|
|
40527
40527
|
let uploadUrl;
|
|
40528
40528
|
try {
|
|
40529
|
-
uploadUrl = await bounded2(new Promise((
|
|
40529
|
+
uploadUrl = await bounded2(new Promise((resolve67, reject) => {
|
|
40530
40530
|
let done = false;
|
|
40531
40531
|
let unsub = () => {
|
|
40532
40532
|
};
|
|
@@ -40534,7 +40534,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
40534
40534
|
if (done || typeof v2 !== "string" || v2 === "" || v2 === before) return;
|
|
40535
40535
|
done = true;
|
|
40536
40536
|
queueMicrotask(() => unsub());
|
|
40537
|
-
|
|
40537
|
+
resolve67(v2);
|
|
40538
40538
|
});
|
|
40539
40539
|
onExpire.push(() => {
|
|
40540
40540
|
if (!done) {
|
|
@@ -40549,7 +40549,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
40549
40549
|
if (typeof now === "string" && now !== "" && now !== before) {
|
|
40550
40550
|
done = true;
|
|
40551
40551
|
queueMicrotask(() => unsub());
|
|
40552
|
-
|
|
40552
|
+
resolve67(now);
|
|
40553
40553
|
return;
|
|
40554
40554
|
}
|
|
40555
40555
|
}
|
|
@@ -42703,7 +42703,7 @@ async function fetchData(url, type = "text") {
|
|
|
42703
42703
|
}
|
|
42704
42704
|
return response.text();
|
|
42705
42705
|
}
|
|
42706
|
-
return new Promise((
|
|
42706
|
+
return new Promise((resolve67, reject) => {
|
|
42707
42707
|
const request = new XMLHttpRequest();
|
|
42708
42708
|
request.open("GET", url, true);
|
|
42709
42709
|
request.responseType = type === "bytes" ? "arraybuffer" : type;
|
|
@@ -42714,14 +42714,14 @@ async function fetchData(url, type = "text") {
|
|
|
42714
42714
|
if (request.status === 200 || request.status === 0) {
|
|
42715
42715
|
switch (type) {
|
|
42716
42716
|
case "bytes":
|
|
42717
|
-
|
|
42717
|
+
resolve67(new Uint8Array(request.response));
|
|
42718
42718
|
return;
|
|
42719
42719
|
case "blob":
|
|
42720
42720
|
case "json":
|
|
42721
|
-
|
|
42721
|
+
resolve67(request.response);
|
|
42722
42722
|
return;
|
|
42723
42723
|
}
|
|
42724
|
-
|
|
42724
|
+
resolve67(request.responseText);
|
|
42725
42725
|
return;
|
|
42726
42726
|
}
|
|
42727
42727
|
reject(new Error(request.statusText));
|
|
@@ -43602,9 +43602,9 @@ function putBinaryImageMask(ctx, imgData) {
|
|
|
43602
43602
|
}
|
|
43603
43603
|
function copyCtxState(sourceCtx, destCtx) {
|
|
43604
43604
|
const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
|
|
43605
|
-
for (const
|
|
43606
|
-
if (sourceCtx[
|
|
43607
|
-
destCtx[
|
|
43605
|
+
for (const property2 of properties) {
|
|
43606
|
+
if (sourceCtx[property2] !== void 0) {
|
|
43607
|
+
destCtx[property2] = sourceCtx[property2];
|
|
43608
43608
|
}
|
|
43609
43609
|
}
|
|
43610
43610
|
if (sourceCtx.setLineDash !== void 0) {
|
|
@@ -44370,7 +44370,7 @@ var init_pdf = __esm({
|
|
|
44370
44370
|
if (isCallable(C2) && (!setPrototypeOf || isPrototypeOf(TypedArray, C2))) return C2;
|
|
44371
44371
|
throw new TypeError2(tryToString(C2) + " is not a typed array constructor");
|
|
44372
44372
|
};
|
|
44373
|
-
var exportTypedArrayMethod = function(KEY,
|
|
44373
|
+
var exportTypedArrayMethod = function(KEY, property2, forced, options) {
|
|
44374
44374
|
if (!DESCRIPTORS) return;
|
|
44375
44375
|
if (forced) for (var ARRAY in TypedArrayConstructorsList) {
|
|
44376
44376
|
var TypedArrayConstructor = globalThis2[ARRAY];
|
|
@@ -44378,16 +44378,16 @@ var init_pdf = __esm({
|
|
|
44378
44378
|
delete TypedArrayConstructor.prototype[KEY];
|
|
44379
44379
|
} catch (error) {
|
|
44380
44380
|
try {
|
|
44381
|
-
TypedArrayConstructor.prototype[KEY] =
|
|
44381
|
+
TypedArrayConstructor.prototype[KEY] = property2;
|
|
44382
44382
|
} catch (error2) {
|
|
44383
44383
|
}
|
|
44384
44384
|
}
|
|
44385
44385
|
}
|
|
44386
44386
|
if (!TypedArrayPrototype[KEY] || forced) {
|
|
44387
|
-
defineBuiltIn(TypedArrayPrototype, KEY, forced ?
|
|
44387
|
+
defineBuiltIn(TypedArrayPrototype, KEY, forced ? property2 : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property2, options);
|
|
44388
44388
|
}
|
|
44389
44389
|
};
|
|
44390
|
-
var exportTypedArrayStaticMethod = function(KEY,
|
|
44390
|
+
var exportTypedArrayStaticMethod = function(KEY, property2, forced) {
|
|
44391
44391
|
var ARRAY, TypedArrayConstructor;
|
|
44392
44392
|
if (!DESCRIPTORS) return;
|
|
44393
44393
|
if (setPrototypeOf) {
|
|
@@ -44400,7 +44400,7 @@ var init_pdf = __esm({
|
|
|
44400
44400
|
}
|
|
44401
44401
|
if (!TypedArray[KEY] || forced) {
|
|
44402
44402
|
try {
|
|
44403
|
-
return defineBuiltIn(TypedArray, KEY, forced ?
|
|
44403
|
+
return defineBuiltIn(TypedArray, KEY, forced ? property2 : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property2);
|
|
44404
44404
|
} catch (error) {
|
|
44405
44405
|
}
|
|
44406
44406
|
} else return;
|
|
@@ -44408,7 +44408,7 @@ var init_pdf = __esm({
|
|
|
44408
44408
|
for (ARRAY in TypedArrayConstructorsList) {
|
|
44409
44409
|
TypedArrayConstructor = globalThis2[ARRAY];
|
|
44410
44410
|
if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
|
|
44411
|
-
defineBuiltIn(TypedArrayConstructor, KEY,
|
|
44411
|
+
defineBuiltIn(TypedArrayConstructor, KEY, property2);
|
|
44412
44412
|
}
|
|
44413
44413
|
}
|
|
44414
44414
|
};
|
|
@@ -44636,11 +44636,11 @@ var init_pdf = __esm({
|
|
|
44636
44636
|
var DESCRIPTORS = __webpack_require__3(3724);
|
|
44637
44637
|
var definePropertyModule = __webpack_require__3(4913);
|
|
44638
44638
|
var createPropertyDescriptor = __webpack_require__3(6980);
|
|
44639
|
-
module.exports = DESCRIPTORS ? function(
|
|
44640
|
-
return definePropertyModule.f(
|
|
44641
|
-
} : function(
|
|
44642
|
-
|
|
44643
|
-
return
|
|
44639
|
+
module.exports = DESCRIPTORS ? function(object7, key3, value) {
|
|
44640
|
+
return definePropertyModule.f(object7, key3, createPropertyDescriptor(1, value));
|
|
44641
|
+
} : function(object7, key3, value) {
|
|
44642
|
+
object7[key3] = value;
|
|
44643
|
+
return object7;
|
|
44644
44644
|
};
|
|
44645
44645
|
},
|
|
44646
44646
|
/***/
|
|
@@ -44659,9 +44659,9 @@ var init_pdf = __esm({
|
|
|
44659
44659
|
var DESCRIPTORS = __webpack_require__3(3724);
|
|
44660
44660
|
var definePropertyModule = __webpack_require__3(4913);
|
|
44661
44661
|
var createPropertyDescriptor = __webpack_require__3(6980);
|
|
44662
|
-
module.exports = function(
|
|
44663
|
-
if (DESCRIPTORS) definePropertyModule.f(
|
|
44664
|
-
else
|
|
44662
|
+
module.exports = function(object7, key3, value) {
|
|
44663
|
+
if (DESCRIPTORS) definePropertyModule.f(object7, key3, createPropertyDescriptor(0, value));
|
|
44664
|
+
else object7[key3] = value;
|
|
44665
44665
|
};
|
|
44666
44666
|
},
|
|
44667
44667
|
/***/
|
|
@@ -44951,9 +44951,9 @@ var init_pdf = __esm({
|
|
|
44951
44951
|
6706(module, __unused_webpack_exports, __webpack_require__3) {
|
|
44952
44952
|
var uncurryThis = __webpack_require__3(9504);
|
|
44953
44953
|
var aCallable = __webpack_require__3(9306);
|
|
44954
|
-
module.exports = function(
|
|
44954
|
+
module.exports = function(object7, key3, method) {
|
|
44955
44955
|
try {
|
|
44956
|
-
return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(
|
|
44956
|
+
return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object7, key3)[method]));
|
|
44957
44957
|
} catch (error) {
|
|
44958
44958
|
}
|
|
44959
44959
|
};
|
|
@@ -45653,7 +45653,7 @@ var init_pdf = __esm({
|
|
|
45653
45653
|
var defineProperty = Object.defineProperty;
|
|
45654
45654
|
var stringSlice = uncurryThis("".slice);
|
|
45655
45655
|
var replace = uncurryThis("".replace);
|
|
45656
|
-
var
|
|
45656
|
+
var join96 = uncurryThis([].join);
|
|
45657
45657
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
45658
45658
|
return defineProperty(function() {
|
|
45659
45659
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -45680,7 +45680,7 @@ var init_pdf = __esm({
|
|
|
45680
45680
|
}
|
|
45681
45681
|
var state = enforceInternalState(value);
|
|
45682
45682
|
if (!hasOwn(state, "source")) {
|
|
45683
|
-
state.source =
|
|
45683
|
+
state.source = join96(TEMPLATE, typeof name == "string" ? name : "");
|
|
45684
45684
|
}
|
|
45685
45685
|
return value;
|
|
45686
45686
|
};
|
|
@@ -45725,13 +45725,13 @@ var init_pdf = __esm({
|
|
|
45725
45725
|
var aCallable = __webpack_require__3(9306);
|
|
45726
45726
|
var $TypeError = TypeError;
|
|
45727
45727
|
var PromiseCapability = function(C2) {
|
|
45728
|
-
var
|
|
45728
|
+
var resolve67, reject;
|
|
45729
45729
|
this.promise = new C2(function($$resolve, $$reject) {
|
|
45730
|
-
if (
|
|
45731
|
-
|
|
45730
|
+
if (resolve67 !== void 0 || reject !== void 0) throw new $TypeError("Bad Promise constructor");
|
|
45731
|
+
resolve67 = $$resolve;
|
|
45732
45732
|
reject = $$reject;
|
|
45733
45733
|
});
|
|
45734
|
-
this.resolve = aCallable(
|
|
45734
|
+
this.resolve = aCallable(resolve67);
|
|
45735
45735
|
this.reject = aCallable(reject);
|
|
45736
45736
|
};
|
|
45737
45737
|
module.exports.f = function(C2) {
|
|
@@ -45921,13 +45921,13 @@ var init_pdf = __esm({
|
|
|
45921
45921
|
var $Object = Object;
|
|
45922
45922
|
var ObjectPrototype = $Object.prototype;
|
|
45923
45923
|
module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function(O2) {
|
|
45924
|
-
var
|
|
45925
|
-
if (hasOwn(
|
|
45926
|
-
var constructor =
|
|
45927
|
-
if (isCallable(constructor) &&
|
|
45924
|
+
var object7 = toObject(O2);
|
|
45925
|
+
if (hasOwn(object7, IE_PROTO)) return object7[IE_PROTO];
|
|
45926
|
+
var constructor = object7.constructor;
|
|
45927
|
+
if (isCallable(constructor) && object7 instanceof constructor) {
|
|
45928
45928
|
return constructor.prototype;
|
|
45929
45929
|
}
|
|
45930
|
-
return
|
|
45930
|
+
return object7 instanceof $Object ? ObjectPrototype : null;
|
|
45931
45931
|
};
|
|
45932
45932
|
},
|
|
45933
45933
|
/***/
|
|
@@ -45943,8 +45943,8 @@ var init_pdf = __esm({
|
|
|
45943
45943
|
var indexOf = __webpack_require__3(9617).indexOf;
|
|
45944
45944
|
var hiddenKeys = __webpack_require__3(421);
|
|
45945
45945
|
var push = uncurryThis([].push);
|
|
45946
|
-
module.exports = function(
|
|
45947
|
-
var O2 = toIndexedObject(
|
|
45946
|
+
module.exports = function(object7, names2) {
|
|
45947
|
+
var O2 = toIndexedObject(object7);
|
|
45948
45948
|
var i2 = 0;
|
|
45949
45949
|
var result = [];
|
|
45950
45950
|
var key3;
|
|
@@ -46099,8 +46099,8 @@ var init_pdf = __esm({
|
|
|
46099
46099
|
anObject(C2);
|
|
46100
46100
|
if (isObject3(x2) && x2.constructor === C2) return x2;
|
|
46101
46101
|
var promiseCapability = newPromiseCapability.f(C2);
|
|
46102
|
-
var
|
|
46103
|
-
|
|
46102
|
+
var resolve67 = promiseCapability.resolve;
|
|
46103
|
+
resolve67(x2);
|
|
46104
46104
|
return promiseCapability.promise;
|
|
46105
46105
|
};
|
|
46106
46106
|
},
|
|
@@ -47387,13 +47387,13 @@ var init_pdf = __esm({
|
|
|
47387
47387
|
}
|
|
47388
47388
|
return call(reviver, holder, name, val, context);
|
|
47389
47389
|
};
|
|
47390
|
-
var internalizeProperty = function(
|
|
47390
|
+
var internalizeProperty = function(object7, key3, value) {
|
|
47391
47391
|
if (DESCRIPTORS) {
|
|
47392
|
-
var descriptor = getOwnPropertyDescriptor(
|
|
47392
|
+
var descriptor = getOwnPropertyDescriptor(object7, key3);
|
|
47393
47393
|
if (descriptor && !descriptor.configurable) return;
|
|
47394
47394
|
}
|
|
47395
|
-
if (value === void 0) delete
|
|
47396
|
-
else createProperty(
|
|
47395
|
+
if (value === void 0) delete object7[key3];
|
|
47396
|
+
else createProperty(object7, key3, value);
|
|
47397
47397
|
};
|
|
47398
47398
|
var Node2 = function(value, end, source, nodes) {
|
|
47399
47399
|
this.value = value;
|
|
@@ -47438,7 +47438,7 @@ var init_pdf = __esm({
|
|
|
47438
47438
|
var source = this.source;
|
|
47439
47439
|
var i2 = this.index + 1;
|
|
47440
47440
|
var expectKeypair = false;
|
|
47441
|
-
var
|
|
47441
|
+
var object7 = {};
|
|
47442
47442
|
var nodes = {};
|
|
47443
47443
|
var closed = false;
|
|
47444
47444
|
while (i2 < source.length) {
|
|
@@ -47455,7 +47455,7 @@ var init_pdf = __esm({
|
|
|
47455
47455
|
i2 = this.skip(IS_WHITESPACE, i2);
|
|
47456
47456
|
result = this.fork(i2).parse();
|
|
47457
47457
|
createProperty(nodes, key3, result);
|
|
47458
|
-
createProperty(
|
|
47458
|
+
createProperty(object7, key3, result.value);
|
|
47459
47459
|
i2 = this.until([",", "}"], result.end);
|
|
47460
47460
|
var chr = at2(source, i2);
|
|
47461
47461
|
if (chr === ",") {
|
|
@@ -47468,7 +47468,7 @@ var init_pdf = __esm({
|
|
|
47468
47468
|
}
|
|
47469
47469
|
}
|
|
47470
47470
|
if (!closed) throw new SyntaxError2("Unterminated object at: " + i2);
|
|
47471
|
-
return this.node(OBJECT,
|
|
47471
|
+
return this.node(OBJECT, object7, this.index, i2, nodes);
|
|
47472
47472
|
},
|
|
47473
47473
|
array: function() {
|
|
47474
47474
|
var source = this.source;
|
|
@@ -48203,7 +48203,7 @@ var init_pdf = __esm({
|
|
|
48203
48203
|
var charAt = uncurryThis("".charAt);
|
|
48204
48204
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
48205
48205
|
var $Array = globalThis2.Array;
|
|
48206
|
-
var
|
|
48206
|
+
var join96 = uncurryThis([].join);
|
|
48207
48207
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
48208
48208
|
try {
|
|
48209
48209
|
var target = new Uint8Array2();
|
|
@@ -48249,7 +48249,7 @@ var init_pdf = __esm({
|
|
|
48249
48249
|
result[written++] = "=";
|
|
48250
48250
|
}
|
|
48251
48251
|
}
|
|
48252
|
-
return
|
|
48252
|
+
return join96(result, "");
|
|
48253
48253
|
}
|
|
48254
48254
|
});
|
|
48255
48255
|
},
|
|
@@ -48261,7 +48261,7 @@ var init_pdf = __esm({
|
|
|
48261
48261
|
var anUint8Array = __webpack_require__3(4154);
|
|
48262
48262
|
var notDetached = __webpack_require__3(5169);
|
|
48263
48263
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
48264
|
-
var
|
|
48264
|
+
var join96 = uncurryThis([].join);
|
|
48265
48265
|
var $Array = Array;
|
|
48266
48266
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
48267
48267
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -48281,7 +48281,7 @@ var init_pdf = __esm({
|
|
|
48281
48281
|
var hex2 = numberToString2(this[i2], 16);
|
|
48282
48282
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
48283
48283
|
}
|
|
48284
|
-
return
|
|
48284
|
+
return join96(result, "");
|
|
48285
48285
|
}
|
|
48286
48286
|
});
|
|
48287
48287
|
},
|
|
@@ -49954,11 +49954,11 @@ var init_pdf = __esm({
|
|
|
49954
49954
|
const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
|
|
49955
49955
|
const fileReader = new FileReader();
|
|
49956
49956
|
const imageElement = new Image();
|
|
49957
|
-
const imagePromise = new Promise((
|
|
49957
|
+
const imagePromise = new Promise((resolve67, reject) => {
|
|
49958
49958
|
imageElement.onload = () => {
|
|
49959
49959
|
data.bitmap = imageElement;
|
|
49960
49960
|
data.isSvg = true;
|
|
49961
|
-
|
|
49961
|
+
resolve67();
|
|
49962
49962
|
};
|
|
49963
49963
|
fileReader.onload = async () => {
|
|
49964
49964
|
const url = data.svgUrl = fileReader.result;
|
|
@@ -50644,13 +50644,13 @@ var init_pdf = __esm({
|
|
|
50644
50644
|
return;
|
|
50645
50645
|
}
|
|
50646
50646
|
const {
|
|
50647
|
-
resolve:
|
|
50647
|
+
resolve: resolve67,
|
|
50648
50648
|
promise
|
|
50649
50649
|
} = Promise.withResolvers();
|
|
50650
50650
|
const onEditorsRendered = (evt) => {
|
|
50651
50651
|
if (evt.pageNumber === pageNumber) {
|
|
50652
50652
|
this._eventBus.off("editorsrendered", onEditorsRendered);
|
|
50653
|
-
|
|
50653
|
+
resolve67();
|
|
50654
50654
|
}
|
|
50655
50655
|
};
|
|
50656
50656
|
this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
|
|
@@ -55688,8 +55688,8 @@ var init_pdf = __esm({
|
|
|
55688
55688
|
if (this.isSyncFontLoadingSupported) {
|
|
55689
55689
|
return;
|
|
55690
55690
|
}
|
|
55691
|
-
await new Promise((
|
|
55692
|
-
const request = this._queueLoadingCallback(
|
|
55691
|
+
await new Promise((resolve67) => {
|
|
55692
|
+
const request = this._queueLoadingCallback(resolve67);
|
|
55693
55693
|
this._prepareFontLoadEvent(font, request);
|
|
55694
55694
|
});
|
|
55695
55695
|
}
|
|
@@ -72729,7 +72729,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
72729
72729
|
input.type = "file";
|
|
72730
72730
|
input.accept = SupportedImageMimeTypes.join(",");
|
|
72731
72731
|
const signal = this._uiManager._signal;
|
|
72732
|
-
this.#bitmapPromise = new Promise((
|
|
72732
|
+
this.#bitmapPromise = new Promise((resolve67) => {
|
|
72733
72733
|
input.addEventListener("change", async () => {
|
|
72734
72734
|
if (!input.files || input.files.length === 0) {
|
|
72735
72735
|
this.remove();
|
|
@@ -72744,13 +72744,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
72744
72744
|
});
|
|
72745
72745
|
this.#getBitmapFetched(data);
|
|
72746
72746
|
}
|
|
72747
|
-
|
|
72747
|
+
resolve67();
|
|
72748
72748
|
}, {
|
|
72749
72749
|
signal
|
|
72750
72750
|
});
|
|
72751
72751
|
input.addEventListener("cancel", () => {
|
|
72752
72752
|
this.remove();
|
|
72753
|
-
|
|
72753
|
+
resolve67();
|
|
72754
72754
|
}, {
|
|
72755
72755
|
signal
|
|
72756
72756
|
});
|
|
@@ -120374,14 +120374,14 @@ var init_pdf_worker_min = __esm({
|
|
|
120374
120374
|
}
|
|
120375
120375
|
get fingerprints() {
|
|
120376
120376
|
const e2 = "\0".repeat(16);
|
|
120377
|
-
function
|
|
120377
|
+
function validate5(t3) {
|
|
120378
120378
|
return "string" == typeof t3 && 16 === t3.length && t3 !== e2;
|
|
120379
120379
|
}
|
|
120380
120380
|
const t2 = this.xref.trailer.get("ID");
|
|
120381
120381
|
let n2, a2;
|
|
120382
|
-
if (Array.isArray(t2) &&
|
|
120382
|
+
if (Array.isArray(t2) && validate5(t2[0])) {
|
|
120383
120383
|
n2 = stringToBytes2(t2[0]);
|
|
120384
|
-
t2[1] !== t2[0] &&
|
|
120384
|
+
t2[1] !== t2[0] && validate5(t2[1]) && (a2 = stringToBytes2(t2[1]));
|
|
120385
120385
|
} else n2 = calculateMD5(this.stream.getByteRange(0, 1024), 0, 1024);
|
|
120386
120386
|
return shadow2(this, "fingerprints", [n2.toHex(), a2?.toHex() ?? null]);
|
|
120387
120387
|
}
|
|
@@ -128669,13 +128669,13 @@ var init_renderNode = __esm({
|
|
|
128669
128669
|
const hasIcon2 = typeof props.icon === "string" ? props.icon.length > 0 : props.icon != null;
|
|
128670
128670
|
const hasSubtitle = subtitleText.trim().length > 0;
|
|
128671
128671
|
const label3 = props.actionLabel;
|
|
128672
|
-
const
|
|
128672
|
+
const hasAction2 = props.action != null && typeof label3 === "string" && label3.trim().length > 0;
|
|
128673
128673
|
const padding = spacingToken(ctx, EMPTY_STATE_SPACING.padding);
|
|
128674
128674
|
return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", width: "100%", padding, boxSizing: "border-box", ...wrap }, children: [
|
|
128675
128675
|
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 }) }),
|
|
128676
128676
|
/* @__PURE__ */ jsx10("div", { "data-empty-state-part": "title", style: { ...fontCss(titleFont), color: C2("textPrimary", "#111"), marginTop: hasIcon2 ? spacingToken(ctx, EMPTY_STATE_SPACING.iconGap) : 0, overflowWrap: "anywhere" }, children: txt(props.title, ctx) }),
|
|
128677
128677
|
hasSubtitle && /* @__PURE__ */ jsx10("div", { "data-empty-state-part": "subtitle", style: { ...fontCss(subtitleFont), color: C2("textSecondary", "#888"), marginTop: spacingToken(ctx, EMPTY_STATE_SPACING.subtitleGap), overflowWrap: "anywhere" }, children: isBinding(props.subtitle) ? subtitleText : txt(props.subtitle, ctx) }),
|
|
128678
|
-
|
|
128678
|
+
hasAction2 && /* @__PURE__ */ jsx10("div", { "data-empty-state-part": "action", style: { marginTop: spacingToken(ctx, EMPTY_STATE_SPACING.actionGap), display: "flex", justifyContent: "center" }, children: renderNode({
|
|
128679
128679
|
id: `${nodeId ?? "empty_state"}.action`,
|
|
128680
128680
|
body: {
|
|
128681
128681
|
package: "himalaya",
|
|
@@ -131533,13 +131533,13 @@ __export(render_descriptor_exports, {
|
|
|
131533
131533
|
stabilizePngPage: () => stabilizePngPage,
|
|
131534
131534
|
withRetry: () => withRetry2
|
|
131535
131535
|
});
|
|
131536
|
-
function a11ySemantics(type, props, modifiers, ancestorHidden,
|
|
131536
|
+
function a11ySemantics(type, props, modifiers, ancestorHidden, resolve67) {
|
|
131537
131537
|
if (!A11Y_MODIFIER_KEYS.some((k2) => modifiers[k2] !== void 0)) return void 0;
|
|
131538
131538
|
const literal = (v2) => typeof v2 === "string" && v2.trim() !== "" && !isDynamicValue(v2) ? v2 : void 0;
|
|
131539
131539
|
const spoken = (v2) => {
|
|
131540
131540
|
const lit = literal(v2);
|
|
131541
|
-
if (lit !== void 0 || !
|
|
131542
|
-
const r2 =
|
|
131541
|
+
if (lit !== void 0 || !resolve67 || typeof v2 !== "string" || !isDynamicValue(v2)) return lit;
|
|
131542
|
+
const r2 = resolve67(v2);
|
|
131543
131543
|
if (r2 === v2) return void 0;
|
|
131544
131544
|
return typeof r2 === "string" && r2.trim() !== "" ? r2 : typeof r2 === "number" ? String(r2) : void 0;
|
|
131545
131545
|
};
|
|
@@ -131553,7 +131553,7 @@ function a11ySemantics(type, props, modifiers, ancestorHidden, resolve66) {
|
|
|
131553
131553
|
if (name !== void 0 && exposure === "exposed") out2.name = name;
|
|
131554
131554
|
const hint = spoken(modifiers.accessibilityHint);
|
|
131555
131555
|
if (hint !== void 0) out2.hint = hint;
|
|
131556
|
-
const value = spoken(modifiers.accessibilityValue) ?? controlState(role, props,
|
|
131556
|
+
const value = spoken(modifiers.accessibilityValue) ?? controlState(role, props, resolve67);
|
|
131557
131557
|
if (value !== void 0) out2.value = value;
|
|
131558
131558
|
if (typeof modifiers.headingLevel === "number") out2.headingLevel = modifiers.headingLevel;
|
|
131559
131559
|
if (exposure !== "exposed") out2.exposure = exposure;
|
|
@@ -131574,13 +131574,13 @@ function a11ySemantics(type, props, modifiers, ancestorHidden, resolve66) {
|
|
|
131574
131574
|
}
|
|
131575
131575
|
return out2;
|
|
131576
131576
|
}
|
|
131577
|
-
function controlState(role, props,
|
|
131577
|
+
function controlState(role, props, resolve67) {
|
|
131578
131578
|
if (role !== "toggle" && role !== "checkbox" && role !== "radio") return void 0;
|
|
131579
131579
|
if (role === "checkbox" && props.indeterminate === true) return "mixed";
|
|
131580
131580
|
const binding2 = typeof props.valuePath === "string" ? props.valuePath : typeof props.value === "string" && isDynamicValue(props.value) ? props.value : void 0;
|
|
131581
131581
|
let on4;
|
|
131582
131582
|
if (binding2 !== void 0) {
|
|
131583
|
-
const v2 =
|
|
131583
|
+
const v2 = resolve67 ? resolve67(binding2) : void 0;
|
|
131584
131584
|
if (v2 === true || v2 === 1 || v2 === "true" || v2 === "1") on4 = true;
|
|
131585
131585
|
else if (v2 === false || v2 === 0 || v2 === "false" || v2 === "0") on4 = false;
|
|
131586
131586
|
else return void 0;
|
|
@@ -131916,7 +131916,7 @@ async function stabilizePngPage(page, scheme) {
|
|
|
131916
131916
|
const browser = globalThis;
|
|
131917
131917
|
browser.document.documentElement.style.colorScheme = selected;
|
|
131918
131918
|
await browser.document.fonts?.ready;
|
|
131919
|
-
await new Promise((
|
|
131919
|
+
await new Promise((resolve67) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve67())));
|
|
131920
131920
|
}, scheme);
|
|
131921
131921
|
}
|
|
131922
131922
|
function setPngEgress(start) {
|
|
@@ -132093,7 +132093,7 @@ async function resolveEgress(host, port, allow = allowedOrigins) {
|
|
|
132093
132093
|
return addrs.every((a2) => isPublicAddress(a2.address)) ? addrs : null;
|
|
132094
132094
|
}
|
|
132095
132095
|
function connectFirst(addrs, port, track) {
|
|
132096
|
-
return new Promise((
|
|
132096
|
+
return new Promise((resolve67, reject) => {
|
|
132097
132097
|
const tryAt = (i2) => {
|
|
132098
132098
|
if (i2 >= addrs.length) return reject(new Error("no address answered"));
|
|
132099
132099
|
const s2 = net.connect({ host: addrs[i2].address, family: addrs[i2].family, port });
|
|
@@ -132107,7 +132107,7 @@ function connectFirst(addrs, port, track) {
|
|
|
132107
132107
|
s2.once("connect", () => {
|
|
132108
132108
|
s2.off("error", onFail);
|
|
132109
132109
|
s2.setTimeout(0);
|
|
132110
|
-
|
|
132110
|
+
resolve67(s2);
|
|
132111
132111
|
});
|
|
132112
132112
|
};
|
|
132113
132113
|
tryAt(0);
|
|
@@ -132213,16 +132213,16 @@ async function startEgressProxy() {
|
|
|
132213
132213
|
upstream.pipe(socket);
|
|
132214
132214
|
socket.pipe(upstream);
|
|
132215
132215
|
});
|
|
132216
|
-
await new Promise((
|
|
132216
|
+
await new Promise((resolve67, reject) => {
|
|
132217
132217
|
server.once("error", reject);
|
|
132218
|
-
server.listen(0, "127.0.0.1", () =>
|
|
132218
|
+
server.listen(0, "127.0.0.1", () => resolve67());
|
|
132219
132219
|
});
|
|
132220
132220
|
const { port } = server.address();
|
|
132221
132221
|
return {
|
|
132222
132222
|
url: `http://127.0.0.1:${port}`,
|
|
132223
132223
|
blocked,
|
|
132224
|
-
close: () => new Promise((
|
|
132225
|
-
server.close(() =>
|
|
132224
|
+
close: () => new Promise((resolve67) => {
|
|
132225
|
+
server.close(() => resolve67());
|
|
132226
132226
|
for (const s2 of sockets) s2.destroy();
|
|
132227
132227
|
server.closeAllConnections?.();
|
|
132228
132228
|
})
|
|
@@ -134795,14 +134795,14 @@ async function pipeWebWixStream(upstream, res, signal, recordStream) {
|
|
|
134795
134795
|
const chunk = await reader.read();
|
|
134796
134796
|
if (chunk.done) break;
|
|
134797
134797
|
if (chunk.value && !res.write(chunk.value)) {
|
|
134798
|
-
await new Promise((
|
|
134798
|
+
await new Promise((resolve67) => {
|
|
134799
134799
|
let settled = false;
|
|
134800
134800
|
const finish2 = () => {
|
|
134801
134801
|
if (settled) return;
|
|
134802
134802
|
settled = true;
|
|
134803
134803
|
res.off("drain", finish2);
|
|
134804
134804
|
res.off("close", finish2);
|
|
134805
|
-
|
|
134805
|
+
resolve67();
|
|
134806
134806
|
};
|
|
134807
134807
|
if (res.destroyed || !res.writable) finish2();
|
|
134808
134808
|
else {
|
|
@@ -134818,7 +134818,7 @@ async function handleWebWix(req, res, state) {
|
|
|
134818
134818
|
const session = webWixSession(req, res, state);
|
|
134819
134819
|
const auth = resolveWebWixAuth(state.app);
|
|
134820
134820
|
const path2 = new URL(req.url ?? "", "http://localhost").pathname;
|
|
134821
|
-
const
|
|
134821
|
+
const readJson10 = async () => {
|
|
134822
134822
|
const chunks = [];
|
|
134823
134823
|
for await (const c2 of req) chunks.push(c2);
|
|
134824
134824
|
const t2 = Buffer.concat(chunks).toString("utf8");
|
|
@@ -134835,7 +134835,7 @@ async function handleWebWix(req, res, state) {
|
|
|
134835
134835
|
res.end(JSON.stringify(obj4));
|
|
134836
134836
|
};
|
|
134837
134837
|
if (path2 === "/v1/__webwix/stream" && req.method === "POST") {
|
|
134838
|
-
const b2 = await
|
|
134838
|
+
const b2 = await readJson10();
|
|
134839
134839
|
const method = String(b2.method ?? "GET").toUpperCase();
|
|
134840
134840
|
const requestedUrl = String(b2.url ?? "");
|
|
134841
134841
|
const body = b2.body === void 0 ? void 0 : typeof b2.body === "string" ? b2.body : JSON.stringify(b2.body);
|
|
@@ -134890,7 +134890,7 @@ async function handleWebWix(req, res, state) {
|
|
|
134890
134890
|
}
|
|
134891
134891
|
if (match) {
|
|
134892
134892
|
const mocked = match.rule.response;
|
|
134893
|
-
if (mocked.delayMs) await new Promise((
|
|
134893
|
+
if (mocked.delayMs) await new Promise((resolve67) => setTimeout(resolve67, mocked.delayMs));
|
|
134894
134894
|
const payload = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
134895
134895
|
recordStream("mock", mocked.status, match.rule.id, mocked.headers);
|
|
134896
134896
|
res.statusCode = mocked.status;
|
|
@@ -134984,7 +134984,7 @@ async function handleWebWix(req, res, state) {
|
|
|
134984
134984
|
return;
|
|
134985
134985
|
}
|
|
134986
134986
|
if (path2 === "/v1/__webwix/login" && req.method === "POST") {
|
|
134987
|
-
const b2 = await
|
|
134987
|
+
const b2 = await readJson10();
|
|
134988
134988
|
try {
|
|
134989
134989
|
const { memberToken, visitorToken } = await memberDirectLogin(
|
|
134990
134990
|
auth.clientId,
|
|
@@ -135077,7 +135077,7 @@ async function handleWebWix(req, res, state) {
|
|
|
135077
135077
|
res.setHeader("cache-control", "no-store");
|
|
135078
135078
|
const account = session.account;
|
|
135079
135079
|
if (!account) return reply(401, { error: "webwix_account_signed_out" });
|
|
135080
|
-
const metaSiteId = String((await
|
|
135080
|
+
const metaSiteId = String((await readJson10()).metaSiteId ?? "").trim();
|
|
135081
135081
|
if (!isSafeMsid(metaSiteId)) return reply(400, { error: "webwix_account_bad_site_id" });
|
|
135082
135082
|
if (sealedAccountRoute) return sealedRefusal(MEMBER_SESSION_URL, "POST");
|
|
135083
135083
|
try {
|
|
@@ -135098,7 +135098,7 @@ async function handleWebWix(req, res, state) {
|
|
|
135098
135098
|
if (!accountApp) return reply(404, { error: "webwix_account_unsupported" });
|
|
135099
135099
|
if (req.method !== "POST") return reply(405, { error: "method_not_allowed" });
|
|
135100
135100
|
res.setHeader("cache-control", "no-store");
|
|
135101
|
-
const shortId = String((await
|
|
135101
|
+
const shortId = String((await readJson10()).shortId ?? "").trim();
|
|
135102
135102
|
const start = inviteShortLinkUrl(shortId);
|
|
135103
135103
|
if (!start) return reply(400, { error: "webwix_short_link_bad_id" });
|
|
135104
135104
|
if (sealedAccountRoute) return sealedRefusal(start, "GET");
|
|
@@ -135107,7 +135107,7 @@ async function handleWebWix(req, res, state) {
|
|
|
135107
135107
|
return url ? reply(200, { url }) : reply(404, { error: "webwix_short_link_unresolved" });
|
|
135108
135108
|
}
|
|
135109
135109
|
if (path2 === "/v1/__webwix/call" && req.method === "POST") {
|
|
135110
|
-
const b2 = await
|
|
135110
|
+
const b2 = await readJson10();
|
|
135111
135111
|
const ownerRung = b2.ownerMsid !== void 0 || b2.checkOwnerSession === true;
|
|
135112
135112
|
const accountRung = !ownerRung && accountApp && !!session.account;
|
|
135113
135113
|
const msid = String(b2.ownerMsid ?? "");
|
|
@@ -135170,7 +135170,7 @@ async function handleWebWix(req, res, state) {
|
|
|
135170
135170
|
}
|
|
135171
135171
|
if (match) {
|
|
135172
135172
|
const mocked = match.rule.response;
|
|
135173
|
-
if (mocked.delayMs) await new Promise((
|
|
135173
|
+
if (mocked.delayMs) await new Promise((resolve67) => setTimeout(resolve67, mocked.delayMs));
|
|
135174
135174
|
const responseBody = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
135175
135175
|
record2("mock", mocked.status, responseBody, match.rule.id, mocked.headers);
|
|
135176
135176
|
return reply(200, { status: mocked.status, body: responseBody ?? "" });
|
|
@@ -135300,7 +135300,7 @@ async function handleWebWix(req, res, state) {
|
|
|
135300
135300
|
});
|
|
135301
135301
|
}
|
|
135302
135302
|
if (path2 === "/v1/__webwix/register" && req.method === "POST") {
|
|
135303
|
-
const b2 = await
|
|
135303
|
+
const b2 = await readJson10();
|
|
135304
135304
|
try {
|
|
135305
135305
|
const { memberToken, visitorToken } = await memberDirectRegister(
|
|
135306
135306
|
auth.clientId,
|
|
@@ -137017,8 +137017,8 @@ function sha256hex(b2) {
|
|
|
137017
137017
|
function stableStringify(value) {
|
|
137018
137018
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
137019
137019
|
if (Array.isArray(value)) return "[" + value.map(stableStringify).join(",") + "]";
|
|
137020
|
-
const
|
|
137021
|
-
return "{" + Object.keys(
|
|
137020
|
+
const object7 = value;
|
|
137021
|
+
return "{" + Object.keys(object7).sort().map((key3) => JSON.stringify(key3) + ":" + stableStringify(object7[key3])).join(",") + "}";
|
|
137022
137022
|
}
|
|
137023
137023
|
function manifestContent(m2) {
|
|
137024
137024
|
const {
|
|
@@ -137508,12 +137508,12 @@ var init_query = __esm({
|
|
|
137508
137508
|
});
|
|
137509
137509
|
|
|
137510
137510
|
// ../../core/dev-server/src/crawl-input.ts
|
|
137511
|
-
function resolved(v2,
|
|
137512
|
-
if (typeof v2 === "string") return v2.startsWith("$service:") ?
|
|
137511
|
+
function resolved(v2, resolve67) {
|
|
137512
|
+
if (typeof v2 === "string") return v2.startsWith("$service:") ? resolve67(v2) : v2;
|
|
137513
137513
|
if (Array.isArray(v2)) {
|
|
137514
137514
|
const out2 = v2.flatMap((el2) => {
|
|
137515
137515
|
if (typeof el2 !== "string" || !el2.startsWith("$service:")) return [el2];
|
|
137516
|
-
const r2 =
|
|
137516
|
+
const r2 = resolve67(el2);
|
|
137517
137517
|
return Array.isArray(r2) ? r2 : [r2];
|
|
137518
137518
|
});
|
|
137519
137519
|
return out2;
|
|
@@ -137527,9 +137527,9 @@ function hasRowBinding(props) {
|
|
|
137527
137527
|
return itemToken(v2) || Array.isArray(v2) && v2.some(itemToken);
|
|
137528
137528
|
});
|
|
137529
137529
|
}
|
|
137530
|
-
function declaredOptionIds(props,
|
|
137530
|
+
function declaredOptionIds(props, resolve67) {
|
|
137531
137531
|
const literal = props.options ?? props.tabs ?? props.chips;
|
|
137532
|
-
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath,
|
|
137532
|
+
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath, resolve67) : void 0;
|
|
137533
137533
|
const raw = Array.isArray(bound) ? bound : literal;
|
|
137534
137534
|
if (!Array.isArray(raw)) return [];
|
|
137535
137535
|
const out2 = [];
|
|
@@ -137572,24 +137572,24 @@ function seedTokens(state, limit = 48) {
|
|
|
137572
137572
|
walk2(state, 0);
|
|
137573
137573
|
return out2;
|
|
137574
137574
|
}
|
|
137575
|
-
function synthesizeInput(control,
|
|
137575
|
+
function synthesizeInput(control, resolve67, tokens2) {
|
|
137576
137576
|
const id = `${control.type}.${control.callback}`;
|
|
137577
137577
|
const row = SYNTHESIZED_CONTROLS[id];
|
|
137578
137578
|
if (!row) return null;
|
|
137579
137579
|
const props = control.props;
|
|
137580
137580
|
if (hasRowBinding(props)) return null;
|
|
137581
137581
|
if (row.from === "declared-options") {
|
|
137582
|
-
const ids = declaredOptionIds(props,
|
|
137582
|
+
const ids = declaredOptionIds(props, resolve67);
|
|
137583
137583
|
if (!ids.length) return null;
|
|
137584
137584
|
if (row.encoding === "string-array") {
|
|
137585
|
-
const currentRaw2 = resolved(props.selectedIds,
|
|
137585
|
+
const currentRaw2 = resolved(props.selectedIds, resolve67);
|
|
137586
137586
|
const current3 = (Array.isArray(currentRaw2) ? currentRaw2 : []).filter((x2) => typeof x2 === "string");
|
|
137587
137587
|
const pick5 = ids.find((o2) => !current3.includes(o2));
|
|
137588
137588
|
if (pick5 === void 0) return null;
|
|
137589
137589
|
const value = props.multiSelect === true ? [...current3, pick5] : [pick5];
|
|
137590
137590
|
return { key: row.key, value, from: row.from, current: current3, control: id };
|
|
137591
137591
|
}
|
|
137592
|
-
const currentRaw = resolved(props.selectedId,
|
|
137592
|
+
const currentRaw = resolved(props.selectedId, resolve67);
|
|
137593
137593
|
const current2 = typeof currentRaw === "string" ? currentRaw : void 0;
|
|
137594
137594
|
const pick4 = ids.find((o2) => o2 !== current2);
|
|
137595
137595
|
if (pick4 === void 0) return null;
|
|
@@ -137597,7 +137597,7 @@ function synthesizeInput(control, resolve66, tokens2) {
|
|
|
137597
137597
|
}
|
|
137598
137598
|
if (!acceptsWords(props) || !acceptsWords(control.wrapper ?? {})) return null;
|
|
137599
137599
|
const binding2 = typeof props.valuePath === "string" ? props.valuePath : typeof props.value === "string" && props.value.startsWith("$service:") ? props.value : void 0;
|
|
137600
|
-
const bound = binding2 === void 0 ? void 0 :
|
|
137600
|
+
const bound = binding2 === void 0 ? void 0 : resolve67(binding2);
|
|
137601
137601
|
const literal = typeof props.value === "string" && !props.value.startsWith("$") ? props.value : void 0;
|
|
137602
137602
|
const current = typeof bound === "string" ? bound : typeof bound === "number" ? String(bound) : literal ?? "";
|
|
137603
137603
|
const max = typeof props.maxLength === "number" && props.maxLength > 0 ? props.maxLength : void 0;
|
|
@@ -140672,7 +140672,7 @@ async function liveRenderServices(bundleJs, opts) {
|
|
|
140672
140672
|
return loadBundleServicesLive(bundleJs, liveBootOptions(opts, bus));
|
|
140673
140673
|
}
|
|
140674
140674
|
async function settleUnawaitedWork() {
|
|
140675
|
-
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((
|
|
140675
|
+
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((resolve67) => setTimeout(resolve67, 0));
|
|
140676
140676
|
}
|
|
140677
140677
|
async function loadAndSettle(bundleJs, options) {
|
|
140678
140678
|
const w2 = await bootBundleWorker(bundleJs, options);
|
|
@@ -142408,9 +142408,9 @@ function stateOf(view) {
|
|
|
142408
142408
|
build: b2 && view.live ? { ok: b2.ok, ms: b2.ms, screens: b2.screens, at: b2.at, run: view.live.runId } : null
|
|
142409
142409
|
};
|
|
142410
142410
|
}
|
|
142411
|
-
function frameFor(state, prev,
|
|
142412
|
-
if (key3 || !prev) return { ts:
|
|
142413
|
-
const f2 = { ts:
|
|
142411
|
+
function frameFor(state, prev, ts11, v2, key3) {
|
|
142412
|
+
if (key3 || !prev) return { ts: ts11, v: v2, key: true, ...state };
|
|
142413
|
+
const f2 = { ts: ts11, v: v2 };
|
|
142414
142414
|
if (!same2(state.step, prev.step)) f2.step = state.step;
|
|
142415
142415
|
if (!same2(state.now, prev.now)) f2.now = state.now;
|
|
142416
142416
|
const screens = {};
|
|
@@ -142790,7 +142790,7 @@ function buildView(dir, memory, now) {
|
|
|
142790
142790
|
const runs = testRuns(dir);
|
|
142791
142791
|
const last = runs[runs.length - 1];
|
|
142792
142792
|
const prev = runs[runs.length - 2];
|
|
142793
|
-
const
|
|
142793
|
+
const validate5 = obj(readJson4(join51(dir, VALIDATE_RECORD)));
|
|
142794
142794
|
const push = obj(readJson4(join51(dir, PUSH_RECORD)));
|
|
142795
142795
|
const edges = readJson4(join51(dir, EDGES_RECORD));
|
|
142796
142796
|
const nav = [];
|
|
@@ -142824,7 +142824,7 @@ function buildView(dir, memory, now) {
|
|
|
142824
142824
|
screens,
|
|
142825
142825
|
focus,
|
|
142826
142826
|
health: {
|
|
142827
|
-
validate:
|
|
142827
|
+
validate: validate5 && typeof validate5.ok === "boolean" ? { ok: validate5.ok, errors: num2(validate5.errors), warnings: num2(validate5.warnings), at: text(validate5.at) ?? now } : null,
|
|
142828
142828
|
test: last ? { ok: last.ok, screens: last.screens, actions: last.actions, gaps: last.gaps, prevGaps: prev ? prev.gaps : null, errors: last.errors, at: runTime(last.runId) } : null,
|
|
142829
142829
|
ux: uxStatuses(dir),
|
|
142830
142830
|
push: push && text(push.releaseId) && text(push.app) ? { app: text(push.app), releaseId: text(push.releaseId), draft: push.draft !== false, at: text(push.at) ?? now } : null
|
|
@@ -148753,21 +148753,21 @@ function compress(arr2, options, matcher, readonlyMatcher) {
|
|
|
148753
148753
|
const compressedObj = {};
|
|
148754
148754
|
for (let i2 = 0; i2 < arr2.length; i2++) {
|
|
148755
148755
|
const tagObj = arr2[i2];
|
|
148756
|
-
const
|
|
148757
|
-
if (
|
|
148756
|
+
const property2 = propName2(tagObj);
|
|
148757
|
+
if (property2 !== void 0 && property2 !== options.textNodeName) {
|
|
148758
148758
|
const rawAttrs = stripAttributePrefix(
|
|
148759
148759
|
tagObj[":@"] || {},
|
|
148760
148760
|
options.attributeNamePrefix
|
|
148761
148761
|
);
|
|
148762
|
-
matcher.push(
|
|
148762
|
+
matcher.push(property2, rawAttrs);
|
|
148763
148763
|
}
|
|
148764
|
-
if (
|
|
148765
|
-
if (text9 === void 0) text9 = tagObj[
|
|
148766
|
-
else text9 += "" + tagObj[
|
|
148767
|
-
} else if (
|
|
148764
|
+
if (property2 === options.textNodeName) {
|
|
148765
|
+
if (text9 === void 0) text9 = tagObj[property2];
|
|
148766
|
+
else text9 += "" + tagObj[property2];
|
|
148767
|
+
} else if (property2 === void 0) {
|
|
148768
148768
|
continue;
|
|
148769
|
-
} else if (tagObj[
|
|
148770
|
-
let val = compress(tagObj[
|
|
148769
|
+
} else if (tagObj[property2]) {
|
|
148770
|
+
let val = compress(tagObj[property2], options, matcher, readonlyMatcher);
|
|
148771
148771
|
const isLeaf = isLeafTag(val, options);
|
|
148772
148772
|
if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) {
|
|
148773
148773
|
val[options.textNodeName] = "";
|
|
@@ -148783,20 +148783,20 @@ function compress(arr2, options, matcher, readonlyMatcher) {
|
|
|
148783
148783
|
if (tagObj[METADATA_SYMBOL2] !== void 0 && typeof val === "object" && val !== null) {
|
|
148784
148784
|
val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
|
|
148785
148785
|
}
|
|
148786
|
-
if (compressedObj[
|
|
148787
|
-
if (!Array.isArray(compressedObj[
|
|
148788
|
-
compressedObj[
|
|
148786
|
+
if (compressedObj[property2] !== void 0 && Object.prototype.hasOwnProperty.call(compressedObj, property2)) {
|
|
148787
|
+
if (!Array.isArray(compressedObj[property2])) {
|
|
148788
|
+
compressedObj[property2] = [compressedObj[property2]];
|
|
148789
148789
|
}
|
|
148790
|
-
compressedObj[
|
|
148790
|
+
compressedObj[property2].push(val);
|
|
148791
148791
|
} else {
|
|
148792
148792
|
const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() : readonlyMatcher;
|
|
148793
|
-
if (options.isArray(
|
|
148794
|
-
compressedObj[
|
|
148793
|
+
if (options.isArray(property2, jPathOrMatcher, isLeaf)) {
|
|
148794
|
+
compressedObj[property2] = [val];
|
|
148795
148795
|
} else {
|
|
148796
|
-
compressedObj[
|
|
148796
|
+
compressedObj[property2] = val;
|
|
148797
148797
|
}
|
|
148798
148798
|
}
|
|
148799
|
-
if (
|
|
148799
|
+
if (property2 !== void 0 && property2 !== options.textNodeName) {
|
|
148800
148800
|
matcher.pop();
|
|
148801
148801
|
}
|
|
148802
148802
|
}
|
|
@@ -149269,22 +149269,22 @@ function resolveTagName2(name, isAttribute2, options, matcher, xmlVersion) {
|
|
|
149269
149269
|
if (qName(name, { xmlVersion })) return name;
|
|
149270
149270
|
return options.sanitizeName(name, { isAttribute: isAttribute2, matcher: matcher.readOnly() });
|
|
149271
149271
|
}
|
|
149272
|
-
function processTextOrObjNode(
|
|
149273
|
-
const attrValues = this.extractAttributes(
|
|
149272
|
+
function processTextOrObjNode(object7, key3, level, matcher, xmlVersion) {
|
|
149273
|
+
const attrValues = this.extractAttributes(object7);
|
|
149274
149274
|
matcher.push(key3, attrValues);
|
|
149275
149275
|
const isStopNode = this.checkStopNode(matcher);
|
|
149276
149276
|
if (isStopNode) {
|
|
149277
|
-
const rawContent = this.buildRawContent(
|
|
149278
|
-
const attrStr = this.buildAttributesForStopNode(
|
|
149277
|
+
const rawContent = this.buildRawContent(object7);
|
|
149278
|
+
const attrStr = this.buildAttributesForStopNode(object7);
|
|
149279
149279
|
matcher.pop();
|
|
149280
149280
|
return this.buildObjectNode(rawContent, key3, attrStr, level);
|
|
149281
149281
|
}
|
|
149282
|
-
const result = this.j2x(
|
|
149282
|
+
const result = this.j2x(object7, level + 1, matcher, xmlVersion);
|
|
149283
149283
|
matcher.pop();
|
|
149284
149284
|
if (key3[0] === "?") {
|
|
149285
149285
|
return this.buildTextValNode("", key3, result.attrStr, level, matcher);
|
|
149286
|
-
} else if (
|
|
149287
|
-
return this.buildTextValNode(
|
|
149286
|
+
} else if (object7[this.options.textNodeName] !== void 0 && Object.keys(object7).length === 1) {
|
|
149287
|
+
return this.buildTextValNode(object7[this.options.textNodeName], key3, result.attrStr, level, matcher);
|
|
149288
149288
|
} else {
|
|
149289
149289
|
return this.buildObjectNode(result.val, key3, result.attrStr, level);
|
|
149290
149290
|
}
|
|
@@ -150951,13 +150951,13 @@ function isSymlink2(path2) {
|
|
|
150951
150951
|
return false;
|
|
150952
150952
|
}
|
|
150953
150953
|
}
|
|
150954
|
-
async function introducedErrors(dir,
|
|
150955
|
-
const edited = await
|
|
150954
|
+
async function introducedErrors(dir, validate5, file2, isOwnFinding) {
|
|
150955
|
+
const edited = await validate5(dir, { fresh: true });
|
|
150956
150956
|
if (edited.code === 0) return void 0;
|
|
150957
150957
|
if (!comparable(edited)) return `himi validate failed and its report could not be read: ${edited.tail ?? "no output"}`;
|
|
150958
150958
|
if (edited.errors.every((e2) => isOwnFinding(e2.ruleCode))) return void 0;
|
|
150959
150959
|
file2.restore();
|
|
150960
|
-
const baseline = await
|
|
150960
|
+
const baseline = await validate5(dir, { fresh: true });
|
|
150961
150961
|
file2.reapply();
|
|
150962
150962
|
if (!comparable(baseline)) return "himi validate could not check the original config.ts to compare against";
|
|
150963
150963
|
const introduced = compareErrors(edited.errors, baseline.errors ?? []).introduced.filter((e2) => !isOwnFinding(e2.ruleCode));
|
|
@@ -151100,7 +151100,7 @@ function previewPushConfigEdit(dir, options) {
|
|
|
151100
151100
|
const { applied, instructions } = enablePushInConfig(readFileSync62(path2, "utf8"), { ...options, fileName: basename13(path2) });
|
|
151101
151101
|
return { wouldApply: applied, instructions };
|
|
151102
151102
|
}
|
|
151103
|
-
async function applyPushConfigEdit(dir, options,
|
|
151103
|
+
async function applyPushConfigEdit(dir, options, validate5) {
|
|
151104
151104
|
const path2 = configEntry(dir);
|
|
151105
151105
|
if (!path2) return void 0;
|
|
151106
151106
|
const fileName = basename13(path2);
|
|
@@ -151113,7 +151113,7 @@ async function applyPushConfigEdit(dir, options, validate4) {
|
|
|
151113
151113
|
const backup = backUpConfig(dir, "notify-setup-backup", fileName, original);
|
|
151114
151114
|
if (!backup) return refuse7(`.himi is not a plain directory in this package (a symlink?), so ${fileName} was not edited.`);
|
|
151115
151115
|
writeFileAtomic(path2, edit.source);
|
|
151116
|
-
const introduced = await introducedErrors(dir,
|
|
151116
|
+
const introduced = await introducedErrors(dir, validate5, {
|
|
151117
151117
|
restore: () => writeFileAtomic(path2, original),
|
|
151118
151118
|
reapply: () => writeFileAtomic(path2, edit.source)
|
|
151119
151119
|
}, isPushFinding).catch((error) => `himi validate could not run, so the edit was not checked: ${error.message}`);
|
|
@@ -152567,15 +152567,15 @@ function loadMemory2(dir) {
|
|
|
152567
152567
|
for (const t2 of m2.timeline) {
|
|
152568
152568
|
if (!isObj3(t2)) continue;
|
|
152569
152569
|
const file2 = historyName(t2.sha, t2.ext);
|
|
152570
|
-
const
|
|
152570
|
+
const ts11 = str4(t2.ts);
|
|
152571
152571
|
const id = str4(t2.id);
|
|
152572
|
-
if (file2 &&
|
|
152572
|
+
if (file2 && ts11 && id) timeline.push({ ts: ts11, id, file: file2 });
|
|
152573
152573
|
}
|
|
152574
152574
|
return { createdAt: str4(m2.createdAt), shots, timeline };
|
|
152575
152575
|
}
|
|
152576
|
-
function captionAt(entries,
|
|
152576
|
+
function captionAt(entries, ts11) {
|
|
152577
152577
|
let best = null;
|
|
152578
|
-
for (const e2 of entries) if (e2.ts <=
|
|
152578
|
+
for (const e2 of entries) if (e2.ts <= ts11) best = e2;
|
|
152579
152579
|
return best ? best.message : null;
|
|
152580
152580
|
}
|
|
152581
152581
|
function thin(items, max) {
|
|
@@ -152695,13 +152695,13 @@ function duration(ms2) {
|
|
|
152695
152695
|
const m2 = Math.round(ms2 / 6e4);
|
|
152696
152696
|
return m2 < 60 ? `${m2} min` : `${Math.floor(m2 / 60)} h ${m2 % 60} min`;
|
|
152697
152697
|
}
|
|
152698
|
-
function utcDay(
|
|
152699
|
-
const d2 = new Date(
|
|
152698
|
+
function utcDay(ts11) {
|
|
152699
|
+
const d2 = new Date(ts11);
|
|
152700
152700
|
return Number.isNaN(d2.getTime()) ? "" : `${d2.toUTCString().slice(0, 16)} (UTC)`;
|
|
152701
152701
|
}
|
|
152702
|
-
function sinceStart(start,
|
|
152702
|
+
function sinceStart(start, ts11) {
|
|
152703
152703
|
if (!start) return "";
|
|
152704
|
-
const s2 = Math.max(0, Math.round((Date.parse(
|
|
152704
|
+
const s2 = Math.max(0, Math.round((Date.parse(ts11) - Date.parse(start)) / 1e3));
|
|
152705
152705
|
const h2 = Math.floor(s2 / 3600);
|
|
152706
152706
|
const m2 = Math.floor(s2 % 3600 / 60);
|
|
152707
152707
|
const sec = String(s2 % 60).padStart(2, "0");
|
|
@@ -152711,7 +152711,7 @@ function renderReel(plan, images) {
|
|
|
152711
152711
|
const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
|
|
152712
152712
|
const count2 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
|
|
152713
152713
|
const accent = ACCENT.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
|
|
152714
|
-
const clock = (
|
|
152714
|
+
const clock = (ts11) => sinceStart(plan.startedAt, ts11);
|
|
152715
152715
|
const frames = plan.frames.filter((f2) => images.has(f2.file));
|
|
152716
152716
|
const flip = frames.length ? `<section class="flip"><div class="phone">${frames.map((f2, i2) => `<img class="fr${i2 === 0 ? " on" : ""}" src="${images.get(f2.file)}" alt="${escapeHtml(plan.focusId ?? "")} at ${clock(f2.ts)}">`).join("")}</div>
|
|
152717
152717
|
<div class="flipcap"><div class="t" id="ft">${frames[0] ? clock(frames[0].ts) : ""}</div><div id="fc">${escapeHtml(frames[0]?.caption ?? "")}</div><div class="bar"><div id="fb"></div></div></div></section>` : `<p class="muted">No screen versions were recorded \u2014 open the build board with <code>himi studio</code> before building to capture them.</p>`;
|
|
@@ -156063,7 +156063,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
156063
156063
|
const headers2 = Object.fromEntries(new Headers(init.headers).entries());
|
|
156064
156064
|
const request = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
156065
156065
|
const hostname3 = url.hostname.replace(/^\[|\]$/g, "");
|
|
156066
|
-
return await new Promise((
|
|
156066
|
+
return await new Promise((resolve67, reject) => {
|
|
156067
156067
|
let settled = false;
|
|
156068
156068
|
const finish2 = (fn2) => {
|
|
156069
156069
|
if (settled) return;
|
|
@@ -156100,7 +156100,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
156100
156100
|
}
|
|
156101
156101
|
const responseHeaders = new Headers();
|
|
156102
156102
|
for (const [key3, value] of Object.entries(response.headers)) if (value !== void 0) responseHeaders.set(key3, Array.isArray(value) ? value.join(", ") : value);
|
|
156103
|
-
|
|
156103
|
+
resolve67(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
|
|
156104
156104
|
}));
|
|
156105
156105
|
});
|
|
156106
156106
|
req.once("error", (error) => finish2(() => reject(error)));
|
|
@@ -156400,7 +156400,7 @@ function createLocalTestSandbox() {
|
|
|
156400
156400
|
}
|
|
156401
156401
|
})();
|
|
156402
156402
|
`;
|
|
156403
|
-
return await new Promise((
|
|
156403
|
+
return await new Promise((resolve67, reject) => {
|
|
156404
156404
|
const { port1, port2 } = new MessageChannel();
|
|
156405
156405
|
const serializableContext = {
|
|
156406
156406
|
auth: context.auth,
|
|
@@ -156476,7 +156476,7 @@ function createLocalTestSandbox() {
|
|
|
156476
156476
|
timer = setTimeout(() => finish2(() => reject(new SandboxError("timeout", `execution exceeded ${limits.timeoutMs}ms`))), Math.max(1, limits.timeoutMs));
|
|
156477
156477
|
return;
|
|
156478
156478
|
}
|
|
156479
|
-
if (message.ok) finish2(() =>
|
|
156479
|
+
if (message.ok) finish2(() => resolve67({ value: message.value, durationMs: Date.now() - started }));
|
|
156480
156480
|
else finish2(() => reject(new SandboxError("execution_failed", message.message ?? "handler failed")));
|
|
156481
156481
|
});
|
|
156482
156482
|
worker.once("error", (error) => finish2(() => reject(new SandboxError("execution_failed", error.message))));
|
|
@@ -158375,12 +158375,12 @@ function createLoginSession(deps) {
|
|
|
158375
158375
|
current = pending;
|
|
158376
158376
|
const out2 = [];
|
|
158377
158377
|
const err = [];
|
|
158378
|
-
return new Promise((
|
|
158378
|
+
return new Promise((resolve67) => {
|
|
158379
158379
|
let answered = false;
|
|
158380
158380
|
const answer = () => {
|
|
158381
158381
|
if (answered) return;
|
|
158382
158382
|
answered = true;
|
|
158383
|
-
|
|
158383
|
+
resolve67(current);
|
|
158384
158384
|
};
|
|
158385
158385
|
let child;
|
|
158386
158386
|
try {
|
|
@@ -158503,9 +158503,9 @@ async function startMcpServer(opts) {
|
|
|
158503
158503
|
login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
|
|
158504
158504
|
...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
|
|
158505
158505
|
};
|
|
158506
|
-
const closed = new Promise((
|
|
158507
|
-
stdin.once("end",
|
|
158508
|
-
stdin.once("close",
|
|
158506
|
+
const closed = new Promise((resolve67) => {
|
|
158507
|
+
stdin.once("end", resolve67);
|
|
158508
|
+
stdin.once("close", resolve67);
|
|
158509
158509
|
});
|
|
158510
158510
|
const handle = serveStdio(
|
|
158511
158511
|
() => {
|
|
@@ -158952,10 +158952,10 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
158952
158952
|
for (const source of Object.values(files)) visit(source);
|
|
158953
158953
|
return { modules, unsupported };
|
|
158954
158954
|
}
|
|
158955
|
-
function sdkSubpathReader(
|
|
158955
|
+
function sdkSubpathReader(resolve67) {
|
|
158956
158956
|
return (sub) => {
|
|
158957
158957
|
try {
|
|
158958
|
-
return readFileSync81(
|
|
158958
|
+
return readFileSync81(resolve67(`@wix/himalaya/${sub}`), "utf8");
|
|
158959
158959
|
} catch {
|
|
158960
158960
|
return null;
|
|
158961
158961
|
}
|
|
@@ -159033,7 +159033,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
159033
159033
|
const token = mintToken2(payload);
|
|
159034
159034
|
const unusable = await probeAuthoringPage(opts.authoringBase, opts.fetchImpl, opts.probeTimeoutMs);
|
|
159035
159035
|
if (unusable) throw new Error(unusable);
|
|
159036
|
-
return await new Promise((
|
|
159036
|
+
return await new Promise((resolve67, reject) => {
|
|
159037
159037
|
let settled = false;
|
|
159038
159038
|
let url = "";
|
|
159039
159039
|
const server = createServer5();
|
|
@@ -159085,7 +159085,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
159085
159085
|
}
|
|
159086
159086
|
res.writeHead(200, { "content-type": "text/plain" }).end("ok");
|
|
159087
159087
|
const report3 = body.result;
|
|
159088
|
-
finish2(() =>
|
|
159088
|
+
finish2(() => resolve67({ report: report3, url }));
|
|
159089
159089
|
})();
|
|
159090
159090
|
});
|
|
159091
159091
|
server.on("error", (e2) => finish2(() => reject(e2)));
|
|
@@ -162294,7 +162294,7 @@ var init_iap_client = __esm({
|
|
|
162294
162294
|
this.options = options;
|
|
162295
162295
|
this.fetchImpl = options.fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
|
|
162296
162296
|
this.now = options.now ?? Date.now;
|
|
162297
|
-
this.sleep = options.sleep ?? ((ms2) => new Promise((
|
|
162297
|
+
this.sleep = options.sleep ?? ((ms2) => new Promise((resolve67) => setTimeout(resolve67, ms2)));
|
|
162298
162298
|
}
|
|
162299
162299
|
fetchImpl;
|
|
162300
162300
|
now;
|
|
@@ -164802,7 +164802,7 @@ function previewIapConfigEdit(dir, options) {
|
|
|
164802
164802
|
const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync92(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename20(path2) });
|
|
164803
164803
|
return { path: path2, changed, applied, conflicts, instructions };
|
|
164804
164804
|
}
|
|
164805
|
-
async function applyIapConfigEdit(dir, options,
|
|
164805
|
+
async function applyIapConfigEdit(dir, options, validate5) {
|
|
164806
164806
|
const path2 = configEntry(dir);
|
|
164807
164807
|
if (!path2) return void 0;
|
|
164808
164808
|
const fileName = basename20(path2);
|
|
@@ -164815,7 +164815,7 @@ async function applyIapConfigEdit(dir, options, validate4) {
|
|
|
164815
164815
|
const backup = backUpConfig(dir, "store-iap-backup", fileName, original);
|
|
164816
164816
|
if (!backup) return refuse7(`.himi is not a plain directory in this package (a symlink?), so ${fileName} was not edited.`);
|
|
164817
164817
|
writeFileAtomic(path2, edit.source);
|
|
164818
|
-
const introduced = await introducedErrors(dir,
|
|
164818
|
+
const introduced = await introducedErrors(dir, validate5, {
|
|
164819
164819
|
restore: () => writeFileAtomic(path2, original),
|
|
164820
164820
|
reapply: () => writeFileAtomic(path2, edit.source)
|
|
164821
164821
|
}, () => false).catch((error) => `himi validate could not run, so the edit was not checked: ${error.message}`);
|
|
@@ -165955,11 +165955,11 @@ async function recordBinding(flags, deps, report3, apply) {
|
|
|
165955
165955
|
if (!dir) return { note: wanted ? `add ${wanted} and "iap" in capabilities to the app's config (or rerun with --content <dir>)` : void 0 };
|
|
165956
165956
|
if (!report3.purchasesAppId) return { note: `${dir} was not edited: there is no purchases app on the site yet`, unapplied: true };
|
|
165957
165957
|
const options = { purchasesAppId: report3.purchasesAppId, siteId: report3.site, bundleId: report3.bundleId };
|
|
165958
|
-
const
|
|
165958
|
+
const validate5 = deps.validateConfig;
|
|
165959
165959
|
let config;
|
|
165960
165960
|
if (!apply) config = previewIapConfigEdit(dir, options);
|
|
165961
|
-
else if (!
|
|
165962
|
-
else config = await applyIapConfigEdit(dir, options,
|
|
165961
|
+
else if (!validate5) return { note: `${dir} was not edited (himi validate is unavailable here): add ${wanted} by hand`, unapplied: true };
|
|
165962
|
+
else config = await applyIapConfigEdit(dir, options, validate5);
|
|
165963
165963
|
if (!config) return { note: `${dir} has no config.ts, so it was not edited: add ${wanted} to the app's config`, unapplied: true };
|
|
165964
165964
|
return { config, unapplied: config.instructions.length > 0 };
|
|
165965
165965
|
}
|
|
@@ -166196,7 +166196,7 @@ function defaultStoreIapDeps() {
|
|
|
166196
166196
|
profileTeam: (profile) => resolveStoreCredentials({ app: profile, cfg: {}, profileFlag: profile, env: {} }).team,
|
|
166197
166197
|
confirm: confirmOnTerminal,
|
|
166198
166198
|
now: () => /* @__PURE__ */ new Date(),
|
|
166199
|
-
sleep: (ms2) => new Promise((
|
|
166199
|
+
sleep: (ms2) => new Promise((resolve67) => setTimeout(resolve67, ms2))
|
|
166200
166200
|
};
|
|
166201
166201
|
}
|
|
166202
166202
|
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;
|
|
@@ -167891,7 +167891,7 @@ async function runAllMembers(args) {
|
|
|
167891
167891
|
const result = await sendCampaign({
|
|
167892
167892
|
recipients,
|
|
167893
167893
|
campaignId: requestId2,
|
|
167894
|
-
wait: deps.wait ?? ((ms2) => new Promise((
|
|
167894
|
+
wait: deps.wait ?? ((ms2) => new Promise((resolve67) => setTimeout(resolve67, ms2))),
|
|
167895
167895
|
onProgress: (completed) => {
|
|
167896
167896
|
if (completed % 10 === 0 || completed === recipients.length) {
|
|
167897
167897
|
io2.log(JSON.stringify({ ok: true, state: "progress", campaignId: requestId2, completed, recipients: recipients.length }));
|
|
@@ -168055,12 +168055,12 @@ async function runNotify(pos, flags, io2, deps = {}) {
|
|
|
168055
168055
|
const json8 = flags.json === true;
|
|
168056
168056
|
const print = (v2) => io2.log(JSON.stringify(v2, null, 2));
|
|
168057
168057
|
const sub = pos[1];
|
|
168058
|
-
const
|
|
168058
|
+
const USAGE3 = "himi notify send --app <app> (--token <t> | --device <id> | --all) --title <s> [--body <s>] [--link <url>]\n [--platform ios|android] [--category <c>] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]\n [--data k=v ...]\nhimi notify tokens --app <app> [--platform ios|android] [--include-disabled] [--json]\nhimi notify doctor [--json]";
|
|
168059
168059
|
if (!sub || !["send", "tokens", "doctor"].includes(sub)) {
|
|
168060
168060
|
io2.error(
|
|
168061
168061
|
JSON.stringify({
|
|
168062
168062
|
error: sub ? `unknown notify subcommand "${sub}" \u2014 use send | tokens | doctor` : "notify needs a subcommand",
|
|
168063
|
-
usage:
|
|
168063
|
+
usage: USAGE3
|
|
168064
168064
|
})
|
|
168065
168065
|
);
|
|
168066
168066
|
return 2;
|
|
@@ -168120,7 +168120,7 @@ async function runNotify(pos, flags, io2, deps = {}) {
|
|
|
168120
168120
|
}
|
|
168121
168121
|
const app = str11(flags.app);
|
|
168122
168122
|
if (!app) {
|
|
168123
|
-
io2.error(JSON.stringify({ error: "--app is required", usage:
|
|
168123
|
+
io2.error(JSON.stringify({ error: "--app is required", usage: USAGE3 }));
|
|
168124
168124
|
return 2;
|
|
168125
168125
|
}
|
|
168126
168126
|
if (sub === "tokens") {
|
|
@@ -168174,22 +168174,22 @@ async function runNotify(pos, flags, io2, deps = {}) {
|
|
|
168174
168174
|
const all = flags.all === true;
|
|
168175
168175
|
const targets = [token && "--token", device && "--device", all && "--all"].filter(Boolean);
|
|
168176
168176
|
if (targets.length === 0) {
|
|
168177
|
-
io2.error(JSON.stringify({ error: "pick a target: --token <t>, --device <id>, or --all", usage:
|
|
168177
|
+
io2.error(JSON.stringify({ error: "pick a target: --token <t>, --device <id>, or --all", usage: USAGE3 }));
|
|
168178
168178
|
return 2;
|
|
168179
168179
|
}
|
|
168180
168180
|
if (targets.length > 1) {
|
|
168181
|
-
io2.error(JSON.stringify({ error: `targets are mutually exclusive \u2014 got ${targets.join(" and ")}`, usage:
|
|
168181
|
+
io2.error(JSON.stringify({ error: `targets are mutually exclusive \u2014 got ${targets.join(" and ")}`, usage: USAGE3 }));
|
|
168182
168182
|
return 2;
|
|
168183
168183
|
}
|
|
168184
168184
|
const data = parseDataFlag(flags.data);
|
|
168185
168185
|
if (data.error) {
|
|
168186
|
-
io2.error(JSON.stringify({ error: data.error, usage:
|
|
168186
|
+
io2.error(JSON.stringify({ error: data.error, usage: USAGE3 }));
|
|
168187
168187
|
return 2;
|
|
168188
168188
|
}
|
|
168189
168189
|
const silent = flags.silent === true;
|
|
168190
168190
|
const title = str11(flags.title);
|
|
168191
168191
|
if (!silent && !title) {
|
|
168192
|
-
io2.error(JSON.stringify({ error: "--title is required for a visible notification (use --silent for a background push)", usage:
|
|
168192
|
+
io2.error(JSON.stringify({ error: "--title is required for a visible notification (use --silent for a background push)", usage: USAGE3 }));
|
|
168193
168193
|
return 2;
|
|
168194
168194
|
}
|
|
168195
168195
|
const badgeRaw = str11(flags.badge);
|
|
@@ -170273,10 +170273,10 @@ function assertPublicSiteUrl(raw) {
|
|
|
170273
170273
|
if (refusal) throw new Error(refusal);
|
|
170274
170274
|
}
|
|
170275
170275
|
function resolveAll(hostname3) {
|
|
170276
|
-
return new Promise((
|
|
170276
|
+
return new Promise((resolve67, reject) => {
|
|
170277
170277
|
dnsLookup(hostname3, { all: true, verbatim: true }, (err, addresses) => {
|
|
170278
170278
|
if (err) reject(err);
|
|
170279
|
-
else
|
|
170279
|
+
else resolve67(addresses);
|
|
170280
170280
|
});
|
|
170281
170281
|
});
|
|
170282
170282
|
}
|
|
@@ -170284,13 +170284,13 @@ function withAbort(start, signal, what) {
|
|
|
170284
170284
|
if (signal?.aborted) return Promise.reject(new Error(`${what} aborted`));
|
|
170285
170285
|
const work = start();
|
|
170286
170286
|
if (!signal) return work;
|
|
170287
|
-
return new Promise((
|
|
170287
|
+
return new Promise((resolve67, reject) => {
|
|
170288
170288
|
const onAbort = () => reject(new Error(`${what} aborted`));
|
|
170289
170289
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
170290
|
-
work.then(
|
|
170290
|
+
work.then(resolve67, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
170291
170291
|
});
|
|
170292
170292
|
}
|
|
170293
|
-
async function pinAddress(url,
|
|
170293
|
+
async function pinAddress(url, resolve67 = resolveAll, signal) {
|
|
170294
170294
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
170295
170295
|
if (ipv4Octets(host)) {
|
|
170296
170296
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
@@ -170300,7 +170300,7 @@ async function pinAddress(url, resolve66 = resolveAll, signal) {
|
|
|
170300
170300
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
170301
170301
|
return { address: host, family: 6 };
|
|
170302
170302
|
}
|
|
170303
|
-
const addresses = await withAbort(() =>
|
|
170303
|
+
const addresses = await withAbort(() => resolve67(host), signal, `${host} lookup`);
|
|
170304
170304
|
if (!addresses.length) throw new Error(`${host} resolved to no address`);
|
|
170305
170305
|
const blocked = addresses.filter((a2) => isBlockedAddress(a2.address)).map((a2) => a2.address);
|
|
170306
170306
|
if (blocked.length) throw new Error(`${host} resolves to a blocked address (${blocked.join(", ")})`);
|
|
@@ -170340,7 +170340,7 @@ function copyIncomingHeaders(headers2) {
|
|
|
170340
170340
|
return out2;
|
|
170341
170341
|
}
|
|
170342
170342
|
function requestOnce(url, pinned, init) {
|
|
170343
|
-
return new Promise((
|
|
170343
|
+
return new Promise((resolve67, reject) => {
|
|
170344
170344
|
const headers2 = { host: url.host, "accept-encoding": "identity" };
|
|
170345
170345
|
new Headers(init.headers ?? {}).forEach((value, key3) => {
|
|
170346
170346
|
if (key3.toLowerCase() !== "host") headers2[key3] = value;
|
|
@@ -170370,7 +170370,7 @@ function requestOnce(url, pinned, init) {
|
|
|
170370
170370
|
reject(err);
|
|
170371
170371
|
return;
|
|
170372
170372
|
}
|
|
170373
|
-
|
|
170373
|
+
resolve67(new Response(body, { status, statusText: res.statusMessage ?? "", headers: out2 }));
|
|
170374
170374
|
}
|
|
170375
170375
|
);
|
|
170376
170376
|
req.on("error", reject);
|
|
@@ -173400,7 +173400,7 @@ var require_cjs = __commonJS({
|
|
|
173400
173400
|
}
|
|
173401
173401
|
return 0;
|
|
173402
173402
|
}
|
|
173403
|
-
function extractHostname(url, urlIsValidHostname,
|
|
173403
|
+
function extractHostname(url, urlIsValidHostname, validate5 = false) {
|
|
173404
173404
|
let start = 0;
|
|
173405
173405
|
let end = url.length;
|
|
173406
173406
|
let hasUpper = false;
|
|
@@ -173449,7 +173449,7 @@ var require_cjs = __commonJS({
|
|
|
173449
173449
|
code === 43)) {
|
|
173450
173450
|
const raw = url.charCodeAt(i2);
|
|
173451
173451
|
if (raw === 9 || raw === 10 || raw === 13) {
|
|
173452
|
-
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname,
|
|
173452
|
+
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname, validate5);
|
|
173453
173453
|
}
|
|
173454
173454
|
return null;
|
|
173455
173455
|
}
|
|
@@ -173465,7 +173465,7 @@ var require_cjs = __commonJS({
|
|
|
173465
173465
|
for (let i2 = start; i2 < end; i2 += 1) {
|
|
173466
173466
|
const code = url.charCodeAt(i2);
|
|
173467
173467
|
if (code === 9 || code === 10 || code === 13) {
|
|
173468
|
-
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname,
|
|
173468
|
+
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname, validate5);
|
|
173469
173469
|
}
|
|
173470
173470
|
if (code === 58) {
|
|
173471
173471
|
indexOfColon = i2;
|
|
@@ -173548,10 +173548,10 @@ var require_cjs = __commonJS({
|
|
|
173548
173548
|
let indexOfPort = -1;
|
|
173549
173549
|
let indexOfFirstColon = -1;
|
|
173550
173550
|
let hasControl = false;
|
|
173551
|
-
let vValid =
|
|
173551
|
+
let vValid = validate5;
|
|
173552
173552
|
let vLastDot = start - 1;
|
|
173553
173553
|
let vLastCode = -1;
|
|
173554
|
-
if (
|
|
173554
|
+
if (validate5 && start < end) {
|
|
173555
173555
|
const c0 = url.charCodeAt(start);
|
|
173556
173556
|
if (!/*@__INLINE__*/
|
|
173557
173557
|
(isValidHostnameChar(c0) || c0 === 46 || c0 === 95) || c0 === 45) {
|
|
@@ -173571,7 +173571,7 @@ var require_cjs = __commonJS({
|
|
|
173571
173571
|
indexOfPort = i2;
|
|
173572
173572
|
} else if (code === 9 || code === 10 || code === 13) {
|
|
173573
173573
|
hasControl = true;
|
|
173574
|
-
} else if (
|
|
173574
|
+
} else if (validate5) {
|
|
173575
173575
|
if (code === 46) {
|
|
173576
173576
|
if (i2 - vLastDot > 64 || vLastCode === 46 || vLastCode === 45) {
|
|
173577
173577
|
vValid = false;
|
|
@@ -173593,16 +173593,16 @@ var require_cjs = __commonJS({
|
|
|
173593
173593
|
indexOfClosingBracket = i2;
|
|
173594
173594
|
} else if (code >= 65 && code <= 90) {
|
|
173595
173595
|
hasUpper = true;
|
|
173596
|
-
} else if (
|
|
173596
|
+
} else if (validate5 && !/*@__INLINE__*/
|
|
173597
173597
|
isValidHostnameChar(code)) {
|
|
173598
173598
|
vValid = false;
|
|
173599
173599
|
}
|
|
173600
|
-
if (
|
|
173600
|
+
if (validate5) {
|
|
173601
173601
|
vLastCode = code;
|
|
173602
173602
|
}
|
|
173603
173603
|
}
|
|
173604
173604
|
if (hasControl) {
|
|
173605
|
-
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname,
|
|
173605
|
+
return extractHostname(url.replace(CONTROL_CHARS3, ""), urlIsValidHostname, validate5);
|
|
173606
173606
|
}
|
|
173607
173607
|
if (indexOfIdentifier !== -1 && indexOfIdentifier >= start && indexOfIdentifier < end) {
|
|
173608
173608
|
start = indexOfIdentifier + 1;
|
|
@@ -173621,7 +173621,7 @@ var require_cjs = __commonJS({
|
|
|
173621
173621
|
if (start >= end) {
|
|
173622
173622
|
return null;
|
|
173623
173623
|
}
|
|
173624
|
-
if (
|
|
173624
|
+
if (validate5 && vValid && indexOfIdentifier === -1 && indexOfPort === -1 && indexOfClosingBracket === -1 && url.charCodeAt(end - 1) !== 46 && end - start <= 255 && // total length
|
|
173625
173625
|
end - vLastDot - 1 <= 63 && // last label length
|
|
173626
173626
|
vLastCode !== 45) {
|
|
173627
173627
|
extractedHostnameValidated = true;
|
|
@@ -174163,10 +174163,10 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
|
|
174163
174163
|
}
|
|
174164
174164
|
function createPromiseCallback(cb) {
|
|
174165
174165
|
let callback;
|
|
174166
|
-
let
|
|
174166
|
+
let resolve67;
|
|
174167
174167
|
let reject;
|
|
174168
174168
|
const promise = new Promise((_resolve, _reject) => {
|
|
174169
|
-
|
|
174169
|
+
resolve67 = _resolve;
|
|
174170
174170
|
reject = _reject;
|
|
174171
174171
|
});
|
|
174172
174172
|
if (typeof cb === "function") {
|
|
@@ -174182,7 +174182,7 @@ function createPromiseCallback(cb) {
|
|
|
174182
174182
|
callback = (err, result) => {
|
|
174183
174183
|
try {
|
|
174184
174184
|
if (err) reject(err);
|
|
174185
|
-
else
|
|
174185
|
+
else resolve67(result);
|
|
174186
174186
|
} catch (e2) {
|
|
174187
174187
|
reject(e2 instanceof Error ? e2 : new Error());
|
|
174188
174188
|
}
|
|
@@ -176127,15 +176127,15 @@ var init_dist = __esm({
|
|
|
176127
176127
|
} else {
|
|
176128
176128
|
serialized = strOrObj;
|
|
176129
176129
|
}
|
|
176130
|
-
const readSerializedProperty = (
|
|
176131
|
-
return serialized && typeof serialized === "object" && inOperator(
|
|
176130
|
+
const readSerializedProperty = (property2) => {
|
|
176131
|
+
return serialized && typeof serialized === "object" && inOperator(property2, serialized) ? serialized[property2] : void 0;
|
|
176132
176132
|
};
|
|
176133
|
-
const readSerializedBoolean = (
|
|
176134
|
-
const value = readSerializedProperty(
|
|
176133
|
+
const readSerializedBoolean = (property2) => {
|
|
176134
|
+
const value = readSerializedProperty(property2);
|
|
176135
176135
|
return typeof value === "boolean" ? value : void 0;
|
|
176136
176136
|
};
|
|
176137
|
-
const readSerializedString = (
|
|
176138
|
-
const value = readSerializedProperty(
|
|
176137
|
+
const readSerializedString = (property2) => {
|
|
176138
|
+
const value = readSerializedProperty(property2);
|
|
176139
176139
|
return typeof value === "string" ? value : void 0;
|
|
176140
176140
|
};
|
|
176141
176141
|
const jar = new _CookieJar(store, {
|
|
@@ -176172,15 +176172,15 @@ var init_dist = __esm({
|
|
|
176172
176172
|
*/
|
|
176173
176173
|
static deserializeSync(strOrObj, store) {
|
|
176174
176174
|
const serialized = typeof strOrObj === "string" ? JSON.parse(strOrObj) : strOrObj;
|
|
176175
|
-
const readSerializedProperty = (
|
|
176176
|
-
return serialized && typeof serialized === "object" && inOperator(
|
|
176175
|
+
const readSerializedProperty = (property2) => {
|
|
176176
|
+
return serialized && typeof serialized === "object" && inOperator(property2, serialized) ? serialized[property2] : void 0;
|
|
176177
176177
|
};
|
|
176178
|
-
const readSerializedBoolean = (
|
|
176179
|
-
const value = readSerializedProperty(
|
|
176178
|
+
const readSerializedBoolean = (property2) => {
|
|
176179
|
+
const value = readSerializedProperty(property2);
|
|
176180
176180
|
return typeof value === "boolean" ? value : void 0;
|
|
176181
176181
|
};
|
|
176182
|
-
const readSerializedString = (
|
|
176183
|
-
const value = readSerializedProperty(
|
|
176182
|
+
const readSerializedString = (property2) => {
|
|
176183
|
+
const value = readSerializedProperty(property2);
|
|
176184
176184
|
return typeof value === "string" ? value : void 0;
|
|
176185
176185
|
};
|
|
176186
176186
|
const jar = new _CookieJar(store, {
|
|
@@ -177357,52 +177357,274 @@ var init_collect = __esm({
|
|
|
177357
177357
|
}
|
|
177358
177358
|
});
|
|
177359
177359
|
|
|
177360
|
+
// src/one-app/validate-topbar.ts
|
|
177361
|
+
import { createHash as createHash45 } from "node:crypto";
|
|
177362
|
+
import { readFileSync as readFileSync105, statSync as statSync22 } from "node:fs";
|
|
177363
|
+
import { resolve as resolve62, join as join92 } from "node:path";
|
|
177364
|
+
import ts9 from "typescript";
|
|
177365
|
+
function object4(value) {
|
|
177366
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
177367
|
+
}
|
|
177368
|
+
function readJson9(path2) {
|
|
177369
|
+
return object4(JSON.parse(readFileSync105(path2, "utf8"))) ?? {};
|
|
177370
|
+
}
|
|
177371
|
+
function parseArgs(args) {
|
|
177372
|
+
let evidenceDir;
|
|
177373
|
+
let contentDir2;
|
|
177374
|
+
let json8 = false;
|
|
177375
|
+
for (let i2 = 0; i2 < args.length; i2++) {
|
|
177376
|
+
const arg = args[i2];
|
|
177377
|
+
if (arg === "--json") {
|
|
177378
|
+
json8 = true;
|
|
177379
|
+
continue;
|
|
177380
|
+
}
|
|
177381
|
+
if (arg === "--skip-version-check") continue;
|
|
177382
|
+
if (arg !== "--evidence-dir" && arg !== "--content") throw new Error(`Unknown option: ${arg}`);
|
|
177383
|
+
const value = args[++i2];
|
|
177384
|
+
if (!value || value.startsWith("--")) throw new Error(`${arg} requires a directory path.`);
|
|
177385
|
+
if (arg === "--evidence-dir") {
|
|
177386
|
+
if (evidenceDir) throw new Error("Pass --evidence-dir once.");
|
|
177387
|
+
evidenceDir = value;
|
|
177388
|
+
} else {
|
|
177389
|
+
if (contentDir2) throw new Error("Pass --content once.");
|
|
177390
|
+
contentDir2 = value;
|
|
177391
|
+
}
|
|
177392
|
+
}
|
|
177393
|
+
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
177394
|
+
return { evidenceDir: resolve62(evidenceDir), contentDir: resolve62(contentDir2), json: json8 };
|
|
177395
|
+
}
|
|
177396
|
+
function authoredControls(raw) {
|
|
177397
|
+
const screens = object4(raw.screens);
|
|
177398
|
+
const headers2 = object4(raw.headers);
|
|
177399
|
+
if (!screens || !headers2 || !Object.keys(screens).length) {
|
|
177400
|
+
return { controls: /* @__PURE__ */ new Set(), screens: 0, error: "raw-structure.json is missing authored screens or headers." };
|
|
177401
|
+
}
|
|
177402
|
+
const controls = /* @__PURE__ */ new Set();
|
|
177403
|
+
let count2 = 0;
|
|
177404
|
+
for (const [screenId, rawScreen] of Object.entries(screens)) {
|
|
177405
|
+
const screen = object4(rawScreen);
|
|
177406
|
+
const headerId = typeof screen?.headerId === "string" ? screen.headerId : void 0;
|
|
177407
|
+
if (!headerId) continue;
|
|
177408
|
+
count2++;
|
|
177409
|
+
const header = object4(headers2[headerId]);
|
|
177410
|
+
if (!header) return { controls, screens: count2, error: `Authored header ${headerId} is missing for screen ${screenId}.` };
|
|
177411
|
+
const settings = object4(header?.settings) ?? header;
|
|
177412
|
+
const topBarSettings = object4(settings?.topBarSettings);
|
|
177413
|
+
const choice = (modern, legacy) => {
|
|
177414
|
+
const current = topBarSettings?.[modern];
|
|
177415
|
+
if (current !== void 0) return typeof current === "boolean" ? current : void 0;
|
|
177416
|
+
const previous = settings?.[legacy];
|
|
177417
|
+
if (previous !== void 0) return typeof previous === "boolean" ? previous : void 0;
|
|
177418
|
+
return false;
|
|
177419
|
+
};
|
|
177420
|
+
const showCart = choice("showCartIcon", "showCartIconInTopBar");
|
|
177421
|
+
const showChat = choice("showChatIcon", "showChatIconInTopBar");
|
|
177422
|
+
if (showCart === void 0 || showChat === void 0) {
|
|
177423
|
+
return { controls, screens: count2, error: `Authored cart/chat settings are invalid for screen ${screenId} (header ${headerId}).` };
|
|
177424
|
+
}
|
|
177425
|
+
if (showCart) controls.add("cart");
|
|
177426
|
+
if (showChat) controls.add("chat");
|
|
177427
|
+
}
|
|
177428
|
+
if (!count2) return { controls, screens: 0, error: "No screen references an authored header in raw-structure.json." };
|
|
177429
|
+
return { controls, screens: count2 };
|
|
177430
|
+
}
|
|
177431
|
+
function property(node, name) {
|
|
177432
|
+
const item = node?.properties.find((candidate) => ts9.isPropertyAssignment(candidate) && ((ts9.isIdentifier(candidate.name) || ts9.isStringLiteral(candidate.name)) && candidate.name.text === name));
|
|
177433
|
+
return item && ts9.isPropertyAssignment(item) ? item.initializer : void 0;
|
|
177434
|
+
}
|
|
177435
|
+
function unwrap2(node) {
|
|
177436
|
+
while (ts9.isParenthesizedExpression(node) || ts9.isAsExpression(node) || ts9.isSatisfiesExpression(node)) node = node.expression;
|
|
177437
|
+
return node;
|
|
177438
|
+
}
|
|
177439
|
+
function resolveObject(node, source, seen = /* @__PURE__ */ new Set()) {
|
|
177440
|
+
if (!node) return void 0;
|
|
177441
|
+
const value = unwrap2(node);
|
|
177442
|
+
if (ts9.isObjectLiteralExpression(value)) return value;
|
|
177443
|
+
if (!ts9.isIdentifier(value) || seen.has(value.text)) return void 0;
|
|
177444
|
+
seen.add(value.text);
|
|
177445
|
+
for (const statement of source.statements) {
|
|
177446
|
+
if (!ts9.isVariableStatement(statement)) continue;
|
|
177447
|
+
const declaration = statement.declarationList.declarations.find((item) => ts9.isIdentifier(item.name) && item.name.text === value.text);
|
|
177448
|
+
if (declaration?.initializer) return resolveObject(declaration.initializer, source, seen);
|
|
177449
|
+
}
|
|
177450
|
+
return void 0;
|
|
177451
|
+
}
|
|
177452
|
+
function stringValue2(node) {
|
|
177453
|
+
if (!node) return void 0;
|
|
177454
|
+
const value = unwrap2(node);
|
|
177455
|
+
return ts9.isStringLiteralLike(value) ? value.text : void 0;
|
|
177456
|
+
}
|
|
177457
|
+
function actionTokens(action) {
|
|
177458
|
+
const values = ["id", "icon", "label", "accessibilityLabel"].map((key3) => stringValue2(property(action, key3)) ?? "").join(" ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
177459
|
+
return new Set(values);
|
|
177460
|
+
}
|
|
177461
|
+
function hasAction(node, source) {
|
|
177462
|
+
const action = resolveObject(node, source);
|
|
177463
|
+
const actionId = stringValue2(property(action, "actionId"));
|
|
177464
|
+
return typeof actionId === "string" && actionId.trim().length > 0;
|
|
177465
|
+
}
|
|
177466
|
+
function configActions(configPath) {
|
|
177467
|
+
const source = ts9.createSourceFile(configPath, readFileSync105(configPath, "utf8"), ts9.ScriptTarget.Latest, true, ts9.ScriptKind.TS);
|
|
177468
|
+
if (source.parseDiagnostics.length) return { actions: [], error: "config.ts could not be parsed." };
|
|
177469
|
+
const exportAssignment = source.statements.find(ts9.isExportAssignment);
|
|
177470
|
+
if (!exportAssignment) return { actions: [], error: "config.ts has no default app export." };
|
|
177471
|
+
let exported = unwrap2(exportAssignment.expression);
|
|
177472
|
+
if (ts9.isIdentifier(exported)) {
|
|
177473
|
+
const exportedName = exported.text;
|
|
177474
|
+
for (const statement of source.statements) {
|
|
177475
|
+
if (!ts9.isVariableStatement(statement)) continue;
|
|
177476
|
+
const declaration = statement.declarationList.declarations.find((item) => ts9.isIdentifier(item.name) && item.name.text === exportedName);
|
|
177477
|
+
if (declaration?.initializer) {
|
|
177478
|
+
exported = unwrap2(declaration.initializer);
|
|
177479
|
+
break;
|
|
177480
|
+
}
|
|
177481
|
+
}
|
|
177482
|
+
}
|
|
177483
|
+
if (!ts9.isCallExpression(exported) || !exported.arguments[0]) return { actions: [], error: "config.ts does not default-export defineApp({...})." };
|
|
177484
|
+
const app = resolveObject(exported.arguments[0], source);
|
|
177485
|
+
const navigation = resolveObject(property(app, "navigation"), source);
|
|
177486
|
+
const topBar = resolveObject(property(navigation, "topBarDefault"), source);
|
|
177487
|
+
if (!topBar) return { actions: [], error: "navigation.topBarDefault is absent or cannot be statically inspected." };
|
|
177488
|
+
const actionExpr = property(topBar, "actions");
|
|
177489
|
+
if (!actionExpr) return { actions: [] };
|
|
177490
|
+
const actionsNode = unwrap2(actionExpr);
|
|
177491
|
+
let items;
|
|
177492
|
+
if (ts9.isArrayLiteralExpression(actionsNode)) items = actionsNode.elements.filter(ts9.isExpression);
|
|
177493
|
+
else if (ts9.isIdentifier(actionsNode)) {
|
|
177494
|
+
const declaration = source.statements.filter(ts9.isVariableStatement).flatMap((statement) => [...statement.declarationList.declarations]).find((item) => ts9.isIdentifier(item.name) && item.name.text === actionsNode.text);
|
|
177495
|
+
const init = declaration?.initializer && unwrap2(declaration.initializer);
|
|
177496
|
+
if (!init || !ts9.isArrayLiteralExpression(init)) return { actions: [], error: "navigation.topBarDefault.actions cannot be statically inspected." };
|
|
177497
|
+
items = init.elements.filter(ts9.isExpression);
|
|
177498
|
+
} else return { actions: [], error: "navigation.topBarDefault.actions cannot be statically inspected." };
|
|
177499
|
+
const actions = [];
|
|
177500
|
+
for (const item of items) {
|
|
177501
|
+
const action = resolveObject(item, source);
|
|
177502
|
+
if (!action) continue;
|
|
177503
|
+
actions.push({ tokens: actionTokens(action), tappable: hasAction(property(action, "onTap"), source) });
|
|
177504
|
+
}
|
|
177505
|
+
return { actions };
|
|
177506
|
+
}
|
|
177507
|
+
function validate4(evidenceDir, contentDir2) {
|
|
177508
|
+
let source;
|
|
177509
|
+
try {
|
|
177510
|
+
const manifest = readJson9(join92(evidenceDir, "manifest.json"));
|
|
177511
|
+
if (manifest.workflow !== "one-app-to-himi-app") throw new Error("manifest.json is not for the one-app-to-himi-app workflow.");
|
|
177512
|
+
if (manifest.stage !== "collected") throw new Error('manifest.json must have stage "collected".');
|
|
177513
|
+
const rawPath = join92(evidenceDir, "raw-structure.json");
|
|
177514
|
+
const rawBytes = readFileSync105(rawPath);
|
|
177515
|
+
const expectedHash = object4(manifest.sha256)?.["raw-structure.json"];
|
|
177516
|
+
if (typeof expectedHash !== "string" || !/^[a-f0-9]{64}$/i.test(expectedHash)) {
|
|
177517
|
+
throw new Error("manifest.json is missing a valid raw-structure.json hash.");
|
|
177518
|
+
}
|
|
177519
|
+
if (createHash45("sha256").update(rawBytes).digest("hex") !== expectedHash) {
|
|
177520
|
+
throw new Error("raw-structure.json does not match the hash recorded in manifest.json.");
|
|
177521
|
+
}
|
|
177522
|
+
source = authoredControls(JSON.parse(rawBytes.toString("utf8")));
|
|
177523
|
+
if (source.error) throw new Error(source.error);
|
|
177524
|
+
} catch (error) {
|
|
177525
|
+
return { ok: false, code: "evidence_invalid", workflow: "one-app-to-himi-app", error: error instanceof Error ? error.message : String(error) };
|
|
177526
|
+
}
|
|
177527
|
+
let target;
|
|
177528
|
+
let configPath;
|
|
177529
|
+
try {
|
|
177530
|
+
configPath = join92(contentDir2, "config.ts");
|
|
177531
|
+
if (!statSync22(configPath).isFile()) throw new Error("config.ts is not a file.");
|
|
177532
|
+
target = configActions(configPath);
|
|
177533
|
+
if (target.error && source.controls.size) throw new Error(target.error);
|
|
177534
|
+
} catch (error) {
|
|
177535
|
+
return { ok: false, code: "config_uninspectable", workflow: "one-app-to-himi-app", error: error instanceof Error ? error.message : String(error) };
|
|
177536
|
+
}
|
|
177537
|
+
const missing = [];
|
|
177538
|
+
for (const control of source.controls) {
|
|
177539
|
+
const phrases = TERMS[control];
|
|
177540
|
+
const matching = target.actions.filter((action) => phrases.some((term) => action.tokens.has(term)));
|
|
177541
|
+
if (!matching.length) missing.push(`${control}: no matching topBarDefault action`);
|
|
177542
|
+
else if (!matching.some((action) => action.tappable)) missing.push(`${control}: matching action has no onTap handler`);
|
|
177543
|
+
}
|
|
177544
|
+
return {
|
|
177545
|
+
ok: missing.length === 0,
|
|
177546
|
+
...missing.length ? { code: "topbar_coverage_failed" } : {},
|
|
177547
|
+
workflow: "one-app-to-himi-app",
|
|
177548
|
+
source: { basis: "raw-structure.json authored header top-bar settings", screensWithHeaders: source.screens, requiredControls: [...source.controls] },
|
|
177549
|
+
target: { config: configPath, location: "navigation.topBarDefault.actions", actionCount: target.actions.length },
|
|
177550
|
+
missing,
|
|
177551
|
+
...target.error ? { note: target.error } : {}
|
|
177552
|
+
};
|
|
177553
|
+
}
|
|
177554
|
+
async function runOneAppTopBarValidation(args, io2) {
|
|
177555
|
+
if (args.includes("--help")) {
|
|
177556
|
+
io2.log(USAGE);
|
|
177557
|
+
return 0;
|
|
177558
|
+
}
|
|
177559
|
+
let options;
|
|
177560
|
+
try {
|
|
177561
|
+
options = parseArgs(args);
|
|
177562
|
+
} catch (error) {
|
|
177563
|
+
io2.error(JSON.stringify({ ok: false, code: "invalid_usage", error: error instanceof Error ? error.message : String(error), usage: USAGE }));
|
|
177564
|
+
return 2;
|
|
177565
|
+
}
|
|
177566
|
+
const result = validate4(options.evidenceDir, options.contentDir);
|
|
177567
|
+
const output = JSON.stringify(result, null, 2);
|
|
177568
|
+
(result.ok ? io2.log : io2.error)(output);
|
|
177569
|
+
return result.ok ? 0 : 1;
|
|
177570
|
+
}
|
|
177571
|
+
var USAGE, TERMS;
|
|
177572
|
+
var init_validate_topbar = __esm({
|
|
177573
|
+
"src/one-app/validate-topbar.ts"() {
|
|
177574
|
+
USAGE = "himi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]";
|
|
177575
|
+
TERMS = {
|
|
177576
|
+
cart: ["cart", "bag", "basket", "checkout"],
|
|
177577
|
+
chat: ["chat", "message", "inbox", "conversation", "support"]
|
|
177578
|
+
};
|
|
177579
|
+
}
|
|
177580
|
+
});
|
|
177581
|
+
|
|
177360
177582
|
// src/one-app/graph.ts
|
|
177361
177583
|
function buildSourceGraph(raw, enriched = {}) {
|
|
177362
177584
|
const enrichedStructures = Object.values(enriched).filter((value) => value !== void 0);
|
|
177363
177585
|
function sourceMap2(key3) {
|
|
177364
177586
|
const result = {};
|
|
177365
177587
|
for (const structure of enrichedStructures) {
|
|
177366
|
-
for (const [id, value] of Object.entries(
|
|
177588
|
+
for (const [id, value] of Object.entries(object5(structure[key3]))) {
|
|
177367
177589
|
if (!own4(result, id)) result[id] = value;
|
|
177368
177590
|
}
|
|
177369
177591
|
}
|
|
177370
|
-
for (const [id, value] of Object.entries(
|
|
177371
|
-
result[id] = own4(result, id) ? { ...
|
|
177592
|
+
for (const [id, value] of Object.entries(object5(raw[key3]))) {
|
|
177593
|
+
result[id] = own4(result, id) ? { ...object5(result[id]), ...object5(value) } : value;
|
|
177372
177594
|
}
|
|
177373
177595
|
return result;
|
|
177374
177596
|
}
|
|
177375
177597
|
function definitionMap(key3) {
|
|
177376
177598
|
const result = {};
|
|
177377
177599
|
for (const structure of enrichedStructures) {
|
|
177378
|
-
for (const [id, value] of Object.entries(
|
|
177600
|
+
for (const [id, value] of Object.entries(object5(object5(structure.definitions)[key3]))) {
|
|
177379
177601
|
if (!own4(result, id)) result[id] = value;
|
|
177380
177602
|
}
|
|
177381
177603
|
}
|
|
177382
|
-
for (const [id, value] of Object.entries(
|
|
177383
|
-
result[id] = own4(result, id) ? { ...
|
|
177604
|
+
for (const [id, value] of Object.entries(object5(object5(raw.definitions)[key3]))) {
|
|
177605
|
+
result[id] = own4(result, id) ? { ...object5(result[id]), ...object5(value) } : value;
|
|
177384
177606
|
}
|
|
177385
177607
|
return result;
|
|
177386
177608
|
}
|
|
177387
177609
|
function platformMap(platformStructure, key3) {
|
|
177388
|
-
const result = { ...
|
|
177389
|
-
for (const [id, value] of Object.entries(
|
|
177390
|
-
result[id] = own4(result, id) ? { ...
|
|
177610
|
+
const result = { ...object5(platformStructure[key3]) };
|
|
177611
|
+
for (const [id, value] of Object.entries(object5(raw[key3]))) {
|
|
177612
|
+
result[id] = own4(result, id) ? { ...object5(result[id]), ...object5(value) } : value;
|
|
177391
177613
|
}
|
|
177392
177614
|
return result;
|
|
177393
177615
|
}
|
|
177394
177616
|
function platformDefinitionMap(platformStructure, key3) {
|
|
177395
|
-
const result = { ...
|
|
177396
|
-
for (const [id, value] of Object.entries(
|
|
177397
|
-
result[id] = own4(result, id) ? { ...
|
|
177617
|
+
const result = { ...object5(object5(platformStructure.definitions)[key3]) };
|
|
177618
|
+
for (const [id, value] of Object.entries(object5(object5(raw.definitions)[key3]))) {
|
|
177619
|
+
result[id] = own4(result, id) ? { ...object5(result[id]), ...object5(value) } : value;
|
|
177398
177620
|
}
|
|
177399
177621
|
return result;
|
|
177400
177622
|
}
|
|
177401
177623
|
const screens = sourceMap2("screens");
|
|
177402
|
-
const layouts =
|
|
177403
|
-
const allSections =
|
|
177404
|
-
const sections = Object.fromEntries(Object.entries(allSections).filter(([, v2]) => !string3(
|
|
177405
|
-
const headers2 =
|
|
177624
|
+
const layouts = object5(raw.layoutItems);
|
|
177625
|
+
const allSections = object5(raw.sections);
|
|
177626
|
+
const sections = Object.fromEntries(Object.entries(allSections).filter(([, v2]) => !string3(object5(v2).sectionDefinitionId)?.startsWith("ntt.")));
|
|
177627
|
+
const headers2 = object5(raw.headers);
|
|
177406
177628
|
const topBars = sourceMap2("topBars");
|
|
177407
177629
|
const topBarButtonDefinitions = definitionMap("topBarButtons");
|
|
177408
177630
|
const actionDefinitions = definitionMap("actions");
|
|
@@ -177414,23 +177636,23 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177414
177636
|
const layoutAliases = /* @__PURE__ */ new Map();
|
|
177415
177637
|
const interactions = [];
|
|
177416
177638
|
for (const [id, value] of Object.entries(layouts)) {
|
|
177417
|
-
const slug = string3(
|
|
177639
|
+
const slug = string3(object5(value).slug);
|
|
177418
177640
|
if (slug) layoutAliases.set(slug, [...layoutAliases.get(slug) ?? [], id]);
|
|
177419
177641
|
}
|
|
177420
177642
|
for (const [id, value] of Object.entries(screens)) {
|
|
177421
|
-
for (const ref of array3(
|
|
177422
|
-
const layoutId = string3(
|
|
177643
|
+
for (const ref of array3(object5(object5(value).layout).items)) {
|
|
177644
|
+
const layoutId = string3(object5(ref).layoutItemId);
|
|
177423
177645
|
if (layoutId) parents.set(layoutId, [.../* @__PURE__ */ new Set([...parents.get(layoutId) ?? [], id])]);
|
|
177424
177646
|
}
|
|
177425
177647
|
}
|
|
177426
177648
|
for (const [name, values] of Object.entries({ screens, layoutItems: layouts, sections, headers: headers2 })) {
|
|
177427
177649
|
for (const [id, value] of Object.entries(values)) {
|
|
177428
|
-
const declared = string3(
|
|
177650
|
+
const declared = string3(object5(value).id);
|
|
177429
177651
|
if (declared !== void 0 && declared !== id) warnings.push({ code: "id_conflict", pointer: `/${name}/${part(id)}/id`, reference: declared });
|
|
177430
177652
|
}
|
|
177431
177653
|
}
|
|
177432
177654
|
function order(refs, pointer) {
|
|
177433
|
-
const indexes = refs.map((ref) =>
|
|
177655
|
+
const indexes = refs.map((ref) => object5(ref).orderIndex).filter((v2) => typeof v2 === "number");
|
|
177434
177656
|
if (indexes.some((v2, i2) => i2 > 0 && v2 <= indexes[i2 - 1])) warnings.push({ code: "order_conflict", pointer });
|
|
177435
177657
|
}
|
|
177436
177658
|
function route(value, contract, pointer) {
|
|
@@ -177460,7 +177682,7 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177460
177682
|
warnings.push({ code: "action_depth_limit", pointer: current.pointer });
|
|
177461
177683
|
continue;
|
|
177462
177684
|
}
|
|
177463
|
-
const item =
|
|
177685
|
+
const item = object5(current.value);
|
|
177464
177686
|
const kind = string3(item.type);
|
|
177465
177687
|
if (kind && ["goToScreen", "vertical", "form", "url", "tel", "mailto"].includes(kind)) {
|
|
177466
177688
|
const dest = string3(item.screenId);
|
|
@@ -177472,14 +177694,14 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177472
177694
|
function placements(value, pointer, context = pointer) {
|
|
177473
177695
|
const refs = array3(value);
|
|
177474
177696
|
const inScope = refs.filter((ref) => {
|
|
177475
|
-
const id = string3(
|
|
177476
|
-
return !id || !string3(
|
|
177697
|
+
const id = string3(object5(ref).elementId);
|
|
177698
|
+
return !id || !string3(object5(allSections[id]).sectionDefinitionId)?.startsWith("ntt.");
|
|
177477
177699
|
});
|
|
177478
177700
|
order(inScope, pointer);
|
|
177479
177701
|
return refs.flatMap((value2, index) => {
|
|
177480
|
-
const ref =
|
|
177702
|
+
const ref = object5(value2);
|
|
177481
177703
|
const id = string3(ref.elementId);
|
|
177482
|
-
if (id && string3(
|
|
177704
|
+
if (id && string3(object5(allSections[id]).sectionDefinitionId)?.startsWith("ntt.")) return [];
|
|
177483
177705
|
const refPointer = `${pointer}/${index}`;
|
|
177484
177706
|
if (ref.elementType !== "SECTION") {
|
|
177485
177707
|
warnings.push({ code: "unknown_element_type", pointer: refPointer, reference: string3(ref.elementType) });
|
|
@@ -177492,19 +177714,19 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177492
177714
|
usedSections.add(id);
|
|
177493
177715
|
const placementContext = `${context}/${index}`;
|
|
177494
177716
|
actions(sections[id], `/sections/${part(id)}`, placementContext);
|
|
177495
|
-
return [{ pointer: refPointer, context: placementContext, arrayIndex: index, ...own4(ref, "orderIndex") ? { orderIndex: ref.orderIndex } : {}, sectionId: id, sectionDefinitionId: string3(
|
|
177717
|
+
return [{ pointer: refPointer, context: placementContext, arrayIndex: index, ...own4(ref, "orderIndex") ? { orderIndex: ref.orderIndex } : {}, sectionId: id, sectionDefinitionId: string3(object5(sections[id]).sectionDefinitionId), reference: ref }];
|
|
177496
177718
|
});
|
|
177497
177719
|
}
|
|
177498
177720
|
function topBarButtons(value, side2, pointer, context, buttonDefinitions = topBarButtonDefinitions, availableActions = actionDefinitions, trackInteractions = true) {
|
|
177499
|
-
const bar =
|
|
177721
|
+
const bar = object5(value);
|
|
177500
177722
|
const idsKey = `${side2}ButtonIds`;
|
|
177501
177723
|
const definitionsKey = `${side2}ButtonDefinitions`;
|
|
177502
177724
|
const refs = own4(bar, idsKey) ? array3(bar[idsKey]) : array3(bar[definitionsKey]);
|
|
177503
177725
|
return refs.map((ref, index) => {
|
|
177504
|
-
const refObject =
|
|
177726
|
+
const refObject = object5(ref);
|
|
177505
177727
|
const id = typeof ref === "string" ? ref : string3(refObject.topBarButtonDefinitionId) ?? string3(refObject.id);
|
|
177506
177728
|
const definition = id && own4(buttonDefinitions, id) ? buttonDefinitions[id] : typeof ref === "object" && ref !== null ? ref : void 0;
|
|
177507
|
-
const actionDefinitionId = string3(
|
|
177729
|
+
const actionDefinitionId = string3(object5(definition).actionDefinitionId) ?? string3(refObject.actionDefinitionId);
|
|
177508
177730
|
const actionDefinition = actionDefinitionId && own4(availableActions, actionDefinitionId) ? availableActions[actionDefinitionId] : void 0;
|
|
177509
177731
|
const buttonPointer = `${pointer}/${side2}/${index}`;
|
|
177510
177732
|
if (trackInteractions) {
|
|
@@ -177520,8 +177742,8 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177520
177742
|
});
|
|
177521
177743
|
}
|
|
177522
177744
|
const screenGraph = Object.entries(screens).map(([screenId, source]) => {
|
|
177523
|
-
const screen =
|
|
177524
|
-
const layout =
|
|
177745
|
+
const screen = object5(source);
|
|
177746
|
+
const layout = object5(screen.layout);
|
|
177525
177747
|
const type = string3(layout.type);
|
|
177526
177748
|
const refs = array3(layout.items);
|
|
177527
177749
|
const pointer = `/screens/${part(screenId)}`;
|
|
@@ -177544,7 +177766,7 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177544
177766
|
};
|
|
177545
177767
|
const topBarByPlatform = Object.fromEntries(Object.entries(enriched).flatMap(([platform, platformStructure]) => {
|
|
177546
177768
|
if (!platformStructure) return [];
|
|
177547
|
-
const platformScreen = { ...
|
|
177769
|
+
const platformScreen = { ...object5(object5(platformStructure.screens)[screenId]), ...object5(object5(raw.screens)[screenId]) };
|
|
177548
177770
|
const platformTopBarId = string3(platformScreen.topBarId);
|
|
177549
177771
|
if (!platformTopBarId) return [];
|
|
177550
177772
|
const platformTopBar = platformMap(platformStructure, "topBars")[platformTopBarId];
|
|
@@ -177563,13 +177785,13 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177563
177785
|
}]];
|
|
177564
177786
|
}));
|
|
177565
177787
|
const pages2 = refs.flatMap((value, index) => {
|
|
177566
|
-
const ref =
|
|
177788
|
+
const ref = object5(value), id = string3(ref.layoutItemId);
|
|
177567
177789
|
if (!id || !own4(layouts, id)) {
|
|
177568
177790
|
warnings.push({ code: "missing_reference", pointer: `${pointer}/layout/items/${index}`, ...id ? { reference: id } : {} });
|
|
177569
177791
|
return [];
|
|
177570
177792
|
}
|
|
177571
177793
|
usedLayouts.add(id);
|
|
177572
|
-
const item =
|
|
177794
|
+
const item = object5(layouts[id]);
|
|
177573
177795
|
return [{
|
|
177574
177796
|
layoutItemId: id,
|
|
177575
177797
|
arrayIndex: index,
|
|
@@ -177599,7 +177821,7 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177599
177821
|
};
|
|
177600
177822
|
});
|
|
177601
177823
|
const detachedLayouts = Object.entries(layouts).filter(([id]) => !usedLayouts.has(id)).map(([id, value]) => {
|
|
177602
|
-
const item =
|
|
177824
|
+
const item = object5(value);
|
|
177603
177825
|
return {
|
|
177604
177826
|
layoutItemId: id,
|
|
177605
177827
|
title: item.title,
|
|
@@ -177609,26 +177831,26 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177609
177831
|
placements: placements(item.elements, `/layoutItems/${part(id)}/elements`)
|
|
177610
177832
|
};
|
|
177611
177833
|
});
|
|
177612
|
-
const bottomTabs = array3(
|
|
177834
|
+
const bottomTabs = array3(object5(raw.navigation).bottomTabs);
|
|
177613
177835
|
order(bottomTabs, "/navigation/bottomTabs");
|
|
177614
177836
|
const navigation = bottomTabs.map((value, index) => {
|
|
177615
|
-
const entry =
|
|
177837
|
+
const entry = object5(value), id = string3(entry.screenId);
|
|
177616
177838
|
if (!id) warnings.push({ code: "missing_reference", pointer: `/navigation/bottomTabs/${index}/screenId` });
|
|
177617
177839
|
return { arrayIndex: index, entry, ...id ? { destination: route(id, "screen", `/navigation/bottomTabs/${index}/screenId`) } : {} };
|
|
177618
177840
|
});
|
|
177619
|
-
const overrides = Object.entries(
|
|
177620
|
-
const id = string3(
|
|
177841
|
+
const overrides = Object.entries(object5(raw.screenOverrides)).map(([alias2, value]) => {
|
|
177842
|
+
const id = string3(object5(value).screenId);
|
|
177621
177843
|
if (!id) warnings.push({ code: "missing_reference", pointer: `/screenOverrides/${part(alias2)}/screenId` });
|
|
177622
177844
|
return { alias: alias2, source: value, ...id ? { destination: route(id, "screen", `/screenOverrides/${part(alias2)}/screenId`) } : {} };
|
|
177623
177845
|
});
|
|
177624
|
-
const profile =
|
|
177846
|
+
const profile = object5(raw.businessProfile);
|
|
177625
177847
|
const profilePlacements = placements(profile.elements, "/businessProfile/elements");
|
|
177626
177848
|
return {
|
|
177627
177849
|
schemaVersion: 1,
|
|
177628
177850
|
interpretation: "authored-evidence-not-evaluated-access",
|
|
177629
177851
|
ordering: "source-array-order",
|
|
177630
177852
|
appSettings: raw.settings,
|
|
177631
|
-
navigation: { entries: navigation, settings:
|
|
177853
|
+
navigation: { entries: navigation, settings: object5(raw.navigation).settings, firstAuthoredScreenId: string3(object5(bottomTabs[0]).screenId) },
|
|
177632
177854
|
screens: screenGraph,
|
|
177633
177855
|
detachedLayouts,
|
|
177634
177856
|
businessProfile: { settings: profile.settings, placements: profilePlacements },
|
|
@@ -177642,10 +177864,10 @@ function buildSourceGraph(raw, enriched = {}) {
|
|
|
177642
177864
|
next: "Interpret source settings, definition CTAs, top bars and runtime conditions with himi docs one-app-to-himi-app. This graph indexes basic actions; it does not claim complete business-journey coverage."
|
|
177643
177865
|
};
|
|
177644
177866
|
}
|
|
177645
|
-
var
|
|
177867
|
+
var object5, array3, string3, part, own4;
|
|
177646
177868
|
var init_graph = __esm({
|
|
177647
177869
|
"src/one-app/graph.ts"() {
|
|
177648
|
-
|
|
177870
|
+
object5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
177649
177871
|
array3 = (value) => Array.isArray(value) ? value : [];
|
|
177650
177872
|
string3 = (value) => typeof value === "string" ? value : void 0;
|
|
177651
177873
|
part = (value) => value.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
@@ -177655,27 +177877,27 @@ var init_graph = __esm({
|
|
|
177655
177877
|
|
|
177656
177878
|
// src/one-app/navigation.ts
|
|
177657
177879
|
function sourceNavigationKind(raw) {
|
|
177658
|
-
const navigation =
|
|
177659
|
-
if (
|
|
177880
|
+
const navigation = object6(raw.navigation);
|
|
177881
|
+
if (object6(navigation.settings).drawerMode === true) return "side-menu";
|
|
177660
177882
|
const entries = array4(navigation.bottomTabs);
|
|
177661
177883
|
if (entries.length > 1) return "bottom-tabs";
|
|
177662
|
-
const screens =
|
|
177663
|
-
const screenId = string4(
|
|
177664
|
-
const screen = screenId && Object.hasOwn(screens, screenId) ?
|
|
177665
|
-
return
|
|
177884
|
+
const screens = object6(raw.screens);
|
|
177885
|
+
const screenId = string4(object6(entries[0]).screenId);
|
|
177886
|
+
const screen = screenId && Object.hasOwn(screens, screenId) ? object6(screens[screenId]) : {};
|
|
177887
|
+
return object6(screen.layout).type === "TOP_TABS" ? "top-tabs" : "single";
|
|
177666
177888
|
}
|
|
177667
177889
|
function planNavigation(raw, policy = "bottom-tabs") {
|
|
177668
|
-
const navigation =
|
|
177890
|
+
const navigation = object6(raw.navigation);
|
|
177669
177891
|
const entries = array4(navigation.bottomTabs);
|
|
177670
|
-
const screens =
|
|
177671
|
-
const layouts =
|
|
177892
|
+
const screens = object6(raw.screens);
|
|
177893
|
+
const layouts = object6(raw.layoutItems);
|
|
177672
177894
|
const kind = sourceNavigationKind(raw);
|
|
177673
177895
|
const warnings = [];
|
|
177674
|
-
const firstEntry =
|
|
177896
|
+
const firstEntry = object6(entries[0]);
|
|
177675
177897
|
const rootScreenId = string4(firstEntry.screenId) ?? null;
|
|
177676
|
-
const rootScreen = rootScreenId && Object.hasOwn(screens, rootScreenId) ?
|
|
177677
|
-
const rootLayout =
|
|
177678
|
-
const settings =
|
|
177898
|
+
const rootScreen = rootScreenId && Object.hasOwn(screens, rootScreenId) ? object6(screens[rootScreenId]) : {};
|
|
177899
|
+
const rootLayout = object6(rootScreen.layout);
|
|
177900
|
+
const settings = object6(navigation.settings);
|
|
177679
177901
|
const appInstance = string4(raw.appInstance) ?? null;
|
|
177680
177902
|
const source = {
|
|
177681
177903
|
kind,
|
|
@@ -177687,8 +177909,8 @@ function planNavigation(raw, policy = "bottom-tabs") {
|
|
|
177687
177909
|
const next = "Build navigation from this plan with himi docs one-app-to-himi-app. Report every warning; the plan does not replace the source graph.";
|
|
177688
177910
|
if (kind === "bottom-tabs") {
|
|
177689
177911
|
entries.forEach((value, index) => {
|
|
177690
|
-
const id = string4(
|
|
177691
|
-
if (id && Object.hasOwn(screens, id) &&
|
|
177912
|
+
const id = string4(object6(value).screenId);
|
|
177913
|
+
if (id && Object.hasOwn(screens, id) && object6(object6(screens[id]).layout).type === "TOP_TABS") {
|
|
177692
177914
|
warnings.push({ code: "nested_top_tabs", pointer: `/screens/${part2(id)}/layout/type`, reference: `/navigation/bottomTabs/${index}` });
|
|
177693
177915
|
}
|
|
177694
177916
|
});
|
|
@@ -177699,14 +177921,14 @@ function planNavigation(raw, policy = "bottom-tabs") {
|
|
|
177699
177921
|
const tabs = [];
|
|
177700
177922
|
const hiddenPages = [];
|
|
177701
177923
|
array4(rootLayout.items).forEach((value, index) => {
|
|
177702
|
-
const layoutItemId = string4(
|
|
177924
|
+
const layoutItemId = string4(object6(value).layoutItemId);
|
|
177703
177925
|
const itemPointer = `${pointer}/${index}`;
|
|
177704
177926
|
if (!layoutItemId || !Object.hasOwn(layouts, layoutItemId)) {
|
|
177705
177927
|
warnings.push({ code: "missing_reference", pointer: itemPointer, ...layoutItemId ? { reference: layoutItemId } : {} });
|
|
177706
177928
|
return;
|
|
177707
177929
|
}
|
|
177708
|
-
const layout =
|
|
177709
|
-
if (
|
|
177930
|
+
const layout = object6(layouts[layoutItemId]);
|
|
177931
|
+
if (object6(layout.settings).hideFromNavigation === true) {
|
|
177710
177932
|
hiddenPages.push({ layoutItemId, pointer: itemPointer });
|
|
177711
177933
|
return;
|
|
177712
177934
|
}
|
|
@@ -177751,10 +177973,10 @@ function planNavigation(raw, policy = "bottom-tabs") {
|
|
|
177751
177973
|
next
|
|
177752
177974
|
};
|
|
177753
177975
|
}
|
|
177754
|
-
var
|
|
177976
|
+
var object6, array4, string4, part2, TOP_TABS_POLICIES, MAX_BAR_TABS;
|
|
177755
177977
|
var init_navigation = __esm({
|
|
177756
177978
|
"src/one-app/navigation.ts"() {
|
|
177757
|
-
|
|
177979
|
+
object6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
177758
177980
|
array4 = (value) => Array.isArray(value) ? value : [];
|
|
177759
177981
|
string4 = (value) => typeof value === "string" && value ? value : void 0;
|
|
177760
177982
|
part2 = (value) => value.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
@@ -177770,9 +177992,9 @@ __export(cli_exports2, {
|
|
|
177770
177992
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
177771
177993
|
runOneAppCommand: () => runOneAppCommand
|
|
177772
177994
|
});
|
|
177773
|
-
import { closeSync as closeSync7, constants as constants4, lstatSync as lstatSync22, mkdirSync as mkdirSync43, openSync as openSync6, readFileSync as
|
|
177774
|
-
import { createHash as
|
|
177775
|
-
import { dirname as dirname49, join as
|
|
177995
|
+
import { closeSync as closeSync7, constants as constants4, lstatSync as lstatSync22, mkdirSync as mkdirSync43, openSync as openSync6, readFileSync as readFileSync106, realpathSync as realpathSync14, writeFileSync as writeFileSync41 } from "node:fs";
|
|
177996
|
+
import { createHash as createHash46 } from "node:crypto";
|
|
177997
|
+
import { dirname as dirname49, join as join93, parse as parse3, resolve as resolve63 } from "node:path";
|
|
177776
177998
|
function readOptions(argv, cwd, commandIncluded) {
|
|
177777
177999
|
let cursor = 0;
|
|
177778
178000
|
const skipGlobalSwitches = () => {
|
|
@@ -177817,10 +178039,10 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
177817
178039
|
let prompt = flags.prompt ?? "";
|
|
177818
178040
|
if (flags["prompt-file"] !== void 0) {
|
|
177819
178041
|
try {
|
|
177820
|
-
const file2 =
|
|
178042
|
+
const file2 = resolve63(cwd, flags["prompt-file"]);
|
|
177821
178043
|
const stat2 = lstatSync22(file2);
|
|
177822
178044
|
if (!stat2.isFile() || stat2.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
177823
|
-
prompt =
|
|
178045
|
+
prompt = readFileSync106(file2, "utf8");
|
|
177824
178046
|
} catch {
|
|
177825
178047
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
177826
178048
|
}
|
|
@@ -177835,8 +178057,8 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
177835
178057
|
if (flags.dir !== void 0 && !flags.dir.trim()) {
|
|
177836
178058
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
177837
178059
|
}
|
|
177838
|
-
const parentDir =
|
|
177839
|
-
const workspace =
|
|
178060
|
+
const parentDir = resolve63(cwd, flags.dir ?? ".");
|
|
178061
|
+
const workspace = join93(parentDir, name);
|
|
177840
178062
|
assertSafeParents(parentDir);
|
|
177841
178063
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
177842
178064
|
return { metaSiteId, appInstance, prompt, name, parentDir, workspace, target, topTabs };
|
|
@@ -177877,10 +178099,21 @@ function writePrivate(path2, contents, append) {
|
|
|
177877
178099
|
}
|
|
177878
178100
|
}
|
|
177879
178101
|
async function runOneAppCommand(argv, io2, deps = {}, commandIncluded = false) {
|
|
178102
|
+
let commandIndex = 0;
|
|
178103
|
+
while (GLOBAL_SWITCHES.has(argv[commandIndex])) commandIndex++;
|
|
178104
|
+
if (commandIncluded && argv[commandIndex] === "one-app") {
|
|
178105
|
+
commandIndex++;
|
|
178106
|
+
while (GLOBAL_SWITCHES.has(argv[commandIndex])) commandIndex++;
|
|
178107
|
+
}
|
|
178108
|
+
if (argv[commandIndex] === "validate-topbar") {
|
|
178109
|
+
return runOneAppTopBarValidation(argv.slice(commandIndex + 1), io2);
|
|
178110
|
+
}
|
|
177880
178111
|
if (argv.includes("--help")) {
|
|
177881
178112
|
io2.log(`${ONE_APP_USAGE}
|
|
177882
178113
|
|
|
177883
|
-
Collect the source mobile app and hand it to the current coding agent. The agent continues with a faithful plan, local generation and a checked hosted draft. Branded falls back to Free (Spaces) only when absent. This command itself does not launch AI or build an app. --dir is the parent directory; an existing destination is refused. --top-tabs bottom-tabs (default) plans bottom tabs, one per visible page, for a source with top tabs; keep retains the top tabs
|
|
178114
|
+
Collect the source mobile app and hand it to the current coding agent. The agent continues with a faithful plan, local generation and a checked hosted draft. Branded falls back to Free (Spaces) only when absent. This command itself does not launch AI or build an app. --dir is the parent directory; an existing destination is refused. --top-tabs bottom-tabs (default) plans bottom tabs, one per visible page, for a source with top tabs; keep retains the top tabs.
|
|
178115
|
+
|
|
178116
|
+
validate-topbar checks authored source top-bar controls against the migrated config.ts. It is scoped to a One App evidence directory and does not change general himi validate behavior.`);
|
|
177884
178117
|
return 0;
|
|
177885
178118
|
}
|
|
177886
178119
|
const now = deps.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -177893,7 +178126,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
177893
178126
|
const hashes = {};
|
|
177894
178127
|
const diskWrite = deps.writeFile ?? writePrivate;
|
|
177895
178128
|
const put = (name, content) => {
|
|
177896
|
-
const path2 =
|
|
178129
|
+
const path2 = join93(evidenceDir, name);
|
|
177897
178130
|
try {
|
|
177898
178131
|
assertSafeParents(evidenceDir);
|
|
177899
178132
|
diskWrite(path2, content, false);
|
|
@@ -177901,7 +178134,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
177901
178134
|
throw new OneAppError("artifact_write_failed", "Could not save the migration evidence. Existing files were kept.", { stage });
|
|
177902
178135
|
}
|
|
177903
178136
|
artifacts[name] = path2;
|
|
177904
|
-
hashes[name] =
|
|
178137
|
+
hashes[name] = createHash46("sha256").update(content).digest("hex");
|
|
177905
178138
|
return path2;
|
|
177906
178139
|
};
|
|
177907
178140
|
const progress = (nextStage) => {
|
|
@@ -177909,7 +178142,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
177909
178142
|
if (!evidenceDir) return;
|
|
177910
178143
|
try {
|
|
177911
178144
|
assertSafeParents(evidenceDir);
|
|
177912
|
-
diskWrite(
|
|
178145
|
+
diskWrite(join93(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
|
|
177913
178146
|
} catch {
|
|
177914
178147
|
throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
|
|
177915
178148
|
}
|
|
@@ -177925,7 +178158,7 @@ Collect the source mobile app and hand it to the current coding agent. The agent
|
|
|
177925
178158
|
assertSafeParents(options.parentDir);
|
|
177926
178159
|
mkdirSync43(options.workspace, { mode: 448 });
|
|
177927
178160
|
if (realpathSync14(options.workspace) !== options.workspace) throw new Error("destination changed");
|
|
177928
|
-
evidenceDir =
|
|
178161
|
+
evidenceDir = join93(options.workspace, ".himi", "one-app");
|
|
177929
178162
|
mkdirSync43(evidenceDir, { recursive: true, mode: 448 });
|
|
177930
178163
|
} catch (error) {
|
|
177931
178164
|
if (error.code === "EEXIST") {
|
|
@@ -178029,10 +178262,11 @@ var init_cli2 = __esm({
|
|
|
178029
178262
|
"src/one-app/cli.ts"() {
|
|
178030
178263
|
init_wix_owner();
|
|
178031
178264
|
init_collect();
|
|
178265
|
+
init_validate_topbar();
|
|
178032
178266
|
init_errors2();
|
|
178033
178267
|
init_graph();
|
|
178034
178268
|
init_navigation();
|
|
178035
|
-
ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]";
|
|
178269
|
+
ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]\nhimi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]";
|
|
178036
178270
|
ONE_APP_WORKFLOW = "one-app-to-himi-app";
|
|
178037
178271
|
UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
178038
178272
|
SLUG = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
@@ -180059,15 +180293,15 @@ var init_customer_build = __esm({
|
|
|
180059
180293
|
});
|
|
180060
180294
|
|
|
180061
180295
|
// src/site-analyze/apply.ts
|
|
180062
|
-
import { existsSync as existsSync86, readFileSync as
|
|
180063
|
-
import { dirname as dirname50, isAbsolute as isAbsolute8, join as
|
|
180296
|
+
import { existsSync as existsSync86, readFileSync as readFileSync107, writeFileSync as writeFileSync42, copyFileSync as copyFileSync2, mkdirSync as mkdirSync44, realpathSync as realpathSync15, statSync as statSync23 } from "node:fs";
|
|
180297
|
+
import { dirname as dirname50, isAbsolute as isAbsolute8, join as join94, resolve as resolve64, sep as sep20 } from "node:path";
|
|
180064
180298
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
180065
180299
|
function unpairedRedirectNote(overlay) {
|
|
180066
180300
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
180067
180301
|
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)`;
|
|
180068
180302
|
}
|
|
180069
180303
|
function posix4(p2) {
|
|
180070
|
-
return
|
|
180304
|
+
return resolve64(p2).replace(/\\/g, "/");
|
|
180071
180305
|
}
|
|
180072
180306
|
function committedShellProvisioning(path2) {
|
|
180073
180307
|
return committedShellFor(posix4(path2));
|
|
@@ -180075,7 +180309,7 @@ function committedShellProvisioning(path2) {
|
|
|
180075
180309
|
function findRepoRoot(cwd) {
|
|
180076
180310
|
let dir = cwd;
|
|
180077
180311
|
for (let i2 = 0; i2 < 8; i2++) {
|
|
180078
|
-
if (SHELL_NAMES2.some((name) => existsSync86(
|
|
180312
|
+
if (SHELL_NAMES2.some((name) => existsSync86(join94(dir, shellAppDir(name), "package.json")))) return dir;
|
|
180079
180313
|
const next = dirname50(dir);
|
|
180080
180314
|
if (next === dir) break;
|
|
180081
180315
|
dir = next;
|
|
@@ -180101,7 +180335,7 @@ function assertNotCommitted(path2, forbidden2) {
|
|
|
180101
180335
|
`refusing to overwrite committed ${committedProvisioningPath(committed)} \u2014 use prepare:customer --contract`
|
|
180102
180336
|
);
|
|
180103
180337
|
}
|
|
180104
|
-
if (forbidden2 &&
|
|
180338
|
+
if (forbidden2 && resolve64(path2) === resolve64(forbidden2)) {
|
|
180105
180339
|
const named = committedShellProvisioning(forbidden2);
|
|
180106
180340
|
throw new Error(
|
|
180107
180341
|
`refusing to overwrite committed ${named ? committedProvisioningPath(named) : forbidden2} \u2014 pass a content-package provisioning.json or use prepare:customer --contract`
|
|
@@ -180178,23 +180412,23 @@ function sameKnownSite(previous, next) {
|
|
|
180178
180412
|
}
|
|
180179
180413
|
function buildMergedContract(options) {
|
|
180180
180414
|
const { appDir: appDir3, packageDir, overlay } = options;
|
|
180181
|
-
const committedPath =
|
|
180415
|
+
const committedPath = join94(appDir3, "provisioning.json");
|
|
180182
180416
|
if (!existsSync86(committedPath)) {
|
|
180183
180417
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
180184
180418
|
}
|
|
180185
|
-
const committed = JSON.parse(
|
|
180419
|
+
const committed = JSON.parse(readFileSync107(committedPath, "utf8"));
|
|
180186
180420
|
const merged = mergeCustomerOwned(committed, overlay);
|
|
180187
180421
|
const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
|
|
180188
180422
|
const branding = merged.branding ?? {};
|
|
180189
180423
|
const staged = [];
|
|
180190
180424
|
const contained = (root, rel) => {
|
|
180191
180425
|
if (isAbsolute8(rel)) return void 0;
|
|
180192
|
-
const full =
|
|
180193
|
-
return full.startsWith(
|
|
180426
|
+
const full = resolve64(root, rel);
|
|
180427
|
+
return full.startsWith(resolve64(root) + sep20) ? full : void 0;
|
|
180194
180428
|
};
|
|
180195
180429
|
const stage = (fromRel, toRel) => {
|
|
180196
180430
|
const from = contained(packageDir, fromRel);
|
|
180197
|
-
const to2 = contained(
|
|
180431
|
+
const to2 = contained(join94(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
180198
180432
|
if (!from || !to2 || !existsSync86(from)) return void 0;
|
|
180199
180433
|
let real;
|
|
180200
180434
|
let realRoot;
|
|
@@ -180206,7 +180440,7 @@ function buildMergedContract(options) {
|
|
|
180206
180440
|
}
|
|
180207
180441
|
if (!real.startsWith(realRoot + sep20)) return void 0;
|
|
180208
180442
|
try {
|
|
180209
|
-
if (!
|
|
180443
|
+
if (!statSync23(real).isFile()) return void 0;
|
|
180210
180444
|
mkdirSync44(dirname50(to2), { recursive: true });
|
|
180211
180445
|
copyFileSync2(real, to2);
|
|
180212
180446
|
} catch {
|
|
@@ -180217,11 +180451,11 @@ function buildMergedContract(options) {
|
|
|
180217
180451
|
};
|
|
180218
180452
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
180219
180453
|
if (icon) branding.appIconPath = icon;
|
|
180220
|
-
const facesPath =
|
|
180454
|
+
const facesPath = join94(packageDir, "media/fonts/faces.json");
|
|
180221
180455
|
if (existsSync86(facesPath)) {
|
|
180222
180456
|
let faces = [];
|
|
180223
180457
|
try {
|
|
180224
|
-
const parsed = JSON.parse(
|
|
180458
|
+
const parsed = JSON.parse(readFileSync107(facesPath, "utf8"));
|
|
180225
180459
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
180226
180460
|
} catch {
|
|
180227
180461
|
faces = [];
|
|
@@ -180242,9 +180476,9 @@ function buildMergedContract(options) {
|
|
|
180242
180476
|
merged.branding = branding;
|
|
180243
180477
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
180244
180478
|
`;
|
|
180245
|
-
const path2 =
|
|
180479
|
+
const path2 = join94(packageDir, "provisioning.contract.json");
|
|
180246
180480
|
writeFileSync42(path2, body);
|
|
180247
|
-
const localPath2 =
|
|
180481
|
+
const localPath2 = join94(appDir3, LOCAL_CONTRACT_REL);
|
|
180248
180482
|
mkdirSync44(dirname50(localPath2), { recursive: true });
|
|
180249
180483
|
writeFileSync42(localPath2, body);
|
|
180250
180484
|
staged.push(localPath2);
|
|
@@ -180279,10 +180513,10 @@ function catalogTypography(overlay, template) {
|
|
|
180279
180513
|
function staticFaqFor(overlay, overlayPath) {
|
|
180280
180514
|
const own5 = overlay.faq;
|
|
180281
180515
|
if (own5 !== void 0) return deriveStaticFaq(own5);
|
|
180282
|
-
const bookPath =
|
|
180516
|
+
const bookPath = join94(dirname50(resolve64(overlayPath)), "book.json");
|
|
180283
180517
|
if (!existsSync86(bookPath)) return void 0;
|
|
180284
180518
|
try {
|
|
180285
|
-
const book = JSON.parse(
|
|
180519
|
+
const book = JSON.parse(readFileSync107(bookPath, "utf8"));
|
|
180286
180520
|
const copy = book?.copy;
|
|
180287
180521
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
180288
180522
|
const pairs = deriveStaticFaq(copy.faq);
|
|
@@ -180296,10 +180530,10 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
180296
180530
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
180297
180531
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
180298
180532
|
);
|
|
180299
|
-
const bookPath =
|
|
180533
|
+
const bookPath = join94(dirname50(resolve64(overlayPath)), "book.json");
|
|
180300
180534
|
if (!existsSync86(bookPath)) return void 0;
|
|
180301
180535
|
try {
|
|
180302
|
-
const book = JSON.parse(
|
|
180536
|
+
const book = JSON.parse(readFileSync107(bookPath, "utf8"));
|
|
180303
180537
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
180304
180538
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
180305
180539
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -180308,11 +180542,11 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
180308
180542
|
}
|
|
180309
180543
|
}
|
|
180310
180544
|
async function applyOverlays(input) {
|
|
180311
|
-
const cwd =
|
|
180545
|
+
const cwd = resolve64(input.cwd);
|
|
180312
180546
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
180313
180547
|
assertKnownShell(shell);
|
|
180314
|
-
const overlay = JSON.parse(
|
|
180315
|
-
const tokens2 = JSON.parse(
|
|
180548
|
+
const overlay = JSON.parse(readFileSync107(input.overlayPath, "utf8"));
|
|
180549
|
+
const tokens2 = JSON.parse(readFileSync107(input.tokensPath, "utf8"));
|
|
180316
180550
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
180317
180551
|
if (faq !== void 0) overlay.faq = faq;
|
|
180318
180552
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -180329,15 +180563,15 @@ async function applyOverlays(input) {
|
|
|
180329
180563
|
`shell "${shell}" cannot bake a customer brand \u2014 it ships no prepare:customer script`
|
|
180330
180564
|
);
|
|
180331
180565
|
}
|
|
180332
|
-
const appDir3 =
|
|
180333
|
-
const committedPath =
|
|
180334
|
-
const committedSite = existsSync86(committedPath) ? JSON.parse(
|
|
180566
|
+
const appDir3 = join94(repoRoot2, shellAppDir(shell));
|
|
180567
|
+
const committedPath = join94(appDir3, "provisioning.json");
|
|
180568
|
+
const committedSite = existsSync86(committedPath) ? JSON.parse(readFileSync107(committedPath, "utf8")).site : void 0;
|
|
180335
180569
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
180336
180570
|
throw new Error(
|
|
180337
180571
|
`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.`
|
|
180338
180572
|
);
|
|
180339
180573
|
}
|
|
180340
|
-
const packageDir = dirname50(
|
|
180574
|
+
const packageDir = dirname50(resolve64(input.overlayPath));
|
|
180341
180575
|
const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay });
|
|
180342
180576
|
wrote.push(...staged);
|
|
180343
180577
|
const r2 = spawnSync4("npm", ["run", "prepare:customer", "--", "--contract", contract], {
|
|
@@ -180358,9 +180592,9 @@ async function applyOverlays(input) {
|
|
|
180358
180592
|
note: `prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
|
|
180359
180593
|
};
|
|
180360
180594
|
}
|
|
180361
|
-
const pkgProv =
|
|
180595
|
+
const pkgProv = join94(cwd, "provisioning.json");
|
|
180362
180596
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
180363
|
-
const contentPath =
|
|
180597
|
+
const contentPath = join94(cwd, "himalaya.content.json");
|
|
180364
180598
|
const syncViewNames = (before, after) => {
|
|
180365
180599
|
const content = readContentManifest(cwd);
|
|
180366
180600
|
if (!content) return;
|
|
@@ -180373,7 +180607,7 @@ async function applyOverlays(input) {
|
|
|
180373
180607
|
let packageFaq = faq;
|
|
180374
180608
|
let packageGalleries = galleries;
|
|
180375
180609
|
if (existsSync86(pkgProv)) {
|
|
180376
|
-
const cur = JSON.parse(
|
|
180610
|
+
const cur = JSON.parse(readFileSync107(pkgProv, "utf8"));
|
|
180377
180611
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
180378
180612
|
const merged = deepMerge4(cur, overlay);
|
|
180379
180613
|
packageFaq = merged.faq;
|
|
@@ -180389,9 +180623,9 @@ async function applyOverlays(input) {
|
|
|
180389
180623
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
180390
180624
|
overlay.installedVerticals.push("galleries");
|
|
180391
180625
|
}
|
|
180392
|
-
const pkgTokens =
|
|
180626
|
+
const pkgTokens = join94(cwd, "tokens.json");
|
|
180393
180627
|
if (existsSync86(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
180394
|
-
const cur = JSON.parse(
|
|
180628
|
+
const cur = JSON.parse(readFileSync107(pkgTokens, "utf8"));
|
|
180395
180629
|
let tokensIn = tokens2;
|
|
180396
180630
|
if (tokens2.typography) {
|
|
180397
180631
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -180416,9 +180650,9 @@ async function applyOverlays(input) {
|
|
|
180416
180650
|
wrote.push(pkgTokens);
|
|
180417
180651
|
}
|
|
180418
180652
|
const homeAction = homeRefreshActionId(shell);
|
|
180419
|
-
const homeSrc =
|
|
180653
|
+
const homeSrc = join94(cwd, "dev/index.ts");
|
|
180420
180654
|
if (homeAction && existsSync86(homeSrc)) {
|
|
180421
|
-
const prev =
|
|
180655
|
+
const prev = readFileSync107(homeSrc, "utf8");
|
|
180422
180656
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
180423
180657
|
let next = patched.src;
|
|
180424
180658
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -180454,7 +180688,7 @@ async function applyOverlays(input) {
|
|
|
180454
180688
|
}
|
|
180455
180689
|
}
|
|
180456
180690
|
if (!input.iconPath || !existsSync86(input.iconPath)) {
|
|
180457
|
-
const book = input.iconPath ? dirname50(dirname50(
|
|
180691
|
+
const book = input.iconPath ? dirname50(dirname50(resolve64(input.iconPath))) : void 0;
|
|
180458
180692
|
notes.push(
|
|
180459
180693
|
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"
|
|
180460
180694
|
);
|
|
@@ -181418,8 +181652,8 @@ __export(cli_exports3, {
|
|
|
181418
181652
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
181419
181653
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
181420
181654
|
});
|
|
181421
|
-
import { existsSync as existsSync87, readFileSync as
|
|
181422
|
-
import { resolve as
|
|
181655
|
+
import { existsSync as existsSync87, readFileSync as readFileSync108 } from "node:fs";
|
|
181656
|
+
import { resolve as resolve65 } from "node:path";
|
|
181423
181657
|
function applyNeedsClient(shell) {
|
|
181424
181658
|
if (shell === void 0 || !SHELL_NAMES2.includes(shell)) return true;
|
|
181425
181659
|
return !isSiteShell(shell);
|
|
@@ -181452,7 +181686,7 @@ async function runSiteAnalyze(opts) {
|
|
|
181452
181686
|
const assetFetch = assetFetchFor(opts);
|
|
181453
181687
|
const siteFetch = guardedSiteFetch;
|
|
181454
181688
|
const cwd = opts.cwd ?? process.cwd();
|
|
181455
|
-
const outDir =
|
|
181689
|
+
const outDir = resolve65(cwd, opts.outDir ?? ".himi/business-book");
|
|
181456
181690
|
let ownerAuth;
|
|
181457
181691
|
let msid;
|
|
181458
181692
|
const ownerSite = ownerSiteFor(opts);
|
|
@@ -181481,14 +181715,14 @@ async function runSiteAnalyze(opts) {
|
|
|
181481
181715
|
if (opts.shell !== void 0 && isSiteShell(opts.shell)) {
|
|
181482
181716
|
try {
|
|
181483
181717
|
const kind = siteKindForOrigin(result.book.input.siteUrl);
|
|
181484
|
-
const book = kind === "base44" ? base44BookRoutes(
|
|
181718
|
+
const book = kind === "base44" ? base44BookRoutes(resolve65(cwd, ".himi/base44-book/book.json"), result.book.input.siteUrl) : void 0;
|
|
181485
181719
|
const routes = book?.routes;
|
|
181486
181720
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
181487
181721
|
const derived = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
181488
|
-
const prevOverlayPath =
|
|
181722
|
+
const prevOverlayPath = resolve65(outDir, "provisioning.overlay.json");
|
|
181489
181723
|
const prevSite = existsSync87(prevOverlayPath) ? (() => {
|
|
181490
181724
|
try {
|
|
181491
|
-
return JSON.parse(
|
|
181725
|
+
return JSON.parse(readFileSync108(prevOverlayPath, "utf8")).site;
|
|
181492
181726
|
} catch {
|
|
181493
181727
|
return void 0;
|
|
181494
181728
|
}
|
|
@@ -181505,9 +181739,9 @@ async function runSiteAnalyze(opts) {
|
|
|
181505
181739
|
];
|
|
181506
181740
|
}
|
|
181507
181741
|
}
|
|
181508
|
-
const previousOverlay =
|
|
181742
|
+
const previousOverlay = resolve65(outDir, "provisioning.overlay.json");
|
|
181509
181743
|
carryOverGoals(
|
|
181510
|
-
existsSync87(previousOverlay) ?
|
|
181744
|
+
existsSync87(previousOverlay) ? readFileSync108(previousOverlay, "utf8") : void 0,
|
|
181511
181745
|
result.provisioningOverlay
|
|
181512
181746
|
);
|
|
181513
181747
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -181526,9 +181760,9 @@ async function runSiteAnalyze(opts) {
|
|
|
181526
181760
|
if (opts.apply) {
|
|
181527
181761
|
applied = await applyOverlays({
|
|
181528
181762
|
cwd,
|
|
181529
|
-
overlayPath:
|
|
181530
|
-
tokensPath:
|
|
181531
|
-
iconPath:
|
|
181763
|
+
overlayPath: resolve65(outDir, "provisioning.overlay.json"),
|
|
181764
|
+
tokensPath: resolve65(outDir, "tokens.overlay.json"),
|
|
181765
|
+
iconPath: resolve65(outDir, "media/icon.png"),
|
|
181532
181766
|
shell: opts.shell
|
|
181533
181767
|
});
|
|
181534
181768
|
const note = noteWithWarnings(applied.note, warnings);
|
|
@@ -181564,8 +181798,8 @@ async function runSiteFunctionCli(opts) {
|
|
|
181564
181798
|
const token = opts.token ?? await siteToken(msid);
|
|
181565
181799
|
let source;
|
|
181566
181800
|
if (opts.sourcePath) {
|
|
181567
|
-
const p2 =
|
|
181568
|
-
source =
|
|
181801
|
+
const p2 = resolve65(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
181802
|
+
source = readFileSync108(p2, "utf8");
|
|
181569
181803
|
}
|
|
181570
181804
|
let body;
|
|
181571
181805
|
if (opts.bodyRaw != null) {
|
|
@@ -181595,7 +181829,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
181595
181829
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
181596
181830
|
if (!existsSync87(bookPath)) return void 0;
|
|
181597
181831
|
try {
|
|
181598
|
-
const book = JSON.parse(
|
|
181832
|
+
const book = JSON.parse(readFileSync108(bookPath, "utf8"));
|
|
181599
181833
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
181600
181834
|
const host = (u2) => {
|
|
181601
181835
|
try {
|
|
@@ -181644,7 +181878,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
181644
181878
|
cached2 = fromEnv;
|
|
181645
181879
|
return fromEnv;
|
|
181646
181880
|
}
|
|
181647
|
-
const token = await new Promise((
|
|
181881
|
+
const token = await new Promise((resolve67, reject) => {
|
|
181648
181882
|
let child;
|
|
181649
181883
|
try {
|
|
181650
181884
|
child = spawnImpl("wix", ["token"]);
|
|
@@ -181673,7 +181907,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
181673
181907
|
const scan = (d2) => {
|
|
181674
181908
|
out2 += String(d2);
|
|
181675
181909
|
const m2 = out2.match(TOKEN_RE2);
|
|
181676
|
-
if (m2) done(() =>
|
|
181910
|
+
if (m2) done(() => resolve67(m2[0]));
|
|
181677
181911
|
};
|
|
181678
181912
|
child.stdout?.on("data", scan);
|
|
181679
181913
|
child.stderr?.on("data", scan);
|
|
@@ -181850,7 +182084,7 @@ __export(site_create_exports, {
|
|
|
181850
182084
|
runSiteList: () => runSiteList,
|
|
181851
182085
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
181852
182086
|
});
|
|
181853
|
-
import { existsSync as existsSync88, readFileSync as
|
|
182087
|
+
import { existsSync as existsSync88, readFileSync as readFileSync109, writeFileSync as writeFileSync43 } from "node:fs";
|
|
181854
182088
|
import { resolve as resolvePath2 } from "node:path";
|
|
181855
182089
|
function oauthClientName(projectName) {
|
|
181856
182090
|
return `${projectName} client`;
|
|
@@ -181999,7 +182233,7 @@ async function runSiteCreate(opts) {
|
|
|
181999
182233
|
if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
|
|
182000
182234
|
return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
182001
182235
|
}
|
|
182002
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync88, readFileSync:
|
|
182236
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync88, readFileSync: readFileSync109, writeFileSync: writeFileSync43 }) {
|
|
182003
182237
|
const msid = binding2.siteId;
|
|
182004
182238
|
const path2 = resolvePath2(target);
|
|
182005
182239
|
const committed = committedShellProvisioning(path2);
|
|
@@ -182335,7 +182569,7 @@ var init_site_oauth_client = __esm({
|
|
|
182335
182569
|
|
|
182336
182570
|
// src/site-analyze/velo-source.ts
|
|
182337
182571
|
import path from "node:path";
|
|
182338
|
-
import
|
|
182572
|
+
import ts10 from "typescript";
|
|
182339
182573
|
function applySourceEdits(source, edits) {
|
|
182340
182574
|
const chunks = [];
|
|
182341
182575
|
let cursor = 0;
|
|
@@ -182353,13 +182587,13 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
182353
182587
|
/\b(?:IST\.[\w.-]+|eyJ[\w-]+\.[\w-]+\.[\w-]+|(?:sk|rk)_(?:live|test)_[\w-]+|gh[pousr]_[\w]+|github_pat_[\w]+|AKIA[A-Z0-9]{16})\b/g,
|
|
182354
182588
|
REDACTED2
|
|
182355
182589
|
).replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, REDACTED2).replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/'"`]+:[^\s/'"`]+@/gi, "$1[REDACTED]@").replace(/([?&](?:api[-_]?key|token|secret|password|signature)=)[^&#\s'"`]+/gi, "$1[REDACTED]");
|
|
182356
|
-
const parsed =
|
|
182590
|
+
const parsed = ts10.createSourceFile("backend.ts", source, ts10.ScriptTarget.Latest, true);
|
|
182357
182591
|
const comments = /* @__PURE__ */ new Map();
|
|
182358
182592
|
const visitComments = (node) => {
|
|
182359
182593
|
for (const range of [
|
|
182360
|
-
...
|
|
182361
|
-
...
|
|
182362
|
-
...
|
|
182594
|
+
...ts10.getLeadingCommentRanges(source, node.pos) ?? [],
|
|
182595
|
+
...ts10.getTrailingCommentRanges(source, node.pos) ?? [],
|
|
182596
|
+
...ts10.getTrailingCommentRanges(source, node.end) ?? []
|
|
182363
182597
|
]) comments.set(range.pos, range.end);
|
|
182364
182598
|
for (const child of node.getChildren(parsed)) visitComments(child);
|
|
182365
182599
|
};
|
|
@@ -182378,22 +182612,22 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
182378
182612
|
if (/^["'`][A-Za-z0-9_+/=-]{24,}["'`]$/.test(token)) return JSON.stringify(REDACTED2);
|
|
182379
182613
|
return token;
|
|
182380
182614
|
};
|
|
182381
|
-
const clean2 =
|
|
182615
|
+
const clean2 = ts10.createSourceFile("backend.ts", source, ts10.ScriptTarget.Latest, true);
|
|
182382
182616
|
const masks = [];
|
|
182383
182617
|
const collectMasks = (node) => {
|
|
182384
182618
|
const start = node.getStart(clean2);
|
|
182385
|
-
if (
|
|
182619
|
+
if (ts10.isRegularExpressionLiteral(node)) {
|
|
182386
182620
|
masks.push({ start, end: node.end, text: " ".repeat(node.end - start) });
|
|
182387
|
-
} else if (
|
|
182621
|
+
} else if (ts10.isStringLiteral(node) || ts10.isTemplateLiteralToken(node)) {
|
|
182388
182622
|
masks.push({ start, end: node.end, text: source.slice(start, node.end).replace(/;/g, " ") });
|
|
182389
182623
|
}
|
|
182390
|
-
|
|
182624
|
+
ts10.forEachChild(node, collectMasks);
|
|
182391
182625
|
};
|
|
182392
182626
|
collectMasks(clean2);
|
|
182393
182627
|
const assignmentContext = applySourceEdits(source, masks);
|
|
182394
182628
|
const edits = [];
|
|
182395
182629
|
const visitLiterals = (node) => {
|
|
182396
|
-
if (
|
|
182630
|
+
if (ts10.isStringLiteral(node) || ts10.isNoSubstitutionTemplateLiteral(node) || ts10.isTemplateExpression(node)) {
|
|
182397
182631
|
const start = node.getStart(clean2);
|
|
182398
182632
|
const text9 = source.slice(start, node.end);
|
|
182399
182633
|
const redacted = redactLiteral(text9, start);
|
|
@@ -182402,7 +182636,7 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
182402
182636
|
return;
|
|
182403
182637
|
}
|
|
182404
182638
|
}
|
|
182405
|
-
|
|
182639
|
+
ts10.forEachChild(node, visitLiterals);
|
|
182406
182640
|
};
|
|
182407
182641
|
visitLiterals(clean2);
|
|
182408
182642
|
return applySourceEdits(source, edits);
|
|
@@ -182441,19 +182675,19 @@ function selectVeloSource(files, request, knownSecrets = []) {
|
|
|
182441
182675
|
selected.set(file2.path, { source: excerpt, sourceTruncated: excerpt.length < redacted.length });
|
|
182442
182676
|
remaining -= excerpt.length;
|
|
182443
182677
|
const dependencies = [];
|
|
182444
|
-
const parsed =
|
|
182678
|
+
const parsed = ts10.createSourceFile(file2.path, file2.content, ts10.ScriptTarget.Latest, true);
|
|
182445
182679
|
const specifiers = [];
|
|
182446
182680
|
const collectImports = (node) => {
|
|
182447
182681
|
let specifier;
|
|
182448
|
-
if (
|
|
182682
|
+
if (ts10.isImportDeclaration(node) || ts10.isExportDeclaration(node)) {
|
|
182449
182683
|
specifier = node.moduleSpecifier;
|
|
182450
|
-
} else if (
|
|
182684
|
+
} else if (ts10.isImportEqualsDeclaration(node) && ts10.isExternalModuleReference(node.moduleReference)) {
|
|
182451
182685
|
specifier = node.moduleReference.expression;
|
|
182452
|
-
} else if (
|
|
182686
|
+
} else if (ts10.isCallExpression(node) && (node.expression.kind === ts10.SyntaxKind.ImportKeyword || ts10.isIdentifier(node.expression) && node.expression.text === "require")) {
|
|
182453
182687
|
specifier = node.arguments[0];
|
|
182454
182688
|
}
|
|
182455
|
-
if (specifier &&
|
|
182456
|
-
|
|
182689
|
+
if (specifier && ts10.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
|
|
182690
|
+
ts10.forEachChild(node, collectImports);
|
|
182457
182691
|
};
|
|
182458
182692
|
collectImports(parsed);
|
|
182459
182693
|
for (const specifier of specifiers) {
|
|
@@ -182696,12 +182930,12 @@ var init_context = __esm({
|
|
|
182696
182930
|
});
|
|
182697
182931
|
|
|
182698
182932
|
// src/cli.ts
|
|
182699
|
-
import { mkdtempSync as mkdtempSync6, readFileSync as
|
|
182933
|
+
import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync110, mkdirSync as mkdirSync45, writeFileSync as writeFileSync44, existsSync as existsSync89, rmSync as rmSync24, readdirSync as readdirSync36, statSync as statSync24, lstatSync as lstatSync23, accessSync, constants as constants5, renameSync as renameSync13, cpSync as cpSync3 } from "node:fs";
|
|
182700
182934
|
import { execFile as execFile2, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
|
|
182701
182935
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
182702
|
-
import { createHash as
|
|
182936
|
+
import { createHash as createHash47, randomUUID as randomUUID11 } from "node:crypto";
|
|
182703
182937
|
import { tmpdir as tmpdir7, homedir as homedir15, hostname as hostname2 } from "node:os";
|
|
182704
|
-
import { join as
|
|
182938
|
+
import { join as join95, resolve as resolve66, relative as relative16, basename as basename21, dirname as dirname51 } from "node:path";
|
|
182705
182939
|
import { fileURLToPath as fileURLToPath30 } from "node:url";
|
|
182706
182940
|
|
|
182707
182941
|
// ../serve-cli/src/client.ts
|
|
@@ -184788,8 +185022,8 @@ var str10 = (v2) => typeof v2 === "string" ? v2 : void 0;
|
|
|
184788
185022
|
var num3 = (v2) => typeof v2 === "string" && v2 !== "" && Number.isFinite(Number(v2)) ? Number(v2) : void 0;
|
|
184789
185023
|
function embeddedTemplateCatalog() {
|
|
184790
185024
|
return availableTemplates().map((name) => {
|
|
184791
|
-
const path2 =
|
|
184792
|
-
const meta = JSON.parse(
|
|
185025
|
+
const path2 = join95(templateSourceDir(name), TEMPLATE_META_FILE);
|
|
185026
|
+
const meta = JSON.parse(readFileSync110(path2, "utf8"));
|
|
184793
185027
|
if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
|
|
184794
185028
|
throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
|
|
184795
185029
|
}
|
|
@@ -184809,7 +185043,7 @@ var PRODUCED_HINTS = {
|
|
|
184809
185043
|
};
|
|
184810
185044
|
var DEVELOPER_PORTAL_URL = `${SERVE_ORIGIN_PUBLIC_APPS}/docs`;
|
|
184811
185045
|
var MAX_APP_SOURCE_BYTES_HELP = "4 MiB (4,194,304 bytes)";
|
|
184812
|
-
var
|
|
185046
|
+
var USAGE2 = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
184813
185047
|
|
|
184814
185048
|
himi captcha setup|status --app <name> [--site <msid>] [--content <dir>]
|
|
184815
185049
|
create/store or inspect CAPTCHA keys (not login tokens).
|
|
@@ -185657,7 +185891,7 @@ WHAT A PATCH DOES NOT CARRY \u2014 all reported in the output, never silent
|
|
|
185657
185891
|
|
|
185658
185892
|
himi docs releasing-with-himi-serve`;
|
|
185659
185893
|
var COMMANDS2 = [
|
|
185660
|
-
{ name: "one-app", summary: "collect One App source configuration, normalized evidence and an optional user prompt for the current coding agent to reconstruct faithfully, validate and publish a hosted draft. Branded (default, including explicit branded) falls back to Free/Spaces only when absent.
|
|
185894
|
+
{ name: "one-app", summary: "collect One App source configuration, normalized evidence and an optional user prompt for the current coding agent to reconstruct faithfully, validate and publish a hosted draft; validate-topbar checks authored cart/chat controls against the migrated app config using this migration's raw evidence only. Branded (default, including explicit branded) falls back to Free/Spaces only when absent. Collection does not launch a model or build the app. --dir is the parent of the new package; existing targets are refused. A source with top tabs is planned as bottom tabs unless --top-tabs keep. User-scoped Wix authentication is required; WIX_API_KEY is not used.", required: "migrate --msid <uuid> [--app-instance branded|free] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json] | validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]" },
|
|
185661
185895
|
{ name: "hhp", summary: "author responsive HTML/CSS/TypeScript screens compiled to native SDUI and T5 workers; scaffold, inspect the app profile, lint or compile declared sources", required: "init <screen> | profile | lint | compile [--app <name>|--content <dir>] [--json] [--dry-run]" },
|
|
185662
185896
|
{ name: "captcha", summary: "create and store native CAPTCHA keys in Serve, or inspect setup status; customer setup verifies Wix site ownership; does not enable member CAPTCHA SDKs", required: "setup|status --app <app> [--content <dir>] [--site <msid>] [--ios-bundle-id <id>] [--android-package-name <id>] [--target <t>]" },
|
|
185663
185897
|
{ name: "init", summary: "scaffold a starter content package (OTA-only; no native shells). --template <t> starts from a full reference app (branded-lite = consumer storefront over a Wix site; owner-lite = owner CRUD/management) instead of the minimal counter; --templates lists bundled ones; --remote fetches the template off the serve plane (falls back to the bundled copy offline). The new app also gets its agent files (the same set `himi agent-init` writes: AGENTS.md, CLAUDE.md, the himalaya skill, HIMALAYA.md, a SessionStart hook) so the next session started inside it picks the work up; --no-agent skips them. It also makes the build board (.himi/studio/, exactly as `himi studio --no-open` does \u2014 it never opens a browser), so every later render, test, validate, push and progress entry refreshes it; and, for a template bundled with this CLI, it makes the FIRST PICTURE itself (never for a --remote one: that is its publisher's code, and a render runs it on this machine, so next[] leaves the render to the agent after it has read the code): exactly `himi render <homeScreenId> --png --mocks --device iphone` (offline \u2014 no request; never --live; --mocks loads the app's recorded data when it has any), run as a child it kills after a time budget, writing .himi/shots/<home>.png and journaling it (by: himi) as the STARTING POINT (\"Starting point: the <template> template, before any of your changes\") so the board and the journal hold a picture when init returns. init also records the source it wrote (.himi/init-source.json: a content fingerprint, Markdown left out), and the first home PNG render after the source diverges from it is journaled once as \"First look at your app\" \u2014 reported as `firstLook: {image}` or `{skipped: <reason>}`, never a failed init; `--no-first-look` skips it (for scripts and CI that render themselves). For a bundled template (never a --remote one \u2014 the preview would build and serve its publisher's code) init also STARTS the live preview itself: `himi run --watch --content <dir> --port <p> --no-open --idle-exit 30`, detached in its own process group with its output in .himi/watch.log, never waited for (the url is chosen before it builds), recorded in .himi/watch.json, and reported as `watch: {started, pid, url, board, log}` \u2014 or `{skipped: <reason>}` for a `CI` environment, a test runner, a watch already running, or a start that failed (never a failed init). Nothing else skips it: outside CI it is started, and `watch.note` says an opt-out was ignored. The envelope LEADS with `doNow`: three lines to run now (the consent preflight, the live preview \u2014 its url and board when init started it, else `himi run --watch --content <dir> &` with the board's path \u2014 and the postcard line), and ENDS with the same lines as `doNowAgain`, so an agent that reads only the head or only the tail (`| tail`) gets them; at a terminal they are also printed as plain text on stderr, before the JSON and again after it. Its `next[]` LEADS with the steps for THIS session, in this order for every app \u2014 the offline first render and that picture's `himi progress` postcard (only when init could not make the picture), the skill's consent preflight (authorize or mock any Wix or external startup request; with none, go straight on), and only then the live preview (the running one's url, or `himi run --watch &` when init did not start it) \u2014 ahead of the next-session guidance", required: "<name> [--dir] [--template <t>] [--remote] [--base44-app-id <id>] [--base44-app-url <https://tenant>] [--no-agent] [--no-first-look] | --templates" },
|
|
@@ -185723,7 +185957,7 @@ var COMMANDS2 = [
|
|
|
185723
185957
|
];
|
|
185724
185958
|
function cliVersion() {
|
|
185725
185959
|
try {
|
|
185726
|
-
return JSON.parse(
|
|
185960
|
+
return JSON.parse(readFileSync110(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
|
|
185727
185961
|
} catch {
|
|
185728
185962
|
return "unknown";
|
|
185729
185963
|
}
|
|
@@ -185774,18 +186008,18 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
|
|
|
185774
186008
|
}
|
|
185775
186009
|
var SCOPED_REGISTRY_TIMEOUT_MS = 5e3;
|
|
185776
186010
|
function execNpmConfig(file2, args, options) {
|
|
185777
|
-
return new Promise((
|
|
185778
|
-
execFile2(file2, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) :
|
|
186011
|
+
return new Promise((resolve67, reject) => {
|
|
186012
|
+
execFile2(file2, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve67(String(stdout)));
|
|
185779
186013
|
});
|
|
185780
186014
|
}
|
|
185781
186015
|
var npmScopedWixRegistry = createScopedRegistryResolver();
|
|
185782
186016
|
async function scopedRegistryBefore(lookup4, deadline, onTimeout) {
|
|
185783
186017
|
let cancel = () => {
|
|
185784
186018
|
};
|
|
185785
|
-
const expired = new Promise((
|
|
186019
|
+
const expired = new Promise((resolve67) => {
|
|
185786
186020
|
const timer = setTimeout(() => {
|
|
185787
186021
|
onTimeout?.();
|
|
185788
|
-
|
|
186022
|
+
resolve67(void 0);
|
|
185789
186023
|
}, Math.max(0, deadline - Date.now()));
|
|
185790
186024
|
cancel = () => clearTimeout(timer);
|
|
185791
186025
|
});
|
|
@@ -185848,16 +186082,16 @@ function ageInDays(publishedAt, now = Date.now()) {
|
|
|
185848
186082
|
}
|
|
185849
186083
|
function packageVersion(path2) {
|
|
185850
186084
|
try {
|
|
185851
|
-
const version4 = JSON.parse(
|
|
186085
|
+
const version4 = JSON.parse(readFileSync110(path2, "utf8")).version;
|
|
185852
186086
|
return typeof version4 === "string" && version4 ? version4 : void 0;
|
|
185853
186087
|
} catch {
|
|
185854
186088
|
return void 0;
|
|
185855
186089
|
}
|
|
185856
186090
|
}
|
|
185857
186091
|
function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("./authoring-runtime/node_modules/@wix/himalaya/package.json", import.meta.url)) {
|
|
185858
|
-
let dir =
|
|
186092
|
+
let dir = resolve66(fromDir);
|
|
185859
186093
|
for (; ; ) {
|
|
185860
|
-
const version4 = packageVersion(
|
|
186094
|
+
const version4 = packageVersion(join95(dir, "node_modules", "@wix", "himalaya", "package.json"));
|
|
185861
186095
|
if (version4) return { version: version4, source: "local" };
|
|
185862
186096
|
const parent = dirname51(dir);
|
|
185863
186097
|
if (parent === dir) break;
|
|
@@ -185867,7 +186101,7 @@ function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("
|
|
|
185867
186101
|
if (bundled) return { version: bundled, source: "bundled" };
|
|
185868
186102
|
try {
|
|
185869
186103
|
const root = execFileSync7("npm", ["root", "-g"], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
|
|
185870
|
-
const version4 = root ? packageVersion(
|
|
186104
|
+
const version4 = root ? packageVersion(join95(root, "@wix", "himalaya", "package.json")) : void 0;
|
|
185871
186105
|
return version4 ? { version: version4, source: "global" } : {};
|
|
185872
186106
|
} catch {
|
|
185873
186107
|
return {};
|
|
@@ -185914,11 +186148,11 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
|
|
|
185914
186148
|
var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
|
|
185915
186149
|
var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
|
|
185916
186150
|
function updateCachePath(env = process.env) {
|
|
185917
|
-
return env.HIMI_UPDATE_CACHE_FILE ??
|
|
186151
|
+
return env.HIMI_UPDATE_CACHE_FILE ?? join95(homedir15(), ".himalaya", "update-check.json");
|
|
185918
186152
|
}
|
|
185919
186153
|
function readUpdateCache(path2) {
|
|
185920
186154
|
try {
|
|
185921
|
-
const parsed = JSON.parse(
|
|
186155
|
+
const parsed = JSON.parse(readFileSync110(path2, "utf8"));
|
|
185922
186156
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
185923
186157
|
} catch {
|
|
185924
186158
|
return {};
|
|
@@ -185987,11 +186221,11 @@ function createUpdateRunner(spawn8 = spawnSync5) {
|
|
|
185987
186221
|
},
|
|
185988
186222
|
installedVersion: () => {
|
|
185989
186223
|
const root = globalNodeModulesRoot();
|
|
185990
|
-
return root ? packageVersion(
|
|
186224
|
+
return root ? packageVersion(join95(root, "@wix", "himalaya-cli", "package.json")) : void 0;
|
|
185991
186225
|
},
|
|
185992
186226
|
reexec: (argv) => {
|
|
185993
186227
|
const root = globalNodeModulesRoot();
|
|
185994
|
-
const entry = root ?
|
|
186228
|
+
const entry = root ? join95(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
|
|
185995
186229
|
if (!entry || !existsSync89(entry)) return void 0;
|
|
185996
186230
|
const result = spawnSync5(process.execPath, [entry, ...argv], {
|
|
185997
186231
|
// inherit keeps PIPED STDIN working — commands that read stdin must survive a re-exec.
|
|
@@ -186039,7 +186273,7 @@ function staleUpdateLockFile(cachePath, now) {
|
|
|
186039
186273
|
for (const path2 of [`${cachePath}.lock.break`, `${cachePath}.lock`]) {
|
|
186040
186274
|
let content;
|
|
186041
186275
|
try {
|
|
186042
|
-
content =
|
|
186276
|
+
content = readFileSync110(path2, "utf8");
|
|
186043
186277
|
} catch {
|
|
186044
186278
|
continue;
|
|
186045
186279
|
}
|
|
@@ -186047,7 +186281,7 @@ function staleUpdateLockFile(cachePath, now) {
|
|
|
186047
186281
|
let since = stamped;
|
|
186048
186282
|
if (!Number.isFinite(since)) {
|
|
186049
186283
|
try {
|
|
186050
|
-
since =
|
|
186284
|
+
since = statSync24(path2).mtimeMs;
|
|
186051
186285
|
} catch {
|
|
186052
186286
|
continue;
|
|
186053
186287
|
}
|
|
@@ -186062,7 +186296,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
|
|
|
186062
186296
|
const mine = lockStamp(now);
|
|
186063
186297
|
const readLock = (path2) => {
|
|
186064
186298
|
try {
|
|
186065
|
-
return
|
|
186299
|
+
return readFileSync110(path2, "utf8");
|
|
186066
186300
|
} catch {
|
|
186067
186301
|
return void 0;
|
|
186068
186302
|
}
|
|
@@ -186196,7 +186430,7 @@ function createTrimValidator(deps = {}, spawnFn = spawn7) {
|
|
|
186196
186430
|
return { code, counts, ...errors ? { errors } : {}, ...code !== 0 ? { tail: said.slice(-4e3) } : {} };
|
|
186197
186431
|
};
|
|
186198
186432
|
return async (dir, opts = {}) => {
|
|
186199
|
-
const argv = ["validate", "--content",
|
|
186433
|
+
const argv = ["validate", "--content", resolve66(dir), "--strict", "--skip-version-check"];
|
|
186200
186434
|
if (!opts.fresh) {
|
|
186201
186435
|
const out2 = [];
|
|
186202
186436
|
const err = [];
|
|
@@ -186654,9 +186888,9 @@ function executableOnPath(name, env = process.env) {
|
|
|
186654
186888
|
const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
186655
186889
|
for (const dir of entries) {
|
|
186656
186890
|
for (const suffix of suffixes) {
|
|
186657
|
-
const candidate =
|
|
186891
|
+
const candidate = join95(dir, `${name}${suffix}`);
|
|
186658
186892
|
try {
|
|
186659
|
-
if (!
|
|
186893
|
+
if (!statSync24(candidate).isFile()) continue;
|
|
186660
186894
|
if (process.platform !== "win32") accessSync(candidate, constants5.X_OK);
|
|
186661
186895
|
return true;
|
|
186662
186896
|
} catch {
|
|
@@ -186763,7 +186997,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
186763
186997
|
const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths2(), paths_exports));
|
|
186764
186998
|
const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
|
|
186765
186999
|
const iosYmlPath = iosProjectYml2(app);
|
|
186766
|
-
const iosYml = existsSync89(iosYmlPath) ?
|
|
187000
|
+
const iosYml = existsSync89(iosYmlPath) ? readFileSync110(iosYmlPath, "utf8") : "";
|
|
186767
187001
|
let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
|
|
186768
187002
|
if (!optedIn) {
|
|
186769
187003
|
const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
|
|
@@ -186777,7 +187011,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
186777
187011
|
}
|
|
186778
187012
|
function readConfigSource(dir) {
|
|
186779
187013
|
try {
|
|
186780
|
-
return
|
|
187014
|
+
return readFileSync110(join95(dir, "config.ts"), "utf8");
|
|
186781
187015
|
} catch {
|
|
186782
187016
|
return null;
|
|
186783
187017
|
}
|
|
@@ -186830,8 +187064,8 @@ function keptPlan(kept) {
|
|
|
186830
187064
|
var NoBase44SlotError = class extends Error {
|
|
186831
187065
|
};
|
|
186832
187066
|
async function initFromRemoteTemplate(name, parentDir, template, c2, opts = {}) {
|
|
186833
|
-
const dir =
|
|
186834
|
-
if (existsSync89(
|
|
187067
|
+
const dir = resolve66(parentDir, name);
|
|
187068
|
+
if (existsSync89(join95(dir, "himalaya.content.json"))) {
|
|
186835
187069
|
throw new Error(`content package already exists at ${dir}`);
|
|
186836
187070
|
}
|
|
186837
187071
|
const r2 = await c2.fetchTemplateSource(TEMPLATE_APP_PREFIX + template);
|
|
@@ -186846,7 +187080,7 @@ async function initFromRemoteTemplate(name, parentDir, template, c2, opts = {})
|
|
|
186846
187080
|
return finishScaffold(materializeSource(archive.files, name, dir), template);
|
|
186847
187081
|
}
|
|
186848
187082
|
function contentDir(flags) {
|
|
186849
|
-
return
|
|
187083
|
+
return resolve66(str10(flags.content) ?? process.cwd());
|
|
186850
187084
|
}
|
|
186851
187085
|
function renameRestoredSource(restored, declaredApp, renamed) {
|
|
186852
187086
|
const text9 = {};
|
|
@@ -186878,7 +187112,7 @@ function restoreDestinationIssue(dest, force) {
|
|
|
186878
187112
|
const link = symlinkDestinationIssue(dest);
|
|
186879
187113
|
if (link) return link;
|
|
186880
187114
|
if (!existsSync89(dest)) return null;
|
|
186881
|
-
if (!
|
|
187115
|
+
if (!statSync24(dest).isDirectory()) {
|
|
186882
187116
|
return { error: `${dest} exists and is not a directory`, hint: "pass --out/--name to land somewhere else, or remove the file" };
|
|
186883
187117
|
}
|
|
186884
187118
|
if (readdirSync36(dest).length > 0 && !force) {
|
|
@@ -186890,9 +187124,9 @@ function restoreDestinationIssue(dest, force) {
|
|
|
186890
187124
|
return null;
|
|
186891
187125
|
}
|
|
186892
187126
|
function isHimalayaMonorepoCheckout(start) {
|
|
186893
|
-
let dir =
|
|
187127
|
+
let dir = resolve66(start);
|
|
186894
187128
|
for (; ; ) {
|
|
186895
|
-
if (existsSync89(
|
|
187129
|
+
if (existsSync89(join95(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync89(join95(dir, "core", "serve", "src", "server.ts"))) return true;
|
|
186896
187130
|
const parent = dirname51(dir);
|
|
186897
187131
|
if (parent === dir) return false;
|
|
186898
187132
|
dir = parent;
|
|
@@ -186952,8 +187186,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
186952
187186
|
const forBuild = Object.fromEntries(
|
|
186953
187187
|
Object.entries(files).map(([rel, body]) => [rel, rel === "himalaya.content.json" ? substituteIdentity(body, slug) : body])
|
|
186954
187188
|
);
|
|
186955
|
-
const repoRoot2 =
|
|
186956
|
-
const root =
|
|
187189
|
+
const repoRoot2 = resolve66(fileURLToPath30(new URL("../../..", import.meta.url)));
|
|
187190
|
+
const root = join95(repoRoot2, "node_modules", ".cache", "himi-template-preview");
|
|
186957
187191
|
const stillRunning = (pid) => {
|
|
186958
187192
|
try {
|
|
186959
187193
|
process.kill(pid, 0);
|
|
@@ -186967,12 +187201,12 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
186967
187201
|
if (!entry.isDirectory()) continue;
|
|
186968
187202
|
const pid = Number(entry.name.startsWith(`${slug}-`) ? entry.name.slice(slug.length + 1) : NaN);
|
|
186969
187203
|
if (Number.isInteger(pid) && pid > 0 && pid !== process.pid && !stillRunning(pid)) {
|
|
186970
|
-
rmSync24(
|
|
187204
|
+
rmSync24(join95(root, entry.name), { recursive: true, force: true });
|
|
186971
187205
|
}
|
|
186972
187206
|
}
|
|
186973
187207
|
} catch {
|
|
186974
187208
|
}
|
|
186975
|
-
const dest =
|
|
187209
|
+
const dest = join95(root, `${slug}-${process.pid}`);
|
|
186976
187210
|
rmSync24(dest, { recursive: true, force: true });
|
|
186977
187211
|
mkdirSync45(dest, { recursive: true });
|
|
186978
187212
|
try {
|
|
@@ -186985,8 +187219,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
186985
187219
|
}
|
|
186986
187220
|
async function appId(dir) {
|
|
186987
187221
|
try {
|
|
186988
|
-
const { readFileSync:
|
|
186989
|
-
const m2 = JSON.parse(
|
|
187222
|
+
const { readFileSync: readFileSync111 } = await import("node:fs");
|
|
187223
|
+
const m2 = JSON.parse(readFileSync111(join95(dir, "himalaya.content.json"), "utf8"));
|
|
186990
187224
|
if (m2.name) return m2.name;
|
|
186991
187225
|
} catch {
|
|
186992
187226
|
}
|
|
@@ -186994,8 +187228,8 @@ async function appId(dir) {
|
|
|
186994
187228
|
}
|
|
186995
187229
|
async function contentVisibility(dir) {
|
|
186996
187230
|
try {
|
|
186997
|
-
const { readFileSync:
|
|
186998
|
-
const m2 = JSON.parse(
|
|
187231
|
+
const { readFileSync: readFileSync111 } = await import("node:fs");
|
|
187232
|
+
const m2 = JSON.parse(readFileSync111(join95(dir, "himalaya.content.json"), "utf8"));
|
|
186999
187233
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
187000
187234
|
} catch {
|
|
187001
187235
|
}
|
|
@@ -187265,7 +187499,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
187265
187499
|
return 0;
|
|
187266
187500
|
}
|
|
187267
187501
|
case "agent-init": {
|
|
187268
|
-
const dir =
|
|
187502
|
+
const dir = resolve66(str10(flags.dir) ?? process.cwd());
|
|
187269
187503
|
const { seedAgentFiles: seedAgentFiles2, NotAContentPackage: NotAContentPackage2 } = await Promise.resolve().then(() => (init_agent_context(), agent_context_exports));
|
|
187270
187504
|
let res;
|
|
187271
187505
|
try {
|
|
@@ -187287,7 +187521,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
187287
187521
|
...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/" } : {},
|
|
187288
187522
|
// In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
|
|
187289
187523
|
// hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
|
|
187290
|
-
...existsSync89(
|
|
187524
|
+
...existsSync89(join95(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" } : {},
|
|
187291
187525
|
...res.skipped.length ? { skipped: res.skipped } : {},
|
|
187292
187526
|
portalUrl: idx.portalUrl
|
|
187293
187527
|
});
|
|
@@ -187308,7 +187542,7 @@ async function recordedReleaseForContentQuietly(dir, resolution, onDrift) {
|
|
|
187308
187542
|
try {
|
|
187309
187543
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
187310
187544
|
const bres = await buildContentForValidation2(dir, { resolution });
|
|
187311
|
-
out2 = mkdtempSync6(
|
|
187545
|
+
out2 = mkdtempSync6(join95(tmpdir7(), "himi-ux-record-"));
|
|
187312
187546
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
187313
187547
|
const outcome = await buildReleaseFromContent2(dir, out2, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, collect: { lint: true } });
|
|
187314
187548
|
const releaseId = outcome.manifest.releaseId;
|
|
@@ -187489,7 +187723,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
187489
187723
|
let js2;
|
|
187490
187724
|
for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
|
|
187491
187725
|
try {
|
|
187492
|
-
js2 =
|
|
187726
|
+
js2 = readFileSync110(join95(outDir, candidate), "utf8");
|
|
187493
187727
|
break;
|
|
187494
187728
|
} catch {
|
|
187495
187729
|
}
|
|
@@ -187520,7 +187754,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
187520
187754
|
}
|
|
187521
187755
|
return { families, source: "dist/bundles" };
|
|
187522
187756
|
}
|
|
187523
|
-
var boardOpen = (dir) => existsSync89(
|
|
187757
|
+
var boardOpen = (dir) => existsSync89(join95(dir, ".himi", "studio", "index.html"));
|
|
187524
187758
|
var BOARD_REFRESHERS = /* @__PURE__ */ new Set(["render", "test", "validate", "build", "push", "icon", "site", "ux", "progress"]);
|
|
187525
187759
|
async function leaveForBoard(dir, record2, value) {
|
|
187526
187760
|
if (!boardOpen(dir)) return;
|
|
@@ -187544,7 +187778,7 @@ async function liveMapFor(dir) {
|
|
|
187544
187778
|
}
|
|
187545
187779
|
var commandScratch = new AsyncLocalStorage2();
|
|
187546
187780
|
function commandScratchDir(prefix) {
|
|
187547
|
-
const dir = mkdtempSync6(
|
|
187781
|
+
const dir = mkdtempSync6(join95(tmpdir7(), prefix));
|
|
187548
187782
|
commandScratch.getStore()?.push(dir);
|
|
187549
187783
|
return dir;
|
|
187550
187784
|
}
|
|
@@ -187605,7 +187839,7 @@ async function runCommand(argv, io2, deps) {
|
|
|
187605
187839
|
const footer = `
|
|
187606
187840
|
|
|
187607
187841
|
himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail off-repo, you are almost certainly on an out-of-date CLI: \`npm i -g @wix/himalaya-cli@latest\`.`;
|
|
187608
|
-
io2.log(flags.json ? JSON.stringify(helpJson(), null, 2) :
|
|
187842
|
+
io2.log(flags.json ? JSON.stringify(helpJson(), null, 2) : USAGE2 + footer);
|
|
187609
187843
|
return command === "help" || flags.help ? 0 : 2;
|
|
187610
187844
|
}
|
|
187611
187845
|
if (flagErrors.length > 0 && flags.help !== true && command !== "one-app") {
|
|
@@ -187855,7 +188089,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
187855
188089
|
return 2;
|
|
187856
188090
|
}
|
|
187857
188091
|
const template = str10(flags.template);
|
|
187858
|
-
const parentDir =
|
|
188092
|
+
const parentDir = resolve66(str10(flags.dir) ?? process.cwd());
|
|
187859
188093
|
const base44AppId = flags["base44-app-id"] === void 0 ? void 0 : String(flags["base44-app-id"]);
|
|
187860
188094
|
const base44AppUrl = flags["base44-app-url"] === void 0 ? void 0 : String(flags["base44-app-url"]);
|
|
187861
188095
|
if (base44AppUrl !== void 0) {
|
|
@@ -187898,7 +188132,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
187898
188132
|
const owed = openApprovals2(readApprovals2(dir).events).length;
|
|
187899
188133
|
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`);
|
|
187900
188134
|
}
|
|
187901
|
-
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) => existsSync89(
|
|
188135
|
+
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) => existsSync89(join95(parentDir, f2)));
|
|
187902
188136
|
if (planInParent.length) {
|
|
187903
188137
|
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}`);
|
|
187904
188138
|
}
|
|
@@ -188059,13 +188293,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188059
188293
|
if (adding) {
|
|
188060
188294
|
const from = str10(flags.from);
|
|
188061
188295
|
if (!from) throw new TrimRefusal2('--add <id> needs --from <file> holding the whole new SCREENS entry (` "<id>": { "screenId": "<id>", \u2026 },`)');
|
|
188062
|
-
print(adopt.addScreen(dir, adding,
|
|
188296
|
+
print(adopt.addScreen(dir, adding, readFileSync110(from, "utf8"), { parent: str10(flags.parent), tab: str10(flags.tab), displayName: str10(flags["display-name"]) }));
|
|
188063
188297
|
return 0;
|
|
188064
188298
|
}
|
|
188065
188299
|
if (target) {
|
|
188066
188300
|
const from = str10(flags.from);
|
|
188067
188301
|
if (!from) throw new TrimRefusal2("--write <id> needs --from <file> holding the whole entry, as --show prints it");
|
|
188068
|
-
print(adopt.replaceScreen(dir, target,
|
|
188302
|
+
print(adopt.replaceScreen(dir, target, readFileSync110(from, "utf8")));
|
|
188069
188303
|
return 0;
|
|
188070
188304
|
}
|
|
188071
188305
|
if (show) {
|
|
@@ -188147,7 +188381,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188147
188381
|
const { keepFromSpec: keepFromSpec2 } = await Promise.resolve().then(() => (init_template_adopt(), template_adopt_exports));
|
|
188148
188382
|
const dir = contentDir(flags);
|
|
188149
188383
|
try {
|
|
188150
|
-
const spec = keepFromSpec2(dir, str10(flags["from-spec"]) ??
|
|
188384
|
+
const spec = keepFromSpec2(dir, str10(flags["from-spec"]) ?? join95(dir, "SPEC.md"));
|
|
188151
188385
|
const own5 = typeof keep === "string" ? keep.split(",").map((k2) => k2.trim()).filter(Boolean) : [];
|
|
188152
188386
|
keep = [.../* @__PURE__ */ new Set([...spec.keep, ...own5])].join(",");
|
|
188153
188387
|
fromSpec = { fromSpec: {
|
|
@@ -188188,7 +188422,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188188
188422
|
const result = { ...outcome.result, ...fromSpec };
|
|
188189
188423
|
const adoptDir = contentDir(flags);
|
|
188190
188424
|
const kept = flags["dry-run"] !== true && (outcome.code === 0 || outcome.result.forcedKeep === true);
|
|
188191
|
-
if (kept && existsSync89(
|
|
188425
|
+
if (kept && existsSync89(join95(adoptDir, adoptBits.ADOPT_FILE))) {
|
|
188192
188426
|
try {
|
|
188193
188427
|
const inv = adoptBits.inspectApp(adoptDir);
|
|
188194
188428
|
adoptBits.writeInventory(adoptDir, inv, { companions: "if-missing" });
|
|
@@ -188213,11 +188447,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188213
188447
|
return 2;
|
|
188214
188448
|
}
|
|
188215
188449
|
}
|
|
188216
|
-
const appDir3 =
|
|
188217
|
-
const sourceDir =
|
|
188450
|
+
const appDir3 = resolve66(str10(flags.dir) ?? process.cwd());
|
|
188451
|
+
const sourceDir = resolve66(str10(flags["source-dir"]) ?? appDir3);
|
|
188218
188452
|
let meta;
|
|
188219
188453
|
try {
|
|
188220
|
-
meta = JSON.parse(
|
|
188454
|
+
meta = JSON.parse(readFileSync110(join95(sourceDir, TEMPLATE_META_FILE), "utf8"));
|
|
188221
188455
|
} catch {
|
|
188222
188456
|
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>)` }));
|
|
188223
188457
|
return 2;
|
|
@@ -188227,7 +188461,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188227
188461
|
return 2;
|
|
188228
188462
|
}
|
|
188229
188463
|
try {
|
|
188230
|
-
const appearance = extractTemplateAppearance(JSON.parse(
|
|
188464
|
+
const appearance = extractTemplateAppearance(JSON.parse(readFileSync110(join95(sourceDir, "tokens.json"), "utf8")));
|
|
188231
188465
|
meta = { ...appearance, ...meta };
|
|
188232
188466
|
} catch {
|
|
188233
188467
|
}
|
|
@@ -188249,14 +188483,14 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188249
188483
|
const force = flags.force === true;
|
|
188250
188484
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
188251
188485
|
const bres = await buildContentForValidation2(buildDir, { resolution: resolutionFlag(flags) });
|
|
188252
|
-
const out2 = mkdtempSync6(
|
|
188486
|
+
const out2 = mkdtempSync6(join95(tmpdir7(), "himi-template-"));
|
|
188253
188487
|
publishScratch.push(out2);
|
|
188254
188488
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
188255
188489
|
const outcome = await buildReleaseFromContent2(buildDir, out2, {
|
|
188256
188490
|
...hasWorkers ? { tier5Dir: bundleOutDir2(buildDir) } : {},
|
|
188257
188491
|
collect: { lint: true, strict }
|
|
188258
188492
|
});
|
|
188259
|
-
const scaffoldSourceFindings =
|
|
188493
|
+
const scaffoldSourceFindings = resolve66(sourceDir) === resolve66(appDir3) ? [] : [
|
|
188260
188494
|
...(await Promise.resolve().then(() => (init_capabilities(), capabilities_exports))).capabilityConfigFindings(sourceDir, buildDir),
|
|
188261
188495
|
...tokenColorIssues(sourceDir),
|
|
188262
188496
|
...surfaceIssues(sourceDir, void 0, strict),
|
|
@@ -188307,13 +188541,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188307
188541
|
}));
|
|
188308
188542
|
return 1;
|
|
188309
188543
|
}
|
|
188310
|
-
const iconPath = str10(flags.icon) ?
|
|
188544
|
+
const iconPath = str10(flags.icon) ? resolve66(str10(flags.icon)) : templateIconPath(name);
|
|
188311
188545
|
let iconHash;
|
|
188312
188546
|
if (iconPath) {
|
|
188313
188547
|
try {
|
|
188314
|
-
const bytes2 =
|
|
188548
|
+
const bytes2 = readFileSync110(iconPath);
|
|
188315
188549
|
payload.icon = bytes2.toString("base64");
|
|
188316
|
-
iconHash =
|
|
188550
|
+
iconHash = createHash47("sha256").update(bytes2).digest("hex");
|
|
188317
188551
|
} catch {
|
|
188318
188552
|
}
|
|
188319
188553
|
}
|
|
@@ -188616,7 +188850,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188616
188850
|
const path2 = dpxSessionTokenPath();
|
|
188617
188851
|
let raw;
|
|
188618
188852
|
try {
|
|
188619
|
-
raw =
|
|
188853
|
+
raw = readFileSync110(path2, "utf8");
|
|
188620
188854
|
} catch {
|
|
188621
188855
|
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`);
|
|
188622
188856
|
}
|
|
@@ -188743,11 +188977,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188743
188977
|
}
|
|
188744
188978
|
if (studio) {
|
|
188745
188979
|
const { himiStudioPluginFiles: himiStudioPluginFiles2 } = await Promise.resolve().then(() => (init_claude_plugin(), claude_plugin_exports));
|
|
188746
|
-
const dir2 =
|
|
188980
|
+
const dir2 = resolve66(out2);
|
|
188747
188981
|
const files2 = himiStudioPluginFiles2();
|
|
188748
188982
|
for (const f2 of files2) {
|
|
188749
|
-
mkdirSync45(dirname51(
|
|
188750
|
-
writeFileSync44(
|
|
188983
|
+
mkdirSync45(dirname51(join95(dir2, f2.path)), { recursive: true });
|
|
188984
|
+
writeFileSync44(join95(dir2, f2.path), f2.text);
|
|
188751
188985
|
}
|
|
188752
188986
|
print({ ok: true, dir: dir2, files: files2.map((f2) => f2.path), next: [`claude plugin validate ${dir2}`, `claude --plugin-dir ${dir2}`] });
|
|
188753
188987
|
return 0;
|
|
@@ -188759,11 +188993,11 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188759
188993
|
return 1;
|
|
188760
188994
|
}
|
|
188761
188995
|
const { himiPluginFiles: himiPluginFiles2 } = await Promise.resolve().then(() => (init_claude_plugin(), claude_plugin_exports));
|
|
188762
|
-
const dir =
|
|
188996
|
+
const dir = resolve66(out2);
|
|
188763
188997
|
const files = himiPluginFiles2(skills.skillMd);
|
|
188764
188998
|
for (const f2 of files) {
|
|
188765
|
-
mkdirSync45(dirname51(
|
|
188766
|
-
writeFileSync44(
|
|
188999
|
+
mkdirSync45(dirname51(join95(dir, f2.path)), { recursive: true });
|
|
189000
|
+
writeFileSync44(join95(dir, f2.path), f2.text);
|
|
188767
189001
|
}
|
|
188768
189002
|
print({ ok: true, dir, files: files.map((f2) => f2.path), next: [`claude plugin validate ${dir}`, `claude --plugin-dir ${dir}`] });
|
|
188769
189003
|
return 0;
|
|
@@ -188773,20 +189007,20 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
188773
189007
|
run,
|
|
188774
189008
|
version: cliVersion(),
|
|
188775
189009
|
withFiles: flags["with-files"] === true,
|
|
188776
|
-
...process.env.HIMI_WORKSPACE ? { workspace:
|
|
189010
|
+
...process.env.HIMI_WORKSPACE ? { workspace: resolve66(process.env.HIMI_WORKSPACE) } : {}
|
|
188777
189011
|
});
|
|
188778
189012
|
return 0;
|
|
188779
189013
|
}
|
|
188780
189014
|
case "studio": {
|
|
188781
189015
|
const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
188782
189016
|
const dir = contentDir(flags);
|
|
188783
|
-
if (!existsSync89(
|
|
189017
|
+
if (!existsSync89(join95(dir, "himalaya.content.json"))) {
|
|
188784
189018
|
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/" }));
|
|
188785
189019
|
return 2;
|
|
188786
189020
|
}
|
|
188787
189021
|
if (pos[1] === "reel") {
|
|
188788
189022
|
const { buildReel: buildReel2 } = await Promise.resolve().then(() => (init_studio_reel(), studio_reel_exports));
|
|
188789
|
-
const out2 =
|
|
189023
|
+
const out2 = resolve66(str10(flags.out) ?? join95(dir, ".himi", "making-of.html"));
|
|
188790
189024
|
const { html, plan } = buildReel2(dir);
|
|
188791
189025
|
mkdirSync45(dirname51(out2), { recursive: true });
|
|
188792
189026
|
writeFileSync44(out2, html);
|
|
@@ -188858,7 +189092,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
188858
189092
|
} = await Promise.resolve().then(() => (init_progress(), progress_exports));
|
|
188859
189093
|
const dir = contentDir(flags);
|
|
188860
189094
|
const journal2 = journalPath2(dir);
|
|
188861
|
-
const isContentPackage = existsSync89(
|
|
189095
|
+
const isContentPackage = existsSync89(join95(dir, "himalaya.content.json"));
|
|
188862
189096
|
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" };
|
|
188863
189097
|
const message = pos.slice(1).join(" ").trim();
|
|
188864
189098
|
const approvalFlags = ["approve", "done", "drop"].filter((f2) => flags[f2] !== void 0);
|
|
@@ -189010,7 +189244,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
189010
189244
|
case "test": {
|
|
189011
189245
|
const dir = contentDir(flags);
|
|
189012
189246
|
const structuredOutput = flags.json === true || io2.isTTY !== true;
|
|
189013
|
-
if (existsSync89(
|
|
189247
|
+
if (existsSync89(join95(dir, "functions"))) {
|
|
189014
189248
|
const { invokeLocalFunction: invokeLocalFunction2, loadFunctionsApp: loadFunctionsApp2 } = await Promise.resolve().then(() => (init_functions(), functions_exports));
|
|
189015
189249
|
const loaded = await loadFunctionsApp2(dir);
|
|
189016
189250
|
const results = [];
|
|
@@ -189142,7 +189376,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
189142
189376
|
io2.error(JSON.stringify({ error: `screen "${screen.screenId}" has no Tier-5 worker, so there is nothing for the browser loop to build` }));
|
|
189143
189377
|
return 2;
|
|
189144
189378
|
}
|
|
189145
|
-
const sources = collectWorkerSources2(
|
|
189379
|
+
const sources = collectWorkerSources2(join95(dir, "tier5-src"), screen.bundleName);
|
|
189146
189380
|
if (!sources) {
|
|
189147
189381
|
io2.error(JSON.stringify({ error: `no worker source found at tier5-src/${screen.bundleName} \u2014 the browser loop compiles SOURCE, not the built bundle` }));
|
|
189148
189382
|
return 2;
|
|
@@ -189321,7 +189555,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
189321
189555
|
const sp = await runShotsPass2({
|
|
189322
189556
|
descriptors: scopeDescriptors2(outcome.descriptors ?? [], pos.slice(1), invalidScreens),
|
|
189323
189557
|
tokens: outcome.tokens,
|
|
189324
|
-
outDir:
|
|
189558
|
+
outDir: join95(dir, ".himi", "shots"),
|
|
189325
189559
|
width: 390,
|
|
189326
189560
|
layers: { rules: shotRules, ...cmsSeed ? { cmsSeed } : {}, ...canned ? { canned: canned.byKey } : {}, ...base44Data ? { base44Data } : {} },
|
|
189327
189561
|
...budgetMs ? { budgetMs } : {},
|
|
@@ -189360,7 +189594,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
189360
189594
|
releaseId: result.releaseId,
|
|
189361
189595
|
releasePayload: release2,
|
|
189362
189596
|
descriptors: attestedDescriptors,
|
|
189363
|
-
screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""),
|
|
189597
|
+
screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join95(dir, ".himi", "shots", name)])),
|
|
189364
189598
|
coverage: {
|
|
189365
189599
|
screens: crawledScreens.size,
|
|
189366
189600
|
actionsDispatched: result.actions.exercised,
|
|
@@ -189485,7 +189719,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
189485
189719
|
return 2;
|
|
189486
189720
|
}
|
|
189487
189721
|
try {
|
|
189488
|
-
const raw = stateArg.trim().startsWith("{") ? stateArg :
|
|
189722
|
+
const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync110(stateArg.replace(/^@/, ""), "utf8");
|
|
189489
189723
|
injectedState = JSON.parse(raw);
|
|
189490
189724
|
} catch (e2) {
|
|
189491
189725
|
io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
|
|
@@ -189500,7 +189734,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
189500
189734
|
return 2;
|
|
189501
189735
|
}
|
|
189502
189736
|
try {
|
|
189503
|
-
const raw = inputArg.trim().startsWith("{") ? inputArg :
|
|
189737
|
+
const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync110(inputArg.replace(/^@/, ""), "utf8");
|
|
189504
189738
|
const parsed = JSON.parse(raw);
|
|
189505
189739
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
|
|
189506
189740
|
injectedInput = parsed;
|
|
@@ -189584,11 +189818,11 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
189584
189818
|
const diagnostics = (outcome.lint ?? []).find((s2) => s2.screenId === screenId)?.issues ?? [];
|
|
189585
189819
|
let pngFile;
|
|
189586
189820
|
let attestationPngFile;
|
|
189587
|
-
const shotPath =
|
|
189821
|
+
const shotPath = join95(dir, ".himi", "shots", `${screenId}.png`);
|
|
189588
189822
|
const pngTarget = typeof flags.png === "string" ? str10(flags.png) : flags.png === true ? shotPath : void 0;
|
|
189589
189823
|
if (pngTarget && r2.pngBase64) {
|
|
189590
189824
|
pngFile = writePngFile(pngTarget, r2.pngBase64);
|
|
189591
|
-
attestationPngFile =
|
|
189825
|
+
attestationPngFile = resolve66(pngTarget) === resolve66(shotPath) ? pngFile : writePngFile(shotPath, r2.pngBase64);
|
|
189592
189826
|
}
|
|
189593
189827
|
if (renderWidth !== void 0 && r2.renderable) {
|
|
189594
189828
|
recordRenderWidth(dir, {
|
|
@@ -189935,7 +190169,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189935
190169
|
return 2;
|
|
189936
190170
|
}
|
|
189937
190171
|
const renamed = str10(flags.name);
|
|
189938
|
-
const dest =
|
|
190172
|
+
const dest = resolve66(str10(flags.out) ?? process.cwd(), renamed ?? wanted);
|
|
189939
190173
|
const replace = flags.replace === true;
|
|
189940
190174
|
const force = replace || flags.force === true;
|
|
189941
190175
|
const linked = symlinkDestinationIssue(dest);
|
|
@@ -189944,7 +190178,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189944
190178
|
return 1;
|
|
189945
190179
|
}
|
|
189946
190180
|
if (existsSync89(dest)) {
|
|
189947
|
-
if (!
|
|
190181
|
+
if (!statSync24(dest).isDirectory()) {
|
|
189948
190182
|
io2.error(JSON.stringify({
|
|
189949
190183
|
error: `${dest} exists and is not a directory`,
|
|
189950
190184
|
hint: "pass --out/--name to land somewhere else, or remove the file"
|
|
@@ -189956,7 +190190,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
189956
190190
|
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" }));
|
|
189957
190191
|
return 1;
|
|
189958
190192
|
}
|
|
189959
|
-
if (replace && occupied && !existsSync89(
|
|
190193
|
+
if (replace && occupied && !existsSync89(join95(dest, "himalaya.content.json"))) {
|
|
189960
190194
|
io2.error(JSON.stringify({
|
|
189961
190195
|
error: `${dest} is not a content package \u2014 refusing to --replace it`,
|
|
189962
190196
|
hint: "--replace only clears a directory that holds himalaya.content.json. Check --out/--name, or pass --force to merge into it instead."
|
|
@@ -190192,7 +190426,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190192
190426
|
let localSourceHash;
|
|
190193
190427
|
try {
|
|
190194
190428
|
const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
|
|
190195
|
-
localSourceHash =
|
|
190429
|
+
localSourceHash = createHash47("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
|
|
190196
190430
|
} catch {
|
|
190197
190431
|
}
|
|
190198
190432
|
return runReleasePatch({
|
|
@@ -190620,7 +190854,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190620
190854
|
return 2;
|
|
190621
190855
|
}
|
|
190622
190856
|
try {
|
|
190623
|
-
const res = writePack(
|
|
190857
|
+
const res = writePack(resolve66(releaseDir), only, resolve66(str10(flags.out) ?? process.cwd()));
|
|
190624
190858
|
print({
|
|
190625
190859
|
ok: true,
|
|
190626
190860
|
app: res.app,
|
|
@@ -190669,7 +190903,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190669
190903
|
}
|
|
190670
190904
|
const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
190671
190905
|
const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
|
|
190672
|
-
const built = mkdtempSync6(
|
|
190906
|
+
const built = mkdtempSync6(join95(tmpdir7(), "himi-pack-"));
|
|
190673
190907
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
190674
190908
|
const outcome = await buildReleaseFromContent2(dir, built, {
|
|
190675
190909
|
...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
|
|
@@ -190699,7 +190933,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190699
190933
|
return 1;
|
|
190700
190934
|
}
|
|
190701
190935
|
try {
|
|
190702
|
-
const res = writePack(built, app,
|
|
190936
|
+
const res = writePack(built, app, resolve66(str10(flags.out) ?? dir), sourceArchive);
|
|
190703
190937
|
print({
|
|
190704
190938
|
ok: true,
|
|
190705
190939
|
app: res.app,
|
|
@@ -190744,7 +190978,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190744
190978
|
const { HIMI_PACKAGE_SOURCE_PATH: HIMI_PACKAGE_SOURCE_PATH2, isSafeAppId: isSafeAppId2, packageContents: packageContents2 } = await Promise.resolve().then(() => (init_himi_package(), himi_package_exports));
|
|
190745
190979
|
let opened;
|
|
190746
190980
|
try {
|
|
190747
|
-
opened = openPackageFile2(
|
|
190981
|
+
opened = openPackageFile2(resolve66(file2));
|
|
190748
190982
|
} catch (e2) {
|
|
190749
190983
|
io2.error(JSON.stringify({ error: e2.message }));
|
|
190750
190984
|
return 1;
|
|
@@ -190757,7 +190991,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190757
190991
|
io2.error(JSON.stringify({
|
|
190758
190992
|
ok: false,
|
|
190759
190993
|
error: "app_source_not_in_package",
|
|
190760
|
-
detail: `${
|
|
190994
|
+
detail: `${resolve66(file2)} is a release package: it carries built output (screens, bundles, tokens) and no source`,
|
|
190761
190995
|
hint: "re-pack it from the content package with `himi pack --dev`, or restore from the serve plane with `himi pull <app>`"
|
|
190762
190996
|
}));
|
|
190763
190997
|
return 1;
|
|
@@ -190780,7 +191014,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190780
191014
|
return 1;
|
|
190781
191015
|
}
|
|
190782
191016
|
}
|
|
190783
|
-
const dest =
|
|
191017
|
+
const dest = resolve66(str10(flags.out) ?? process.cwd(), renamed ?? opened.header.app);
|
|
190784
191018
|
const issue2 = restoreDestinationIssue(dest, flags.force === true);
|
|
190785
191019
|
if (issue2) {
|
|
190786
191020
|
io2.error(JSON.stringify(issue2));
|
|
@@ -190867,7 +191101,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190867
191101
|
}
|
|
190868
191102
|
try {
|
|
190869
191103
|
const { openPackageFile: openPackageFile2 } = await Promise.resolve().then(() => (init_pack(), pack_exports));
|
|
190870
|
-
const opened = openPackageFile2(
|
|
191104
|
+
const opened = openPackageFile2(resolve66(file2));
|
|
190871
191105
|
if (!opened.validation.ok || !opened.header) {
|
|
190872
191106
|
io2.error(JSON.stringify({ error: "refusing to share an invalid package", issues: opened.validation.errors }));
|
|
190873
191107
|
return 1;
|
|
@@ -190877,12 +191111,12 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190877
191111
|
io2.error(JSON.stringify({
|
|
190878
191112
|
ok: false,
|
|
190879
191113
|
error: "refusing to share a package that carries the app's source",
|
|
190880
|
-
detail: `${
|
|
191114
|
+
detail: `${resolve66(file2)} was packed with --dev, and a share link is public and unauthenticated \u2014 anyone with the URL could \`himi import\` your codebase`,
|
|
190881
191115
|
hint: "share a release package instead (`himi pack` with no --dev), or hand the dev package over directly"
|
|
190882
191116
|
}));
|
|
190883
191117
|
return 1;
|
|
190884
191118
|
}
|
|
190885
|
-
const archive =
|
|
191119
|
+
const archive = readFileSync110(resolve66(file2));
|
|
190886
191120
|
const result = await client2().createPackageShare({
|
|
190887
191121
|
app: opened.header.app,
|
|
190888
191122
|
releaseId: opened.header.releaseId,
|
|
@@ -190979,11 +191213,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
190979
191213
|
const app = await appId(dir2);
|
|
190980
191214
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
190981
191215
|
const bres = await buildContentBundles2(dir2, { resolution: resolutionFlag(flags) });
|
|
190982
|
-
temp = mkdtempSync6(
|
|
191216
|
+
temp = mkdtempSync6(join95(tmpdir7(), "himi-run-build-"));
|
|
190983
191217
|
const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
|
|
190984
191218
|
const initial = await buildReleaseFromContent2(dir2, temp, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir2) } : {}, ...RUN_CONTENT_BUILD2 });
|
|
190985
191219
|
servedMissing = initial.missingBundles;
|
|
190986
|
-
source =
|
|
191220
|
+
source = join95(temp, app);
|
|
190987
191221
|
}
|
|
190988
191222
|
const chromeArg = str10(flags.chrome) ?? "preview";
|
|
190989
191223
|
if (chromeArg !== "preview" && chromeArg !== "app") {
|
|
@@ -191022,7 +191256,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191022
191256
|
if (!recordKit) return;
|
|
191023
191257
|
startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
191024
191258
|
const failure = record2(served2, { ok: true, at: startedAt });
|
|
191025
|
-
if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${
|
|
191259
|
+
if (!recorded) io2.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${join95(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
|
|
191026
191260
|
await refreshBoard();
|
|
191027
191261
|
};
|
|
191028
191262
|
const retract = async () => {
|
|
@@ -191045,9 +191279,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191045
191279
|
});
|
|
191046
191280
|
await announce(run2);
|
|
191047
191281
|
print({ ok: true, app: run2.app, url: run2.url, port: run2.port, plane: "browser" });
|
|
191048
|
-
await new Promise((
|
|
191282
|
+
await new Promise((resolve67) => {
|
|
191049
191283
|
const stop = () => {
|
|
191050
|
-
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run2.close().finally(() =>
|
|
191284
|
+
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run2.close().finally(() => resolve67()));
|
|
191051
191285
|
};
|
|
191052
191286
|
dropEarlySignals?.();
|
|
191053
191287
|
process.once("SIGINT", stop);
|
|
@@ -191058,7 +191292,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191058
191292
|
const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
|
|
191059
191293
|
const hhpPreviewRoute = watch2 ? (await Promise.resolve().then(() => (init_hhp_preview(), hhp_preview_exports))).hhpPreviewResponse : null;
|
|
191060
191294
|
const bus = watchKit ? new watchKit.ReloadBus() : void 0;
|
|
191061
|
-
if (watch2) served = mkdtempSync6(
|
|
191295
|
+
if (watch2) served = mkdtempSync6(join95(tmpdir7(), "himi-run-served-"));
|
|
191062
191296
|
const running = await runPackage2(source, {
|
|
191063
191297
|
port,
|
|
191064
191298
|
chrome: chromeArg,
|
|
@@ -191087,8 +191321,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191087
191321
|
await announce(running);
|
|
191088
191322
|
if (watchKit && bus) {
|
|
191089
191323
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
191090
|
-
const live3 =
|
|
191091
|
-
const manifestOf = (tree) => JSON.parse(
|
|
191324
|
+
const live3 = join95(running.releaseRoot, running.app);
|
|
191325
|
+
const manifestOf = (tree) => JSON.parse(readFileSync110(join95(tree, "release-manifest.json"), "utf8"));
|
|
191092
191326
|
let current = manifestOf(live3);
|
|
191093
191327
|
const failed3 = async (message) => {
|
|
191094
191328
|
if (stopping) return;
|
|
@@ -191099,7 +191333,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191099
191333
|
};
|
|
191100
191334
|
rebuild = watchKit.serialize(async () => {
|
|
191101
191335
|
const t0 = Date.now();
|
|
191102
|
-
const next = mkdtempSync6(
|
|
191336
|
+
const next = mkdtempSync6(join95(tmpdir7(), "himi-run-build-"));
|
|
191103
191337
|
try {
|
|
191104
191338
|
const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
|
|
191105
191339
|
if (bres.compileErrors.length) {
|
|
@@ -191116,16 +191350,16 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191116
191350
|
return;
|
|
191117
191351
|
}
|
|
191118
191352
|
if (stopping) return;
|
|
191119
|
-
const fresh = manifestOf(
|
|
191353
|
+
const fresh = manifestOf(join95(next, running.app));
|
|
191120
191354
|
const diff = watchKit.diffReleases(current, fresh);
|
|
191121
191355
|
const { describeChanges: describeChanges2, headline: headline2 } = await Promise.resolve().then(() => (init_build_changes(), build_changes_exports));
|
|
191122
|
-
const changes = describeChanges2(live3,
|
|
191356
|
+
const changes = describeChanges2(live3, join95(next, running.app), diff);
|
|
191123
191357
|
const retired = `${live3}.retired-${Date.now()}`;
|
|
191124
191358
|
renameSync13(live3, retired);
|
|
191125
191359
|
try {
|
|
191126
|
-
renameSync13(
|
|
191360
|
+
renameSync13(join95(next, running.app), live3);
|
|
191127
191361
|
} catch {
|
|
191128
|
-
cpSync3(
|
|
191362
|
+
cpSync3(join95(next, running.app), live3, { recursive: true });
|
|
191129
191363
|
}
|
|
191130
191364
|
rmSync24(retired, { recursive: true, force: true });
|
|
191131
191365
|
current = fresh;
|
|
@@ -191808,7 +192042,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191808
192042
|
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."
|
|
191809
192043
|
};
|
|
191810
192044
|
if (kind === "tokens" || kind === "app-config") {
|
|
191811
|
-
const body =
|
|
192045
|
+
const body = readFileSync110(file2, "utf8");
|
|
191812
192046
|
const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
|
|
191813
192047
|
return runReleasePatch({
|
|
191814
192048
|
...common,
|
|
@@ -191823,7 +192057,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191823
192057
|
io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
|
|
191824
192058
|
return 2;
|
|
191825
192059
|
}
|
|
191826
|
-
const descriptor =
|
|
192060
|
+
const descriptor = readFileSync110(file2, "utf8");
|
|
191827
192061
|
let parsed;
|
|
191828
192062
|
try {
|
|
191829
192063
|
parsed = JSON.parse(descriptor);
|
|
@@ -191880,8 +192114,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
191880
192114
|
extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
|
|
191881
192115
|
});
|
|
191882
192116
|
}
|
|
191883
|
-
const bytes2 =
|
|
191884
|
-
const sha2 =
|
|
192117
|
+
const bytes2 = readFileSync110(file2);
|
|
192118
|
+
const sha2 = createHash47("sha256").update(bytes2).digest("hex");
|
|
191885
192119
|
const forScreens = (str10(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
191886
192120
|
if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
|
|
191887
192121
|
io2.error(JSON.stringify({ ok: false, error: "no_rebind_takes_no_value", message: "--no-rebind is a switch and takes no value; pass it bare.", usage: PATCH_USAGE }));
|
|
@@ -192024,7 +192258,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
192024
192258
|
}
|
|
192025
192259
|
let def;
|
|
192026
192260
|
try {
|
|
192027
|
-
const parsed = JSON.parse(arg.startsWith("@") ?
|
|
192261
|
+
const parsed = JSON.parse(arg.startsWith("@") ? readFileSync110(arg.slice(1), "utf8") : arg);
|
|
192028
192262
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
192029
192263
|
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}`] }));
|
|
192030
192264
|
return 2;
|
|
@@ -192306,7 +192540,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
192306
192540
|
const rememberLastDist = async (jobs2) => {
|
|
192307
192541
|
try {
|
|
192308
192542
|
const dir = contentDir(flags);
|
|
192309
|
-
if (!existsSync89(
|
|
192543
|
+
if (!existsSync89(join95(dir, "himalaya.content.json"))) return;
|
|
192310
192544
|
const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
|
|
192311
192545
|
const own5 = await appId(dir);
|
|
192312
192546
|
for (const job of jobs2) {
|
|
@@ -192546,7 +192780,7 @@ ${label3}`);
|
|
|
192546
192780
|
const platform = str10(flags.platform)?.split(",").map((p2) => p2.trim()).filter(Boolean);
|
|
192547
192781
|
{
|
|
192548
192782
|
const distDir = contentDir(flags);
|
|
192549
|
-
if (existsSync89(
|
|
192783
|
+
if (existsSync89(join95(distDir, "himalaya.content.json"))) {
|
|
192550
192784
|
const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
|
|
192551
192785
|
const errors = issues.filter((i2) => i2.severity === "error");
|
|
192552
192786
|
for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
|
|
@@ -192886,7 +193120,7 @@ ${label3}`);
|
|
|
192886
193120
|
const dpxPath = dpxSessionTokenPath();
|
|
192887
193121
|
let dpx;
|
|
192888
193122
|
try {
|
|
192889
|
-
dpx =
|
|
193123
|
+
dpx = readFileSync110(dpxPath, "utf8").trim();
|
|
192890
193124
|
} catch {
|
|
192891
193125
|
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` }));
|
|
192892
193126
|
return 1;
|
|
@@ -193349,7 +193583,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
193349
193583
|
const path2 = dpxSessionTokenPath();
|
|
193350
193584
|
let raw;
|
|
193351
193585
|
try {
|
|
193352
|
-
raw =
|
|
193586
|
+
raw = readFileSync110(path2, "utf8");
|
|
193353
193587
|
} catch {
|
|
193354
193588
|
io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
|
|
193355
193589
|
return 1;
|
|
@@ -193597,7 +193831,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
193597
193831
|
return 1;
|
|
193598
193832
|
};
|
|
193599
193833
|
const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
|
|
193600
|
-
const missing = gen.ENGINE_FILES.filter((f2) => !existsSync89(
|
|
193834
|
+
const missing = gen.ENGINE_FILES.filter((f2) => !existsSync89(join95(dir, f2)));
|
|
193601
193835
|
if (missing.length) {
|
|
193602
193836
|
return fail6("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing.join(", ")})`, { missing, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
|
|
193603
193837
|
}
|
|
@@ -193682,8 +193916,8 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
193682
193916
|
const slug = str10(flags.app);
|
|
193683
193917
|
if (!provisioning || str10(flags.content) !== void 0 || !slug) return contentDir(flags);
|
|
193684
193918
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
|
|
193685
|
-
const dir =
|
|
193686
|
-
return existsSync89(
|
|
193919
|
+
const dir = resolve66("apps", slug);
|
|
193920
|
+
return existsSync89(join95(dir, "config.ts")) || existsSync89(join95(dir, "config.mjs")) ? dir : void 0;
|
|
193687
193921
|
};
|
|
193688
193922
|
if (sub === "entities" || sub === "functions") {
|
|
193689
193923
|
if (sub === "entities" && !["query", "create", "seed"].includes(pos[2] ?? "")) {
|
|
@@ -194068,7 +194302,7 @@ Code: ${userCode}`);
|
|
|
194068
194302
|
}
|
|
194069
194303
|
default:
|
|
194070
194304
|
io2.error(JSON.stringify({ error: `unknown command: ${command}` }));
|
|
194071
|
-
io2.log(
|
|
194305
|
+
io2.log(USAGE2);
|
|
194072
194306
|
return 2;
|
|
194073
194307
|
}
|
|
194074
194308
|
} catch (err) {
|