@wix/himalaya-cli 0.1017.0 → 0.1019.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 +93 -25
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -46477,7 +46477,7 @@ var init_assets = __esm({
|
|
|
46477
46477
|
async function checkPinnedRead(input) {
|
|
46478
46478
|
const { secret, token, app, releaseId, screenId, authorizePreview } = input;
|
|
46479
46479
|
if (!secret) return authorizePreview ? { status: 503, body: { error: "preview_token_unavailable" } } : null;
|
|
46480
|
-
if (!token) return await input.
|
|
46480
|
+
if (!token) return await input.isPublic() ? null : { status: 401, body: { error: "preview_token_required", app, releaseId } };
|
|
46481
46481
|
const verified = await verifyPreviewToken({ token, secret, app, releaseId, screenId });
|
|
46482
46482
|
if (verified.ok) {
|
|
46483
46483
|
if (authorizePreview ? !await authorizePreview(verified.claims) : !!verified.claims.siteLease) {
|
|
@@ -46759,9 +46759,30 @@ function makeServeHandler(opts) {
|
|
|
46759
46759
|
function resolvePin(request, url) {
|
|
46760
46760
|
return request.headers.get("x-himalaya-release") || url.searchParams.get("release") || null;
|
|
46761
46761
|
}
|
|
46762
|
+
const RELEASE_SOURCE_HEADER = "x-himalaya-release-source";
|
|
46762
46763
|
function resolvePreviewToken(request, url) {
|
|
46763
46764
|
return request.headers.get("x-himalaya-preview-token") || url.searchParams.get("pvt") || null;
|
|
46764
46765
|
}
|
|
46766
|
+
const RING_CACHE_CAP = 500;
|
|
46767
|
+
const ringCache = /* @__PURE__ */ new Map();
|
|
46768
|
+
async function isRingRelease(app, releaseId) {
|
|
46769
|
+
if (!opts.ringReleases) return false;
|
|
46770
|
+
const hit = ringCache.get(app);
|
|
46771
|
+
let ids = hit && Date.now() - hit.at < manifestCacheTtlMs ? hit.ids : void 0;
|
|
46772
|
+
if (!ids) {
|
|
46773
|
+
try {
|
|
46774
|
+
ids = new Set(await opts.ringReleases(app));
|
|
46775
|
+
} catch {
|
|
46776
|
+
ids = /* @__PURE__ */ new Set();
|
|
46777
|
+
}
|
|
46778
|
+
if (!ringCache.has(app) && ringCache.size >= RING_CACHE_CAP) {
|
|
46779
|
+
const oldest = ringCache.keys().next().value;
|
|
46780
|
+
if (oldest !== void 0) ringCache.delete(oldest);
|
|
46781
|
+
}
|
|
46782
|
+
ringCache.set(app, { ids, at: Date.now() });
|
|
46783
|
+
}
|
|
46784
|
+
return ids.has(releaseId);
|
|
46785
|
+
}
|
|
46765
46786
|
async function pinnedManifest(app, releaseId) {
|
|
46766
46787
|
const key2 = `${app}
|
|
46767
46788
|
${releaseId}`;
|
|
@@ -46846,11 +46867,40 @@ ${releaseId}`;
|
|
|
46846
46867
|
app,
|
|
46847
46868
|
releaseId,
|
|
46848
46869
|
screenId,
|
|
46849
|
-
|
|
46870
|
+
isPublic: async () => (await manifest(app))?.releaseId === releaseId || await isRingRelease(app, releaseId),
|
|
46850
46871
|
authorizePreview: opts.authorizePreview
|
|
46851
46872
|
});
|
|
46852
46873
|
return denied && json3(denied.status, denied.body);
|
|
46853
46874
|
}
|
|
46875
|
+
async function honourRingPin(request) {
|
|
46876
|
+
const kept = { request, dropped: false };
|
|
46877
|
+
if (request.method !== "GET" && request.method !== "HEAD") return kept;
|
|
46878
|
+
if (request.headers.get(RELEASE_SOURCE_HEADER) !== "ring") return kept;
|
|
46879
|
+
const pin = request.headers.get("x-himalaya-release");
|
|
46880
|
+
if (!pin) return kept;
|
|
46881
|
+
const url = new URL(request.url);
|
|
46882
|
+
const app = /^\/v1\/app-config\/([^/]+)$/.exec(url.pathname)?.[1] ?? resolveApp(request, url);
|
|
46883
|
+
if (!app) return kept;
|
|
46884
|
+
const drop = () => {
|
|
46885
|
+
const headers2 = new Headers(request.headers);
|
|
46886
|
+
headers2.delete("x-himalaya-release");
|
|
46887
|
+
headers2.delete(RELEASE_SOURCE_HEADER);
|
|
46888
|
+
return { request: new Request(request, { headers: headers2 }), dropped: true };
|
|
46889
|
+
};
|
|
46890
|
+
if (/^\/v1\/app-config\/[^/]+$/.test(url.pathname)) return drop();
|
|
46891
|
+
let servable;
|
|
46892
|
+
try {
|
|
46893
|
+
const live2 = await manifest(app);
|
|
46894
|
+
const eligible = live2?.releaseId === pin || await isRingRelease(app, pin);
|
|
46895
|
+
const pinned = eligible ? await pinnedManifest(app, pin) : null;
|
|
46896
|
+
servable = pinned !== null;
|
|
46897
|
+
const screenId = /^\/v1\/screen\/([^/]+)$/.exec(url.pathname)?.[1];
|
|
46898
|
+
if (servable && screenId && !pinned?.screens[screenId]) servable = false;
|
|
46899
|
+
} catch {
|
|
46900
|
+
return kept;
|
|
46901
|
+
}
|
|
46902
|
+
return servable ? kept : drop();
|
|
46903
|
+
}
|
|
46854
46904
|
const corsHeaders = (request) => {
|
|
46855
46905
|
const origin = request.headers.get("origin");
|
|
46856
46906
|
if (!origin) return {};
|
|
@@ -46859,7 +46909,7 @@ ${releaseId}`;
|
|
|
46859
46909
|
"access-control-allow-origin": origin,
|
|
46860
46910
|
vary: "Origin",
|
|
46861
46911
|
"access-control-allow-methods": "GET, HEAD, POST, PUT, DELETE, OPTIONS",
|
|
46862
|
-
"access-control-allow-headers": "Content-Type, If-None-Match, X-Himalaya-Schema-Versions, Accept-Language, X-Himalaya-Session, X-Himalaya-User, X-Himalaya-Platform, X-Himalaya-App-Version, X-Himalaya-App, X-Himalaya-Release, X-Himalaya-Preview-Token",
|
|
46912
|
+
"access-control-allow-headers": "Content-Type, If-None-Match, X-Himalaya-Schema-Versions, Accept-Language, X-Himalaya-Session, X-Himalaya-User, X-Himalaya-Platform, X-Himalaya-App-Version, X-Himalaya-App, X-Himalaya-Release, X-Himalaya-Release-Source, X-Himalaya-Preview-Token",
|
|
46863
46913
|
"access-control-expose-headers": "ETag, X-Himalaya-Bundle-Integrity, X-Himalaya-App",
|
|
46864
46914
|
"access-control-allow-credentials": "true"
|
|
46865
46915
|
};
|
|
@@ -47399,7 +47449,8 @@ ${releaseId}`;
|
|
|
47399
47449
|
}
|
|
47400
47450
|
const mm = m;
|
|
47401
47451
|
const readDoc = (hash, live2) => pin ? hash ? pinnedBody(app, hash, live2) : Promise.resolve(null) : live2();
|
|
47402
|
-
const
|
|
47452
|
+
const ringPinned = pin !== null && request.headers.get(RELEASE_SOURCE_HEADER) === "ring";
|
|
47453
|
+
const cfgBytes = ringPinned ? await store.getAppConfig(app) : await readDoc(mm.appConfigHash, () => store.getAppConfig(app));
|
|
47403
47454
|
if (!cfgBytes) return json3(404, { error: "app_config_not_found", app });
|
|
47404
47455
|
let appConfig;
|
|
47405
47456
|
try {
|
|
@@ -47407,7 +47458,7 @@ ${releaseId}`;
|
|
|
47407
47458
|
} catch {
|
|
47408
47459
|
return json3(500, { error: "app_config_invalid", app });
|
|
47409
47460
|
}
|
|
47410
|
-
const bootOverlay = !pin && opts.devControl ? devControlOverlay.get(app) : void 0;
|
|
47461
|
+
const bootOverlay = (!pin || ringPinned) && opts.devControl ? devControlOverlay.get(app) : void 0;
|
|
47411
47462
|
if (bootOverlay) appConfig.control = { ...appConfig.control ?? {}, ...bootOverlay };
|
|
47412
47463
|
const tokensBytes = await readDoc(mm.tokensHash, () => store.getTokens(app));
|
|
47413
47464
|
let tokens = null;
|
|
@@ -47424,9 +47475,18 @@ ${releaseId}`;
|
|
|
47424
47475
|
let screen = null;
|
|
47425
47476
|
let screenHash = "";
|
|
47426
47477
|
let homeBundle = null;
|
|
47427
|
-
|
|
47478
|
+
let homeFrom = mm;
|
|
47479
|
+
let readHome = readDoc;
|
|
47480
|
+
if (ringPinned && homeScreenId && !mm.screens[homeScreenId]) {
|
|
47481
|
+
const live2 = await manifest(app);
|
|
47482
|
+
if (live2?.screens[homeScreenId]) {
|
|
47483
|
+
homeFrom = live2;
|
|
47484
|
+
readHome = (_hash, liveSlot) => liveSlot();
|
|
47485
|
+
}
|
|
47486
|
+
}
|
|
47487
|
+
const homeMeta = homeScreenId ? homeFrom.screens[homeScreenId] : void 0;
|
|
47428
47488
|
if (homeScreenId && homeMeta) {
|
|
47429
|
-
const body = await
|
|
47489
|
+
const body = await readHome(homeMeta.descriptorHash, () => store.getScreen(app, homeScreenId));
|
|
47430
47490
|
if (body) {
|
|
47431
47491
|
try {
|
|
47432
47492
|
screen = JSON.parse(utf8Decode(body));
|
|
@@ -47436,7 +47496,7 @@ ${releaseId}`;
|
|
|
47436
47496
|
}
|
|
47437
47497
|
}
|
|
47438
47498
|
if (homeMeta.bundle) {
|
|
47439
|
-
const entry =
|
|
47499
|
+
const entry = homeFrom.bundles[homeMeta.bundle];
|
|
47440
47500
|
if (entry?.sha256 && entry?.sri) {
|
|
47441
47501
|
homeBundle = {
|
|
47442
47502
|
sha256: entry.sha256,
|
|
@@ -47446,9 +47506,10 @@ ${releaseId}`;
|
|
|
47446
47506
|
}
|
|
47447
47507
|
}
|
|
47448
47508
|
}
|
|
47449
|
-
const
|
|
47450
|
-
const
|
|
47451
|
-
const
|
|
47509
|
+
const cfgTag = ringPinned ? sha256hex(JSON.stringify(appConfig)) : mm.appConfigHash ?? "";
|
|
47510
|
+
const etag = strongEtag(`${mm.releaseId}:${cfgTag}:${mm.tokensHash ?? ""}:${screenHash}:${homeBundle?.sha256 ?? ""}`);
|
|
47511
|
+
const cache = pin && !ringPinned ? PINNED_CACHE_CONTROL : DOC_CACHE_CONTROL;
|
|
47512
|
+
const vary = pin ? { vary: ringPinned ? `x-himalaya-release, ${RELEASE_SOURCE_HEADER}` : "x-himalaya-release" } : {};
|
|
47452
47513
|
if (request.headers.get("if-none-match") === etag) {
|
|
47453
47514
|
return new Response(null, { status: 304, headers: { etag, "cache-control": cache, ...vary } });
|
|
47454
47515
|
}
|
|
@@ -47629,7 +47690,14 @@ ${releaseId}`;
|
|
|
47629
47690
|
if (request.method === "OPTIONS") {
|
|
47630
47691
|
return new Response(null, { status: 204, headers: { ...corsHeaders(request), "content-length": "0" } });
|
|
47631
47692
|
}
|
|
47632
|
-
const
|
|
47693
|
+
const ring = await honourRingPin(request);
|
|
47694
|
+
const response = await handle(ring.request);
|
|
47695
|
+
if (ring.dropped) {
|
|
47696
|
+
const parts = new Set(
|
|
47697
|
+
[...response.headers.get("vary")?.split(",") ?? [], "x-himalaya-release", RELEASE_SOURCE_HEADER].map((s) => s.trim()).filter(Boolean)
|
|
47698
|
+
);
|
|
47699
|
+
response.headers.set("vary", [...parts].join(", "));
|
|
47700
|
+
}
|
|
47633
47701
|
if (resolvePreviewToken(request, new URL(request.url))) {
|
|
47634
47702
|
response.headers.set("cache-control", "private, no-store");
|
|
47635
47703
|
response.headers.set("vary", "x-himalaya-preview-token, x-himalaya-release");
|
|
@@ -47999,19 +48067,19 @@ var init_preview_assets_generated = __esm({
|
|
|
47999
48067
|
"../../packages/serve/src/preview-assets.generated.ts"() {
|
|
48000
48068
|
init_preview_assets_format();
|
|
48001
48069
|
PREVIEW_ASSET_MANIFEST = [
|
|
48002
|
-
{ key: "assets/index-
|
|
48003
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
48004
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
48005
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
48006
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
48007
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
48008
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
48009
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
48010
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
48011
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
48012
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
48013
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
48014
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
48070
|
+
{ key: "assets/index-Bsi3iDy5.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1018562, sha256: "8487d8635f18c5a32f124ebc217f0570d5b8242ac964de661fa0644b80843116" },
|
|
48071
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 1018570, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
48072
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1109494, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
48073
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1200478, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
48074
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1291458, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
48075
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1382330, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
48076
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1473310, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
48077
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1581946, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
48078
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1691030, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
48079
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1800078, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
48080
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1907778, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
48081
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 1995886, length: 4448, sha256: "60540583e7c95a5564940f1f05510886f0f59a6ec612af78881031a5e9c04b9a" },
|
|
48082
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 2000334, length: 17209, sha256: "dffc9718e2faa63ae2cc919e0a842f585ed565aaaa7c53778e90379442c731b6" }
|
|
48015
48083
|
];
|
|
48016
48084
|
}
|
|
48017
48085
|
});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1019.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": [
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"artifactId": "himalaya-cli"
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"falconPackageHash": "
|
|
68
|
+
"falconPackageHash": "1bc07d659f8a5254f7afe76b39faf5f6d53dff12518cfd6257039a78"
|
|
69
69
|
}
|