vitral 0.13.1 → 0.14.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/README.md +210 -195
- package/dist/angular.d.ts +2 -2
- package/dist/angular.js +11 -10
- package/dist/auto.js +16 -10
- package/dist/{capture-2I5IQ2C2.js → capture-5TUYE67Q.js} +3 -2
- package/dist/{channel-BHOVSU5X.js → channel-LW7J2VLA.js} +7 -4
- package/dist/{chunk-UCFOXMOR.js → chunk-24GEJNHQ.js} +6 -3
- package/dist/{chunk-LITYI5X7.js → chunk-3VYMK53Z.js} +4 -4
- package/dist/{chunk-YDO7SPF4.js → chunk-6EFYG6N7.js} +4 -4
- package/dist/{chunk-DSOK3BNO.js → chunk-7VQLAFIO.js} +45 -14
- package/dist/{chunk-6XXPGS5Q.js → chunk-GAVXPS5X.js} +33 -24
- package/dist/{chunk-GB3J6I2T.js → chunk-JRZ7FNAE.js} +10 -8
- package/dist/{chunk-B7LKO4HS.js → chunk-KA2SH4FH.js} +7 -4
- package/dist/chunk-M7AYWO4W.js +13 -0
- package/dist/{chunk-VDVVEGAO.js → chunk-NDB5GJMS.js} +9 -6
- package/dist/{chunk-54CBIZES.js → chunk-P2RSLXEB.js} +16 -4
- package/dist/{chunk-OKXLOMAG.js → chunk-PHVXXDWT.js} +1 -1
- package/dist/{chunk-5JNG3OG5.js → chunk-QIGE3XYA.js} +2 -2
- package/dist/{chunk-EQZOJU3B.js → chunk-RKYDVK2P.js} +1 -1
- package/dist/{chunk-BQGVAXFM.js → chunk-U4QBQQQJ.js} +7 -3
- package/dist/{chunk-F5USJIBT.js → chunk-UMSDTGTI.js} +16 -12
- package/dist/{chunk-GNPFWISJ.js → chunk-VKY4TKRT.js} +13 -2
- package/dist/{chunk-SQ46TAP4.js → chunk-YF7HTZMX.js} +8 -5
- package/dist/cli.js +5 -5
- package/dist/contract-YNLXHJL7.js +97 -0
- package/dist/devtools.js +2 -2
- package/dist/edge.d.ts +1 -1
- package/dist/element.d.ts +2 -2
- package/dist/element.js +11 -10
- package/dist/embed.js +2 -2
- package/dist/{events-XXC4si92.d.ts → events-C7OtGkNT.d.ts} +1 -1
- package/dist/expose-ZDAACD24.js +19 -0
- package/dist/federation.d.ts +1 -1
- package/dist/{hydrate-QPVDJHM7.js → hydrate-GRYEYDGZ.js} +13 -10
- package/dist/{i18n-TMQBOCPP.js → i18n-S5XJHITJ.js} +6 -5
- package/dist/i18n.d.ts +1 -10
- package/dist/i18n.js +6 -5
- package/dist/iframe.js +15 -12
- package/dist/index.d.ts +14 -6
- package/dist/index.js +11 -8
- package/dist/{loader-vj8m2GQU.d.ts → loader-BWTfd89w.d.ts} +1 -1
- package/dist/next-config.d.ts +1 -1
- package/dist/next-host.d.ts +3 -3
- package/dist/next-host.js +14 -13
- package/dist/next-server.d.ts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/{overrides-5BGODLCO.js → overrides-VDR33GS7.js} +2 -2
- package/dist/preact.d.ts +4 -4
- package/dist/preact.js +12 -10
- package/dist/prefetch.js +8 -7
- package/dist/react-server.d.ts +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +11 -10
- package/dist/{reframe-IV36WJRO.js → reframe-SQLGQC6U.js} +19 -16
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +10 -9
- package/dist/{shadow-ABRO7JNY.js → shadow-H3CCEKCL.js} +5 -4
- package/dist/single-spa.d.ts +1 -1
- package/dist/{slot-CxhuVuka.d.ts → slot-BNPG3hc0.d.ts} +1 -1
- package/dist/snapshot.js +1 -1
- package/dist/solid.d.ts +3 -3
- package/dist/solid.js +14 -11
- package/dist/sri-XXWEYDFN.js +18 -0
- package/dist/svelte.d.ts +4 -4
- package/dist/svelte.js +10 -9
- package/dist/sw.d.ts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +9 -8
- package/dist/{types-cSsvpvgE.d.ts → types-L-qRmgLw.d.ts} +29 -2
- package/dist/vitals.js +3 -2
- package/dist/vite.js +1 -0
- package/dist/vue.d.ts +6 -6
- package/dist/vue.js +12 -10
- package/package.json +22 -22
- package/dist/contract-3JY7SOGQ.js +0 -18
- package/dist/expose-4CIS6AKL.js +0 -18
- package/dist/sri-Z5U32IR2.js +0 -17
package/dist/angular.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionToken, Type, ApplicationConfig, Signal, Provider, EnvironmentProviders } from '@angular/core';
|
|
2
|
-
import { R as RemoteContext, P as Props, a as RemoteModule, S as Shared, V as VitralConfig } from './types-
|
|
3
|
-
export { e as events } from './events-
|
|
2
|
+
import { R as RemoteContext, P as Props, a as RemoteModule, S as Shared, V as VitralConfig } from './types-L-qRmgLw.js';
|
|
3
|
+
export { e as events } from './events-C7OtGkNT.js';
|
|
4
4
|
export { n as navigate } from './navigate-BRG1WJUM.js';
|
|
5
5
|
import './errors-kjBv6IH_.js';
|
|
6
6
|
|
package/dist/angular.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-JRZ7FNAE.js";
|
|
4
|
+
import "./chunk-QIGE3XYA.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7VQLAFIO.js";
|
|
11
11
|
import {
|
|
12
12
|
configure
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-GAVXPS5X.js";
|
|
14
|
+
import "./chunk-PHVXXDWT.js";
|
|
15
|
+
import "./chunk-6EFYG6N7.js";
|
|
16
|
+
import "./chunk-NDB5GJMS.js";
|
|
17
|
+
import "./chunk-U4QBQQQJ.js";
|
|
18
|
+
import "./chunk-M7AYWO4W.js";
|
|
18
19
|
import "./chunk-JWDDXX5O.js";
|
|
19
20
|
import "./chunk-2Z4OH3BP.js";
|
|
20
21
|
import "./chunk-4E33RZMM.js";
|
|
21
22
|
import {
|
|
22
23
|
events,
|
|
23
24
|
navigate
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-RKYDVK2P.js";
|
|
26
|
+
import "./chunk-VKY4TKRT.js";
|
|
26
27
|
import "./chunk-MLKGABMK.js";
|
|
27
28
|
|
|
28
29
|
// src/angular.ts
|
package/dist/auto.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-JRZ7FNAE.js";
|
|
4
|
+
import "./chunk-QIGE3XYA.js";
|
|
5
|
+
import "./chunk-7VQLAFIO.js";
|
|
6
|
+
import "./chunk-GAVXPS5X.js";
|
|
7
|
+
import "./chunk-PHVXXDWT.js";
|
|
8
|
+
import "./chunk-6EFYG6N7.js";
|
|
9
|
+
import "./chunk-NDB5GJMS.js";
|
|
10
|
+
import "./chunk-U4QBQQQJ.js";
|
|
11
|
+
import "./chunk-M7AYWO4W.js";
|
|
11
12
|
import "./chunk-JWDDXX5O.js";
|
|
12
13
|
import "./chunk-2Z4OH3BP.js";
|
|
13
14
|
import "./chunk-4E33RZMM.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import
|
|
15
|
+
import "./chunk-RKYDVK2P.js";
|
|
16
|
+
import {
|
|
17
|
+
protocol
|
|
18
|
+
} from "./chunk-VKY4TKRT.js";
|
|
16
19
|
import "./chunk-MLKGABMK.js";
|
|
17
20
|
|
|
18
21
|
// src/auto.ts
|
|
22
|
+
var me = typeof document != "undefined" ? [...document.querySelectorAll("script[data-origins]")].find((s) => s.src === import.meta.url) : void 0;
|
|
23
|
+
var origins = me?.dataset.origins?.split(/\s+/).filter(Boolean).map((o) => new URL(o, location.href).origin);
|
|
24
|
+
if (origins?.length) protocol().configure({ trusted: [...protocol().settings().trusted ?? [], ...origins] });
|
|
19
25
|
defineVitralElement();
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
mounted,
|
|
5
5
|
report,
|
|
6
6
|
reported
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
8
|
+
import "./chunk-M7AYWO4W.js";
|
|
8
9
|
import "./chunk-JWDDXX5O.js";
|
|
9
10
|
import {
|
|
10
11
|
protocol
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VKY4TKRT.js";
|
|
12
13
|
import "./chunk-MLKGABMK.js";
|
|
13
14
|
|
|
14
15
|
// src/core/capture.ts
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
absolute
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NDB5GJMS.js";
|
|
4
4
|
import {
|
|
5
5
|
RemoteError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
7
|
+
import {
|
|
8
|
+
tr
|
|
9
|
+
} from "./chunk-M7AYWO4W.js";
|
|
7
10
|
import {
|
|
8
11
|
ctxHooks
|
|
9
12
|
} from "./chunk-JWDDXX5O.js";
|
|
10
13
|
import {
|
|
11
14
|
protocol
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VKY4TKRT.js";
|
|
13
16
|
import "./chunk-MLKGABMK.js";
|
|
14
17
|
|
|
15
18
|
// src/core/channel.ts
|
|
@@ -19,7 +22,7 @@ var watching = /* @__PURE__ */ new Map();
|
|
|
19
22
|
var abandoned = {};
|
|
20
23
|
var id;
|
|
21
24
|
async function pick(name, entry, channel) {
|
|
22
|
-
if (typeof channel.stable != "string") throw new RemoteError("INVALID_MODULE", name, `canal inv\xE1lido em ${entry.url}: falta "stable"`);
|
|
25
|
+
if (typeof channel.stable != "string") throw new RemoteError("INVALID_MODULE", name, tr(`canal inv\xE1lido em ${entry.url}: falta "stable"`, `invalid channel at ${entry.url}: missing "stable"`));
|
|
23
26
|
ctxHooks.watch = watch;
|
|
24
27
|
const ctx = { name, bucket: bucket(name) };
|
|
25
28
|
const { canary, stable } = channel;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RemoteError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
4
|
+
import {
|
|
5
|
+
tr
|
|
6
|
+
} from "./chunk-M7AYWO4W.js";
|
|
4
7
|
|
|
5
8
|
// src/core/integrity.ts
|
|
6
9
|
var clean = (b64) => b64.replace(/-/g, "+").replace(/_/g, "/").replace(/=/g, "");
|
|
7
10
|
async function verifyIntegrity(name, bytes, integrity) {
|
|
8
11
|
const hashes = integrity.split(/\s+/).map((token) => /^sha(256|384|512)-([\w+/=-]+)/.exec(token)).filter((m) => !!m);
|
|
9
|
-
if (!hashes.length) throw new RemoteError("INTEGRITY", name, `formato de integrity inv\xE1lido: ${integrity}`);
|
|
12
|
+
if (!hashes.length) throw new RemoteError("INTEGRITY", name, tr(`formato de integrity inv\xE1lido: ${integrity}`, `invalid integrity format: ${integrity}`));
|
|
10
13
|
const bits = Math.max(...hashes.map((m) => +m[1]));
|
|
11
14
|
const actual = btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-" + bits, bytes))));
|
|
12
15
|
const expected = hashes.filter((m) => +m[1] === bits).map((m) => m[2]);
|
|
13
16
|
if (!expected.some((h) => clean(h) === clean(actual))) {
|
|
14
|
-
throw new RemoteError("INTEGRITY", name, `o hash n\xE3o confere: esperado sha${bits}-${expected.join(" ou ")}, obtido sha${bits}-${actual}`);
|
|
17
|
+
throw new RemoteError("INTEGRITY", name, tr(`o hash n\xE3o confere: esperado sha${bits}-${expected.join(" ou ")}, obtido sha${bits}-${actual}`, `hash mismatch: expected sha${bits}-${expected.join(" or ")}, got sha${bits}-${actual}`));
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifyIntegrity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-24GEJNHQ.js";
|
|
4
4
|
import {
|
|
5
5
|
dedupeModule
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PHVXXDWT.js";
|
|
7
7
|
import {
|
|
8
8
|
addLink,
|
|
9
9
|
fetchBytes,
|
|
10
10
|
retryUrl,
|
|
11
11
|
withTimeout
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NDB5GJMS.js";
|
|
13
13
|
import {
|
|
14
14
|
RemoteError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
16
16
|
import {
|
|
17
17
|
__export
|
|
18
18
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addLink,
|
|
3
3
|
fetchBytes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NDB5GJMS.js";
|
|
5
5
|
import {
|
|
6
6
|
protocol
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VKY4TKRT.js";
|
|
8
8
|
|
|
9
9
|
// src/core/css.ts
|
|
10
10
|
var loadedCss = /* @__PURE__ */ new WeakMap();
|
|
@@ -23,11 +23,11 @@ function fetchCssText(href, integrity, priority) {
|
|
|
23
23
|
return p;
|
|
24
24
|
}
|
|
25
25
|
function prefetchCss(r, shadow, priority = "auto") {
|
|
26
|
-
if (shadow && adopts()) import("./shadow-
|
|
26
|
+
if (shadow && adopts()) import("./shadow-H3CCEKCL.js").then((m) => m.prefetch(r, priority), noop);
|
|
27
27
|
else for (const href of r.css) if (!document.querySelector(`link[href="${href}"]`)) addLink("preload", href, { as: "style", integrity: r.sri?.[href] ?? "", fetchPriority: priority });
|
|
28
28
|
}
|
|
29
29
|
function injectStyles(r, shadow, make, styles) {
|
|
30
|
-
return shadow ? import("./shadow-
|
|
30
|
+
return shadow ? import("./shadow-H3CCEKCL.js").then((m) => m.attachShadowRoot(shadow, make, r, protocol().settings().styles, styles)) : injectCss(r.css, null, r.sri).then(() => [noop]);
|
|
31
31
|
}
|
|
32
32
|
function injectCss(urls, root, sri = {}) {
|
|
33
33
|
const owner = root ?? document;
|
|
@@ -3,20 +3,24 @@ import {
|
|
|
3
3
|
loadFile,
|
|
4
4
|
registerSrc,
|
|
5
5
|
resolveEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GAVXPS5X.js";
|
|
7
7
|
import {
|
|
8
8
|
injectStyles
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6EFYG6N7.js";
|
|
10
10
|
import {
|
|
11
11
|
metric
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NDB5GJMS.js";
|
|
13
13
|
import {
|
|
14
14
|
RemoteError,
|
|
15
15
|
fail,
|
|
16
16
|
isRemoteError,
|
|
17
17
|
mounted,
|
|
18
18
|
report
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
20
|
+
import {
|
|
21
|
+
isPt,
|
|
22
|
+
tr
|
|
23
|
+
} from "./chunk-M7AYWO4W.js";
|
|
20
24
|
import {
|
|
21
25
|
ctxHooks
|
|
22
26
|
} from "./chunk-JWDDXX5O.js";
|
|
@@ -24,10 +28,15 @@ import {
|
|
|
24
28
|
events,
|
|
25
29
|
navigate,
|
|
26
30
|
scopedEvents
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RKYDVK2P.js";
|
|
28
32
|
import {
|
|
29
33
|
protocol
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VKY4TKRT.js";
|
|
35
|
+
|
|
36
|
+
// src/core/messages.ts
|
|
37
|
+
var PT = { loading: "Carregando\u2026", error: "N\xE3o foi poss\xEDvel carregar.", retry: "Tentar de novo" };
|
|
38
|
+
var EN = { loading: "Loading\u2026", error: "Could not load.", retry: "Try again" };
|
|
39
|
+
var messages = () => ({ ...isPt() ? PT : EN, ...protocol().settings().messages });
|
|
31
40
|
|
|
32
41
|
// src/core/updates.ts
|
|
33
42
|
var versions = /* @__PURE__ */ new Map();
|
|
@@ -87,7 +96,7 @@ var noop = () => {
|
|
|
87
96
|
async function checkUpdates() {
|
|
88
97
|
const p = protocol();
|
|
89
98
|
const found = [];
|
|
90
|
-
const { splitName } = await import("./expose-
|
|
99
|
+
const { splitName } = await import("./expose-ZDAACD24.js");
|
|
91
100
|
const remotes = /* @__PURE__ */ new Map();
|
|
92
101
|
for (const name of live.keys()) {
|
|
93
102
|
const root = splitName(name)[0];
|
|
@@ -130,10 +139,15 @@ function setFrameMounter(mounter) {
|
|
|
130
139
|
}
|
|
131
140
|
async function mountOnce(target, name, props, options) {
|
|
132
141
|
const p = protocol();
|
|
142
|
+
const { signal } = options;
|
|
143
|
+
const stop = () => signal?.throwIfAborted();
|
|
144
|
+
stop();
|
|
133
145
|
await p.pending();
|
|
146
|
+
stop();
|
|
134
147
|
const isolate = options.isolate ?? registered(name)?.isolate ?? p.settings().isolate;
|
|
135
|
-
if (isolate === "iframe") return (frames ?? (await import("./reframe-
|
|
136
|
-
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-
|
|
148
|
+
if (isolate === "iframe") return (frames ?? (await import("./reframe-SQLGQC6U.js")).noFrames)(target, name, props, options).catch(fail);
|
|
149
|
+
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-SQLGQC6U.js")).load : load)(name, isolate, options.priority);
|
|
150
|
+
stop();
|
|
137
151
|
const untrack = track(name, resolved);
|
|
138
152
|
ctxHooks.watch?.(name);
|
|
139
153
|
const label = resolved.name ?? name;
|
|
@@ -147,10 +161,17 @@ async function mountOnce(target, name, props, options) {
|
|
|
147
161
|
let t = performance.now();
|
|
148
162
|
const [release, portal = document.body, shadowRoot = null, registry = customElements, el = target.appendChild(make())] = await injectStyles(
|
|
149
163
|
resolved,
|
|
150
|
-
|
|
164
|
+
// shadow e reframe põem o DOM do remote num shadow root.
|
|
165
|
+
(isolate === "shadow" || isolate === "reframe") && target,
|
|
151
166
|
make,
|
|
152
167
|
options.styles
|
|
153
168
|
);
|
|
169
|
+
if (signal?.aborted) {
|
|
170
|
+
untrack();
|
|
171
|
+
release();
|
|
172
|
+
el.remove();
|
|
173
|
+
stop();
|
|
174
|
+
}
|
|
154
175
|
metric(name, "css", t);
|
|
155
176
|
t = performance.now();
|
|
156
177
|
const scoped = scopedEvents();
|
|
@@ -182,10 +203,10 @@ async function mountOnce(target, name, props, options) {
|
|
|
182
203
|
scoped.dispose();
|
|
183
204
|
release();
|
|
184
205
|
el.remove();
|
|
185
|
-
throw report(new RemoteError("MOUNT_FAILED", label, "erro ao montar", e), resolved);
|
|
206
|
+
throw report(new RemoteError("MOUNT_FAILED", label, tr("erro ao montar", "mount failed"), e), resolved);
|
|
186
207
|
}
|
|
187
208
|
let alive = true;
|
|
188
|
-
|
|
209
|
+
const handle2 = {
|
|
189
210
|
update(next) {
|
|
190
211
|
if (alive) mounted2.update?.(next);
|
|
191
212
|
},
|
|
@@ -202,6 +223,11 @@ async function mountOnce(target, name, props, options) {
|
|
|
202
223
|
}
|
|
203
224
|
}
|
|
204
225
|
};
|
|
226
|
+
if (signal?.aborted) {
|
|
227
|
+
handle2.unmount();
|
|
228
|
+
stop();
|
|
229
|
+
}
|
|
230
|
+
return handle2;
|
|
205
231
|
}
|
|
206
232
|
function registered(name) {
|
|
207
233
|
const p = protocol();
|
|
@@ -219,6 +245,7 @@ function createSlot(target, options) {
|
|
|
219
245
|
let handle2 = null;
|
|
220
246
|
let holder = null;
|
|
221
247
|
let token = 0;
|
|
248
|
+
let abort = null;
|
|
222
249
|
let status = "loading";
|
|
223
250
|
const setStatus = (s, e = null) => {
|
|
224
251
|
status = s;
|
|
@@ -226,6 +253,8 @@ function createSlot(target, options) {
|
|
|
226
253
|
options.onStatus?.(s, e);
|
|
227
254
|
};
|
|
228
255
|
const teardown = () => {
|
|
256
|
+
abort?.abort();
|
|
257
|
+
abort = null;
|
|
229
258
|
handle2?.unmount();
|
|
230
259
|
handle2 = null;
|
|
231
260
|
holder?.remove();
|
|
@@ -243,7 +272,8 @@ function createSlot(target, options) {
|
|
|
243
272
|
setStatus("error", isRemoteError(e) ? e : new RemoteError("MOUNT_FAILED", name, String(e), e));
|
|
244
273
|
};
|
|
245
274
|
const initial = props;
|
|
246
|
-
|
|
275
|
+
abort = new AbortController();
|
|
276
|
+
mountRemote(holder, name, props, { isolate, priority: options.priority, styles: options.styles, onError: fail2, signal: abort.signal }).then((h) => {
|
|
247
277
|
if (my !== token) return h.unmount();
|
|
248
278
|
handle2 = h;
|
|
249
279
|
if (props !== initial) h.update?.(props);
|
|
@@ -478,7 +508,7 @@ function handle(store, key, by, track2 = (off) => off, token) {
|
|
|
478
508
|
const get = () => store.get(key);
|
|
479
509
|
const set = (value) => {
|
|
480
510
|
if (store.set(key, value, token, by)) return;
|
|
481
|
-
const e = new RemoteError("SHARED_READONLY", by || "shared", `s\xF3 o dono altera "${key}"`);
|
|
511
|
+
const e = new RemoteError("SHARED_READONLY", by || "shared", tr(`s\xF3 o dono altera "${key}"`, `only the owner can change "${key}"`));
|
|
482
512
|
if (isDev()) throw e;
|
|
483
513
|
console.warn(e.message);
|
|
484
514
|
};
|
|
@@ -575,6 +605,7 @@ function serializeShared(values) {
|
|
|
575
605
|
}
|
|
576
606
|
|
|
577
607
|
export {
|
|
608
|
+
messages,
|
|
578
609
|
track,
|
|
579
610
|
refresh,
|
|
580
611
|
refreshable,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dedupeModule,
|
|
3
3
|
sriModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PHVXXDWT.js";
|
|
5
5
|
import {
|
|
6
6
|
prefetchCss
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6EFYG6N7.js";
|
|
8
8
|
import {
|
|
9
9
|
absolute,
|
|
10
10
|
addLink,
|
|
@@ -13,30 +13,35 @@ import {
|
|
|
13
13
|
pageOrigin,
|
|
14
14
|
withRetry,
|
|
15
15
|
withTimeout
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NDB5GJMS.js";
|
|
17
17
|
import {
|
|
18
18
|
RemoteError,
|
|
19
19
|
fail,
|
|
20
20
|
isRemoteError,
|
|
21
21
|
report
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
23
|
+
import {
|
|
24
|
+
tr
|
|
25
|
+
} from "./chunk-M7AYWO4W.js";
|
|
23
26
|
import {
|
|
24
27
|
protocol
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-VKY4TKRT.js";
|
|
26
29
|
|
|
27
30
|
// src/core/registry.ts
|
|
28
31
|
function configure(config) {
|
|
29
32
|
const p = protocol();
|
|
30
33
|
const { remotes, dedupe, ...rest } = config;
|
|
31
34
|
p.configure(rest);
|
|
32
|
-
if (rest.captureGlobalErrors) import("./capture-
|
|
35
|
+
if (rest.captureGlobalErrors) import("./capture-5TUYE67Q.js").then((m) => m.capture());
|
|
33
36
|
if (dedupe) p.pending(dedupeModule().then((m) => m.offer(p, dedupe)).catch(() => {
|
|
34
37
|
}));
|
|
35
38
|
if (typeof remotes === "string") {
|
|
36
39
|
const url = absolute(remotes);
|
|
37
|
-
p.
|
|
38
|
-
|
|
39
|
-
)
|
|
40
|
+
const run = () => withRetry(p.settings().retries, () => fetchJson(url, p.settings().timeout, "remotes", { cache: "no-cache" })).then(
|
|
41
|
+
(map) => registerAll(map, url)
|
|
42
|
+
);
|
|
43
|
+
if (p.pendingRetry) p.pendingRetry(run);
|
|
44
|
+
else p.pending(run()).catch(() => {
|
|
40
45
|
});
|
|
41
46
|
} else if (remotes) {
|
|
42
47
|
registerAll(remotes);
|
|
@@ -44,7 +49,7 @@ function configure(config) {
|
|
|
44
49
|
}
|
|
45
50
|
function register(name, entry) {
|
|
46
51
|
const e = typeof entry === "string" ? { url: entry } : entry;
|
|
47
|
-
if (!e.url && !e.module) throw new RemoteError("NOT_REGISTERED", name, "informe url ou module");
|
|
52
|
+
if (!e.url && !e.module) throw new RemoteError("NOT_REGISTERED", name, tr("informe url ou module", "provide url or module"));
|
|
48
53
|
if (!e.url) return protocol().register(name, e);
|
|
49
54
|
const url = absolute(e.url);
|
|
50
55
|
protocol().register(name, { ...e, url });
|
|
@@ -57,7 +62,7 @@ function registerSrc(src, name, trusted = true) {
|
|
|
57
62
|
const p = protocol();
|
|
58
63
|
const url = absolute(src);
|
|
59
64
|
const key = name || url;
|
|
60
|
-
if (p.entry(key)?.url !== url) p.register(key, { url });
|
|
65
|
+
if (p.entry(key)?.url !== url) p.register(key, trusted || /^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname) ? { url } : { url, untrusted: true });
|
|
61
66
|
const origin = new URL(url).origin;
|
|
62
67
|
const list = p.settings().trusted ?? [];
|
|
63
68
|
if (trusted && !list.includes(origin)) p.configure({ trusted: [...list, origin] });
|
|
@@ -75,7 +80,7 @@ function checkOrigin(name, url) {
|
|
|
75
80
|
const { allowedOrigins, trusted = [] } = p.settings();
|
|
76
81
|
const allowed = [...allowedOrigins ?? [pageOrigin(), ...p.origins()].filter(Boolean), ...trusted];
|
|
77
82
|
if (allowed.includes("*") || allowed.includes(origin) || url.startsWith("blob:")) return;
|
|
78
|
-
throw new RemoteError("ORIGIN_BLOCKED", name, `origem ${origin} n\xE3o est\xE1 em allowedOrigins`);
|
|
83
|
+
throw new RemoteError("ORIGIN_BLOCKED", name, tr(`origem ${origin} n\xE3o est\xE1 em allowedOrigins`, `origin ${origin} is not in allowedOrigins`));
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
// src/core/policy.ts
|
|
@@ -106,7 +111,7 @@ function loadRemote(name) {
|
|
|
106
111
|
return load(name).then((r) => r.module);
|
|
107
112
|
}
|
|
108
113
|
function loadModule(name) {
|
|
109
|
-
return import("./expose-
|
|
114
|
+
return import("./expose-ZDAACD24.js").then((m) => m.resolveModule(name, (n) => loadFile(n))).catch(fail);
|
|
110
115
|
}
|
|
111
116
|
function preload(name, options = {}) {
|
|
112
117
|
const done = load(name);
|
|
@@ -146,7 +151,7 @@ function warmSsr(holder) {
|
|
|
146
151
|
}
|
|
147
152
|
function load(name, isolate, priority) {
|
|
148
153
|
const file = (n) => loadFile(n, isolate, priority);
|
|
149
|
-
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-
|
|
154
|
+
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-ZDAACD24.js").then((m) => m.resolveTarget(name, file))).catch(fail);
|
|
150
155
|
}
|
|
151
156
|
function loadFile(name, isolate, priority) {
|
|
152
157
|
const p = protocol();
|
|
@@ -159,7 +164,7 @@ function loadFile(name, isolate, priority) {
|
|
|
159
164
|
await p.pending();
|
|
160
165
|
const override = await devOverride(name);
|
|
161
166
|
const entry = override ? { isolate: p.entry(name)?.isolate, ...override } : p.entry(name);
|
|
162
|
-
if (!entry) throw new RemoteError("NOT_REGISTERED", name, "remote n\xE3o registrado. Use configure({ remotes }).");
|
|
167
|
+
if (!entry) throw new RemoteError("NOT_REGISTERED", name, tr("remote n\xE3o registrado. Use configure({ remotes }).", "remote not registered. Use configure({ remotes })."));
|
|
163
168
|
if (entry.module) return await loadLocal(name, entry);
|
|
164
169
|
let t = performance.now();
|
|
165
170
|
resolved = await resolveEntry(name, entry, priority, entry.url === known?.url ? early : void 0);
|
|
@@ -168,7 +173,7 @@ function loadFile(name, isolate, priority) {
|
|
|
168
173
|
if (d?.some((x) => x.uses)) (p.uses ??= {})[resolved.split.entry] = Object.fromEntries(d.map((x) => [x.name, x.uses]));
|
|
169
174
|
prefetchCss(resolved, (isolate ?? resolved.isolate ?? p.settings().isolate) === "shadow", priority);
|
|
170
175
|
const { i18n, timeout } = p.settings();
|
|
171
|
-
const words = resolved.i18n && i18n && import("./i18n-
|
|
176
|
+
const words = resolved.i18n && i18n && import("./i18n-S5XJHITJ.js").then((m) => m.loadTranslations(name, resolved.i18n, resolved.sri ?? {}, i18n, timeout, priority)).catch((e) => console.warn(`[vitral] ${name}: tradu\xE7\xF5es n\xE3o carregaram`, e));
|
|
172
177
|
t = performance.now();
|
|
173
178
|
const ns = await withRetry(p.settings().retries, () => importModule(name, resolved));
|
|
174
179
|
await words;
|
|
@@ -180,7 +185,7 @@ function loadFile(name, isolate, priority) {
|
|
|
180
185
|
});
|
|
181
186
|
}
|
|
182
187
|
function devOverride(name) {
|
|
183
|
-
if (overrides()) return import("./overrides-
|
|
188
|
+
if (overrides()) return import("./overrides-VDR33GS7.js").then((m) => m.overrideFor(name));
|
|
184
189
|
}
|
|
185
190
|
function overrides() {
|
|
186
191
|
try {
|
|
@@ -197,11 +202,15 @@ async function loadLocal(name, entry) {
|
|
|
197
202
|
async function resolveEntry(name, entry, priority, early) {
|
|
198
203
|
checkOrigin(name, entry.url);
|
|
199
204
|
const keys = signed(entry);
|
|
200
|
-
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await (
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await withRetry(protocol().settings().retries, () => {
|
|
206
|
+
const f = early ?? manifestOf(entry.url, name, priority, keys);
|
|
207
|
+
early = void 0;
|
|
208
|
+
return f;
|
|
209
|
+
}) : { name, entry: entry.url });
|
|
210
|
+
if (m?.stable) return resolveEntry(name, await (await import("./channel-LW7J2VLA.js")).pick(name, entry, m), priority);
|
|
211
|
+
if (typeof m?.entry !== "string") throw new RemoteError("INVALID_MODULE", name, tr(`manifesto inv\xE1lido em ${entry.url}`, `invalid manifest at ${entry.url}`));
|
|
203
212
|
if (m.contract && (entry.contract || protocol().settings().contract)) {
|
|
204
|
-
const why = await (await import("./contract-
|
|
213
|
+
const why = await (await import("./contract-YNLXHJL7.js")).checkContract(m.contract, entry.contract);
|
|
205
214
|
if (why) throw new RemoteError("CONTRACT_MISMATCH", name, why);
|
|
206
215
|
}
|
|
207
216
|
const abs = (u) => absolute(u, entry.url);
|
|
@@ -268,7 +277,7 @@ async function importModule(name, r) {
|
|
|
268
277
|
/* webpackIgnore: true */
|
|
269
278
|
url
|
|
270
279
|
)).catch((e) => {
|
|
271
|
-
throw isRemoteError(e) ? e : new RemoteError("LOAD_FAILED", name, `falha ao importar ${r.entry}`, e);
|
|
280
|
+
throw isRemoteError(e) ? e : new RemoteError("LOAD_FAILED", name, tr(`falha ao importar ${r.entry}`, `failed to import ${r.entry}`), e);
|
|
272
281
|
});
|
|
273
282
|
if (!r.integrity) {
|
|
274
283
|
const n = plainFailed.get(r.entry);
|
|
@@ -285,12 +294,12 @@ async function importModule(name, r) {
|
|
|
285
294
|
return run(r.split.entry).catch((e) => again(e, 0));
|
|
286
295
|
}
|
|
287
296
|
const sri = await paths;
|
|
288
|
-
if (!sri) throw new RemoteError("LOAD_FAILED", name, "n\xE3o foi poss\xEDvel carregar o verificador de integrity");
|
|
297
|
+
if (!sri) throw new RemoteError("LOAD_FAILED", name, tr("n\xE3o foi poss\xEDvel carregar o verificador de integrity", "could not load the integrity checker"));
|
|
289
298
|
return sri.importVerified(name, r, run, timeout);
|
|
290
299
|
}
|
|
291
300
|
function mountable(name, r) {
|
|
292
301
|
if (typeof r.module?.mount != "function") {
|
|
293
|
-
throw new RemoteError("INVALID_MODULE", name, "o m\xF3dulo n\xE3o exporta mount(). Use defineRemote(), ou loadModule() para m\xF3dulo sem UI.");
|
|
302
|
+
throw new RemoteError("INVALID_MODULE", name, tr("o m\xF3dulo n\xE3o exporta mount(). Use defineRemote(), ou loadModule() para m\xF3dulo sem UI.", "the module does not export mount(). Use defineRemote(), or loadModule() for a module without UI."));
|
|
294
303
|
}
|
|
295
304
|
return r;
|
|
296
305
|
}
|
|
@@ -2,18 +2,19 @@ import {
|
|
|
2
2
|
hostSlot,
|
|
3
3
|
timings,
|
|
4
4
|
when
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QIGE3XYA.js";
|
|
6
6
|
import {
|
|
7
7
|
defineRemote,
|
|
8
8
|
memoSelect,
|
|
9
|
+
messages,
|
|
9
10
|
same,
|
|
10
11
|
shared
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7VQLAFIO.js";
|
|
12
13
|
import {
|
|
13
14
|
policy,
|
|
14
15
|
registerSrc,
|
|
15
16
|
warmSsr
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GAVXPS5X.js";
|
|
17
18
|
|
|
18
19
|
// src/element.ts
|
|
19
20
|
var Base = typeof HTMLElement === "undefined" ? class {
|
|
@@ -77,14 +78,14 @@ var VitralRemoteElement = class extends Base {
|
|
|
77
78
|
};
|
|
78
79
|
const ssr = true ? this.querySelector(":scope>[data-vitral-ssr]") : null;
|
|
79
80
|
if (ssr) {
|
|
80
|
-
const go = () => (warmSsr(ssr), import("./hydrate-
|
|
81
|
+
const go = () => (warmSsr(ssr), import("./hydrate-GRYEYDGZ.js").then((m) => this.isConnected && !this.#slot && (this.#slot = m.hydrateSlot(this, ssr, { ...options, props: this.#props }))));
|
|
81
82
|
if (policy() === "lazy") when(this, "visible", go);
|
|
82
83
|
else go();
|
|
83
84
|
} else this.#slot = hostSlot(this, options);
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
87
|
* Nome para montar. `src` em atributo é registrado sem entrar na allowlist:
|
|
87
|
-
* HTML injetado não pode liberar uma origem nova
|
|
88
|
+
* HTML injetado não pode liberar uma origem nova, com ou sem `allowedOrigins`.
|
|
88
89
|
*/
|
|
89
90
|
#name() {
|
|
90
91
|
const src = this.getAttribute("src");
|
|
@@ -102,14 +103,15 @@ var VitralRemoteElement = class extends Base {
|
|
|
102
103
|
box.setAttribute("data-vitral-default", status);
|
|
103
104
|
if (status === "loading") {
|
|
104
105
|
box.setAttribute("role", "status");
|
|
105
|
-
box.textContent =
|
|
106
|
+
box.textContent = messages().loading;
|
|
106
107
|
} else {
|
|
107
108
|
box.setAttribute("role", "alert");
|
|
108
109
|
const button = document.createElement("button");
|
|
109
110
|
button.type = "button";
|
|
110
|
-
|
|
111
|
+
const m = messages();
|
|
112
|
+
button.textContent = m.retry;
|
|
111
113
|
button.onclick = () => this.retry();
|
|
112
|
-
box.append(
|
|
114
|
+
box.append(m.error + " ", button);
|
|
113
115
|
}
|
|
114
116
|
this.prepend(this.#default = box);
|
|
115
117
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifyIntegrity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-24GEJNHQ.js";
|
|
4
4
|
import {
|
|
5
5
|
absolute,
|
|
6
6
|
fetchBytes
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NDB5GJMS.js";
|
|
8
8
|
import {
|
|
9
9
|
RemoteError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-U4QBQQQJ.js";
|
|
11
|
+
import {
|
|
12
|
+
tr
|
|
13
|
+
} from "./chunk-M7AYWO4W.js";
|
|
11
14
|
|
|
12
15
|
// src/core/i18n.ts
|
|
13
16
|
var asked = /* @__PURE__ */ new Map();
|
|
@@ -50,7 +53,7 @@ function load(name, files, sri, host, lng, timeout, priority) {
|
|
|
50
53
|
try {
|
|
51
54
|
data = JSON.parse(new TextDecoder().decode(bytes));
|
|
52
55
|
} catch (e) {
|
|
53
|
-
throw new RemoteError("INVALID_MODULE", name, `JSON inv\xE1lido em ${url}`, e);
|
|
56
|
+
throw new RemoteError("INVALID_MODULE", name, tr(`JSON inv\xE1lido em ${url}`, `invalid JSON at ${url}`), e);
|
|
54
57
|
}
|
|
55
58
|
host.add(pick, ns, data);
|
|
56
59
|
return true;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/core/lang.ts
|
|
2
|
+
var isPt = () => (
|
|
3
|
+
// Lê o protocolo sem `protocol()`: quem só lança um erro não carrega o estado da lib.
|
|
4
|
+
/^pt\b/i.test(
|
|
5
|
+
globalThis[/* @__PURE__ */ Symbol.for("vitral")]?.settings().language || globalThis.document?.documentElement.lang || globalThis.navigator?.language || ""
|
|
6
|
+
)
|
|
7
|
+
);
|
|
8
|
+
var tr = (pt, en) => isPt() ? pt : en;
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
isPt,
|
|
12
|
+
tr
|
|
13
|
+
};
|