@wix/himalaya-cli 0.1052.0 → 0.1054.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/dev-server/src/app-module.d.ts +10 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/wix-member-login.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +8 -0
- package/dist/cli.mjs +495 -350
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/headless-loop.md +4 -1
- package/guides/wix-business-context.md +7 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -2182,6 +2182,282 @@ var init_widget_identity = __esm({
|
|
|
2182
2182
|
}
|
|
2183
2183
|
});
|
|
2184
2184
|
|
|
2185
|
+
// ../../core/admin-web/src/utils/qr.ts
|
|
2186
|
+
function rawDataModules(ver) {
|
|
2187
|
+
let result = (16 * ver + 128) * ver + 64;
|
|
2188
|
+
if (ver >= 2) {
|
|
2189
|
+
const numAlign = Math.floor(ver / 7) + 2;
|
|
2190
|
+
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
2191
|
+
if (ver >= 7) result -= 36;
|
|
2192
|
+
}
|
|
2193
|
+
return result;
|
|
2194
|
+
}
|
|
2195
|
+
function byteCapacity(ver) {
|
|
2196
|
+
const lenBits = ver < 10 ? 8 : 16;
|
|
2197
|
+
return dataCodewords(ver) - Math.ceil((4 + lenBits) / 8);
|
|
2198
|
+
}
|
|
2199
|
+
function fitVersion(len) {
|
|
2200
|
+
for (let v = 1; v <= QR_MAX_VERSION; v++) if (byteCapacity(v) >= len) return v;
|
|
2201
|
+
return void 0;
|
|
2202
|
+
}
|
|
2203
|
+
function rsDivisor(degree) {
|
|
2204
|
+
const result = new Array(degree).fill(0);
|
|
2205
|
+
result[degree - 1] = 1;
|
|
2206
|
+
let root = 1;
|
|
2207
|
+
for (let i = 0; i < degree; i++) {
|
|
2208
|
+
for (let j = 0; j < degree; j++) {
|
|
2209
|
+
result[j] = gfMul(result[j], root);
|
|
2210
|
+
if (j + 1 < degree) result[j] ^= result[j + 1];
|
|
2211
|
+
}
|
|
2212
|
+
root = gfMul(root, 2);
|
|
2213
|
+
}
|
|
2214
|
+
return result;
|
|
2215
|
+
}
|
|
2216
|
+
function rsRemainder(data, degree) {
|
|
2217
|
+
const divisor = rsDivisor(degree);
|
|
2218
|
+
const res = new Array(degree).fill(0);
|
|
2219
|
+
for (const b of data) {
|
|
2220
|
+
const factor = b ^ res.shift();
|
|
2221
|
+
res.push(0);
|
|
2222
|
+
for (let i = 0; i < degree; i++) res[i] ^= gfMul(divisor[i], factor);
|
|
2223
|
+
}
|
|
2224
|
+
return res;
|
|
2225
|
+
}
|
|
2226
|
+
function encodeData(bytes2, ver) {
|
|
2227
|
+
const bits = [];
|
|
2228
|
+
const push = (val, len) => {
|
|
2229
|
+
for (let i = len - 1; i >= 0; i--) bits.push(val >>> i & 1);
|
|
2230
|
+
};
|
|
2231
|
+
push(4, 4);
|
|
2232
|
+
push(bytes2.length, ver < 10 ? 8 : 16);
|
|
2233
|
+
for (const b of bytes2) push(b, 8);
|
|
2234
|
+
const capacityBits = dataCodewords(ver) * 8;
|
|
2235
|
+
push(0, Math.min(4, capacityBits - bits.length));
|
|
2236
|
+
while (bits.length % 8 !== 0) bits.push(0);
|
|
2237
|
+
const out = [];
|
|
2238
|
+
for (let i = 0; i < bits.length; i += 8) {
|
|
2239
|
+
let byte2 = 0;
|
|
2240
|
+
for (let j = 0; j < 8; j++) byte2 = byte2 << 1 | bits[i + j];
|
|
2241
|
+
out.push(byte2);
|
|
2242
|
+
}
|
|
2243
|
+
for (let pad2 = 236; out.length < dataCodewords(ver); pad2 ^= 236 ^ 17) out.push(pad2);
|
|
2244
|
+
return out;
|
|
2245
|
+
}
|
|
2246
|
+
function interleave(data, ver) {
|
|
2247
|
+
const numBlocks = NUM_BLOCKS_L[ver];
|
|
2248
|
+
const eccLen = ECC_PER_BLOCK_L[ver];
|
|
2249
|
+
const shortLen = Math.floor(totalCodewords(ver) / numBlocks) - eccLen;
|
|
2250
|
+
const numShort = numBlocks - totalCodewords(ver) % numBlocks;
|
|
2251
|
+
const blocks = [];
|
|
2252
|
+
const eccs = [];
|
|
2253
|
+
let off = 0;
|
|
2254
|
+
for (let i = 0; i < numBlocks; i++) {
|
|
2255
|
+
const len = shortLen + (i < numShort ? 0 : 1);
|
|
2256
|
+
const blk = data.slice(off, off + len);
|
|
2257
|
+
off += len;
|
|
2258
|
+
blocks.push(blk);
|
|
2259
|
+
eccs.push(rsRemainder(blk, eccLen));
|
|
2260
|
+
}
|
|
2261
|
+
const out = [];
|
|
2262
|
+
for (let i = 0; i < shortLen + 1; i++) {
|
|
2263
|
+
for (let b = 0; b < numBlocks; b++) {
|
|
2264
|
+
const v = blocks[b][i];
|
|
2265
|
+
if (v !== void 0) out.push(v);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
for (let i = 0; i < eccLen; i++) for (let b = 0; b < numBlocks; b++) out.push(eccs[b][i]);
|
|
2269
|
+
return out;
|
|
2270
|
+
}
|
|
2271
|
+
function alignmentPositions(ver) {
|
|
2272
|
+
if (ver === 1) return [];
|
|
2273
|
+
const num3 = Math.floor(ver / 7) + 2;
|
|
2274
|
+
const size = ver * 4 + 17;
|
|
2275
|
+
const step = Math.ceil((ver * 4 + 4) / (num3 * 2 - 2)) * 2;
|
|
2276
|
+
const res = [6];
|
|
2277
|
+
for (let pos = size - 7; res.length < num3; pos -= step) res.splice(1, 0, pos);
|
|
2278
|
+
return res;
|
|
2279
|
+
}
|
|
2280
|
+
function bchFormat(data) {
|
|
2281
|
+
let rem = data;
|
|
2282
|
+
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
2283
|
+
return (data << 10 | rem) ^ 21522;
|
|
2284
|
+
}
|
|
2285
|
+
function bchVersion(ver) {
|
|
2286
|
+
let rem = ver;
|
|
2287
|
+
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
2288
|
+
return ver << 12 | rem;
|
|
2289
|
+
}
|
|
2290
|
+
function penalty(m, size) {
|
|
2291
|
+
let score = 0;
|
|
2292
|
+
const run2 = (get) => {
|
|
2293
|
+
for (let i = 0; i < size; i++) {
|
|
2294
|
+
let last = get(i, 0), len = 1;
|
|
2295
|
+
for (let j = 1; j < size; j++) {
|
|
2296
|
+
const cur = get(i, j);
|
|
2297
|
+
if (cur === last) {
|
|
2298
|
+
len++;
|
|
2299
|
+
if (len === 5) score += 3;
|
|
2300
|
+
else if (len > 5) score++;
|
|
2301
|
+
} else {
|
|
2302
|
+
last = cur;
|
|
2303
|
+
len = 1;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
run2((i, j) => m[i][j]);
|
|
2309
|
+
run2((i, j) => m[j][i]);
|
|
2310
|
+
for (let y = 0; y < size - 1; y++)
|
|
2311
|
+
for (let x = 0; x < size - 1; x++) {
|
|
2312
|
+
const c = m[y][x];
|
|
2313
|
+
if (c === m[y][x + 1] && c === m[y + 1][x] && c === m[y + 1][x + 1]) score += 3;
|
|
2314
|
+
}
|
|
2315
|
+
let dark = 0;
|
|
2316
|
+
for (const row of m) for (const c of row) if (c) dark++;
|
|
2317
|
+
const total = size * size;
|
|
2318
|
+
score += Math.floor(Math.abs(dark * 20 - total * 10) / total) * 10;
|
|
2319
|
+
return score;
|
|
2320
|
+
}
|
|
2321
|
+
function encodeQr(text5) {
|
|
2322
|
+
const bytes2 = [...new TextEncoder().encode(text5)];
|
|
2323
|
+
const version2 = fitVersion(bytes2.length);
|
|
2324
|
+
if (!version2) {
|
|
2325
|
+
throw new RangeError(`QR payload too long: ${bytes2.length} bytes exceeds version ${QR_MAX_VERSION} at EC level L`);
|
|
2326
|
+
}
|
|
2327
|
+
const codewords = interleave(encodeData(bytes2, version2), version2);
|
|
2328
|
+
const size = version2 * 4 + 17;
|
|
2329
|
+
const modules = Array.from({ length: size }, () => new Array(size).fill(false));
|
|
2330
|
+
const reserved = Array.from({ length: size }, () => new Array(size).fill(false));
|
|
2331
|
+
const set = (x, y, dark) => {
|
|
2332
|
+
modules[y][x] = dark;
|
|
2333
|
+
reserved[y][x] = true;
|
|
2334
|
+
};
|
|
2335
|
+
const finder = (cx, cy) => {
|
|
2336
|
+
for (let dy = -4; dy <= 4; dy++)
|
|
2337
|
+
for (let dx = -4; dx <= 4; dx++) {
|
|
2338
|
+
const x = cx + dx, y = cy + dy;
|
|
2339
|
+
if (x < 0 || y < 0 || x >= size || y >= size) continue;
|
|
2340
|
+
const d = Math.max(Math.abs(dx), Math.abs(dy));
|
|
2341
|
+
set(x, y, d !== 2 && d !== 4);
|
|
2342
|
+
}
|
|
2343
|
+
};
|
|
2344
|
+
finder(3, 3);
|
|
2345
|
+
finder(size - 4, 3);
|
|
2346
|
+
finder(3, size - 4);
|
|
2347
|
+
for (let i = 8; i < size - 8; i++) {
|
|
2348
|
+
set(i, 6, i % 2 === 0);
|
|
2349
|
+
set(6, i, i % 2 === 0);
|
|
2350
|
+
}
|
|
2351
|
+
for (const ay of alignmentPositions(version2))
|
|
2352
|
+
for (const ax of alignmentPositions(version2)) {
|
|
2353
|
+
if (ax === 6 && ay === 6 || ax === 6 && ay === size - 7 || ax === size - 7 && ay === 6) continue;
|
|
2354
|
+
for (let dy = -2; dy <= 2; dy++)
|
|
2355
|
+
for (let dx = -2; dx <= 2; dx++) set(ax + dx, ay + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
|
|
2356
|
+
}
|
|
2357
|
+
for (let i = 0; i < 9; i++) {
|
|
2358
|
+
reserved[i][8] = true;
|
|
2359
|
+
reserved[8][i] = true;
|
|
2360
|
+
}
|
|
2361
|
+
for (let i = 0; i < 8; i++) {
|
|
2362
|
+
reserved[size - 1 - i][8] = true;
|
|
2363
|
+
reserved[8][size - 1 - i] = true;
|
|
2364
|
+
}
|
|
2365
|
+
set(8, size - 8, true);
|
|
2366
|
+
if (version2 >= 7)
|
|
2367
|
+
for (let i = 0; i < 18; i++) {
|
|
2368
|
+
const a = size - 11 + i % 3, b = Math.floor(i / 3);
|
|
2369
|
+
reserved[a][b] = true;
|
|
2370
|
+
reserved[b][a] = true;
|
|
2371
|
+
}
|
|
2372
|
+
let bit = 0;
|
|
2373
|
+
const totalBits = codewords.length * 8;
|
|
2374
|
+
for (let right = size - 1; right >= 1; right -= 2) {
|
|
2375
|
+
if (right === 6) right = 5;
|
|
2376
|
+
for (let vert = 0; vert < size; vert++) {
|
|
2377
|
+
for (let j = 0; j < 2; j++) {
|
|
2378
|
+
const x = right - j;
|
|
2379
|
+
const upward = (right + 1 & 2) === 0;
|
|
2380
|
+
const y = upward ? size - 1 - vert : vert;
|
|
2381
|
+
if (reserved[y][x]) continue;
|
|
2382
|
+
modules[y][x] = bit < totalBits ? (codewords[bit >>> 3] >>> 7 - (bit & 7) & 1) === 1 : false;
|
|
2383
|
+
bit++;
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
let best = null, bestMask = 0, bestScore = Infinity;
|
|
2388
|
+
for (let mask = 0; mask < 8; mask++) {
|
|
2389
|
+
const cand = modules.map((row) => [...row]);
|
|
2390
|
+
for (let y = 0; y < size; y++)
|
|
2391
|
+
for (let x = 0; x < size; x++) if (!reserved[y][x] && MASKS[mask](x, y)) cand[y][x] = !cand[y][x];
|
|
2392
|
+
applyFormat(cand, size, mask);
|
|
2393
|
+
if (version2 >= 7) applyVersion(cand, size, version2);
|
|
2394
|
+
const s = penalty(cand, size);
|
|
2395
|
+
if (s < bestScore) {
|
|
2396
|
+
bestScore = s;
|
|
2397
|
+
best = cand;
|
|
2398
|
+
bestMask = mask;
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
return { size, version: version2, mask: bestMask, modules: best };
|
|
2402
|
+
}
|
|
2403
|
+
function applyFormat(m, size, mask) {
|
|
2404
|
+
const bits = bchFormat(1 << 3 | mask);
|
|
2405
|
+
const on3 = (i) => (bits >>> i & 1) === 1;
|
|
2406
|
+
const put = (x, y, dark) => {
|
|
2407
|
+
m[y][x] = dark;
|
|
2408
|
+
};
|
|
2409
|
+
for (let i = 0; i <= 5; i++) put(8, i, on3(i));
|
|
2410
|
+
put(8, 7, on3(6));
|
|
2411
|
+
put(8, 8, on3(7));
|
|
2412
|
+
put(7, 8, on3(8));
|
|
2413
|
+
for (let i = 9; i < 15; i++) put(14 - i, 8, on3(i));
|
|
2414
|
+
for (let i = 0; i < 8; i++) put(size - 1 - i, 8, on3(i));
|
|
2415
|
+
for (let i = 8; i < 15; i++) put(8, size - 15 + i, on3(i));
|
|
2416
|
+
put(8, size - 8, true);
|
|
2417
|
+
}
|
|
2418
|
+
function applyVersion(m, size, version2) {
|
|
2419
|
+
const bits = bchVersion(version2);
|
|
2420
|
+
for (let i = 0; i < 18; i++) {
|
|
2421
|
+
const on3 = (bits >>> i & 1) === 1;
|
|
2422
|
+
const a = size - 11 + i % 3, b = Math.floor(i / 3);
|
|
2423
|
+
m[a][b] = on3;
|
|
2424
|
+
m[b][a] = on3;
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
var ECC_PER_BLOCK_L, NUM_BLOCKS_L, QR_MAX_VERSION, totalCodewords, dataCodewords, EXP, LOG, gfMul, MASKS;
|
|
2428
|
+
var init_qr = __esm({
|
|
2429
|
+
"../../core/admin-web/src/utils/qr.ts"() {
|
|
2430
|
+
ECC_PER_BLOCK_L = [0, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28];
|
|
2431
|
+
NUM_BLOCKS_L = [0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8];
|
|
2432
|
+
QR_MAX_VERSION = 20;
|
|
2433
|
+
totalCodewords = (ver) => Math.floor(rawDataModules(ver) / 8);
|
|
2434
|
+
dataCodewords = (ver) => totalCodewords(ver) - ECC_PER_BLOCK_L[ver] * NUM_BLOCKS_L[ver];
|
|
2435
|
+
EXP = new Uint8Array(512);
|
|
2436
|
+
LOG = new Uint8Array(256);
|
|
2437
|
+
(() => {
|
|
2438
|
+
let x = 1;
|
|
2439
|
+
for (let i = 0; i < 255; i++) {
|
|
2440
|
+
EXP[i] = x;
|
|
2441
|
+
LOG[x] = i;
|
|
2442
|
+
x <<= 1;
|
|
2443
|
+
if (x & 256) x ^= 285;
|
|
2444
|
+
}
|
|
2445
|
+
for (let i = 255; i < 512; i++) EXP[i] = EXP[i - 255];
|
|
2446
|
+
})();
|
|
2447
|
+
gfMul = (a, b) => a === 0 || b === 0 ? 0 : EXP[LOG[a] + LOG[b]];
|
|
2448
|
+
MASKS = [
|
|
2449
|
+
(x, y) => (x + y) % 2 === 0,
|
|
2450
|
+
(_x, y) => y % 2 === 0,
|
|
2451
|
+
(x) => x % 3 === 0,
|
|
2452
|
+
(x, y) => (x + y) % 3 === 0,
|
|
2453
|
+
(x, y) => (Math.floor(y / 2) + Math.floor(x / 3)) % 2 === 0,
|
|
2454
|
+
(x, y) => x * y % 2 + x * y % 3 === 0,
|
|
2455
|
+
(x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
|
|
2456
|
+
(x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
|
|
2457
|
+
];
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
|
|
2185
2461
|
// ../../core/dev-server/src/wix-placeholders.ts
|
|
2186
2462
|
var PLACEHOLDER_CLIENT_ID;
|
|
2187
2463
|
var init_wix_placeholders = __esm({
|
|
@@ -4274,8 +4550,9 @@ function confinedHost(ts2, contentDir2, options) {
|
|
|
4274
4550
|
host.writeFile = (fileName) => {
|
|
4275
4551
|
throw new Error(`Tier-5 typecheck attempted to write ${fileName} under noEmit \u2014 refusing`);
|
|
4276
4552
|
};
|
|
4277
|
-
|
|
4278
|
-
|
|
4553
|
+
const writable = host;
|
|
4554
|
+
if (writable.createDirectory) {
|
|
4555
|
+
writable.createDirectory = (dir) => {
|
|
4279
4556
|
throw new Error(`Tier-5 typecheck attempted to create ${dir} under noEmit \u2014 refusing`);
|
|
4280
4557
|
};
|
|
4281
4558
|
}
|
|
@@ -5603,6 +5880,7 @@ function walk(node, registry, path2, out) {
|
|
|
5603
5880
|
var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA;
|
|
5604
5881
|
var init_tokens = __esm({
|
|
5605
5882
|
"../../core/ts/src/tokens.ts"() {
|
|
5883
|
+
"use strict";
|
|
5606
5884
|
SYSTEM_FONT_FAMILY = "$system";
|
|
5607
5885
|
TONAL_ELEVATION_ALPHA = [0, 0.05, 0.08, 0.11, 0.12, 0.14];
|
|
5608
5886
|
}
|
|
@@ -5629,6 +5907,7 @@ function resolveTranslation(value, catalog, sourceCatalog) {
|
|
|
5629
5907
|
var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
|
|
5630
5908
|
var init_bindings = __esm({
|
|
5631
5909
|
"../../core/ts/src/bindings.ts"() {
|
|
5910
|
+
"use strict";
|
|
5632
5911
|
BINDING_SIGILS = ["service", "flag", "item", "t"];
|
|
5633
5912
|
BINDING_SIGIL_RE = new RegExp(
|
|
5634
5913
|
`^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
|
|
@@ -11360,6 +11639,7 @@ function resolveIdiom(tokens, ctx = {}) {
|
|
|
11360
11639
|
var IDIOM_CONTEXTS, UNSAFE_KEYS;
|
|
11361
11640
|
var init_idiom = __esm({
|
|
11362
11641
|
"../../core/ts/src/idiom.ts"() {
|
|
11642
|
+
"use strict";
|
|
11363
11643
|
IDIOM_CONTEXTS = {
|
|
11364
11644
|
ios: { native: ["ios"] },
|
|
11365
11645
|
android: { native: ["material"] },
|
|
@@ -13865,7 +14145,7 @@ function listReport(opts = {}) {
|
|
|
13865
14145
|
for (const [name, sys] of Object.entries(catalog.system)) {
|
|
13866
14146
|
families.push({ family: name, category: sys.category ?? "serif", variable: false, weights: "platform", kb: 0, license: "system" });
|
|
13867
14147
|
}
|
|
13868
|
-
return { ok: true, count: families.length, totalBytes, families };
|
|
14148
|
+
return { ok: true, count: families.length, totalBytes, problems: [], families };
|
|
13869
14149
|
}
|
|
13870
14150
|
async function fontFindings(appDir2, opts = {}) {
|
|
13871
14151
|
const tokensPath = join22(appDir2, configuredTokensPath(appDir2).path ?? "tokens.json");
|
|
@@ -16991,6 +17271,12 @@ var init_agent_context = __esm({
|
|
|
16991
17271
|
});
|
|
16992
17272
|
|
|
16993
17273
|
// ../../core/dev-server/src/app-module.ts
|
|
17274
|
+
function isFunctionsOnlyConfig(config) {
|
|
17275
|
+
return config.kind === "functions";
|
|
17276
|
+
}
|
|
17277
|
+
function uiConfig(config) {
|
|
17278
|
+
return config ?? {};
|
|
17279
|
+
}
|
|
16994
17280
|
function deriveAppMeta(name, m, platforms = {}) {
|
|
16995
17281
|
const config = m.config;
|
|
16996
17282
|
return {
|
|
@@ -17272,7 +17558,10 @@ async function loadContainedDevModule(name, entry, dir) {
|
|
|
17272
17558
|
"the contained dev-module realm is not installed, so the upload's dev/index.ts would have been imported into the host realm (which is not a security boundary)"
|
|
17273
17559
|
);
|
|
17274
17560
|
}
|
|
17275
|
-
const { buildContainedDevModule: buildContainedDevModule2, CONTAINED_DEV_MODULE_SERVICE: CONTAINED_DEV_MODULE_SERVICE2, CONTAINED_DEV_MODULE_ACTION: CONTAINED_DEV_MODULE_ACTION2 } =
|
|
17561
|
+
const { buildContainedDevModule: buildContainedDevModule2, CONTAINED_DEV_MODULE_SERVICE: CONTAINED_DEV_MODULE_SERVICE2, CONTAINED_DEV_MODULE_ACTION: CONTAINED_DEV_MODULE_ACTION2 } = (
|
|
17562
|
+
// @ts-expect-error — .mjs sibling without types; the cast below states what this uses.
|
|
17563
|
+
await Promise.resolve().then(() => (init_build_lib(), build_lib_exports))
|
|
17564
|
+
);
|
|
17276
17565
|
let js;
|
|
17277
17566
|
try {
|
|
17278
17567
|
js = await buildContainedDevModule2(entry, { absWorkingDir: dir, confineTo: dir });
|
|
@@ -18212,6 +18501,7 @@ __export(wix_member_login_exports, {
|
|
|
18212
18501
|
memberDirectLogin: () => memberDirectLogin,
|
|
18213
18502
|
memberDirectRegister: () => memberDirectRegister,
|
|
18214
18503
|
mintVisitor: () => mintVisitor,
|
|
18504
|
+
readMemberId: () => readMemberId,
|
|
18215
18505
|
webWixCall: () => webWixCall
|
|
18216
18506
|
});
|
|
18217
18507
|
import { createHash as createHash10, randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -18345,6 +18635,16 @@ async function webWixCall(method, path2, body, token, cookie, forwardedHeaders =
|
|
|
18345
18635
|
});
|
|
18346
18636
|
return { status: res.status, body: await res.text() };
|
|
18347
18637
|
}
|
|
18638
|
+
async function readMemberId(memberToken) {
|
|
18639
|
+
try {
|
|
18640
|
+
const identity = await webWixCall("GET", "/members/v1/members/my", void 0, memberToken);
|
|
18641
|
+
if (identity.status < 200 || identity.status >= 300) return null;
|
|
18642
|
+
const parsed = JSON.parse(identity.body);
|
|
18643
|
+
return parsed.member?.id ?? parsed.id ?? null;
|
|
18644
|
+
} catch {
|
|
18645
|
+
return null;
|
|
18646
|
+
}
|
|
18647
|
+
}
|
|
18348
18648
|
var API;
|
|
18349
18649
|
var init_wix_member_login = __esm({
|
|
18350
18650
|
"../../core/dev-server/src/wix-member-login.ts"() {
|
|
@@ -26874,7 +27174,8 @@ function renderNodeInner(node, ctx) {
|
|
|
26874
27174
|
extra.role = "button";
|
|
26875
27175
|
if (typeof el.type !== "string") extra[SYNTHETIC_TAP_ROLE] = true;
|
|
26876
27176
|
}
|
|
26877
|
-
|
|
27177
|
+
const defaultedTabIndex = extra.tabIndex == null || extra.tabIndex === -1 && extra[SYNTHETIC_TABINDEX] === true;
|
|
27178
|
+
if (defaultedTabIndex) {
|
|
26878
27179
|
extra.tabIndex = 0;
|
|
26879
27180
|
if (typeof el.type !== "string") extra[SYNTHETIC_TABINDEX] = true;
|
|
26880
27181
|
}
|
|
@@ -33950,7 +34251,7 @@ function makeEtag(body) {
|
|
|
33950
34251
|
return `"${createHash16("sha256").update(body).digest("hex").slice(0, 32)}"`;
|
|
33951
34252
|
}
|
|
33952
34253
|
function servedTokensPath(app) {
|
|
33953
|
-
return app.module.designTokensPath ?? resolve31(app.dir, app.module.config.designTokensPath ?? "tokens.json");
|
|
34254
|
+
return app.module.designTokensPath ?? resolve31(app.dir, uiConfig(app.module.config).designTokensPath ?? "tokens.json");
|
|
33954
34255
|
}
|
|
33955
34256
|
function readAppTokens(state) {
|
|
33956
34257
|
if (!state.app) return null;
|
|
@@ -34032,7 +34333,7 @@ function handleL10nRequest(req, res, state) {
|
|
|
34032
34333
|
res.end();
|
|
34033
34334
|
return;
|
|
34034
34335
|
}
|
|
34035
|
-
const sourceLocale = state.app.module.config.locale?.default ?? "en";
|
|
34336
|
+
const sourceLocale = uiConfig(state.app.module.config).locale?.default ?? "en";
|
|
34036
34337
|
let messages;
|
|
34037
34338
|
try {
|
|
34038
34339
|
messages = Object.fromEntries(
|
|
@@ -34070,9 +34371,9 @@ async function runScreenDiagnostics(state, screenId, descriptor) {
|
|
|
34070
34371
|
nativeActions,
|
|
34071
34372
|
appWorkerActions,
|
|
34072
34373
|
strict: false,
|
|
34073
|
-
workerSubtreeScreens: new Set(state.app?.module.config.workerSubtreeScreens ?? []),
|
|
34374
|
+
workerSubtreeScreens: new Set(uiConfig(state.app?.module.config).workerSubtreeScreens ?? []),
|
|
34074
34375
|
// Same a11y rung the build lint applies (RFC 0058 §5) — diagnostics must not disagree.
|
|
34075
|
-
a11y: state.app?.module.config.a11y
|
|
34376
|
+
a11y: uiConfig(state.app?.module.config).a11y
|
|
34076
34377
|
});
|
|
34077
34378
|
const telemetry = state.telemetryEvents.filter((e) => e.screenId === screenId && (/^worker_/.test(e.type) || e.type === "bundle_load_revoked")).slice(-20);
|
|
34078
34379
|
const lastError = [...telemetry].reverse().find((e) => /crash|revoked|error|fail/i.test(e.type)) ?? null;
|
|
@@ -34423,7 +34724,7 @@ async function buildDescriptorForScreenId(state, screenId, query = new URLSearch
|
|
|
34423
34724
|
}
|
|
34424
34725
|
return null;
|
|
34425
34726
|
})();
|
|
34426
|
-
return built ? ensureTransportCapability(applyTopBarDefault(attachAssignments(built, state, evalCtx, cfg?.overrides), state.app.module.config), state.tier5Dir ?? TIER5_ROOT2) : null;
|
|
34727
|
+
return built ? ensureTransportCapability(applyTopBarDefault(attachAssignments(built, state, evalCtx, cfg?.overrides), uiConfig(state.app.module.config)), state.tier5Dir ?? TIER5_ROOT2) : null;
|
|
34427
34728
|
}
|
|
34428
34729
|
return null;
|
|
34429
34730
|
}
|
|
@@ -35261,15 +35562,7 @@ async function handleWebWix(req, res, state) {
|
|
|
35261
35562
|
}
|
|
35262
35563
|
if (path2 === "/v1/__webwix/identity" && (req.method === "GET" || req.method === "POST")) {
|
|
35263
35564
|
if (!session.memberToken) return reply(200, { authenticated: false, userId: null, email: "" });
|
|
35264
|
-
|
|
35265
|
-
try {
|
|
35266
|
-
const identity = await webWixCall("GET", "/members/v1/members/my", session.memberToken);
|
|
35267
|
-
if (identity.status >= 200 && identity.status < 300) {
|
|
35268
|
-
const parsed = JSON.parse(identity.body);
|
|
35269
|
-
userId = parsed.member?.id ?? parsed.id ?? null;
|
|
35270
|
-
}
|
|
35271
|
-
} catch {
|
|
35272
|
-
}
|
|
35565
|
+
const userId = await readMemberId(session.memberToken);
|
|
35273
35566
|
const preferenceIdentity = session.email?.trim().toLowerCase() || userId;
|
|
35274
35567
|
return reply(200, {
|
|
35275
35568
|
authenticated: true,
|
|
@@ -35844,8 +36137,8 @@ async function handleAdminPlayground(req, res, state) {
|
|
|
35844
36137
|
nativeActions,
|
|
35845
36138
|
appWorkerActions,
|
|
35846
36139
|
strict,
|
|
35847
|
-
workerSubtreeScreens: new Set(state.app?.module.config.workerSubtreeScreens ?? []),
|
|
35848
|
-
a11y: state.app?.module.config.a11y
|
|
36140
|
+
workerSubtreeScreens: new Set(uiConfig(state.app?.module.config).workerSubtreeScreens ?? []),
|
|
36141
|
+
a11y: uiConfig(state.app?.module.config).a11y
|
|
35849
36142
|
});
|
|
35850
36143
|
return sendJson(res, report2.ok ? 200 : 422, report2);
|
|
35851
36144
|
}
|
|
@@ -40192,7 +40485,7 @@ async function buildReleaseFromContent(contentDir2, dest, opts = {}) {
|
|
|
40192
40485
|
}
|
|
40193
40486
|
function readTokensForLint(preloaded) {
|
|
40194
40487
|
try {
|
|
40195
|
-
const tokenPath = preloaded.module.designTokensPath ?? resolve32(preloaded.dir, preloaded.module.config.designTokensPath ?? "tokens.json");
|
|
40488
|
+
const tokenPath = preloaded.module.designTokensPath ?? resolve32(preloaded.dir, uiConfig(preloaded.module.config).designTokensPath ?? "tokens.json");
|
|
40196
40489
|
const parsed = JSON.parse(readFileSync42(tokenPath, "utf8"));
|
|
40197
40490
|
delete parsed._meta;
|
|
40198
40491
|
return parsed;
|
|
@@ -40204,7 +40497,8 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40204
40497
|
const app = preloaded.name;
|
|
40205
40498
|
const tier5Dir = opts.tier5Dir ?? TIER5_DIR;
|
|
40206
40499
|
const collect2 = opts.collect;
|
|
40207
|
-
|
|
40500
|
+
const config = preloaded.module.config;
|
|
40501
|
+
if (isFunctionsOnlyConfig(config)) {
|
|
40208
40502
|
return buildFunctionsOnlyRelease(preloaded, dest);
|
|
40209
40503
|
}
|
|
40210
40504
|
const store = typeof dest === "string" ? new FileReleaseStore(dest) : dest;
|
|
@@ -40230,14 +40524,14 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40230
40524
|
};
|
|
40231
40525
|
const LIVE_LOAD_BUDGET_MS = 3e4;
|
|
40232
40526
|
const appLocalDbSchema = (() => {
|
|
40233
|
-
const entities =
|
|
40527
|
+
const entities = config.dataSchema?.entities ?? [];
|
|
40234
40528
|
const names = entities.map((e) => e?.name).filter((n) => typeof n === "string" && n.length > 0);
|
|
40235
40529
|
return names.length ? names.map((name) => ({ name })) : null;
|
|
40236
40530
|
})();
|
|
40237
40531
|
let liveWixCall = null;
|
|
40238
40532
|
const ensureLiveWixCall = async () => {
|
|
40239
40533
|
if (liveWixCall) return liveWixCall;
|
|
40240
|
-
const auth =
|
|
40534
|
+
const auth = config.auth;
|
|
40241
40535
|
const clientId = auth?.config?.clientId;
|
|
40242
40536
|
if (auth?.providerId !== "wix-consumer" || typeof clientId !== "string" || !clientId) {
|
|
40243
40537
|
throw new Error(
|
|
@@ -40322,7 +40616,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40322
40616
|
};
|
|
40323
40617
|
let handlers;
|
|
40324
40618
|
let minBinaryVersion = null;
|
|
40325
|
-
const requiredCapabilities = new Set(
|
|
40619
|
+
const requiredCapabilities = new Set(config.capabilities ?? []);
|
|
40326
40620
|
const requiredNativeComponents = /* @__PURE__ */ new Set();
|
|
40327
40621
|
const tierScreens = [];
|
|
40328
40622
|
const tierBundles = /* @__PURE__ */ new Map();
|
|
@@ -40568,11 +40862,11 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40568
40862
|
nativeActions,
|
|
40569
40863
|
appWorkerActions,
|
|
40570
40864
|
strict: collect2.strict,
|
|
40571
|
-
workerSubtreeScreens: new Set(
|
|
40572
|
-
l10n: l10nLintOptions(
|
|
40865
|
+
workerSubtreeScreens: new Set(config.workerSubtreeScreens ?? []),
|
|
40866
|
+
l10n: l10nLintOptions(config.locale, preloaded.dir),
|
|
40573
40867
|
// RFC 0058 §5 — the app's own rung of the a11y ladder. Omitted ⇒ the validator's
|
|
40574
40868
|
// default, "error"; an in-repo app with ratcheted debt declares "warn".
|
|
40575
|
-
a11y:
|
|
40869
|
+
a11y: config.a11y
|
|
40576
40870
|
});
|
|
40577
40871
|
lint.push({ screenId, ok: report2.ok, issues: report2.issues });
|
|
40578
40872
|
}
|
|
@@ -40600,8 +40894,8 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40600
40894
|
nativeActions,
|
|
40601
40895
|
appWorkerActions,
|
|
40602
40896
|
strict: collect2.strict,
|
|
40603
|
-
workerSubtreeScreens: new Set(
|
|
40604
|
-
a11y:
|
|
40897
|
+
workerSubtreeScreens: new Set(config.workerSubtreeScreens ?? []),
|
|
40898
|
+
a11y: config.a11y
|
|
40605
40899
|
});
|
|
40606
40900
|
lint.push({ screenId: wantedRender, ok: report2.ok, issues: report2.issues });
|
|
40607
40901
|
}
|
|
@@ -40635,6 +40929,10 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40635
40929
|
store: preloaded.module.createStore(app),
|
|
40636
40930
|
toggles: {},
|
|
40637
40931
|
query: new URLSearchParams(),
|
|
40932
|
+
// A bake has no requesting member: the anonymous caller the dev-server also defaults to.
|
|
40933
|
+
// `ScreenBuildContext.caller` is documented never-absent, so a `seedIds` may read
|
|
40934
|
+
// `ctx.caller.entitled` unguarded, and would have thrown here without it.
|
|
40935
|
+
caller: { entitled: false },
|
|
40638
40936
|
serverBaseUrl: base,
|
|
40639
40937
|
bundleIntegrity: () => null,
|
|
40640
40938
|
// Resolve for real: a baked templated route whose descriptor references an asset must
|
|
@@ -40744,7 +41042,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40744
41042
|
}
|
|
40745
41043
|
Object.assign(catalogs, await bakeCatalogs(
|
|
40746
41044
|
app,
|
|
40747
|
-
|
|
41045
|
+
config.locale,
|
|
40748
41046
|
async (tag) => {
|
|
40749
41047
|
const res = await devFetch(
|
|
40750
41048
|
`${base}/v1/l10n?app=${encodeURIComponent(app)}&tag=${encodeURIComponent(tag)}`,
|
|
@@ -40759,7 +41057,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40759
41057
|
const served = await cfgRes.text();
|
|
40760
41058
|
const prodText = withProdServeAppConfig(
|
|
40761
41059
|
opts.keepDevOnlyAppConfig ? served : withoutDevOnlyAppConfig(served),
|
|
40762
|
-
|
|
41060
|
+
config.environments?.prod
|
|
40763
41061
|
);
|
|
40764
41062
|
const streamPolicyErrors = validateReleaseStreamPolicyConfig(prodText);
|
|
40765
41063
|
if (streamPolicyErrors.length) {
|
|
@@ -40831,7 +41129,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40831
41129
|
playerRequirements: {
|
|
40832
41130
|
capabilities: [...requiredCapabilities].sort(),
|
|
40833
41131
|
nativeComponents: [...requiredNativeComponents].sort(),
|
|
40834
|
-
authProviders: [
|
|
41132
|
+
authProviders: [config.auth.providerId].filter(Boolean).sort()
|
|
40835
41133
|
},
|
|
40836
41134
|
iconHash,
|
|
40837
41135
|
...brandFonts.length ? { brandFonts } : {},
|
|
@@ -40887,7 +41185,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40887
41185
|
// core identifies an oversized bundle by SRI, which is unactionable on its own, so the
|
|
40888
41186
|
// name is resolved back in here (most-specific match: `integrity` is a full SRI, but a
|
|
40889
41187
|
// descriptor carrying none would fall back to a bare name, and names nest).
|
|
40890
|
-
tierCapViolations: checkTierCaps(
|
|
41188
|
+
tierCapViolations: checkTierCaps(config, tierScreens, [...tierBundles.values()]).map((v) => {
|
|
40891
41189
|
const named = [...tierBundles.values()].filter((b) => v.message.includes(b.integrity)).sort((a, b) => b.integrity.length - a.integrity.length)[0];
|
|
40892
41190
|
return named ? { ...v, message: `${v.message} \u2014 bundle "${named.name}"` } : v;
|
|
40893
41191
|
}),
|
|
@@ -40900,7 +41198,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
|
|
|
40900
41198
|
...renderTokens !== void 0 ? { tokens: renderTokens } : {},
|
|
40901
41199
|
...preloaded.meta.surfaces ? { surfaceNav: preloaded.meta.surfaces } : {},
|
|
40902
41200
|
auth: (() => {
|
|
40903
|
-
const a =
|
|
41201
|
+
const a = config.auth;
|
|
40904
41202
|
const cid = a?.config?.clientId;
|
|
40905
41203
|
return { ...a?.providerId ? { providerId: a.providerId } : {}, ...typeof cid === "string" && cid ? { clientId: cid } : {} };
|
|
40906
41204
|
})()
|
|
@@ -40944,7 +41242,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
|
|
|
40944
41242
|
const sha = gitSha();
|
|
40945
41243
|
const manifest = { releaseId: contentReleaseId(content), gitSha: sha, ...content };
|
|
40946
41244
|
await store.putManifest(app, manifest);
|
|
40947
|
-
return { manifest, failedToBuild: [], missingBundles: [], auth: {} };
|
|
41245
|
+
return { manifest, failedToBuild: [], missingBundles: [], auth: {}, tierCapViolations: [] };
|
|
40948
41246
|
}
|
|
40949
41247
|
function listBuildableApps() {
|
|
40950
41248
|
const appsDir = join37(REPO_ROOT7, "apps");
|
|
@@ -40957,6 +41255,7 @@ var init_build3 = __esm({
|
|
|
40957
41255
|
init_contained_dev_module();
|
|
40958
41256
|
init_tier5_dir();
|
|
40959
41257
|
init_build_sha();
|
|
41258
|
+
init_app_module();
|
|
40960
41259
|
init_app_icon();
|
|
40961
41260
|
init_app_assets();
|
|
40962
41261
|
init_plan_fonts();
|
|
@@ -41155,6 +41454,11 @@ h2{font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;le
|
|
|
41155
41454
|
.phone img,.phone iframe{width:100%;height:100%;object-fit:cover;object-position:top;border:0;display:block;cursor:zoom-in}
|
|
41156
41455
|
.phone.vpf{position:relative}.phone iframe.vp{position:absolute;top:0;left:0;width:390px;height:844px;transform-origin:0 0;transform:scale(var(--k,.72));cursor:auto}
|
|
41157
41456
|
.cap{text-align:center;color:var(--muted);font-size:12px;margin-top:8px}
|
|
41457
|
+
.lan{text-align:center;margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:12px}
|
|
41458
|
+
.lan svg{display:block;margin:8px auto;border-radius:6px}
|
|
41459
|
+
.lant{font-weight:600}
|
|
41460
|
+
.lanu{font-size:12px;word-break:break-all}
|
|
41461
|
+
.lanh{color:var(--muted);font-size:12px;margin-top:4px}
|
|
41158
41462
|
.film{display:flex;gap:6px;overflow-x:auto;margin-top:12px;padding-bottom:4px}.film img{width:48px;aspect-ratio:390/844;object-fit:cover;object-position:top;border-radius:8px;border:1px solid var(--line);cursor:zoom-in}
|
|
41159
41463
|
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}.chip{font-size:12px;padding:5px 10px;border-radius:999px;background:var(--card);border:1px solid var(--line);color:var(--muted)}
|
|
41160
41464
|
.chip.ok{background:var(--okbg);color:var(--ok);border-color:transparent}.chip.warn{background:var(--warnbg);color:var(--warn);border-color:transparent}.chip.bad{background:var(--badbg);color:var(--bad);border-color:transparent}
|
|
@@ -41223,6 +41527,14 @@ h2{font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;le
|
|
|
41223
41527
|
var cur=null, lastSeen=Date.now();
|
|
41224
41528
|
function $(id){return document.getElementById(id)}
|
|
41225
41529
|
function el(tag,cls,txt){var e=document.createElement(tag);if(cls)e.className=cls;if(txt!=null)e.textContent=txt;return e}
|
|
41530
|
+
/* #3250 \u2014 a --lan run's way onto the owner's phone. The QR arrives as rows of 1/0 modules and is drawn
|
|
41531
|
+
as ONE path of unit squares: built with DOM calls, so nothing in the URL can become markup. */
|
|
41532
|
+
function lanCard(lan){var d=el("div","lan");d.appendChild(el("div","lant","Open on your phone"));
|
|
41533
|
+
if(lan.qr){var ns="http://www.w3.org/2000/svg",n=lan.qr.length,q=4,sz=n+2*q,svg=document.createElementNS(ns,"svg");svg.setAttribute("viewBox","0 0 "+sz+" "+sz);svg.setAttribute("width","148");svg.setAttribute("height","148");svg.setAttribute("role","img");svg.setAttribute("aria-label","QR code for "+lan.url);
|
|
41534
|
+
var bg=document.createElementNS(ns,"rect");bg.setAttribute("width",String(sz));bg.setAttribute("height",String(sz));bg.setAttribute("fill","#fff");svg.appendChild(bg);
|
|
41535
|
+
var p="";for(var y=0;y<n;y++)for(var x=0;x<n;x++)if(lan.qr[y].charAt(x)==="1")p+="M"+(x+q)+" "+(y+q)+"h1v1h-1z";
|
|
41536
|
+
var path=document.createElementNS(ns,"path");path.setAttribute("d",p);path.setAttribute("fill","#000");svg.appendChild(path);d.appendChild(svg)}
|
|
41537
|
+
d.appendChild(el("div","lanu",lan.url));d.appendChild(el("div","lanh","On the same Wi-Fi as this computer. It opens as the real app, full screen."));return d}
|
|
41226
41538
|
function clear(e){while(e.firstChild)e.removeChild(e.firstChild)}
|
|
41227
41539
|
function nowMs(){return asOf||Date.now()}
|
|
41228
41540
|
function ago(ts){var s=Math.max(0,Math.round((nowMs()-Date.parse(ts))/1000));if(s<60)return s+"s ago";var m=Math.round(s/60);if(m<60)return m+" min ago";return Math.round(m/60)+" h ago"}
|
|
@@ -41250,7 +41562,7 @@ function render(s){
|
|
|
41250
41562
|
if(pip){paintStrip(s)}else{
|
|
41251
41563
|
var kept=s.live?focus.querySelector("iframe"):null;if(kept&&(kept.getAttribute("src")!==s.live.url||kept.getAttribute("data-run")!==s.live.runId))kept=null;
|
|
41252
41564
|
if(kept){while(focus.lastChild&&focus.lastChild!==kept.parentNode)focus.removeChild(focus.lastChild)}else clear(focus);
|
|
41253
|
-
if(s.live){$("focuslbl").textContent="Live preview";if(!kept){var f=el("div","phone vpf");var fr=document.createElement("iframe");fr.className="vp";fr.setAttribute("width","390");fr.setAttribute("height","844");fr.setAttribute("data-run",s.live.runId);fr.src=s.live.url;fr.title="Live preview";f.appendChild(fr);focus.appendChild(f)}fit();if(s.live.buildError){var be=el("div","chip bad",null);be.style.display="block";be.style.marginTop="8px";be.textContent="Last edit did not build, still showing the last good version: "+s.live.buildError;focus.appendChild(be)}focus.appendChild(el("div","cap",(s.live.watching?"Repaints as the app is edited \xB7 ":"The build this run started with; himi run --watch repaints on every edit \xB7 ")+s.live.url))}
|
|
41565
|
+
if(s.live){$("focuslbl").textContent="Live preview";if(!kept){var f=el("div","phone vpf");var fr=document.createElement("iframe");fr.className="vp";fr.setAttribute("width","390");fr.setAttribute("height","844");fr.setAttribute("data-run",s.live.runId);fr.src=s.live.url;fr.title="Live preview";f.appendChild(fr);focus.appendChild(f)}fit();if(s.live.buildError){var be=el("div","chip bad",null);be.style.display="block";be.style.marginTop="8px";be.textContent="Last edit did not build, still showing the last good version: "+s.live.buildError;focus.appendChild(be)}focus.appendChild(el("div","cap",(s.live.watching?"Repaints as the app is edited \xB7 ":"The build this run started with; himi run --watch repaints on every edit \xB7 ")+s.live.url));if(s.live.lan)focus.appendChild(lanCard(s.live.lan))}
|
|
41254
41566
|
else if(s.focus&&s.focus.frames.length){var fl=s.focus.frames;$("focuslbl").textContent="Latest \xB7 "+s.focus.id;var p=el("div","phone");p.appendChild(img(fl[fl.length-1].img));focus.appendChild(p);focus.appendChild(el("div","cap",fl.length+(fl.length===1?" version":" versions")+" so far"))}
|
|
41255
41567
|
else{$("focuslbl").textContent="Latest";focus.appendChild(el("div","empty","The first render appears here."))}
|
|
41256
41568
|
if(s.focus&&s.focus.frames.length>1)s.focus.frames.forEach(function(fm){film.appendChild(img(fm.img))});}}
|
|
@@ -41761,12 +42073,30 @@ function liveRun(dir) {
|
|
|
41761
42073
|
screens: (Array.isArray(build2.screens) ? build2.screens : []).filter((x) => typeof x === "string").slice(0, 20),
|
|
41762
42074
|
tokens: build2.tokens === true,
|
|
41763
42075
|
config: build2.config === true
|
|
41764
|
-
} : null
|
|
42076
|
+
} : null,
|
|
42077
|
+
lan: lanOf(rec?.lanUrl)
|
|
41765
42078
|
};
|
|
41766
42079
|
} catch {
|
|
41767
42080
|
return null;
|
|
41768
42081
|
}
|
|
41769
42082
|
}
|
|
42083
|
+
function lanOf(value) {
|
|
42084
|
+
const raw = text(value);
|
|
42085
|
+
if (!raw) return null;
|
|
42086
|
+
let url;
|
|
42087
|
+
try {
|
|
42088
|
+
const u = new URL(raw);
|
|
42089
|
+
if (u.protocol !== "http:" && u.protocol !== "https:") return null;
|
|
42090
|
+
url = u.href;
|
|
42091
|
+
} catch {
|
|
42092
|
+
return null;
|
|
42093
|
+
}
|
|
42094
|
+
try {
|
|
42095
|
+
return { url, qr: encodeQr(url).modules.map((row) => row.map((m) => m ? "1" : "0").join("")) };
|
|
42096
|
+
} catch {
|
|
42097
|
+
return { url, qr: null };
|
|
42098
|
+
}
|
|
42099
|
+
}
|
|
41770
42100
|
function focusScreen(memory) {
|
|
41771
42101
|
const present = Object.entries(memory.shots).filter(([, s]) => s.present);
|
|
41772
42102
|
if (!present.length) return null;
|
|
@@ -41893,6 +42223,7 @@ var STUDIO_DIR, STUDIO_PAGE, STATE_FILE, MEMORY_FILE, VALIDATE_RECORD, PUSH_RECO
|
|
|
41893
42223
|
var init_studio = __esm({
|
|
41894
42224
|
"src/studio.ts"() {
|
|
41895
42225
|
init_studio_page();
|
|
42226
|
+
init_qr();
|
|
41896
42227
|
init_studio_timeline();
|
|
41897
42228
|
init_progress();
|
|
41898
42229
|
init_studio_page();
|
|
@@ -48346,6 +48677,14 @@ function memoryStore(manifest, built) {
|
|
|
48346
48677
|
},
|
|
48347
48678
|
async getAppConfig() {
|
|
48348
48679
|
return null;
|
|
48680
|
+
},
|
|
48681
|
+
// The two members the cast used to paper over. Serve-relative, as FileReleaseStore's is; and
|
|
48682
|
+
// nothing to prune, since this store only ever holds the one release it was built with.
|
|
48683
|
+
bundleUrl(_app, sha2565) {
|
|
48684
|
+
return `/v1/bundles/${sha2565}.bundle.js`;
|
|
48685
|
+
},
|
|
48686
|
+
async prune() {
|
|
48687
|
+
return 0;
|
|
48349
48688
|
}
|
|
48350
48689
|
};
|
|
48351
48690
|
}
|
|
@@ -51294,21 +51633,21 @@ var init_preview_assets_generated = __esm({
|
|
|
51294
51633
|
"../../packages/serve/src/preview-assets.generated.ts"() {
|
|
51295
51634
|
init_preview_assets_format();
|
|
51296
51635
|
PREVIEW_ASSET_MANIFEST = [
|
|
51297
|
-
{ key: "assets/index-
|
|
51298
|
-
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset:
|
|
51299
|
-
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset:
|
|
51300
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
51301
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
51302
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
51303
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
51304
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
51305
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
51306
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
51307
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
51308
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
51309
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
51310
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
51311
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
51636
|
+
{ key: "assets/index-D1gUsTY3.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1056804, sha256: "26589af001475b3ae732fdc5abd94d43c0b48f9d946b9fe6a2f27db0c7ba71a7" },
|
|
51637
|
+
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 1056812, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
|
|
51638
|
+
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 1061422, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
|
|
51639
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 1550006, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
51640
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1640930, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
51641
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1731914, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
51642
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1822894, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
51643
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1913766, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
51644
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 2004746, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
51645
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 2113382, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
51646
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 2222466, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
51647
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 2331514, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
51648
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 2439214, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
51649
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 2527322, length: 4947, sha256: "207153af042e0e1a166f74fcd50bd1052e9000b05e7bc7283c0514848af6bd31" },
|
|
51650
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 2532269, length: 17209, sha256: "dffc9718e2faa63ae2cc919e0a842f585ed565aaaa7c53778e90379442c731b6" }
|
|
51312
51651
|
];
|
|
51313
51652
|
}
|
|
51314
51653
|
});
|
|
@@ -51317,6 +51656,8 @@ var init_preview_assets_generated = __esm({
|
|
|
51317
51656
|
var run_exports = {};
|
|
51318
51657
|
__export(run_exports, {
|
|
51319
51658
|
NO_SPA_MESSAGE: () => NO_SPA_MESSAGE,
|
|
51659
|
+
lanAddress: () => lanAddress,
|
|
51660
|
+
lanFlagConflict: () => lanFlagConflict,
|
|
51320
51661
|
loadPreviewAssets: () => loadPreviewAssets,
|
|
51321
51662
|
makePackageRunHandler: () => makePackageRunHandler,
|
|
51322
51663
|
packageUrl: () => packageUrl,
|
|
@@ -51325,7 +51666,7 @@ __export(run_exports, {
|
|
|
51325
51666
|
withoutProdServe: () => withoutProdServe
|
|
51326
51667
|
});
|
|
51327
51668
|
import { cpSync as cpSync2, existsSync as existsSync55, mkdirSync as mkdirSync26, mkdtempSync as mkdtempSync3, readFileSync as readFileSync61, rmSync as rmSync12, statSync as statSync13 } from "node:fs";
|
|
51328
|
-
import { tmpdir as tmpdir4 } from "node:os";
|
|
51669
|
+
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir4 } from "node:os";
|
|
51329
51670
|
import { dirname as dirname29, join as join54 } from "node:path";
|
|
51330
51671
|
import { fileURLToPath as fileURLToPath22 } from "node:url";
|
|
51331
51672
|
function makePackageRunHandler(opts) {
|
|
@@ -51429,10 +51770,37 @@ function packageUrl(origin, app, opts = {}) {
|
|
|
51429
51770
|
const query = opts.surface ? `?surface=${encodeURIComponent(opts.surface)}` : "";
|
|
51430
51771
|
return `${origin.replace(/\/$/, "")}${path2}${query}`;
|
|
51431
51772
|
}
|
|
51773
|
+
function isPrivateLan(address) {
|
|
51774
|
+
const [a, b] = address.split(".").map(Number);
|
|
51775
|
+
return a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
51776
|
+
}
|
|
51777
|
+
function lanAddress(ifaces = osNetworkInterfaces()) {
|
|
51778
|
+
const found = [];
|
|
51779
|
+
for (const [name, list] of Object.entries(ifaces)) {
|
|
51780
|
+
if (UNREACHABLE_IFACE.test(name)) continue;
|
|
51781
|
+
for (const i of list ?? []) {
|
|
51782
|
+
const v4 = i.family === "IPv4" || i.family === 4;
|
|
51783
|
+
if (v4 && !i.internal && isPrivateLan(i.address)) found.push({ name, address: i.address });
|
|
51784
|
+
}
|
|
51785
|
+
}
|
|
51786
|
+
return (found.find((f) => LIKELY_LAN_IFACE.test(f.name)) ?? found[0])?.address ?? null;
|
|
51787
|
+
}
|
|
51788
|
+
function lanFlagConflict(f) {
|
|
51789
|
+
if (!f.lan) return null;
|
|
51790
|
+
if (f.browser) return { error: "--lan cannot be combined with --browser: that preview runs inside a desktop tab, with no server a phone could open. Drop --browser." };
|
|
51791
|
+
if (f.spa) return { error: "--lan cannot be combined with --spa: the hosted page would read the preview from loopback, which on a phone is the phone itself. Drop --spa." };
|
|
51792
|
+
return null;
|
|
51793
|
+
}
|
|
51432
51794
|
function openBrowser(url) {
|
|
51433
51795
|
openUrl(url);
|
|
51434
51796
|
}
|
|
51435
51797
|
async function runPackage(source, opts = {}) {
|
|
51798
|
+
const conflict = lanFlagConflict(opts);
|
|
51799
|
+
if (conflict) throw new Error(conflict.error);
|
|
51800
|
+
const lanHost = opts.lan ? lanAddress((opts.networkInterfaces ?? osNetworkInterfaces)()) : null;
|
|
51801
|
+
if (opts.lan && !lanHost) {
|
|
51802
|
+
throw new Error("himi run --lan found no LAN address to share: connect this machine to the same Wi-Fi as the phone (a VPN tunnel does not count), or drop --lan");
|
|
51803
|
+
}
|
|
51436
51804
|
const resolved2 = await resolvePackage(source, opts.workDir);
|
|
51437
51805
|
const assets = opts.assets ?? (opts.spa ? /* @__PURE__ */ new Map() : await loadPreviewAssets());
|
|
51438
51806
|
if (!opts.spa && assets.size === 0) {
|
|
@@ -51450,16 +51818,38 @@ async function runPackage(source, opts = {}) {
|
|
|
51450
51818
|
});
|
|
51451
51819
|
const extra = opts.extraRoutes;
|
|
51452
51820
|
const handler = extra ? (request) => extra(request) ?? plane(request) : plane;
|
|
51453
|
-
const
|
|
51454
|
-
|
|
51455
|
-
|
|
51456
|
-
|
|
51457
|
-
|
|
51458
|
-
const addr = server.address();
|
|
51459
|
-
resolvePort(typeof addr === "object" && addr ? addr.port : opts.port ?? 0);
|
|
51821
|
+
const listen = (srv, port2, host2) => new Promise((resolveListen, reject) => {
|
|
51822
|
+
srv.once("error", reject);
|
|
51823
|
+
srv.listen(port2, host2, () => {
|
|
51824
|
+
const addr = srv.address();
|
|
51825
|
+
resolveListen(typeof addr === "object" && addr ? { port: addr.port, address: addr.address } : { port: port2, address: host2 });
|
|
51460
51826
|
});
|
|
51461
51827
|
});
|
|
51828
|
+
const closeServer = (srv) => new Promise((done) => {
|
|
51829
|
+
srv.closeAllConnections?.();
|
|
51830
|
+
srv.close(() => done());
|
|
51831
|
+
});
|
|
51832
|
+
const host = opts.host ?? "127.0.0.1";
|
|
51833
|
+
const server = nodeAdapter(handler);
|
|
51834
|
+
const first = await listen(server, opts.port ?? 0, host);
|
|
51835
|
+
const port = first.port;
|
|
51836
|
+
const bound = [first.address];
|
|
51837
|
+
const servers = [server];
|
|
51838
|
+
if (lanHost) {
|
|
51839
|
+
const lanServer = nodeAdapter(handler);
|
|
51840
|
+
let lanBound;
|
|
51841
|
+
try {
|
|
51842
|
+
lanBound = (await listen(lanServer, port, lanHost)).address;
|
|
51843
|
+
} catch (e) {
|
|
51844
|
+
await closeServer(server);
|
|
51845
|
+
if (resolved2.temp) rmSync12(resolved2.temp, { recursive: true, force: true });
|
|
51846
|
+
throw new Error(`himi run --lan could not listen on ${lanHost}:${port} (${e.message}); drop --lan, or pass --port for a free one`);
|
|
51847
|
+
}
|
|
51848
|
+
bound.push(lanBound);
|
|
51849
|
+
servers.push(lanServer);
|
|
51850
|
+
}
|
|
51462
51851
|
const origin = `http://${host}:${port}`;
|
|
51852
|
+
const lanUrl = lanHost ? packageUrl(`http://${lanHost}:${port}`, resolved2.app, opts) : void 0;
|
|
51463
51853
|
const url = opts.spa ? `${packageUrl(opts.spa, resolved2.app, opts)}${opts.surface ? "&" : "?"}api=${encodeURIComponent(origin)}` : packageUrl(origin, resolved2.app, opts);
|
|
51464
51854
|
if (opts.open) openBrowser(url);
|
|
51465
51855
|
return {
|
|
@@ -51469,17 +51859,16 @@ async function runPackage(source, opts = {}) {
|
|
|
51469
51859
|
url,
|
|
51470
51860
|
releaseRoot: resolved2.releaseRoot,
|
|
51471
51861
|
origin,
|
|
51862
|
+
bound,
|
|
51863
|
+
...lanUrl ? { lanUrl } : {},
|
|
51472
51864
|
warnings: resolved2.warnings,
|
|
51473
|
-
close:
|
|
51474
|
-
|
|
51475
|
-
|
|
51476
|
-
|
|
51477
|
-
done();
|
|
51478
|
-
});
|
|
51479
|
-
})
|
|
51865
|
+
close: async () => {
|
|
51866
|
+
await Promise.all(servers.map(closeServer));
|
|
51867
|
+
if (resolved2.temp) rmSync12(resolved2.temp, { recursive: true, force: true });
|
|
51868
|
+
}
|
|
51480
51869
|
};
|
|
51481
51870
|
}
|
|
51482
|
-
var NO_SPA_MESSAGE;
|
|
51871
|
+
var NO_SPA_MESSAGE, UNREACHABLE_IFACE, LIKELY_LAN_IFACE;
|
|
51483
51872
|
var init_run = __esm({
|
|
51484
51873
|
"src/run.ts"() {
|
|
51485
51874
|
init_open_url();
|
|
@@ -51491,6 +51880,8 @@ var init_run = __esm({
|
|
|
51491
51880
|
init_himi_package();
|
|
51492
51881
|
init_himi_package();
|
|
51493
51882
|
NO_SPA_MESSAGE = "the web-host SPA is not embedded in this build \u2014 run `node packages/serve/scripts/embed-preview-assets.mjs` (in a monorepo checkout), or pass --spa <url> to use a hosted preview host instead";
|
|
51883
|
+
UNREACHABLE_IFACE = /^(utun|tun|tap|ppp|ipsec|wg|gif|stf|bridge|vmnet|vboxnet|virbr|docker|br-|veth|awdl|llw|anpi|tailscale|zt|zerotier|nordlynx)|vpn/i;
|
|
51884
|
+
LIKELY_LAN_IFACE = /^(en|eth|wlan|wl|wifi)/i;
|
|
51494
51885
|
}
|
|
51495
51886
|
});
|
|
51496
51887
|
|
|
@@ -64396,278 +64787,8 @@ function verifyAttestation(attestation, contentDir2, descriptors, expectedApp, r
|
|
|
64396
64787
|
return { ok: errors.length === 0, errors };
|
|
64397
64788
|
}
|
|
64398
64789
|
|
|
64399
|
-
// ../../core/admin-web/src/utils/qr.ts
|
|
64400
|
-
var ECC_PER_BLOCK_L = [0, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28];
|
|
64401
|
-
var NUM_BLOCKS_L = [0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8];
|
|
64402
|
-
var QR_MAX_VERSION = 20;
|
|
64403
|
-
function rawDataModules(ver) {
|
|
64404
|
-
let result = (16 * ver + 128) * ver + 64;
|
|
64405
|
-
if (ver >= 2) {
|
|
64406
|
-
const numAlign = Math.floor(ver / 7) + 2;
|
|
64407
|
-
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
64408
|
-
if (ver >= 7) result -= 36;
|
|
64409
|
-
}
|
|
64410
|
-
return result;
|
|
64411
|
-
}
|
|
64412
|
-
var totalCodewords = (ver) => Math.floor(rawDataModules(ver) / 8);
|
|
64413
|
-
var dataCodewords = (ver) => totalCodewords(ver) - ECC_PER_BLOCK_L[ver] * NUM_BLOCKS_L[ver];
|
|
64414
|
-
function byteCapacity(ver) {
|
|
64415
|
-
const lenBits = ver < 10 ? 8 : 16;
|
|
64416
|
-
return dataCodewords(ver) - Math.ceil((4 + lenBits) / 8);
|
|
64417
|
-
}
|
|
64418
|
-
function fitVersion(len) {
|
|
64419
|
-
for (let v = 1; v <= QR_MAX_VERSION; v++) if (byteCapacity(v) >= len) return v;
|
|
64420
|
-
return void 0;
|
|
64421
|
-
}
|
|
64422
|
-
var EXP = new Uint8Array(512);
|
|
64423
|
-
var LOG = new Uint8Array(256);
|
|
64424
|
-
(() => {
|
|
64425
|
-
let x = 1;
|
|
64426
|
-
for (let i = 0; i < 255; i++) {
|
|
64427
|
-
EXP[i] = x;
|
|
64428
|
-
LOG[x] = i;
|
|
64429
|
-
x <<= 1;
|
|
64430
|
-
if (x & 256) x ^= 285;
|
|
64431
|
-
}
|
|
64432
|
-
for (let i = 255; i < 512; i++) EXP[i] = EXP[i - 255];
|
|
64433
|
-
})();
|
|
64434
|
-
var gfMul = (a, b) => a === 0 || b === 0 ? 0 : EXP[LOG[a] + LOG[b]];
|
|
64435
|
-
function rsDivisor(degree) {
|
|
64436
|
-
const result = new Array(degree).fill(0);
|
|
64437
|
-
result[degree - 1] = 1;
|
|
64438
|
-
let root = 1;
|
|
64439
|
-
for (let i = 0; i < degree; i++) {
|
|
64440
|
-
for (let j = 0; j < degree; j++) {
|
|
64441
|
-
result[j] = gfMul(result[j], root);
|
|
64442
|
-
if (j + 1 < degree) result[j] ^= result[j + 1];
|
|
64443
|
-
}
|
|
64444
|
-
root = gfMul(root, 2);
|
|
64445
|
-
}
|
|
64446
|
-
return result;
|
|
64447
|
-
}
|
|
64448
|
-
function rsRemainder(data, degree) {
|
|
64449
|
-
const divisor = rsDivisor(degree);
|
|
64450
|
-
const res = new Array(degree).fill(0);
|
|
64451
|
-
for (const b of data) {
|
|
64452
|
-
const factor = b ^ res.shift();
|
|
64453
|
-
res.push(0);
|
|
64454
|
-
for (let i = 0; i < degree; i++) res[i] ^= gfMul(divisor[i], factor);
|
|
64455
|
-
}
|
|
64456
|
-
return res;
|
|
64457
|
-
}
|
|
64458
|
-
function encodeData(bytes2, ver) {
|
|
64459
|
-
const bits = [];
|
|
64460
|
-
const push = (val, len) => {
|
|
64461
|
-
for (let i = len - 1; i >= 0; i--) bits.push(val >>> i & 1);
|
|
64462
|
-
};
|
|
64463
|
-
push(4, 4);
|
|
64464
|
-
push(bytes2.length, ver < 10 ? 8 : 16);
|
|
64465
|
-
for (const b of bytes2) push(b, 8);
|
|
64466
|
-
const capacityBits = dataCodewords(ver) * 8;
|
|
64467
|
-
push(0, Math.min(4, capacityBits - bits.length));
|
|
64468
|
-
while (bits.length % 8 !== 0) bits.push(0);
|
|
64469
|
-
const out = [];
|
|
64470
|
-
for (let i = 0; i < bits.length; i += 8) {
|
|
64471
|
-
let byte2 = 0;
|
|
64472
|
-
for (let j = 0; j < 8; j++) byte2 = byte2 << 1 | bits[i + j];
|
|
64473
|
-
out.push(byte2);
|
|
64474
|
-
}
|
|
64475
|
-
for (let pad2 = 236; out.length < dataCodewords(ver); pad2 ^= 236 ^ 17) out.push(pad2);
|
|
64476
|
-
return out;
|
|
64477
|
-
}
|
|
64478
|
-
function interleave(data, ver) {
|
|
64479
|
-
const numBlocks = NUM_BLOCKS_L[ver];
|
|
64480
|
-
const eccLen = ECC_PER_BLOCK_L[ver];
|
|
64481
|
-
const shortLen = Math.floor(totalCodewords(ver) / numBlocks) - eccLen;
|
|
64482
|
-
const numShort = numBlocks - totalCodewords(ver) % numBlocks;
|
|
64483
|
-
const blocks = [];
|
|
64484
|
-
const eccs = [];
|
|
64485
|
-
let off = 0;
|
|
64486
|
-
for (let i = 0; i < numBlocks; i++) {
|
|
64487
|
-
const len = shortLen + (i < numShort ? 0 : 1);
|
|
64488
|
-
const blk = data.slice(off, off + len);
|
|
64489
|
-
off += len;
|
|
64490
|
-
blocks.push(blk);
|
|
64491
|
-
eccs.push(rsRemainder(blk, eccLen));
|
|
64492
|
-
}
|
|
64493
|
-
const out = [];
|
|
64494
|
-
for (let i = 0; i < shortLen + 1; i++) {
|
|
64495
|
-
for (let b = 0; b < numBlocks; b++) {
|
|
64496
|
-
const v = blocks[b][i];
|
|
64497
|
-
if (v !== void 0) out.push(v);
|
|
64498
|
-
}
|
|
64499
|
-
}
|
|
64500
|
-
for (let i = 0; i < eccLen; i++) for (let b = 0; b < numBlocks; b++) out.push(eccs[b][i]);
|
|
64501
|
-
return out;
|
|
64502
|
-
}
|
|
64503
|
-
function alignmentPositions(ver) {
|
|
64504
|
-
if (ver === 1) return [];
|
|
64505
|
-
const num3 = Math.floor(ver / 7) + 2;
|
|
64506
|
-
const size = ver * 4 + 17;
|
|
64507
|
-
const step = Math.ceil((ver * 4 + 4) / (num3 * 2 - 2)) * 2;
|
|
64508
|
-
const res = [6];
|
|
64509
|
-
for (let pos = size - 7; res.length < num3; pos -= step) res.splice(1, 0, pos);
|
|
64510
|
-
return res;
|
|
64511
|
-
}
|
|
64512
|
-
var MASKS = [
|
|
64513
|
-
(x, y) => (x + y) % 2 === 0,
|
|
64514
|
-
(_x, y) => y % 2 === 0,
|
|
64515
|
-
(x) => x % 3 === 0,
|
|
64516
|
-
(x, y) => (x + y) % 3 === 0,
|
|
64517
|
-
(x, y) => (Math.floor(y / 2) + Math.floor(x / 3)) % 2 === 0,
|
|
64518
|
-
(x, y) => x * y % 2 + x * y % 3 === 0,
|
|
64519
|
-
(x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
|
|
64520
|
-
(x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
|
|
64521
|
-
];
|
|
64522
|
-
function bchFormat(data) {
|
|
64523
|
-
let rem = data;
|
|
64524
|
-
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
64525
|
-
return (data << 10 | rem) ^ 21522;
|
|
64526
|
-
}
|
|
64527
|
-
function bchVersion(ver) {
|
|
64528
|
-
let rem = ver;
|
|
64529
|
-
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
64530
|
-
return ver << 12 | rem;
|
|
64531
|
-
}
|
|
64532
|
-
function penalty(m, size) {
|
|
64533
|
-
let score = 0;
|
|
64534
|
-
const run2 = (get) => {
|
|
64535
|
-
for (let i = 0; i < size; i++) {
|
|
64536
|
-
let last = get(i, 0), len = 1;
|
|
64537
|
-
for (let j = 1; j < size; j++) {
|
|
64538
|
-
const cur = get(i, j);
|
|
64539
|
-
if (cur === last) {
|
|
64540
|
-
len++;
|
|
64541
|
-
if (len === 5) score += 3;
|
|
64542
|
-
else if (len > 5) score++;
|
|
64543
|
-
} else {
|
|
64544
|
-
last = cur;
|
|
64545
|
-
len = 1;
|
|
64546
|
-
}
|
|
64547
|
-
}
|
|
64548
|
-
}
|
|
64549
|
-
};
|
|
64550
|
-
run2((i, j) => m[i][j]);
|
|
64551
|
-
run2((i, j) => m[j][i]);
|
|
64552
|
-
for (let y = 0; y < size - 1; y++)
|
|
64553
|
-
for (let x = 0; x < size - 1; x++) {
|
|
64554
|
-
const c = m[y][x];
|
|
64555
|
-
if (c === m[y][x + 1] && c === m[y + 1][x] && c === m[y + 1][x + 1]) score += 3;
|
|
64556
|
-
}
|
|
64557
|
-
let dark = 0;
|
|
64558
|
-
for (const row of m) for (const c of row) if (c) dark++;
|
|
64559
|
-
const total = size * size;
|
|
64560
|
-
score += Math.floor(Math.abs(dark * 20 - total * 10) / total) * 10;
|
|
64561
|
-
return score;
|
|
64562
|
-
}
|
|
64563
|
-
function encodeQr(text5) {
|
|
64564
|
-
const bytes2 = [...new TextEncoder().encode(text5)];
|
|
64565
|
-
const version2 = fitVersion(bytes2.length);
|
|
64566
|
-
if (!version2) {
|
|
64567
|
-
throw new RangeError(`QR payload too long: ${bytes2.length} bytes exceeds version ${QR_MAX_VERSION} at EC level L`);
|
|
64568
|
-
}
|
|
64569
|
-
const codewords = interleave(encodeData(bytes2, version2), version2);
|
|
64570
|
-
const size = version2 * 4 + 17;
|
|
64571
|
-
const modules = Array.from({ length: size }, () => new Array(size).fill(false));
|
|
64572
|
-
const reserved = Array.from({ length: size }, () => new Array(size).fill(false));
|
|
64573
|
-
const set = (x, y, dark) => {
|
|
64574
|
-
modules[y][x] = dark;
|
|
64575
|
-
reserved[y][x] = true;
|
|
64576
|
-
};
|
|
64577
|
-
const finder = (cx, cy) => {
|
|
64578
|
-
for (let dy = -4; dy <= 4; dy++)
|
|
64579
|
-
for (let dx = -4; dx <= 4; dx++) {
|
|
64580
|
-
const x = cx + dx, y = cy + dy;
|
|
64581
|
-
if (x < 0 || y < 0 || x >= size || y >= size) continue;
|
|
64582
|
-
const d = Math.max(Math.abs(dx), Math.abs(dy));
|
|
64583
|
-
set(x, y, d !== 2 && d !== 4);
|
|
64584
|
-
}
|
|
64585
|
-
};
|
|
64586
|
-
finder(3, 3);
|
|
64587
|
-
finder(size - 4, 3);
|
|
64588
|
-
finder(3, size - 4);
|
|
64589
|
-
for (let i = 8; i < size - 8; i++) {
|
|
64590
|
-
set(i, 6, i % 2 === 0);
|
|
64591
|
-
set(6, i, i % 2 === 0);
|
|
64592
|
-
}
|
|
64593
|
-
for (const ay of alignmentPositions(version2))
|
|
64594
|
-
for (const ax of alignmentPositions(version2)) {
|
|
64595
|
-
if (ax === 6 && ay === 6 || ax === 6 && ay === size - 7 || ax === size - 7 && ay === 6) continue;
|
|
64596
|
-
for (let dy = -2; dy <= 2; dy++)
|
|
64597
|
-
for (let dx = -2; dx <= 2; dx++) set(ax + dx, ay + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
|
|
64598
|
-
}
|
|
64599
|
-
for (let i = 0; i < 9; i++) {
|
|
64600
|
-
reserved[i][8] = true;
|
|
64601
|
-
reserved[8][i] = true;
|
|
64602
|
-
}
|
|
64603
|
-
for (let i = 0; i < 8; i++) {
|
|
64604
|
-
reserved[size - 1 - i][8] = true;
|
|
64605
|
-
reserved[8][size - 1 - i] = true;
|
|
64606
|
-
}
|
|
64607
|
-
set(8, size - 8, true);
|
|
64608
|
-
if (version2 >= 7)
|
|
64609
|
-
for (let i = 0; i < 18; i++) {
|
|
64610
|
-
const a = size - 11 + i % 3, b = Math.floor(i / 3);
|
|
64611
|
-
reserved[a][b] = true;
|
|
64612
|
-
reserved[b][a] = true;
|
|
64613
|
-
}
|
|
64614
|
-
let bit = 0;
|
|
64615
|
-
const totalBits = codewords.length * 8;
|
|
64616
|
-
for (let right = size - 1; right >= 1; right -= 2) {
|
|
64617
|
-
if (right === 6) right = 5;
|
|
64618
|
-
for (let vert = 0; vert < size; vert++) {
|
|
64619
|
-
for (let j = 0; j < 2; j++) {
|
|
64620
|
-
const x = right - j;
|
|
64621
|
-
const upward = (right + 1 & 2) === 0;
|
|
64622
|
-
const y = upward ? size - 1 - vert : vert;
|
|
64623
|
-
if (reserved[y][x]) continue;
|
|
64624
|
-
modules[y][x] = bit < totalBits ? (codewords[bit >>> 3] >>> 7 - (bit & 7) & 1) === 1 : false;
|
|
64625
|
-
bit++;
|
|
64626
|
-
}
|
|
64627
|
-
}
|
|
64628
|
-
}
|
|
64629
|
-
let best = null, bestMask = 0, bestScore = Infinity;
|
|
64630
|
-
for (let mask = 0; mask < 8; mask++) {
|
|
64631
|
-
const cand = modules.map((row) => [...row]);
|
|
64632
|
-
for (let y = 0; y < size; y++)
|
|
64633
|
-
for (let x = 0; x < size; x++) if (!reserved[y][x] && MASKS[mask](x, y)) cand[y][x] = !cand[y][x];
|
|
64634
|
-
applyFormat(cand, size, mask);
|
|
64635
|
-
if (version2 >= 7) applyVersion(cand, size, version2);
|
|
64636
|
-
const s = penalty(cand, size);
|
|
64637
|
-
if (s < bestScore) {
|
|
64638
|
-
bestScore = s;
|
|
64639
|
-
best = cand;
|
|
64640
|
-
bestMask = mask;
|
|
64641
|
-
}
|
|
64642
|
-
}
|
|
64643
|
-
return { size, version: version2, mask: bestMask, modules: best };
|
|
64644
|
-
}
|
|
64645
|
-
function applyFormat(m, size, mask) {
|
|
64646
|
-
const bits = bchFormat(1 << 3 | mask);
|
|
64647
|
-
const on3 = (i) => (bits >>> i & 1) === 1;
|
|
64648
|
-
const put = (x, y, dark) => {
|
|
64649
|
-
m[y][x] = dark;
|
|
64650
|
-
};
|
|
64651
|
-
for (let i = 0; i <= 5; i++) put(8, i, on3(i));
|
|
64652
|
-
put(8, 7, on3(6));
|
|
64653
|
-
put(8, 8, on3(7));
|
|
64654
|
-
put(7, 8, on3(8));
|
|
64655
|
-
for (let i = 9; i < 15; i++) put(14 - i, 8, on3(i));
|
|
64656
|
-
for (let i = 0; i < 8; i++) put(size - 1 - i, 8, on3(i));
|
|
64657
|
-
for (let i = 8; i < 15; i++) put(8, size - 15 + i, on3(i));
|
|
64658
|
-
put(8, size - 8, true);
|
|
64659
|
-
}
|
|
64660
|
-
function applyVersion(m, size, version2) {
|
|
64661
|
-
const bits = bchVersion(version2);
|
|
64662
|
-
for (let i = 0; i < 18; i++) {
|
|
64663
|
-
const on3 = (bits >>> i & 1) === 1;
|
|
64664
|
-
const a = size - 11 + i % 3, b = Math.floor(i / 3);
|
|
64665
|
-
m[a][b] = on3;
|
|
64666
|
-
m[b][a] = on3;
|
|
64667
|
-
}
|
|
64668
|
-
}
|
|
64669
|
-
|
|
64670
64790
|
// ../../core/admin-web/src/utils/qr-terminal.ts
|
|
64791
|
+
init_qr();
|
|
64671
64792
|
function qrTerminal(text5, opts = {}) {
|
|
64672
64793
|
const { modules, size } = encodeQr(text5);
|
|
64673
64794
|
const quietZone = opts.quietZone ?? 4;
|
|
@@ -66054,6 +66175,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
66054
66175
|
"force",
|
|
66055
66176
|
"replace",
|
|
66056
66177
|
"watch",
|
|
66178
|
+
"lan",
|
|
66057
66179
|
"no-claim",
|
|
66058
66180
|
"new",
|
|
66059
66181
|
"dev",
|
|
@@ -66472,7 +66594,7 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
66472
66594
|
file is not the plane's per-release archive.
|
|
66473
66595
|
himi share --file <package.himi> [--expires-at <ISO>] | revoke --app <app> <shareId>
|
|
66474
66596
|
publish a content-addressed package link for a released app
|
|
66475
|
-
himi run [<package.himi|dir|url>] [--browser] [--watch] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open]
|
|
66597
|
+
himi run [<package.himi|dir|url>] [--browser] [--watch] [--lan] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open]
|
|
66476
66598
|
serve a package on localhost + open it in a browser. No serve
|
|
66477
66599
|
plane, no dev-server. With no argument it packs the current
|
|
66478
66600
|
content package first \u2014 edit, run, look at it.
|
|
@@ -66480,6 +66602,9 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
66480
66602
|
(a failed build keeps the last good preview). The build board
|
|
66481
66603
|
is served beside it at /__himi/studio/ with the preview framed
|
|
66482
66604
|
in it. Blocks until Ctrl-C.
|
|
66605
|
+
--lan also serves it to the local network and prints a QR:
|
|
66606
|
+
a phone on the same Wi-Fi opens it as the real app, full
|
|
66607
|
+
screen. Read-only, but anyone on that network can open it.
|
|
66483
66608
|
himi flags list|set|ramp|rm [<key>] [--app <a>]
|
|
66484
66609
|
read/change operational flags (RFC 0013); writes report
|
|
66485
66610
|
servedNow from the device door, never just ok
|
|
@@ -66826,7 +66951,7 @@ var COMMANDS = [
|
|
|
66826
66951
|
{ name: "import", summary: "turn a `himi pack --dev` package back into an EDITABLE content package \u2014 the file counterpart of `himi pull`, needing no serve plane, no account and no network. Refuses an invalid package before trusting its source (the content hash is recomputed over every entry on open, so the archive is provably the one that was packed), and refuses a RELEASE package by naming the absence \u2014 it carries built output and no source \u2014 rather than reporting a missing file. `--name` re-substitutes the app identity through the same machinery `himi init --template` and `himi pull --name` use, so the restored tree is a NEW app rather than a second copy of the same one, and a name that also appears inside a screen id (`feed` in `feed_home`) is left alone. A non-empty destination needs `--force` and a merge NAMES what it kept (`left: [...]`), the same contract `himi pull --force` has; a shape clash is refused whole before anything is written. There is no `--replace`: a file you were handed is not the plane's per-release archive.", required: "<package.himi> [--out <dir>] [--name <new>] [--force]" },
|
|
66827
66952
|
{ name: "pull", summary: "restore an app's SOURCE from the serve plane into an editable content package \u2014 the other half of `himi push`, which archives the content package on every publish. Owner or editor only: a viewer may download the RUNNING app (`/v1/owner/package`), not the codebase it was built from. A PAST release is restorable, not only the live one \u2014 the archive is content-addressed per release, so it has none of the live-single-slot problem that makes `himi pack` current-release-only. Two limits: pruning keeps the current release plus the newest ~20 ledger entries, and a release id identifies OTA content rather than source, so a source-only change republishes under the same id and replaces that id's archive. A release published before source archiving shipped, or pushed with `--no-source`, answers `app_source_not_found` and says to push again. `--name` re-substitutes the app identity through the same machinery `himi init --template` uses, so the restored tree is a NEW app rather than a second copy of the same one, and a name that also appears inside a screen id (`feed` in `feed_home`) is left alone. A NON-EMPTY destination is refused unless you say which you mean: `--force` merges and reports \u2014 it writes the archive over what is there, keeps files the release does not carry, and NAMES every one of them as `left: [...]` so a tree that matches no release is never silent (#2437); `--replace` restores exactly what was archived, removing those files first (`removed: [...]`) and implying `--force`. `--replace` refuses a directory holding no `himalaya.content.json`, so a mistyped `--out` cannot clear an unrelated tree, and the only paths it can remove are the ones a push would have archived \u2014 `.git/`, `node_modules/`, `dist/`, `.env*` and key material are out of its reach by construction.", required: "<app> [--release <id>] [--out <dir>] [--name <new>] [--force|--replace] [--target <t>]" },
|
|
66828
66953
|
{ name: "share", summary: "publish or revoke a content-addressed `.himi` share link. The package must be a validated archive for an already-published release; the resulting https URL is safe to QR, copy, or open in Himi Player.", required: "--file <package.himi> [--expires-at <ISO>] | revoke --app <app> <shareId>" },
|
|
66829
|
-
{ name: "run", summary: "serve a .himi package on localhost and open it in a browser \u2014 no serve plane, no dev-server, no setup. Given no argument it builds the current content package first, so `himi run` is the inner loop: edit, run, look at it. The SPA and /v1 are served from ONE origin because Tier-5 bundle fetches on web are same-origin-only. --chrome preview frames the app in a device chassis; --chrome app serves it as a plain web app. Blocks until Ctrl-C, like any dev server. --browser runs the whole plane INSIDE the tab (service worker + in-memory store) so no app code executes in this process or on any pod. --watch keeps the preview LIVE: every save in the content package rebuilds it and repaints the open tab with only what changed (the dev-server's hot-reload events); a build that fails keeps the last good preview on screen and says why. Any `himi run` of a content package (plain, --watch or --browser) frames its preview on the build board (`himi studio`) while it serves, and all but --browser also serve that board at /__himi/studio/ on the preview's own origin.", required: "[<package.himi|dir|url>] [--browser] [--watch] [--content <dir>] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open] [--spa <url>]" },
|
|
66954
|
+
{ name: "run", summary: "serve a .himi package on localhost and open it in a browser \u2014 no serve plane, no dev-server, no setup. Given no argument it builds the current content package first, so `himi run` is the inner loop: edit, run, look at it. The SPA and /v1 are served from ONE origin because Tier-5 bundle fetches on web are same-origin-only. --chrome preview frames the app in a device chassis; --chrome app serves it as a plain web app. Blocks until Ctrl-C, like any dev server. --browser runs the whole plane INSIDE the tab (service worker + in-memory store) so no app code executes in this process or on any pod. --lan also serves it to the local network and prints a QR, so a phone on the same Wi-Fi opens it as the real app, full screen. --watch keeps the preview LIVE: every save in the content package rebuilds it and repaints the open tab with only what changed (the dev-server's hot-reload events); a build that fails keeps the last good preview on screen and says why. Any `himi run` of a content package (plain, --watch or --browser) frames its preview on the build board (`himi studio`) while it serves, and all but --browser also serve that board at /__himi/studio/ on the preview's own origin.", required: "[<package.himi|dir|url>] [--browser] [--watch] [--lan] [--content <dir>] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open] [--spa <url>]" },
|
|
66830
66955
|
{ name: "preview", summary: "print the shareable web URL + himi:// deep link + agent /v1/preview JSON URLs for an app+release; --surface frames the web preview as any catalog surface (?surface=)", required: "--app --release [--screen] [--surface]" },
|
|
66831
66956
|
{ name: "surfaces", summary: "the surface catalog vs this app's envelope (platforms.json): targeted surfaces, the opt-in key for the rest, per-surface preview links with --app --release, and which widget families the package produces with --measure-widgets (which runs its built bundles)", required: "[--content <dir>] [--app --release] [--measure-widgets]" },
|
|
66832
66957
|
{ name: "context", summary: "fetch the agent preview envelope (GET /v1/preview/a/<app>) \u2014 ok/issues/screens/links; exit 1 if ok:false", required: "--app --release [--screen] [--include telemetry]" },
|
|
@@ -69726,7 +69851,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
69726
69851
|
const { detectAndroidNativeDecode: detectAndroidNativeDecode2, detectNativeDecode: detectNativeDecode2, nativeDecodePlatforms: nativeDecodePlatforms2 } = await Promise.resolve().then(() => (init_native_decode(), native_decode_exports));
|
|
69727
69852
|
let platforms;
|
|
69728
69853
|
try {
|
|
69729
|
-
platforms = nativeDecodePlatforms2(flags.native === true ? true : str6(flags.native));
|
|
69854
|
+
platforms = nativeDecodePlatforms2(flags.native === true ? true : str6(flags.native) ?? String(flags.native));
|
|
69730
69855
|
} catch (error) {
|
|
69731
69856
|
io.error(JSON.stringify({ error: error.message }));
|
|
69732
69857
|
return 2;
|
|
@@ -71399,7 +71524,13 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
71399
71524
|
// ---- himi run — serve a package on localhost and open it in a browser ----
|
|
71400
71525
|
// Blocks until interrupted, like any dev server.
|
|
71401
71526
|
case "run": {
|
|
71402
|
-
const { runPackage: runPackage2 } = await Promise.resolve().then(() => (init_run(), run_exports));
|
|
71527
|
+
const { runPackage: runPackage2, lanFlagConflict: lanFlagConflict2 } = await Promise.resolve().then(() => (init_run(), run_exports));
|
|
71528
|
+
const spaFlag = flags.spa;
|
|
71529
|
+
const lanConflict = lanFlagConflict2({ lan: flags.lan === true, browser: flags.browser === true, spa: typeof spaFlag === "string" || Array.isArray(spaFlag) ? String(spaFlag) : void 0 });
|
|
71530
|
+
if (lanConflict) {
|
|
71531
|
+
io.error(JSON.stringify({ ok: false, ...lanConflict }));
|
|
71532
|
+
return 2;
|
|
71533
|
+
}
|
|
71403
71534
|
let source = pos[1];
|
|
71404
71535
|
let temp = null;
|
|
71405
71536
|
const watch2 = flags.watch === true;
|
|
@@ -71455,7 +71586,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
71455
71586
|
let startedAt = "";
|
|
71456
71587
|
const record2 = (served2, build2) => {
|
|
71457
71588
|
try {
|
|
71458
|
-
if (recordKit?.writeRunRecord(dir, { url: served2.url, port: served2.port, pid: process.pid, startedAt, watching: watch2, build: build2 })) recorded = true;
|
|
71589
|
+
if (recordKit?.writeRunRecord(dir, { url: served2.url, port: served2.port, ...served2.lanUrl ? { lanUrl: served2.lanUrl } : {}, pid: process.pid, startedAt, watching: watch2, build: build2 })) recorded = true;
|
|
71459
71590
|
return null;
|
|
71460
71591
|
} catch (e) {
|
|
71461
71592
|
return e.message;
|
|
@@ -71504,6 +71635,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
71504
71635
|
surface: str6(flags.surface),
|
|
71505
71636
|
spa: str6(flags.spa),
|
|
71506
71637
|
open: flags["no-open"] !== true,
|
|
71638
|
+
lan: flags.lan === true,
|
|
71507
71639
|
// The build board on the preview's own origin, for any run of this content package.
|
|
71508
71640
|
...recordKit ? { extraRoutes: (request) => recordKit.boardFile(dir, new URL(request.url).pathname) } : {},
|
|
71509
71641
|
// `liveWix` only with --watch: that is the "click around while you work" window, and a
|
|
@@ -71576,12 +71708,23 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
71576
71708
|
await running.close();
|
|
71577
71709
|
throw e;
|
|
71578
71710
|
}
|
|
71711
|
+
if (running.lanUrl) {
|
|
71712
|
+
io.error(`himi run --lan: anyone on this network can open this preview (read-only) at ${running.lanUrl}`);
|
|
71713
|
+
io.error("Scan it with your phone, on the same Wi-Fi:");
|
|
71714
|
+
try {
|
|
71715
|
+
const qr = qrTerminal(running.lanUrl);
|
|
71716
|
+
io.error(qr.cols <= 60 ? qr.text : ` QR omitted (terminal width ${qr.cols} exceeds 60 columns)`);
|
|
71717
|
+
} catch {
|
|
71718
|
+
io.error(" QR omitted (link is too long)");
|
|
71719
|
+
}
|
|
71720
|
+
}
|
|
71579
71721
|
print({
|
|
71580
71722
|
ok: true,
|
|
71581
71723
|
app: running.app,
|
|
71582
71724
|
releaseId: running.releaseId,
|
|
71583
71725
|
url: running.url,
|
|
71584
71726
|
port: running.port,
|
|
71727
|
+
...running.lanUrl ? { lan: { url: running.lanUrl } } : {},
|
|
71585
71728
|
...watch2 ? { watching: dir } : {},
|
|
71586
71729
|
...recordKit && boardOpen(dir) ? { board: `${running.origin}/__himi/studio/` } : {},
|
|
71587
71730
|
...running.warnings.length ? { warnings: running.warnings } : {},
|
|
@@ -71726,10 +71869,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
71726
71869
|
// right below says how (or whether) the narrowing was measured.
|
|
71727
71870
|
enabled: (() => {
|
|
71728
71871
|
const envelope = resolveSurfaceEnvelope(platforms).enabled;
|
|
71729
|
-
|
|
71872
|
+
const families = produced.families;
|
|
71873
|
+
if (!families) return envelope;
|
|
71730
71874
|
return envelope.filter((id) => {
|
|
71731
71875
|
const surface = surfaceById(id);
|
|
71732
|
-
return !surface || !isWidgetFamilySurface(surface) ||
|
|
71876
|
+
return !surface || !isWidgetFamilySurface(surface) || families.has(surfaceFrozenFamily(surface));
|
|
71733
71877
|
});
|
|
71734
71878
|
})(),
|
|
71735
71879
|
// Says which question the `produced` column answered, and — when it could not
|
|
@@ -73598,7 +73742,8 @@ ${report2.ok ? "OK \u2014 data + serve plane reachable." : typeof report2.hint =
|
|
|
73598
73742
|
return 2;
|
|
73599
73743
|
}
|
|
73600
73744
|
const environment2 = str6(flags.environment) ?? "preview";
|
|
73601
|
-
|
|
73745
|
+
const isResourceEnvironment = (v) => v === "preview" || v === "production";
|
|
73746
|
+
if (!isResourceEnvironment(environment2)) {
|
|
73602
73747
|
io.error(JSON.stringify({ error: "--environment must be preview or production" }));
|
|
73603
73748
|
return 2;
|
|
73604
73749
|
}
|
|
@@ -73881,7 +74026,7 @@ ${report2.ok ? "OK \u2014 data + serve plane reachable." : typeof report2.hint =
|
|
|
73881
74026
|
redirectUri: redirectFlag,
|
|
73882
74027
|
cwd: str6(flags.content) ?? process.cwd()
|
|
73883
74028
|
});
|
|
73884
|
-
print(
|
|
74029
|
+
print(r);
|
|
73885
74030
|
return 0;
|
|
73886
74031
|
} catch (e) {
|
|
73887
74032
|
io.error(JSON.stringify({ error: e.message }));
|