@wix/himalaya-cli 0.1818.0 → 0.1819.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.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isPseudoLocale, PSEUDO_LOCALE } from "../../../tools/l10n/pseudo.js";
|
|
2
|
+
export { isPseudoLocale, PSEUDO_LOCALE };
|
|
1
3
|
export interface CatalogMessage {
|
|
2
4
|
/** The English text this message was harvested from. Always present. */
|
|
3
5
|
source: string;
|
|
@@ -60,3 +62,19 @@ export declare function duplicateKeys(catalog: Catalog | undefined): {
|
|
|
60
62
|
key: string;
|
|
61
63
|
sources: string[];
|
|
62
64
|
}[];
|
|
65
|
+
/**
|
|
66
|
+
* The `en-XA` pseudo-locale catalog, derived from the SOURCE locale's catalog: every row's
|
|
67
|
+
* translation is its source string, pseudo-localized. Every row carries one — the keyed
|
|
68
|
+
* runtime-copy rows and the auth-gate rows included, since they live in the same file — so
|
|
69
|
+
* a string that reaches a screen through the catalog paints `⟦…⟧` and one that bypasses it
|
|
70
|
+
* paints plain English (RFC 0054; `pseudo-locale-differential.test.ts`).
|
|
71
|
+
*
|
|
72
|
+
* A pure transform of the input, never a file of its own: nothing to keep fresh, nothing to translate.
|
|
73
|
+
*/
|
|
74
|
+
export declare function pseudoCatalog(source: Catalog | undefined): Catalog | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Whether an `Accept-Language` header asks for the pseudo-locale as its FIRST choice: `en-XA` (or the
|
|
77
|
+
* `qps-ploc` alias) holds the highest q-value, ties broken by order, and its q is above 0. `q=0` means
|
|
78
|
+
* "not acceptable", and `he, en-XA;q=0.5` prefers Hebrew, so neither selects it.
|
|
79
|
+
*/
|
|
80
|
+
export declare function prefersPseudoLocale(acceptLanguage: string | undefined | null): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The pseudo-locale tag, and the Windows-style alias some hosts send. Compared case-insensitively. */
|
|
2
|
+
export declare const PSEUDO_LOCALE = "en-XA";
|
|
3
|
+
export declare const PSEUDO_LOCALE_ALIASES: readonly string[];
|
|
4
|
+
export declare const PSEUDO_OPEN = "\u27E6";
|
|
5
|
+
export declare const PSEUDO_CLOSE = "\u27E7";
|
|
6
|
+
/** Extra length: translations routinely run 30–40% longer than English. */
|
|
7
|
+
export declare const PSEUDO_EXPANSION = 0.35;
|
|
8
|
+
export declare function isPseudoLocale(tag: string | null | undefined): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* `Sign in` → `⟦Šîĝñ îñ ~~~⟧`. Accents every letter, adds ~35% length and wraps in `⟦…⟧`.
|
|
11
|
+
* ICU `{placeholders}`, `$t:` keys and printf specifiers are preserved. Idempotent: text
|
|
12
|
+
* already wrapped is returned unchanged. An empty string stays empty (nothing to paint).
|
|
13
|
+
*/
|
|
14
|
+
export declare function pseudoLocalize(text: string): string;
|
package/dist/cli.mjs
CHANGED
|
@@ -37380,6 +37380,111 @@ var init_wix_cache_policy = __esm({
|
|
|
37380
37380
|
}
|
|
37381
37381
|
});
|
|
37382
37382
|
|
|
37383
|
+
// ../l10n/pseudo.ts
|
|
37384
|
+
function isPseudoLocale(tag) {
|
|
37385
|
+
return typeof tag === "string" && PSEUDO_LOCALE_ALIASES.includes(tag.trim().toLowerCase());
|
|
37386
|
+
}
|
|
37387
|
+
function accentPlain(text32) {
|
|
37388
|
+
let out2 = "";
|
|
37389
|
+
let letters = 0;
|
|
37390
|
+
for (let i2 = 0; i2 < text32.length; ) {
|
|
37391
|
+
VERBATIM.lastIndex = i2;
|
|
37392
|
+
const keep = VERBATIM.exec(text32);
|
|
37393
|
+
if (keep) {
|
|
37394
|
+
out2 += keep[0];
|
|
37395
|
+
i2 += keep[0].length;
|
|
37396
|
+
continue;
|
|
37397
|
+
}
|
|
37398
|
+
const ch2 = text32[i2];
|
|
37399
|
+
const mapped = ACCENT.get(ch2);
|
|
37400
|
+
if (mapped) letters++;
|
|
37401
|
+
out2 += mapped ?? ch2;
|
|
37402
|
+
i2++;
|
|
37403
|
+
}
|
|
37404
|
+
return { out: out2, letters };
|
|
37405
|
+
}
|
|
37406
|
+
function closeOf(text32, open6) {
|
|
37407
|
+
let depth = 0;
|
|
37408
|
+
for (let i2 = open6; i2 < text32.length; i2++) {
|
|
37409
|
+
if (text32[i2] === "{") depth++;
|
|
37410
|
+
else if (text32[i2] === "}" && --depth === 0) return i2;
|
|
37411
|
+
}
|
|
37412
|
+
return -1;
|
|
37413
|
+
}
|
|
37414
|
+
function accentIcu(text32) {
|
|
37415
|
+
let out2 = "";
|
|
37416
|
+
let letters = 0;
|
|
37417
|
+
let plain4 = "";
|
|
37418
|
+
const flush2 = () => {
|
|
37419
|
+
const r3 = accentPlain(plain4);
|
|
37420
|
+
out2 += r3.out;
|
|
37421
|
+
letters += r3.letters;
|
|
37422
|
+
plain4 = "";
|
|
37423
|
+
};
|
|
37424
|
+
for (let i2 = 0; i2 < text32.length; ) {
|
|
37425
|
+
if (text32[i2] !== "{") {
|
|
37426
|
+
plain4 += text32[i2];
|
|
37427
|
+
i2++;
|
|
37428
|
+
continue;
|
|
37429
|
+
}
|
|
37430
|
+
const end2 = closeOf(text32, i2);
|
|
37431
|
+
if (end2 === -1) {
|
|
37432
|
+
plain4 += text32.slice(i2);
|
|
37433
|
+
break;
|
|
37434
|
+
}
|
|
37435
|
+
flush2();
|
|
37436
|
+
const inner = text32.slice(i2 + 1, end2);
|
|
37437
|
+
if (!inner.includes("{")) {
|
|
37438
|
+
out2 += `{${inner}}`;
|
|
37439
|
+
} else {
|
|
37440
|
+
let body = "";
|
|
37441
|
+
for (let j2 = 0; j2 < inner.length; ) {
|
|
37442
|
+
if (inner[j2] !== "{") {
|
|
37443
|
+
body += inner[j2];
|
|
37444
|
+
j2++;
|
|
37445
|
+
continue;
|
|
37446
|
+
}
|
|
37447
|
+
const branchEnd = closeOf(inner, j2);
|
|
37448
|
+
if (branchEnd === -1) {
|
|
37449
|
+
body += inner.slice(j2);
|
|
37450
|
+
break;
|
|
37451
|
+
}
|
|
37452
|
+
const branch = accentIcu(inner.slice(j2 + 1, branchEnd));
|
|
37453
|
+
letters += branch.letters;
|
|
37454
|
+
body += `{${branch.out}}`;
|
|
37455
|
+
j2 = branchEnd + 1;
|
|
37456
|
+
}
|
|
37457
|
+
out2 += `{${body}}`;
|
|
37458
|
+
}
|
|
37459
|
+
i2 = end2 + 1;
|
|
37460
|
+
}
|
|
37461
|
+
flush2();
|
|
37462
|
+
return { out: out2, letters };
|
|
37463
|
+
}
|
|
37464
|
+
function pseudoLocalize(text32) {
|
|
37465
|
+
if (!text32) return text32;
|
|
37466
|
+
if (text32.startsWith(PSEUDO_OPEN) && text32.endsWith(PSEUDO_CLOSE)) return text32;
|
|
37467
|
+
const { out: out2, letters } = accentIcu(text32);
|
|
37468
|
+
const pad3 = letters === 0 ? 0 : Math.ceil(letters * PSEUDO_EXPANSION);
|
|
37469
|
+
return `${PSEUDO_OPEN}${out2}${pad3 ? ` ${PAD.repeat(pad3)}` : ""}${PSEUDO_CLOSE}`;
|
|
37470
|
+
}
|
|
37471
|
+
var PSEUDO_LOCALE, PSEUDO_LOCALE_ALIASES, PSEUDO_OPEN, PSEUDO_CLOSE, PSEUDO_EXPANSION, PAD, FROM, TO, ACCENT, VERBATIM;
|
|
37472
|
+
var init_pseudo = __esm({
|
|
37473
|
+
"../l10n/pseudo.ts"() {
|
|
37474
|
+
init_define_HHP_CATALOG();
|
|
37475
|
+
PSEUDO_LOCALE = "en-XA";
|
|
37476
|
+
PSEUDO_LOCALE_ALIASES = ["en-xa", "qps-ploc"];
|
|
37477
|
+
PSEUDO_OPEN = "\u27E6";
|
|
37478
|
+
PSEUDO_CLOSE = "\u27E7";
|
|
37479
|
+
PSEUDO_EXPANSION = 0.35;
|
|
37480
|
+
PAD = "~";
|
|
37481
|
+
FROM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
37482
|
+
TO = "\xC5\u0181\xC7\xD0\xC9\u0191\u011C\u0124\xCE\u0134\u0136\u013B\u1E3E\xD1\xD6\xDE\u01EA\u0154\u0160\u0162\xDB\u1E7C\u0174\u1E8A\xDD\u017D\xE5\u0180\xE7\xF0\xE9\u0192\u011D\u0125\xEE\u0135\u0137\u013C\u1E3F\xF1\xF6\xFE\u01EB\u0155\u0161\u0163\xFB\u1E7D\u0175\u1E8B\xFD\u017E";
|
|
37483
|
+
ACCENT = new Map([...FROM].map((c2, i2) => [c2, [...TO][i2]]));
|
|
37484
|
+
VERBATIM = /\$t:[A-Za-z0-9_.\-]+|%(?:\d+\$)?[@dsfu]/y;
|
|
37485
|
+
}
|
|
37486
|
+
});
|
|
37487
|
+
|
|
37383
37488
|
// ../../core/dev-server/src/l10n-catalog.ts
|
|
37384
37489
|
function parseCatalog(text32) {
|
|
37385
37490
|
try {
|
|
@@ -37409,9 +37514,30 @@ function keyMap(catalog4, opts = {}) {
|
|
|
37409
37514
|
}
|
|
37410
37515
|
return out2;
|
|
37411
37516
|
}
|
|
37517
|
+
function pseudoCatalog(source2) {
|
|
37518
|
+
if (!source2) return void 0;
|
|
37519
|
+
const messages = {};
|
|
37520
|
+
for (const [id, m2] of Object.entries(source2.messages ?? {})) {
|
|
37521
|
+
if (typeof m2?.source !== "string") continue;
|
|
37522
|
+
messages[id] = { ...m2, translation: pseudoLocalize(m2.source) };
|
|
37523
|
+
}
|
|
37524
|
+
return { ...source2, $source: source2.$source, messages };
|
|
37525
|
+
}
|
|
37526
|
+
function prefersPseudoLocale(acceptLanguage) {
|
|
37527
|
+
if (!acceptLanguage) return false;
|
|
37528
|
+
const ranked = acceptLanguage.split(",").map((part5, order) => {
|
|
37529
|
+
const [tag = "", ...params] = part5.split(";");
|
|
37530
|
+
const q4 = params.map((p2) => /^\s*q\s*=\s*([0-9.]+)\s*$/i.exec(p2)?.[1]).find((v2) => v2 !== void 0);
|
|
37531
|
+
const weight2 = q4 === void 0 ? 1 : Number(q4);
|
|
37532
|
+
return { tag: tag.trim(), weight: Number.isFinite(weight2) ? weight2 : 0, order };
|
|
37533
|
+
}).filter((e2) => e2.tag && e2.weight > 0);
|
|
37534
|
+
ranked.sort((x2, y2) => y2.weight - x2.weight || x2.order - y2.order);
|
|
37535
|
+
return ranked.length > 0 && isPseudoLocale(ranked[0].tag);
|
|
37536
|
+
}
|
|
37412
37537
|
var init_l10n_catalog = __esm({
|
|
37413
37538
|
"../../core/dev-server/src/l10n-catalog.ts"() {
|
|
37414
37539
|
init_define_HHP_CATALOG();
|
|
37540
|
+
init_pseudo();
|
|
37415
37541
|
}
|
|
37416
37542
|
});
|
|
37417
37543
|
|
|
@@ -37421,13 +37547,20 @@ import { resolve as resolve27 } from "node:path";
|
|
|
37421
37547
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
37422
37548
|
function loadCatalog(tag) {
|
|
37423
37549
|
if (catalogCache.has(tag)) return catalogCache.get(tag);
|
|
37424
|
-
const
|
|
37550
|
+
const pseudo = isPseudoLocale(tag);
|
|
37551
|
+
const path2 = resolve27(ROOT3, `tools/l10n/catalog.${pseudo ? "en" : tag}.json`);
|
|
37552
|
+
if (pseudo) {
|
|
37553
|
+
const map3 = existsSync33(path2) ? sourceMap(pseudoCatalog(parseCatalog(readFileSync31(path2, "utf8")))) : /* @__PURE__ */ new Map();
|
|
37554
|
+
catalogCache.set(tag, map3);
|
|
37555
|
+
return map3;
|
|
37556
|
+
}
|
|
37425
37557
|
const map2 = existsSync33(path2) ? sourceMap(parseCatalog(readFileSync31(path2, "utf8"))) : /* @__PURE__ */ new Map();
|
|
37426
37558
|
catalogCache.set(tag, map2);
|
|
37427
37559
|
return map2;
|
|
37428
37560
|
}
|
|
37429
37561
|
function pickLocale(acceptLanguage) {
|
|
37430
37562
|
if (!acceptLanguage) return null;
|
|
37563
|
+
if (prefersPseudoLocale(acceptLanguage)) return PSEUDO_LOCALE;
|
|
37431
37564
|
const tags = acceptLanguage.split(",").map((s5) => s5.split(";")[0].trim().toLowerCase()).map((s5) => s5.split("-")[0]).filter((s5) => s5.length > 0);
|
|
37432
37565
|
for (const tag of tags) {
|
|
37433
37566
|
if (tag === "en") continue;
|
|
@@ -146227,7 +146360,9 @@ function renderDescriptorToHtml(payload, tokens2, scheme = "light", provider = n
|
|
|
146227
146360
|
...rtl ? { isRTL: true } : {},
|
|
146228
146361
|
...opts?.idiomContext ? { idiomContext: opts.idiomContext } : {},
|
|
146229
146362
|
...opts?.debugUnknownComponents ? { debugUnknownComponents: true } : {},
|
|
146230
|
-
...opts?.assetBaseUrl ? { assetBaseUrl: opts.assetBaseUrl } : {}
|
|
146363
|
+
...opts?.assetBaseUrl ? { assetBaseUrl: opts.assetBaseUrl } : {},
|
|
146364
|
+
...opts?.catalog ? { catalog: opts.catalog } : {},
|
|
146365
|
+
...opts?.localeTag ? { localeTag: opts.localeTag } : {}
|
|
146231
146366
|
});
|
|
146232
146367
|
const FOCUS_STYLE_MARKUP = `<style data-himalaya-focus-ring>${FOCUS_RING_CSS}</style>`;
|
|
146233
146368
|
const glassPreview = isIOSGlassPreview(opts?.idiomContext);
|
|
@@ -146566,6 +146701,7 @@ function resolveTreeScalar(v2, provider, itemScope) {
|
|
|
146566
146701
|
return itemScope ? key4 ? itemScope[key4] : itemScope : void 0;
|
|
146567
146702
|
}
|
|
146568
146703
|
if (v2.startsWith("$service:")) return provider.value(v2) ?? void 0;
|
|
146704
|
+
if (v2.startsWith(TRANSLATION_PREFIX) && provider.catalog) return resolveTranslation(v2, provider.catalog);
|
|
146569
146705
|
return v2;
|
|
146570
146706
|
}
|
|
146571
146707
|
function collectResolvedMediaRecord(record5, path2, context) {
|
|
@@ -146676,7 +146812,8 @@ function buildRenderTree(node3, path2 = "$", provider = null, itemScope = void 0
|
|
|
146676
146812
|
const template = props2.template;
|
|
146677
146813
|
if (type2 === "Text" && template && typeof template.template === "string") {
|
|
146678
146814
|
const args = Object.fromEntries(Object.entries(template.params ?? {}).map(([key4, value2]) => [key4, resolveTreeScalar(value2, provider, itemScope)]));
|
|
146679
|
-
|
|
146815
|
+
const pattern = resolveTreeScalar(template.template, provider, itemScope);
|
|
146816
|
+
values.content = formatMessage(typeof pattern === "string" ? pattern : template.template, args);
|
|
146680
146817
|
}
|
|
146681
146818
|
const valuePath = props2.valuePath;
|
|
146682
146819
|
const asText3 = VALUE_PATH_TEXT.get(type2);
|
|
@@ -146886,7 +147023,7 @@ function composeStickyTree(payload, header2, footer) {
|
|
|
146886
147023
|
if (footer) children2.push(footer);
|
|
146887
147024
|
return { id: "screen", type: "ScreenChrome", children: children2 };
|
|
146888
147025
|
}
|
|
146889
|
-
async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, services2 = null, width, isRTL2, idiomContext, assetBaseUrl, platformFrame, contentMaxWidth) {
|
|
147026
|
+
async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, services2 = null, width, isRTL2, idiomContext, assetBaseUrl, platformFrame, contentMaxWidth, l10n) {
|
|
146890
147027
|
const desc = descriptor;
|
|
146891
147028
|
const tooDeep = rawJsonDepthFinding(descriptor);
|
|
146892
147029
|
if (tooDeep) return { renderable: false, reason: `depth_budget_exceeded: ${tooDeep.message}` };
|
|
@@ -146901,6 +147038,7 @@ async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, service
|
|
|
146901
147038
|
};
|
|
146902
147039
|
}
|
|
146903
147040
|
const provider = services2 ? new FakeServiceProvider(services2) : null;
|
|
147041
|
+
const treeProvider = provider && l10n ? { value: (path2) => provider.value(path2), catalog: l10n.catalog } : provider;
|
|
146904
147042
|
const stickyHeader = isSduiNode(desc.stickyHeader) ? desc.stickyHeader : void 0;
|
|
146905
147043
|
const stickyFooter = isSduiNode(desc.stickyFooter) ? desc.stickyFooter : void 0;
|
|
146906
147044
|
const clientEnv = clientEnvFor(scheme, width, isRTL2);
|
|
@@ -146910,10 +147048,10 @@ async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, service
|
|
|
146910
147048
|
stickyHeader ? treeOf(stickyHeader, "$.stickyHeader", null) : null,
|
|
146911
147049
|
stickyFooter ? treeOf(stickyFooter, "$.stickyFooter", null) : null
|
|
146912
147050
|
);
|
|
146913
|
-
const resolvedRenderTree =
|
|
146914
|
-
treeOf(payload, "$",
|
|
146915
|
-
stickyHeader ? treeOf(stickyHeader, "$.stickyHeader",
|
|
146916
|
-
stickyFooter ? treeOf(stickyFooter, "$.stickyFooter",
|
|
147051
|
+
const resolvedRenderTree = treeProvider ? composeStickyTree(
|
|
147052
|
+
treeOf(payload, "$", treeProvider) ?? void 0,
|
|
147053
|
+
stickyHeader ? treeOf(stickyHeader, "$.stickyHeader", treeProvider) : null,
|
|
147054
|
+
stickyFooter ? treeOf(stickyFooter, "$.stickyFooter", treeProvider) : null
|
|
146917
147055
|
) : void 0;
|
|
146918
147056
|
let html;
|
|
146919
147057
|
try {
|
|
@@ -146931,7 +147069,7 @@ async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, service
|
|
|
146931
147069
|
} : void 0,
|
|
146932
147070
|
// #4497 — the agent fast loop is a dev tool: an unknown component type keeps its
|
|
146933
147071
|
// developer label here (a shipped web app renders nothing for it).
|
|
146934
|
-
{ ...isRTL2 ? { isRTL: true } : {}, ...idiomContext ? { idiomContext } : {}, ...assetBaseUrl ? { assetBaseUrl } : {}, ...platformFrame ? { platformFrame } : {}, ...contentMaxWidth ? { contentMaxWidth } : {}, debugUnknownComponents: true }
|
|
147072
|
+
{ ...isRTL2 ? { isRTL: true } : {}, ...idiomContext ? { idiomContext } : {}, ...assetBaseUrl ? { assetBaseUrl } : {}, ...platformFrame ? { platformFrame } : {}, ...contentMaxWidth ? { contentMaxWidth } : {}, ...l10n ? { catalog: l10n.catalog, localeTag: l10n.localeTag } : {}, debugUnknownComponents: true }
|
|
146935
147073
|
);
|
|
146936
147074
|
} catch (err) {
|
|
146937
147075
|
return {
|
|
@@ -147126,6 +147264,7 @@ var init_render_descriptor = __esm({
|
|
|
147126
147264
|
init_media_value();
|
|
147127
147265
|
init_raw_json_depth();
|
|
147128
147266
|
init_message_format();
|
|
147267
|
+
init_bindings();
|
|
147129
147268
|
init_preview_surfaces();
|
|
147130
147269
|
init_shell_nav();
|
|
147131
147270
|
init_a11y_contract();
|
|
@@ -148774,10 +148913,25 @@ function sourceTranslationKeys(state) {
|
|
|
148774
148913
|
return /* @__PURE__ */ new Set();
|
|
148775
148914
|
}
|
|
148776
148915
|
}
|
|
148916
|
+
function renderL10nFor(state, locale) {
|
|
148917
|
+
if (typeof locale !== "string" || !state.app) return void 0;
|
|
148918
|
+
const pseudo = isPseudoLocale(locale);
|
|
148919
|
+
const sourceLocale = uiConfig(state.app.module.config).locale?.default ?? "en";
|
|
148920
|
+
const tag = pseudo ? sourceLocale : locale.trim();
|
|
148921
|
+
if (!/^[a-z]{2,3}(-[A-Za-z0-9]{1,8})?$/.test(tag)) return void 0;
|
|
148922
|
+
const path2 = resolve34(state.app.dir, "l10n", `${tag}.json`);
|
|
148923
|
+
if (!existsSync40(path2)) return void 0;
|
|
148924
|
+
try {
|
|
148925
|
+
const parsed = parseCatalog(readFileSync43(path2, "utf8"));
|
|
148926
|
+
return { catalog: keyMap(pseudo ? pseudoCatalog(parsed) : parsed, { sourceFallback: tag === sourceLocale }), localeTag: pseudo ? PSEUDO_LOCALE : tag };
|
|
148927
|
+
} catch {
|
|
148928
|
+
return void 0;
|
|
148929
|
+
}
|
|
148930
|
+
}
|
|
148777
148931
|
function handleL10nRequest(req, res, state) {
|
|
148778
148932
|
const u2 = new URL(req.url ?? "", "http://localhost");
|
|
148779
148933
|
const app2 = (u2.searchParams.get("app") ?? "").trim();
|
|
148780
|
-
|
|
148934
|
+
let tag = (u2.searchParams.get("tag") ?? "").trim();
|
|
148781
148935
|
const cors = { "access-control-allow-origin": "*" };
|
|
148782
148936
|
if (!isWellFormedAppParam(app2)) {
|
|
148783
148937
|
return sendJson(res, 400, { error: "bad_app", hint: "pass ?app=<kebab-app-name>&tag=<locale>" }, cors);
|
|
@@ -148788,17 +148942,20 @@ function handleL10nRequest(req, res, state) {
|
|
|
148788
148942
|
if (!state.app || app2 !== state.app.name) {
|
|
148789
148943
|
return sendJson(res, 404, { error: "unknown_app", app: app2 }, cors);
|
|
148790
148944
|
}
|
|
148791
|
-
const
|
|
148945
|
+
const sourceLocale = uiConfig(state.app.module.config).locale?.default ?? "en";
|
|
148946
|
+
if (isPseudoLocale(tag) || tag === sourceLocale && prefersPseudoLocale(String(req.headers["accept-language"] ?? ""))) tag = PSEUDO_LOCALE;
|
|
148947
|
+
const pseudo = tag === PSEUDO_LOCALE;
|
|
148948
|
+
const path2 = resolve34(state.app.dir, "l10n", `${pseudo ? sourceLocale : tag}.json`);
|
|
148792
148949
|
if (!existsSync40(path2)) {
|
|
148793
148950
|
res.writeHead(204, cors);
|
|
148794
148951
|
res.end();
|
|
148795
148952
|
return;
|
|
148796
148953
|
}
|
|
148797
|
-
const sourceLocale = uiConfig(state.app.module.config).locale?.default ?? "en";
|
|
148798
148954
|
let messages;
|
|
148799
148955
|
try {
|
|
148956
|
+
const parsed = parseCatalog(readFileSync43(path2, "utf8"));
|
|
148800
148957
|
messages = Object.fromEntries(
|
|
148801
|
-
keyMap(
|
|
148958
|
+
keyMap(pseudo ? pseudoCatalog(parsed) : parsed, { sourceFallback: tag === sourceLocale })
|
|
148802
148959
|
);
|
|
148803
148960
|
} catch {
|
|
148804
148961
|
return sendJson(res, 500, { error: "catalog_unreadable", app: app2, tag }, cors);
|
|
@@ -150553,7 +150710,11 @@ async function handleDev(req, res, state) {
|
|
|
150553
150710
|
idiomContext,
|
|
150554
150711
|
// #4595 — HHP package images arrive host-less (`/v1/asset/<sha>?app=`); a PNG page loads at
|
|
150555
150712
|
// about:blank, so resolve them against this server, as a device resolves them against its origin.
|
|
150556
|
-
state.serverBaseUrl
|
|
150713
|
+
state.serverBaseUrl,
|
|
150714
|
+
void 0,
|
|
150715
|
+
void 0,
|
|
150716
|
+
// platformFrame, contentMaxWidth
|
|
150717
|
+
renderL10nFor(state, body.locale)
|
|
150557
150718
|
);
|
|
150558
150719
|
const legacy = { screenId, scheme, ...render3, diagnostics };
|
|
150559
150720
|
const report9 = foldLegacyReport(legacy, {
|
|
@@ -179887,7 +180048,7 @@ function planReel(dir) {
|
|
|
179887
180048
|
const tokens2 = readJson6(join59(dir, "tokens.json"));
|
|
179888
180049
|
const accentToken = tokens2?.colors?.accentPrimary;
|
|
179889
180050
|
const accentRaw = typeof accentToken === "string" ? accentToken : accentToken?.light;
|
|
179890
|
-
const accent = typeof accentRaw === "string" &&
|
|
180051
|
+
const accent = typeof accentRaw === "string" && ACCENT2.test(accentRaw) ? accentRaw : DEFAULT_ACCENT;
|
|
179891
180052
|
const shots = memory2?.shots ?? [];
|
|
179892
180053
|
const present = shots.filter((s5) => s5.present).sort((a3, b3) => a3.firstSeen.localeCompare(b3.firstSeen) || a3.id.localeCompare(b3.id));
|
|
179893
180054
|
const home2 = present.find((s5) => /(^|_)home($|_)/i.test(s5.id)) ?? present.find((s5) => /home/i.test(s5.id));
|
|
@@ -180004,7 +180165,7 @@ function sinceStart(start2, ts34) {
|
|
|
180004
180165
|
function renderReel(plan, images) {
|
|
180005
180166
|
const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
|
|
180006
180167
|
const count3 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
|
|
180007
|
-
const accent =
|
|
180168
|
+
const accent = ACCENT2.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
|
|
180008
180169
|
const clock = (ts34) => sinceStart(plan.startedAt, ts34);
|
|
180009
180170
|
const frames = plan.frames.filter((f2) => images.has(f2.file));
|
|
180010
180171
|
const flip = frames.length ? `<section class="flip"><div class="phone">${frames.map((f2, i2) => `<img class="fr${i2 === 0 ? " on" : ""}" src="${images.get(f2.file)}" alt="${escapeHtml(plan.focusId ?? "")} at ${clock(f2.ts)}">`).join("")}</div>
|
|
@@ -180050,7 +180211,7 @@ function buildReel(dir, budget = REEL_BUDGET_BYTES) {
|
|
|
180050
180211
|
const { plan, images } = inlineImages(dir, planReel(dir), budget);
|
|
180051
180212
|
return { html: renderReel(plan, images), plan };
|
|
180052
180213
|
}
|
|
180053
|
-
var REEL_BUDGET_BYTES, MAX_FLIP_FRAMES, DEFAULT_ACCENT,
|
|
180214
|
+
var REEL_BUDGET_BYTES, MAX_FLIP_FRAMES, DEFAULT_ACCENT, ACCENT2, HISTORY_NAME, MIME2, mimeOf, readJson6, isObj3, str7, historyName, cited;
|
|
180054
180215
|
var init_studio_reel = __esm({
|
|
180055
180216
|
"src/studio-reel.ts"() {
|
|
180056
180217
|
init_define_HHP_CATALOG();
|
|
@@ -180059,7 +180220,7 @@ var init_studio_reel = __esm({
|
|
|
180059
180220
|
REEL_BUDGET_BYTES = 12 * 1024 * 1024;
|
|
180060
180221
|
MAX_FLIP_FRAMES = 40;
|
|
180061
180222
|
DEFAULT_ACCENT = "#3b6fd8";
|
|
180062
|
-
|
|
180223
|
+
ACCENT2 = /^#[0-9a-f]{3,8}$/i;
|
|
180063
180224
|
HISTORY_NAME = /^[0-9a-f]{64}\.(png|jpg|gif|webp)$/;
|
|
180064
180225
|
MIME2 = { png: "image/png", jpg: "image/jpeg", gif: "image/gif", webp: "image/webp" };
|
|
180065
180226
|
mimeOf = (file2) => MIME2[file2.slice(65)] ?? "image/png";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1819.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"artifactId": "himalaya-cli"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"falconPackageHash": "
|
|
85
|
+
"falconPackageHash": "699b1b61bbc7e53bbc87b116bbed0af81cd485b613cc7d3fcc79e722"
|
|
86
86
|
}
|