@wix/himalaya-cli 0.1701.0 → 0.1702.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/site-shell.d.ts +10 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +5 -5
- package/dist/cli.mjs +841 -254
- package/guides/himi-json-output.md +12 -0
- package/guides/release-notes.md +16 -0
- package/guides/wix-business-context.md +27 -2
- package/guides/wix-site-to-himi-app.md +2 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -3836,7 +3836,14 @@ function isSiteShell(name) {
|
|
|
3836
3836
|
assertKnownShell(name);
|
|
3837
3837
|
return SITE_SHELLS.has(name);
|
|
3838
3838
|
}
|
|
3839
|
-
|
|
3839
|
+
function isSitePageHost(name) {
|
|
3840
|
+
assertKnownShell(name);
|
|
3841
|
+
return SITE_PAGE_HOSTS.has(name);
|
|
3842
|
+
}
|
|
3843
|
+
function sitePageHosts() {
|
|
3844
|
+
return [...SITE_PAGE_HOSTS];
|
|
3845
|
+
}
|
|
3846
|
+
var SHELL_NAMES, DEFAULT_BRANDABLE_SHELL, HOME_REFRESH_ACTIONS, SITE_SHELLS, SITE_PAGE_HOSTS;
|
|
3840
3847
|
var init_brandable_shells = __esm({
|
|
3841
3848
|
"src/brandable-shells.ts"() {
|
|
3842
3849
|
init_define_HHP_CATALOG();
|
|
@@ -3847,6 +3854,7 @@ var init_brandable_shells = __esm({
|
|
|
3847
3854
|
"branded-lite": "tier5.himiBrandedHome.refresh"
|
|
3848
3855
|
};
|
|
3849
3856
|
SITE_SHELLS = /* @__PURE__ */ new Set(["brandy"]);
|
|
3857
|
+
SITE_PAGE_HOSTS = /* @__PURE__ */ new Set(["branded-lite"]);
|
|
3850
3858
|
}
|
|
3851
3859
|
});
|
|
3852
3860
|
|
|
@@ -9904,8 +9912,8 @@ function tsExtResolvePlugin() {
|
|
|
9904
9912
|
setup(b3) {
|
|
9905
9913
|
b3.onResolve({ filter: /\.js$/ }, (args) => {
|
|
9906
9914
|
if (args.kind === "entry-point" || !args.path.startsWith(".")) return void 0;
|
|
9907
|
-
const
|
|
9908
|
-
return existsSync11(
|
|
9915
|
+
const ts25 = resolve10(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
|
|
9916
|
+
return existsSync11(ts25) ? { path: ts25 } : void 0;
|
|
9909
9917
|
});
|
|
9910
9918
|
}
|
|
9911
9919
|
};
|
|
@@ -10668,7 +10676,7 @@ function bundleFor(file2) {
|
|
|
10668
10676
|
const match = /^tier5-src\/([^/]+)\//.exec(file2);
|
|
10669
10677
|
return match?.[1] ?? "_shared";
|
|
10670
10678
|
}
|
|
10671
|
-
function toIssue(
|
|
10679
|
+
function toIssue(ts25, contentDir2, diagnostic) {
|
|
10672
10680
|
const file2 = diagnostic.file ? relativeFile(contentDir2, diagnostic.file.fileName) : void 0;
|
|
10673
10681
|
const position = diagnostic.file && diagnostic.start !== void 0 ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : void 0;
|
|
10674
10682
|
return {
|
|
@@ -10676,13 +10684,13 @@ function toIssue(ts24, contentDir2, diagnostic) {
|
|
|
10676
10684
|
...file2 ? { file: file2 } : {},
|
|
10677
10685
|
...position ? { line: position.line + 1, column: position.character + 1 } : {},
|
|
10678
10686
|
code: `TS${diagnostic.code}`,
|
|
10679
|
-
message:
|
|
10687
|
+
message: ts25.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
10680
10688
|
};
|
|
10681
10689
|
}
|
|
10682
|
-
function confinedHost(
|
|
10690
|
+
function confinedHost(ts25, contentDir2, options2) {
|
|
10683
10691
|
if (!buildConfinementRequired()) return void 0;
|
|
10684
|
-
const host =
|
|
10685
|
-
const libDir = resolve12(
|
|
10692
|
+
const host = ts25.createCompilerHost(options2);
|
|
10693
|
+
const libDir = resolve12(ts25.getDefaultLibFilePath(options2), "..");
|
|
10686
10694
|
const allows = confinementMatcher(contentDir2, [libDir]);
|
|
10687
10695
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
10688
10696
|
const readFile21 = host.readFile.bind(host);
|
|
@@ -10711,7 +10719,7 @@ function confinedHost(ts24, contentDir2, options2) {
|
|
|
10711
10719
|
}
|
|
10712
10720
|
async function typecheckContentWorkers(contentDir2, options2) {
|
|
10713
10721
|
if (!existsSync12(resolve12(contentDir2, "tier5-src"))) return [];
|
|
10714
|
-
const
|
|
10722
|
+
const ts25 = await compiler2();
|
|
10715
10723
|
const config = {
|
|
10716
10724
|
compilerOptions: {
|
|
10717
10725
|
...CONTENT_WORKER_COMPILER_OPTIONS,
|
|
@@ -10720,18 +10728,18 @@ async function typecheckContentWorkers(contentDir2, options2) {
|
|
|
10720
10728
|
// The deployed authoring runtime stages TypeScript 6, which requires an explicit
|
|
10721
10729
|
// acknowledgement for this compatibility `baseUrl`; the repository's TypeScript 5 lane
|
|
10722
10730
|
// rejects that 6.0 value, so keep it specific to the compiler that needs it.
|
|
10723
|
-
...Number.parseInt(
|
|
10731
|
+
...Number.parseInt(ts25.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
|
|
10724
10732
|
},
|
|
10725
10733
|
include: ["tier5-src/*/index.ts", "tier5-src/_shared/**/*.ts"]
|
|
10726
10734
|
};
|
|
10727
|
-
const parsed =
|
|
10735
|
+
const parsed = ts25.parseJsonConfigFileContent(config, ts25.sys, contentDir2);
|
|
10728
10736
|
if (parsed.fileNames.length === 0) return [];
|
|
10729
|
-
const program =
|
|
10737
|
+
const program = ts25.createProgram({
|
|
10730
10738
|
rootNames: parsed.fileNames,
|
|
10731
10739
|
options: parsed.options,
|
|
10732
|
-
host: confinedHost(
|
|
10740
|
+
host: confinedHost(ts25, contentDir2, parsed.options)
|
|
10733
10741
|
});
|
|
10734
|
-
return [...parsed.errors, ...
|
|
10742
|
+
return [...parsed.errors, ...ts25.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts25.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts25, contentDir2, diagnostic));
|
|
10735
10743
|
}
|
|
10736
10744
|
var compilerPromise;
|
|
10737
10745
|
var init_tier5_typecheck = __esm({
|
|
@@ -24004,22 +24012,22 @@ var init_pixels = __esm({
|
|
|
24004
24012
|
});
|
|
24005
24013
|
|
|
24006
24014
|
// ../../core/dev-server/src/declared-navigation-ast.ts
|
|
24007
|
-
function fixedNavigations(bundleJs,
|
|
24008
|
-
literalTargets(bundleJs,
|
|
24015
|
+
function fixedNavigations(bundleJs, ts25) {
|
|
24016
|
+
literalTargets(bundleJs, ts25);
|
|
24009
24017
|
return fixedCache.get(bundleJs) ?? /* @__PURE__ */ new Map();
|
|
24010
24018
|
}
|
|
24011
|
-
function literalTargets(bundleJs,
|
|
24012
|
-
const name = (n2) => n2 && (
|
|
24019
|
+
function literalTargets(bundleJs, ts25) {
|
|
24020
|
+
const name = (n2) => n2 && (ts25.isIdentifier(n2) || ts25.isStringLiteral(n2) || ts25.isNoSubstitutionTemplateLiteral(n2)) ? n2.text : void 0;
|
|
24013
24021
|
const object16 = (n2) => {
|
|
24014
|
-
while (n2 &&
|
|
24015
|
-
return n2 &&
|
|
24022
|
+
while (n2 && ts25.isParenthesizedExpression(n2)) n2 = n2.expression;
|
|
24023
|
+
return n2 && ts25.isObjectLiteralExpression(n2) ? n2 : void 0;
|
|
24016
24024
|
};
|
|
24017
24025
|
const property3 = (o2, key4) => o2?.properties.find((p2) => name(p2.name) === key4);
|
|
24018
|
-
const initializer = (p2) => p2 &&
|
|
24019
|
-
const callable = (n2) => !!n2 && (
|
|
24026
|
+
const initializer = (p2) => p2 && ts25.isPropertyAssignment(p2) ? p2.initializer : void 0;
|
|
24027
|
+
const callable = (n2) => !!n2 && (ts25.isArrowFunction(n2) || ts25.isFunctionExpression(n2) || ts25.isFunctionDeclaration(n2) || ts25.isMethodDeclaration(n2));
|
|
24020
24028
|
const cached3 = cache.get(bundleJs);
|
|
24021
24029
|
if (cached3) return cached3;
|
|
24022
|
-
const file2 =
|
|
24030
|
+
const file2 = ts25.createSourceFile("himi-bundle.js", bundleJs, ts25.ScriptTarget.Latest, true, ts25.ScriptKind.JS);
|
|
24023
24031
|
const symbols = /* @__PURE__ */ new Map();
|
|
24024
24032
|
const note = (key4, fn2) => {
|
|
24025
24033
|
if (!key4) return;
|
|
@@ -24027,16 +24035,16 @@ function literalTargets(bundleJs, ts24) {
|
|
|
24027
24035
|
symbols.set(key4, { count: (prior?.count ?? 0) + 1, fn: fn2 });
|
|
24028
24036
|
};
|
|
24029
24037
|
const declarations = (node3) => {
|
|
24030
|
-
if (
|
|
24031
|
-
else if (
|
|
24032
|
-
else if (
|
|
24033
|
-
else if (
|
|
24034
|
-
|
|
24038
|
+
if (ts25.isFunctionDeclaration(node3)) note(name(node3.name), node3);
|
|
24039
|
+
else if (ts25.isVariableDeclaration(node3)) note(name(node3.name), callable(node3.initializer) ? node3.initializer : void 0);
|
|
24040
|
+
else if (ts25.isParameter(node3)) note(name(node3.name));
|
|
24041
|
+
else if (ts25.isBindingElement(node3)) note(name(node3.name));
|
|
24042
|
+
ts25.forEachChild(node3, declarations);
|
|
24035
24043
|
};
|
|
24036
24044
|
declarations(file2);
|
|
24037
24045
|
const resolve116 = (node3) => {
|
|
24038
24046
|
if (callable(node3)) return node3;
|
|
24039
|
-
if (node3 &&
|
|
24047
|
+
if (node3 && ts25.isIdentifier(node3)) {
|
|
24040
24048
|
const symbol = symbols.get(node3.text);
|
|
24041
24049
|
if (symbol?.count === 1) return symbol.fn;
|
|
24042
24050
|
}
|
|
@@ -24050,9 +24058,9 @@ function literalTargets(bundleJs, ts24) {
|
|
|
24050
24058
|
const nav = {};
|
|
24051
24059
|
for (const p2 of o2.properties) {
|
|
24052
24060
|
const key4 = name(p2.name);
|
|
24053
|
-
if (!
|
|
24054
|
-
if (
|
|
24055
|
-
else if (key4 === "reset" && p2.initializer.kind ===
|
|
24061
|
+
if (!ts25.isPropertyAssignment(p2) || !key4 || !NAV_KEYS.has(key4)) return void 0;
|
|
24062
|
+
if (ts25.isStringLiteralLike(p2.initializer) && p2.initializer.text) nav[key4] = p2.initializer.text;
|
|
24063
|
+
else if (key4 === "reset" && p2.initializer.kind === ts25.SyntaxKind.TrueKeyword) nav[key4] = true;
|
|
24056
24064
|
else return void 0;
|
|
24057
24065
|
}
|
|
24058
24066
|
const { screenId, presentation, tab, reset } = nav;
|
|
@@ -24063,75 +24071,75 @@ function literalTargets(bundleJs, ts24) {
|
|
|
24063
24071
|
};
|
|
24064
24072
|
const assigned = /* @__PURE__ */ new Set();
|
|
24065
24073
|
const assignedNames = (n2) => {
|
|
24066
|
-
if (
|
|
24067
|
-
else
|
|
24074
|
+
if (ts25.isIdentifier(n2)) assigned.add(n2.text);
|
|
24075
|
+
else ts25.forEachChild(n2, assignedNames);
|
|
24068
24076
|
};
|
|
24069
24077
|
const assignments = (n2) => {
|
|
24070
|
-
if (
|
|
24071
|
-
else if ((
|
|
24072
|
-
else if ((
|
|
24073
|
-
|
|
24078
|
+
if (ts25.isBinaryExpression(n2) && n2.operatorToken.kind >= ts25.SyntaxKind.FirstAssignment && n2.operatorToken.kind <= ts25.SyntaxKind.LastAssignment) assignedNames(n2.left);
|
|
24079
|
+
else if ((ts25.isPrefixUnaryExpression(n2) || ts25.isPostfixUnaryExpression(n2)) && (n2.operator === ts25.SyntaxKind.PlusPlusToken || n2.operator === ts25.SyntaxKind.MinusMinusToken)) assignedNames(n2.operand);
|
|
24080
|
+
else if ((ts25.isForOfStatement(n2) || ts25.isForInStatement(n2)) && !ts25.isVariableDeclarationList(n2.initializer)) assignedNames(n2.initializer);
|
|
24081
|
+
ts25.forEachChild(n2, assignments);
|
|
24074
24082
|
};
|
|
24075
24083
|
assignments(file2);
|
|
24076
24084
|
const plain3 = (fn2) => {
|
|
24077
|
-
const modifiers =
|
|
24078
|
-
return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind ===
|
|
24085
|
+
const modifiers = ts25.canHaveModifiers(fn2) ? ts25.getModifiers(fn2) ?? [] : [];
|
|
24086
|
+
return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind === ts25.SyntaxKind.AsyncKeyword);
|
|
24079
24087
|
};
|
|
24080
24088
|
const plainParams = (fn2) => {
|
|
24081
24089
|
const names2 = /* @__PURE__ */ new Set();
|
|
24082
24090
|
for (const p2 of fn2.parameters) {
|
|
24083
|
-
if (!
|
|
24091
|
+
if (!ts25.isIdentifier(p2.name) || p2.initializer || p2.dotDotDotToken) return void 0;
|
|
24084
24092
|
names2.add(p2.name.text);
|
|
24085
24093
|
}
|
|
24086
24094
|
return names2;
|
|
24087
24095
|
};
|
|
24088
24096
|
const provenSafe = (expr, params) => {
|
|
24089
|
-
while (
|
|
24090
|
-
if (
|
|
24091
|
-
if (expr.kind ===
|
|
24092
|
-
if (
|
|
24093
|
-
if (
|
|
24094
|
-
return expr.elements.every((e2) => !
|
|
24095
|
-
}
|
|
24096
|
-
if (
|
|
24097
|
+
while (ts25.isParenthesizedExpression(expr)) expr = expr.expression;
|
|
24098
|
+
if (ts25.isStringLiteral(expr) || ts25.isNoSubstitutionTemplateLiteral(expr) || ts25.isNumericLiteral(expr)) return true;
|
|
24099
|
+
if (expr.kind === ts25.SyntaxKind.TrueKeyword || expr.kind === ts25.SyntaxKind.FalseKeyword || expr.kind === ts25.SyntaxKind.NullKeyword) return true;
|
|
24100
|
+
if (ts25.isIdentifier(expr)) return params.has(expr.text);
|
|
24101
|
+
if (ts25.isArrayLiteralExpression(expr)) {
|
|
24102
|
+
return expr.elements.every((e2) => !ts25.isSpreadElement(e2) && !ts25.isOmittedExpression(e2) && provenSafe(e2, params));
|
|
24103
|
+
}
|
|
24104
|
+
if (ts25.isObjectLiteralExpression(expr)) return expr.properties.every((p2) => safeProperty(p2, params));
|
|
24097
24105
|
return false;
|
|
24098
24106
|
};
|
|
24099
24107
|
const safeProperty = (p2, params) => {
|
|
24100
|
-
if (
|
|
24101
|
-
if (
|
|
24102
|
-
if (
|
|
24108
|
+
if (ts25.isSpreadAssignment(p2)) return provenSafe(p2.expression, params);
|
|
24109
|
+
if (ts25.isPropertyAssignment(p2)) return !ts25.isComputedPropertyName(p2.name) && provenSafe(p2.initializer, params);
|
|
24110
|
+
if (ts25.isShorthandPropertyAssignment(p2)) return params.has(p2.name.text) && !p2.objectAssignmentInitializer;
|
|
24103
24111
|
return false;
|
|
24104
24112
|
};
|
|
24105
24113
|
const isNavigateHelper = (callee) => {
|
|
24106
|
-
if (!
|
|
24114
|
+
if (!ts25.isIdentifier(callee) || !/^navigate[0-9]*$/.test(callee.text) || assigned.has(callee.text)) return false;
|
|
24107
24115
|
const symbol = symbols.get(callee.text);
|
|
24108
24116
|
const helper = symbol?.count === 1 ? symbol.fn : void 0;
|
|
24109
24117
|
if (!helper?.body || !plain3(helper) || helper.parameters.length !== 2 || !plainParams(helper)) return false;
|
|
24110
24118
|
const [stateParam, navParam] = helper.parameters.map((p2) => name(p2.name));
|
|
24111
|
-
const body =
|
|
24119
|
+
const body = ts25.isBlock(helper.body) ? helper.body.statements.length === 1 && ts25.isReturnStatement(helper.body.statements[0]) ? helper.body.statements[0].expression : void 0 : helper.body;
|
|
24112
24120
|
const o2 = object16(body);
|
|
24113
24121
|
if (!o2 || o2.properties.length !== 2 || !stateParam || !navParam) return false;
|
|
24114
24122
|
const [spread, nav] = o2.properties;
|
|
24115
|
-
return
|
|
24123
|
+
return ts25.isSpreadAssignment(spread) && ts25.isIdentifier(spread.expression) && spread.expression.text === stateParam && ts25.isPropertyAssignment(nav) && name(nav.name) === "_nav" && ts25.isIdentifier(nav.initializer) && nav.initializer.text === navParam;
|
|
24116
24124
|
};
|
|
24117
24125
|
const fixedOf = (fn2) => {
|
|
24118
24126
|
const params = plainParams(fn2);
|
|
24119
24127
|
if (!fn2.body || !plain3(fn2) || !params) return void 0;
|
|
24120
24128
|
let result = void 0;
|
|
24121
|
-
if (
|
|
24129
|
+
if (ts25.isBlock(fn2.body)) {
|
|
24122
24130
|
const [only, ...rest] = fn2.body.statements;
|
|
24123
|
-
if (!only || rest.length > 0 || !
|
|
24131
|
+
if (!only || rest.length > 0 || !ts25.isReturnStatement(only)) return void 0;
|
|
24124
24132
|
result = only.expression;
|
|
24125
24133
|
} else result = fn2.body;
|
|
24126
|
-
while (result &&
|
|
24134
|
+
while (result && ts25.isParenthesizedExpression(result)) result = result.expression;
|
|
24127
24135
|
let navNode;
|
|
24128
|
-
if (result &&
|
|
24136
|
+
if (result && ts25.isObjectLiteralExpression(result)) {
|
|
24129
24137
|
const props2 = result.properties;
|
|
24130
24138
|
const lastProp = props2[props2.length - 1];
|
|
24131
|
-
if (!lastProp || !
|
|
24139
|
+
if (!lastProp || !ts25.isPropertyAssignment(lastProp) || ts25.isComputedPropertyName(lastProp.name) || name(lastProp.name) !== "_nav") return void 0;
|
|
24132
24140
|
if (!props2.slice(0, -1).every((p2) => safeProperty(p2, params))) return void 0;
|
|
24133
24141
|
navNode = lastProp.initializer;
|
|
24134
|
-
} else if (result &&
|
|
24142
|
+
} else if (result && ts25.isCallExpression(result) && result.arguments.length === 2 && isNavigateHelper(result.expression)) {
|
|
24135
24143
|
if (!provenSafe(result.arguments[0], params)) return void 0;
|
|
24136
24144
|
navNode = result.arguments[1];
|
|
24137
24145
|
}
|
|
@@ -24141,58 +24149,58 @@ function literalTargets(bundleJs, ts24) {
|
|
|
24141
24149
|
return { nav, line: position.line + 1, column: position.character };
|
|
24142
24150
|
};
|
|
24143
24151
|
const visit = (node3) => {
|
|
24144
|
-
if (
|
|
24145
|
-
const callee =
|
|
24152
|
+
if (ts25.isCallExpression(node3)) {
|
|
24153
|
+
const callee = ts25.isPropertyAccessExpression(node3.expression) ? node3.expression.name.text : name(node3.expression);
|
|
24146
24154
|
const service = node3.arguments[0];
|
|
24147
|
-
if (callee && /^defineService[0-9]*$/.test(callee) && service &&
|
|
24155
|
+
if (callee && /^defineService[0-9]*$/.test(callee) && service && ts25.isStringLiteralLike(service)) {
|
|
24148
24156
|
const actions = object16(initializer(property3(object16(node3.arguments[1]), "actions")));
|
|
24149
24157
|
for (const member of actions?.properties ?? []) {
|
|
24150
24158
|
const action = name(member.name);
|
|
24151
|
-
const fn2 =
|
|
24159
|
+
const fn2 = ts25.isMethodDeclaration(member) ? member : resolve116(ts25.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
|
|
24152
24160
|
if (!action || !fn2?.body) continue;
|
|
24153
24161
|
const targets = [];
|
|
24154
24162
|
const target = (expr) => {
|
|
24155
24163
|
const sid = initializer(property3(object16(expr), "screenId"));
|
|
24156
|
-
if (!sid || !
|
|
24164
|
+
if (!sid || !ts25.isStringLiteralLike(sid)) return;
|
|
24157
24165
|
const position = file2.getLineAndCharacterOfPosition(sid.getStart(file2));
|
|
24158
24166
|
targets.push({ screenId: sid.text, line: position.line + 1, column: position.character });
|
|
24159
24167
|
};
|
|
24160
24168
|
const returned = (expr) => {
|
|
24161
24169
|
if (!expr) return;
|
|
24162
|
-
if (
|
|
24170
|
+
if (ts25.isParenthesizedExpression(expr) || ts25.isAwaitExpression(expr)) {
|
|
24163
24171
|
returned(expr.expression);
|
|
24164
24172
|
return;
|
|
24165
24173
|
}
|
|
24166
|
-
if (
|
|
24174
|
+
if (ts25.isConditionalExpression(expr)) {
|
|
24167
24175
|
returned(expr.whenTrue);
|
|
24168
24176
|
returned(expr.whenFalse);
|
|
24169
24177
|
return;
|
|
24170
24178
|
}
|
|
24171
|
-
if (
|
|
24179
|
+
if (ts25.isObjectLiteralExpression(expr)) {
|
|
24172
24180
|
target(initializer(property3(expr, "_nav")));
|
|
24173
24181
|
return;
|
|
24174
24182
|
}
|
|
24175
|
-
if (
|
|
24176
|
-
const called =
|
|
24183
|
+
if (ts25.isCallExpression(expr)) {
|
|
24184
|
+
const called = ts25.isPropertyAccessExpression(expr.expression) ? expr.expression.name.text : name(expr.expression);
|
|
24177
24185
|
if (called && /^navigate[0-9]*$/.test(called)) target(expr.arguments[1]);
|
|
24178
24186
|
}
|
|
24179
24187
|
};
|
|
24180
|
-
if (
|
|
24188
|
+
if (ts25.isBlock(fn2.body)) {
|
|
24181
24189
|
const returns = (part4) => {
|
|
24182
24190
|
if (callable(part4)) return;
|
|
24183
|
-
if (
|
|
24184
|
-
else
|
|
24191
|
+
if (ts25.isReturnStatement(part4)) returned(part4.expression);
|
|
24192
|
+
else ts25.forEachChild(part4, returns);
|
|
24185
24193
|
};
|
|
24186
24194
|
returns(fn2.body);
|
|
24187
24195
|
} else returned(fn2.body);
|
|
24188
24196
|
results.set("tier5." + service.text + "." + action, targets);
|
|
24189
|
-
const ref =
|
|
24190
|
-
const always = ref &&
|
|
24197
|
+
const ref = ts25.isShorthandPropertyAssignment(member) ? member.name : initializer(member);
|
|
24198
|
+
const always = ref && ts25.isIdentifier(ref) && assigned.has(ref.text) ? void 0 : fixedOf(fn2);
|
|
24191
24199
|
if (always) fixed.set("tier5." + service.text + "." + action, always);
|
|
24192
24200
|
}
|
|
24193
24201
|
}
|
|
24194
24202
|
}
|
|
24195
|
-
|
|
24203
|
+
ts25.forEachChild(node3, visit);
|
|
24196
24204
|
};
|
|
24197
24205
|
visit(file2);
|
|
24198
24206
|
cache.set(bundleJs, results);
|
|
@@ -31833,6 +31841,7 @@ function resolveIdiom(tokens2, ctx = {}) {
|
|
|
31833
31841
|
var IDIOM_CONTEXTS, UNSAFE_KEYS;
|
|
31834
31842
|
var init_idiom = __esm({
|
|
31835
31843
|
"../../core/ts/src/idiom.ts"() {
|
|
31844
|
+
"use strict";
|
|
31836
31845
|
init_define_HHP_CATALOG();
|
|
31837
31846
|
IDIOM_CONTEXTS = {
|
|
31838
31847
|
ios: { native: ["ios"] },
|
|
@@ -33655,7 +33664,6 @@ function shouldRevealError(args) {
|
|
|
33655
33664
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
33656
33665
|
var init_validation = __esm({
|
|
33657
33666
|
"../../core/ts/src/validation.ts"() {
|
|
33658
|
-
"use strict";
|
|
33659
33667
|
init_define_HHP_CATALOG();
|
|
33660
33668
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
33661
33669
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -36478,6 +36486,15 @@ function normalizeSiteOrigin(origin) {
|
|
|
36478
36486
|
const path2 = url.pathname.replace(/\/+$/, "");
|
|
36479
36487
|
return `https://${url.host.toLowerCase()}${path2}`;
|
|
36480
36488
|
}
|
|
36489
|
+
function siteAllowedOrigins(origin, kind) {
|
|
36490
|
+
const base2 = new URL(normalizeSiteOrigin(origin));
|
|
36491
|
+
const host = base2.host;
|
|
36492
|
+
const path2 = base2.pathname.replace(/\/+$/, "");
|
|
36493
|
+
const hosts = [host];
|
|
36494
|
+
const isWixFreeHost = host.endsWith(".wixsite.com") || host.endsWith(".wixstudio.com");
|
|
36495
|
+
if (!isWixFreeHost && kind === "wix") hosts.push(host.startsWith("www.") ? host.slice(4) : `www.${host}`);
|
|
36496
|
+
return hosts.map((h2) => `https://${h2}${path2}/`);
|
|
36497
|
+
}
|
|
36481
36498
|
function sitePageUrl(origin, path2) {
|
|
36482
36499
|
const base2 = normalizeSiteOrigin(origin);
|
|
36483
36500
|
const raw = (typeof path2 === "string" ? path2 : "").trim();
|
|
@@ -36501,6 +36518,142 @@ function sitePageUrl(origin, path2) {
|
|
|
36501
36518
|
function siteScreenId(page) {
|
|
36502
36519
|
return `${SITE_SCREEN_PREFIX}${page.id}`;
|
|
36503
36520
|
}
|
|
36521
|
+
function resolveSiteChrome(chrome) {
|
|
36522
|
+
return {
|
|
36523
|
+
hideSiteHeader: chrome?.hideSiteHeader ?? true,
|
|
36524
|
+
hideSiteMenu: chrome?.hideSiteMenu ?? true,
|
|
36525
|
+
hideSiteFooter: chrome?.hideSiteFooter ?? true,
|
|
36526
|
+
hideWixAds: chrome?.hideWixAds ?? true
|
|
36527
|
+
};
|
|
36528
|
+
}
|
|
36529
|
+
function siteWebViewPreset(site) {
|
|
36530
|
+
const chrome = resolveSiteChrome(site.chrome);
|
|
36531
|
+
return {
|
|
36532
|
+
layout: "inset",
|
|
36533
|
+
immersive: true,
|
|
36534
|
+
// Chrome hiding is binary-shipped (RFC 0062): only these flags travel over the air, so an
|
|
36535
|
+
// owner can flip one without a new build, and no page script is served OTA (invariant 15).
|
|
36536
|
+
hideHostedSiteHeader: chrome.hideSiteHeader,
|
|
36537
|
+
hideHostedSiteFooter: chrome.hideSiteFooter,
|
|
36538
|
+
// Wix ads only exist on Wix free sites; a Base44 site never gets the Wix selectors.
|
|
36539
|
+
hideWixAds: site.kind === "wix" && chrome.hideWixAds,
|
|
36540
|
+
// The site's own menu duplicates the native tabs/drawer. Wix markers only, like the ads.
|
|
36541
|
+
hideHostedSiteMenu: site.kind === "wix" && chrome.hideSiteMenu,
|
|
36542
|
+
// RFC 0062 §5.8 — a Base44 app is signed in natively and its session carried into the page.
|
|
36543
|
+
// The host still refuses unless the app declares the `base44` capability. A Wix site bridges
|
|
36544
|
+
// only when its app signs members in natively (`site.sessionBridge`); the host additionally
|
|
36545
|
+
// needs the app's baked site and its Wix member login installed.
|
|
36546
|
+
...site.kind === "base44" ? { hostedSiteAdapter: "base44", sessionBridge: true } : {},
|
|
36547
|
+
...site.kind === "wix" && site.sessionBridge ? { hostedSiteAdapter: "wix", sessionBridge: true } : {},
|
|
36548
|
+
pullToRefresh: true,
|
|
36549
|
+
showProgressBar: true,
|
|
36550
|
+
syncStatusBarAppearance: true,
|
|
36551
|
+
allowedOrigins: siteAllowedOrigins(site.origin, site.kind),
|
|
36552
|
+
externalLinks: "system_browser",
|
|
36553
|
+
promptBeforeExternalLink: true,
|
|
36554
|
+
// A real external site, not Himalaya screens — its links stay in its WebView.
|
|
36555
|
+
interceptInternalLinks: false,
|
|
36556
|
+
floatingBackButton: { enabled: true },
|
|
36557
|
+
autoReloadOnCrash: true,
|
|
36558
|
+
domStorageEnabled: true,
|
|
36559
|
+
// A live site, not app-bundled content: honor its HTTP caching. The default
|
|
36560
|
+
// (`respectHttpCache` unset) is offline-first — iOS applies that to the top-level page only, but
|
|
36561
|
+
// Android's WebView cache mode governs EVERY request, so a hosted site's API fetches, scripts and
|
|
36562
|
+
// page data came from cache regardless of expiry, cookies or CORS headers: a signed-in member got
|
|
36563
|
+
// the visitor's cached member state back (the site flipped them to its login wall), and a cached
|
|
36564
|
+
// non-CORS response replayed for a CORS fetch left the page blank (#3700).
|
|
36565
|
+
respectHttpCache: true,
|
|
36566
|
+
// Each tab keeps its own warm WebView across tab switches (keyed by screen id on both
|
|
36567
|
+
// platforms; see SITE_SHELL_MAX_TABS for why the tab count stays within the store's cap).
|
|
36568
|
+
keepAlive: true
|
|
36569
|
+
};
|
|
36570
|
+
}
|
|
36571
|
+
function defineSiteTab(site, page) {
|
|
36572
|
+
assertSitePage(page);
|
|
36573
|
+
const preset = siteWebViewPreset(site);
|
|
36574
|
+
return {
|
|
36575
|
+
screenId: siteScreenId(page),
|
|
36576
|
+
renderer: "webview_native_bridge",
|
|
36577
|
+
title: page.title,
|
|
36578
|
+
url: sitePageUrl(site.origin, page.path),
|
|
36579
|
+
capabilitiesRequired: [],
|
|
36580
|
+
schemaVersion: 1,
|
|
36581
|
+
// Wix serves page HTML `no-cache`; the descriptor itself is cheap to revalidate.
|
|
36582
|
+
cacheControl: { maxAge: 600, staleWhileRevalidate: 86400 },
|
|
36583
|
+
webViewConfig: { ...preset, ...page.webView ?? {} }
|
|
36584
|
+
};
|
|
36585
|
+
}
|
|
36586
|
+
function defineSitePageScreen(site) {
|
|
36587
|
+
const preset = siteWebViewPreset(site);
|
|
36588
|
+
return {
|
|
36589
|
+
screenId: SITE_PAGE_SCREEN_ID,
|
|
36590
|
+
renderer: "webview_native_bridge",
|
|
36591
|
+
title: "",
|
|
36592
|
+
url: normalizeSiteOrigin(site.origin),
|
|
36593
|
+
capabilitiesRequired: [],
|
|
36594
|
+
schemaVersion: 1,
|
|
36595
|
+
cacheControl: { maxAge: 600, staleWhileRevalidate: 86400 },
|
|
36596
|
+
webViewConfig: { ...preset, keepAlive: false }
|
|
36597
|
+
};
|
|
36598
|
+
}
|
|
36599
|
+
function primarySiteWebView(url, config, id, label4) {
|
|
36600
|
+
return {
|
|
36601
|
+
id,
|
|
36602
|
+
body: {
|
|
36603
|
+
package: "himalaya",
|
|
36604
|
+
type: "WebView",
|
|
36605
|
+
props: { url, role: "primary", fill: true, scrollEnabled: true, ...config ? { config } : {} }
|
|
36606
|
+
},
|
|
36607
|
+
modifiers: { weight: 1, accessibilityLabel: label4?.trim() || hostOf(url) }
|
|
36608
|
+
};
|
|
36609
|
+
}
|
|
36610
|
+
function hostOf(url) {
|
|
36611
|
+
try {
|
|
36612
|
+
return new URL(url).host || url;
|
|
36613
|
+
} catch {
|
|
36614
|
+
return url;
|
|
36615
|
+
}
|
|
36616
|
+
}
|
|
36617
|
+
function isDesugarableSiteScreen(descriptor) {
|
|
36618
|
+
return !!descriptor && descriptor.renderer === "webview_native_bridge" && typeof descriptor.url === "string" && descriptor.url !== "" && descriptor.logicBundle === void 0 && descriptor.webViewConfig?.internalLinksAsScreens !== true;
|
|
36619
|
+
}
|
|
36620
|
+
function desugarSiteScreen(descriptor) {
|
|
36621
|
+
if (!isDesugarableSiteScreen(descriptor)) return descriptor;
|
|
36622
|
+
const { url, webViewConfig, ...screen } = descriptor;
|
|
36623
|
+
return {
|
|
36624
|
+
...screen,
|
|
36625
|
+
renderer: SITE_NODE_SCREEN_RENDERER,
|
|
36626
|
+
payload: primarySiteWebView(url, webViewConfig ? { ...webViewConfig } : void 0, SITE_PAGE_NODE_ID, descriptor.title)
|
|
36627
|
+
};
|
|
36628
|
+
}
|
|
36629
|
+
function siteScreens(site, opts) {
|
|
36630
|
+
assertSiteShellConfig(site, opts);
|
|
36631
|
+
const form = opts?.form ?? "t3";
|
|
36632
|
+
if (!SITE_SCREEN_FORMS.includes(form)) {
|
|
36633
|
+
throw new Error(`site screen form ${JSON.stringify(form)} must be one of ${SITE_SCREEN_FORMS.join(", ")}`);
|
|
36634
|
+
}
|
|
36635
|
+
const shape = (d2) => form === "node" ? desugarSiteScreen(d2) : d2;
|
|
36636
|
+
return {
|
|
36637
|
+
...Object.fromEntries(site.pages.map((page) => [siteScreenId(page), shape(defineSiteTab(site, page))])),
|
|
36638
|
+
[SITE_PAGE_SCREEN_ID]: shape(defineSitePageScreen(site))
|
|
36639
|
+
};
|
|
36640
|
+
}
|
|
36641
|
+
function siteNav(site, opts) {
|
|
36642
|
+
assertSiteShellConfig(site, opts);
|
|
36643
|
+
const tabs = [];
|
|
36644
|
+
const drawer = [];
|
|
36645
|
+
for (const page of site.pages) {
|
|
36646
|
+
const placement = page.placement ?? "tab";
|
|
36647
|
+
const icon = page.icon ?? "globe";
|
|
36648
|
+
if (placement === "tab" && tabs.length < SITE_SHELL_MAX_TABS) {
|
|
36649
|
+
tabs.push({ id: page.id, screenId: siteScreenId(page), label: page.title, icon });
|
|
36650
|
+
}
|
|
36651
|
+
if (placement !== "overflow") {
|
|
36652
|
+
drawer.push({ id: `drawer_${page.id}`, screenId: siteScreenId(page), label: page.title, icon });
|
|
36653
|
+
}
|
|
36654
|
+
}
|
|
36655
|
+
return { tabs, drawer };
|
|
36656
|
+
}
|
|
36504
36657
|
function assertSitePage(page) {
|
|
36505
36658
|
if (!page || typeof page.id !== "string" || !PAGE_ID.test(page.id)) {
|
|
36506
36659
|
throw new Error(`site page id ${JSON.stringify(page?.id)} must match ${PAGE_ID}`);
|
|
@@ -36515,7 +36668,7 @@ function assertSitePage(page) {
|
|
|
36515
36668
|
throw new Error(`site page ${page.id} needs a title`);
|
|
36516
36669
|
}
|
|
36517
36670
|
}
|
|
36518
|
-
function assertSiteShellConfig(site) {
|
|
36671
|
+
function assertSiteShellConfig(site, opts) {
|
|
36519
36672
|
normalizeSiteOrigin(site.origin);
|
|
36520
36673
|
if (site.kind !== "wix" && site.kind !== "base44") {
|
|
36521
36674
|
throw new Error(`site kind ${JSON.stringify(site.kind)} must be "wix" or "base44"`);
|
|
@@ -36540,11 +36693,11 @@ function assertSiteShellConfig(site) {
|
|
|
36540
36693
|
if (site.menuSource !== void 0 && site.menuSource !== "contract" && site.menuSource !== "runtime") {
|
|
36541
36694
|
throw new Error(`site menuSource ${JSON.stringify(site.menuSource)} must be "contract" or "runtime"`);
|
|
36542
36695
|
}
|
|
36543
|
-
if (!site.pages.some((page) => (page.placement ?? "tab") === "tab")) {
|
|
36696
|
+
if (opts?.requireTab !== false && !site.pages.some((page) => (page.placement ?? "tab") === "tab")) {
|
|
36544
36697
|
throw new Error('a site shell needs at least one page with placement "tab"');
|
|
36545
36698
|
}
|
|
36546
36699
|
}
|
|
36547
|
-
var SITE_LAYOUTS, SITE_SHELL_MAX_TABS, SITE_SCREEN_PREFIX, SITE_PAGE_SCREEN_ID, PAGE_ID;
|
|
36700
|
+
var SITE_LAYOUTS, SITE_SHELL_MAX_TABS, SITE_SCREEN_PREFIX, SITE_PAGE_SCREEN_ID, PAGE_ID, SITE_PAGE_NODE_ID, SITE_SCREEN_FORMS, SITE_NODE_SCREEN_RENDERER;
|
|
36548
36701
|
var init_site_shell = __esm({
|
|
36549
36702
|
"../../core/ts/src/site-shell.ts"() {
|
|
36550
36703
|
init_define_HHP_CATALOG();
|
|
@@ -36553,6 +36706,9 @@ var init_site_shell = __esm({
|
|
|
36553
36706
|
SITE_SCREEN_PREFIX = "site_";
|
|
36554
36707
|
SITE_PAGE_SCREEN_ID = "site_page";
|
|
36555
36708
|
PAGE_ID = /^[a-z0-9_]+$/;
|
|
36709
|
+
SITE_PAGE_NODE_ID = "site_page_view";
|
|
36710
|
+
SITE_SCREEN_FORMS = ["t3", "node"];
|
|
36711
|
+
SITE_NODE_SCREEN_RENDERER = "sdui_layout";
|
|
36556
36712
|
}
|
|
36557
36713
|
});
|
|
36558
36714
|
|
|
@@ -51130,7 +51286,7 @@ var init_pdf = __esm({
|
|
|
51130
51286
|
var defineProperty = Object.defineProperty;
|
|
51131
51287
|
var stringSlice = uncurryThis("".slice);
|
|
51132
51288
|
var replace = uncurryThis("".replace);
|
|
51133
|
-
var
|
|
51289
|
+
var join184 = uncurryThis([].join);
|
|
51134
51290
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
51135
51291
|
return defineProperty(function() {
|
|
51136
51292
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -51157,7 +51313,7 @@ var init_pdf = __esm({
|
|
|
51157
51313
|
}
|
|
51158
51314
|
var state = enforceInternalState(value2);
|
|
51159
51315
|
if (!hasOwn(state, "source")) {
|
|
51160
|
-
state.source =
|
|
51316
|
+
state.source = join184(TEMPLATE, typeof name == "string" ? name : "");
|
|
51161
51317
|
}
|
|
51162
51318
|
return value2;
|
|
51163
51319
|
};
|
|
@@ -53680,7 +53836,7 @@ var init_pdf = __esm({
|
|
|
53680
53836
|
var charAt = uncurryThis("".charAt);
|
|
53681
53837
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
53682
53838
|
var $Array = globalThis2.Array;
|
|
53683
|
-
var
|
|
53839
|
+
var join184 = uncurryThis([].join);
|
|
53684
53840
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
53685
53841
|
try {
|
|
53686
53842
|
var target = new Uint8Array2();
|
|
@@ -53726,7 +53882,7 @@ var init_pdf = __esm({
|
|
|
53726
53882
|
result[written++] = "=";
|
|
53727
53883
|
}
|
|
53728
53884
|
}
|
|
53729
|
-
return
|
|
53885
|
+
return join184(result, "");
|
|
53730
53886
|
}
|
|
53731
53887
|
});
|
|
53732
53888
|
},
|
|
@@ -53738,7 +53894,7 @@ var init_pdf = __esm({
|
|
|
53738
53894
|
var anUint8Array = __webpack_require__3(4154);
|
|
53739
53895
|
var notDetached = __webpack_require__3(5169);
|
|
53740
53896
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
53741
|
-
var
|
|
53897
|
+
var join184 = uncurryThis([].join);
|
|
53742
53898
|
var $Array = Array;
|
|
53743
53899
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
53744
53900
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -53758,7 +53914,7 @@ var init_pdf = __esm({
|
|
|
53758
53914
|
var hex2 = numberToString2(this[i2], 16);
|
|
53759
53915
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
53760
53916
|
}
|
|
53761
|
-
return
|
|
53917
|
+
return join184(result, "");
|
|
53762
53918
|
}
|
|
53763
53919
|
});
|
|
53764
53920
|
},
|
|
@@ -151820,9 +151976,9 @@ function stateOf(view) {
|
|
|
151820
151976
|
build: b3 && view.live ? { ok: b3.ok, ms: b3.ms, screens: b3.screens, at: b3.at, run: view.live.runId } : null
|
|
151821
151977
|
};
|
|
151822
151978
|
}
|
|
151823
|
-
function frameFor(state, prev,
|
|
151824
|
-
if (key4 || !prev) return { ts:
|
|
151825
|
-
const f2 = { ts:
|
|
151979
|
+
function frameFor(state, prev, ts25, v2, key4) {
|
|
151980
|
+
if (key4 || !prev) return { ts: ts25, v: v2, key: true, ...state };
|
|
151981
|
+
const f2 = { ts: ts25, v: v2 };
|
|
151826
151982
|
if (!same2(state.step, prev.step)) f2.step = state.step;
|
|
151827
151983
|
if (!same2(state.now, prev.now)) f2.now = state.now;
|
|
151828
151984
|
const screens = {};
|
|
@@ -152688,8 +152844,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
152688
152844
|
}
|
|
152689
152845
|
async function appId(dir) {
|
|
152690
152846
|
try {
|
|
152691
|
-
const { readFileSync:
|
|
152692
|
-
const m2 = JSON.parse(
|
|
152847
|
+
const { readFileSync: readFileSync172 } = await import("node:fs");
|
|
152848
|
+
const m2 = JSON.parse(readFileSync172(join35(dir, "himalaya.content.json"), "utf8"));
|
|
152693
152849
|
if (m2.name) return m2.name;
|
|
152694
152850
|
} catch {
|
|
152695
152851
|
}
|
|
@@ -163814,6 +163970,7 @@ __export(template_adopt_exports, {
|
|
|
163814
163970
|
moduleEvaluationCalls: () => moduleEvaluationCalls,
|
|
163815
163971
|
primaryNodeIds: () => primaryNodeIds,
|
|
163816
163972
|
readAppSources: () => readAppSources,
|
|
163973
|
+
removeScreens: () => removeScreens,
|
|
163817
163974
|
replaceScreen: () => replaceScreen,
|
|
163818
163975
|
screenActions: () => screenActions,
|
|
163819
163976
|
screenEntry: () => screenEntry,
|
|
@@ -164392,6 +164549,53 @@ function upsertScreens(dir, screens) {
|
|
|
164392
164549
|
}
|
|
164393
164550
|
return { ok: true, added, replaced };
|
|
164394
164551
|
}
|
|
164552
|
+
function removeScreens(dir, ids2) {
|
|
164553
|
+
const src = readAppSources(dir);
|
|
164554
|
+
const app2 = parseApp(src.dev, src.config);
|
|
164555
|
+
const routes = app2.routes.filter((r3) => r3.kind === "screen" && ids2.includes(r3.label) && r3.label !== app2.home.label);
|
|
164556
|
+
if (!routes.length) return { ok: true, removed: [] };
|
|
164557
|
+
const removed = routes.map((r3) => r3.label);
|
|
164558
|
+
const gone = new Set(removed);
|
|
164559
|
+
let dev = src.dev;
|
|
164560
|
+
for (const r3 of [...routes].sort((a3, b3) => b3.lineStart - a3.lineStart)) dev = dev.slice(0, r3.lineStart) + dev.slice(r3.end);
|
|
164561
|
+
const nav = JSON.parse(JSON.stringify(app2.nav.value));
|
|
164562
|
+
let config = src.config;
|
|
164563
|
+
if (Array.isArray(nav.linkableScreens) && nav.linkableScreens.some((l3) => gone.has(String(l3.screenId)))) {
|
|
164564
|
+
nav.linkableScreens = nav.linkableScreens.filter((l3) => !gone.has(String(l3.screenId)));
|
|
164565
|
+
config = src.config.slice(0, app2.nav.open) + serializeAt(nav, src.config, app2.nav.open) + src.config.slice(app2.nav.close);
|
|
164566
|
+
}
|
|
164567
|
+
let reparsed;
|
|
164568
|
+
try {
|
|
164569
|
+
reparsed = parseApp(dev, config);
|
|
164570
|
+
} catch (e2) {
|
|
164571
|
+
throw new TrimRefusal(`removing ${removed.join(", ")} would leave dev/index.ts unparseable, nothing written: ${e2.message}`);
|
|
164572
|
+
}
|
|
164573
|
+
if (reparsed.routes.length !== app2.routes.length - removed.length || removed.some((id) => findRoute(reparsed, id))) {
|
|
164574
|
+
throw new TrimRefusal(`removing ${removed.join(", ")} did not remove exactly those screens \u2014 nothing written`);
|
|
164575
|
+
}
|
|
164576
|
+
let content;
|
|
164577
|
+
try {
|
|
164578
|
+
content = readContentManifest(dir);
|
|
164579
|
+
} catch (error) {
|
|
164580
|
+
throw new TrimRefusal(error.message);
|
|
164581
|
+
}
|
|
164582
|
+
let contentText;
|
|
164583
|
+
if (content && content.screens && typeof content.screens === "object" && !Array.isArray(content.screens)) {
|
|
164584
|
+
const screens = content.screens;
|
|
164585
|
+
if (removed.some((id) => Object.hasOwn(screens, id))) {
|
|
164586
|
+
content.screens = Object.fromEntries(Object.entries(screens).filter(([id]) => !gone.has(id)));
|
|
164587
|
+
contentText = JSON.stringify(content, null, 2) + "\n";
|
|
164588
|
+
}
|
|
164589
|
+
}
|
|
164590
|
+
for (const rel2 of ["dev", "dev/index.ts", ...config !== src.config ? ["config.ts"] : [], ...contentText !== void 0 ? ["himalaya.content.json"] : []]) {
|
|
164591
|
+
const p2 = join41(dir, rel2);
|
|
164592
|
+
if (existsSync49(p2) && lstatSync15(p2).isSymbolicLink()) throw new TrimRefusal(`${rel2} is a symlink \u2014 refusing to write through it (nothing written)`);
|
|
164593
|
+
}
|
|
164594
|
+
writeNoFollow(dir, "dev/index.ts", dev);
|
|
164595
|
+
if (config !== src.config) writeNoFollow(dir, "config.ts", config);
|
|
164596
|
+
if (contentText !== void 0) writeContentManifest(dir, contentText);
|
|
164597
|
+
return { ok: true, removed };
|
|
164598
|
+
}
|
|
164395
164599
|
function specScreens(spec) {
|
|
164396
164600
|
const body = spec.replace(/<!--[\s\S]*?(?:-->|$)/g, "");
|
|
164397
164601
|
const m2 = /(?:^|\n)##[ \t]+Screen catalogue\b[^\n]*([\s\S]*?)(?=\n##[ \t]|$)/i.exec(body);
|
|
@@ -166441,15 +166645,15 @@ function loadMemory2(dir) {
|
|
|
166441
166645
|
for (const t2 of m2.timeline) {
|
|
166442
166646
|
if (!isObj3(t2)) continue;
|
|
166443
166647
|
const file2 = historyName(t2.sha, t2.ext);
|
|
166444
|
-
const
|
|
166648
|
+
const ts25 = str5(t2.ts);
|
|
166445
166649
|
const id = str5(t2.id);
|
|
166446
|
-
if (file2 &&
|
|
166650
|
+
if (file2 && ts25 && id) timeline.push({ ts: ts25, id, file: file2 });
|
|
166447
166651
|
}
|
|
166448
166652
|
return { createdAt: str5(m2.createdAt), shots, timeline };
|
|
166449
166653
|
}
|
|
166450
|
-
function captionAt(entries,
|
|
166654
|
+
function captionAt(entries, ts25) {
|
|
166451
166655
|
let best = null;
|
|
166452
|
-
for (const e2 of entries) if (e2.ts <=
|
|
166656
|
+
for (const e2 of entries) if (e2.ts <= ts25) best = e2;
|
|
166453
166657
|
return best ? best.message : null;
|
|
166454
166658
|
}
|
|
166455
166659
|
function thin(items, max) {
|
|
@@ -166569,13 +166773,13 @@ function duration(ms2) {
|
|
|
166569
166773
|
const m2 = Math.round(ms2 / 6e4);
|
|
166570
166774
|
return m2 < 60 ? `${m2} min` : `${Math.floor(m2 / 60)} h ${m2 % 60} min`;
|
|
166571
166775
|
}
|
|
166572
|
-
function utcDay(
|
|
166573
|
-
const d2 = new Date(
|
|
166776
|
+
function utcDay(ts25) {
|
|
166777
|
+
const d2 = new Date(ts25);
|
|
166574
166778
|
return Number.isNaN(d2.getTime()) ? "" : `${d2.toUTCString().slice(0, 16)} (UTC)`;
|
|
166575
166779
|
}
|
|
166576
|
-
function sinceStart(start,
|
|
166780
|
+
function sinceStart(start, ts25) {
|
|
166577
166781
|
if (!start) return "";
|
|
166578
|
-
const s5 = Math.max(0, Math.round((Date.parse(
|
|
166782
|
+
const s5 = Math.max(0, Math.round((Date.parse(ts25) - Date.parse(start)) / 1e3));
|
|
166579
166783
|
const h2 = Math.floor(s5 / 3600);
|
|
166580
166784
|
const m2 = Math.floor(s5 % 3600 / 60);
|
|
166581
166785
|
const sec = String(s5 % 60).padStart(2, "0");
|
|
@@ -166585,7 +166789,7 @@ function renderReel(plan, images) {
|
|
|
166585
166789
|
const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
|
|
166586
166790
|
const count2 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
|
|
166587
166791
|
const accent = ACCENT.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
|
|
166588
|
-
const clock = (
|
|
166792
|
+
const clock = (ts25) => sinceStart(plan.startedAt, ts25);
|
|
166589
166793
|
const frames = plan.frames.filter((f2) => images.has(f2.file));
|
|
166590
166794
|
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>
|
|
166591
166795
|
<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>`;
|
|
@@ -176449,7 +176653,7 @@ function adaptWixLink(raw) {
|
|
|
176449
176653
|
if (raw.toLowerCase().startsWith(WIX_SCHEME_PREFIX)) {
|
|
176450
176654
|
rest = raw.slice(WIX_SCHEME_PREFIX.length);
|
|
176451
176655
|
} else {
|
|
176452
|
-
const host =
|
|
176656
|
+
const host = hostOf2(raw);
|
|
176453
176657
|
if (!host || !WIX_UNIVERSAL_HOST.test(host)) return void 0;
|
|
176454
176658
|
rest = raw.slice(raw.toLowerCase().indexOf(host) + host.length);
|
|
176455
176659
|
}
|
|
@@ -176478,7 +176682,7 @@ function siteSegment(segs) {
|
|
|
176478
176682
|
if (segs[0] === "notifications" && segs[1] === "list" && segs[2]) return segs[2];
|
|
176479
176683
|
return void 0;
|
|
176480
176684
|
}
|
|
176481
|
-
function
|
|
176685
|
+
function hostOf2(url) {
|
|
176482
176686
|
const m2 = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/([^/?#]+)/.exec(url);
|
|
176483
176687
|
return m2 ? m2[1].toLowerCase() : null;
|
|
176484
176688
|
}
|
|
@@ -213755,9 +213959,9 @@ var init_commands = __esm({
|
|
|
213755
213959
|
summary: "Jobs in the state directory",
|
|
213756
213960
|
async run(inv) {
|
|
213757
213961
|
const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
|
|
213758
|
-
const { join:
|
|
213962
|
+
const { join: join184 } = await import("node:path");
|
|
213759
213963
|
const runner2 = await inv.ctx.runner();
|
|
213760
|
-
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(
|
|
213964
|
+
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join184(inv.ctx.stateDir, "jobs")).list();
|
|
213761
213965
|
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"]);
|
|
213762
213966
|
}
|
|
213763
213967
|
},
|
|
@@ -224150,11 +224354,11 @@ __export(input_evidence_isolation_exports, {
|
|
|
224150
224354
|
});
|
|
224151
224355
|
async function installInputEvidenceIsolation(dir) {
|
|
224152
224356
|
const { lstatSync: lstatSync36, readdirSync: readdirSync55 } = await import("node:fs");
|
|
224153
|
-
const { join:
|
|
224357
|
+
const { join: join184 } = await import("node:path");
|
|
224154
224358
|
const check = (path2) => {
|
|
224155
224359
|
const stat9 = lstatSync36(path2);
|
|
224156
224360
|
if (stat9.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
|
|
224157
|
-
if (stat9.isDirectory()) for (const name of readdirSync55(path2)) check(
|
|
224361
|
+
if (stat9.isDirectory()) for (const name of readdirSync55(path2)) check(join184(path2, name));
|
|
224158
224362
|
};
|
|
224159
224363
|
check(dir);
|
|
224160
224364
|
const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
|
|
@@ -228914,6 +229118,7 @@ function renderBookMarkdown(book) {
|
|
|
228914
229118
|
lines2.push(`- membership: plans=${traits.membership.plans} loyalty=${traits.membership.loyalty}`);
|
|
228915
229119
|
if (traits.voice) lines2.push(`- voice: ${traits.voice.notes} (${traits.voice.source})`);
|
|
228916
229120
|
lines2.push("");
|
|
229121
|
+
if (book.sitePages) lines2.push(...renderSitePages(book.sitePages), "");
|
|
228917
229122
|
if (book.mobileApp) lines2.push(...renderMobileApp(book.mobileApp, book.input.msid), "");
|
|
228918
229123
|
lines2.push(`## Catalog`);
|
|
228919
229124
|
for (const p2 of probes) {
|
|
@@ -228932,6 +229137,24 @@ function renderBookMarkdown(book) {
|
|
|
228932
229137
|
lines2.push("");
|
|
228933
229138
|
return lines2.join("\n");
|
|
228934
229139
|
}
|
|
229140
|
+
function renderSitePages(plan) {
|
|
229141
|
+
const lines2 = ["## Site pages"];
|
|
229142
|
+
lines2.push(
|
|
229143
|
+
'What `himi site analyze --apply --site-pages` adds: each page below with no native screen opens the website, from the drawer section "From our website". Without `--site-pages`, `--apply` adds none of them.'
|
|
229144
|
+
);
|
|
229145
|
+
for (const note of plan.notes) lines2.push(`- ${note}`);
|
|
229146
|
+
lines2.push("- website pages:");
|
|
229147
|
+
if (!plan.site.length) lines2.push(" - none");
|
|
229148
|
+
for (const p2 of plan.site) lines2.push(` - "${p2.title}" ${p2.path} \u2192 \`${p2.screenId}\` \u2014 ${p2.reason}`);
|
|
229149
|
+
lines2.push("- native screens:");
|
|
229150
|
+
if (!plan.native.length) lines2.push(" - none");
|
|
229151
|
+
for (const p2 of plan.native) lines2.push(` - "${p2.title}" ${p2.path} \u2192 \`${p2.screenId}\`${p2.vertical ? ` (${p2.vertical})` : ""}`);
|
|
229152
|
+
if (plan.skipped.length) {
|
|
229153
|
+
lines2.push("- left out:");
|
|
229154
|
+
for (const p2 of plan.skipped) lines2.push(` - "${p2.title}" ${p2.path} \u2014 ${p2.reason}`);
|
|
229155
|
+
}
|
|
229156
|
+
return lines2;
|
|
229157
|
+
}
|
|
228935
229158
|
function accessLabel(a3) {
|
|
228936
229159
|
if (!a3) return "";
|
|
228937
229160
|
const parts = [
|
|
@@ -241358,7 +241581,7 @@ function expandVars(value2, vars) {
|
|
|
241358
241581
|
}
|
|
241359
241582
|
return out2;
|
|
241360
241583
|
}
|
|
241361
|
-
function
|
|
241584
|
+
function hostOf3(entry) {
|
|
241362
241585
|
const h2 = entry.split("?")[0].toLowerCase();
|
|
241363
241586
|
const bracketed = /^\[([^\]]*)\]/.exec(h2);
|
|
241364
241587
|
if (bracketed) return bracketed[1];
|
|
@@ -241768,7 +241991,7 @@ var init_preflight_app = __esm({
|
|
|
241768
241991
|
init_credential_profile();
|
|
241769
241992
|
init_app_icon_rules();
|
|
241770
241993
|
LOOPBACK_HOST = /^(?:localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[?::1\]?)$/i;
|
|
241771
|
-
isLoopback2 = (entry) => LOOPBACK_HOST.test(
|
|
241994
|
+
isLoopback2 = (entry) => LOOPBACK_HOST.test(hostOf3(entry));
|
|
241772
241995
|
unquote3 = (v2) => v2.trim().replace(/^["']|["']$/g, "");
|
|
241773
241996
|
APP_STORE_SIZES = [
|
|
241774
241997
|
[1320, 2868],
|
|
@@ -250257,10 +250480,10 @@ function ricosVideoUrl(src) {
|
|
|
250257
250480
|
const { url, id } = src;
|
|
250258
250481
|
if (typeof url === "string" && url.trim() !== "") {
|
|
250259
250482
|
const link3 = cleanLink(url);
|
|
250260
|
-
const linkHost = link3 === void 0 ? void 0 :
|
|
250483
|
+
const linkHost = link3 === void 0 ? void 0 : hostOf4(link3);
|
|
250261
250484
|
if (link3 !== void 0 && linkHost !== void 0 && VIDEO_CARD_HOST.test(linkHost)) return link3;
|
|
250262
250485
|
const media = normalizeMediaRef(url);
|
|
250263
|
-
const mediaHost =
|
|
250486
|
+
const mediaHost = hostOf4(media);
|
|
250264
250487
|
return HTTPS.test(media) && !(mediaHost !== void 0 && VIDEO_CARD_HOST.test(mediaHost)) ? media : "";
|
|
250265
250488
|
}
|
|
250266
250489
|
const ref = typeof id === "string" ? id.trim().replace(/^video\//, "") : "";
|
|
@@ -250268,7 +250491,7 @@ function ricosVideoUrl(src) {
|
|
|
250268
250491
|
if (/^\w[\w~.-]*\/[\w~./-]+$/.test(ref)) return `https://video.wixstatic.com/video/${ref}`;
|
|
250269
250492
|
return "";
|
|
250270
250493
|
}
|
|
250271
|
-
var HTTPS, LINK3, HTTP_HOST, VIDEO_CARD_HOST,
|
|
250494
|
+
var HTTPS, LINK3, HTTP_HOST, VIDEO_CARD_HOST, hostOf4;
|
|
250272
250495
|
var init_display = __esm({
|
|
250273
250496
|
"../../stdlib/wix-sdk/rich-content/src/display.ts"() {
|
|
250274
250497
|
init_define_HHP_CATALOG();
|
|
@@ -250277,7 +250500,7 @@ var init_display = __esm({
|
|
|
250277
250500
|
LINK3 = /^(https?:\/\/[^\s/?#]\S*|mailto:\S+|tel:\S+)$/i;
|
|
250278
250501
|
HTTP_HOST = /^https?:\/\/([^\s/?#]+)/i;
|
|
250279
250502
|
VIDEO_CARD_HOST = /^(?:(?:www\.|m\.)?youtube\.com|youtu\.be|(?:www\.|player\.)?vimeo\.com)$/;
|
|
250280
|
-
|
|
250503
|
+
hostOf4 = (url) => HTTP_HOST.exec(url)?.[1]?.toLowerCase().replace(/:\d+$/, "");
|
|
250281
250504
|
}
|
|
250282
250505
|
});
|
|
250283
250506
|
|
|
@@ -257027,6 +257250,147 @@ var init_analyze2 = __esm({
|
|
|
257027
257250
|
}
|
|
257028
257251
|
});
|
|
257029
257252
|
|
|
257253
|
+
// ../../core/ts/src/site-pages-host.ts
|
|
257254
|
+
function isWebsitePagesBlock(site) {
|
|
257255
|
+
return !!site && Array.isArray(site.pages) && site.pages.length > 0 && site.pages.every((page) => page.placement === "drawer");
|
|
257256
|
+
}
|
|
257257
|
+
function isWebsiteScreenId(id) {
|
|
257258
|
+
return id.startsWith(SITE_SCREEN_PREFIX);
|
|
257259
|
+
}
|
|
257260
|
+
function isWebsiteDrawerId(id) {
|
|
257261
|
+
return id === WEBSITE_DRAWER_SECTION_ID || id.startsWith(WEBSITE_DRAWER_ROW_PREFIX);
|
|
257262
|
+
}
|
|
257263
|
+
function websiteDrawer(site, label4 = WEBSITE_DRAWER_LABEL) {
|
|
257264
|
+
if (!isWebsitePagesBlock(site)) return [];
|
|
257265
|
+
const rows = siteNav(site, { requireTab: false }).drawer.map((row2) => ({
|
|
257266
|
+
...row2,
|
|
257267
|
+
id: `${WEBSITE_DRAWER_ROW_PREFIX}${row2.id.slice("drawer_".length)}`
|
|
257268
|
+
}));
|
|
257269
|
+
return [
|
|
257270
|
+
{ id: WEBSITE_DRAWER_SECTION_ID, role: "section", label: label4, collapsed: rows.length > WEBSITE_SECTION_EXPANDED_MAX },
|
|
257271
|
+
...rows
|
|
257272
|
+
];
|
|
257273
|
+
}
|
|
257274
|
+
function websiteScreens(site) {
|
|
257275
|
+
if (!isWebsitePagesBlock(site)) return {};
|
|
257276
|
+
const { [SITE_PAGE_SCREEN_ID]: _fallback, ...pages2 } = siteScreens(site, { requireTab: false });
|
|
257277
|
+
return pages2;
|
|
257278
|
+
}
|
|
257279
|
+
var WEBSITE_DRAWER_SECTION_ID, WEBSITE_DRAWER_ROW_PREFIX, WEBSITE_DRAWER_LABEL, WEBSITE_SECTION_EXPANDED_MAX;
|
|
257280
|
+
var init_site_pages_host = __esm({
|
|
257281
|
+
"../../core/ts/src/site-pages-host.ts"() {
|
|
257282
|
+
init_define_HHP_CATALOG();
|
|
257283
|
+
init_site_shell();
|
|
257284
|
+
WEBSITE_DRAWER_SECTION_ID = "drawer_sec_website";
|
|
257285
|
+
WEBSITE_DRAWER_ROW_PREFIX = "drawer_site_";
|
|
257286
|
+
WEBSITE_DRAWER_LABEL = "From our website";
|
|
257287
|
+
WEBSITE_SECTION_EXPANDED_MAX = 4;
|
|
257288
|
+
}
|
|
257289
|
+
});
|
|
257290
|
+
|
|
257291
|
+
// src/site-analyze/site-pages-apply.ts
|
|
257292
|
+
import { existsSync as existsSync136, readFileSync as readFileSync166 } from "node:fs";
|
|
257293
|
+
import { join as join174 } from "node:path";
|
|
257294
|
+
import ts23 from "typescript";
|
|
257295
|
+
function packageScreenIds(dir) {
|
|
257296
|
+
const dev = join174(dir, "dev", "index.ts");
|
|
257297
|
+
const config = join174(dir, "config.ts");
|
|
257298
|
+
if (!existsSync136(dev) || !existsSync136(config)) return void 0;
|
|
257299
|
+
try {
|
|
257300
|
+
const app2 = parseApp(readFileSync166(dev, "utf8"), readFileSync166(config, "utf8"));
|
|
257301
|
+
return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
|
|
257302
|
+
} catch {
|
|
257303
|
+
return void 0;
|
|
257304
|
+
}
|
|
257305
|
+
}
|
|
257306
|
+
function spliceWebsiteDrawer(source2, site, fileName = "config.ts") {
|
|
257307
|
+
const file2 = ts23.createSourceFile(fileName, source2, ts23.ScriptTarget.Latest, true, ts23.ScriptKind.TS);
|
|
257308
|
+
const objectOf2 = (literal3, name) => {
|
|
257309
|
+
if (!literal3) return void 0;
|
|
257310
|
+
const found = lookup3(literal3, name);
|
|
257311
|
+
const value2 = found.kind === "written" ? unwrap(found.node.initializer) : void 0;
|
|
257312
|
+
return value2 && ts23.isObjectLiteralExpression(value2) ? value2 : void 0;
|
|
257313
|
+
};
|
|
257314
|
+
const navigation = objectOf2(defineAppLiteral(file2), "navigation");
|
|
257315
|
+
if (!navigation) return { refused: "config.ts has no `navigation: { \u2026 }` object literal in its defineApp call" };
|
|
257316
|
+
const drawer = objectOf2(navigation, "drawer");
|
|
257317
|
+
const itemsProp = drawer ? lookup3(drawer, "items") : void 0;
|
|
257318
|
+
const items = itemsProp?.kind === "written" ? unwrap(itemsProp.node.initializer) : void 0;
|
|
257319
|
+
if (!items || !ts23.isArrayLiteralExpression(items)) return { refused: "`navigation.drawer.items` is not an array literal this step can rewrite" };
|
|
257320
|
+
const commentAt = (pos) => (ts23.getLeadingCommentRanges(source2, pos) ?? []).length > 0;
|
|
257321
|
+
if (items.elements.some((element) => commentAt(element.pos)) || commentAt(items.elements.end)) {
|
|
257322
|
+
return { refused: "`navigation.drawer.items` has comments between its rows, which rewriting the drawer would drop" };
|
|
257323
|
+
}
|
|
257324
|
+
const rows = [];
|
|
257325
|
+
for (const element of items.elements) {
|
|
257326
|
+
try {
|
|
257327
|
+
const value2 = JSON.parse(element.getText(file2));
|
|
257328
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2) || typeof value2.id !== "string") throw new Error("not a row");
|
|
257329
|
+
rows.push(value2);
|
|
257330
|
+
} catch {
|
|
257331
|
+
return { refused: "a `navigation.drawer.items` row is not plain JSON, so the drawer cannot be rewritten without losing it" };
|
|
257332
|
+
}
|
|
257333
|
+
}
|
|
257334
|
+
const kept = rows.filter((row2) => !isWebsiteDrawerId(String(row2.id)));
|
|
257335
|
+
const section3 = websiteDrawer(site, WEBSITE_DRAWER_LABEL);
|
|
257336
|
+
const anchor = ANCHOR_ROWS.map((id) => kept.findIndex((row2) => row2.id === id)).find((i2) => i2 >= 0);
|
|
257337
|
+
const firstFolder = kept.findIndex((row2) => row2.role === "section");
|
|
257338
|
+
const at2 = anchor !== void 0 ? anchor + 1 : firstFolder >= 0 ? firstFolder : kept.length;
|
|
257339
|
+
const next = [...kept.slice(0, at2), ...section3, ...kept.slice(at2)];
|
|
257340
|
+
if (JSON.stringify(next) === JSON.stringify(rows)) return { source: source2, rows: section3.map((row2) => String(row2.id)) };
|
|
257341
|
+
const lineStart = source2.lastIndexOf("\n", items.getStart(file2) - 1) + 1;
|
|
257342
|
+
const indent = /^[ \t]*/.exec(source2.slice(lineStart))[0];
|
|
257343
|
+
const text25 = JSON.stringify(next, null, 2).replace(/\n/g, `
|
|
257344
|
+
${indent}`);
|
|
257345
|
+
return { source: applySplices(source2, [{ at: items.getStart(file2), end: items.end, text: text25 }]), rows: section3.map((row2) => String(row2.id)) };
|
|
257346
|
+
}
|
|
257347
|
+
function applySitePagesToPackage(dir, site, opts = {}) {
|
|
257348
|
+
const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
|
|
257349
|
+
const devPath = join174(dir, "dev", "index.ts");
|
|
257350
|
+
const configPath = join174(dir, "config.ts");
|
|
257351
|
+
if (!existsSync136(devPath) || !existsSync136(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
|
|
257352
|
+
let existing;
|
|
257353
|
+
try {
|
|
257354
|
+
const app2 = parseApp(readFileSync166(devPath, "utf8"), readFileSync166(configPath, "utf8"));
|
|
257355
|
+
existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
|
|
257356
|
+
} catch (e2) {
|
|
257357
|
+
return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
|
|
257358
|
+
}
|
|
257359
|
+
const screens = websiteScreens(site);
|
|
257360
|
+
const wanted = Object.keys(screens);
|
|
257361
|
+
const removed = existing.filter((id) => !wanted.includes(id));
|
|
257362
|
+
const added = wanted.filter((id) => !existing.includes(id));
|
|
257363
|
+
const replaced = wanted.filter((id) => existing.includes(id));
|
|
257364
|
+
const probe2 = spliceWebsiteDrawer(readFileSync166(configPath, "utf8"), site);
|
|
257365
|
+
if ("refused" in probe2) return none(probe2.refused);
|
|
257366
|
+
if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
|
|
257367
|
+
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync136(join174(dir, rel2)) ? readFileSync166(join174(dir, rel2), "utf8") : void 0]));
|
|
257368
|
+
try {
|
|
257369
|
+
if (removed.length) removeScreens(dir, removed);
|
|
257370
|
+
if (wanted.length) upsertScreens(dir, screens);
|
|
257371
|
+
const spliced = spliceWebsiteDrawer(readFileSync166(configPath, "utf8"), site);
|
|
257372
|
+
if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
|
|
257373
|
+
if (spliced.source !== readFileSync166(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
|
|
257374
|
+
} catch (e2) {
|
|
257375
|
+
for (const [rel2, text25] of before) if (text25 !== void 0 && readFileSync166(join174(dir, rel2), "utf8") !== text25) writeFileAtomic(join174(dir, rel2), text25);
|
|
257376
|
+
return none(`stopped and restored every file: ${e2.message}`);
|
|
257377
|
+
}
|
|
257378
|
+
const wrote = [...before].filter(([rel2, text25]) => text25 !== void 0 && readFileSync166(join174(dir, rel2), "utf8") !== text25).map(([rel2]) => join174(dir, rel2));
|
|
257379
|
+
return { added, replaced, removed, rows: probe2.rows, wrote };
|
|
257380
|
+
}
|
|
257381
|
+
var ANCHOR_ROWS;
|
|
257382
|
+
var init_site_pages_apply = __esm({
|
|
257383
|
+
"src/site-analyze/site-pages-apply.ts"() {
|
|
257384
|
+
init_define_HHP_CATALOG();
|
|
257385
|
+
init_site_pages_host();
|
|
257386
|
+
init_config_source_edit();
|
|
257387
|
+
init_template_adopt();
|
|
257388
|
+
init_template_trim();
|
|
257389
|
+
init_progress();
|
|
257390
|
+
ANCHOR_ROWS = ["drawer_business_contact", "drawer_profile"];
|
|
257391
|
+
}
|
|
257392
|
+
});
|
|
257393
|
+
|
|
257030
257394
|
// ../native-config/customer-build.ts
|
|
257031
257395
|
var LOCAL_CONTRACT_REL;
|
|
257032
257396
|
var init_customer_build = __esm({
|
|
@@ -257038,9 +257402,12 @@ var init_customer_build = __esm({
|
|
|
257038
257402
|
});
|
|
257039
257403
|
|
|
257040
257404
|
// src/site-analyze/apply.ts
|
|
257041
|
-
import { existsSync as
|
|
257042
|
-
import { dirname as dirname75, isAbsolute as isAbsolute17, join as
|
|
257405
|
+
import { existsSync as existsSync137, readFileSync as readFileSync167, writeFileSync as writeFileSync68, copyFileSync as copyFileSync2, mkdirSync as mkdirSync62, realpathSync as realpathSync22, statSync as statSync47 } from "node:fs";
|
|
257406
|
+
import { dirname as dirname75, isAbsolute as isAbsolute17, join as join175, resolve as resolve112, sep as sep26 } from "node:path";
|
|
257043
257407
|
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
257408
|
+
function siteHostRefusal(shell) {
|
|
257409
|
+
return `--site-pages adds website pages beside a native app's own screens, and shell "${shell}" hosts none \u2014 it works with --shell ${sitePageHosts().join(" or ")}. A site shell (--shell brandy) is all website pages already.`;
|
|
257410
|
+
}
|
|
257044
257411
|
function unpairedRedirectNote(overlay) {
|
|
257045
257412
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
257046
257413
|
return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
|
|
@@ -257054,7 +257421,7 @@ function committedShellProvisioning(path2) {
|
|
|
257054
257421
|
function findRepoRoot(cwd) {
|
|
257055
257422
|
let dir = cwd;
|
|
257056
257423
|
for (let i2 = 0; i2 < 8; i2++) {
|
|
257057
|
-
if (SHELL_NAMES.some((name) =>
|
|
257424
|
+
if (SHELL_NAMES.some((name) => existsSync137(join175(dir, shellAppDir(name), "package.json")))) return dir;
|
|
257058
257425
|
const next = dirname75(dir);
|
|
257059
257426
|
if (next === dir) break;
|
|
257060
257427
|
dir = next;
|
|
@@ -257093,7 +257460,7 @@ function keepSiteLayout(prev, next) {
|
|
|
257093
257460
|
if (layout2 === void 0 || next.layout !== void 0) return next;
|
|
257094
257461
|
return { ...next, layout: layout2 };
|
|
257095
257462
|
}
|
|
257096
|
-
function mergeCustomerOwned(committed, overlay) {
|
|
257463
|
+
function mergeCustomerOwned(committed, overlay, opts = {}) {
|
|
257097
257464
|
const CUSTOMER_OWNED = [
|
|
257098
257465
|
"version",
|
|
257099
257466
|
"siteId",
|
|
@@ -257123,7 +257490,7 @@ function mergeCustomerOwned(committed, overlay) {
|
|
|
257123
257490
|
if (customer.galleries === void 0 && !sameKnownSite(committed, overlay)) {
|
|
257124
257491
|
customer.galleries = [];
|
|
257125
257492
|
}
|
|
257126
|
-
if (committed.site === void 0) delete customer.site;
|
|
257493
|
+
if (committed.site === void 0 && !opts.keepSite) delete customer.site;
|
|
257127
257494
|
customer.site = keepSiteLayout(committed.site, customer.site);
|
|
257128
257495
|
const overlayBranding = { ...customer.branding ?? {} };
|
|
257129
257496
|
delete overlayBranding.appIconPath;
|
|
@@ -257148,6 +257515,12 @@ function mergeCustomerOwned(committed, overlay) {
|
|
|
257148
257515
|
}
|
|
257149
257516
|
return deepMerge4(shell, customer);
|
|
257150
257517
|
}
|
|
257518
|
+
function websiteSiteToCarry(previous, overlay) {
|
|
257519
|
+
if (!previous || typeof previous !== "object" || Array.isArray(previous)) return void 0;
|
|
257520
|
+
const site = previous.site;
|
|
257521
|
+
if (!isWebsitePagesBlock(site)) return void 0;
|
|
257522
|
+
return sameKnownSite(previous, overlay) ? site : void 0;
|
|
257523
|
+
}
|
|
257151
257524
|
function carryOverGoals(previousOverlayJson, overlay) {
|
|
257152
257525
|
if (overlay.goals !== void 0 || !previousOverlayJson) return;
|
|
257153
257526
|
try {
|
|
@@ -257169,16 +257542,16 @@ function sameKnownSite(previous, next) {
|
|
|
257169
257542
|
}
|
|
257170
257543
|
function buildMergedContract(options2) {
|
|
257171
257544
|
const { appDir: appDir3, packageDir, overlay } = options2;
|
|
257172
|
-
const committedPath =
|
|
257173
|
-
if (!
|
|
257545
|
+
const committedPath = join175(appDir3, "provisioning.json");
|
|
257546
|
+
if (!existsSync137(committedPath)) {
|
|
257174
257547
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
257175
257548
|
}
|
|
257176
|
-
const committed = JSON.parse(
|
|
257177
|
-
const previousPath =
|
|
257549
|
+
const committed = JSON.parse(readFileSync167(committedPath, "utf8"));
|
|
257550
|
+
const previousPath = join175(appDir3, LOCAL_CONTRACT_REL);
|
|
257178
257551
|
let evidenceOverlay = overlay;
|
|
257179
|
-
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) &&
|
|
257552
|
+
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync137(previousPath)) {
|
|
257180
257553
|
try {
|
|
257181
|
-
const previous = JSON.parse(
|
|
257554
|
+
const previous = JSON.parse(readFileSync167(previousPath, "utf8"));
|
|
257182
257555
|
if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
|
|
257183
257556
|
evidenceOverlay = {
|
|
257184
257557
|
...overlay,
|
|
@@ -257190,7 +257563,18 @@ function buildMergedContract(options2) {
|
|
|
257190
257563
|
} catch {
|
|
257191
257564
|
}
|
|
257192
257565
|
}
|
|
257193
|
-
|
|
257566
|
+
let keepSite = options2.keepSite === true;
|
|
257567
|
+
if (!keepSite && options2.sitePageHost && existsSync137(previousPath)) {
|
|
257568
|
+
try {
|
|
257569
|
+
const carried = websiteSiteToCarry(JSON.parse(readFileSync167(previousPath, "utf8")), overlay);
|
|
257570
|
+
if (carried) {
|
|
257571
|
+
evidenceOverlay = { ...evidenceOverlay, site: carried };
|
|
257572
|
+
keepSite = true;
|
|
257573
|
+
}
|
|
257574
|
+
} catch {
|
|
257575
|
+
}
|
|
257576
|
+
}
|
|
257577
|
+
const merged = mergeCustomerOwned(committed, evidenceOverlay, { keepSite });
|
|
257194
257578
|
const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
|
|
257195
257579
|
const branding = merged.branding ?? {};
|
|
257196
257580
|
const staged = [];
|
|
@@ -257201,8 +257585,8 @@ function buildMergedContract(options2) {
|
|
|
257201
257585
|
};
|
|
257202
257586
|
const stage = (fromRel, toRel) => {
|
|
257203
257587
|
const from = contained(packageDir, fromRel);
|
|
257204
|
-
const to2 = contained(
|
|
257205
|
-
if (!from || !to2 || !
|
|
257588
|
+
const to2 = contained(join175(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
257589
|
+
if (!from || !to2 || !existsSync137(from)) return void 0;
|
|
257206
257590
|
let real;
|
|
257207
257591
|
let realRoot;
|
|
257208
257592
|
try {
|
|
@@ -257224,11 +257608,11 @@ function buildMergedContract(options2) {
|
|
|
257224
257608
|
};
|
|
257225
257609
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
257226
257610
|
if (icon) branding.appIconPath = icon;
|
|
257227
|
-
const facesPath =
|
|
257228
|
-
if (
|
|
257611
|
+
const facesPath = join175(packageDir, "media/fonts/faces.json");
|
|
257612
|
+
if (existsSync137(facesPath)) {
|
|
257229
257613
|
let faces = [];
|
|
257230
257614
|
try {
|
|
257231
|
-
const parsed = JSON.parse(
|
|
257615
|
+
const parsed = JSON.parse(readFileSync167(facesPath, "utf8"));
|
|
257232
257616
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
257233
257617
|
} catch {
|
|
257234
257618
|
faces = [];
|
|
@@ -257249,9 +257633,9 @@ function buildMergedContract(options2) {
|
|
|
257249
257633
|
merged.branding = branding;
|
|
257250
257634
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
257251
257635
|
`;
|
|
257252
|
-
const path2 =
|
|
257636
|
+
const path2 = join175(packageDir, "provisioning.contract.json");
|
|
257253
257637
|
writeFileSync68(path2, body);
|
|
257254
|
-
const localPath2 =
|
|
257638
|
+
const localPath2 = join175(appDir3, LOCAL_CONTRACT_REL);
|
|
257255
257639
|
mkdirSync62(dirname75(localPath2), { recursive: true });
|
|
257256
257640
|
writeFileSync68(localPath2, body);
|
|
257257
257641
|
staged.push(localPath2);
|
|
@@ -257286,10 +257670,10 @@ function catalogTypography(overlay, template) {
|
|
|
257286
257670
|
function staticFaqFor(overlay, overlayPath) {
|
|
257287
257671
|
const own6 = overlay.faq;
|
|
257288
257672
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
257289
|
-
const bookPath =
|
|
257290
|
-
if (!
|
|
257673
|
+
const bookPath = join175(dirname75(resolve112(overlayPath)), "book.json");
|
|
257674
|
+
if (!existsSync137(bookPath)) return void 0;
|
|
257291
257675
|
try {
|
|
257292
|
-
const book = JSON.parse(
|
|
257676
|
+
const book = JSON.parse(readFileSync167(bookPath, "utf8"));
|
|
257293
257677
|
const copy = book?.copy;
|
|
257294
257678
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
257295
257679
|
const pairs2 = deriveStaticFaq(copy.faq);
|
|
@@ -257303,10 +257687,10 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
257303
257687
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
257304
257688
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
257305
257689
|
);
|
|
257306
|
-
const bookPath =
|
|
257307
|
-
if (!
|
|
257690
|
+
const bookPath = join175(dirname75(resolve112(overlayPath)), "book.json");
|
|
257691
|
+
if (!existsSync137(bookPath)) return void 0;
|
|
257308
257692
|
try {
|
|
257309
|
-
const book = JSON.parse(
|
|
257693
|
+
const book = JSON.parse(readFileSync167(bookPath, "utf8"));
|
|
257310
257694
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
257311
257695
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
257312
257696
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -257318,8 +257702,15 @@ async function applyOverlays(input) {
|
|
|
257318
257702
|
const cwd = resolve112(input.cwd);
|
|
257319
257703
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
257320
257704
|
assertKnownShell(shell);
|
|
257321
|
-
|
|
257322
|
-
|
|
257705
|
+
if (input.sitePages && !isSitePageHost(shell)) {
|
|
257706
|
+
throw Object.assign(new Error(siteHostRefusal(shell)), { exit: 2, code: SITE_PAGES_SHELL_UNSUPPORTED });
|
|
257707
|
+
}
|
|
257708
|
+
const overlay = JSON.parse(readFileSync167(input.overlayPath, "utf8"));
|
|
257709
|
+
const sitePages = input.sitePages === true;
|
|
257710
|
+
const plan = input.sitePagesPlan;
|
|
257711
|
+
const planNote = sitePages && plan ? plan.notes[0] : void 0;
|
|
257712
|
+
const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
|
|
257713
|
+
const tokens2 = JSON.parse(readFileSync167(input.tokensPath, "utf8"));
|
|
257323
257714
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
257324
257715
|
if (faq !== void 0) overlay.faq = faq;
|
|
257325
257716
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -257336,16 +257727,26 @@ async function applyOverlays(input) {
|
|
|
257336
257727
|
`shell "${shell}" cannot bake a customer brand \u2014 it ships no prepare:customer script`
|
|
257337
257728
|
);
|
|
257338
257729
|
}
|
|
257339
|
-
const appDir3 =
|
|
257340
|
-
const committedPath =
|
|
257341
|
-
const committedSite =
|
|
257730
|
+
const appDir3 = join175(repoRoot2, shellAppDir(shell));
|
|
257731
|
+
const committedPath = join175(appDir3, "provisioning.json");
|
|
257732
|
+
const committedSite = existsSync137(committedPath) ? JSON.parse(readFileSync167(committedPath, "utf8")).site : void 0;
|
|
257342
257733
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
257343
257734
|
throw new Error(
|
|
257344
257735
|
`shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), and this overlay has none. Re-run \`himi site analyze --url <site> --shell ${shell}\` to derive the site's page map (edit \`site.pages\` in provisioning.overlay.json if needed), then --apply.`
|
|
257345
257736
|
);
|
|
257346
257737
|
}
|
|
257347
257738
|
const packageDir = dirname75(resolve112(input.overlayPath));
|
|
257348
|
-
|
|
257739
|
+
if (input.dryRun) {
|
|
257740
|
+
return {
|
|
257741
|
+
mode: "dry",
|
|
257742
|
+
target: "in-repo",
|
|
257743
|
+
wrote: [],
|
|
257744
|
+
wouldWrite: [join175(packageDir, "provisioning.contract.json"), join175(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
|
|
257745
|
+
note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
|
|
257746
|
+
...sitePagesOut()
|
|
257747
|
+
};
|
|
257748
|
+
}
|
|
257749
|
+
const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay, keepSite: sitePages, sitePageHost: isSitePageHost(shell) });
|
|
257349
257750
|
wrote.push(...staged);
|
|
257350
257751
|
const r3 = spawnSync11("npm", ["run", "prepare:customer", "--", "--contract", contract], {
|
|
257351
257752
|
cwd: appDir3,
|
|
@@ -257356,18 +257757,39 @@ async function applyOverlays(input) {
|
|
|
257356
257757
|
return {
|
|
257357
257758
|
mode: "in-repo",
|
|
257358
257759
|
wrote,
|
|
257359
|
-
|
|
257760
|
+
...sitePagesOut(),
|
|
257761
|
+
note: `${planNote ? `${planNote} \xB7 ` : ""}${unpairedInRepo ? `${unpairedInRepo} \xB7 ` : ""}prepare:customer --contract failed (${r3.status}): ${(r3.stderr || r3.stdout || "").slice(0, 400)}. Merged contract left at ${contract} (your overlay is untouched); committed provisioning.json was not touched.`
|
|
257360
257762
|
};
|
|
257361
257763
|
}
|
|
257362
257764
|
return {
|
|
257363
257765
|
mode: "in-repo",
|
|
257364
257766
|
wrote: [contract, ...staged],
|
|
257365
|
-
|
|
257767
|
+
...sitePagesOut(),
|
|
257768
|
+
note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
|
|
257366
257769
|
};
|
|
257367
257770
|
}
|
|
257368
|
-
const pkgProv =
|
|
257771
|
+
const pkgProv = join175(cwd, "provisioning.json");
|
|
257369
257772
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
257370
|
-
|
|
257773
|
+
if (input.dryRun) {
|
|
257774
|
+
const pages2 = sitePages ? applySitePagesToPackage(cwd, overlay.site, { dryRun: true }) : void 0;
|
|
257775
|
+
const screens = pages2 && !pages2.refused ? { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows } : void 0;
|
|
257776
|
+
const touchesPackage = !!screens && (screens.added.length + screens.removed.length + screens.replaced.length > 0 || screens.rows.length > 0);
|
|
257777
|
+
return {
|
|
257778
|
+
mode: "dry",
|
|
257779
|
+
target: "off-repo",
|
|
257780
|
+
wrote: [],
|
|
257781
|
+
wouldWrite: [
|
|
257782
|
+
pkgProv,
|
|
257783
|
+
...existsSync137(join175(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join175(cwd, "tokens.json")] : [],
|
|
257784
|
+
...existsSync137(join175(cwd, "dev/index.ts")) ? [join175(cwd, "dev/index.ts")] : [],
|
|
257785
|
+
...touchesPackage ? [join175(cwd, "config.ts"), join175(cwd, "himalaya.content.json")] : [],
|
|
257786
|
+
...input.iconPath && existsSync137(input.iconPath) ? [join175(cwd, "icon.png")] : []
|
|
257787
|
+
],
|
|
257788
|
+
note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
|
|
257789
|
+
...sitePagesOut(screens)
|
|
257790
|
+
};
|
|
257791
|
+
}
|
|
257792
|
+
const contentPath = join175(cwd, "himalaya.content.json");
|
|
257371
257793
|
const syncViewNames = (before, after) => {
|
|
257372
257794
|
const content = readContentManifest(cwd);
|
|
257373
257795
|
if (!content) return;
|
|
@@ -257377,10 +257799,12 @@ async function applyOverlays(input) {
|
|
|
257377
257799
|
wrote.push(contentPath);
|
|
257378
257800
|
}
|
|
257379
257801
|
};
|
|
257802
|
+
const pagesRefused = sitePages ? applySitePagesToPackage(cwd, overlay.site, { dryRun: true }).refused : void 0;
|
|
257803
|
+
const recordSite = sitePages && !pagesRefused;
|
|
257380
257804
|
let packageFaq = faq;
|
|
257381
257805
|
let packageGalleries = galleries;
|
|
257382
|
-
if (
|
|
257383
|
-
const cur = JSON.parse(
|
|
257806
|
+
if (existsSync137(pkgProv)) {
|
|
257807
|
+
const cur = JSON.parse(readFileSync167(pkgProv, "utf8"));
|
|
257384
257808
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
257385
257809
|
const merged = deepMerge4(cur, overlay);
|
|
257386
257810
|
if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
|
|
@@ -257391,20 +257815,29 @@ async function applyOverlays(input) {
|
|
|
257391
257815
|
else if (!sameKnownSite(cur, overlay)) delete merged.businessTimeZone;
|
|
257392
257816
|
packageFaq = merged.faq;
|
|
257393
257817
|
packageGalleries = merged.galleries;
|
|
257394
|
-
|
|
257818
|
+
if (recordSite) {
|
|
257819
|
+
if (overlay.site) merged.site = overlay.site;
|
|
257820
|
+
else delete merged.site;
|
|
257821
|
+
} else if (sitePages) {
|
|
257822
|
+
if (cur.site === void 0) delete merged.site;
|
|
257823
|
+
else merged.site = cur.site;
|
|
257824
|
+
} else {
|
|
257825
|
+
syncViewNames(cur.site, merged.site);
|
|
257826
|
+
}
|
|
257395
257827
|
writeFileSync68(pkgProv, JSON.stringify(merged, null, 2) + "\n");
|
|
257396
257828
|
wrote.push(pkgProv);
|
|
257397
257829
|
} else {
|
|
257398
|
-
syncViewNames(void 0, overlay.site);
|
|
257399
|
-
|
|
257830
|
+
if (!sitePages) syncViewNames(void 0, overlay.site);
|
|
257831
|
+
const { site: _unrecorded, ...withoutSite } = overlay;
|
|
257832
|
+
writeFileSync68(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
|
|
257400
257833
|
wrote.push(pkgProv);
|
|
257401
257834
|
}
|
|
257402
257835
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
257403
257836
|
overlay.installedVerticals.push("galleries");
|
|
257404
257837
|
}
|
|
257405
|
-
const pkgTokens =
|
|
257406
|
-
if (
|
|
257407
|
-
const cur = JSON.parse(
|
|
257838
|
+
const pkgTokens = join175(cwd, "tokens.json");
|
|
257839
|
+
if (existsSync137(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
257840
|
+
const cur = JSON.parse(readFileSync167(pkgTokens, "utf8"));
|
|
257408
257841
|
let tokensIn = tokens2;
|
|
257409
257842
|
if (tokens2.typography) {
|
|
257410
257843
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -257429,9 +257862,9 @@ async function applyOverlays(input) {
|
|
|
257429
257862
|
wrote.push(pkgTokens);
|
|
257430
257863
|
}
|
|
257431
257864
|
const homeAction = homeRefreshActionId(shell);
|
|
257432
|
-
const homeSrc =
|
|
257433
|
-
if (homeAction &&
|
|
257434
|
-
const prev =
|
|
257865
|
+
const homeSrc = join175(cwd, "dev/index.ts");
|
|
257866
|
+
if (homeAction && existsSync137(homeSrc)) {
|
|
257867
|
+
const prev = readFileSync167(homeSrc, "utf8");
|
|
257435
257868
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
257436
257869
|
let next = patched.src;
|
|
257437
257870
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -257466,13 +257899,21 @@ async function applyOverlays(input) {
|
|
|
257466
257899
|
notes.push(`${patched.unparsed} onAppear params block(s) in ${homeSrc} could not be read \u2014 any brand values inside them were not applied`);
|
|
257467
257900
|
}
|
|
257468
257901
|
}
|
|
257469
|
-
|
|
257902
|
+
let pageScreens;
|
|
257903
|
+
if (pagesRefused) notes.push(`website pages not added: ${pagesRefused}`);
|
|
257904
|
+
else if (sitePages) {
|
|
257905
|
+
const pages2 = applySitePagesToPackage(cwd, overlay.site);
|
|
257906
|
+
wrote.push(...pages2.wrote.filter((path2) => !wrote.includes(path2)));
|
|
257907
|
+
if (pages2.refused) notes.push(`website pages not added: ${pages2.refused}`);
|
|
257908
|
+
else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
|
|
257909
|
+
}
|
|
257910
|
+
if (!input.iconPath || !existsSync137(input.iconPath)) {
|
|
257470
257911
|
const book = input.iconPath ? dirname75(dirname75(resolve112(input.iconPath))) : void 0;
|
|
257471
257912
|
notes.push(
|
|
257472
257913
|
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"
|
|
257473
257914
|
);
|
|
257474
257915
|
}
|
|
257475
|
-
if (input.iconPath &&
|
|
257916
|
+
if (input.iconPath && existsSync137(input.iconPath)) {
|
|
257476
257917
|
try {
|
|
257477
257918
|
const installed3 = await installIcon(cwd, input.iconPath, { derivePlay: true });
|
|
257478
257919
|
wrote.push(...installed3.wrote);
|
|
@@ -257487,7 +257928,8 @@ async function applyOverlays(input) {
|
|
|
257487
257928
|
}
|
|
257488
257929
|
const unpaired = unpairedRedirectNote(overlay);
|
|
257489
257930
|
if (unpaired) notes.push(unpaired);
|
|
257490
|
-
|
|
257931
|
+
if (planNote) notes.unshift(planNote);
|
|
257932
|
+
return { mode: "off-repo", wrote, ...sitePagesOut(pageScreens), ...notes.length ? { note: notes.join(" \xB7 ") } : {} };
|
|
257491
257933
|
}
|
|
257492
257934
|
function patchBrandParams(src, overlay, homeActionId) {
|
|
257493
257935
|
const layout2 = overlay.appearance?.homeLayout;
|
|
@@ -257560,7 +258002,7 @@ function patchBrandParams(src, overlay, homeActionId) {
|
|
|
257560
258002
|
}
|
|
257561
258003
|
return { src: out2 + src.slice(cursor), applied, unparsed, foreign: false };
|
|
257562
258004
|
}
|
|
257563
|
-
var STAGED;
|
|
258005
|
+
var SITE_PAGES_SHELL_UNSUPPORTED, STAGED;
|
|
257564
258006
|
var init_apply3 = __esm({
|
|
257565
258007
|
"src/site-analyze/apply.ts"() {
|
|
257566
258008
|
init_define_HHP_CATALOG();
|
|
@@ -257568,6 +258010,8 @@ var init_apply3 = __esm({
|
|
|
257568
258010
|
init_site_view_metadata();
|
|
257569
258011
|
init_icon2();
|
|
257570
258012
|
init_brandable_shells();
|
|
258013
|
+
init_site_pages_apply();
|
|
258014
|
+
init_site_pages_host();
|
|
257571
258015
|
init_customer_build();
|
|
257572
258016
|
init_branding_derive();
|
|
257573
258017
|
init_brand_color_math();
|
|
@@ -257576,6 +258020,7 @@ var init_apply3 = __esm({
|
|
|
257576
258020
|
init_catalog2();
|
|
257577
258021
|
init_plan_fonts();
|
|
257578
258022
|
init_tokens();
|
|
258023
|
+
SITE_PAGES_SHELL_UNSUPPORTED = "site_pages_shell_unsupported";
|
|
257579
258024
|
STAGED = ".himi/brand";
|
|
257580
258025
|
}
|
|
257581
258026
|
});
|
|
@@ -257627,20 +258072,18 @@ function pageId(c2, used) {
|
|
|
257627
258072
|
used.add(id);
|
|
257628
258073
|
return id;
|
|
257629
258074
|
}
|
|
257630
|
-
function
|
|
257631
|
-
const origin = normalizeSiteOrigin(input.siteUrl);
|
|
257632
|
-
const kind = input.kind ?? siteKindForOrigin(origin);
|
|
258075
|
+
function walkSiteCandidates(origin, input) {
|
|
257633
258076
|
const notes = [];
|
|
257634
258077
|
const published = input.look.sitePages ?? [];
|
|
257635
258078
|
const mainPageId = input.look.mainPageId;
|
|
257636
258079
|
const candidates = [];
|
|
257637
258080
|
const seenPaths = /* @__PURE__ */ new Set(["/"]);
|
|
257638
|
-
|
|
258081
|
+
const systemPages = [];
|
|
257639
258082
|
const add = (title, path2, url) => {
|
|
257640
258083
|
if (seenPaths.has(path2) || !title) return;
|
|
257641
258084
|
if (isSystemPage(path2, title)) {
|
|
257642
258085
|
seenPaths.add(path2);
|
|
257643
|
-
|
|
258086
|
+
systemPages.push({ title: boundedTitle(title), path: path2 });
|
|
257644
258087
|
return;
|
|
257645
258088
|
}
|
|
257646
258089
|
seenPaths.add(path2);
|
|
@@ -257683,7 +258126,15 @@ function deriveSiteShell(input) {
|
|
|
257683
258126
|
notes.push("site pages: no header menu was crawled, so pages follow the published page list \u2014 reorder them in `site.pages` if the site's menu differs.");
|
|
257684
258127
|
}
|
|
257685
258128
|
}
|
|
257686
|
-
|
|
258129
|
+
return { candidates, homeTitle, systemPages, notes, routes, published, navLinks };
|
|
258130
|
+
}
|
|
258131
|
+
function deriveSiteShell(input) {
|
|
258132
|
+
const origin = normalizeSiteOrigin(input.siteUrl);
|
|
258133
|
+
const kind = input.kind ?? siteKindForOrigin(origin);
|
|
258134
|
+
const walk3 = walkSiteCandidates(origin, input);
|
|
258135
|
+
const { candidates, homeTitle, routes, published, navLinks } = walk3;
|
|
258136
|
+
const notes = [...walk3.notes];
|
|
258137
|
+
if (walk3.systemPages.length) notes.push(`site pages: left out ${walk3.systemPages.length} flow/utility page(s) (thank-you, popups, item templates, members-area pages).`);
|
|
257687
258138
|
const dropped = Math.max(0, candidates.length - (DERIVED_SITE_MAX_PAGES - 1));
|
|
257688
258139
|
const kept = candidates.slice(0, DERIVED_SITE_MAX_PAGES - 1);
|
|
257689
258140
|
if (dropped) notes.push(`site pages: kept the first ${DERIVED_SITE_MAX_PAGES} pages; ${dropped} more are reachable from the site's own links but have no native row.`);
|
|
@@ -257762,6 +258213,73 @@ function routeTitle(r3) {
|
|
|
257762
258213
|
const seg2 = r3.path.split("/").filter(Boolean).pop() ?? r3.path;
|
|
257763
258214
|
return seg2.replace(/[-_]+/g, " ").replace(/\b\w/g, (c2) => c2.toUpperCase());
|
|
257764
258215
|
}
|
|
258216
|
+
function siteReason(role, vertical, installed3) {
|
|
258217
|
+
if (vertical && installed3) return `the app has no ${vertical} screen`;
|
|
258218
|
+
if (vertical) return `the site does not run ${vertical}, so no native screen reads it`;
|
|
258219
|
+
if (role === "faq") return "no FAQ pairs or FAQ app were found for the native FAQ screen";
|
|
258220
|
+
if (role === "gallery") return "no gallery photos were found for a native gallery";
|
|
258221
|
+
if (role === "contact") return "no business contact details were found for the native contact screen";
|
|
258222
|
+
return "no native screen for this page";
|
|
258223
|
+
}
|
|
258224
|
+
function websiteChrome(kind) {
|
|
258225
|
+
return kind === "wix" ? { hideSiteHeader: true, hideSiteFooter: true, hideWixAds: true } : { hideSiteHeader: true, hideSiteFooter: true };
|
|
258226
|
+
}
|
|
258227
|
+
function deriveSitePages(input) {
|
|
258228
|
+
const origin = normalizeSiteOrigin(input.siteUrl);
|
|
258229
|
+
const kind = siteKindForOrigin(origin);
|
|
258230
|
+
const walk3 = walkSiteCandidates(origin, input);
|
|
258231
|
+
const installed3 = new Set(input.installedVerticals);
|
|
258232
|
+
const ships = (screenId) => !input.nativeScreens || input.nativeScreens.has(screenId);
|
|
258233
|
+
const site = [];
|
|
258234
|
+
const native = [];
|
|
258235
|
+
const skipped = walk3.systemPages.map((p2) => ({ ...p2, reason: "a flow or utility page (thank-you, popup, item template, members area)" }));
|
|
258236
|
+
const used = /* @__PURE__ */ new Set(["home"]);
|
|
258237
|
+
const pages2 = [];
|
|
258238
|
+
const cards = EXPLORE_CARDS;
|
|
258239
|
+
for (const c2 of walk3.candidates) {
|
|
258240
|
+
const page = { title: c2.title, path: c2.path };
|
|
258241
|
+
if (c2.role === "home") {
|
|
258242
|
+
skipped.push({ ...page, reason: "the site's home page \u2014 the app's native Home is it" });
|
|
258243
|
+
continue;
|
|
258244
|
+
}
|
|
258245
|
+
if (c2.role === "members") {
|
|
258246
|
+
skipped.push({ ...page, reason: "a members page \u2014 the app's Profile and sign-in are native" });
|
|
258247
|
+
continue;
|
|
258248
|
+
}
|
|
258249
|
+
const vertical = verticalOfPage({ role: c2.role, url: `${origin.replace(/\/$/, "")}${c2.path}`, title: c2.title });
|
|
258250
|
+
const card2 = vertical && Object.hasOwn(cards, vertical) ? cards[vertical] : void 0;
|
|
258251
|
+
if (vertical && installed3.has(vertical) && card2 && ships(card2.screenId)) {
|
|
258252
|
+
native.push({ ...page, screenId: card2.screenId, vertical });
|
|
258253
|
+
continue;
|
|
258254
|
+
}
|
|
258255
|
+
const contentScreen = vertical ? void 0 : c2.role === "faq" && (input.faq || installed3.has("faq")) ? "himi_faq" : c2.role === "gallery" && installed3.has("portfolio") ? "himi_portfolio" : c2.role === "gallery" && (input.galleries || installed3.has("galleries")) ? "himi_galleries" : c2.role === "contact" && input.businessContact ? "himi_business_contact" : void 0;
|
|
258256
|
+
if (contentScreen && ships(contentScreen)) {
|
|
258257
|
+
native.push({ ...page, screenId: contentScreen });
|
|
258258
|
+
continue;
|
|
258259
|
+
}
|
|
258260
|
+
if (site.length >= DERIVED_SITE_MAX_PAGES) {
|
|
258261
|
+
skipped.push({ ...page, reason: `past the ${DERIVED_SITE_MAX_PAGES}-page cap \u2014 reachable from the site's own links` });
|
|
258262
|
+
continue;
|
|
258263
|
+
}
|
|
258264
|
+
const id = pageId(c2, used);
|
|
258265
|
+
site.push({ id, ...page, screenId: `site_${id}`, placement: "drawer", reason: siteReason(c2.role, vertical, !!vertical && installed3.has(vertical)) });
|
|
258266
|
+
pages2.push({ id, title: c2.title, path: c2.path, icon: ROLE_ICON[c2.role], placement: "drawer" });
|
|
258267
|
+
}
|
|
258268
|
+
const notes = [...walk3.notes];
|
|
258269
|
+
let block;
|
|
258270
|
+
if (pages2.length) {
|
|
258271
|
+
block = { origin, kind, pages: pages2, chrome: websiteChrome(kind) };
|
|
258272
|
+
assertSiteShellConfig(block, { requireTab: false });
|
|
258273
|
+
}
|
|
258274
|
+
if (!walk3.published.length && !walk3.navLinks.length && !input.look.navLabels.length) {
|
|
258275
|
+
notes.push("site pages: the analysis read no page list (no header menu, no published pages), so there are no website pages to add.");
|
|
258276
|
+
}
|
|
258277
|
+
const named3 = site.slice(0, 4).map((p2) => p2.title).join(", ") + (site.length > 4 ? `, +${site.length - 4} more` : "");
|
|
258278
|
+
notes.unshift(
|
|
258279
|
+
`site pages: ${site.length} open the website${site.length ? ` (${named3} \u2014 drawer section "From our website")` : ""}; ${native.length} have native screens; ${skipped.length} left out.`
|
|
258280
|
+
);
|
|
258281
|
+
return { site, native, skipped, notes, ...block ? { block } : {} };
|
|
258282
|
+
}
|
|
257765
258283
|
var DERIVED_SITE_MAX_PAGES, SITE_PAGE_TITLE_MAX, ROLE_ICON, TAB_ROLES, SYSTEM_SEGMENT, SYSTEM_TITLE, HOME_WORD, MEMBER_PAGE_ROUTES, oneLine2, RESERVED_PAGE_IDS;
|
|
257766
258284
|
var init_site_shell_derive = __esm({
|
|
257767
258285
|
"src/site-analyze/site-shell-derive.ts"() {
|
|
@@ -257769,6 +258287,7 @@ var init_site_shell_derive = __esm({
|
|
|
257769
258287
|
init_site_shell();
|
|
257770
258288
|
init_site_menu_script_generated();
|
|
257771
258289
|
init_traits();
|
|
258290
|
+
init_home_descriptor();
|
|
257772
258291
|
DERIVED_SITE_MAX_PAGES = 10;
|
|
257773
258292
|
SITE_PAGE_TITLE_MAX = 40;
|
|
257774
258293
|
ROLE_ICON = {
|
|
@@ -258423,6 +258942,8 @@ var init_site_function = __esm({
|
|
|
258423
258942
|
var cli_exports3 = {};
|
|
258424
258943
|
__export(cli_exports3, {
|
|
258425
258944
|
APPLY_NEEDS_CLIENT: () => APPLY_NEEDS_CLIENT,
|
|
258945
|
+
DRY_RUN_NEEDS_SITE_PAGES: () => DRY_RUN_NEEDS_SITE_PAGES,
|
|
258946
|
+
DRY_RUN_NEEDS_SITE_PAGES_MESSAGE: () => DRY_RUN_NEEDS_SITE_PAGES_MESSAGE,
|
|
258426
258947
|
REDIRECT_NEEDS_CLIENT: () => REDIRECT_NEEDS_CLIENT,
|
|
258427
258948
|
SITE_FUNCTION_USAGE: () => SITE_FUNCTION_USAGE,
|
|
258428
258949
|
applyNeedsClient: () => applyNeedsClient,
|
|
@@ -258432,10 +258953,17 @@ __export(cli_exports3, {
|
|
|
258432
258953
|
noteWithWarnings: () => noteWithWarnings,
|
|
258433
258954
|
ownerSiteFor: () => ownerSiteFor,
|
|
258434
258955
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
258435
|
-
runSiteFunctionCli: () => runSiteFunctionCli
|
|
258956
|
+
runSiteFunctionCli: () => runSiteFunctionCli,
|
|
258957
|
+
sitePagesRefusal: () => sitePagesRefusal
|
|
258436
258958
|
});
|
|
258437
|
-
import { existsSync as
|
|
258959
|
+
import { existsSync as existsSync138, readFileSync as readFileSync168 } from "node:fs";
|
|
258438
258960
|
import { resolve as resolve113 } from "node:path";
|
|
258961
|
+
function sitePagesRefusal(opts) {
|
|
258962
|
+
const shell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
258963
|
+
if (opts.sitePages && SHELL_NAMES.includes(shell) && !isSitePageHost(shell)) return { code: SITE_PAGES_SHELL_UNSUPPORTED, error: siteHostRefusal(shell) };
|
|
258964
|
+
if (opts.dryRun && !(opts.apply && opts.sitePages)) return { code: DRY_RUN_NEEDS_SITE_PAGES, error: DRY_RUN_NEEDS_SITE_PAGES_MESSAGE };
|
|
258965
|
+
return void 0;
|
|
258966
|
+
}
|
|
258439
258967
|
function applyNeedsClient(shell) {
|
|
258440
258968
|
if (shell === void 0 || !SHELL_NAMES.includes(shell)) return true;
|
|
258441
258969
|
return !isSiteShell(shell);
|
|
@@ -258460,6 +258988,8 @@ async function mobileAppAuthFor(ownerAuth, deps = {}) {
|
|
|
258460
258988
|
}
|
|
258461
258989
|
async function runSiteAnalyze(opts) {
|
|
258462
258990
|
if (opts.shell !== void 0) assertKnownShell(opts.shell);
|
|
258991
|
+
const pagesRefusal = sitePagesRefusal(opts);
|
|
258992
|
+
if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
|
|
258463
258993
|
if (!opts.clientId?.trim()) {
|
|
258464
258994
|
if (opts.apply && applyNeedsClient(opts.shell)) throw Object.assign(new Error(APPLY_NEEDS_CLIENT), { exit: 2 });
|
|
258465
258995
|
if (opts.redirectUri?.trim()) throw Object.assign(new Error(REDIRECT_NEEDS_CLIENT), { exit: 2 });
|
|
@@ -258502,9 +259032,9 @@ async function runSiteAnalyze(opts) {
|
|
|
258502
259032
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
258503
259033
|
const derived2 = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
258504
259034
|
const prevOverlayPath = resolve113(outDir, "provisioning.overlay.json");
|
|
258505
|
-
const prevSite =
|
|
259035
|
+
const prevSite = existsSync138(prevOverlayPath) ? (() => {
|
|
258506
259036
|
try {
|
|
258507
|
-
return JSON.parse(
|
|
259037
|
+
return JSON.parse(readFileSync168(prevOverlayPath, "utf8")).site;
|
|
258508
259038
|
} catch {
|
|
258509
259039
|
return void 0;
|
|
258510
259040
|
}
|
|
@@ -258521,9 +259051,37 @@ async function runSiteAnalyze(opts) {
|
|
|
258521
259051
|
];
|
|
258522
259052
|
}
|
|
258523
259053
|
}
|
|
259054
|
+
const targetShell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
259055
|
+
let sitePagesPlan;
|
|
259056
|
+
if (isSitePageHost(targetShell)) {
|
|
259057
|
+
try {
|
|
259058
|
+
const copy = result.book.copy;
|
|
259059
|
+
sitePagesPlan = deriveSitePages({
|
|
259060
|
+
siteUrl: result.book.input.siteUrl,
|
|
259061
|
+
look: result.book.look,
|
|
259062
|
+
installedVerticals: result.provisioningOverlay.installedVerticals ?? [],
|
|
259063
|
+
// Off-repo, the package's own screens (a trimmed template may lack a vertical's); in the
|
|
259064
|
+
// repo, or with no package here, every vertical's screen.
|
|
259065
|
+
nativeScreens: packageScreenIds(cwd),
|
|
259066
|
+
faq: !!copy && !copy.unavailable && deriveStaticFaq(copy.faq).length > 0,
|
|
259067
|
+
galleries: !result.book.look.unavailable && deriveStaticGalleries(result.book.look.pages).length > 0,
|
|
259068
|
+
businessContact: result.provisioningOverlay.businessContact !== void 0
|
|
259069
|
+
});
|
|
259070
|
+
result.book.sitePages = sitePagesPlan;
|
|
259071
|
+
if (opts.sitePages) {
|
|
259072
|
+
if (sitePagesPlan.block) result.provisioningOverlay.site = sitePagesPlan.block;
|
|
259073
|
+
if (sitePagesPlan.notes.length > 1) result.warnings = [...result.warnings ?? [], ...sitePagesPlan.notes.slice(1)];
|
|
259074
|
+
}
|
|
259075
|
+
} catch (e2) {
|
|
259076
|
+
result.warnings = [
|
|
259077
|
+
...result.warnings ?? [],
|
|
259078
|
+
`site pages: could not work out which pages need the website (${e2 instanceof Error ? e2.message : String(e2)})${opts.sitePages ? " \u2014 no website page was added" : ""}.`
|
|
259079
|
+
];
|
|
259080
|
+
}
|
|
259081
|
+
}
|
|
258524
259082
|
const previousOverlay = resolve113(outDir, "provisioning.overlay.json");
|
|
258525
259083
|
carryOverGoals(
|
|
258526
|
-
|
|
259084
|
+
existsSync138(previousOverlay) ? readFileSync168(previousOverlay, "utf8") : void 0,
|
|
258527
259085
|
result.provisioningOverlay
|
|
258528
259086
|
);
|
|
258529
259087
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -258545,7 +259103,10 @@ async function runSiteAnalyze(opts) {
|
|
|
258545
259103
|
overlayPath: resolve113(outDir, "provisioning.overlay.json"),
|
|
258546
259104
|
tokensPath: resolve113(outDir, "tokens.overlay.json"),
|
|
258547
259105
|
iconPath: resolve113(outDir, "media/icon.png"),
|
|
258548
|
-
shell: opts.shell
|
|
259106
|
+
shell: opts.shell,
|
|
259107
|
+
sitePages: opts.sitePages === true,
|
|
259108
|
+
sitePagesPlan,
|
|
259109
|
+
dryRun: opts.dryRun === true
|
|
258549
259110
|
});
|
|
258550
259111
|
const note = noteWithWarnings(applied.note, warnings);
|
|
258551
259112
|
if (note !== applied.note) applied = { ...applied, note };
|
|
@@ -258556,6 +259117,8 @@ async function runSiteAnalyze(opts) {
|
|
|
258556
259117
|
files: written.files,
|
|
258557
259118
|
look: result.book.look.unavailable,
|
|
258558
259119
|
apply: applied,
|
|
259120
|
+
// The plan in brief (book.json / book.md carry it whole); on --apply --site-pages, `apply.sitePages`.
|
|
259121
|
+
...sitePagesPlan && !opts.apply ? { sitePages: { site: sitePagesPlan.site.length, native: sitePagesPlan.native.length, skipped: sitePagesPlan.skipped.length, note: sitePagesPlan.notes[0] } } : {},
|
|
258559
259122
|
...warnings.length ? { warnings } : {}
|
|
258560
259123
|
};
|
|
258561
259124
|
}
|
|
@@ -258581,7 +259144,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
258581
259144
|
let source2;
|
|
258582
259145
|
if (opts.sourcePath) {
|
|
258583
259146
|
const p2 = resolve113(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
258584
|
-
source2 =
|
|
259147
|
+
source2 = readFileSync168(p2, "utf8");
|
|
258585
259148
|
}
|
|
258586
259149
|
let body;
|
|
258587
259150
|
if (opts.bodyRaw != null) {
|
|
@@ -258609,9 +259172,9 @@ async function runSiteFunctionCli(opts) {
|
|
|
258609
259172
|
});
|
|
258610
259173
|
}
|
|
258611
259174
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
258612
|
-
if (!
|
|
259175
|
+
if (!existsSync138(bookPath)) return void 0;
|
|
258613
259176
|
try {
|
|
258614
|
-
const book = JSON.parse(
|
|
259177
|
+
const book = JSON.parse(readFileSync168(bookPath, "utf8"));
|
|
258615
259178
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
258616
259179
|
const host = (u2) => {
|
|
258617
259180
|
try {
|
|
@@ -258632,7 +259195,7 @@ function base44BookRoutes(bookPath, siteUrl) {
|
|
|
258632
259195
|
return void 0;
|
|
258633
259196
|
}
|
|
258634
259197
|
}
|
|
258635
|
-
var APPLY_NEEDS_CLIENT, FUNCTION_OPS;
|
|
259198
|
+
var APPLY_NEEDS_CLIENT, DRY_RUN_NEEDS_SITE_PAGES, DRY_RUN_NEEDS_SITE_PAGES_MESSAGE, FUNCTION_OPS;
|
|
258636
259199
|
var init_cli3 = __esm({
|
|
258637
259200
|
"src/site-analyze/cli.ts"() {
|
|
258638
259201
|
init_define_HHP_CATALOG();
|
|
@@ -258641,6 +259204,8 @@ var init_cli3 = __esm({
|
|
|
258641
259204
|
init_net_guard();
|
|
258642
259205
|
init_apply3();
|
|
258643
259206
|
init_site_shell_derive();
|
|
259207
|
+
init_site_pages_apply();
|
|
259208
|
+
init_derive();
|
|
258644
259209
|
init_brandable_shells();
|
|
258645
259210
|
init_crawl_look();
|
|
258646
259211
|
init_rest();
|
|
@@ -258648,6 +259213,8 @@ var init_cli3 = __esm({
|
|
|
258648
259213
|
init_site_function();
|
|
258649
259214
|
init_types2();
|
|
258650
259215
|
APPLY_NEEDS_CLIENT = "--apply needs --client-id: the applied app must be bound to the site's own Headless client, and a URL-only run has none. `himi site client list --site <msid>` shows the site's clients (`himi site client ensure --site <msid> --yes` mints one); WIX_CLIENT_ID is read as a fallback.";
|
|
259216
|
+
DRY_RUN_NEEDS_SITE_PAGES = "dry_run_needs_site_pages";
|
|
259217
|
+
DRY_RUN_NEEDS_SITE_PAGES_MESSAGE = "--dry-run previews `--apply --site-pages` and needs both: pass `--apply --site-pages --dry-run`. Without --apply, analyze already writes nothing into the app \u2014 book.md's `## Site pages` shows what --site-pages would add.";
|
|
258651
259218
|
FUNCTION_OPS = ["list", "get", "put", "publish", "invoke"];
|
|
258652
259219
|
}
|
|
258653
259220
|
});
|
|
@@ -258779,7 +259346,7 @@ __export(site_create_exports, {
|
|
|
258779
259346
|
runSiteList: () => runSiteList,
|
|
258780
259347
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
258781
259348
|
});
|
|
258782
|
-
import { existsSync as
|
|
259349
|
+
import { existsSync as existsSync139, readFileSync as readFileSync169, writeFileSync as writeFileSync69 } from "node:fs";
|
|
258783
259350
|
import { resolve as resolvePath4 } from "node:path";
|
|
258784
259351
|
function oauthClientName(projectName) {
|
|
258785
259352
|
return `${projectName} client`;
|
|
@@ -258928,7 +259495,7 @@ async function runSiteCreate(opts) {
|
|
|
258928
259495
|
if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
|
|
258929
259496
|
return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
258930
259497
|
}
|
|
258931
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync:
|
|
259498
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync139, readFileSync: readFileSync169, writeFileSync: writeFileSync69 }) {
|
|
258932
259499
|
const msid = binding2.siteId;
|
|
258933
259500
|
const path2 = resolvePath4(target);
|
|
258934
259501
|
const committed = committedShellProvisioning(path2);
|
|
@@ -259345,7 +259912,7 @@ var init_site_oauth_client = __esm({
|
|
|
259345
259912
|
|
|
259346
259913
|
// src/site-analyze/velo-source.ts
|
|
259347
259914
|
import path from "node:path";
|
|
259348
|
-
import
|
|
259915
|
+
import ts24 from "typescript";
|
|
259349
259916
|
function applySourceEdits(source2, edits) {
|
|
259350
259917
|
const chunks = [];
|
|
259351
259918
|
let cursor = 0;
|
|
@@ -259363,13 +259930,13 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
259363
259930
|
/\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,
|
|
259364
259931
|
REDACTED2
|
|
259365
259932
|
).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]");
|
|
259366
|
-
const parsed =
|
|
259933
|
+
const parsed = ts24.createSourceFile("backend.ts", source2, ts24.ScriptTarget.Latest, true);
|
|
259367
259934
|
const comments = /* @__PURE__ */ new Map();
|
|
259368
259935
|
const visitComments = (node3) => {
|
|
259369
259936
|
for (const range of [
|
|
259370
|
-
...
|
|
259371
|
-
...
|
|
259372
|
-
...
|
|
259937
|
+
...ts24.getLeadingCommentRanges(source2, node3.pos) ?? [],
|
|
259938
|
+
...ts24.getTrailingCommentRanges(source2, node3.pos) ?? [],
|
|
259939
|
+
...ts24.getTrailingCommentRanges(source2, node3.end) ?? []
|
|
259373
259940
|
]) comments.set(range.pos, range.end);
|
|
259374
259941
|
for (const child3 of node3.getChildren(parsed)) visitComments(child3);
|
|
259375
259942
|
};
|
|
@@ -259388,22 +259955,22 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
259388
259955
|
if (/^["'`][A-Za-z0-9_+/=-]{24,}["'`]$/.test(token)) return JSON.stringify(REDACTED2);
|
|
259389
259956
|
return token;
|
|
259390
259957
|
};
|
|
259391
|
-
const clean3 =
|
|
259958
|
+
const clean3 = ts24.createSourceFile("backend.ts", source2, ts24.ScriptTarget.Latest, true);
|
|
259392
259959
|
const masks = [];
|
|
259393
259960
|
const collectMasks = (node3) => {
|
|
259394
259961
|
const start = node3.getStart(clean3);
|
|
259395
|
-
if (
|
|
259962
|
+
if (ts24.isRegularExpressionLiteral(node3)) {
|
|
259396
259963
|
masks.push({ start, end: node3.end, text: " ".repeat(node3.end - start) });
|
|
259397
|
-
} else if (
|
|
259964
|
+
} else if (ts24.isStringLiteral(node3) || ts24.isTemplateLiteralToken(node3)) {
|
|
259398
259965
|
masks.push({ start, end: node3.end, text: source2.slice(start, node3.end).replace(/;/g, " ") });
|
|
259399
259966
|
}
|
|
259400
|
-
|
|
259967
|
+
ts24.forEachChild(node3, collectMasks);
|
|
259401
259968
|
};
|
|
259402
259969
|
collectMasks(clean3);
|
|
259403
259970
|
const assignmentContext = applySourceEdits(source2, masks);
|
|
259404
259971
|
const edits = [];
|
|
259405
259972
|
const visitLiterals = (node3) => {
|
|
259406
|
-
if (
|
|
259973
|
+
if (ts24.isStringLiteral(node3) || ts24.isNoSubstitutionTemplateLiteral(node3) || ts24.isTemplateExpression(node3)) {
|
|
259407
259974
|
const start = node3.getStart(clean3);
|
|
259408
259975
|
const text25 = source2.slice(start, node3.end);
|
|
259409
259976
|
const redacted = redactLiteral(text25, start);
|
|
@@ -259412,7 +259979,7 @@ function redactVeloSource(source2, knownSecrets = []) {
|
|
|
259412
259979
|
return;
|
|
259413
259980
|
}
|
|
259414
259981
|
}
|
|
259415
|
-
|
|
259982
|
+
ts24.forEachChild(node3, visitLiterals);
|
|
259416
259983
|
};
|
|
259417
259984
|
visitLiterals(clean3);
|
|
259418
259985
|
return applySourceEdits(source2, edits);
|
|
@@ -259451,19 +260018,19 @@ function selectVeloSource(files, request2, knownSecrets = []) {
|
|
|
259451
260018
|
selected.set(file2.path, { source: excerpt, sourceTruncated: excerpt.length < redacted.length });
|
|
259452
260019
|
remaining -= excerpt.length;
|
|
259453
260020
|
const dependencies = [];
|
|
259454
|
-
const parsed =
|
|
260021
|
+
const parsed = ts24.createSourceFile(file2.path, file2.content, ts24.ScriptTarget.Latest, true);
|
|
259455
260022
|
const specifiers = [];
|
|
259456
260023
|
const collectImports = (node3) => {
|
|
259457
260024
|
let specifier;
|
|
259458
|
-
if (
|
|
260025
|
+
if (ts24.isImportDeclaration(node3) || ts24.isExportDeclaration(node3)) {
|
|
259459
260026
|
specifier = node3.moduleSpecifier;
|
|
259460
|
-
} else if (
|
|
260027
|
+
} else if (ts24.isImportEqualsDeclaration(node3) && ts24.isExternalModuleReference(node3.moduleReference)) {
|
|
259461
260028
|
specifier = node3.moduleReference.expression;
|
|
259462
|
-
} else if (
|
|
260029
|
+
} else if (ts24.isCallExpression(node3) && (node3.expression.kind === ts24.SyntaxKind.ImportKeyword || ts24.isIdentifier(node3.expression) && node3.expression.text === "require")) {
|
|
259463
260030
|
specifier = node3.arguments[0];
|
|
259464
260031
|
}
|
|
259465
|
-
if (specifier &&
|
|
259466
|
-
|
|
260032
|
+
if (specifier && ts24.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
|
|
260033
|
+
ts24.forEachChild(node3, collectImports);
|
|
259467
260034
|
};
|
|
259468
260035
|
collectImports(parsed);
|
|
259469
260036
|
for (const specifier of specifiers) {
|
|
@@ -259795,20 +260362,20 @@ __export(capture_exports, {
|
|
|
259795
260362
|
nativeNotConfigured: () => nativeNotConfigured,
|
|
259796
260363
|
variantWidth: () => variantWidth
|
|
259797
260364
|
});
|
|
259798
|
-
import { existsSync as
|
|
259799
|
-
import { join as
|
|
260365
|
+
import { existsSync as existsSync140, mkdirSync as mkdirSync63, rmSync as rmSync42, writeFileSync as writeFileSync70 } from "node:fs";
|
|
260366
|
+
import { join as join176 } from "node:path";
|
|
259800
260367
|
import { pathToFileURL as pathToFileURL11 } from "node:url";
|
|
259801
260368
|
function variantWidth(variant) {
|
|
259802
260369
|
return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
|
|
259803
260370
|
}
|
|
259804
260371
|
function frameFile(outDir, screen, variant, surface) {
|
|
259805
260372
|
mkdirSync63(outDir, { recursive: true });
|
|
259806
|
-
return
|
|
260373
|
+
return join176(outDir, `${screen}.${variant}.${surface}.png`);
|
|
259807
260374
|
}
|
|
259808
260375
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
259809
260376
|
if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
|
|
259810
260377
|
const file2 = localPath(root, entry.mockup);
|
|
259811
|
-
if (!
|
|
260378
|
+
if (!existsSync140(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
|
|
259812
260379
|
const own6 = session ?? new MockupSession();
|
|
259813
260380
|
try {
|
|
259814
260381
|
const png = await own6.shoot(file2, variant);
|
|
@@ -259840,7 +260407,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
|
|
|
259840
260407
|
const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
|
|
259841
260408
|
const out2 = /* @__PURE__ */ new Map();
|
|
259842
260409
|
if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
|
|
259843
|
-
const scratch =
|
|
260410
|
+
const scratch = join176(outDir, `.build-${variant}`);
|
|
259844
260411
|
try {
|
|
259845
260412
|
const outcome = await buildReleaseFromContent2(root, scratch, {
|
|
259846
260413
|
...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
|
|
@@ -259947,9 +260514,9 @@ var init_capture = __esm({
|
|
|
259947
260514
|
|
|
259948
260515
|
// src/fidelity/judge.ts
|
|
259949
260516
|
import { spawn as spawn9 } from "node:child_process";
|
|
259950
|
-
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as
|
|
260517
|
+
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync170, rmSync as rmSync43 } from "node:fs";
|
|
259951
260518
|
import { tmpdir as tmpdir13 } from "node:os";
|
|
259952
|
-
import { basename as basename37, dirname as dirname76, join as
|
|
260519
|
+
import { basename as basename37, dirname as dirname76, join as join177, resolve as resolve114 } from "node:path";
|
|
259953
260520
|
import { fileURLToPath as fileURLToPath39 } from "node:url";
|
|
259954
260521
|
function parseVerdict(value2, captured) {
|
|
259955
260522
|
const v2 = value2;
|
|
@@ -259989,8 +260556,8 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
259989
260556
|
const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
|
|
259990
260557
|
let prompt2, schema2;
|
|
259991
260558
|
try {
|
|
259992
|
-
prompt2 =
|
|
259993
|
-
schema2 =
|
|
260559
|
+
prompt2 = readFileSync170(resolve114(judgeDir, "JUDGE.md"), "utf8");
|
|
260560
|
+
schema2 = readFileSync170(resolve114(judgeDir, "verdict.schema.json"), "utf8");
|
|
259994
260561
|
} catch (e2) {
|
|
259995
260562
|
return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
|
|
259996
260563
|
}
|
|
@@ -259999,10 +260566,10 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
259999
260566
|
"",
|
|
260000
260567
|
`Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename37(strip3)} and judge it.`
|
|
260001
260568
|
].join("\n");
|
|
260002
|
-
const cwd = mkdtempSync12(
|
|
260569
|
+
const cwd = mkdtempSync12(join177(tmpdir13(), "himi-fidelity-judge-"));
|
|
260003
260570
|
let r3;
|
|
260004
260571
|
try {
|
|
260005
|
-
copyFileSync3(strip3,
|
|
260572
|
+
copyFileSync3(strip3, join177(cwd, basename37(strip3)));
|
|
260006
260573
|
r3 = await run3("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
|
|
260007
260574
|
} catch (e2) {
|
|
260008
260575
|
return cannotTell(`the judge could not be prepared: ${e2.message}`);
|
|
@@ -260061,7 +260628,7 @@ var init_judge = __esm({
|
|
|
260061
260628
|
// src/fidelity/score.ts
|
|
260062
260629
|
import { spawn as spawn10 } from "node:child_process";
|
|
260063
260630
|
import { mkdtempSync as mkdtempSync13, rmSync as rmSync44 } from "node:fs";
|
|
260064
|
-
import { join as
|
|
260631
|
+
import { join as join178 } from "node:path";
|
|
260065
260632
|
import { tmpdir as tmpdir14 } from "node:os";
|
|
260066
260633
|
function viewportHeight(width) {
|
|
260067
260634
|
return Math.round(width * 2.165);
|
|
@@ -260083,10 +260650,10 @@ async function scorePair(aFile, bFile, opts = {}) {
|
|
|
260083
260650
|
const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run3, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
|
|
260084
260651
|
const width = Math.min(sizes[0][0], sizes[1][0]);
|
|
260085
260652
|
const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
|
|
260086
|
-
const dir = mkdtempSync13(
|
|
260653
|
+
const dir = mkdtempSync13(join178(tmpdir14(), "himi-fidelity-score-"));
|
|
260087
260654
|
try {
|
|
260088
260655
|
const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
|
|
260089
|
-
const out2 =
|
|
260656
|
+
const out2 = join178(dir, `${i2}.png`);
|
|
260090
260657
|
const mask = opts.mask ?? { top: 0, bottom: 0 };
|
|
260091
260658
|
const draw = [
|
|
260092
260659
|
...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
|
|
@@ -260127,8 +260694,8 @@ var init_score = __esm({
|
|
|
260127
260694
|
});
|
|
260128
260695
|
|
|
260129
260696
|
// ../visual-proof/evidence.mjs
|
|
260130
|
-
import { existsSync as
|
|
260131
|
-
function resolveCaptionFont({ exists: exists2 =
|
|
260697
|
+
import { existsSync as existsSync141, rmSync as rmSync45 } from "node:fs";
|
|
260698
|
+
function resolveCaptionFont({ exists: exists2 = existsSync141, env = process.env } = {}) {
|
|
260132
260699
|
if (env?.VISUAL_PROOF_FONT) return env.VISUAL_PROOF_FONT;
|
|
260133
260700
|
return CAPTION_FONT_CANDIDATES.find((p2) => exists2(p2)) ?? null;
|
|
260134
260701
|
}
|
|
@@ -260162,7 +260729,7 @@ var init_evidence = __esm({
|
|
|
260162
260729
|
|
|
260163
260730
|
// src/fidelity/strip.ts
|
|
260164
260731
|
import { mkdtempSync as mkdtempSync14, rmSync as rmSync46 } from "node:fs";
|
|
260165
|
-
import { join as
|
|
260732
|
+
import { join as join179 } from "node:path";
|
|
260166
260733
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
260167
260734
|
async function buildStrip(frames, out2, opts = {}) {
|
|
260168
260735
|
const run3 = opts.run ?? runProcess;
|
|
@@ -260171,7 +260738,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
260171
260738
|
const { pointsize, strip: strip3 } = labelMetrics(width);
|
|
260172
260739
|
const font = resolveCaptionFont();
|
|
260173
260740
|
const fontArgs = font ? ["-font", font] : [];
|
|
260174
|
-
const dir = mkdtempSync14(
|
|
260741
|
+
const dir = mkdtempSync14(join179(tmpdir15(), "himi-fidelity-strip-"));
|
|
260175
260742
|
const magick2 = async (args) => {
|
|
260176
260743
|
const r3 = await run3("magick", args);
|
|
260177
260744
|
if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
|
|
@@ -260181,7 +260748,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
260181
260748
|
for (const surface of STRIP_ORDER) {
|
|
260182
260749
|
const frame = frames.find((f2) => f2.surface === surface);
|
|
260183
260750
|
if (!frame) continue;
|
|
260184
|
-
const pane =
|
|
260751
|
+
const pane = join179(dir, `${surface}.png`);
|
|
260185
260752
|
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"}`];
|
|
260186
260753
|
const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
|
|
260187
260754
|
await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip3}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
|
|
@@ -260218,7 +260785,7 @@ __export(run_exports2, {
|
|
|
260218
260785
|
unlinkableScreens: () => unlinkableScreens
|
|
260219
260786
|
});
|
|
260220
260787
|
import { mkdirSync as mkdirSync64, writeFileSync as writeFileSync71 } from "node:fs";
|
|
260221
|
-
import { basename as basename38, join as
|
|
260788
|
+
import { basename as basename38, join as join180 } from "node:path";
|
|
260222
260789
|
function unlinkableScreens(config, screens, home2) {
|
|
260223
260790
|
const navigation = config?.navigation;
|
|
260224
260791
|
const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
|
|
@@ -260277,8 +260844,8 @@ async function runFidelity(root, opts = {}) {
|
|
|
260277
260844
|
if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
|
|
260278
260845
|
const variants = opts.variants?.length ? opts.variants : VARIANTS;
|
|
260279
260846
|
const run3 = opts.run ?? runId();
|
|
260280
|
-
const dir =
|
|
260281
|
-
const framesDir =
|
|
260847
|
+
const dir = join180(opts.outRoot ?? join180(root, ".himi", "fidelity"), run3);
|
|
260848
|
+
const framesDir = join180(dir, "frames");
|
|
260282
260849
|
mkdirSync64(framesDir, { recursive: true });
|
|
260283
260850
|
const session = opts.capture?.mockup ? void 0 : new MockupSession();
|
|
260284
260851
|
const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
|
|
@@ -260329,7 +260896,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
260329
260896
|
let stripFile;
|
|
260330
260897
|
let verdict;
|
|
260331
260898
|
const judged2 = frames.filter((f2) => !f2.noReference);
|
|
260332
|
-
const stripPath2 =
|
|
260899
|
+
const stripPath2 = join180(dir, `${screen}.${variant}.strip.png`);
|
|
260333
260900
|
if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
|
|
260334
260901
|
if (frames.some((f2) => f2.file)) stripFile = await strip3(frames, stripPath2);
|
|
260335
260902
|
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");
|
|
@@ -260353,7 +260920,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
260353
260920
|
await native?.restore?.();
|
|
260354
260921
|
}
|
|
260355
260922
|
const report9 = { app: basename38(root), run: run3, dir, rows, status: worst(rows) };
|
|
260356
|
-
writeFileSync71(
|
|
260923
|
+
writeFileSync71(join180(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
|
|
260357
260924
|
return report9;
|
|
260358
260925
|
}
|
|
260359
260926
|
function prCommentBody(report9) {
|
|
@@ -260414,8 +260981,8 @@ __export(native_exports, {
|
|
|
260414
260981
|
screenLink: () => screenLink
|
|
260415
260982
|
});
|
|
260416
260983
|
import { spawn as spawn11 } from "node:child_process";
|
|
260417
|
-
import { readFileSync as
|
|
260418
|
-
import { join as
|
|
260984
|
+
import { readFileSync as readFileSync171, writeFileSync as writeFileSync72 } from "node:fs";
|
|
260985
|
+
import { join as join181 } from "node:path";
|
|
260419
260986
|
function resumedPackages(dumpsys) {
|
|
260420
260987
|
const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
|
|
260421
260988
|
if (!lines2.length) return void 0;
|
|
@@ -260470,7 +261037,7 @@ function nativeCapture(devices, opts) {
|
|
|
260470
261037
|
return r3;
|
|
260471
261038
|
};
|
|
260472
261039
|
const gone = /* @__PURE__ */ new Set();
|
|
260473
|
-
const read2 = opts.readFile ?? ((p2) =>
|
|
261040
|
+
const read2 = opts.readFile ?? ((p2) => readFileSync171(p2));
|
|
260474
261041
|
const sleep2 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
|
|
260475
261042
|
const settleMs = opts.settleMs ?? 1e3;
|
|
260476
261043
|
const maxWaitMs = opts.maxWaitMs ?? 3e4;
|
|
@@ -260562,7 +261129,7 @@ function nativeCapture(devices, opts) {
|
|
|
260562
261129
|
const container = await run3("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
|
|
260563
261130
|
let compiled = "";
|
|
260564
261131
|
if (container.code === 0) {
|
|
260565
|
-
const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-",
|
|
261132
|
+
const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join181(container.stdout.toString().trim(), "Info.plist")]);
|
|
260566
261133
|
if (plist.code === 0) compiled = plist.stdout.toString().trim();
|
|
260567
261134
|
}
|
|
260568
261135
|
const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
|
|
@@ -260633,7 +261200,7 @@ function nativeCapture(devices, opts) {
|
|
|
260633
261200
|
}
|
|
260634
261201
|
await apply2(platform, id, variant);
|
|
260635
261202
|
await open3(platform, id, `himi://app/${encodeURIComponent(picker)}`);
|
|
260636
|
-
const file2 =
|
|
261203
|
+
const file2 = join181(outDir, `${screen}.${variant}.${platform}.png`);
|
|
260637
261204
|
const pickerFrame = (await settle2(platform, id, file2)).frame;
|
|
260638
261205
|
await open3(platform, id, screenLink(opts.appId, screen, entry, opts.release));
|
|
260639
261206
|
const { unsettled } = await settle2(platform, id, file2, pickerFrame);
|
|
@@ -260734,15 +261301,15 @@ __export(serve_exports, {
|
|
|
260734
261301
|
releaseProblem: () => releaseProblem,
|
|
260735
261302
|
serveWorkingCopy: () => serveWorkingCopy
|
|
260736
261303
|
});
|
|
260737
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
261304
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync142, mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync15, rmSync as rmSync47 } from "node:fs";
|
|
260738
261305
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
260739
|
-
import { join as
|
|
261306
|
+
import { join as join182 } from "node:path";
|
|
260740
261307
|
function copyFreshBundles(built, outDir, into) {
|
|
260741
261308
|
mkdirSync65(into, { recursive: true });
|
|
260742
261309
|
for (const name of built) {
|
|
260743
261310
|
for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
|
|
260744
|
-
const from =
|
|
260745
|
-
if (
|
|
261311
|
+
const from = join182(outDir, file2);
|
|
261312
|
+
if (existsSync142(from)) copyFileSync4(from, join182(into, file2));
|
|
260746
261313
|
}
|
|
260747
261314
|
}
|
|
260748
261315
|
}
|
|
@@ -260758,7 +261325,7 @@ async function serveWorkingCopy(dir, port) {
|
|
|
260758
261325
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
|
|
260759
261326
|
const bundles = await buildContentBundles2(dir, {});
|
|
260760
261327
|
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`);
|
|
260761
|
-
const temp = mkdtempSync15(
|
|
261328
|
+
const temp = mkdtempSync15(join182(tmpdir16(), "himi-fidelity-serve-"));
|
|
260762
261329
|
const cleanup = () => rmSync47(temp, { recursive: true, force: true });
|
|
260763
261330
|
const onSignal = () => {
|
|
260764
261331
|
cleanup();
|
|
@@ -260767,12 +261334,12 @@ async function serveWorkingCopy(dir, port) {
|
|
|
260767
261334
|
process.once("SIGINT", onSignal);
|
|
260768
261335
|
process.once("SIGTERM", onSignal);
|
|
260769
261336
|
try {
|
|
260770
|
-
const tier5Dir = bundles.built.length > 0 ?
|
|
261337
|
+
const tier5Dir = bundles.built.length > 0 ? join182(temp, ".tier5") : void 0;
|
|
260771
261338
|
if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
|
|
260772
261339
|
const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
|
|
260773
261340
|
const unservable = releaseProblem(outcome);
|
|
260774
261341
|
if (unservable) throw new Error(unservable);
|
|
260775
|
-
const served = await runPackage(
|
|
261342
|
+
const served = await runPackage(join182(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
|
|
260776
261343
|
return { origin: served.origin, close: async () => {
|
|
260777
261344
|
await served.close();
|
|
260778
261345
|
cleanup();
|
|
@@ -260825,8 +261392,8 @@ __export(fidelity_exports, {
|
|
|
260825
261392
|
himalayaRepoRoot: () => himalayaRepoRoot
|
|
260826
261393
|
});
|
|
260827
261394
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
260828
|
-
import { existsSync as
|
|
260829
|
-
import { join as
|
|
261395
|
+
import { existsSync as existsSync143, realpathSync as realpathSync23 } from "node:fs";
|
|
261396
|
+
import { join as join183, relative as relative30, sep as sep27 } from "node:path";
|
|
260830
261397
|
function himalayaRepoRoot(dir) {
|
|
260831
261398
|
let top;
|
|
260832
261399
|
try {
|
|
@@ -260834,7 +261401,7 @@ function himalayaRepoRoot(dir) {
|
|
|
260834
261401
|
} catch {
|
|
260835
261402
|
return null;
|
|
260836
261403
|
}
|
|
260837
|
-
if (!
|
|
261404
|
+
if (!existsSync143(join183(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
260838
261405
|
const rel2 = relative30(realpathSync23(top), realpathSync23(dir));
|
|
260839
261406
|
return rel2.startsWith(`..${sep27}`) || rel2 === ".." ? null : top;
|
|
260840
261407
|
}
|
|
@@ -260844,7 +261411,7 @@ function fidelityEnvelope(report9) {
|
|
|
260844
261411
|
async function fidelityCommand(ctx) {
|
|
260845
261412
|
const { io: io2, flags, print } = ctx;
|
|
260846
261413
|
const dir = contentDir(flags);
|
|
260847
|
-
if (!
|
|
261414
|
+
if (!existsSync143(dir)) {
|
|
260848
261415
|
io2.error(failure2("fidelity_bad_flag", `content dir ${dir} does not exist`));
|
|
260849
261416
|
return 2;
|
|
260850
261417
|
}
|
|
@@ -260867,7 +261434,7 @@ async function fidelityCommand(ctx) {
|
|
|
260867
261434
|
return 2;
|
|
260868
261435
|
}
|
|
260869
261436
|
const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
|
|
260870
|
-
const judgeDir =
|
|
261437
|
+
const judgeDir = join183(repo, "tools/judges/fidelity");
|
|
260871
261438
|
const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
|
|
260872
261439
|
const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
|
|
260873
261440
|
if (bare.length) {
|
|
@@ -260973,7 +261540,7 @@ async function fidelityCommand(ctx) {
|
|
|
260973
261540
|
else {
|
|
260974
261541
|
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]}` : ""}`);
|
|
260975
261542
|
io2.log(`
|
|
260976
|
-
${report9.status.toUpperCase()} \u2014 report: ${
|
|
261543
|
+
${report9.status.toUpperCase()} \u2014 report: ${join183(report9.dir, "report.json")}`);
|
|
260977
261544
|
}
|
|
260978
261545
|
return report9.status === "fail" ? 1 : 0;
|
|
260979
261546
|
}
|
|
@@ -261062,9 +261629,9 @@ async function publishSizeCommand(ctx) {
|
|
|
261062
261629
|
return fail12("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
|
|
261063
261630
|
}
|
|
261064
261631
|
const dir = contentDir2(flags);
|
|
261065
|
-
const { existsSync:
|
|
261066
|
-
const { join:
|
|
261067
|
-
if (!
|
|
261632
|
+
const { existsSync: existsSync144 } = await import("node:fs");
|
|
261633
|
+
const { join: join184 } = await import("node:path");
|
|
261634
|
+
if (!existsSync144(join184(dir, "dev", "index.ts"))) return fail12("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
|
|
261068
261635
|
const declared = await appId3(dir);
|
|
261069
261636
|
const app2 = typeof flags.app === "string" ? flags.app : declared;
|
|
261070
261637
|
if (!isValidAppId(app2)) return fail12("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
|
|
@@ -261279,7 +261846,8 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
261279
261846
|
"wix-token-stdin",
|
|
261280
261847
|
"no-key",
|
|
261281
261848
|
"no-frame",
|
|
261282
|
-
"resume"
|
|
261849
|
+
"resume",
|
|
261850
|
+
"site-pages"
|
|
261283
261851
|
]);
|
|
261284
261852
|
var SWITCH_FLAGS = new Set([...BOOLEAN_FLAGS].filter((name) => name !== "deep"));
|
|
261285
261853
|
var SWITCH_CONSEQUENCE = {
|
|
@@ -262169,8 +262737,8 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
262169
262737
|
refuses a WEB client \u2014 so a WEB one carrying your
|
|
262170
262738
|
redirect looks right and is not a candidate.
|
|
262171
262739
|
himi site analyze --read-only --site <msid> [--client-id <id>] [--url <https://\u2026>] [--json]
|
|
262172
|
-
himi site analyze --url <https://\u2026> [--client-id <id>] [--site <msid>] [--out <dir>]
|
|
262173
|
-
[--shell ${SHELL_ENUM}] [--no-browser]
|
|
262740
|
+
himi site analyze --url <https://\u2026> [--client-id <id>] [--site <msid>] [--out <dir>]
|
|
262741
|
+
[--apply [--site-pages] [--dry-run]] [--shell ${SHELL_ENUM}] [--no-browser]
|
|
262174
262742
|
refuses up front (code:"browser_unavailable", exit 2, with
|
|
262175
262743
|
the fix) when Playwright/Chromium is missing; --no-browser
|
|
262176
262744
|
runs static-HTML-only on purpose.
|
|
@@ -262184,7 +262752,13 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
262184
262752
|
names 'himi dist --shell' does; default branded-lite.
|
|
262185
262753
|
A SITE shell (brandy) also derives the site's page map
|
|
262186
262754
|
(tabs/drawer from its menu) into the overlay's \`site\`
|
|
262187
|
-
block \u2014 edit it, then --apply.
|
|
262755
|
+
block \u2014 edit it, then --apply. --site-pages (opt-in,
|
|
262756
|
+
branded-lite only) adds the site's pages no native screen
|
|
262757
|
+
covers as website pages: site_* screens in one drawer
|
|
262758
|
+
section, "From our website" (book.md \u2192 ## Site pages lists
|
|
262759
|
+
them; apply.sitePages reports site/native/skipped).
|
|
262760
|
+
--dry-run needs --apply --site-pages and writes nothing
|
|
262761
|
+
into the app (mode:"dry"). Owner token: WIX_API_KEY
|
|
262188
262762
|
or 'wix token --site'. Look/screenshots need Chromium:
|
|
262189
262763
|
the install command the crawl report names.
|
|
262190
262764
|
himi site function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET]
|
|
@@ -262305,7 +262879,7 @@ var COMMANDS = [
|
|
|
262305
262879
|
{ name: "connector", summary: "personal access tokens for the hosted MCP connector (Wix Native App Builder), for an AI tool that cannot sign in with OAuth (e.g. Base44's builder): `token create` opens a Wix sign-in page and prints a long-lived token once, to paste into the tool as `Authorization: Bearer <token>`; `token list` / `token revoke <id>` manage them with the `himi login --browser` token. The token can only build and publish DRAFTS.", required: "token create [--name <n>] [--days <1-90>] [--no-open] | token list | token revoke <id> [--target <t>]" },
|
|
262306
262880
|
{ name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files; `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
|
|
262307
262881
|
{ name: "signing", summary: "READ-ONLY App Store Connect inventory for customer BYO TestFlight readiness. `inspect` lists whether the bundle id, distribution certificate, IOS_APP_STORE profile, and ASC app record exist for --bundle-id / --team-id using a local ASC .p8 (flags or ASC_KEY_* env). Never uploads or mutates Apple resources. Optional --cert-file/--profile-file classify on-disk material.", required: "inspect --bundle-id <id> --team-id <id> --asc-key-file <path> --asc-key-id <id> --asc-issuer-id <id> [--cert-file <p12> --cert-password <pw> --profile-file <mobileprovision>] [--json]" },
|
|
262308
|
-
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (WIX_API_KEY, else the owner's account token in WIX_TOKEN exchanged for that site, else `wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; with no Playwright/Chromium it refuses before any work (code \"browser_unavailable\", the install command in `fix`) unless `--no-browser` asks for the static-HTML-only pass; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. `--shell brandy` (the site shell, RFC 0062) also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply] [--no-browser] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
262882
|
+
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (WIX_API_KEY, else the owner's account token in WIX_TOKEN exchanged for that site, else `wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; with no Playwright/Chromium it refuses before any work (code \"browser_unavailable\", the install command in `fix`) unless `--no-browser` asks for the static-HTML-only pass; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. `--shell brandy` (the site shell, RFC 0062) also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply [--site-pages] [--dry-run]] [--no-browser] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
262309
262883
|
{ name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context. `adopt` turns the book into a reviewable base44-entities.ts of ADOPTED entity + function declarations for config.ts (never edits config.ts, never overwrites); `entities query` is READ-ONLY and reports, per declared entity, ownership, row count and schema drift against the live app, plus foreign entities. `entities create` provisions the app's OWNED Himi<App>* entities: Base44's schema write is a destructive full-set sync, so the single PUT carries every entity in a freshly read eject snapshot (foreign ones verbatim) and the run refuses BEFORE sending when one would be dropped, the snapshot is unreadable or empty, or it moved since the plan; removing an owned field/entity needs --allow-destructive, rewriting owned RLS needs --apply-permissions. `entities seed` bulk-inserts seed rows into empty owned entities only (--ai writes base44-seed.json offline). `functions deploy` ships owned functions one PUT each, never the bulk sync or DELETE, and refuses a name deployed by someone else. All three print a plan and write only with --yes, which needs a `login --write` (apps:write) session. `types` writes tier5-src/_shared/base44-entities.ts \u2014 a row type and a typed `entities<Row>()` handle per declared entity, byte-stable \u2014 and `himi validate` reports base44-types-stale when that file falls behind the block (nothing when it is absent). himi docs base44-entities. `screens` (base44-starter packages) writes one generated list + detail screen per declared entity over the template's shared engine, with write controls gated by the entity's rls; an unchanged config reports every file `unchanged`, a hand-edited generated file is `skipped-edited` unless --force; never calls Base44. himi docs base44-app-to-himi-app", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | entities query [--content <dir>] [--all] [--json] | entities create [--app <a>] [--yes] [--allow-destructive] [--apply-permissions] [--empty-app-ok] | entities seed [--app <a>] [--yes] [--only A,B] [--ai] | functions deploy [--app <a>] [--yes] [--only a,b] | types [--content <dir>] [--json] | screens [--content <dir>] [--force] [--dry-run] [--json] | login [--write] [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
|
|
262310
262884
|
{ name: "doctor", summary: 'off-VPN preflight in one shot: probe the PUBLIC data plane (www.wixapis.com \u2014 reachable off-VPN), the INTERNAL serve/control plane for the selected target (VPN-gated), and report auth state (dpx session on disk + stored control token). --dpx additionally runs a live, EADDRINUSE-safe `dpx whoami`. Machine-readable with --json (an unreachable internal plane carries a stable code:"needs_vpn" so an agent branches on the code, not the prose); human-readable otherwise. Also reports whether Playwright and its Chromium are installed (code:"browser_unavailable" + the exact `fix` command when not \u2014 `himi site analyze`, `render --png` and the screenshot paths need them); --install-browser downloads the Chromium the CLI\'s own Playwright launches, then re-checks. Never loads the authoring runtime \u2014 works off-repo.', required: "[--target <t>] [--dpx] [--install-browser] [--json] [--data-url <url>] [--timeout <ms>]" },
|
|
262311
262885
|
{ name: "upgrade", summary: "install the newest published CLI (`npm i -g @wix/himalaya-cli@latest`) and report what moved. This is the explicit door: himi also updates itself when the running build is more than a week old \u2014 unattended it just does it and re-runs your command, at a terminal it asks first \u2014 and `HIMI_NO_UPDATE_CHECK=1` turns that off, leaving this command as the way to catch up. Reports `unchanged` rather than claiming success when npm exits 0 without moving the version, which is what a registry mirror serving its own pinned copy looks like.", required: "[--json]" },
|
|
@@ -265066,8 +265640,8 @@ function pushAuthHint(status, token, target, hasOwnerIssuer = true) {
|
|
|
265066
265640
|
}
|
|
265067
265641
|
async function contentVisibility(dir) {
|
|
265068
265642
|
try {
|
|
265069
|
-
const { readFileSync:
|
|
265070
|
-
const m2 = JSON.parse(
|
|
265643
|
+
const { readFileSync: readFileSync172 } = await import("node:fs");
|
|
265644
|
+
const m2 = JSON.parse(readFileSync172(join133(dir, "himalaya.content.json"), "utf8"));
|
|
265071
265645
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
265072
265646
|
} catch {
|
|
265073
265647
|
}
|
|
@@ -271762,13 +272336,23 @@ async function siteCommand(ctx) {
|
|
|
271762
272336
|
print({ ok: true, context });
|
|
271763
272337
|
return 0;
|
|
271764
272338
|
}
|
|
271765
|
-
const analyzeUsage = "himi site analyze --url https://\u2026 [--client-id <headless-oauth-client-id>] [--site <msid>] [--out .himi/business-book] [--redirect-uri <uri>] [--shell " + SHELL_ENUM + "] [--apply] [--no-browser]";
|
|
272339
|
+
const analyzeUsage = "himi site analyze --url https://\u2026 [--client-id <headless-oauth-client-id>] [--site <msid>] [--out .himi/business-book] [--redirect-uri <uri>] [--shell " + SHELL_ENUM + "] [--apply [--site-pages] [--dry-run]] [--no-browser]";
|
|
271766
272340
|
if (!siteUrl) {
|
|
271767
272341
|
io2.error(JSON.stringify({ error: "himi site analyze needs --url", usage: analyzeUsage }));
|
|
271768
272342
|
return 2;
|
|
271769
272343
|
}
|
|
271770
272344
|
const redirectFlag = str3(flags["redirect-uri"]);
|
|
271771
|
-
const { APPLY_NEEDS_CLIENT: APPLY_NEEDS_CLIENT2, REDIRECT_NEEDS_CLIENT: REDIRECT_NEEDS_CLIENT2, applyNeedsClient: applyNeedsClient2 } = await Promise.resolve().then(() => (init_cli3(), cli_exports3));
|
|
272345
|
+
const { APPLY_NEEDS_CLIENT: APPLY_NEEDS_CLIENT2, REDIRECT_NEEDS_CLIENT: REDIRECT_NEEDS_CLIENT2, applyNeedsClient: applyNeedsClient2, sitePagesRefusal: sitePagesRefusal2 } = await Promise.resolve().then(() => (init_cli3(), cli_exports3));
|
|
272346
|
+
const pagesRefusal = sitePagesRefusal2({
|
|
272347
|
+
shell: str3(flags.shell),
|
|
272348
|
+
apply: flags.apply === true,
|
|
272349
|
+
sitePages: flags["site-pages"] === true,
|
|
272350
|
+
dryRun: flags["dry-run"] === true
|
|
272351
|
+
});
|
|
272352
|
+
if (pagesRefusal) {
|
|
272353
|
+
io2.error(JSON.stringify({ ok: false, ...pagesRefusal, usage: analyzeUsage }));
|
|
272354
|
+
return 2;
|
|
272355
|
+
}
|
|
271772
272356
|
const applyWantsClient = flags.apply === true && applyNeedsClient2(str3(flags.shell));
|
|
271773
272357
|
if (!clientId && (applyWantsClient || redirectFlag)) {
|
|
271774
272358
|
io2.error(JSON.stringify({
|
|
@@ -271806,12 +272390,15 @@ async function siteCommand(ctx) {
|
|
|
271806
272390
|
// client is in play — so it is passed in by whoever registered it.
|
|
271807
272391
|
redirectUri: redirectFlag,
|
|
271808
272392
|
cwd: str3(flags.content) ?? process.cwd(),
|
|
271809
|
-
noBrowser: flags["no-browser"] === true
|
|
272393
|
+
noBrowser: flags["no-browser"] === true,
|
|
272394
|
+
sitePages: flags["site-pages"] === true,
|
|
272395
|
+
dryRun: flags["dry-run"] === true
|
|
271810
272396
|
});
|
|
271811
272397
|
print(r3);
|
|
271812
272398
|
return 0;
|
|
271813
272399
|
} catch (e2) {
|
|
271814
|
-
|
|
272400
|
+
const code2 = e2.code;
|
|
272401
|
+
io2.error(JSON.stringify({ ...typeof code2 === "string" && code2 ? { ok: false, code: code2 } : {}, error: e2.message }));
|
|
271815
272402
|
return e2.exit === 2 ? 2 : 1;
|
|
271816
272403
|
}
|
|
271817
272404
|
}
|