@wix/himalaya-cli 0.1554.0 → 0.1556.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +209 -196
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/one-app-to-himi-app.md +4 -0
- package/guides/trim-a-template.md +9 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -8780,8 +8780,8 @@ function tsExtResolvePlugin() {
|
|
|
8780
8780
|
setup(b2) {
|
|
8781
8781
|
b2.onResolve({ filter: /\.js$/ }, (args) => {
|
|
8782
8782
|
if (args.kind === "entry-point" || !args.path.startsWith(".")) return void 0;
|
|
8783
|
-
const
|
|
8784
|
-
return existsSync9(
|
|
8783
|
+
const ts14 = resolve8(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
|
|
8784
|
+
return existsSync9(ts14) ? { path: ts14 } : void 0;
|
|
8785
8785
|
});
|
|
8786
8786
|
}
|
|
8787
8787
|
};
|
|
@@ -9536,7 +9536,7 @@ function bundleFor(file2) {
|
|
|
9536
9536
|
const match = /^tier5-src\/([^/]+)\//.exec(file2);
|
|
9537
9537
|
return match?.[1] ?? "_shared";
|
|
9538
9538
|
}
|
|
9539
|
-
function toIssue(
|
|
9539
|
+
function toIssue(ts14, contentDir2, diagnostic) {
|
|
9540
9540
|
const file2 = diagnostic.file ? relativeFile(contentDir2, diagnostic.file.fileName) : void 0;
|
|
9541
9541
|
const position = diagnostic.file && diagnostic.start !== void 0 ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : void 0;
|
|
9542
9542
|
return {
|
|
@@ -9544,13 +9544,13 @@ function toIssue(ts13, contentDir2, diagnostic) {
|
|
|
9544
9544
|
...file2 ? { file: file2 } : {},
|
|
9545
9545
|
...position ? { line: position.line + 1, column: position.character + 1 } : {},
|
|
9546
9546
|
code: `TS${diagnostic.code}`,
|
|
9547
|
-
message:
|
|
9547
|
+
message: ts14.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
9548
9548
|
};
|
|
9549
9549
|
}
|
|
9550
|
-
function confinedHost(
|
|
9550
|
+
function confinedHost(ts14, contentDir2, options) {
|
|
9551
9551
|
if (!buildConfinementRequired()) return void 0;
|
|
9552
|
-
const host =
|
|
9553
|
-
const libDir = resolve10(
|
|
9552
|
+
const host = ts14.createCompilerHost(options);
|
|
9553
|
+
const libDir = resolve10(ts14.getDefaultLibFilePath(options), "..");
|
|
9554
9554
|
const allows = confinementMatcher(contentDir2, [libDir]);
|
|
9555
9555
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
9556
9556
|
const readFile3 = host.readFile.bind(host);
|
|
@@ -9579,7 +9579,7 @@ function confinedHost(ts13, contentDir2, options) {
|
|
|
9579
9579
|
}
|
|
9580
9580
|
async function typecheckContentWorkers(contentDir2, options) {
|
|
9581
9581
|
if (!existsSync10(resolve10(contentDir2, "tier5-src"))) return [];
|
|
9582
|
-
const
|
|
9582
|
+
const ts14 = await compiler2();
|
|
9583
9583
|
const config = {
|
|
9584
9584
|
compilerOptions: {
|
|
9585
9585
|
...CONTENT_WORKER_COMPILER_OPTIONS,
|
|
@@ -9588,18 +9588,18 @@ async function typecheckContentWorkers(contentDir2, options) {
|
|
|
9588
9588
|
// The deployed authoring runtime stages TypeScript 6, which requires an explicit
|
|
9589
9589
|
// acknowledgement for this compatibility `baseUrl`; the repository's TypeScript 5 lane
|
|
9590
9590
|
// rejects that 6.0 value, so keep it specific to the compiler that needs it.
|
|
9591
|
-
...Number.parseInt(
|
|
9591
|
+
...Number.parseInt(ts14.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
|
|
9592
9592
|
},
|
|
9593
9593
|
include: ["tier5-src/*/index.ts", "tier5-src/_shared/**/*.ts"]
|
|
9594
9594
|
};
|
|
9595
|
-
const parsed =
|
|
9595
|
+
const parsed = ts14.parseJsonConfigFileContent(config, ts14.sys, contentDir2);
|
|
9596
9596
|
if (parsed.fileNames.length === 0) return [];
|
|
9597
|
-
const program =
|
|
9597
|
+
const program = ts14.createProgram({
|
|
9598
9598
|
rootNames: parsed.fileNames,
|
|
9599
9599
|
options: parsed.options,
|
|
9600
|
-
host: confinedHost(
|
|
9600
|
+
host: confinedHost(ts14, contentDir2, parsed.options)
|
|
9601
9601
|
});
|
|
9602
|
-
return [...parsed.errors, ...
|
|
9602
|
+
return [...parsed.errors, ...ts14.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts14.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts14, contentDir2, diagnostic));
|
|
9603
9603
|
}
|
|
9604
9604
|
var compilerPromise;
|
|
9605
9605
|
var init_tier5_typecheck = __esm({
|
|
@@ -12882,6 +12882,7 @@ function webViewOriginAllowed(url, origins) {
|
|
|
12882
12882
|
}
|
|
12883
12883
|
var init_webview_origin = __esm({
|
|
12884
12884
|
"../../core/ts/src/webview-origin.ts"() {
|
|
12885
|
+
"use strict";
|
|
12885
12886
|
}
|
|
12886
12887
|
});
|
|
12887
12888
|
|
|
@@ -18622,18 +18623,18 @@ var init_pixels = __esm({
|
|
|
18622
18623
|
});
|
|
18623
18624
|
|
|
18624
18625
|
// ../../core/dev-server/src/declared-navigation-ast.ts
|
|
18625
|
-
function literalTargets(bundleJs,
|
|
18626
|
-
const name = (n2) => n2 && (
|
|
18626
|
+
function literalTargets(bundleJs, ts14) {
|
|
18627
|
+
const name = (n2) => n2 && (ts14.isIdentifier(n2) || ts14.isStringLiteral(n2) || ts14.isNoSubstitutionTemplateLiteral(n2)) ? n2.text : void 0;
|
|
18627
18628
|
const object10 = (n2) => {
|
|
18628
|
-
while (n2 &&
|
|
18629
|
-
return n2 &&
|
|
18629
|
+
while (n2 && ts14.isParenthesizedExpression(n2)) n2 = n2.expression;
|
|
18630
|
+
return n2 && ts14.isObjectLiteralExpression(n2) ? n2 : void 0;
|
|
18630
18631
|
};
|
|
18631
18632
|
const property2 = (o2, key3) => o2?.properties.find((p2) => name(p2.name) === key3);
|
|
18632
|
-
const initializer = (p2) => p2 &&
|
|
18633
|
-
const callable = (n2) => !!n2 && (
|
|
18633
|
+
const initializer = (p2) => p2 && ts14.isPropertyAssignment(p2) ? p2.initializer : void 0;
|
|
18634
|
+
const callable = (n2) => !!n2 && (ts14.isArrowFunction(n2) || ts14.isFunctionExpression(n2) || ts14.isFunctionDeclaration(n2) || ts14.isMethodDeclaration(n2));
|
|
18634
18635
|
const cached3 = cache.get(bundleJs);
|
|
18635
18636
|
if (cached3) return cached3;
|
|
18636
|
-
const file2 =
|
|
18637
|
+
const file2 = ts14.createSourceFile("himi-bundle.js", bundleJs, ts14.ScriptTarget.Latest, true, ts14.ScriptKind.JS);
|
|
18637
18638
|
const symbols = /* @__PURE__ */ new Map();
|
|
18638
18639
|
const note = (key3, fn2) => {
|
|
18639
18640
|
if (!key3) return;
|
|
@@ -18641,15 +18642,15 @@ function literalTargets(bundleJs, ts13) {
|
|
|
18641
18642
|
symbols.set(key3, { count: (prior?.count ?? 0) + 1, fn: fn2 });
|
|
18642
18643
|
};
|
|
18643
18644
|
const declarations = (node) => {
|
|
18644
|
-
if (
|
|
18645
|
-
else if (
|
|
18646
|
-
else if (
|
|
18647
|
-
|
|
18645
|
+
if (ts14.isFunctionDeclaration(node)) note(name(node.name), node);
|
|
18646
|
+
else if (ts14.isVariableDeclaration(node)) note(name(node.name), callable(node.initializer) ? node.initializer : void 0);
|
|
18647
|
+
else if (ts14.isParameter(node)) note(name(node.name));
|
|
18648
|
+
ts14.forEachChild(node, declarations);
|
|
18648
18649
|
};
|
|
18649
18650
|
declarations(file2);
|
|
18650
18651
|
const resolve87 = (node) => {
|
|
18651
18652
|
if (callable(node)) return node;
|
|
18652
|
-
if (node &&
|
|
18653
|
+
if (node && ts14.isIdentifier(node)) {
|
|
18653
18654
|
const symbol = symbols.get(node.text);
|
|
18654
18655
|
if (symbol?.count === 1) return symbol.fn;
|
|
18655
18656
|
}
|
|
@@ -18657,47 +18658,47 @@ function literalTargets(bundleJs, ts13) {
|
|
|
18657
18658
|
};
|
|
18658
18659
|
const results = /* @__PURE__ */ new Map();
|
|
18659
18660
|
const visit = (node) => {
|
|
18660
|
-
if (
|
|
18661
|
-
const callee =
|
|
18661
|
+
if (ts14.isCallExpression(node)) {
|
|
18662
|
+
const callee = ts14.isPropertyAccessExpression(node.expression) ? node.expression.name.text : name(node.expression);
|
|
18662
18663
|
const service = node.arguments[0];
|
|
18663
|
-
if (callee && /^defineService[0-9]*$/.test(callee) && service &&
|
|
18664
|
+
if (callee && /^defineService[0-9]*$/.test(callee) && service && ts14.isStringLiteralLike(service)) {
|
|
18664
18665
|
const actions = object10(initializer(property2(object10(node.arguments[1]), "actions")));
|
|
18665
18666
|
for (const member of actions?.properties ?? []) {
|
|
18666
18667
|
const action = name(member.name);
|
|
18667
|
-
const fn2 =
|
|
18668
|
+
const fn2 = ts14.isMethodDeclaration(member) ? member : resolve87(ts14.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
|
|
18668
18669
|
if (!action || !fn2?.body) continue;
|
|
18669
18670
|
const targets = [];
|
|
18670
18671
|
const target = (expr) => {
|
|
18671
18672
|
const sid = initializer(property2(object10(expr), "screenId"));
|
|
18672
|
-
if (!sid || !
|
|
18673
|
+
if (!sid || !ts14.isStringLiteralLike(sid)) return;
|
|
18673
18674
|
const position = file2.getLineAndCharacterOfPosition(sid.getStart(file2));
|
|
18674
18675
|
targets.push({ screenId: sid.text, line: position.line + 1, column: position.character });
|
|
18675
18676
|
};
|
|
18676
18677
|
const returned = (expr) => {
|
|
18677
18678
|
if (!expr) return;
|
|
18678
|
-
if (
|
|
18679
|
+
if (ts14.isParenthesizedExpression(expr) || ts14.isAwaitExpression(expr)) {
|
|
18679
18680
|
returned(expr.expression);
|
|
18680
18681
|
return;
|
|
18681
18682
|
}
|
|
18682
|
-
if (
|
|
18683
|
+
if (ts14.isConditionalExpression(expr)) {
|
|
18683
18684
|
returned(expr.whenTrue);
|
|
18684
18685
|
returned(expr.whenFalse);
|
|
18685
18686
|
return;
|
|
18686
18687
|
}
|
|
18687
|
-
if (
|
|
18688
|
+
if (ts14.isObjectLiteralExpression(expr)) {
|
|
18688
18689
|
target(initializer(property2(expr, "_nav")));
|
|
18689
18690
|
return;
|
|
18690
18691
|
}
|
|
18691
|
-
if (
|
|
18692
|
-
const called =
|
|
18692
|
+
if (ts14.isCallExpression(expr)) {
|
|
18693
|
+
const called = ts14.isPropertyAccessExpression(expr.expression) ? expr.expression.name.text : name(expr.expression);
|
|
18693
18694
|
if (called && /^navigate[0-9]*$/.test(called)) target(expr.arguments[1]);
|
|
18694
18695
|
}
|
|
18695
18696
|
};
|
|
18696
|
-
if (
|
|
18697
|
+
if (ts14.isBlock(fn2.body)) {
|
|
18697
18698
|
const returns = (part3) => {
|
|
18698
18699
|
if (callable(part3)) return;
|
|
18699
|
-
if (
|
|
18700
|
-
else
|
|
18700
|
+
if (ts14.isReturnStatement(part3)) returned(part3.expression);
|
|
18701
|
+
else ts14.forEachChild(part3, returns);
|
|
18701
18702
|
};
|
|
18702
18703
|
returns(fn2.body);
|
|
18703
18704
|
} else returned(fn2.body);
|
|
@@ -18705,7 +18706,7 @@ function literalTargets(bundleJs, ts13) {
|
|
|
18705
18706
|
}
|
|
18706
18707
|
}
|
|
18707
18708
|
}
|
|
18708
|
-
|
|
18709
|
+
ts14.forEachChild(node, visit);
|
|
18709
18710
|
};
|
|
18710
18711
|
visit(file2);
|
|
18711
18712
|
cache.set(bundleJs, results);
|
|
@@ -23887,7 +23888,6 @@ function resolveIdiom(tokens2, ctx = {}) {
|
|
|
23887
23888
|
var IDIOM_CONTEXTS, UNSAFE_KEYS;
|
|
23888
23889
|
var init_idiom = __esm({
|
|
23889
23890
|
"../../core/ts/src/idiom.ts"() {
|
|
23890
|
-
"use strict";
|
|
23891
23891
|
IDIOM_CONTEXTS = {
|
|
23892
23892
|
ios: { native: ["ios"] },
|
|
23893
23893
|
android: { native: ["material"] },
|
|
@@ -140618,9 +140618,9 @@ function stateOf(view) {
|
|
|
140618
140618
|
build: b2 && view.live ? { ok: b2.ok, ms: b2.ms, screens: b2.screens, at: b2.at, run: view.live.runId } : null
|
|
140619
140619
|
};
|
|
140620
140620
|
}
|
|
140621
|
-
function frameFor(state, prev,
|
|
140622
|
-
if (key3 || !prev) return { ts:
|
|
140623
|
-
const f2 = { ts:
|
|
140621
|
+
function frameFor(state, prev, ts14, v2, key3) {
|
|
140622
|
+
if (key3 || !prev) return { ts: ts14, v: v2, key: true, ...state };
|
|
140623
|
+
const f2 = { ts: ts14, v: v2 };
|
|
140624
140624
|
if (!same2(state.step, prev.step)) f2.step = state.step;
|
|
140625
140625
|
if (!same2(state.now, prev.now)) f2.now = state.now;
|
|
140626
140626
|
const screens = {};
|
|
@@ -150026,6 +150026,7 @@ __export(template_trim_exports, {
|
|
|
150026
150026
|
});
|
|
150027
150027
|
import { cpSync, existsSync as existsSync43, mkdirSync as mkdirSync23, readdirSync as readdirSync23, readFileSync as readFileSync48, renameSync as renameSync9, rmSync as rmSync13, statSync as statSync12, writeFileSync as writeFileSync17 } from "node:fs";
|
|
150028
150028
|
import { dirname as dirname28, join as join36 } from "node:path";
|
|
150029
|
+
import ts5 from "typescript";
|
|
150029
150030
|
function routeMatcher(pattern) {
|
|
150030
150031
|
const detail = /^\^([A-Za-z0-9_]+)\(\?:\[_\/\]\(\.\+\)\)\?\$$/.exec(pattern);
|
|
150031
150032
|
if (detail) {
|
|
@@ -150082,6 +150083,17 @@ function parseJson2(text12, what) {
|
|
|
150082
150083
|
);
|
|
150083
150084
|
}
|
|
150084
150085
|
}
|
|
150086
|
+
function configWithoutComments(text12) {
|
|
150087
|
+
const scanner = ts5.createScanner(ts5.ScriptTarget.Latest, false, ts5.LanguageVariant.Standard, text12);
|
|
150088
|
+
const parts = [];
|
|
150089
|
+
let end = 0;
|
|
150090
|
+
for (let token = scanner.scan(); token !== ts5.SyntaxKind.EndOfFileToken; token = scanner.scan()) {
|
|
150091
|
+
if (token !== ts5.SyntaxKind.SingleLineCommentTrivia && token !== ts5.SyntaxKind.MultiLineCommentTrivia) continue;
|
|
150092
|
+
parts.push(text12.slice(end, scanner.getTokenPos()), text12.slice(scanner.getTokenPos(), scanner.getTextPos()).replace(/[^\r\n]/g, " "));
|
|
150093
|
+
end = scanner.getTextPos();
|
|
150094
|
+
}
|
|
150095
|
+
return parts.join("") + text12.slice(end);
|
|
150096
|
+
}
|
|
150085
150097
|
function jsonString(literal, what) {
|
|
150086
150098
|
try {
|
|
150087
150099
|
return JSON.parse(literal);
|
|
@@ -150198,14 +150210,15 @@ function parseApp(dev, config) {
|
|
|
150198
150210
|
const homeId = jsonString(hm[1], "dev/index.ts: homeScreenId");
|
|
150199
150211
|
const home = exact.get(homeId);
|
|
150200
150212
|
if (!home) throw new TrimRefusal(`dev/index.ts: homeScreenId "${homeId}" is not a screen in the SCREENS map`);
|
|
150213
|
+
const configData = configWithoutComments(config);
|
|
150201
150214
|
const NAV_ANCHOR = "\n navigation: {";
|
|
150202
|
-
const nAt =
|
|
150215
|
+
const nAt = configData.indexOf(NAV_ANCHOR);
|
|
150203
150216
|
if (nAt < 0) throw new TrimRefusal("config.ts has no `navigation: {` \u2014 trim rewrites navigation in the shape `himi init` writes");
|
|
150204
150217
|
const nOpen = nAt + NAV_ANCHOR.length - 1;
|
|
150205
|
-
const nClose = objectEnd(
|
|
150218
|
+
const nClose = objectEnd(configData, nOpen);
|
|
150206
150219
|
if (nClose < 0) throw new TrimRefusal("config.ts: the navigation object never closes");
|
|
150207
|
-
const navValue2 = parseJson2(
|
|
150208
|
-
const subtree = parseSubtree(
|
|
150220
|
+
const navValue2 = parseJson2(configData.slice(nOpen, nClose), "config.ts navigation");
|
|
150221
|
+
const subtree = parseSubtree(configData);
|
|
150209
150222
|
return { dev, config, home, routes, exact, templated, templatedRegion, nav: { open: nOpen, close: nClose, value: navValue2 }, subtree };
|
|
150210
150223
|
}
|
|
150211
150224
|
function resolveIn(app, id) {
|
|
@@ -151798,14 +151811,14 @@ var init_hosted_owner = __esm({
|
|
|
151798
151811
|
// src/config-source-edit.ts
|
|
151799
151812
|
import { lstatSync as lstatSync13 } from "node:fs";
|
|
151800
151813
|
import { join as join38 } from "node:path";
|
|
151801
|
-
import
|
|
151814
|
+
import ts6 from "typescript";
|
|
151802
151815
|
function defineAppLiteral(file2) {
|
|
151803
151816
|
for (const statement of file2.statements) {
|
|
151804
|
-
if (!
|
|
151817
|
+
if (!ts6.isExportAssignment(statement)) continue;
|
|
151805
151818
|
const exported = localValue(file2, unwrap(statement.expression));
|
|
151806
|
-
if (
|
|
151807
|
-
const [first] =
|
|
151808
|
-
return first &&
|
|
151819
|
+
if (ts6.isObjectLiteralExpression(exported)) return exported;
|
|
151820
|
+
const [first] = ts6.isCallExpression(exported) ? exported.arguments : [];
|
|
151821
|
+
return first && ts6.isObjectLiteralExpression(unwrap(first)) ? unwrap(first) : void 0;
|
|
151809
151822
|
}
|
|
151810
151823
|
return void 0;
|
|
151811
151824
|
}
|
|
@@ -151813,27 +151826,27 @@ function loginOf(app) {
|
|
|
151813
151826
|
const auth = lookup3(app, "auth");
|
|
151814
151827
|
if (auth.kind !== "written") return { kind: auth.kind === "absent" ? "other" : "opaque" };
|
|
151815
151828
|
const value2 = unwrap(auth.node.initializer);
|
|
151816
|
-
if (
|
|
151817
|
-
if (!
|
|
151829
|
+
if (ts6.isObjectLiteralExpression(value2)) return { kind: "other" };
|
|
151830
|
+
if (!ts6.isCallExpression(value2)) return { kind: "opaque" };
|
|
151818
151831
|
const provider = calleeName(value2);
|
|
151819
151832
|
if (provider === "WixOwnerAuthProvider" || provider === "WixAuthProvider") return { kind: "owner" };
|
|
151820
151833
|
if (provider === "WixNativeAuthProvider") return nativeMode(value2) === "owner" ? { kind: "owner" } : { kind: "other" };
|
|
151821
151834
|
if (provider !== "WixConsumerAuthProvider") return { kind: "other" };
|
|
151822
151835
|
const [first] = value2.arguments;
|
|
151823
|
-
return first &&
|
|
151836
|
+
return first && ts6.isObjectLiteralExpression(first) ? { kind: "member", literal: first } : { kind: "opaque" };
|
|
151824
151837
|
}
|
|
151825
151838
|
function nativeMode(call) {
|
|
151826
151839
|
const [first] = call.arguments;
|
|
151827
|
-
return first &&
|
|
151840
|
+
return first && ts6.isObjectLiteralExpression(first) ? stringValue(first, "mode") : void 0;
|
|
151828
151841
|
}
|
|
151829
151842
|
function calleeName(call) {
|
|
151830
151843
|
const callee = call.expression;
|
|
151831
|
-
if (
|
|
151832
|
-
return
|
|
151844
|
+
if (ts6.isIdentifier(callee)) return callee.text;
|
|
151845
|
+
return ts6.isPropertyAccessExpression(callee) ? callee.name.text : void 0;
|
|
151833
151846
|
}
|
|
151834
151847
|
function unwrap(node) {
|
|
151835
151848
|
let current = node;
|
|
151836
|
-
while (
|
|
151849
|
+
while (ts6.isParenthesizedExpression(current) || ts6.isAsExpression(current) || ts6.isSatisfiesExpression(current)) {
|
|
151837
151850
|
current = current.expression;
|
|
151838
151851
|
}
|
|
151839
151852
|
return current;
|
|
@@ -151841,17 +151854,17 @@ function unwrap(node) {
|
|
|
151841
151854
|
function lookup3(literal, name) {
|
|
151842
151855
|
let found = { kind: "absent" };
|
|
151843
151856
|
for (const p2 of literal.properties) {
|
|
151844
|
-
const key3 = p2.name && (
|
|
151845
|
-
if (
|
|
151846
|
-
else if (
|
|
151857
|
+
const key3 = p2.name && (ts6.isIdentifier(p2.name) || ts6.isStringLiteral(p2.name)) ? p2.name.text : void 0;
|
|
151858
|
+
if (ts6.isPropertyAssignment(p2) && key3 === name) found = { kind: "written", node: p2 };
|
|
151859
|
+
else if (ts6.isSpreadAssignment(p2) || p2.name && ts6.isComputedPropertyName(p2.name) || key3 === name) found = { kind: "opaque" };
|
|
151847
151860
|
}
|
|
151848
151861
|
return found;
|
|
151849
151862
|
}
|
|
151850
151863
|
function stringValue(node, name) {
|
|
151851
151864
|
const literal = unwrap(node);
|
|
151852
|
-
const found =
|
|
151865
|
+
const found = ts6.isObjectLiteralExpression(literal) ? lookup3(literal, name) : void 0;
|
|
151853
151866
|
const value2 = found?.kind === "written" ? found.node.initializer : void 0;
|
|
151854
|
-
return value2 &&
|
|
151867
|
+
return value2 && ts6.isStringLiteralLike(value2) ? value2.text : void 0;
|
|
151855
151868
|
}
|
|
151856
151869
|
function appendProperties(literal, file2, lines) {
|
|
151857
151870
|
const inline = () => lines.filter((line) => !line.trimStart().startsWith("//")).join(" ");
|
|
@@ -151883,11 +151896,11 @@ function applySplices(source, splices) {
|
|
|
151883
151896
|
return [...splices].sort((a2, b2) => b2.at - a2.at).reduce((out2, s2) => out2.slice(0, s2.at) + s2.text + out2.slice(s2.end), source);
|
|
151884
151897
|
}
|
|
151885
151898
|
function localValue(file2, node) {
|
|
151886
|
-
if (!
|
|
151899
|
+
if (!ts6.isIdentifier(node)) return node;
|
|
151887
151900
|
for (const statement of file2.statements) {
|
|
151888
|
-
if (!
|
|
151901
|
+
if (!ts6.isVariableStatement(statement) || !(statement.declarationList.flags & ts6.NodeFlags.Const)) continue;
|
|
151889
151902
|
for (const declaration of statement.declarationList.declarations) {
|
|
151890
|
-
if (
|
|
151903
|
+
if (ts6.isIdentifier(declaration.name) && declaration.name.text === node.text && declaration.initializer) return unwrap(declaration.initializer);
|
|
151891
151904
|
}
|
|
151892
151905
|
}
|
|
151893
151906
|
return node;
|
|
@@ -151935,12 +151948,12 @@ __export(config_push_edit_exports, {
|
|
|
151935
151948
|
});
|
|
151936
151949
|
import { readFileSync as readFileSync50 } from "node:fs";
|
|
151937
151950
|
import { basename as basename13 } from "node:path";
|
|
151938
|
-
import
|
|
151951
|
+
import ts7 from "typescript";
|
|
151939
151952
|
function enablePushInConfig(source, options) {
|
|
151940
151953
|
const pingAppName = DEFAULT_PING_APP_NAME;
|
|
151941
151954
|
const fileName = options.fileName ?? "config.ts";
|
|
151942
|
-
const kind = fileName.endsWith(".ts") ?
|
|
151943
|
-
const file2 =
|
|
151955
|
+
const kind = fileName.endsWith(".ts") ? ts7.ScriptKind.TS : ts7.ScriptKind.JS;
|
|
151956
|
+
const file2 = ts7.createSourceFile(fileName, source, ts7.ScriptTarget.Latest, true, kind);
|
|
151944
151957
|
const app = defineAppLiteral(file2);
|
|
151945
151958
|
const named = (instruction) => instruction.replaceAll("config.ts", fileName);
|
|
151946
151959
|
const unchanged = (instruction) => ({ source, changed: false, applied: [], instructions: [named(instruction)], pushOn: false });
|
|
@@ -151992,9 +152005,9 @@ function planPush(app, pingAppName, plan) {
|
|
|
151992
152005
|
}
|
|
151993
152006
|
function planRetiredFamily(block, plan) {
|
|
151994
152007
|
const literal = unwrap(block);
|
|
151995
|
-
const found =
|
|
152008
|
+
const found = ts7.isObjectLiteralExpression(literal) ? lookup3(literal, "pingAppName") : void 0;
|
|
151996
152009
|
const value2 = found?.kind === "written" ? unwrap(found.node.initializer) : void 0;
|
|
151997
|
-
const replacement = value2 &&
|
|
152010
|
+
const replacement = value2 && ts7.isStringLiteralLike(value2) ? replacementPingFamily(value2.text) : void 0;
|
|
151998
152011
|
if (!value2 || !replacement) return;
|
|
151999
152012
|
plan.splices.push({ at: value2.getStart(), end: value2.end, text: JSON.stringify(replacement) });
|
|
152000
152013
|
plan.applied.push(`pingAppName ${JSON.stringify(replacement)} in place of ${value2.getText()}`);
|
|
@@ -152007,11 +152020,11 @@ function planCapability(app, plan) {
|
|
|
152007
152020
|
return;
|
|
152008
152021
|
}
|
|
152009
152022
|
const list2 = capabilities.kind === "written" ? unwrap(capabilities.node.initializer) : void 0;
|
|
152010
|
-
if (!list2 || !
|
|
152023
|
+
if (!list2 || !ts7.isArrayLiteralExpression(list2)) {
|
|
152011
152024
|
plan.instructions.push('Add "push" to capabilities: Wix push needs the push capability, and config.ts does not list it inline.');
|
|
152012
152025
|
return;
|
|
152013
152026
|
}
|
|
152014
|
-
if (list2.elements.some((e2) =>
|
|
152027
|
+
if (list2.elements.some((e2) => ts7.isStringLiteralLike(e2) && e2.text === "push")) return;
|
|
152015
152028
|
const last = list2.elements[list2.elements.length - 1];
|
|
152016
152029
|
plan.splices.push(last ? { at: last.end, end: last.end, text: ', "push"' } : { at: list2.getStart(), end: list2.end, text: '["push"]' });
|
|
152017
152030
|
plan.applied.push("push capability");
|
|
@@ -152039,7 +152052,7 @@ function planAuthSite(login, file2, site, plan) {
|
|
|
152039
152052
|
const current = siteId.kind === "written" ? unwrap(siteId.node.initializer) : void 0;
|
|
152040
152053
|
if (!current) {
|
|
152041
152054
|
plan.instructions.push(`auth may get its siteId from elsewhere, so none was added. Wix push needs ${wanted}.`);
|
|
152042
|
-
} else if (!
|
|
152055
|
+
} else if (!ts7.isStringLiteralLike(current)) {
|
|
152043
152056
|
plan.instructions.push(`auth's siteId is computed, so it was not checked: make sure it evaluates to ${JSON.stringify(site)}.`);
|
|
152044
152057
|
} else if (current.text !== site) {
|
|
152045
152058
|
plan.instructions.push(
|
|
@@ -153537,15 +153550,15 @@ function loadMemory2(dir) {
|
|
|
153537
153550
|
for (const t2 of m2.timeline) {
|
|
153538
153551
|
if (!isObj3(t2)) continue;
|
|
153539
153552
|
const file2 = historyName(t2.sha, t2.ext);
|
|
153540
|
-
const
|
|
153553
|
+
const ts14 = str5(t2.ts);
|
|
153541
153554
|
const id = str5(t2.id);
|
|
153542
|
-
if (file2 &&
|
|
153555
|
+
if (file2 && ts14 && id) timeline.push({ ts: ts14, id, file: file2 });
|
|
153543
153556
|
}
|
|
153544
153557
|
return { createdAt: str5(m2.createdAt), shots, timeline };
|
|
153545
153558
|
}
|
|
153546
|
-
function captionAt(entries,
|
|
153559
|
+
function captionAt(entries, ts14) {
|
|
153547
153560
|
let best = null;
|
|
153548
|
-
for (const e2 of entries) if (e2.ts <=
|
|
153561
|
+
for (const e2 of entries) if (e2.ts <= ts14) best = e2;
|
|
153549
153562
|
return best ? best.message : null;
|
|
153550
153563
|
}
|
|
153551
153564
|
function thin(items, max) {
|
|
@@ -153665,13 +153678,13 @@ function duration(ms2) {
|
|
|
153665
153678
|
const m2 = Math.round(ms2 / 6e4);
|
|
153666
153679
|
return m2 < 60 ? `${m2} min` : `${Math.floor(m2 / 60)} h ${m2 % 60} min`;
|
|
153667
153680
|
}
|
|
153668
|
-
function utcDay(
|
|
153669
|
-
const d2 = new Date(
|
|
153681
|
+
function utcDay(ts14) {
|
|
153682
|
+
const d2 = new Date(ts14);
|
|
153670
153683
|
return Number.isNaN(d2.getTime()) ? "" : `${d2.toUTCString().slice(0, 16)} (UTC)`;
|
|
153671
153684
|
}
|
|
153672
|
-
function sinceStart(start,
|
|
153685
|
+
function sinceStart(start, ts14) {
|
|
153673
153686
|
if (!start) return "";
|
|
153674
|
-
const s2 = Math.max(0, Math.round((Date.parse(
|
|
153687
|
+
const s2 = Math.max(0, Math.round((Date.parse(ts14) - Date.parse(start)) / 1e3));
|
|
153675
153688
|
const h2 = Math.floor(s2 / 3600);
|
|
153676
153689
|
const m2 = Math.floor(s2 % 3600 / 60);
|
|
153677
153690
|
const sec = String(s2 % 60).padStart(2, "0");
|
|
@@ -153681,7 +153694,7 @@ function renderReel(plan, images) {
|
|
|
153681
153694
|
const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
|
|
153682
153695
|
const count2 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
|
|
153683
153696
|
const accent = ACCENT.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
|
|
153684
|
-
const clock = (
|
|
153697
|
+
const clock = (ts14) => sinceStart(plan.startedAt, ts14);
|
|
153685
153698
|
const frames = plan.frames.filter((f2) => images.has(f2.file));
|
|
153686
153699
|
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>
|
|
153687
153700
|
<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>`;
|
|
@@ -155028,19 +155041,19 @@ var init_brand_color_math = __esm({
|
|
|
155028
155041
|
// src/token-lint.ts
|
|
155029
155042
|
import { existsSync as existsSync51, readFileSync as readFileSync59 } from "node:fs";
|
|
155030
155043
|
import { join as join48 } from "node:path";
|
|
155031
|
-
import
|
|
155044
|
+
import ts8 from "typescript";
|
|
155032
155045
|
function configuredTokensPath(dir) {
|
|
155033
155046
|
for (const name of ["config.ts", "config.js", "himi.config.ts"]) {
|
|
155034
155047
|
const f2 = join48(dir, name);
|
|
155035
155048
|
if (!existsSync51(f2)) continue;
|
|
155036
155049
|
const src = readFileSync59(f2, "utf8");
|
|
155037
|
-
const app = defineAppLiteral(
|
|
155050
|
+
const app = defineAppLiteral(ts8.createSourceFile(f2, src, ts8.ScriptTarget.Latest, true));
|
|
155038
155051
|
if (!app) return { computed: true };
|
|
155039
155052
|
const field = lookup3(app, "designTokensPath");
|
|
155040
155053
|
if (field.kind === "opaque") return { computed: true };
|
|
155041
155054
|
if (field.kind === "written") {
|
|
155042
155055
|
const value2 = unwrap(field.node.initializer);
|
|
155043
|
-
return
|
|
155056
|
+
return ts8.isStringLiteralLike(value2) && !ts8.isTemplateExpression(value2) ? { path: value2.text.replace(/^\.\//, "") } : { computed: true };
|
|
155044
155057
|
}
|
|
155045
155058
|
}
|
|
155046
155059
|
return {};
|
|
@@ -155685,17 +155698,17 @@ __export(template_sweep_exports, {
|
|
|
155685
155698
|
});
|
|
155686
155699
|
import { readFileSync as readFileSync62, writeFileSync as writeFileSync22 } from "node:fs";
|
|
155687
155700
|
import { join as join51 } from "node:path";
|
|
155688
|
-
import
|
|
155701
|
+
import ts9 from "typescript";
|
|
155689
155702
|
function isCopy(node, file2) {
|
|
155690
155703
|
const parent = node.parent;
|
|
155691
|
-
if (
|
|
155692
|
-
if (
|
|
155693
|
-
if (
|
|
155694
|
-
if (
|
|
155704
|
+
if (ts9.isPropertyAssignment(parent) && parent.name === node) return false;
|
|
155705
|
+
if (ts9.isImportDeclaration(parent) || ts9.isExportDeclaration(parent) || ts9.isExternalModuleReference(parent)) return false;
|
|
155706
|
+
if (ts9.isLiteralTypeNode(parent) || ts9.isImportTypeNode(parent)) return false;
|
|
155707
|
+
if (ts9.isCallExpression(parent) && ts9.isIdentifier(parent.expression) && parent.expression.text === "require") return false;
|
|
155695
155708
|
const value2 = node.text;
|
|
155696
155709
|
if (/\s/.test(value2) || PLACEHOLDER.test(value2)) return true;
|
|
155697
155710
|
if (ID_LIKE.test(value2)) return false;
|
|
155698
|
-
const key3 =
|
|
155711
|
+
const key3 = ts9.isPropertyAssignment(parent) ? propName4(parent.name) : void 0;
|
|
155699
155712
|
if (!key3) return false;
|
|
155700
155713
|
return COPY_KEYS.has(key3) || key3 === "name" && file2 === "config.ts";
|
|
155701
155714
|
}
|
|
@@ -155713,8 +155726,8 @@ function syntaxErrors(file2, text12) {
|
|
|
155713
155726
|
return [e2.message];
|
|
155714
155727
|
}
|
|
155715
155728
|
}
|
|
155716
|
-
const out2 =
|
|
155717
|
-
return (out2.diagnostics ?? []).map((d2) =>
|
|
155729
|
+
const out2 = ts9.transpileModule(text12, { fileName: file2, reportDiagnostics: true, compilerOptions: { target: ts9.ScriptTarget.ES2022 } });
|
|
155730
|
+
return (out2.diagnostics ?? []).map((d2) => ts9.flattenDiagnosticMessageText(d2.messageText, "\n"));
|
|
155718
155731
|
}
|
|
155719
155732
|
function parses(dev, config) {
|
|
155720
155733
|
try {
|
|
@@ -155736,11 +155749,11 @@ function sweepCopy(dir, pairs, dryRun) {
|
|
|
155736
155749
|
for (const f2 of files) {
|
|
155737
155750
|
const text12 = readFileSync62(join51(dir, f2), "utf8");
|
|
155738
155751
|
if (!pairs.some(([from]) => text12.includes(from) || text12.includes(JSON.stringify(from).slice(1, -1)))) continue;
|
|
155739
|
-
const kind = f2.endsWith(".json") ?
|
|
155740
|
-
const sf2 =
|
|
155752
|
+
const kind = f2.endsWith(".json") ? ts9.ScriptKind.JSON : f2.endsWith("x") ? ts9.ScriptKind.TSX : ts9.ScriptKind.TS;
|
|
155753
|
+
const sf2 = ts9.createSourceFile(f2, text12, ts9.ScriptTarget.Latest, true, kind);
|
|
155741
155754
|
const edits = [];
|
|
155742
155755
|
const visit = (node) => {
|
|
155743
|
-
if ((
|
|
155756
|
+
if ((ts9.isStringLiteral(node) || ts9.isNoSubstitutionTemplateLiteral(node)) && isCopy(node, f2)) {
|
|
155744
155757
|
let value2 = node.text;
|
|
155745
155758
|
pairs.forEach(([from, to2], i2) => {
|
|
155746
155759
|
const n2 = value2.split(from).length - 1;
|
|
@@ -155753,7 +155766,7 @@ function sweepCopy(dir, pairs, dryRun) {
|
|
|
155753
155766
|
edits.push({ start, end: node.end, text: encode(value2, text12[start]) });
|
|
155754
155767
|
}
|
|
155755
155768
|
}
|
|
155756
|
-
|
|
155769
|
+
ts9.forEachChild(node, visit);
|
|
155757
155770
|
};
|
|
155758
155771
|
visit(sf2);
|
|
155759
155772
|
if (!edits.length) continue;
|
|
@@ -155832,7 +155845,7 @@ var init_template_sweep = __esm({
|
|
|
155832
155845
|
"appName",
|
|
155833
155846
|
"displayName"
|
|
155834
155847
|
]);
|
|
155835
|
-
propName4 = (n2) =>
|
|
155848
|
+
propName4 = (n2) => ts9.isIdentifier(n2) || ts9.isStringLiteral(n2) || ts9.isNoSubstitutionTemplateLiteral(n2) ? n2.text : void 0;
|
|
155836
155849
|
}
|
|
155837
155850
|
});
|
|
155838
155851
|
|
|
@@ -167249,7 +167262,7 @@ __export(validate_topbar_exports, {
|
|
|
167249
167262
|
import { createHash as createHash40 } from "node:crypto";
|
|
167250
167263
|
import { existsSync as existsSync84, readFileSync as readFileSync94, statSync as statSync23 } from "node:fs";
|
|
167251
167264
|
import { resolve as resolve68, join as join88 } from "node:path";
|
|
167252
|
-
import
|
|
167265
|
+
import ts10 from "typescript";
|
|
167253
167266
|
function enrichedControls(raw, views) {
|
|
167254
167267
|
const result = /* @__PURE__ */ new Map();
|
|
167255
167268
|
const graph = buildSourceGraph(raw, views);
|
|
@@ -167359,22 +167372,22 @@ function authoredControls(raw) {
|
|
|
167359
167372
|
return { controls, byScreen, screens: count2 };
|
|
167360
167373
|
}
|
|
167361
167374
|
function property(node, name) {
|
|
167362
|
-
const item = node?.properties.find((candidate) =>
|
|
167363
|
-
return item &&
|
|
167375
|
+
const item = node?.properties.find((candidate) => ts10.isPropertyAssignment(candidate) && ((ts10.isIdentifier(candidate.name) || ts10.isStringLiteral(candidate.name)) && candidate.name.text === name));
|
|
167376
|
+
return item && ts10.isPropertyAssignment(item) ? item.initializer : void 0;
|
|
167364
167377
|
}
|
|
167365
167378
|
function unwrap2(node) {
|
|
167366
|
-
while (
|
|
167379
|
+
while (ts10.isParenthesizedExpression(node) || ts10.isAsExpression(node) || ts10.isSatisfiesExpression(node)) node = node.expression;
|
|
167367
167380
|
return node;
|
|
167368
167381
|
}
|
|
167369
167382
|
function resolveObject(node, source, seen = /* @__PURE__ */ new Set()) {
|
|
167370
167383
|
if (!node) return void 0;
|
|
167371
167384
|
const value2 = unwrap2(node);
|
|
167372
|
-
if (
|
|
167373
|
-
if (!
|
|
167385
|
+
if (ts10.isObjectLiteralExpression(value2)) return value2;
|
|
167386
|
+
if (!ts10.isIdentifier(value2) || seen.has(value2.text)) return void 0;
|
|
167374
167387
|
seen.add(value2.text);
|
|
167375
167388
|
for (const statement of source.statements) {
|
|
167376
|
-
if (!
|
|
167377
|
-
const declaration = statement.declarationList.declarations.find((item) =>
|
|
167389
|
+
if (!ts10.isVariableStatement(statement)) continue;
|
|
167390
|
+
const declaration = statement.declarationList.declarations.find((item) => ts10.isIdentifier(item.name) && item.name.text === value2.text);
|
|
167378
167391
|
if (declaration?.initializer) return resolveObject(declaration.initializer, source, seen);
|
|
167379
167392
|
}
|
|
167380
167393
|
return void 0;
|
|
@@ -167383,21 +167396,21 @@ function resolveScreenObject(node, source) {
|
|
|
167383
167396
|
const direct = resolveObject(node, source);
|
|
167384
167397
|
if (direct) return direct;
|
|
167385
167398
|
const value2 = unwrap2(node);
|
|
167386
|
-
const name =
|
|
167399
|
+
const name = ts10.isCallExpression(value2) && ts10.isIdentifier(value2.expression) ? value2.expression.text : ts10.isIdentifier(value2) ? value2.text : void 0;
|
|
167387
167400
|
if (!name) return void 0;
|
|
167388
|
-
const functionBody = source.statements.find((statement) =>
|
|
167389
|
-
const variable = source.statements.filter(
|
|
167401
|
+
const functionBody = source.statements.find((statement) => ts10.isFunctionDeclaration(statement) && statement.name?.text === name)?.body;
|
|
167402
|
+
const variable = source.statements.filter(ts10.isVariableStatement).flatMap((statement) => [...statement.declarationList.declarations]).find((item) => ts10.isIdentifier(item.name) && item.name.text === name);
|
|
167390
167403
|
const initializer = variable?.initializer && unwrap2(variable.initializer);
|
|
167391
|
-
const body = functionBody ?? (initializer && (
|
|
167404
|
+
const body = functionBody ?? (initializer && (ts10.isArrowFunction(initializer) || ts10.isFunctionExpression(initializer)) ? initializer.body : void 0);
|
|
167392
167405
|
if (!body) return void 0;
|
|
167393
|
-
if (!
|
|
167394
|
-
const returns = body.statements.filter(
|
|
167406
|
+
if (!ts10.isBlock(body)) return resolveObject(body, source);
|
|
167407
|
+
const returns = body.statements.filter(ts10.isReturnStatement);
|
|
167395
167408
|
return returns.length === 1 ? resolveObject(returns[0]?.expression, source) : void 0;
|
|
167396
167409
|
}
|
|
167397
167410
|
function stringValue2(node) {
|
|
167398
167411
|
if (!node) return void 0;
|
|
167399
167412
|
const value2 = unwrap2(node);
|
|
167400
|
-
return
|
|
167413
|
+
return ts10.isStringLiteralLike(value2) ? value2.text : void 0;
|
|
167401
167414
|
}
|
|
167402
167415
|
function actionTokens(action) {
|
|
167403
167416
|
const values = ["id", "icon", "label", "accessibilityLabel"].map((key3) => stringValue2(property(action, key3)) ?? "").join(" ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
@@ -167414,12 +167427,12 @@ function parseActions(topBar, source) {
|
|
|
167414
167427
|
if (!actionExpr) return { actions: [] };
|
|
167415
167428
|
const actionsNode = unwrap2(actionExpr);
|
|
167416
167429
|
let items;
|
|
167417
|
-
if (
|
|
167418
|
-
else if (
|
|
167419
|
-
const declaration = source.statements.filter(
|
|
167430
|
+
if (ts10.isArrayLiteralExpression(actionsNode)) items = actionsNode.elements.filter(ts10.isExpression);
|
|
167431
|
+
else if (ts10.isIdentifier(actionsNode)) {
|
|
167432
|
+
const declaration = source.statements.filter(ts10.isVariableStatement).flatMap((statement) => [...statement.declarationList.declarations]).find((item) => ts10.isIdentifier(item.name) && item.name.text === actionsNode.text);
|
|
167420
167433
|
const init = declaration?.initializer && unwrap2(declaration.initializer);
|
|
167421
|
-
if (!init || !
|
|
167422
|
-
items = init.elements.filter(
|
|
167434
|
+
if (!init || !ts10.isArrayLiteralExpression(init)) return { actions: [], error: "Top-bar actions cannot be statically inspected." };
|
|
167435
|
+
items = init.elements.filter(ts10.isExpression);
|
|
167423
167436
|
} else return { actions: [], error: "Top-bar actions cannot be statically inspected." };
|
|
167424
167437
|
const actions = [];
|
|
167425
167438
|
for (const item of items) {
|
|
@@ -167430,23 +167443,23 @@ function parseActions(topBar, source) {
|
|
|
167430
167443
|
return { actions };
|
|
167431
167444
|
}
|
|
167432
167445
|
function configActions(configPath) {
|
|
167433
|
-
const source =
|
|
167446
|
+
const source = ts10.createSourceFile(configPath, readFileSync94(configPath, "utf8"), ts10.ScriptTarget.Latest, true, ts10.ScriptKind.TS);
|
|
167434
167447
|
if (source.parseDiagnostics.length) return { actions: [], error: "config.ts could not be parsed." };
|
|
167435
|
-
const exportAssignment = source.statements.find(
|
|
167448
|
+
const exportAssignment = source.statements.find(ts10.isExportAssignment);
|
|
167436
167449
|
if (!exportAssignment) return { actions: [], error: "config.ts has no default app export." };
|
|
167437
167450
|
let exported = unwrap2(exportAssignment.expression);
|
|
167438
|
-
if (
|
|
167451
|
+
if (ts10.isIdentifier(exported)) {
|
|
167439
167452
|
const exportedName = exported.text;
|
|
167440
167453
|
for (const statement of source.statements) {
|
|
167441
|
-
if (!
|
|
167442
|
-
const declaration = statement.declarationList.declarations.find((item) =>
|
|
167454
|
+
if (!ts10.isVariableStatement(statement)) continue;
|
|
167455
|
+
const declaration = statement.declarationList.declarations.find((item) => ts10.isIdentifier(item.name) && item.name.text === exportedName);
|
|
167443
167456
|
if (declaration?.initializer) {
|
|
167444
167457
|
exported = unwrap2(declaration.initializer);
|
|
167445
167458
|
break;
|
|
167446
167459
|
}
|
|
167447
167460
|
}
|
|
167448
167461
|
}
|
|
167449
|
-
if (!
|
|
167462
|
+
if (!ts10.isCallExpression(exported) || !exported.arguments[0]) return { actions: [], error: "config.ts does not default-export defineApp({...})." };
|
|
167450
167463
|
const app = resolveObject(exported.arguments[0], source);
|
|
167451
167464
|
const navigation = resolveObject(property(app, "navigation"), source);
|
|
167452
167465
|
const topBar = resolveObject(property(navigation, "topBarDefault"), source);
|
|
@@ -167457,13 +167470,13 @@ function configActions(configPath) {
|
|
|
167457
167470
|
function screenActions2(contentDir2) {
|
|
167458
167471
|
const path2 = join88(contentDir2, "dev", "index.ts");
|
|
167459
167472
|
if (!existsSync84(path2)) return /* @__PURE__ */ new Map();
|
|
167460
|
-
const source =
|
|
167473
|
+
const source = ts10.createSourceFile(path2, readFileSync94(path2, "utf8"), ts10.ScriptTarget.Latest, true, ts10.ScriptKind.TS);
|
|
167461
167474
|
if (source.parseDiagnostics.length) throw Error("dev/index.ts could not be parsed.");
|
|
167462
|
-
const declaration = source.statements.filter(
|
|
167475
|
+
const declaration = source.statements.filter(ts10.isVariableStatement).flatMap((statement) => [...statement.declarationList.declarations]).find((item) => ts10.isIdentifier(item.name) && item.name.text === "SCREENS");
|
|
167463
167476
|
const initializer = declaration?.initializer && unwrap2(declaration.initializer);
|
|
167464
|
-
let registry2 = initializer &&
|
|
167477
|
+
let registry2 = initializer && ts10.isCallExpression(initializer) ? resolveObject(initializer.arguments[0], source) : resolveObject(initializer, source);
|
|
167465
167478
|
if (!declaration) {
|
|
167466
|
-
const exported = source.statements.find(
|
|
167479
|
+
const exported = source.statements.find(ts10.isExportAssignment);
|
|
167467
167480
|
const module = resolveObject(exported?.expression, source);
|
|
167468
167481
|
const screens = resolveObject(property(module, "screens"), source);
|
|
167469
167482
|
registry2 = resolveObject(property(screens, "exact"), source);
|
|
@@ -167471,11 +167484,11 @@ function screenActions2(contentDir2) {
|
|
|
167471
167484
|
if (!registry2) throw Error("dev/index.ts screen registry cannot be statically inspected.");
|
|
167472
167485
|
const result = /* @__PURE__ */ new Map();
|
|
167473
167486
|
for (const item of registry2.properties) {
|
|
167474
|
-
if (!
|
|
167487
|
+
if (!ts10.isPropertyAssignment(item) || !ts10.isIdentifier(item.name) && !ts10.isStringLiteral(item.name)) {
|
|
167475
167488
|
throw Error("dev/index.ts screen registry contains entries that cannot be statically inspected.");
|
|
167476
167489
|
}
|
|
167477
167490
|
const screen = resolveScreenObject(item.initializer, source);
|
|
167478
|
-
if (!screen || screen.properties.some(
|
|
167491
|
+
if (!screen || screen.properties.some(ts10.isSpreadAssignment)) {
|
|
167479
167492
|
result.set(item.name.text, { actions: [], error: "ScreenDescriptor cannot be statically inspected." });
|
|
167480
167493
|
continue;
|
|
167481
167494
|
}
|
|
@@ -167637,7 +167650,7 @@ __export(validate_design_exports, {
|
|
|
167637
167650
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
167638
167651
|
import { closeSync as closeSync7, constants as constants5, existsSync as existsSync85, lstatSync as lstatSync23, openSync as openSync6, readFileSync as readFileSync95, realpathSync as realpathSync12, renameSync as renameSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync36 } from "node:fs";
|
|
167639
167652
|
import { dirname as dirname47, isAbsolute as isAbsolute9, join as join89, relative as relative19, resolve as resolve69, sep as sep20, win32 } from "node:path";
|
|
167640
|
-
import
|
|
167653
|
+
import ts11 from "typescript";
|
|
167641
167654
|
function readColorToken(tokens2, name) {
|
|
167642
167655
|
const entry = obj5(tokens2.colors)?.[name];
|
|
167643
167656
|
if (typeof entry === "string") return { value: entry, origin: "token" };
|
|
@@ -167734,11 +167747,11 @@ function tokensLocation(contentDir2) {
|
|
|
167734
167747
|
}
|
|
167735
167748
|
function literalPolicyValue(expression) {
|
|
167736
167749
|
const node = unwrap(expression);
|
|
167737
|
-
if (
|
|
167738
|
-
if (!
|
|
167750
|
+
if (ts11.isStringLiteralLike(node)) return node.text;
|
|
167751
|
+
if (!ts11.isObjectLiteralExpression(node)) throw new Error("The app idiom policy is computed and cannot be checked.");
|
|
167739
167752
|
const value2 = {};
|
|
167740
167753
|
for (const property2 of node.properties) {
|
|
167741
|
-
if (!
|
|
167754
|
+
if (!ts11.isPropertyAssignment(property2) || !property2.name || !ts11.isIdentifier(property2.name) && !ts11.isStringLiteral(property2.name)) {
|
|
167742
167755
|
throw new Error("The app idiom policy is computed and cannot be checked.");
|
|
167743
167756
|
}
|
|
167744
167757
|
value2[property2.name.text] = literalPolicyValue(property2.initializer);
|
|
@@ -167751,7 +167764,7 @@ function activeIdiomNames(contentDir2, tokens2) {
|
|
|
167751
167764
|
for (const name of ["config.ts", "config.js", "himi.config.ts"]) {
|
|
167752
167765
|
const file2 = join89(contentDir2, name);
|
|
167753
167766
|
if (!existsSync85(file2)) continue;
|
|
167754
|
-
const source =
|
|
167767
|
+
const source = ts11.createSourceFile(file2, readFileSync95(file2, "utf8"), ts11.ScriptTarget.Latest, true);
|
|
167755
167768
|
const app = defineAppLiteral(source);
|
|
167756
167769
|
if (!app) throw new Error("The app config cannot be inspected for active idiom overlays.");
|
|
167757
167770
|
const field = lookup3(app, "idiom");
|
|
@@ -170970,40 +170983,40 @@ var init_preview_assets_generated = __esm({
|
|
|
170970
170983
|
"../../packages/serve/src/preview-assets.generated.ts"() {
|
|
170971
170984
|
init_preview_assets_format();
|
|
170972
170985
|
PREVIEW_ASSET_MANIFEST = [
|
|
170973
|
-
{ key: "assets/DashboardHost-
|
|
170974
|
-
{ key: "assets/DevDrawer-
|
|
170975
|
-
{ key: "assets/IdiomCompare-
|
|
170976
|
-
{ key: "assets/LightboxViewer-
|
|
170977
|
-
{ key: "assets/OfflineReadingBar-
|
|
170978
|
-
{ key: "assets/PhonePreviewControl-
|
|
170979
|
-
{ key: "assets/SchemeCompare-
|
|
170986
|
+
{ key: "assets/DashboardHost-Dlp1NFJA.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2955, sha256: "9502e4d90eebb7bdada14ff5cf74c0dda3eef392d547e85820ebe0a8f39af1fe" },
|
|
170987
|
+
{ key: "assets/DevDrawer-DmTayvjk.js", contentType: "application/javascript; charset=utf-8", offset: 2963, length: 16783, sha256: "2e7e6b22745870c5a1c5cb5d5a0de2b605ac142b9f981b75ecd3c1dbe4f90a3e" },
|
|
170988
|
+
{ key: "assets/IdiomCompare-B1qiFpfx.js", contentType: "application/javascript; charset=utf-8", offset: 19746, length: 1926, sha256: "113057cfc24a859f2342d1adcc90b6affaf36f05e304020012931e0e222a6af3" },
|
|
170989
|
+
{ key: "assets/LightboxViewer-BMMQTrCt.js", contentType: "application/javascript; charset=utf-8", offset: 21672, length: 8171, sha256: "0d6a8efd6edea463188bad710504cfcdeab00a38de0fd5174797c84e859e3a96" },
|
|
170990
|
+
{ key: "assets/OfflineReadingBar-B8OPp-1I.js", contentType: "application/javascript; charset=utf-8", offset: 29843, length: 1707, sha256: "a49107d73a8bd33cf3cb154fbd997969b4d94f5d057761f552fc3a5918df8650" },
|
|
170991
|
+
{ key: "assets/PhonePreviewControl-CSwgF-ZS.js", contentType: "application/javascript; charset=utf-8", offset: 31550, length: 37768, sha256: "fbc818c26776b62f13686d3a396a2948a52a95febf8f945dace9f2b1f54b5507" },
|
|
170992
|
+
{ key: "assets/SchemeCompare-CY27eOWX.js", contentType: "application/javascript; charset=utf-8", offset: 69318, length: 1858, sha256: "ef41ac7af5df97d0e603c10f223e2da9aab3e8afd16820b336bccf4da4ce07ab" },
|
|
170980
170993
|
{ key: "assets/glassPreviewBrowser-Bt5ZFmG4.js", contentType: "application/javascript; charset=utf-8", offset: 71176, length: 342, sha256: "20d73f97d38f6d9a0b79e68e24954cd6bbfe66833a6e6aecae00a9102e64cab3" },
|
|
170981
|
-
{ key: "assets/index-
|
|
170982
|
-
{ key: "assets/jsx-runtime-CY_jTiqj.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
170983
|
-
{ key: "assets/pdf-
|
|
170984
|
-
{ key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
170985
|
-
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset:
|
|
170986
|
-
{ key: "assets/pdfDocument-
|
|
170987
|
-
{ key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
170988
|
-
{ key: "assets/webviewBridgeHost-
|
|
170989
|
-
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset:
|
|
170990
|
-
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset:
|
|
170991
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
170992
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
170993
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
170994
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
170995
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
170996
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
170997
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
170998
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
170999
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
171000
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
171001
|
-
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
171002
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
171003
|
-
{ key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset:
|
|
171004
|
-
{ key: "ios-glass-preview.svg", contentType: "image/svg+xml", offset:
|
|
171005
|
-
{ key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset:
|
|
171006
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
170994
|
+
{ key: "assets/index-Cu_14evU.js", contentType: "application/javascript; charset=utf-8", offset: 71518, length: 1353477, sha256: "a5176244b668c35f2b9065d6699388e5ac0153cd07bd10728f5639f1002c5306" },
|
|
170995
|
+
{ key: "assets/jsx-runtime-CY_jTiqj.js", contentType: "application/javascript; charset=utf-8", offset: 1424995, length: 7624, sha256: "29dfba5b56f79a0b84d6b04d84d87617454baeba03c225f682ab2ab7ae2d5016" },
|
|
170996
|
+
{ key: "assets/pdf-Cnt8L-gU.js", contentType: "application/javascript; charset=utf-8", offset: 1432619, length: 488199, sha256: "9825219b8f3230cdc3e368ab076ebf0776ad563ab89a2f251ecee719893bd42a" },
|
|
170997
|
+
{ key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset: 1920818, length: 73, sha256: "41bcfda4f3c8c0a81c785ea87c69afc8e7d0ed8c333324aee94c273d881bb6aa" },
|
|
170998
|
+
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 1920891, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
|
|
170999
|
+
{ key: "assets/pdfDocument-CMADg9pV.js", contentType: "application/javascript; charset=utf-8", offset: 3237925, length: 3453, sha256: "462e4d2dce3f4b8a5ccd20f5063ba4ad61a4a7b92b60b7c293df1b180dccb296" },
|
|
171000
|
+
{ key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3241378, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
|
|
171001
|
+
{ key: "assets/webviewBridgeHost-CalrQKAD.js", contentType: "application/javascript; charset=utf-8", offset: 3243644, length: 9888, sha256: "417becf224e3a96b9050bce3d77ec01b29d56a49446c6c15c7d9b5e183f34039" },
|
|
171002
|
+
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3253532, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
|
|
171003
|
+
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3258142, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
|
|
171004
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3746726, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
171005
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3837650, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
171006
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3928634, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
171007
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4019614, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
171008
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4110486, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
171009
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4201466, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
171010
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4310102, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
171011
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4419186, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
171012
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4528234, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
171013
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4635934, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
171014
|
+
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 4724042, length: 6748, sha256: "4a92459977d7cefa1a6a7e020c3a63509737f083b3f2773557c1a5771665811a" },
|
|
171015
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 4730790, length: 5037, sha256: "f2a045b5883d9543569d8b5e98c7aead72e846a83cd8b9a6487b3531f35115c2" },
|
|
171016
|
+
{ key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 4735827, length: 7193, sha256: "a482f4796147c2a3893942e10ab225bd3b6f749f7125fe0330680d4c20ea0212" },
|
|
171017
|
+
{ key: "ios-glass-preview.svg", contentType: "image/svg+xml", offset: 4743020, length: 423, sha256: "b9cd5989d31464a0422f260a332af6be5add0b04de2148944de35158f3b75efc" },
|
|
171018
|
+
{ key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 4743443, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
|
|
171019
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4744614, length: 19459, sha256: "760d3263ea56776e60a4808558b32ae20ea2c667c0634573b9fdc5c7694a4f20" }
|
|
171007
171020
|
];
|
|
171008
171021
|
}
|
|
171009
171022
|
});
|
|
@@ -174951,11 +174964,11 @@ var init_store_spec = __esm({
|
|
|
174951
174964
|
// src/iap-config-edit.ts
|
|
174952
174965
|
import { existsSync as existsSync94, readFileSync as readFileSync109 } from "node:fs";
|
|
174953
174966
|
import { basename as basename25, join as join97 } from "node:path";
|
|
174954
|
-
import
|
|
174967
|
+
import ts12 from "typescript";
|
|
174955
174968
|
function bindPurchasesAppInConfig(source, options) {
|
|
174956
174969
|
const fileName = options.fileName ?? "config.ts";
|
|
174957
|
-
const kind = fileName.endsWith(".ts") ?
|
|
174958
|
-
const file2 =
|
|
174970
|
+
const kind = fileName.endsWith(".ts") ? ts12.ScriptKind.TS : ts12.ScriptKind.JS;
|
|
174971
|
+
const file2 = ts12.createSourceFile(fileName, source, ts12.ScriptTarget.Latest, true, kind);
|
|
174959
174972
|
const wanted = `wixIap: { purchasesAppId: ${JSON.stringify(options.purchasesAppId)} }`;
|
|
174960
174973
|
const unchanged = (result) => ({ source, changed: false, applied: [], conflicts: [], instructions: [], ...result });
|
|
174961
174974
|
const app = defineAppLiteral(file2);
|
|
@@ -174983,7 +174996,7 @@ function siteFinding(app, siteId, fileName) {
|
|
|
174983
174996
|
if (login.kind !== "member") return { instruction: `${fileName} does not write auth as a WixConsumerAuthProvider({ \u2026 }) call it can read, so ${check}` };
|
|
174984
174997
|
const found = lookup3(login.literal, "siteId");
|
|
174985
174998
|
const value2 = found.kind === "written" ? unwrap(found.node.initializer) : void 0;
|
|
174986
|
-
if (!value2 || !
|
|
174999
|
+
if (!value2 || !ts12.isStringLiteralLike(value2)) return { instruction: `auth's siteId is not written as a literal, so ${check}` };
|
|
174987
175000
|
if (value2.text.toLowerCase() === siteId.toLowerCase()) return {};
|
|
174988
175001
|
return { conflict: `auth's siteId is "${value2.text}", but the purchases app is registered on site "${siteId}". A build bakes the binding only when they match, so ${fileName} was not edited.` };
|
|
174989
175002
|
}
|
|
@@ -174994,7 +175007,7 @@ function bundleFinding(app, { bundleId, storeBundleId }, fileName) {
|
|
|
174994
175007
|
}
|
|
174995
175008
|
const found = lookup3(app, "bundleId");
|
|
174996
175009
|
const value2 = found.kind === "written" ? unwrap(found.node.initializer) : void 0;
|
|
174997
|
-
if (!value2 || !
|
|
175010
|
+
if (!value2 || !ts12.isStringLiteralLike(value2)) {
|
|
174998
175011
|
return { instruction: `${fileName} does not write bundleId as a literal: make sure this app builds bundle ${JSON.stringify(bundleId)}, the one the purchases app is registered for.` };
|
|
174999
175012
|
}
|
|
175000
175013
|
if (value2.text === bundleId || defaultProdBundleId(value2.text) === bundleId) return {};
|
|
@@ -175004,23 +175017,23 @@ function bindingFinding(app, file2, purchasesAppId, wanted, fileName) {
|
|
|
175004
175017
|
const wixIap = lookup3(app, "wixIap");
|
|
175005
175018
|
if (wixIap.kind === "absent") return { splice: appendProperties(app, file2, [`${wanted},`]), applied: "wixIap.purchasesAppId" };
|
|
175006
175019
|
const literal = wixIap.kind === "written" ? unwrap(wixIap.node.initializer) : void 0;
|
|
175007
|
-
if (!literal || !
|
|
175020
|
+
if (!literal || !ts12.isObjectLiteralExpression(literal)) return { instruction: `${fileName} computes wixIap, so it was not edited: it must evaluate to ${wanted}.` };
|
|
175008
175021
|
const current = lookup3(literal, "purchasesAppId");
|
|
175009
175022
|
if (current.kind === "absent") return { splice: appendProperties(literal, file2, [`purchasesAppId: ${JSON.stringify(purchasesAppId)},`]), applied: "wixIap.purchasesAppId" };
|
|
175010
175023
|
const value2 = current.kind === "written" ? unwrap(current.node.initializer) : void 0;
|
|
175011
|
-
if (!value2 || !
|
|
175024
|
+
if (!value2 || !ts12.isStringLiteralLike(value2)) return { instruction: `${fileName} computes wixIap.purchasesAppId, so it was not edited: it must evaluate to ${JSON.stringify(purchasesAppId)}.` };
|
|
175012
175025
|
if (value2.text === purchasesAppId) return {};
|
|
175013
175026
|
return { conflict: `${fileName} already binds purchases app "${value2.text}", but this site's purchases app for the bundle is "${purchasesAppId}". Nothing was changed; fix whichever is stale.` };
|
|
175014
175027
|
}
|
|
175015
175028
|
function capabilityFinding(app, fileName) {
|
|
175016
175029
|
const capabilities = lookup3(app, "capabilities");
|
|
175017
175030
|
const list2 = capabilities.kind === "written" ? unwrap(capabilities.node.initializer) : void 0;
|
|
175018
|
-
if (capabilities.kind !== "absent" && (!list2 || !
|
|
175031
|
+
if (capabilities.kind !== "absent" && (!list2 || !ts12.isArrayLiteralExpression(list2))) {
|
|
175019
175032
|
return { instruction: `Add "iap" to capabilities: the purchases app is baked only into a build that declares it, and ${fileName} does not list capabilities inline.` };
|
|
175020
175033
|
}
|
|
175021
175034
|
if (!list2) return { instruction: `Add capabilities: ["iap"] (with the app's other capabilities) to ${fileName}: the purchases app is baked only into a build that declares it.` };
|
|
175022
175035
|
const elements = list2.elements;
|
|
175023
|
-
if (elements.some((e2) =>
|
|
175036
|
+
if (elements.some((e2) => ts12.isStringLiteralLike(e2) && e2.text === "iap")) return {};
|
|
175024
175037
|
const last = elements[elements.length - 1];
|
|
175025
175038
|
return {
|
|
175026
175039
|
splice: last ? { at: last.end, end: last.end, text: ', "iap"' } : { at: list2.getStart(), end: list2.end, text: '["iap"]' },
|
|
@@ -192619,7 +192632,7 @@ var init_site_oauth_client = __esm({
|
|
|
192619
192632
|
|
|
192620
192633
|
// src/site-analyze/velo-source.ts
|
|
192621
192634
|
import path from "node:path";
|
|
192622
|
-
import
|
|
192635
|
+
import ts13 from "typescript";
|
|
192623
192636
|
function applySourceEdits(source, edits) {
|
|
192624
192637
|
const chunks = [];
|
|
192625
192638
|
let cursor = 0;
|
|
@@ -192637,13 +192650,13 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
192637
192650
|
/\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,
|
|
192638
192651
|
REDACTED2
|
|
192639
192652
|
).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]");
|
|
192640
|
-
const parsed =
|
|
192653
|
+
const parsed = ts13.createSourceFile("backend.ts", source, ts13.ScriptTarget.Latest, true);
|
|
192641
192654
|
const comments = /* @__PURE__ */ new Map();
|
|
192642
192655
|
const visitComments = (node) => {
|
|
192643
192656
|
for (const range of [
|
|
192644
|
-
...
|
|
192645
|
-
...
|
|
192646
|
-
...
|
|
192657
|
+
...ts13.getLeadingCommentRanges(source, node.pos) ?? [],
|
|
192658
|
+
...ts13.getTrailingCommentRanges(source, node.pos) ?? [],
|
|
192659
|
+
...ts13.getTrailingCommentRanges(source, node.end) ?? []
|
|
192647
192660
|
]) comments.set(range.pos, range.end);
|
|
192648
192661
|
for (const child of node.getChildren(parsed)) visitComments(child);
|
|
192649
192662
|
};
|
|
@@ -192662,22 +192675,22 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
192662
192675
|
if (/^["'`][A-Za-z0-9_+/=-]{24,}["'`]$/.test(token)) return JSON.stringify(REDACTED2);
|
|
192663
192676
|
return token;
|
|
192664
192677
|
};
|
|
192665
|
-
const clean2 =
|
|
192678
|
+
const clean2 = ts13.createSourceFile("backend.ts", source, ts13.ScriptTarget.Latest, true);
|
|
192666
192679
|
const masks = [];
|
|
192667
192680
|
const collectMasks = (node) => {
|
|
192668
192681
|
const start = node.getStart(clean2);
|
|
192669
|
-
if (
|
|
192682
|
+
if (ts13.isRegularExpressionLiteral(node)) {
|
|
192670
192683
|
masks.push({ start, end: node.end, text: " ".repeat(node.end - start) });
|
|
192671
|
-
} else if (
|
|
192684
|
+
} else if (ts13.isStringLiteral(node) || ts13.isTemplateLiteralToken(node)) {
|
|
192672
192685
|
masks.push({ start, end: node.end, text: source.slice(start, node.end).replace(/;/g, " ") });
|
|
192673
192686
|
}
|
|
192674
|
-
|
|
192687
|
+
ts13.forEachChild(node, collectMasks);
|
|
192675
192688
|
};
|
|
192676
192689
|
collectMasks(clean2);
|
|
192677
192690
|
const assignmentContext = applySourceEdits(source, masks);
|
|
192678
192691
|
const edits = [];
|
|
192679
192692
|
const visitLiterals = (node) => {
|
|
192680
|
-
if (
|
|
192693
|
+
if (ts13.isStringLiteral(node) || ts13.isNoSubstitutionTemplateLiteral(node) || ts13.isTemplateExpression(node)) {
|
|
192681
192694
|
const start = node.getStart(clean2);
|
|
192682
192695
|
const text12 = source.slice(start, node.end);
|
|
192683
192696
|
const redacted = redactLiteral(text12, start);
|
|
@@ -192686,7 +192699,7 @@ function redactVeloSource(source, knownSecrets = []) {
|
|
|
192686
192699
|
return;
|
|
192687
192700
|
}
|
|
192688
192701
|
}
|
|
192689
|
-
|
|
192702
|
+
ts13.forEachChild(node, visitLiterals);
|
|
192690
192703
|
};
|
|
192691
192704
|
visitLiterals(clean2);
|
|
192692
192705
|
return applySourceEdits(source, edits);
|
|
@@ -192725,19 +192738,19 @@ function selectVeloSource(files, request, knownSecrets = []) {
|
|
|
192725
192738
|
selected.set(file2.path, { source: excerpt, sourceTruncated: excerpt.length < redacted.length });
|
|
192726
192739
|
remaining -= excerpt.length;
|
|
192727
192740
|
const dependencies = [];
|
|
192728
|
-
const parsed =
|
|
192741
|
+
const parsed = ts13.createSourceFile(file2.path, file2.content, ts13.ScriptTarget.Latest, true);
|
|
192729
192742
|
const specifiers = [];
|
|
192730
192743
|
const collectImports = (node) => {
|
|
192731
192744
|
let specifier;
|
|
192732
|
-
if (
|
|
192745
|
+
if (ts13.isImportDeclaration(node) || ts13.isExportDeclaration(node)) {
|
|
192733
192746
|
specifier = node.moduleSpecifier;
|
|
192734
|
-
} else if (
|
|
192747
|
+
} else if (ts13.isImportEqualsDeclaration(node) && ts13.isExternalModuleReference(node.moduleReference)) {
|
|
192735
192748
|
specifier = node.moduleReference.expression;
|
|
192736
|
-
} else if (
|
|
192749
|
+
} else if (ts13.isCallExpression(node) && (node.expression.kind === ts13.SyntaxKind.ImportKeyword || ts13.isIdentifier(node.expression) && node.expression.text === "require")) {
|
|
192737
192750
|
specifier = node.arguments[0];
|
|
192738
192751
|
}
|
|
192739
|
-
if (specifier &&
|
|
192740
|
-
|
|
192752
|
+
if (specifier && ts13.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
|
|
192753
|
+
ts13.forEachChild(node, collectImports);
|
|
192741
192754
|
};
|
|
192742
192755
|
collectImports(parsed);
|
|
192743
192756
|
for (const specifier of specifiers) {
|
|
Binary file
|
|
@@ -226,6 +226,10 @@ reference's top-tabs row in R04 and its top-tabs acceptance case:
|
|
|
226
226
|
`initialTabId`. `initial_tab_changed` names the page that used to open first.
|
|
227
227
|
- `target.showLabels` is the source label setting. Pilates hides labels when it
|
|
228
228
|
is unset.
|
|
229
|
+
- `target.showLabels: false` means an icon-only bar: set the kit token
|
|
230
|
+
`tabBar.labels.show: false`. It applies to the native bar too (the iOS system
|
|
231
|
+
Liquid Glass bar and Android's Material bar), so keep `presentation: "native"`.
|
|
232
|
+
Every tab still needs its `label`: it is the tab's screen-reader name.
|
|
229
233
|
- `target.navKind: "single"` means at most one visible page: no tab bar.
|
|
230
234
|
- `missing_icon`: choose an icon that matches the page content and record it as a
|
|
231
235
|
target adaptation. `missing_label`: use a label from the page content and record it.
|
|
@@ -114,10 +114,18 @@ should keep working.
|
|
|
114
114
|
It **refuses** (exit `2`, nothing written) when `--keep` is missing or names an id the app does
|
|
115
115
|
not serve (the report lists the ones it does), when the app's `dev/index.ts` or `config.ts` is
|
|
116
116
|
no longer in the shape `himi init` writes (a block, the `navigation` object or
|
|
117
|
-
`workerSubtreeScreens` that is not
|
|
117
|
+
`workerSubtreeScreens` that is not JSON data), when kept screens link to removed ones and no `--links` was given, when no tab would be
|
|
118
118
|
left, and when dropping links would leave a kept screen empty or cannot reach a link. Then trim
|
|
119
119
|
by hand, below.
|
|
120
120
|
|
|
121
|
+
The `navigation` object and `workerSubtreeScreens` array in `config.ts` may contain
|
|
122
|
+
`//` or `/* … */` comments. Read-only template commands preserve their
|
|
123
|
+
source bytes. Commands that rewrite navigation, including trim and `template screens --add`,
|
|
124
|
+
re-emit that block as JSON, removing comments inside it.
|
|
125
|
+
Property names and strings must remain double-quoted; computed values, spreads and function
|
|
126
|
+
calls are refused rather than evaluated. This also keeps migrated navigation readable by
|
|
127
|
+
`himi template screens`, `himi template inspect` and `himi template trim` after an agent adds notes.
|
|
128
|
+
|
|
121
129
|
Afterwards: `himi render <each kept screen>`, then `himi test`.
|
|
122
130
|
|
|
123
131
|
## How to trim by hand
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1556.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"artifactId": "himalaya-cli"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"falconPackageHash": "
|
|
74
|
+
"falconPackageHash": "23dddd99ae87fea0fd887d35bbd733e1d696ad3f0b28d9c774b360ee"
|
|
75
75
|
}
|