@wix/himalaya-cli 0.1370.0 → 0.1372.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
CHANGED
|
@@ -7706,7 +7706,6 @@ function resolveTranslation(value, catalog3, sourceCatalog) {
|
|
|
7706
7706
|
var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
|
|
7707
7707
|
var init_bindings = __esm({
|
|
7708
7708
|
"../../core/ts/src/bindings.ts"() {
|
|
7709
|
-
"use strict";
|
|
7710
7709
|
BINDING_SIGILS = ["service", "flag", "item", "t"];
|
|
7711
7710
|
BINDING_SIGIL_RE = new RegExp(
|
|
7712
7711
|
`^\\$(?:${BINDING_SIGILS.filter((s2) => s2 !== "t").join("|")})\\b|^\\$t:`
|
|
@@ -33226,7 +33225,89 @@ function wixClientIdOf(appConfigJson) {
|
|
|
33226
33225
|
if (typeof clientId !== "string" || !clientId) return { error: "no_client_id" };
|
|
33227
33226
|
return { clientId };
|
|
33228
33227
|
}
|
|
33229
|
-
|
|
33228
|
+
function isForwardableWixSessionCookie(name) {
|
|
33229
|
+
return name === "wixSession2" || name.startsWith("session3") || name === "XSRF-TOKEN" || name === "petri_ovr" || name.toLowerCase() === "svsession" || name === "wixUIDX";
|
|
33230
|
+
}
|
|
33231
|
+
function forwardableWixSessionCookies(cookieHeader) {
|
|
33232
|
+
const pairs = (cookieHeader ?? "").split(/;\s*/).filter((pair) => {
|
|
33233
|
+
const eq = pair.indexOf("=");
|
|
33234
|
+
return eq > 0 && isForwardableWixSessionCookie(pair.slice(0, eq).trim());
|
|
33235
|
+
});
|
|
33236
|
+
return pairs.some((pair) => pair.startsWith("wixSession2=")) ? pairs.join("; ") : "";
|
|
33237
|
+
}
|
|
33238
|
+
function wixAccountSignInUrl(postLogin) {
|
|
33239
|
+
const signIn = new URL("https://users.wix.com/signin");
|
|
33240
|
+
signIn.searchParams.set("postLogin", postLogin);
|
|
33241
|
+
return signIn.toString();
|
|
33242
|
+
}
|
|
33243
|
+
function allowedAccountTarget(method, url) {
|
|
33244
|
+
let target;
|
|
33245
|
+
try {
|
|
33246
|
+
target = new URL(url);
|
|
33247
|
+
} catch {
|
|
33248
|
+
return null;
|
|
33249
|
+
}
|
|
33250
|
+
if (target.protocol !== "https:" || target.port !== "" && target.port !== "443" || target.username || target.password) return null;
|
|
33251
|
+
const host = target.hostname.toLowerCase();
|
|
33252
|
+
const verb = method.toUpperCase();
|
|
33253
|
+
return ACCOUNT_FORWARD_ALLOWLIST.some((e2) => e2.host === host && e2.method === verb && e2.path === target.pathname) ? target : null;
|
|
33254
|
+
}
|
|
33255
|
+
function isAccountJoinCall(method, url) {
|
|
33256
|
+
const target = allowedAccountTarget(method, url);
|
|
33257
|
+
return !!target && ACCOUNT_JOIN_PATHS.has(target.pathname);
|
|
33258
|
+
}
|
|
33259
|
+
async function wixAccountCall(method, url, body, sessionCookie, fetchImpl = fetch, forwardedHeaders = {}, memberInstance) {
|
|
33260
|
+
const target = allowedAccountTarget(method, url);
|
|
33261
|
+
if (!target) throw new Error("not an allowlisted account endpoint");
|
|
33262
|
+
const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
|
|
33263
|
+
const res = await fetchImpl(target.toString(), {
|
|
33264
|
+
method: method.toUpperCase(),
|
|
33265
|
+
headers: {
|
|
33266
|
+
...forwardedHeaders,
|
|
33267
|
+
Cookie: sessionCookie,
|
|
33268
|
+
Accept: "application/json",
|
|
33269
|
+
...xsrf ? { "x-xsrf-token": xsrf } : {},
|
|
33270
|
+
...memberInstance ? { Authorization: memberInstance } : {},
|
|
33271
|
+
...body ? { "Content-Type": "application/json" } : {}
|
|
33272
|
+
},
|
|
33273
|
+
body: method.toUpperCase() === "GET" || method.toUpperCase() === "HEAD" ? void 0 : body,
|
|
33274
|
+
redirect: "manual"
|
|
33275
|
+
});
|
|
33276
|
+
return { status: res.status, body: await res.text() };
|
|
33277
|
+
}
|
|
33278
|
+
function instancePayload(instance) {
|
|
33279
|
+
const part = instance.split(".")[1];
|
|
33280
|
+
if (!part) return null;
|
|
33281
|
+
try {
|
|
33282
|
+
const b64 = part.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(part.length / 4) * 4, "=");
|
|
33283
|
+
const parsed = JSON.parse(decodeURIComponent(Array.from(atob(b64), (c2) => `%${c2.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")));
|
|
33284
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
33285
|
+
} catch {
|
|
33286
|
+
return null;
|
|
33287
|
+
}
|
|
33288
|
+
}
|
|
33289
|
+
function memberInstanceRejection(instance, metaSiteId) {
|
|
33290
|
+
const p2 = instancePayload(instance);
|
|
33291
|
+
if (!p2) return "undecodable instance";
|
|
33292
|
+
if (typeof p2.metaSiteId !== "string" || !p2.metaSiteId) return "no metaSiteId";
|
|
33293
|
+
if (p2.metaSiteId !== metaSiteId) return "instance is for another site";
|
|
33294
|
+
if (typeof p2.siteMemberId !== "string" || !p2.siteMemberId) return "no siteMemberId";
|
|
33295
|
+
if (p2.uid !== p2.siteMemberId) return "uid is not the site member";
|
|
33296
|
+
if (p2.permissions !== void 0) return "a User instance, not a Member one";
|
|
33297
|
+
return null;
|
|
33298
|
+
}
|
|
33299
|
+
function memberInstanceRefreshAt(instance, now, fallbackMs = 12e4) {
|
|
33300
|
+
const raw = instancePayload(instance)?.expirationDate;
|
|
33301
|
+
const expiry = typeof raw === "string" ? Date.parse(raw) : NaN;
|
|
33302
|
+
return Number.isFinite(expiry) ? Math.max(now, expiry - MEMBER_REFRESH_MARGIN_MS) : now + fallbackMs;
|
|
33303
|
+
}
|
|
33304
|
+
function memberInstanceRefusal(e2) {
|
|
33305
|
+
if (e2 instanceof NotSiteMember) return { status: 403, body: { error: "NotSiteMember", metaSiteId: e2.metaSiteId, reason: e2.reason } };
|
|
33306
|
+
if (e2 instanceof AccountSessionExpired) return { status: 401, body: { error: "AccountSessionExpired", metaSiteId: e2.metaSiteId, reason: e2.reason } };
|
|
33307
|
+
if (e2 instanceof SiteInstanceUnavailable) return { status: 502, body: { error: "SiteInstanceUnavailable", metaSiteId: e2.metaSiteId, reason: e2.reason } };
|
|
33308
|
+
return { status: 502, body: { error: "SiteInstanceUnavailable" } };
|
|
33309
|
+
}
|
|
33310
|
+
var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, WIX_FORWARDABLE_HEADERS, OWNER_REFRESH_MARGIN_MS, OWNER_RENEW_MIN_AGE_MS, OWNER_MINT_TIMEOUT_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache, ACCOUNT_FORWARD_ALLOWLIST, ACCOUNT_JOIN_PATHS, NotSiteMember, AccountSessionExpired, SiteInstanceUnavailable, MEMBER_REFRESH_MARGIN_MS, MEMBER_NEGATIVE_TTL_MS, MEMBER_TRANSIENT_TTL_MS, MemberInstanceCache;
|
|
33230
33311
|
var init_wix_bridge = __esm({
|
|
33231
33312
|
"../../core/serve-runtime/src/wix-bridge.ts"() {
|
|
33232
33313
|
init_sha256();
|
|
@@ -33375,6 +33456,166 @@ ${cookieHeader}`);
|
|
|
33375
33456
|
this.cache.delete(this.key(cookieHeader, limit));
|
|
33376
33457
|
}
|
|
33377
33458
|
};
|
|
33459
|
+
ACCOUNT_FORWARD_ALLOWLIST = [
|
|
33460
|
+
// My Sites (my-sites.ts)
|
|
33461
|
+
{ host: "apps.wix.com", method: "GET", path: "/_api/app-state/v1/user/state" },
|
|
33462
|
+
{ host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/businesses/recent" },
|
|
33463
|
+
{ host: "manage.wix.com", method: "POST", path: "/_serverless/mobile-apps-editor-middleware/spaces-businesses" },
|
|
33464
|
+
{ host: "apps.wix.com", method: "GET", path: "/api/v1/mobile-platform-facade/business/pending" },
|
|
33465
|
+
{ host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/pinned" },
|
|
33466
|
+
{ host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/hidden" },
|
|
33467
|
+
{ host: "apps.wix.com", method: "POST", path: "/growth/v1/business/pending/cancel" },
|
|
33468
|
+
{ host: "www.wixapis.com", method: "POST", path: OWNER_SITES_QUERY_PATH },
|
|
33469
|
+
// Site open (site-open.ts)
|
|
33470
|
+
{ host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/business" },
|
|
33471
|
+
// Join, invite, leave (join.ts)
|
|
33472
|
+
{ host: "apps.wix.com", method: "GET", path: "/clubs/api/v1/invites/details" },
|
|
33473
|
+
{ host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join/details" },
|
|
33474
|
+
{ host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites/accept" },
|
|
33475
|
+
{ host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join" },
|
|
33476
|
+
{ host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites" },
|
|
33477
|
+
{ host: "apps.wix.com", method: "DELETE", path: "/api/v1/mobile-platform-facade/members/me" }
|
|
33478
|
+
];
|
|
33479
|
+
ACCOUNT_JOIN_PATHS = /* @__PURE__ */ new Set(["/clubs/api/v1/invites/accept", "/clubs/api/v1/business/join"]);
|
|
33480
|
+
NotSiteMember = class extends Error {
|
|
33481
|
+
constructor(metaSiteId, reason) {
|
|
33482
|
+
super(`NotSiteMember(metaSiteId: ${metaSiteId}): ${reason}`);
|
|
33483
|
+
this.metaSiteId = metaSiteId;
|
|
33484
|
+
this.reason = reason;
|
|
33485
|
+
this.name = "NotSiteMember";
|
|
33486
|
+
}
|
|
33487
|
+
code = "NotSiteMember";
|
|
33488
|
+
};
|
|
33489
|
+
AccountSessionExpired = class extends Error {
|
|
33490
|
+
constructor(metaSiteId, reason) {
|
|
33491
|
+
super(`AccountSessionExpired(metaSiteId: ${metaSiteId}): ${reason}`);
|
|
33492
|
+
this.metaSiteId = metaSiteId;
|
|
33493
|
+
this.reason = reason;
|
|
33494
|
+
this.name = "AccountSessionExpired";
|
|
33495
|
+
}
|
|
33496
|
+
code = "AccountSessionExpired";
|
|
33497
|
+
};
|
|
33498
|
+
SiteInstanceUnavailable = class extends Error {
|
|
33499
|
+
constructor(metaSiteId, reason) {
|
|
33500
|
+
super(`SiteInstanceUnavailable(metaSiteId: ${metaSiteId}): ${reason}`);
|
|
33501
|
+
this.metaSiteId = metaSiteId;
|
|
33502
|
+
this.reason = reason;
|
|
33503
|
+
this.name = "SiteInstanceUnavailable";
|
|
33504
|
+
}
|
|
33505
|
+
code = "SiteInstanceUnavailable";
|
|
33506
|
+
};
|
|
33507
|
+
MEMBER_REFRESH_MARGIN_MS = 6e4;
|
|
33508
|
+
MEMBER_NEGATIVE_TTL_MS = 1e4;
|
|
33509
|
+
MEMBER_TRANSIENT_TTL_MS = 3e3;
|
|
33510
|
+
MemberInstanceCache = class {
|
|
33511
|
+
constructor(fetchImpl = fetch, mintTimeoutMs = OWNER_MINT_TIMEOUT_MS) {
|
|
33512
|
+
this.fetchImpl = fetchImpl;
|
|
33513
|
+
this.mintTimeoutMs = mintTimeoutMs;
|
|
33514
|
+
}
|
|
33515
|
+
cache = /* @__PURE__ */ new Map();
|
|
33516
|
+
inflight = /* @__PURE__ */ new Map();
|
|
33517
|
+
refusals = /* @__PURE__ */ new Map();
|
|
33518
|
+
/** Per session: bumped by `forgetSession` / `forgetRefusals`. A mint that started under an older
|
|
33519
|
+
* generation still answers its own callers, but writes nothing back — otherwise a mint in flight
|
|
33520
|
+
* across a sign-out re-caches the signed-out instance, and one in flight across a join re-caches
|
|
33521
|
+
* the `NotSiteMember` the join just made stale. */
|
|
33522
|
+
generations = /* @__PURE__ */ new Map();
|
|
33523
|
+
session(sessionCookie) {
|
|
33524
|
+
return sha256Hex(/(?:^|;\s*)wixSession2=([^;]*)/.exec(sessionCookie)?.[1] ?? sessionCookie);
|
|
33525
|
+
}
|
|
33526
|
+
key(msid, session) {
|
|
33527
|
+
return sha256Hex(`${msid}
|
|
33528
|
+
Member
|
|
33529
|
+
${session}`);
|
|
33530
|
+
}
|
|
33531
|
+
/** The site's Member instance for this session. Throws `NotSiteMember` or `SiteInstanceUnavailable`.
|
|
33532
|
+
* `force`: Wix refused the instance this cache handed out (a 401) — mint a new one. */
|
|
33533
|
+
async instance(msid, sessionCookie, opts = {}) {
|
|
33534
|
+
const now = opts.now ?? Date.now();
|
|
33535
|
+
const session = this.session(sessionCookie);
|
|
33536
|
+
const key2 = this.key(msid, session);
|
|
33537
|
+
const generation = this.generations.get(session) ?? 0;
|
|
33538
|
+
const pending = this.inflight.get(key2);
|
|
33539
|
+
if (pending && pending.generation === generation) return (await pending.mint).instance;
|
|
33540
|
+
const refused2 = this.refusals.get(key2);
|
|
33541
|
+
if (refused2 && refused2.until > now && !opts.force) throw refused2.error;
|
|
33542
|
+
const hit = this.cache.get(key2);
|
|
33543
|
+
if (hit && !opts.force && hit.refreshAt > now) return hit.instance;
|
|
33544
|
+
const mint = this.mint(key2, msid, sessionCookie, session, now, generation).finally(() => {
|
|
33545
|
+
if (this.inflight.get(key2)?.mint === mint) this.inflight.delete(key2);
|
|
33546
|
+
});
|
|
33547
|
+
this.inflight.set(key2, { mint, generation });
|
|
33548
|
+
return (await mint).instance;
|
|
33549
|
+
}
|
|
33550
|
+
/** Drop everything held for this session — instances and refusals alike: its sign-out or expiry
|
|
33551
|
+
* (RFC 0071 §6, sign-out purges every per-site instance). */
|
|
33552
|
+
forgetSession(sessionCookie) {
|
|
33553
|
+
const session = this.session(sessionCookie);
|
|
33554
|
+
for (const [key2, entry] of this.cache) if (entry.session === session) this.cache.delete(key2);
|
|
33555
|
+
this.forgetRefusals(sessionCookie);
|
|
33556
|
+
}
|
|
33557
|
+
/** Drop every refusal held for this session — after a join, which makes them stale. */
|
|
33558
|
+
forgetRefusals(sessionCookie) {
|
|
33559
|
+
const session = this.session(sessionCookie);
|
|
33560
|
+
this.generations.set(session, (this.generations.get(session) ?? 0) + 1);
|
|
33561
|
+
for (const [key2, refusal] of this.refusals) if (refusal.session === session) this.refusals.delete(key2);
|
|
33562
|
+
}
|
|
33563
|
+
async mint(key2, msid, sessionCookie, session, now, generation) {
|
|
33564
|
+
const current = () => (this.generations.get(session) ?? 0) === generation;
|
|
33565
|
+
const refuse7 = (error, ttl2) => {
|
|
33566
|
+
if (!current()) throw error;
|
|
33567
|
+
this.cache.delete(key2);
|
|
33568
|
+
this.refusals.set(key2, { error, until: now + ttl2, session });
|
|
33569
|
+
throw error;
|
|
33570
|
+
};
|
|
33571
|
+
const abort = new AbortController();
|
|
33572
|
+
let timer;
|
|
33573
|
+
const timedOut = new Promise((_2, reject) => {
|
|
33574
|
+
timer = setTimeout(() => {
|
|
33575
|
+
abort.abort();
|
|
33576
|
+
reject(new Error(`timed out after ${this.mintTimeoutMs}ms`));
|
|
33577
|
+
}, this.mintTimeoutMs);
|
|
33578
|
+
});
|
|
33579
|
+
const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
|
|
33580
|
+
let status;
|
|
33581
|
+
let text9;
|
|
33582
|
+
try {
|
|
33583
|
+
const res = await Promise.race([
|
|
33584
|
+
this.fetchImpl(`${ONE_APP_SESSION}/${msid}/signed-instance?signed_instance_type=Member`, {
|
|
33585
|
+
method: "GET",
|
|
33586
|
+
headers: { Cookie: sessionCookie, Accept: "application/json", ...xsrf ? { "x-xsrf-token": xsrf } : {} },
|
|
33587
|
+
signal: abort.signal,
|
|
33588
|
+
redirect: "manual"
|
|
33589
|
+
}),
|
|
33590
|
+
timedOut
|
|
33591
|
+
]);
|
|
33592
|
+
status = res.status;
|
|
33593
|
+
text9 = await Promise.race([res.text(), timedOut]);
|
|
33594
|
+
} catch (e2) {
|
|
33595
|
+
return refuse7(new SiteInstanceUnavailable(msid, `mint failed: ${e2?.message ?? e2}`), MEMBER_TRANSIENT_TTL_MS);
|
|
33596
|
+
} finally {
|
|
33597
|
+
clearTimeout(timer);
|
|
33598
|
+
}
|
|
33599
|
+
if (status === 403 || status === 404) return refuse7(new NotSiteMember(msid, `mint refused (${status})`), MEMBER_NEGATIVE_TTL_MS);
|
|
33600
|
+
if (status === 401) return refuse7(new AccountSessionExpired(msid, `mint refused (${status})`), MEMBER_TRANSIENT_TTL_MS);
|
|
33601
|
+
let instance;
|
|
33602
|
+
try {
|
|
33603
|
+
instance = JSON.parse(text9).signedInstance;
|
|
33604
|
+
} catch {
|
|
33605
|
+
}
|
|
33606
|
+
if (status < 200 || status >= 300 || typeof instance !== "string" || !instance) {
|
|
33607
|
+
return refuse7(new SiteInstanceUnavailable(msid, `mint failed (${status})`), MEMBER_TRANSIENT_TTL_MS);
|
|
33608
|
+
}
|
|
33609
|
+
const rejection = memberInstanceRejection(instance, msid);
|
|
33610
|
+
if (rejection) return refuse7(new NotSiteMember(msid, rejection), MEMBER_NEGATIVE_TTL_MS);
|
|
33611
|
+
const entry = { instance, refreshAt: memberInstanceRefreshAt(instance, now), session };
|
|
33612
|
+
if (current()) {
|
|
33613
|
+
this.refusals.delete(key2);
|
|
33614
|
+
this.cache.set(key2, entry);
|
|
33615
|
+
}
|
|
33616
|
+
return entry;
|
|
33617
|
+
}
|
|
33618
|
+
};
|
|
33378
33619
|
}
|
|
33379
33620
|
});
|
|
33380
33621
|
|
|
@@ -34154,6 +34395,238 @@ var init_aria_realtime_dev = __esm({
|
|
|
34154
34395
|
}
|
|
34155
34396
|
});
|
|
34156
34397
|
|
|
34398
|
+
// ../../core/serve-runtime/src/wix-account.ts
|
|
34399
|
+
function unwrapString(v2) {
|
|
34400
|
+
if (typeof v2 === "string") return v2;
|
|
34401
|
+
if (v2 && typeof v2 === "object" && typeof v2.value === "string") {
|
|
34402
|
+
return v2.value;
|
|
34403
|
+
}
|
|
34404
|
+
return void 0;
|
|
34405
|
+
}
|
|
34406
|
+
function hasWixSession(cookieHeader) {
|
|
34407
|
+
return !!cookieHeader && /(?:^|;\s*)wixSession2=/.test(cookieHeader);
|
|
34408
|
+
}
|
|
34409
|
+
function normalizeWixAuthorization(raw) {
|
|
34410
|
+
if (!raw) return null;
|
|
34411
|
+
const trimmed = raw.trim();
|
|
34412
|
+
if (!trimmed) return null;
|
|
34413
|
+
const bearer = /^Bearer\s+(.+)$/i.exec(trimmed);
|
|
34414
|
+
const value = (bearer ? bearer[1] : trimmed).trim();
|
|
34415
|
+
if (!value) return null;
|
|
34416
|
+
if (/^(?:Bearer|Basic|Digest|Negotiate|NTLM)$/i.test(value)) return null;
|
|
34417
|
+
if (/^Basic\s/i.test(value)) return null;
|
|
34418
|
+
return value;
|
|
34419
|
+
}
|
|
34420
|
+
async function resolveWixAccounts(cookieHeader, fetchImpl = fetch, authorization) {
|
|
34421
|
+
const hasCookie = hasWixSession(cookieHeader);
|
|
34422
|
+
const auth = hasCookie ? null : normalizeWixAuthorization(authorization);
|
|
34423
|
+
if (!auth && !hasCookie) return { ok: false, reason: "no_session" };
|
|
34424
|
+
const cookie = cookieHeader ?? "";
|
|
34425
|
+
const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(cookie)?.[1];
|
|
34426
|
+
let res;
|
|
34427
|
+
try {
|
|
34428
|
+
res = await fetchImpl(`${ACCOUNT_SERVER}/v1/users/my_accounts`, {
|
|
34429
|
+
method: "GET",
|
|
34430
|
+
headers: auth ? { Authorization: auth, Accept: "application/json" } : {
|
|
34431
|
+
Cookie: cookie,
|
|
34432
|
+
Accept: "application/json",
|
|
34433
|
+
...xsrf ? { "x-xsrf-token": xsrf } : {}
|
|
34434
|
+
}
|
|
34435
|
+
});
|
|
34436
|
+
} catch (err) {
|
|
34437
|
+
return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
|
|
34438
|
+
}
|
|
34439
|
+
if (auth && res.status === 428) return resolveAccountCredential(auth, fetchImpl);
|
|
34440
|
+
if (res.status === 428 || res.status === 401 || res.status === 403) {
|
|
34441
|
+
return { ok: false, reason: "no_session" };
|
|
34442
|
+
}
|
|
34443
|
+
const text9 = await res.text();
|
|
34444
|
+
if (!res.ok) {
|
|
34445
|
+
return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
|
|
34446
|
+
}
|
|
34447
|
+
let parsed;
|
|
34448
|
+
try {
|
|
34449
|
+
parsed = JSON.parse(text9);
|
|
34450
|
+
} catch {
|
|
34451
|
+
return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
|
|
34452
|
+
}
|
|
34453
|
+
if (!parsed || !Array.isArray(parsed.accounts)) {
|
|
34454
|
+
return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_accounts_array" };
|
|
34455
|
+
}
|
|
34456
|
+
const accounts = [];
|
|
34457
|
+
for (const raw of parsed.accounts) {
|
|
34458
|
+
const account = toWixAccount(raw);
|
|
34459
|
+
if (account) accounts.push(account);
|
|
34460
|
+
}
|
|
34461
|
+
if (accounts.length === 0) return { ok: false, reason: "no_session" };
|
|
34462
|
+
return { ok: true, accounts };
|
|
34463
|
+
}
|
|
34464
|
+
function toWixAccount(raw) {
|
|
34465
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
34466
|
+
const a2 = raw;
|
|
34467
|
+
const accountId = typeof a2.accountId === "string" ? a2.accountId : void 0;
|
|
34468
|
+
if (!accountId) return void 0;
|
|
34469
|
+
return {
|
|
34470
|
+
accountId,
|
|
34471
|
+
...typeof a2.slug === "string" ? { slug: a2.slug } : {},
|
|
34472
|
+
...typeof a2.status === "string" ? { status: a2.status } : {},
|
|
34473
|
+
...typeof a2.accountOwner === "string" ? { accountOwner: a2.accountOwner } : {},
|
|
34474
|
+
...unwrapString(a2.accountName) ? { name: unwrapString(a2.accountName) } : {}
|
|
34475
|
+
};
|
|
34476
|
+
}
|
|
34477
|
+
async function resolveAccountCredential(auth, fetchImpl) {
|
|
34478
|
+
let res;
|
|
34479
|
+
try {
|
|
34480
|
+
res = await fetchImpl(`${ACCOUNT_SERVER}/v1/accounts/my_account`, {
|
|
34481
|
+
method: "GET",
|
|
34482
|
+
headers: { Authorization: auth, Accept: "application/json" }
|
|
34483
|
+
});
|
|
34484
|
+
} catch (err) {
|
|
34485
|
+
return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
|
|
34486
|
+
}
|
|
34487
|
+
if (res.status === 428 || res.status === 401 || res.status === 403 || res.status === 404) {
|
|
34488
|
+
return { ok: false, reason: "no_session" };
|
|
34489
|
+
}
|
|
34490
|
+
const text9 = await res.text();
|
|
34491
|
+
if (!res.ok) {
|
|
34492
|
+
return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
|
|
34493
|
+
}
|
|
34494
|
+
let parsed;
|
|
34495
|
+
try {
|
|
34496
|
+
parsed = JSON.parse(text9);
|
|
34497
|
+
} catch {
|
|
34498
|
+
return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
|
|
34499
|
+
}
|
|
34500
|
+
const account = toWixAccount(parsed && typeof parsed === "object" ? parsed.account : void 0);
|
|
34501
|
+
if (!account) return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_account" };
|
|
34502
|
+
return { ok: true, accounts: [account] };
|
|
34503
|
+
}
|
|
34504
|
+
var ACCOUNT_SERVER;
|
|
34505
|
+
var init_wix_account = __esm({
|
|
34506
|
+
"../../core/serve-runtime/src/wix-account.ts"() {
|
|
34507
|
+
ACCOUNT_SERVER = "https://www.wix.com/_api/account-server";
|
|
34508
|
+
}
|
|
34509
|
+
});
|
|
34510
|
+
|
|
34511
|
+
// ../../core/dev-server/src/person-session-auth.ts
|
|
34512
|
+
import { join as pathJoin } from "node:path";
|
|
34513
|
+
import { homedir as homedir5 } from "node:os";
|
|
34514
|
+
function isWixSessionExpired(token, nowMs = Date.now()) {
|
|
34515
|
+
try {
|
|
34516
|
+
const raw = token.startsWith("JWT.") ? token.slice(4) : token;
|
|
34517
|
+
const mid = raw.split(".")[1];
|
|
34518
|
+
if (!mid) return false;
|
|
34519
|
+
const payload = JSON.parse(Buffer.from(mid, "base64url").toString("utf8"));
|
|
34520
|
+
const data = typeof payload.data === "string" ? JSON.parse(payload.data) : payload.data;
|
|
34521
|
+
const wxexp = data?.wxexp;
|
|
34522
|
+
if (!wxexp || typeof wxexp !== "string") return false;
|
|
34523
|
+
const expMs = Date.parse(wxexp);
|
|
34524
|
+
if (Number.isNaN(expMs)) return false;
|
|
34525
|
+
return expMs <= nowMs;
|
|
34526
|
+
} catch {
|
|
34527
|
+
return false;
|
|
34528
|
+
}
|
|
34529
|
+
}
|
|
34530
|
+
var AUTOMATION_KEY_PATH, DPX_SESSION_PATH, DEFAULT_PERSON_EMAIL;
|
|
34531
|
+
var init_person_session_auth = __esm({
|
|
34532
|
+
"../../core/dev-server/src/person-session-auth.ts"() {
|
|
34533
|
+
AUTOMATION_KEY_PATH = pathJoin(homedir5(), ".argus", "automation_master_key");
|
|
34534
|
+
DPX_SESSION_PATH = pathJoin(homedir5(), ".dpx", "session", "wix-session");
|
|
34535
|
+
DEFAULT_PERSON_EMAIL = process.env.WIX_PERSON_SESSION_EMAIL ?? "bookingsowner@test.com";
|
|
34536
|
+
}
|
|
34537
|
+
});
|
|
34538
|
+
|
|
34539
|
+
// ../../core/dev-server/src/wix-account-session.ts
|
|
34540
|
+
import { readFileSync as readFileSync44 } from "node:fs";
|
|
34541
|
+
import { homedir as homedir6 } from "node:os";
|
|
34542
|
+
import { join as pathJoin2 } from "node:path";
|
|
34543
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
34544
|
+
function captureAccountSession(req, opts = {}) {
|
|
34545
|
+
const env = opts.env ?? process.env;
|
|
34546
|
+
const now = opts.now ?? Date.now();
|
|
34547
|
+
const live3 = (cookie) => {
|
|
34548
|
+
const ws2 = /(?:^|;\s*)wixSession2=([^;]+)/.exec(cookie)?.[1];
|
|
34549
|
+
if (!ws2) return false;
|
|
34550
|
+
let value = ws2;
|
|
34551
|
+
try {
|
|
34552
|
+
value = decodeURIComponent(ws2);
|
|
34553
|
+
} catch {
|
|
34554
|
+
}
|
|
34555
|
+
return !isWixSessionExpired(value, now);
|
|
34556
|
+
};
|
|
34557
|
+
const fromRequest = forwardableWixSessionCookies(req.headers.cookie);
|
|
34558
|
+
if (fromRequest && live3(fromRequest)) return { cookie: fromRequest, source: "cookie" };
|
|
34559
|
+
if (!opts.machineSession) return null;
|
|
34560
|
+
const fromEnv = forwardableWixSessionCookies(env.HIMI_WEB_ACCOUNT_COOKIE);
|
|
34561
|
+
if (fromEnv && live3(fromEnv)) return { cookie: fromEnv, source: "env" };
|
|
34562
|
+
let fromFile = "";
|
|
34563
|
+
try {
|
|
34564
|
+
fromFile = readFileSync44(opts.dpxSessionPath ?? pathJoin2(homedir6(), ".dpx", "session", "wix-session"), "utf8").trim();
|
|
34565
|
+
} catch {
|
|
34566
|
+
}
|
|
34567
|
+
if (fromFile && /^[^;\s=]+$/.test(fromFile)) {
|
|
34568
|
+
const cookie = `wixSession2=${fromFile}`;
|
|
34569
|
+
if (live3(cookie)) return { cookie, source: "file" };
|
|
34570
|
+
}
|
|
34571
|
+
return null;
|
|
34572
|
+
}
|
|
34573
|
+
function isLocalDeveloperRequest(req) {
|
|
34574
|
+
if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return false;
|
|
34575
|
+
const hostname3 = (req.headers.host ?? "").replace(/:\d+$/, "").toLowerCase();
|
|
34576
|
+
return hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "[::1]";
|
|
34577
|
+
}
|
|
34578
|
+
async function accountPrincipal(cookie, fetchImpl = fetch) {
|
|
34579
|
+
const identity = await resolveWixAccounts(cookie, fetchImpl);
|
|
34580
|
+
if (!identity.ok) return { ok: false, reason: identity.reason };
|
|
34581
|
+
const ids = identity.accounts.map((a2) => a2.accountId).sort().join("\n");
|
|
34582
|
+
return { ok: true, principal: `acct_${createHash16("sha256").update(ids).digest("hex").slice(0, 32)}` };
|
|
34583
|
+
}
|
|
34584
|
+
function safeAccountReturn(raw, requestHost, requestProto = "http") {
|
|
34585
|
+
if (typeof raw !== "string" || !raw) return "/";
|
|
34586
|
+
if (raw.startsWith("/") && !raw.startsWith("//") && !raw.startsWith("/\\")) {
|
|
34587
|
+
const base = "http://placeholder.invalid";
|
|
34588
|
+
try {
|
|
34589
|
+
const url = new URL(raw, base);
|
|
34590
|
+
if (url.origin !== base || url.pathname.startsWith("//")) return "/";
|
|
34591
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
34592
|
+
} catch {
|
|
34593
|
+
return "/";
|
|
34594
|
+
}
|
|
34595
|
+
}
|
|
34596
|
+
try {
|
|
34597
|
+
const url = new URL(raw);
|
|
34598
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return "/";
|
|
34599
|
+
if (url.username || url.password) return "/";
|
|
34600
|
+
return !!requestHost && url.host === requestHost && url.protocol === `${requestProto}:` ? url.toString() : "/";
|
|
34601
|
+
} catch {
|
|
34602
|
+
return "/";
|
|
34603
|
+
}
|
|
34604
|
+
}
|
|
34605
|
+
function isWixAccountOrigin(host) {
|
|
34606
|
+
const hostname3 = (host ?? "").replace(/:\d+$/, "").toLowerCase();
|
|
34607
|
+
return hostname3 === "wix.com" || hostname3.endsWith(".wix.com");
|
|
34608
|
+
}
|
|
34609
|
+
function withAccountOutcome(target, outcome) {
|
|
34610
|
+
const absolute = /^https?:\/\//i.test(target);
|
|
34611
|
+
const url = new URL(target, "http://placeholder.invalid");
|
|
34612
|
+
url.searchParams.set("webwix_account", outcome);
|
|
34613
|
+
return absolute ? url.toString() : `${url.pathname}${url.search}${url.hash}`;
|
|
34614
|
+
}
|
|
34615
|
+
function isWixAccountModeApp(app) {
|
|
34616
|
+
const auth = app?.meta.auth;
|
|
34617
|
+
return auth?.providerId === "wix-native" && auth.config?.mode === "account";
|
|
34618
|
+
}
|
|
34619
|
+
var LOOPBACK_PEERS, ACCOUNT_SESSION_HINT;
|
|
34620
|
+
var init_wix_account_session = __esm({
|
|
34621
|
+
"../../core/dev-server/src/wix-account-session.ts"() {
|
|
34622
|
+
init_wix_bridge();
|
|
34623
|
+
init_wix_account();
|
|
34624
|
+
init_person_session_auth();
|
|
34625
|
+
LOOPBACK_PEERS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
34626
|
+
ACCOUNT_SESSION_HINT = "Wix sign-in cannot redirect back to this origin. Set HIMI_WEB_ACCOUNT_COOKIE to your *.wix.com session cookies, or provision ~/.dpx/session/wix-session (docs/wix-authentication.md).";
|
|
34627
|
+
}
|
|
34628
|
+
});
|
|
34629
|
+
|
|
34157
34630
|
// ../../core/serve-runtime/src/flag-assignments.ts
|
|
34158
34631
|
function bad(error) {
|
|
34159
34632
|
return new Response(JSON.stringify({ error }), { status: 400, headers: { "content-type": JSON_CT, "cache-control": "no-store" } });
|
|
@@ -34216,9 +34689,9 @@ var init_flag_assignments = __esm({
|
|
|
34216
34689
|
});
|
|
34217
34690
|
|
|
34218
34691
|
// ../../core/dev-server/src/images.ts
|
|
34219
|
-
import { createHash as
|
|
34692
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
34220
34693
|
function svgFor(productId, title, sku) {
|
|
34221
|
-
const seedHex =
|
|
34694
|
+
const seedHex = createHash17("sha1").update(productId + ":" + title).digest("hex");
|
|
34222
34695
|
const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
|
|
34223
34696
|
const hue1 = h2(0) % 360;
|
|
34224
34697
|
const hue2 = (hue1 + 30 + h2(2) % 60) % 360;
|
|
@@ -34250,7 +34723,7 @@ function escapeXml(s2) {
|
|
|
34250
34723
|
return s2.replace(/[<>&"']/g, (c2) => ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[c2] ?? c2);
|
|
34251
34724
|
}
|
|
34252
34725
|
function wixPhotoSvg(category, seed2) {
|
|
34253
|
-
const seedHex =
|
|
34726
|
+
const seedHex = createHash17("sha1").update(category + ":" + seed2).digest("hex");
|
|
34254
34727
|
const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
|
|
34255
34728
|
const palette2 = paletteForCategory(category, h2);
|
|
34256
34729
|
const glyph = glyphForCategory(category);
|
|
@@ -34375,9 +34848,9 @@ var init_stable_ids = __esm({
|
|
|
34375
34848
|
|
|
34376
34849
|
// ../../core/dev-server/src/preview.ts
|
|
34377
34850
|
import { spawn as spawn4 } from "node:child_process";
|
|
34378
|
-
import { createHash as
|
|
34379
|
-
import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as
|
|
34380
|
-
import { homedir as
|
|
34851
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
34852
|
+
import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as readFileSync45, renameSync as renameSync9, unlinkSync as unlinkSync3 } from "node:fs";
|
|
34853
|
+
import { homedir as homedir7, tmpdir as tmpdir2 } from "node:os";
|
|
34381
34854
|
import { resolve as resolvePath, dirname as dirname27 } from "node:path";
|
|
34382
34855
|
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
34383
34856
|
function firstExisting(paths) {
|
|
@@ -34391,7 +34864,7 @@ function macosWinlistBin() {
|
|
|
34391
34864
|
}
|
|
34392
34865
|
function macosWinlistSourceHash() {
|
|
34393
34866
|
try {
|
|
34394
|
-
return
|
|
34867
|
+
return createHash18("sha1").update(readFileSync45(MACOS_WINLIST)).digest("hex").slice(0, 12);
|
|
34395
34868
|
} catch {
|
|
34396
34869
|
return "missing";
|
|
34397
34870
|
}
|
|
@@ -34536,7 +35009,7 @@ async function captureFrame(params, format = "png") {
|
|
|
34536
35009
|
const tmp = resolvePath(tmpdir2(), `himalaya-macos-preview-${windowId}-${process.pid}-${++macosCaptureSeq}.png`);
|
|
34537
35010
|
try {
|
|
34538
35011
|
await runner.capture(SCREENCAPTURE_BIN, ["-o", "-x", `-l${windowId}`, tmp]);
|
|
34539
|
-
return { buf:
|
|
35012
|
+
return { buf: readFileSync45(tmp), mime: "image/png" };
|
|
34540
35013
|
} finally {
|
|
34541
35014
|
try {
|
|
34542
35015
|
unlinkSync3(tmp);
|
|
@@ -35198,7 +35671,7 @@ var init_preview2 = __esm({
|
|
|
35198
35671
|
};
|
|
35199
35672
|
runner = defaultRunner2;
|
|
35200
35673
|
ADB_BIN = process.env.HIMALAYA_ADB_PATH ?? firstExisting([
|
|
35201
|
-
resolvePath(
|
|
35674
|
+
resolvePath(homedir7(), "Library/Android/sdk/platform-tools/adb"),
|
|
35202
35675
|
"/Users/Shared/Android/sdk/platform-tools/adb",
|
|
35203
35676
|
"/opt/android-sdk/platform-tools/adb"
|
|
35204
35677
|
]) ?? "adb";
|
|
@@ -35247,9 +35720,9 @@ var init_preview2 = __esm({
|
|
|
35247
35720
|
});
|
|
35248
35721
|
|
|
35249
35722
|
// ../../core/dev-server/src/tier4-integrity.ts
|
|
35250
|
-
import { createHash as
|
|
35723
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
35251
35724
|
function computeSri(bytes2) {
|
|
35252
|
-
const digest2 =
|
|
35725
|
+
const digest2 = createHash19("sha384").update(bytes2).digest("base64");
|
|
35253
35726
|
return `sha384-${digest2}`;
|
|
35254
35727
|
}
|
|
35255
35728
|
function parseManifestIntegrity(manifest) {
|
|
@@ -35264,7 +35737,7 @@ var init_tier4_integrity = __esm({
|
|
|
35264
35737
|
});
|
|
35265
35738
|
|
|
35266
35739
|
// ../../core/dev-server/src/tier4-verifier.ts
|
|
35267
|
-
import { readFileSync as
|
|
35740
|
+
import { readFileSync as readFileSync46, existsSync as existsSync44 } from "node:fs";
|
|
35268
35741
|
import { resolve as resolve34 } from "node:path";
|
|
35269
35742
|
var TierFourVerifier;
|
|
35270
35743
|
var init_tier4_verifier = __esm({
|
|
@@ -35282,7 +35755,7 @@ var init_tier4_verifier = __esm({
|
|
|
35282
35755
|
const expected = this.expectedSri(bundleId, relPath);
|
|
35283
35756
|
if (!expected) return { ok: true };
|
|
35284
35757
|
const path2 = resolve34(this.tier4Root, bundleId, relPath);
|
|
35285
|
-
const bytes2 = providedBytes ?? (existsSync44(path2) ?
|
|
35758
|
+
const bytes2 = providedBytes ?? (existsSync44(path2) ? readFileSync46(path2) : null);
|
|
35286
35759
|
if (!bytes2) return { ok: false, reason: "file not found" };
|
|
35287
35760
|
if (computeSri(bytes2) !== expected) return { ok: false, reason: "sri mismatch" };
|
|
35288
35761
|
return { ok: true };
|
|
@@ -35292,7 +35765,7 @@ var init_tier4_verifier = __esm({
|
|
|
35292
35765
|
if (cached3) return cached3;
|
|
35293
35766
|
const manifestPath = resolve34(this.tier4Root, bundleId, "manifest.json");
|
|
35294
35767
|
if (!existsSync44(manifestPath)) return void 0;
|
|
35295
|
-
const manifest = JSON.parse(
|
|
35768
|
+
const manifest = JSON.parse(readFileSync46(manifestPath, "utf8"));
|
|
35296
35769
|
cached3 = { integrity: parseManifestIntegrity(manifest) };
|
|
35297
35770
|
this.cache.set(bundleId, cached3);
|
|
35298
35771
|
return cached3;
|
|
@@ -35356,13 +35829,13 @@ var init_net_mocks_rollover = __esm({
|
|
|
35356
35829
|
});
|
|
35357
35830
|
|
|
35358
35831
|
// ../../core/dev-server/src/player-proxy.ts
|
|
35359
|
-
import { readFileSync as
|
|
35360
|
-
import { homedir as
|
|
35832
|
+
import { readFileSync as readFileSync47 } from "node:fs";
|
|
35833
|
+
import { homedir as homedir8 } from "node:os";
|
|
35361
35834
|
import { dirname as dirname28, join as join42 } from "node:path";
|
|
35362
35835
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
35363
35836
|
function readJson2(path2) {
|
|
35364
35837
|
try {
|
|
35365
|
-
return JSON.parse(
|
|
35838
|
+
return JSON.parse(readFileSync47(path2, "utf8"));
|
|
35366
35839
|
} catch {
|
|
35367
35840
|
return void 0;
|
|
35368
35841
|
}
|
|
@@ -35374,7 +35847,7 @@ function ledgerDevServerPort(tenant) {
|
|
|
35374
35847
|
return typeof port === "number" ? port : void 0;
|
|
35375
35848
|
}
|
|
35376
35849
|
function loadSupervisorRegistry() {
|
|
35377
|
-
const home = process.env.HIMALAYA_HOME ?? join42(
|
|
35850
|
+
const home = process.env.HIMALAYA_HOME ?? join42(homedir8(), ".himalaya");
|
|
35378
35851
|
const reg = readJson2(join42(home, "instances.json"));
|
|
35379
35852
|
return { instances: reg?.instances && typeof reg.instances === "object" ? reg.instances : {} };
|
|
35380
35853
|
}
|
|
@@ -35434,7 +35907,7 @@ function tenantPrefixed(url, hostApp, method = "GET") {
|
|
|
35434
35907
|
return tenantsOf(hostApp).includes(tenant) ? { tenant, url: tenantUrl } : null;
|
|
35435
35908
|
}
|
|
35436
35909
|
function forwardedBaseUrl(req) {
|
|
35437
|
-
if (!
|
|
35910
|
+
if (!LOOPBACK_PEERS2.has(req.socket?.remoteAddress ?? "")) return null;
|
|
35438
35911
|
const first = (h2) => (Array.isArray(h2) ? h2[0] : h2)?.split(",", 1)[0]?.trim() ?? "";
|
|
35439
35912
|
const host = first(req.headers["x-forwarded-host"]);
|
|
35440
35913
|
if (!host || !/^[A-Za-z0-9.\-:[\]]+$/.test(host)) return null;
|
|
@@ -35583,7 +36056,7 @@ async function proxyToServe(base, req, res, opts = {}) {
|
|
|
35583
36056
|
res.writeHead(upstream.status, outHeaders);
|
|
35584
36057
|
res.end(buf);
|
|
35585
36058
|
}
|
|
35586
|
-
var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX,
|
|
36059
|
+
var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX, LOOPBACK_PEERS2, STRIP_RESPONSE_HEADERS, STRIP_REQUEST_HEADERS;
|
|
35587
36060
|
var init_player_proxy = __esm({
|
|
35588
36061
|
"../../core/dev-server/src/player-proxy.ts"() {
|
|
35589
36062
|
init_config();
|
|
@@ -35593,7 +36066,7 @@ var init_player_proxy = __esm({
|
|
|
35593
36066
|
"himi-spaces-lite": ["himi-branded-lite"]
|
|
35594
36067
|
};
|
|
35595
36068
|
TENANT_PREFIX = "/__tenant/";
|
|
35596
|
-
|
|
36069
|
+
LOOPBACK_PEERS2 = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
35597
36070
|
STRIP_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
|
|
35598
36071
|
"connection",
|
|
35599
36072
|
"keep-alive",
|
|
@@ -128632,12 +129105,12 @@ var init_render_descriptor = __esm({
|
|
|
128632
129105
|
});
|
|
128633
129106
|
|
|
128634
129107
|
// ../../core/dev-server/src/render-fonts.ts
|
|
128635
|
-
import { existsSync as existsSync45, readFileSync as
|
|
129108
|
+
import { existsSync as existsSync45, readFileSync as readFileSync48 } from "node:fs";
|
|
128636
129109
|
import { extname, join as join43 } from "node:path";
|
|
128637
129110
|
function servedFontFaces(appDir3, tokens2) {
|
|
128638
129111
|
try {
|
|
128639
129112
|
const policyPath = join43(appDir3, "fonts.json");
|
|
128640
|
-
const policy = existsSync45(policyPath) ? JSON.parse(
|
|
129113
|
+
const policy = existsSync45(policyPath) ? JSON.parse(readFileSync48(policyPath, "utf8")) : {};
|
|
128641
129114
|
let plan = planFonts(tokens2, policy);
|
|
128642
129115
|
if (!hasVendoredFloor()) plan = { ...plan, families: plan.families.filter((f2) => !isHostProvided(f2.name)) };
|
|
128643
129116
|
if (plan.families.length === 0) return void 0;
|
|
@@ -128658,7 +129131,7 @@ async function faceBytes(face, catalog3, opts) {
|
|
|
128658
129131
|
try {
|
|
128659
129132
|
if (opts.source) {
|
|
128660
129133
|
const path2 = opts.source(face.file, face.sha256);
|
|
128661
|
-
return path2 ?
|
|
129134
|
+
return path2 ? readFileSync48(path2) : null;
|
|
128662
129135
|
}
|
|
128663
129136
|
const bytes2 = await catalogFaceBytes(face.sha256, { catalog: catalog3, ...opts.fetchFace ? { fetchFace: opts.fetchFace } : {} });
|
|
128664
129137
|
return bytes2 ?? null;
|
|
@@ -128724,7 +129197,7 @@ async function idiomFontFaceCss(idiomContext) {
|
|
|
128724
129197
|
const bundled = idiomControls2(controlIdiomFor2(idiomContext)).font.bundled;
|
|
128725
129198
|
if (!bundled) return "";
|
|
128726
129199
|
try {
|
|
128727
|
-
const bytes2 =
|
|
129200
|
+
const bytes2 = readFileSync48(new URL(`../../web-host/public/${bundled.file}`, import.meta.url));
|
|
128728
129201
|
return `@font-face { font-family: "${bundled.family}"; font-weight: 100 900; font-style: normal; src: url(data:font/ttf;base64,${bytes2.toString("base64")}) format("truetype"); }`;
|
|
128729
129202
|
} catch {
|
|
128730
129203
|
return "";
|
|
@@ -128767,7 +129240,7 @@ var init_tier = __esm({
|
|
|
128767
129240
|
});
|
|
128768
129241
|
|
|
128769
129242
|
// ../../core/dev-server/src/flags/index.ts
|
|
128770
|
-
import { readFileSync as
|
|
129243
|
+
import { readFileSync as readFileSync49 } from "node:fs";
|
|
128771
129244
|
import { resolve as resolve35 } from "node:path";
|
|
128772
129245
|
function selectProvider(config, store) {
|
|
128773
129246
|
const local = new LocalFlagProvider(store, () => config?.overrides);
|
|
@@ -128863,7 +129336,7 @@ var init_flags2 = __esm({
|
|
|
128863
129336
|
if (now - this.lastFetch < this.ttlMs) return;
|
|
128864
129337
|
this.lastFetch = now;
|
|
128865
129338
|
try {
|
|
128866
|
-
const defs = JSON.parse(
|
|
129339
|
+
const defs = JSON.parse(readFileSync49(resolve35(appDir3, "flags.json"), "utf8"));
|
|
128867
129340
|
if (Array.isArray(defs) && defs.length > 0) store.replaceAll(defs);
|
|
128868
129341
|
} catch {
|
|
128869
129342
|
}
|
|
@@ -128913,19 +129386,19 @@ var init_motion_flags = __esm({
|
|
|
128913
129386
|
});
|
|
128914
129387
|
|
|
128915
129388
|
// ../../core/dev-server/src/kits.ts
|
|
128916
|
-
import { readdirSync as readdirSync24, readFileSync as
|
|
129389
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync50 } from "node:fs";
|
|
128917
129390
|
import { resolve as resolve36, join as join44 } from "node:path";
|
|
128918
129391
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
128919
129392
|
function listKits() {
|
|
128920
129393
|
return readdirSync24(CATALOG).filter((f2) => f2.endsWith(".json")).map((f2) => {
|
|
128921
|
-
const { tokens: tokens2, ...meta } = JSON.parse(
|
|
129394
|
+
const { tokens: tokens2, ...meta } = JSON.parse(readFileSync50(join44(CATALOG, f2), "utf8"));
|
|
128922
129395
|
return meta;
|
|
128923
129396
|
});
|
|
128924
129397
|
}
|
|
128925
129398
|
function readKit(id) {
|
|
128926
129399
|
if (!/^[a-z0-9-]+$/.test(id)) return null;
|
|
128927
129400
|
try {
|
|
128928
|
-
return JSON.parse(
|
|
129401
|
+
return JSON.parse(readFileSync50(join44(CATALOG, `${id}.json`), "utf8"));
|
|
128929
129402
|
} catch {
|
|
128930
129403
|
return null;
|
|
128931
129404
|
}
|
|
@@ -128956,7 +129429,7 @@ __export(widgets_exports, {
|
|
|
128956
129429
|
viewWidgetId: () => viewWidgetId,
|
|
128957
129430
|
widgetRealm: () => widgetRealm
|
|
128958
129431
|
});
|
|
128959
|
-
import { createHash as
|
|
129432
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
128960
129433
|
import { inspect } from "node:util";
|
|
128961
129434
|
async function widgetRealm() {
|
|
128962
129435
|
if (!realmPromise) {
|
|
@@ -129012,7 +129485,7 @@ function dropEntry(cache, key2) {
|
|
|
129012
129485
|
cache.bytes -= entry.bytes;
|
|
129013
129486
|
}
|
|
129014
129487
|
function produceCacheKey(bundleJs, timeoutMs, clock) {
|
|
129015
|
-
const digest2 =
|
|
129488
|
+
const digest2 = createHash20("sha256").update(bundleJs).digest("base64");
|
|
129016
129489
|
return `${timeoutMs}|${clock === void 0 ? "live" : Math.trunc(clock)}|${digest2}`;
|
|
129017
129490
|
}
|
|
129018
129491
|
function cachedProduce(evaluator, key2) {
|
|
@@ -129403,7 +129876,7 @@ function contentEtag(snapshot2) {
|
|
|
129403
129876
|
// Lever A — a timeline change must bump the etag (frame values/times are content).
|
|
129404
129877
|
frames: snapshot2.frames ?? null
|
|
129405
129878
|
});
|
|
129406
|
-
return "sha256-" +
|
|
129879
|
+
return "sha256-" + createHash20("sha256").update(canonical4).digest("base64");
|
|
129407
129880
|
}
|
|
129408
129881
|
async function buildWidgetSnapshot(bundleJs, widgetId, opts = {}) {
|
|
129409
129882
|
const { widgets } = await extractWidgets(bundleJs, opts);
|
|
@@ -129660,7 +130133,7 @@ __export(config_exports2, {
|
|
|
129660
130133
|
serializeRolloutYaml: () => serializeRolloutYaml,
|
|
129661
130134
|
validateOverlayPatch: () => validateOverlayPatch
|
|
129662
130135
|
});
|
|
129663
|
-
import { mkdirSync as mkdirSync22, readFileSync as
|
|
130136
|
+
import { mkdirSync as mkdirSync22, readFileSync as readFileSync51, writeFileSync as writeFileSync19 } from "node:fs";
|
|
129664
130137
|
import { dirname as dirname29, join as join45, resolve as resolve37 } from "node:path";
|
|
129665
130138
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
129666
130139
|
function strip(line) {
|
|
@@ -129728,7 +130201,7 @@ function appConfigPath(app, file2, root = REPO_ROOT6) {
|
|
|
129728
130201
|
for (const base of ["apps", "test-apps"]) {
|
|
129729
130202
|
const p2 = join45(root, base, app, file2);
|
|
129730
130203
|
try {
|
|
129731
|
-
|
|
130204
|
+
readFileSync51(p2);
|
|
129732
130205
|
return p2;
|
|
129733
130206
|
} catch {
|
|
129734
130207
|
}
|
|
@@ -129781,7 +130254,7 @@ function validateOverlayPatch(patch) {
|
|
|
129781
130254
|
}
|
|
129782
130255
|
function readJsonAt(app, file2, root) {
|
|
129783
130256
|
try {
|
|
129784
|
-
return JSON.parse(
|
|
130257
|
+
return JSON.parse(readFileSync51(appConfigPath(app, file2, root), "utf8"));
|
|
129785
130258
|
} catch {
|
|
129786
130259
|
return null;
|
|
129787
130260
|
}
|
|
@@ -129819,14 +130292,14 @@ function saveLocalFlags(app, defs, root = REPO_ROOT6) {
|
|
|
129819
130292
|
}
|
|
129820
130293
|
function loadRollout(app) {
|
|
129821
130294
|
try {
|
|
129822
|
-
return parseRolloutYaml(
|
|
130295
|
+
return parseRolloutYaml(readFileSync51(appConfigPath(app, "rollout.yaml"), "utf8"));
|
|
129823
130296
|
} catch {
|
|
129824
130297
|
return null;
|
|
129825
130298
|
}
|
|
129826
130299
|
}
|
|
129827
130300
|
function loadRevocations(app) {
|
|
129828
130301
|
try {
|
|
129829
|
-
return parseRevocationsYaml(
|
|
130302
|
+
return parseRevocationsYaml(readFileSync51(appConfigPath(app, "revocations.yaml"), "utf8")).revoked;
|
|
129830
130303
|
} catch {
|
|
129831
130304
|
return [];
|
|
129832
130305
|
}
|
|
@@ -129904,9 +130377,9 @@ var init_config2 = __esm({
|
|
|
129904
130377
|
// ../../core/dev-server/src/index.ts
|
|
129905
130378
|
import { createServer as createServer3 } from "node:http";
|
|
129906
130379
|
import { readFile, stat } from "node:fs/promises";
|
|
129907
|
-
import { readFileSync as
|
|
130380
|
+
import { readFileSync as readFileSync52, existsSync as existsSync46, watch, mkdirSync as mkdirSync23, rmSync as rmSync11 } from "node:fs";
|
|
129908
130381
|
import { basename as basename10, dirname as dirname30, extname as extname2, join as join46, relative as relative8, resolve as resolve38, normalize as normalize3, sep as sep10 } from "node:path";
|
|
129909
|
-
import { createHash as
|
|
130382
|
+
import { createHash as createHash21, randomUUID as randomUUID5 } from "node:crypto";
|
|
129910
130383
|
import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
129911
130384
|
function readLogicBundle(read, tier5Dir, name) {
|
|
129912
130385
|
return read(tier5Dir ?? TIER5_ROOT2, name) ?? (tier5Dir && tier5Dir !== TIER5_ROOT2 ? read(TIER5_ROOT2, name) : void 0);
|
|
@@ -129952,7 +130425,7 @@ async function readBody2(req) {
|
|
|
129952
130425
|
return Buffer.concat(chunks).toString("utf-8");
|
|
129953
130426
|
}
|
|
129954
130427
|
function makeEtag(body) {
|
|
129955
|
-
return `"${
|
|
130428
|
+
return `"${createHash21("sha256").update(body).digest("hex").slice(0, 32)}"`;
|
|
129956
130429
|
}
|
|
129957
130430
|
function servedTokensPath(app) {
|
|
129958
130431
|
return app.module.designTokensPath ?? resolve38(app.dir, uiConfig(app.module.config).designTokensPath ?? "tokens.json");
|
|
@@ -129960,7 +130433,7 @@ function servedTokensPath(app) {
|
|
|
129960
130433
|
function readAppTokens(state) {
|
|
129961
130434
|
if (!state.app) return null;
|
|
129962
130435
|
try {
|
|
129963
|
-
const parsed = JSON.parse(
|
|
130436
|
+
const parsed = JSON.parse(readFileSync52(servedTokensPath(state.app), "utf8"));
|
|
129964
130437
|
delete parsed._meta;
|
|
129965
130438
|
return parsed;
|
|
129966
130439
|
} catch {
|
|
@@ -129972,7 +130445,7 @@ function effectiveAppConfigOverride(state) {
|
|
|
129972
130445
|
if (state.app) {
|
|
129973
130446
|
try {
|
|
129974
130447
|
gitOverlay = JSON.parse(
|
|
129975
|
-
|
|
130448
|
+
readFileSync52(resolve38(state.app.dir, "app-config.overlay.json"), "utf8")
|
|
129976
130449
|
);
|
|
129977
130450
|
} catch {
|
|
129978
130451
|
}
|
|
@@ -130041,7 +130514,7 @@ function handleL10nRequest(req, res, state) {
|
|
|
130041
130514
|
let messages;
|
|
130042
130515
|
try {
|
|
130043
130516
|
messages = Object.fromEntries(
|
|
130044
|
-
keyMap(parseCatalog(
|
|
130517
|
+
keyMap(parseCatalog(readFileSync52(path2, "utf8")), { sourceFallback: tag === sourceLocale })
|
|
130045
130518
|
);
|
|
130046
130519
|
} catch {
|
|
130047
130520
|
return sendJson(res, 500, { error: "catalog_unreadable", app, tag }, cors);
|
|
@@ -130443,8 +130916,8 @@ async function buildDescriptorForScreenId(state, screenId, query = new URLSearch
|
|
|
130443
130916
|
function bundleIntegritySync(name, dir) {
|
|
130444
130917
|
for (const root of dir ? [dir, TIER5_ROOT2] : [TIER5_ROOT2]) {
|
|
130445
130918
|
try {
|
|
130446
|
-
const bytes2 =
|
|
130447
|
-
return "sha256-" +
|
|
130919
|
+
const bytes2 = readFileSync52(resolve38(root, `${name}.bundle.js`));
|
|
130920
|
+
return "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
|
|
130448
130921
|
} catch {
|
|
130449
130922
|
}
|
|
130450
130923
|
}
|
|
@@ -130865,7 +131338,7 @@ function tokensAreDerived(state) {
|
|
|
130865
131338
|
}
|
|
130866
131339
|
function servedTokensHash(app) {
|
|
130867
131340
|
try {
|
|
130868
|
-
return
|
|
131341
|
+
return createHash21("sha256").update(readFileSync52(servedTokensPath(app))).digest("hex");
|
|
130869
131342
|
} catch {
|
|
130870
131343
|
return "";
|
|
130871
131344
|
}
|
|
@@ -131076,6 +131549,13 @@ function resolveWebWixAuth(app) {
|
|
|
131076
131549
|
redirectUri: WEBWIX_REDIRECT
|
|
131077
131550
|
});
|
|
131078
131551
|
}
|
|
131552
|
+
function rotateWebWixSession(req, res, state, session) {
|
|
131553
|
+
const current = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
|
|
131554
|
+
if (current && state.wixWebSessions.get(current) === session) state.wixWebSessions.set(current, {});
|
|
131555
|
+
const id = randomUUID5();
|
|
131556
|
+
state.wixWebSessions.set(id, session);
|
|
131557
|
+
res.setHeader("set-cookie", `${WEBWIX_COOKIE}=${id}; Path=/; HttpOnly; SameSite=Lax`);
|
|
131558
|
+
}
|
|
131079
131559
|
function webWixSession(req, res, state) {
|
|
131080
131560
|
const requestedId = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
|
|
131081
131561
|
const id = requestedId && state.wixWebSessions.has(requestedId) ? requestedId : randomUUID5();
|
|
@@ -131270,20 +131750,68 @@ async function handleWebWix(req, res, state) {
|
|
|
131270
131750
|
session.memberToken = memberToken;
|
|
131271
131751
|
session.visitorToken = visitorToken;
|
|
131272
131752
|
session.email = String(b2.email ?? "");
|
|
131753
|
+
if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
|
|
131754
|
+
session.account = void 0;
|
|
131273
131755
|
return reply(200, { ok: true, email: session.email });
|
|
131274
131756
|
} catch (e2) {
|
|
131275
131757
|
return reply(200, { ok: false, error: String(e2?.message ?? e2) });
|
|
131276
131758
|
}
|
|
131277
131759
|
}
|
|
131760
|
+
const accountApp = isWixAccountModeApp(state.app);
|
|
131761
|
+
if (path2 === "/v1/__webwix/account/login" || path2 === "/v1/__webwix/account/callback") {
|
|
131762
|
+
if (!accountApp) return reply(404, { error: "webwix_account_unsupported" });
|
|
131763
|
+
const query = new URL(req.url ?? "", "http://localhost").searchParams;
|
|
131764
|
+
const forwardedHost = req.headers["x-forwarded-host"];
|
|
131765
|
+
const requestHost = (Array.isArray(forwardedHost) ? forwardedHost[0] : forwardedHost) ?? req.headers.host;
|
|
131766
|
+
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
131767
|
+
const proto = (Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto) === "https" ? "https" : "http";
|
|
131768
|
+
const back = safeAccountReturn(query.get("return"), requestHost, proto);
|
|
131769
|
+
const wixOrigin = isWixAccountOrigin(requestHost);
|
|
131770
|
+
const signInUrl = wixOrigin ? wixAccountSignInUrl(`${proto}://${requestHost}/v1/__webwix/account/callback?return=${encodeURIComponent(back)}`) : void 0;
|
|
131771
|
+
const machineSession = path2 === "/v1/__webwix/account/login" && !wixOrigin && isLocalDeveloperRequest(req);
|
|
131772
|
+
const establish = async () => {
|
|
131773
|
+
const captured = captureAccountSession(req, { machineSession });
|
|
131774
|
+
if (!captured) return { ok: false, error: "webwix_account_no_session" };
|
|
131775
|
+
const who = await accountPrincipal(captured.cookie);
|
|
131776
|
+
if (!who.ok) return { ok: false, error: who.reason === "no_session" ? "webwix_account_no_session" : "webwix_account_upstream_failed" };
|
|
131777
|
+
session.account = { cookie: captured.cookie, principal: who.principal };
|
|
131778
|
+
session.memberToken = void 0;
|
|
131779
|
+
session.email = void 0;
|
|
131780
|
+
rotateWebWixSession(req, res, state, session);
|
|
131781
|
+
return { ok: true, principal: who.principal };
|
|
131782
|
+
};
|
|
131783
|
+
res.setHeader("cache-control", "no-store");
|
|
131784
|
+
if (path2 === "/v1/__webwix/account/login" && req.method === "GET" && signInUrl) {
|
|
131785
|
+
res.statusCode = 302;
|
|
131786
|
+
res.setHeader("location", signInUrl);
|
|
131787
|
+
return void res.end();
|
|
131788
|
+
}
|
|
131789
|
+
if (path2 === "/v1/__webwix/account/login" && req.method === "POST") {
|
|
131790
|
+
const outcome = await establish();
|
|
131791
|
+
return outcome.ok ? reply(200, { ok: true, authenticated: true, userId: outcome.principal }) : reply(outcome.error === "webwix_account_no_session" ? 401 : 502, {
|
|
131792
|
+
ok: false,
|
|
131793
|
+
error: outcome.error,
|
|
131794
|
+
...signInUrl ? { signInUrl } : { hint: ACCOUNT_SESSION_HINT }
|
|
131795
|
+
});
|
|
131796
|
+
}
|
|
131797
|
+
if (req.method === "GET") {
|
|
131798
|
+
const outcome = await establish();
|
|
131799
|
+
res.statusCode = 302;
|
|
131800
|
+
res.setHeader("location", withAccountOutcome(back, outcome.ok ? "signed_in" : outcome.error));
|
|
131801
|
+
return void res.end();
|
|
131802
|
+
}
|
|
131803
|
+
return reply(405, { error: "method_not_allowed" });
|
|
131804
|
+
}
|
|
131278
131805
|
if (path2 === "/v1/__webwix/call" && req.method === "POST") {
|
|
131279
131806
|
const b2 = await readJson9();
|
|
131280
131807
|
const ownerRung = b2.ownerMsid !== void 0 || b2.checkOwnerSession === true;
|
|
131808
|
+
const accountRung = !ownerRung && accountApp && !!session.account;
|
|
131281
131809
|
const msid = String(b2.ownerMsid ?? "");
|
|
131282
131810
|
const cookie = req.headers.cookie ?? "";
|
|
131283
131811
|
const method = String(b2.method ?? "GET").toUpperCase();
|
|
131284
131812
|
const requestedPath = String(b2.path ?? "/");
|
|
131285
131813
|
const started = Date.now();
|
|
131286
|
-
const capability = ownerRung ? "wix_api.web.owner" : "wix_api.web";
|
|
131814
|
+
const capability = ownerRung ? "wix_api.web.owner" : accountRung ? "wix_api.web.account" : "wix_api.web";
|
|
131287
131815
|
const refuseEarly = (status, error, parsed) => {
|
|
131288
131816
|
recordWixTraffic(state.wix, state.appName, state.adminUrl, {
|
|
131289
131817
|
ts: started,
|
|
@@ -131310,6 +131838,7 @@ async function handleWebWix(req, res, state) {
|
|
|
131310
131838
|
}
|
|
131311
131839
|
const body = b2.body === void 0 ? void 0 : typeof b2.body === "string" ? b2.body : JSON.stringify(b2.body);
|
|
131312
131840
|
const forwardedHeaders = normalizeWixForwardedHeaders(b2.headers, requestedPath);
|
|
131841
|
+
const logged = accountApp ? new URL(`${target.origin}${target.pathname}`) : target;
|
|
131313
131842
|
const record2 = (source, status, respBody, mockRuleId, respHeaders) => {
|
|
131314
131843
|
const redactBodies = source === "proxy" || mockRuleId === UNMATCHED_FAIL_CLOSED_ID;
|
|
131315
131844
|
recordWixTraffic(state.wix, state.appName, state.adminUrl, {
|
|
@@ -131318,7 +131847,7 @@ async function handleWebWix(req, res, state) {
|
|
|
131318
131847
|
capability,
|
|
131319
131848
|
host: target.host,
|
|
131320
131849
|
method,
|
|
131321
|
-
url:
|
|
131850
|
+
url: logged.toString(),
|
|
131322
131851
|
path: target.pathname,
|
|
131323
131852
|
status,
|
|
131324
131853
|
durationMs: Date.now() - started,
|
|
@@ -131328,7 +131857,7 @@ async function handleWebWix(req, res, state) {
|
|
|
131328
131857
|
mockRuleId
|
|
131329
131858
|
});
|
|
131330
131859
|
};
|
|
131331
|
-
if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung || failsClosed(state.wix))) {
|
|
131860
|
+
if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung && !accountRung || failsClosed(state.wix))) {
|
|
131332
131861
|
const matchCtx = { host: target.host, query: Object.fromEntries(target.searchParams.entries()), headers: forwardedHeaders, body };
|
|
131333
131862
|
let match = matchRuleEx(state.wix.rules, method, target.pathname, matchCtx);
|
|
131334
131863
|
if (match && (match.rule.kind ?? "mock") !== "mock") {
|
|
@@ -131348,6 +131877,44 @@ async function handleWebWix(req, res, state) {
|
|
|
131348
131877
|
return reply(200, { status: refusal.status, body: refusal.body });
|
|
131349
131878
|
}
|
|
131350
131879
|
}
|
|
131880
|
+
if (accountRung && session.account) {
|
|
131881
|
+
const account = session.account;
|
|
131882
|
+
const absolute = /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath);
|
|
131883
|
+
const allowed2 = absolute && !!allowedAccountTarget(method, requestedPath);
|
|
131884
|
+
const siteId = Object.entries(forwardedHeaders).find(([name]) => name.toLowerCase() === "wix-site-id")?.[1]?.trim() ?? "";
|
|
131885
|
+
if (allowed2 || !absolute && siteId) {
|
|
131886
|
+
if (siteId && !isSafeMsid(siteId)) return refuseEarly(400, "webwix_account_bad_site_id", logged);
|
|
131887
|
+
res.setHeader("cache-control", "no-store");
|
|
131888
|
+
const send2 = async (force) => {
|
|
131889
|
+
const instance = siteId ? await webAccountMemberInstances.instance(siteId, account.cookie, { force }) : void 0;
|
|
131890
|
+
return allowed2 ? wixAccountCall(method, requestedPath, body, account.cookie, fetch, forwardedHeaders, instance) : wixVisitorCall(method, requestedPath, body, instance ?? "", fetch, forwardedHeaders);
|
|
131891
|
+
};
|
|
131892
|
+
try {
|
|
131893
|
+
let result = await send2(false);
|
|
131894
|
+
if (result.status === 401 && siteId) result = await send2(true);
|
|
131895
|
+
if (result.status >= 200 && result.status < 300 && isAccountJoinCall(method, requestedPath)) {
|
|
131896
|
+
webAccountMemberInstances.forgetRefusals(account.cookie);
|
|
131897
|
+
}
|
|
131898
|
+
record2("proxy", result.status, result.body);
|
|
131899
|
+
return reply(200, result);
|
|
131900
|
+
} catch (e2) {
|
|
131901
|
+
if (e2 instanceof AccountSessionExpired) {
|
|
131902
|
+
webAccountMemberInstances.forgetSession(account.cookie);
|
|
131903
|
+
if (session.account === account) session.account = void 0;
|
|
131904
|
+
}
|
|
131905
|
+
if (e2 instanceof NotSiteMember || e2 instanceof SiteInstanceUnavailable || e2 instanceof AccountSessionExpired) {
|
|
131906
|
+
const refusal = memberInstanceRefusal(e2);
|
|
131907
|
+
record2("proxy", refusal.status, void 0);
|
|
131908
|
+
return reply(refusal.status, refusal.body);
|
|
131909
|
+
}
|
|
131910
|
+
record2("proxy", 502, void 0);
|
|
131911
|
+
return reply(502, { error: "webwix_bridge_upstream_failed" });
|
|
131912
|
+
}
|
|
131913
|
+
}
|
|
131914
|
+
}
|
|
131915
|
+
if (accountApp && !ownerRung && !session.account && /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath) && allowedAccountTarget(method, requestedPath)) {
|
|
131916
|
+
return refuseEarly(401, "webwix_account_signed_out", logged);
|
|
131917
|
+
}
|
|
131351
131918
|
if (ownerRung) {
|
|
131352
131919
|
try {
|
|
131353
131920
|
if (b2.checkOwnerSession !== true && method === "POST" && isOwnerSitesPath(requestedPath)) {
|
|
@@ -131403,11 +131970,16 @@ async function handleWebWix(req, res, state) {
|
|
|
131403
131970
|
}
|
|
131404
131971
|
}
|
|
131405
131972
|
if (path2 === "/v1/__webwix/logout" && req.method === "POST") {
|
|
131973
|
+
if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
|
|
131406
131974
|
session.memberToken = void 0;
|
|
131407
131975
|
session.email = void 0;
|
|
131976
|
+
session.account = void 0;
|
|
131408
131977
|
return reply(200, { ok: true });
|
|
131409
131978
|
}
|
|
131410
131979
|
if (path2 === "/v1/__webwix/identity" && (req.method === "GET" || req.method === "POST")) {
|
|
131980
|
+
if (accountApp && session.account) {
|
|
131981
|
+
return reply(200, { authenticated: true, mode: "account", userId: session.account.principal, email: "" });
|
|
131982
|
+
}
|
|
131411
131983
|
if (!session.memberToken) return reply(200, { authenticated: false, userId: null, email: "" });
|
|
131412
131984
|
const userId = await readMemberId(session.memberToken);
|
|
131413
131985
|
const preferenceIdentity = session.email?.trim().toLowerCase() || userId;
|
|
@@ -131416,7 +131988,7 @@ async function handleWebWix(req, res, state) {
|
|
|
131416
131988
|
userId: userId ?? session.email ?? null,
|
|
131417
131989
|
email: session.email ?? "",
|
|
131418
131990
|
preferenceContext: preferenceIdentity ? {
|
|
131419
|
-
accountId: `m_${
|
|
131991
|
+
accountId: `m_${createHash21("sha256").update(preferenceIdentity).digest("hex")}`,
|
|
131420
131992
|
// Headless client IDs are site-bound and come from the server's app
|
|
131421
131993
|
// configuration, never the URL's user-supplied business parameter.
|
|
131422
131994
|
businessId: auth.clientId
|
|
@@ -131437,6 +132009,8 @@ async function handleWebWix(req, res, state) {
|
|
|
131437
132009
|
session.memberToken = memberToken;
|
|
131438
132010
|
session.visitorToken = visitorToken;
|
|
131439
132011
|
session.email = String(b2.email ?? "");
|
|
132012
|
+
if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
|
|
132013
|
+
session.account = void 0;
|
|
131440
132014
|
return reply(200, { ok: true, email: session.email });
|
|
131441
132015
|
} catch (e2) {
|
|
131442
132016
|
return reply(200, { ok: false, error: String(e2?.message ?? e2) });
|
|
@@ -132135,7 +132709,7 @@ async function readBundleFile(name, dir) {
|
|
|
132135
132709
|
if (!roots.some((root) => path2.startsWith(root))) continue;
|
|
132136
132710
|
try {
|
|
132137
132711
|
const bytes2 = await readFile(path2);
|
|
132138
|
-
const integrity2 = "sha256-" +
|
|
132712
|
+
const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
|
|
132139
132713
|
return { bytes: bytes2, integrity: integrity2 };
|
|
132140
132714
|
} catch {
|
|
132141
132715
|
}
|
|
@@ -132300,12 +132874,12 @@ function readActionHandlerManifest(app) {
|
|
|
132300
132874
|
let decls;
|
|
132301
132875
|
let bytes2;
|
|
132302
132876
|
try {
|
|
132303
|
-
decls = JSON.parse(
|
|
132304
|
-
bytes2 =
|
|
132877
|
+
decls = JSON.parse(readFileSync52(manifestPath, "utf8"));
|
|
132878
|
+
bytes2 = readFileSync52(bundlePath);
|
|
132305
132879
|
} catch {
|
|
132306
132880
|
return { handlers: [] };
|
|
132307
132881
|
}
|
|
132308
|
-
const integrity2 = "sha256-" +
|
|
132882
|
+
const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
|
|
132309
132883
|
const bundleUrl = `/v1/action-handler-bundles/${app}`;
|
|
132310
132884
|
return { handlers: decls.map((d2) => ({ id: d2.id, policy: d2.policy, description: d2.description, bundleUrl, integrity: integrity2 })) };
|
|
132311
132885
|
}
|
|
@@ -132318,7 +132892,7 @@ async function handleActionHandlerBundleGet(res, app) {
|
|
|
132318
132892
|
if (!path2.startsWith(ACTION_HANDLERS_ROOT)) return sendJson(res, 404, { error: "not_found" });
|
|
132319
132893
|
try {
|
|
132320
132894
|
const bytes2 = await readFile(path2);
|
|
132321
|
-
const integrity2 = "sha256-" +
|
|
132895
|
+
const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
|
|
132322
132896
|
res.setHeader("content-type", "application/javascript; charset=utf-8");
|
|
132323
132897
|
res.setHeader("cache-control", "max-age=300");
|
|
132324
132898
|
res.setHeader("x-himalaya-bundle-integrity", integrity2);
|
|
@@ -132620,7 +133194,7 @@ function createDevServer(opts = {}) {
|
|
|
132620
133194
|
const q2 = new URLSearchParams(url.split("?")[1] ?? "");
|
|
132621
133195
|
const assetApp = q2.get("app") ?? state.appName;
|
|
132622
133196
|
const assetDir = state.app && assetApp === state.app.name ? state.app.dir : resolveAppDir(assetApp);
|
|
132623
|
-
const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(
|
|
133197
|
+
const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(readFileSync52(a2.path)) === sha2) : void 0;
|
|
132624
133198
|
if (!hit && assetDir) {
|
|
132625
133199
|
const fontBytes = await fontFaceBytesBySha(assetDir, sha2);
|
|
132626
133200
|
if (fontBytes) {
|
|
@@ -132643,7 +133217,7 @@ function createDevServer(opts = {}) {
|
|
|
132643
133217
|
res.end(JSON.stringify({ error: "asset_not_found", app: assetApp, sha: sha2 }));
|
|
132644
133218
|
return;
|
|
132645
133219
|
}
|
|
132646
|
-
const bytes2 =
|
|
133220
|
+
const bytes2 = readFileSync52(hit.path);
|
|
132647
133221
|
res.writeHead(200, {
|
|
132648
133222
|
"content-type": hit.contentType,
|
|
132649
133223
|
"content-length": String(bytes2.length),
|
|
@@ -132736,7 +133310,7 @@ function createDevServer(opts = {}) {
|
|
|
132736
133310
|
if (url === "/v1/schema/screen-descriptor.json" && req.method === "GET") {
|
|
132737
133311
|
try {
|
|
132738
133312
|
const schemaPath = resolve38(ROOT6, "core/schema/generated/screen-descriptor.schema.json");
|
|
132739
|
-
const body =
|
|
133313
|
+
const body = readFileSync52(schemaPath, "utf8");
|
|
132740
133314
|
return send(res, 200, body, {
|
|
132741
133315
|
"content-type": "application/schema+json; charset=utf-8",
|
|
132742
133316
|
"cache-control": "no-store",
|
|
@@ -132787,7 +133361,7 @@ function createDevServer(opts = {}) {
|
|
|
132787
133361
|
try {
|
|
132788
133362
|
const { parseRevocationsYaml: parseRevocationsYaml2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
|
|
132789
133363
|
revoked = parseRevocationsYaml2(
|
|
132790
|
-
|
|
133364
|
+
readFileSync52(resolve38(state.app.dir, "revocations.yaml"), "utf8")
|
|
132791
133365
|
).revoked;
|
|
132792
133366
|
} catch {
|
|
132793
133367
|
}
|
|
@@ -133000,7 +133574,7 @@ ${err.message}`);
|
|
|
133000
133574
|
});
|
|
133001
133575
|
return httpServer;
|
|
133002
133576
|
}
|
|
133003
|
-
var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, MIME, widgetOverrides;
|
|
133577
|
+
var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, webAccountMemberInstances, MIME, widgetOverrides;
|
|
133004
133578
|
var init_src6 = __esm({
|
|
133005
133579
|
"../../core/dev-server/src/index.ts"() {
|
|
133006
133580
|
init_inject();
|
|
@@ -133014,6 +133588,7 @@ var init_src6 = __esm({
|
|
|
133014
133588
|
init_aria_realtime_dev();
|
|
133015
133589
|
init_wix_member_login();
|
|
133016
133590
|
init_wix_bridge();
|
|
133591
|
+
init_wix_account_session();
|
|
133017
133592
|
init_flag_assignments();
|
|
133018
133593
|
init_images();
|
|
133019
133594
|
init_l10n();
|
|
@@ -133062,6 +133637,7 @@ var init_src6 = __esm({
|
|
|
133062
133637
|
WEBWIX_REDIRECT = "himalaya-demo-app://oauth/callback";
|
|
133063
133638
|
WEBWIX_COOKIE = "himi_webwix_session";
|
|
133064
133639
|
webOwnerPreviewInstances = new OwnerInstanceCache(fetch);
|
|
133640
|
+
webAccountMemberInstances = new MemberInstanceCache(fetch);
|
|
133065
133641
|
MIME = {
|
|
133066
133642
|
".html": "text/html; charset=utf-8",
|
|
133067
133643
|
".css": "text/css; charset=utf-8",
|
|
@@ -133081,9 +133657,9 @@ var init_src6 = __esm({
|
|
|
133081
133657
|
});
|
|
133082
133658
|
|
|
133083
133659
|
// ../../core/serve-storage/src/release-patch.ts
|
|
133084
|
-
import { createHash as
|
|
133660
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
133085
133661
|
function sha256hex(b2) {
|
|
133086
|
-
return
|
|
133662
|
+
return createHash22("sha256").update(b2).digest("hex");
|
|
133087
133663
|
}
|
|
133088
133664
|
function stableStringify(value) {
|
|
133089
133665
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -136014,11 +136590,11 @@ var init_dependencies = __esm({
|
|
|
136014
136590
|
});
|
|
136015
136591
|
|
|
136016
136592
|
// ../../core/functions-build/src/sbom.ts
|
|
136017
|
-
import { createHash as
|
|
136593
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
136018
136594
|
function createFunctionSbom(packages) {
|
|
136019
136595
|
const components2 = [...packages].sort((a2, b2) => a2.name.localeCompare(b2.name)).map(({ name, version: version4, integrity: integrity2, license }) => ({ name, version: version4, integrity: integrity2, license }));
|
|
136020
136596
|
const body = JSON.stringify({ format: "himalaya-sbom-v1", components: components2 });
|
|
136021
|
-
return { format: "himalaya-sbom-v1", components: components2, hash:
|
|
136597
|
+
return { format: "himalaya-sbom-v1", components: components2, hash: createHash23("sha256").update(body).digest("hex") };
|
|
136022
136598
|
}
|
|
136023
136599
|
var init_sbom = __esm({
|
|
136024
136600
|
"../../core/functions-build/src/sbom.ts"() {
|
|
@@ -136026,12 +136602,12 @@ var init_sbom = __esm({
|
|
|
136026
136602
|
});
|
|
136027
136603
|
|
|
136028
136604
|
// ../../core/functions-build/src/build.ts
|
|
136029
|
-
import { createHash as
|
|
136605
|
+
import { createHash as createHash24 } from "node:crypto";
|
|
136030
136606
|
function sha2563(value) {
|
|
136031
|
-
return
|
|
136607
|
+
return createHash24("sha256").update(value).digest("hex");
|
|
136032
136608
|
}
|
|
136033
136609
|
function sri(value) {
|
|
136034
|
-
return `sha256-${
|
|
136610
|
+
return `sha256-${createHash24("sha256").update(value).digest("base64")}`;
|
|
136035
136611
|
}
|
|
136036
136612
|
function schemaHash(schema) {
|
|
136037
136613
|
if (!schema) return "";
|
|
@@ -136225,8 +136801,8 @@ __export(build_exports2, {
|
|
|
136225
136801
|
withStoreNavBundle: () => withStoreNavBundle,
|
|
136226
136802
|
withoutDevOnlyAppConfig: () => withoutDevOnlyAppConfig
|
|
136227
136803
|
});
|
|
136228
|
-
import { createHash as
|
|
136229
|
-
import { readFileSync as
|
|
136804
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
136805
|
+
import { readFileSync as readFileSync53, readdirSync as readdirSync25, existsSync as existsSync47 } from "node:fs";
|
|
136230
136806
|
import { dirname as dirname31, join as join47, resolve as resolve39 } from "node:path";
|
|
136231
136807
|
import { fileURLToPath as fileURLToPath23 } from "node:url";
|
|
136232
136808
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -136272,7 +136848,7 @@ function l10nLintOptions(locale, appDir3) {
|
|
|
136272
136848
|
const path2 = join47(appDir3, "l10n", `${tag}.json`);
|
|
136273
136849
|
if (!existsSync47(path2)) continue;
|
|
136274
136850
|
try {
|
|
136275
|
-
const parsed = JSON.parse(
|
|
136851
|
+
const parsed = JSON.parse(readFileSync53(path2, "utf8"));
|
|
136276
136852
|
for (const m2 of Object.values(parsed.messages ?? {})) {
|
|
136277
136853
|
if (typeof m2?.source === "string" && typeof m2.translation === "string" && m2.translation.length > 0) {
|
|
136278
136854
|
catalog3.add(m2.source);
|
|
@@ -136308,10 +136884,10 @@ function servesMessages(text9) {
|
|
|
136308
136884
|
}
|
|
136309
136885
|
}
|
|
136310
136886
|
function sha2564(buf) {
|
|
136311
|
-
return
|
|
136887
|
+
return createHash25("sha256").update(buf).digest("hex");
|
|
136312
136888
|
}
|
|
136313
136889
|
function sri2(buf) {
|
|
136314
|
-
return "sha256-" +
|
|
136890
|
+
return "sha256-" + createHash25("sha256").update(buf).digest("base64");
|
|
136315
136891
|
}
|
|
136316
136892
|
async function widgetFailureDetail(res) {
|
|
136317
136893
|
try {
|
|
@@ -136639,7 +137215,7 @@ async function buildReleaseFromContent(contentDir2, dest, opts = {}) {
|
|
|
136639
137215
|
function readTokensForLint(preloaded) {
|
|
136640
137216
|
try {
|
|
136641
137217
|
const tokenPath = preloaded.module.designTokensPath ?? resolve39(preloaded.dir, uiConfig(preloaded.module.config).designTokensPath ?? "tokens.json");
|
|
136642
|
-
const parsed = JSON.parse(
|
|
137218
|
+
const parsed = JSON.parse(readFileSync53(tokenPath, "utf8"));
|
|
136643
137219
|
delete parsed._meta;
|
|
136644
137220
|
return parsed;
|
|
136645
137221
|
} catch {
|
|
@@ -136661,7 +137237,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136661
137237
|
};
|
|
136662
137238
|
const readBundle = (name) => {
|
|
136663
137239
|
const path2 = bundlePath(name);
|
|
136664
|
-
return path2 ?
|
|
137240
|
+
return path2 ? readFileSync53(path2, "utf8") : void 0;
|
|
136665
137241
|
};
|
|
136666
137242
|
const collect2 = opts.collect;
|
|
136667
137243
|
const config = preloaded.module.config;
|
|
@@ -136807,11 +137383,11 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136807
137383
|
};
|
|
136808
137384
|
checkRegistry(preloaded.module.actions);
|
|
136809
137385
|
const contentManifestPath2 = join47(preloaded.dir, "himalaya.content.json");
|
|
136810
|
-
const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(
|
|
137386
|
+
const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(readFileSync53(contentManifestPath2, "utf8")) : void 0;
|
|
136811
137387
|
let screenMetadata = parseScreenMetadata(contentManifest?.screens);
|
|
136812
137388
|
if (contentManifest?.shell === "brandy" && screenMetadata) {
|
|
136813
137389
|
const provisioningPath2 = join47(preloaded.dir, "provisioning.json");
|
|
136814
|
-
if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(
|
|
137390
|
+
if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(readFileSync53(provisioningPath2, "utf8")).site);
|
|
136815
137391
|
}
|
|
136816
137392
|
await store.reset(app);
|
|
136817
137393
|
const bundles = {};
|
|
@@ -136848,7 +137424,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136848
137424
|
try {
|
|
136849
137425
|
const path2 = bundlePath(name);
|
|
136850
137426
|
if (!path2) return null;
|
|
136851
|
-
bytes2 =
|
|
137427
|
+
bytes2 = readFileSync53(path2);
|
|
136852
137428
|
} catch {
|
|
136853
137429
|
return null;
|
|
136854
137430
|
}
|
|
@@ -136872,7 +137448,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136872
137448
|
for (const [name, file2] of [["spec", "SPEC.md"], ["mobile-ux", "MOBILE-UX.md"]]) {
|
|
136873
137449
|
const path2 = join47(preloaded.dir, file2);
|
|
136874
137450
|
if (!existsSync47(path2)) continue;
|
|
136875
|
-
const bytes2 =
|
|
137451
|
+
const bytes2 = readFileSync53(path2);
|
|
136876
137452
|
if (bytes2.length === 0 || bytes2.length > MAX_AUTHORING_DOC_BYTES) {
|
|
136877
137453
|
throw new Error(`${file2} must be non-empty and at most ${MAX_AUTHORING_DOC_BYTES} bytes to ship with a release.`);
|
|
136878
137454
|
}
|
|
@@ -136887,7 +137463,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136887
137463
|
const iconPath = resolveAppDirIcon(preloaded.dir);
|
|
136888
137464
|
if (iconPath) {
|
|
136889
137465
|
try {
|
|
136890
|
-
const bytes2 =
|
|
137466
|
+
const bytes2 = readFileSync53(iconPath);
|
|
136891
137467
|
await store.putIcon(app, bytes2);
|
|
136892
137468
|
iconHash = sha2564(bytes2);
|
|
136893
137469
|
} catch {
|
|
@@ -136909,7 +137485,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136909
137485
|
}
|
|
136910
137486
|
const seenAssetSha = /* @__PURE__ */ new Set();
|
|
136911
137487
|
for (const a2 of collected) {
|
|
136912
|
-
const bytes2 =
|
|
137488
|
+
const bytes2 = readFileSync53(a2.path);
|
|
136913
137489
|
const hash2 = sha2564(bytes2);
|
|
136914
137490
|
if (!seenAssetSha.has(hash2)) {
|
|
136915
137491
|
await store.putAsset(app, hash2, bytes2, a2.contentType);
|
|
@@ -136931,7 +137507,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136931
137507
|
const fontWarnings = [];
|
|
136932
137508
|
try {
|
|
136933
137509
|
const appTokens = readTokensForLint(preloaded) ?? {};
|
|
136934
|
-
const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(
|
|
137510
|
+
const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync53(join47(preloaded.dir, "fonts.json"), "utf8")) : {};
|
|
136935
137511
|
fontPlan = planFonts(appTokens, policy);
|
|
136936
137512
|
} catch (err) {
|
|
136937
137513
|
throw new Error(
|
|
@@ -136947,7 +137523,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136947
137523
|
`[release-build] ${family.name} face ${face.postScriptName} has no local bytes (sha ${face.sha256.slice(0, 12)}\u2026), so the release would declare a face the asset route cannot serve. Run \`npm run fonts:catalog\` to warm the cache before publishing.`
|
|
136948
137524
|
);
|
|
136949
137525
|
}
|
|
136950
|
-
const bytes2 =
|
|
137526
|
+
const bytes2 = readFileSync53(src);
|
|
136951
137527
|
const hash2 = sha2564(bytes2);
|
|
136952
137528
|
if (hash2 !== face.sha256) {
|
|
136953
137529
|
throw new Error(
|
|
@@ -136997,7 +137573,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
136997
137573
|
if (store.putAsset) {
|
|
136998
137574
|
for (const face of collectBrandFonts(preloaded.dir)) {
|
|
136999
137575
|
try {
|
|
137000
|
-
const bytes2 =
|
|
137576
|
+
const bytes2 = readFileSync53(face.path);
|
|
137001
137577
|
if (bytes2.length === 0) continue;
|
|
137002
137578
|
const hash2 = sha2564(bytes2);
|
|
137003
137579
|
await store.putAsset(app, hash2, bytes2, "font/ttf");
|
|
@@ -137464,7 +138040,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
|
|
|
137464
138040
|
const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join47(preloaded.dir, "functions", `${definition.name}${extension}`));
|
|
137465
138041
|
const source = candidates.find((candidate) => existsSync47(candidate));
|
|
137466
138042
|
if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
|
|
137467
|
-
sources[definition.name] =
|
|
138043
|
+
sources[definition.name] = readFileSync53(source, "utf8");
|
|
137468
138044
|
}
|
|
137469
138045
|
const built = await buildFunctions(config.functions.functions, sources);
|
|
137470
138046
|
const bundles = {};
|
|
@@ -138099,7 +138675,7 @@ __export(build_changes_exports, {
|
|
|
138099
138675
|
diffTokens: () => diffTokens,
|
|
138100
138676
|
headline: () => headline
|
|
138101
138677
|
});
|
|
138102
|
-
import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as
|
|
138678
|
+
import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as readFileSync54 } from "node:fs";
|
|
138103
138679
|
import { join as join48 } from "node:path";
|
|
138104
138680
|
function componentsOf(descriptor) {
|
|
138105
138681
|
const out2 = /* @__PURE__ */ new Map();
|
|
@@ -138239,7 +138815,7 @@ var init_build_changes = __esm({
|
|
|
138239
138815
|
scalar2 = (v2) => typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean";
|
|
138240
138816
|
readJson3 = (path2) => {
|
|
138241
138817
|
try {
|
|
138242
|
-
return JSON.parse(
|
|
138818
|
+
return JSON.parse(readFileSync54(path2, "utf8"));
|
|
138243
138819
|
} catch {
|
|
138244
138820
|
return void 0;
|
|
138245
138821
|
}
|
|
@@ -138256,7 +138832,7 @@ var init_build_changes = __esm({
|
|
|
138256
138832
|
});
|
|
138257
138833
|
|
|
138258
138834
|
// src/studio-timeline.ts
|
|
138259
|
-
import { existsSync as existsSync49, readFileSync as
|
|
138835
|
+
import { existsSync as existsSync49, readFileSync as readFileSync55 } from "node:fs";
|
|
138260
138836
|
import { join as join49 } from "node:path";
|
|
138261
138837
|
function stateOf(view) {
|
|
138262
138838
|
const j2 = view.journal[0];
|
|
@@ -138327,7 +138903,7 @@ function readTimeline(dir) {
|
|
|
138327
138903
|
const file2 = join49(dir, TIMELINE_FILE);
|
|
138328
138904
|
if (!existsSync49(file2)) return [];
|
|
138329
138905
|
const out2 = [];
|
|
138330
|
-
for (const line of
|
|
138906
|
+
for (const line of readFileSync55(file2, "utf8").split("\n")) {
|
|
138331
138907
|
if (!line.trim()) continue;
|
|
138332
138908
|
try {
|
|
138333
138909
|
const f2 = JSON.parse(line);
|
|
@@ -138420,8 +138996,8 @@ __export(studio_exports, {
|
|
|
138420
138996
|
renderStudioHtml: () => renderStudioHtml,
|
|
138421
138997
|
writeStudioRecord: () => writeStudioRecord
|
|
138422
138998
|
});
|
|
138423
|
-
import { createHash as
|
|
138424
|
-
import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as
|
|
138999
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
139000
|
+
import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as readFileSync56, realpathSync as realpathSync8, statSync as statSync12 } from "node:fs";
|
|
138425
139001
|
import { basename as basename11, extname as extname3, join as join50, relative as relative9, resolve as resolve40, sep as sep11 } from "node:path";
|
|
138426
139002
|
import { pathToFileURL as pathToFileURL7 } from "node:url";
|
|
138427
139003
|
function realInside(dir, abs) {
|
|
@@ -138452,7 +139028,7 @@ function archiveFile(dir, memory, abs) {
|
|
|
138452
139028
|
}
|
|
138453
139029
|
let archived;
|
|
138454
139030
|
try {
|
|
138455
|
-
archived = archiveBytes(dir,
|
|
139031
|
+
archived = archiveBytes(dir, readFileSync56(real));
|
|
138456
139032
|
} catch {
|
|
138457
139033
|
return null;
|
|
138458
139034
|
}
|
|
@@ -138702,7 +139278,7 @@ function buildView(dir, memory, now) {
|
|
|
138702
139278
|
reveal: memory.reveal ?? null
|
|
138703
139279
|
};
|
|
138704
139280
|
const { generatedAt: _ignored, timelineFrames: _count, ...stable } = view;
|
|
138705
|
-
const v2 =
|
|
139281
|
+
const v2 = createHash26("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
|
|
138706
139282
|
return { v: v2, ...view };
|
|
138707
139283
|
}
|
|
138708
139284
|
function writeAtomic(file2, content) {
|
|
@@ -138780,7 +139356,7 @@ var init_studio = __esm({
|
|
|
138780
139356
|
MAX_NAV_EDGES = 40;
|
|
138781
139357
|
readJson4 = (file2) => {
|
|
138782
139358
|
try {
|
|
138783
|
-
return JSON.parse(
|
|
139359
|
+
return JSON.parse(readFileSync56(file2, "utf8"));
|
|
138784
139360
|
} catch {
|
|
138785
139361
|
return null;
|
|
138786
139362
|
}
|
|
@@ -139344,11 +139920,11 @@ __export(captcha_exports, {
|
|
|
139344
139920
|
captchaContentInput: () => captchaContentInput,
|
|
139345
139921
|
runCaptcha: () => runCaptcha
|
|
139346
139922
|
});
|
|
139347
|
-
import { readFileSync as
|
|
139923
|
+
import { readFileSync as readFileSync57 } from "node:fs";
|
|
139348
139924
|
import { resolve as resolve41 } from "node:path";
|
|
139349
139925
|
function readObject(path2) {
|
|
139350
139926
|
try {
|
|
139351
|
-
return JSON.parse(
|
|
139927
|
+
return JSON.parse(readFileSync57(path2, "utf8"));
|
|
139352
139928
|
} catch {
|
|
139353
139929
|
return {};
|
|
139354
139930
|
}
|
|
@@ -139418,7 +139994,7 @@ __export(preflight_exports, {
|
|
|
139418
139994
|
parseStoreConfig: () => parseStoreConfig,
|
|
139419
139995
|
requireEnv: () => requireEnv
|
|
139420
139996
|
});
|
|
139421
|
-
import { existsSync as existsSync51, readFileSync as
|
|
139997
|
+
import { existsSync as existsSync51, readFileSync as readFileSync58 } from "node:fs";
|
|
139422
139998
|
import { isAbsolute as isAbsolute4, relative as relative10, resolve as resolve42 } from "node:path";
|
|
139423
139999
|
function isInsideRepo(p2) {
|
|
139424
140000
|
const rel = relative10(REPO_ROOT3, resolve42(p2));
|
|
@@ -139478,7 +140054,7 @@ function loadStoreConfig(app) {
|
|
|
139478
140054
|
if (!existsSync51(p2)) {
|
|
139479
140055
|
throw new Error(`No store config at ${p2}. Create apps/${app}/store/store.config.yaml first (see /setup-store-signing).`);
|
|
139480
140056
|
}
|
|
139481
|
-
return parseStoreConfig(
|
|
140057
|
+
return parseStoreConfig(readFileSync58(p2, "utf8"));
|
|
139482
140058
|
}
|
|
139483
140059
|
var init_preflight = __esm({
|
|
139484
140060
|
"../store-release/preflight.ts"() {
|
|
@@ -145548,7 +146124,7 @@ var init_fxp = __esm({
|
|
|
145548
146124
|
});
|
|
145549
146125
|
|
|
145550
146126
|
// ../../packages/serve/src/pkcs12.ts
|
|
145551
|
-
import { X509Certificate, createHash as
|
|
146127
|
+
import { X509Certificate, createHash as createHash27, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
|
|
145552
146128
|
function decodePkcs12(der, password) {
|
|
145553
146129
|
try {
|
|
145554
146130
|
const pfx = readSequence(der, 0);
|
|
@@ -145822,7 +146398,7 @@ function expand(src, v2) {
|
|
|
145822
146398
|
return out2;
|
|
145823
146399
|
}
|
|
145824
146400
|
function sha12(data) {
|
|
145825
|
-
return
|
|
146401
|
+
return createHash27("sha1").update(data).digest();
|
|
145826
146402
|
}
|
|
145827
146403
|
function readAt(buf, i2) {
|
|
145828
146404
|
if (i2 >= buf.length) return void 0;
|
|
@@ -145911,7 +146487,7 @@ var init_pkcs12 = __esm({
|
|
|
145911
146487
|
});
|
|
145912
146488
|
|
|
145913
146489
|
// ../../packages/serve/src/customer-signing-assets.ts
|
|
145914
|
-
import { createHash as
|
|
146490
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
145915
146491
|
function readValue(node) {
|
|
145916
146492
|
const [tag, children] = Object.entries(node)[0] ?? [];
|
|
145917
146493
|
if (!tag || !Array.isArray(children)) return refuse3("customer_profile_invalid");
|
|
@@ -145989,7 +146565,7 @@ function toBundle(assets, expected, decoded, profileType, apns, deviceCount) {
|
|
|
145989
146565
|
provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
|
|
145990
146566
|
profileSha256: sha2565(assets.provisioningProfile),
|
|
145991
146567
|
certificateSha256: sha2565(decoded.cert.raw),
|
|
145992
|
-
certificateSha1:
|
|
146568
|
+
certificateSha1: createHash28("sha1").update(decoded.cert.raw).digest("hex").toUpperCase(),
|
|
145993
146569
|
expiresAt: new Date(Math.min(decoded.expiration, Date.parse(decoded.cert.validTo))).toISOString(),
|
|
145994
146570
|
...apns ? { apnsEnvironment: apns } : {},
|
|
145995
146571
|
deviceCount
|
|
@@ -146040,7 +146616,7 @@ var init_customer_signing_assets = __esm({
|
|
|
146040
146616
|
init_fxp();
|
|
146041
146617
|
init_pkcs12();
|
|
146042
146618
|
init_customer_dist_signing();
|
|
146043
|
-
sha2565 = (bytes2) =>
|
|
146619
|
+
sha2565 = (bytes2) => createHash28("sha256").update(bytes2).digest("hex");
|
|
146044
146620
|
refuse3 = (code) => {
|
|
146045
146621
|
throw new CustomerSigningError(code);
|
|
146046
146622
|
};
|
|
@@ -146207,11 +146783,11 @@ var init_customer_signing_inspect = __esm({
|
|
|
146207
146783
|
});
|
|
146208
146784
|
|
|
146209
146785
|
// src/push-onboarding.ts
|
|
146210
|
-
import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as
|
|
146786
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as readFileSync59, statSync as statSync13, writeFileSync as writeFileSync20, chmodSync as chmodSync2 } from "node:fs";
|
|
146211
146787
|
import { basename as basename12, dirname as dirname32, join as join51, resolve as resolve43 } from "node:path";
|
|
146212
146788
|
function readJson5(path2) {
|
|
146213
146789
|
try {
|
|
146214
|
-
const parsed = JSON.parse(
|
|
146790
|
+
const parsed = JSON.parse(readFileSync59(path2, "utf8"));
|
|
146215
146791
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
146216
146792
|
} catch {
|
|
146217
146793
|
return {};
|
|
@@ -146296,7 +146872,7 @@ function readKeyFile(path2) {
|
|
|
146296
146872
|
}
|
|
146297
146873
|
let body;
|
|
146298
146874
|
try {
|
|
146299
|
-
body =
|
|
146875
|
+
body = readFileSync59(path2, "utf8");
|
|
146300
146876
|
} catch {
|
|
146301
146877
|
return { ok: false, code: "key_file_unreadable", reason: "cannot read the selected key file; check its path and file permissions" };
|
|
146302
146878
|
}
|
|
@@ -146454,7 +147030,7 @@ var signing_inspect_exports = {};
|
|
|
146454
147030
|
__export(signing_inspect_exports, {
|
|
146455
147031
|
runSigningInspect: () => runSigningInspect
|
|
146456
147032
|
});
|
|
146457
|
-
import { existsSync as existsSync53, readFileSync as
|
|
147033
|
+
import { existsSync as existsSync53, readFileSync as readFileSync60, statSync as statSync14 } from "node:fs";
|
|
146458
147034
|
import { isAbsolute as isAbsolute5, resolve as resolve44 } from "node:path";
|
|
146459
147035
|
function fail3(io2, code, fields = {}) {
|
|
146460
147036
|
io2.error(JSON.stringify({ ok: false, code, ...fields }));
|
|
@@ -146551,9 +147127,9 @@ async function runSigningInspect(pos, flags, io2, deps = {}) {
|
|
|
146551
147127
|
return fail3(io2, "signing_inspect_local_assets_unreadable", { error: "cert or profile file is unexpectedly large" });
|
|
146552
147128
|
}
|
|
146553
147129
|
assets = {
|
|
146554
|
-
certificate:
|
|
147130
|
+
certificate: readFileSync60(certPath),
|
|
146555
147131
|
certificatePassword: text4(flags["cert-password"]),
|
|
146556
|
-
provisioningProfile:
|
|
147132
|
+
provisioningProfile: readFileSync60(profilePath2)
|
|
146557
147133
|
};
|
|
146558
147134
|
}
|
|
146559
147135
|
try {
|
|
@@ -146838,7 +147414,7 @@ __export(config_push_edit_exports, {
|
|
|
146838
147414
|
enablePushInConfig: () => enablePushInConfig,
|
|
146839
147415
|
previewPushConfigEdit: () => previewPushConfigEdit
|
|
146840
147416
|
});
|
|
146841
|
-
import { readFileSync as
|
|
147417
|
+
import { readFileSync as readFileSync61 } from "node:fs";
|
|
146842
147418
|
import { basename as basename13 } from "node:path";
|
|
146843
147419
|
import ts6 from "typescript";
|
|
146844
147420
|
function enablePushInConfig(source, options) {
|
|
@@ -146958,7 +147534,7 @@ function noLiteralInstruction(pingAppName) {
|
|
|
146958
147534
|
function previewPushConfigEdit(dir, options) {
|
|
146959
147535
|
const path2 = configEntry(dir);
|
|
146960
147536
|
if (!path2) return void 0;
|
|
146961
|
-
const { applied, instructions } = enablePushInConfig(
|
|
147537
|
+
const { applied, instructions } = enablePushInConfig(readFileSync61(path2, "utf8"), { ...options, fileName: basename13(path2) });
|
|
146962
147538
|
return { wouldApply: applied, instructions };
|
|
146963
147539
|
}
|
|
146964
147540
|
async function applyPushConfigEdit(dir, options, validate4) {
|
|
@@ -146967,7 +147543,7 @@ async function applyPushConfigEdit(dir, options, validate4) {
|
|
|
146967
147543
|
const fileName = basename13(path2);
|
|
146968
147544
|
const refuse7 = (why) => ({ changed: false, pushOn: false, applied: [], instructions: [why] });
|
|
146969
147545
|
if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: turn push on in the file it points to.`);
|
|
146970
|
-
const original =
|
|
147546
|
+
const original = readFileSync61(path2, "utf8");
|
|
146971
147547
|
const edit = enablePushInConfig(original, { ...options, fileName });
|
|
146972
147548
|
const { applied, instructions, pushOn } = edit;
|
|
146973
147549
|
if (!edit.changed) return { changed: false, pushOn, applied, instructions };
|
|
@@ -147285,9 +147861,9 @@ __export(pack_exports, {
|
|
|
147285
147861
|
unpackTo: () => unpackTo,
|
|
147286
147862
|
writeZip: () => writeZip
|
|
147287
147863
|
});
|
|
147288
|
-
import { createHash as
|
|
147864
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
147289
147865
|
import { deflateRawSync, inflateRawSync } from "node:zlib";
|
|
147290
|
-
import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as
|
|
147866
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync62, readdirSync as readdirSync28, rmSync as rmSync12, statSync as statSync15, writeFileSync as writeFileSync21 } from "node:fs";
|
|
147291
147867
|
import { dirname as dirname33, join as join53, resolve as resolve46 } from "node:path";
|
|
147292
147868
|
function writeZip(entries) {
|
|
147293
147869
|
const sorted2 = entries.slice().sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
|
|
@@ -147382,7 +147958,7 @@ function inflateEntry(buf, entry) {
|
|
|
147382
147958
|
return bytes2;
|
|
147383
147959
|
}
|
|
147384
147960
|
function readIf(path2) {
|
|
147385
|
-
return existsSync54(path2) && statSync15(path2).isFile() ?
|
|
147961
|
+
return existsSync54(path2) && statSync15(path2).isFile() ? readFileSync62(path2) : null;
|
|
147386
147962
|
}
|
|
147387
147963
|
function listDir(dir) {
|
|
147388
147964
|
return existsSync54(dir) ? readdirSync28(dir).filter((f2) => statSync15(join53(dir, f2)).isFile()) : [];
|
|
@@ -147435,11 +148011,11 @@ function gatherReleaseEntries(appDir3) {
|
|
|
147435
148011
|
return { entries, manifest, skipped };
|
|
147436
148012
|
}
|
|
147437
148013
|
function sha256Hex4(bytes2) {
|
|
147438
|
-
return
|
|
148014
|
+
return createHash29("sha256").update(bytes2).digest("hex");
|
|
147439
148015
|
}
|
|
147440
148016
|
function computeContentHash(entries) {
|
|
147441
148017
|
const input = packageHashInput(entries.map((e2) => ({ path: e2.path, hash: sha256Hex4(e2.bytes) })));
|
|
147442
|
-
return "sha256-" +
|
|
148018
|
+
return "sha256-" + createHash29("sha256").update(input).digest("base64");
|
|
147443
148019
|
}
|
|
147444
148020
|
function buildEntries(appDir3, app, opts) {
|
|
147445
148021
|
const { entries: released, manifest, skipped } = gatherReleaseEntries(appDir3);
|
|
@@ -147532,7 +148108,7 @@ function openPackageBuffer(buf) {
|
|
|
147532
148108
|
return openFromEntries(readZip(buf), { requireHeader: true });
|
|
147533
148109
|
}
|
|
147534
148110
|
function openPackageFile(file2) {
|
|
147535
|
-
return openPackageBuffer(
|
|
148111
|
+
return openPackageBuffer(readFileSync62(file2));
|
|
147536
148112
|
}
|
|
147537
148113
|
function openPackageDir(dir) {
|
|
147538
148114
|
const root = resolve46(dir);
|
|
@@ -147543,7 +148119,7 @@ function openPackageDir(dir) {
|
|
|
147543
148119
|
const childRel = rel ? `${rel}/${name}` : name;
|
|
147544
148120
|
const childAbs = join53(abs, name);
|
|
147545
148121
|
if (statSync15(childAbs).isDirectory()) walk2(childRel);
|
|
147546
|
-
else if (isSafeEntryName(childRel)) entries.set(childRel,
|
|
148122
|
+
else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync62(childAbs));
|
|
147547
148123
|
}
|
|
147548
148124
|
};
|
|
147549
148125
|
if (!existsSync54(root)) throw new Error(`no such package directory: ${root}`);
|
|
@@ -147630,8 +148206,8 @@ __export(app_source_exports, {
|
|
|
147630
148206
|
writeConflicts: () => writeConflicts,
|
|
147631
148207
|
zipAppSource: () => zipAppSource
|
|
147632
148208
|
});
|
|
147633
|
-
import { createHash as
|
|
147634
|
-
import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as
|
|
148209
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
148210
|
+
import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as readFileSync63, mkdirSync as mkdirSync26, writeFileSync as writeFileSync22, existsSync as existsSync55, rmSync as rmSync13, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
|
|
147635
148211
|
import { join as join54, resolve as resolve47, sep as sep13 } from "node:path";
|
|
147636
148212
|
import { createRequire as createRequire3 } from "node:module";
|
|
147637
148213
|
import { deflateRawSync as deflateRawSync2 } from "node:zlib";
|
|
@@ -147665,7 +148241,7 @@ function collectAppSource(dir) {
|
|
|
147665
148241
|
const skipped = [];
|
|
147666
148242
|
walkSourceTree(
|
|
147667
148243
|
dir,
|
|
147668
|
-
(archivePath, hostRel) => entries.push({ path: archivePath, bytes:
|
|
148244
|
+
(archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync63(join54(dir, hostRel)) }),
|
|
147669
148245
|
(hostRel) => skipped.push(hostRel)
|
|
147670
148246
|
);
|
|
147671
148247
|
entries.sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
|
|
@@ -147746,13 +148322,13 @@ function sourceFingerprint(dir) {
|
|
|
147746
148322
|
dir,
|
|
147747
148323
|
(archivePath, hostRel) => {
|
|
147748
148324
|
if (/\.md$/i.test(archivePath)) return;
|
|
147749
|
-
files.push(`${archivePath}\0${
|
|
148325
|
+
files.push(`${archivePath}\0${createHash30("sha256").update(readFileSync63(join54(dir, hostRel))).digest("hex")}`);
|
|
147750
148326
|
},
|
|
147751
148327
|
() => {
|
|
147752
148328
|
}
|
|
147753
148329
|
);
|
|
147754
148330
|
files.sort();
|
|
147755
|
-
return
|
|
148331
|
+
return createHash30("sha256").update(files.join("\n")).digest("hex");
|
|
147756
148332
|
}
|
|
147757
148333
|
function largestEntries(entries, limit = 5) {
|
|
147758
148334
|
return entries.map((e2) => ({
|
|
@@ -147959,7 +148535,7 @@ __export(run_watch_exports, {
|
|
|
147959
148535
|
watchedContentDir: () => watchedContentDir,
|
|
147960
148536
|
writeRunRecord: () => writeRunRecord
|
|
147961
148537
|
});
|
|
147962
|
-
import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as
|
|
148538
|
+
import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as readFileSync64, realpathSync as realpathSync9, renameSync as renameSync10, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
|
|
147963
148539
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
147964
148540
|
import { extname as extname4, join as join55, resolve as resolve48, sep as sep14 } from "node:path";
|
|
147965
148541
|
function diffReleases(prev, next) {
|
|
@@ -148217,7 +148793,7 @@ function readConfined(root, rel) {
|
|
|
148217
148793
|
const fd = openSync4(at2, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
|
|
148218
148794
|
try {
|
|
148219
148795
|
if (!fstatSync(fd).isFile()) return null;
|
|
148220
|
-
return
|
|
148796
|
+
return readFileSync64(fd);
|
|
148221
148797
|
} finally {
|
|
148222
148798
|
closeSync4(fd);
|
|
148223
148799
|
}
|
|
@@ -148274,8 +148850,8 @@ __export(screen_state_exports, {
|
|
|
148274
148850
|
shotStateFor: () => shotStateFor,
|
|
148275
148851
|
withHomeCaveat: () => withHomeCaveat
|
|
148276
148852
|
});
|
|
148277
|
-
import { createHash as
|
|
148278
|
-
import { lstatSync as lstatSync17, readFileSync as
|
|
148853
|
+
import { createHash as createHash31 } from "node:crypto";
|
|
148854
|
+
import { lstatSync as lstatSync17, readFileSync as readFileSync65 } from "node:fs";
|
|
148279
148855
|
import { join as join56 } from "node:path";
|
|
148280
148856
|
function quotableLine(text9) {
|
|
148281
148857
|
if (!text9) return void 0;
|
|
@@ -148335,7 +148911,7 @@ function readRecord(dir) {
|
|
|
148335
148911
|
const file2 = join56(dir, SHOT_STATES_FILE);
|
|
148336
148912
|
try {
|
|
148337
148913
|
if (!lstatSync17(file2).isFile()) return {};
|
|
148338
|
-
const r2 = JSON.parse(
|
|
148914
|
+
const r2 = JSON.parse(readFileSync65(file2, "utf8"));
|
|
148339
148915
|
return r2.v === 1 && r2.shots && typeof r2.shots === "object" ? r2.shots : {};
|
|
148340
148916
|
} catch {
|
|
148341
148917
|
return {};
|
|
@@ -148394,7 +148970,7 @@ var init_screen_state = __esm({
|
|
|
148394
148970
|
KEEP = 40;
|
|
148395
148971
|
LINE_MAX = 120;
|
|
148396
148972
|
str3 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
|
|
148397
|
-
sha256Of = (file2) =>
|
|
148973
|
+
sha256Of = (file2) => createHash31("sha256").update(readFileSync65(file2)).digest("hex");
|
|
148398
148974
|
}
|
|
148399
148975
|
});
|
|
148400
148976
|
|
|
@@ -148409,8 +148985,8 @@ __export(studio_reel_exports, {
|
|
|
148409
148985
|
thin: () => thin,
|
|
148410
148986
|
utcDay: () => utcDay
|
|
148411
148987
|
});
|
|
148412
|
-
import { createHash as
|
|
148413
|
-
import { lstatSync as lstatSync18, readFileSync as
|
|
148988
|
+
import { createHash as createHash32 } from "node:crypto";
|
|
148989
|
+
import { lstatSync as lstatSync18, readFileSync as readFileSync66 } from "node:fs";
|
|
148414
148990
|
import { basename as basename14, join as join57 } from "node:path";
|
|
148415
148991
|
function loadMemory2(dir) {
|
|
148416
148992
|
const m2 = readJson6(join57(dir, ".himi", "studio", "memory.json"));
|
|
@@ -148497,8 +149073,8 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
|
|
|
148497
149073
|
const path2 = join57(dir, HISTORY_DIR, f2);
|
|
148498
149074
|
const st2 = lstatSync18(path2);
|
|
148499
149075
|
if (!st2.isFile() || st2.nlink !== 1) return null;
|
|
148500
|
-
const bytes2 =
|
|
148501
|
-
return
|
|
149076
|
+
const bytes2 = readFileSync66(path2);
|
|
149077
|
+
return createHash32("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
|
|
148502
149078
|
} catch {
|
|
148503
149079
|
return null;
|
|
148504
149080
|
}
|
|
@@ -148631,7 +149207,7 @@ var init_studio_reel = __esm({
|
|
|
148631
149207
|
mimeOf = (file2) => MIME2[file2.slice(65)] ?? "image/png";
|
|
148632
149208
|
readJson6 = (file2) => {
|
|
148633
149209
|
try {
|
|
148634
|
-
return JSON.parse(
|
|
149210
|
+
return JSON.parse(readFileSync66(file2, "utf8"));
|
|
148635
149211
|
} catch {
|
|
148636
149212
|
return null;
|
|
148637
149213
|
}
|
|
@@ -148648,12 +149224,12 @@ var init_studio_reel = __esm({
|
|
|
148648
149224
|
});
|
|
148649
149225
|
|
|
148650
149226
|
// src/home-screen-id.ts
|
|
148651
|
-
import { readFileSync as
|
|
149227
|
+
import { readFileSync as readFileSync67 } from "node:fs";
|
|
148652
149228
|
import { join as join58 } from "node:path";
|
|
148653
149229
|
function homeScreenIdOf(dir) {
|
|
148654
149230
|
let src;
|
|
148655
149231
|
try {
|
|
148656
|
-
src =
|
|
149232
|
+
src = readFileSync67(join58(dir, "dev", "index.ts"), "utf8");
|
|
148657
149233
|
} catch {
|
|
148658
149234
|
return null;
|
|
148659
149235
|
}
|
|
@@ -148719,9 +149295,9 @@ __export(milestones_exports, {
|
|
|
148719
149295
|
watchUrlFor: () => watchUrlFor,
|
|
148720
149296
|
writeHandoverReel: () => writeHandoverReel
|
|
148721
149297
|
});
|
|
148722
|
-
import { createHash as
|
|
149298
|
+
import { createHash as createHash33, randomUUID as randomUUID7 } from "node:crypto";
|
|
148723
149299
|
import { spawn as spawn5 } from "node:child_process";
|
|
148724
|
-
import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as
|
|
149300
|
+
import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as readFileSync68, statSync as statSync17 } from "node:fs";
|
|
148725
149301
|
import { createServer as createServer4 } from "node:net";
|
|
148726
149302
|
import { basename as basename15, dirname as dirname34, isAbsolute as isAbsolute6, join as join59, relative as relative11, resolve as resolve49, sep as sep15 } from "node:path";
|
|
148727
149303
|
function homeShotPath(dir, home) {
|
|
@@ -149067,7 +149643,7 @@ function lastDraft(dir) {
|
|
|
149067
149643
|
try {
|
|
149068
149644
|
const file2 = join59(dir, LAST_DRAFT_FILE);
|
|
149069
149645
|
if (!lstatSync19(file2).isFile()) return null;
|
|
149070
|
-
const r2 = JSON.parse(
|
|
149646
|
+
const r2 = JSON.parse(readFileSync68(file2, "utf8"));
|
|
149071
149647
|
const m2 = r2.manifest;
|
|
149072
149648
|
if (r2.v !== 1 || typeof r2.releaseId !== "string" || !m2 || typeof m2.screens !== "object" || !m2.screens || typeof m2.bundles !== "object" || !m2.bundles) return null;
|
|
149073
149649
|
return { releaseId: r2.releaseId, manifest: m2 };
|
|
@@ -149129,7 +149705,7 @@ function readInitSource(dir) {
|
|
|
149129
149705
|
const file2 = join59(dir, INIT_SOURCE_FILE);
|
|
149130
149706
|
try {
|
|
149131
149707
|
if (!lstatSync19(file2).isFile()) return null;
|
|
149132
|
-
const r2 = JSON.parse(
|
|
149708
|
+
const r2 = JSON.parse(readFileSync68(file2, "utf8"));
|
|
149133
149709
|
if (r2.v !== 1 || typeof r2.fingerprint !== "string" || !/^[0-9a-f]{64}$/.test(r2.fingerprint) || typeof r2.newestMs !== "number") return null;
|
|
149134
149710
|
return {
|
|
149135
149711
|
v: 1,
|
|
@@ -149217,7 +149793,7 @@ function readInitWatch(dir) {
|
|
|
149217
149793
|
const file2 = join59(dir, INIT_WATCH_FILE);
|
|
149218
149794
|
try {
|
|
149219
149795
|
if (!lstatSync19(file2).isFile()) return null;
|
|
149220
|
-
const r2 = JSON.parse(
|
|
149796
|
+
const r2 = JSON.parse(readFileSync68(file2, "utf8"));
|
|
149221
149797
|
if (r2.v !== 1 || typeof r2.pid !== "number" || !Number.isInteger(r2.pid) || r2.pid < 1) return null;
|
|
149222
149798
|
if (typeof r2.url !== "string" || !/^http:\/\/127\.0\.0\.1:\d+\//.test(r2.url) || typeof r2.board !== "string" || typeof r2.log !== "string" || typeof r2.startedAt !== "string") return null;
|
|
149223
149799
|
if (r2.root !== runRootId(dir)) return null;
|
|
@@ -149249,7 +149825,7 @@ function watchReminder(dir, opts = {}) {
|
|
|
149249
149825
|
const file2 = join59(dir, REMINDERS_FILE);
|
|
149250
149826
|
let last = Number.NaN;
|
|
149251
149827
|
try {
|
|
149252
|
-
if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(
|
|
149828
|
+
if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(readFileSync68(file2, "utf8")).watch ?? "");
|
|
149253
149829
|
} catch {
|
|
149254
149830
|
}
|
|
149255
149831
|
if (Number.isFinite(last) && now - last >= 0 && now - last < WATCH_REMINDER_EVERY_MS) return void 0;
|
|
@@ -149409,7 +149985,7 @@ var init_milestones = __esm({
|
|
|
149409
149985
|
INIT_SOURCE_FILE = join59(".himi", "init-source.json");
|
|
149410
149986
|
STARTING_POINT_REF = "starting-point";
|
|
149411
149987
|
TEMPLATE_NAME = /^[A-Za-z0-9._-]{1,64}$/;
|
|
149412
|
-
sha256Of2 = (file2) =>
|
|
149988
|
+
sha256Of2 = (file2) => createHash33("sha256").update(readFileSync68(file2)).digest("hex");
|
|
149413
149989
|
WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
|
|
149414
149990
|
REMINDERS_FILE = join59(".himi", "reminders.json");
|
|
149415
149991
|
pidAlive = (pid) => {
|
|
@@ -149456,7 +150032,7 @@ __export(template_sweep_exports, {
|
|
|
149456
150032
|
sweepCopy: () => sweepCopy,
|
|
149457
150033
|
sweepPairs: () => sweepPairs
|
|
149458
150034
|
});
|
|
149459
|
-
import { readFileSync as
|
|
150035
|
+
import { readFileSync as readFileSync69, writeFileSync as writeFileSync24 } from "node:fs";
|
|
149460
150036
|
import { join as join60 } from "node:path";
|
|
149461
150037
|
import ts7 from "typescript";
|
|
149462
150038
|
function isCopy(node, file2) {
|
|
@@ -149498,7 +150074,7 @@ function sweepCopy(dir, pairs, dryRun) {
|
|
|
149498
150074
|
const next = /* @__PURE__ */ new Map();
|
|
149499
150075
|
const replaced = pairs.map(([from, to2]) => ({ from, to: to2, files: {} }));
|
|
149500
150076
|
for (const f2 of files) {
|
|
149501
|
-
const text9 =
|
|
150077
|
+
const text9 = readFileSync69(join60(dir, f2), "utf8");
|
|
149502
150078
|
if (!pairs.some(([from]) => text9.includes(from) || text9.includes(JSON.stringify(from).slice(1, -1)))) continue;
|
|
149503
150079
|
const kind = f2.endsWith(".json") ? ts7.ScriptKind.JSON : f2.endsWith("x") ? ts7.ScriptKind.TSX : ts7.ScriptKind.TS;
|
|
149504
150080
|
const sf2 = ts7.createSourceFile(f2, text9, ts7.ScriptTarget.Latest, true, kind);
|
|
@@ -149527,8 +150103,8 @@ function sweepCopy(dir, pairs, dryRun) {
|
|
|
149527
150103
|
if (errors.length) throw new TrimRefusal(`the sweep would break ${f2} \u2014 nothing written: ${errors[0]}`);
|
|
149528
150104
|
next.set(f2, out2);
|
|
149529
150105
|
}
|
|
149530
|
-
const dev = next.get("dev/index.ts") ??
|
|
149531
|
-
const config = next.get("config.ts") ??
|
|
150106
|
+
const dev = next.get("dev/index.ts") ?? readFileSync69(join60(dir, "dev", "index.ts"), "utf8");
|
|
150107
|
+
const config = next.get("config.ts") ?? readFileSync69(join60(dir, "config.ts"), "utf8");
|
|
149532
150108
|
try {
|
|
149533
150109
|
parseApp(dev, config);
|
|
149534
150110
|
} catch (e2) {
|
|
@@ -149536,7 +150112,7 @@ function sweepCopy(dir, pairs, dryRun) {
|
|
|
149536
150112
|
}
|
|
149537
150113
|
if (!dryRun) for (const [f2, t2] of next) writeFileSync24(join60(dir, f2), t2);
|
|
149538
150114
|
const g2 = new RegExp(PLACEHOLDER.source, `${PLACEHOLDER.flags.replace("g", "")}g`);
|
|
149539
|
-
const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ??
|
|
150115
|
+
const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync69(join60(dir, f2), "utf8")).matchAll(g2)].length, 0);
|
|
149540
150116
|
return {
|
|
149541
150117
|
ok: true,
|
|
149542
150118
|
dryRun,
|
|
@@ -149553,7 +150129,7 @@ function sweepPairs(set, mapFile) {
|
|
|
149553
150129
|
pairs.push([s2.slice(0, at2), s2.slice(at2 + 2)]);
|
|
149554
150130
|
}
|
|
149555
150131
|
if (mapFile) {
|
|
149556
|
-
const map = JSON.parse(
|
|
150132
|
+
const map = JSON.parse(readFileSync69(mapFile, "utf8"));
|
|
149557
150133
|
for (const [k2, v2] of Object.entries(map)) {
|
|
149558
150134
|
if (typeof v2 !== "string") throw new TrimRefusal(`--map ${mapFile}: "${k2}" must map to a string`);
|
|
149559
150135
|
pairs.push([k2, v2]);
|
|
@@ -149798,18 +150374,18 @@ __export(template_recommend_exports, {
|
|
|
149798
150374
|
recommendTemplates: () => recommendTemplates,
|
|
149799
150375
|
verticalsFromBook: () => verticalsFromBook
|
|
149800
150376
|
});
|
|
149801
|
-
import { existsSync as existsSync58, readFileSync as
|
|
150377
|
+
import { existsSync as existsSync58, readFileSync as readFileSync70 } from "node:fs";
|
|
149802
150378
|
import { join as join61 } from "node:path";
|
|
149803
150379
|
function verticalsFromBook(path2) {
|
|
149804
150380
|
const dir = existsSync58(join61(path2, "book.json")) || existsSync58(join61(path2, "provisioning.overlay.json")) ? path2 : join61(path2, ".himi", "business-book");
|
|
149805
150381
|
const overlay = join61(dir, "provisioning.overlay.json");
|
|
149806
150382
|
if (existsSync58(overlay)) {
|
|
149807
|
-
const v2 = JSON.parse(
|
|
150383
|
+
const v2 = JSON.parse(readFileSync70(overlay, "utf8")).installedVerticals;
|
|
149808
150384
|
if (Array.isArray(v2) && v2.length) return v2.filter((x2) => typeof x2 === "string");
|
|
149809
150385
|
}
|
|
149810
150386
|
const book = join61(dir, "book.json");
|
|
149811
150387
|
if (existsSync58(book)) {
|
|
149812
|
-
const probes = JSON.parse(
|
|
150388
|
+
const probes = JSON.parse(readFileSync70(book, "utf8")).probes;
|
|
149813
150389
|
if (Array.isArray(probes)) return installedFromProbes(probes);
|
|
149814
150390
|
}
|
|
149815
150391
|
throw new Error(`no book.json / provisioning.overlay.json under ${path2} \u2014 run \`himi site analyze\` first, or pass --verticals`);
|
|
@@ -150219,7 +150795,7 @@ __export(eject_exports, {
|
|
|
150219
150795
|
EJECTABLE: () => EJECTABLE,
|
|
150220
150796
|
ejectModule: () => ejectModule
|
|
150221
150797
|
});
|
|
150222
|
-
import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as
|
|
150798
|
+
import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as readFileSync71, writeFileSync as writeFileSync25 } from "node:fs";
|
|
150223
150799
|
import { dirname as dirname35, join as join62, relative as relative12, resolve as resolve50, sep as sep16 } from "node:path";
|
|
150224
150800
|
function locate(repoRootOrCwd, mod) {
|
|
150225
150801
|
const inRepo = resolve50(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
|
|
@@ -150263,7 +150839,7 @@ function ejectModule(opts) {
|
|
|
150263
150839
|
// gate still applies. Ejecting buys layout and flow, never the floor.
|
|
150264
150840
|
|
|
150265
150841
|
`;
|
|
150266
|
-
const normalized =
|
|
150842
|
+
const normalized = readFileSync71(found.path, "utf8").replace(
|
|
150267
150843
|
/(["'])@himalaya\/([a-z0-9-]+(?:\/[a-z0-9-]+)?)\1/g,
|
|
150268
150844
|
(_m, q2, sub) => `${q2}@wix/himalaya/${sub}${q2}`
|
|
150269
150845
|
);
|
|
@@ -150271,7 +150847,7 @@ function ejectModule(opts) {
|
|
|
150271
150847
|
const rewired = [];
|
|
150272
150848
|
for (const f2 of files) {
|
|
150273
150849
|
if (!existsSync59(f2)) continue;
|
|
150274
|
-
const before =
|
|
150850
|
+
const before = readFileSync71(f2, "utf8");
|
|
150275
150851
|
let after = before;
|
|
150276
150852
|
let rel = relative12(dirname35(f2), target).split(sep16).join("/").replace(/\.tsx?$/, ".js");
|
|
150277
150853
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
@@ -150391,7 +150967,7 @@ var init_app_map = __esm({
|
|
|
150391
150967
|
});
|
|
150392
150968
|
|
|
150393
150969
|
// src/wix-writes.ts
|
|
150394
|
-
import { existsSync as existsSync60, readFileSync as
|
|
150970
|
+
import { existsSync as existsSync60, readFileSync as readFileSync72 } from "node:fs";
|
|
150395
150971
|
import { join as join63 } from "node:path";
|
|
150396
150972
|
function isProvenRead(method, path2) {
|
|
150397
150973
|
if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
|
|
@@ -150514,7 +151090,7 @@ function readDataAccess(dir) {
|
|
|
150514
151090
|
if (!existsSync60(p2)) continue;
|
|
150515
151091
|
let text9;
|
|
150516
151092
|
try {
|
|
150517
|
-
text9 =
|
|
151093
|
+
text9 = readFileSync72(p2, "utf8");
|
|
150518
151094
|
} catch {
|
|
150519
151095
|
continue;
|
|
150520
151096
|
}
|
|
@@ -150628,14 +151204,14 @@ __export(test_exports, {
|
|
|
150628
151204
|
scopeDescriptors: () => scopeDescriptors,
|
|
150629
151205
|
writeRecordedMocks: () => writeRecordedMocks
|
|
150630
151206
|
});
|
|
150631
|
-
import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as
|
|
151207
|
+
import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync73, writeFileSync as writeFileSync26 } from "node:fs";
|
|
150632
151208
|
import { join as join64, resolve as resolve51 } from "node:path";
|
|
150633
151209
|
function readTestConfig(dir) {
|
|
150634
151210
|
const p2 = resolve51(dir, TEST_CONFIG_FILE);
|
|
150635
151211
|
if (!existsSync61(p2)) return {};
|
|
150636
151212
|
let parsed;
|
|
150637
151213
|
try {
|
|
150638
|
-
parsed = JSON.parse(
|
|
151214
|
+
parsed = JSON.parse(readFileSync73(p2, "utf8"));
|
|
150639
151215
|
} catch (e2) {
|
|
150640
151216
|
throw new Error(`${TEST_CONFIG_FILE} is not valid JSON \u2014 ${e2.message}`);
|
|
150641
151217
|
}
|
|
@@ -150682,7 +151258,7 @@ function readTestConfig(dir) {
|
|
|
150682
151258
|
function readNetRules(path2) {
|
|
150683
151259
|
let parsed;
|
|
150684
151260
|
try {
|
|
150685
|
-
parsed = JSON.parse(
|
|
151261
|
+
parsed = JSON.parse(readFileSync73(path2, "utf8"));
|
|
150686
151262
|
} catch (e2) {
|
|
150687
151263
|
throw new Error(`--net ${path2} could not be read as JSON \u2014 ${e2.message}`);
|
|
150688
151264
|
}
|
|
@@ -150719,7 +151295,7 @@ function readCannedResponses() {
|
|
|
150719
151295
|
];
|
|
150720
151296
|
for (const url of candidates) {
|
|
150721
151297
|
try {
|
|
150722
|
-
const parsed = JSON.parse(
|
|
151298
|
+
const parsed = JSON.parse(readFileSync73(url, "utf8"));
|
|
150723
151299
|
const byKey = {};
|
|
150724
151300
|
for (const [k2, v2] of Object.entries(parsed)) {
|
|
150725
151301
|
if (!k2.startsWith("//")) byKey[k2] = v2;
|
|
@@ -151356,14 +151932,14 @@ var mobile_ux_lint_exports = {};
|
|
|
151356
151932
|
__export(mobile_ux_lint_exports, {
|
|
151357
151933
|
mobileUxIssues: () => mobileUxIssues
|
|
151358
151934
|
});
|
|
151359
|
-
import { existsSync as existsSync62, readFileSync as
|
|
151935
|
+
import { existsSync as existsSync62, readFileSync as readFileSync74 } from "node:fs";
|
|
151360
151936
|
import { join as join65 } from "node:path";
|
|
151361
151937
|
function mobileUxIssues(dir, strict) {
|
|
151362
151938
|
const file2 = join65(dir, "MOBILE-UX.md");
|
|
151363
151939
|
if (!existsSync62(file2)) return [];
|
|
151364
151940
|
let text9;
|
|
151365
151941
|
try {
|
|
151366
|
-
text9 =
|
|
151942
|
+
text9 = readFileSync74(file2, "utf8");
|
|
151367
151943
|
} catch {
|
|
151368
151944
|
return [];
|
|
151369
151945
|
}
|
|
@@ -152213,10 +152789,10 @@ var init_calls = __esm({
|
|
|
152213
152789
|
});
|
|
152214
152790
|
|
|
152215
152791
|
// ../../core/functions-runtime/src/queue.ts
|
|
152216
|
-
import { createHash as
|
|
152792
|
+
import { createHash as createHash34 } from "node:crypto";
|
|
152217
152793
|
function inputSchemaHash(definition) {
|
|
152218
152794
|
const schema = definition.input;
|
|
152219
|
-
return schema ?
|
|
152795
|
+
return schema ? createHash34("sha256").update(JSON.stringify(schema.descriptor ?? { kind: schema.kind, optional: schema.optional === true })).digest("hex") : "";
|
|
152220
152796
|
}
|
|
152221
152797
|
function createFunctionEnqueueCapability(options) {
|
|
152222
152798
|
return {
|
|
@@ -152282,14 +152858,14 @@ var init_queue = __esm({
|
|
|
152282
152858
|
});
|
|
152283
152859
|
|
|
152284
152860
|
// ../../core/data-resources/src/plan.ts
|
|
152285
|
-
import { createHash as
|
|
152861
|
+
import { createHash as createHash35 } from "node:crypto";
|
|
152286
152862
|
function canonical3(value) {
|
|
152287
152863
|
if (Array.isArray(value)) return `[${value.map(canonical3).join(",")}]`;
|
|
152288
152864
|
if (value && typeof value === "object") return `{${Object.entries(value).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([key2, item]) => `${JSON.stringify(key2)}:${canonical3(item)}`).join(",")}}`;
|
|
152289
152865
|
return JSON.stringify(value);
|
|
152290
152866
|
}
|
|
152291
152867
|
function hashResourcePlan(plan) {
|
|
152292
|
-
return
|
|
152868
|
+
return createHash35("sha256").update(canonical3(plan)).digest("hex");
|
|
152293
152869
|
}
|
|
152294
152870
|
function finalize(input) {
|
|
152295
152871
|
return { ...input, hash: hashResourcePlan(input) };
|
|
@@ -153044,7 +153620,7 @@ __export(functions_exports, {
|
|
|
153044
153620
|
resolveFunctionsTarget: () => resolveFunctionsTarget,
|
|
153045
153621
|
runRemoteFunctionOperation: () => runRemoteFunctionOperation
|
|
153046
153622
|
});
|
|
153047
|
-
import { readFileSync as
|
|
153623
|
+
import { readFileSync as readFileSync75, existsSync as existsSync63 } from "node:fs";
|
|
153048
153624
|
import { join as join66, resolve as resolve52 } from "node:path";
|
|
153049
153625
|
function resolveFunctionsTarget(input) {
|
|
153050
153626
|
const explicitUrl = input.functionsUrl?.trim();
|
|
@@ -153066,7 +153642,7 @@ async function loadFunctionsApp(dir) {
|
|
|
153066
153642
|
for (const definition of config.functions.functions) {
|
|
153067
153643
|
const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join66(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync63);
|
|
153068
153644
|
if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
|
|
153069
|
-
sources[definition.name] =
|
|
153645
|
+
sources[definition.name] = readFileSync75(source, "utf8");
|
|
153070
153646
|
}
|
|
153071
153647
|
const data = config.cms || config.data ? mergeDataResources(config) : void 0;
|
|
153072
153648
|
const dataErrors = validateDataResources(data, loaded.name).filter((issue2) => issue2.severity === "error");
|
|
@@ -153254,7 +153830,7 @@ var init_cli_bridge = __esm({
|
|
|
153254
153830
|
});
|
|
153255
153831
|
|
|
153256
153832
|
// src/mcp/file-tools.ts
|
|
153257
|
-
import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as
|
|
153833
|
+
import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as readFileSync76, realpathSync as realpathSync10, renameSync as renameSync11, rmSync as rmSync15, statSync as statSync18, writeSync, existsSync as existsSync64 } from "node:fs";
|
|
153258
153834
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
153259
153835
|
import { dirname as dirname36, isAbsolute as isAbsolute7, join as join67, relative as relative13, resolve as resolve53, sep as sep17 } from "node:path";
|
|
153260
153836
|
import * as z2 from "zod";
|
|
@@ -153427,7 +154003,7 @@ function fileTools() {
|
|
|
153427
154003
|
if (!existsSync64(p2) || !lstatSync20(p2).isFile()) return refuse5("not_found", `no file "${String(a2.path)}"`);
|
|
153428
154004
|
const size = statSync18(p2).size;
|
|
153429
154005
|
if (size > MAX_FILE_BYTES) return refuse5("too_large", `"${String(a2.path)}" is ${size} bytes \u2014 over the ${MAX_FILE_BYTES}-byte read limit`);
|
|
153430
|
-
return ok({ ok: true, path: a2.path, bytes: size, content:
|
|
154006
|
+
return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync76(p2, "utf8") });
|
|
153431
154007
|
}
|
|
153432
154008
|
},
|
|
153433
154009
|
{
|
|
@@ -154039,7 +154615,7 @@ __export(server_exports, {
|
|
|
154039
154615
|
protectStdout: () => protectStdout,
|
|
154040
154616
|
startMcpServer: () => startMcpServer
|
|
154041
154617
|
});
|
|
154042
|
-
import { mkdirSync as mkdirSync31, readFileSync as
|
|
154618
|
+
import { mkdirSync as mkdirSync31, readFileSync as readFileSync77 } from "node:fs";
|
|
154043
154619
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
154044
154620
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
154045
154621
|
import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
@@ -154099,7 +154675,7 @@ async function startMcpServer(opts) {
|
|
|
154099
154675
|
status: (dir) => previewStatus(dir, previewDeps),
|
|
154100
154676
|
stop: (dir) => stopPreview(dir, previewDeps)
|
|
154101
154677
|
},
|
|
154102
|
-
readFile: (p2) =>
|
|
154678
|
+
readFile: (p2) => readFileSync77(p2),
|
|
154103
154679
|
login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
|
|
154104
154680
|
...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
|
|
154105
154681
|
};
|
|
@@ -154143,7 +154719,7 @@ __export(native_decode_exports, {
|
|
|
154143
154719
|
runNativeDecode: () => runNativeDecode
|
|
154144
154720
|
});
|
|
154145
154721
|
import { execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
|
|
154146
|
-
import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as
|
|
154722
|
+
import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as readFileSync78, rmSync as rmSync16, writeFileSync as writeFileSync27 } from "node:fs";
|
|
154147
154723
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
154148
154724
|
import { join as join68 } from "node:path";
|
|
154149
154725
|
import { fileURLToPath as fileURLToPath25 } from "node:url";
|
|
@@ -154179,7 +154755,7 @@ function detectNativeDecode(options = {}) {
|
|
|
154179
154755
|
}
|
|
154180
154756
|
function localPropertiesSdk(harnessDir) {
|
|
154181
154757
|
try {
|
|
154182
|
-
const match =
|
|
154758
|
+
const match = readFileSync78(join68(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
|
|
154183
154759
|
return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
|
|
154184
154760
|
} catch {
|
|
154185
154761
|
return null;
|
|
@@ -154330,7 +154906,7 @@ function runAndroidNativeDecode(options) {
|
|
|
154330
154906
|
stdio: ["ignore", "ignore", "pipe"],
|
|
154331
154907
|
encoding: "utf8"
|
|
154332
154908
|
});
|
|
154333
|
-
const stdout =
|
|
154909
|
+
const stdout = readFileSync78(outputPath, "utf8");
|
|
154334
154910
|
return {
|
|
154335
154911
|
platform: "android",
|
|
154336
154912
|
verdicts: parseNativeDecodeOutput(stdout, options.descriptors.map((descriptor) => descriptor.screenId), "android"),
|
|
@@ -154399,8 +154975,8 @@ __export(browser_authoring_exports, {
|
|
|
154399
154975
|
sdkSubpathReader: () => sdkSubpathReader
|
|
154400
154976
|
});
|
|
154401
154977
|
import { createServer as createServer5 } from "node:http";
|
|
154402
|
-
import { createHash as
|
|
154403
|
-
import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as
|
|
154978
|
+
import { createHash as createHash36, randomBytes as randomBytes5 } from "node:crypto";
|
|
154979
|
+
import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as readFileSync79, realpathSync as realpathSync11, statSync as statSync19 } from "node:fs";
|
|
154404
154980
|
import { join as join69, posix as posix3, relative as relative14, sep as sep18 } from "node:path";
|
|
154405
154981
|
function humanMs(ms2) {
|
|
154406
154982
|
return ms2 < 1e3 ? `${ms2}ms` : `${Math.round(ms2 / 1e3)}s`;
|
|
@@ -154419,7 +154995,7 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
|
|
|
154419
154995
|
if (statSync19(childAbs).isDirectory()) {
|
|
154420
154996
|
walk2(childAbs, childRel);
|
|
154421
154997
|
} else if (/\.(ts|tsx|js|mjs|json)$/.test(name)) {
|
|
154422
|
-
files[childRel] =
|
|
154998
|
+
files[childRel] = readFileSync79(childAbs, "utf8");
|
|
154423
154999
|
}
|
|
154424
155000
|
}
|
|
154425
155001
|
};
|
|
@@ -154453,7 +155029,7 @@ function collectRelativeSiblings(files, tier5SrcDir) {
|
|
|
154453
155029
|
if (!existsSync66(abs) || statSync19(abs).isDirectory()) continue;
|
|
154454
155030
|
const key2 = `/tier5-src/${relative14(tier5SrcDir, abs).split(sep18).join(posix3.sep)}`;
|
|
154455
155031
|
if (key2 in files) break;
|
|
154456
|
-
files[key2] =
|
|
155032
|
+
files[key2] = readFileSync79(abs, "utf8");
|
|
154457
155033
|
queue.push(key2);
|
|
154458
155034
|
break;
|
|
154459
155035
|
}
|
|
@@ -154488,7 +155064,7 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
154488
155064
|
function sdkSubpathReader(resolve62) {
|
|
154489
155065
|
return (sub) => {
|
|
154490
155066
|
try {
|
|
154491
|
-
return
|
|
155067
|
+
return readFileSync79(resolve62(`@wix/himalaya/${sub}`), "utf8");
|
|
154492
155068
|
} catch {
|
|
154493
155069
|
return null;
|
|
154494
155070
|
}
|
|
@@ -154498,7 +155074,7 @@ function encodeJob(job) {
|
|
|
154498
155074
|
return Buffer.from(JSON.stringify(job), "utf8").toString("base64");
|
|
154499
155075
|
}
|
|
154500
155076
|
function mintToken2(payload, nonce = randomBytes5(16).toString("hex")) {
|
|
154501
|
-
const digest2 =
|
|
155077
|
+
const digest2 = createHash36("sha256").update(payload, "utf8").digest("base64url");
|
|
154502
155078
|
return `${nonce}.${digest2}`;
|
|
154503
155079
|
}
|
|
154504
155080
|
function defaultOpenBrowser2(url) {
|
|
@@ -154660,7 +155236,7 @@ __export(coverage_exports, {
|
|
|
154660
155236
|
suppressedNativeKeys: () => suppressedNativeKeys,
|
|
154661
155237
|
trendAndStore: () => trendAndStore
|
|
154662
155238
|
});
|
|
154663
|
-
import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as
|
|
155239
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as readFileSync80, writeFileSync as writeFileSync28 } from "node:fs";
|
|
154664
155240
|
import { dirname as dirname37, join as join70 } from "node:path";
|
|
154665
155241
|
function suppressedNativeKeys(oracle) {
|
|
154666
155242
|
return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
|
|
@@ -154845,7 +155421,7 @@ function trendAndStore(dir, entries, suppressed) {
|
|
|
154845
155421
|
let previous = null;
|
|
154846
155422
|
try {
|
|
154847
155423
|
if (existsSync67(p2)) {
|
|
154848
|
-
const parsed = JSON.parse(
|
|
155424
|
+
const parsed = JSON.parse(readFileSync80(p2, "utf8"));
|
|
154849
155425
|
if (Array.isArray(parsed.keys)) previous = parsed.keys.filter((k2) => typeof k2 === "string");
|
|
154850
155426
|
}
|
|
154851
155427
|
} catch {
|
|
@@ -154888,7 +155464,7 @@ function diffAndStoreObservations(dir, current) {
|
|
|
154888
155464
|
let previous = null;
|
|
154889
155465
|
try {
|
|
154890
155466
|
if (existsSync67(p2)) {
|
|
154891
|
-
const parsed = JSON.parse(
|
|
155467
|
+
const parsed = JSON.parse(readFileSync80(p2, "utf8"));
|
|
154892
155468
|
if (parsed.screens && typeof parsed.screens === "object" && !Array.isArray(parsed.screens) && Object.values(parsed.screens).every(
|
|
154893
155469
|
(v2) => Array.isArray(v2) && v2.every((l2) => typeof l2 === "string")
|
|
154894
155470
|
)) {
|
|
@@ -154949,7 +155525,7 @@ __export(design_kits_exports, {
|
|
|
154949
155525
|
kitsDir: () => kitsDir,
|
|
154950
155526
|
listKits: () => listKits2
|
|
154951
155527
|
});
|
|
154952
|
-
import { existsSync as existsSync68, readFileSync as
|
|
155528
|
+
import { existsSync as existsSync68, readFileSync as readFileSync81, readdirSync as readdirSync33 } from "node:fs";
|
|
154953
155529
|
import { join as join71, basename as basename16 } from "node:path";
|
|
154954
155530
|
import { fileURLToPath as fileURLToPath26 } from "node:url";
|
|
154955
155531
|
function kitsDir() {
|
|
@@ -154977,7 +155553,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
|
|
|
154977
155553
|
if (!kits.includes(name)) {
|
|
154978
155554
|
return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
|
|
154979
155555
|
}
|
|
154980
|
-
const raw =
|
|
155556
|
+
const raw = readFileSync81(join71(dir, `${name}.json`), "utf8");
|
|
154981
155557
|
let parsed;
|
|
154982
155558
|
try {
|
|
154983
155559
|
parsed = JSON.parse(raw);
|
|
@@ -155017,11 +155593,11 @@ __export(assets_exports, {
|
|
|
155017
155593
|
removeAssetPayload: () => removeAssetPayload,
|
|
155018
155594
|
verifyReport: () => verifyReport
|
|
155019
155595
|
});
|
|
155020
|
-
import { readFileSync as
|
|
155596
|
+
import { readFileSync as readFileSync82 } from "node:fs";
|
|
155021
155597
|
import { basename as basename17 } from "node:path";
|
|
155022
155598
|
function declaredAssets(dir) {
|
|
155023
155599
|
return collectAssets(dir).map((a2) => {
|
|
155024
|
-
const bytes2 =
|
|
155600
|
+
const bytes2 = readFileSync82(a2.path);
|
|
155025
155601
|
return {
|
|
155026
155602
|
name: a2.name,
|
|
155027
155603
|
sha256: assetSha256(bytes2),
|
|
@@ -155098,7 +155674,7 @@ function verifyReport(dir, app, manifest) {
|
|
|
155098
155674
|
};
|
|
155099
155675
|
}
|
|
155100
155676
|
function addAssetPayload(manifest, filePath, opts) {
|
|
155101
|
-
const bytes2 =
|
|
155677
|
+
const bytes2 = readFileSync82(filePath);
|
|
155102
155678
|
const name = opts.name ?? basename17(filePath);
|
|
155103
155679
|
const sha2566 = assetSha256(bytes2);
|
|
155104
155680
|
const record2 = {
|
|
@@ -156892,7 +157468,7 @@ __export(run_exports, {
|
|
|
156892
157468
|
runPackage: () => runPackage,
|
|
156893
157469
|
withoutProdServe: () => withoutProdServe
|
|
156894
157470
|
});
|
|
156895
|
-
import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as
|
|
157471
|
+
import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as readFileSync83, rmSync as rmSync17, statSync as statSync20 } from "node:fs";
|
|
156896
157472
|
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir4 } from "node:os";
|
|
156897
157473
|
import { dirname as dirname38, join as join72 } from "node:path";
|
|
156898
157474
|
import { fileURLToPath as fileURLToPath27 } from "node:url";
|
|
@@ -156952,7 +157528,7 @@ async function resolvePackage(source, workDir) {
|
|
|
156952
157528
|
}
|
|
156953
157529
|
throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
|
|
156954
157530
|
}
|
|
156955
|
-
const bytes2 = isUrl2 ? await fetchBytes(source) :
|
|
157531
|
+
const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync83(source);
|
|
156956
157532
|
const root = workDir ?? mkdtempSync3(join72(tmpdir4(), "himi-run-"));
|
|
156957
157533
|
const { app, appDir: appDir3 } = unpackTo(bytes2, root);
|
|
156958
157534
|
const opened = openPackageDir(appDir3);
|
|
@@ -156983,7 +157559,7 @@ async function loadPreviewAssets() {
|
|
|
156983
157559
|
];
|
|
156984
157560
|
for (const path2 of candidates) {
|
|
156985
157561
|
if (!existsSync69(path2)) continue;
|
|
156986
|
-
const blob =
|
|
157562
|
+
const blob = readFileSync83(path2);
|
|
156987
157563
|
return mod.assemblePreviewAssetsFromBlob(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength));
|
|
156988
157564
|
}
|
|
156989
157565
|
return /* @__PURE__ */ new Map();
|
|
@@ -157120,7 +157696,7 @@ __export(run_browser_exports, {
|
|
|
157120
157696
|
runInBrowser: () => runInBrowser
|
|
157121
157697
|
});
|
|
157122
157698
|
import { createServer as createServer7 } from "node:http";
|
|
157123
|
-
import { existsSync as existsSync70, readFileSync as
|
|
157699
|
+
import { existsSync as existsSync70, readFileSync as readFileSync84 } from "node:fs";
|
|
157124
157700
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
157125
157701
|
import { dirname as dirname39, resolve as resolve55 } from "node:path";
|
|
157126
157702
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
@@ -157228,7 +157804,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
|
|
|
157228
157804
|
}
|
|
157229
157805
|
let bytes2;
|
|
157230
157806
|
try {
|
|
157231
|
-
bytes2 =
|
|
157807
|
+
bytes2 = readFileSync84(resolve55(stagedDir(), name));
|
|
157232
157808
|
} catch (e2) {
|
|
157233
157809
|
res.writeHead(503, { "content-type": "application/json" });
|
|
157234
157810
|
res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e2) }));
|
|
@@ -157281,14 +157857,14 @@ var hhp_preview_exports = {};
|
|
|
157281
157857
|
__export(hhp_preview_exports, {
|
|
157282
157858
|
hhpPreviewResponse: () => hhpPreviewResponse
|
|
157283
157859
|
});
|
|
157284
|
-
import { existsSync as existsSync71, readFileSync as
|
|
157860
|
+
import { existsSync as existsSync71, readFileSync as readFileSync85 } from "node:fs";
|
|
157285
157861
|
import { join as join73 } from "node:path";
|
|
157286
157862
|
function hhpPreviewResponse(root, request) {
|
|
157287
157863
|
if (new URL(request.url).pathname !== "/__himi/hhp-preview" || !existsSync71(join73(root, "hhp.json"))) return null;
|
|
157288
157864
|
if (request.method !== "GET") return new Response(null, { status: 405 });
|
|
157289
157865
|
try {
|
|
157290
157866
|
const file2 = localPath(root, ".himi/hhp-preview.json");
|
|
157291
|
-
const authored2 = existsSync71(file2) ? JSON.parse(
|
|
157867
|
+
const authored2 = existsSync71(file2) ? JSON.parse(readFileSync85(file2, "utf8")) : {};
|
|
157292
157868
|
if (authored2.mockCapabilities && (!Array.isArray(authored2.mockCapabilities) || authored2.mockCapabilities.some((v2) => typeof v2 !== "string"))) throw new Error("mockCapabilities must be a string array.");
|
|
157293
157869
|
const fixtures = authored2.fixtures ?? {};
|
|
157294
157870
|
if (typeof fixtures !== "object" || Array.isArray(fixtures) || fixtures === null) throw new Error("fixtures must be an object.");
|
|
@@ -157438,7 +158014,7 @@ var init_embedded_bundles = __esm({
|
|
|
157438
158014
|
});
|
|
157439
158015
|
|
|
157440
158016
|
// ../store-release/register-bundle.ts
|
|
157441
|
-
import { readFileSync as
|
|
158017
|
+
import { readFileSync as readFileSync86 } from "node:fs";
|
|
157442
158018
|
import { createPrivateKey as createPrivateKey4, sign as sign2 } from "node:crypto";
|
|
157443
158019
|
function b64url2(b2) {
|
|
157444
158020
|
return Buffer.from(b2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
@@ -157456,7 +158032,7 @@ function bundleIdBody(identifier, name, platform = "IOS") {
|
|
|
157456
158032
|
async function registerBundleId(opts) {
|
|
157457
158033
|
const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
|
|
157458
158034
|
assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
|
|
157459
|
-
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID,
|
|
158035
|
+
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync86(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
|
|
157460
158036
|
const res = await fetch(`${ASC_API}/v1/bundleIds`, {
|
|
157461
158037
|
method: "POST",
|
|
157462
158038
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
|
|
@@ -157486,7 +158062,7 @@ async function main() {
|
|
|
157486
158062
|
}
|
|
157487
158063
|
const ni2 = rest.indexOf("--name");
|
|
157488
158064
|
const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
|
|
157489
|
-
const yml =
|
|
158065
|
+
const yml = readFileSync86(iosProjectYml(app), "utf8");
|
|
157490
158066
|
for (const { id, label: label2 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
|
|
157491
158067
|
id: embeddedBundleId(identifier, b2),
|
|
157492
158068
|
label: `${name} ${embeddedAppIdLabel(b2)}`
|
|
@@ -157897,7 +158473,7 @@ var init_iap_api = __esm({
|
|
|
157897
158473
|
});
|
|
157898
158474
|
|
|
157899
158475
|
// ../store-release/iap-manifest.ts
|
|
157900
|
-
import { createHash as
|
|
158476
|
+
import { createHash as createHash37 } from "node:crypto";
|
|
157901
158477
|
function readTarget(reader, value) {
|
|
157902
158478
|
const obj3 = reader.object(value, "target", TARGET_KEYS);
|
|
157903
158479
|
return {
|
|
@@ -158041,7 +158617,7 @@ function canonicalJson(value) {
|
|
|
158041
158617
|
return JSON.stringify(sortKeys(value));
|
|
158042
158618
|
}
|
|
158043
158619
|
function sha256Digest(value) {
|
|
158044
|
-
return `sha256:${
|
|
158620
|
+
return `sha256:${createHash37("sha256").update(canonicalJson(value)).digest("hex")}`;
|
|
158045
158621
|
}
|
|
158046
158622
|
function manifestDigest(manifest) {
|
|
158047
158623
|
return sha256Digest(manifest);
|
|
@@ -158895,13 +159471,13 @@ __export(credential_profile_exports, {
|
|
|
158895
159471
|
profilePath: () => profilePath,
|
|
158896
159472
|
resolveStoreCredentials: () => resolveStoreCredentials
|
|
158897
159473
|
});
|
|
158898
|
-
import { existsSync as existsSync72, readFileSync as
|
|
158899
|
-
import { homedir as
|
|
159474
|
+
import { existsSync as existsSync72, readFileSync as readFileSync87 } from "node:fs";
|
|
159475
|
+
import { homedir as homedir9 } from "node:os";
|
|
158900
159476
|
import { join as join74 } from "node:path";
|
|
158901
|
-
function credentialsDir(home =
|
|
159477
|
+
function credentialsDir(home = homedir9()) {
|
|
158902
159478
|
return join74(home, ".himalaya", "store-credentials");
|
|
158903
159479
|
}
|
|
158904
|
-
function profilePath(name, home =
|
|
159480
|
+
function profilePath(name, home = homedir9()) {
|
|
158905
159481
|
if (!PROFILE_NAME.test(name)) {
|
|
158906
159482
|
throw new Error(
|
|
158907
159483
|
`credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join74(credentialsDir(home), "<name>.json")}; it is never a path.`
|
|
@@ -158937,8 +159513,8 @@ function namedProfile(cfg, profileFlag) {
|
|
|
158937
159513
|
function resolveStoreCredentials(opts) {
|
|
158938
159514
|
const { app, cfg } = opts;
|
|
158939
159515
|
const env = opts.env ?? process.env;
|
|
158940
|
-
const home = opts.home ??
|
|
158941
|
-
const read = opts.readProfile ?? ((p2) =>
|
|
159516
|
+
const home = opts.home ?? homedir9();
|
|
159517
|
+
const read = opts.readProfile ?? ((p2) => readFileSync87(p2, "utf8"));
|
|
158942
159518
|
const exists = opts.profileExists ?? existsSync72;
|
|
158943
159519
|
const ios = cfg.ios ?? {};
|
|
158944
159520
|
const flagName = opts.profileFlag?.trim();
|
|
@@ -159004,11 +159580,11 @@ var init_credential_profile = __esm({
|
|
|
159004
159580
|
});
|
|
159005
159581
|
|
|
159006
159582
|
// ../store-release/iap-credentials.ts
|
|
159007
|
-
import { createHash as
|
|
159008
|
-
import { existsSync as existsSync73, readFileSync as
|
|
159009
|
-
import { homedir as
|
|
159583
|
+
import { createHash as createHash38 } from "node:crypto";
|
|
159584
|
+
import { existsSync as existsSync73, readFileSync as readFileSync88, realpathSync as realpathSync12 } from "node:fs";
|
|
159585
|
+
import { homedir as homedir10 } from "node:os";
|
|
159010
159586
|
function accountFingerprint(keyId, issuerId) {
|
|
159011
|
-
return `sha256:${
|
|
159587
|
+
return `sha256:${createHash38("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
|
|
159012
159588
|
}
|
|
159013
159589
|
function requireExplicitProfile(profileFlag, target) {
|
|
159014
159590
|
const profile = profileFlag?.trim();
|
|
@@ -159038,8 +159614,8 @@ function canonicalKeyPath(path2, profile, realpath) {
|
|
|
159038
159614
|
}
|
|
159039
159615
|
function resolveIapCredentials(options) {
|
|
159040
159616
|
const { target } = options;
|
|
159041
|
-
const home = options.home ??
|
|
159042
|
-
const readFile3 = options.readFile ?? ((p2) =>
|
|
159617
|
+
const home = options.home ?? homedir10();
|
|
159618
|
+
const readFile3 = options.readFile ?? ((p2) => readFileSync88(p2, "utf8"));
|
|
159043
159619
|
const realpath = options.realpath ?? realpathSync12;
|
|
159044
159620
|
const profile = requireExplicitProfile(options.profileFlag, target);
|
|
159045
159621
|
const creds = resolveStoreCredentials({
|
|
@@ -159085,7 +159661,7 @@ var init_wix_payments_contract = __esm({
|
|
|
159085
159661
|
});
|
|
159086
159662
|
|
|
159087
159663
|
// ../store-release/iap-draft.ts
|
|
159088
|
-
import { createHash as
|
|
159664
|
+
import { createHash as createHash39 } from "node:crypto";
|
|
159089
159665
|
function fit(text9, max) {
|
|
159090
159666
|
const chars = [...text9];
|
|
159091
159667
|
return chars.length <= max ? text9 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
|
|
@@ -159223,7 +159799,7 @@ var init_iap_draft = __esm({
|
|
|
159223
159799
|
TIER_DESCRIPTION = "Unlocks one item in the app";
|
|
159224
159800
|
ELLIPSIS = "\u2026";
|
|
159225
159801
|
entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
|
|
159226
|
-
sha = (text9) =>
|
|
159802
|
+
sha = (text9) => createHash39("sha256").update(text9).digest("hex");
|
|
159227
159803
|
ENTITIES = { "&": "&", " ": " ", "<": "<", ">": ">", """: '"', "'": "'" };
|
|
159228
159804
|
MAX_SUFFIX = 24;
|
|
159229
159805
|
ReferenceNames = class {
|
|
@@ -159361,7 +159937,7 @@ __export(version_exports, {
|
|
|
159361
159937
|
stampTargetVersion: () => stampTargetVersion,
|
|
159362
159938
|
stampVersionKeys: () => stampVersionKeys
|
|
159363
159939
|
});
|
|
159364
|
-
import { readFileSync as
|
|
159940
|
+
import { readFileSync as readFileSync89, writeFileSync as writeFileSync29 } from "node:fs";
|
|
159365
159941
|
function readIosVersion(projectYml) {
|
|
159366
159942
|
const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
|
|
159367
159943
|
const build3 = matchScalar(projectYml, "CFBundleVersion");
|
|
@@ -159508,8 +160084,8 @@ function setAndroidVersion(gradle, v2) {
|
|
|
159508
160084
|
function bumpVersion(app, opts) {
|
|
159509
160085
|
const iosPath = iosProjectYml(app);
|
|
159510
160086
|
const gradlePath = androidGradle(app);
|
|
159511
|
-
const iosYml =
|
|
159512
|
-
const gradle =
|
|
160087
|
+
const iosYml = readFileSync89(iosPath, "utf8");
|
|
160088
|
+
const gradle = readFileSync89(gradlePath, "utf8");
|
|
159513
160089
|
const current = readIosVersion(iosYml);
|
|
159514
160090
|
const next = {
|
|
159515
160091
|
marketing: opts.marketing ?? current.marketing,
|
|
@@ -159539,7 +160115,7 @@ var init_store_spec = __esm({
|
|
|
159539
160115
|
});
|
|
159540
160116
|
|
|
159541
160117
|
// src/iap-config-edit.ts
|
|
159542
|
-
import { existsSync as existsSync74, readFileSync as
|
|
160118
|
+
import { existsSync as existsSync74, readFileSync as readFileSync90 } from "node:fs";
|
|
159543
160119
|
import { basename as basename18, join as join75 } from "node:path";
|
|
159544
160120
|
import ts8 from "typescript";
|
|
159545
160121
|
function bindPurchasesAppInConfig(source, options) {
|
|
@@ -159621,14 +160197,14 @@ function withStoreBundle(dir, options) {
|
|
|
159621
160197
|
if (options.storeBundleId) return options;
|
|
159622
160198
|
const path2 = join75(dir, "store", "store.config.yaml");
|
|
159623
160199
|
if (!existsSync74(path2)) return options;
|
|
159624
|
-
const storeBundleId = parseStoreConfig(
|
|
160200
|
+
const storeBundleId = parseStoreConfig(readFileSync90(path2, "utf8")).ios?.bundleId;
|
|
159625
160201
|
return storeBundleId ? { ...options, storeBundleId } : options;
|
|
159626
160202
|
}
|
|
159627
160203
|
function previewIapConfigEdit(dir, options) {
|
|
159628
160204
|
const path2 = configEntry(dir);
|
|
159629
160205
|
if (!path2) return void 0;
|
|
159630
160206
|
if (isSymlink2(path2)) return { path: path2, changed: false, applied: [], conflicts: [], instructions: [`${basename18(path2)} is a symlink, so it would not be edited: add the purchases app in the file it points to.`] };
|
|
159631
|
-
const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(
|
|
160207
|
+
const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync90(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename18(path2) });
|
|
159632
160208
|
return { path: path2, changed, applied, conflicts, instructions };
|
|
159633
160209
|
}
|
|
159634
160210
|
async function applyIapConfigEdit(dir, options, validate4) {
|
|
@@ -159637,7 +160213,7 @@ async function applyIapConfigEdit(dir, options, validate4) {
|
|
|
159637
160213
|
const fileName = basename18(path2);
|
|
159638
160214
|
const refuse7 = (why) => ({ path: path2, changed: false, applied: [], conflicts: [], instructions: [why] });
|
|
159639
160215
|
if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: add the purchases app in the file it points to.`);
|
|
159640
|
-
const original =
|
|
160216
|
+
const original = readFileSync90(path2, "utf8");
|
|
159641
160217
|
const edit = bindPurchasesAppInConfig(original, { ...withStoreBundle(dir, options), fileName });
|
|
159642
160218
|
const { applied, conflicts, instructions } = edit;
|
|
159643
160219
|
if (!edit.changed) return { path: path2, changed: false, applied, conflicts, instructions };
|
|
@@ -160110,8 +160686,8 @@ __export(store_iap_exports, {
|
|
|
160110
160686
|
runStoreIap: () => runStoreIap
|
|
160111
160687
|
});
|
|
160112
160688
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
160113
|
-
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as
|
|
160114
|
-
import { homedir as
|
|
160689
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync91, realpathSync as realpathSync13, rmSync as rmSync18, writeFileSync as writeFileSync30 } from "node:fs";
|
|
160690
|
+
import { homedir as homedir11, hostname } from "node:os";
|
|
160115
160691
|
import { join as join76 } from "node:path";
|
|
160116
160692
|
function scrubDeep(value, scrub) {
|
|
160117
160693
|
if (typeof value === "string") return scrub(value);
|
|
@@ -160568,7 +161144,7 @@ function fileJournal(path2) {
|
|
|
160568
161144
|
}
|
|
160569
161145
|
function readLockSummary(path2) {
|
|
160570
161146
|
try {
|
|
160571
|
-
const { pid, host, at: at2 } = JSON.parse(
|
|
161147
|
+
const { pid, host, at: at2 } = JSON.parse(readFileSync91(path2, "utf8"));
|
|
160572
161148
|
return `pid ${pid} on ${host} since ${at2}`;
|
|
160573
161149
|
} catch {
|
|
160574
161150
|
return "unreadable lock";
|
|
@@ -160588,7 +161164,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
160588
161164
|
return () => {
|
|
160589
161165
|
let current = "";
|
|
160590
161166
|
try {
|
|
160591
|
-
current =
|
|
161167
|
+
current = readFileSync91(path2, "utf8");
|
|
160592
161168
|
} catch {
|
|
160593
161169
|
return;
|
|
160594
161170
|
}
|
|
@@ -160596,7 +161172,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
160596
161172
|
};
|
|
160597
161173
|
}
|
|
160598
161174
|
function stateDir(appleAppId) {
|
|
160599
|
-
const dir = join76(
|
|
161175
|
+
const dir = join76(homedir11(), ".himalaya", "store-iap", appleAppId);
|
|
160600
161176
|
mkdirSync34(dir, { recursive: true, mode: 448 });
|
|
160601
161177
|
return dir;
|
|
160602
161178
|
}
|
|
@@ -160612,7 +161188,7 @@ async function confirmOnTerminal(question) {
|
|
|
160612
161188
|
}
|
|
160613
161189
|
function defaultStoreIapDeps() {
|
|
160614
161190
|
return {
|
|
160615
|
-
readFile: (path2) =>
|
|
161191
|
+
readFile: (path2) => readFileSync91(path2, "utf8"),
|
|
160616
161192
|
writeFileAtomic,
|
|
160617
161193
|
resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
|
|
160618
161194
|
createApi: (key2) => createIapApi(createAscClient({ key: key2 })),
|
|
@@ -161094,8 +161670,8 @@ __export(preflight_app_exports, {
|
|
|
161094
161670
|
preflightApp: () => preflightApp,
|
|
161095
161671
|
profileAccount: () => profileAccount
|
|
161096
161672
|
});
|
|
161097
|
-
import { readFileSync as
|
|
161098
|
-
import { createHash as
|
|
161673
|
+
import { readFileSync as readFileSync92, existsSync as existsSync75, readdirSync as readdirSync34, statSync as statSync21 } from "node:fs";
|
|
161674
|
+
import { createHash as createHash40 } from "node:crypto";
|
|
161099
161675
|
import { join as join77 } from "node:path";
|
|
161100
161676
|
function analyze(projectYml, storeConfig, icon, account) {
|
|
161101
161677
|
const f2 = [];
|
|
@@ -161160,8 +161736,8 @@ function profileAccount(app, storeConfig, opts = {}) {
|
|
|
161160
161736
|
}
|
|
161161
161737
|
}
|
|
161162
161738
|
async function preflightApp(app, opts = {}) {
|
|
161163
|
-
const projectYml = existsSync75(iosProjectYml(app)) ?
|
|
161164
|
-
const storeConfig = existsSync75(storeConfigPath(app)) ?
|
|
161739
|
+
const projectYml = existsSync75(iosProjectYml(app)) ? readFileSync92(iosProjectYml(app), "utf8") : "";
|
|
161740
|
+
const storeConfig = existsSync75(storeConfigPath(app)) ? readFileSync92(storeConfigPath(app), "utf8") : "";
|
|
161165
161741
|
if (!storeConfig) return [{ level: "error", message: `no apps/${app}/store/store.config.yaml \u2014 run /setup-store-signing first.` }];
|
|
161166
161742
|
const findings = analyze(
|
|
161167
161743
|
projectYml,
|
|
@@ -161320,7 +161896,7 @@ function playListingAssets(app, locale = "en-US") {
|
|
|
161320
161896
|
for (const name of names) {
|
|
161321
161897
|
const p2 = join77(dir, name);
|
|
161322
161898
|
try {
|
|
161323
|
-
if (statSync21(p2).isFile()) return { name, bytes:
|
|
161899
|
+
if (statSync21(p2).isFile()) return { name, bytes: readFileSync92(p2) };
|
|
161324
161900
|
} catch {
|
|
161325
161901
|
}
|
|
161326
161902
|
}
|
|
@@ -161360,7 +161936,7 @@ function listScreenshots(app, locale = "en-US") {
|
|
|
161360
161936
|
const flat = join77(storeDir(app), "screenshots", locale);
|
|
161361
161937
|
if (existsSync75(flat)) {
|
|
161362
161938
|
for (const png of readdirSync34(flat).filter((n2) => n2.endsWith(".png"))) {
|
|
161363
|
-
const sz = pngSize(
|
|
161939
|
+
const sz = pngSize(readFileSync92(join77(flat, png)));
|
|
161364
161940
|
if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
|
|
161365
161941
|
}
|
|
161366
161942
|
}
|
|
@@ -161370,7 +161946,7 @@ function listScreenshots(app, locale = "en-US") {
|
|
|
161370
161946
|
const d2 = join77(legacy, deviceDir);
|
|
161371
161947
|
if (!statSync21(d2).isDirectory()) continue;
|
|
161372
161948
|
for (const png of readdirSync34(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
161373
|
-
const sz = pngSize(
|
|
161949
|
+
const sz = pngSize(readFileSync92(join77(d2, png)));
|
|
161374
161950
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
161375
161951
|
}
|
|
161376
161952
|
}
|
|
@@ -161384,7 +161960,7 @@ function placeholderHashes2() {
|
|
|
161384
161960
|
const p2 = join77(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
161385
161961
|
try {
|
|
161386
161962
|
if (!statSync21(p2).isFile()) continue;
|
|
161387
|
-
return [LEGACY_PLACEHOLDER_SHA2562,
|
|
161963
|
+
return [LEGACY_PLACEHOLDER_SHA2562, createHash40("sha256").update(readFileSync92(p2)).digest("hex")];
|
|
161388
161964
|
} catch {
|
|
161389
161965
|
}
|
|
161390
161966
|
}
|
|
@@ -161420,8 +161996,8 @@ async function appIconState(iosDir) {
|
|
|
161420
161996
|
const p2 = join77(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
161421
161997
|
try {
|
|
161422
161998
|
if (!statSync21(p2).isFile()) continue;
|
|
161423
|
-
const bytes2 =
|
|
161424
|
-
const hash2 =
|
|
161999
|
+
const bytes2 = readFileSync92(p2);
|
|
162000
|
+
const hash2 = createHash40("sha256").update(bytes2).digest("hex");
|
|
161425
162001
|
const pixels = await pixelIssues(bytes2);
|
|
161426
162002
|
return {
|
|
161427
162003
|
exists: true,
|
|
@@ -161487,7 +162063,7 @@ __export(asc_status_exports, {
|
|
|
161487
162063
|
ascStatus: () => ascStatus,
|
|
161488
162064
|
buildVerdict: () => buildVerdict
|
|
161489
162065
|
});
|
|
161490
|
-
import { readFileSync as
|
|
162066
|
+
import { readFileSync as readFileSync93 } from "node:fs";
|
|
161491
162067
|
function buildVerdict(builds) {
|
|
161492
162068
|
if (!builds.length) {
|
|
161493
162069
|
return "NO builds registered \u2014 if you uploaded recently and it's been >15 min, the binary was REJECTED IN PROCESSING (reason is email-only; run validate-binary.ts / scan-purpose-strings.ts to reproduce it).";
|
|
@@ -161501,7 +162077,7 @@ function buildVerdict(builds) {
|
|
|
161501
162077
|
function client(creds) {
|
|
161502
162078
|
const env = creds ?? requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
|
|
161503
162079
|
assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
|
|
161504
|
-
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID,
|
|
162080
|
+
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync93(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
|
|
161505
162081
|
return async (path2) => {
|
|
161506
162082
|
const r2 = await fetch(`${ASC}${path2}`, { headers: { Authorization: `Bearer ${jwt}` } });
|
|
161507
162083
|
return { status: r2.status, json: await r2.json().catch(() => ({})) };
|
|
@@ -161766,7 +162342,7 @@ __export(secrets_exports, {
|
|
|
161766
162342
|
runRemoteSecretsCommand: () => runRemoteSecretsCommand,
|
|
161767
162343
|
runSecretsCommand: () => runSecretsCommand
|
|
161768
162344
|
});
|
|
161769
|
-
import { readFileSync as
|
|
162345
|
+
import { readFileSync as readFileSync94 } from "node:fs";
|
|
161770
162346
|
function environment(value) {
|
|
161771
162347
|
if (value === "preview" || value === "production") return value;
|
|
161772
162348
|
throw new Error("--environment must be preview or production");
|
|
@@ -161797,7 +162373,7 @@ async function runSecretsCommand(operation, flags, io2, options = {}) {
|
|
|
161797
162373
|
io2.log(JSON.stringify(await vault.list({ app, environment: env })));
|
|
161798
162374
|
return 0;
|
|
161799
162375
|
}
|
|
161800
|
-
const value = options.readValue ? options.readValue() :
|
|
162376
|
+
const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
|
|
161801
162377
|
if (operation === "set") await vault.set({ app, environment: env, name, value });
|
|
161802
162378
|
else if (operation === "rotate") await vault.rotate({ app, environment: env, name, value });
|
|
161803
162379
|
else throw new Error(`unknown secrets operation ${operation}`);
|
|
@@ -161826,7 +162402,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options) {
|
|
|
161826
162402
|
}
|
|
161827
162403
|
let body;
|
|
161828
162404
|
if (operation !== "list") {
|
|
161829
|
-
const value = options.readValue ? options.readValue() :
|
|
162405
|
+
const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
|
|
161830
162406
|
body = JSON.stringify({ value });
|
|
161831
162407
|
}
|
|
161832
162408
|
const response = await (options.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
|
|
@@ -162020,7 +162596,7 @@ var init_site_member = __esm({
|
|
|
162020
162596
|
});
|
|
162021
162597
|
|
|
162022
162598
|
// src/notify-ping-all.ts
|
|
162023
|
-
import { createHash as
|
|
162599
|
+
import { createHash as createHash41 } from "node:crypto";
|
|
162024
162600
|
async function listApprovedMembers(input) {
|
|
162025
162601
|
const first = await scanMembers(input);
|
|
162026
162602
|
const second = await scanMembers(input);
|
|
@@ -162074,7 +162650,7 @@ async function scanMembers(input) {
|
|
|
162074
162650
|
}
|
|
162075
162651
|
}
|
|
162076
162652
|
function campaignRequestId(campaignId, memberId) {
|
|
162077
|
-
const bytes2 =
|
|
162653
|
+
const bytes2 = createHash41("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
|
|
162078
162654
|
bytes2[6] = bytes2[6] & 15 | 80;
|
|
162079
162655
|
bytes2[8] = bytes2[8] & 63 | 128;
|
|
162080
162656
|
const hex2 = bytes2.toString("hex");
|
|
@@ -162324,15 +162900,15 @@ __export(notify_exports, {
|
|
|
162324
162900
|
runNotify: () => runNotify,
|
|
162325
162901
|
saveAdminSession: () => saveAdminSession
|
|
162326
162902
|
});
|
|
162327
|
-
import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as
|
|
162328
|
-
import { homedir as
|
|
162903
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as readFileSync95, writeFileSync as writeFileSync31 } from "node:fs";
|
|
162904
|
+
import { homedir as homedir12 } from "node:os";
|
|
162329
162905
|
import { dirname as dirname41, join as join78 } from "node:path";
|
|
162330
162906
|
function defaultSessionsPath() {
|
|
162331
|
-
return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(
|
|
162907
|
+
return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(homedir12(), ".himalaya", "admin-sessions.json");
|
|
162332
162908
|
}
|
|
162333
162909
|
function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
162334
162910
|
try {
|
|
162335
|
-
return JSON.parse(
|
|
162911
|
+
return JSON.parse(readFileSync95(path2, "utf8"));
|
|
162336
162912
|
} catch {
|
|
162337
162913
|
return {};
|
|
162338
162914
|
}
|
|
@@ -162709,20 +163285,20 @@ __export(base44_auth_exports, {
|
|
|
162709
163285
|
usableBase44Auth: () => usableBase44Auth,
|
|
162710
163286
|
writeBase44Session: () => writeBase44Session
|
|
162711
163287
|
});
|
|
162712
|
-
import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as
|
|
162713
|
-
import { homedir as
|
|
163288
|
+
import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as readFileSync96, rmSync as rmSync19, writeFileSync as writeFileSync32 } from "node:fs";
|
|
163289
|
+
import { homedir as homedir13 } from "node:os";
|
|
162714
163290
|
import { dirname as dirname42, join as join79 } from "node:path";
|
|
162715
163291
|
function base44ApiBase(env = process.env) {
|
|
162716
163292
|
return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
|
|
162717
163293
|
}
|
|
162718
|
-
function base44SessionPath(home =
|
|
163294
|
+
function base44SessionPath(home = homedir13()) {
|
|
162719
163295
|
return join79(home, ".himi", "base44", "session.json");
|
|
162720
163296
|
}
|
|
162721
163297
|
function readBase44Session(home) {
|
|
162722
163298
|
const p2 = base44SessionPath(home);
|
|
162723
163299
|
if (!existsSync76(p2)) return void 0;
|
|
162724
163300
|
try {
|
|
162725
|
-
const s2 = JSON.parse(
|
|
163301
|
+
const s2 = JSON.parse(readFileSync96(p2, "utf8"));
|
|
162726
163302
|
return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
|
|
162727
163303
|
} catch {
|
|
162728
163304
|
return void 0;
|
|
@@ -162832,10 +163408,10 @@ async function base44DeviceLogin(opts) {
|
|
|
162832
163408
|
}
|
|
162833
163409
|
throw new Error("the Base44 sign-in code expired before it was approved \u2014 run `himi base44 login` again");
|
|
162834
163410
|
}
|
|
162835
|
-
function importBase44CliSession(home =
|
|
163411
|
+
function importBase44CliSession(home = homedir13(), env = process.env) {
|
|
162836
163412
|
const src = join79(home, ".base44", "auth", "auth.json");
|
|
162837
163413
|
if (!existsSync76(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
162838
|
-
const a2 = JSON.parse(
|
|
163414
|
+
const a2 = JSON.parse(readFileSync96(src, "utf8"));
|
|
162839
163415
|
if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
|
|
162840
163416
|
const session = {
|
|
162841
163417
|
accessToken: a2.accessToken,
|
|
@@ -166139,11 +166715,11 @@ var init_analyze = __esm({
|
|
|
166139
166715
|
});
|
|
166140
166716
|
|
|
166141
166717
|
// src/base44-analyze/write-artifacts.ts
|
|
166142
|
-
import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as
|
|
166718
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as readFileSync97, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "node:fs";
|
|
166143
166719
|
import { dirname as dirname43, join as join81, resolve as resolve57, sep as sep19 } from "node:path";
|
|
166144
166720
|
function isBookFolder(dir) {
|
|
166145
166721
|
try {
|
|
166146
|
-
return JSON.parse(
|
|
166722
|
+
return JSON.parse(readFileSync97(join81(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
166147
166723
|
} catch {
|
|
166148
166724
|
return false;
|
|
166149
166725
|
}
|
|
@@ -171559,7 +172135,7 @@ var init_customer_build = __esm({
|
|
|
171559
172135
|
});
|
|
171560
172136
|
|
|
171561
172137
|
// src/site-analyze/apply.ts
|
|
171562
|
-
import { existsSync as existsSync78, readFileSync as
|
|
172138
|
+
import { existsSync as existsSync78, readFileSync as readFileSync98, writeFileSync as writeFileSync36, copyFileSync as copyFileSync2, mkdirSync as mkdirSync40, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
|
|
171563
172139
|
import { dirname as dirname44, isAbsolute as isAbsolute8, join as join83, resolve as resolve59, sep as sep20 } from "node:path";
|
|
171564
172140
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
171565
172141
|
function unpairedRedirectNote(overlay) {
|
|
@@ -171682,7 +172258,7 @@ function buildMergedContract(options) {
|
|
|
171682
172258
|
if (!existsSync78(committedPath)) {
|
|
171683
172259
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
171684
172260
|
}
|
|
171685
|
-
const committed = JSON.parse(
|
|
172261
|
+
const committed = JSON.parse(readFileSync98(committedPath, "utf8"));
|
|
171686
172262
|
const merged = mergeCustomerOwned(committed, overlay);
|
|
171687
172263
|
const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
|
|
171688
172264
|
const branding = merged.branding ?? {};
|
|
@@ -171721,7 +172297,7 @@ function buildMergedContract(options) {
|
|
|
171721
172297
|
if (existsSync78(facesPath)) {
|
|
171722
172298
|
let faces = [];
|
|
171723
172299
|
try {
|
|
171724
|
-
const parsed = JSON.parse(
|
|
172300
|
+
const parsed = JSON.parse(readFileSync98(facesPath, "utf8"));
|
|
171725
172301
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
171726
172302
|
} catch {
|
|
171727
172303
|
faces = [];
|
|
@@ -171782,7 +172358,7 @@ function staticFaqFor(overlay, overlayPath) {
|
|
|
171782
172358
|
const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
|
|
171783
172359
|
if (!existsSync78(bookPath)) return void 0;
|
|
171784
172360
|
try {
|
|
171785
|
-
const book = JSON.parse(
|
|
172361
|
+
const book = JSON.parse(readFileSync98(bookPath, "utf8"));
|
|
171786
172362
|
const copy = book?.copy;
|
|
171787
172363
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
171788
172364
|
const pairs = deriveStaticFaq(copy.faq);
|
|
@@ -171799,7 +172375,7 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
171799
172375
|
const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
|
|
171800
172376
|
if (!existsSync78(bookPath)) return void 0;
|
|
171801
172377
|
try {
|
|
171802
|
-
const book = JSON.parse(
|
|
172378
|
+
const book = JSON.parse(readFileSync98(bookPath, "utf8"));
|
|
171803
172379
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
171804
172380
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
171805
172381
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -171811,8 +172387,8 @@ async function applyOverlays(input) {
|
|
|
171811
172387
|
const cwd = resolve59(input.cwd);
|
|
171812
172388
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
171813
172389
|
assertKnownShell(shell);
|
|
171814
|
-
const overlay = JSON.parse(
|
|
171815
|
-
const tokens2 = JSON.parse(
|
|
172390
|
+
const overlay = JSON.parse(readFileSync98(input.overlayPath, "utf8"));
|
|
172391
|
+
const tokens2 = JSON.parse(readFileSync98(input.tokensPath, "utf8"));
|
|
171816
172392
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
171817
172393
|
if (faq !== void 0) overlay.faq = faq;
|
|
171818
172394
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -171831,7 +172407,7 @@ async function applyOverlays(input) {
|
|
|
171831
172407
|
}
|
|
171832
172408
|
const appDir3 = join83(repoRoot2, shellAppDir(shell));
|
|
171833
172409
|
const committedPath = join83(appDir3, "provisioning.json");
|
|
171834
|
-
const committedSite = existsSync78(committedPath) ? JSON.parse(
|
|
172410
|
+
const committedSite = existsSync78(committedPath) ? JSON.parse(readFileSync98(committedPath, "utf8")).site : void 0;
|
|
171835
172411
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
171836
172412
|
throw new Error(
|
|
171837
172413
|
`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.`
|
|
@@ -171873,7 +172449,7 @@ async function applyOverlays(input) {
|
|
|
171873
172449
|
let packageFaq = faq;
|
|
171874
172450
|
let packageGalleries = galleries;
|
|
171875
172451
|
if (existsSync78(pkgProv)) {
|
|
171876
|
-
const cur = JSON.parse(
|
|
172452
|
+
const cur = JSON.parse(readFileSync98(pkgProv, "utf8"));
|
|
171877
172453
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
171878
172454
|
const merged = deepMerge4(cur, overlay);
|
|
171879
172455
|
packageFaq = merged.faq;
|
|
@@ -171891,7 +172467,7 @@ async function applyOverlays(input) {
|
|
|
171891
172467
|
}
|
|
171892
172468
|
const pkgTokens = join83(cwd, "tokens.json");
|
|
171893
172469
|
if (existsSync78(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
171894
|
-
const cur = JSON.parse(
|
|
172470
|
+
const cur = JSON.parse(readFileSync98(pkgTokens, "utf8"));
|
|
171895
172471
|
let tokensIn = tokens2;
|
|
171896
172472
|
if (tokens2.typography) {
|
|
171897
172473
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -171918,7 +172494,7 @@ async function applyOverlays(input) {
|
|
|
171918
172494
|
const homeAction = homeRefreshActionId(shell);
|
|
171919
172495
|
const homeSrc = join83(cwd, "dev/index.ts");
|
|
171920
172496
|
if (homeAction && existsSync78(homeSrc)) {
|
|
171921
|
-
const prev =
|
|
172497
|
+
const prev = readFileSync98(homeSrc, "utf8");
|
|
171922
172498
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
171923
172499
|
let next = patched.src;
|
|
171924
172500
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -172917,7 +173493,7 @@ __export(cli_exports2, {
|
|
|
172917
173493
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
172918
173494
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
172919
173495
|
});
|
|
172920
|
-
import { existsSync as existsSync79, readFileSync as
|
|
173496
|
+
import { existsSync as existsSync79, readFileSync as readFileSync99 } from "node:fs";
|
|
172921
173497
|
import { resolve as resolve60 } from "node:path";
|
|
172922
173498
|
function applyNeedsClient(shell) {
|
|
172923
173499
|
if (shell === void 0 || !SHELL_NAMES2.includes(shell)) return true;
|
|
@@ -172976,7 +173552,7 @@ async function runSiteAnalyze(opts) {
|
|
|
172976
173552
|
const prevOverlayPath = resolve60(outDir, "provisioning.overlay.json");
|
|
172977
173553
|
const prevSite = existsSync79(prevOverlayPath) ? (() => {
|
|
172978
173554
|
try {
|
|
172979
|
-
return JSON.parse(
|
|
173555
|
+
return JSON.parse(readFileSync99(prevOverlayPath, "utf8")).site;
|
|
172980
173556
|
} catch {
|
|
172981
173557
|
return void 0;
|
|
172982
173558
|
}
|
|
@@ -172995,7 +173571,7 @@ async function runSiteAnalyze(opts) {
|
|
|
172995
173571
|
}
|
|
172996
173572
|
const previousOverlay = resolve60(outDir, "provisioning.overlay.json");
|
|
172997
173573
|
carryOverGoals(
|
|
172998
|
-
existsSync79(previousOverlay) ?
|
|
173574
|
+
existsSync79(previousOverlay) ? readFileSync99(previousOverlay, "utf8") : void 0,
|
|
172999
173575
|
result.provisioningOverlay
|
|
173000
173576
|
);
|
|
173001
173577
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -173053,7 +173629,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
173053
173629
|
let source;
|
|
173054
173630
|
if (opts.sourcePath) {
|
|
173055
173631
|
const p2 = resolve60(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
173056
|
-
source =
|
|
173632
|
+
source = readFileSync99(p2, "utf8");
|
|
173057
173633
|
}
|
|
173058
173634
|
let body;
|
|
173059
173635
|
if (opts.bodyRaw != null) {
|
|
@@ -173083,7 +173659,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
173083
173659
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
173084
173660
|
if (!existsSync79(bookPath)) return void 0;
|
|
173085
173661
|
try {
|
|
173086
|
-
const book = JSON.parse(
|
|
173662
|
+
const book = JSON.parse(readFileSync99(bookPath, "utf8"));
|
|
173087
173663
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
173088
173664
|
const host = (u2) => {
|
|
173089
173665
|
try {
|
|
@@ -173223,7 +173799,7 @@ function explainAuthFailure(err) {
|
|
|
173223
173799
|
return `${err.status} from the \`wix token\` identity \u2014 your Wix user may not be allowed to provision on this account. Generate an API key with site-provisioning permission at ${API_KEYS_URL}, then export WIX_API_KEY and WIX_ACCOUNT_ID and retry.`;
|
|
173224
173800
|
}
|
|
173225
173801
|
var API_BASE2, API_KEYS_URL, TOKEN_RE2, TOKEN_MINT_TIMEOUT_MS2, cached2, DEFAULT_TIMEOUT_MS5;
|
|
173226
|
-
var
|
|
173802
|
+
var init_wix_account2 = __esm({
|
|
173227
173803
|
"src/wix-account.ts"() {
|
|
173228
173804
|
init_wix_owner();
|
|
173229
173805
|
API_BASE2 = "https://www.wixapis.com";
|
|
@@ -173338,7 +173914,7 @@ __export(site_create_exports, {
|
|
|
173338
173914
|
runSiteList: () => runSiteList,
|
|
173339
173915
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
173340
173916
|
});
|
|
173341
|
-
import { existsSync as existsSync80, readFileSync as
|
|
173917
|
+
import { existsSync as existsSync80, readFileSync as readFileSync100, writeFileSync as writeFileSync37 } from "node:fs";
|
|
173342
173918
|
import { resolve as resolvePath2 } from "node:path";
|
|
173343
173919
|
function oauthClientName(projectName) {
|
|
173344
173920
|
return `${projectName} client`;
|
|
@@ -173487,7 +174063,7 @@ async function runSiteCreate(opts) {
|
|
|
173487
174063
|
if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
|
|
173488
174064
|
return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
173489
174065
|
}
|
|
173490
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync:
|
|
174066
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync: readFileSync100, writeFileSync: writeFileSync37 }) {
|
|
173491
174067
|
const msid = binding2.siteId;
|
|
173492
174068
|
const path2 = resolvePath2(target);
|
|
173493
174069
|
const committed = committedShellProvisioning(path2);
|
|
@@ -173571,7 +174147,7 @@ var init_site_create = __esm({
|
|
|
173571
174147
|
"src/site-create.ts"() {
|
|
173572
174148
|
init_shell_quote();
|
|
173573
174149
|
init_wix_owner();
|
|
173574
|
-
|
|
174150
|
+
init_wix_account2();
|
|
173575
174151
|
init_wix_verticals();
|
|
173576
174152
|
init_apply2();
|
|
173577
174153
|
init_types2();
|
|
@@ -174184,11 +174760,11 @@ var init_context = __esm({
|
|
|
174184
174760
|
});
|
|
174185
174761
|
|
|
174186
174762
|
// src/cli.ts
|
|
174187
|
-
import { mkdtempSync as mkdtempSync5, readFileSync as
|
|
174763
|
+
import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync101, mkdirSync as mkdirSync41, writeFileSync as writeFileSync38, existsSync as existsSync81, rmSync as rmSync22, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync21, accessSync, constants as constants4, renameSync as renameSync12, cpSync as cpSync3 } from "node:fs";
|
|
174188
174764
|
import { execFile as execFile2, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
|
|
174189
174765
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
174190
|
-
import { createHash as
|
|
174191
|
-
import { tmpdir as tmpdir6, homedir as
|
|
174766
|
+
import { createHash as createHash42, randomUUID as randomUUID11 } from "node:crypto";
|
|
174767
|
+
import { tmpdir as tmpdir6, homedir as homedir14, hostname as hostname2 } from "node:os";
|
|
174192
174768
|
import { join as join84, resolve as resolve61, relative as relative15, basename as basename19, dirname as dirname45 } from "node:path";
|
|
174193
174769
|
import { fileURLToPath as fileURLToPath29 } from "node:url";
|
|
174194
174770
|
|
|
@@ -176263,7 +176839,7 @@ var num3 = (v2) => typeof v2 === "string" && v2 !== "" && Number.isFinite(Number
|
|
|
176263
176839
|
function embeddedTemplateCatalog() {
|
|
176264
176840
|
return availableTemplates().map((name) => {
|
|
176265
176841
|
const path2 = join84(templateSourceDir(name), TEMPLATE_META_FILE);
|
|
176266
|
-
const meta = JSON.parse(
|
|
176842
|
+
const meta = JSON.parse(readFileSync101(path2, "utf8"));
|
|
176267
176843
|
if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
|
|
176268
176844
|
throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
|
|
176269
176845
|
}
|
|
@@ -177141,7 +177717,7 @@ var COMMANDS2 = [
|
|
|
177141
177717
|
];
|
|
177142
177718
|
function cliVersion() {
|
|
177143
177719
|
try {
|
|
177144
|
-
return JSON.parse(
|
|
177720
|
+
return JSON.parse(readFileSync101(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
|
|
177145
177721
|
} catch {
|
|
177146
177722
|
return "unknown";
|
|
177147
177723
|
}
|
|
@@ -177179,7 +177755,7 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
|
|
|
177179
177755
|
const configured = async (key2) => {
|
|
177180
177756
|
const timeout = deadline - Date.now();
|
|
177181
177757
|
if (timeout <= 0) throw new Error("npm config: out of budget");
|
|
177182
|
-
const raw = String(await exec("npm", ["config", "get", key2], { cwd:
|
|
177758
|
+
const raw = String(await exec("npm", ["config", "get", key2], { cwd: homedir14(), timeout })).trim();
|
|
177183
177759
|
return raw && raw !== "undefined" ? raw : void 0;
|
|
177184
177760
|
};
|
|
177185
177761
|
const effective = normalizeRegistry(await configured("@wix:registry") ?? await configured("registry"));
|
|
@@ -177266,7 +177842,7 @@ function ageInDays(publishedAt, now = Date.now()) {
|
|
|
177266
177842
|
}
|
|
177267
177843
|
function packageVersion(path2) {
|
|
177268
177844
|
try {
|
|
177269
|
-
const version4 = JSON.parse(
|
|
177845
|
+
const version4 = JSON.parse(readFileSync101(path2, "utf8")).version;
|
|
177270
177846
|
return typeof version4 === "string" && version4 ? version4 : void 0;
|
|
177271
177847
|
} catch {
|
|
177272
177848
|
return void 0;
|
|
@@ -177332,11 +177908,11 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
|
|
|
177332
177908
|
var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
|
|
177333
177909
|
var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
|
|
177334
177910
|
function updateCachePath(env = process.env) {
|
|
177335
|
-
return env.HIMI_UPDATE_CACHE_FILE ?? join84(
|
|
177911
|
+
return env.HIMI_UPDATE_CACHE_FILE ?? join84(homedir14(), ".himalaya", "update-check.json");
|
|
177336
177912
|
}
|
|
177337
177913
|
function readUpdateCache(path2) {
|
|
177338
177914
|
try {
|
|
177339
|
-
const parsed = JSON.parse(
|
|
177915
|
+
const parsed = JSON.parse(readFileSync101(path2, "utf8"));
|
|
177340
177916
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
177341
177917
|
} catch {
|
|
177342
177918
|
return {};
|
|
@@ -177398,7 +177974,7 @@ function createUpdateRunner(spawn8 = spawnSync5) {
|
|
|
177398
177974
|
// parse — the agent case this whole feature exists for (#2985 review). And no stdin: an
|
|
177399
177975
|
// install needs none, and must not consume input piped to the command we are about to re-run.
|
|
177400
177976
|
stdio: ["ignore", 2, 2],
|
|
177401
|
-
cwd:
|
|
177977
|
+
cwd: homedir14()
|
|
177402
177978
|
});
|
|
177403
177979
|
if (result.error) return { ok: false, detail: result.error.message };
|
|
177404
177980
|
return result.status === 0 ? { ok: true } : { ok: false, detail: `npm exited ${result.status}` };
|
|
@@ -177457,7 +178033,7 @@ function staleUpdateLockFile(cachePath, now) {
|
|
|
177457
178033
|
for (const path2 of [`${cachePath}.lock.break`, `${cachePath}.lock`]) {
|
|
177458
178034
|
let content;
|
|
177459
178035
|
try {
|
|
177460
|
-
content =
|
|
178036
|
+
content = readFileSync101(path2, "utf8");
|
|
177461
178037
|
} catch {
|
|
177462
178038
|
continue;
|
|
177463
178039
|
}
|
|
@@ -177480,7 +178056,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
|
|
|
177480
178056
|
const mine = lockStamp(now);
|
|
177481
178057
|
const readLock = (path2) => {
|
|
177482
178058
|
try {
|
|
177483
|
-
return
|
|
178059
|
+
return readFileSync101(path2, "utf8");
|
|
177484
178060
|
} catch {
|
|
177485
178061
|
return void 0;
|
|
177486
178062
|
}
|
|
@@ -177571,7 +178147,7 @@ function createUpdateRefreshSpawner(spawnFn = spawn7, execArgv = process.execArg
|
|
|
177571
178147
|
const child = spawnFn(process.execPath, [...loaderArgs(execArgv), fileURLToPath29(import.meta.url), UPDATE_REFRESH_COMMAND], {
|
|
177572
178148
|
detached: true,
|
|
177573
178149
|
stdio: "ignore",
|
|
177574
|
-
cwd:
|
|
178150
|
+
cwd: homedir14(),
|
|
177575
178151
|
env: process.env
|
|
177576
178152
|
});
|
|
177577
178153
|
child.on("error", () => {
|
|
@@ -178181,7 +178757,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
178181
178757
|
const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths2(), paths_exports));
|
|
178182
178758
|
const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
|
|
178183
178759
|
const iosYmlPath = iosProjectYml2(app);
|
|
178184
|
-
const iosYml = existsSync81(iosYmlPath) ?
|
|
178760
|
+
const iosYml = existsSync81(iosYmlPath) ? readFileSync101(iosYmlPath, "utf8") : "";
|
|
178185
178761
|
let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
|
|
178186
178762
|
if (!optedIn) {
|
|
178187
178763
|
const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
|
|
@@ -178195,7 +178771,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
178195
178771
|
}
|
|
178196
178772
|
function readConfigSource(dir) {
|
|
178197
178773
|
try {
|
|
178198
|
-
return
|
|
178774
|
+
return readFileSync101(join84(dir, "config.ts"), "utf8");
|
|
178199
178775
|
} catch {
|
|
178200
178776
|
return null;
|
|
178201
178777
|
}
|
|
@@ -178403,8 +178979,8 @@ function materializeForPreview(appDir3, slug, displayName2) {
|
|
|
178403
178979
|
}
|
|
178404
178980
|
async function appId(dir) {
|
|
178405
178981
|
try {
|
|
178406
|
-
const { readFileSync:
|
|
178407
|
-
const m2 = JSON.parse(
|
|
178982
|
+
const { readFileSync: readFileSync102 } = await import("node:fs");
|
|
178983
|
+
const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
|
|
178408
178984
|
if (m2.name) return m2.name;
|
|
178409
178985
|
} catch {
|
|
178410
178986
|
}
|
|
@@ -178412,8 +178988,8 @@ async function appId(dir) {
|
|
|
178412
178988
|
}
|
|
178413
178989
|
async function contentVisibility(dir) {
|
|
178414
178990
|
try {
|
|
178415
|
-
const { readFileSync:
|
|
178416
|
-
const m2 = JSON.parse(
|
|
178991
|
+
const { readFileSync: readFileSync102 } = await import("node:fs");
|
|
178992
|
+
const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
|
|
178417
178993
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
178418
178994
|
} catch {
|
|
178419
178995
|
}
|
|
@@ -178907,7 +179483,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
178907
179483
|
let js2;
|
|
178908
179484
|
for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
|
|
178909
179485
|
try {
|
|
178910
|
-
js2 =
|
|
179486
|
+
js2 = readFileSync101(join84(outDir, candidate), "utf8");
|
|
178911
179487
|
break;
|
|
178912
179488
|
} catch {
|
|
178913
179489
|
}
|
|
@@ -179477,13 +180053,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
179477
180053
|
if (adding) {
|
|
179478
180054
|
const from = str9(flags.from);
|
|
179479
180055
|
if (!from) throw new TrimRefusal2('--add <id> needs --from <file> holding the whole new SCREENS entry (` "<id>": { "screenId": "<id>", \u2026 },`)');
|
|
179480
|
-
print(adopt.addScreen(dir, adding,
|
|
180056
|
+
print(adopt.addScreen(dir, adding, readFileSync101(from, "utf8"), { parent: str9(flags.parent), tab: str9(flags.tab), displayName: str9(flags["display-name"]) }));
|
|
179481
180057
|
return 0;
|
|
179482
180058
|
}
|
|
179483
180059
|
if (target) {
|
|
179484
180060
|
const from = str9(flags.from);
|
|
179485
180061
|
if (!from) throw new TrimRefusal2("--write <id> needs --from <file> holding the whole entry, as --show prints it");
|
|
179486
|
-
print(adopt.replaceScreen(dir, target,
|
|
180062
|
+
print(adopt.replaceScreen(dir, target, readFileSync101(from, "utf8")));
|
|
179487
180063
|
return 0;
|
|
179488
180064
|
}
|
|
179489
180065
|
if (show) {
|
|
@@ -179635,7 +180211,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
179635
180211
|
const sourceDir = resolve61(str9(flags["source-dir"]) ?? appDir3);
|
|
179636
180212
|
let meta;
|
|
179637
180213
|
try {
|
|
179638
|
-
meta = JSON.parse(
|
|
180214
|
+
meta = JSON.parse(readFileSync101(join84(sourceDir, TEMPLATE_META_FILE), "utf8"));
|
|
179639
180215
|
} catch {
|
|
179640
180216
|
io2.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
|
|
179641
180217
|
return 2;
|
|
@@ -179645,7 +180221,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
179645
180221
|
return 2;
|
|
179646
180222
|
}
|
|
179647
180223
|
try {
|
|
179648
|
-
const appearance = extractTemplateAppearance(JSON.parse(
|
|
180224
|
+
const appearance = extractTemplateAppearance(JSON.parse(readFileSync101(join84(sourceDir, "tokens.json"), "utf8")));
|
|
179649
180225
|
meta = { ...appearance, ...meta };
|
|
179650
180226
|
} catch {
|
|
179651
180227
|
}
|
|
@@ -179724,9 +180300,9 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
179724
180300
|
let iconHash;
|
|
179725
180301
|
if (iconPath) {
|
|
179726
180302
|
try {
|
|
179727
|
-
const bytes2 =
|
|
180303
|
+
const bytes2 = readFileSync101(iconPath);
|
|
179728
180304
|
payload.icon = bytes2.toString("base64");
|
|
179729
|
-
iconHash =
|
|
180305
|
+
iconHash = createHash42("sha256").update(bytes2).digest("hex");
|
|
179730
180306
|
} catch {
|
|
179731
180307
|
}
|
|
179732
180308
|
}
|
|
@@ -179937,16 +180513,16 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
179937
180513
|
return 2;
|
|
179938
180514
|
}
|
|
179939
180515
|
const { readdirSync: readdirSync36, existsSync: fileExists } = await import("node:fs");
|
|
179940
|
-
const { join:
|
|
180516
|
+
const { join: pathJoin3 } = await import("node:path");
|
|
179941
180517
|
const targets = [];
|
|
179942
|
-
const t5 =
|
|
180518
|
+
const t5 = pathJoin3(dir, "tier5-src");
|
|
179943
180519
|
if (fileExists(t5)) {
|
|
179944
180520
|
for (const d2 of readdirSync36(t5, { withFileTypes: true })) {
|
|
179945
|
-
if (d2.isDirectory()) targets.push(
|
|
180521
|
+
if (d2.isDirectory()) targets.push(pathJoin3(t5, d2.name, "index.ts"));
|
|
179946
180522
|
}
|
|
179947
180523
|
}
|
|
179948
180524
|
for (const f2 of ["dev/index.ts", "dev/index.tsx"]) {
|
|
179949
|
-
const c2 =
|
|
180525
|
+
const c2 = pathJoin3(dir, f2);
|
|
179950
180526
|
if (fileExists(c2)) targets.push(c2);
|
|
179951
180527
|
}
|
|
179952
180528
|
const res = ejectModule2({
|
|
@@ -180028,7 +180604,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
|
|
|
180028
180604
|
const path2 = dpxSessionTokenPath();
|
|
180029
180605
|
let raw;
|
|
180030
180606
|
try {
|
|
180031
|
-
raw =
|
|
180607
|
+
raw = readFileSync101(path2, "utf8");
|
|
180032
180608
|
} catch {
|
|
180033
180609
|
throw new Error(`no DPX BO session at ${path2}; run dpx auth login, write dpx auth token to that path, then himi login --dpx --target bo`);
|
|
180034
180610
|
}
|
|
@@ -180885,7 +181461,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
180885
181461
|
return 2;
|
|
180886
181462
|
}
|
|
180887
181463
|
try {
|
|
180888
|
-
const raw = stateArg.trim().startsWith("{") ? stateArg :
|
|
181464
|
+
const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync101(stateArg.replace(/^@/, ""), "utf8");
|
|
180889
181465
|
injectedState = JSON.parse(raw);
|
|
180890
181466
|
} catch (e2) {
|
|
180891
181467
|
io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
|
|
@@ -180900,7 +181476,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
|
|
|
180900
181476
|
return 2;
|
|
180901
181477
|
}
|
|
180902
181478
|
try {
|
|
180903
|
-
const raw = inputArg.trim().startsWith("{") ? inputArg :
|
|
181479
|
+
const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync101(inputArg.replace(/^@/, ""), "utf8");
|
|
180904
181480
|
const parsed = JSON.parse(raw);
|
|
180905
181481
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
|
|
180906
181482
|
injectedInput = parsed;
|
|
@@ -181585,7 +182161,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
181585
182161
|
let localSourceHash;
|
|
181586
182162
|
try {
|
|
181587
182163
|
const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
|
|
181588
|
-
localSourceHash =
|
|
182164
|
+
localSourceHash = createHash42("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
|
|
181589
182165
|
} catch {
|
|
181590
182166
|
}
|
|
181591
182167
|
return runReleasePatch({
|
|
@@ -182269,7 +182845,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
182269
182845
|
}));
|
|
182270
182846
|
return 1;
|
|
182271
182847
|
}
|
|
182272
|
-
const archive =
|
|
182848
|
+
const archive = readFileSync101(resolve61(file2));
|
|
182273
182849
|
const result = await client2().createPackageShare({
|
|
182274
182850
|
app: opened.header.app,
|
|
182275
182851
|
releaseId: opened.header.releaseId,
|
|
@@ -182475,7 +183051,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
182475
183051
|
if (watchKit && bus) {
|
|
182476
183052
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
182477
183053
|
const live3 = join84(running.releaseRoot, running.app);
|
|
182478
|
-
const manifestOf = (tree) => JSON.parse(
|
|
183054
|
+
const manifestOf = (tree) => JSON.parse(readFileSync101(join84(tree, "release-manifest.json"), "utf8"));
|
|
182479
183055
|
let current = manifestOf(live3);
|
|
182480
183056
|
const failed3 = async (message) => {
|
|
182481
183057
|
if (stopping) return;
|
|
@@ -183195,7 +183771,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
183195
183771
|
lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
|
|
183196
183772
|
};
|
|
183197
183773
|
if (kind === "tokens" || kind === "app-config") {
|
|
183198
|
-
const body =
|
|
183774
|
+
const body = readFileSync101(file2, "utf8");
|
|
183199
183775
|
const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
|
|
183200
183776
|
return runReleasePatch({
|
|
183201
183777
|
...common,
|
|
@@ -183210,7 +183786,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
183210
183786
|
io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
|
|
183211
183787
|
return 2;
|
|
183212
183788
|
}
|
|
183213
|
-
const descriptor =
|
|
183789
|
+
const descriptor = readFileSync101(file2, "utf8");
|
|
183214
183790
|
try {
|
|
183215
183791
|
JSON.parse(descriptor);
|
|
183216
183792
|
} catch (e2) {
|
|
@@ -183250,8 +183826,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
183250
183826
|
extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
|
|
183251
183827
|
});
|
|
183252
183828
|
}
|
|
183253
|
-
const bytes2 =
|
|
183254
|
-
const sha2 =
|
|
183829
|
+
const bytes2 = readFileSync101(file2);
|
|
183830
|
+
const sha2 = createHash42("sha256").update(bytes2).digest("hex");
|
|
183255
183831
|
const forScreens = (str9(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
183256
183832
|
if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
|
|
183257
183833
|
io2.error(JSON.stringify({ ok: false, error: "no_rebind_takes_no_value", message: "--no-rebind is a switch and takes no value; pass it bare.", usage: PATCH_USAGE }));
|
|
@@ -183394,7 +183970,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
183394
183970
|
}
|
|
183395
183971
|
let def;
|
|
183396
183972
|
try {
|
|
183397
|
-
const parsed = JSON.parse(arg.startsWith("@") ?
|
|
183973
|
+
const parsed = JSON.parse(arg.startsWith("@") ? readFileSync101(arg.slice(1), "utf8") : arg);
|
|
183398
183974
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
183399
183975
|
io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
|
|
183400
183976
|
return 2;
|
|
@@ -184256,7 +184832,7 @@ ${label2}`);
|
|
|
184256
184832
|
const dpxPath = dpxSessionTokenPath();
|
|
184257
184833
|
let dpx;
|
|
184258
184834
|
try {
|
|
184259
|
-
dpx =
|
|
184835
|
+
dpx = readFileSync101(dpxPath, "utf8").trim();
|
|
184260
184836
|
} catch {
|
|
184261
184837
|
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` }));
|
|
184262
184838
|
return 1;
|
|
@@ -184719,7 +185295,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
|
|
|
184719
185295
|
const path2 = dpxSessionTokenPath();
|
|
184720
185296
|
let raw;
|
|
184721
185297
|
try {
|
|
184722
|
-
raw =
|
|
185298
|
+
raw = readFileSync101(path2, "utf8");
|
|
184723
185299
|
} catch {
|
|
184724
185300
|
io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
|
|
184725
185301
|
return 1;
|