@wix/himalaya-cli 0.1710.0 → 0.1712.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/webview-embedded.d.ts +16 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +70 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +6 -2
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{82ac5473f6edad4c4d0e5c0cfd460722e7e145b9f097cf708cdc97621f386d6a.bin → 5db37cd261bfc00a358c737601ba6b09dd67ea583bd16e1b3e70df6a5d4780ed.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +5156 -3988
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/designing-himi-screens.md +1 -1
- package/guides/himi-json-output.md +14 -3
- package/guides/qa-builds.md +12 -0
- package/guides/webview-page-sdk.md +35 -0
- package/package.json +2 -2
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts
CHANGED
|
@@ -163,6 +163,12 @@ export interface SitePageNodeSpec {
|
|
|
163
163
|
title?: string;
|
|
164
164
|
/** Overrides merged OVER the site preset, like {@link SitePage.webView}. */
|
|
165
165
|
webView?: Partial<WebViewConfig>;
|
|
166
|
+
/** RFC 0079 §7 — `"worker"`: the page talks to the screen's worker (`@wix/himalaya/webview-page` on the
|
|
167
|
+
* page, `@himalaya/webview` in the worker, whose bundle must declare `"webview"`). On a binary whose
|
|
168
|
+
* baked site contains the page and the preset's allow-list, the page is SITE-TRUSTED: it keeps every
|
|
169
|
+
* site behaviour and gains the channel, which is attached only while the page's main frame is inside
|
|
170
|
+
* the site. Anywhere else it falls back to RFC 0073's strict profile. Unset ⇒ no channel. */
|
|
171
|
+
bridge?: "worker";
|
|
166
172
|
}
|
|
167
173
|
/** The component id every site-page node gets unless the author names one. A screen has one
|
|
168
174
|
* primary node (RFC 0079 §9), so a fixed id is unique and stays a stable test id (invariant 27).
|
|
@@ -3,7 +3,7 @@ export declare const MAX_SIMULTANEOUS_BRIDGED_WEBVIEWS = 4;
|
|
|
3
3
|
export interface WebViewEmbeddedFinding {
|
|
4
4
|
severity: "error" | "warning";
|
|
5
5
|
/** Stable id of the §4.6 rule, for tests and tooling; never match on `message`. */
|
|
6
|
-
rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary" | "dual_form_without_primary" | "dual_form_mismatch" | "dual_form_logic_bundle";
|
|
6
|
+
rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary" | "primary_bridge_not_site_trusted" | "dual_form_without_primary" | "dual_form_mismatch" | "dual_form_logic_bundle";
|
|
7
7
|
path: string;
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
@@ -51,6 +51,21 @@ export declare function canonicalScreenArgs(args: Readonly<Record<string, unknow
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function effectiveWebViewInstanceId(screenId: string, args: Readonly<Record<string, unknown>> | undefined, componentId: string, explicitInstanceId?: string): string;
|
|
53
53
|
export { DUAL_FORM_NODE_RENDERER, DUAL_FORM_T3_RENDERER, payloadNodeForm, prefersPayloadNodeForm, rootPrimaryWebView, sameCapabilityScope } from "./site-screen-form.js";
|
|
54
|
+
/** Whether a page URL is inside the site's path boundaries (the RFC 0062 §3 rule): https, no
|
|
55
|
+
* credentials, the boundary's host and port, and its path or anything under it. */
|
|
56
|
+
export declare function siteOriginsAdmit(url: string, siteOrigins: readonly string[]): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* RFC 0079 §9 — the app-level half of the site-trusted rule: a `role: "primary"` + `bridge: "worker"`
|
|
59
|
+
* WebView whose literal `url`, or any `allowedOrigins` entry, is outside the app's `site` block
|
|
60
|
+
* (`navigation.site.origins`). The device decides trust from the BAKED site (§7) and fails closed to the
|
|
61
|
+
* strict profile, so this is a warning: the page stays a primary page, under the strict bridge profile.
|
|
62
|
+
* `siteOrigins` null/empty — the app has no site block — means no primary bridged page can be trusted.
|
|
63
|
+
* The empty allow-list case is the single-screen rule in {@link webViewEmbeddedFindings}.
|
|
64
|
+
*/
|
|
65
|
+
export declare function webViewSiteTrustAppFindings(screens: Iterable<{
|
|
66
|
+
screenId: string;
|
|
67
|
+
descriptor: unknown;
|
|
68
|
+
}>, siteOrigins: readonly string[] | null | undefined): WebViewEmbeddedAppFinding[];
|
|
54
69
|
/**
|
|
55
70
|
* The single-screen §4.6 rules over one screen descriptor. The cross-screen rule (an explicit
|
|
56
71
|
* `per_instance` literal reused for different content) needs every screen, so it is
|
|
@@ -14742,6 +14742,68 @@ function primaryRules(s, config, out) {
|
|
|
14742
14742
|
message: `WebView "${s.id}" sets bridge: "worker" with a site config (${siteFields.join(", ")}) but no role: "primary" \u2014 a bridged WebView that is not the screen's site page gets the strict bridge profile, which drops the site behaviours those fields ask for (RFC 0079 \xA77, \xA79)`
|
|
14743
14743
|
});
|
|
14744
14744
|
}
|
|
14745
|
+
if (isBridged(props) && primary && allowedOriginsOf(config).length === 0) {
|
|
14746
|
+
out.push({
|
|
14747
|
+
severity: "warning",
|
|
14748
|
+
rule: "primary_bridge_not_site_trusted",
|
|
14749
|
+
path: `${path}.body.props.config.allowedOrigins`,
|
|
14750
|
+
message: `WebView "${s.id}" is a primary page with bridge: "worker" but no config.allowedOrigins \u2014 the device trusts a site page's channel only when every allowed origin is inside the app's baked site, so this page stays a primary page under the strict bridge profile (no off-site prompt, /login intercept, session bridges or site links). Give it the site's allow-list (sitePage() does) (RFC 0079 \xA77, \xA79)`
|
|
14751
|
+
});
|
|
14752
|
+
}
|
|
14753
|
+
}
|
|
14754
|
+
var allowedOriginsOf = (config) => Array.isArray(config.allowedOrigins) ? config.allowedOrigins.filter((o) => typeof o === "string") : [];
|
|
14755
|
+
function siteBoundary(raw) {
|
|
14756
|
+
const trimmed = raw.trim();
|
|
14757
|
+
if (!/^https:\/\//i.test(trimmed) || trimmed.includes("*")) return null;
|
|
14758
|
+
const rawPath = trimmed.replace(/^https:\/\/[^/?#]*/i, "").split(/[?#]/)[0];
|
|
14759
|
+
if (rawPath.replace(/%2e/gi, ".").split("/").some((seg) => seg === "." || seg === "..")) return null;
|
|
14760
|
+
let url;
|
|
14761
|
+
try {
|
|
14762
|
+
url = new URL(trimmed);
|
|
14763
|
+
} catch {
|
|
14764
|
+
return null;
|
|
14765
|
+
}
|
|
14766
|
+
if (url.username || url.password || url.search || url.hash || !url.hostname) return null;
|
|
14767
|
+
const path = (url.pathname.endsWith("/") ? url.pathname : `${url.pathname}/`).toLowerCase();
|
|
14768
|
+
return { host: url.hostname.toLowerCase(), port: url.port, path };
|
|
14769
|
+
}
|
|
14770
|
+
var boundaryWithin = (a, b) => a.host === b.host && a.port === b.port && a.path.startsWith(b.path);
|
|
14771
|
+
function siteOriginsAdmit(url, siteOrigins) {
|
|
14772
|
+
const page = siteBoundary(url.split("#")[0].split("?")[0]);
|
|
14773
|
+
if (page === null) return false;
|
|
14774
|
+
return siteOrigins.map(siteBoundary).some((b) => b !== null && boundaryWithin(page, b));
|
|
14775
|
+
}
|
|
14776
|
+
function siteOriginsContain(entry, siteOrigins) {
|
|
14777
|
+
const e = siteBoundary(entry);
|
|
14778
|
+
if (e === null) return false;
|
|
14779
|
+
return siteOrigins.map(siteBoundary).some((b) => b !== null && boundaryWithin(e, b));
|
|
14780
|
+
}
|
|
14781
|
+
function webViewSiteTrustAppFindings(screens, siteOrigins) {
|
|
14782
|
+
const origins = siteOrigins ?? [];
|
|
14783
|
+
const out = [];
|
|
14784
|
+
for (const { screenId, descriptor } of screens) {
|
|
14785
|
+
if (!isRec2(descriptor)) continue;
|
|
14786
|
+
for (const s of collectWebViews(descriptor)) {
|
|
14787
|
+
if (!isBridged(s.props) || !isPrimary(s.props)) continue;
|
|
14788
|
+
const allowed = allowedOriginsOf(configOf(s.props));
|
|
14789
|
+
if (allowed.length === 0) continue;
|
|
14790
|
+
const outsideUrl = isLiteral(s.props.url) && !siteOriginsAdmit(s.props.url, origins);
|
|
14791
|
+
const outsideEntries = allowed.filter((o) => !siteOriginsContain(o, origins));
|
|
14792
|
+
if (!outsideUrl && outsideEntries.length === 0) continue;
|
|
14793
|
+
const what = origins.length === 0 ? "the app has no site block (navigation.site)" : [
|
|
14794
|
+
...outsideUrl ? [`its url ${JSON.stringify(s.props.url)}`] : [],
|
|
14795
|
+
...outsideEntries.length > 0 ? [`allowedOrigins ${JSON.stringify(outsideEntries)}`] : []
|
|
14796
|
+
].join(" and ") + ` ${outsideUrl && outsideEntries.length === 0 ? "is" : "are"} outside the app's site block (${JSON.stringify(origins)})`;
|
|
14797
|
+
out.push({
|
|
14798
|
+
severity: "warning",
|
|
14799
|
+
rule: "primary_bridge_not_site_trusted",
|
|
14800
|
+
screenId,
|
|
14801
|
+
path: `${s.path}.body.props.${outsideUrl ? "url" : "config.allowedOrigins"}`,
|
|
14802
|
+
message: `WebView "${s.id}" is a primary page with bridge: "worker", but ${what} \u2014 the device trusts a site page's channel only inside the binary's baked site, so this page stays a primary page under the strict bridge profile (RFC 0079 \xA77, \xA79)`
|
|
14803
|
+
});
|
|
14804
|
+
}
|
|
14805
|
+
}
|
|
14806
|
+
return out;
|
|
14745
14807
|
}
|
|
14746
14808
|
function webViewEmbeddedFindings(descriptor) {
|
|
14747
14809
|
if (!isRec2(descriptor)) return [];
|
|
@@ -15065,7 +15127,7 @@ function defineSitePageScreen(site) {
|
|
|
15065
15127
|
var SITE_PAGE_NODE_ID = "site_page_view";
|
|
15066
15128
|
var SITE_SCREEN_FORMS = ["t3", "node", "both"];
|
|
15067
15129
|
var SITE_NODE_SCREEN_RENDERER = "sdui_layout";
|
|
15068
|
-
function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
|
|
15130
|
+
function primarySiteWebView(url, config, id, label2, capabilitiesRequired, bridge) {
|
|
15069
15131
|
return {
|
|
15070
15132
|
id,
|
|
15071
15133
|
body: {
|
|
@@ -15076,6 +15138,7 @@ function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
|
|
|
15076
15138
|
role: "primary",
|
|
15077
15139
|
fill: true,
|
|
15078
15140
|
scrollEnabled: true,
|
|
15141
|
+
...bridge === "worker" ? { bridge } : {},
|
|
15079
15142
|
...capabilitiesRequired ? { capabilitiesRequired: [...capabilitiesRequired] } : {},
|
|
15080
15143
|
...config ? { config } : {}
|
|
15081
15144
|
}
|
|
@@ -15098,7 +15161,10 @@ function sitePageNode(site, page, opts) {
|
|
|
15098
15161
|
throw new Error("a site page node needs a path");
|
|
15099
15162
|
}
|
|
15100
15163
|
const url = sitePageUrl(site.origin, page.path);
|
|
15101
|
-
|
|
15164
|
+
if (page.bridge !== void 0 && page.bridge !== "worker") {
|
|
15165
|
+
throw new Error(`site page bridge ${JSON.stringify(page.bridge)} must be "worker" or unset`);
|
|
15166
|
+
}
|
|
15167
|
+
return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, [], page.bridge);
|
|
15102
15168
|
}
|
|
15103
15169
|
function isDesugarableSiteScreen(descriptor) {
|
|
15104
15170
|
return !!descriptor && descriptor.renderer === "webview_native_bridge" && typeof descriptor.url === "string" && descriptor.url !== "" && descriptor.logicBundle === void 0 && descriptor.webViewConfig?.internalLinksAsScreens !== true;
|
|
@@ -15720,6 +15786,7 @@ export {
|
|
|
15720
15786
|
siteNav,
|
|
15721
15787
|
siteNavConfig,
|
|
15722
15788
|
siteNavKind,
|
|
15789
|
+
siteOriginsAdmit,
|
|
15723
15790
|
sitePageNode,
|
|
15724
15791
|
sitePageUrl,
|
|
15725
15792
|
siteScreenId,
|
|
@@ -15749,6 +15816,7 @@ export {
|
|
|
15749
15816
|
webViewEmbeddedAppFindings,
|
|
15750
15817
|
webViewEmbeddedFindings,
|
|
15751
15818
|
webViewOriginAllowed,
|
|
15819
|
+
webViewSiteTrustAppFindings,
|
|
15752
15820
|
widgetSnapshotSchema,
|
|
15753
15821
|
workerSubtreePolicyErrors,
|
|
15754
15822
|
workerSubtreeSha256
|
|
@@ -8454,7 +8454,7 @@ function siteWebViewPreset(site) {
|
|
|
8454
8454
|
};
|
|
8455
8455
|
}
|
|
8456
8456
|
var SITE_PAGE_NODE_ID = "site_page_view";
|
|
8457
|
-
function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
|
|
8457
|
+
function primarySiteWebView(url, config, id, label2, capabilitiesRequired, bridge) {
|
|
8458
8458
|
return {
|
|
8459
8459
|
id,
|
|
8460
8460
|
body: {
|
|
@@ -8465,6 +8465,7 @@ function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
|
|
|
8465
8465
|
role: "primary",
|
|
8466
8466
|
fill: true,
|
|
8467
8467
|
scrollEnabled: true,
|
|
8468
|
+
...bridge === "worker" ? { bridge } : {},
|
|
8468
8469
|
...capabilitiesRequired ? { capabilitiesRequired: [...capabilitiesRequired] } : {},
|
|
8469
8470
|
...config ? { config } : {}
|
|
8470
8471
|
}
|
|
@@ -8487,7 +8488,10 @@ function sitePageNode(site, page, opts) {
|
|
|
8487
8488
|
throw new Error("a site page node needs a path");
|
|
8488
8489
|
}
|
|
8489
8490
|
const url = sitePageUrl(site.origin, page.path);
|
|
8490
|
-
|
|
8491
|
+
if (page.bridge !== void 0 && page.bridge !== "worker") {
|
|
8492
|
+
throw new Error(`site page bridge ${JSON.stringify(page.bridge)} must be "worker" or unset`);
|
|
8493
|
+
}
|
|
8494
|
+
return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, [], page.bridge);
|
|
8491
8495
|
}
|
|
8492
8496
|
|
|
8493
8497
|
// ../../core/ts/src/rich-content-limits.generated.ts
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"files": [
|
|
3
3
|
{
|
|
4
4
|
"name": "sw.js",
|
|
5
|
-
"bytes":
|
|
5
|
+
"bytes": 2544090
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
"name": "host.html",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"bytes": 23064
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"name": "preview-deferred/
|
|
24
|
+
"name": "preview-deferred/5db37cd261bfc00a358c737601ba6b09dd67ea583bd16e1b3e70df6a5d4780ed.bin",
|
|
25
25
|
"bytes": 488215
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
],
|
|
80
80
|
"deferred": [
|
|
81
81
|
{
|
|
82
|
-
"key": "assets/pdf-
|
|
82
|
+
"key": "assets/pdf-iTCRYcBP.js",
|
|
83
83
|
"contentType": "application/javascript; charset=utf-8",
|
|
84
|
-
"sha256": "
|
|
85
|
-
"file": "preview-deferred/
|
|
84
|
+
"sha256": "5db37cd261bfc00a358c737601ba6b09dd67ea583bd16e1b3e70df6a5d4780ed",
|
|
85
|
+
"file": "preview-deferred/5db37cd261bfc00a358c737601ba6b09dd67ea583bd16e1b3e70df6a5d4780ed.bin"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"key": "assets/pdf.worker.min-BGnVRhRG.js",
|