vitral 0.3.0 → 0.4.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/angular.d.ts +2 -2
- package/dist/angular.js +7 -7
- package/dist/auto.js +7 -7
- package/dist/{capture-JYFERAPL.js → capture-TT5WBLJ6.js} +1 -1
- package/dist/channel-2YPYGX3J.js +95 -0
- package/dist/{chunk-AKNNHQ2H.js → chunk-463H6B56.js} +5 -0
- package/dist/chunk-54CBIZES.js +105 -0
- package/dist/{chunk-ZAC6QQI6.js → chunk-6EX5KYT5.js} +4 -4
- package/dist/{chunk-3YXI3G34.js → chunk-BCC25ANK.js} +11 -5
- package/dist/{chunk-TD4S3IHA.js → chunk-EMSB2NVX.js} +10 -8
- package/dist/{chunk-SDB5AZEI.js → chunk-IH3ZT3QU.js} +2 -2
- package/dist/{chunk-GNHCZRQP.js → chunk-TW7KYJQ6.js} +1 -1
- package/dist/{chunk-AH7KNMBW.js → chunk-UYOPJ4XQ.js} +1 -1
- package/dist/{chunk-IHTUM6LT.js → chunk-W6322KGP.js} +2 -2
- package/dist/{chunk-I3VSKSAZ.js → chunk-WD4CDGDZ.js} +21 -20
- package/dist/cli.js +1152 -37
- package/dist/devtools.d.ts +32 -2
- package/dist/devtools.js +27 -12
- package/dist/element.d.ts +12 -3
- package/dist/element.js +7 -7
- package/dist/embed.js +2 -0
- package/dist/{events-D5gs7rff.d.ts → events-Dkpkw_Sv.d.ts} +1 -1
- package/dist/expose-OVWTPHH5.js +15 -0
- package/dist/federation.d.ts +89 -0
- package/dist/federation.js +101 -0
- package/dist/iframe.js +7 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/overrides-NP754HY7.js +27 -0
- package/dist/preact.d.ts +4 -4
- package/dist/preact.js +6 -6
- package/dist/react.d.ts +3 -3
- package/dist/react.js +6 -6
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +5 -5
- package/dist/{shadow-6HELCHCJ.js → shadow-PVSETNMZ.js} +66 -5
- package/dist/single-spa.d.ts +40 -0
- package/dist/single-spa.js +52 -0
- package/dist/{slot-DqXTwGbs.d.ts → slot-UPg6ob9v.d.ts} +1 -1
- package/dist/solid.d.ts +3 -3
- package/dist/solid.js +6 -6
- package/dist/{sri-JMX6JLQP.js → sri-M7ZRU57G.js} +40 -10
- package/dist/svelte.d.ts +4 -4
- package/dist/svelte.js +6 -6
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +5 -5
- package/dist/{types-Czvm-siZ.d.ts → types-CA2p9KHC.d.ts} +112 -4
- package/dist/vite.d.ts +18 -0
- package/dist/vite.js +341 -35
- package/dist/vue.d.ts +3 -3
- package/dist/vue.js +6 -6
- package/package.json +79 -21
- package/dist/chunk-DXORSF4X.js +0 -42
- package/dist/expose-JUOUN5N5.js +0 -15
- package/dist/overrides-NZAIUGK5.js +0 -15
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-CA2p9KHC.js';
|
|
3
|
+
export { e as events } from './events-Dkpkw_Sv.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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-BCC25ANK.js";
|
|
4
|
+
import "./chunk-W6322KGP.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
events,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
navigate,
|
|
10
10
|
same,
|
|
11
11
|
shared
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WD4CDGDZ.js";
|
|
13
13
|
import {
|
|
14
14
|
configure
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-EMSB2NVX.js";
|
|
16
|
+
import "./chunk-6EX5KYT5.js";
|
|
17
|
+
import "./chunk-TW7KYJQ6.js";
|
|
18
|
+
import "./chunk-463H6B56.js";
|
|
19
19
|
import "./chunk-GNPFWISJ.js";
|
|
20
20
|
|
|
21
21
|
// src/angular.ts
|
package/dist/auto.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
3
|
+
} from "./chunk-BCC25ANK.js";
|
|
4
|
+
import "./chunk-W6322KGP.js";
|
|
5
|
+
import "./chunk-WD4CDGDZ.js";
|
|
6
|
+
import "./chunk-EMSB2NVX.js";
|
|
7
|
+
import "./chunk-6EX5KYT5.js";
|
|
8
|
+
import "./chunk-TW7KYJQ6.js";
|
|
9
|
+
import "./chunk-463H6B56.js";
|
|
10
10
|
import "./chunk-GNPFWISJ.js";
|
|
11
11
|
|
|
12
12
|
// src/auto.ts
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
absolute
|
|
3
|
+
} from "./chunk-TW7KYJQ6.js";
|
|
4
|
+
import {
|
|
5
|
+
RemoteError,
|
|
6
|
+
ctxHooks
|
|
7
|
+
} from "./chunk-463H6B56.js";
|
|
8
|
+
import {
|
|
9
|
+
protocol
|
|
10
|
+
} from "./chunk-GNPFWISJ.js";
|
|
11
|
+
|
|
12
|
+
// src/core/channel.ts
|
|
13
|
+
var ROLLBACK_KEY = "vitral:rollback";
|
|
14
|
+
var ID_KEY = "vitral:id";
|
|
15
|
+
var watching = /* @__PURE__ */ new Map();
|
|
16
|
+
var abandoned = {};
|
|
17
|
+
var id;
|
|
18
|
+
async function pick(name, entry, channel) {
|
|
19
|
+
if (typeof channel.stable != "string") throw new RemoteError("INVALID_MODULE", name, `canal inv\xE1lido em ${entry.url}: falta "stable"`);
|
|
20
|
+
ctxHooks.watch = watch;
|
|
21
|
+
const ctx = { name, bucket: bucket(name) };
|
|
22
|
+
const { canary, stable } = channel;
|
|
23
|
+
let version = await entry.resolve?.(channel, ctx) ?? (canary && ctx.bucket < canary.percent ? canary.version : stable);
|
|
24
|
+
if (version !== stable && rolledBack()[name] === version) version = stable;
|
|
25
|
+
if (version === stable || entry.rollback === false) watching.delete(name);
|
|
26
|
+
else if (watching.get(name)?.from !== version) {
|
|
27
|
+
watching.set(name, { from: version, to: stable, errors: 0, mounts: 0, max: { errors: 3, mounts: 20, ...entry.rollback } });
|
|
28
|
+
}
|
|
29
|
+
return { ...entry, url: versionUrl(version, entry.url), integrity: void 0, manifest: void 0 };
|
|
30
|
+
}
|
|
31
|
+
var versionUrl = (version, channel) => absolute(/[/:]|\.(m?js|json)$/.test(version) ? version : `${version}/vitral.json`, channel);
|
|
32
|
+
function bucket(name) {
|
|
33
|
+
const key = protocol().settings().canaryKey ?? browserId();
|
|
34
|
+
let h = 2166136261;
|
|
35
|
+
for (const c of `${key}:${name}`) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
|
|
36
|
+
return (h >>> 0) % 100;
|
|
37
|
+
}
|
|
38
|
+
function browserId() {
|
|
39
|
+
try {
|
|
40
|
+
id ??= localStorage.getItem(ID_KEY) ?? void 0;
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
if (!id) {
|
|
44
|
+
id = Math.random().toString(36).slice(2);
|
|
45
|
+
try {
|
|
46
|
+
localStorage.setItem(ID_KEY, id);
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return id;
|
|
51
|
+
}
|
|
52
|
+
function rolledBack() {
|
|
53
|
+
try {
|
|
54
|
+
return { ...JSON.parse(sessionStorage.getItem(ROLLBACK_KEY) || "{}"), ...abandoned };
|
|
55
|
+
} catch {
|
|
56
|
+
return abandoned;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function watch(name, error) {
|
|
60
|
+
for (const [key, w] of watching) {
|
|
61
|
+
if (name !== key && !name.startsWith(key + "/")) continue;
|
|
62
|
+
if (!error) {
|
|
63
|
+
if (++w.mounts > w.max.mounts) w.mounts = 1, w.errors = 0;
|
|
64
|
+
} else if (++w.errors >= w.max.errors) {
|
|
65
|
+
rollback(key, w);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function rollback(name, w) {
|
|
70
|
+
watching.delete(name);
|
|
71
|
+
abandoned = { ...rolledBack(), [name]: w.from };
|
|
72
|
+
try {
|
|
73
|
+
sessionStorage.setItem(ROLLBACK_KEY, JSON.stringify(abandoned));
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
console.warn(`[vitral] ${name}: ${w.errors} erros em ${w.mounts} montagens da vers\xE3o ${w.from}; voltando para ${w.to}`);
|
|
77
|
+
try {
|
|
78
|
+
protocol().settings().onRollback?.({ name, from: w.from, to: w.to, errors: w.errors, mounts: w.mounts });
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
const p = protocol();
|
|
82
|
+
p.register(name, p.entry(name));
|
|
83
|
+
p.events.emit("vitral:refresh", name);
|
|
84
|
+
}
|
|
85
|
+
function resetChannels() {
|
|
86
|
+
watching.clear();
|
|
87
|
+
abandoned = {};
|
|
88
|
+
id = void 0;
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
bucket,
|
|
92
|
+
pick,
|
|
93
|
+
resetChannels,
|
|
94
|
+
versionUrl
|
|
95
|
+
};
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
protocol
|
|
3
3
|
} from "./chunk-GNPFWISJ.js";
|
|
4
4
|
|
|
5
|
+
// src/core/hooks.ts
|
|
6
|
+
var ctxHooks = {};
|
|
7
|
+
|
|
5
8
|
// src/core/errors.ts
|
|
6
9
|
var ERROR_DOCS = "https://joaogabriel15.github.io/vitral/erros/";
|
|
7
10
|
var RemoteError = class extends Error {
|
|
@@ -28,6 +31,7 @@ function report(e, from) {
|
|
|
28
31
|
protocol().settings().onError?.(e);
|
|
29
32
|
} catch {
|
|
30
33
|
}
|
|
34
|
+
ctxHooks.watch?.(e.remote, e);
|
|
31
35
|
}
|
|
32
36
|
return e;
|
|
33
37
|
}
|
|
@@ -36,6 +40,7 @@ var fail = (e) => {
|
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
export {
|
|
43
|
+
ctxHooks,
|
|
39
44
|
RemoteError,
|
|
40
45
|
isRemoteError,
|
|
41
46
|
mounted,
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
protocol
|
|
3
|
+
} from "./chunk-GNPFWISJ.js";
|
|
4
|
+
|
|
5
|
+
// src/core/overrides.ts
|
|
6
|
+
var OVERRIDES_KEY = "vitral:overrides";
|
|
7
|
+
function overridesEnabled() {
|
|
8
|
+
return !!protocol().settings().devOverrides || typeof location !== "undefined" && /^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname);
|
|
9
|
+
}
|
|
10
|
+
var manifestUrl = (url) => /\.(json|m?js)(\?|$)/.test(url) ? url : url.replace(/\/?$/, "/vitral.json");
|
|
11
|
+
var isRef = (value) => /^[\w.-]+$/.test(value);
|
|
12
|
+
var read = (store) => {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(store().getItem(OVERRIDES_KEY) ?? "{}") ?? {};
|
|
15
|
+
} catch {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var write = (store, all) => {
|
|
20
|
+
try {
|
|
21
|
+
if (Object.keys(all).length) store().setItem(OVERRIDES_KEY, JSON.stringify(all));
|
|
22
|
+
else store().removeItem(OVERRIDES_KEY);
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var local = () => localStorage;
|
|
27
|
+
var session = () => sessionStorage;
|
|
28
|
+
var storedOverrides = () => read(local);
|
|
29
|
+
function storeOverride(name, value) {
|
|
30
|
+
const all = storedOverrides();
|
|
31
|
+
if (value) all[name] = isRef(value) ? value : manifestUrl(value);
|
|
32
|
+
else delete all[name];
|
|
33
|
+
write(local, all);
|
|
34
|
+
}
|
|
35
|
+
function tabOverrides() {
|
|
36
|
+
const all = read(session);
|
|
37
|
+
const pairs = new URLSearchParams(location.search).getAll("vitral").join(",").split(",");
|
|
38
|
+
if (!pairs.some(Boolean)) return all;
|
|
39
|
+
for (const pair of pairs) {
|
|
40
|
+
const at = pair.indexOf("@");
|
|
41
|
+
if (pair === "off") clearOverrides(), Object.keys(all).forEach((k) => delete all[k]);
|
|
42
|
+
else if (at > 0 && pair.slice(at + 1) === "off") delete all[pair.slice(0, at)];
|
|
43
|
+
else if (at > 0) all[pair.slice(0, at)] = pair.slice(at + 1);
|
|
44
|
+
}
|
|
45
|
+
write(session, all);
|
|
46
|
+
return all;
|
|
47
|
+
}
|
|
48
|
+
function clearOverrides() {
|
|
49
|
+
write(session, {});
|
|
50
|
+
write(local, {});
|
|
51
|
+
}
|
|
52
|
+
function dropOverride(name) {
|
|
53
|
+
for (const store of [session, local]) {
|
|
54
|
+
const all = read(store);
|
|
55
|
+
delete all[name];
|
|
56
|
+
write(store, all);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function resolveOverride(name, value) {
|
|
60
|
+
if (!isRef(value)) return new URL(manifestUrl(value), location.href).href;
|
|
61
|
+
const d = protocol().settings().devOverrides;
|
|
62
|
+
const preview = typeof d === "object" ? d.preview : void 0;
|
|
63
|
+
if (!preview) return;
|
|
64
|
+
const url = preview.replace(/\{name\}/g, encodeURIComponent(name)).replace(/\{ref\}/g, encodeURIComponent(value));
|
|
65
|
+
return new URL(manifestUrl(url), location.href).href;
|
|
66
|
+
}
|
|
67
|
+
function activeOverrides() {
|
|
68
|
+
const tab = tabOverrides();
|
|
69
|
+
const all = {};
|
|
70
|
+
for (const [source, map] of [["navegador", storedOverrides()], ["aba", tab]]) {
|
|
71
|
+
for (const [name, value] of Object.entries(map)) all[name] = { name, value, url: resolveOverride(name, value), source };
|
|
72
|
+
}
|
|
73
|
+
return Object.values(all);
|
|
74
|
+
}
|
|
75
|
+
var warned = /* @__PURE__ */ new Set();
|
|
76
|
+
function overrideFor(name) {
|
|
77
|
+
if (!overridesEnabled()) return;
|
|
78
|
+
const o = activeOverrides().find((o2) => o2.name === name);
|
|
79
|
+
if (!o) return;
|
|
80
|
+
const first = !warned.has(name) && warned.add(name);
|
|
81
|
+
if (!o.url) {
|
|
82
|
+
if (first) console.warn(`[vitral] override ${name}@${o.value} ignorado: falta configure({ devOverrides: { preview } })`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const p = protocol();
|
|
86
|
+
const trusted = p.settings().trusted ?? [];
|
|
87
|
+
const origin = new URL(o.url).origin;
|
|
88
|
+
if (!trusted.includes(origin)) p.configure({ trusted: [...trusted, origin] });
|
|
89
|
+
if (first) console.warn(`[vitral] override ativo: ${name} \u2192 ${o.url} (${o.source}). Para limpar: ?vitral=off`);
|
|
90
|
+
return { url: o.url };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
OVERRIDES_KEY,
|
|
95
|
+
overridesEnabled,
|
|
96
|
+
manifestUrl,
|
|
97
|
+
isRef,
|
|
98
|
+
storedOverrides,
|
|
99
|
+
storeOverride,
|
|
100
|
+
clearOverrides,
|
|
101
|
+
dropOverride,
|
|
102
|
+
resolveOverride,
|
|
103
|
+
activeOverrides,
|
|
104
|
+
overrideFor
|
|
105
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addLink,
|
|
3
3
|
fetchBytes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TW7KYJQ6.js";
|
|
5
5
|
import {
|
|
6
6
|
protocol
|
|
7
7
|
} from "./chunk-GNPFWISJ.js";
|
|
@@ -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-PVSETNMZ.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
|
-
function injectStyles(r,
|
|
30
|
-
return
|
|
29
|
+
function injectStyles(r, shadow, make, styles) {
|
|
30
|
+
return shadow ? import("./shadow-PVSETNMZ.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;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hostSlot,
|
|
3
3
|
timings
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W6322KGP.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WD4CDGDZ.js";
|
|
11
11
|
import {
|
|
12
12
|
registerSrc
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EMSB2NVX.js";
|
|
14
14
|
|
|
15
15
|
// src/element.ts
|
|
16
16
|
var Base = typeof HTMLElement === "undefined" ? class {
|
|
@@ -135,8 +135,14 @@ function defineVitralElement(tag = "vitral-remote") {
|
|
|
135
135
|
function elementRemote(tag, setup) {
|
|
136
136
|
return defineRemote({
|
|
137
137
|
mount(el, props, ctx) {
|
|
138
|
-
|
|
139
|
-
const
|
|
138
|
+
const registry = ctx.customElements ?? customElements;
|
|
139
|
+
const name = setup?.(registry) || tag;
|
|
140
|
+
let node;
|
|
141
|
+
try {
|
|
142
|
+
node = document.createElement(name, { customElementRegistry: registry });
|
|
143
|
+
} catch {
|
|
144
|
+
node = document.createElement(name);
|
|
145
|
+
}
|
|
140
146
|
node.vitral = ctx;
|
|
141
147
|
Object.assign(node, props);
|
|
142
148
|
el.appendChild(node);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prefetchCss
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6EX5KYT5.js";
|
|
4
4
|
import {
|
|
5
5
|
absolute,
|
|
6
6
|
addLink,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
pageOrigin,
|
|
10
10
|
withRetry,
|
|
11
11
|
withTimeout
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TW7KYJQ6.js";
|
|
13
13
|
import {
|
|
14
14
|
RemoteError,
|
|
15
15
|
fail,
|
|
16
16
|
isRemoteError,
|
|
17
17
|
report
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-463H6B56.js";
|
|
19
19
|
import {
|
|
20
20
|
protocol
|
|
21
21
|
} from "./chunk-GNPFWISJ.js";
|
|
@@ -25,7 +25,7 @@ function configure(config) {
|
|
|
25
25
|
const p = protocol();
|
|
26
26
|
const { remotes, dedupe, ...rest } = config;
|
|
27
27
|
p.configure(rest);
|
|
28
|
-
if (rest.captureGlobalErrors) import("./capture-
|
|
28
|
+
if (rest.captureGlobalErrors) import("./capture-TT5WBLJ6.js").then((m) => m.capture());
|
|
29
29
|
if (dedupe) p.pending(import("./dedupe-S7BHQMOZ.js").then((m) => m.offer(p, dedupe)).catch(() => {
|
|
30
30
|
}));
|
|
31
31
|
if (typeof remotes === "string") {
|
|
@@ -79,7 +79,7 @@ function loadRemote(name) {
|
|
|
79
79
|
return load(name).then((r) => r.module);
|
|
80
80
|
}
|
|
81
81
|
function loadModule(name) {
|
|
82
|
-
return import("./expose-
|
|
82
|
+
return import("./expose-OVWTPHH5.js").then((m) => m.resolveModule(name, (n) => loadFile(n))).catch(fail);
|
|
83
83
|
}
|
|
84
84
|
function preload(name) {
|
|
85
85
|
load(name).catch(() => {
|
|
@@ -88,12 +88,12 @@ function preload(name) {
|
|
|
88
88
|
var paths;
|
|
89
89
|
function load(name, isolate, priority) {
|
|
90
90
|
const file = (n) => loadFile(n, isolate, priority);
|
|
91
|
-
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-
|
|
91
|
+
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-OVWTPHH5.js").then((m) => m.resolveTarget(name, file))).catch(fail);
|
|
92
92
|
}
|
|
93
93
|
function loadFile(name, isolate, priority) {
|
|
94
94
|
const p = protocol();
|
|
95
95
|
return p.load(name, async () => {
|
|
96
|
-
paths ??= import("./sri-
|
|
96
|
+
paths ??= import("./sri-M7ZRU57G.js").catch(() => null);
|
|
97
97
|
let resolved;
|
|
98
98
|
try {
|
|
99
99
|
await p.pending();
|
|
@@ -116,7 +116,8 @@ function loadFile(name, isolate, priority) {
|
|
|
116
116
|
}
|
|
117
117
|
function devOverride(name) {
|
|
118
118
|
try {
|
|
119
|
-
|
|
119
|
+
const k = "vitral:overrides";
|
|
120
|
+
if (location.search.includes("vitral") || localStorage[k] || sessionStorage[k]) return import("./overrides-NP754HY7.js").then((m) => m.overrideFor(name));
|
|
120
121
|
} catch {
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -128,6 +129,7 @@ async function loadLocal(name, entry) {
|
|
|
128
129
|
async function resolveEntry(name, entry, priority) {
|
|
129
130
|
checkOrigin(name, entry.url);
|
|
130
131
|
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await fetchJson(entry.url, protocol().settings().timeout, name, { cache: "no-cache", priority }) : { name, entry: entry.url });
|
|
132
|
+
if (m?.stable) return resolveEntry(name, await (await import("./channel-2YPYGX3J.js")).pick(name, entry, m), priority);
|
|
131
133
|
if (typeof m?.entry !== "string") throw new RemoteError("INVALID_MODULE", name, `manifesto inv\xE1lido em ${entry.url}`);
|
|
132
134
|
if (m.contract && (entry.contract || protocol().settings().contract)) {
|
|
133
135
|
const why = await (await import("./contract-46EZFQPQ.js")).checkContract(m.contract, entry.contract);
|
|
@@ -3,20 +3,21 @@ import {
|
|
|
3
3
|
loadFile,
|
|
4
4
|
registerSrc,
|
|
5
5
|
resolveEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EMSB2NVX.js";
|
|
7
7
|
import {
|
|
8
8
|
injectStyles
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6EX5KYT5.js";
|
|
10
10
|
import {
|
|
11
11
|
metric
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TW7KYJQ6.js";
|
|
13
13
|
import {
|
|
14
14
|
RemoteError,
|
|
15
|
+
ctxHooks,
|
|
15
16
|
fail,
|
|
16
17
|
isRemoteError,
|
|
17
18
|
mounted,
|
|
18
19
|
report
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-463H6B56.js";
|
|
20
21
|
import {
|
|
21
22
|
protocol
|
|
22
23
|
} from "./chunk-GNPFWISJ.js";
|
|
@@ -47,9 +48,6 @@ function scopedEvents() {
|
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
// src/core/hooks.ts
|
|
51
|
-
var ctxHooks = {};
|
|
52
|
-
|
|
53
51
|
// src/core/navigate.ts
|
|
54
52
|
function navigate(url, options = {}) {
|
|
55
53
|
const target = new URL(url, location.href);
|
|
@@ -121,7 +119,7 @@ var noop = () => {
|
|
|
121
119
|
async function checkUpdates() {
|
|
122
120
|
const p = protocol();
|
|
123
121
|
const found = [];
|
|
124
|
-
const { splitName } = await import("./expose-
|
|
122
|
+
const { splitName } = await import("./expose-OVWTPHH5.js");
|
|
125
123
|
const remotes = /* @__PURE__ */ new Map();
|
|
126
124
|
for (const name of live.keys()) {
|
|
127
125
|
const root = splitName(name)[0];
|
|
@@ -171,21 +169,23 @@ async function mountOnce(target, name, props, options) {
|
|
|
171
169
|
}
|
|
172
170
|
const { module: mod, ...resolved } = await load(name, options.isolate, options.priority);
|
|
173
171
|
const untrack = track(name, resolved);
|
|
172
|
+
ctxHooks.watch?.(name);
|
|
174
173
|
const isolate = options.isolate ?? resolved.isolate ?? protocol().settings().isolate;
|
|
175
174
|
const label = resolved.name ?? name;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
shadowRoot.appendChild(el);
|
|
184
|
-
} else {
|
|
185
|
-
target.appendChild(el);
|
|
186
|
-
}
|
|
175
|
+
const make = (options2) => {
|
|
176
|
+
const el2 = document.createElement("div", options2);
|
|
177
|
+
el2.setAttribute("data-vitral-root", label);
|
|
178
|
+
if (resolved.scope) el2.setAttribute("data-vitral-scope", resolved.scope);
|
|
179
|
+
el2.style.display = "contents";
|
|
180
|
+
return el2;
|
|
181
|
+
};
|
|
187
182
|
let t = performance.now();
|
|
188
|
-
const [release, portal = document.body
|
|
183
|
+
const [release, portal = document.body, shadowRoot = null, registry = customElements, el = target.appendChild(make())] = await injectStyles(
|
|
184
|
+
resolved,
|
|
185
|
+
isolate === "shadow" && target,
|
|
186
|
+
make,
|
|
187
|
+
options.styles
|
|
188
|
+
);
|
|
189
189
|
metric(name, "css", t);
|
|
190
190
|
t = performance.now();
|
|
191
191
|
const scoped = scopedEvents();
|
|
@@ -196,6 +196,7 @@ async function mountOnce(target, name, props, options) {
|
|
|
196
196
|
events: scoped.bus,
|
|
197
197
|
shadowRoot,
|
|
198
198
|
portalContainer: portal,
|
|
199
|
+
customElements: registry,
|
|
199
200
|
reportError(e) {
|
|
200
201
|
const err = report(isRemoteError(e) ? e : new RemoteError("RENDER_FAILED", label, String(e?.message ?? e), e), resolved);
|
|
201
202
|
if (options.onError) options.onError(err);
|