@wix/himalaya-cli 0.1744.0 → 0.1746.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +7 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +21 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{b583b2879dbf6318c5d5bc0aaca78a34b84f76b51a8f79dc824e05521f2a5a7a.bin → d432d189310d8d819b56251c53dd82a9e166a4a73936749f08c355c11083e8e0.bin} +1 -1
- package/dist/browser-plane/sw.js +5 -5
- package/dist/cli.mjs +808 -421
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/android-ux.md +1 -1
- package/guides/designing-himi-screens.md +23 -14
- package/guides/headless-loop.md +1 -1
- package/guides/ios-ux.md +1 -1
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +19 -1
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/branded-lite/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/community-club/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/conference/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/events-meetups/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/gym-fitness/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/nonprofit-cause/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/podcast-creator/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/portfolio-creative/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/restaurant/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/retail-store/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/salon-spa/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/wholesale-store/tier5-src/_shared/himi-account.ts +37 -8
- package/templates/yoga-studio/tier5-src/_shared/himi-account.ts +37 -8
package/dist/cli.mjs
CHANGED
|
@@ -11107,8 +11107,8 @@ function tsExtResolvePlugin() {
|
|
|
11107
11107
|
setup(b3) {
|
|
11108
11108
|
b3.onResolve({ filter: /\.js$/ }, (args) => {
|
|
11109
11109
|
if (args.kind === "entry-point" || !args.path.startsWith(".")) return void 0;
|
|
11110
|
-
const
|
|
11111
|
-
return existsSync12(
|
|
11110
|
+
const ts31 = resolve10(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
|
|
11111
|
+
return existsSync12(ts31) ? { path: ts31 } : void 0;
|
|
11112
11112
|
});
|
|
11113
11113
|
}
|
|
11114
11114
|
};
|
|
@@ -11897,7 +11897,7 @@ function bundleFor(file2) {
|
|
|
11897
11897
|
const match = /^tier5-src\/([^/]+)\//.exec(file2);
|
|
11898
11898
|
return match?.[1] ?? "_shared";
|
|
11899
11899
|
}
|
|
11900
|
-
function toIssue(
|
|
11900
|
+
function toIssue(ts31, contentDir2, diagnostic) {
|
|
11901
11901
|
const file2 = diagnostic.file ? relativeFile(contentDir2, diagnostic.file.fileName) : void 0;
|
|
11902
11902
|
const position = diagnostic.file && diagnostic.start !== void 0 ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : void 0;
|
|
11903
11903
|
return {
|
|
@@ -11905,13 +11905,13 @@ function toIssue(ts30, contentDir2, diagnostic) {
|
|
|
11905
11905
|
...file2 ? { file: file2 } : {},
|
|
11906
11906
|
...position ? { line: position.line + 1, column: position.character + 1 } : {},
|
|
11907
11907
|
code: `TS${diagnostic.code}`,
|
|
11908
|
-
message:
|
|
11908
|
+
message: ts31.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
11909
11909
|
};
|
|
11910
11910
|
}
|
|
11911
|
-
function confinedHost(
|
|
11911
|
+
function confinedHost(ts31, contentDir2, options2) {
|
|
11912
11912
|
if (!buildConfinementRequired()) return void 0;
|
|
11913
|
-
const host =
|
|
11914
|
-
const libDir = resolve12(
|
|
11913
|
+
const host = ts31.createCompilerHost(options2);
|
|
11914
|
+
const libDir = resolve12(ts31.getDefaultLibFilePath(options2), "..");
|
|
11915
11915
|
const allows = confinementMatcher(contentDir2, [libDir]);
|
|
11916
11916
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
11917
11917
|
const readFile21 = host.readFile.bind(host);
|
|
@@ -11940,7 +11940,7 @@ function confinedHost(ts30, contentDir2, options2) {
|
|
|
11940
11940
|
}
|
|
11941
11941
|
async function typecheckContentWorkers(contentDir2, options2) {
|
|
11942
11942
|
if (!existsSync13(resolve12(contentDir2, "tier5-src"))) return [];
|
|
11943
|
-
const
|
|
11943
|
+
const ts31 = await compiler2();
|
|
11944
11944
|
const config = {
|
|
11945
11945
|
compilerOptions: {
|
|
11946
11946
|
...CONTENT_WORKER_COMPILER_OPTIONS,
|
|
@@ -11950,18 +11950,18 @@ async function typecheckContentWorkers(contentDir2, options2) {
|
|
|
11950
11950
|
// The deployed authoring runtime stages TypeScript 6, which requires an explicit
|
|
11951
11951
|
// acknowledgement for this compatibility `baseUrl`; the repository's TypeScript 5 lane
|
|
11952
11952
|
// rejects that 6.0 value, so keep it specific to the compiler that needs it.
|
|
11953
|
-
...Number.parseInt(
|
|
11953
|
+
...Number.parseInt(ts31.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
|
|
11954
11954
|
},
|
|
11955
11955
|
include: ["tier5-src/*/index.ts", "tier5-src/_shared/**/*.ts"]
|
|
11956
11956
|
};
|
|
11957
|
-
const parsed =
|
|
11957
|
+
const parsed = ts31.parseJsonConfigFileContent(config, ts31.sys, contentDir2);
|
|
11958
11958
|
if (parsed.fileNames.length === 0) return [];
|
|
11959
|
-
const program =
|
|
11959
|
+
const program = ts31.createProgram({
|
|
11960
11960
|
rootNames: parsed.fileNames,
|
|
11961
11961
|
options: parsed.options,
|
|
11962
|
-
host: confinedHost(
|
|
11962
|
+
host: confinedHost(ts31, contentDir2, parsed.options)
|
|
11963
11963
|
});
|
|
11964
|
-
return [...parsed.errors, ...
|
|
11964
|
+
return [...parsed.errors, ...ts31.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts31.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts31, contentDir2, diagnostic));
|
|
11965
11965
|
}
|
|
11966
11966
|
var compilerPromise;
|
|
11967
11967
|
var init_tier5_typecheck = __esm({
|
|
@@ -25296,22 +25296,22 @@ var init_pixels = __esm({
|
|
|
25296
25296
|
});
|
|
25297
25297
|
|
|
25298
25298
|
// ../../core/dev-server/src/declared-navigation-ast.ts
|
|
25299
|
-
function fixedNavigations(bundleJs,
|
|
25300
|
-
literalTargets(bundleJs,
|
|
25299
|
+
function fixedNavigations(bundleJs, ts31) {
|
|
25300
|
+
literalTargets(bundleJs, ts31);
|
|
25301
25301
|
return fixedCache.get(bundleJs) ?? /* @__PURE__ */ new Map();
|
|
25302
25302
|
}
|
|
25303
|
-
function literalTargets(bundleJs,
|
|
25304
|
-
const name = (n2) => n2 && (
|
|
25303
|
+
function literalTargets(bundleJs, ts31) {
|
|
25304
|
+
const name = (n2) => n2 && (ts31.isIdentifier(n2) || ts31.isStringLiteral(n2) || ts31.isNoSubstitutionTemplateLiteral(n2)) ? n2.text : void 0;
|
|
25305
25305
|
const object16 = (n2) => {
|
|
25306
|
-
while (n2 &&
|
|
25307
|
-
return n2 &&
|
|
25306
|
+
while (n2 && ts31.isParenthesizedExpression(n2)) n2 = n2.expression;
|
|
25307
|
+
return n2 && ts31.isObjectLiteralExpression(n2) ? n2 : void 0;
|
|
25308
25308
|
};
|
|
25309
25309
|
const property3 = (o2, key4) => o2?.properties.find((p2) => name(p2.name) === key4);
|
|
25310
|
-
const initializer = (p2) => p2 &&
|
|
25311
|
-
const callable = (n2) => !!n2 && (
|
|
25310
|
+
const initializer = (p2) => p2 && ts31.isPropertyAssignment(p2) ? p2.initializer : void 0;
|
|
25311
|
+
const callable = (n2) => !!n2 && (ts31.isArrowFunction(n2) || ts31.isFunctionExpression(n2) || ts31.isFunctionDeclaration(n2) || ts31.isMethodDeclaration(n2));
|
|
25312
25312
|
const cached3 = cache.get(bundleJs);
|
|
25313
25313
|
if (cached3) return cached3;
|
|
25314
|
-
const file2 =
|
|
25314
|
+
const file2 = ts31.createSourceFile("himi-bundle.js", bundleJs, ts31.ScriptTarget.Latest, true, ts31.ScriptKind.JS);
|
|
25315
25315
|
const symbols = /* @__PURE__ */ new Map();
|
|
25316
25316
|
const note = (key4, fn2) => {
|
|
25317
25317
|
if (!key4) return;
|
|
@@ -25319,16 +25319,16 @@ function literalTargets(bundleJs, ts30) {
|
|
|
25319
25319
|
symbols.set(key4, { count: (prior?.count ?? 0) + 1, fn: fn2 });
|
|
25320
25320
|
};
|
|
25321
25321
|
const declarations = (node3) => {
|
|
25322
|
-
if (
|
|
25323
|
-
else if (
|
|
25324
|
-
else if (
|
|
25325
|
-
else if (
|
|
25326
|
-
|
|
25322
|
+
if (ts31.isFunctionDeclaration(node3)) note(name(node3.name), node3);
|
|
25323
|
+
else if (ts31.isVariableDeclaration(node3)) note(name(node3.name), callable(node3.initializer) ? node3.initializer : void 0);
|
|
25324
|
+
else if (ts31.isParameter(node3)) note(name(node3.name));
|
|
25325
|
+
else if (ts31.isBindingElement(node3)) note(name(node3.name));
|
|
25326
|
+
ts31.forEachChild(node3, declarations);
|
|
25327
25327
|
};
|
|
25328
25328
|
declarations(file2);
|
|
25329
25329
|
const resolve118 = (node3) => {
|
|
25330
25330
|
if (callable(node3)) return node3;
|
|
25331
|
-
if (node3 &&
|
|
25331
|
+
if (node3 && ts31.isIdentifier(node3)) {
|
|
25332
25332
|
const symbol = symbols.get(node3.text);
|
|
25333
25333
|
if (symbol?.count === 1) return symbol.fn;
|
|
25334
25334
|
}
|
|
@@ -25342,9 +25342,9 @@ function literalTargets(bundleJs, ts30) {
|
|
|
25342
25342
|
const nav = {};
|
|
25343
25343
|
for (const p2 of o2.properties) {
|
|
25344
25344
|
const key4 = name(p2.name);
|
|
25345
|
-
if (!
|
|
25346
|
-
if (
|
|
25347
|
-
else if (key4 === "reset" && p2.initializer.kind ===
|
|
25345
|
+
if (!ts31.isPropertyAssignment(p2) || !key4 || !NAV_KEYS.has(key4)) return void 0;
|
|
25346
|
+
if (ts31.isStringLiteralLike(p2.initializer) && p2.initializer.text) nav[key4] = p2.initializer.text;
|
|
25347
|
+
else if (key4 === "reset" && p2.initializer.kind === ts31.SyntaxKind.TrueKeyword) nav[key4] = true;
|
|
25348
25348
|
else return void 0;
|
|
25349
25349
|
}
|
|
25350
25350
|
const { screenId, presentation, tab, reset } = nav;
|
|
@@ -25355,75 +25355,75 @@ function literalTargets(bundleJs, ts30) {
|
|
|
25355
25355
|
};
|
|
25356
25356
|
const assigned = /* @__PURE__ */ new Set();
|
|
25357
25357
|
const assignedNames = (n2) => {
|
|
25358
|
-
if (
|
|
25359
|
-
else
|
|
25358
|
+
if (ts31.isIdentifier(n2)) assigned.add(n2.text);
|
|
25359
|
+
else ts31.forEachChild(n2, assignedNames);
|
|
25360
25360
|
};
|
|
25361
25361
|
const assignments = (n2) => {
|
|
25362
|
-
if (
|
|
25363
|
-
else if ((
|
|
25364
|
-
else if ((
|
|
25365
|
-
|
|
25362
|
+
if (ts31.isBinaryExpression(n2) && n2.operatorToken.kind >= ts31.SyntaxKind.FirstAssignment && n2.operatorToken.kind <= ts31.SyntaxKind.LastAssignment) assignedNames(n2.left);
|
|
25363
|
+
else if ((ts31.isPrefixUnaryExpression(n2) || ts31.isPostfixUnaryExpression(n2)) && (n2.operator === ts31.SyntaxKind.PlusPlusToken || n2.operator === ts31.SyntaxKind.MinusMinusToken)) assignedNames(n2.operand);
|
|
25364
|
+
else if ((ts31.isForOfStatement(n2) || ts31.isForInStatement(n2)) && !ts31.isVariableDeclarationList(n2.initializer)) assignedNames(n2.initializer);
|
|
25365
|
+
ts31.forEachChild(n2, assignments);
|
|
25366
25366
|
};
|
|
25367
25367
|
assignments(file2);
|
|
25368
25368
|
const plain3 = (fn2) => {
|
|
25369
|
-
const modifiers =
|
|
25370
|
-
return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind ===
|
|
25369
|
+
const modifiers = ts31.canHaveModifiers(fn2) ? ts31.getModifiers(fn2) ?? [] : [];
|
|
25370
|
+
return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind === ts31.SyntaxKind.AsyncKeyword);
|
|
25371
25371
|
};
|
|
25372
25372
|
const plainParams = (fn2) => {
|
|
25373
25373
|
const names2 = /* @__PURE__ */ new Set();
|
|
25374
25374
|
for (const p2 of fn2.parameters) {
|
|
25375
|
-
if (!
|
|
25375
|
+
if (!ts31.isIdentifier(p2.name) || p2.initializer || p2.dotDotDotToken) return void 0;
|
|
25376
25376
|
names2.add(p2.name.text);
|
|
25377
25377
|
}
|
|
25378
25378
|
return names2;
|
|
25379
25379
|
};
|
|
25380
25380
|
const provenSafe = (expr, params) => {
|
|
25381
|
-
while (
|
|
25382
|
-
if (
|
|
25383
|
-
if (expr.kind ===
|
|
25384
|
-
if (
|
|
25385
|
-
if (
|
|
25386
|
-
return expr.elements.every((e2) => !
|
|
25387
|
-
}
|
|
25388
|
-
if (
|
|
25381
|
+
while (ts31.isParenthesizedExpression(expr)) expr = expr.expression;
|
|
25382
|
+
if (ts31.isStringLiteral(expr) || ts31.isNoSubstitutionTemplateLiteral(expr) || ts31.isNumericLiteral(expr)) return true;
|
|
25383
|
+
if (expr.kind === ts31.SyntaxKind.TrueKeyword || expr.kind === ts31.SyntaxKind.FalseKeyword || expr.kind === ts31.SyntaxKind.NullKeyword) return true;
|
|
25384
|
+
if (ts31.isIdentifier(expr)) return params.has(expr.text);
|
|
25385
|
+
if (ts31.isArrayLiteralExpression(expr)) {
|
|
25386
|
+
return expr.elements.every((e2) => !ts31.isSpreadElement(e2) && !ts31.isOmittedExpression(e2) && provenSafe(e2, params));
|
|
25387
|
+
}
|
|
25388
|
+
if (ts31.isObjectLiteralExpression(expr)) return expr.properties.every((p2) => safeProperty(p2, params));
|
|
25389
25389
|
return false;
|
|
25390
25390
|
};
|
|
25391
25391
|
const safeProperty = (p2, params) => {
|
|
25392
|
-
if (
|
|
25393
|
-
if (
|
|
25394
|
-
if (
|
|
25392
|
+
if (ts31.isSpreadAssignment(p2)) return provenSafe(p2.expression, params);
|
|
25393
|
+
if (ts31.isPropertyAssignment(p2)) return !ts31.isComputedPropertyName(p2.name) && provenSafe(p2.initializer, params);
|
|
25394
|
+
if (ts31.isShorthandPropertyAssignment(p2)) return params.has(p2.name.text) && !p2.objectAssignmentInitializer;
|
|
25395
25395
|
return false;
|
|
25396
25396
|
};
|
|
25397
25397
|
const isNavigateHelper = (callee) => {
|
|
25398
|
-
if (!
|
|
25398
|
+
if (!ts31.isIdentifier(callee) || !/^navigate[0-9]*$/.test(callee.text) || assigned.has(callee.text)) return false;
|
|
25399
25399
|
const symbol = symbols.get(callee.text);
|
|
25400
25400
|
const helper = symbol?.count === 1 ? symbol.fn : void 0;
|
|
25401
25401
|
if (!helper?.body || !plain3(helper) || helper.parameters.length !== 2 || !plainParams(helper)) return false;
|
|
25402
25402
|
const [stateParam, navParam] = helper.parameters.map((p2) => name(p2.name));
|
|
25403
|
-
const body =
|
|
25403
|
+
const body = ts31.isBlock(helper.body) ? helper.body.statements.length === 1 && ts31.isReturnStatement(helper.body.statements[0]) ? helper.body.statements[0].expression : void 0 : helper.body;
|
|
25404
25404
|
const o2 = object16(body);
|
|
25405
25405
|
if (!o2 || o2.properties.length !== 2 || !stateParam || !navParam) return false;
|
|
25406
25406
|
const [spread, nav] = o2.properties;
|
|
25407
|
-
return
|
|
25407
|
+
return ts31.isSpreadAssignment(spread) && ts31.isIdentifier(spread.expression) && spread.expression.text === stateParam && ts31.isPropertyAssignment(nav) && name(nav.name) === "_nav" && ts31.isIdentifier(nav.initializer) && nav.initializer.text === navParam;
|
|
25408
25408
|
};
|
|
25409
25409
|
const fixedOf = (fn2) => {
|
|
25410
25410
|
const params = plainParams(fn2);
|
|
25411
25411
|
if (!fn2.body || !plain3(fn2) || !params) return void 0;
|
|
25412
25412
|
let result = void 0;
|
|
25413
|
-
if (
|
|
25413
|
+
if (ts31.isBlock(fn2.body)) {
|
|
25414
25414
|
const [only, ...rest] = fn2.body.statements;
|
|
25415
|
-
if (!only || rest.length > 0 || !
|
|
25415
|
+
if (!only || rest.length > 0 || !ts31.isReturnStatement(only)) return void 0;
|
|
25416
25416
|
result = only.expression;
|
|
25417
25417
|
} else result = fn2.body;
|
|
25418
|
-
while (result &&
|
|
25418
|
+
while (result && ts31.isParenthesizedExpression(result)) result = result.expression;
|
|
25419
25419
|
let navNode;
|
|
25420
|
-
if (result &&
|
|
25420
|
+
if (result && ts31.isObjectLiteralExpression(result)) {
|
|
25421
25421
|
const props2 = result.properties;
|
|
25422
25422
|
const lastProp = props2[props2.length - 1];
|
|
25423
|
-
if (!lastProp || !
|
|
25423
|
+
if (!lastProp || !ts31.isPropertyAssignment(lastProp) || ts31.isComputedPropertyName(lastProp.name) || name(lastProp.name) !== "_nav") return void 0;
|
|
25424
25424
|
if (!props2.slice(0, -1).every((p2) => safeProperty(p2, params))) return void 0;
|
|
25425
25425
|
navNode = lastProp.initializer;
|
|
25426
|
-
} else if (result &&
|
|
25426
|
+
} else if (result && ts31.isCallExpression(result) && result.arguments.length === 2 && isNavigateHelper(result.expression)) {
|
|
25427
25427
|
if (!provenSafe(result.arguments[0], params)) return void 0;
|
|
25428
25428
|
navNode = result.arguments[1];
|
|
25429
25429
|
}
|
|
@@ -25433,58 +25433,58 @@ function literalTargets(bundleJs, ts30) {
|
|
|
25433
25433
|
return { nav, line: position.line + 1, column: position.character };
|
|
25434
25434
|
};
|
|
25435
25435
|
const visit = (node3) => {
|
|
25436
|
-
if (
|
|
25437
|
-
const callee =
|
|
25436
|
+
if (ts31.isCallExpression(node3)) {
|
|
25437
|
+
const callee = ts31.isPropertyAccessExpression(node3.expression) ? node3.expression.name.text : name(node3.expression);
|
|
25438
25438
|
const service = node3.arguments[0];
|
|
25439
|
-
if (callee && /^defineService[0-9]*$/.test(callee) && service &&
|
|
25439
|
+
if (callee && /^defineService[0-9]*$/.test(callee) && service && ts31.isStringLiteralLike(service)) {
|
|
25440
25440
|
const actions = object16(initializer(property3(object16(node3.arguments[1]), "actions")));
|
|
25441
25441
|
for (const member of actions?.properties ?? []) {
|
|
25442
25442
|
const action = name(member.name);
|
|
25443
|
-
const fn2 =
|
|
25443
|
+
const fn2 = ts31.isMethodDeclaration(member) ? member : resolve118(ts31.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
|
|
25444
25444
|
if (!action || !fn2?.body) continue;
|
|
25445
25445
|
const targets = [];
|
|
25446
25446
|
const target = (expr) => {
|
|
25447
25447
|
const sid = initializer(property3(object16(expr), "screenId"));
|
|
25448
|
-
if (!sid || !
|
|
25448
|
+
if (!sid || !ts31.isStringLiteralLike(sid)) return;
|
|
25449
25449
|
const position = file2.getLineAndCharacterOfPosition(sid.getStart(file2));
|
|
25450
25450
|
targets.push({ screenId: sid.text, line: position.line + 1, column: position.character });
|
|
25451
25451
|
};
|
|
25452
25452
|
const returned = (expr) => {
|
|
25453
25453
|
if (!expr) return;
|
|
25454
|
-
if (
|
|
25454
|
+
if (ts31.isParenthesizedExpression(expr) || ts31.isAwaitExpression(expr)) {
|
|
25455
25455
|
returned(expr.expression);
|
|
25456
25456
|
return;
|
|
25457
25457
|
}
|
|
25458
|
-
if (
|
|
25458
|
+
if (ts31.isConditionalExpression(expr)) {
|
|
25459
25459
|
returned(expr.whenTrue);
|
|
25460
25460
|
returned(expr.whenFalse);
|
|
25461
25461
|
return;
|
|
25462
25462
|
}
|
|
25463
|
-
if (
|
|
25463
|
+
if (ts31.isObjectLiteralExpression(expr)) {
|
|
25464
25464
|
target(initializer(property3(expr, "_nav")));
|
|
25465
25465
|
return;
|
|
25466
25466
|
}
|
|
25467
|
-
if (
|
|
25468
|
-
const called =
|
|
25467
|
+
if (ts31.isCallExpression(expr)) {
|
|
25468
|
+
const called = ts31.isPropertyAccessExpression(expr.expression) ? expr.expression.name.text : name(expr.expression);
|
|
25469
25469
|
if (called && /^navigate[0-9]*$/.test(called)) target(expr.arguments[1]);
|
|
25470
25470
|
}
|
|
25471
25471
|
};
|
|
25472
|
-
if (
|
|
25472
|
+
if (ts31.isBlock(fn2.body)) {
|
|
25473
25473
|
const returns = (part4) => {
|
|
25474
25474
|
if (callable(part4)) return;
|
|
25475
|
-
if (
|
|
25476
|
-
else
|
|
25475
|
+
if (ts31.isReturnStatement(part4)) returned(part4.expression);
|
|
25476
|
+
else ts31.forEachChild(part4, returns);
|
|
25477
25477
|
};
|
|
25478
25478
|
returns(fn2.body);
|
|
25479
25479
|
} else returned(fn2.body);
|
|
25480
25480
|
results.set("tier5." + service.text + "." + action, targets);
|
|
25481
|
-
const ref =
|
|
25482
|
-
const always = ref &&
|
|
25481
|
+
const ref = ts31.isShorthandPropertyAssignment(member) ? member.name : initializer(member);
|
|
25482
|
+
const always = ref && ts31.isIdentifier(ref) && assigned.has(ref.text) ? void 0 : fixedOf(fn2);
|
|
25483
25483
|
if (always) fixed.set("tier5." + service.text + "." + action, always);
|
|
25484
25484
|
}
|
|
25485
25485
|
}
|
|
25486
25486
|
}
|
|
25487
|
-
|
|
25487
|
+
ts31.forEachChild(node3, visit);
|
|
25488
25488
|
};
|
|
25489
25489
|
visit(file2);
|
|
25490
25490
|
cache.set(bundleJs, results);
|
|
@@ -29443,7 +29443,6 @@ var init_page_worker = __esm({
|
|
|
29443
29443
|
var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
|
|
29444
29444
|
var init_icon_catalog_generated = __esm({
|
|
29445
29445
|
"../../core/ts/src/icon-catalog.generated.ts"() {
|
|
29446
|
-
"use strict";
|
|
29447
29446
|
init_define_HHP_CATALOG();
|
|
29448
29447
|
ICON_VIEW_BOX = 24;
|
|
29449
29448
|
ICON_STROKE_WIDTH = 2;
|
|
@@ -31196,6 +31195,25 @@ var init_icon_catalog_generated = __esm({
|
|
|
31196
31195
|
"license": "Apache-2.0",
|
|
31197
31196
|
"libVersion": "0.45.9"
|
|
31198
31197
|
},
|
|
31198
|
+
"redo": {
|
|
31199
|
+
"category": "editing",
|
|
31200
|
+
"path": [
|
|
31201
|
+
"M9.8 19C8.217 19 6.854 18.467 5.713 17.4C4.571 16.333 4 15.017 4 13.45C4 11.883 4.571 10.567 5.713 9.5C6.854 8.433 8.217 7.9 9.8 7.9L17.15 7.9L14.3 5.05L15.35 4L20 8.65L15.35 13.3L14.3 12.25L17.15 9.4L9.775 9.4C8.608 9.4 7.604 9.788 6.763 10.563C5.921 11.338 5.5 12.3 5.5 13.45C5.5 14.6 5.921 15.563 6.763 16.338C7.604 17.113 8.608 17.5 9.775 17.5L17.525 17.5L17.525 19L9.8 19Z"
|
|
31202
|
+
],
|
|
31203
|
+
"style": "filled",
|
|
31204
|
+
"mirrorsInRTL": true,
|
|
31205
|
+
"ios": {
|
|
31206
|
+
"sf": "arrow.uturn.forward",
|
|
31207
|
+
"match": "exact"
|
|
31208
|
+
},
|
|
31209
|
+
"android": {
|
|
31210
|
+
"material": "Redo",
|
|
31211
|
+
"match": "exact"
|
|
31212
|
+
},
|
|
31213
|
+
"source": "material-symbols/redo",
|
|
31214
|
+
"license": "Apache-2.0",
|
|
31215
|
+
"libVersion": "0.45.9"
|
|
31216
|
+
},
|
|
31199
31217
|
"refresh": {
|
|
31200
31218
|
"category": "status",
|
|
31201
31219
|
"path": [
|
|
@@ -31764,6 +31782,7 @@ var init_icon_catalog_generated = __esm({
|
|
|
31764
31782
|
"prev": "prev",
|
|
31765
31783
|
"skipback": "prev",
|
|
31766
31784
|
"question": "question",
|
|
31785
|
+
"redo": "redo",
|
|
31767
31786
|
"refresh": "refresh",
|
|
31768
31787
|
"repeat": "repeat",
|
|
31769
31788
|
"rss": "rss",
|
|
@@ -31900,6 +31919,7 @@ var init_icon_catalog_generated = __esm({
|
|
|
31900
31919
|
"plus_circle_fill",
|
|
31901
31920
|
"prev",
|
|
31902
31921
|
"question",
|
|
31922
|
+
"redo",
|
|
31903
31923
|
"refresh",
|
|
31904
31924
|
"repeat",
|
|
31905
31925
|
"rss",
|
|
@@ -40753,7 +40773,6 @@ function shouldRevealError(args) {
|
|
|
40753
40773
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
40754
40774
|
var init_validation = __esm({
|
|
40755
40775
|
"../../core/ts/src/validation.ts"() {
|
|
40756
|
-
"use strict";
|
|
40757
40776
|
init_define_HHP_CATALOG();
|
|
40758
40777
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
40759
40778
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -55913,7 +55932,7 @@ var init_pdf = __esm({
|
|
|
55913
55932
|
var defineProperty = Object.defineProperty;
|
|
55914
55933
|
var stringSlice = uncurryThis("".slice);
|
|
55915
55934
|
var replace = uncurryThis("".replace);
|
|
55916
|
-
var
|
|
55935
|
+
var join194 = uncurryThis([].join);
|
|
55917
55936
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
55918
55937
|
return defineProperty(function() {
|
|
55919
55938
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -55940,7 +55959,7 @@ var init_pdf = __esm({
|
|
|
55940
55959
|
}
|
|
55941
55960
|
var state = enforceInternalState(value2);
|
|
55942
55961
|
if (!hasOwn(state, "source")) {
|
|
55943
|
-
state.source =
|
|
55962
|
+
state.source = join194(TEMPLATE, typeof name == "string" ? name : "");
|
|
55944
55963
|
}
|
|
55945
55964
|
return value2;
|
|
55946
55965
|
};
|
|
@@ -58463,7 +58482,7 @@ var init_pdf = __esm({
|
|
|
58463
58482
|
var charAt = uncurryThis("".charAt);
|
|
58464
58483
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
58465
58484
|
var $Array = globalThis2.Array;
|
|
58466
|
-
var
|
|
58485
|
+
var join194 = uncurryThis([].join);
|
|
58467
58486
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
58468
58487
|
try {
|
|
58469
58488
|
var target = new Uint8Array2();
|
|
@@ -58509,7 +58528,7 @@ var init_pdf = __esm({
|
|
|
58509
58528
|
result[written++] = "=";
|
|
58510
58529
|
}
|
|
58511
58530
|
}
|
|
58512
|
-
return
|
|
58531
|
+
return join194(result, "");
|
|
58513
58532
|
}
|
|
58514
58533
|
});
|
|
58515
58534
|
},
|
|
@@ -58521,7 +58540,7 @@ var init_pdf = __esm({
|
|
|
58521
58540
|
var anUint8Array = __webpack_require__3(4154);
|
|
58522
58541
|
var notDetached = __webpack_require__3(5169);
|
|
58523
58542
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
58524
|
-
var
|
|
58543
|
+
var join194 = uncurryThis([].join);
|
|
58525
58544
|
var $Array = Array;
|
|
58526
58545
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
58527
58546
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -58541,7 +58560,7 @@ var init_pdf = __esm({
|
|
|
58541
58560
|
var hex2 = numberToString2(this[i2], 16);
|
|
58542
58561
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
58543
58562
|
}
|
|
58544
|
-
return
|
|
58563
|
+
return join194(result, "");
|
|
58545
58564
|
}
|
|
58546
58565
|
});
|
|
58547
58566
|
},
|
|
@@ -156861,9 +156880,9 @@ function stateOf(view) {
|
|
|
156861
156880
|
build: b3 && view.live ? { ok: b3.ok, ms: b3.ms, screens: b3.screens, at: b3.at, run: view.live.runId } : null
|
|
156862
156881
|
};
|
|
156863
156882
|
}
|
|
156864
|
-
function frameFor(state, prev,
|
|
156865
|
-
if (key4 || !prev) return { ts:
|
|
156866
|
-
const f2 = { ts:
|
|
156883
|
+
function frameFor(state, prev, ts31, v2, key4) {
|
|
156884
|
+
if (key4 || !prev) return { ts: ts31, v: v2, key: true, ...state };
|
|
156885
|
+
const f2 = { ts: ts31, v: v2 };
|
|
156867
156886
|
if (!same2(state.step, prev.step)) f2.step = state.step;
|
|
156868
156887
|
if (!same2(state.now, prev.now)) f2.now = state.now;
|
|
156869
156888
|
const screens = {};
|
|
@@ -157743,8 +157762,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
157743
157762
|
}
|
|
157744
157763
|
async function appId(dir) {
|
|
157745
157764
|
try {
|
|
157746
|
-
const { readFileSync:
|
|
157747
|
-
const m2 = JSON.parse(
|
|
157765
|
+
const { readFileSync: readFileSync182 } = await import("node:fs");
|
|
157766
|
+
const m2 = JSON.parse(readFileSync182(join41(dir, "himalaya.content.json"), "utf8"));
|
|
157748
157767
|
if (m2.name) return m2.name;
|
|
157749
157768
|
} catch {
|
|
157750
157769
|
}
|
|
@@ -169539,7 +169558,7 @@ function specScreens(spec) {
|
|
|
169539
169558
|
const first = line.replace(/^\|/, "").split("|")[0].trim();
|
|
169540
169559
|
const tick = /^`([^`]+)`/.exec(first);
|
|
169541
169560
|
const id = tick ? tick[1].trim() : first;
|
|
169542
|
-
if (/^screen$/i.test(id)) continue;
|
|
169561
|
+
if (!tick && /^screen$/i.test(id)) continue;
|
|
169543
169562
|
if (/^[a-z][a-z0-9_]*(?:\[[^\]]*\])?$/.test(id)) out2.push(id.replace(/\[.*$/, ""));
|
|
169544
169563
|
}
|
|
169545
169564
|
return [...new Set(out2)];
|
|
@@ -171452,15 +171471,15 @@ function loadMemory2(dir) {
|
|
|
171452
171471
|
for (const t2 of m2.timeline) {
|
|
171453
171472
|
if (!isObj3(t2)) continue;
|
|
171454
171473
|
const file2 = historyName(t2.sha, t2.ext);
|
|
171455
|
-
const
|
|
171474
|
+
const ts31 = str5(t2.ts);
|
|
171456
171475
|
const id = str5(t2.id);
|
|
171457
|
-
if (file2 &&
|
|
171476
|
+
if (file2 && ts31 && id) timeline.push({ ts: ts31, id, file: file2 });
|
|
171458
171477
|
}
|
|
171459
171478
|
return { createdAt: str5(m2.createdAt), shots, timeline };
|
|
171460
171479
|
}
|
|
171461
|
-
function captionAt(entries,
|
|
171480
|
+
function captionAt(entries, ts31) {
|
|
171462
171481
|
let best = null;
|
|
171463
|
-
for (const e2 of entries) if (e2.ts <=
|
|
171482
|
+
for (const e2 of entries) if (e2.ts <= ts31) best = e2;
|
|
171464
171483
|
return best ? best.message : null;
|
|
171465
171484
|
}
|
|
171466
171485
|
function thin(items, max) {
|
|
@@ -171580,13 +171599,13 @@ function duration(ms2) {
|
|
|
171580
171599
|
const m2 = Math.round(ms2 / 6e4);
|
|
171581
171600
|
return m2 < 60 ? `${m2} min` : `${Math.floor(m2 / 60)} h ${m2 % 60} min`;
|
|
171582
171601
|
}
|
|
171583
|
-
function utcDay(
|
|
171584
|
-
const d2 = new Date(
|
|
171602
|
+
function utcDay(ts31) {
|
|
171603
|
+
const d2 = new Date(ts31);
|
|
171585
171604
|
return Number.isNaN(d2.getTime()) ? "" : `${d2.toUTCString().slice(0, 16)} (UTC)`;
|
|
171586
171605
|
}
|
|
171587
|
-
function sinceStart(start,
|
|
171606
|
+
function sinceStart(start, ts31) {
|
|
171588
171607
|
if (!start) return "";
|
|
171589
|
-
const s5 = Math.max(0, Math.round((Date.parse(
|
|
171608
|
+
const s5 = Math.max(0, Math.round((Date.parse(ts31) - Date.parse(start)) / 1e3));
|
|
171590
171609
|
const h2 = Math.floor(s5 / 3600);
|
|
171591
171610
|
const m2 = Math.floor(s5 % 3600 / 60);
|
|
171592
171611
|
const sec = String(s5 % 60).padStart(2, "0");
|
|
@@ -171596,7 +171615,7 @@ function renderReel(plan, images) {
|
|
|
171596
171615
|
const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
|
|
171597
171616
|
const count2 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
|
|
171598
171617
|
const accent = ACCENT.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
|
|
171599
|
-
const clock = (
|
|
171618
|
+
const clock = (ts31) => sinceStart(plan.startedAt, ts31);
|
|
171600
171619
|
const frames = plan.frames.filter((f2) => images.has(f2.file));
|
|
171601
171620
|
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>
|
|
171602
171621
|
<div class="flipcap"><div class="t" id="ft">${frames[0] ? clock(frames[0].ts) : ""}</div><div id="fc">${escapeHtml(frames[0]?.caption ?? "")}</div><div class="bar"><div id="fb"></div></div></div></section>` : `<p class="muted">No screen versions were recorded \u2014 open the build board with <code>himi studio</code> before building to capture them.</p>`;
|
|
@@ -175458,6 +175477,7 @@ var init_glyphs = __esm({
|
|
|
175458
175477
|
// ../app-icons/plan.ts
|
|
175459
175478
|
import { existsSync as existsSync69, readFileSync as readFileSync77, readdirSync as readdirSync36 } from "node:fs";
|
|
175460
175479
|
import { createHash as createHash33 } from "node:crypto";
|
|
175480
|
+
import { inflateSync } from "node:zlib";
|
|
175461
175481
|
import { dirname as dirname37, join as join65, resolve as resolve50 } from "node:path";
|
|
175462
175482
|
function stripComments(src) {
|
|
175463
175483
|
let out2 = "";
|
|
@@ -175631,6 +175651,13 @@ function assertIconContract(app2, cfg) {
|
|
|
175631
175651
|
throw new Error(`app-icons: ${app2} icon.glyph must be a lowercase snake_case name. Got "${cfg.glyph}".`);
|
|
175632
175652
|
}
|
|
175633
175653
|
}
|
|
175654
|
+
function assertGlyphScale(app2, glyphScale) {
|
|
175655
|
+
if (glyphScale < GLYPH_SCALE_MIN || glyphScale > GLYPH_SCALE_MAX) {
|
|
175656
|
+
throw new Error(
|
|
175657
|
+
`app-icons: ${app2} icon.glyphScale must be between ${GLYPH_SCALE_MIN} and ${GLYPH_SCALE_MAX} (Android masks the foreground layer to a circle, so a larger glyph is clipped). Got ${glyphScale}.`
|
|
175658
|
+
);
|
|
175659
|
+
}
|
|
175660
|
+
}
|
|
175634
175661
|
function iconSpec(app2, configTs, id, tokensPathOverride) {
|
|
175635
175662
|
const cfg = parseIconConfig(configTs);
|
|
175636
175663
|
assertIconContract(app2, cfg);
|
|
@@ -175640,12 +175667,15 @@ function iconSpec(app2, configTs, id, tokensPathOverride) {
|
|
|
175640
175667
|
if (!existsSync69(abs)) {
|
|
175641
175668
|
throw new Error(`app-icons: ${app2} declares icon.source "${cfg.source}" but ${abs} does not exist.`);
|
|
175642
175669
|
}
|
|
175670
|
+
const glyphScale2 = cfg.glyphScale ?? SOURCE_GLYPH_SCALE;
|
|
175671
|
+
assertGlyphScale(app2, glyphScale2);
|
|
175672
|
+
const background2 = cfg.backgroundColor ? resolveToken(app2, cfg.backgroundColor, tokens2) : pngCornerColor(readFileSync77(abs)) ?? SOURCE_FALLBACK_BACKGROUND;
|
|
175643
175673
|
return {
|
|
175644
175674
|
sourcePath: abs,
|
|
175645
175675
|
glyph: GLYPH_NAMES[0],
|
|
175646
175676
|
accent: "#000000",
|
|
175647
|
-
background:
|
|
175648
|
-
glyphScale:
|
|
175677
|
+
background: background2,
|
|
175678
|
+
glyphScale: glyphScale2,
|
|
175649
175679
|
derived: false
|
|
175650
175680
|
};
|
|
175651
175681
|
}
|
|
@@ -175660,11 +175690,7 @@ function iconSpec(app2, configTs, id, tokensPathOverride) {
|
|
|
175660
175690
|
const accent = cfg.accentColor ? accentBase : rotateHue(accentBase, deriveHueDelta(id));
|
|
175661
175691
|
const background = cfg.backgroundColor ? resolveToken(app2, cfg.backgroundColor, tokens2) : accent;
|
|
175662
175692
|
const glyphScale = cfg.glyphScale ?? DEFAULT_GLYPH_SCALE;
|
|
175663
|
-
|
|
175664
|
-
throw new Error(
|
|
175665
|
-
`app-icons: ${app2} icon.glyphScale must be between ${GLYPH_SCALE_MIN} and ${GLYPH_SCALE_MAX} (Android masks the foreground layer to a circle, so a larger glyph is clipped). Got ${glyphScale}.`
|
|
175666
|
-
);
|
|
175667
|
-
}
|
|
175693
|
+
assertGlyphScale(app2, glyphScale);
|
|
175668
175694
|
return {
|
|
175669
175695
|
glyph,
|
|
175670
175696
|
accent,
|
|
@@ -175727,6 +175753,56 @@ function fileSha256(path2) {
|
|
|
175727
175753
|
return null;
|
|
175728
175754
|
}
|
|
175729
175755
|
}
|
|
175756
|
+
function pngSize(png) {
|
|
175757
|
+
const PNG_MAGIC2 = Buffer.from([137, 80, 78, 71]);
|
|
175758
|
+
if (png.length < 24 || !png.subarray(0, 4).equals(PNG_MAGIC2)) {
|
|
175759
|
+
throw new Error("app-icons: not a PNG (bad magic or truncated)");
|
|
175760
|
+
}
|
|
175761
|
+
return { width: png.readUInt32BE(16), height: png.readUInt32BE(20) };
|
|
175762
|
+
}
|
|
175763
|
+
function pngCornerColor(png) {
|
|
175764
|
+
pngSize(png);
|
|
175765
|
+
const bitDepth = png[24];
|
|
175766
|
+
const colorType = png[25];
|
|
175767
|
+
const interlace = png[28];
|
|
175768
|
+
if (interlace !== 0) return null;
|
|
175769
|
+
const channels3 = { 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 }[colorType];
|
|
175770
|
+
if (channels3 === void 0) return null;
|
|
175771
|
+
if (colorType === 3 ? ![1, 2, 4, 8].includes(bitDepth) : bitDepth !== 8) return null;
|
|
175772
|
+
const idat = [];
|
|
175773
|
+
let plte = null;
|
|
175774
|
+
let trns = null;
|
|
175775
|
+
for (let off = 8; off + 8 <= png.length; ) {
|
|
175776
|
+
const len = png.readUInt32BE(off);
|
|
175777
|
+
const type2 = png.toString("latin1", off + 4, off + 8);
|
|
175778
|
+
const data = png.subarray(off + 8, off + 8 + len);
|
|
175779
|
+
if (type2 === "IDAT") idat.push(data);
|
|
175780
|
+
if (type2 === "PLTE") plte = data;
|
|
175781
|
+
if (type2 === "tRNS") trns = data;
|
|
175782
|
+
if (type2 === "IEND") break;
|
|
175783
|
+
off += 12 + len;
|
|
175784
|
+
}
|
|
175785
|
+
let raw;
|
|
175786
|
+
try {
|
|
175787
|
+
raw = inflateSync(Buffer.concat(idat));
|
|
175788
|
+
} catch {
|
|
175789
|
+
return null;
|
|
175790
|
+
}
|
|
175791
|
+
if (raw.length < 1 + channels3) return null;
|
|
175792
|
+
const px = raw.subarray(1, 1 + channels3);
|
|
175793
|
+
let r3, g2, b3, alpha2;
|
|
175794
|
+
if (colorType === 3) {
|
|
175795
|
+
const index = px[0] >> 8 - bitDepth;
|
|
175796
|
+
if (!plte || plte.length < 3 * (index + 1)) return null;
|
|
175797
|
+
[r3, g2, b3] = [plte[3 * index], plte[3 * index + 1], plte[3 * index + 2]];
|
|
175798
|
+
alpha2 = trns && index < trns.length ? trns[index] : 255;
|
|
175799
|
+
} else {
|
|
175800
|
+
[r3, g2, b3] = channels3 >= 3 ? [px[0], px[1], px[2]] : [px[0], px[0], px[0]];
|
|
175801
|
+
alpha2 = channels3 === 4 ? px[3] : channels3 === 2 ? px[1] : 255;
|
|
175802
|
+
}
|
|
175803
|
+
if (alpha2 !== 255) return null;
|
|
175804
|
+
return `#${[r3, g2, b3].map((v2) => v2.toString(16).padStart(2, "0").toUpperCase()).join("")}`;
|
|
175805
|
+
}
|
|
175730
175806
|
function generationAllowed(app2, configTs, opts = {}) {
|
|
175731
175807
|
if (opts.force) return { allowed: true, reason: "--force" };
|
|
175732
175808
|
if (/^ {2}icon\s*[:=]\s*\{/m.test(stripComments(configTs))) {
|
|
@@ -175744,7 +175820,7 @@ function generationAllowed(app2, configTs, opts = {}) {
|
|
|
175744
175820
|
reason: "ships hand-authored art and declares no icon block (pass --force to re-skin, or add `icon: {}` to config.ts)"
|
|
175745
175821
|
};
|
|
175746
175822
|
}
|
|
175747
|
-
var DEFAULT_ACCENT_TOKEN, DEFAULT_GLYPH_SCALE, GLYPH_SCALE_MIN, GLYPH_SCALE_MAX, LEGACY_PLACEHOLDER_SHA256;
|
|
175823
|
+
var DEFAULT_ACCENT_TOKEN, DEFAULT_GLYPH_SCALE, GLYPH_SCALE_MIN, GLYPH_SCALE_MAX, SOURCE_GLYPH_SCALE, SOURCE_FALLBACK_BACKGROUND, LEGACY_PLACEHOLDER_SHA256;
|
|
175748
175824
|
var init_plan2 = __esm({
|
|
175749
175825
|
"../app-icons/plan.ts"() {
|
|
175750
175826
|
init_define_HHP_CATALOG();
|
|
@@ -175754,6 +175830,8 @@ var init_plan2 = __esm({
|
|
|
175754
175830
|
DEFAULT_GLYPH_SCALE = 0.62;
|
|
175755
175831
|
GLYPH_SCALE_MIN = 0.4;
|
|
175756
175832
|
GLYPH_SCALE_MAX = 0.9;
|
|
175833
|
+
SOURCE_GLYPH_SCALE = 72 / 108;
|
|
175834
|
+
SOURCE_FALLBACK_BACKGROUND = "#FFFFFF";
|
|
175757
175835
|
LEGACY_PLACEHOLDER_SHA256 = "d35cccc14f8df24064b7fb575b2ea35c0695813cbebe28ac9bf9856d12dacbf2";
|
|
175758
175836
|
}
|
|
175759
175837
|
});
|
|
@@ -195224,7 +195302,7 @@ function decodePng(bytes2, what = "image") {
|
|
|
195224
195302
|
const stride = Math.ceil(width * bitsPerPixel / 8);
|
|
195225
195303
|
let inflated;
|
|
195226
195304
|
try {
|
|
195227
|
-
inflated =
|
|
195305
|
+
inflated = inflateSync2(idat, { maxOutputLength: expected });
|
|
195228
195306
|
} catch (e2) {
|
|
195229
195307
|
if (e2.code === "ERR_BUFFER_TOO_LARGE")
|
|
195230
195308
|
throw bad2(what, `the PNG's image data inflates past the ${expected} bytes a ${width}\xD7${height} image holds`);
|
|
@@ -195329,12 +195407,12 @@ function encodePng(image, options2) {
|
|
|
195329
195407
|
ihdr[9] = options2.alpha ? 6 : 2;
|
|
195330
195408
|
return Buffer.concat([SIGNATURE, chunk("IHDR", ihdr), chunk("IDAT", deflateSync(filtered, { level: 9 })), chunk("IEND", Buffer.alloc(0))]);
|
|
195331
195409
|
}
|
|
195332
|
-
var crc322, deflateSync,
|
|
195410
|
+
var crc322, deflateSync, inflateSync2, SIGNATURE, CHANNELS, DEPTHS, PNG_MAX_SIDE, PNG_MAX_PIXELS, bad2, scanlineBytes, maxCompressed;
|
|
195333
195411
|
var init_png = __esm({
|
|
195334
195412
|
"../../node_modules/@wix/gplay-api/dist/png.js"() {
|
|
195335
195413
|
init_define_HHP_CATALOG();
|
|
195336
195414
|
init_errors3();
|
|
195337
|
-
({ crc32: crc322, deflateSync, inflateSync } = __ascBuiltin015);
|
|
195415
|
+
({ crc32: crc322, deflateSync, inflateSync: inflateSync2 } = __ascBuiltin015);
|
|
195338
195416
|
SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
195339
195417
|
CHANNELS = { 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 };
|
|
195340
195418
|
DEPTHS = { 0: [1, 2, 4, 8, 16], 2: [8, 16], 3: [1, 2, 4, 8], 4: [8, 16], 6: [8, 16] };
|
|
@@ -219377,9 +219455,9 @@ var init_commands = __esm({
|
|
|
219377
219455
|
summary: "Jobs in the state directory",
|
|
219378
219456
|
async run(inv) {
|
|
219379
219457
|
const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
|
|
219380
|
-
const { join:
|
|
219458
|
+
const { join: join194 } = await import("node:path");
|
|
219381
219459
|
const runner2 = await inv.ctx.runner();
|
|
219382
|
-
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(
|
|
219460
|
+
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join194(inv.ctx.stateDir, "jobs")).list();
|
|
219383
219461
|
inv.print(jobs.map((j2) => ({ id: j2.id, action: j2.action, status: j2.status, actor: j2.actor, issuerId: accountKey(j2.account), created: j2.history[0]?.at })), ["id", "action", "status", "actor", "issuerId", "created"]);
|
|
219384
219462
|
}
|
|
219385
219463
|
},
|
|
@@ -229772,11 +229850,11 @@ __export(input_evidence_isolation_exports, {
|
|
|
229772
229850
|
});
|
|
229773
229851
|
async function installInputEvidenceIsolation(dir) {
|
|
229774
229852
|
const { lstatSync: lstatSync39, readdirSync: readdirSync60 } = await import("node:fs");
|
|
229775
|
-
const { join:
|
|
229853
|
+
const { join: join194 } = await import("node:path");
|
|
229776
229854
|
const check = (path2) => {
|
|
229777
229855
|
const stat9 = lstatSync39(path2);
|
|
229778
229856
|
if (stat9.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
|
|
229779
|
-
if (stat9.isDirectory()) for (const name of readdirSync60(path2)) check(
|
|
229857
|
+
if (stat9.isDirectory()) for (const name of readdirSync60(path2)) check(join194(path2, name));
|
|
229780
229858
|
};
|
|
229781
229859
|
check(dir);
|
|
229782
229860
|
const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
|
|
@@ -239482,52 +239560,52 @@ var init_preview_assets_generated = __esm({
|
|
|
239482
239560
|
init_define_HHP_CATALOG();
|
|
239483
239561
|
init_preview_assets_format();
|
|
239484
239562
|
PREVIEW_ASSET_MANIFEST = [
|
|
239485
|
-
{ key: "assets/DashboardHost-
|
|
239486
|
-
{ key: "assets/DevDrawer-
|
|
239487
|
-
{ key: "assets/IdiomCompare-
|
|
239488
|
-
{ key: "assets/LightboxViewer-
|
|
239489
|
-
{ key: "assets/OfflineReadingBar-
|
|
239490
|
-
{ key: "assets/PhonePreviewControl-
|
|
239491
|
-
{ key: "assets/SchemeCompare-
|
|
239492
|
-
{ key: "assets/WixFrogTelemetrySink-
|
|
239563
|
+
{ key: "assets/DashboardHost-93gHHXsU.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2985, sha256: "993f5fdc24e1d7feba8654a05d5e60a11d499cd558674310dc363237d7902dec" },
|
|
239564
|
+
{ key: "assets/DevDrawer-BS27qKQ3.js", contentType: "application/javascript; charset=utf-8", offset: 2993, length: 16783, sha256: "7a407775f5cfe0991cd4d7eea2849e29c894b5a6914c4e035a70a929ed68e08f" },
|
|
239565
|
+
{ key: "assets/IdiomCompare-D0_35loe.js", contentType: "application/javascript; charset=utf-8", offset: 19776, length: 1926, sha256: "269cc877cb4cfdf35a9a894e0be2178b95a29f4fdd8a6a07955cce1a200cfc6f" },
|
|
239566
|
+
{ key: "assets/LightboxViewer-RJT2pdPm.js", contentType: "application/javascript; charset=utf-8", offset: 21702, length: 17382, sha256: "f9969cd949306605cdc0e92707243005738afd77cd2a092dc549cc3993c15b80" },
|
|
239567
|
+
{ key: "assets/OfflineReadingBar-CCA63wG9.js", contentType: "application/javascript; charset=utf-8", offset: 39084, length: 1646, sha256: "70532e74b922206c86dbdc38464fca9055e68c219d837bdbace44a28fd79c827" },
|
|
239568
|
+
{ key: "assets/PhonePreviewControl-Dk5P3reV.js", contentType: "application/javascript; charset=utf-8", offset: 40730, length: 37851, sha256: "f2268119d5141ac360869d1d34bce6dc7beb277d345b608e7b4c0d4a81a6b483" },
|
|
239569
|
+
{ key: "assets/SchemeCompare-B6evZHTV.js", contentType: "application/javascript; charset=utf-8", offset: 78581, length: 1858, sha256: "a5061632ea68a261121f399e11f61a244211e0b3d0081c97af8869659c3405af" },
|
|
239570
|
+
{ key: "assets/WixFrogTelemetrySink-CpxHN8Ce.js", contentType: "application/javascript; charset=utf-8", offset: 80439, length: 3515, sha256: "2a268521ffaa483c6d4f9580ff87b11df1b8a5ff27da8a2089c7c31e9c4c7ac8" },
|
|
239493
239571
|
{ key: "assets/calendar-ics-BvfIYWjG.js", contentType: "application/javascript; charset=utf-8", offset: 83954, length: 2192, sha256: "1636167041e9829ceccd3544297b86b8475c38bd2f759c4dbc17c813dc6e9254" },
|
|
239494
239572
|
{ key: "assets/catalog-CAoUWITw.js", contentType: "application/javascript; charset=utf-8", offset: 86146, length: 26046, sha256: "4c270ca3051f77d761aef1297125e02339d48493dd2b84a0cacf0faf41aa8cb3" },
|
|
239495
|
-
{ key: "assets/catalogFontFaces-
|
|
239573
|
+
{ key: "assets/catalogFontFaces-CP98EVlH.js", contentType: "application/javascript; charset=utf-8", offset: 112192, length: 1111, sha256: "3e23072c30252203133888824c6e53ffeebbebed126527f2c5459ccffd4b7118" },
|
|
239496
239574
|
{ key: "assets/contacts-vcard-BcohPQ0m.js", contentType: "application/javascript; charset=utf-8", offset: 113303, length: 2567, sha256: "c4ff75e96cd909bbb9182c5dc78794fcebc65139fbddef2537711d774fb33ad0" },
|
|
239497
|
-
{ key: "assets/files-transfer-
|
|
239575
|
+
{ key: "assets/files-transfer-BjZblmVl.js", contentType: "application/javascript; charset=utf-8", offset: 115870, length: 6446, sha256: "f1011667ba289a4c0ea4b5732a760cb1134c3142b97229bafb560ba9e8ebb118" },
|
|
239498
239576
|
{ key: "assets/frogActionMap-CTMe3Bz1.js", contentType: "application/javascript; charset=utf-8", offset: 122316, length: 1172, sha256: "9f1ce4c70a680dfb902949e1f482c7e47500b69c3350cd091b1b51d674032d53" },
|
|
239499
|
-
{ key: "assets/frogApiRules-
|
|
239577
|
+
{ key: "assets/frogApiRules-CaOcVAVM.js", contentType: "application/javascript; charset=utf-8", offset: 123488, length: 2207, sha256: "4eaad71f30bd733953335324beac24c043c11c39692f33c790f58b624abf5509" },
|
|
239500
239578
|
{ key: "assets/frogScreenMap-S_IRnz20.js", contentType: "application/javascript; charset=utf-8", offset: 125695, length: 1067, sha256: "22b2f71e1b06df8f1e79b890d47fe42e983d37865c2cc9be753e4121764c91e1" },
|
|
239501
239579
|
{ key: "assets/glassPreviewBrowser-DONaOehd.js", contentType: "application/javascript; charset=utf-8", offset: 126762, length: 6578, sha256: "4402c4cddd2a564e7466cdf1e12a0e0277c0400b288e1e5eda1d23e797599d31" },
|
|
239502
239580
|
{ key: "assets/image-preparation-Cj4gldm6.js", contentType: "application/javascript; charset=utf-8", offset: 133340, length: 2704, sha256: "32944ea587c2f3b84389b66b50a850437560238f1c8d33b6275973ee04eee865" },
|
|
239503
|
-
{ key: "assets/index-
|
|
239504
|
-
{ key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
239505
|
-
{ key: "assets/on-device-ml-D5QGvW8P.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
239506
|
-
{ key: "assets/pdf-
|
|
239507
|
-
{ key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
239508
|
-
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset:
|
|
239509
|
-
{ key: "assets/pdfDocument-
|
|
239510
|
-
{ key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
239511
|
-
{ key: "assets/scrollLinkedRuntime-
|
|
239512
|
-
{ key: "assets/webviewBridgeHost-
|
|
239513
|
-
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset:
|
|
239514
|
-
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset:
|
|
239515
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
239516
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
239517
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
239518
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
239519
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
239520
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
239521
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
239522
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
239523
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
239524
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
239525
|
-
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
239526
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
239527
|
-
{ key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset:
|
|
239528
|
-
{ key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset:
|
|
239529
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
239530
|
-
{ key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
239581
|
+
{ key: "assets/index-BNQqmuBT.js", contentType: "application/javascript; charset=utf-8", offset: 136044, length: 1584325, sha256: "76b37da22f36e7e744ba6ff8d5ac2acbdc1a180b652988438f661fb5d58b1307" },
|
|
239582
|
+
{ key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset: 1720369, length: 7751, sha256: "42a78b508d0f309f6a4a6efbb8669015211b3c26574c5b0929884c4d9d20b806" },
|
|
239583
|
+
{ key: "assets/on-device-ml-D5QGvW8P.js", contentType: "application/javascript; charset=utf-8", offset: 1728120, length: 10531, sha256: "914ea54d973624e7bc82d1847444f26084ac16d69be3051b4b5938b1e35beced" },
|
|
239584
|
+
{ key: "assets/pdf-OgxX4nB8.js", contentType: "application/javascript; charset=utf-8", offset: 1738651, length: 488215, sha256: "d432d189310d8d819b56251c53dd82a9e166a4a73936749f08c355c11083e8e0" },
|
|
239585
|
+
{ key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset: 2226866, length: 90, sha256: "521a0e528916d678d7588b2cddf3dadd3bb959a6d62426382f61c77a82017e35" },
|
|
239586
|
+
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 2226956, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
|
|
239587
|
+
{ key: "assets/pdfDocument-BRzqkxT0.js", contentType: "application/javascript; charset=utf-8", offset: 3543990, length: 3470, sha256: "d7e472130adc927b44be20312e13f309ee3b8ac29131ac6b5524f86bccf1b52d" },
|
|
239588
|
+
{ key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3547460, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
|
|
239589
|
+
{ key: "assets/scrollLinkedRuntime-BqP_Bl-D.js", contentType: "application/javascript; charset=utf-8", offset: 3549726, length: 2278, sha256: "548b99d34a9de7a80cd90a8c469580657eb5607a43f4cf0e8df03a538ecb8038" },
|
|
239590
|
+
{ key: "assets/webviewBridgeHost-yubDxjRC.js", contentType: "application/javascript; charset=utf-8", offset: 3552004, length: 9889, sha256: "abba540cf94b984cd7b21002b5062f4d9055cc233a2cf4ee284f65f5af987ba3" },
|
|
239591
|
+
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3561893, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
|
|
239592
|
+
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3566503, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
|
|
239593
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 4055087, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
239594
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 4146011, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
239595
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 4236995, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
239596
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4327975, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
239597
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4418847, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
239598
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4509827, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
239599
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4618463, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
239600
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4727547, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
239601
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4836595, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
239602
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4944295, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
239603
|
+
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 5032403, length: 6818, sha256: "835250c3d8004f27c2b67f9b471984351ba6df07b916d97e33b43c691200a18c" },
|
|
239604
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 5039221, length: 4924, sha256: "743591f95207555703eecba1c045fb37d97d9f5e2b449f7d9f68ed44421ede36" },
|
|
239605
|
+
{ key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 5044145, length: 11457, sha256: "6cb2b75264fa5fa2b4d28851878a5eab0712900e8b3a6c2370cc661d6d820805" },
|
|
239606
|
+
{ key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 5055602, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
|
|
239607
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 5056773, length: 24239, sha256: "42bd04b28606706389a6b3ab79b74f37259ab43bf66580d2d9c69be5980a53fe" },
|
|
239608
|
+
{ key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset: 5081012, length: 24256, sha256: "c14ee20bf56b80e2622177d34824b18f368c66faaffd7ea3aa9b07b60582411c" }
|
|
239531
239609
|
];
|
|
239532
239610
|
}
|
|
239533
239611
|
});
|
|
@@ -243325,7 +243403,7 @@ var init_screenshot_display_types = __esm({
|
|
|
243325
243403
|
// ../store-release/iap-review-screenshot.ts
|
|
243326
243404
|
import { createHash as createHash74 } from "node:crypto";
|
|
243327
243405
|
import { basename as basename35, resolve as resolve96 } from "node:path";
|
|
243328
|
-
function
|
|
243406
|
+
function pngSize2(bytes2) {
|
|
243329
243407
|
const signed = PNG_SIGNATURE.every((b3, i2) => bytes2[i2] === b3);
|
|
243330
243408
|
if (!signed || bytes2.length < 24 || bytes2.toString("ascii", 12, 16) !== "IHDR") return void 0;
|
|
243331
243409
|
return { format: "png", width: bytes2.readUInt32BE(16), height: bytes2.readUInt32BE(20) };
|
|
@@ -243339,7 +243417,7 @@ function jpegSize(bytes2) {
|
|
|
243339
243417
|
}
|
|
243340
243418
|
function readImageSize(bytes2) {
|
|
243341
243419
|
const buffer = Buffer.from(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
|
|
243342
|
-
return
|
|
243420
|
+
return pngSize2(buffer) ?? jpegSize(buffer);
|
|
243343
243421
|
}
|
|
243344
243422
|
function md5Hex(bytes2) {
|
|
243345
243423
|
return createHash74("md5").update(bytes2).digest("hex");
|
|
@@ -247075,7 +247153,7 @@ __export(preflight_app_exports, {
|
|
|
247075
247153
|
isValidAppStoreSize: () => isValidAppStoreSize,
|
|
247076
247154
|
jpegSize: () => jpegSize2,
|
|
247077
247155
|
playListingAssets: () => playListingAssets,
|
|
247078
|
-
pngSize: () =>
|
|
247156
|
+
pngSize: () => pngSize3,
|
|
247079
247157
|
preflightApp: () => preflightApp,
|
|
247080
247158
|
profileAccount: () => profileAccount,
|
|
247081
247159
|
readXcconfigVars: () => readXcconfigVars
|
|
@@ -247310,7 +247388,7 @@ function isValidAppStoreSize(w2, h2) {
|
|
|
247310
247388
|
function isRequired69(w2, h2) {
|
|
247311
247389
|
return w2 === 1320 && h2 === 2868 || w2 === 1290 && h2 === 2796 || w2 === 2868 && h2 === 1320 || w2 === 2796 && h2 === 1290;
|
|
247312
247390
|
}
|
|
247313
|
-
function
|
|
247391
|
+
function pngSize3(buf) {
|
|
247314
247392
|
if (buf.length < 24 || buf.toString("ascii", 12, 16) !== "IHDR") return null;
|
|
247315
247393
|
return { w: buf.readUInt32BE(16), h: buf.readUInt32BE(20) };
|
|
247316
247394
|
}
|
|
@@ -247367,7 +247445,7 @@ function analyzePlayListing(assets) {
|
|
|
247367
247445
|
} else {
|
|
247368
247446
|
const { name, bytes: bytes2 } = assets.featureGraphic;
|
|
247369
247447
|
const isPng = bytes2.length > 8 && bytes2.toString("ascii", 1, 4) === "PNG";
|
|
247370
|
-
const size = isPng ?
|
|
247448
|
+
const size = isPng ? pngSize3(bytes2) : jpegSize2(bytes2);
|
|
247371
247449
|
if (!size) {
|
|
247372
247450
|
f2.push({
|
|
247373
247451
|
level: "error",
|
|
@@ -247456,7 +247534,7 @@ function listScreenshots(app2, locale = "en-US") {
|
|
|
247456
247534
|
const flat2 = join155(storeDir(app2), "screenshots", locale);
|
|
247457
247535
|
if (existsSync123(flat2)) {
|
|
247458
247536
|
for (const png of readdirSync54(flat2).filter((n2) => n2.endsWith(".png"))) {
|
|
247459
|
-
const sz =
|
|
247537
|
+
const sz = pngSize3(readFileSync149(join155(flat2, png)));
|
|
247460
247538
|
if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
|
|
247461
247539
|
}
|
|
247462
247540
|
}
|
|
@@ -247466,7 +247544,7 @@ function listScreenshots(app2, locale = "en-US") {
|
|
|
247466
247544
|
const d2 = join155(legacy, deviceDir);
|
|
247467
247545
|
if (!statSync44(d2).isDirectory()) continue;
|
|
247468
247546
|
for (const png of readdirSync54(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
247469
|
-
const sz =
|
|
247547
|
+
const sz = pngSize3(readFileSync149(join155(d2, png)));
|
|
247470
247548
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
247471
247549
|
}
|
|
247472
247550
|
}
|
|
@@ -257468,7 +257546,13 @@ function generateScreens(input) {
|
|
|
257468
257546
|
}));
|
|
257469
257547
|
const taken = new Set(input.takenScreenIds ?? []);
|
|
257470
257548
|
const hiddenPage = (id) => obj6(obj6(layoutItems[id]).settings).hideFromNavigation === true;
|
|
257471
|
-
const
|
|
257549
|
+
const isForum = (sectionId) => str13(obj6(sections2[sectionId]).sectionDefinitionId).startsWith("forum_");
|
|
257550
|
+
const forumOnly = (id) => {
|
|
257551
|
+
const els = arr(obj6(layoutItems[id]).elements).map(obj6);
|
|
257552
|
+
return els.length > 0 && els.every((e2) => isForum(str13(e2.elementId)));
|
|
257553
|
+
};
|
|
257554
|
+
const firstPage = (screenId) => pageItems(screenId).find((page) => !forumOnly(page)) ?? pageItems(screenId)[0];
|
|
257555
|
+
const homePage = input.homeScreenId ? str13(arr(obj6(obj6(input.navigation).target).tabs).map(obj6).find((tab) => !forumOnly(str13(tab.layoutItemId)))?.layoutItemId) || (sourceTabs.length > 1 ? tabScreenIds.map((id) => pageItems(id).find((page) => !forumOnly(page))).find((id) => id && !hiddenPage(id)) : void 0) || items.find((id) => !hiddenPage(id) && !forumOnly(id)) || items.find((id) => !forumOnly(id)) || items[0] : void 0;
|
|
257472
257556
|
if (input.homeScreenId) taken.add(input.homeScreenId);
|
|
257473
257557
|
const fellBack = /* @__PURE__ */ new Set();
|
|
257474
257558
|
const paramLinked = /* @__PURE__ */ new Set();
|
|
@@ -257506,7 +257590,23 @@ function generateScreens(input) {
|
|
|
257506
257590
|
for (const layoutItemId of items) {
|
|
257507
257591
|
const item2 = obj6(layoutItems[layoutItemId]);
|
|
257508
257592
|
const label4 = str13(item2.title) || layoutItemId;
|
|
257509
|
-
const
|
|
257593
|
+
const sourceElements = arr(item2.elements).map(obj6);
|
|
257594
|
+
const sourceIndex = new Map(sourceElements.map((element, position) => [element, position]));
|
|
257595
|
+
const elements2 = sourceElements.filter((element) => {
|
|
257596
|
+
const sectionId = str13(element.elementId);
|
|
257597
|
+
if (!isForum(sectionId)) return true;
|
|
257598
|
+
out2.gaps.push({
|
|
257599
|
+
page: label4,
|
|
257600
|
+
sectionId,
|
|
257601
|
+
sectionDefinitionId: str13(obj6(sections2[sectionId]).sectionDefinitionId),
|
|
257602
|
+
reason: "the retired Wix Forum is omitted; use real Wix Groups when present. Forum-to-Groups migration is not verified by this collection"
|
|
257603
|
+
});
|
|
257604
|
+
return false;
|
|
257605
|
+
});
|
|
257606
|
+
if (forumOnly(layoutItemId)) {
|
|
257607
|
+
out2.routes.push({ layoutItemId, label: label4, kind: "skipped", omitted: "retired_forum" });
|
|
257608
|
+
continue;
|
|
257609
|
+
}
|
|
257510
257610
|
if (!elements2.length) {
|
|
257511
257611
|
out2.routes.push({ layoutItemId, label: label4, kind: "empty" });
|
|
257512
257612
|
continue;
|
|
@@ -257581,7 +257681,8 @@ function generateScreens(input) {
|
|
|
257581
257681
|
}
|
|
257582
257682
|
};
|
|
257583
257683
|
const children2 = [];
|
|
257584
|
-
elements2.forEach((element
|
|
257684
|
+
elements2.forEach((element) => {
|
|
257685
|
+
const index = sourceIndex.get(element);
|
|
257585
257686
|
const sectionId = str13(element.elementId);
|
|
257586
257687
|
const section3 = obj6(sections2[sectionId]);
|
|
257587
257688
|
const type2 = str13(section3.sectionDefinitionId);
|
|
@@ -257643,16 +257744,23 @@ function generateScreens(input) {
|
|
|
257643
257744
|
const slugs = layoutSlugs(layoutItems);
|
|
257644
257745
|
const hasTabBar = (str13(obj6(obj6(input.navigation).target).navKind) || "bottomTabs") === "bottomTabs";
|
|
257645
257746
|
const pageOfScreen = new Map(sourceTabs.flatMap((tab) => {
|
|
257646
|
-
const first =
|
|
257747
|
+
const first = firstPage(str13(tab.screenId));
|
|
257647
257748
|
return first ? [[str13(tab.screenId), first]] : [];
|
|
257648
257749
|
}));
|
|
257649
257750
|
for (; ; ) {
|
|
257650
|
-
const emptied = resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, true);
|
|
257751
|
+
const emptied = resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, forumOnly, true);
|
|
257651
257752
|
let demoted = 0;
|
|
257652
|
-
for (const { id: screenId, dropped } of emptied) {
|
|
257753
|
+
for (const { id: screenId, dropped, retired } of emptied) {
|
|
257653
257754
|
const route = out2.routes.find((r3) => r3.screenId === screenId && r3.kind === "generated");
|
|
257654
257755
|
if (!route) continue;
|
|
257655
257756
|
demoted++;
|
|
257757
|
+
if (retired) {
|
|
257758
|
+
for (const title of dropped) out2.gaps.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: `the button "${title}" links to the retired Wix Forum, so the button and the page it alone filled are omitted` });
|
|
257759
|
+
out2.routes[out2.routes.indexOf(route)] = { layoutItemId: route.layoutItemId, label: route.label, kind: "skipped", omitted: "retired_forum" };
|
|
257760
|
+
delete out2.screens[screenId];
|
|
257761
|
+
delete out2.workers[screenId];
|
|
257762
|
+
continue;
|
|
257763
|
+
}
|
|
257656
257764
|
for (const title of dropped) out2.gaps.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: `the button "${title}" links to a page that produced no screen, so the button is left out` });
|
|
257657
257765
|
out2.unmapped.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: "its only content was a button linking to a page that produced no screen, so the page has nothing to show" });
|
|
257658
257766
|
out2.routes[out2.routes.indexOf(route)] = { layoutItemId: route.layoutItemId, label: route.label, kind: "unmapped" };
|
|
@@ -257674,7 +257782,8 @@ function generateScreens(input) {
|
|
|
257674
257782
|
const attempted = new Set(items);
|
|
257675
257783
|
for (const sourceScreenId of Object.keys(screens0)) {
|
|
257676
257784
|
const pages2 = pageItems(sourceScreenId);
|
|
257677
|
-
const
|
|
257785
|
+
const visible = pages2.filter((id) => obj6(obj6(layoutItems[id]).settings).hideFromNavigation !== true);
|
|
257786
|
+
const first = visible.find((id) => !forumOnly(id)) ?? visible[0] ?? pages2[0];
|
|
257678
257787
|
if (first ? attempted.has(first) : tabScreenIds.includes(sourceScreenId)) mapRow(`/screens/${pointerPart(sourceScreenId)}`, first ? screenOfPage.get(first) : void 0);
|
|
257679
257788
|
arr(obj6(obj6(screens0[sourceScreenId]).layout).items).forEach((item2, index) => {
|
|
257680
257789
|
const id = str13(obj6(item2).layoutItemId);
|
|
@@ -257687,7 +257796,7 @@ function generateScreens(input) {
|
|
|
257687
257796
|
}
|
|
257688
257797
|
const planned2 = obj6(input.navigation);
|
|
257689
257798
|
const ownTabs = sourceTabs.length > 1 && !arr(obj6(planned2.target).tabs).length ? sourceTabs.flatMap((tab) => {
|
|
257690
|
-
const layoutItemId =
|
|
257799
|
+
const layoutItemId = firstPage(str13(tab.screenId));
|
|
257691
257800
|
if (!layoutItemId) {
|
|
257692
257801
|
out2.gaps.push({ page: str13(tab.title).trim() || str13(tab.screenId), sectionId: "", sectionDefinitionId: "(navigation)", reason: "this bottom tab's screen has no page, so the app has no tab for it" });
|
|
257693
257802
|
return [];
|
|
@@ -257696,7 +257805,7 @@ function generateScreens(input) {
|
|
|
257696
257805
|
return layoutItemId && !hidden ? [{ layoutItemId, label: str13(tab.title).trim(), icon: str13(tab.icon) }] : [];
|
|
257697
257806
|
}) : [];
|
|
257698
257807
|
addNavigation(out2, ownTabs.length ? { target: { tabs: ownTabs, overflow: ownTabs.length > BOTTOM_TABS_BEFORE_MORE + 1 } } : planned2, taken);
|
|
257699
|
-
resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen);
|
|
257808
|
+
resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, forumOnly);
|
|
257700
257809
|
return out2;
|
|
257701
257810
|
}
|
|
257702
257811
|
function markSharedTemplateParams(out2, paramLinked) {
|
|
@@ -257723,7 +257832,7 @@ function layoutSlugs(layoutItems) {
|
|
|
257723
257832
|
for (const slug of repeated) found.delete(slug);
|
|
257724
257833
|
return found;
|
|
257725
257834
|
}
|
|
257726
|
-
function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, dryRun = false) {
|
|
257835
|
+
function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, isForumPage, dryRun = false) {
|
|
257727
257836
|
const screenOf = new Map(out2.routes.filter((r3) => r3.screenId).map((r3) => [r3.layoutItemId, r3.screenId]));
|
|
257728
257837
|
const taken = /* @__PURE__ */ new Set();
|
|
257729
257838
|
const tabOfScreen = new Map((hasTabBar ? out2.tabs : []).map((tab) => [tab.screenId, tabIdFor(tab, taken)]));
|
|
@@ -257746,12 +257855,17 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
|
|
|
257746
257855
|
return body.type === "Button" && isPlaceholderTap(action) && !resolve118(str13(obj6(obj6(action).params).screenId));
|
|
257747
257856
|
};
|
|
257748
257857
|
const DEAD = Symbol("dead");
|
|
257858
|
+
let stats = { forum: 0, other: 0 };
|
|
257749
257859
|
const walk4 = (value2, dropped) => {
|
|
257750
257860
|
if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return resolve118(value2);
|
|
257751
257861
|
if (Array.isArray(value2)) return value2.map((v2) => walk4(v2, dropped)).filter((v2) => v2 !== DEAD);
|
|
257752
257862
|
if (value2 && typeof value2 === "object") {
|
|
257753
257863
|
if (isDeadButton(value2)) {
|
|
257754
257864
|
dropped.push(str13(obj6(obj6(obj6(value2).body).props).title));
|
|
257865
|
+
const action = obj6(obj6(obj6(obj6(value2).body).props).action);
|
|
257866
|
+
const named3 = str13(obj6(action.params).screenId).slice(ROUTE_PLACEHOLDER.length).split("|")[0] ?? "";
|
|
257867
|
+
if (isForumPage(named3) || isForumPage(slugs.get(named3) ?? "")) stats.forum++;
|
|
257868
|
+
else stats.other++;
|
|
257755
257869
|
return DEAD;
|
|
257756
257870
|
}
|
|
257757
257871
|
const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !resolve118(str13(obj6(obj6(v2).params).screenId)))).map(([k3, v2]) => [k3, isPlaceholderTap(v2) ? retarget(v2) : walk4(v2, dropped)]));
|
|
@@ -257765,8 +257879,9 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
|
|
|
257765
257879
|
const emptied = [];
|
|
257766
257880
|
for (const [id, screen] of Object.entries(out2.screens)) {
|
|
257767
257881
|
const dropped = [];
|
|
257882
|
+
stats = { forum: 0, other: 0 };
|
|
257768
257883
|
const walked = walk4(screen, dropped);
|
|
257769
|
-
if (walked.payload === DEAD) emptied.push({ id, dropped });
|
|
257884
|
+
if (walked.payload === DEAD) emptied.push({ id, dropped, retired: stats.forum > 0 && stats.other === 0 });
|
|
257770
257885
|
if (dryRun) continue;
|
|
257771
257886
|
out2.screens[id] = walked.payload === DEAD ? { ...walked, payload: { ...obj6(screen.payload), body: { ...obj6(obj6(screen.payload).body), props: { ...obj6(obj6(obj6(screen.payload).body).props), children: [] } } } } : walked;
|
|
257772
257887
|
if (walked.payload === DEAD) out2.unmapped.push({ page: str13(screen.title) || id, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: "its only content was a button linking to a page that produced no screen, so the page has nothing to show" });
|
|
@@ -257800,12 +257915,25 @@ function tabsFile(result, navigation) {
|
|
|
257800
257915
|
};
|
|
257801
257916
|
}
|
|
257802
257917
|
function addNavigation(out2, plan, taken) {
|
|
257803
|
-
const
|
|
257804
|
-
if (!
|
|
257918
|
+
const plannedTabs = arr(obj6(plan.target).tabs).map(obj6);
|
|
257919
|
+
if (!plannedTabs.length) return;
|
|
257805
257920
|
const routeOf = new Map(out2.routes.map((r3) => [r3.layoutItemId, r3]));
|
|
257921
|
+
for (const tab of plannedTabs) {
|
|
257922
|
+
const route = routeOf.get(str13(tab.layoutItemId));
|
|
257923
|
+
out2.pages.push({
|
|
257924
|
+
layoutItemId: str13(tab.layoutItemId),
|
|
257925
|
+
label: str13(tab.label),
|
|
257926
|
+
...route?.screenId ? { screenId: route.screenId } : {},
|
|
257927
|
+
...route?.omitted ? { omitted: route.omitted } : {}
|
|
257928
|
+
});
|
|
257929
|
+
}
|
|
257930
|
+
const tabs = plannedTabs.filter((tab) => !routeOf.get(str13(tab.layoutItemId))?.omitted);
|
|
257931
|
+
if (!tabs.length) {
|
|
257932
|
+
out2.unmapped.push({ page: "(navigation)", sectionId: "", sectionDefinitionId: "(navigation)", reason: "every page of the navigation is the retired Wix Forum, so no page is left to open: the app needs at least one other page" });
|
|
257933
|
+
return;
|
|
257934
|
+
}
|
|
257806
257935
|
const overflow = obj6(plan.target).overflow === true && tabs.length > BOTTOM_TABS_BEFORE_MORE + 1;
|
|
257807
257936
|
const bottom = overflow ? tabs.slice(0, BOTTOM_TABS_BEFORE_MORE) : tabs;
|
|
257808
|
-
for (const tab of tabs) out2.pages.push({ layoutItemId: str13(tab.layoutItemId), label: str13(tab.label), ...routeOf.get(str13(tab.layoutItemId))?.screenId ? { screenId: routeOf.get(str13(tab.layoutItemId)).screenId } : {} });
|
|
257809
257937
|
for (const tab of bottom) {
|
|
257810
257938
|
const route = routeOf.get(str13(tab.layoutItemId));
|
|
257811
257939
|
if (route?.screenId) {
|
|
@@ -258958,8 +259086,9 @@ import ts25 from "typescript";
|
|
|
258958
259086
|
function pagesWithoutScreen(plan, planned2) {
|
|
258959
259087
|
const have = new Map((plan.pages ?? []).map((page) => [page.layoutItemId, page]));
|
|
258960
259088
|
const missing4 = /* @__PURE__ */ new Map();
|
|
258961
|
-
|
|
258962
|
-
for (const page of
|
|
259089
|
+
const omitted = (id) => have.get(id)?.omitted === "retired_forum";
|
|
259090
|
+
for (const page of plan.pages ?? []) if (!page.screenId && !omitted(page.layoutItemId)) missing4.set(page.layoutItemId, page.label);
|
|
259091
|
+
for (const page of planned2) if (!have.get(page.layoutItemId)?.screenId && !omitted(page.layoutItemId)) missing4.set(page.layoutItemId, page.label);
|
|
258963
259092
|
return [...missing4].map(([layoutItemId, page]) => ({ page, layoutItemId }));
|
|
258964
259093
|
}
|
|
258965
259094
|
function tabIcon(source2) {
|
|
@@ -259187,16 +259316,255 @@ var init_apply_navigation = __esm({
|
|
|
259187
259316
|
}
|
|
259188
259317
|
});
|
|
259189
259318
|
|
|
259319
|
+
// src/one-app/starter-keep-list.ts
|
|
259320
|
+
import { existsSync as existsSync142, readFileSync as readFileSync170, writeFileSync as writeFileSync67 } from "node:fs";
|
|
259321
|
+
import { join as join178 } from "node:path";
|
|
259322
|
+
import ts26 from "typescript";
|
|
259323
|
+
function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
|
|
259324
|
+
if (Array.isArray(node3)) {
|
|
259325
|
+
for (const child3 of node3) screensOpenedBy(child3, found);
|
|
259326
|
+
return [...found];
|
|
259327
|
+
}
|
|
259328
|
+
if (typeof node3 !== "object" || node3 === null) return [...found];
|
|
259329
|
+
const record4 = node3;
|
|
259330
|
+
const target = record4.params?.screenId;
|
|
259331
|
+
const opens = record4.actionId === "himi.open" || typeof record4.actionId === "string" && WORKER_OPEN2.test(record4.actionId);
|
|
259332
|
+
if (opens && typeof target === "string" && CATALOGUE_ID.test(target)) found.add(target);
|
|
259333
|
+
for (const value2 of Object.values(record4)) screensOpenedBy(value2, found);
|
|
259334
|
+
return [...found];
|
|
259335
|
+
}
|
|
259336
|
+
function seedKeepList(facts) {
|
|
259337
|
+
const rows = /* @__PURE__ */ new Map();
|
|
259338
|
+
const add = (id, why) => {
|
|
259339
|
+
if (!rows.has(id)) rows.set(id, why);
|
|
259340
|
+
};
|
|
259341
|
+
for (const id of facts.generated) add(id, "generated by one-app generate");
|
|
259342
|
+
for (const id of facts.template) add(id, "starter screen a migrated page opens");
|
|
259343
|
+
for (const id of ACCOUNT_CORE) add(id, "account core");
|
|
259344
|
+
for (const counter of ["notifications", "cart"]) {
|
|
259345
|
+
if (facts.counters.includes(counter)) add(HEADER_BADGE_SPEC[counter].screenId, `top-bar ${counter} control`);
|
|
259346
|
+
}
|
|
259347
|
+
if (facts.memberChat) add("himi_inbox", "member chat: every chat door opens the Inbox");
|
|
259348
|
+
else if (facts.counters.includes("chat")) add(HEADER_BADGE_SPEC.chat.screenId, "top-bar chat control");
|
|
259349
|
+
if (facts.showsInvite) add(INVITE_SCREEN, "top-bar invite control (built by the agent)");
|
|
259350
|
+
return [...rows].map(([id, why]) => ({ id, why }));
|
|
259351
|
+
}
|
|
259352
|
+
function loadStarter(dir) {
|
|
259353
|
+
try {
|
|
259354
|
+
const dev = readFileSync170(join178(dir, "dev", "index.ts"), "utf8"), config = readFileSync170(join178(dir, "config.ts"), "utf8");
|
|
259355
|
+
const workers = listWorkers(dir);
|
|
259356
|
+
return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
|
|
259357
|
+
} catch (error) {
|
|
259358
|
+
if (error instanceof TrimRefusal || error.code) return void 0;
|
|
259359
|
+
throw error;
|
|
259360
|
+
}
|
|
259361
|
+
}
|
|
259362
|
+
function routeLabel(app2, id) {
|
|
259363
|
+
return (app2.exact.get(id) ?? app2.templated.find((route) => route.re.test(id)))?.label;
|
|
259364
|
+
}
|
|
259365
|
+
function literalTargets2(app2, text25) {
|
|
259366
|
+
const found = /* @__PURE__ */ new Set();
|
|
259367
|
+
for (const token of literalsOf(text25)) {
|
|
259368
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*[_/]?$/.test(token)) continue;
|
|
259369
|
+
const prefix = /[_/]$/.test(token);
|
|
259370
|
+
const label4 = prefix ? app2.templated.find((route) => route.re.test(`${token}x`))?.label : routeLabel(app2, token);
|
|
259371
|
+
if (label4) found.add(label4);
|
|
259372
|
+
}
|
|
259373
|
+
return [...found];
|
|
259374
|
+
}
|
|
259375
|
+
function runtimeTargets(starter, workerTexts) {
|
|
259376
|
+
const { app: app2, sources, moduleTargets } = starter;
|
|
259377
|
+
const found = new Set(workerTexts.flatMap((text25) => literalTargets2(app2, text25)));
|
|
259378
|
+
for (const module of new Set(workerTexts.flatMap(sharedModulesOf))) {
|
|
259379
|
+
if (!moduleTargets.has(module)) moduleTargets.set(module, literalTargets2(app2, sources.workerFiles[`tier5-src/_shared/${module}.ts`] ?? ""));
|
|
259380
|
+
const targets = moduleTargets.get(module);
|
|
259381
|
+
if (targets.length <= TABLE_LIMIT) for (const label4 of targets) found.add(label4);
|
|
259382
|
+
}
|
|
259383
|
+
return [...found];
|
|
259384
|
+
}
|
|
259385
|
+
function workerTextsOf(starter, label4) {
|
|
259386
|
+
const route = starter.app.routes.find((r3) => r3.label === label4);
|
|
259387
|
+
const prefixes = (route?.bundles ?? []).map((bundle) => `tier5-src/${bundle}/`);
|
|
259388
|
+
return Object.entries(starter.sources.workerFiles).filter(([file2]) => prefixes.some((prefix) => file2.startsWith(prefix))).map(([, text25]) => text25);
|
|
259389
|
+
}
|
|
259390
|
+
function closeOverTrim(dir, seed2, replaced = [], alsoKept = []) {
|
|
259391
|
+
const starter = loadStarter(dir);
|
|
259392
|
+
if (!starter) return [];
|
|
259393
|
+
const { sources, app: app2 } = starter;
|
|
259394
|
+
const sample = new Set(replaced);
|
|
259395
|
+
const labels = new Set(app2.routes.map((route) => route.label));
|
|
259396
|
+
const keep = new Set([...seed2, ...alsoKept].filter((id) => labels.has(id)));
|
|
259397
|
+
const added = [];
|
|
259398
|
+
const need2 = (screen, to2, why = `opened by ${screen}`) => {
|
|
259399
|
+
if (sample.has(screen)) return false;
|
|
259400
|
+
const label4 = routeLabel(app2, to2);
|
|
259401
|
+
if (!label4 || keep.has(label4)) return false;
|
|
259402
|
+
keep.add(label4);
|
|
259403
|
+
added.push({ id: label4, why });
|
|
259404
|
+
return true;
|
|
259405
|
+
};
|
|
259406
|
+
const attempt2 = (links) => {
|
|
259407
|
+
try {
|
|
259408
|
+
return { plan: planTrim(sources, [...keep], links) };
|
|
259409
|
+
} catch (error) {
|
|
259410
|
+
if (error instanceof TrimRefusal) return { refused: error };
|
|
259411
|
+
throw error;
|
|
259412
|
+
}
|
|
259413
|
+
};
|
|
259414
|
+
const primaryIds = primaryNodeIds(app2);
|
|
259415
|
+
const droppedOf = (detail) => Array.isArray(detail) ? detail : [];
|
|
259416
|
+
const roots2 = new Set(seed2.filter((id) => labels.has(id)));
|
|
259417
|
+
const scanned = /* @__PURE__ */ new Set();
|
|
259418
|
+
const scanRuntime = () => {
|
|
259419
|
+
let grew = false;
|
|
259420
|
+
for (const label4 of roots2) {
|
|
259421
|
+
if (scanned.has(label4) || sample.has(label4)) continue;
|
|
259422
|
+
scanned.add(label4);
|
|
259423
|
+
for (const to2 of runtimeTargets(starter, workerTextsOf(starter, label4))) grew = need2(label4, to2, `opened at runtime by ${label4}`) || grew;
|
|
259424
|
+
}
|
|
259425
|
+
return grew;
|
|
259426
|
+
};
|
|
259427
|
+
for (let round = 0; round <= labels.size; round++) {
|
|
259428
|
+
let grew = scanRuntime();
|
|
259429
|
+
const { plan, refused: refused2 } = attempt2("drop");
|
|
259430
|
+
if (plan) {
|
|
259431
|
+
grew = droppedPrimaryTaps(droppedOf(plan.report.droppedLinks), primaryIds).map((lost2) => need2(lost2.screen, lost2.to)).includes(true) || grew;
|
|
259432
|
+
} else {
|
|
259433
|
+
const unremovable = refused2.detail.unremovable ?? [];
|
|
259434
|
+
const emptied = new Set(refused2.detail.dropWouldEmpty ?? []);
|
|
259435
|
+
grew = unremovable.map((u2) => need2(u2.screen, u2.to)).includes(true) || grew;
|
|
259436
|
+
if (!grew && emptied.size) {
|
|
259437
|
+
grew = droppedOf(attempt2().refused?.detail.droppedLinks).filter((d2) => emptied.has(d2.screen)).map((d2) => need2(d2.screen, d2.to)).includes(true);
|
|
259438
|
+
}
|
|
259439
|
+
}
|
|
259440
|
+
if (!grew) break;
|
|
259441
|
+
}
|
|
259442
|
+
return added;
|
|
259443
|
+
}
|
|
259444
|
+
function catalogueRange(masked) {
|
|
259445
|
+
const heading = /(?:^|\n)##[ \t]+Screen catalogue\b[^\n]*/i.exec(masked);
|
|
259446
|
+
if (!heading) return void 0;
|
|
259447
|
+
const start = heading.index + heading[0].length;
|
|
259448
|
+
const next = /\n##[ \t]/.exec(masked.slice(start));
|
|
259449
|
+
return { start, end: next ? start + next.index : masked.length };
|
|
259450
|
+
}
|
|
259451
|
+
function selfWrittenRows(spec) {
|
|
259452
|
+
const masked = maskComments(spec);
|
|
259453
|
+
const range = catalogueRange(masked);
|
|
259454
|
+
const own6 = /* @__PURE__ */ new Set();
|
|
259455
|
+
if (!range) return own6;
|
|
259456
|
+
for (const line of masked.slice(range.start, range.end).split("\n")) {
|
|
259457
|
+
if (!line.trim().startsWith("|")) continue;
|
|
259458
|
+
const cells = line.trim().replace(/^\||\|$/g, "").split("|").map((cell3) => cell3.trim());
|
|
259459
|
+
const id = /^`([^`]+)`/.exec(cells[0] ?? "")?.[1];
|
|
259460
|
+
if (id && cells.length > 1 && SELF_NOTE.test(cells[cells.length - 1] ?? "")) own6.add(id);
|
|
259461
|
+
}
|
|
259462
|
+
return own6;
|
|
259463
|
+
}
|
|
259464
|
+
function mergeCatalogue(spec, rows) {
|
|
259465
|
+
const have = new Set(specScreens(spec));
|
|
259466
|
+
const fresh = rows.filter((row2, index) => CATALOGUE_ID.test(row2.id) && !have.has(row2.id) && rows.findIndex((r3) => r3.id === row2.id) === index);
|
|
259467
|
+
if (!fresh.length) return { text: spec, added: [] };
|
|
259468
|
+
const masked = maskComments(spec);
|
|
259469
|
+
const range = catalogueRange(masked);
|
|
259470
|
+
const rowOf = (columns2, row2) => tableRow([`\`${row2.id}\``, ...Array(Math.max(columns2 - 2, 0)).fill(""), row2.why]);
|
|
259471
|
+
const block = (columns2) => fresh.map((row2) => rowOf(columns2, row2)).join("\n");
|
|
259472
|
+
const added = fresh.map((row2) => row2.id);
|
|
259473
|
+
if (!range) {
|
|
259474
|
+
const table2 = [tableRow(HEADER4), tableRow(HEADER4.map(() => "---")), block(HEADER4.length)].join("\n");
|
|
259475
|
+
return { text: `${spec.replace(/\n*$/, "\n")}
|
|
259476
|
+
## Screen catalogue
|
|
259477
|
+
${table2}
|
|
259478
|
+
`, added };
|
|
259479
|
+
}
|
|
259480
|
+
const { start, end: end2 } = range;
|
|
259481
|
+
const lines2 = masked.slice(start, end2).split("\n");
|
|
259482
|
+
let offset = start, lastRowEnd = -1, columns = HEADER4.length, first = true;
|
|
259483
|
+
for (const line of lines2) {
|
|
259484
|
+
if (line.trim().startsWith("|")) {
|
|
259485
|
+
if (first) {
|
|
259486
|
+
columns = line.trim().replace(/^\||\|$/g, "").split("|").length;
|
|
259487
|
+
first = false;
|
|
259488
|
+
}
|
|
259489
|
+
lastRowEnd = offset + line.length;
|
|
259490
|
+
}
|
|
259491
|
+
offset += line.length + 1;
|
|
259492
|
+
}
|
|
259493
|
+
if (lastRowEnd >= 0) return { text: `${spec.slice(0, lastRowEnd)}
|
|
259494
|
+
${block(columns)}${spec.slice(lastRowEnd)}`, added };
|
|
259495
|
+
const table = [tableRow(HEADER4), tableRow(HEADER4.map(() => "---")), block(HEADER4.length)].join("\n");
|
|
259496
|
+
return { text: `${spec.slice(0, end2).replace(/\n*$/, "\n")}${table}
|
|
259497
|
+
${spec.slice(end2).replace(/^\n*/, "\n")}`, added };
|
|
259498
|
+
}
|
|
259499
|
+
function sharedModulesOf(workerSource) {
|
|
259500
|
+
const file2 = ts26.createSourceFile("worker.ts", workerSource, ts26.ScriptTarget.Latest, true);
|
|
259501
|
+
const modules = [];
|
|
259502
|
+
for (const statement of file2.statements) {
|
|
259503
|
+
if (!ts26.isImportDeclaration(statement) || !ts26.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
259504
|
+
const specifier = statement.moduleSpecifier.text;
|
|
259505
|
+
if (specifier.startsWith("../_shared/") && specifier.endsWith(".js")) modules.push(specifier.slice("../_shared/".length, -".js".length));
|
|
259506
|
+
}
|
|
259507
|
+
return modules;
|
|
259508
|
+
}
|
|
259509
|
+
function literalsOf(text25) {
|
|
259510
|
+
const file2 = ts26.createSourceFile("module.ts", text25, ts26.ScriptTarget.Latest, true);
|
|
259511
|
+
const out2 = [];
|
|
259512
|
+
const visit = (node3) => {
|
|
259513
|
+
if (ts26.isStringLiteral(node3) || ts26.isNoSubstitutionTemplateLiteral(node3) || ts26.isTemplateHead(node3)) out2.push(node3.text);
|
|
259514
|
+
ts26.forEachChild(node3, visit);
|
|
259515
|
+
};
|
|
259516
|
+
visit(file2);
|
|
259517
|
+
return out2;
|
|
259518
|
+
}
|
|
259519
|
+
function workerOpenedScreens(dir, workerSources) {
|
|
259520
|
+
const starter = loadStarter(dir);
|
|
259521
|
+
if (!starter || !workerSources.length) return [];
|
|
259522
|
+
return runtimeTargets(starter, workerSources).map((id) => ({ id, why: MODULE_NOTE }));
|
|
259523
|
+
}
|
|
259524
|
+
function writeStarterKeepList(contentDir2, facts) {
|
|
259525
|
+
const path2 = join178(contentDir2, "SPEC.md");
|
|
259526
|
+
const created = !existsSync142(path2);
|
|
259527
|
+
const starter = loadStarter(contentDir2);
|
|
259528
|
+
const template = facts.template.flatMap((id) => facts.generated.includes(id) || !starter ? [id] : routeLabel(starter.app, id) ?? []);
|
|
259529
|
+
const seed2 = [...seedKeepList({ ...facts, template }), ...workerOpenedScreens(contentDir2, facts.workers ?? [])];
|
|
259530
|
+
const spec = created ? SPEC_TEMPLATE : readFileSync170(path2, "utf8");
|
|
259531
|
+
const existing = specScreens(spec), mine = selfWrittenRows(spec);
|
|
259532
|
+
const closure = closeOverTrim(contentDir2, [...seed2.map((row2) => row2.id), ...existing.filter((id) => !mine.has(id))], facts.generated, existing);
|
|
259533
|
+
const { text: text25, added } = mergeCatalogue(spec, [...seed2, ...closure]);
|
|
259534
|
+
if (created || added.length) writeFileSync67(path2, text25, "utf8");
|
|
259535
|
+
return { path: path2, created, added, closure };
|
|
259536
|
+
}
|
|
259537
|
+
var MODULE_NOTE, ACCOUNT_CORE, CATALOGUE_ID, WORKER_OPEN2, TABLE_LIMIT, maskComments, HEADER4, tableRow, SELF_NOTE;
|
|
259538
|
+
var init_starter_keep_list = __esm({
|
|
259539
|
+
"src/one-app/starter-keep-list.ts"() {
|
|
259540
|
+
init_define_HHP_CATALOG();
|
|
259541
|
+
init_mobile_ux_contract();
|
|
259542
|
+
init_template_adopt();
|
|
259543
|
+
init_template_trim();
|
|
259544
|
+
init_header_badges();
|
|
259545
|
+
init_invite_drawer();
|
|
259546
|
+
MODULE_NOTE = "opened at runtime by a module a migrated page registers";
|
|
259547
|
+
ACCOUNT_CORE = ["himi_account", "himi_account_settings", "himi_sign_in", "himi_delete_account", "himi_app_info", "himi_appearance", "himi_app_language"];
|
|
259548
|
+
CATALOGUE_ID = /^[a-z][a-z0-9_]*$/;
|
|
259549
|
+
WORKER_OPEN2 = /^tier5\.[A-Za-z0-9_]+\.openMember$/;
|
|
259550
|
+
TABLE_LIMIT = 4;
|
|
259551
|
+
maskComments = (text25) => text25.replace(/<!--[\s\S]*?(?:-->|$)/g, (m2) => m2.replace(/[^\n]/g, " "));
|
|
259552
|
+
HEADER4 = ["Screen", "Job", "Primary action", "Data", "Notes"];
|
|
259553
|
+
tableRow = (cells) => `| ${cells.join(" | ")} |`;
|
|
259554
|
+
SELF_NOTE = new RegExp(String.raw`^(${MODULE_NOTE}|generated by one-app generate|starter screen a migrated page opens|account core|top-bar [a-z]+ control( \(built by the agent\))?|member chat: every chat door opens the Inbox|opened (at runtime )?by [a-z][a-z0-9_]*)$`);
|
|
259555
|
+
}
|
|
259556
|
+
});
|
|
259557
|
+
|
|
259190
259558
|
// src/one-app/generate-cli.ts
|
|
259191
|
-
import { existsSync as
|
|
259192
|
-
import { dirname as dirname77, join as
|
|
259559
|
+
import { existsSync as existsSync143, mkdirSync as mkdirSync63, readdirSync as readdirSync59, readFileSync as readFileSync171, rmSync as rmSync41, writeFileSync as writeFileSync68 } from "node:fs";
|
|
259560
|
+
import { dirname as dirname77, join as join179, resolve as resolve110 } from "node:path";
|
|
259193
259561
|
function removeStaleGeneratedWorkers(contentDir2, current) {
|
|
259194
|
-
const root =
|
|
259195
|
-
if (!
|
|
259562
|
+
const root = join179(contentDir2, "tier5-src");
|
|
259563
|
+
if (!existsSync143(root)) return;
|
|
259196
259564
|
for (const name of readdirSync59(root)) {
|
|
259197
259565
|
if (current.has(name) || name === "_shared") continue;
|
|
259198
|
-
const index =
|
|
259199
|
-
if (
|
|
259566
|
+
const index = join179(root, name, "index.ts");
|
|
259567
|
+
if (existsSync143(index) && readFileSync171(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync41(join179(root, name), { recursive: true, force: true });
|
|
259200
259568
|
}
|
|
259201
259569
|
}
|
|
259202
259570
|
function parseArgs5(args) {
|
|
@@ -259218,11 +259586,11 @@ function parseArgs5(args) {
|
|
|
259218
259586
|
}
|
|
259219
259587
|
}
|
|
259220
259588
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
259221
|
-
return { evidenceDir: resolve110(evidenceDir), contentDir: resolve110(contentDir2), out: resolve110(out2 ??
|
|
259589
|
+
return { evidenceDir: resolve110(evidenceDir), contentDir: resolve110(contentDir2), out: resolve110(out2 ?? join179(evidenceDir, "gen", "screens.json")) };
|
|
259222
259590
|
}
|
|
259223
259591
|
function claimedHome(out2) {
|
|
259224
259592
|
try {
|
|
259225
|
-
return JSON.parse(
|
|
259593
|
+
return JSON.parse(readFileSync171(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
|
|
259226
259594
|
} catch {
|
|
259227
259595
|
return false;
|
|
259228
259596
|
}
|
|
@@ -259230,7 +259598,7 @@ function claimedHome(out2) {
|
|
|
259230
259598
|
function previousOutput(out2) {
|
|
259231
259599
|
const keys2 = (path2) => {
|
|
259232
259600
|
try {
|
|
259233
|
-
const value2 = JSON.parse(
|
|
259601
|
+
const value2 = JSON.parse(readFileSync171(path2, "utf8"));
|
|
259234
259602
|
return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
|
|
259235
259603
|
} catch {
|
|
259236
259604
|
return [];
|
|
@@ -259265,7 +259633,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
259265
259633
|
}
|
|
259266
259634
|
const fetchedAt = (() => {
|
|
259267
259635
|
try {
|
|
259268
|
-
const m2 = JSON.parse(
|
|
259636
|
+
const m2 = JSON.parse(readFileSync171(join179(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
259269
259637
|
return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
|
|
259270
259638
|
} catch {
|
|
259271
259639
|
return void 0;
|
|
@@ -259275,7 +259643,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
259275
259643
|
let homeScreenId;
|
|
259276
259644
|
const previousIds = previousOutput(options2.out);
|
|
259277
259645
|
try {
|
|
259278
|
-
const manifest2 = JSON.parse(
|
|
259646
|
+
const manifest2 = JSON.parse(readFileSync171(join179(options2.contentDir, "himalaya.content.json"), "utf8"));
|
|
259279
259647
|
taken = new Set(Object.keys(manifest2.screens ?? {}));
|
|
259280
259648
|
if (taken.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
|
|
259281
259649
|
for (const id of previousIds) taken.delete(id);
|
|
@@ -259284,24 +259652,24 @@ async function runOneAppGenerate(args, io2) {
|
|
|
259284
259652
|
}
|
|
259285
259653
|
let result;
|
|
259286
259654
|
try {
|
|
259287
|
-
result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) =>
|
|
259655
|
+
result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync143(join179(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
|
|
259288
259656
|
} catch (error) {
|
|
259289
259657
|
if (error instanceof RecipeError) return report7(io2, false, { code: "recipe_unavailable", error: error.message });
|
|
259290
259658
|
throw error;
|
|
259291
259659
|
}
|
|
259292
259660
|
try {
|
|
259293
259661
|
mkdirSync63(dirname77(options2.out), { recursive: true });
|
|
259294
|
-
|
|
259295
|
-
|
|
259296
|
-
if (homeScreenId)
|
|
259662
|
+
writeFileSync68(options2.out, JSON.stringify(result.screens, null, 2) + "\n", "utf8");
|
|
259663
|
+
writeFileSync68(idsFile(options2.out), JSON.stringify([.../* @__PURE__ */ new Set([...previousIds, ...Object.keys(result.screens)])].sort()) + "\n", "utf8");
|
|
259664
|
+
if (homeScreenId) writeFileSync68(homeFile(options2.out), JSON.stringify({ homeScreenId }) + "\n", "utf8");
|
|
259297
259665
|
const tabsPath = tabsFileOf(options2.out);
|
|
259298
259666
|
const tabs = tabsFile(result, navigation);
|
|
259299
|
-
if (tabs)
|
|
259667
|
+
if (tabs) writeFileSync68(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
|
|
259300
259668
|
else rmSync41(tabsPath, { force: true });
|
|
259301
259669
|
for (const worker of Object.values(result.workers)) {
|
|
259302
|
-
const dir =
|
|
259670
|
+
const dir = join179(options2.contentDir, "tier5-src", worker.bundle);
|
|
259303
259671
|
mkdirSync63(dir, { recursive: true });
|
|
259304
|
-
|
|
259672
|
+
writeFileSync68(join179(dir, "index.ts"), worker.source, "utf8");
|
|
259305
259673
|
}
|
|
259306
259674
|
removeStaleGeneratedWorkers(options2.contentDir, new Set(Object.values(result.workers).map((w2) => w2.bundle)));
|
|
259307
259675
|
} catch (error) {
|
|
@@ -259341,7 +259709,24 @@ async function runOneAppGenerate(args, io2) {
|
|
|
259341
259709
|
} catch (error) {
|
|
259342
259710
|
return report7(io2, false, { code: "output_unwritable", error: `Could not write the route rows of ONE-APP-COVERAGE.json: ${error instanceof Error ? error.message : String(error)}` });
|
|
259343
259711
|
}
|
|
259344
|
-
|
|
259712
|
+
let keepList;
|
|
259713
|
+
try {
|
|
259714
|
+
const manifest2 = JSON.parse(readFileSync171(join179(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
259715
|
+
const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
|
|
259716
|
+
const generated = Object.keys(result.screens);
|
|
259717
|
+
const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
|
|
259718
|
+
keepList = writeStarterKeepList(options2.contentDir, {
|
|
259719
|
+
generated,
|
|
259720
|
+
template: [...routed, ...screensOpenedBy(result.screens)],
|
|
259721
|
+
counters: Array.isArray(badgePlan?.counters) ? badgePlan.counters.filter((c2) => typeof c2 === "string") : [],
|
|
259722
|
+
memberChat: manifest2.memberChat === true,
|
|
259723
|
+
showsInvite: sourceShowsInvite(readHashedEvidenceJson(options2.evidenceDir, "invite-plan.json")),
|
|
259724
|
+
workers: Object.values(result.workers).map((worker) => worker.source)
|
|
259725
|
+
});
|
|
259726
|
+
} catch (error) {
|
|
259727
|
+
return report7(io2, false, { code: "output_unwritable", error: `Could not write the Screen catalogue of SPEC.md: ${error instanceof Error ? error.message : String(error)}` });
|
|
259728
|
+
}
|
|
259729
|
+
const body = { starterKeepList: { path: keepList.path, created: keepList.created, added: keepList.added, closure: keepList.closure }, coverage: coverage2, templateParams, screens: Object.keys(result.screens), workers: Object.values(result.workers).map((w2) => `tier5-src/${w2.bundle}/index.ts`), routes: result.routes, tabs: result.tabs, unmapped: result.unmapped, gaps: result.gaps, evidence: { ...result.evidence, ...fetchedAt ? { fetchedAt } : {} }, out: options2.out };
|
|
259345
259730
|
if (result.unmapped.length) {
|
|
259346
259731
|
return report7(io2, false, {
|
|
259347
259732
|
code: "sections_unmapped",
|
|
@@ -259361,6 +259746,8 @@ var init_generate_cli = __esm({
|
|
|
259361
259746
|
init_provision();
|
|
259362
259747
|
init_coverage();
|
|
259363
259748
|
init_apply_navigation();
|
|
259749
|
+
init_invite_drawer();
|
|
259750
|
+
init_starter_keep_list();
|
|
259364
259751
|
GENERATE_USAGE = "himi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]";
|
|
259365
259752
|
GENERATED_WORKER_MARKER = "// Generated by `himi one-app generate`";
|
|
259366
259753
|
idsFile = (out2) => `${out2}.ids.json`;
|
|
@@ -259370,7 +259757,7 @@ var init_generate_cli = __esm({
|
|
|
259370
259757
|
});
|
|
259371
259758
|
|
|
259372
259759
|
// src/one-app/access.ts
|
|
259373
|
-
import
|
|
259760
|
+
import ts27 from "typescript";
|
|
259374
259761
|
import { createHash as createHash87 } from "node:crypto";
|
|
259375
259762
|
function gateKey(layoutItemId) {
|
|
259376
259763
|
let out2 = "g_";
|
|
@@ -259486,18 +259873,18 @@ function applyEdits(source2, edits) {
|
|
|
259486
259873
|
return out2;
|
|
259487
259874
|
}
|
|
259488
259875
|
function parse7(fileName, source2) {
|
|
259489
|
-
const file2 =
|
|
259876
|
+
const file2 = ts27.createSourceFile(fileName, source2, ts27.ScriptTarget.Latest, true, ts27.ScriptKind.TS);
|
|
259490
259877
|
return file2.parseDiagnostics.length ? void 0 : file2;
|
|
259491
259878
|
}
|
|
259492
259879
|
function screensObject(file2) {
|
|
259493
259880
|
for (const statement of file2.statements) {
|
|
259494
|
-
if (!
|
|
259881
|
+
if (!ts27.isVariableStatement(statement)) continue;
|
|
259495
259882
|
for (const declaration2 of statement.declarationList.declarations) {
|
|
259496
|
-
if (!
|
|
259883
|
+
if (!ts27.isIdentifier(declaration2.name) || declaration2.name.text !== "SCREENS" || !declaration2.initializer) continue;
|
|
259497
259884
|
let init = declaration2.initializer;
|
|
259498
|
-
while (
|
|
259499
|
-
if (
|
|
259500
|
-
if (
|
|
259885
|
+
while (ts27.isParenthesizedExpression(init) || ts27.isAsExpression(init) || ts27.isSatisfiesExpression(init)) init = init.expression;
|
|
259886
|
+
if (ts27.isCallExpression(init) && init.arguments[0] && ts27.isObjectLiteralExpression(init.arguments[0])) return init.arguments[0];
|
|
259887
|
+
if (ts27.isObjectLiteralExpression(init)) return init;
|
|
259501
259888
|
}
|
|
259502
259889
|
}
|
|
259503
259890
|
return void 0;
|
|
@@ -259507,7 +259894,7 @@ function declaredScreens(source2) {
|
|
|
259507
259894
|
const screens = file2 && screensObject(file2);
|
|
259508
259895
|
if (!screens) return void 0;
|
|
259509
259896
|
const out2 = /* @__PURE__ */ new Set();
|
|
259510
|
-
for (const property3 of screens.properties) if (
|
|
259897
|
+
for (const property3 of screens.properties) if (ts27.isPropertyAssignment(property3)) {
|
|
259511
259898
|
const name = propName5(property3.name);
|
|
259512
259899
|
if (name) out2.add(name);
|
|
259513
259900
|
}
|
|
@@ -259516,7 +259903,7 @@ function declaredScreens(source2) {
|
|
|
259516
259903
|
function payloadParts(source2, payload) {
|
|
259517
259904
|
const parts = {};
|
|
259518
259905
|
for (const property3 of payload.properties) {
|
|
259519
|
-
if (!
|
|
259906
|
+
if (!ts27.isPropertyAssignment(property3)) return void 0;
|
|
259520
259907
|
const name = propName5(property3.name);
|
|
259521
259908
|
if (!name || !PAYLOAD_KEYS.has(name)) return void 0;
|
|
259522
259909
|
parts[name] = slice(source2, property3.initializer);
|
|
@@ -259529,9 +259916,9 @@ function openCase(payload, gate, source2) {
|
|
|
259529
259916
|
if (!body || stringValue3(findProperty(body, "type")?.initializer) !== "FragmentSlot" || !props2) return "none";
|
|
259530
259917
|
if (stringValue3(findProperty(props2, "casePath")?.initializer) !== accessStatePath(gate)) return "none";
|
|
259531
259918
|
const cases = findProperty(props2, "cases")?.initializer;
|
|
259532
|
-
if (!cases || !
|
|
259919
|
+
if (!cases || !ts27.isArrayLiteralExpression(cases)) return void 0;
|
|
259533
259920
|
for (const element of cases.elements) {
|
|
259534
|
-
if (!
|
|
259921
|
+
if (!ts27.isObjectLiteralExpression(element)) continue;
|
|
259535
259922
|
if (stringValue3(findProperty(element, "id")?.initializer) !== "open") continue;
|
|
259536
259923
|
const content = objectValue(findProperty(element, "content"));
|
|
259537
259924
|
return content ? payloadParts(source2, content) : void 0;
|
|
@@ -259569,7 +259956,7 @@ function applyScreens(source2, gates, context) {
|
|
|
259569
259956
|
const conflicts = [];
|
|
259570
259957
|
const hiding = gates.filter(mayHide);
|
|
259571
259958
|
const visit = (current) => {
|
|
259572
|
-
if (
|
|
259959
|
+
if (ts27.isPropertyAssignment(current) && propName5(current.name) === "onTap" && ts27.isObjectLiteralExpression(current.initializer) && ts27.isObjectLiteralExpression(current.parent)) {
|
|
259573
259960
|
const params = objectValue(findProperty(current.initializer, "params"));
|
|
259574
259961
|
const opens = stringValue3(findProperty(current.initializer, "actionId")?.initializer) === "himi.open" ? stringValue3(params && findProperty(params, "screenId")?.initializer) : void 0;
|
|
259575
259962
|
const gate = hiding.find((item2) => item2.screenId === opens);
|
|
@@ -259581,7 +259968,7 @@ function applyScreens(source2, gates, context) {
|
|
|
259581
259968
|
} else if (stringValue3(existing.initializer) !== accessRowHiddenPath(gate)) conflicts.push(`an entry opening ${gate.screenId} already has hiddenPath ${slice(source2, existing.initializer)}`);
|
|
259582
259969
|
}
|
|
259583
259970
|
}
|
|
259584
|
-
|
|
259971
|
+
ts27.forEachChild(current, visit);
|
|
259585
259972
|
};
|
|
259586
259973
|
visit(first);
|
|
259587
259974
|
if (conflicts.length) return refuse9(conflicts.join("; "));
|
|
@@ -259592,7 +259979,7 @@ function applyScreens(source2, gates, context) {
|
|
|
259592
259979
|
const missing4 = [];
|
|
259593
259980
|
const edits = [];
|
|
259594
259981
|
for (const gate of gates) {
|
|
259595
|
-
const screen = screens.properties.find((property3) =>
|
|
259982
|
+
const screen = screens.properties.find((property3) => ts27.isPropertyAssignment(property3) && propName5(property3.name) === gate.screenId);
|
|
259596
259983
|
if (!screen) {
|
|
259597
259984
|
missing4.push(gate.screenId);
|
|
259598
259985
|
continue;
|
|
@@ -259619,7 +260006,7 @@ function applyConfig(configText, gates, options2 = {}) {
|
|
|
259619
260006
|
const navigationProperty = app2 && findProperty(app2, "navigation");
|
|
259620
260007
|
const navigation = objectValue(navigationProperty);
|
|
259621
260008
|
if (!navigation) return refuse9("config.ts has no literal `navigation: {...}` in its defineApp call");
|
|
259622
|
-
if (navigation.properties.some((property3) => !
|
|
260009
|
+
if (navigation.properties.some((property3) => !ts27.isPropertyAssignment(property3))) return refuse9("navigation has spreads or accessors, so it cannot be edited safely");
|
|
259623
260010
|
const edits = [];
|
|
259624
260011
|
const bound2 = [];
|
|
259625
260012
|
const conflicts = [];
|
|
@@ -259650,7 +260037,7 @@ ${indent}"navLogicBundle": ${indented(headerBadgesBundleRef(ACCESS_NAV_BUNDLE),
|
|
|
259650
260037
|
const appBlock = objectValue(appProperty);
|
|
259651
260038
|
const declared = appBlock && findProperty(appBlock, "newApp");
|
|
259652
260039
|
if (appProperty && !appBlock) conflicts.push("`app` in config.ts is not an object literal, so `newApp` cannot be added to it safely");
|
|
259653
|
-
else if (declared?.initializer.kind !==
|
|
260040
|
+
else if (declared?.initializer.kind !== ts27.SyntaxKind.TrueKeyword) {
|
|
259654
260041
|
if (declared) conflicts.push("`app.newApp` is declared but not `true`: the page locks need app services, which an app that already shipped older binaries cannot use yet");
|
|
259655
260042
|
else if (!options2.newApp) return { ...refuse9(NEW_APP_REASON), needsNewApp: true };
|
|
259656
260043
|
else if (appBlock) edits.push({ start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
|
|
@@ -259668,7 +260055,7 @@ ${indent}"app": { "newApp": true },` });
|
|
|
259668
260055
|
const itemsOf = (name) => {
|
|
259669
260056
|
const block = objectValue(findProperty(navigation, name));
|
|
259670
260057
|
const list4 = block && findProperty(block, "items")?.initializer;
|
|
259671
|
-
return list4 &&
|
|
260058
|
+
return list4 && ts27.isArrayLiteralExpression(list4) ? list4.elements.filter(ts27.isObjectLiteralExpression) : [];
|
|
259672
260059
|
};
|
|
259673
260060
|
const screenOf = (row2) => stringValue3(findProperty(row2, "screenId")?.initializer);
|
|
259674
260061
|
const tabs = itemsOf("tabBar");
|
|
@@ -259685,7 +260072,7 @@ ${indent}"app": { "newApp": true },` });
|
|
|
259685
260072
|
const home2 = [];
|
|
259686
260073
|
const found = /* @__PURE__ */ new Set();
|
|
259687
260074
|
const visit = (current) => {
|
|
259688
|
-
if (
|
|
260075
|
+
if (ts27.isObjectLiteralExpression(current) && findProperty(current, "label")) {
|
|
259689
260076
|
const screenId = stringValue3(findProperty(current, "screenId")?.initializer);
|
|
259690
260077
|
const gate = hiding.find((item2) => item2.screenId === screenId);
|
|
259691
260078
|
if (gate) {
|
|
@@ -259707,11 +260094,11 @@ ${indent}` });
|
|
|
259707
260094
|
edits.push({ start: existing.getStart(), end: existing.getStart(), replacement: `"hiddenUntilResolved": true,
|
|
259708
260095
|
${indent}` });
|
|
259709
260096
|
bound2.push(gate.screenId);
|
|
259710
|
-
} else if (resolved3.initializer.kind !==
|
|
260097
|
+
} else if (resolved3.initializer.kind !== ts27.SyntaxKind.TrueKeyword) conflicts.push(`the entry for ${gate.screenId} sets hiddenUntilResolved to something other than true, which would show a hidden tab before the lock is decided`);
|
|
259711
260098
|
}
|
|
259712
260099
|
}
|
|
259713
260100
|
}
|
|
259714
|
-
|
|
260101
|
+
ts27.forEachChild(current, visit);
|
|
259715
260102
|
};
|
|
259716
260103
|
visit(navigation);
|
|
259717
260104
|
if (conflicts.length) return refuse9(conflicts.join("; "));
|
|
@@ -259727,16 +260114,16 @@ function applyLoginWall(configText, wall, options2 = {}) {
|
|
|
259727
260114
|
const authProperty = app2 && findProperty(app2, "auth");
|
|
259728
260115
|
if (!authProperty) return refuse9("config.ts has no literal `auth: ...` in its defineApp call");
|
|
259729
260116
|
const init = authProperty.initializer;
|
|
259730
|
-
const wrapped =
|
|
260117
|
+
const wrapped = ts27.isCallExpression(init) && ts27.isIdentifier(init.expression) && init.expression.text === LOGIN_HELPER && init.arguments.length === 1;
|
|
259731
260118
|
if (wall === "none") {
|
|
259732
260119
|
if (wrapped && options2.keepExisting) return { status: "unchanged", text: configText, kept: true };
|
|
259733
260120
|
return wrapped ? refuse9("the app requires login (`requireLogin` in config.ts) but the source no longer does: remove it by hand, a login requirement is not taken out automatically") : { status: "unchanged", text: configText };
|
|
259734
260121
|
}
|
|
259735
260122
|
if (wrapped) return { status: "unchanged", text: configText };
|
|
259736
|
-
const declared = file2.statements.some((statement) =>
|
|
260123
|
+
const declared = file2.statements.some((statement) => ts27.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts27.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
|
|
259737
260124
|
const edits = [{ start: init.getStart(), end: init.getEnd(), replacement: `${LOGIN_HELPER}(${init.getText(file2)})` }];
|
|
259738
260125
|
if (!declared) {
|
|
259739
|
-
const imports = file2.statements.filter(
|
|
260126
|
+
const imports = file2.statements.filter(ts27.isImportDeclaration);
|
|
259740
260127
|
const at2 = imports.length ? imports[imports.length - 1].getEnd() : 0;
|
|
259741
260128
|
edits.push({ start: at2, end: at2, replacement: `
|
|
259742
260129
|
|
|
@@ -259751,14 +260138,14 @@ function tableGates(tableText) {
|
|
|
259751
260138
|
const file2 = parse7("access-gates-table.ts", tableText);
|
|
259752
260139
|
if (!file2) return void 0;
|
|
259753
260140
|
for (const statement of file2.statements) {
|
|
259754
|
-
if (!
|
|
260141
|
+
if (!ts27.isVariableStatement(statement)) continue;
|
|
259755
260142
|
for (const declaration2 of statement.declarationList.declarations) {
|
|
259756
|
-
if (!
|
|
260143
|
+
if (!ts27.isIdentifier(declaration2.name) || declaration2.name.text !== "ACCESS_GATES" || !declaration2.initializer) continue;
|
|
259757
260144
|
let init = declaration2.initializer;
|
|
259758
|
-
while (
|
|
259759
|
-
if (!
|
|
260145
|
+
while (ts27.isParenthesizedExpression(init) || ts27.isAsExpression(init) || ts27.isSatisfiesExpression(init)) init = init.expression;
|
|
260146
|
+
if (!ts27.isArrayLiteralExpression(init)) return void 0;
|
|
259760
260147
|
return init.elements.flatMap((element) => {
|
|
259761
|
-
if (!
|
|
260148
|
+
if (!ts27.isObjectLiteralExpression(element)) return [];
|
|
259762
260149
|
const key4 = stringValue3(findProperty(element, "key")?.initializer);
|
|
259763
260150
|
if (key4 === void 0) return [];
|
|
259764
260151
|
return [{ key: key4, layoutItemId: stringValue3(findProperty(element, "layoutItemId")?.initializer) ?? "", screenId: stringValue3(findProperty(element, "screenId")?.initializer) ?? "" }];
|
|
@@ -259812,8 +260199,8 @@ var init_access = __esm({
|
|
|
259812
260199
|
accessRowHiddenPath = (gate) => `$app:${NAV_SERVICE}.accessHidden.${gate.key}`;
|
|
259813
260200
|
accessHiddenPath = (gate) => `$service:${NAV_SERVICE}.accessHidden.${gate.key}`;
|
|
259814
260201
|
slice = (source2, node3) => source2.slice(node3.getStart(), node3.getEnd());
|
|
259815
|
-
stringValue3 = (node3) => node3 && (
|
|
259816
|
-
objectValue = (property3) => property3 &&
|
|
260202
|
+
stringValue3 = (node3) => node3 && (ts27.isStringLiteral(node3) || ts27.isNoSubstitutionTemplateLiteral(node3)) ? node3.text : void 0;
|
|
260203
|
+
objectValue = (property3) => property3 && ts27.isObjectLiteralExpression(property3.initializer) ? property3.initializer : void 0;
|
|
259817
260204
|
PAYLOAD_KEYS = /* @__PURE__ */ new Set(["id", "body", "modifiers"]);
|
|
259818
260205
|
indented = (value2, indent) => JSON.stringify(value2, null, 2).replaceAll("\n", `
|
|
259819
260206
|
${indent}`);
|
|
@@ -259824,8 +260211,8 @@ ${indent}`);
|
|
|
259824
260211
|
|
|
259825
260212
|
// src/one-app/access-cli.ts
|
|
259826
260213
|
import { createHash as createHash88 } from "node:crypto";
|
|
259827
|
-
import { existsSync as
|
|
259828
|
-
import { join as
|
|
260214
|
+
import { existsSync as existsSync144, readFileSync as readFileSync172, rmSync as rmSync42, statSync as statSync48, writeFileSync as writeFileSync69 } from "node:fs";
|
|
260215
|
+
import { join as join180, resolve as resolve111 } from "node:path";
|
|
259829
260216
|
function parseArgs6(args) {
|
|
259830
260217
|
let evidenceDir;
|
|
259831
260218
|
let contentDir2;
|
|
@@ -259896,7 +260283,7 @@ function parseArgs6(args) {
|
|
|
259896
260283
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
259897
260284
|
if (dryRun && check) throw new Error("--dry-run and --check are different modes: pass one.");
|
|
259898
260285
|
if (screensFile) {
|
|
259899
|
-
const parsed = JSON.parse(
|
|
260286
|
+
const parsed = JSON.parse(readFileSync172(resolve111(screensFile), "utf8"));
|
|
259900
260287
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("--screens-file must hold a JSON object of layoutItemId: screenId.");
|
|
259901
260288
|
for (const [key4, item2] of Object.entries(parsed)) {
|
|
259902
260289
|
if (typeof item2 !== "string" || !item2) throw new Error(`--screens-file: ${key4} must map to a screen id.`);
|
|
@@ -259913,7 +260300,7 @@ function report8(io2, ok5, body) {
|
|
|
259913
260300
|
function businessTitleOf(evidenceDir, given) {
|
|
259914
260301
|
if (given) return given;
|
|
259915
260302
|
try {
|
|
259916
|
-
const context = JSON.parse(
|
|
260303
|
+
const context = JSON.parse(readFileSync172(join180(evidenceDir, "business-context.json"), "utf8"));
|
|
259917
260304
|
if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
|
|
259918
260305
|
} catch {
|
|
259919
260306
|
}
|
|
@@ -259956,10 +260343,10 @@ function mapCoverage2(options2, plan, raw) {
|
|
|
259956
260343
|
return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage2, null, 2) + "\n" : void 0 };
|
|
259957
260344
|
}
|
|
259958
260345
|
function recordedLoginPolicy(evidenceDir) {
|
|
259959
|
-
const manifest2 = JSON.parse(
|
|
260346
|
+
const manifest2 = JSON.parse(readFileSync172(join180(evidenceDir, "manifest.json"), "utf8"));
|
|
259960
260347
|
const expected = manifest2.sha256?.["access-policy.json"];
|
|
259961
260348
|
if (expected === void 0) return void 0;
|
|
259962
|
-
const bytes2 =
|
|
260349
|
+
const bytes2 = readFileSync172(join180(evidenceDir, "access-policy.json"));
|
|
259963
260350
|
if (createHash88("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
|
|
259964
260351
|
const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
|
|
259965
260352
|
return typeof value2 === "boolean" ? value2 : void 0;
|
|
@@ -259984,8 +260371,8 @@ async function runOneAppAccess(args, io2) {
|
|
|
259984
260371
|
let plan;
|
|
259985
260372
|
let raw;
|
|
259986
260373
|
let recorded;
|
|
259987
|
-
const tablePath =
|
|
259988
|
-
const tableBefore =
|
|
260374
|
+
const tablePath = join180(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
|
|
260375
|
+
const tableBefore = existsSync144(tablePath) ? readFileSync172(tablePath, "utf8") : void 0;
|
|
259989
260376
|
const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
|
|
259990
260377
|
const written = writtenGates ?? [];
|
|
259991
260378
|
try {
|
|
@@ -259997,16 +260384,16 @@ async function runOneAppAccess(args, io2) {
|
|
|
259997
260384
|
}
|
|
259998
260385
|
const common2 = { unmapped: plan.unmapped, warnings: plan.warnings };
|
|
259999
260386
|
const decision = loginWallOf(options2, recorded);
|
|
260000
|
-
const configPath =
|
|
260001
|
-
const screensPath =
|
|
260002
|
-
const enginePath =
|
|
260003
|
-
const workerPath =
|
|
260387
|
+
const configPath = join180(options2.contentDir, "config.ts");
|
|
260388
|
+
const screensPath = join180(options2.contentDir, "dev", "index.ts");
|
|
260389
|
+
const enginePath = join180(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
|
|
260390
|
+
const workerPath = join180(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
|
|
260004
260391
|
let configText;
|
|
260005
260392
|
let screensText;
|
|
260006
260393
|
try {
|
|
260007
260394
|
for (const path2 of [configPath, screensPath]) if (!statSync48(path2).isFile()) throw new Error(`${path2} is not a file.`);
|
|
260008
|
-
configText =
|
|
260009
|
-
screensText =
|
|
260395
|
+
configText = readFileSync172(configPath, "utf8");
|
|
260396
|
+
screensText = readFileSync172(screensPath, "utf8");
|
|
260010
260397
|
} catch (error) {
|
|
260011
260398
|
return report8(io2, false, { code: "app_uninspectable", error: `${errorText(error)} --content must be a Himi content package with config.ts and dev/index.ts.`, ...common2 });
|
|
260012
260399
|
}
|
|
@@ -260039,7 +260426,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
260039
260426
|
error: `A locked page is mapped to another screen than the app carries: ${moved.map((m2) => `${m2.layoutItemId} was ${m2.from}, now ${m2.to}`).join("; ")}. The old screen is still wrapped in its lock: restore its original payload (the screen inside the lock's open case) and remove its gate by hand, or keep the earlier mapping.`
|
|
260040
260427
|
});
|
|
260041
260428
|
}
|
|
260042
|
-
if (hasGates && (!
|
|
260429
|
+
if (hasGates && (!existsSync144(enginePath) || !existsSync144(workerPath))) {
|
|
260043
260430
|
return report8(io2, false, {
|
|
260044
260431
|
code: "access_engine_missing",
|
|
260045
260432
|
gates: plan.gates,
|
|
@@ -260130,25 +260517,25 @@ async function runOneAppAccess(args, io2) {
|
|
|
260130
260517
|
return outOfSync.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync, ...summary2, error: "The app does not carry the source's locked pages and login requirement as they are now: run `himi one-app access` without --check." }) : plan.unmapped.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync: [], ...summary2, error: "A locked page has no Himi screen yet, so the app does not carry it: map it with --screen and run `himi one-app access`." }) : report8(io2, true, { status: "in_sync", ...summary2 });
|
|
260131
260518
|
}
|
|
260132
260519
|
if (!options2.dryRun) {
|
|
260133
|
-
const ledgerPath =
|
|
260520
|
+
const ledgerPath = join180(options2.contentDir, COVERAGE_FILE);
|
|
260134
260521
|
const writes = [
|
|
260135
260522
|
...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
|
|
260136
260523
|
{ path: configPath, before: configText, after: nextConfig },
|
|
260137
260524
|
...screensEdit?.status === "written" ? [{ path: screensPath, before: screensText, after: screensEdit.text }] : [],
|
|
260138
|
-
...coverage2.text ? [{ path: ledgerPath, before:
|
|
260525
|
+
...coverage2.text ? [{ path: ledgerPath, before: existsSync144(ledgerPath) ? readFileSync172(ledgerPath, "utf8") : void 0, after: coverage2.text }] : []
|
|
260139
260526
|
].filter((write3) => write3.before !== write3.after);
|
|
260140
260527
|
const done = [];
|
|
260141
260528
|
try {
|
|
260142
260529
|
for (const write3 of writes) {
|
|
260143
260530
|
done.push(write3);
|
|
260144
|
-
|
|
260531
|
+
writeFileSync69(write3.path, write3.after, "utf8");
|
|
260145
260532
|
}
|
|
260146
260533
|
} catch (error) {
|
|
260147
260534
|
const failed3 = [];
|
|
260148
260535
|
for (const write3 of done.reverse()) {
|
|
260149
260536
|
try {
|
|
260150
260537
|
if (write3.before === void 0) rmSync42(write3.path, { force: true });
|
|
260151
|
-
else if (!
|
|
260538
|
+
else if (!existsSync144(write3.path) || readFileSync172(write3.path, "utf8") !== write3.before) writeFileSync69(write3.path, write3.before, "utf8");
|
|
260152
260539
|
} catch {
|
|
260153
260540
|
failed3.push(write3.path);
|
|
260154
260541
|
}
|
|
@@ -260224,8 +260611,8 @@ var init_access_policy = __esm({
|
|
|
260224
260611
|
});
|
|
260225
260612
|
|
|
260226
260613
|
// src/one-app/payment-review.ts
|
|
260227
|
-
import { readFileSync as
|
|
260228
|
-
import { join as
|
|
260614
|
+
import { readFileSync as readFileSync173 } from "node:fs";
|
|
260615
|
+
import { join as join181, resolve as resolve112 } from "node:path";
|
|
260229
260616
|
function preservesUnverifiedFlow(flow) {
|
|
260230
260617
|
const checkout = obj11(flow.checkout);
|
|
260231
260618
|
return flow.payment === "online-paid" && obj11(flow.readiness).state === "unverified" && checkout.state === "supported" && text24(checkout.evidence) && (flow.decision === void 0 || obj11(flow.decision).action === "proceed");
|
|
@@ -260314,7 +260701,7 @@ function runPaymentReview(args, io2) {
|
|
|
260314
260701
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
260315
260702
|
const metaSiteId = obj11(manifest2.source).metaSiteId;
|
|
260316
260703
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
260317
|
-
const review = JSON.parse(
|
|
260704
|
+
const review = JSON.parse(readFileSync173(join181(evidenceDir, "payment-review.json"), "utf8"));
|
|
260318
260705
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
260319
260706
|
if (issues.length) return fail12("payment_decision_required", issues, 1);
|
|
260320
260707
|
const warnings = obj11(review).flows.map(obj11).filter(preservesUnverifiedFlow).map((flow) => ({
|
|
@@ -260504,10 +260891,10 @@ __export(cli_exports2, {
|
|
|
260504
260891
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
260505
260892
|
runOneAppCommand: () => runOneAppCommand
|
|
260506
260893
|
});
|
|
260507
|
-
import { closeSync as closeSync13, constants as constants12, lstatSync as lstatSync38, mkdirSync as mkdirSync64, openSync as openSync12, readFileSync as
|
|
260894
|
+
import { closeSync as closeSync13, constants as constants12, lstatSync as lstatSync38, mkdirSync as mkdirSync64, openSync as openSync12, readFileSync as readFileSync174, realpathSync as realpathSync23, writeFileSync as writeFileSync70 } from "node:fs";
|
|
260508
260895
|
import { createHash as createHash89 } from "node:crypto";
|
|
260509
260896
|
import { isIP as isIP2 } from "node:net";
|
|
260510
|
-
import { dirname as dirname78, join as
|
|
260897
|
+
import { dirname as dirname78, join as join182, parse as parse8, resolve as resolve113 } from "node:path";
|
|
260511
260898
|
function nativeSiteHost(host) {
|
|
260512
260899
|
if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
|
|
260513
260900
|
const labels = host.replace(/\.$/, "").split(".");
|
|
@@ -260577,7 +260964,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
260577
260964
|
const file2 = resolve113(cwd, flags["prompt-file"]);
|
|
260578
260965
|
const stat9 = lstatSync38(file2);
|
|
260579
260966
|
if (!stat9.isFile() || stat9.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
260580
|
-
prompt2 =
|
|
260967
|
+
prompt2 = readFileSync174(file2, "utf8");
|
|
260581
260968
|
} catch {
|
|
260582
260969
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
260583
260970
|
}
|
|
@@ -260593,7 +260980,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
260593
260980
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
260594
260981
|
}
|
|
260595
260982
|
const parentDir = resolve113(cwd, flags.dir ?? ".");
|
|
260596
|
-
const workspace =
|
|
260983
|
+
const workspace = join182(parentDir, name);
|
|
260597
260984
|
assertSafeParents(parentDir);
|
|
260598
260985
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
260599
260986
|
return { metaSiteId, appInstance, locale, prompt: prompt2, name, parentDir, workspace, target, topTabs };
|
|
@@ -260628,7 +261015,7 @@ function assertSafeParents(path2) {
|
|
|
260628
261015
|
function writePrivate(path2, contents, append) {
|
|
260629
261016
|
const fd = openSync12(path2, constants12.O_WRONLY | constants12.O_CREAT | constants12.O_NOFOLLOW | (append ? constants12.O_APPEND : constants12.O_EXCL), 384);
|
|
260630
261017
|
try {
|
|
260631
|
-
|
|
261018
|
+
writeFileSync70(fd, contents, { encoding: "utf8" });
|
|
260632
261019
|
} finally {
|
|
260633
261020
|
closeSync13(fd);
|
|
260634
261021
|
}
|
|
@@ -260715,7 +261102,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
260715
261102
|
const hashes = {};
|
|
260716
261103
|
const diskWrite = deps.writeFile ?? writePrivate;
|
|
260717
261104
|
const put = (name, content) => {
|
|
260718
|
-
const path2 =
|
|
261105
|
+
const path2 = join182(evidenceDir, name);
|
|
260719
261106
|
try {
|
|
260720
261107
|
assertSafeParents(evidenceDir);
|
|
260721
261108
|
diskWrite(path2, content, false);
|
|
@@ -260731,7 +261118,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
260731
261118
|
if (!evidenceDir) return;
|
|
260732
261119
|
try {
|
|
260733
261120
|
assertSafeParents(evidenceDir);
|
|
260734
|
-
diskWrite(
|
|
261121
|
+
diskWrite(join182(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
|
|
260735
261122
|
} catch {
|
|
260736
261123
|
throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
|
|
260737
261124
|
}
|
|
@@ -260752,7 +261139,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
260752
261139
|
assertSafeParents(options2.parentDir);
|
|
260753
261140
|
mkdirSync64(options2.workspace, { mode: 448 });
|
|
260754
261141
|
if (realpathSync23(options2.workspace) !== options2.workspace) throw new Error("destination changed");
|
|
260755
|
-
evidenceDir =
|
|
261142
|
+
evidenceDir = join182(options2.workspace, ".himi", "one-app");
|
|
260756
261143
|
mkdirSync64(evidenceDir, { recursive: true, mode: 448 });
|
|
260757
261144
|
} catch (error) {
|
|
260758
261145
|
if (error.code === "EEXIST") {
|
|
@@ -262957,35 +263344,35 @@ var init_analyze2 = __esm({
|
|
|
262957
263344
|
});
|
|
262958
263345
|
|
|
262959
263346
|
// src/site-analyze/site-pages-apply.ts
|
|
262960
|
-
import { existsSync as
|
|
262961
|
-
import { join as
|
|
262962
|
-
import
|
|
263347
|
+
import { existsSync as existsSync145, readFileSync as readFileSync175 } from "node:fs";
|
|
263348
|
+
import { join as join183 } from "node:path";
|
|
263349
|
+
import ts28 from "typescript";
|
|
262963
263350
|
function packageScreenIds(dir) {
|
|
262964
|
-
const dev =
|
|
262965
|
-
const config =
|
|
262966
|
-
if (!
|
|
263351
|
+
const dev = join183(dir, "dev", "index.ts");
|
|
263352
|
+
const config = join183(dir, "config.ts");
|
|
263353
|
+
if (!existsSync145(dev) || !existsSync145(config)) return void 0;
|
|
262967
263354
|
try {
|
|
262968
|
-
const app2 = parseApp(
|
|
263355
|
+
const app2 = parseApp(readFileSync175(dev, "utf8"), readFileSync175(config, "utf8"));
|
|
262969
263356
|
return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
|
|
262970
263357
|
} catch {
|
|
262971
263358
|
return void 0;
|
|
262972
263359
|
}
|
|
262973
263360
|
}
|
|
262974
263361
|
function spliceWebsiteDrawer(source2, site, fileName = "config.ts") {
|
|
262975
|
-
const file2 =
|
|
263362
|
+
const file2 = ts28.createSourceFile(fileName, source2, ts28.ScriptTarget.Latest, true, ts28.ScriptKind.TS);
|
|
262976
263363
|
const objectOf2 = (literal3, name) => {
|
|
262977
263364
|
if (!literal3) return void 0;
|
|
262978
263365
|
const found = lookup(literal3, name);
|
|
262979
263366
|
const value2 = found.kind === "written" ? unwrap(found.node.initializer) : void 0;
|
|
262980
|
-
return value2 &&
|
|
263367
|
+
return value2 && ts28.isObjectLiteralExpression(value2) ? value2 : void 0;
|
|
262981
263368
|
};
|
|
262982
263369
|
const navigation = objectOf2(defineAppLiteral(file2), "navigation");
|
|
262983
263370
|
if (!navigation) return { refused: "config.ts has no `navigation: { \u2026 }` object literal in its defineApp call" };
|
|
262984
263371
|
const drawer = objectOf2(navigation, "drawer");
|
|
262985
263372
|
const itemsProp = drawer ? lookup(drawer, "items") : void 0;
|
|
262986
263373
|
const items = itemsProp?.kind === "written" ? unwrap(itemsProp.node.initializer) : void 0;
|
|
262987
|
-
if (!items || !
|
|
262988
|
-
const commentAt = (pos) => (
|
|
263374
|
+
if (!items || !ts28.isArrayLiteralExpression(items)) return { refused: "`navigation.drawer.items` is not an array literal this step can rewrite" };
|
|
263375
|
+
const commentAt = (pos) => (ts28.getLeadingCommentRanges(source2, pos) ?? []).length > 0;
|
|
262989
263376
|
if (items.elements.some((element) => commentAt(element.pos)) || commentAt(items.elements.end)) {
|
|
262990
263377
|
return { refused: "`navigation.drawer.items` has comments between its rows, which rewriting the drawer would drop" };
|
|
262991
263378
|
}
|
|
@@ -263014,12 +263401,12 @@ ${indent}`);
|
|
|
263014
263401
|
}
|
|
263015
263402
|
function applySitePagesToPackage(dir, site, opts = {}) {
|
|
263016
263403
|
const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
|
|
263017
|
-
const devPath =
|
|
263018
|
-
const configPath =
|
|
263019
|
-
if (!
|
|
263404
|
+
const devPath = join183(dir, "dev", "index.ts");
|
|
263405
|
+
const configPath = join183(dir, "config.ts");
|
|
263406
|
+
if (!existsSync145(devPath) || !existsSync145(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
|
|
263020
263407
|
let existing;
|
|
263021
263408
|
try {
|
|
263022
|
-
const app2 = parseApp(
|
|
263409
|
+
const app2 = parseApp(readFileSync175(devPath, "utf8"), readFileSync175(configPath, "utf8"));
|
|
263023
263410
|
existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
|
|
263024
263411
|
} catch (e2) {
|
|
263025
263412
|
return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
|
|
@@ -263029,21 +263416,21 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
263029
263416
|
const removed = existing.filter((id) => !wanted.includes(id));
|
|
263030
263417
|
const added = wanted.filter((id) => !existing.includes(id));
|
|
263031
263418
|
const replaced = wanted.filter((id) => existing.includes(id));
|
|
263032
|
-
const probe2 = spliceWebsiteDrawer(
|
|
263419
|
+
const probe2 = spliceWebsiteDrawer(readFileSync175(configPath, "utf8"), site);
|
|
263033
263420
|
if ("refused" in probe2) return none(probe2.refused);
|
|
263034
263421
|
if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
|
|
263035
|
-
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2,
|
|
263422
|
+
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync145(join183(dir, rel2)) ? readFileSync175(join183(dir, rel2), "utf8") : void 0]));
|
|
263036
263423
|
try {
|
|
263037
263424
|
if (removed.length) removeScreens(dir, removed);
|
|
263038
263425
|
if (wanted.length) upsertScreens(dir, screens);
|
|
263039
|
-
const spliced = spliceWebsiteDrawer(
|
|
263426
|
+
const spliced = spliceWebsiteDrawer(readFileSync175(configPath, "utf8"), site);
|
|
263040
263427
|
if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
|
|
263041
|
-
if (spliced.source !==
|
|
263428
|
+
if (spliced.source !== readFileSync175(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
|
|
263042
263429
|
} catch (e2) {
|
|
263043
|
-
for (const [rel2, text25] of before) if (text25 !== void 0 &&
|
|
263430
|
+
for (const [rel2, text25] of before) if (text25 !== void 0 && readFileSync175(join183(dir, rel2), "utf8") !== text25) writeFileAtomic(join183(dir, rel2), text25);
|
|
263044
263431
|
return none(`stopped and restored every file: ${e2.message}`);
|
|
263045
263432
|
}
|
|
263046
|
-
const wrote = [...before].filter(([rel2, text25]) => text25 !== void 0 &&
|
|
263433
|
+
const wrote = [...before].filter(([rel2, text25]) => text25 !== void 0 && readFileSync175(join183(dir, rel2), "utf8") !== text25).map(([rel2]) => join183(dir, rel2));
|
|
263047
263434
|
return { added, replaced, removed, rows: probe2.rows, wrote };
|
|
263048
263435
|
}
|
|
263049
263436
|
var ANCHOR_ROWS;
|
|
@@ -263071,8 +263458,8 @@ var init_customer_build = __esm({
|
|
|
263071
263458
|
});
|
|
263072
263459
|
|
|
263073
263460
|
// src/site-analyze/apply.ts
|
|
263074
|
-
import { existsSync as
|
|
263075
|
-
import { dirname as dirname79, isAbsolute as isAbsolute17, join as
|
|
263461
|
+
import { existsSync as existsSync146, readFileSync as readFileSync176, writeFileSync as writeFileSync71, copyFileSync as copyFileSync2, mkdirSync as mkdirSync65, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
|
|
263462
|
+
import { dirname as dirname79, isAbsolute as isAbsolute17, join as join184, resolve as resolve114, sep as sep30 } from "node:path";
|
|
263076
263463
|
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
263077
263464
|
function inRepoBakeRefusal(repoRoot2, shell) {
|
|
263078
263465
|
if (isBrandable(repoRoot2, shell)) return null;
|
|
@@ -263225,16 +263612,16 @@ function sameKnownSite(previous, next) {
|
|
|
263225
263612
|
}
|
|
263226
263613
|
function buildMergedContract(options2) {
|
|
263227
263614
|
const { appDir: appDir3, packageDir, overlay } = options2;
|
|
263228
|
-
const committedPath =
|
|
263229
|
-
if (!
|
|
263615
|
+
const committedPath = join184(appDir3, "provisioning.json");
|
|
263616
|
+
if (!existsSync146(committedPath)) {
|
|
263230
263617
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
263231
263618
|
}
|
|
263232
|
-
const committed = JSON.parse(
|
|
263233
|
-
const previousPath =
|
|
263619
|
+
const committed = JSON.parse(readFileSync176(committedPath, "utf8"));
|
|
263620
|
+
const previousPath = join184(appDir3, LOCAL_CONTRACT_REL);
|
|
263234
263621
|
let evidenceOverlay = overlay;
|
|
263235
|
-
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) &&
|
|
263622
|
+
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync146(previousPath)) {
|
|
263236
263623
|
try {
|
|
263237
|
-
const previous = JSON.parse(
|
|
263624
|
+
const previous = JSON.parse(readFileSync176(previousPath, "utf8"));
|
|
263238
263625
|
if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
|
|
263239
263626
|
evidenceOverlay = {
|
|
263240
263627
|
...overlay,
|
|
@@ -263247,9 +263634,9 @@ function buildMergedContract(options2) {
|
|
|
263247
263634
|
}
|
|
263248
263635
|
}
|
|
263249
263636
|
let keepSite = options2.keepSite === true;
|
|
263250
|
-
if (!keepSite && options2.sitePageHost &&
|
|
263637
|
+
if (!keepSite && options2.sitePageHost && existsSync146(previousPath)) {
|
|
263251
263638
|
try {
|
|
263252
|
-
const carried = websiteSiteToCarry(JSON.parse(
|
|
263639
|
+
const carried = websiteSiteToCarry(JSON.parse(readFileSync176(previousPath, "utf8")), overlay);
|
|
263253
263640
|
if (carried) {
|
|
263254
263641
|
evidenceOverlay = { ...evidenceOverlay, site: carried };
|
|
263255
263642
|
keepSite = true;
|
|
@@ -263268,8 +263655,8 @@ function buildMergedContract(options2) {
|
|
|
263268
263655
|
};
|
|
263269
263656
|
const stage = (fromRel, toRel) => {
|
|
263270
263657
|
const from = contained(packageDir, fromRel);
|
|
263271
|
-
const to2 = contained(
|
|
263272
|
-
if (!from || !to2 || !
|
|
263658
|
+
const to2 = contained(join184(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
263659
|
+
if (!from || !to2 || !existsSync146(from)) return void 0;
|
|
263273
263660
|
let real;
|
|
263274
263661
|
let realRoot;
|
|
263275
263662
|
try {
|
|
@@ -263291,11 +263678,11 @@ function buildMergedContract(options2) {
|
|
|
263291
263678
|
};
|
|
263292
263679
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
263293
263680
|
if (icon) branding.appIconPath = icon;
|
|
263294
|
-
const facesPath =
|
|
263295
|
-
if (
|
|
263681
|
+
const facesPath = join184(packageDir, "media/fonts/faces.json");
|
|
263682
|
+
if (existsSync146(facesPath)) {
|
|
263296
263683
|
let faces = [];
|
|
263297
263684
|
try {
|
|
263298
|
-
const parsed = JSON.parse(
|
|
263685
|
+
const parsed = JSON.parse(readFileSync176(facesPath, "utf8"));
|
|
263299
263686
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
263300
263687
|
} catch {
|
|
263301
263688
|
faces = [];
|
|
@@ -263316,11 +263703,11 @@ function buildMergedContract(options2) {
|
|
|
263316
263703
|
merged.branding = branding;
|
|
263317
263704
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
263318
263705
|
`;
|
|
263319
|
-
const path2 =
|
|
263320
|
-
|
|
263321
|
-
const localPath2 =
|
|
263706
|
+
const path2 = join184(packageDir, "provisioning.contract.json");
|
|
263707
|
+
writeFileSync71(path2, body);
|
|
263708
|
+
const localPath2 = join184(appDir3, LOCAL_CONTRACT_REL);
|
|
263322
263709
|
mkdirSync65(dirname79(localPath2), { recursive: true });
|
|
263323
|
-
|
|
263710
|
+
writeFileSync71(localPath2, body);
|
|
263324
263711
|
staged.push(localPath2);
|
|
263325
263712
|
return { path: path2, staged };
|
|
263326
263713
|
}
|
|
@@ -263353,10 +263740,10 @@ function catalogTypography(overlay, template) {
|
|
|
263353
263740
|
function staticFaqFor(overlay, overlayPath) {
|
|
263354
263741
|
const own6 = overlay.faq;
|
|
263355
263742
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
263356
|
-
const bookPath =
|
|
263357
|
-
if (!
|
|
263743
|
+
const bookPath = join184(dirname79(resolve114(overlayPath)), "book.json");
|
|
263744
|
+
if (!existsSync146(bookPath)) return void 0;
|
|
263358
263745
|
try {
|
|
263359
|
-
const book = JSON.parse(
|
|
263746
|
+
const book = JSON.parse(readFileSync176(bookPath, "utf8"));
|
|
263360
263747
|
const copy = book?.copy;
|
|
263361
263748
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
263362
263749
|
const pairs2 = deriveStaticFaq(copy.faq);
|
|
@@ -263370,10 +263757,10 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
263370
263757
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
263371
263758
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
263372
263759
|
);
|
|
263373
|
-
const bookPath =
|
|
263374
|
-
if (!
|
|
263760
|
+
const bookPath = join184(dirname79(resolve114(overlayPath)), "book.json");
|
|
263761
|
+
if (!existsSync146(bookPath)) return void 0;
|
|
263375
263762
|
try {
|
|
263376
|
-
const book = JSON.parse(
|
|
263763
|
+
const book = JSON.parse(readFileSync176(bookPath, "utf8"));
|
|
263377
263764
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
263378
263765
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
263379
263766
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -263387,12 +263774,12 @@ async function applyOverlays(input) {
|
|
|
263387
263774
|
assertKnownShell(shell);
|
|
263388
263775
|
const pagesRefusal = input.sitePages ? sitePagesTargetRefusal({ cwd, shell }) : void 0;
|
|
263389
263776
|
if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
|
|
263390
|
-
const overlay = JSON.parse(
|
|
263777
|
+
const overlay = JSON.parse(readFileSync176(input.overlayPath, "utf8"));
|
|
263391
263778
|
const sitePages = input.sitePages === true;
|
|
263392
263779
|
const plan = input.sitePagesPlan;
|
|
263393
263780
|
const planNote = sitePages && plan ? plan.notes[0] : void 0;
|
|
263394
263781
|
const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
|
|
263395
|
-
const tokens2 = JSON.parse(
|
|
263782
|
+
const tokens2 = JSON.parse(readFileSync176(input.tokensPath, "utf8"));
|
|
263396
263783
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
263397
263784
|
if (faq !== void 0) overlay.faq = faq;
|
|
263398
263785
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -263406,15 +263793,15 @@ async function applyOverlays(input) {
|
|
|
263406
263793
|
if (repoRoot2) {
|
|
263407
263794
|
const bakeRefusal = inRepoBakeRefusal(repoRoot2, shell);
|
|
263408
263795
|
if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
|
|
263409
|
-
const appDir3 =
|
|
263410
|
-
assertOverlayNamesSite(
|
|
263796
|
+
const appDir3 = join184(repoRoot2, shellAppDir(shell));
|
|
263797
|
+
assertOverlayNamesSite(join184(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
|
|
263411
263798
|
const packageDir = dirname79(resolve114(input.overlayPath));
|
|
263412
263799
|
if (input.dryRun) {
|
|
263413
263800
|
return {
|
|
263414
263801
|
mode: "dry",
|
|
263415
263802
|
target: "in-repo",
|
|
263416
263803
|
wrote: [],
|
|
263417
|
-
wouldWrite: [
|
|
263804
|
+
wouldWrite: [join184(packageDir, "provisioning.contract.json"), join184(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
|
|
263418
263805
|
note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
|
|
263419
263806
|
...sitePagesOut()
|
|
263420
263807
|
};
|
|
@@ -263441,7 +263828,7 @@ async function applyOverlays(input) {
|
|
|
263441
263828
|
note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
|
|
263442
263829
|
};
|
|
263443
263830
|
}
|
|
263444
|
-
const pkgProv =
|
|
263831
|
+
const pkgProv = join184(cwd, "provisioning.json");
|
|
263445
263832
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
263446
263833
|
assertOverlayNamesSite(pkgProv, overlay, "this content package", "");
|
|
263447
263834
|
if (input.dryRun) {
|
|
@@ -263454,16 +263841,16 @@ async function applyOverlays(input) {
|
|
|
263454
263841
|
wrote: [],
|
|
263455
263842
|
wouldWrite: [
|
|
263456
263843
|
pkgProv,
|
|
263457
|
-
...
|
|
263458
|
-
...
|
|
263459
|
-
...touchesPackage ? [
|
|
263460
|
-
...input.iconPath &&
|
|
263844
|
+
...existsSync146(join184(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join184(cwd, "tokens.json")] : [],
|
|
263845
|
+
...existsSync146(join184(cwd, "dev/index.ts")) ? [join184(cwd, "dev/index.ts")] : [],
|
|
263846
|
+
...touchesPackage ? [join184(cwd, "config.ts"), join184(cwd, "himalaya.content.json")] : [],
|
|
263847
|
+
...input.iconPath && existsSync146(input.iconPath) ? [join184(cwd, "icon.png")] : []
|
|
263461
263848
|
],
|
|
263462
263849
|
note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
|
|
263463
263850
|
...sitePagesOut(screens)
|
|
263464
263851
|
};
|
|
263465
263852
|
}
|
|
263466
|
-
const contentPath =
|
|
263853
|
+
const contentPath = join184(cwd, "himalaya.content.json");
|
|
263467
263854
|
const syncViewNames = (before, after) => {
|
|
263468
263855
|
const content = readContentManifest(cwd);
|
|
263469
263856
|
if (!content) return;
|
|
@@ -263477,8 +263864,8 @@ async function applyOverlays(input) {
|
|
|
263477
263864
|
const recordSite = sitePages && !pagesRefused;
|
|
263478
263865
|
let packageFaq = faq;
|
|
263479
263866
|
let packageGalleries = galleries;
|
|
263480
|
-
if (
|
|
263481
|
-
const cur = JSON.parse(
|
|
263867
|
+
if (existsSync146(pkgProv)) {
|
|
263868
|
+
const cur = JSON.parse(readFileSync176(pkgProv, "utf8"));
|
|
263482
263869
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
263483
263870
|
const merged = deepMerge4(cur, overlay);
|
|
263484
263871
|
if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
|
|
@@ -263498,20 +263885,20 @@ async function applyOverlays(input) {
|
|
|
263498
263885
|
} else {
|
|
263499
263886
|
syncViewNames(cur.site, merged.site);
|
|
263500
263887
|
}
|
|
263501
|
-
|
|
263888
|
+
writeFileSync71(pkgProv, JSON.stringify(merged, null, 2) + "\n");
|
|
263502
263889
|
wrote.push(pkgProv);
|
|
263503
263890
|
} else {
|
|
263504
263891
|
if (!sitePages) syncViewNames(void 0, overlay.site);
|
|
263505
263892
|
const { site: _unrecorded, ...withoutSite } = overlay;
|
|
263506
|
-
|
|
263893
|
+
writeFileSync71(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
|
|
263507
263894
|
wrote.push(pkgProv);
|
|
263508
263895
|
}
|
|
263509
263896
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
263510
263897
|
overlay.installedVerticals.push("galleries");
|
|
263511
263898
|
}
|
|
263512
|
-
const pkgTokens =
|
|
263513
|
-
if (
|
|
263514
|
-
const cur = JSON.parse(
|
|
263899
|
+
const pkgTokens = join184(cwd, "tokens.json");
|
|
263900
|
+
if (existsSync146(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
263901
|
+
const cur = JSON.parse(readFileSync176(pkgTokens, "utf8"));
|
|
263515
263902
|
let tokensIn = tokens2;
|
|
263516
263903
|
if (tokens2.typography) {
|
|
263517
263904
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -263532,13 +263919,13 @@ async function applyOverlays(input) {
|
|
|
263532
263919
|
if (primary && glow && typeof glow.color === "string") glow.color = primary;
|
|
263533
263920
|
stripBrandFromIdiom(merged);
|
|
263534
263921
|
}
|
|
263535
|
-
|
|
263922
|
+
writeFileSync71(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
|
|
263536
263923
|
wrote.push(pkgTokens);
|
|
263537
263924
|
}
|
|
263538
263925
|
const homeAction = homeRefreshActionId(shell);
|
|
263539
|
-
const homeSrc =
|
|
263540
|
-
if (homeAction &&
|
|
263541
|
-
const prev =
|
|
263926
|
+
const homeSrc = join184(cwd, "dev/index.ts");
|
|
263927
|
+
if (homeAction && existsSync146(homeSrc)) {
|
|
263928
|
+
const prev = readFileSync176(homeSrc, "utf8");
|
|
263542
263929
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
263543
263930
|
let next = patched.src;
|
|
263544
263931
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -263566,7 +263953,7 @@ async function applyOverlays(input) {
|
|
|
263566
263953
|
}
|
|
263567
263954
|
}
|
|
263568
263955
|
if (next !== prev) {
|
|
263569
|
-
|
|
263956
|
+
writeFileSync71(homeSrc, next);
|
|
263570
263957
|
wrote.push(homeSrc);
|
|
263571
263958
|
}
|
|
263572
263959
|
if (patched.unparsed) {
|
|
@@ -263581,13 +263968,13 @@ async function applyOverlays(input) {
|
|
|
263581
263968
|
if (pages2.refused) notes.push(`website pages not added: ${pages2.refused}`);
|
|
263582
263969
|
else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
|
|
263583
263970
|
}
|
|
263584
|
-
if (!input.iconPath || !
|
|
263971
|
+
if (!input.iconPath || !existsSync146(input.iconPath)) {
|
|
263585
263972
|
const book = input.iconPath ? dirname79(dirname79(resolve114(input.iconPath))) : void 0;
|
|
263586
263973
|
notes.push(
|
|
263587
263974
|
book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
|
|
263588
263975
|
);
|
|
263589
263976
|
}
|
|
263590
|
-
if (input.iconPath &&
|
|
263977
|
+
if (input.iconPath && existsSync146(input.iconPath)) {
|
|
263591
263978
|
try {
|
|
263592
263979
|
const installed3 = await installIcon(cwd, input.iconPath, { derivePlay: true });
|
|
263593
263980
|
wrote.push(...installed3.wrote);
|
|
@@ -264638,7 +265025,7 @@ __export(cli_exports3, {
|
|
|
264638
265025
|
sitePagesRefusal: () => sitePagesRefusal,
|
|
264639
265026
|
targetIsSiteShell: () => targetIsSiteShell
|
|
264640
265027
|
});
|
|
264641
|
-
import { existsSync as
|
|
265028
|
+
import { existsSync as existsSync147, readFileSync as readFileSync177 } from "node:fs";
|
|
264642
265029
|
import { resolve as resolve115 } from "node:path";
|
|
264643
265030
|
function sitePagesRefusal(opts) {
|
|
264644
265031
|
const shell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
@@ -264728,9 +265115,9 @@ async function runSiteAnalyze(opts) {
|
|
|
264728
265115
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
264729
265116
|
const derived2 = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
264730
265117
|
const prevOverlayPath = resolve115(outDir, "provisioning.overlay.json");
|
|
264731
|
-
const prevSite =
|
|
265118
|
+
const prevSite = existsSync147(prevOverlayPath) ? (() => {
|
|
264732
265119
|
try {
|
|
264733
|
-
return JSON.parse(
|
|
265120
|
+
return JSON.parse(readFileSync177(prevOverlayPath, "utf8")).site;
|
|
264734
265121
|
} catch {
|
|
264735
265122
|
return void 0;
|
|
264736
265123
|
}
|
|
@@ -264776,7 +265163,7 @@ async function runSiteAnalyze(opts) {
|
|
|
264776
265163
|
}
|
|
264777
265164
|
const previousOverlay = resolve115(outDir, "provisioning.overlay.json");
|
|
264778
265165
|
carryOverGoals(
|
|
264779
|
-
|
|
265166
|
+
existsSync147(previousOverlay) ? readFileSync177(previousOverlay, "utf8") : void 0,
|
|
264780
265167
|
result.provisioningOverlay
|
|
264781
265168
|
);
|
|
264782
265169
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -264839,7 +265226,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
264839
265226
|
let source2;
|
|
264840
265227
|
if (opts.sourcePath) {
|
|
264841
265228
|
const p2 = resolve115(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
264842
|
-
source2 =
|
|
265229
|
+
source2 = readFileSync177(p2, "utf8");
|
|
264843
265230
|
}
|
|
264844
265231
|
let body;
|
|
264845
265232
|
if (opts.bodyRaw != null) {
|
|
@@ -264867,9 +265254,9 @@ async function runSiteFunctionCli(opts) {
|
|
|
264867
265254
|
});
|
|
264868
265255
|
}
|
|
264869
265256
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
264870
|
-
if (!
|
|
265257
|
+
if (!existsSync147(bookPath)) return void 0;
|
|
264871
265258
|
try {
|
|
264872
|
-
const book = JSON.parse(
|
|
265259
|
+
const book = JSON.parse(readFileSync177(bookPath, "utf8"));
|
|
264873
265260
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
264874
265261
|
const host = (u2) => {
|
|
264875
265262
|
try {
|
|
@@ -265041,7 +265428,7 @@ __export(site_create_exports, {
|
|
|
265041
265428
|
runSiteList: () => runSiteList,
|
|
265042
265429
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
265043
265430
|
});
|
|
265044
|
-
import { existsSync as
|
|
265431
|
+
import { existsSync as existsSync148, readFileSync as readFileSync178, writeFileSync as writeFileSync72 } from "node:fs";
|
|
265045
265432
|
import { resolve as resolvePath4 } from "node:path";
|
|
265046
265433
|
function oauthClientName(projectName) {
|
|
265047
265434
|
return `${projectName} client`;
|
|
@@ -265190,7 +265577,7 @@ async function runSiteCreate(opts) {
|
|
|
265190
265577
|
if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
|
|
265191
265578
|
return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
265192
265579
|
}
|
|
265193
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync:
|
|
265580
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync148, readFileSync: readFileSync178, writeFileSync: writeFileSync72 }) {
|
|
265194
265581
|
const msid = binding2.siteId;
|
|
265195
265582
|
const path2 = resolvePath4(target);
|
|
265196
265583
|
const committed = committedShellProvisioning(path2);
|
|
@@ -265607,7 +265994,7 @@ var init_site_oauth_client = __esm({
|
|
|
265607
265994
|
|
|
265608
265995
|
// src/site-analyze/velo-source.ts
|
|
265609
265996
|
import path from "node:path";
|
|
265610
|
-
import
|
|
265997
|
+
import ts29 from "typescript";
|
|
265611
265998
|
function applySourceEdits(source2, edits) {
|
|
265612
265999
|
const chunks = [];
|
|
265613
266000
|
let cursor = 0;
|
|
@@ -265625,13 +266012,13 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
265625
266012
|
/\b(?:IST\.[\w.-]+|eyJ[\w-]+\.[\w-]+\.[\w-]+|(?:sk|rk)_(?:live|test)_[\w-]+|gh[pousr]_[\w]+|github_pat_[\w]+|AKIA[A-Z0-9]{16})\b/g,
|
|
265626
266013
|
REDACTED2
|
|
265627
266014
|
).replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, REDACTED2).replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/'"`]+:[^\s/'"`]+@/gi, "$1[REDACTED]@").replace(/([?&](?:api[-_]?key|token|secret|password|signature)=)[^&#\s'"`]+/gi, "$1[REDACTED]");
|
|
265628
|
-
const parsed =
|
|
266015
|
+
const parsed = ts29.createSourceFile("backend.ts", source2, ts29.ScriptTarget.Latest, true);
|
|
265629
266016
|
const comments = /* @__PURE__ */ new Map();
|
|
265630
266017
|
const visitComments = (node3) => {
|
|
265631
266018
|
for (const range of [
|
|
265632
|
-
...
|
|
265633
|
-
...
|
|
265634
|
-
...
|
|
266019
|
+
...ts29.getLeadingCommentRanges(source2, node3.pos) ?? [],
|
|
266020
|
+
...ts29.getTrailingCommentRanges(source2, node3.pos) ?? [],
|
|
266021
|
+
...ts29.getTrailingCommentRanges(source2, node3.end) ?? []
|
|
265635
266022
|
]) comments.set(range.pos, range.end);
|
|
265636
266023
|
for (const child3 of node3.getChildren(parsed)) visitComments(child3);
|
|
265637
266024
|
};
|
|
@@ -265650,22 +266037,22 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
265650
266037
|
if (/^["'`][A-Za-z0-9_+/=-]{24,}["'`]$/.test(token)) return JSON.stringify(REDACTED2);
|
|
265651
266038
|
return token;
|
|
265652
266039
|
};
|
|
265653
|
-
const clean3 =
|
|
266040
|
+
const clean3 = ts29.createSourceFile("backend.ts", source2, ts29.ScriptTarget.Latest, true);
|
|
265654
266041
|
const masks = [];
|
|
265655
266042
|
const collectMasks = (node3) => {
|
|
265656
266043
|
const start = node3.getStart(clean3);
|
|
265657
|
-
if (
|
|
266044
|
+
if (ts29.isRegularExpressionLiteral(node3)) {
|
|
265658
266045
|
masks.push({ start, end: node3.end, text: " ".repeat(node3.end - start) });
|
|
265659
|
-
} else if (
|
|
266046
|
+
} else if (ts29.isStringLiteral(node3) || ts29.isTemplateLiteralToken(node3)) {
|
|
265660
266047
|
masks.push({ start, end: node3.end, text: source2.slice(start, node3.end).replace(/;/g, " ") });
|
|
265661
266048
|
}
|
|
265662
|
-
|
|
266049
|
+
ts29.forEachChild(node3, collectMasks);
|
|
265663
266050
|
};
|
|
265664
266051
|
collectMasks(clean3);
|
|
265665
266052
|
const assignmentContext = applySourceEdits(source2, masks);
|
|
265666
266053
|
const edits = [];
|
|
265667
266054
|
const visitLiterals = (node3) => {
|
|
265668
|
-
if (
|
|
266055
|
+
if (ts29.isStringLiteral(node3) || ts29.isNoSubstitutionTemplateLiteral(node3) || ts29.isTemplateExpression(node3)) {
|
|
265669
266056
|
const start = node3.getStart(clean3);
|
|
265670
266057
|
const text25 = source2.slice(start, node3.end);
|
|
265671
266058
|
const redacted = redactLiteral(text25, start);
|
|
@@ -265674,7 +266061,7 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
265674
266061
|
return;
|
|
265675
266062
|
}
|
|
265676
266063
|
}
|
|
265677
|
-
|
|
266064
|
+
ts29.forEachChild(node3, visitLiterals);
|
|
265678
266065
|
};
|
|
265679
266066
|
visitLiterals(clean3);
|
|
265680
266067
|
return applySourceEdits(source2, edits);
|
|
@@ -265713,19 +266100,19 @@ function selectVeloSource(files, request2, knownSecrets = []) {
|
|
|
265713
266100
|
selected.set(file2.path, { source: excerpt, sourceTruncated: excerpt.length < redacted.length });
|
|
265714
266101
|
remaining -= excerpt.length;
|
|
265715
266102
|
const dependencies = [];
|
|
265716
|
-
const parsed =
|
|
266103
|
+
const parsed = ts29.createSourceFile(file2.path, file2.content, ts29.ScriptTarget.Latest, true);
|
|
265717
266104
|
const specifiers = [];
|
|
265718
266105
|
const collectImports = (node3) => {
|
|
265719
266106
|
let specifier;
|
|
265720
|
-
if (
|
|
266107
|
+
if (ts29.isImportDeclaration(node3) || ts29.isExportDeclaration(node3)) {
|
|
265721
266108
|
specifier = node3.moduleSpecifier;
|
|
265722
|
-
} else if (
|
|
266109
|
+
} else if (ts29.isImportEqualsDeclaration(node3) && ts29.isExternalModuleReference(node3.moduleReference)) {
|
|
265723
266110
|
specifier = node3.moduleReference.expression;
|
|
265724
|
-
} else if (
|
|
266111
|
+
} else if (ts29.isCallExpression(node3) && (node3.expression.kind === ts29.SyntaxKind.ImportKeyword || ts29.isIdentifier(node3.expression) && node3.expression.text === "require")) {
|
|
265725
266112
|
specifier = node3.arguments[0];
|
|
265726
266113
|
}
|
|
265727
|
-
if (specifier &&
|
|
265728
|
-
|
|
266114
|
+
if (specifier && ts29.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
|
|
266115
|
+
ts29.forEachChild(node3, collectImports);
|
|
265729
266116
|
};
|
|
265730
266117
|
collectImports(parsed);
|
|
265731
266118
|
for (const specifier of specifiers) {
|
|
@@ -266058,26 +266445,26 @@ __export(capture_exports, {
|
|
|
266058
266445
|
nativeNotConfigured: () => nativeNotConfigured,
|
|
266059
266446
|
variantWidth: () => variantWidth
|
|
266060
266447
|
});
|
|
266061
|
-
import { existsSync as
|
|
266062
|
-
import { join as
|
|
266448
|
+
import { existsSync as existsSync149, mkdirSync as mkdirSync66, rmSync as rmSync43, writeFileSync as writeFileSync73 } from "node:fs";
|
|
266449
|
+
import { join as join185 } from "node:path";
|
|
266063
266450
|
import { pathToFileURL as pathToFileURL11 } from "node:url";
|
|
266064
266451
|
function variantWidth(variant) {
|
|
266065
266452
|
return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
|
|
266066
266453
|
}
|
|
266067
266454
|
function frameFile(outDir, screen, variant, surface) {
|
|
266068
266455
|
mkdirSync66(outDir, { recursive: true });
|
|
266069
|
-
return
|
|
266456
|
+
return join185(outDir, `${screen}.${variant}.${surface}.png`);
|
|
266070
266457
|
}
|
|
266071
266458
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
266072
266459
|
if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
|
|
266073
266460
|
const file2 = localPath(root, entry.mockup);
|
|
266074
|
-
if (!
|
|
266461
|
+
if (!existsSync149(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
|
|
266075
266462
|
const own6 = session ?? new MockupSession();
|
|
266076
266463
|
try {
|
|
266077
266464
|
const png = await own6.shoot(file2, variant);
|
|
266078
266465
|
const noReference = variant === "dark" && !await own6.stylesDark(file2);
|
|
266079
266466
|
const out2 = frameFile(outDir, screen, variant, "mockup");
|
|
266080
|
-
|
|
266467
|
+
writeFileSync73(out2, png);
|
|
266081
266468
|
return { surface: "mockup", screen, variant, file: out2, ...noReference ? { noReference: true } : {} };
|
|
266082
266469
|
} finally {
|
|
266083
266470
|
if (!session) await own6.close();
|
|
@@ -266103,7 +266490,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
|
|
|
266103
266490
|
const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
|
|
266104
266491
|
const out2 = /* @__PURE__ */ new Map();
|
|
266105
266492
|
if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
|
|
266106
|
-
const scratch =
|
|
266493
|
+
const scratch = join185(outDir, `.build-${variant}`);
|
|
266107
266494
|
try {
|
|
266108
266495
|
const outcome = await buildReleaseFromContent2(root, scratch, {
|
|
266109
266496
|
...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
|
|
@@ -266122,7 +266509,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
|
|
|
266122
266509
|
const r3 = (outcome.renders ?? []).find((x2) => x2.screenId === screen);
|
|
266123
266510
|
if (r3?.pngBase64) {
|
|
266124
266511
|
const file2 = frameFile(outDir, screen, variant, "web");
|
|
266125
|
-
|
|
266512
|
+
writeFileSync73(file2, Buffer.from(r3.pngBase64, "base64"));
|
|
266126
266513
|
out2.set(screen, { surface: "web", screen, variant, file: file2 });
|
|
266127
266514
|
} else {
|
|
266128
266515
|
const reason = !r3 ? "screen did not build" : r3.pngUnavailable ? "no Playwright Chromium for the web PNG" : r3.reason ?? "web render produced no PNG";
|
|
@@ -266210,9 +266597,9 @@ var init_capture = __esm({
|
|
|
266210
266597
|
|
|
266211
266598
|
// src/fidelity/judge.ts
|
|
266212
266599
|
import { spawn as spawn9 } from "node:child_process";
|
|
266213
|
-
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as
|
|
266600
|
+
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync179, rmSync as rmSync44 } from "node:fs";
|
|
266214
266601
|
import { tmpdir as tmpdir13 } from "node:os";
|
|
266215
|
-
import { basename as basename38, dirname as dirname80, join as
|
|
266602
|
+
import { basename as basename38, dirname as dirname80, join as join186, resolve as resolve116 } from "node:path";
|
|
266216
266603
|
import { fileURLToPath as fileURLToPath40 } from "node:url";
|
|
266217
266604
|
function parseVerdict(value2, captured) {
|
|
266218
266605
|
const v2 = value2;
|
|
@@ -266252,8 +266639,8 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
266252
266639
|
const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
|
|
266253
266640
|
let prompt2, schema2;
|
|
266254
266641
|
try {
|
|
266255
|
-
prompt2 =
|
|
266256
|
-
schema2 =
|
|
266642
|
+
prompt2 = readFileSync179(resolve116(judgeDir, "JUDGE.md"), "utf8");
|
|
266643
|
+
schema2 = readFileSync179(resolve116(judgeDir, "verdict.schema.json"), "utf8");
|
|
266257
266644
|
} catch (e2) {
|
|
266258
266645
|
return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
|
|
266259
266646
|
}
|
|
@@ -266262,10 +266649,10 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
266262
266649
|
"",
|
|
266263
266650
|
`Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename38(strip3)} and judge it.`
|
|
266264
266651
|
].join("\n");
|
|
266265
|
-
const cwd = mkdtempSync12(
|
|
266652
|
+
const cwd = mkdtempSync12(join186(tmpdir13(), "himi-fidelity-judge-"));
|
|
266266
266653
|
let r3;
|
|
266267
266654
|
try {
|
|
266268
|
-
copyFileSync3(strip3,
|
|
266655
|
+
copyFileSync3(strip3, join186(cwd, basename38(strip3)));
|
|
266269
266656
|
r3 = await run3("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
|
|
266270
266657
|
} catch (e2) {
|
|
266271
266658
|
return cannotTell(`the judge could not be prepared: ${e2.message}`);
|
|
@@ -266324,7 +266711,7 @@ var init_judge = __esm({
|
|
|
266324
266711
|
// src/fidelity/score.ts
|
|
266325
266712
|
import { spawn as spawn10 } from "node:child_process";
|
|
266326
266713
|
import { mkdtempSync as mkdtempSync13, rmSync as rmSync45 } from "node:fs";
|
|
266327
|
-
import { join as
|
|
266714
|
+
import { join as join187 } from "node:path";
|
|
266328
266715
|
import { tmpdir as tmpdir14 } from "node:os";
|
|
266329
266716
|
function viewportHeight(width) {
|
|
266330
266717
|
return Math.round(width * 2.165);
|
|
@@ -266346,10 +266733,10 @@ async function scorePair(aFile, bFile, opts = {}) {
|
|
|
266346
266733
|
const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run3, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
|
|
266347
266734
|
const width = Math.min(sizes[0][0], sizes[1][0]);
|
|
266348
266735
|
const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
|
|
266349
|
-
const dir = mkdtempSync13(
|
|
266736
|
+
const dir = mkdtempSync13(join187(tmpdir14(), "himi-fidelity-score-"));
|
|
266350
266737
|
try {
|
|
266351
266738
|
const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
|
|
266352
|
-
const out2 =
|
|
266739
|
+
const out2 = join187(dir, `${i2}.png`);
|
|
266353
266740
|
const mask = opts.mask ?? { top: 0, bottom: 0 };
|
|
266354
266741
|
const draw = [
|
|
266355
266742
|
...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
|
|
@@ -266390,8 +266777,8 @@ var init_score = __esm({
|
|
|
266390
266777
|
});
|
|
266391
266778
|
|
|
266392
266779
|
// ../visual-proof/evidence.mjs
|
|
266393
|
-
import { existsSync as
|
|
266394
|
-
function resolveCaptionFont({ exists: exists2 =
|
|
266780
|
+
import { existsSync as existsSync150, rmSync as rmSync46 } from "node:fs";
|
|
266781
|
+
function resolveCaptionFont({ exists: exists2 = existsSync150, env = process.env } = {}) {
|
|
266395
266782
|
if (env?.VISUAL_PROOF_FONT) return env.VISUAL_PROOF_FONT;
|
|
266396
266783
|
return CAPTION_FONT_CANDIDATES.find((p2) => exists2(p2)) ?? null;
|
|
266397
266784
|
}
|
|
@@ -266425,7 +266812,7 @@ var init_evidence = __esm({
|
|
|
266425
266812
|
|
|
266426
266813
|
// src/fidelity/strip.ts
|
|
266427
266814
|
import { mkdtempSync as mkdtempSync14, rmSync as rmSync47 } from "node:fs";
|
|
266428
|
-
import { join as
|
|
266815
|
+
import { join as join188 } from "node:path";
|
|
266429
266816
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
266430
266817
|
async function buildStrip(frames, out2, opts = {}) {
|
|
266431
266818
|
const run3 = opts.run ?? runProcess;
|
|
@@ -266434,7 +266821,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
266434
266821
|
const { pointsize, strip: strip3 } = labelMetrics(width);
|
|
266435
266822
|
const font = resolveCaptionFont();
|
|
266436
266823
|
const fontArgs = font ? ["-font", font] : [];
|
|
266437
|
-
const dir = mkdtempSync14(
|
|
266824
|
+
const dir = mkdtempSync14(join188(tmpdir15(), "himi-fidelity-strip-"));
|
|
266438
266825
|
const magick2 = async (args) => {
|
|
266439
266826
|
const r3 = await run3("magick", args);
|
|
266440
266827
|
if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
|
|
@@ -266444,7 +266831,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
266444
266831
|
for (const surface of STRIP_ORDER) {
|
|
266445
266832
|
const frame = frames.find((f2) => f2.surface === surface);
|
|
266446
266833
|
if (!frame) continue;
|
|
266447
|
-
const pane =
|
|
266834
|
+
const pane = join188(dir, `${surface}.png`);
|
|
266448
266835
|
const body = frame.file ? [frame.file, "-alpha", "remove", "-resize", `${width}x`, "-crop", `${width}x${height}+0+0`, "+repage", "-background", "white", "-gravity", "north", "-extent", `${width}x${height}`] : ["-size", `${width}x${height}`, "xc:#d9d9d9", ...fontArgs, "-fill", "#333", "-pointsize", String(Math.round(pointsize * 0.8)), "-gravity", "center", "-annotate", "+0+0", `skipped: ${frame.skipped?.reason ?? "no capture"}`];
|
|
266449
266836
|
const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
|
|
266450
266837
|
await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip3}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
|
|
@@ -266480,8 +266867,8 @@ __export(run_exports2, {
|
|
|
266480
266867
|
runId: () => runId,
|
|
266481
266868
|
unlinkableScreens: () => unlinkableScreens
|
|
266482
266869
|
});
|
|
266483
|
-
import { mkdirSync as mkdirSync67, writeFileSync as
|
|
266484
|
-
import { basename as basename39, join as
|
|
266870
|
+
import { mkdirSync as mkdirSync67, writeFileSync as writeFileSync74 } from "node:fs";
|
|
266871
|
+
import { basename as basename39, join as join189 } from "node:path";
|
|
266485
266872
|
function unlinkableScreens(config, screens, home2) {
|
|
266486
266873
|
const navigation = config?.navigation;
|
|
266487
266874
|
const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
|
|
@@ -266540,8 +266927,8 @@ async function runFidelity(root, opts = {}) {
|
|
|
266540
266927
|
if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
|
|
266541
266928
|
const variants = opts.variants?.length ? opts.variants : VARIANTS;
|
|
266542
266929
|
const run3 = opts.run ?? runId();
|
|
266543
|
-
const dir =
|
|
266544
|
-
const framesDir =
|
|
266930
|
+
const dir = join189(opts.outRoot ?? join189(root, ".himi", "fidelity"), run3);
|
|
266931
|
+
const framesDir = join189(dir, "frames");
|
|
266545
266932
|
mkdirSync67(framesDir, { recursive: true });
|
|
266546
266933
|
const session = opts.capture?.mockup ? void 0 : new MockupSession();
|
|
266547
266934
|
const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
|
|
@@ -266592,7 +266979,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
266592
266979
|
let stripFile;
|
|
266593
266980
|
let verdict;
|
|
266594
266981
|
const judged2 = frames.filter((f2) => !f2.noReference);
|
|
266595
|
-
const stripPath2 =
|
|
266982
|
+
const stripPath2 = join189(dir, `${screen}.${variant}.strip.png`);
|
|
266596
266983
|
if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
|
|
266597
266984
|
if (frames.some((f2) => f2.file)) stripFile = await strip3(frames, stripPath2);
|
|
266598
266985
|
verdict = skippedJudge(!w2?.file ? "no web render, and web is the reference for both design and parity" : frames.some((f2) => f2.noReference) ? `the mockup does not style ${variant}, and there is no native pane to compare with web` : "fewer than two captured panes, so there is nothing to compare");
|
|
@@ -266616,7 +267003,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
266616
267003
|
await native?.restore?.();
|
|
266617
267004
|
}
|
|
266618
267005
|
const report9 = { app: basename39(root), run: run3, dir, rows, status: worst(rows) };
|
|
266619
|
-
|
|
267006
|
+
writeFileSync74(join189(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
|
|
266620
267007
|
return report9;
|
|
266621
267008
|
}
|
|
266622
267009
|
function prCommentBody(report9) {
|
|
@@ -266670,15 +267057,15 @@ __export(native_exports, {
|
|
|
266670
267057
|
parseAppLocales: () => parseAppLocales,
|
|
266671
267058
|
parseNightMode: () => parseNightMode,
|
|
266672
267059
|
parsePlistArray: () => parsePlistArray,
|
|
266673
|
-
pngSize: () =>
|
|
267060
|
+
pngSize: () => pngSize4,
|
|
266674
267061
|
resumedPackages: () => resumedPackages,
|
|
266675
267062
|
runWithTimeout: () => runWithTimeout,
|
|
266676
267063
|
sameLocalOrigin: () => sameLocalOrigin,
|
|
266677
267064
|
screenLink: () => screenLink
|
|
266678
267065
|
});
|
|
266679
267066
|
import { spawn as spawn11 } from "node:child_process";
|
|
266680
|
-
import { readFileSync as
|
|
266681
|
-
import { join as
|
|
267067
|
+
import { readFileSync as readFileSync180, writeFileSync as writeFileSync75 } from "node:fs";
|
|
267068
|
+
import { join as join190 } from "node:path";
|
|
266682
267069
|
function resumedPackages(dumpsys) {
|
|
266683
267070
|
const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
|
|
266684
267071
|
if (!lines2.length) return void 0;
|
|
@@ -266708,7 +267095,7 @@ function runWithTimeout(cmd, args, timeoutMs) {
|
|
|
266708
267095
|
});
|
|
266709
267096
|
});
|
|
266710
267097
|
}
|
|
266711
|
-
function
|
|
267098
|
+
function pngSize4(buf) {
|
|
266712
267099
|
if (buf.length < 24 || buf.readUInt32BE(0) !== 2303741511) return void 0;
|
|
266713
267100
|
return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
|
|
266714
267101
|
}
|
|
@@ -266733,7 +267120,7 @@ function nativeCapture(devices, opts) {
|
|
|
266733
267120
|
return r3;
|
|
266734
267121
|
};
|
|
266735
267122
|
const gone = /* @__PURE__ */ new Set();
|
|
266736
|
-
const read2 = opts.readFile ?? ((p2) =>
|
|
267123
|
+
const read2 = opts.readFile ?? ((p2) => readFileSync180(p2));
|
|
266737
267124
|
const sleep2 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
|
|
266738
267125
|
const settleMs = opts.settleMs ?? 1e3;
|
|
266739
267126
|
const maxWaitMs = opts.maxWaitMs ?? 3e4;
|
|
@@ -266825,7 +267212,7 @@ function nativeCapture(devices, opts) {
|
|
|
266825
267212
|
const container = await run3("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
|
|
266826
267213
|
let compiled = "";
|
|
266827
267214
|
if (container.code === 0) {
|
|
266828
|
-
const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-",
|
|
267215
|
+
const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join190(container.stdout.toString().trim(), "Info.plist")]);
|
|
266829
267216
|
if (plist.code === 0) compiled = plist.stdout.toString().trim();
|
|
266830
267217
|
}
|
|
266831
267218
|
const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
|
|
@@ -266840,7 +267227,7 @@ function nativeCapture(devices, opts) {
|
|
|
266840
267227
|
}
|
|
266841
267228
|
const r3 = await run3("adb", ["-s", id, "exec-out", "screencap", "-p"]);
|
|
266842
267229
|
if (r3.code !== 0) throw new Error(`adb -s ${id} exec-out screencap -p exited ${r3.code}`);
|
|
266843
|
-
|
|
267230
|
+
writeFileSync75(file2, r3.stdout);
|
|
266844
267231
|
return r3.stdout;
|
|
266845
267232
|
}
|
|
266846
267233
|
async function notInFront(platform, id) {
|
|
@@ -266896,7 +267283,7 @@ function nativeCapture(devices, opts) {
|
|
|
266896
267283
|
}
|
|
266897
267284
|
await apply2(platform, id, variant);
|
|
266898
267285
|
await open3(platform, id, `himi://app/${encodeURIComponent(picker)}`);
|
|
266899
|
-
const file2 =
|
|
267286
|
+
const file2 = join190(outDir, `${screen}.${variant}.${platform}.png`);
|
|
266900
267287
|
const pickerFrame = (await settle2(platform, id, file2)).frame;
|
|
266901
267288
|
await open3(platform, id, screenLink(opts.appId, screen, entry, opts.release));
|
|
266902
267289
|
const { unsettled } = await settle2(platform, id, file2, pickerFrame);
|
|
@@ -266915,7 +267302,7 @@ function nativeCapture(devices, opts) {
|
|
|
266915
267302
|
continue;
|
|
266916
267303
|
}
|
|
266917
267304
|
}
|
|
266918
|
-
const size =
|
|
267305
|
+
const size = pngSize4(read2(file2));
|
|
266919
267306
|
if (size && size.width > size.height) {
|
|
266920
267307
|
frames.push({ surface: platform, screen, variant, skipped: { reason: `the ${platform} frame is landscape (${size.width}x${size.height}): turn the device upright` } });
|
|
266921
267308
|
continue;
|
|
@@ -266997,15 +267384,15 @@ __export(serve_exports, {
|
|
|
266997
267384
|
releaseProblem: () => releaseProblem,
|
|
266998
267385
|
serveWorkingCopy: () => serveWorkingCopy
|
|
266999
267386
|
});
|
|
267000
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
267387
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync151, mkdirSync as mkdirSync68, mkdtempSync as mkdtempSync15, rmSync as rmSync48 } from "node:fs";
|
|
267001
267388
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
267002
|
-
import { join as
|
|
267389
|
+
import { join as join191 } from "node:path";
|
|
267003
267390
|
function copyFreshBundles(built, outDir, into) {
|
|
267004
267391
|
mkdirSync68(into, { recursive: true });
|
|
267005
267392
|
for (const name of built) {
|
|
267006
267393
|
for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
|
|
267007
|
-
const from =
|
|
267008
|
-
if (
|
|
267394
|
+
const from = join191(outDir, file2);
|
|
267395
|
+
if (existsSync151(from)) copyFileSync4(from, join191(into, file2));
|
|
267009
267396
|
}
|
|
267010
267397
|
}
|
|
267011
267398
|
}
|
|
@@ -267021,7 +267408,7 @@ async function serveWorkingCopy(dir, port) {
|
|
|
267021
267408
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
|
|
267022
267409
|
const bundles = await buildContentBundles2(dir, {});
|
|
267023
267410
|
if (bundles.compileErrors.length) throw new Error(`the content package's workers do not compile (${bundles.compileErrors.length} error(s)); run \`himi build\` to see them`);
|
|
267024
|
-
const temp = mkdtempSync15(
|
|
267411
|
+
const temp = mkdtempSync15(join191(tmpdir16(), "himi-fidelity-serve-"));
|
|
267025
267412
|
const cleanup = () => rmSync48(temp, { recursive: true, force: true });
|
|
267026
267413
|
const onSignal = () => {
|
|
267027
267414
|
cleanup();
|
|
@@ -267030,12 +267417,12 @@ async function serveWorkingCopy(dir, port) {
|
|
|
267030
267417
|
process.once("SIGINT", onSignal);
|
|
267031
267418
|
process.once("SIGTERM", onSignal);
|
|
267032
267419
|
try {
|
|
267033
|
-
const tier5Dir = bundles.built.length > 0 ?
|
|
267420
|
+
const tier5Dir = bundles.built.length > 0 ? join191(temp, ".tier5") : void 0;
|
|
267034
267421
|
if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
|
|
267035
267422
|
const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
|
|
267036
267423
|
const unservable = releaseProblem(outcome);
|
|
267037
267424
|
if (unservable) throw new Error(unservable);
|
|
267038
|
-
const served = await runPackage(
|
|
267425
|
+
const served = await runPackage(join191(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
|
|
267039
267426
|
return { origin: served.origin, close: async () => {
|
|
267040
267427
|
await served.close();
|
|
267041
267428
|
cleanup();
|
|
@@ -267088,8 +267475,8 @@ __export(fidelity_exports, {
|
|
|
267088
267475
|
himalayaRepoRoot: () => himalayaRepoRoot
|
|
267089
267476
|
});
|
|
267090
267477
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
267091
|
-
import { existsSync as
|
|
267092
|
-
import { join as
|
|
267478
|
+
import { existsSync as existsSync152, realpathSync as realpathSync25 } from "node:fs";
|
|
267479
|
+
import { join as join192, relative as relative33, sep as sep31 } from "node:path";
|
|
267093
267480
|
function himalayaRepoRoot(dir) {
|
|
267094
267481
|
let top;
|
|
267095
267482
|
try {
|
|
@@ -267097,7 +267484,7 @@ function himalayaRepoRoot(dir) {
|
|
|
267097
267484
|
} catch {
|
|
267098
267485
|
return null;
|
|
267099
267486
|
}
|
|
267100
|
-
if (!
|
|
267487
|
+
if (!existsSync152(join192(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
267101
267488
|
const rel2 = relative33(realpathSync25(top), realpathSync25(dir));
|
|
267102
267489
|
return rel2.startsWith(`..${sep31}`) || rel2 === ".." ? null : top;
|
|
267103
267490
|
}
|
|
@@ -267107,7 +267494,7 @@ function fidelityEnvelope(report9) {
|
|
|
267107
267494
|
async function fidelityCommand(ctx) {
|
|
267108
267495
|
const { io: io2, flags, print } = ctx;
|
|
267109
267496
|
const dir = contentDir(flags);
|
|
267110
|
-
if (!
|
|
267497
|
+
if (!existsSync152(dir)) {
|
|
267111
267498
|
io2.error(failure2("fidelity_bad_flag", `content dir ${dir} does not exist`));
|
|
267112
267499
|
return 2;
|
|
267113
267500
|
}
|
|
@@ -267130,7 +267517,7 @@ async function fidelityCommand(ctx) {
|
|
|
267130
267517
|
return 2;
|
|
267131
267518
|
}
|
|
267132
267519
|
const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
|
|
267133
|
-
const judgeDir =
|
|
267520
|
+
const judgeDir = join192(repo, "tools/judges/fidelity");
|
|
267134
267521
|
const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
|
|
267135
267522
|
const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
|
|
267136
267523
|
if (bare.length) {
|
|
@@ -267236,7 +267623,7 @@ async function fidelityCommand(ctx) {
|
|
|
267236
267623
|
else {
|
|
267237
267624
|
for (const r3 of report9.rows) io2.log(`${r3.status.padEnd(4)} ${r3.screen}/${r3.variant} design=${r3.judge.design} parity=${r3.judge.parity}${r3.reasons.length ? ` \u2014 ${r3.reasons[0]}` : ""}`);
|
|
267238
267625
|
io2.log(`
|
|
267239
|
-
${report9.status.toUpperCase()} \u2014 report: ${
|
|
267626
|
+
${report9.status.toUpperCase()} \u2014 report: ${join192(report9.dir, "report.json")}`);
|
|
267240
267627
|
}
|
|
267241
267628
|
return report9.status === "fail" ? 1 : 0;
|
|
267242
267629
|
}
|
|
@@ -267325,9 +267712,9 @@ async function publishSizeCommand(ctx) {
|
|
|
267325
267712
|
return fail12("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
|
|
267326
267713
|
}
|
|
267327
267714
|
const dir = contentDir2(flags);
|
|
267328
|
-
const { existsSync:
|
|
267329
|
-
const { join:
|
|
267330
|
-
if (!
|
|
267715
|
+
const { existsSync: existsSync154 } = await import("node:fs");
|
|
267716
|
+
const { join: join194 } = await import("node:path");
|
|
267717
|
+
if (!existsSync154(join194(dir, "dev", "index.ts"))) return fail12("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
|
|
267331
267718
|
const declared = await appId3(dir);
|
|
267332
267719
|
const app2 = typeof flags.app === "string" ? flags.app : declared;
|
|
267333
267720
|
if (!isValidAppId(app2)) return fail12("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
|
|
@@ -267439,9 +267826,9 @@ __export(ext_impl_exports, {
|
|
|
267439
267826
|
addExtensionToConfigSource: () => addExtensionToConfigSource,
|
|
267440
267827
|
runExt: () => runExt
|
|
267441
267828
|
});
|
|
267442
|
-
import { existsSync as
|
|
267443
|
-
import { join as
|
|
267444
|
-
import
|
|
267829
|
+
import { existsSync as existsSync153, mkdirSync as mkdirSync69, readFileSync as readFileSync181, writeFileSync as writeFileSync76 } from "node:fs";
|
|
267830
|
+
import { join as join193 } from "node:path";
|
|
267831
|
+
import ts30 from "typescript";
|
|
267445
267832
|
async function runExt(ctx) {
|
|
267446
267833
|
const { pos, flags, io: io2, print } = ctx;
|
|
267447
267834
|
const fail12 = (code2, error, extra = {}, exit = 1) => {
|
|
@@ -267471,8 +267858,8 @@ async function runExt(ctx) {
|
|
|
267471
267858
|
hint: `run \`himi capabilities ${catalogId}\` for how to use it, or pass --force to create the extension anyway`
|
|
267472
267859
|
}, 2);
|
|
267473
267860
|
}
|
|
267474
|
-
const configPath =
|
|
267475
|
-
if (!
|
|
267861
|
+
const configPath = join193(dir, "config.ts");
|
|
267862
|
+
if (!existsSync153(configPath)) return fail12("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
|
|
267476
267863
|
const declared = declaredExtensions(dir);
|
|
267477
267864
|
if (declared.kind === "opaque") {
|
|
267478
267865
|
return fail12("extensions_config_opaque", "config.ts `extensions` is not a literal array of names, so it cannot be edited safely; add the name to it by hand", { extension: name });
|
|
@@ -267480,8 +267867,8 @@ async function runExt(ctx) {
|
|
|
267480
267867
|
if (!declared.names.includes(name) && declared.names.length >= MAX_EXTENSIONS) {
|
|
267481
267868
|
return fail12("extension_limit", `an app may declare at most ${MAX_EXTENSIONS} extensions`, { limit: MAX_EXTENSIONS });
|
|
267482
267869
|
}
|
|
267483
|
-
const extDir =
|
|
267484
|
-
if (
|
|
267870
|
+
const extDir = join193(dir, EXTENSIONS_DIR, name);
|
|
267871
|
+
if (existsSync153(extDir)) return fail12("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
|
|
267485
267872
|
const views = [str3(flags.views), str3(flags.view)].filter(Boolean).flatMap((v2) => v2.split(",")).map((v2) => v2.trim()).filter(Boolean);
|
|
267486
267873
|
const badView = views.find((v2) => !isValidViewName(v2) || CORE_TYPE_NAMES.has(v2));
|
|
267487
267874
|
if (badView) {
|
|
@@ -267490,9 +267877,9 @@ async function runExt(ctx) {
|
|
|
267490
267877
|
const pascal2 = pascalName(name);
|
|
267491
267878
|
const files = [];
|
|
267492
267879
|
const put = (rel2, text25) => {
|
|
267493
|
-
const path2 =
|
|
267494
|
-
mkdirSync69(
|
|
267495
|
-
|
|
267880
|
+
const path2 = join193(extDir, rel2);
|
|
267881
|
+
mkdirSync69(join193(path2, ".."), { recursive: true });
|
|
267882
|
+
writeFileSync76(path2, text25, { flag: "wx" });
|
|
267496
267883
|
files.push(`${EXTENSIONS_DIR}/${name}/${rel2}`);
|
|
267497
267884
|
};
|
|
267498
267885
|
put(EXTENSION_MANIFEST, `${JSON.stringify({
|
|
@@ -267548,14 +267935,14 @@ async function runExt(ctx) {
|
|
|
267548
267935
|
return 0;
|
|
267549
267936
|
}
|
|
267550
267937
|
function loadModelFor(extDir) {
|
|
267551
|
-
const parsed = parseExtensionManifest(JSON.parse(
|
|
267938
|
+
const parsed = parseExtensionManifest(JSON.parse(readFileSync181(join193(extDir, EXTENSION_MANIFEST), "utf8")));
|
|
267552
267939
|
if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
|
|
267553
|
-
const iface = parseExtensionInterface(
|
|
267940
|
+
const iface = parseExtensionInterface(readFileSync181(join193(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
|
|
267554
267941
|
if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
|
|
267555
267942
|
return { ok: true, model: iface.model };
|
|
267556
267943
|
}
|
|
267557
267944
|
function addExtensionToConfigSource(source2, name) {
|
|
267558
|
-
const file2 =
|
|
267945
|
+
const file2 = ts30.createSourceFile("config.ts", source2, ts30.ScriptTarget.ES2022, true, ts30.ScriptKind.TS);
|
|
267559
267946
|
const app2 = defineAppLiteral(file2);
|
|
267560
267947
|
if (!app2) throw new Error("config.ts has no defineApp({ \u2026 }) literal");
|
|
267561
267948
|
const existing = declaredExtensionsNode(app2);
|
|
@@ -267573,12 +267960,12 @@ function addExtensionToConfigSource(source2, name) {
|
|
|
267573
267960
|
}
|
|
267574
267961
|
function declaredExtensionsNode(app2) {
|
|
267575
267962
|
for (const p2 of app2.properties) {
|
|
267576
|
-
if (
|
|
267963
|
+
if (ts30.isPropertyAssignment(p2) && p2.name && (ts30.isIdentifier(p2.name) || ts30.isStringLiteral(p2.name)) && p2.name.text === "extensions" && ts30.isArrayLiteralExpression(p2.initializer)) return p2.initializer;
|
|
267577
267964
|
}
|
|
267578
267965
|
return void 0;
|
|
267579
267966
|
}
|
|
267580
267967
|
function addToConfig(configPath, name) {
|
|
267581
|
-
writeFileAtomic(configPath, addExtensionToConfigSource(
|
|
267968
|
+
writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync181(configPath, "utf8"), name));
|
|
267582
267969
|
}
|
|
267583
267970
|
function listExtensions(dir, print) {
|
|
267584
267971
|
const prepared = prepareExtensions(dir, { write: false });
|
|
@@ -271665,8 +272052,8 @@ function pushAuthHint(status, token, target, hasOwnerIssuer = true) {
|
|
|
271665
272052
|
}
|
|
271666
272053
|
async function contentVisibility(dir) {
|
|
271667
272054
|
try {
|
|
271668
|
-
const { readFileSync:
|
|
271669
|
-
const m2 = JSON.parse(
|
|
272055
|
+
const { readFileSync: readFileSync182 } = await import("node:fs");
|
|
272056
|
+
const m2 = JSON.parse(readFileSync182(join141(dir, "himalaya.content.json"), "utf8"));
|
|
271670
272057
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
271671
272058
|
} catch {
|
|
271672
272059
|
}
|