@wix/himalaya-cli 0.1597.0 → 0.1598.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 +571 -472
- package/guides/qa-builds.md +43 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -1821,7 +1821,7 @@ function sentinelizeIdentity(body, identity) {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
if (identity.name) {
|
|
1823
1823
|
const re2 = new RegExp(`\\b(${NAME_FIELDS.join("|")})(["']?\\s*[:=]\\s*)(["'])${escapeRe(identity.name)}\\3`, "g");
|
|
1824
|
-
out2 = out2.replace(re2, (_m, key3,
|
|
1824
|
+
out2 = out2.replace(re2, (_m, key3, sep26, q3) => `${key3}${sep26}${q3}__HIMI_APP_NAME__${q3}`);
|
|
1825
1825
|
}
|
|
1826
1826
|
return out2;
|
|
1827
1827
|
}
|
|
@@ -3339,7 +3339,7 @@ function distJobSpec(req) {
|
|
|
3339
3339
|
// not get to answer a per-shell question.
|
|
3340
3340
|
...req.provisioningEnv ? { HIMI_DIST_PROVISIONING_ENV: req.provisioningEnv } : {}
|
|
3341
3341
|
};
|
|
3342
|
-
const command =
|
|
3342
|
+
const command = `${req.runner === "linux" ? "linux:" : ""}dist:${req.platform} ${DIST_PARAMS_FLAG} ${encodeDistParams(envVars)}`;
|
|
3343
3343
|
if (command.length > MAX_COMMAND_CHARS) {
|
|
3344
3344
|
throw new Error(
|
|
3345
3345
|
`dist command is ${command.length} chars (cap ${MAX_COMMAND_CHARS}); shrink the job env \u2014 pass large values as a URL the Mac job fetches, as the brand contract does`
|
|
@@ -3547,7 +3547,7 @@ var init_dist_jobs = __esm({
|
|
|
3547
3547
|
DEFAULT_DIST_SIGNING = "wix-managed";
|
|
3548
3548
|
WIX_MANAGED_SIGNING_ALIASES = ["wix-managed", "wix", "pool-enterprise"];
|
|
3549
3549
|
DEFAULT_ANDROID_SIGNING = "qa-keystore";
|
|
3550
|
-
ANDROID_SIGNING_POLICIES = ["qa-keystore", "wix-keystore", "debug", "oneapp-debug"];
|
|
3550
|
+
ANDROID_SIGNING_POLICIES = ["qa-keystore", "wix-keystore", "debug", "oneapp-debug", "unsigned"];
|
|
3551
3551
|
ANDROID_SIGNING_ALIASES = {
|
|
3552
3552
|
// The canonical spellings, derived so the two lists cannot drift apart.
|
|
3553
3553
|
...Object.fromEntries(ANDROID_SIGNING_POLICIES.map((p2) => [p2, p2])),
|
|
@@ -3556,7 +3556,9 @@ var init_dist_jobs = __esm({
|
|
|
3556
3556
|
wix: "wix-keystore",
|
|
3557
3557
|
oneapp: "wix-keystore",
|
|
3558
3558
|
"one-app-debug": "oneapp-debug",
|
|
3559
|
-
oneappdebug: "oneapp-debug"
|
|
3559
|
+
oneappdebug: "oneapp-debug",
|
|
3560
|
+
// The CLI's word for an owner bundle. `unsigned` is the fact about the file, which the pool reports.
|
|
3561
|
+
owner: "unsigned"
|
|
3560
3562
|
};
|
|
3561
3563
|
DEFAULT_ANDROID_FORMAT = "apk";
|
|
3562
3564
|
ANDROID_FORMATS = ["apk", "aab"];
|
|
@@ -3595,8 +3597,8 @@ function committedProvisioningPath(name) {
|
|
|
3595
3597
|
function committedShellFor(path2) {
|
|
3596
3598
|
const normalized = path2.replace(/\\/g, "/");
|
|
3597
3599
|
return SHELL_NAMES.find((name) => {
|
|
3598
|
-
const
|
|
3599
|
-
return normalized ===
|
|
3600
|
+
const relative27 = committedProvisioningPath(name);
|
|
3601
|
+
return normalized === relative27 || normalized.endsWith(`/${relative27}`);
|
|
3600
3602
|
});
|
|
3601
3603
|
}
|
|
3602
3604
|
function isBrandable(repoRoot2, name) {
|
|
@@ -4993,8 +4995,8 @@ var init_catalog_cache = __esm({
|
|
|
4993
4995
|
|
|
4994
4996
|
// ../authoring-kit/ensure-authoring-client.mjs
|
|
4995
4997
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
4996
|
-
import { existsSync as existsSync5, readdirSync as readdirSync4, readFileSync as readFileSync6, renameSync as renameSync2, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
4997
|
-
import { basename as basename2, dirname as dirname6, join as join7, resolve as resolve4 } from "node:path";
|
|
4998
|
+
import { existsSync as existsSync5, lstatSync as lstatSync3, mkdirSync as mkdirSync4, readdirSync as readdirSync4, readFileSync as readFileSync6, renameSync as renameSync2, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
4999
|
+
import { basename as basename2, dirname as dirname6, join as join7, relative, resolve as resolve4, sep as sep3 } from "node:path";
|
|
4998
5000
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
4999
5001
|
function aggregatesStamp(root = REPO) {
|
|
5000
5002
|
return resolve4(root, "tools/authoring-kit/aggregates.stamp.json");
|
|
@@ -5063,7 +5065,7 @@ __export(guides_exports, {
|
|
|
5063
5065
|
withReferenceCache: () => withReferenceCache,
|
|
5064
5066
|
writeAgentContext: () => writeAgentContext
|
|
5065
5067
|
});
|
|
5066
|
-
import { readFileSync as readFileSync7, existsSync as existsSync6, mkdirSync as
|
|
5068
|
+
import { readFileSync as readFileSync7, existsSync as existsSync6, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5, lstatSync as lstatSync4, readdirSync as readdirSync5, renameSync as renameSync3, rmdirSync } from "node:fs";
|
|
5067
5069
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
5068
5070
|
import { dirname as dirname7, join as join8, resolve as resolve5 } from "node:path";
|
|
5069
5071
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -5283,8 +5285,8 @@ function removeLegacyRootCopies(targetDir) {
|
|
|
5283
5285
|
for (const rel of legacy) {
|
|
5284
5286
|
const p2 = linkFreeTarget(targetDir, rel);
|
|
5285
5287
|
const dest = linkFreeTarget(targetDir, `.himi/legacy-agent-files/${rel}`);
|
|
5286
|
-
if (p2 && dest && existsSync6(p2) &&
|
|
5287
|
-
|
|
5288
|
+
if (p2 && dest && existsSync6(p2) && lstatSync4(p2).isFile()) {
|
|
5289
|
+
mkdirSync5(dirname7(dest), { recursive: true });
|
|
5288
5290
|
renameSync3(p2, existsSync6(dest) ? `${dest}.${Date.now()}` : dest);
|
|
5289
5291
|
removed.push(rel);
|
|
5290
5292
|
}
|
|
@@ -5298,7 +5300,7 @@ function linkFreeTarget(dir, rel) {
|
|
|
5298
5300
|
for (const part4 of rel.split(/[\\/]+/).filter(Boolean)) {
|
|
5299
5301
|
at2 = join8(at2, part4);
|
|
5300
5302
|
try {
|
|
5301
|
-
if (
|
|
5303
|
+
if (lstatSync4(at2).isSymbolicLink()) return null;
|
|
5302
5304
|
} catch (e2) {
|
|
5303
5305
|
if (e2.code === "ENOENT") break;
|
|
5304
5306
|
return null;
|
|
@@ -5327,20 +5329,20 @@ function writeAgentContext(targetDir, opts = {}) {
|
|
|
5327
5329
|
const write2 = (rel, body) => {
|
|
5328
5330
|
const p2 = target(rel);
|
|
5329
5331
|
if (!p2) return;
|
|
5330
|
-
|
|
5332
|
+
mkdirSync5(dirname7(p2), { recursive: true });
|
|
5331
5333
|
writeFileSync5(p2, body);
|
|
5332
5334
|
files.push(rel);
|
|
5333
5335
|
};
|
|
5334
5336
|
const copy = (srcRel, destRel) => {
|
|
5335
5337
|
const p2 = target(destRel);
|
|
5336
5338
|
if (!p2) return;
|
|
5337
|
-
|
|
5339
|
+
mkdirSync5(dirname7(p2), { recursive: true });
|
|
5338
5340
|
writeFileSync5(p2, readReference(srcRel));
|
|
5339
5341
|
files.push(destRel);
|
|
5340
5342
|
};
|
|
5341
5343
|
const writeIfMissing = (rel, body) => {
|
|
5342
5344
|
try {
|
|
5343
|
-
|
|
5345
|
+
lstatSync4(join8(targetDir, rel));
|
|
5344
5346
|
return;
|
|
5345
5347
|
} catch {
|
|
5346
5348
|
write2(rel, body);
|
|
@@ -6761,9 +6763,9 @@ function compileV2(html, profile, options) {
|
|
|
6761
6763
|
if (!row2) error(el2, "HHP-BINDING-SCOPE", "Item bindings require a keyed list template.");
|
|
6762
6764
|
return raw;
|
|
6763
6765
|
}
|
|
6764
|
-
const
|
|
6765
|
-
if (!info4?.paths.has(
|
|
6766
|
-
return `$service:${serviceName}.${
|
|
6766
|
+
const relative27 = statePath(raw);
|
|
6767
|
+
if (!info4?.paths.has(relative27)) error(el2, "HHP-BINDING-PATH", `Unknown controller state path ${relative27}.`);
|
|
6768
|
+
return `$service:${serviceName}.${relative27}`;
|
|
6767
6769
|
}
|
|
6768
6770
|
const read = (value2, dotted) => dotted.split(".").reduce((current, key3) => current && typeof current === "object" && Object.hasOwn(current, key3) ? current[key3] : void 0, value2);
|
|
6769
6771
|
function rowValues(row2, raw) {
|
|
@@ -7403,8 +7405,8 @@ __export(progress_exports, {
|
|
|
7403
7405
|
import { spawn } from "node:child_process";
|
|
7404
7406
|
import { createHash as createHash4 } from "node:crypto";
|
|
7405
7407
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
7406
|
-
import { appendFileSync, closeSync, existsSync as existsSync7, lstatSync as
|
|
7407
|
-
import { isAbsolute, join as join9, relative, resolve as resolve6, sep as
|
|
7408
|
+
import { appendFileSync, closeSync, existsSync as existsSync7, lstatSync as lstatSync5, mkdirSync as mkdirSync6, openSync, readdirSync as readdirSync6, readFileSync as readFileSync9, readSync, renameSync as renameSync4, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
7409
|
+
import { isAbsolute, join as join9, relative as relative2, resolve as resolve6, sep as sep4 } from "node:path";
|
|
7408
7410
|
function agentCovers(agent, cli) {
|
|
7409
7411
|
if (isCliEntry(agent)) return false;
|
|
7410
7412
|
const agentShas = shasOf(agent.images);
|
|
@@ -7458,11 +7460,11 @@ function realDirIn(dir, rel) {
|
|
|
7458
7460
|
for (const part4 of rel.split(/[\\/]+/).filter(Boolean)) {
|
|
7459
7461
|
at2 = join9(at2, part4);
|
|
7460
7462
|
try {
|
|
7461
|
-
if (!
|
|
7463
|
+
if (!lstatSync5(at2).isDirectory()) return null;
|
|
7462
7464
|
} catch (e2) {
|
|
7463
7465
|
if (e2.code !== "ENOENT") return null;
|
|
7464
|
-
|
|
7465
|
-
if (!
|
|
7466
|
+
mkdirSync6(at2);
|
|
7467
|
+
if (!lstatSync5(at2).isDirectory()) return null;
|
|
7466
7468
|
}
|
|
7467
7469
|
}
|
|
7468
7470
|
return at2;
|
|
@@ -7479,7 +7481,7 @@ function writeFileAtomic(file2, content) {
|
|
|
7479
7481
|
}
|
|
7480
7482
|
function isSymlink(file2) {
|
|
7481
7483
|
try {
|
|
7482
|
-
return
|
|
7484
|
+
return lstatSync5(file2).isSymbolicLink();
|
|
7483
7485
|
} catch {
|
|
7484
7486
|
return false;
|
|
7485
7487
|
}
|
|
@@ -7521,7 +7523,7 @@ function appendProgress(dir, input) {
|
|
|
7521
7523
|
return entry;
|
|
7522
7524
|
}
|
|
7523
7525
|
function packageRelative(dir, p2) {
|
|
7524
|
-
const rel =
|
|
7526
|
+
const rel = relative2(dir, resolve6(p2));
|
|
7525
7527
|
return rel && !rel.startsWith("..") && !isAbsolute(rel) ? toPosix(rel) : null;
|
|
7526
7528
|
}
|
|
7527
7529
|
function endsWithNewline(file2) {
|
|
@@ -7683,7 +7685,7 @@ function carryPlanningJournal(parentDir, appDir3) {
|
|
|
7683
7685
|
if (existsSync7(join9(parentDir, "himalaya.content.json"))) return [];
|
|
7684
7686
|
const src = join9(parentDir, ".himi");
|
|
7685
7687
|
try {
|
|
7686
|
-
if (!
|
|
7688
|
+
if (!lstatSync5(src).isDirectory()) return [];
|
|
7687
7689
|
} catch {
|
|
7688
7690
|
return [];
|
|
7689
7691
|
}
|
|
@@ -7700,12 +7702,12 @@ function carryPlanningJournal(parentDir, appDir3) {
|
|
|
7700
7702
|
const hist = join9(parentDir, HISTORY_DIR);
|
|
7701
7703
|
let names2 = [];
|
|
7702
7704
|
try {
|
|
7703
|
-
if (
|
|
7705
|
+
if (lstatSync5(hist).isDirectory()) names2 = readdirSync6(hist);
|
|
7704
7706
|
} catch {
|
|
7705
7707
|
}
|
|
7706
7708
|
for (const name of names2) {
|
|
7707
7709
|
const from = join9(hist, name);
|
|
7708
|
-
if (isSymlink(from) || !
|
|
7710
|
+
if (isSymlink(from) || !lstatSync5(from).isFile()) continue;
|
|
7709
7711
|
const bytes2 = readFileSync9(from);
|
|
7710
7712
|
archiveBytes(appDir3, bytes2);
|
|
7711
7713
|
}
|
|
@@ -7717,7 +7719,7 @@ function formatBrief(input) {
|
|
|
7717
7719
|
const who = `himi \u2014 ${input.appName ?? "this folder"}`;
|
|
7718
7720
|
const lines = [];
|
|
7719
7721
|
if (!summary2.count) {
|
|
7720
|
-
lines.push(`${who}: no journey journal yet (${PROGRESS_FILE.split(
|
|
7722
|
+
lines.push(`${who}: no journey journal yet (${PROGRESS_FILE.split(sep4).join("/")}).`);
|
|
7721
7723
|
lines.push(
|
|
7722
7724
|
'A new app starts with discovery (step 1). An app built before journaling existed continues from its current state instead: confirm with the customer that its SPEC.md was approved rather than re-running discovery. Either way, journal each milestone with `himi progress "<what changed>" --step <n>` so the next session can pick up from it.'
|
|
7723
7725
|
);
|
|
@@ -7799,7 +7801,7 @@ function appLabel(dir) {
|
|
|
7799
7801
|
}
|
|
7800
7802
|
function journalPath(dir) {
|
|
7801
7803
|
const abs = join9(dir, PROGRESS_FILE);
|
|
7802
|
-
const rel =
|
|
7804
|
+
const rel = relative2(process.cwd(), abs);
|
|
7803
7805
|
return rel && !rel.startsWith("..") ? rel : abs;
|
|
7804
7806
|
}
|
|
7805
7807
|
var JOURNEY_STEPS, CLI_AUTHOR, AUTO_MILESTONES, MILESTONE_STEP, AGENT_WINS_WITHIN_MS, isCliEntry, shasOf, PROGRESS_FILE, HISTORY_DIR, APPROVALS_FILE, APPROVAL_GATES, MAX_MESSAGE_CHARS, MAX_IMAGE_BYTES, ProgressError, toPosix, UnsafeHimiDirError, SECRET_SHAPES, looksSecret, REF_SHAPE, gateLabel, minute, NOTIFY_TIMEOUT_MS;
|
|
@@ -7833,7 +7835,7 @@ var init_progress = __esm({
|
|
|
7833
7835
|
this.code = code;
|
|
7834
7836
|
}
|
|
7835
7837
|
};
|
|
7836
|
-
toPosix = (p2) => p2.split(
|
|
7838
|
+
toPosix = (p2) => p2.split(sep4).join("/");
|
|
7837
7839
|
UnsafeHimiDirError = class extends Error {
|
|
7838
7840
|
constructor(rel) {
|
|
7839
7841
|
super(`${rel} is not a real directory inside the content package (a symlink?) \u2014 refusing to write through it`);
|
|
@@ -8520,7 +8522,7 @@ var init_run_identity = __esm({
|
|
|
8520
8522
|
|
|
8521
8523
|
// src/mcp/preview.ts
|
|
8522
8524
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
8523
|
-
import { closeSync as closeSync2, constants as fsc, existsSync as existsSync8, lstatSync as
|
|
8525
|
+
import { closeSync as closeSync2, constants as fsc, existsSync as existsSync8, lstatSync as lstatSync6, mkdirSync as mkdirSync7, openSync as openSync2, readFileSync as readFileSync10, rmSync as rmSync4 } from "node:fs";
|
|
8524
8526
|
import { createServer } from "node:net";
|
|
8525
8527
|
import { basename as basename3, join as join10 } from "node:path";
|
|
8526
8528
|
function previewPortFor(appName2) {
|
|
@@ -8570,14 +8572,14 @@ async function recordState(dir, r3, deps) {
|
|
|
8570
8572
|
}
|
|
8571
8573
|
function openPreviewLog(dir, name = "preview.log") {
|
|
8572
8574
|
const himiDir2 = join10(dir, ".himi");
|
|
8573
|
-
if (existsSync8(himiDir2) && !
|
|
8575
|
+
if (existsSync8(himiDir2) && !lstatSync6(himiDir2).isDirectory()) {
|
|
8574
8576
|
throw new PreviewStartError(`${himiDir2} is not a real directory (a symlink?) \u2014 refusing to write the preview log through it`, "");
|
|
8575
8577
|
}
|
|
8576
|
-
|
|
8578
|
+
mkdirSync7(himiDir2, { recursive: true });
|
|
8577
8579
|
const path2 = join10(himiDir2, name);
|
|
8578
8580
|
let existing;
|
|
8579
8581
|
try {
|
|
8580
|
-
existing =
|
|
8582
|
+
existing = lstatSync6(path2);
|
|
8581
8583
|
} catch {
|
|
8582
8584
|
}
|
|
8583
8585
|
if (existing?.isDirectory()) {
|
|
@@ -8745,7 +8747,7 @@ var init_preview = __esm({
|
|
|
8745
8747
|
});
|
|
8746
8748
|
|
|
8747
8749
|
// src/mcp/client-configs.ts
|
|
8748
|
-
import { dirname as dirname8, relative as
|
|
8750
|
+
import { dirname as dirname8, relative as relative3, resolve as resolve8, sep as sep5 } from "node:path";
|
|
8749
8751
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
8750
8752
|
function sourceCheckout(moduleUrl = import.meta.url) {
|
|
8751
8753
|
if (!moduleUrl.endsWith(".ts")) return null;
|
|
@@ -8843,8 +8845,8 @@ var init_client_configs = __esm({
|
|
|
8843
8845
|
NPM_PACKAGE = HIMI_NPM_PACKAGE;
|
|
8844
8846
|
HERE2 = dirname8(fileURLToPath5(import.meta.url));
|
|
8845
8847
|
inside = (child, parent) => {
|
|
8846
|
-
const rel =
|
|
8847
|
-
return rel === "" || !rel.startsWith("..") && !rel.startsWith(
|
|
8848
|
+
const rel = relative3(parent, child);
|
|
8849
|
+
return rel === "" || !rel.startsWith("..") && !rel.startsWith(sep5) && !/^[A-Za-z]:/.test(rel);
|
|
8848
8850
|
};
|
|
8849
8851
|
same = (a2, b2) => JSON.stringify(a2) === JSON.stringify(b2);
|
|
8850
8852
|
out = (o2) => `${JSON.stringify(o2, null, 2)}
|
|
@@ -8875,7 +8877,7 @@ __export(agent_context_exports, {
|
|
|
8875
8877
|
withoutBlock: () => withoutBlock,
|
|
8876
8878
|
writeAgentLayer: () => writeAgentLayer
|
|
8877
8879
|
});
|
|
8878
|
-
import { existsSync as existsSync9, lstatSync as
|
|
8880
|
+
import { existsSync as existsSync9, lstatSync as lstatSync7, mkdirSync as mkdirSync8, readFileSync as readFileSync11, realpathSync as realpathSync2, writeFileSync as writeFileSync7 } from "node:fs";
|
|
8879
8881
|
import { dirname as dirname9, join as join11 } from "node:path";
|
|
8880
8882
|
function beginMarker(version5) {
|
|
8881
8883
|
return `${BLOCK_BEGIN} v=${version5} \u2014 written by \`himi agent-init\`; edit OUTSIDE this block, it is replaced on refresh -->`;
|
|
@@ -8962,7 +8964,7 @@ perform the step. Reading the pages of a site the customer already published nee
|
|
|
8962
8964
|
}
|
|
8963
8965
|
function claudeLinksToAgents(dir) {
|
|
8964
8966
|
try {
|
|
8965
|
-
if (!
|
|
8967
|
+
if (!lstatSync7(join11(dir, "CLAUDE.md")).isSymbolicLink()) return false;
|
|
8966
8968
|
return realpathSync2(join11(dir, "CLAUDE.md")) === realpathSync2(join11(dir, "AGENTS.md"));
|
|
8967
8969
|
} catch {
|
|
8968
8970
|
return false;
|
|
@@ -9052,7 +9054,7 @@ function writeAgentLayer(dir, opts) {
|
|
|
9052
9054
|
skipped.push({ file: posix(rel), reason: LINKED_PATH_REASON });
|
|
9053
9055
|
return;
|
|
9054
9056
|
}
|
|
9055
|
-
|
|
9057
|
+
mkdirSync8(dirname9(p2), { recursive: true });
|
|
9056
9058
|
if (readOrNull(p2) !== body) writeFileSync7(p2, body);
|
|
9057
9059
|
files.push(posix(rel));
|
|
9058
9060
|
};
|
|
@@ -9225,8 +9227,8 @@ __export(build_lib_exports, {
|
|
|
9225
9227
|
umbrellaRewritePlugin: () => umbrellaRewritePlugin
|
|
9226
9228
|
});
|
|
9227
9229
|
import { fileURLToPath as fileURLToPath6, pathToFileURL } from "node:url";
|
|
9228
|
-
import { basename as basename4, dirname as dirname10, join as join12, resolve as resolve9, sep as
|
|
9229
|
-
import { readdirSync as readdirSync7, existsSync as existsSync10, mkdirSync as
|
|
9230
|
+
import { basename as basename4, dirname as dirname10, join as join12, resolve as resolve9, sep as sep6 } from "node:path";
|
|
9231
|
+
import { readdirSync as readdirSync7, existsSync as existsSync10, mkdirSync as mkdirSync9, readFileSync as readFileSync12, realpathSync as realpathSync3, statSync as statSync3, writeFileSync as writeFileSync8 } from "node:fs";
|
|
9230
9232
|
async function loadCompiler() {
|
|
9231
9233
|
try {
|
|
9232
9234
|
const nativeCompiler = ["es", "build"].join("");
|
|
@@ -9273,7 +9275,7 @@ function realpathOrSelf(p2) {
|
|
|
9273
9275
|
}
|
|
9274
9276
|
}
|
|
9275
9277
|
function isUnder(p2, root) {
|
|
9276
|
-
return p2 === root || p2.startsWith(root +
|
|
9278
|
+
return p2 === root || p2.startsWith(root + sep6);
|
|
9277
9279
|
}
|
|
9278
9280
|
function confinementRoots(contentRoot2) {
|
|
9279
9281
|
const roots2 = /* @__PURE__ */ new Set();
|
|
@@ -9563,7 +9565,7 @@ function tsExtResolvePlugin() {
|
|
|
9563
9565
|
}
|
|
9564
9566
|
function importMetaUrlPlugin({ scope: scope2 } = {}) {
|
|
9565
9567
|
const scopes = scope2 ? [.../* @__PURE__ */ new Set([realpathOrSelf(scope2), resolve9(scope2)])] : [];
|
|
9566
|
-
const inScope = (p2) => scopes.some((r3) => p2 === r3 || p2.startsWith(r3 +
|
|
9568
|
+
const inScope = (p2) => scopes.some((r3) => p2 === r3 || p2.startsWith(r3 + sep6));
|
|
9567
9569
|
return {
|
|
9568
9570
|
name: "himalaya-import-meta-url",
|
|
9569
9571
|
setup(b2) {
|
|
@@ -9624,7 +9626,7 @@ async function buildBundle(name, opts = {}) {
|
|
|
9624
9626
|
} catch {
|
|
9625
9627
|
}
|
|
9626
9628
|
if (same3) continue;
|
|
9627
|
-
|
|
9629
|
+
mkdirSync9(dirname10(file2.path), { recursive: true });
|
|
9628
9630
|
writeFileSync8(file2.path, file2.contents);
|
|
9629
9631
|
}
|
|
9630
9632
|
return name;
|
|
@@ -10276,7 +10278,7 @@ var init_tier5_dir = __esm({
|
|
|
10276
10278
|
|
|
10277
10279
|
// src/tier5-typecheck.ts
|
|
10278
10280
|
import { existsSync as existsSync11, readFileSync as readFileSync13 } from "node:fs";
|
|
10279
|
-
import { relative as
|
|
10281
|
+
import { relative as relative4, resolve as resolve11, sep as sep7 } from "node:path";
|
|
10280
10282
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
10281
10283
|
async function loadTypeScript() {
|
|
10282
10284
|
const runtime = process.env.HIMI_AUTHORING_RUNTIME_DIR;
|
|
@@ -10315,7 +10317,7 @@ function pathsFor(options) {
|
|
|
10315
10317
|
return declarationPaths(options.umbrellaDir);
|
|
10316
10318
|
}
|
|
10317
10319
|
function relativeFile(contentDir2, fileName) {
|
|
10318
|
-
return
|
|
10320
|
+
return relative4(contentDir2, fileName).split(sep7).join("/");
|
|
10319
10321
|
}
|
|
10320
10322
|
function belongsToContentWorkers(contentDir2, diagnostic) {
|
|
10321
10323
|
if (!diagnostic.file) return true;
|
|
@@ -10501,8 +10503,8 @@ var init_provisioning_facts = __esm({
|
|
|
10501
10503
|
|
|
10502
10504
|
// ../../core/dev-server/src/app-assets.ts
|
|
10503
10505
|
import { createHash as createHash6 } from "node:crypto";
|
|
10504
|
-
import { existsSync as existsSync12, lstatSync as
|
|
10505
|
-
import { join as join13, resolve as resolve13, sep as
|
|
10506
|
+
import { existsSync as existsSync12, lstatSync as lstatSync8, readFileSync as readFileSync15, readdirSync as readdirSync9, realpathSync as realpathSync4, statSync as statSync4 } from "node:fs";
|
|
10507
|
+
import { join as join13, resolve as resolve13, sep as sep8 } from "node:path";
|
|
10506
10508
|
function contentTypeFor(name) {
|
|
10507
10509
|
const ext = name.includes(".") ? name.slice(name.lastIndexOf(".") + 1).toLowerCase() : "";
|
|
10508
10510
|
return CONTENT_TYPES[ext] ?? "application/octet-stream";
|
|
@@ -10523,7 +10525,7 @@ function findAssetsDir(appDir3) {
|
|
|
10523
10525
|
const rel = typeof declared === "string" && declared ? declared : "assets";
|
|
10524
10526
|
const abs = resolve13(appDir3, rel);
|
|
10525
10527
|
const base = resolve13(appDir3);
|
|
10526
|
-
if (abs !== base && !abs.startsWith(base +
|
|
10528
|
+
if (abs !== base && !abs.startsWith(base + sep8)) return null;
|
|
10527
10529
|
return existsSync12(abs) && statSync4(abs).isDirectory() ? abs : null;
|
|
10528
10530
|
}
|
|
10529
10531
|
function readOtaOnlyPatterns(appDir3) {
|
|
@@ -10579,9 +10581,9 @@ function collectBrandFonts(appDir3) {
|
|
|
10579
10581
|
if (rel.startsWith("/") || rel.split("/").includes("..")) continue;
|
|
10580
10582
|
const path2 = join13(appDir3, rel);
|
|
10581
10583
|
try {
|
|
10582
|
-
if (!
|
|
10584
|
+
if (!lstatSync8(path2).isFile()) continue;
|
|
10583
10585
|
const root = realpathSync4(appDir3);
|
|
10584
|
-
if (!realpathSync4(path2).startsWith(root +
|
|
10586
|
+
if (!realpathSync4(path2).startsWith(root + sep8)) continue;
|
|
10585
10587
|
} catch {
|
|
10586
10588
|
continue;
|
|
10587
10589
|
}
|
|
@@ -15701,8 +15703,8 @@ function textOf(node) {
|
|
|
15701
15703
|
function plainText(node) {
|
|
15702
15704
|
if (typeOf2(node) === "TEXT") return str(at(node, "textData", "text"));
|
|
15703
15705
|
const children = kids(node).filter(isObj);
|
|
15704
|
-
const
|
|
15705
|
-
return children.map(plainText).join(
|
|
15706
|
+
const sep26 = children.every((c2) => typeOf2(c2) === "TEXT") ? "" : "\n";
|
|
15707
|
+
return children.map(plainText).join(sep26);
|
|
15706
15708
|
}
|
|
15707
15709
|
function alignOf(v2) {
|
|
15708
15710
|
switch (v2) {
|
|
@@ -21588,16 +21590,83 @@ var init_contained_dev_module = __esm({
|
|
|
21588
21590
|
// ../authoring-kit/ensure-templates.mjs
|
|
21589
21591
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
21590
21592
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
21591
|
-
import { existsSync as existsSync15, mkdirSync as
|
|
21592
|
-
import { dirname as dirname11, join as join14, relative as
|
|
21593
|
+
import { existsSync as existsSync15, lstatSync as lstatSync9, mkdirSync as mkdirSync10, readFileSync as readFileSync16, readdirSync as readdirSync11, renameSync as renameSync5, rmSync as rmSync5, rmdirSync as rmdirSync2, statSync as statSync5, writeFileSync as writeFileSync9 } from "node:fs";
|
|
21594
|
+
import { dirname as dirname11, isAbsolute as isAbsolute2, join as join14, relative as relative5, resolve as resolve15, sep as sep9 } from "node:path";
|
|
21593
21595
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
21596
|
+
function generationBase(outRoot) {
|
|
21597
|
+
const out2 = resolve15(outRoot);
|
|
21598
|
+
const tree = join14(sep9, TEMPLATES_REL);
|
|
21599
|
+
return out2.endsWith(tree) ? join14(out2.slice(0, -tree.length), GENERATION_REL, "templates") : out2;
|
|
21600
|
+
}
|
|
21594
21601
|
function stampPath(outRoot) {
|
|
21595
|
-
return `${outRoot}.stamp.json`;
|
|
21602
|
+
return `${generationBase(outRoot)}.stamp.json`;
|
|
21596
21603
|
}
|
|
21597
21604
|
function head(root) {
|
|
21598
21605
|
const r3 = spawnSync3("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" });
|
|
21599
21606
|
return r3.status === 0 ? r3.stdout.trim() : null;
|
|
21600
21607
|
}
|
|
21608
|
+
function isLink(path2) {
|
|
21609
|
+
try {
|
|
21610
|
+
return lstatSync9(path2).isSymbolicLink();
|
|
21611
|
+
} catch (e2) {
|
|
21612
|
+
if (e2.code === "ENOENT" || e2.code === "ENOTDIR") return false;
|
|
21613
|
+
throw e2;
|
|
21614
|
+
}
|
|
21615
|
+
}
|
|
21616
|
+
function replaceLinkedRoot(path2, root = REPO2) {
|
|
21617
|
+
const out2 = resolve15(path2);
|
|
21618
|
+
const rel = relative5(root, out2);
|
|
21619
|
+
const outside = rel === ".." || rel.startsWith(`..${sep9}`) || isAbsolute2(rel);
|
|
21620
|
+
if (!outside && rel.split(sep9)[0] !== "node_modules") {
|
|
21621
|
+
for (let dir = dirname11(out2); dir !== root; dir = dirname11(dir)) {
|
|
21622
|
+
if (isLink(dir)) throw new Error(`${relative5(root, dir)} is a symlink: refusing to generate ${rel} through it`);
|
|
21623
|
+
}
|
|
21624
|
+
}
|
|
21625
|
+
if (isLink(out2)) rmSync5(out2);
|
|
21626
|
+
}
|
|
21627
|
+
function sweepLegacyGeneration(out2) {
|
|
21628
|
+
rmSync5(`${out2}.stamp.json`, { force: true });
|
|
21629
|
+
const lock = `${out2}.lock`;
|
|
21630
|
+
let held = false;
|
|
21631
|
+
try {
|
|
21632
|
+
held = lockAlive(lock, readOwner(lock));
|
|
21633
|
+
} catch {
|
|
21634
|
+
}
|
|
21635
|
+
if (!held) rmSync5(lock, { recursive: true, force: true });
|
|
21636
|
+
const mutex = `${lock}.takeover`;
|
|
21637
|
+
try {
|
|
21638
|
+
if (isLink(mutex) || Date.now() - statSync5(mutex).mtimeMs > PIDLESS_LOCK_GRACE_MS) rmSync5(mutex, { recursive: true, force: true });
|
|
21639
|
+
} catch {
|
|
21640
|
+
}
|
|
21641
|
+
const staging = `${out2}.staging`;
|
|
21642
|
+
if (isLink(staging)) return void rmSync5(staging);
|
|
21643
|
+
let staged;
|
|
21644
|
+
try {
|
|
21645
|
+
staged = readdirSync11(staging);
|
|
21646
|
+
} catch {
|
|
21647
|
+
return;
|
|
21648
|
+
}
|
|
21649
|
+
for (const name of staged) {
|
|
21650
|
+
const run2 = /\.build-(\d+)$/.exec(name);
|
|
21651
|
+
if (run2 && processAlive(Number(run2[1]))) continue;
|
|
21652
|
+
rmSync5(join14(staging, name), { recursive: true, force: true });
|
|
21653
|
+
}
|
|
21654
|
+
try {
|
|
21655
|
+
rmdirSync2(staging);
|
|
21656
|
+
} catch (e2) {
|
|
21657
|
+
if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(e2.code)) throw e2;
|
|
21658
|
+
}
|
|
21659
|
+
}
|
|
21660
|
+
function prepareGeneration(outRoot, root = REPO2) {
|
|
21661
|
+
const out2 = resolve15(outRoot);
|
|
21662
|
+
replaceLinkedRoot(out2, root);
|
|
21663
|
+
const real = generationBase(out2) !== out2;
|
|
21664
|
+
if (real) replaceLinkedRoot(dirname11(generationBase(out2)), root);
|
|
21665
|
+
for (const path2 of [stagingRoot(out2), lockPath(out2), `${lockPath(out2)}.takeover`, stampPath(out2)]) {
|
|
21666
|
+
if (isLink(path2)) rmSync5(path2);
|
|
21667
|
+
}
|
|
21668
|
+
if (real) sweepLegacyGeneration(out2);
|
|
21669
|
+
}
|
|
21601
21670
|
function templatesReady(root = REPO2) {
|
|
21602
21671
|
const out2 = resolve15(root, TEMPLATES_REL);
|
|
21603
21672
|
if (!existsSync15(out2) || !existsSync15(stampPath(out2))) return false;
|
|
@@ -21610,8 +21679,11 @@ function templatesReady(root = REPO2) {
|
|
|
21610
21679
|
const now = head(root);
|
|
21611
21680
|
return now === null || stamp.head === now;
|
|
21612
21681
|
}
|
|
21682
|
+
function stagingRoot(outRoot) {
|
|
21683
|
+
return `${generationBase(outRoot)}.staging`;
|
|
21684
|
+
}
|
|
21613
21685
|
function lockPath(outRoot) {
|
|
21614
|
-
return `${outRoot}.lock`;
|
|
21686
|
+
return `${generationBase(outRoot)}.lock`;
|
|
21615
21687
|
}
|
|
21616
21688
|
function processAlive(pid) {
|
|
21617
21689
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -21637,7 +21709,7 @@ function lockAlive(lock, owner) {
|
|
|
21637
21709
|
function tryLock(lock, token) {
|
|
21638
21710
|
for (; ; ) {
|
|
21639
21711
|
try {
|
|
21640
|
-
|
|
21712
|
+
mkdirSync10(lock);
|
|
21641
21713
|
writeFileSync9(join14(lock, "pid"), token);
|
|
21642
21714
|
return true;
|
|
21643
21715
|
} catch (e2) {
|
|
@@ -21653,7 +21725,7 @@ function tryLock(lock, token) {
|
|
|
21653
21725
|
if (alive) return false;
|
|
21654
21726
|
const mutex = `${lock}.takeover`;
|
|
21655
21727
|
try {
|
|
21656
|
-
|
|
21728
|
+
mkdirSync10(mutex);
|
|
21657
21729
|
} catch (e2) {
|
|
21658
21730
|
if (e2.code !== "EEXIST") throw e2;
|
|
21659
21731
|
try {
|
|
@@ -21687,7 +21759,7 @@ ${randomUUID3()}`;
|
|
|
21687
21759
|
let waited = false;
|
|
21688
21760
|
while (!tryLock(lock, token)) {
|
|
21689
21761
|
if (Date.now() > deadline) {
|
|
21690
|
-
throw new Error(`another process has held ${
|
|
21762
|
+
throw new Error(`another process has held ${relative5(root, lock)} for over ${Math.round(waitMs / 1e3)}s \u2014 remove it if no generation is running`);
|
|
21691
21763
|
}
|
|
21692
21764
|
waited = true;
|
|
21693
21765
|
sleepSync(LOCK_POLL_MS);
|
|
@@ -21706,8 +21778,9 @@ function ensureTemplates({
|
|
|
21706
21778
|
if (env[TEMPLATES_FRESH]) return false;
|
|
21707
21779
|
if (!refresh && templatesReady(root)) return false;
|
|
21708
21780
|
const out2 = resolve15(root, TEMPLATES_REL);
|
|
21709
|
-
|
|
21781
|
+
prepareGeneration(out2, root);
|
|
21710
21782
|
const lock = lockPath(out2);
|
|
21783
|
+
mkdirSync10(dirname11(lock), { recursive: true });
|
|
21711
21784
|
const { token, waited } = acquireLock(lock, { root, waitMs });
|
|
21712
21785
|
try {
|
|
21713
21786
|
if (waited && templatesReady(root)) return false;
|
|
@@ -21729,12 +21802,13 @@ ${(r3.stderr || r3.stdout || "").trim()}`);
|
|
|
21729
21802
|
releaseLock(lock, token);
|
|
21730
21803
|
}
|
|
21731
21804
|
}
|
|
21732
|
-
var REPO2, TEMPLATES_REL, GENERATOR, TEMPLATES_FRESH, PIDLESS_LOCK_GRACE_MS, LOCK_POLL_MS, isMain;
|
|
21805
|
+
var REPO2, TEMPLATES_REL, GENERATION_REL, GENERATOR, TEMPLATES_FRESH, PIDLESS_LOCK_GRACE_MS, LOCK_POLL_MS, isMain;
|
|
21733
21806
|
var init_ensure_templates = __esm({
|
|
21734
21807
|
"../authoring-kit/ensure-templates.mjs"() {
|
|
21735
21808
|
init_define_HHP_CATALOG();
|
|
21736
21809
|
REPO2 = resolve15(dirname11(fileURLToPath9(import.meta.url)), "../..");
|
|
21737
21810
|
TEMPLATES_REL = "tools/himi-cli/templates";
|
|
21811
|
+
GENERATION_REL = "tools/.himi-templates";
|
|
21738
21812
|
GENERATOR = "tools/authoring-kit/gen-templates.mts";
|
|
21739
21813
|
TEMPLATES_FRESH = "HIMI_TEMPLATES_FRESH";
|
|
21740
21814
|
PIDLESS_LOCK_GRACE_MS = 3e4;
|
|
@@ -21754,8 +21828,8 @@ var init_ensure_templates = __esm({
|
|
|
21754
21828
|
|
|
21755
21829
|
// ../../core/dev-server/tier5-bundles-src/ensure-bundles.mjs
|
|
21756
21830
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
21757
|
-
import { existsSync as existsSync16, mkdirSync as
|
|
21758
|
-
import { dirname as dirname12, relative as
|
|
21831
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync11, readFileSync as readFileSync17, rmSync as rmSync6 } from "node:fs";
|
|
21832
|
+
import { dirname as dirname12, relative as relative6, resolve as resolve16 } from "node:path";
|
|
21759
21833
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
21760
21834
|
function head2(root) {
|
|
21761
21835
|
const r3 = spawnSync4("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" });
|
|
@@ -21785,7 +21859,7 @@ function ensureBundles({
|
|
|
21785
21859
|
if (!existsSync16(resolve16(root, GENERATOR2))) return false;
|
|
21786
21860
|
if (!refresh && bundlesReady(root)) return false;
|
|
21787
21861
|
const out2 = resolve16(root, BUNDLES_REL);
|
|
21788
|
-
|
|
21862
|
+
mkdirSync11(dirname12(out2), { recursive: true });
|
|
21789
21863
|
const lock = lockPath(out2);
|
|
21790
21864
|
const { token, waited } = acquireLock(lock, { root, waitMs });
|
|
21791
21865
|
try {
|
|
@@ -21803,7 +21877,7 @@ function ensureBundles({
|
|
|
21803
21877
|
${(r3.stderr || r3.stdout || "").trim()}`);
|
|
21804
21878
|
}
|
|
21805
21879
|
if (!existsSync16(stampPath(out2))) {
|
|
21806
|
-
throw new Error(`${GENERATOR2} exited 0 but did not record a complete build in ${
|
|
21880
|
+
throw new Error(`${GENERATOR2} exited 0 but did not record a complete build in ${relative6(root, stampPath(out2))}`);
|
|
21807
21881
|
}
|
|
21808
21882
|
return true;
|
|
21809
21883
|
} finally {
|
|
@@ -21851,7 +21925,7 @@ __export(loader_exports, {
|
|
|
21851
21925
|
});
|
|
21852
21926
|
import { resolve as resolve17, basename as basename7, dirname as dirname13 } from "node:path";
|
|
21853
21927
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
21854
|
-
import { existsSync as existsSync17, readdirSync as readdirSync12, readFileSync as readFileSync18, mkdirSync as
|
|
21928
|
+
import { existsSync as existsSync17, readdirSync as readdirSync12, readFileSync as readFileSync18, mkdirSync as mkdirSync12, rmSync as rmSync7 } from "node:fs";
|
|
21855
21929
|
import { pathToFileURL as pathToFileURL3, fileURLToPath as fileURLToPath11 } from "node:url";
|
|
21856
21930
|
function resolveWixWebAuthConfig(app) {
|
|
21857
21931
|
const auth = app?.meta.auth;
|
|
@@ -21894,7 +21968,7 @@ async function devModuleUrl(entry, dir, fresh = false, sourceCopy = false) {
|
|
|
21894
21968
|
const direct = !isOffRepo() && hasTypeScriptLoader;
|
|
21895
21969
|
if (direct && !fresh && !sourceCopy) return { url: pathToFileURL3(entry).href };
|
|
21896
21970
|
const out2 = resolve17(dir, sourceCopy ? `dist/.himi/dev-source-${randomUUID4()}.mjs` : fresh ? `dist/.himi/dev-${process.pid}-${++freshLoads}.mjs` : "dist/.himi/dev.mjs");
|
|
21897
|
-
|
|
21971
|
+
mkdirSync12(dirname13(out2), { recursive: true });
|
|
21898
21972
|
const buildOptions2 = direct ? { confineTo: dir } : {
|
|
21899
21973
|
// Plain Node must resolve the published-style umbrella entry points for
|
|
21900
21974
|
// both standalone and in-repo CLI content. In-repo workspace packages
|
|
@@ -22697,7 +22771,7 @@ __export(config_exports2, {
|
|
|
22697
22771
|
serializeRolloutYaml: () => serializeRolloutYaml,
|
|
22698
22772
|
validateOverlayPatch: () => validateOverlayPatch
|
|
22699
22773
|
});
|
|
22700
|
-
import { mkdirSync as
|
|
22774
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync19, writeFileSync as writeFileSync10 } from "node:fs";
|
|
22701
22775
|
import { dirname as dirname14, join as join15, resolve as resolve18 } from "node:path";
|
|
22702
22776
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
22703
22777
|
function strip(line) {
|
|
@@ -22825,7 +22899,7 @@ function readJsonAt(app, file2, root) {
|
|
|
22825
22899
|
}
|
|
22826
22900
|
function writeJsonAt(app, file2, root, value2) {
|
|
22827
22901
|
const path2 = appConfigPath(app, file2, root);
|
|
22828
|
-
|
|
22902
|
+
mkdirSync13(dirname14(path2), { recursive: true });
|
|
22829
22903
|
writeFileSync10(path2, JSON.stringify(value2, null, 2) + "\n");
|
|
22830
22904
|
return path2;
|
|
22831
22905
|
}
|
|
@@ -23272,19 +23346,19 @@ var init_hhp_command = __esm({
|
|
|
23272
23346
|
});
|
|
23273
23347
|
|
|
23274
23348
|
// src/hhp.ts
|
|
23275
|
-
import { existsSync as existsSync20, readFileSync as readFileSync21, writeFileSync as writeFileSync11, mkdirSync as
|
|
23276
|
-
import { basename as basename8, dirname as dirname16, resolve as resolve21, relative as
|
|
23349
|
+
import { existsSync as existsSync20, readFileSync as readFileSync21, writeFileSync as writeFileSync11, mkdirSync as mkdirSync14, renameSync as renameSync6, rmSync as rmSync8, lstatSync as lstatSync10, readdirSync as readdirSync14 } from "node:fs";
|
|
23350
|
+
import { basename as basename8, dirname as dirname16, resolve as resolve21, relative as relative7, sep as sep10, join as join17 } from "node:path";
|
|
23277
23351
|
import { createHash as createHash7, randomUUID as randomUUID5 } from "node:crypto";
|
|
23278
23352
|
import ts3 from "typescript";
|
|
23279
23353
|
function localPath(root, path2, from = join17(root, "hhp.json")) {
|
|
23280
23354
|
if (/^[a-z]+:|^\/\//i.test(path2)) throw new Error("HHP source dependencies must be local files.");
|
|
23281
|
-
const target = resolve21(dirname16(from), path2), rel =
|
|
23282
|
-
if (rel.startsWith(`..${
|
|
23283
|
-
const components2 = rel.split(
|
|
23355
|
+
const target = resolve21(dirname16(from), path2), rel = relative7(resolve21(root), target);
|
|
23356
|
+
if (rel.startsWith(`..${sep10}`) || rel === ".." || !rel || target === resolve21(root)) throw new Error("HHP source path escapes the app.");
|
|
23357
|
+
const components2 = rel.split(sep10);
|
|
23284
23358
|
let current = resolve21(root);
|
|
23285
23359
|
for (const component of components2) {
|
|
23286
23360
|
current = join17(current, component);
|
|
23287
|
-
if (existsSync20(current) &&
|
|
23361
|
+
if (existsSync20(current) && lstatSync10(current).isSymbolicLink()) throw new Error("HHP paths cannot traverse symlinks.");
|
|
23288
23362
|
}
|
|
23289
23363
|
return target;
|
|
23290
23364
|
}
|
|
@@ -23417,13 +23491,13 @@ async function compileContentHhp(root, opts = {}) {
|
|
|
23417
23491
|
for (const dependency of result2.dependencies.filter((f2) => /\.tsx?$/.test(f2))) inspect2(dependency);
|
|
23418
23492
|
result2.manifest.requiredCapabilities = [...requiredCapabilities2].sort();
|
|
23419
23493
|
outputs.set(`dev/hhp/${id}.descriptor.json`, JSON.stringify(result2.descriptor, null, 2) + "\n");
|
|
23420
|
-
outputs.set(`dev/hhp/${id}.map.json`, JSON.stringify({ ...result2.manifest, nodes: Object.fromEntries(Object.entries(result2.sourceMap).map(([key3, node]) => [key3, { ...node, file:
|
|
23494
|
+
outputs.set(`dev/hhp/${id}.map.json`, JSON.stringify({ ...result2.manifest, nodes: Object.fromEntries(Object.entries(result2.sourceMap).map(([key3, node]) => [key3, { ...node, file: relative7(root, node.file).split(sep10).join("/") }])) }, null, 2) + "\n");
|
|
23421
23495
|
if (result2.worker && result2.bundleName) {
|
|
23422
23496
|
if (results.some((r3) => r3 !== result2 && r3.bundleName === result2.bundleName)) diagnostics.push({ code: "HHP-BUNDLE-ID", severity: "error", file: file2, line: 1, column: 1, message: "Screen ids normalize to the same bundle name." });
|
|
23423
23497
|
const workerRel = `tier5-src/${result2.bundleName}/index.ts`;
|
|
23424
23498
|
let worker = result2.worker;
|
|
23425
23499
|
for (const dependency of result2.dependencies.filter((f2) => /\.(controller|service)\.tsx?$/.test(f2)))
|
|
23426
|
-
worker = worker.replace(JSON.stringify(dependency), JSON.stringify(
|
|
23500
|
+
worker = worker.replace(JSON.stringify(dependency), JSON.stringify(relative7(dirname16(join17(root, workerRel)), dependency).split(sep10).join("/").replace(/\.tsx?$/, ".js")));
|
|
23427
23501
|
outputs.set(workerRel, worker);
|
|
23428
23502
|
}
|
|
23429
23503
|
}
|
|
@@ -23477,13 +23551,13 @@ async function compileContentHhp(root, opts = {}) {
|
|
|
23477
23551
|
for (const [path2, png] of rasters) {
|
|
23478
23552
|
if (!png) continue;
|
|
23479
23553
|
if (existsExact(path2) && readFileSync21(path2).equals(png)) continue;
|
|
23480
|
-
|
|
23554
|
+
mkdirSync14(dirname16(path2), { recursive: true });
|
|
23481
23555
|
writeFileSync11(`${path2}.tmp`, png);
|
|
23482
23556
|
rmSync8(path2, { force: true });
|
|
23483
23557
|
renameSync6(`${path2}.tmp`, path2);
|
|
23484
23558
|
}
|
|
23485
23559
|
const target = localPath(root, "dev/hhp"), stage = localPath(root, `dev/.hhp-${randomUUID5()}`), backup = `${stage}-old`;
|
|
23486
|
-
|
|
23560
|
+
mkdirSync14(stage, { recursive: true });
|
|
23487
23561
|
try {
|
|
23488
23562
|
for (const [rel, source] of outputs) if (rel.startsWith("dev/hhp/")) writeFileSync11(join17(stage, rel.slice(8)), source);
|
|
23489
23563
|
const workers = [...outputs].filter(([rel]) => rel.startsWith("tier5-src/"));
|
|
@@ -23496,7 +23570,7 @@ async function compileContentHhp(root, opts = {}) {
|
|
|
23496
23570
|
try {
|
|
23497
23571
|
for (const [rel, source] of workers) {
|
|
23498
23572
|
const path2 = localPath(root, rel);
|
|
23499
|
-
|
|
23573
|
+
mkdirSync14(dirname16(path2), { recursive: true });
|
|
23500
23574
|
writeFileSync11(`${path2}.tmp`, source);
|
|
23501
23575
|
renameSync6(`${path2}.tmp`, path2);
|
|
23502
23576
|
}
|
|
@@ -23513,7 +23587,7 @@ async function compileContentHhp(root, opts = {}) {
|
|
|
23513
23587
|
for (const [path2, source] of oldWorkers) {
|
|
23514
23588
|
if (source === null) rmSync8(path2, { force: true });
|
|
23515
23589
|
else {
|
|
23516
|
-
|
|
23590
|
+
mkdirSync14(dirname16(path2), { recursive: true });
|
|
23517
23591
|
writeFileSync11(path2, source);
|
|
23518
23592
|
}
|
|
23519
23593
|
}
|
|
@@ -23570,7 +23644,7 @@ export default defineController({
|
|
|
23570
23644
|
if ((await loadContent(root)).module.screens.exact[id]) throw new Error(`Screen id ${id} is already registered.`);
|
|
23571
23645
|
for (const [rel, body] of Object.entries(files)) {
|
|
23572
23646
|
const path2 = localPath(root, rel);
|
|
23573
|
-
|
|
23647
|
+
mkdirSync14(dirname16(path2), { recursive: true });
|
|
23574
23648
|
writeFileSync11(path2, body);
|
|
23575
23649
|
}
|
|
23576
23650
|
manifest2.screens[id] = { html: `screens/${id}.html` };
|
|
@@ -23583,7 +23657,7 @@ export default defineController({
|
|
|
23583
23657
|
const originalSettings = existsSync20(settings) ? readFileSync21(settings, "utf8") : "{}";
|
|
23584
23658
|
const updated = hhpEditorSettings(originalSettings);
|
|
23585
23659
|
if (originalSettings !== updated) {
|
|
23586
|
-
|
|
23660
|
+
mkdirSync14(dirname16(settings), { recursive: true });
|
|
23587
23661
|
writeFileSync11(settings, updated);
|
|
23588
23662
|
}
|
|
23589
23663
|
built.outputs.push(".vscode/settings.json");
|
|
@@ -23625,7 +23699,7 @@ var init_hhp = __esm({
|
|
|
23625
23699
|
});
|
|
23626
23700
|
|
|
23627
23701
|
// src/shared-drift.ts
|
|
23628
|
-
import { existsSync as existsSync21, lstatSync as
|
|
23702
|
+
import { existsSync as existsSync21, lstatSync as lstatSync11, readdirSync as readdirSync15, readFileSync as readFileSync22 } from "node:fs";
|
|
23629
23703
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
23630
23704
|
import { basename as basename9, dirname as dirname17, join as join18, resolve as resolve22 } from "node:path";
|
|
23631
23705
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
@@ -23677,7 +23751,7 @@ function missingSiblings(shippedFile, sharedDir) {
|
|
|
23677
23751
|
}
|
|
23678
23752
|
function hasEntry(p2) {
|
|
23679
23753
|
try {
|
|
23680
|
-
|
|
23754
|
+
lstatSync11(p2);
|
|
23681
23755
|
return true;
|
|
23682
23756
|
} catch {
|
|
23683
23757
|
return false;
|
|
@@ -23729,7 +23803,7 @@ function scanSharedDrift(contentDir2, templatesRoot) {
|
|
|
23729
23803
|
if (!templatesRoot || !existsSync21(templatesRoot)) return null;
|
|
23730
23804
|
const sharedDir = join18(contentDir2, SHARED_REL);
|
|
23731
23805
|
try {
|
|
23732
|
-
if (!
|
|
23806
|
+
if (!lstatSync11(sharedDir).isDirectory()) return null;
|
|
23733
23807
|
} catch {
|
|
23734
23808
|
return null;
|
|
23735
23809
|
}
|
|
@@ -23789,7 +23863,7 @@ var init_shared_drift = __esm({
|
|
|
23789
23863
|
SIBLING_IMPORT = /(?:from\s+|import\s+)(["'])\.\/([A-Za-z0-9_-]+)(?:\.js|\.ts)?\1/g;
|
|
23790
23864
|
isRealFile = (p2) => {
|
|
23791
23865
|
try {
|
|
23792
|
-
return
|
|
23866
|
+
return lstatSync11(p2).isFile();
|
|
23793
23867
|
} catch {
|
|
23794
23868
|
return false;
|
|
23795
23869
|
}
|
|
@@ -23817,7 +23891,7 @@ __export(build_exports, {
|
|
|
23817
23891
|
umbrellaVersion: () => umbrellaVersion,
|
|
23818
23892
|
umbrellaVersionIssue: () => umbrellaVersionIssue
|
|
23819
23893
|
});
|
|
23820
|
-
import { existsSync as existsSync22, readdirSync as readdirSync16, mkdirSync as
|
|
23894
|
+
import { existsSync as existsSync22, readdirSync as readdirSync16, mkdirSync as mkdirSync15, statSync as statSync6, symlinkSync, readFileSync as readFileSync23 } from "node:fs";
|
|
23821
23895
|
import { resolve as resolve23, join as join19, dirname as dirname18 } from "node:path";
|
|
23822
23896
|
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
23823
23897
|
import { execFileSync } from "node:child_process";
|
|
@@ -23865,7 +23939,7 @@ function ensureUmbrella(contentDir2, globalPath = globalUmbrella()) {
|
|
|
23865
23939
|
if (!globalPath) return false;
|
|
23866
23940
|
try {
|
|
23867
23941
|
const scope2 = join19(contentDir2, "node_modules", "@wix");
|
|
23868
|
-
|
|
23942
|
+
mkdirSync15(scope2, { recursive: true });
|
|
23869
23943
|
const link = join19(scope2, "himalaya");
|
|
23870
23944
|
if (!existsSync22(link)) symlinkSync(globalPath, link, "dir");
|
|
23871
23945
|
return existsSync22(join19(link, "package.json"));
|
|
@@ -23968,7 +24042,7 @@ async function buildContentBundles(contentDir2, opts = {}) {
|
|
|
23968
24042
|
return { built, outDir, compileErrors: [{ bundle: "hhp", errors: [{ text: e2.message }] }], ...advisories };
|
|
23969
24043
|
}
|
|
23970
24044
|
if (!existsSync22(srcDir)) return { built, outDir, compileErrors, ...advisories };
|
|
23971
|
-
|
|
24045
|
+
mkdirSync15(outDir, { recursive: true });
|
|
23972
24046
|
for (const name of readdirSync16(srcDir).sort()) {
|
|
23973
24047
|
const entry = join19(srcDir, name, "index.ts");
|
|
23974
24048
|
if (!statSync6(join19(srcDir, name)).isDirectory() || !existsSync22(entry)) continue;
|
|
@@ -24027,7 +24101,7 @@ __export(app_config_loader_exports, {
|
|
|
24027
24101
|
makeBuildMemo: () => makeBuildMemo,
|
|
24028
24102
|
uninstallContainedAppConfigRealm: () => uninstallContainedAppConfigRealm
|
|
24029
24103
|
});
|
|
24030
|
-
import { existsSync as existsSync23, mkdirSync as
|
|
24104
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync16 } from "node:fs";
|
|
24031
24105
|
import { dirname as dirname19, join as join20, resolve as resolve24 } from "node:path";
|
|
24032
24106
|
import { pathToFileURL as pathToFileURL4 } from "node:url";
|
|
24033
24107
|
function configEntry(dir) {
|
|
@@ -24043,7 +24117,7 @@ async function buildConfigModuleUrl(entry, dir) {
|
|
|
24043
24117
|
const { bundledRuntimeDir: bundledRuntimeDir2 } = await Promise.resolve().then(() => (init_build(), build_exports));
|
|
24044
24118
|
bundledRuntimeDir2();
|
|
24045
24119
|
const out2 = resolve24(dir, "dist/.himi/config.mjs");
|
|
24046
|
-
|
|
24120
|
+
mkdirSync16(dirname19(out2), { recursive: true });
|
|
24047
24121
|
await buildAppEntry(entry, out2, { umbrella: true, resolveTsExtensions: true, absWorkingDir: dir, confineTo: dir });
|
|
24048
24122
|
return pathToFileURL4(out2).href;
|
|
24049
24123
|
}
|
|
@@ -27315,7 +27389,7 @@ var init_plan_fonts = __esm({
|
|
|
27315
27389
|
|
|
27316
27390
|
// ../font-bake/face-source.ts
|
|
27317
27391
|
import { createHash as createHash9 } from "node:crypto";
|
|
27318
|
-
import { existsSync as existsSync28, mkdirSync as
|
|
27392
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync27, renameSync as renameSync7, rmSync as rmSync9, writeFileSync as writeFileSync12 } from "node:fs";
|
|
27319
27393
|
import { homedir as homedir3 } from "node:os";
|
|
27320
27394
|
import { basename as basename10, join as join23 } from "node:path";
|
|
27321
27395
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
@@ -27349,7 +27423,7 @@ async function fetchUpstreamBytes(url) {
|
|
|
27349
27423
|
}
|
|
27350
27424
|
function writeCachedFace(bytes2) {
|
|
27351
27425
|
const hash3 = sha256Hex3(bytes2);
|
|
27352
|
-
|
|
27426
|
+
mkdirSync17(CACHE_DIR, { recursive: true });
|
|
27353
27427
|
const tmp = join23(CACHE_DIR, `.${hash3}.${process.pid}.${Date.now()}.tmp`);
|
|
27354
27428
|
try {
|
|
27355
27429
|
writeFileSync12(tmp, bytes2);
|
|
@@ -28224,7 +28298,7 @@ var init_inject = __esm({
|
|
|
28224
28298
|
});
|
|
28225
28299
|
|
|
28226
28300
|
// ../../core/dev-server/src/store.ts
|
|
28227
|
-
import { mkdirSync as
|
|
28301
|
+
import { mkdirSync as mkdirSync18 } from "node:fs";
|
|
28228
28302
|
import { dirname as dirname21, resolve as resolve27 } from "node:path";
|
|
28229
28303
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
28230
28304
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -28244,7 +28318,7 @@ var init_store2 = __esm({
|
|
|
28244
28318
|
/** The node:sqlite handle — opened, bootstrapped, and seeded on first access. */
|
|
28245
28319
|
get db() {
|
|
28246
28320
|
if (this._db) return this._db;
|
|
28247
|
-
|
|
28321
|
+
mkdirSync18(dirname21(this.dbPath), { recursive: true });
|
|
28248
28322
|
const { DatabaseSync } = nodeRequire("node:sqlite");
|
|
28249
28323
|
this._db = new DatabaseSync(this.dbPath, { timeout: 5e3 });
|
|
28250
28324
|
this.bootstrap();
|
|
@@ -33178,7 +33252,7 @@ function redactBodyString(body) {
|
|
|
33178
33252
|
} catch {
|
|
33179
33253
|
}
|
|
33180
33254
|
}
|
|
33181
|
-
return body.replace(FORM_ASSIGNMENT_RE, (m2, name) => isSensitiveBodyName(name) ? `${name}=${REDACTED}` : m2).replace(JSON_FIELD_RE, (m2, name,
|
|
33255
|
+
return body.replace(FORM_ASSIGNMENT_RE, (m2, name) => isSensitiveBodyName(name) ? `${name}=${REDACTED}` : m2).replace(JSON_FIELD_RE, (m2, name, sep26) => isSensitiveBodyName(name) ? `"${name}"${sep26}"${REDACTED}"` : m2).replace(JSON_FIELD_UNTERMINATED_RE, (m2, name, sep26) => isSensitiveBodyName(name) ? `"${name}"${sep26}"${REDACTED}` : m2).replace(BEARER_RE, (_m, s2) => `${s2} ${REDACTED}`);
|
|
33182
33256
|
}
|
|
33183
33257
|
function createWixGatewayState() {
|
|
33184
33258
|
return { mode: "record", rules: [], traffic: [], clients: /* @__PURE__ */ new Set(), seq: 0, ruleSeq: 0 };
|
|
@@ -38741,10 +38815,10 @@ async function runRicosImageUpload(o2) {
|
|
|
38741
38815
|
} catch {
|
|
38742
38816
|
return fail7("read");
|
|
38743
38817
|
}
|
|
38744
|
-
const
|
|
38818
|
+
const sep26 = entry.uploadUrl.includes("?") ? "&" : "?";
|
|
38745
38819
|
let res;
|
|
38746
38820
|
try {
|
|
38747
|
-
res = await deps.fetch(`${entry.uploadUrl}${
|
|
38821
|
+
res = await deps.fetch(`${entry.uploadUrl}${sep26}filename=${encodeURIComponent(file2.fileName)}`, { method: "PUT", headers: { "Content-Type": file2.mimeType }, body });
|
|
38748
38822
|
} catch {
|
|
38749
38823
|
return fail7("put");
|
|
38750
38824
|
}
|
|
@@ -39387,10 +39461,10 @@ async function runMediaFieldUpload(o2) {
|
|
|
39387
39461
|
} catch (e2) {
|
|
39388
39462
|
return { ok: false, reason: e2 instanceof Deadline ? "timeout" : "read" };
|
|
39389
39463
|
}
|
|
39390
|
-
const
|
|
39464
|
+
const sep26 = uploadUrl.includes("?") ? "&" : "?";
|
|
39391
39465
|
let res;
|
|
39392
39466
|
try {
|
|
39393
|
-
res = await bounded2(deps.fetch(`${uploadUrl}${
|
|
39467
|
+
res = await bounded2(deps.fetch(`${uploadUrl}${sep26}filename=${encodeURIComponent(file2.fileName)}`, {
|
|
39394
39468
|
method: "PUT",
|
|
39395
39469
|
headers: { "Content-Type": file2.mimeType },
|
|
39396
39470
|
body,
|
|
@@ -123073,8 +123147,8 @@ function ensureCountUpRuntime() {
|
|
|
123073
123147
|
const neg = fixed.startsWith("-");
|
|
123074
123148
|
const body = neg ? fixed.slice(1) : fixed;
|
|
123075
123149
|
const [int2, frac] = body.split(".");
|
|
123076
|
-
const
|
|
123077
|
-
return (neg ? "-" : "") +
|
|
123150
|
+
const sep26 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
123151
|
+
return (neg ? "-" : "") + sep26 + (frac ? "." + frac : "");
|
|
123078
123152
|
};
|
|
123079
123153
|
const animateEl = (el2) => {
|
|
123080
123154
|
const node = el2;
|
|
@@ -133783,7 +133857,7 @@ __export(widgets_exports, {
|
|
|
133783
133857
|
widgetScanRunCount: () => widgetScanRunCount
|
|
133784
133858
|
});
|
|
133785
133859
|
import { createHash as createHash15 } from "node:crypto";
|
|
133786
|
-
import { lstatSync as
|
|
133860
|
+
import { lstatSync as lstatSync12, readdirSync as readdirSync19, statSync as statSync8 } from "node:fs";
|
|
133787
133861
|
import { join as join27 } from "node:path";
|
|
133788
133862
|
import { inspect } from "node:util";
|
|
133789
133863
|
async function widgetRealm() {
|
|
@@ -133910,7 +133984,7 @@ function bundleDirFingerprint(roots2) {
|
|
|
133910
133984
|
} catch (err) {
|
|
133911
133985
|
const code = err.code;
|
|
133912
133986
|
if (code !== "ENOENT" && code !== "ENOTDIR" && code !== "ELOOP") throw err;
|
|
133913
|
-
st2 =
|
|
133987
|
+
st2 = lstatSync12(path2, { bigint: true });
|
|
133914
133988
|
hash3.update(`${root}\0${entry}\0unresolved\0${st2.ino}\0${st2.mtimeNs}\0${st2.ctimeNs}
|
|
133915
133989
|
`);
|
|
133916
133990
|
continue;
|
|
@@ -134534,8 +134608,8 @@ var init_widgets = __esm({
|
|
|
134534
134608
|
// ../../core/dev-server/src/index.ts
|
|
134535
134609
|
import { createServer as createServer2 } from "node:http";
|
|
134536
134610
|
import { readFile, stat } from "node:fs/promises";
|
|
134537
|
-
import { readFileSync as readFileSync37, existsSync as existsSync33, watch, mkdirSync as
|
|
134538
|
-
import { basename as basename11, dirname as dirname24, extname as extname2, join as join28, relative as
|
|
134611
|
+
import { readFileSync as readFileSync37, existsSync as existsSync33, watch, mkdirSync as mkdirSync19, rmSync as rmSync10 } from "node:fs";
|
|
134612
|
+
import { basename as basename11, dirname as dirname24, extname as extname2, join as join28, relative as relative8, resolve as resolve32, normalize as normalize4, sep as sep11 } from "node:path";
|
|
134539
134613
|
import { createHash as createHash16, randomUUID as randomUUID6 } from "node:crypto";
|
|
134540
134614
|
import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL5 } from "node:url";
|
|
134541
134615
|
function readLogicBundle(read, tier5Dir, name) {
|
|
@@ -135362,7 +135436,7 @@ function startBundleArtifactWatcher(state) {
|
|
|
135362
135436
|
});
|
|
135363
135437
|
};
|
|
135364
135438
|
try {
|
|
135365
|
-
|
|
135439
|
+
mkdirSync19(TIER5_ROOT2, { recursive: true });
|
|
135366
135440
|
const watcher2 = watch(TIER5_ROOT2, { persistent: false }, (_event, filename) => {
|
|
135367
135441
|
const bundle = builtBundleName(filename);
|
|
135368
135442
|
if (!bundle) return;
|
|
@@ -135411,7 +135485,7 @@ function startBundleSourceWatcher(state) {
|
|
|
135411
135485
|
try {
|
|
135412
135486
|
const watcher2 = watch(TIER5_SRC_ROOT, { persistent: false, recursive: true }, (_event, filename) => {
|
|
135413
135487
|
if (!filename || !/\.(ts|tsx)$/.test(filename)) return;
|
|
135414
|
-
const name = filename.split(
|
|
135488
|
+
const name = filename.split(sep11)[0];
|
|
135415
135489
|
if (!name || name.startsWith(".")) return;
|
|
135416
135490
|
pending.add(name);
|
|
135417
135491
|
if (timer) clearTimeout(timer);
|
|
@@ -135490,7 +135564,7 @@ async function reloadAppModuleNow(state, opts) {
|
|
|
135490
135564
|
const current = state.app;
|
|
135491
135565
|
if (!current) return { ok: false, error: "no_app" };
|
|
135492
135566
|
const entry = resolve32(current.dir, "dev/index.ts");
|
|
135493
|
-
|
|
135567
|
+
mkdirSync19(HMR_TMP_DIR, { recursive: true });
|
|
135494
135568
|
const outfile = resolve32(HMR_TMP_DIR, `${current.name}-${++appReloadSeq}.mjs`);
|
|
135495
135569
|
try {
|
|
135496
135570
|
const lib = await import(pathToFileURL5(resolve32(TIER5_SRC_ROOT, "build-lib.mjs")).href);
|
|
@@ -135559,12 +135633,12 @@ function servedTokensHash(app) {
|
|
|
135559
135633
|
}
|
|
135560
135634
|
}
|
|
135561
135635
|
function appDependencyFiles(inputs, appDir3) {
|
|
135562
|
-
const inside2 = (root, p2) => p2 === root || p2.startsWith(root +
|
|
135636
|
+
const inside2 = (root, p2) => p2 === root || p2.startsWith(root + sep11);
|
|
135563
135637
|
const out2 = /* @__PURE__ */ new Set();
|
|
135564
135638
|
for (const raw of inputs) {
|
|
135565
135639
|
const p2 = resolve32(raw);
|
|
135566
135640
|
if (!inside2(ROOT6, p2) || inside2(resolve32(appDir3), p2) || inside2(HMR_TMP_DIR, p2)) continue;
|
|
135567
|
-
if (p2.split(
|
|
135641
|
+
if (p2.split(sep11).includes("node_modules")) continue;
|
|
135568
135642
|
out2.add(p2);
|
|
135569
135643
|
}
|
|
135570
135644
|
return [...out2].sort();
|
|
@@ -135594,7 +135668,7 @@ function syncAppDependencyWatchers(state, inputs) {
|
|
|
135594
135668
|
if (timer) clearTimeout(timer);
|
|
135595
135669
|
timer = setTimeout(() => {
|
|
135596
135670
|
timer = void 0;
|
|
135597
|
-
const files = [...changed].map((f2) =>
|
|
135671
|
+
const files = [...changed].map((f2) => relative8(ROOT6, f2));
|
|
135598
135672
|
changed.clear();
|
|
135599
135673
|
console.log(`[himalaya-dev] app dependency changed: ${files.join(", ")}`);
|
|
135600
135674
|
void reloadAppModule(state, { reason: "dependency_changed" });
|
|
@@ -135613,7 +135687,7 @@ async function primeAppDependencyWatchers(state) {
|
|
|
135613
135687
|
if (!current) return;
|
|
135614
135688
|
const entry = resolve32(current.dir, "dev/index.ts");
|
|
135615
135689
|
if (!existsSync33(entry)) return;
|
|
135616
|
-
|
|
135690
|
+
mkdirSync19(HMR_TMP_DIR, { recursive: true });
|
|
135617
135691
|
const outfile = resolve32(HMR_TMP_DIR, `${current.name}-deps-${++appReloadSeq}.mjs`);
|
|
135618
135692
|
try {
|
|
135619
135693
|
const lib = await import(pathToFileURL5(resolve32(TIER5_SRC_ROOT, "build-lib.mjs")).href);
|
|
@@ -135682,7 +135756,7 @@ function startAppSourceWatcher(state) {
|
|
|
135682
135756
|
try {
|
|
135683
135757
|
const watcher2 = watch(appDir3, { persistent: false, recursive: true }, (_event, filename) => {
|
|
135684
135758
|
if (!filename) return;
|
|
135685
|
-
const rel = String(filename).split(
|
|
135759
|
+
const rel = String(filename).split(sep11).join("/");
|
|
135686
135760
|
if (!classifyAppPath(rel)) return;
|
|
135687
135761
|
pending.add(rel);
|
|
135688
135762
|
if (timer) clearTimeout(timer);
|
|
@@ -137277,8 +137351,8 @@ async function handleActionHandlerBundleGet(res, app) {
|
|
|
137277
137351
|
}
|
|
137278
137352
|
async function serveStatic(req, res, root, prefix) {
|
|
137279
137353
|
const requested = decodeURIComponent((req.url ?? "").split("?")[0]);
|
|
137280
|
-
const
|
|
137281
|
-
const safe = normalize4(
|
|
137354
|
+
const relative27 = requested.replace(prefix, "").replace(/^\//, "");
|
|
137355
|
+
const safe = normalize4(relative27).replace(/^(\.\.[\/\\])+/, "");
|
|
137282
137356
|
const fullPath = resolve32(root, safe);
|
|
137283
137357
|
if (!fullPath.startsWith(root)) {
|
|
137284
137358
|
return send(res, 403, "forbidden");
|
|
@@ -138074,8 +138148,8 @@ var init_src6 = __esm({
|
|
|
138074
138148
|
});
|
|
138075
138149
|
|
|
138076
138150
|
// ../../core/serve-storage/src/file-store.ts
|
|
138077
|
-
import { mkdirSync as
|
|
138078
|
-
import { join as join29, resolve as resolve33, sep as
|
|
138151
|
+
import { mkdirSync as mkdirSync20, readFileSync as readFileSync38, rmSync as rmSync11, writeFileSync as writeFileSync13, readdirSync as readdirSync20, existsSync as existsSync34 } from "node:fs";
|
|
138152
|
+
import { join as join29, resolve as resolve33, sep as sep12 } from "node:path";
|
|
138079
138153
|
var FileReleaseStore;
|
|
138080
138154
|
var init_file_store = __esm({
|
|
138081
138155
|
"../../core/serve-storage/src/file-store.ts"() {
|
|
@@ -138113,7 +138187,7 @@ var init_file_store = __esm({
|
|
|
138113
138187
|
*/
|
|
138114
138188
|
appDir(app) {
|
|
138115
138189
|
const dir = resolve33(this.root, this.safe(app));
|
|
138116
|
-
if (!dir.startsWith(this.root +
|
|
138190
|
+
if (!dir.startsWith(this.root + sep12)) {
|
|
138117
138191
|
throw new Error(`unsafe app id ${JSON.stringify(app)}: ${dir} is not inside the store root`);
|
|
138118
138192
|
}
|
|
138119
138193
|
return dir;
|
|
@@ -138125,58 +138199,58 @@ var init_file_store = __esm({
|
|
|
138125
138199
|
async reset(app) {
|
|
138126
138200
|
const dir = this.appDir(app);
|
|
138127
138201
|
rmSync11(dir, { recursive: true, force: true });
|
|
138128
|
-
|
|
138129
|
-
|
|
138202
|
+
mkdirSync20(join29(dir, "screens"), { recursive: true });
|
|
138203
|
+
mkdirSync20(join29(dir, "bundles"), { recursive: true });
|
|
138130
138204
|
}
|
|
138131
138205
|
async remove(app) {
|
|
138132
138206
|
rmSync11(this.appDir(app), { recursive: true, force: true });
|
|
138133
138207
|
}
|
|
138134
138208
|
async putManifest(app, manifest2) {
|
|
138135
138209
|
validateFunctionManifest(manifest2);
|
|
138136
|
-
|
|
138210
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138137
138211
|
writeFileSync13(join29(this.appDir(app), "release-manifest.json"), JSON.stringify(manifest2, null, 2));
|
|
138138
138212
|
}
|
|
138139
138213
|
async putScreen(app, screenId, json8) {
|
|
138140
138214
|
const dir = join29(this.appDir(app), "screens");
|
|
138141
|
-
|
|
138215
|
+
mkdirSync20(dir, { recursive: true });
|
|
138142
138216
|
writeFileSync13(join29(dir, `${this.safe(screenId)}.json`), json8);
|
|
138143
138217
|
}
|
|
138144
138218
|
async putBundle(app, sha2567, bytes2) {
|
|
138145
138219
|
const dir = join29(this.appDir(app), "bundles");
|
|
138146
|
-
|
|
138220
|
+
mkdirSync20(dir, { recursive: true });
|
|
138147
138221
|
writeFileSync13(join29(dir, `${this.safe(sha2567)}.bundle.js`), bytes2);
|
|
138148
138222
|
}
|
|
138149
138223
|
async putTokens(app, json8) {
|
|
138150
|
-
|
|
138224
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138151
138225
|
writeFileSync13(join29(this.appDir(app), "tokens.json"), json8);
|
|
138152
138226
|
}
|
|
138153
138227
|
async putDoc(app, sha2567, json8) {
|
|
138154
138228
|
const dir = join29(this.appDir(app), "docs");
|
|
138155
|
-
|
|
138229
|
+
mkdirSync20(dir, { recursive: true });
|
|
138156
138230
|
writeFileSync13(join29(dir, `${this.safe(sha2567)}.json`), json8);
|
|
138157
138231
|
}
|
|
138158
138232
|
async putAppConfig(app, json8) {
|
|
138159
|
-
|
|
138233
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138160
138234
|
writeFileSync13(join29(this.appDir(app), "app-config.json"), json8);
|
|
138161
138235
|
}
|
|
138162
138236
|
async putIcon(app, bytes2) {
|
|
138163
|
-
|
|
138237
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138164
138238
|
writeFileSync13(join29(this.appDir(app), "icon.png"), bytes2);
|
|
138165
138239
|
}
|
|
138166
138240
|
async putWidget(app, widgetId, json8) {
|
|
138167
138241
|
const dir = join29(this.appDir(app), "widgets");
|
|
138168
|
-
|
|
138242
|
+
mkdirSync20(dir, { recursive: true });
|
|
138169
138243
|
writeFileSync13(join29(dir, `${this.safe(widgetId)}.json`), json8);
|
|
138170
138244
|
}
|
|
138171
138245
|
// Per-app settings (registry visibility) — release-independent, so it lives beside the
|
|
138172
138246
|
// manifest, not inside it. NOTE: listApps() keys on release-manifest.json/ledger presence,
|
|
138173
138247
|
// so a settings-only dir never lists an app.
|
|
138174
138248
|
async putAppSettings(app, settings) {
|
|
138175
|
-
|
|
138249
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138176
138250
|
writeFileSync13(join29(this.appDir(app), "settings.json"), JSON.stringify(settings, null, 2));
|
|
138177
138251
|
}
|
|
138178
138252
|
async putOneAppEnrollment(app) {
|
|
138179
|
-
|
|
138253
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138180
138254
|
writeFileSync13(join29(this.appDir(app), "one-app-enrollment"), "one-app-to-himi-app");
|
|
138181
138255
|
}
|
|
138182
138256
|
// Template scaffold source archive — a content-addressed JSON doc, so it rides the same
|
|
@@ -138189,7 +138263,7 @@ var init_file_store = __esm({
|
|
|
138189
138263
|
// bundles/<sha>.bundle.js, which bakes ".bundle.js" into the filename).
|
|
138190
138264
|
async putAsset(app, sha2567, bytes2) {
|
|
138191
138265
|
const dir = join29(this.appDir(app), "assets");
|
|
138192
|
-
|
|
138266
|
+
mkdirSync20(dir, { recursive: true });
|
|
138193
138267
|
writeFileSync13(join29(dir, this.safe(sha2567)), bytes2);
|
|
138194
138268
|
}
|
|
138195
138269
|
async getManifest(app) {
|
|
@@ -138259,7 +138333,7 @@ var init_file_store = __esm({
|
|
|
138259
138333
|
async putManifestVersioned(app, releaseId, manifest2) {
|
|
138260
138334
|
validateFunctionManifest(manifest2);
|
|
138261
138335
|
const dir = join29(this.appDir(app), "manifests");
|
|
138262
|
-
|
|
138336
|
+
mkdirSync20(dir, { recursive: true });
|
|
138263
138337
|
writeFileSync13(join29(dir, `${this.safe(releaseId)}.json`), JSON.stringify(manifest2, null, 2));
|
|
138264
138338
|
}
|
|
138265
138339
|
async getManifestById(app, releaseId) {
|
|
@@ -138280,7 +138354,7 @@ var init_file_store = __esm({
|
|
|
138280
138354
|
}
|
|
138281
138355
|
}
|
|
138282
138356
|
async appendRelease(app, entry) {
|
|
138283
|
-
|
|
138357
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138284
138358
|
const ledger = await this.listReleases(app);
|
|
138285
138359
|
const i2 = ledger.findIndex((e2) => e2.releaseId === entry.releaseId);
|
|
138286
138360
|
if (i2 >= 0) ledger[i2] = entry;
|
|
@@ -138307,7 +138381,7 @@ var init_file_store = __esm({
|
|
|
138307
138381
|
async updateWipRecord(app, fn2) {
|
|
138308
138382
|
const next = fn2(this.readWipSync(app));
|
|
138309
138383
|
if (next === void 0) return false;
|
|
138310
|
-
|
|
138384
|
+
mkdirSync20(this.appDir(app), { recursive: true });
|
|
138311
138385
|
writeFileSync13(join29(this.appDir(app), "_wip.json"), JSON.stringify(next, null, 2));
|
|
138312
138386
|
return true;
|
|
138313
138387
|
}
|
|
@@ -140587,8 +140661,8 @@ async function crawlScreenInner(opts) {
|
|
|
140587
140661
|
if (linkable.has(target)) return true;
|
|
140588
140662
|
for (const base of linkable) {
|
|
140589
140663
|
if (target.length > base.length + 1 && target.startsWith(base)) {
|
|
140590
|
-
const
|
|
140591
|
-
if (
|
|
140664
|
+
const sep26 = target[base.length];
|
|
140665
|
+
if (sep26 === "_" || sep26 === "/") return true;
|
|
140592
140666
|
}
|
|
140593
140667
|
}
|
|
140594
140668
|
return false;
|
|
@@ -144510,13 +144584,13 @@ __export(studio_exports, {
|
|
|
144510
144584
|
});
|
|
144511
144585
|
import { createHash as createHash21 } from "node:crypto";
|
|
144512
144586
|
import { existsSync as existsSync38, readdirSync as readdirSync23, readFileSync as readFileSync42, realpathSync as realpathSync6, statSync as statSync9 } from "node:fs";
|
|
144513
|
-
import { basename as basename12, extname as extname3, join as join33, relative as
|
|
144587
|
+
import { basename as basename12, extname as extname3, join as join33, relative as relative9, resolve as resolve35, sep as sep13 } from "node:path";
|
|
144514
144588
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
144515
144589
|
function realInside(dir, abs) {
|
|
144516
144590
|
try {
|
|
144517
144591
|
const root = realpathSync6(dir);
|
|
144518
144592
|
const real = realpathSync6(abs);
|
|
144519
|
-
return real.startsWith(root +
|
|
144593
|
+
return real.startsWith(root + sep13) ? real : null;
|
|
144520
144594
|
} catch {
|
|
144521
144595
|
return null;
|
|
144522
144596
|
}
|
|
@@ -144533,7 +144607,7 @@ function archiveFile(dir, memory, abs) {
|
|
|
144533
144607
|
return null;
|
|
144534
144608
|
}
|
|
144535
144609
|
if (size === 0) return null;
|
|
144536
|
-
const key3 =
|
|
144610
|
+
const key3 = relative9(dir, abs);
|
|
144537
144611
|
const hit = memory.files?.[key3];
|
|
144538
144612
|
if (hit && hit.size === size && hit.mtimeMs === mtimeMs && hit.ino === ino && existsSync38(join33(dir, HISTORY_DIR, `${hit.sha}.${hit.ext}`))) {
|
|
144539
144613
|
return { sha: hit.sha, ext: hit.ext, file: `${hit.sha}.${hit.ext}` };
|
|
@@ -144954,7 +145028,7 @@ __export(cli_shared_exports, {
|
|
|
144954
145028
|
visibilityFlag: () => visibilityFlag,
|
|
144955
145029
|
writePngFile: () => writePngFile
|
|
144956
145030
|
});
|
|
144957
|
-
import { mkdtempSync, readFileSync as readFileSync43, mkdirSync as
|
|
145031
|
+
import { mkdtempSync, readFileSync as readFileSync43, mkdirSync as mkdirSync21, writeFileSync as writeFileSync14, existsSync as existsSync39, rmSync as rmSync12, readdirSync as readdirSync24, lstatSync as lstatSync13 } from "node:fs";
|
|
144958
145032
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
144959
145033
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
144960
145034
|
import { join as join34, resolve as resolve36, basename as basename13, dirname as dirname26 } from "node:path";
|
|
@@ -145107,7 +145181,7 @@ function nativeConfigTokenNotice(configSource, optedIn) {
|
|
|
145107
145181
|
return `launch-screen token ${list2} also feeds the BUILD-TIME native launch screen (tools/native-config) \u2014 an OTA-only change to its value updates the live app but NOT the baked launch screen until the next native build (regenerate: npm run native-config -- <app>)`;
|
|
145108
145182
|
}
|
|
145109
145183
|
function writePngFile(path2, base64) {
|
|
145110
|
-
|
|
145184
|
+
mkdirSync21(dirname26(path2), { recursive: true });
|
|
145111
145185
|
writeFileSync14(path2, Buffer.from(base64, "base64"));
|
|
145112
145186
|
return path2;
|
|
145113
145187
|
}
|
|
@@ -145150,7 +145224,7 @@ function renameRestoredSource(restored, declaredApp, renamed) {
|
|
|
145150
145224
|
function symlinkDestinationIssue(dest) {
|
|
145151
145225
|
let kind;
|
|
145152
145226
|
try {
|
|
145153
|
-
kind =
|
|
145227
|
+
kind = lstatSync13(dest);
|
|
145154
145228
|
} catch {
|
|
145155
145229
|
return null;
|
|
145156
145230
|
}
|
|
@@ -145214,7 +145288,7 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
145214
145288
|
}
|
|
145215
145289
|
const dest = join34(root, `${slug}-${process.pid}`);
|
|
145216
145290
|
rmSync12(dest, { recursive: true, force: true });
|
|
145217
|
-
|
|
145291
|
+
mkdirSync21(dest, { recursive: true });
|
|
145218
145292
|
try {
|
|
145219
145293
|
materializeSource(forBuild, displayName3, dest, slug);
|
|
145220
145294
|
} catch (e2) {
|
|
@@ -145225,8 +145299,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
145225
145299
|
}
|
|
145226
145300
|
async function appId(dir) {
|
|
145227
145301
|
try {
|
|
145228
|
-
const { readFileSync:
|
|
145229
|
-
const m2 = JSON.parse(
|
|
145302
|
+
const { readFileSync: readFileSync139 } = await import("node:fs");
|
|
145303
|
+
const m2 = JSON.parse(readFileSync139(join34(dir, "himalaya.content.json"), "utf8"));
|
|
145230
145304
|
if (m2.name) return m2.name;
|
|
145231
145305
|
} catch {
|
|
145232
145306
|
}
|
|
@@ -145459,7 +145533,7 @@ var init_cli_shared = __esm({
|
|
|
145459
145533
|
});
|
|
145460
145534
|
|
|
145461
145535
|
// src/self-update.ts
|
|
145462
|
-
import { readFileSync as readFileSync44, mkdirSync as
|
|
145536
|
+
import { readFileSync as readFileSync44, mkdirSync as mkdirSync22, writeFileSync as writeFileSync15, existsSync as existsSync40, rmSync as rmSync13, statSync as statSync10, accessSync, constants } from "node:fs";
|
|
145463
145537
|
import { execFile, execFileSync as execFileSync3, spawnSync as spawnSync6 } from "node:child_process";
|
|
145464
145538
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
145465
145539
|
import { homedir as homedir8, hostname } from "node:os";
|
|
@@ -145646,7 +145720,7 @@ function readUpdateCache(path2) {
|
|
|
145646
145720
|
}
|
|
145647
145721
|
function writeUpdateCache(path2, cache2) {
|
|
145648
145722
|
try {
|
|
145649
|
-
|
|
145723
|
+
mkdirSync22(dirname27(path2), { recursive: true, mode: 448 });
|
|
145650
145724
|
writeFileSync15(path2, JSON.stringify(cache2, null, 2) + "\n", { mode: 384 });
|
|
145651
145725
|
} catch {
|
|
145652
145726
|
}
|
|
@@ -145800,7 +145874,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
|
|
|
145800
145874
|
};
|
|
145801
145875
|
const release2 = () => removeIfMine(lockPath2);
|
|
145802
145876
|
try {
|
|
145803
|
-
|
|
145877
|
+
mkdirSync22(dirname27(lockPath2), { recursive: true, mode: 448 });
|
|
145804
145878
|
} catch {
|
|
145805
145879
|
return () => {
|
|
145806
145880
|
};
|
|
@@ -147081,10 +147155,10 @@ __export(preflight_exports, {
|
|
|
147081
147155
|
requireEnv: () => requireEnv
|
|
147082
147156
|
});
|
|
147083
147157
|
import { existsSync as existsSync43, readFileSync as readFileSync47 } from "node:fs";
|
|
147084
|
-
import { isAbsolute as
|
|
147158
|
+
import { isAbsolute as isAbsolute3, relative as relative10, resolve as resolve39 } from "node:path";
|
|
147085
147159
|
function isInsideRepo(p2) {
|
|
147086
|
-
const rel =
|
|
147087
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
147160
|
+
const rel = relative10(REPO_ROOT, resolve39(p2));
|
|
147161
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute3(rel);
|
|
147088
147162
|
}
|
|
147089
147163
|
function assertCredentialOutsideRepo(label3, p2) {
|
|
147090
147164
|
if (isInsideRepo(p2)) {
|
|
@@ -150690,21 +150764,21 @@ var init_Matcher = __esm({
|
|
|
150690
150764
|
* @returns {string}
|
|
150691
150765
|
*/
|
|
150692
150766
|
toString(separator, includeNamespace = true) {
|
|
150693
|
-
const
|
|
150694
|
-
const isDefault =
|
|
150767
|
+
const sep26 = separator || this.separator;
|
|
150768
|
+
const isDefault = sep26 === this.separator && includeNamespace === true;
|
|
150695
150769
|
if (isDefault) {
|
|
150696
150770
|
if (this._pathStringCache !== null) {
|
|
150697
150771
|
return this._pathStringCache;
|
|
150698
150772
|
}
|
|
150699
150773
|
const result = this.path.map(
|
|
150700
150774
|
(n2) => n2.namespace ? `${n2.namespace}:${n2.tag}` : n2.tag
|
|
150701
|
-
).join(
|
|
150775
|
+
).join(sep26);
|
|
150702
150776
|
this._pathStringCache = result;
|
|
150703
150777
|
return result;
|
|
150704
150778
|
}
|
|
150705
150779
|
return this.path.map(
|
|
150706
150780
|
(n2) => includeNamespace && n2.namespace ? `${n2.namespace}:${n2.tag}` : n2.tag
|
|
150707
|
-
).join(
|
|
150781
|
+
).join(sep26);
|
|
150708
150782
|
}
|
|
150709
150783
|
/**
|
|
150710
150784
|
* Get path as array of tag names.
|
|
@@ -151414,77 +151488,77 @@ var init_redos = __esm({
|
|
|
151414
151488
|
});
|
|
151415
151489
|
|
|
151416
151490
|
// ../../node_modules/is-unsafe/src/contexts/nosql.js
|
|
151417
|
-
var
|
|
151491
|
+
var sep14, NOSQL_PATTERNS, nosql_default;
|
|
151418
151492
|
var init_nosql = __esm({
|
|
151419
151493
|
"../../node_modules/is-unsafe/src/contexts/nosql.js"() {
|
|
151420
151494
|
init_define_HHP_CATALOG();
|
|
151421
|
-
|
|
151495
|
+
sep14 = `["'\\s]*:`;
|
|
151422
151496
|
NOSQL_PATTERNS = [
|
|
151423
151497
|
// ─── MongoDB $ operator injection ────────────────────────────────────────
|
|
151424
151498
|
{
|
|
151425
151499
|
id: "nosql-where-operator",
|
|
151426
151500
|
description: "$where \u2014 executes arbitrary JavaScript server-side in MongoDB",
|
|
151427
|
-
pattern: new RegExp(`\\$where${
|
|
151501
|
+
pattern: new RegExp(`\\$where${sep14}`, "i")
|
|
151428
151502
|
},
|
|
151429
151503
|
{
|
|
151430
151504
|
id: "nosql-ne-operator",
|
|
151431
151505
|
description: '$ne \u2014 "not equal" operator used to bypass equality checks',
|
|
151432
|
-
pattern: new RegExp(`\\$ne${
|
|
151506
|
+
pattern: new RegExp(`\\$ne${sep14}`, "i")
|
|
151433
151507
|
},
|
|
151434
151508
|
{
|
|
151435
151509
|
id: "nosql-gt-operator",
|
|
151436
151510
|
description: '$gt \u2014 "greater than" used to bypass password/value checks',
|
|
151437
|
-
pattern: new RegExp(`\\$gte?${
|
|
151511
|
+
pattern: new RegExp(`\\$gte?${sep14}`, "i")
|
|
151438
151512
|
},
|
|
151439
151513
|
{
|
|
151440
151514
|
id: "nosql-lt-operator",
|
|
151441
151515
|
description: '$lt / $lte \u2014 "less than" bypass variants',
|
|
151442
|
-
pattern: new RegExp(`\\$lte?${
|
|
151516
|
+
pattern: new RegExp(`\\$lte?${sep14}`, "i")
|
|
151443
151517
|
},
|
|
151444
151518
|
{
|
|
151445
151519
|
id: "nosql-regex-operator",
|
|
151446
151520
|
description: "$regex \u2014 can be used to extract data character by character (blind injection)",
|
|
151447
|
-
pattern: new RegExp(`\\$regex${
|
|
151521
|
+
pattern: new RegExp(`\\$regex${sep14}`, "i")
|
|
151448
151522
|
},
|
|
151449
151523
|
{
|
|
151450
151524
|
id: "nosql-or-operator",
|
|
151451
151525
|
description: "$or \u2014 logical OR; used to create always-true conditions",
|
|
151452
|
-
pattern: new RegExp(`\\$or${
|
|
151526
|
+
pattern: new RegExp(`\\$or${sep14}\\s*\\[`, "i")
|
|
151453
151527
|
},
|
|
151454
151528
|
{
|
|
151455
151529
|
id: "nosql-and-operator",
|
|
151456
151530
|
description: "$and \u2014 logical AND operator injection",
|
|
151457
|
-
pattern: new RegExp(`\\$and${
|
|
151531
|
+
pattern: new RegExp(`\\$and${sep14}\\s*\\[`, "i")
|
|
151458
151532
|
},
|
|
151459
151533
|
{
|
|
151460
151534
|
id: "nosql-nor-operator",
|
|
151461
151535
|
description: "$nor \u2014 logical NOR operator injection",
|
|
151462
|
-
pattern: new RegExp(`\\$nor${
|
|
151536
|
+
pattern: new RegExp(`\\$nor${sep14}\\s*\\[`, "i")
|
|
151463
151537
|
},
|
|
151464
151538
|
{
|
|
151465
151539
|
id: "nosql-exists-operator",
|
|
151466
151540
|
description: "$exists \u2014 can enumerate fields to determine schema",
|
|
151467
|
-
pattern: new RegExp(`\\$exists${
|
|
151541
|
+
pattern: new RegExp(`\\$exists${sep14}`, "i")
|
|
151468
151542
|
},
|
|
151469
151543
|
{
|
|
151470
151544
|
id: "nosql-in-operator",
|
|
151471
151545
|
description: "$in \u2014 matches any value in a list; can enumerate values",
|
|
151472
|
-
pattern: new RegExp(`\\$in${
|
|
151546
|
+
pattern: new RegExp(`\\$in${sep14}\\s*\\[`, "i")
|
|
151473
151547
|
},
|
|
151474
151548
|
{
|
|
151475
151549
|
id: "nosql-expr-operator",
|
|
151476
151550
|
description: "$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",
|
|
151477
|
-
pattern: new RegExp(`\\$expr${
|
|
151551
|
+
pattern: new RegExp(`\\$expr${sep14}`, "i")
|
|
151478
151552
|
},
|
|
151479
151553
|
{
|
|
151480
151554
|
id: "nosql-function-operator",
|
|
151481
151555
|
description: "$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",
|
|
151482
|
-
pattern: new RegExp(`\\$function${
|
|
151556
|
+
pattern: new RegExp(`\\$function${sep14}`, "i")
|
|
151483
151557
|
},
|
|
151484
151558
|
{
|
|
151485
151559
|
id: "nosql-accumulator-operator",
|
|
151486
151560
|
description: "$accumulator \u2014 custom aggregation with arbitrary JS execution",
|
|
151487
|
-
pattern: new RegExp(`\\$accumulator${
|
|
151561
|
+
pattern: new RegExp(`\\$accumulator${sep14}`, "i")
|
|
151488
151562
|
},
|
|
151489
151563
|
// ─── Prototype pollution ─────────────────────────────────────────────────
|
|
151490
151564
|
{
|
|
@@ -153915,7 +153989,7 @@ var init_customer_signing_inspect = __esm({
|
|
|
153915
153989
|
});
|
|
153916
153990
|
|
|
153917
153991
|
// src/push-onboarding.ts
|
|
153918
|
-
import { existsSync as existsSync44, mkdirSync as
|
|
153992
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync23, readFileSync as readFileSync48, statSync as statSync11, writeFileSync as writeFileSync16, chmodSync as chmodSync2 } from "node:fs";
|
|
153919
153993
|
import { basename as basename14, dirname as dirname28, join as join36, resolve as resolve40 } from "node:path";
|
|
153920
153994
|
function readJson4(path2) {
|
|
153921
153995
|
try {
|
|
@@ -154065,7 +154139,7 @@ function readPushOnboarding(dir) {
|
|
|
154065
154139
|
}
|
|
154066
154140
|
function writeFile(dir, file2) {
|
|
154067
154141
|
const path2 = join36(resolve40(dir), PUSH_ONBOARDING_PATH);
|
|
154068
|
-
|
|
154142
|
+
mkdirSync23(dirname28(path2), { recursive: true, mode: 448 });
|
|
154069
154143
|
writeFileSync16(path2, JSON.stringify(file2, null, 2) + "\n", { mode: 384 });
|
|
154070
154144
|
try {
|
|
154071
154145
|
chmodSync2(path2, 384);
|
|
@@ -154164,7 +154238,7 @@ __export(signing_inspect_exports, {
|
|
|
154164
154238
|
runSigningInspect: () => runSigningInspect
|
|
154165
154239
|
});
|
|
154166
154240
|
import { existsSync as existsSync45, readFileSync as readFileSync49, statSync as statSync12 } from "node:fs";
|
|
154167
|
-
import { isAbsolute as
|
|
154241
|
+
import { isAbsolute as isAbsolute4, resolve as resolve41 } from "node:path";
|
|
154168
154242
|
function fail5(io2, code, fields = {}) {
|
|
154169
154243
|
io2.error(JSON.stringify({ ok: false, code, ...fields }));
|
|
154170
154244
|
return code.endsWith("_required") || code.endsWith("_usage") ? 2 : 1;
|
|
@@ -154220,7 +154294,7 @@ async function runSigningInspect(pos, flags, io2, deps = {}) {
|
|
|
154220
154294
|
hint: "Pass --bundle-id --team-id and ASC key flags, or set ASC_KEY_PATH / ASC_KEY_ID / ASC_ISSUER_ID."
|
|
154221
154295
|
});
|
|
154222
154296
|
}
|
|
154223
|
-
const resolvedKey =
|
|
154297
|
+
const resolvedKey = isAbsolute4(keyFile) ? keyFile : resolve41(process.cwd(), keyFile);
|
|
154224
154298
|
try {
|
|
154225
154299
|
assertCredentialOutsideRepo("asc-key-file", resolvedKey);
|
|
154226
154300
|
} catch (error) {
|
|
@@ -154245,8 +154319,8 @@ async function runSigningInspect(pos, flags, io2, deps = {}) {
|
|
|
154245
154319
|
error: "local asset check needs --cert-file, --cert-password, and --profile-file together"
|
|
154246
154320
|
});
|
|
154247
154321
|
}
|
|
154248
|
-
const certPath =
|
|
154249
|
-
const profilePath2 =
|
|
154322
|
+
const certPath = isAbsolute4(certFile) ? certFile : resolve41(process.cwd(), certFile);
|
|
154323
|
+
const profilePath2 = isAbsolute4(profileFile) ? profileFile : resolve41(process.cwd(), profileFile);
|
|
154250
154324
|
try {
|
|
154251
154325
|
assertCredentialOutsideRepo("cert-file", certPath);
|
|
154252
154326
|
assertCredentialOutsideRepo("profile-file", profilePath2);
|
|
@@ -154301,12 +154375,12 @@ __export(content_manifest_exports, {
|
|
|
154301
154375
|
writeContentManifest: () => writeContentManifest
|
|
154302
154376
|
});
|
|
154303
154377
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
154304
|
-
import { constants as constants2, lstatSync as
|
|
154378
|
+
import { constants as constants2, lstatSync as lstatSync14, readFileSync as readFileSync50, realpathSync as realpathSync7, writeFileSync as writeFileSync17, renameSync as renameSync9, openSync as openSync3, closeSync as closeSync3, unlinkSync as unlinkSync2 } from "node:fs";
|
|
154305
154379
|
import { join as join37 } from "node:path";
|
|
154306
154380
|
function contentManifestPath(dir) {
|
|
154307
154381
|
const path2 = join37(realpathSync7(dir), "himalaya.content.json");
|
|
154308
154382
|
try {
|
|
154309
|
-
if (
|
|
154383
|
+
if (lstatSync14(path2).isSymbolicLink()) throw new Error("himalaya.content.json is a symlink \u2014 refusing to read or write through it");
|
|
154310
154384
|
} catch (error) {
|
|
154311
154385
|
if (error.code !== "ENOENT") throw error;
|
|
154312
154386
|
}
|
|
@@ -154823,7 +154897,7 @@ __export(template_trim_exports, {
|
|
|
154823
154897
|
runTemplateTrim: () => runTemplateTrim,
|
|
154824
154898
|
trimCapabilities: () => trimCapabilities
|
|
154825
154899
|
});
|
|
154826
|
-
import { cpSync, existsSync as existsSync46, mkdirSync as
|
|
154900
|
+
import { cpSync, existsSync as existsSync46, mkdirSync as mkdirSync24, readdirSync as readdirSync25, readFileSync as readFileSync51, renameSync as renameSync10, rmSync as rmSync14, statSync as statSync13, writeFileSync as writeFileSync18 } from "node:fs";
|
|
154827
154901
|
import { dirname as dirname29, join as join38 } from "node:path";
|
|
154828
154902
|
import ts5 from "typescript";
|
|
154829
154903
|
function routeMatcher(pattern) {
|
|
@@ -155855,9 +155929,9 @@ async function runTemplateTrim(req, deps) {
|
|
|
155855
155929
|
return { code: 1, result: { ok: false, error: `${error} (${message2}); every file was restored`, rolledBack: true, ...base(validate6) } };
|
|
155856
155930
|
};
|
|
155857
155931
|
try {
|
|
155858
|
-
|
|
155932
|
+
mkdirSync24(join38(backup, "dev"), { recursive: true });
|
|
155859
155933
|
for (const [path2, rel] of originals) cpSync(path2, join38(backup, rel));
|
|
155860
|
-
if (plan.removedWorkers.length)
|
|
155934
|
+
if (plan.removedWorkers.length) mkdirSync24(join38(backup, "tier5-src"), { recursive: true });
|
|
155861
155935
|
} catch (e2) {
|
|
155862
155936
|
dropBackup();
|
|
155863
155937
|
return { code: 1, result: { ok: false, error: `could not back up the app before trimming it (${e2.message}); nothing was changed`, rolledBack: true, ...base() } };
|
|
@@ -156155,7 +156229,7 @@ __export(template_adopt_exports, {
|
|
|
156155
156229
|
workerReach: () => workerReach,
|
|
156156
156230
|
writeInventory: () => writeInventory
|
|
156157
156231
|
});
|
|
156158
|
-
import { existsSync as existsSync47, lstatSync as
|
|
156232
|
+
import { existsSync as existsSync47, lstatSync as lstatSync15, mkdirSync as mkdirSync25, readdirSync as readdirSync26, readFileSync as readFileSync52, renameSync as renameSync11, statSync as statSync14, writeFileSync as writeFileSync19 } from "node:fs";
|
|
156159
156233
|
import { dirname as dirname30, join as join39, posix as posix2 } from "node:path";
|
|
156160
156234
|
import ts6 from "typescript";
|
|
156161
156235
|
function readAppSources(dir) {
|
|
@@ -156499,9 +156573,9 @@ function inventorySummary(inv) {
|
|
|
156499
156573
|
function writeNoFollow(dir, rel, body) {
|
|
156500
156574
|
const p2 = join39(dir, rel);
|
|
156501
156575
|
const parent = dirname30(p2);
|
|
156502
|
-
if (existsSync47(parent) &&
|
|
156503
|
-
|
|
156504
|
-
if (existsSync47(p2) &&
|
|
156576
|
+
if (existsSync47(parent) && lstatSync15(parent).isSymbolicLink()) throw new TrimRefusal(`${dirname30(rel)} is a symlink \u2014 refusing to write through it`);
|
|
156577
|
+
mkdirSync25(parent, { recursive: true });
|
|
156578
|
+
if (existsSync47(p2) && lstatSync15(p2).isSymbolicLink()) throw new TrimRefusal(`${rel} is a symlink \u2014 refusing to write through it`);
|
|
156505
156579
|
const tmp = `${p2}.${process.pid}.${Date.now()}.tmp`;
|
|
156506
156580
|
writeFileSync19(tmp, body, { flag: "wx" });
|
|
156507
156581
|
renameSync11(tmp, p2);
|
|
@@ -156555,7 +156629,7 @@ function replaceScreen(dir, id, entry) {
|
|
|
156555
156629
|
}
|
|
156556
156630
|
for (const rel of ["dev", "dev/index.ts"]) {
|
|
156557
156631
|
const p2 = join39(dir, rel);
|
|
156558
|
-
if (existsSync47(p2) &&
|
|
156632
|
+
if (existsSync47(p2) && lstatSync15(p2).isSymbolicLink()) throw new TrimRefusal(`${rel} is a symlink \u2014 refusing to write through it (dev/index.ts left unchanged)`);
|
|
156559
156633
|
}
|
|
156560
156634
|
writeNoFollow(dir, "dev/index.ts", next);
|
|
156561
156635
|
return { ok: true, screen: id, bytes: body.length };
|
|
@@ -156619,7 +156693,7 @@ function addScreen(dir, id, entry, opts = {}) {
|
|
|
156619
156693
|
}
|
|
156620
156694
|
for (const rel of ["dev", "dev/index.ts", ...config !== src.config ? ["config.ts"] : [], ...contentWithView !== void 0 ? ["himalaya.content.json"] : []]) {
|
|
156621
156695
|
const p2 = join39(dir, rel);
|
|
156622
|
-
if (existsSync47(p2) &&
|
|
156696
|
+
if (existsSync47(p2) && lstatSync15(p2).isSymbolicLink()) throw new TrimRefusal(`${rel} is a symlink \u2014 refusing to write through it (nothing written)`);
|
|
156623
156697
|
}
|
|
156624
156698
|
writeNoFollow(dir, "dev/index.ts", dev);
|
|
156625
156699
|
if (config !== src.config) writeNoFollow(dir, "config.ts", config);
|
|
@@ -156918,7 +156992,7 @@ var init_hosted_owner = __esm({
|
|
|
156918
156992
|
});
|
|
156919
156993
|
|
|
156920
156994
|
// src/config-source-edit.ts
|
|
156921
|
-
import { lstatSync as
|
|
156995
|
+
import { lstatSync as lstatSync16 } from "node:fs";
|
|
156922
156996
|
import { join as join40 } from "node:path";
|
|
156923
156997
|
import ts7 from "typescript";
|
|
156924
156998
|
function defineAppLiteral(file2) {
|
|
@@ -157024,7 +157098,7 @@ function backUpConfig(dir, folder, fileName, original) {
|
|
|
157024
157098
|
}
|
|
157025
157099
|
function isSymlink2(path2) {
|
|
157026
157100
|
try {
|
|
157027
|
-
return
|
|
157101
|
+
return lstatSync16(path2).isSymbolicLink();
|
|
157028
157102
|
} catch {
|
|
157029
157103
|
return false;
|
|
157030
157104
|
}
|
|
@@ -157511,7 +157585,7 @@ __export(pack_exports, {
|
|
|
157511
157585
|
});
|
|
157512
157586
|
import { createHash as createHash24 } from "node:crypto";
|
|
157513
157587
|
import { deflateRawSync, inflateRawSync } from "node:zlib";
|
|
157514
|
-
import { existsSync as existsSync48, mkdirSync as
|
|
157588
|
+
import { existsSync as existsSync48, mkdirSync as mkdirSync26, readFileSync as readFileSync54, readdirSync as readdirSync27, rmSync as rmSync15, statSync as statSync15, writeFileSync as writeFileSync20 } from "node:fs";
|
|
157515
157589
|
import { dirname as dirname31, join as join41, resolve as resolve43 } from "node:path";
|
|
157516
157590
|
function writeZip(entries) {
|
|
157517
157591
|
const sorted2 = entries.slice().sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
|
|
@@ -157690,7 +157764,7 @@ function packRelease(releaseRoot, app, out2, opts = {}) {
|
|
|
157690
157764
|
const buf = writeZip(all);
|
|
157691
157765
|
const isDir2 = existsSync48(out2) && statSync15(out2).isDirectory();
|
|
157692
157766
|
const outFile = isDir2 ? join41(resolve43(out2), packageFileName(app, header.releaseId)) : resolve43(out2);
|
|
157693
|
-
|
|
157767
|
+
mkdirSync26(dirname31(outFile), { recursive: true });
|
|
157694
157768
|
writeFileSync20(outFile, buf);
|
|
157695
157769
|
return { app, releaseId: header.releaseId, header, out: outFile, bytes: buf.length, entryCount: all.length, skipped };
|
|
157696
157770
|
}
|
|
@@ -157734,7 +157808,7 @@ function packReleaseToDir(releaseRoot, app, outDir, opts = {}) {
|
|
|
157734
157808
|
let bytes2 = 0;
|
|
157735
157809
|
for (const entry of all) {
|
|
157736
157810
|
const target = join41(dest, entry.path);
|
|
157737
|
-
|
|
157811
|
+
mkdirSync26(dirname31(target), { recursive: true });
|
|
157738
157812
|
writeFileSync20(target, entry.bytes);
|
|
157739
157813
|
bytes2 += entry.bytes.length;
|
|
157740
157814
|
}
|
|
@@ -157816,7 +157890,7 @@ function unpackTo(buf, dest, appFallback) {
|
|
|
157816
157890
|
rmSync15(appDir3, { recursive: true, force: true });
|
|
157817
157891
|
for (const [rel, bytes2] of entries) {
|
|
157818
157892
|
const target = join41(appDir3, rel);
|
|
157819
|
-
|
|
157893
|
+
mkdirSync26(dirname31(target), { recursive: true });
|
|
157820
157894
|
writeFileSync20(target, bytes2);
|
|
157821
157895
|
}
|
|
157822
157896
|
return { root, appDir: appDir3, app };
|
|
@@ -157856,8 +157930,8 @@ __export(app_source_exports, {
|
|
|
157856
157930
|
zipAppSource: () => zipAppSource
|
|
157857
157931
|
});
|
|
157858
157932
|
import { createHash as createHash25 } from "node:crypto";
|
|
157859
|
-
import { readdirSync as readdirSync28, lstatSync as
|
|
157860
|
-
import { join as join42, resolve as resolve44, sep as
|
|
157933
|
+
import { readdirSync as readdirSync28, lstatSync as lstatSync17, readFileSync as readFileSync55, mkdirSync as mkdirSync27, writeFileSync as writeFileSync21, existsSync as existsSync49, rmSync as rmSync16, rmdirSync as rmdirSync3, unlinkSync as unlinkSync3 } from "node:fs";
|
|
157934
|
+
import { join as join42, resolve as resolve44, sep as sep15 } from "node:path";
|
|
157861
157935
|
import { createRequire as createRequire4 } from "node:module";
|
|
157862
157936
|
import { deflateRawSync as deflateRawSync2 } from "node:zlib";
|
|
157863
157937
|
function walkSourceTree(dir, file2, skip, enter = () => {
|
|
@@ -157866,7 +157940,7 @@ function walkSourceTree(dir, file2, skip, enter = () => {
|
|
|
157866
157940
|
enter(relDir);
|
|
157867
157941
|
for (const name of readdirSync28(join42(dir, relDir))) {
|
|
157868
157942
|
const rel = relDir ? join42(relDir, name) : name;
|
|
157869
|
-
const st2 =
|
|
157943
|
+
const st2 = lstatSync17(join42(dir, rel));
|
|
157870
157944
|
if (st2.isSymbolicLink()) {
|
|
157871
157945
|
skip(rel);
|
|
157872
157946
|
continue;
|
|
@@ -157880,7 +157954,7 @@ function walkSourceTree(dir, file2, skip, enter = () => {
|
|
|
157880
157954
|
skip(rel);
|
|
157881
157955
|
continue;
|
|
157882
157956
|
}
|
|
157883
|
-
file2(rel.split(
|
|
157957
|
+
file2(rel.split(sep15).join("/"), rel);
|
|
157884
157958
|
}
|
|
157885
157959
|
};
|
|
157886
157960
|
walk2("");
|
|
@@ -157940,14 +158014,14 @@ function renderInputRootDirs(dir) {
|
|
|
157940
158014
|
}
|
|
157941
158015
|
function newestSourceChangeMs(dir) {
|
|
157942
158016
|
const roots2 = renderInputRootDirs(dir);
|
|
157943
|
-
const inRead = (hostRel) => !roots2 || roots2.has(hostRel.split(
|
|
157944
|
-
const counts = (hostRel) => !hostRel.includes(
|
|
158017
|
+
const inRead = (hostRel) => !roots2 || roots2.has(hostRel.split(sep15)[0]);
|
|
158018
|
+
const counts = (hostRel) => !hostRel.includes(sep15) || inRead(hostRel);
|
|
157945
158019
|
let newest = 0;
|
|
157946
158020
|
walkSourceTree(
|
|
157947
158021
|
dir,
|
|
157948
158022
|
(archivePath, hostRel) => {
|
|
157949
158023
|
if (/\.md$/i.test(archivePath) || !counts(hostRel)) return;
|
|
157950
|
-
const m2 =
|
|
158024
|
+
const m2 = lstatSync17(join42(dir, hostRel)).mtimeMs;
|
|
157951
158025
|
if (m2 > newest) newest = m2;
|
|
157952
158026
|
},
|
|
157953
158027
|
() => {
|
|
@@ -157959,7 +158033,7 @@ function newestSourceChangeMs(dir) {
|
|
|
157959
158033
|
// Nor a root directory the render does not read: creating a file in `_qa/` moves `_qa/`.
|
|
157960
158034
|
(hostRel) => {
|
|
157961
158035
|
if (hostRel === "" || !inRead(hostRel)) return;
|
|
157962
|
-
const m2 =
|
|
158036
|
+
const m2 = lstatSync17(join42(dir, hostRel)).mtimeMs;
|
|
157963
158037
|
if (m2 > newest) newest = m2;
|
|
157964
158038
|
}
|
|
157965
158039
|
);
|
|
@@ -158007,7 +158081,7 @@ function readAppSource(zip) {
|
|
|
158007
158081
|
}
|
|
158008
158082
|
function pathKind(p2) {
|
|
158009
158083
|
try {
|
|
158010
|
-
return
|
|
158084
|
+
return lstatSync17(p2);
|
|
158011
158085
|
} catch {
|
|
158012
158086
|
return null;
|
|
158013
158087
|
}
|
|
@@ -158019,7 +158093,7 @@ function writeAppSource(entries, destDir) {
|
|
|
158019
158093
|
`refusing to restore into ${root}: the destination itself is a symlink, so every file would be written outside it. Remove it, or pass --out/--name somewhere else.`
|
|
158020
158094
|
);
|
|
158021
158095
|
}
|
|
158022
|
-
|
|
158096
|
+
mkdirSync27(root, { recursive: true });
|
|
158023
158097
|
const written = [];
|
|
158024
158098
|
for (const entry of entries) {
|
|
158025
158099
|
if (isDeniedSourcePath(entry.path)) continue;
|
|
@@ -158030,7 +158104,7 @@ function writeAppSource(entries, destDir) {
|
|
|
158030
158104
|
const kind = pathKind(dir);
|
|
158031
158105
|
if (kind?.isSymbolicLink()) unlinkSync3(dir);
|
|
158032
158106
|
else if (kind) continue;
|
|
158033
|
-
|
|
158107
|
+
mkdirSync27(dir);
|
|
158034
158108
|
}
|
|
158035
158109
|
const target = join42(root, ...segments);
|
|
158036
158110
|
if (pathKind(target)?.isSymbolicLink()) unlinkSync3(target);
|
|
@@ -158103,8 +158177,8 @@ function pruneEmptyDirs(root, rel, needed, removed) {
|
|
|
158103
158177
|
let empty2 = true;
|
|
158104
158178
|
for (const name of readdirSync28(rel ? join42(root, rel) : root)) {
|
|
158105
158179
|
const childRel = rel ? join42(rel, name) : name;
|
|
158106
|
-
const posix5 = childRel.split(
|
|
158107
|
-
const kind =
|
|
158180
|
+
const posix5 = childRel.split(sep15).join("/");
|
|
158181
|
+
const kind = lstatSync17(join42(root, childRel));
|
|
158108
158182
|
if (kind.isSymbolicLink() || !kind.isDirectory() || isDeniedSourceDir(name, rel)) {
|
|
158109
158183
|
empty2 = false;
|
|
158110
158184
|
continue;
|
|
@@ -158186,9 +158260,9 @@ __export(run_watch_exports, {
|
|
|
158186
158260
|
watchedContentDir: () => watchedContentDir,
|
|
158187
158261
|
writeRunRecord: () => writeRunRecord
|
|
158188
158262
|
});
|
|
158189
|
-
import { closeSync as closeSync4, constants as constants3, existsSync as existsSync50, fstatSync, lstatSync as
|
|
158263
|
+
import { closeSync as closeSync4, constants as constants3, existsSync as existsSync50, fstatSync, lstatSync as lstatSync18, statSync as statSync16, readdirSync as readdirSync29, mkdirSync as mkdirSync28, openSync as openSync4, readFileSync as readFileSync56, realpathSync as realpathSync8, renameSync as renameSync12, rmSync as rmSync17, writeFileSync as writeFileSync22, watch as fsWatch } from "node:fs";
|
|
158190
158264
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
158191
|
-
import { extname as extname4, join as join43, relative as
|
|
158265
|
+
import { extname as extname4, join as join43, relative as relative11, resolve as resolve45, sep as sep16 } from "node:path";
|
|
158192
158266
|
function diffReleases(prev, next) {
|
|
158193
158267
|
const bundles = Object.keys(next.bundles).filter((b2) => prev.bundles[b2]?.sha256 !== next.bundles[b2].sha256).sort();
|
|
158194
158268
|
const changedBundles = new Set(bundles);
|
|
@@ -158216,7 +158290,7 @@ function reloadEvents(d2) {
|
|
|
158216
158290
|
function hhpRasterDir(dir) {
|
|
158217
158291
|
const assets = findAssetsDir(dir);
|
|
158218
158292
|
if (!assets) return null;
|
|
158219
|
-
const rel =
|
|
158293
|
+
const rel = relative11(dir, assets).split(sep16).join("/");
|
|
158220
158294
|
return rel ? `${rel}/hhp-raster` : "hhp-raster";
|
|
158221
158295
|
}
|
|
158222
158296
|
function ignoredChange(relPath, isDirectory = () => false, rasterDir = "assets/hhp-raster") {
|
|
@@ -158266,7 +158340,7 @@ function watchContent(dir, onChange, opts = {}) {
|
|
|
158266
158340
|
for (const name of entries) {
|
|
158267
158341
|
const path2 = join43(directory, String(name)), rel = prefix ? `${prefix}/${name}` : String(name);
|
|
158268
158342
|
try {
|
|
158269
|
-
const stat2 =
|
|
158343
|
+
const stat2 = lstatSync18(path2);
|
|
158270
158344
|
if (stat2.isSymbolicLink() || ignoredChange(rel, () => stat2.isDirectory(), rasterDir)) continue;
|
|
158271
158345
|
if (stat2.isDirectory()) visit(path2, rel);
|
|
158272
158346
|
else if (stat2.isFile()) files.set(rel, `${stat2.mtimeMs}:${stat2.ctimeMs}:${stat2.size}`);
|
|
@@ -158364,11 +158438,11 @@ function serialize(task) {
|
|
|
158364
158438
|
function himiDir(dir) {
|
|
158365
158439
|
const root = join43(dir, ".himi");
|
|
158366
158440
|
try {
|
|
158367
|
-
return
|
|
158441
|
+
return lstatSync18(root).isDirectory() ? root : null;
|
|
158368
158442
|
} catch (e2) {
|
|
158369
158443
|
if (e2.code !== "ENOENT") return null;
|
|
158370
|
-
|
|
158371
|
-
return
|
|
158444
|
+
mkdirSync28(root, { recursive: true });
|
|
158445
|
+
return lstatSync18(root).isDirectory() ? root : null;
|
|
158372
158446
|
}
|
|
158373
158447
|
}
|
|
158374
158448
|
function writeRunRecord(dir, record3) {
|
|
@@ -158388,7 +158462,7 @@ function writeRunRecord(dir, record3) {
|
|
|
158388
158462
|
function removeRunRecord(dir, owner) {
|
|
158389
158463
|
const root = join43(dir, ".himi");
|
|
158390
158464
|
try {
|
|
158391
|
-
if (!
|
|
158465
|
+
if (!lstatSync18(root).isDirectory()) return;
|
|
158392
158466
|
} catch {
|
|
158393
158467
|
return;
|
|
158394
158468
|
}
|
|
@@ -158406,7 +158480,7 @@ function removeRunRecord(dir, owner) {
|
|
|
158406
158480
|
function removeInitWatchRecord(dir, owner) {
|
|
158407
158481
|
const root = join43(dir, ".himi");
|
|
158408
158482
|
try {
|
|
158409
|
-
if (!
|
|
158483
|
+
if (!lstatSync18(root).isDirectory()) return;
|
|
158410
158484
|
} catch {
|
|
158411
158485
|
return;
|
|
158412
158486
|
}
|
|
@@ -158443,16 +158517,16 @@ function boardFile(dir, pathname) {
|
|
|
158443
158517
|
}
|
|
158444
158518
|
function readConfined(root, rel) {
|
|
158445
158519
|
try {
|
|
158446
|
-
if (!
|
|
158447
|
-
const parts = rel.split(
|
|
158520
|
+
if (!lstatSync18(root).isDirectory()) return null;
|
|
158521
|
+
const parts = rel.split(sep16);
|
|
158448
158522
|
let at2 = root;
|
|
158449
158523
|
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
158450
158524
|
at2 = join43(at2, parts[i2]);
|
|
158451
|
-
const st2 =
|
|
158525
|
+
const st2 = lstatSync18(at2);
|
|
158452
158526
|
if (st2.isSymbolicLink() || !(i2 === parts.length - 1 ? st2.isFile() : st2.isDirectory())) return null;
|
|
158453
158527
|
}
|
|
158454
158528
|
const canonicalRoot = realpathSync8(root);
|
|
158455
|
-
if (!realpathSync8(at2).startsWith(canonicalRoot +
|
|
158529
|
+
if (!realpathSync8(at2).startsWith(canonicalRoot + sep16)) return null;
|
|
158456
158530
|
const fd = openSync4(at2, constants3.O_RDONLY | (constants3.O_NOFOLLOW ?? 0));
|
|
158457
158531
|
try {
|
|
158458
158532
|
if (!fstatSync(fd).isFile()) return null;
|
|
@@ -158516,7 +158590,7 @@ __export(screen_state_exports, {
|
|
|
158516
158590
|
withHomeCaveat: () => withHomeCaveat
|
|
158517
158591
|
});
|
|
158518
158592
|
import { createHash as createHash26 } from "node:crypto";
|
|
158519
|
-
import { lstatSync as
|
|
158593
|
+
import { lstatSync as lstatSync19, readFileSync as readFileSync57 } from "node:fs";
|
|
158520
158594
|
import { join as join44 } from "node:path";
|
|
158521
158595
|
function quotableLine(text13) {
|
|
158522
158596
|
if (!text13) return void 0;
|
|
@@ -158575,7 +158649,7 @@ function screenStateOf(services, html, opts = {}) {
|
|
|
158575
158649
|
function readRecord(dir) {
|
|
158576
158650
|
const file2 = join44(dir, SHOT_STATES_FILE);
|
|
158577
158651
|
try {
|
|
158578
|
-
if (!
|
|
158652
|
+
if (!lstatSync19(file2).isFile()) return {};
|
|
158579
158653
|
const r3 = JSON.parse(readFileSync57(file2, "utf8"));
|
|
158580
158654
|
return r3.v === 1 && r3.shots && typeof r3.shots === "object" ? r3.shots : {};
|
|
158581
158655
|
} catch {
|
|
@@ -158652,7 +158726,7 @@ __export(studio_reel_exports, {
|
|
|
158652
158726
|
utcDay: () => utcDay
|
|
158653
158727
|
});
|
|
158654
158728
|
import { createHash as createHash27 } from "node:crypto";
|
|
158655
|
-
import { lstatSync as
|
|
158729
|
+
import { lstatSync as lstatSync20, readFileSync as readFileSync58 } from "node:fs";
|
|
158656
158730
|
import { basename as basename16, join as join45 } from "node:path";
|
|
158657
158731
|
function loadMemory2(dir) {
|
|
158658
158732
|
const m2 = readJson5(join45(dir, ".himi", "studio", "memory.json"));
|
|
@@ -158737,7 +158811,7 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
|
|
|
158737
158811
|
if (!HISTORY_NAME.test(f2)) return null;
|
|
158738
158812
|
try {
|
|
158739
158813
|
const path2 = join45(dir, HISTORY_DIR, f2);
|
|
158740
|
-
const st2 =
|
|
158814
|
+
const st2 = lstatSync20(path2);
|
|
158741
158815
|
if (!st2.isFile() || st2.nlink !== 1) return null;
|
|
158742
158816
|
const bytes2 = readFileSync58(path2);
|
|
158743
158817
|
return createHash27("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
|
|
@@ -158987,25 +159061,25 @@ __export(milestones_exports, {
|
|
|
158987
159061
|
});
|
|
158988
159062
|
import { createHash as createHash28, randomUUID as randomUUID10 } from "node:crypto";
|
|
158989
159063
|
import { spawn as spawn4 } from "node:child_process";
|
|
158990
|
-
import { closeSync as closeSync5, existsSync as existsSync51, lstatSync as
|
|
159064
|
+
import { closeSync as closeSync5, existsSync as existsSync51, lstatSync as lstatSync21, readFileSync as readFileSync60, statSync as statSync17 } from "node:fs";
|
|
158991
159065
|
import { createServer as createServer3 } from "node:net";
|
|
158992
|
-
import { basename as basename17, dirname as dirname33, isAbsolute as
|
|
159066
|
+
import { basename as basename17, dirname as dirname33, isAbsolute as isAbsolute5, join as join48, relative as relative12, resolve as resolve46, sep as sep17 } from "node:path";
|
|
158993
159067
|
function homeShotPath(dir, home) {
|
|
158994
159068
|
const root = resolve46(dir);
|
|
158995
159069
|
const base = resolve46(root, ".himi", "shots");
|
|
158996
159070
|
const shot = resolve46(base, `${home}.png`);
|
|
158997
|
-
if (!shot.startsWith(base +
|
|
158998
|
-
for (let p2 = shot; p2 !== root && p2.startsWith(root +
|
|
159071
|
+
if (!shot.startsWith(base + sep17)) return null;
|
|
159072
|
+
for (let p2 = shot; p2 !== root && p2.startsWith(root + sep17); p2 = dirname33(p2)) {
|
|
158999
159073
|
try {
|
|
159000
|
-
if (
|
|
159074
|
+
if (lstatSync21(p2).isSymbolicLink()) return null;
|
|
159001
159075
|
} catch {
|
|
159002
159076
|
}
|
|
159003
159077
|
}
|
|
159004
159078
|
return shot;
|
|
159005
159079
|
}
|
|
159006
159080
|
function displayPath(p2, cwd = process.cwd()) {
|
|
159007
|
-
const rel =
|
|
159008
|
-
return rel && !rel.startsWith("..") && !
|
|
159081
|
+
const rel = relative12(cwd, p2);
|
|
159082
|
+
return rel && !rel.startsWith("..") && !isAbsolute5(rel) ? rel : p2;
|
|
159009
159083
|
}
|
|
159010
159084
|
function progressCommand(opts) {
|
|
159011
159085
|
return `himi progress "<${opts.what}>"${opts.step ? ` --step ${opts.step}` : ""}${opts.image ? ` --image ${shellQuote(opts.image)}` : ""}${contentArg(opts.content)}`;
|
|
@@ -159145,8 +159219,8 @@ async function openBoardForSession(dir, cwd = process.cwd()) {
|
|
|
159145
159219
|
try {
|
|
159146
159220
|
const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
159147
159221
|
const { page, url } = openStudio2(dir);
|
|
159148
|
-
const rel =
|
|
159149
|
-
return { page: rel && !rel.startsWith("..") && !
|
|
159222
|
+
const rel = relative12(cwd, page);
|
|
159223
|
+
return { page: rel && !rel.startsWith("..") && !isAbsolute5(rel) ? rel : page, url, opened: false };
|
|
159150
159224
|
} catch (e2) {
|
|
159151
159225
|
return { opened: false, error: `the build board was not created: ${e2.message} \u2014 \`himi studio --no-open\` in the app retries it` };
|
|
159152
159226
|
}
|
|
@@ -159332,7 +159406,7 @@ function rememberDraft(dir, releaseId, m2) {
|
|
|
159332
159406
|
function lastDraft(dir) {
|
|
159333
159407
|
try {
|
|
159334
159408
|
const file2 = join48(dir, LAST_DRAFT_FILE);
|
|
159335
|
-
if (!
|
|
159409
|
+
if (!lstatSync21(file2).isFile()) return null;
|
|
159336
159410
|
const r3 = JSON.parse(readFileSync60(file2, "utf8"));
|
|
159337
159411
|
const m2 = r3.manifest;
|
|
159338
159412
|
if (r3.v !== 1 || typeof r3.releaseId !== "string" || !m2 || typeof m2.screens !== "object" || !m2.screens || typeof m2.bundles !== "object" || !m2.bundles) return null;
|
|
@@ -159394,7 +159468,7 @@ function recordInitSource(dir, opts = {}) {
|
|
|
159394
159468
|
function readInitSource(dir) {
|
|
159395
159469
|
const file2 = join48(dir, INIT_SOURCE_FILE);
|
|
159396
159470
|
try {
|
|
159397
|
-
if (!
|
|
159471
|
+
if (!lstatSync21(file2).isFile()) return null;
|
|
159398
159472
|
const r3 = JSON.parse(readFileSync60(file2, "utf8"));
|
|
159399
159473
|
if (r3.v !== 1 || typeof r3.fingerprint !== "string" || !/^[0-9a-f]{64}$/.test(r3.fingerprint) || typeof r3.newestMs !== "number") return null;
|
|
159400
159474
|
return {
|
|
@@ -159469,7 +159543,7 @@ function contentHomePictures(dir, home) {
|
|
|
159469
159543
|
if (r3.state.state !== "content") continue;
|
|
159470
159544
|
for (const file2 of [shot, hist && join48(hist, `${r3.sha256}.png`)]) {
|
|
159471
159545
|
try {
|
|
159472
|
-
if (!file2 || !
|
|
159546
|
+
if (!file2 || !lstatSync21(file2).isFile() || sha256Of2(file2) !== r3.sha256) continue;
|
|
159473
159547
|
} catch {
|
|
159474
159548
|
continue;
|
|
159475
159549
|
}
|
|
@@ -159482,7 +159556,7 @@ function contentHomePictures(dir, home) {
|
|
|
159482
159556
|
function readInitWatch(dir) {
|
|
159483
159557
|
const file2 = join48(dir, INIT_WATCH_FILE);
|
|
159484
159558
|
try {
|
|
159485
|
-
if (!
|
|
159559
|
+
if (!lstatSync21(file2).isFile()) return null;
|
|
159486
159560
|
const r3 = JSON.parse(readFileSync60(file2, "utf8"));
|
|
159487
159561
|
if (r3.v !== 1 || typeof r3.pid !== "number" || !Number.isInteger(r3.pid) || r3.pid < 1) return null;
|
|
159488
159562
|
if (typeof r3.url !== "string" || !/^http:\/\/127\.0\.0\.1:\d+\//.test(r3.url) || typeof r3.board !== "string" || typeof r3.log !== "string" || typeof r3.startedAt !== "string") return null;
|
|
@@ -159515,7 +159589,7 @@ function watchReminder(dir, opts = {}) {
|
|
|
159515
159589
|
const file2 = join48(dir, REMINDERS_FILE);
|
|
159516
159590
|
let last = Number.NaN;
|
|
159517
159591
|
try {
|
|
159518
|
-
if (
|
|
159592
|
+
if (lstatSync21(file2).isFile()) last = Date.parse(JSON.parse(readFileSync60(file2, "utf8")).watch ?? "");
|
|
159519
159593
|
} catch {
|
|
159520
159594
|
}
|
|
159521
159595
|
if (Number.isFinite(last) && now - last >= 0 && now - last < WATCH_REMINDER_EVERY_MS) return void 0;
|
|
@@ -159638,7 +159712,7 @@ function afterHandoverPostcard(dir, opts = {}) {
|
|
|
159638
159712
|
const file2 = join48(dir, ".himi", "making-of.html");
|
|
159639
159713
|
let fresh = false;
|
|
159640
159714
|
try {
|
|
159641
|
-
const st2 =
|
|
159715
|
+
const st2 = lstatSync21(file2);
|
|
159642
159716
|
fresh = st2.isFile() && !st2.isSymbolicLink() && st2.mtimeMs >= statSync17(join48(dir, ".himi", "progress.jsonl")).mtimeMs;
|
|
159643
159717
|
} catch {
|
|
159644
159718
|
fresh = false;
|
|
@@ -163256,7 +163330,7 @@ __export(gen_native_config_exports, {
|
|
|
163256
163330
|
xmlAttr: () => xmlAttr2,
|
|
163257
163331
|
yamlScalar: () => yamlScalar
|
|
163258
163332
|
});
|
|
163259
|
-
import { existsSync as existsSync61, mkdirSync as
|
|
163333
|
+
import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync71, readdirSync as readdirSync33, rmSync as rmSync18, statSync as statSync19, writeFileSync as writeFileSync25 } from "node:fs";
|
|
163260
163334
|
import { dirname as dirname36, join as join59 } from "node:path";
|
|
163261
163335
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
163262
163336
|
function withoutComments(src) {
|
|
@@ -163778,7 +163852,7 @@ function applyWholeFile(path2, content, check) {
|
|
|
163778
163852
|
const current = existsSync61(path2) ? readFileSync71(path2, "utf8") : null;
|
|
163779
163853
|
if (current === content) return { path: path2, outcome: "unchanged" };
|
|
163780
163854
|
if (check) return { path: path2, outcome: "drift" };
|
|
163781
|
-
|
|
163855
|
+
mkdirSync29(dirname36(path2), { recursive: true });
|
|
163782
163856
|
writeFileSync25(path2, content);
|
|
163783
163857
|
return { path: path2, outcome: "written" };
|
|
163784
163858
|
}
|
|
@@ -164179,7 +164253,7 @@ __export(capabilities_exports, {
|
|
|
164179
164253
|
shellSupport: () => shellSupport,
|
|
164180
164254
|
writeLastDist: () => writeLastDist
|
|
164181
164255
|
});
|
|
164182
|
-
import { existsSync as existsSync62, lstatSync as
|
|
164256
|
+
import { existsSync as existsSync62, lstatSync as lstatSync22, readFileSync as readFileSync72 } from "node:fs";
|
|
164183
164257
|
import { join as join60 } from "node:path";
|
|
164184
164258
|
function declareHintFor(id) {
|
|
164185
164259
|
return catalogKey(id) === "app_services" ? "each calling screen's `logicBundle.declaredCapabilities` (the runtime gate) \u2014 an app need not list app_services in config.ts `capabilities`, which only a shell that hosts app services must (an HHP app declares it there, since HHP copies that list onto every screen)" : DECLARE_HINT;
|
|
@@ -164281,7 +164355,7 @@ async function writeLastDist(dir, rec) {
|
|
|
164281
164355
|
function readLastDist(dir) {
|
|
164282
164356
|
const path2 = join60(dir, LAST_DIST_FILE);
|
|
164283
164357
|
try {
|
|
164284
|
-
if (
|
|
164358
|
+
if (lstatSync22(join60(dir, ".himi")).isSymbolicLink() || lstatSync22(path2).isSymbolicLink()) return null;
|
|
164285
164359
|
} catch {
|
|
164286
164360
|
return null;
|
|
164287
164361
|
}
|
|
@@ -165125,7 +165199,7 @@ __export(base44_types_exports, {
|
|
|
165125
165199
|
renderBase44Types: () => renderBase44Types,
|
|
165126
165200
|
writeBase44Types: () => writeBase44Types
|
|
165127
165201
|
});
|
|
165128
|
-
import { existsSync as existsSync63, mkdirSync as
|
|
165202
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync30, readFileSync as readFileSync73, writeFileSync as writeFileSync26 } from "node:fs";
|
|
165129
165203
|
import { dirname as dirname37, join as join61 } from "node:path";
|
|
165130
165204
|
function logicalName(spec) {
|
|
165131
165205
|
return (isAdoptedEntity(spec) ? spec.base44Name : spec.name) ?? "";
|
|
@@ -165207,7 +165281,7 @@ async function writeBase44Types(dir, app) {
|
|
|
165207
165281
|
const path2 = join61(dir, BASE44_TYPES_PATH);
|
|
165208
165282
|
const changed = !existsSync63(path2) || readFileSync73(path2, "utf8") !== text13;
|
|
165209
165283
|
if (changed) {
|
|
165210
|
-
|
|
165284
|
+
mkdirSync30(dirname37(path2), { recursive: true });
|
|
165211
165285
|
writeFileSync26(path2, text13);
|
|
165212
165286
|
}
|
|
165213
165287
|
return { path: path2, changed, entities: text13.split("\nexport const ").length - 1 };
|
|
@@ -165359,8 +165433,8 @@ __export(eject_exports, {
|
|
|
165359
165433
|
EJECTABLE: () => EJECTABLE,
|
|
165360
165434
|
ejectModule: () => ejectModule
|
|
165361
165435
|
});
|
|
165362
|
-
import { existsSync as existsSync65, mkdirSync as
|
|
165363
|
-
import { dirname as dirname38, join as join63, relative as
|
|
165436
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync31, readFileSync as readFileSync75, writeFileSync as writeFileSync27 } from "node:fs";
|
|
165437
|
+
import { dirname as dirname38, join as join63, relative as relative13, resolve as resolve51, sep as sep18 } from "node:path";
|
|
165364
165438
|
function locate(repoRootOrCwd, mod) {
|
|
165365
165439
|
const inRepo = resolve51(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
|
|
165366
165440
|
if (existsSync65(inRepo)) return { path: inRepo, form: "source" };
|
|
@@ -165390,7 +165464,7 @@ function ejectModule(opts) {
|
|
|
165390
165464
|
}
|
|
165391
165465
|
const ext = found.form === "source" ? "ts" : "mjs";
|
|
165392
165466
|
const target = join63(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
|
|
165393
|
-
|
|
165467
|
+
mkdirSync31(dirname38(target), { recursive: true });
|
|
165394
165468
|
const banner = `// EJECTED from @wix/himalaya/${mod}. This app owns this file now.
|
|
165395
165469
|
//
|
|
165396
165470
|
// Central fixes to @wix/himalaya/${mod} NO LONGER REACH THIS APP \u2014 including any
|
|
@@ -165413,7 +165487,7 @@ function ejectModule(opts) {
|
|
|
165413
165487
|
if (!existsSync65(f2)) continue;
|
|
165414
165488
|
const before = readFileSync75(f2, "utf8");
|
|
165415
165489
|
let after = before;
|
|
165416
|
-
let rel =
|
|
165490
|
+
let rel = relative13(dirname38(f2), target).split(sep18).join("/").replace(/\.tsx?$/, ".js");
|
|
165417
165491
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
165418
165492
|
for (const spec of specifiersFor(mod)) {
|
|
165419
165493
|
const q3 = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -165594,8 +165668,8 @@ __export(icon_exports, {
|
|
|
165594
165668
|
writePreparedIcon: () => writePreparedIcon
|
|
165595
165669
|
});
|
|
165596
165670
|
import { createHash as createHash31 } from "node:crypto";
|
|
165597
|
-
import { accessSync as accessSync2, constants as constants4, existsSync as existsSync66, mkdirSync as
|
|
165598
|
-
import { basename as basename19, dirname as dirname39, join as join64, resolve as resolve52, sep as
|
|
165671
|
+
import { accessSync as accessSync2, constants as constants4, existsSync as existsSync66, mkdirSync as mkdirSync32, readFileSync as readFileSync76, statSync as statSync20, writeFileSync as writeFileSync28 } from "node:fs";
|
|
165672
|
+
import { basename as basename19, dirname as dirname39, join as join64, resolve as resolve52, sep as sep19 } from "node:path";
|
|
165599
165673
|
function readManifest(dir) {
|
|
165600
165674
|
try {
|
|
165601
165675
|
return JSON.parse(readFileSync76(join64(dir, MANIFEST), "utf8"));
|
|
@@ -165612,12 +165686,12 @@ function declaredIconName(dir) {
|
|
|
165612
165686
|
function iconDest(dir, name) {
|
|
165613
165687
|
const base = resolve52(dir);
|
|
165614
165688
|
const abs = resolve52(base, name);
|
|
165615
|
-
if (!abs.startsWith(base +
|
|
165689
|
+
if (!abs.startsWith(base + sep19)) {
|
|
165616
165690
|
throw new Error(
|
|
165617
165691
|
`himi icon: himalaya.content.json declares "icon": "${name}", which resolves outside the package (${abs}). Declare a path inside it, e.g. "${DEFAULT_CONTENT_ICON}".`
|
|
165618
165692
|
);
|
|
165619
165693
|
}
|
|
165620
|
-
|
|
165694
|
+
mkdirSync32(dirname39(abs), { recursive: true });
|
|
165621
165695
|
return abs;
|
|
165622
165696
|
}
|
|
165623
165697
|
function templateIconMatch(png) {
|
|
@@ -165973,8 +166047,8 @@ function baseOf(target, linkable, known) {
|
|
|
165973
166047
|
let best = null;
|
|
165974
166048
|
for (const base of linkable ?? []) {
|
|
165975
166049
|
if (!known.has(base) || target.length <= base.length + 1 || !target.startsWith(base)) continue;
|
|
165976
|
-
const
|
|
165977
|
-
if ((
|
|
166050
|
+
const sep26 = target[base.length];
|
|
166051
|
+
if ((sep26 === "_" || sep26 === "/") && (!best || base.length > best.length)) best = base;
|
|
165978
166052
|
}
|
|
165979
166053
|
return best;
|
|
165980
166054
|
}
|
|
@@ -166347,7 +166421,7 @@ __export(test_exports, {
|
|
|
166347
166421
|
scopeDescriptors: () => scopeDescriptors,
|
|
166348
166422
|
writeRecordedMocks: () => writeRecordedMocks
|
|
166349
166423
|
});
|
|
166350
|
-
import { existsSync as existsSync69, mkdirSync as
|
|
166424
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync33, readFileSync as readFileSync79, writeFileSync as writeFileSync29 } from "node:fs";
|
|
166351
166425
|
import { join as join68, resolve as resolve53 } from "node:path";
|
|
166352
166426
|
function readTestConfig(dir) {
|
|
166353
166427
|
const p2 = resolve53(dir, TEST_CONFIG_FILE);
|
|
@@ -166525,7 +166599,7 @@ function writeRecordedMocks(opts) {
|
|
|
166525
166599
|
};
|
|
166526
166600
|
}
|
|
166527
166601
|
const fs2 = opts.io ?? {
|
|
166528
|
-
mkdir: (p2) =>
|
|
166602
|
+
mkdir: (p2) => mkdirSync33(p2, { recursive: true }),
|
|
166529
166603
|
write: (p2, s2) => writeFileSync29(p2, s2)
|
|
166530
166604
|
};
|
|
166531
166605
|
fs2.mkdir(join68(opts.dir, "dev"));
|
|
@@ -167130,7 +167204,7 @@ var init_policy = __esm({
|
|
|
167130
167204
|
// ../pre-pr-review/scope.mjs
|
|
167131
167205
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
167132
167206
|
import { createHash as createHash32 } from "node:crypto";
|
|
167133
|
-
import { resolve as resolve55, dirname as dirname41, isAbsolute as
|
|
167207
|
+
import { resolve as resolve55, dirname as dirname41, isAbsolute as isAbsolute6, join as join69 } from "node:path";
|
|
167134
167208
|
import { fileURLToPath as fileURLToPath30 } from "node:url";
|
|
167135
167209
|
function resolveRepoRoot2(cwd = process.cwd()) {
|
|
167136
167210
|
let top;
|
|
@@ -167175,8 +167249,8 @@ var init_scope = __esm({
|
|
|
167175
167249
|
|
|
167176
167250
|
// ../verify-gate/diff-hash.mjs
|
|
167177
167251
|
import {
|
|
167178
|
-
lstatSync as
|
|
167179
|
-
mkdirSync as
|
|
167252
|
+
lstatSync as lstatSync23,
|
|
167253
|
+
mkdirSync as mkdirSync34,
|
|
167180
167254
|
mkdtempSync as mkdtempSync3,
|
|
167181
167255
|
readFileSync as readFileSync80,
|
|
167182
167256
|
readlinkSync,
|
|
@@ -167289,7 +167363,7 @@ function validationDiffHash(cwd = process.cwd()) {
|
|
|
167289
167363
|
const deletedRecord = () => [`${Buffer.byteLength(path2)}:${path2}`, "deleted", stagedIdentity(headEntry, indexEntry, void 0), ""].join("\0");
|
|
167290
167364
|
let stat2;
|
|
167291
167365
|
try {
|
|
167292
|
-
stat2 =
|
|
167366
|
+
stat2 = lstatSync23(absolute);
|
|
167293
167367
|
} catch (error) {
|
|
167294
167368
|
if (error?.code === "ENOENT") return deletedRecord();
|
|
167295
167369
|
throw error;
|
|
@@ -167325,7 +167399,7 @@ function validationDiffHash(cwd = process.cwd()) {
|
|
|
167325
167399
|
}
|
|
167326
167400
|
} catch (error) {
|
|
167327
167401
|
try {
|
|
167328
|
-
|
|
167402
|
+
lstatSync23(absolute);
|
|
167329
167403
|
} catch (recheck) {
|
|
167330
167404
|
if (recheck?.code === "ENOENT") return deletedRecord();
|
|
167331
167405
|
}
|
|
@@ -167351,7 +167425,7 @@ function seed(repo, commands) {
|
|
|
167351
167425
|
}
|
|
167352
167426
|
function write(repo, rel, body) {
|
|
167353
167427
|
const absolute = resolve56(repo, rel);
|
|
167354
|
-
|
|
167428
|
+
mkdirSync34(dirname42(absolute), { recursive: true });
|
|
167355
167429
|
writeFileSync30(absolute, body);
|
|
167356
167430
|
}
|
|
167357
167431
|
function selfTestRepo({ withBase }) {
|
|
@@ -167523,8 +167597,8 @@ import { execFileSync as execFileSync5 } from "node:child_process";
|
|
|
167523
167597
|
import { createHash as createHash35, randomBytes as randomBytes2 } from "node:crypto";
|
|
167524
167598
|
import {
|
|
167525
167599
|
existsSync as existsSync70,
|
|
167526
|
-
lstatSync as
|
|
167527
|
-
mkdirSync as
|
|
167600
|
+
lstatSync as lstatSync24,
|
|
167601
|
+
mkdirSync as mkdirSync35,
|
|
167528
167602
|
realpathSync as realpathSync9,
|
|
167529
167603
|
readlinkSync as readlinkSync2,
|
|
167530
167604
|
readFileSync as readFileSync81,
|
|
@@ -167532,7 +167606,7 @@ import {
|
|
|
167532
167606
|
unlinkSync as unlinkSync4,
|
|
167533
167607
|
writeFileSync as writeFileSync31
|
|
167534
167608
|
} from "node:fs";
|
|
167535
|
-
import { basename as basename21, join as join71, relative as
|
|
167609
|
+
import { basename as basename21, join as join71, relative as relative14, resolve as resolve57 } from "node:path";
|
|
167536
167610
|
function attestationVersionOf(value2) {
|
|
167537
167611
|
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return null;
|
|
167538
167612
|
const version5 = value2.attestation;
|
|
@@ -167582,7 +167656,7 @@ function repoRoot(contentDir2) {
|
|
|
167582
167656
|
function storedContentDir(contentDir2) {
|
|
167583
167657
|
const absolute = resolve57(contentDir2);
|
|
167584
167658
|
const root = repoRoot(absolute);
|
|
167585
|
-
return root ?
|
|
167659
|
+
return root ? relative14(root, absolute) || "." : ".";
|
|
167586
167660
|
}
|
|
167587
167661
|
function currentGitDiffHash(contentDir2) {
|
|
167588
167662
|
const root = repoRoot(resolve57(contentDir2));
|
|
@@ -167594,20 +167668,20 @@ function currentGitUntrackedHash(contentDir2) {
|
|
|
167594
167668
|
const absolute = realpathSync9.native(unresolved);
|
|
167595
167669
|
const root = repoRoot(absolute);
|
|
167596
167670
|
if (!root) return sourceTreeHash(absolute);
|
|
167597
|
-
const scope2 =
|
|
167671
|
+
const scope2 = relative14(root, absolute) || ".";
|
|
167598
167672
|
const listed = execFileSync5("git", ["-C", root, "ls-files", "--others", "--exclude-standard", "-z", "--", scope2], {
|
|
167599
167673
|
encoding: "utf8",
|
|
167600
167674
|
maxBuffer: GIT_HASH_MAX_BUFFER
|
|
167601
167675
|
});
|
|
167602
167676
|
const hash3 = createHash35("sha256");
|
|
167603
167677
|
for (const path2 of listed.split("\0").filter(Boolean).sort()) {
|
|
167604
|
-
const local =
|
|
167678
|
+
const local = relative14(absolute, join71(root, path2));
|
|
167605
167679
|
const segs = local.split(/[\\/]/);
|
|
167606
167680
|
if (NOT_ATTESTED_DIRS.has(segs[0])) continue;
|
|
167607
167681
|
if (segs.length === 1 && AGENT_TOOLING_ROOT_FILES.includes(segs[0])) continue;
|
|
167608
167682
|
if (MCP_HOST_CONFIG_FILES.includes(segs.join("/"))) continue;
|
|
167609
167683
|
const full = join71(root, path2);
|
|
167610
|
-
const stats =
|
|
167684
|
+
const stats = lstatSync24(full, { throwIfNoEntry: false });
|
|
167611
167685
|
if (!stats) continue;
|
|
167612
167686
|
const kind = stats.isSymbolicLink() ? "link" : stats.isDirectory() ? "dir" : stats.isFile() ? "file" : null;
|
|
167613
167687
|
if (!kind) continue;
|
|
@@ -167624,7 +167698,7 @@ function sourceTreeHash(root) {
|
|
|
167624
167698
|
for (const entry of readdirSync34(dir, { withFileTypes: true }).sort((a2, b2) => a2.name < b2.name ? -1 : a2.name > b2.name ? 1 : 0)) {
|
|
167625
167699
|
if (entry.isDirectory() && (entry.name === ".git" || entry.name === "node_modules" || NOT_ATTESTED_DIRS.has(entry.name))) continue;
|
|
167626
167700
|
const path2 = join71(dir, entry.name);
|
|
167627
|
-
const local =
|
|
167701
|
+
const local = relative14(root, path2);
|
|
167628
167702
|
if (dir === root && entry.isFile() && AGENT_TOOLING_ROOT_FILES.includes(entry.name)) continue;
|
|
167629
167703
|
if (MCP_HOST_CONFIG_FILES.includes(local.split(/[\\/]/).join("/"))) continue;
|
|
167630
167704
|
if (entry.isDirectory()) visit(path2);
|
|
@@ -167742,7 +167816,7 @@ function summaryOf2(attestation) {
|
|
|
167742
167816
|
function writeAttestation(input, opts = {}) {
|
|
167743
167817
|
const contentDir2 = resolve57(input.contentDir);
|
|
167744
167818
|
const dir = join71(contentDir2, ".himi", "attestations");
|
|
167745
|
-
|
|
167819
|
+
mkdirSync35(dir, { recursive: true });
|
|
167746
167820
|
const previous = readLatestAttestation(contentDir2);
|
|
167747
167821
|
const runId2 = `${(opts.now ?? (() => /* @__PURE__ */ new Date()))().toISOString()}-${(opts.randomSuffix ?? (() => randomBytes2(3).toString("hex")))()}`;
|
|
167748
167822
|
const descriptorHashes = Object.fromEntries(
|
|
@@ -167755,7 +167829,7 @@ function writeAttestation(input, opts = {}) {
|
|
|
167755
167829
|
const screenshots = Object.fromEntries(screenshotEntries.map(({ screen, hash: hash3 }) => [screen, hash3]));
|
|
167756
167830
|
for (const { bytes: bytes2, hash: hash3 } of screenshotEntries) {
|
|
167757
167831
|
const artifact = screenshotArtifactPath(contentDir2, hash3);
|
|
167758
|
-
|
|
167832
|
+
mkdirSync35(join71(dir, "artifacts"), { recursive: true });
|
|
167759
167833
|
if (!existsSync70(artifact)) writeFileSync31(artifact, bytes2);
|
|
167760
167834
|
}
|
|
167761
167835
|
const unsigned = {
|
|
@@ -167902,8 +167976,8 @@ var init_attestation = __esm({
|
|
|
167902
167976
|
});
|
|
167903
167977
|
|
|
167904
167978
|
// src/ux-evidence.ts
|
|
167905
|
-
import { existsSync as existsSync71, mkdirSync as
|
|
167906
|
-
import { dirname as dirname43, isAbsolute as
|
|
167979
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync36, readFileSync as readFileSync82, writeFileSync as writeFileSync32 } from "node:fs";
|
|
167980
|
+
import { dirname as dirname43, isAbsolute as isAbsolute7, join as join72, relative as relative15, resolve as resolve58 } from "node:path";
|
|
167907
167981
|
function isNativePlatform(value2) {
|
|
167908
167982
|
return typeof value2 === "string" && NATIVE_PLATFORMS.includes(value2);
|
|
167909
167983
|
}
|
|
@@ -167947,12 +168021,12 @@ function recordedRenderWidths(content) {
|
|
|
167947
168021
|
return renderEvidenceEntries(evidence).map((entry) => entry.width);
|
|
167948
168022
|
}
|
|
167949
168023
|
function writeEvidence(path2, evidence) {
|
|
167950
|
-
|
|
168024
|
+
mkdirSync36(dirname43(path2), { recursive: true });
|
|
167951
168025
|
writeFileSync32(path2, JSON.stringify(evidence, null, 2) + "\n");
|
|
167952
168026
|
}
|
|
167953
168027
|
function recordedFilePath(dir, file2) {
|
|
167954
|
-
const rel =
|
|
167955
|
-
return rel && !rel.startsWith("..") && !
|
|
168028
|
+
const rel = relative15(dir, resolve58(file2));
|
|
168029
|
+
return rel && !rel.startsWith("..") && !isAbsolute7(rel) ? rel : file2;
|
|
167956
168030
|
}
|
|
167957
168031
|
function recordRenderWidth(content, entry) {
|
|
167958
168032
|
try {
|
|
@@ -170003,12 +170077,12 @@ var init_cli_bridge = __esm({
|
|
|
170003
170077
|
});
|
|
170004
170078
|
|
|
170005
170079
|
// src/mcp/file-tools.ts
|
|
170006
|
-
import { closeSync as closeSync6, constants as constants5, lstatSync as
|
|
170080
|
+
import { closeSync as closeSync6, constants as constants5, lstatSync as lstatSync25, mkdirSync as mkdirSync37, openSync as openSync5, readdirSync as readdirSync35, readFileSync as readFileSync88, realpathSync as realpathSync10, renameSync as renameSync13, rmSync as rmSync21, statSync as statSync21, writeSync, existsSync as existsSync76 } from "node:fs";
|
|
170007
170081
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
170008
|
-
import { dirname as dirname44, isAbsolute as
|
|
170082
|
+
import { dirname as dirname44, isAbsolute as isAbsolute8, join as join77, relative as relative16, resolve as resolve60, sep as sep20 } from "node:path";
|
|
170009
170083
|
import * as z2 from "zod";
|
|
170010
170084
|
function within(root, p2) {
|
|
170011
|
-
return p2 === root || p2.startsWith(root.endsWith(
|
|
170085
|
+
return p2 === root || p2.startsWith(root.endsWith(sep20) ? root : root + sep20);
|
|
170012
170086
|
}
|
|
170013
170087
|
function realish(p2) {
|
|
170014
170088
|
let cur = p2;
|
|
@@ -170016,17 +170090,17 @@ function realish(p2) {
|
|
|
170016
170090
|
while (!existsSync76(cur)) {
|
|
170017
170091
|
const up = dirname44(cur);
|
|
170018
170092
|
if (up === cur) break;
|
|
170019
|
-
tail.unshift(cur.slice(up.length + (up.endsWith(
|
|
170093
|
+
tail.unshift(cur.slice(up.length + (up.endsWith(sep20) ? 0 : 1)));
|
|
170020
170094
|
cur = up;
|
|
170021
170095
|
}
|
|
170022
170096
|
return join77(realpathSync10(cur), ...tail);
|
|
170023
170097
|
}
|
|
170024
170098
|
function symlinkComponent(base, abs) {
|
|
170025
170099
|
let cur = base;
|
|
170026
|
-
for (const part4 of
|
|
170100
|
+
for (const part4 of relative16(base, abs).split(sep20).filter(Boolean)) {
|
|
170027
170101
|
cur = join77(cur, part4);
|
|
170028
170102
|
try {
|
|
170029
|
-
if (
|
|
170103
|
+
if (lstatSync25(cur).isSymbolicLink()) return relative16(base, cur);
|
|
170030
170104
|
} catch {
|
|
170031
170105
|
return void 0;
|
|
170032
170106
|
}
|
|
@@ -170049,7 +170123,7 @@ async function confinedAppDir(args, deps) {
|
|
|
170049
170123
|
if (!within(root, dir) || !within(realpathSync10(root), realish(dir))) return refuse5("outside_workspace", `"${String(args.dir)}" is outside the workspace folder`);
|
|
170050
170124
|
const link = symlinkComponent(root, dir);
|
|
170051
170125
|
if (link) return refuse5("outside_workspace", `"${link}" is a symlink \u2014 the app folder must be a real folder in the workspace`);
|
|
170052
|
-
const rel =
|
|
170126
|
+
const rel = relative16(root, dir);
|
|
170053
170127
|
if (rel && (isDeniedSourcePath(`${rel}/x`) || isDeniedSourcePath(`${rel.toLowerCase()}/x`))) return refuse5("denied", `"${rel}" is a folder this tool does not touch`);
|
|
170054
170128
|
if (!existsSync76(join77(dir, CONTENT_MARKER))) {
|
|
170055
170129
|
return refuse5("not_an_app", `"${rel || "."}" is not an app folder (no ${CONTENT_MARKER}) \u2014 see himi_list_apps, or create one with himi_init`);
|
|
@@ -170062,16 +170136,16 @@ function onDiskSpelling(abs) {
|
|
|
170062
170136
|
while (!existsSync76(cur)) {
|
|
170063
170137
|
const up = dirname44(cur);
|
|
170064
170138
|
if (up === cur) break;
|
|
170065
|
-
tail.unshift(cur.slice(up.length + (up.endsWith(
|
|
170139
|
+
tail.unshift(cur.slice(up.length + (up.endsWith(sep20) ? 0 : 1)));
|
|
170066
170140
|
cur = up;
|
|
170067
170141
|
}
|
|
170068
170142
|
return join77(realpathSync10.native(cur), ...tail);
|
|
170069
170143
|
}
|
|
170070
170144
|
function denied(appDir3, abs) {
|
|
170071
|
-
const rel =
|
|
170145
|
+
const rel = relative16(appDir3, abs);
|
|
170072
170146
|
if (isDeniedSourcePath(rel) || isDeniedSourcePath(rel.toLowerCase())) return true;
|
|
170073
170147
|
try {
|
|
170074
|
-
return isDeniedSourcePath(
|
|
170148
|
+
return isDeniedSourcePath(relative16(realpathSync10.native(appDir3), onDiskSpelling(abs)));
|
|
170075
170149
|
} catch {
|
|
170076
170150
|
return true;
|
|
170077
170151
|
}
|
|
@@ -170079,7 +170153,7 @@ function denied(appDir3, abs) {
|
|
|
170079
170153
|
function confinedPath(appDir3, rel) {
|
|
170080
170154
|
if (typeof rel !== "string" || !rel.trim()) return { error: "a path is required" };
|
|
170081
170155
|
if (rel.includes("\0")) return { error: "a path may not contain NUL" };
|
|
170082
|
-
if (
|
|
170156
|
+
if (isAbsolute8(rel)) return { error: `"${rel}" is absolute \u2014 give a path inside the app folder` };
|
|
170083
170157
|
const abs = resolve60(appDir3, rel);
|
|
170084
170158
|
if (!within(appDir3, abs) || abs === appDir3) return { error: `"${rel}" is outside the app folder` };
|
|
170085
170159
|
const real = realish(abs);
|
|
@@ -170091,7 +170165,7 @@ function confinedPath(appDir3, rel) {
|
|
|
170091
170165
|
return abs;
|
|
170092
170166
|
}
|
|
170093
170167
|
function writeNoFollow2(appDir3, abs, content) {
|
|
170094
|
-
|
|
170168
|
+
mkdirSync37(dirname44(abs), { recursive: true });
|
|
170095
170169
|
const before = symlinkComponent(appDir3, abs);
|
|
170096
170170
|
if (before) throw new Error(`"${before}" became a symlink`);
|
|
170097
170171
|
const tmp = join77(dirname44(abs), `.himi-write-${process.pid}-${randomBytes3(6).toString("hex")}.tmp`);
|
|
@@ -170104,14 +170178,14 @@ function writeNoFollow2(appDir3, abs, content) {
|
|
|
170104
170178
|
const link = symlinkComponent(appDir3, abs);
|
|
170105
170179
|
if (link || !within(realpathSync10(appDir3), realpathSync10(dirname44(abs)))) {
|
|
170106
170180
|
rmSync21(tmp, { force: true });
|
|
170107
|
-
throw new Error(`"${link ??
|
|
170181
|
+
throw new Error(`"${link ?? relative16(appDir3, dirname44(abs))}" changed into a link while writing`);
|
|
170108
170182
|
}
|
|
170109
170183
|
renameSync13(tmp, abs);
|
|
170110
170184
|
}
|
|
170111
170185
|
function listFiles(appDir3) {
|
|
170112
170186
|
const files = [];
|
|
170113
170187
|
const walk2 = (d2) => {
|
|
170114
|
-
const parentRel =
|
|
170188
|
+
const parentRel = relative16(appDir3, d2);
|
|
170115
170189
|
for (const e2 of readdirSync35(d2, { withFileTypes: true }).sort((a2, b2) => a2.name.localeCompare(b2.name))) {
|
|
170116
170190
|
if (e2.isSymbolicLink()) continue;
|
|
170117
170191
|
const p2 = join77(d2, e2.name);
|
|
@@ -170119,10 +170193,10 @@ function listFiles(appDir3) {
|
|
|
170119
170193
|
if (isDeniedSourceDir(e2.name, parentRel) || isDeniedSourceDir(e2.name.toLowerCase(), parentRel)) continue;
|
|
170120
170194
|
if (!walk2(p2)) return false;
|
|
170121
170195
|
} else if (e2.isFile()) {
|
|
170122
|
-
const rel =
|
|
170196
|
+
const rel = relative16(appDir3, p2);
|
|
170123
170197
|
if (isDeniedSourcePath(rel) || isDeniedSourcePath(rel.toLowerCase())) continue;
|
|
170124
170198
|
if (files.length >= MAX_LISTED) return false;
|
|
170125
|
-
files.push({ path: rel.split(
|
|
170199
|
+
files.push({ path: rel.split(sep20).join("/"), bytes: statSync21(p2).size });
|
|
170126
170200
|
}
|
|
170127
170201
|
}
|
|
170128
170202
|
return true;
|
|
@@ -170173,7 +170247,7 @@ function fileTools() {
|
|
|
170173
170247
|
if (typeof app !== "string") return app;
|
|
170174
170248
|
const p2 = confinedPath(app, a2.path);
|
|
170175
170249
|
if (typeof p2 !== "string") return refuse5("bad_path", p2.error);
|
|
170176
|
-
if (!existsSync76(p2) || !
|
|
170250
|
+
if (!existsSync76(p2) || !lstatSync25(p2).isFile()) return refuse5("not_found", `no file "${String(a2.path)}"`);
|
|
170177
170251
|
const size = statSync21(p2).size;
|
|
170178
170252
|
if (size > MAX_FILE_BYTES) return refuse5("too_large", `"${String(a2.path)}" is ${size} bytes \u2014 over the ${MAX_FILE_BYTES}-byte read limit`);
|
|
170179
170253
|
return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync88(p2, "utf8") });
|
|
@@ -170200,7 +170274,7 @@ function fileTools() {
|
|
|
170200
170274
|
if (typeof p2 !== "string") refused2.push({ path: f2.path, error: p2.error });
|
|
170201
170275
|
else if (typeof f2.content !== "string") refused2.push({ path: f2.path, error: "content must be text" });
|
|
170202
170276
|
else if (Buffer.byteLength(f2.content) > MAX_FILE_BYTES) refused2.push({ path: f2.path, error: `over the ${MAX_FILE_BYTES}-byte limit` });
|
|
170203
|
-
else if (existsSync76(p2) && !
|
|
170277
|
+
else if (existsSync76(p2) && !lstatSync25(p2).isFile()) refused2.push({ path: f2.path, error: "not a regular file" });
|
|
170204
170278
|
else if (planned2.some((q3) => q3.abs === p2)) refused2.push({ path: f2.path, error: "the same file twice in one call" });
|
|
170205
170279
|
else planned2.push({ abs: p2, rel: String(f2.path), content: f2.content });
|
|
170206
170280
|
}
|
|
@@ -170234,7 +170308,7 @@ function fileTools() {
|
|
|
170234
170308
|
const p2 = confinedPath(app, rel);
|
|
170235
170309
|
if (typeof p2 !== "string") refused2.push({ path: rel, error: p2.error });
|
|
170236
170310
|
else if (!existsSync76(p2)) refused2.push({ path: rel, error: "no such file" });
|
|
170237
|
-
else if (!
|
|
170311
|
+
else if (!lstatSync25(p2).isFile()) refused2.push({ path: rel, error: "not a regular file" });
|
|
170238
170312
|
else if (!planned2.includes(p2)) {
|
|
170239
170313
|
planned2.push(p2);
|
|
170240
170314
|
deleted.push(rel);
|
|
@@ -170265,7 +170339,7 @@ var init_file_tools = __esm({
|
|
|
170265
170339
|
|
|
170266
170340
|
// src/mcp/iap-tools.ts
|
|
170267
170341
|
import * as z3 from "zod";
|
|
170268
|
-
import { dirname as dirname45, relative as
|
|
170342
|
+
import { dirname as dirname45, relative as relative17, resolve as resolve61 } from "node:path";
|
|
170269
170343
|
async function paths(args, deps) {
|
|
170270
170344
|
const base = await deps.defaultDir();
|
|
170271
170345
|
const result = { ...args, workspaceDir: base };
|
|
@@ -170281,7 +170355,7 @@ function workspaceInputRefusal(args, deps, context) {
|
|
|
170281
170355
|
const why = workspaceRefusal(context.boundary, args[key3]);
|
|
170282
170356
|
if (why) return `${key3} ${why}`;
|
|
170283
170357
|
if (key3 !== "dir" && key3 !== "plist") {
|
|
170284
|
-
const confined = confinedPath(context.boundary,
|
|
170358
|
+
const confined = confinedPath(context.boundary, relative17(context.boundary, args[key3]));
|
|
170285
170359
|
if (typeof confined !== "string") return `${key3} ${confined.error}`;
|
|
170286
170360
|
}
|
|
170287
170361
|
}
|
|
@@ -170915,7 +170989,7 @@ __export(server_exports, {
|
|
|
170915
170989
|
protectStdout: () => protectStdout,
|
|
170916
170990
|
startMcpServer: () => startMcpServer
|
|
170917
170991
|
});
|
|
170918
|
-
import { mkdirSync as
|
|
170992
|
+
import { mkdirSync as mkdirSync38, readFileSync as readFileSync89 } from "node:fs";
|
|
170919
170993
|
import { fileURLToPath as fileURLToPath31 } from "node:url";
|
|
170920
170994
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
170921
170995
|
import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
@@ -170954,7 +171028,7 @@ async function startMcpServer(opts) {
|
|
|
170954
171028
|
const runCli = createCliBridge(opts.run);
|
|
170955
171029
|
if (opts.workspace) {
|
|
170956
171030
|
try {
|
|
170957
|
-
|
|
171031
|
+
mkdirSync38(opts.workspace, { recursive: true });
|
|
170958
171032
|
} catch (e2) {
|
|
170959
171033
|
console.error(`[himi mcp] could not create the workspace folder ${opts.workspace}: ${e2.message}`);
|
|
170960
171034
|
}
|
|
@@ -171035,7 +171109,7 @@ var init_open_url = __esm({
|
|
|
171035
171109
|
|
|
171036
171110
|
// src/ux-audit.ts
|
|
171037
171111
|
import { existsSync as existsSync79, readFileSync as readFileSync90, readdirSync as readdirSync36 } from "node:fs";
|
|
171038
|
-
import { join as join81, relative as
|
|
171112
|
+
import { join as join81, relative as relative18, resolve as resolve65 } from "node:path";
|
|
171039
171113
|
function issue(issues, strict, code, message2, path2) {
|
|
171040
171114
|
issues.push({ code, message: message2, ...path2 ? { path: path2 } : {}, severity: strict ? "error" : "warning" });
|
|
171041
171115
|
}
|
|
@@ -171057,7 +171131,7 @@ function walkSource(dir, root = dir) {
|
|
|
171057
171131
|
if (!SOURCE_EXTENSIONS.has(ext)) continue;
|
|
171058
171132
|
const absolute = join81(dir, entry.name);
|
|
171059
171133
|
const text13 = readText2(absolute);
|
|
171060
|
-
if (text13 !== null) found.push({ path:
|
|
171134
|
+
if (text13 !== null) found.push({ path: relative18(root, absolute), text: text13 });
|
|
171061
171135
|
}
|
|
171062
171136
|
return found;
|
|
171063
171137
|
}
|
|
@@ -171190,7 +171264,7 @@ __export(native_decode_exports, {
|
|
|
171190
171264
|
runNativeDecode: () => runNativeDecode
|
|
171191
171265
|
});
|
|
171192
171266
|
import { execFileSync as execFileSync6, spawnSync as spawnSync8 } from "node:child_process";
|
|
171193
|
-
import { existsSync as existsSync80, mkdirSync as
|
|
171267
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync41, mkdtempSync as mkdtempSync5, readFileSync as readFileSync91, rmSync as rmSync23, writeFileSync as writeFileSync35 } from "node:fs";
|
|
171194
171268
|
import { homedir as homedir10, tmpdir as tmpdir6 } from "node:os";
|
|
171195
171269
|
import { join as join83 } from "node:path";
|
|
171196
171270
|
import { fileURLToPath as fileURLToPath32 } from "node:url";
|
|
@@ -171353,7 +171427,7 @@ function writeDecodeInputs(descriptorDir, descriptors, tokensJson) {
|
|
|
171353
171427
|
writeFileSync35(join83(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
|
|
171354
171428
|
}
|
|
171355
171429
|
if (tokensJson === void 0) return void 0;
|
|
171356
|
-
|
|
171430
|
+
mkdirSync41(join83(descriptorDir, "tokens"));
|
|
171357
171431
|
const tokensPath = join83(descriptorDir, "tokens", NATIVE_TOKENS_DOCUMENT);
|
|
171358
171432
|
writeFileSync35(tokensPath, tokensJson);
|
|
171359
171433
|
return tokensPath;
|
|
@@ -171512,7 +171586,7 @@ __export(browser_authoring_exports, {
|
|
|
171512
171586
|
import { createServer as createServer4 } from "node:http";
|
|
171513
171587
|
import { createHash as createHash38, randomBytes as randomBytes4 } from "node:crypto";
|
|
171514
171588
|
import { existsSync as existsSync81, readdirSync as readdirSync37, readFileSync as readFileSync92, realpathSync as realpathSync11, statSync as statSync22 } from "node:fs";
|
|
171515
|
-
import { join as join84, posix as posix3, relative as
|
|
171589
|
+
import { join as join84, posix as posix3, relative as relative19, sep as sep21 } from "node:path";
|
|
171516
171590
|
function humanMs(ms2) {
|
|
171517
171591
|
return ms2 < 1e3 ? `${ms2}ms` : `${Math.round(ms2 / 1e3)}s`;
|
|
171518
171592
|
}
|
|
@@ -171562,7 +171636,7 @@ function collectRelativeSiblings(files, tier5SrcDir) {
|
|
|
171562
171636
|
];
|
|
171563
171637
|
for (const abs of candidates) {
|
|
171564
171638
|
if (!existsSync81(abs) || statSync22(abs).isDirectory()) continue;
|
|
171565
|
-
const key3 = `/tier5-src/${
|
|
171639
|
+
const key3 = `/tier5-src/${relative19(tier5SrcDir, abs).split(sep21).join(posix3.sep)}`;
|
|
171566
171640
|
if (key3 in files) break;
|
|
171567
171641
|
files[key3] = readFileSync92(abs, "utf8");
|
|
171568
171642
|
queue.push(key3);
|
|
@@ -171772,7 +171846,7 @@ __export(coverage_exports, {
|
|
|
171772
171846
|
suppressedNativeKeys: () => suppressedNativeKeys,
|
|
171773
171847
|
trendAndStore: () => trendAndStore
|
|
171774
171848
|
});
|
|
171775
|
-
import { existsSync as existsSync82, mkdirSync as
|
|
171849
|
+
import { existsSync as existsSync82, mkdirSync as mkdirSync42, readFileSync as readFileSync93, writeFileSync as writeFileSync36 } from "node:fs";
|
|
171776
171850
|
import { dirname as dirname48, join as join85 } from "node:path";
|
|
171777
171851
|
function suppressedNativeKeys(oracle) {
|
|
171778
171852
|
return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
|
|
@@ -171965,7 +172039,7 @@ function trendAndStore(dir, entries, suppressed) {
|
|
|
171965
172039
|
const current = entries.map((e2) => e2.key);
|
|
171966
172040
|
const stored = [.../* @__PURE__ */ new Set([...current, ...(previous ?? []).filter((key3) => (suppressed ?? []).includes(key3))])];
|
|
171967
172041
|
try {
|
|
171968
|
-
|
|
172042
|
+
mkdirSync42(dirname48(p2), { recursive: true });
|
|
171969
172043
|
writeFileSync36(p2, JSON.stringify({ keys: stored, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
171970
172044
|
} catch {
|
|
171971
172045
|
return null;
|
|
@@ -172010,7 +172084,7 @@ function diffAndStoreObservations(dir, current) {
|
|
|
172010
172084
|
} catch {
|
|
172011
172085
|
}
|
|
172012
172086
|
try {
|
|
172013
|
-
|
|
172087
|
+
mkdirSync42(dirname48(p2), { recursive: true });
|
|
172014
172088
|
writeFileSync36(p2, JSON.stringify({ screens: current, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
172015
172089
|
} catch {
|
|
172016
172090
|
return null;
|
|
@@ -174604,7 +174678,7 @@ var init_brand_font = __esm({
|
|
|
174604
174678
|
});
|
|
174605
174679
|
|
|
174606
174680
|
// src/site-analyze/write-artifacts.ts
|
|
174607
|
-
import { mkdirSync as
|
|
174681
|
+
import { mkdirSync as mkdirSync43, rmSync as rmSync25, writeFileSync as writeFileSync37 } from "node:fs";
|
|
174608
174682
|
import { join as join89 } from "node:path";
|
|
174609
174683
|
function attachVeloSources(book, sources, put) {
|
|
174610
174684
|
const byPath = new Map((sources ?? []).map((s2) => [s2.path, s2.text]));
|
|
@@ -174760,12 +174834,12 @@ async function downloadMedia(book, fetchImpl, put) {
|
|
|
174760
174834
|
}
|
|
174761
174835
|
async function writeBusinessBook(result, opts) {
|
|
174762
174836
|
const out2 = opts.outDir;
|
|
174763
|
-
|
|
174764
|
-
|
|
174837
|
+
mkdirSync43(join89(out2, "evidence/pages"), { recursive: true });
|
|
174838
|
+
mkdirSync43(join89(out2, "media/catalog"), { recursive: true });
|
|
174765
174839
|
const files = [];
|
|
174766
174840
|
const put = (rel, body) => {
|
|
174767
174841
|
const p2 = join89(out2, rel);
|
|
174768
|
-
|
|
174842
|
+
mkdirSync43(join89(p2, ".."), { recursive: true });
|
|
174769
174843
|
writeFileSync37(p2, body);
|
|
174770
174844
|
files.push(rel);
|
|
174771
174845
|
};
|
|
@@ -175364,7 +175438,7 @@ __export(coverage_exports2, {
|
|
|
175364
175438
|
});
|
|
175365
175439
|
import { createHash as createHash39 } from "node:crypto";
|
|
175366
175440
|
import { existsSync as existsSync85, readFileSync as readFileSync96, writeFileSync as writeFileSync38 } from "node:fs";
|
|
175367
|
-
import { isAbsolute as
|
|
175441
|
+
import { isAbsolute as isAbsolute9, join as join90, resolve as resolve67 } from "node:path";
|
|
175368
175442
|
function verifiedEvidence(evidenceDir) {
|
|
175369
175443
|
const manifest2 = obj4(JSON.parse(readFileSync96(join90(evidenceDir, "manifest.json"), "utf8")));
|
|
175370
175444
|
if (manifest2.workflow !== "one-app-to-himi-app" || manifest2.stage !== "collected") throw Error("One App evidence is not collected.");
|
|
@@ -175535,7 +175609,7 @@ function verifyNativeProof(contentDir2, releaseHash, requirementIds) {
|
|
|
175535
175609
|
continue;
|
|
175536
175610
|
}
|
|
175537
175611
|
const artifact = record3.artifact;
|
|
175538
|
-
if (typeof artifact !== "string" || !artifact.trim() ||
|
|
175612
|
+
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !existsSync85(join90(root, artifact))) {
|
|
175539
175613
|
issues.push(`Native walkthrough check ${id} needs a reviewable artifact file.`);
|
|
175540
175614
|
}
|
|
175541
175615
|
}
|
|
@@ -175652,7 +175726,7 @@ function verifyCoverage(evidenceDir, contentDir2, releaseHash, builtScreenIds) {
|
|
|
175652
175726
|
}
|
|
175653
175727
|
for (const check of matching) {
|
|
175654
175728
|
const path2 = check.evidence;
|
|
175655
|
-
if (typeof path2 !== "string" || !path2.trim() ||
|
|
175729
|
+
if (typeof path2 !== "string" || !path2.trim() || isAbsolute9(path2) || path2.split(/[\\/]/).includes("..")) {
|
|
175656
175730
|
issues.push({ id, message: `Check ${required3} needs a safe relative evidence path.` });
|
|
175657
175731
|
} else if (!existsSync85(join90(resolve67(contentDir2), path2))) {
|
|
175658
175732
|
issues.push({ id, message: `Check ${required3} evidence file is absent: ${path2}.` });
|
|
@@ -175665,14 +175739,14 @@ function verifyCoverage(evidenceDir, contentDir2, releaseHash, builtScreenIds) {
|
|
|
175665
175739
|
issues.push({ id, message: `Check ${required3} has no latest passed record for this requirement and target.` });
|
|
175666
175740
|
} else {
|
|
175667
175741
|
const artifact = record3.artifact;
|
|
175668
|
-
if (typeof artifact !== "string" || !artifact.trim() ||
|
|
175742
|
+
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !existsSync85(join90(resolve67(contentDir2), artifact))) {
|
|
175669
175743
|
issues.push({ id, message: `Check ${required3} needs a reviewable artifact file.` });
|
|
175670
175744
|
}
|
|
175671
175745
|
if (kind === "native-widget") {
|
|
175672
175746
|
const baseline = obj4(record3.sourceBaseline);
|
|
175673
175747
|
const context = obj4(record3.targetContext);
|
|
175674
175748
|
const sourceArtifact = baseline.artifact;
|
|
175675
|
-
if (baseline.kind !== "native-device" || typeof sourceArtifact !== "string" || !sourceArtifact.trim() ||
|
|
175749
|
+
if (baseline.kind !== "native-device" || typeof sourceArtifact !== "string" || !sourceArtifact.trim() || isAbsolute9(sourceArtifact) || sourceArtifact.split(/[\\/]/).includes("..") || !existsSync85(join90(resolve67(contentDir2), sourceArtifact))) {
|
|
175676
175750
|
issues.push({ id, message: "Native widget behavior needs a source-device baseline artifact; editor-only observations are unverified." });
|
|
175677
175751
|
}
|
|
175678
175752
|
if (!["siteId", "identityContext"].every((key3) => typeof baseline[key3] === "string" && String(baseline[key3]).trim() && baseline[key3] === context[key3]) || typeof sourceSiteId !== "string" || baseline.siteId !== sourceSiteId) {
|
|
@@ -176527,8 +176601,8 @@ __export(validate_design_exports, {
|
|
|
176527
176601
|
validateDesign: () => validateDesign
|
|
176528
176602
|
});
|
|
176529
176603
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
176530
|
-
import { closeSync as closeSync7, constants as constants6, existsSync as existsSync89, lstatSync as
|
|
176531
|
-
import { dirname as dirname49, isAbsolute as
|
|
176604
|
+
import { closeSync as closeSync7, constants as constants6, existsSync as existsSync89, lstatSync as lstatSync26, openSync as openSync6, readFileSync as readFileSync100, realpathSync as realpathSync12, renameSync as renameSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync40 } from "node:fs";
|
|
176605
|
+
import { dirname as dirname49, isAbsolute as isAbsolute10, join as join94, relative as relative20, resolve as resolve70, sep as sep22, win32 } from "node:path";
|
|
176532
176606
|
import ts12 from "typescript";
|
|
176533
176607
|
function readColorToken(tokens2, name) {
|
|
176534
176608
|
const entry = obj5(tokens2.colors)?.[name];
|
|
@@ -176747,33 +176821,33 @@ function activeIdiomNames(contentDir2, tokens2) {
|
|
|
176747
176821
|
return /* @__PURE__ */ new Set();
|
|
176748
176822
|
}
|
|
176749
176823
|
function writableTokensPath(contentDir2, location) {
|
|
176750
|
-
if (
|
|
176824
|
+
if (isAbsolute10(location) || win32.isAbsolute(location) || location.split(/[\\/]/).includes("..")) {
|
|
176751
176825
|
throw new Error("--fix requires a token path inside the content directory without traversal.");
|
|
176752
176826
|
}
|
|
176753
176827
|
const root = realpathSync12(contentDir2);
|
|
176754
176828
|
const path2 = resolve70(root, location);
|
|
176755
|
-
const rel =
|
|
176756
|
-
if (!rel || rel === ".." || rel.startsWith(`..${
|
|
176829
|
+
const rel = relative20(root, path2);
|
|
176830
|
+
if (!rel || rel === ".." || rel.startsWith(`..${sep22}`) || isAbsolute10(rel)) {
|
|
176757
176831
|
throw new Error("--fix requires a token path inside the content directory.");
|
|
176758
176832
|
}
|
|
176759
176833
|
let current = root;
|
|
176760
|
-
const parts = rel.split(
|
|
176834
|
+
const parts = rel.split(sep22);
|
|
176761
176835
|
for (const [index, part4] of parts.entries()) {
|
|
176762
176836
|
current = join94(current, part4);
|
|
176763
|
-
const stat2 =
|
|
176837
|
+
const stat2 = lstatSync26(current);
|
|
176764
176838
|
if (stat2.isSymbolicLink() || (index === parts.length - 1 ? !stat2.isFile() : !stat2.isDirectory())) {
|
|
176765
176839
|
throw new Error("--fix requires a regular token file under directories without symlinks.");
|
|
176766
176840
|
}
|
|
176767
176841
|
}
|
|
176768
|
-
const real =
|
|
176769
|
-
if (!real || real === ".." || real.startsWith(`..${
|
|
176842
|
+
const real = relative20(root, realpathSync12(path2));
|
|
176843
|
+
if (!real || real === ".." || real.startsWith(`..${sep22}`) || isAbsolute10(real)) {
|
|
176770
176844
|
throw new Error("--fix cannot write outside the content directory.");
|
|
176771
176845
|
}
|
|
176772
176846
|
return path2;
|
|
176773
176847
|
}
|
|
176774
176848
|
function writeFixedTokens(contentDir2, location, path2, tokens2) {
|
|
176775
176849
|
const temp = join94(dirname49(path2), `.himi-design-${process.pid}-${randomBytes5(6).toString("hex")}.tmp`);
|
|
176776
|
-
const mode =
|
|
176850
|
+
const mode = lstatSync26(path2).mode & 511;
|
|
176777
176851
|
const fd = openSync6(temp, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | (constants6.O_NOFOLLOW ?? 0), mode);
|
|
176778
176852
|
try {
|
|
176779
176853
|
try {
|
|
@@ -176965,12 +177039,12 @@ function safeEvidencePath(contentDir2, name) {
|
|
|
176965
177039
|
const root = realpathSync12(contentDir2);
|
|
176966
177040
|
const dir = realDirIn(root, ".himi/one-app");
|
|
176967
177041
|
if (!dir) throw new Error("The design evidence directory is not a regular directory.");
|
|
176968
|
-
const real =
|
|
176969
|
-
if (!real || real === ".." || real.startsWith(`..${
|
|
177042
|
+
const real = relative20(root, realpathSync12(dir));
|
|
177043
|
+
if (!real || real === ".." || real.startsWith(`..${sep22}`) || isAbsolute10(real)) {
|
|
176970
177044
|
throw new Error("The design evidence directory is outside the content directory.");
|
|
176971
177045
|
}
|
|
176972
177046
|
const path2 = join94(dir, name);
|
|
176973
|
-
const stat2 =
|
|
177047
|
+
const stat2 = lstatSync26(path2, { throwIfNoEntry: false });
|
|
176974
177048
|
if (stat2 && !stat2.isFile()) throw new Error("The design evidence file is not a regular file.");
|
|
176975
177049
|
return path2;
|
|
176976
177050
|
}
|
|
@@ -180108,7 +180182,7 @@ __export(run_exports, {
|
|
|
180108
180182
|
runPackage: () => runPackage,
|
|
180109
180183
|
withoutProdServe: () => withoutProdServe
|
|
180110
180184
|
});
|
|
180111
|
-
import { cpSync as cpSync2, existsSync as existsSync92, mkdirSync as
|
|
180185
|
+
import { cpSync as cpSync2, existsSync as existsSync92, mkdirSync as mkdirSync44, mkdtempSync as mkdtempSync8, readFileSync as readFileSync102, rmSync as rmSync28, statSync as statSync26 } from "node:fs";
|
|
180112
180186
|
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir9 } from "node:os";
|
|
180113
180187
|
import { dirname as dirname50, join as join97 } from "node:path";
|
|
180114
180188
|
import { fileURLToPath as fileURLToPath34 } from "node:url";
|
|
@@ -180154,7 +180228,7 @@ async function resolvePackage(source, workDir) {
|
|
|
180154
180228
|
const root2 = workDir ?? mkdtempSync8(join97(tmpdir9(), "himi-run-"));
|
|
180155
180229
|
const target = join97(root2, app2);
|
|
180156
180230
|
if (join97(source) !== target) {
|
|
180157
|
-
|
|
180231
|
+
mkdirSync44(root2, { recursive: true });
|
|
180158
180232
|
rmSync28(target, { recursive: true, force: true });
|
|
180159
180233
|
cpSync2(source, target, { recursive: true });
|
|
180160
180234
|
}
|
|
@@ -184476,7 +184550,7 @@ var init_store_iap_connect = __esm({
|
|
|
184476
184550
|
});
|
|
184477
184551
|
|
|
184478
184552
|
// src/store-iap-screenshots.ts
|
|
184479
|
-
import { dirname as dirname52, join as join103, relative as
|
|
184553
|
+
import { dirname as dirname52, join as join103, relative as relative22 } from "node:path";
|
|
184480
184554
|
function purchaseScreensFor(item) {
|
|
184481
184555
|
const screen = item.wix && PURCHASE_SCREENS[item.wix.entityType];
|
|
184482
184556
|
if (!screen || !item.wix) return [];
|
|
@@ -184604,7 +184678,7 @@ async function shoot(selected, run2, outDir) {
|
|
|
184604
184678
|
} catch (e2) {
|
|
184605
184679
|
return { ...report3, skipped: `could not save the screenshot: ${e2.message}` };
|
|
184606
184680
|
}
|
|
184607
|
-
return { ...report3, screenshot:
|
|
184681
|
+
return { ...report3, screenshot: relative22(dirname52(run2.manifestPath), path2) };
|
|
184608
184682
|
}
|
|
184609
184683
|
function visibleText2(html) {
|
|
184610
184684
|
return html.replace(/ | | /gi, "\xA0").replace(/&/g, "&");
|
|
@@ -184802,7 +184876,7 @@ __export(store_iap_exports, {
|
|
|
184802
184876
|
});
|
|
184803
184877
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
184804
184878
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
184805
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
184879
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync45, readFileSync as readFileSync115, realpathSync as realpathSync15, renameSync as renameSync16, rmSync as rmSync31, writeFileSync as writeFileSync41 } from "node:fs";
|
|
184806
184880
|
import { homedir as homedir13, hostname as hostname2 } from "node:os";
|
|
184807
184881
|
import { dirname as dirname53, join as join105, resolve as resolve76 } from "node:path";
|
|
184808
184882
|
function scrubDeep(value2, scrub) {
|
|
@@ -185432,7 +185506,7 @@ async function screenshotsCommand(flags, deps, out2) {
|
|
|
185432
185506
|
return report3.complete ? 0 : 1;
|
|
185433
185507
|
}
|
|
185434
185508
|
function writeBinaryFile(path2, bytes2) {
|
|
185435
|
-
|
|
185509
|
+
mkdirSync45(dirname53(path2), { recursive: true });
|
|
185436
185510
|
const partial = `${path2}.${process.pid}.partial`;
|
|
185437
185511
|
writeFileSync41(partial, bytes2);
|
|
185438
185512
|
renameSync16(partial, path2);
|
|
@@ -185494,7 +185568,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
185494
185568
|
}
|
|
185495
185569
|
function stateDir(appleAppId) {
|
|
185496
185570
|
const dir = join105(homedir13(), ".himalaya", "store-iap", appleAppId);
|
|
185497
|
-
|
|
185571
|
+
mkdirSync45(dir, { recursive: true, mode: 448 });
|
|
185498
185572
|
return dir;
|
|
185499
185573
|
}
|
|
185500
185574
|
async function confirmOnTerminal(question) {
|
|
@@ -186941,7 +187015,7 @@ __export(secrets_exports, {
|
|
|
186941
187015
|
runRemoteSecretsCommand: () => runRemoteSecretsCommand,
|
|
186942
187016
|
runSecretsCommand: () => runSecretsCommand
|
|
186943
187017
|
});
|
|
186944
|
-
import { readFileSync as
|
|
187018
|
+
import { readFileSync as readFileSync120 } from "node:fs";
|
|
186945
187019
|
function environment(value2) {
|
|
186946
187020
|
if (value2 === "preview" || value2 === "production") return value2;
|
|
186947
187021
|
throw new Error("--environment must be preview or production");
|
|
@@ -186972,7 +187046,7 @@ async function runSecretsCommand(operation, flags, io2, options = {}) {
|
|
|
186972
187046
|
io2.log(JSON.stringify(await vault.list({ app, environment: env })));
|
|
186973
187047
|
return 0;
|
|
186974
187048
|
}
|
|
186975
|
-
const value2 = options.readValue ? options.readValue() :
|
|
187049
|
+
const value2 = options.readValue ? options.readValue() : readFileSync120(0, "utf8").replace(/\r?\n$/, "");
|
|
186976
187050
|
if (operation === "set") await vault.set({ app, environment: env, name, value: value2 });
|
|
186977
187051
|
else if (operation === "rotate") await vault.rotate({ app, environment: env, name, value: value2 });
|
|
186978
187052
|
else throw new Error(`unknown secrets operation ${operation}`);
|
|
@@ -187001,7 +187075,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options) {
|
|
|
187001
187075
|
}
|
|
187002
187076
|
let body;
|
|
187003
187077
|
if (operation !== "list") {
|
|
187004
|
-
const value2 = options.readValue ? options.readValue() :
|
|
187078
|
+
const value2 = options.readValue ? options.readValue() : readFileSync120(0, "utf8").replace(/\r?\n$/, "");
|
|
187005
187079
|
body = JSON.stringify({ value: value2 });
|
|
187006
187080
|
}
|
|
187007
187081
|
const response = await (options.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
|
|
@@ -187509,7 +187583,7 @@ __export(notify_exports, {
|
|
|
187509
187583
|
runNotify: () => runNotify,
|
|
187510
187584
|
saveAdminSession: () => saveAdminSession
|
|
187511
187585
|
});
|
|
187512
|
-
import { chmodSync as chmodSync3, mkdirSync as
|
|
187586
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync46, readFileSync as readFileSync123, writeFileSync as writeFileSync43 } from "node:fs";
|
|
187513
187587
|
import { homedir as homedir14 } from "node:os";
|
|
187514
187588
|
import { dirname as dirname56, join as join111 } from "node:path";
|
|
187515
187589
|
function defaultSessionsPath() {
|
|
@@ -187517,7 +187591,7 @@ function defaultSessionsPath() {
|
|
|
187517
187591
|
}
|
|
187518
187592
|
function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
187519
187593
|
try {
|
|
187520
|
-
return JSON.parse(
|
|
187594
|
+
return JSON.parse(readFileSync123(path2, "utf8"));
|
|
187521
187595
|
} catch {
|
|
187522
187596
|
return {};
|
|
187523
187597
|
}
|
|
@@ -187525,7 +187599,7 @@ function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
|
187525
187599
|
function saveAdminSession(adminUrl, session, path2 = defaultSessionsPath()) {
|
|
187526
187600
|
const file2 = loadSessionsFile(path2);
|
|
187527
187601
|
file2.sessions = { ...file2.sessions, [adminUrl]: session };
|
|
187528
|
-
|
|
187602
|
+
mkdirSync46(dirname56(path2), { recursive: true, mode: 448 });
|
|
187529
187603
|
writeFileSync43(path2, JSON.stringify(file2, null, 2) + "\n", { mode: 384 });
|
|
187530
187604
|
try {
|
|
187531
187605
|
chmodSync3(dirname56(path2), 448);
|
|
@@ -187822,8 +187896,8 @@ __export(auth_gate_copy_exports, {
|
|
|
187822
187896
|
scanThrownMessages: () => scanThrownMessages
|
|
187823
187897
|
});
|
|
187824
187898
|
import { createHash as createHash50 } from "node:crypto";
|
|
187825
|
-
import { existsSync as existsSync104, readdirSync as readdirSync43, readFileSync as
|
|
187826
|
-
import { dirname as dirname57, join as join112, relative as
|
|
187899
|
+
import { existsSync as existsSync104, readdirSync as readdirSync43, readFileSync as readFileSync124, writeFileSync as writeFileSync44 } from "node:fs";
|
|
187900
|
+
import { dirname as dirname57, join as join112, relative as relative23, resolve as resolve79 } from "node:path";
|
|
187827
187901
|
import { fileURLToPath as fileURLToPath36 } from "node:url";
|
|
187828
187902
|
function discoverMessageSources() {
|
|
187829
187903
|
const roots2 = [
|
|
@@ -187843,7 +187917,7 @@ function discoverMessageSources() {
|
|
|
187843
187917
|
if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
|
|
187844
187918
|
visit(child);
|
|
187845
187919
|
} else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child)) {
|
|
187846
|
-
if (MESSAGE_FILE.test(
|
|
187920
|
+
if (MESSAGE_FILE.test(readFileSync124(join112(REPO_ROOT8, child), "utf8"))) out2.push(child);
|
|
187847
187921
|
}
|
|
187848
187922
|
}
|
|
187849
187923
|
};
|
|
@@ -187851,7 +187925,7 @@ function discoverMessageSources() {
|
|
|
187851
187925
|
return out2.sort();
|
|
187852
187926
|
}
|
|
187853
187927
|
function loadTable(path2 = TABLE_PATH) {
|
|
187854
|
-
const raw = JSON.parse(
|
|
187928
|
+
const raw = JSON.parse(readFileSync124(path2, "utf8"));
|
|
187855
187929
|
const out2 = {};
|
|
187856
187930
|
for (const [k2, v2] of Object.entries(raw)) {
|
|
187857
187931
|
if (k2.startsWith("_")) continue;
|
|
@@ -187925,7 +187999,7 @@ function nativeKeysPath(appDir3) {
|
|
|
187925
187999
|
function loadNativeKeys(appDir3) {
|
|
187926
188000
|
const p2 = nativeKeysPath(appDir3);
|
|
187927
188001
|
if (!existsSync104(p2)) return void 0;
|
|
187928
|
-
const raw = JSON.parse(
|
|
188002
|
+
const raw = JSON.parse(readFileSync124(p2, "utf8"));
|
|
187929
188003
|
if (!Array.isArray(raw.keys) || raw.keys.some((k2) => typeof k2 !== "string")) {
|
|
187930
188004
|
throw new Error(`${p2}: expected { "keys": string[] }`);
|
|
187931
188005
|
}
|
|
@@ -187934,7 +188008,7 @@ function loadNativeKeys(appDir3) {
|
|
|
187934
188008
|
function loadAppTable(appDir3) {
|
|
187935
188009
|
const p2 = join112(appDir3, "strings", "en.json");
|
|
187936
188010
|
if (!existsSync104(p2)) return {};
|
|
187937
|
-
const raw = JSON.parse(
|
|
188011
|
+
const raw = JSON.parse(readFileSync124(p2, "utf8"));
|
|
187938
188012
|
const out2 = {};
|
|
187939
188013
|
for (const [k2, v2] of Object.entries(raw)) if (!k2.startsWith("_") && typeof v2 === "string") out2[k2] = v2;
|
|
187940
188014
|
return out2;
|
|
@@ -188123,14 +188197,14 @@ function looksLikeCopy(text13) {
|
|
|
188123
188197
|
return /^[A-Z][a-z]/.test(t2);
|
|
188124
188198
|
}
|
|
188125
188199
|
function loadAllow(section3, path2 = ALLOW_PATH) {
|
|
188126
|
-
const raw = JSON.parse(
|
|
188200
|
+
const raw = JSON.parse(readFileSync124(path2, "utf8"));
|
|
188127
188201
|
const list2 = raw[section3] ?? [];
|
|
188128
188202
|
for (const e2 of list2) {
|
|
188129
188203
|
if (!e2.file || !e2.text || !e2.reason) throw new Error(`allowlist entry missing file/text/reason: ${JSON.stringify(e2)}`);
|
|
188130
188204
|
}
|
|
188131
188205
|
return list2;
|
|
188132
188206
|
}
|
|
188133
|
-
function scanProse(files, allow = [], read = (rel) =>
|
|
188207
|
+
function scanProse(files, allow = [], read = (rel) => readFileSync124(join112(REPO_ROOT8, rel), "utf8")) {
|
|
188134
188208
|
const hits = [];
|
|
188135
188209
|
const usedAllow = /* @__PURE__ */ new Set();
|
|
188136
188210
|
for (const file2 of files) {
|
|
@@ -188154,12 +188228,12 @@ function expectedOutputs(table = loadTable()) {
|
|
|
188154
188228
|
{ path: KOTLIN_OUT, content: renderKotlin(table) }
|
|
188155
188229
|
];
|
|
188156
188230
|
for (const p2 of appSourceCatalogs()) {
|
|
188157
|
-
const committed = JSON.parse(
|
|
188231
|
+
const committed = JSON.parse(readFileSync124(p2, "utf8"));
|
|
188158
188232
|
out2.push({ path: p2, content: serializeCatalog(injectAllNativeRows(committed, dirname57(dirname57(p2)), table)) });
|
|
188159
188233
|
}
|
|
188160
188234
|
return out2;
|
|
188161
188235
|
}
|
|
188162
|
-
function scanThrownMessages(files, read = (rel) =>
|
|
188236
|
+
function scanThrownMessages(files, read = (rel) => readFileSync124(join112(REPO_ROOT8, rel), "utf8")) {
|
|
188163
188237
|
const out2 = [];
|
|
188164
188238
|
for (const file2 of files) {
|
|
188165
188239
|
const src = read(file2);
|
|
@@ -188255,7 +188329,7 @@ var init_auth_gate_copy = __esm({
|
|
|
188255
188329
|
});
|
|
188256
188330
|
|
|
188257
188331
|
// ../l10n/extract.ts
|
|
188258
|
-
import { resolve as resolve80, join as join113, relative as
|
|
188332
|
+
import { resolve as resolve80, join as join113, relative as relative24, dirname as dirname58 } from "node:path";
|
|
188259
188333
|
import { createHash as createHash51 } from "node:crypto";
|
|
188260
188334
|
import { fileURLToPath as fileURLToPath37 } from "node:url";
|
|
188261
188335
|
function keyOf(source) {
|
|
@@ -188640,7 +188714,7 @@ __export(base44_adopt_exports, {
|
|
|
188640
188714
|
renderAdoptModule: () => renderAdoptModule,
|
|
188641
188715
|
runBase44Adopt: () => runBase44Adopt
|
|
188642
188716
|
});
|
|
188643
|
-
import { existsSync as existsSync106, readFileSync as
|
|
188717
|
+
import { existsSync as existsSync106, readFileSync as readFileSync126, writeFileSync as writeFileSync46 } from "node:fs";
|
|
188644
188718
|
import { join as join115, resolve as resolve82 } from "node:path";
|
|
188645
188719
|
function prop(entity, key3) {
|
|
188646
188720
|
const props2 = entity.schema?.properties;
|
|
@@ -188735,7 +188809,7 @@ function runBase44Adopt(opts) {
|
|
|
188735
188809
|
const bookPath = join115(bookDir, "book.json");
|
|
188736
188810
|
let book;
|
|
188737
188811
|
try {
|
|
188738
|
-
book = JSON.parse(
|
|
188812
|
+
book = JSON.parse(readFileSync126(bookPath, "utf8"));
|
|
188739
188813
|
if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
|
|
188740
188814
|
} catch (e2) {
|
|
188741
188815
|
throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
|
|
@@ -189000,7 +189074,7 @@ __export(generate_exports, {
|
|
|
189000
189074
|
writeGenerated: () => writeGenerated
|
|
189001
189075
|
});
|
|
189002
189076
|
import { createHash as createHash52 } from "node:crypto";
|
|
189003
|
-
import { existsSync as existsSync107, mkdirSync as
|
|
189077
|
+
import { existsSync as existsSync107, mkdirSync as mkdirSync48, readdirSync as readdirSync45, readFileSync as readFileSync127, writeFileSync as writeFileSync47 } from "node:fs";
|
|
189004
189078
|
import { dirname as dirname60, join as join116 } from "node:path";
|
|
189005
189079
|
function withHeader(body) {
|
|
189006
189080
|
return `${GENERATED_HEADER}${sha2566(body)}
|
|
@@ -189129,13 +189203,13 @@ function writeGenerated(dir, files, opts = {}) {
|
|
|
189129
189203
|
let outcome;
|
|
189130
189204
|
if (!existsSync107(abs)) outcome = "written";
|
|
189131
189205
|
else {
|
|
189132
|
-
const cur =
|
|
189206
|
+
const cur = readFileSync127(abs, "utf8");
|
|
189133
189207
|
if (cur === next) outcome = "unchanged";
|
|
189134
189208
|
else if (isEdited(cur) && !opts.force) outcome = "skipped-edited";
|
|
189135
189209
|
else outcome = "written";
|
|
189136
189210
|
}
|
|
189137
189211
|
if (outcome === "written" && !opts.dryRun) {
|
|
189138
|
-
|
|
189212
|
+
mkdirSync48(dirname60(abs), { recursive: true });
|
|
189139
189213
|
writeFileSync47(abs, next);
|
|
189140
189214
|
}
|
|
189141
189215
|
out2.push({ path: f2.path, outcome });
|
|
@@ -189154,7 +189228,7 @@ function orphanedFiles(dir, current) {
|
|
|
189154
189228
|
}
|
|
189155
189229
|
for (const rel of candidates.sort()) {
|
|
189156
189230
|
if (keep.has(rel) || !existsSync107(join116(dir, rel))) continue;
|
|
189157
|
-
if (
|
|
189231
|
+
if (readFileSync127(join116(dir, rel), "utf8").startsWith(GENERATED_HEADER)) found.push(rel);
|
|
189158
189232
|
}
|
|
189159
189233
|
return found;
|
|
189160
189234
|
}
|
|
@@ -189193,7 +189267,7 @@ __export(base44_auth_exports, {
|
|
|
189193
189267
|
usableBase44Auth: () => usableBase44Auth,
|
|
189194
189268
|
writeBase44Session: () => writeBase44Session
|
|
189195
189269
|
});
|
|
189196
|
-
import { chmodSync as chmodSync4, existsSync as existsSync108, mkdirSync as
|
|
189270
|
+
import { chmodSync as chmodSync4, existsSync as existsSync108, mkdirSync as mkdirSync49, readFileSync as readFileSync128, rmSync as rmSync33, writeFileSync as writeFileSync48 } from "node:fs";
|
|
189197
189271
|
import { homedir as homedir15 } from "node:os";
|
|
189198
189272
|
import { dirname as dirname61, join as join117 } from "node:path";
|
|
189199
189273
|
function base44ApiBase(env = process.env) {
|
|
@@ -189206,7 +189280,7 @@ function readBase44Session(home) {
|
|
|
189206
189280
|
const p2 = base44SessionPath(home);
|
|
189207
189281
|
if (!existsSync108(p2)) return void 0;
|
|
189208
189282
|
try {
|
|
189209
|
-
const s2 = JSON.parse(
|
|
189283
|
+
const s2 = JSON.parse(readFileSync128(p2, "utf8"));
|
|
189210
189284
|
return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
|
|
189211
189285
|
} catch {
|
|
189212
189286
|
return void 0;
|
|
@@ -189214,7 +189288,7 @@ function readBase44Session(home) {
|
|
|
189214
189288
|
}
|
|
189215
189289
|
function writeBase44Session(session, home) {
|
|
189216
189290
|
const p2 = base44SessionPath(home);
|
|
189217
|
-
|
|
189291
|
+
mkdirSync49(dirname61(p2), { recursive: true, mode: 448 });
|
|
189218
189292
|
writeFileSync48(p2, `${JSON.stringify(session, null, 2)}
|
|
189219
189293
|
`, { mode: 384 });
|
|
189220
189294
|
chmodSync4(p2, 384);
|
|
@@ -189326,7 +189400,7 @@ function hasBase44WriteScope(auth) {
|
|
|
189326
189400
|
function importBase44CliSession(home = homedir15(), env = process.env) {
|
|
189327
189401
|
const src = join117(home, ".base44", "auth", "auth.json");
|
|
189328
189402
|
if (!existsSync108(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
189329
|
-
const a2 = JSON.parse(
|
|
189403
|
+
const a2 = JSON.parse(readFileSync128(src, "utf8"));
|
|
189330
189404
|
if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
|
|
189331
189405
|
const session = {
|
|
189332
189406
|
accessToken: a2.accessToken,
|
|
@@ -189425,14 +189499,14 @@ __export(seed_exports, {
|
|
|
189425
189499
|
seedBase44Entities: () => seedBase44Entities,
|
|
189426
189500
|
writeBase44SeedRows: () => writeBase44SeedRows
|
|
189427
189501
|
});
|
|
189428
|
-
import { existsSync as existsSync109, readFileSync as
|
|
189502
|
+
import { existsSync as existsSync109, readFileSync as readFileSync129, writeFileSync as writeFileSync49 } from "node:fs";
|
|
189429
189503
|
import { join as join118 } from "node:path";
|
|
189430
189504
|
function readBase44SeedFile(dir) {
|
|
189431
189505
|
const file2 = join118(dir, BASE44_SEED_FILE);
|
|
189432
189506
|
if (!existsSync109(file2)) return {};
|
|
189433
189507
|
let parsed;
|
|
189434
189508
|
try {
|
|
189435
|
-
parsed = JSON.parse(
|
|
189509
|
+
parsed = JSON.parse(readFileSync129(file2, "utf8"));
|
|
189436
189510
|
} catch (e2) {
|
|
189437
189511
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Fix or delete it.`);
|
|
189438
189512
|
}
|
|
@@ -189592,7 +189666,7 @@ function writeBase44SeedRows(opts) {
|
|
|
189592
189666
|
if (existsSync109(path2)) {
|
|
189593
189667
|
let parsed;
|
|
189594
189668
|
try {
|
|
189595
|
-
parsed = JSON.parse(
|
|
189669
|
+
parsed = JSON.parse(readFileSync129(path2, "utf8"));
|
|
189596
189670
|
} catch (e2) {
|
|
189597
189671
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it.`);
|
|
189598
189672
|
}
|
|
@@ -189946,7 +190020,7 @@ __export(functions_exports2, {
|
|
|
189946
190020
|
markerContent: () => markerContent,
|
|
189947
190021
|
readFunctionSource: () => readFunctionSource
|
|
189948
190022
|
});
|
|
189949
|
-
import { existsSync as existsSync110, lstatSync as
|
|
190023
|
+
import { existsSync as existsSync110, lstatSync as lstatSync28 } from "node:fs";
|
|
189950
190024
|
import { join as join119 } from "node:path";
|
|
189951
190025
|
function markerContent(app) {
|
|
189952
190026
|
return `${JSON.stringify({ app, by: "himi" })}
|
|
@@ -189955,7 +190029,7 @@ function markerContent(app) {
|
|
|
189955
190029
|
function readFunctionSource(appDir3, name, app) {
|
|
189956
190030
|
const rel = `base44/functions/${name}/`;
|
|
189957
190031
|
const folder = join119(appDir3, "base44", "functions", name);
|
|
189958
|
-
if (!existsSync110(folder) || !
|
|
190032
|
+
if (!existsSync110(folder) || !lstatSync28(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel}`);
|
|
189959
190033
|
const { entries, skipped } = collectAppSource(folder);
|
|
189960
190034
|
if (skipped.length) throw new FunctionSourceError("function_source_unsafe", `${rel} holds paths himi will not upload (symlinks or denied names): ${skipped.join(", ")} \u2014 remove them`);
|
|
189961
190035
|
const secrets = secretFindings(entries);
|
|
@@ -190296,7 +190370,7 @@ __export(apply_exports, {
|
|
|
190296
190370
|
createBase44Entities: () => createBase44Entities,
|
|
190297
190371
|
fileLedger: () => fileLedger
|
|
190298
190372
|
});
|
|
190299
|
-
import { existsSync as existsSync111, readFileSync as
|
|
190373
|
+
import { existsSync as existsSync111, readFileSync as readFileSync130, writeFileSync as writeFileSync50 } from "node:fs";
|
|
190300
190374
|
import { join as join120 } from "node:path";
|
|
190301
190375
|
function fileLedger(dir, appId2) {
|
|
190302
190376
|
const path2 = join120(dir, LEDGER_FILE2);
|
|
@@ -190304,7 +190378,7 @@ function fileLedger(dir, appId2) {
|
|
|
190304
190378
|
if (!existsSync111(path2)) return {};
|
|
190305
190379
|
let v2;
|
|
190306
190380
|
try {
|
|
190307
|
-
v2 = JSON.parse(
|
|
190381
|
+
v2 = JSON.parse(readFileSync130(path2, "utf8"));
|
|
190308
190382
|
} catch (e2) {
|
|
190309
190383
|
throw new LedgerError(`${LEDGER_FILE2} is not valid JSON (${e2.message}) \u2014 fix it (a merge conflict?) rather than let himi rewrite it`);
|
|
190310
190384
|
}
|
|
@@ -190956,11 +191030,11 @@ var init_analyze = __esm({
|
|
|
190956
191030
|
});
|
|
190957
191031
|
|
|
190958
191032
|
// src/base44-analyze/write-artifacts.ts
|
|
190959
|
-
import { existsSync as existsSync112, mkdirSync as
|
|
190960
|
-
import { dirname as dirname62, join as join121, resolve as resolve83, sep as
|
|
191033
|
+
import { existsSync as existsSync112, mkdirSync as mkdirSync50, readFileSync as readFileSync131, rmSync as rmSync34, writeFileSync as writeFileSync51 } from "node:fs";
|
|
191034
|
+
import { dirname as dirname62, join as join121, resolve as resolve83, sep as sep23 } from "node:path";
|
|
190961
191035
|
function isBookFolder(dir) {
|
|
190962
191036
|
try {
|
|
190963
|
-
return JSON.parse(
|
|
191037
|
+
return JSON.parse(readFileSync131(join121(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
190964
191038
|
} catch {
|
|
190965
191039
|
return false;
|
|
190966
191040
|
}
|
|
@@ -191052,12 +191126,12 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
191052
191126
|
if (!isBookFolder(out2)) throw new Error(`refusing to write the app book into ${out2}: it already has ${owned.join(", ")} that ${owned.length === 1 ? "is" : "are"} not from an app book \u2014 pick an empty --out`);
|
|
191053
191127
|
for (const d2 of ["source", "screenshots"]) rmSync34(join121(out2, d2), { recursive: true, force: true });
|
|
191054
191128
|
}
|
|
191055
|
-
|
|
191129
|
+
mkdirSync50(out2, { recursive: true });
|
|
191056
191130
|
writeFileSync51(join121(out2, "book.json"), json8);
|
|
191057
191131
|
writeFileSync51(join121(out2, "BOOK.md"), md);
|
|
191058
191132
|
files.push("book.json", "BOOK.md");
|
|
191059
191133
|
for (const s2 of shots) {
|
|
191060
|
-
|
|
191134
|
+
mkdirSync50(join121(out2, "screenshots"), { recursive: true });
|
|
191061
191135
|
writeFileSync51(join121(out2, "screenshots", s2.filename), s2.bytes);
|
|
191062
191136
|
files.push(`screenshots/${s2.filename}`);
|
|
191063
191137
|
}
|
|
@@ -191065,8 +191139,8 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
191065
191139
|
for (const f2 of result.sourceFiles) {
|
|
191066
191140
|
if (!safeRel(f2.path)) continue;
|
|
191067
191141
|
const dest = join121(sourceRoot, ...f2.path.split("/"));
|
|
191068
|
-
if (!dest.startsWith(sourceRoot +
|
|
191069
|
-
|
|
191142
|
+
if (!dest.startsWith(sourceRoot + sep23)) continue;
|
|
191143
|
+
mkdirSync50(dirname62(dest), { recursive: true });
|
|
191070
191144
|
writeFileSync51(dest, f2.bytes);
|
|
191071
191145
|
}
|
|
191072
191146
|
if (result.sourceFiles.length) files.push(`source/ (${result.sourceFiles.length} files)`);
|
|
@@ -194613,7 +194687,7 @@ __export(cli_exports, {
|
|
|
194613
194687
|
systemTar: () => systemTar
|
|
194614
194688
|
});
|
|
194615
194689
|
import { execFile as execFile2 } from "node:child_process";
|
|
194616
|
-
import { mkdirSync as
|
|
194690
|
+
import { mkdirSync as mkdirSync51, mkdtempSync as mkdtempSync11, rmSync as rmSync35, writeFileSync as writeFileSync52 } from "node:fs";
|
|
194617
194691
|
import { tmpdir as tmpdir12 } from "node:os";
|
|
194618
194692
|
import { join as join122, resolve as resolve84 } from "node:path";
|
|
194619
194693
|
import { promisify } from "node:util";
|
|
@@ -194634,7 +194708,7 @@ function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
|
194634
194708
|
const archive = join122(root, "project.tar");
|
|
194635
194709
|
const dir = join122(root, "project");
|
|
194636
194710
|
writeFileSync52(archive, bytes2);
|
|
194637
|
-
|
|
194711
|
+
mkdirSync51(dir);
|
|
194638
194712
|
await extract(archive, dir);
|
|
194639
194713
|
return { dir, cleanup };
|
|
194640
194714
|
} catch (e2) {
|
|
@@ -195878,7 +195952,7 @@ var init_invite_plan = __esm({
|
|
|
195878
195952
|
});
|
|
195879
195953
|
|
|
195880
195954
|
// src/one-app/payment-review.ts
|
|
195881
|
-
import { readFileSync as
|
|
195955
|
+
import { readFileSync as readFileSync132 } from "node:fs";
|
|
195882
195956
|
import { join as join124, resolve as resolve86 } from "node:path";
|
|
195883
195957
|
function initialPaymentReview(metaSiteId) {
|
|
195884
195958
|
return {
|
|
@@ -195952,7 +196026,7 @@ function runPaymentReview(args, io2) {
|
|
|
195952
196026
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
195953
196027
|
const metaSiteId = obj6(manifest2.source).metaSiteId;
|
|
195954
196028
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
195955
|
-
const review = JSON.parse(
|
|
196029
|
+
const review = JSON.parse(readFileSync132(join124(evidenceDir, "payment-review.json"), "utf8"));
|
|
195956
196030
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
195957
196031
|
if (issues.length) return fail7("payment_decision_required", issues, 1);
|
|
195958
196032
|
io2.log(JSON.stringify({ ok: true, stage: "payment-decisions-reviewed", evidenceDir, verification: "Recorded evidence and decisions checked; merchant readiness is not independently verified by this command." }));
|
|
@@ -196136,7 +196210,7 @@ __export(validate_identity_exports, {
|
|
|
196136
196210
|
runOneAppIdentityValidation: () => runOneAppIdentityValidation
|
|
196137
196211
|
});
|
|
196138
196212
|
import { createHash as createHash55 } from "node:crypto";
|
|
196139
|
-
import { existsSync as existsSync114, readFileSync as
|
|
196213
|
+
import { existsSync as existsSync114, readFileSync as readFileSync133 } from "node:fs";
|
|
196140
196214
|
import { join as join125, resolve as resolve87 } from "node:path";
|
|
196141
196215
|
function ricosTexts(documentJson) {
|
|
196142
196216
|
let root;
|
|
@@ -196193,7 +196267,7 @@ function literalSlugFindings(slug, displayName3, screens, authoredText = []) {
|
|
|
196193
196267
|
}
|
|
196194
196268
|
function sourceIdentity(evidenceDir) {
|
|
196195
196269
|
const { manifest: manifest2, raw } = verifiedEvidence(evidenceDir);
|
|
196196
|
-
const bytes2 =
|
|
196270
|
+
const bytes2 = readFileSync133(join125(evidenceDir, "business-context.json"));
|
|
196197
196271
|
const hash3 = createHash55("sha256").update(bytes2).digest("hex");
|
|
196198
196272
|
if (obj7(manifest2.sha256)["business-context.json"] !== hash3) throw Error("business-context.json differs from the collected evidence.");
|
|
196199
196273
|
const name = obj7(JSON.parse(bytes2.toString("utf8"))).displayName;
|
|
@@ -196214,7 +196288,7 @@ function sourceIdentity(evidenceDir) {
|
|
|
196214
196288
|
}
|
|
196215
196289
|
const pagesPath = join125(evidenceDir, "pages-content.json");
|
|
196216
196290
|
if (existsSync114(pagesPath)) {
|
|
196217
|
-
const pagesBytes =
|
|
196291
|
+
const pagesBytes = readFileSync133(pagesPath);
|
|
196218
196292
|
if (obj7(manifest2.sha256)["pages-content.json"] !== createHash55("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
|
|
196219
196293
|
for (const document2 of obj7(JSON.parse(pagesBytes.toString("utf8"))).documents ?? []) authoredText.push(...ricosTexts(obj7(obj7(document2).page).documentJson));
|
|
196220
196294
|
}
|
|
@@ -196308,7 +196382,7 @@ __export(cli_exports2, {
|
|
|
196308
196382
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
196309
196383
|
runOneAppCommand: () => runOneAppCommand
|
|
196310
196384
|
});
|
|
196311
|
-
import { closeSync as closeSync9, constants as constants9, lstatSync as
|
|
196385
|
+
import { closeSync as closeSync9, constants as constants9, lstatSync as lstatSync29, mkdirSync as mkdirSync52, openSync as openSync8, readFileSync as readFileSync134, realpathSync as realpathSync17, writeFileSync as writeFileSync53 } from "node:fs";
|
|
196312
196386
|
import { createHash as createHash56 } from "node:crypto";
|
|
196313
196387
|
import { isIP as isIP2 } from "node:net";
|
|
196314
196388
|
import { dirname as dirname63, join as join126, parse as parse3, resolve as resolve88 } from "node:path";
|
|
@@ -196379,9 +196453,9 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
196379
196453
|
if (flags["prompt-file"] !== void 0) {
|
|
196380
196454
|
try {
|
|
196381
196455
|
const file2 = resolve88(cwd, flags["prompt-file"]);
|
|
196382
|
-
const stat2 =
|
|
196456
|
+
const stat2 = lstatSync29(file2);
|
|
196383
196457
|
if (!stat2.isFile() || stat2.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
196384
|
-
prompt =
|
|
196458
|
+
prompt = readFileSync134(file2, "utf8");
|
|
196385
196459
|
} catch {
|
|
196386
196460
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
196387
196461
|
}
|
|
@@ -196404,7 +196478,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
196404
196478
|
}
|
|
196405
196479
|
function pathExists(path2) {
|
|
196406
196480
|
try {
|
|
196407
|
-
|
|
196481
|
+
lstatSync29(path2);
|
|
196408
196482
|
return true;
|
|
196409
196483
|
} catch (error) {
|
|
196410
196484
|
if (error.code === "ENOENT") return false;
|
|
@@ -196416,7 +196490,7 @@ function assertSafeParents(path2) {
|
|
|
196416
196490
|
let current = path2;
|
|
196417
196491
|
while (current !== root) {
|
|
196418
196492
|
try {
|
|
196419
|
-
const stat2 =
|
|
196493
|
+
const stat2 = lstatSync29(current);
|
|
196420
196494
|
if (stat2.isSymbolicLink() || !stat2.isDirectory()) {
|
|
196421
196495
|
throw new OneAppError("invalid_output_path", "Choose an output parent without symlinks or non-directory components.");
|
|
196422
196496
|
}
|
|
@@ -196537,12 +196611,12 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
196537
196611
|
}
|
|
196538
196612
|
stage = "input";
|
|
196539
196613
|
try {
|
|
196540
|
-
|
|
196614
|
+
mkdirSync52(options.parentDir, { recursive: true, mode: 448 });
|
|
196541
196615
|
assertSafeParents(options.parentDir);
|
|
196542
|
-
|
|
196616
|
+
mkdirSync52(options.workspace, { mode: 448 });
|
|
196543
196617
|
if (realpathSync17(options.workspace) !== options.workspace) throw new Error("destination changed");
|
|
196544
196618
|
evidenceDir = join126(options.workspace, ".himi", "one-app");
|
|
196545
|
-
|
|
196619
|
+
mkdirSync52(evidenceDir, { recursive: true, mode: 448 });
|
|
196546
196620
|
} catch (error) {
|
|
196547
196621
|
if (error.code === "EEXIST") {
|
|
196548
196622
|
throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
@@ -198687,8 +198761,8 @@ var init_customer_build = __esm({
|
|
|
198687
198761
|
});
|
|
198688
198762
|
|
|
198689
198763
|
// src/site-analyze/apply.ts
|
|
198690
|
-
import { existsSync as existsSync115, readFileSync as
|
|
198691
|
-
import { dirname as dirname64, isAbsolute as
|
|
198764
|
+
import { existsSync as existsSync115, readFileSync as readFileSync135, writeFileSync as writeFileSync54, copyFileSync as copyFileSync2, mkdirSync as mkdirSync53, realpathSync as realpathSync18, statSync as statSync31 } from "node:fs";
|
|
198765
|
+
import { dirname as dirname64, isAbsolute as isAbsolute11, join as join127, resolve as resolve89, sep as sep24 } from "node:path";
|
|
198692
198766
|
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
198693
198767
|
function unpairedRedirectNote(overlay) {
|
|
198694
198768
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
@@ -198822,12 +198896,12 @@ function buildMergedContract(options) {
|
|
|
198822
198896
|
if (!existsSync115(committedPath)) {
|
|
198823
198897
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
198824
198898
|
}
|
|
198825
|
-
const committed = JSON.parse(
|
|
198899
|
+
const committed = JSON.parse(readFileSync135(committedPath, "utf8"));
|
|
198826
198900
|
const previousPath = join127(appDir3, LOCAL_CONTRACT_REL);
|
|
198827
198901
|
let evidenceOverlay = overlay;
|
|
198828
198902
|
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync115(previousPath)) {
|
|
198829
198903
|
try {
|
|
198830
|
-
const previous = JSON.parse(
|
|
198904
|
+
const previous = JSON.parse(readFileSync135(previousPath, "utf8"));
|
|
198831
198905
|
if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
|
|
198832
198906
|
evidenceOverlay = {
|
|
198833
198907
|
...overlay,
|
|
@@ -198844,9 +198918,9 @@ function buildMergedContract(options) {
|
|
|
198844
198918
|
const branding = merged.branding ?? {};
|
|
198845
198919
|
const staged = [];
|
|
198846
198920
|
const contained = (root, rel) => {
|
|
198847
|
-
if (
|
|
198921
|
+
if (isAbsolute11(rel)) return void 0;
|
|
198848
198922
|
const full = resolve89(root, rel);
|
|
198849
|
-
return full.startsWith(resolve89(root) +
|
|
198923
|
+
return full.startsWith(resolve89(root) + sep24) ? full : void 0;
|
|
198850
198924
|
};
|
|
198851
198925
|
const stage = (fromRel, toRel) => {
|
|
198852
198926
|
const from = contained(packageDir, fromRel);
|
|
@@ -198860,10 +198934,10 @@ function buildMergedContract(options) {
|
|
|
198860
198934
|
} catch {
|
|
198861
198935
|
return void 0;
|
|
198862
198936
|
}
|
|
198863
|
-
if (!real.startsWith(realRoot +
|
|
198937
|
+
if (!real.startsWith(realRoot + sep24)) return void 0;
|
|
198864
198938
|
try {
|
|
198865
198939
|
if (!statSync31(real).isFile()) return void 0;
|
|
198866
|
-
|
|
198940
|
+
mkdirSync53(dirname64(to2), { recursive: true });
|
|
198867
198941
|
copyFileSync2(real, to2);
|
|
198868
198942
|
} catch {
|
|
198869
198943
|
return void 0;
|
|
@@ -198877,7 +198951,7 @@ function buildMergedContract(options) {
|
|
|
198877
198951
|
if (existsSync115(facesPath)) {
|
|
198878
198952
|
let faces = [];
|
|
198879
198953
|
try {
|
|
198880
|
-
const parsed = JSON.parse(
|
|
198954
|
+
const parsed = JSON.parse(readFileSync135(facesPath, "utf8"));
|
|
198881
198955
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
198882
198956
|
} catch {
|
|
198883
198957
|
faces = [];
|
|
@@ -198901,7 +198975,7 @@ function buildMergedContract(options) {
|
|
|
198901
198975
|
const path2 = join127(packageDir, "provisioning.contract.json");
|
|
198902
198976
|
writeFileSync54(path2, body);
|
|
198903
198977
|
const localPath2 = join127(appDir3, LOCAL_CONTRACT_REL);
|
|
198904
|
-
|
|
198978
|
+
mkdirSync53(dirname64(localPath2), { recursive: true });
|
|
198905
198979
|
writeFileSync54(localPath2, body);
|
|
198906
198980
|
staged.push(localPath2);
|
|
198907
198981
|
return { path: path2, staged };
|
|
@@ -198938,7 +199012,7 @@ function staticFaqFor(overlay, overlayPath) {
|
|
|
198938
199012
|
const bookPath = join127(dirname64(resolve89(overlayPath)), "book.json");
|
|
198939
199013
|
if (!existsSync115(bookPath)) return void 0;
|
|
198940
199014
|
try {
|
|
198941
|
-
const book = JSON.parse(
|
|
199015
|
+
const book = JSON.parse(readFileSync135(bookPath, "utf8"));
|
|
198942
199016
|
const copy = book?.copy;
|
|
198943
199017
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
198944
199018
|
const pairs = deriveStaticFaq(copy.faq);
|
|
@@ -198955,7 +199029,7 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
198955
199029
|
const bookPath = join127(dirname64(resolve89(overlayPath)), "book.json");
|
|
198956
199030
|
if (!existsSync115(bookPath)) return void 0;
|
|
198957
199031
|
try {
|
|
198958
|
-
const book = JSON.parse(
|
|
199032
|
+
const book = JSON.parse(readFileSync135(bookPath, "utf8"));
|
|
198959
199033
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
198960
199034
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
198961
199035
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -198967,8 +199041,8 @@ async function applyOverlays(input) {
|
|
|
198967
199041
|
const cwd = resolve89(input.cwd);
|
|
198968
199042
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
198969
199043
|
assertKnownShell(shell);
|
|
198970
|
-
const overlay = JSON.parse(
|
|
198971
|
-
const tokens2 = JSON.parse(
|
|
199044
|
+
const overlay = JSON.parse(readFileSync135(input.overlayPath, "utf8"));
|
|
199045
|
+
const tokens2 = JSON.parse(readFileSync135(input.tokensPath, "utf8"));
|
|
198972
199046
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
198973
199047
|
if (faq !== void 0) overlay.faq = faq;
|
|
198974
199048
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -198987,7 +199061,7 @@ async function applyOverlays(input) {
|
|
|
198987
199061
|
}
|
|
198988
199062
|
const appDir3 = join127(repoRoot2, shellAppDir(shell));
|
|
198989
199063
|
const committedPath = join127(appDir3, "provisioning.json");
|
|
198990
|
-
const committedSite = existsSync115(committedPath) ? JSON.parse(
|
|
199064
|
+
const committedSite = existsSync115(committedPath) ? JSON.parse(readFileSync135(committedPath, "utf8")).site : void 0;
|
|
198991
199065
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
198992
199066
|
throw new Error(
|
|
198993
199067
|
`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.`
|
|
@@ -199029,7 +199103,7 @@ async function applyOverlays(input) {
|
|
|
199029
199103
|
let packageFaq = faq;
|
|
199030
199104
|
let packageGalleries = galleries;
|
|
199031
199105
|
if (existsSync115(pkgProv)) {
|
|
199032
|
-
const cur = JSON.parse(
|
|
199106
|
+
const cur = JSON.parse(readFileSync135(pkgProv, "utf8"));
|
|
199033
199107
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
199034
199108
|
const merged = deepMerge4(cur, overlay);
|
|
199035
199109
|
if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
|
|
@@ -199053,7 +199127,7 @@ async function applyOverlays(input) {
|
|
|
199053
199127
|
}
|
|
199054
199128
|
const pkgTokens = join127(cwd, "tokens.json");
|
|
199055
199129
|
if (existsSync115(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
199056
|
-
const cur = JSON.parse(
|
|
199130
|
+
const cur = JSON.parse(readFileSync135(pkgTokens, "utf8"));
|
|
199057
199131
|
let tokensIn = tokens2;
|
|
199058
199132
|
if (tokens2.typography) {
|
|
199059
199133
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -199080,7 +199154,7 @@ async function applyOverlays(input) {
|
|
|
199080
199154
|
const homeAction = homeRefreshActionId(shell);
|
|
199081
199155
|
const homeSrc = join127(cwd, "dev/index.ts");
|
|
199082
199156
|
if (homeAction && existsSync115(homeSrc)) {
|
|
199083
|
-
const prev =
|
|
199157
|
+
const prev = readFileSync135(homeSrc, "utf8");
|
|
199084
199158
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
199085
199159
|
let next = patched.src;
|
|
199086
199160
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -200083,7 +200157,7 @@ __export(cli_exports3, {
|
|
|
200083
200157
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
200084
200158
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
200085
200159
|
});
|
|
200086
|
-
import { existsSync as existsSync116, readFileSync as
|
|
200160
|
+
import { existsSync as existsSync116, readFileSync as readFileSync136 } from "node:fs";
|
|
200087
200161
|
import { resolve as resolve90 } from "node:path";
|
|
200088
200162
|
function applyNeedsClient(shell) {
|
|
200089
200163
|
if (shell === void 0 || !SHELL_NAMES.includes(shell)) return true;
|
|
@@ -200153,7 +200227,7 @@ async function runSiteAnalyze(opts) {
|
|
|
200153
200227
|
const prevOverlayPath = resolve90(outDir, "provisioning.overlay.json");
|
|
200154
200228
|
const prevSite = existsSync116(prevOverlayPath) ? (() => {
|
|
200155
200229
|
try {
|
|
200156
|
-
return JSON.parse(
|
|
200230
|
+
return JSON.parse(readFileSync136(prevOverlayPath, "utf8")).site;
|
|
200157
200231
|
} catch {
|
|
200158
200232
|
return void 0;
|
|
200159
200233
|
}
|
|
@@ -200172,7 +200246,7 @@ async function runSiteAnalyze(opts) {
|
|
|
200172
200246
|
}
|
|
200173
200247
|
const previousOverlay = resolve90(outDir, "provisioning.overlay.json");
|
|
200174
200248
|
carryOverGoals(
|
|
200175
|
-
existsSync116(previousOverlay) ?
|
|
200249
|
+
existsSync116(previousOverlay) ? readFileSync136(previousOverlay, "utf8") : void 0,
|
|
200176
200250
|
result.provisioningOverlay
|
|
200177
200251
|
);
|
|
200178
200252
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -200230,7 +200304,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
200230
200304
|
let source;
|
|
200231
200305
|
if (opts.sourcePath) {
|
|
200232
200306
|
const p2 = resolve90(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
200233
|
-
source =
|
|
200307
|
+
source = readFileSync136(p2, "utf8");
|
|
200234
200308
|
}
|
|
200235
200309
|
let body;
|
|
200236
200310
|
if (opts.bodyRaw != null) {
|
|
@@ -200260,7 +200334,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
200260
200334
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
200261
200335
|
if (!existsSync116(bookPath)) return void 0;
|
|
200262
200336
|
try {
|
|
200263
|
-
const book = JSON.parse(
|
|
200337
|
+
const book = JSON.parse(readFileSync136(bookPath, "utf8"));
|
|
200264
200338
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
200265
200339
|
const host = (u2) => {
|
|
200266
200340
|
try {
|
|
@@ -200518,7 +200592,7 @@ __export(site_create_exports, {
|
|
|
200518
200592
|
runSiteList: () => runSiteList,
|
|
200519
200593
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
200520
200594
|
});
|
|
200521
|
-
import { existsSync as existsSync117, readFileSync as
|
|
200595
|
+
import { existsSync as existsSync117, readFileSync as readFileSync137, writeFileSync as writeFileSync55 } from "node:fs";
|
|
200522
200596
|
import { resolve as resolvePath2 } from "node:path";
|
|
200523
200597
|
function oauthClientName(projectName) {
|
|
200524
200598
|
return `${projectName} client`;
|
|
@@ -200667,7 +200741,7 @@ async function runSiteCreate(opts) {
|
|
|
200667
200741
|
if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
|
|
200668
200742
|
return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
200669
200743
|
}
|
|
200670
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync117, readFileSync:
|
|
200744
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync117, readFileSync: readFileSync137, writeFileSync: writeFileSync55 }) {
|
|
200671
200745
|
const msid = binding2.siteId;
|
|
200672
200746
|
const path2 = resolvePath2(target);
|
|
200673
200747
|
const committed = committedShellProvisioning(path2);
|
|
@@ -201451,14 +201525,14 @@ __export(capture_exports, {
|
|
|
201451
201525
|
nativeNotConfigured: () => nativeNotConfigured,
|
|
201452
201526
|
variantWidth: () => variantWidth
|
|
201453
201527
|
});
|
|
201454
|
-
import { existsSync as existsSync118, mkdirSync as
|
|
201528
|
+
import { existsSync as existsSync118, mkdirSync as mkdirSync54, rmSync as rmSync36, writeFileSync as writeFileSync56 } from "node:fs";
|
|
201455
201529
|
import { join as join128 } from "node:path";
|
|
201456
201530
|
import { pathToFileURL as pathToFileURL10 } from "node:url";
|
|
201457
201531
|
function variantWidth(variant) {
|
|
201458
201532
|
return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
|
|
201459
201533
|
}
|
|
201460
201534
|
function frameFile(outDir, screen, variant, surface) {
|
|
201461
|
-
|
|
201535
|
+
mkdirSync54(outDir, { recursive: true });
|
|
201462
201536
|
return join128(outDir, `${screen}.${variant}.${surface}.png`);
|
|
201463
201537
|
}
|
|
201464
201538
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
@@ -201603,7 +201677,7 @@ var init_capture = __esm({
|
|
|
201603
201677
|
|
|
201604
201678
|
// src/fidelity/judge.ts
|
|
201605
201679
|
import { spawn as spawn7 } from "node:child_process";
|
|
201606
|
-
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as
|
|
201680
|
+
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync138, rmSync as rmSync37 } from "node:fs";
|
|
201607
201681
|
import { tmpdir as tmpdir13 } from "node:os";
|
|
201608
201682
|
import { basename as basename29, dirname as dirname65, join as join129, resolve as resolve91 } from "node:path";
|
|
201609
201683
|
import { fileURLToPath as fileURLToPath38 } from "node:url";
|
|
@@ -201639,8 +201713,8 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
201639
201713
|
const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
|
|
201640
201714
|
let prompt, schema;
|
|
201641
201715
|
try {
|
|
201642
|
-
prompt =
|
|
201643
|
-
schema =
|
|
201716
|
+
prompt = readFileSync138(resolve91(judgeDir, "JUDGE.md"), "utf8");
|
|
201717
|
+
schema = readFileSync138(resolve91(judgeDir, "verdict.schema.json"), "utf8");
|
|
201644
201718
|
} catch (e2) {
|
|
201645
201719
|
return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
|
|
201646
201720
|
}
|
|
@@ -201864,7 +201938,7 @@ __export(run_exports2, {
|
|
|
201864
201938
|
runFidelity: () => runFidelity,
|
|
201865
201939
|
runId: () => runId
|
|
201866
201940
|
});
|
|
201867
|
-
import { mkdirSync as
|
|
201941
|
+
import { mkdirSync as mkdirSync55, writeFileSync as writeFileSync57 } from "node:fs";
|
|
201868
201942
|
import { basename as basename30, join as join132 } from "node:path";
|
|
201869
201943
|
function runId(now = /* @__PURE__ */ new Date()) {
|
|
201870
201944
|
return now.toISOString().replace(/[-:]/g, "").replace(/\..*/, "").replace("T", "-");
|
|
@@ -201899,7 +201973,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
201899
201973
|
const run2 = opts.run ?? runId();
|
|
201900
201974
|
const dir = join132(opts.outRoot ?? join132(root, ".himi", "fidelity"), run2);
|
|
201901
201975
|
const framesDir = join132(dir, "frames");
|
|
201902
|
-
|
|
201976
|
+
mkdirSync55(framesDir, { recursive: true });
|
|
201903
201977
|
const session = opts.capture?.mockup ? void 0 : new MockupSession();
|
|
201904
201978
|
const mockup = opts.capture?.mockup ?? ((r3, s2, e2, v2, o2) => captureMockup(r3, s2, e2, v2, o2, session));
|
|
201905
201979
|
const web = opts.capture?.web ?? captureWebVariant;
|
|
@@ -202035,7 +202109,7 @@ __export(fidelity_exports, {
|
|
|
202035
202109
|
});
|
|
202036
202110
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
202037
202111
|
import { existsSync as existsSync120, realpathSync as realpathSync19 } from "node:fs";
|
|
202038
|
-
import { join as join133, relative as
|
|
202112
|
+
import { join as join133, relative as relative26, sep as sep25 } from "node:path";
|
|
202039
202113
|
function himalayaRepoRoot(dir) {
|
|
202040
202114
|
let top;
|
|
202041
202115
|
try {
|
|
@@ -202044,8 +202118,8 @@ function himalayaRepoRoot(dir) {
|
|
|
202044
202118
|
return null;
|
|
202045
202119
|
}
|
|
202046
202120
|
if (!existsSync120(join133(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
202047
|
-
const rel =
|
|
202048
|
-
return rel.startsWith(`..${
|
|
202121
|
+
const rel = relative26(realpathSync19(top), realpathSync19(dir));
|
|
202122
|
+
return rel.startsWith(`..${sep25}`) || rel === ".." ? null : top;
|
|
202049
202123
|
}
|
|
202050
202124
|
function fidelityEnvelope(report3) {
|
|
202051
202125
|
return report3.status === "fail" ? { ok: false, code: "fidelity_rows_failed", ...report3 } : { ok: true, ...report3 };
|
|
@@ -202893,7 +202967,8 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
202893
202967
|
minBinaryVersion \u2014 all named in the output.
|
|
202894
202968
|
himi dist [--app <a>] [--platform ios,android] [--release <id>] [--allow-draft] [--target <t>]
|
|
202895
202969
|
[--shell branded-lite|owner-lite|brandy|base44|player|demo-app] [--signing wix-managed|byo]
|
|
202896
|
-
[--android-signing qa-keystore|wix-keystore|debug] [--aab]
|
|
202970
|
+
[--android-signing qa-keystore|wix-keystore|debug|owner] [--aab]
|
|
202971
|
+
[--package-name <id> --google-services <file>]
|
|
202897
202972
|
[--app-name <name> --app-icon-url <url>]
|
|
202898
202973
|
[--borrow-ios-id <bundleId>] [--no-wait] [--force] [--plan]
|
|
202899
202974
|
build an INSTALLABLE QA binary (signed IPA / APK) on
|
|
@@ -202939,10 +203014,16 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
202939
203014
|
link and QR for the APK. Android only. The bundle is
|
|
202940
203015
|
signed with the Wix production key (wix-keystore, the
|
|
202941
203016
|
upload key Branded apps use; any other
|
|
202942
|
-
--android-signing is refused), the APK with the QA
|
|
203017
|
+
--android-signing but owner is refused), the APK with the QA
|
|
202943
203018
|
key. The default stays an APK only. For a Containers
|
|
202944
203019
|
app, --aab --version <x.y.z> makes that the bundle's
|
|
202945
203020
|
versionName, which Google Play shows.
|
|
203021
|
+
--aab --android-signing owner --package-name <id>
|
|
203022
|
+
--google-services <file> builds an UNSIGNED bundle
|
|
203023
|
+
under your own package name and Firebase project,
|
|
203024
|
+
for an app bound to no Wix site, with no APK beside
|
|
203025
|
+
it. Sign it before uploading. Off until a plane
|
|
203026
|
+
switches it on (501 owner_bundles_unconfigured).
|
|
202946
203027
|
--app-name / --app-icon-url (together) give the binary
|
|
202947
203028
|
a name and icon in place of the release's; the icon is
|
|
202948
203029
|
a https://static.wixstatic.com/media/<file> URL. A
|
|
@@ -204733,7 +204814,7 @@ async function functionsCommand(ctx) {
|
|
|
204733
204814
|
// src/commands/mcp.ts
|
|
204734
204815
|
init_define_HHP_CATALOG();
|
|
204735
204816
|
init_guides();
|
|
204736
|
-
import { mkdirSync as
|
|
204817
|
+
import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync33 } from "node:fs";
|
|
204737
204818
|
import { join as join78, resolve as resolve63, dirname as dirname46 } from "node:path";
|
|
204738
204819
|
init_cli_shared();
|
|
204739
204820
|
async function mcpCommand(ctx) {
|
|
@@ -204750,7 +204831,7 @@ async function mcpCommand(ctx) {
|
|
|
204750
204831
|
const dir2 = resolve63(out2);
|
|
204751
204832
|
const files2 = himiStudioPluginFiles2();
|
|
204752
204833
|
for (const f2 of files2) {
|
|
204753
|
-
|
|
204834
|
+
mkdirSync39(dirname46(join78(dir2, f2.path)), { recursive: true });
|
|
204754
204835
|
writeFileSync33(join78(dir2, f2.path), f2.text);
|
|
204755
204836
|
}
|
|
204756
204837
|
print({ ok: true, dir: dir2, files: files2.map((f2) => f2.path), next: [`claude plugin validate ${dir2}`, `claude --plugin-dir ${dir2}`] });
|
|
@@ -204766,7 +204847,7 @@ async function mcpCommand(ctx) {
|
|
|
204766
204847
|
const dir = resolve63(out2);
|
|
204767
204848
|
const files = himiPluginFiles2(skills.skillMd);
|
|
204768
204849
|
for (const f2 of files) {
|
|
204769
|
-
|
|
204850
|
+
mkdirSync39(dirname46(join78(dir, f2.path)), { recursive: true });
|
|
204770
204851
|
writeFileSync33(join78(dir, f2.path), f2.text);
|
|
204771
204852
|
}
|
|
204772
204853
|
print({ ok: true, dir, files: files.map((f2) => f2.path), next: [`claude plugin validate ${dir}`, `claude --plugin-dir ${dir}`] });
|
|
@@ -204785,7 +204866,7 @@ async function mcpCommand(ctx) {
|
|
|
204785
204866
|
// src/commands/studio.ts
|
|
204786
204867
|
init_define_HHP_CATALOG();
|
|
204787
204868
|
init_cli_shared();
|
|
204788
|
-
import { mkdirSync as
|
|
204869
|
+
import { mkdirSync as mkdirSync40, writeFileSync as writeFileSync34, existsSync as existsSync77 } from "node:fs";
|
|
204789
204870
|
import { join as join79, resolve as resolve64, basename as basename22, dirname as dirname47 } from "node:path";
|
|
204790
204871
|
async function studioCommand(ctx) {
|
|
204791
204872
|
const { io: io2, pos, flags, print } = ctx;
|
|
@@ -204799,7 +204880,7 @@ async function studioCommand(ctx) {
|
|
|
204799
204880
|
const { buildReel: buildReel2 } = await Promise.resolve().then(() => (init_studio_reel(), studio_reel_exports));
|
|
204800
204881
|
const out2 = resolve64(str3(flags.out) ?? join79(dir, ".himi", "making-of.html"));
|
|
204801
204882
|
const { html, plan } = buildReel2(dir);
|
|
204802
|
-
|
|
204883
|
+
mkdirSync40(dirname47(out2), { recursive: true });
|
|
204803
204884
|
writeFileSync34(out2, html);
|
|
204804
204885
|
const { pathToFileURL: pathToFileURL11 } = await import("node:url");
|
|
204805
204886
|
const url2 = pathToFileURL11(out2).href;
|
|
@@ -205902,7 +205983,7 @@ init_preview_surfaces();
|
|
|
205902
205983
|
init_lint_report();
|
|
205903
205984
|
import { createHash as createHash41 } from "node:crypto";
|
|
205904
205985
|
import { existsSync as existsSync90 } from "node:fs";
|
|
205905
|
-
import { join as join95, relative as
|
|
205986
|
+
import { join as join95, relative as relative21 } from "node:path";
|
|
205906
205987
|
init_owner_claim();
|
|
205907
205988
|
init_surface_lint();
|
|
205908
205989
|
init_token_lint();
|
|
@@ -205924,8 +206005,8 @@ function pushAuthHint(status, token, target, hasOwnerIssuer = true) {
|
|
|
205924
206005
|
}
|
|
205925
206006
|
async function contentVisibility(dir) {
|
|
205926
206007
|
try {
|
|
205927
|
-
const { readFileSync:
|
|
205928
|
-
const m2 = JSON.parse(
|
|
206008
|
+
const { readFileSync: readFileSync139 } = await import("node:fs");
|
|
206009
|
+
const m2 = JSON.parse(readFileSync139(join95(dir, "himalaya.content.json"), "utf8"));
|
|
205929
206010
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
205930
206011
|
} catch {
|
|
205931
206012
|
}
|
|
@@ -206119,7 +206200,7 @@ async function pushCommand(ctx) {
|
|
|
206119
206200
|
}
|
|
206120
206201
|
}
|
|
206121
206202
|
const { shellQuote: shellQuote3 } = await Promise.resolve().then(() => (init_shell_quote(), shell_quote_exports));
|
|
206122
|
-
const contentRel =
|
|
206203
|
+
const contentRel = relative21(process.cwd(), dir) || ".";
|
|
206123
206204
|
const contentArg2 = shellQuote3(contentRel);
|
|
206124
206205
|
if (onlyRaw !== void 0) {
|
|
206125
206206
|
const onlyDraft = flags.draft === true;
|
|
@@ -208622,7 +208703,7 @@ async function testflightCommand(ctx) {
|
|
|
208622
208703
|
|
|
208623
208704
|
// src/commands/dist.ts
|
|
208624
208705
|
init_define_HHP_CATALOG();
|
|
208625
|
-
import { existsSync as existsSync101 } from "node:fs";
|
|
208706
|
+
import { existsSync as existsSync101, readFileSync as readFileSync118 } from "node:fs";
|
|
208626
208707
|
import { join as join107 } from "node:path";
|
|
208627
208708
|
init_wix_owner();
|
|
208628
208709
|
init_cli_shared();
|
|
@@ -208951,6 +209032,21 @@ ${label3}`);
|
|
|
208951
209032
|
}
|
|
208952
209033
|
}
|
|
208953
209034
|
}
|
|
209035
|
+
let googleServicesJson;
|
|
209036
|
+
const googleServicesPath = str3(flags["google-services"]);
|
|
209037
|
+
if (googleServicesPath) {
|
|
209038
|
+
try {
|
|
209039
|
+
googleServicesJson = readFileSync118(googleServicesPath, "utf8");
|
|
209040
|
+
} catch {
|
|
209041
|
+
print({
|
|
209042
|
+
ok: false,
|
|
209043
|
+
error: "google_services_unreadable",
|
|
209044
|
+
code: "google_services_unreadable",
|
|
209045
|
+
message: `could not read ${googleServicesPath}`
|
|
209046
|
+
});
|
|
209047
|
+
return 1;
|
|
209048
|
+
}
|
|
209049
|
+
}
|
|
208954
209050
|
let wixAuthorization;
|
|
208955
209051
|
const testflight = str3(flags.destination) === "testflight";
|
|
208956
209052
|
const customerTestflight = str3(flags.signing)?.trim().toLowerCase() === "byo" && testflight;
|
|
@@ -208966,7 +209062,7 @@ ${label3}`);
|
|
|
208966
209062
|
});
|
|
208967
209063
|
return 1;
|
|
208968
209064
|
}
|
|
208969
|
-
} else if (flags.aab === true || testflight && app !== "himi-player") {
|
|
209065
|
+
} else if (flags.aab === true && !["owner", "unsigned"].includes(str3(flags["android-signing"])?.trim().toLowerCase() ?? "") || testflight && app !== "himi-player") {
|
|
208970
209066
|
try {
|
|
208971
209067
|
c2.assertWixAuthorizationTarget();
|
|
208972
209068
|
wixAuthorization = await accountToken();
|
|
@@ -209020,6 +209116,9 @@ ${label3}`);
|
|
|
209020
209116
|
// A Play bundle instead of an APK. The plane validates it (Android only, link destination,
|
|
209021
209117
|
// a stable key) so every caller of the route gets the same refusal.
|
|
209022
209118
|
...flags.aab === true ? { androidFormat: "aab" } : {},
|
|
209119
|
+
// An owner bundle (--android-signing owner): the plane leaves it unsigned, under this name.
|
|
209120
|
+
...str3(flags["package-name"]) ? { androidPackageName: str3(flags["package-name"]) } : {},
|
|
209121
|
+
...googleServicesJson !== void 0 ? { googleServicesJson } : {},
|
|
209023
209122
|
// The App name and icon (a Wix Media file) a Containers app's store build ships under, in place
|
|
209024
209123
|
// of the release's; a store build needs both. Sent as typed, so the plane gives the refusals.
|
|
209025
209124
|
...str3(flags["app-name"]) !== void 0 ? { appName: str3(flags["app-name"]) } : {},
|
|
@@ -209106,7 +209205,7 @@ ${label3}`);
|
|
|
209106
209205
|
const installUrl = rec.platform === "ios" ? artifact?.installPageUrl : artifact?.downloadUrl ?? artifact?.installLink;
|
|
209107
209206
|
const handoff = rec.customerAppStore;
|
|
209108
209207
|
const handoffText = typeof handoff?.status === "string" ? ` testflight ${handoff.status}${handoff.error ? ` (${handoff.error})` : ""}` : "";
|
|
209109
|
-
io2.log(` ${rec.platform} ${rec.status}${handoffText}${installUrl ? isAab ? ` .aab for Google Play (not installable) \u2192 ${installUrl}` : ` install \u2192 ${installUrl}` : ""}`);
|
|
209208
|
+
io2.log(` ${rec.platform} ${rec.status}${handoffText}${installUrl ? isAab ? ` .aab for Google Play (${rec.ownerBundle ? "UNSIGNED: sign it before uploading" : "not installable"}) \u2192 ${installUrl}` : ` install \u2192 ${installUrl}` : ""}`);
|
|
209110
209209
|
if (isAab && artifact?.apk?.downloadUrl) io2.log(` ${rec.platform} install APK (same build, QA key) \u2192 ${artifact.apk.downloadUrl}`);
|
|
209111
209210
|
if (artifact?.caveat) io2.log(` \u26A0 ${artifact.caveat}`);
|
|
209112
209211
|
}
|
|
@@ -209128,7 +209227,7 @@ ${label3}`);
|
|
|
209128
209227
|
// src/commands/login.ts
|
|
209129
209228
|
init_define_HHP_CATALOG();
|
|
209130
209229
|
init_config();
|
|
209131
|
-
import { readFileSync as
|
|
209230
|
+
import { readFileSync as readFileSync119 } from "node:fs";
|
|
209132
209231
|
init_browser_login();
|
|
209133
209232
|
init_wix_owner();
|
|
209134
209233
|
init_owner_claim();
|
|
@@ -209349,7 +209448,7 @@ async function loginCommand(ctx) {
|
|
|
209349
209448
|
const dpxPath = dpxSessionTokenPath();
|
|
209350
209449
|
let dpx;
|
|
209351
209450
|
try {
|
|
209352
|
-
dpx =
|
|
209451
|
+
dpx = readFileSync119(dpxPath, "utf8").trim();
|
|
209353
209452
|
} catch {
|
|
209354
209453
|
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` }));
|
|
209355
209454
|
return 1;
|
|
@@ -210219,7 +210318,7 @@ async function guideCommand(ctx) {
|
|
|
210219
210318
|
|
|
210220
210319
|
// src/commands/secrets.ts
|
|
210221
210320
|
init_define_HHP_CATALOG();
|
|
210222
|
-
import { readFileSync as
|
|
210321
|
+
import { readFileSync as readFileSync121 } from "node:fs";
|
|
210223
210322
|
init_cli_shared();
|
|
210224
210323
|
async function secretsCommand(ctx) {
|
|
210225
210324
|
const { io: io2, pos, flags } = ctx;
|
|
@@ -210240,7 +210339,7 @@ async function secretsCommand(ctx) {
|
|
|
210240
210339
|
const path2 = dpxSessionTokenPath();
|
|
210241
210340
|
let raw;
|
|
210242
210341
|
try {
|
|
210243
|
-
raw =
|
|
210342
|
+
raw = readFileSync121(path2, "utf8");
|
|
210244
210343
|
} catch {
|
|
210245
210344
|
io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
|
|
210246
210345
|
return 1;
|
|
@@ -210263,7 +210362,7 @@ init_schema2();
|
|
|
210263
210362
|
init_define_HHP_CATALOG();
|
|
210264
210363
|
init_cms_schema();
|
|
210265
210364
|
init_wix_owner();
|
|
210266
|
-
import { existsSync as existsSync103, readFileSync as
|
|
210365
|
+
import { existsSync as existsSync103, readFileSync as readFileSync122, writeFileSync as writeFileSync42 } from "node:fs";
|
|
210267
210366
|
import { join as join110 } from "node:path";
|
|
210268
210367
|
var FOREIGN_DETAIL_LIMIT = 25;
|
|
210269
210368
|
var MAX_COLLECTION_PAGES = 40;
|
|
@@ -210788,7 +210887,7 @@ function readSeedFile(dir) {
|
|
|
210788
210887
|
if (!existsSync103(file2)) return {};
|
|
210789
210888
|
let parsed;
|
|
210790
210889
|
try {
|
|
210791
|
-
parsed = JSON.parse(
|
|
210890
|
+
parsed = JSON.parse(readFileSync122(file2, "utf8"));
|
|
210792
210891
|
} catch (e2) {
|
|
210793
210892
|
throw new Error(`cms-seed.json is not valid JSON (${e2.message}). Fix or delete it.`);
|
|
210794
210893
|
}
|
|
@@ -210850,7 +210949,7 @@ async function writeSeedRows(opts) {
|
|
|
210850
210949
|
if (existsSync103(file2)) {
|
|
210851
210950
|
let parsed;
|
|
210852
210951
|
try {
|
|
210853
|
-
parsed = JSON.parse(
|
|
210952
|
+
parsed = JSON.parse(readFileSync122(file2, "utf8"));
|
|
210854
210953
|
} catch (e2) {
|
|
210855
210954
|
throw new Error(
|
|
210856
210955
|
`cms-seed.json is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it. Fix the JSON, or delete the file if you want a fresh set.`
|
|
@@ -211176,10 +211275,10 @@ import {
|
|
|
211176
211275
|
constants as constants8,
|
|
211177
211276
|
existsSync as existsSync105,
|
|
211178
211277
|
fstatSync as fstatSync2,
|
|
211179
|
-
lstatSync as
|
|
211180
|
-
mkdirSync as
|
|
211278
|
+
lstatSync as lstatSync27,
|
|
211279
|
+
mkdirSync as mkdirSync47,
|
|
211181
211280
|
openSync as openSync7,
|
|
211182
|
-
readFileSync as
|
|
211281
|
+
readFileSync as readFileSync125,
|
|
211183
211282
|
readdirSync as readdirSync44,
|
|
211184
211283
|
realpathSync as realpathSync16,
|
|
211185
211284
|
renameSync as renameSync17,
|
|
@@ -211187,20 +211286,20 @@ import {
|
|
|
211187
211286
|
statSync as statSync30,
|
|
211188
211287
|
writeFileSync as writeFileSync45
|
|
211189
211288
|
} from "node:fs";
|
|
211190
|
-
import { basename as basename28, dirname as dirname59, join as join114, relative as
|
|
211289
|
+
import { basename as basename28, dirname as dirname59, join as join114, relative as relative25, resolve as resolve81 } from "node:path";
|
|
211191
211290
|
var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
|
|
211192
211291
|
var MESSAGES_FILE = /^messages_(.+)\.json$/;
|
|
211193
211292
|
var UnsafePath = class extends Error {
|
|
211194
211293
|
};
|
|
211195
211294
|
var isUnsafe2 = (e2) => e2 instanceof UnsafePath || e2?.code === "ELOOP";
|
|
211196
211295
|
function readRegularFile(path2) {
|
|
211197
|
-
const st2 =
|
|
211296
|
+
const st2 = lstatSync27(path2);
|
|
211198
211297
|
if (st2.isSymbolicLink()) throw new UnsafePath(`${path2} is a symbolic link`);
|
|
211199
211298
|
if (!st2.isFile()) throw new Error(`${path2} is not a regular file`);
|
|
211200
211299
|
const fd = openSync7(path2, constants8.O_RDONLY | (constants8.O_NOFOLLOW ?? 0));
|
|
211201
211300
|
try {
|
|
211202
211301
|
if (!fstatSync2(fd).isFile()) throw new Error(`${path2} is not a regular file`);
|
|
211203
|
-
return
|
|
211302
|
+
return readFileSync125(fd);
|
|
211204
211303
|
} finally {
|
|
211205
211304
|
closeSync8(fd);
|
|
211206
211305
|
}
|
|
@@ -211209,7 +211308,7 @@ function unsafeDestination(appDir3, tags) {
|
|
|
211209
211308
|
const l10nDir = join114(appDir3, "l10n");
|
|
211210
211309
|
for (const path2 of [l10nDir, ...tags.map((t2) => join114(l10nDir, `${t2}.json`))]) {
|
|
211211
211310
|
try {
|
|
211212
|
-
if (
|
|
211311
|
+
if (lstatSync27(path2).isSymbolicLink()) return `${relative25(process.cwd(), path2)} is a symbolic link`;
|
|
211213
211312
|
} catch (e2) {
|
|
211214
211313
|
const code = e2.code;
|
|
211215
211314
|
if (code !== "ENOENT" && code !== "ENOTDIR") throw e2;
|
|
@@ -211314,27 +211413,27 @@ async function l10nCommand(ctx) {
|
|
|
211314
211413
|
buf = readRegularFile(path2);
|
|
211315
211414
|
} catch (e2) {
|
|
211316
211415
|
if (isUnsafe2(e2)) {
|
|
211317
|
-
return fail7("unsafe_path", { error: `${
|
|
211416
|
+
return fail7("unsafe_path", { error: `${relative25(process.cwd(), path2)} is a symbolic link \u2014 the import does not follow links in the messages directory`, file: path2, hint: "copy the real file into the directory, or point <dir> at where the files actually live" }, 1);
|
|
211318
211417
|
}
|
|
211319
|
-
return fail7("messages_unreadable", { error: `${
|
|
211418
|
+
return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
|
|
211320
211419
|
}
|
|
211321
211420
|
const text13 = buf.toString("utf8");
|
|
211322
211421
|
const utf16Bom = buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
|
|
211323
211422
|
if (utf16Bom || buf.includes(0) || Buffer.compare(Buffer.from(text13, "utf8"), buf) !== 0) {
|
|
211324
|
-
return fail7("messages_not_utf8", { error: `${
|
|
211423
|
+
return fail7("messages_not_utf8", { error: `${relative25(process.cwd(), path2)} is not valid UTF-8`, file: path2, hint: "re-encode the file as UTF-8 (UTF-16 exports are the usual cause)" }, 1);
|
|
211325
211424
|
}
|
|
211326
211425
|
let parsed;
|
|
211327
211426
|
try {
|
|
211328
211427
|
parsed = JSON.parse(text13.replace(/^\uFEFF/, ""));
|
|
211329
211428
|
} catch (e2) {
|
|
211330
|
-
return fail7("messages_unreadable", { error: `${
|
|
211429
|
+
return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
|
|
211331
211430
|
}
|
|
211332
211431
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
211333
|
-
return fail7("messages_unreadable", { error: `${
|
|
211432
|
+
return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)} is not an object of key \u2192 message`, file: path2 }, 1);
|
|
211334
211433
|
}
|
|
211335
211434
|
const bad2 = Object.entries(parsed).filter(([, v2]) => typeof v2 !== "string").map(([k2]) => k2);
|
|
211336
211435
|
if (bad2.length > 0) {
|
|
211337
|
-
return fail7("messages_unreadable", { error: `${
|
|
211436
|
+
return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)} has non-string values`, file: path2, keys: bad2.slice(0, 5) }, 1);
|
|
211338
211437
|
}
|
|
211339
211438
|
files[tag] = parsed;
|
|
211340
211439
|
}
|
|
@@ -211344,7 +211443,7 @@ async function l10nCommand(ctx) {
|
|
|
211344
211443
|
try {
|
|
211345
211444
|
unsafe2 = unsafeDestination(appDir3, requested);
|
|
211346
211445
|
} catch (e2) {
|
|
211347
|
-
return fail7("catalog_write_failed", { error: `cannot inspect ${
|
|
211446
|
+
return fail7("catalog_write_failed", { error: `cannot inspect ${relative25(process.cwd(), join114(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
|
|
211348
211447
|
}
|
|
211349
211448
|
if (unsafe2 !== void 0) {
|
|
211350
211449
|
return fail7("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
|
|
@@ -211360,7 +211459,7 @@ async function l10nCommand(ctx) {
|
|
|
211360
211459
|
existing[tag] = parsed;
|
|
211361
211460
|
} catch (e2) {
|
|
211362
211461
|
return fail7("catalog_unreadable", {
|
|
211363
|
-
error: `existing catalog ${
|
|
211462
|
+
error: `existing catalog ${relative25(process.cwd(), path2)} cannot be parsed \u2014 refusing to overwrite it`,
|
|
211364
211463
|
file: path2,
|
|
211365
211464
|
cause: e2.message
|
|
211366
211465
|
}, 1);
|
|
@@ -211419,7 +211518,7 @@ async function l10nCommand(ctx) {
|
|
|
211419
211518
|
}
|
|
211420
211519
|
const written = [];
|
|
211421
211520
|
try {
|
|
211422
|
-
|
|
211521
|
+
mkdirSync47(join114(appDir3, "l10n"), { recursive: true });
|
|
211423
211522
|
const swapped = unsafeDestination(appDir3, requested);
|
|
211424
211523
|
const l10nReal = realpathSync16(join114(appDir3, "l10n"));
|
|
211425
211524
|
if (swapped !== void 0 || l10nReal !== join114(realpathSync16(appDir3), "l10n")) {
|
|
@@ -211428,7 +211527,7 @@ async function l10nCommand(ctx) {
|
|
|
211428
211527
|
for (const tag of requested) {
|
|
211429
211528
|
const path2 = join114(appDir3, "l10n", `${tag}.json`);
|
|
211430
211529
|
writeCatalog(path2, JSON.stringify(catalogs[tag], null, 2) + "\n");
|
|
211431
|
-
written.push({ tag, path:
|
|
211530
|
+
written.push({ tag, path: relative25(process.cwd(), path2), count: Object.keys(catalogs[tag].messages).length });
|
|
211432
211531
|
}
|
|
211433
211532
|
} catch (e2) {
|
|
211434
211533
|
if (isUnsafe2(e2)) return fail7("unsafe_path", { error: `${e2.message} \u2014 nothing more was written`, written }, 1);
|