@wix/himalaya-cli 0.1489.0 → 0.1490.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 +12 -6
- package/guides/widgets.md +20 -7
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -22149,6 +22149,7 @@ function resolveIdiom(tokens2, ctx = {}) {
|
|
|
22149
22149
|
var IDIOM_CONTEXTS, UNSAFE_KEYS;
|
|
22150
22150
|
var init_idiom = __esm({
|
|
22151
22151
|
"../../core/ts/src/idiom.ts"() {
|
|
22152
|
+
"use strict";
|
|
22152
22153
|
IDIOM_CONTEXTS = {
|
|
22153
22154
|
ios: { native: ["ios"] },
|
|
22154
22155
|
android: { native: ["material"] },
|
|
@@ -130176,7 +130177,7 @@ function stableWidgets(widgets) {
|
|
|
130176
130177
|
if (!widgets || typeof widgets !== "object" || Array.isArray(widgets)) return widgets;
|
|
130177
130178
|
return Object.fromEntries(Object.entries(widgets).map(([id, value]) => {
|
|
130178
130179
|
if (!value || typeof value !== "object" || Array.isArray(value)) return [id, value];
|
|
130179
|
-
const { contentEtag: _regenerated, ...stable } = value;
|
|
130180
|
+
const { contentEtag: _regenerated, family: _listed, ...stable } = value;
|
|
130180
130181
|
return [id, stable];
|
|
130181
130182
|
}));
|
|
130182
130183
|
}
|
|
@@ -135146,7 +135147,9 @@ async function bakeWidgets(fetchPath, putWidget, ownBundles) {
|
|
|
135146
135147
|
await putWidget(widgetId, json8);
|
|
135147
135148
|
widgets[widgetId] = {
|
|
135148
135149
|
contentEtag: snap.contentEtag ?? sha2563(json8),
|
|
135149
|
-
ttlSeconds: snap.refresh?.ttlSeconds ?? 0
|
|
135150
|
+
ttlSeconds: snap.refresh?.ttlSeconds ?? 0,
|
|
135151
|
+
// Listed so a device fetches only the families it draws (RFC 0039 M2); absent in older releases.
|
|
135152
|
+
...typeof snap.family === "string" ? { family: snap.family } : {}
|
|
135150
135153
|
};
|
|
135151
135154
|
}
|
|
135152
135155
|
return { widgets, failures };
|
|
@@ -163610,12 +163613,15 @@ ${releaseId}`;
|
|
|
163610
163613
|
headers: { "content-type": JSON_CT3, etag, "cache-control": DOC_CACHE_CONTROL, "x-himalaya-app": app }
|
|
163611
163614
|
});
|
|
163612
163615
|
}
|
|
163616
|
+
const widgetSite = path2 === "/v1/widgets" || path2.startsWith("/v1/widget/") ? url.searchParams.get("site") : null;
|
|
163617
|
+
if (widgetSite !== null && !/^[A-Za-z0-9_-]{1,64}$/.test(widgetSite)) return json5(400, { error: "invalid_site" });
|
|
163618
|
+
const widgetScope = widgetSite !== null ? { "x-himalaya-widget-scope": "app" } : {};
|
|
163613
163619
|
if (path2 === "/v1/widgets") {
|
|
163614
163620
|
if (!app) return json5(400, { error: "missing_app" });
|
|
163615
163621
|
const m2 = pin ? await pinnedManifest(app, pin) : await manifest(app);
|
|
163616
163622
|
if (!m2) return json5(404, { error: pin ? "release_not_found" : "no_release", app });
|
|
163617
|
-
const widgets = Object.entries(m2.widgets ?? {}).map(([widgetId, meta]) => ({ widgetId, contentEtag: meta.contentEtag }));
|
|
163618
|
-
return json5(200, { widgets });
|
|
163623
|
+
const widgets = Object.entries(m2.widgets ?? {}).map(([widgetId, meta]) => ({ widgetId, contentEtag: meta.contentEtag, ...meta.family ? { family: meta.family } : {} }));
|
|
163624
|
+
return json5(200, { widgets }, widgetScope);
|
|
163619
163625
|
}
|
|
163620
163626
|
const widgetMatch = /^\/v1\/widget\/([^/]+)$/.exec(path2);
|
|
163621
163627
|
if (widgetMatch) {
|
|
@@ -163629,13 +163635,13 @@ ${releaseId}`;
|
|
|
163629
163635
|
const cache = pin ? PINNED_CACHE_CONTROL : `max-age=${meta.ttlSeconds}`;
|
|
163630
163636
|
const vary = pin ? { vary: "x-himalaya-release" } : {};
|
|
163631
163637
|
if (request.headers.get("if-none-match") === etag) {
|
|
163632
|
-
return new Response(null, { status: 304, headers: { etag, "cache-control": cache, ...vary } });
|
|
163638
|
+
return new Response(null, { status: 304, headers: { etag, "cache-control": cache, ...vary, ...widgetScope } });
|
|
163633
163639
|
}
|
|
163634
163640
|
const body = await store.getWidget(app, widgetId);
|
|
163635
163641
|
if (!body) return json5(404, { error: "widget_not_found", widgetId });
|
|
163636
163642
|
return new Response(body, {
|
|
163637
163643
|
status: 200,
|
|
163638
|
-
headers: { "content-type": JSON_CT3, etag, "cache-control": cache, ...vary, "x-himalaya-app": app }
|
|
163644
|
+
headers: { "content-type": JSON_CT3, etag, "cache-control": cache, ...vary, "x-himalaya-app": app, ...widgetScope }
|
|
163639
163645
|
});
|
|
163640
163646
|
}
|
|
163641
163647
|
return json5(404, { error: "not_found" });
|
package/guides/widgets.md
CHANGED
|
@@ -46,13 +46,23 @@ bindings, only **resolved literal values**. Reading the clock is the one allowed
|
|
|
46
46
|
the last produce (see [refresh](#refresh-taps-and-previews)). A `render` that throws, or returns a
|
|
47
47
|
tree with a binding in it, makes that widget fail to produce.
|
|
48
48
|
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
### Live data reaches a widget only through the app on the device
|
|
50
|
+
|
|
51
|
+
The produce above has no credential, so data your worker fetches **cannot** reach a widget through
|
|
52
|
+
`defineWidget`. The one path for live data runs on the device, in the app: the app fetches the
|
|
53
|
+
widget's descriptors, runs their worker **headlessly** with the signed-in session, resolves every
|
|
54
|
+
`$service:` binding to a literal, and publishes the frozen tree itself —
|
|
55
|
+
`WidgetSnapshotSync.publishLocal` on iOS, `WidgetSnapshotSync.publishLocalBlocking` on Android.
|
|
56
|
+
Owner Lite's Today widget works this way (`OwnerLiteHomeWidget`): it refreshes when the app runs or
|
|
57
|
+
the OS grants a background refresh, never on its own. An app that embeds Himalaya apps gets the same
|
|
58
|
+
produce from `HimalayaEmbedSurfaces.publishWidgets` (see
|
|
59
|
+
[embedding → widgets](embedding-sdk.md#home-and-lock-screen-widgets)).
|
|
60
|
+
|
|
61
|
+
`refresh.pushTopic` exists in the type definitions, but nothing consumes it yet: setting it does not
|
|
62
|
+
make the widget update when data changes. Without a device produce, plan the widget around what you
|
|
63
|
+
know when the app is built — a call to action, a constant, or a schedule (see
|
|
64
|
+
[timelines](#content-whose-future-you-know-live-time-and-timelines)) — and let the tap take the user
|
|
65
|
+
into the app, where the live data is.
|
|
56
66
|
|
|
57
67
|
## A widget that stays inside the contract
|
|
58
68
|
|
|
@@ -217,6 +227,9 @@ not, because the car lays out its own rows. It never goes through `defineWidget`
|
|
|
217
227
|
request, not a schedule.
|
|
218
228
|
- **`deepLink`** is where a tap takes the user. Point it at the screen that shows the live version
|
|
219
229
|
of what the widget summarises.
|
|
230
|
+
- **`GET /v1/widgets?site=<metaSiteId>`** (and `/v1/widget/<id>?site=`) is accepted for a host that
|
|
231
|
+
shows one app on many sites. The snapshot is still the app's — nothing is produced per site — and
|
|
232
|
+
the response says so with `x-himalaya-widget-scope: app`.
|
|
220
233
|
- **Preview a widget** while you work: `himi run --watch --content .` serves it at
|
|
221
234
|
`GET /v1/widget/<widget id>`, and `GET /v1/widgets` lists every widget the app produces.
|
|
222
235
|
`himi surfaces --measure-widgets` reports which families your package actually produces.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1490.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"artifactId": "himalaya-cli"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"falconPackageHash": "
|
|
74
|
+
"falconPackageHash": "cb54373a9c2a773492e66c5579403c0720caa00367681b4479fbc0e3"
|
|
75
75
|
}
|