vitral 0.8.0 → 0.10.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 -5
- package/dist/auto.js +7 -5
- package/dist/{capture-TT5WBLJ6.js → capture-A6JQNNQY.js} +1 -0
- package/dist/{channel-2YPYGX3J.js → channel-2DUQQPPA.js} +1 -0
- package/dist/chunk-4E33RZMM.js +18 -0
- package/dist/{chunk-6AFVJCQG.js → chunk-5OM6KOCP.js} +26 -5
- package/dist/{chunk-ZRAGLT3I.js → chunk-CFJC4GRB.js} +4 -4
- package/dist/{chunk-6T25WKNK.js → chunk-EVVYV5ED.js} +41 -18
- package/dist/{chunk-4IWZIFAL.js → chunk-FOEXP52G.js} +19 -5
- package/dist/chunk-MGG5BW3U.js +10 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-PQXS2UDM.js → chunk-QINOFHG6.js} +1 -1
- package/dist/{dedupe-PZCSKL3L.js → chunk-R3HUMHNL.js} +15 -16
- package/dist/{chunk-KU6HF2EW.js → chunk-SC2KF7GJ.js} +2 -2
- package/dist/{sri-TBZ6PYYY.js → chunk-VK6W7KHM.js} +17 -4
- package/dist/{chunk-NTXMEZIZ.js → chunk-VTGHPX4J.js} +5 -5
- package/dist/{chunk-ZJ4IM2PZ.js → chunk-WAU6OKK3.js} +2 -2
- package/dist/cli.js +2 -1
- package/dist/{contract-OMHCH6LI.js → contract-IXM52LVW.js} +2 -1
- package/dist/dedupe-SRAPOK3V.js +13 -0
- package/dist/devtools.js +1 -0
- package/dist/dict.js +1 -0
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +1 -0
- package/dist/element.d.ts +2 -2
- package/dist/element.js +7 -5
- package/dist/embed.js +2 -2
- package/dist/{events-Cieg_far.d.ts → events-CWdYSrkz.d.ts} +1 -1
- package/dist/{expose-V5ASGX4E.js → expose-BA4HSXDP.js} +5 -3
- package/dist/federation.d.ts +1 -1
- package/dist/federation.js +2 -0
- package/dist/{hydrate-6NE4MYOD.js → hydrate-IVQNHOP3.js} +6 -4
- package/dist/iframe.js +8 -6
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -3
- package/dist/{loader-BIXjuvvp.d.ts → loader-CLRMRRFv.d.ts} +1 -1
- package/dist/next-config.d.ts +34 -2
- package/dist/next-config.js +68 -4
- package/dist/next-host.d.ts +3 -3
- package/dist/next-host.js +50 -10
- package/dist/next.d.ts +1 -1
- package/dist/next.js +1 -0
- package/dist/otel.js +2 -0
- package/dist/{overrides-NP754HY7.js → overrides-5BGODLCO.js} +1 -0
- package/dist/portals-RLXKPXBZ.js +24 -0
- package/dist/preact.d.ts +4 -4
- package/dist/preact.js +6 -4
- package/dist/prefetch.js +5 -3
- package/dist/react-server.d.ts +1 -1
- package/dist/react-server.js +1 -0
- package/dist/react.d.ts +4 -4
- package/dist/react.js +7 -5
- package/dist/{reframe-3ZN5CHEG.js → reframe-ZOQPW552.js} +8 -6
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +6 -4
- package/dist/sentry.js +2 -0
- package/dist/{shadow-S4SKHTA7.js → shadow-PZGQKUA4.js} +2 -1
- package/dist/single-spa.d.ts +1 -1
- package/dist/single-spa.js +2 -0
- package/dist/{slot-Dhczjs1E.d.ts → slot-DRYmGvvV.d.ts} +1 -1
- package/dist/solid.d.ts +3 -3
- package/dist/solid.js +6 -4
- package/dist/sri-LQBLQMG5.js +14 -0
- package/dist/{stale-HFTCJASS.js → stale-XV4LNHDX.js} +2 -0
- package/dist/svelte.d.ts +4 -4
- package/dist/svelte.js +6 -4
- package/dist/sw.js +2 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +5 -3
- package/dist/{types-wsKR1gfx.d.ts → types-g8WEVD_b.d.ts} +2 -0
- package/dist/vitals.js +1 -0
- package/dist/vite.js +10 -4
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +6 -4
- package/package.json +35 -25
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-g8WEVD_b.js';
|
|
3
|
+
export { e as events } from './events-CWdYSrkz.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,24 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-CFJC4GRB.js";
|
|
4
|
+
import "./chunk-WAU6OKK3.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VTGHPX4J.js";
|
|
11
11
|
import {
|
|
12
12
|
events,
|
|
13
13
|
navigate
|
|
14
14
|
} from "./chunk-EQZOJU3B.js";
|
|
15
15
|
import {
|
|
16
16
|
configure
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-EVVYV5ED.js";
|
|
18
|
+
import "./chunk-MGG5BW3U.js";
|
|
19
|
+
import "./chunk-SC2KF7GJ.js";
|
|
19
20
|
import "./chunk-TW7KYJQ6.js";
|
|
20
21
|
import "./chunk-463H6B56.js";
|
|
21
22
|
import "./chunk-GNPFWISJ.js";
|
|
23
|
+
import "./chunk-MLKGABMK.js";
|
|
22
24
|
|
|
23
25
|
// src/angular.ts
|
|
24
26
|
import {
|
package/dist/auto.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-CFJC4GRB.js";
|
|
4
|
+
import "./chunk-WAU6OKK3.js";
|
|
5
|
+
import "./chunk-VTGHPX4J.js";
|
|
6
6
|
import "./chunk-EQZOJU3B.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-EVVYV5ED.js";
|
|
8
|
+
import "./chunk-MGG5BW3U.js";
|
|
9
|
+
import "./chunk-SC2KF7GJ.js";
|
|
9
10
|
import "./chunk-TW7KYJQ6.js";
|
|
10
11
|
import "./chunk-463H6B56.js";
|
|
11
12
|
import "./chunk-GNPFWISJ.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
12
14
|
|
|
13
15
|
// src/auto.ts
|
|
14
16
|
defineVitralElement();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/core/semver.ts
|
|
2
|
+
function satisfies(version, range) {
|
|
3
|
+
if (range === "*") return true;
|
|
4
|
+
const [, op = "", want = ""] = /^(\^|~|>=|=)?(.*)$/.exec(range.trim());
|
|
5
|
+
if (!op || op === "=" || version.includes("-")) return version === want;
|
|
6
|
+
const [v, w] = [version, want].map((s) => (s + ".0.0").split(".", 3).map(Number));
|
|
7
|
+
for (let i = 0; i < 3; i++) if (v[i] !== w[i]) {
|
|
8
|
+
if (!(v[i] > w[i])) return false;
|
|
9
|
+
break;
|
|
10
|
+
}
|
|
11
|
+
if (op === ">=") return true;
|
|
12
|
+
const fixed = Math.min(want.split(".").length, op === "~" ? 2 : w[0] ? 1 : w[1] ? 2 : 3);
|
|
13
|
+
return v.slice(0, fixed).join(".") === w.slice(0, fixed).join(".");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
satisfies
|
|
18
|
+
};
|
|
@@ -101,6 +101,19 @@ var DEPS = "\0vitral-deps";
|
|
|
101
101
|
var OWN = "\0vitral-own:";
|
|
102
102
|
var SHIM = "\0vitral-shim:";
|
|
103
103
|
var DEEP = "\0vitral-deep:";
|
|
104
|
+
function usedNames(modules) {
|
|
105
|
+
const out = {};
|
|
106
|
+
const add = (spec, name) => (out[spec] ??= /* @__PURE__ */ new Set()).add(name);
|
|
107
|
+
for (const [id, m] of modules) {
|
|
108
|
+
if (id.startsWith(SHIM)) {
|
|
109
|
+
const spec = id.slice(SHIM.length);
|
|
110
|
+
out[spec] ??= /* @__PURE__ */ new Set();
|
|
111
|
+
for (const n of m.renderedExports ?? []) add(spec, n);
|
|
112
|
+
} else if (id.startsWith(DEEP)) for (const n of m.renderedExports ?? []) for (const [spec, name] of deepVia.get(id)?.get(n) ?? []) add(spec, name);
|
|
113
|
+
}
|
|
114
|
+
return Object.fromEntries(Object.entries(out).map(([k, v]) => [k, [...v].sort()]));
|
|
115
|
+
}
|
|
116
|
+
var deepVia = /* @__PURE__ */ new Map();
|
|
104
117
|
var pkgOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
105
118
|
var norm = (p) => p.replace(/\\/g, "/");
|
|
106
119
|
var groupOf = (spec) => REACT.includes(spec) || pkgOf(spec) === "scheduler" ? "react" : pkgOf(spec);
|
|
@@ -151,7 +164,7 @@ async function groups(list, root, entry, resolveId) {
|
|
|
151
164
|
}
|
|
152
165
|
try {
|
|
153
166
|
const mod = await import(pathToFileURL(found.id.split("?")[0]).href);
|
|
154
|
-
const extra = mod.default && typeof mod.default === "object" ? Object.keys(mod.default) : [];
|
|
167
|
+
const extra = mod.default && (typeof mod.default === "object" || typeof mod.default === "function") ? Object.keys(mod.default) : [];
|
|
155
168
|
group.names[spec] = [.../* @__PURE__ */ new Set([...Object.keys(mod), ...extra])].filter((n) => n !== "default" && ident.test(n));
|
|
156
169
|
} catch {
|
|
157
170
|
}
|
|
@@ -250,9 +263,12 @@ export default {${g.keys.map((k, i) => `${JSON.stringify(k)}: m${i}`).join(", ")
|
|
|
250
263
|
}
|
|
251
264
|
return `import { deps } from ${JSON.stringify(DEPS)}
|
|
252
265
|
const m = deps[${JSON.stringify(spec)}]
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
`
|
|
266
|
+
const d = m.default ?? m
|
|
267
|
+
export default d
|
|
268
|
+
` + // `export { v as "delete" }`: nomes que são palavras reservadas (`axios.delete`) também saem.
|
|
269
|
+
names.map((n, i) => `const v${i} = ${JSON.stringify(n)} in m ? m[${JSON.stringify(n)}] : d?.[${JSON.stringify(n)}]
|
|
270
|
+
export { v${i} as ${JSON.stringify(n)} }
|
|
271
|
+
`).join("");
|
|
256
272
|
}
|
|
257
273
|
if (id.startsWith(DEEP)) {
|
|
258
274
|
const file = id.slice(DEEP.length);
|
|
@@ -263,6 +279,7 @@ export default m.default ?? m
|
|
|
263
279
|
const f = JSON.stringify(file);
|
|
264
280
|
const shared = via.filter(([, v]) => v);
|
|
265
281
|
const rest = via.filter(([, v]) => !v).map(([name]) => name);
|
|
282
|
+
deepVia.set(id, new Map(shared.map(([name, v]) => [name, [[v.spec, v.name]]])));
|
|
266
283
|
if (!shared.length) {
|
|
267
284
|
ctx.warn?.(`dedupe: ${file.slice(g.dir.length + 1)} n\xE3o sai por nenhum export de ${g.name}: o remote leva uma c\xF3pia pr\xF3pria deste arquivo`);
|
|
268
285
|
return `export * from ${f}
|
|
@@ -289,9 +306,12 @@ function boot(entry, groups2) {
|
|
|
289
306
|
return `const { deps } = await import(${JSON.stringify(DEPS)})
|
|
290
307
|
const p = globalThis[Symbol.for("vitral")]
|
|
291
308
|
const shared = !!(p && p.dedupe) && /\\/split\\/[^/]*$/.test(import.meta.url)
|
|
309
|
+
const uses = (p && p.uses && p.uses[import.meta.url]) || {}
|
|
292
310
|
async function need(name, range, version, keys, load) {
|
|
293
311
|
let m = shared && (await p.dedupe(name, range, { version, load }))
|
|
294
|
-
|
|
312
|
+
// A oferta pode ter s\xF3 os nomes que o remote usa (host Next): confere cada um.
|
|
313
|
+
const has = (o, n) => n === "default" || (o != null && (n in o || (o.default != null && n in Object(o.default))))
|
|
314
|
+
const missing = m ? keys.flatMap((k) => (!(k in m) ? [k] : (uses[name]?.[k] || []).filter((n) => !has(m[k], n)).map((n) => k + " " + n))) : []
|
|
295
315
|
if (missing.length) console.warn("[vitral] dedupe: a oferta de " + name + " n\xE3o tem " + missing.join(", ") + "; o remote usa a c\xF3pia pr\xF3pria inteira")
|
|
296
316
|
if (!m || missing.length) m = await load()
|
|
297
317
|
Object.assign(deps, m)
|
|
@@ -304,6 +324,7 @@ export default remote.default
|
|
|
304
324
|
|
|
305
325
|
export {
|
|
306
326
|
BOOT,
|
|
327
|
+
usedNames,
|
|
307
328
|
subpaths,
|
|
308
329
|
groups,
|
|
309
330
|
dedupeIds,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hostSlot,
|
|
3
3
|
timings
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WAU6OKK3.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VTGHPX4J.js";
|
|
11
11
|
import {
|
|
12
12
|
registerSrc,
|
|
13
13
|
warmSsr
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EVVYV5ED.js";
|
|
15
15
|
|
|
16
16
|
// src/element.ts
|
|
17
17
|
var Base = typeof HTMLElement === "undefined" ? class {
|
|
@@ -69,7 +69,7 @@ var VitralRemoteElement = class extends Base {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
const ssr = true ? this.querySelector(":scope>[data-vitral-ssr]") : null;
|
|
72
|
-
if (ssr) warmSsr(ssr), import("./hydrate-
|
|
72
|
+
if (ssr) warmSsr(ssr), import("./hydrate-IVQNHOP3.js").then((m) => this.isConnected && !this.#slot && (this.#slot = m.hydrateSlot(this, ssr, { ...options, props: this.#props })));
|
|
73
73
|
else this.#slot = hostSlot(this, options);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dedupeModule,
|
|
3
|
+
sriModule
|
|
4
|
+
} from "./chunk-MGG5BW3U.js";
|
|
1
5
|
import {
|
|
2
6
|
prefetchCss
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SC2KF7GJ.js";
|
|
4
8
|
import {
|
|
5
9
|
absolute,
|
|
6
10
|
addLink,
|
|
@@ -25,8 +29,8 @@ function configure(config) {
|
|
|
25
29
|
const p = protocol();
|
|
26
30
|
const { remotes, dedupe, ...rest } = config;
|
|
27
31
|
p.configure(rest);
|
|
28
|
-
if (rest.captureGlobalErrors) import("./capture-
|
|
29
|
-
if (dedupe) p.pending(
|
|
32
|
+
if (rest.captureGlobalErrors) import("./capture-A6JQNNQY.js").then((m) => m.capture());
|
|
33
|
+
if (dedupe) p.pending(dedupeModule().then((m) => m.offer(p, dedupe)).catch(() => {
|
|
30
34
|
}));
|
|
31
35
|
if (typeof remotes === "string") {
|
|
32
36
|
const url = absolute(remotes);
|
|
@@ -79,7 +83,7 @@ function loadRemote(name) {
|
|
|
79
83
|
return load(name).then((r) => r.module);
|
|
80
84
|
}
|
|
81
85
|
function loadModule(name) {
|
|
82
|
-
return import("./expose-
|
|
86
|
+
return import("./expose-BA4HSXDP.js").then((m) => m.resolveModule(name, (n) => loadFile(n))).catch(fail);
|
|
83
87
|
}
|
|
84
88
|
function preload(name, options = {}) {
|
|
85
89
|
const done = load(name);
|
|
@@ -109,18 +113,18 @@ function warmRoutes(r) {
|
|
|
109
113
|
var paths;
|
|
110
114
|
function warm() {
|
|
111
115
|
if (paths) return;
|
|
112
|
-
paths =
|
|
113
|
-
|
|
116
|
+
paths = sriModule().catch(() => null);
|
|
117
|
+
dedupeModule().catch(() => {
|
|
114
118
|
});
|
|
115
119
|
}
|
|
116
120
|
function warmSsr(holder) {
|
|
117
|
-
paths ??=
|
|
118
|
-
if (holder.querySelector("script[data-vitral-manifest]")?.textContent?.includes('"dedupe"'))
|
|
121
|
+
paths ??= sriModule().catch(() => null);
|
|
122
|
+
if (holder.querySelector("script[data-vitral-manifest]")?.textContent?.includes('"dedupe"')) dedupeModule().catch(() => {
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
function load(name, isolate, priority) {
|
|
122
126
|
const file = (n) => loadFile(n, isolate, priority);
|
|
123
|
-
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-
|
|
127
|
+
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-BA4HSXDP.js").then((m) => m.resolveTarget(name, file))).catch(fail);
|
|
124
128
|
}
|
|
125
129
|
function loadFile(name, isolate, priority) {
|
|
126
130
|
const p = protocol();
|
|
@@ -128,14 +132,18 @@ function loadFile(name, isolate, priority) {
|
|
|
128
132
|
warm();
|
|
129
133
|
let resolved;
|
|
130
134
|
try {
|
|
135
|
+
const known = p.entry(name);
|
|
136
|
+
const early = known?.url && !known.module && !known.manifest && !overrides() ? prefetchManifest(known.url, name, priority) : void 0;
|
|
131
137
|
await p.pending();
|
|
132
138
|
const override = await devOverride(name);
|
|
133
139
|
const entry = override ? { isolate: p.entry(name)?.isolate, ...override } : p.entry(name);
|
|
134
140
|
if (!entry) throw new RemoteError("NOT_REGISTERED", name, "remote n\xE3o registrado. Use configure({ remotes }).");
|
|
135
141
|
if (entry.module) return await loadLocal(name, entry);
|
|
136
142
|
let t = performance.now();
|
|
137
|
-
resolved = await resolveEntry(name, entry, priority);
|
|
143
|
+
resolved = await resolveEntry(name, entry, priority, entry.url === known?.url ? early : void 0);
|
|
138
144
|
metric(name, "manifest", t);
|
|
145
|
+
const d = resolved.split?.dedupe;
|
|
146
|
+
if (d?.some((x) => x.uses)) (p.uses ??= {})[resolved.split.entry] = Object.fromEntries(d.map((x) => [x.name, x.uses]));
|
|
139
147
|
prefetchCss(resolved, (isolate ?? resolved.isolate ?? p.settings().isolate) === "shadow", priority);
|
|
140
148
|
t = performance.now();
|
|
141
149
|
const ns = await withRetry(p.settings().retries, () => importModule(name, resolved));
|
|
@@ -147,9 +155,12 @@ function loadFile(name, isolate, priority) {
|
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
157
|
function devOverride(name) {
|
|
158
|
+
if (overrides()) return import("./overrides-5BGODLCO.js").then((m) => m.overrideFor(name));
|
|
159
|
+
}
|
|
160
|
+
function overrides() {
|
|
150
161
|
try {
|
|
151
162
|
const k = "vitral:overrides";
|
|
152
|
-
|
|
163
|
+
return /[?&]vitral=/.test(location.search) || !!(localStorage[k] || sessionStorage[k]);
|
|
153
164
|
} catch {
|
|
154
165
|
}
|
|
155
166
|
}
|
|
@@ -158,13 +169,13 @@ async function loadLocal(name, entry) {
|
|
|
158
169
|
if (typeof ns === "function") ns = await ns();
|
|
159
170
|
return { module: ns?.default ?? ns, exports: ns, entry: typeof location !== "undefined" ? location.href : "http://localhost/", css: entry.css ?? [], isolate: entry.isolate };
|
|
160
171
|
}
|
|
161
|
-
async function resolveEntry(name, entry, priority) {
|
|
172
|
+
async function resolveEntry(name, entry, priority, early) {
|
|
162
173
|
checkOrigin(name, entry.url);
|
|
163
|
-
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await manifestOf(entry.url, name, priority) : { name, entry: entry.url });
|
|
164
|
-
if (m?.stable) return resolveEntry(name, await (await import("./channel-
|
|
174
|
+
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await (early ?? manifestOf(entry.url, name, priority)) : { name, entry: entry.url });
|
|
175
|
+
if (m?.stable) return resolveEntry(name, await (await import("./channel-2DUQQPPA.js")).pick(name, entry, m), priority);
|
|
165
176
|
if (typeof m?.entry !== "string") throw new RemoteError("INVALID_MODULE", name, `manifesto inv\xE1lido em ${entry.url}`);
|
|
166
177
|
if (m.contract && (entry.contract || protocol().settings().contract)) {
|
|
167
|
-
const why = await (await import("./contract-
|
|
178
|
+
const why = await (await import("./contract-IXM52LVW.js")).checkContract(m.contract, entry.contract);
|
|
168
179
|
if (why) throw new RemoteError("CONTRACT_MISMATCH", name, why);
|
|
169
180
|
}
|
|
170
181
|
const abs = (u) => absolute(u, entry.url);
|
|
@@ -202,10 +213,22 @@ async function resolveEntry(name, entry, priority) {
|
|
|
202
213
|
}
|
|
203
214
|
return resolved;
|
|
204
215
|
}
|
|
216
|
+
function prefetchManifest(url, name, priority) {
|
|
217
|
+
try {
|
|
218
|
+
if (!new URL(url).pathname.endsWith(".json")) return;
|
|
219
|
+
checkOrigin(name, url);
|
|
220
|
+
} catch {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const f = manifestOf(url, name, priority);
|
|
224
|
+
f.catch(() => {
|
|
225
|
+
});
|
|
226
|
+
return f;
|
|
227
|
+
}
|
|
205
228
|
function manifestOf(url, name, priority) {
|
|
206
229
|
const { timeout, maxStale } = protocol().settings();
|
|
207
|
-
const fresh = fetchJson(url, timeout, name, { cache: "no-cache", priority });
|
|
208
|
-
return maxStale ? import("./stale-
|
|
230
|
+
const fresh = fetchJson(url, timeout, name, { cache: "no-cache", credentials: "same-origin", priority });
|
|
231
|
+
return maxStale ? import("./stale-XV4LNHDX.js").then((m) => m.stale(url, fresh, maxStale), () => fresh) : fresh;
|
|
209
232
|
}
|
|
210
233
|
async function importModule(name, r) {
|
|
211
234
|
const { timeout } = protocol().settings();
|
|
@@ -219,7 +242,7 @@ async function importModule(name, r) {
|
|
|
219
242
|
if (!r.integrity) {
|
|
220
243
|
if (!r.split) return run(r.entry);
|
|
221
244
|
if (r.split.dedupe?.length) {
|
|
222
|
-
const { shared } = await
|
|
245
|
+
const { shared } = await dedupeModule();
|
|
223
246
|
for (const d of r.split.dedupe)
|
|
224
247
|
shared(protocol())(d.name, d.range, { version: d.version, url: d.file, load: async () => (await run(d.file)).default });
|
|
225
248
|
}
|
|
@@ -4,19 +4,22 @@ import {
|
|
|
4
4
|
} from "./chunk-B2MPYF4M.js";
|
|
5
5
|
import {
|
|
6
6
|
hostSlot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WAU6OKK3.js";
|
|
8
8
|
import {
|
|
9
9
|
defineRemote,
|
|
10
10
|
memoSelect,
|
|
11
11
|
same,
|
|
12
12
|
shared
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VTGHPX4J.js";
|
|
14
14
|
import {
|
|
15
15
|
events
|
|
16
16
|
} from "./chunk-EQZOJU3B.js";
|
|
17
17
|
import {
|
|
18
18
|
preload
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EVVYV5ED.js";
|
|
20
|
+
import {
|
|
21
|
+
dedupeModule
|
|
22
|
+
} from "./chunk-MGG5BW3U.js";
|
|
20
23
|
import {
|
|
21
24
|
protocol
|
|
22
25
|
} from "./chunk-GNPFWISJ.js";
|
|
@@ -41,10 +44,21 @@ function reactRemote(Component) {
|
|
|
41
44
|
const start = (el, props, ctx, hydrate) => {
|
|
42
45
|
const tree = (p) => /* @__PURE__ */ jsx(RemoteTree, { Component, props: p, ctx });
|
|
43
46
|
const options = { onUncaughtError: (e) => ctx.reportError(e) };
|
|
47
|
+
const scope = ctx.portalContainer === document.body && el.closest("[data-vitral-scope]")?.getAttribute("data-vitral-scope");
|
|
48
|
+
let stop;
|
|
49
|
+
let gone = false;
|
|
50
|
+
if (scope) void import("./portals-RLXKPXBZ.js").then((m) => gone || (stop = m.scopePortals(el, scope)));
|
|
44
51
|
const root = hydrate ? hydrateRoot(el, tree(props), options) : createRoot(el, options);
|
|
45
52
|
const render = (p) => root.render(tree(p));
|
|
46
53
|
if (!hydrate) render(props);
|
|
47
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
update: render,
|
|
56
|
+
unmount: () => {
|
|
57
|
+
root.unmount();
|
|
58
|
+
gone = true;
|
|
59
|
+
stop?.();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
48
62
|
};
|
|
49
63
|
return defineRemote({
|
|
50
64
|
mount: (el, props, ctx) => start(el, props, ctx, false),
|
|
@@ -91,7 +105,7 @@ function offerReact() {
|
|
|
91
105
|
// O React 19 expõe o react/compiler-runtime pelo próprio react.
|
|
92
106
|
...compiler && { "react/compiler-runtime": compiler }
|
|
93
107
|
};
|
|
94
|
-
p.pending(
|
|
108
|
+
p.pending(dedupeModule().then((m) => m.offer(p, { react: { version: ReactAll.version, modules } })).catch(() => {
|
|
95
109
|
}));
|
|
96
110
|
}
|
|
97
111
|
function preload2(name, options) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/core/bundled.ts
|
|
2
|
+
var bundled = {};
|
|
3
|
+
var dedupeModule = () => bundled.dedupe ? Promise.resolve(bundled.dedupe) : import("./dedupe-SRAPOK3V.js");
|
|
4
|
+
var sriModule = () => bundled.sri ? Promise.resolve(bundled.sri) : import("./sri-LQBLQMG5.js");
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
bundled,
|
|
8
|
+
dedupeModule,
|
|
9
|
+
sriModule
|
|
10
|
+
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (let i = 0; i < 3; i++) if (v[i] !== w[i]) {
|
|
8
|
-
if (!(v[i] > w[i])) return false;
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
if (op === ">=") return true;
|
|
12
|
-
const fixed = Math.min(want.split(".").length, op === "~" ? 2 : w[0] ? 1 : w[1] ? 2 : 3);
|
|
13
|
-
return v.slice(0, fixed).join(".") === w.slice(0, fixed).join(".");
|
|
14
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
satisfies
|
|
3
|
+
} from "./chunk-4E33RZMM.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./chunk-MLKGABMK.js";
|
|
15
7
|
|
|
16
8
|
// src/core/dedupe.ts
|
|
9
|
+
var dedupe_exports = {};
|
|
10
|
+
__export(dedupe_exports, {
|
|
11
|
+
offer: () => offer,
|
|
12
|
+
satisfies: () => satisfies,
|
|
13
|
+
shared: () => shared
|
|
14
|
+
});
|
|
17
15
|
var KEY = "vitral:dedupe:";
|
|
18
16
|
var remembered = (k) => {
|
|
19
17
|
try {
|
|
@@ -75,8 +73,9 @@ function offer(p, groups) {
|
|
|
75
73
|
p.configure({ offered: { ...p.settings().offered, [name]: version } });
|
|
76
74
|
}
|
|
77
75
|
}
|
|
76
|
+
|
|
78
77
|
export {
|
|
78
|
+
shared,
|
|
79
79
|
offer,
|
|
80
|
-
|
|
81
|
-
shared
|
|
80
|
+
dedupe_exports
|
|
82
81
|
};
|
|
@@ -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-PZGQKUA4.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-PZGQKUA4.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,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifyIntegrity
|
|
3
3
|
} from "./chunk-UYOPJ4XQ.js";
|
|
4
|
+
import {
|
|
5
|
+
dedupeModule
|
|
6
|
+
} from "./chunk-MGG5BW3U.js";
|
|
4
7
|
import {
|
|
5
8
|
addLink,
|
|
6
9
|
fetchBytes,
|
|
@@ -9,9 +12,16 @@ import {
|
|
|
9
12
|
import {
|
|
10
13
|
RemoteError
|
|
11
14
|
} from "./chunk-463H6B56.js";
|
|
12
|
-
import
|
|
15
|
+
import {
|
|
16
|
+
__export
|
|
17
|
+
} from "./chunk-MLKGABMK.js";
|
|
13
18
|
|
|
14
19
|
// src/core/sri.ts
|
|
20
|
+
var sri_exports = {};
|
|
21
|
+
__export(sri_exports, {
|
|
22
|
+
importVerified: () => importVerified,
|
|
23
|
+
verified: () => verified
|
|
24
|
+
});
|
|
15
25
|
var failed = /* @__PURE__ */ new Set();
|
|
16
26
|
async function importVerified(name, r, run, timeout) {
|
|
17
27
|
const { entry, integrity, priority } = r;
|
|
@@ -72,7 +82,7 @@ async function verified(build, run) {
|
|
|
72
82
|
const p = globalThis[/* @__PURE__ */ Symbol.for("vitral")];
|
|
73
83
|
const share = async (pre) => {
|
|
74
84
|
if (!run || !dedupe.length) return;
|
|
75
|
-
const { shared } = await
|
|
85
|
+
const { shared } = await dedupeModule();
|
|
76
86
|
for (const d of dedupe)
|
|
77
87
|
shared(p)(d.name, d.range, {
|
|
78
88
|
version: d.version,
|
|
@@ -86,7 +96,8 @@ async function verified(build, run) {
|
|
|
86
96
|
const probes = build.probe?.every((u) => u.startsWith("data:") || new URL(u, location.href).origin === location.origin) ? build.probe : void 0;
|
|
87
97
|
if (maps !== false && (maps = await useMap(sri, probes))) {
|
|
88
98
|
await share();
|
|
89
|
-
|
|
99
|
+
const hinted = new Set([...document.querySelectorAll("link[rel=preload]")].map((l) => l.href));
|
|
100
|
+
for (const u of chunks) if (!hinted.has(u)) fetch(u, { priority }).catch(() => {
|
|
90
101
|
});
|
|
91
102
|
return entry;
|
|
92
103
|
}
|
|
@@ -156,7 +167,9 @@ function check(load, good, bad) {
|
|
|
156
167
|
new Promise((resolve) => setTimeout(resolve, 3e3, false))
|
|
157
168
|
]);
|
|
158
169
|
}
|
|
170
|
+
|
|
159
171
|
export {
|
|
160
172
|
importVerified,
|
|
161
|
-
verified
|
|
173
|
+
verified,
|
|
174
|
+
sri_exports
|
|
162
175
|
};
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
loadFile,
|
|
9
9
|
registerSrc,
|
|
10
10
|
resolveEntry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EVVYV5ED.js";
|
|
12
12
|
import {
|
|
13
13
|
injectStyles
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SC2KF7GJ.js";
|
|
15
15
|
import {
|
|
16
16
|
metric
|
|
17
17
|
} from "./chunk-TW7KYJQ6.js";
|
|
@@ -85,7 +85,7 @@ var noop = () => {
|
|
|
85
85
|
async function checkUpdates() {
|
|
86
86
|
const p = protocol();
|
|
87
87
|
const found = [];
|
|
88
|
-
const { splitName } = await import("./expose-
|
|
88
|
+
const { splitName } = await import("./expose-BA4HSXDP.js");
|
|
89
89
|
const remotes = /* @__PURE__ */ new Map();
|
|
90
90
|
for (const name of live.keys()) {
|
|
91
91
|
const root = splitName(name)[0];
|
|
@@ -130,8 +130,8 @@ async function mountOnce(target, name, props, options) {
|
|
|
130
130
|
const p = protocol();
|
|
131
131
|
await p.pending();
|
|
132
132
|
const isolate = options.isolate ?? registered(name)?.isolate ?? p.settings().isolate;
|
|
133
|
-
if (isolate === "iframe") return (frames ?? (await import("./reframe-
|
|
134
|
-
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-
|
|
133
|
+
if (isolate === "iframe") return (frames ?? (await import("./reframe-ZOQPW552.js")).noFrames)(target, name, props, options).catch(fail);
|
|
134
|
+
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-ZOQPW552.js")).load : load)(name, isolate, options.priority);
|
|
135
135
|
const untrack = track(name, resolved);
|
|
136
136
|
ctxHooks.watch?.(name);
|
|
137
137
|
const label = resolved.name ?? name;
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
dictMatch
|
|
10
10
|
} from "./chunk-NZEQGRBL.js";
|
|
11
|
+
import "./chunk-MLKGABMK.js";
|
|
11
12
|
|
|
12
13
|
// src/cli.ts
|
|
13
14
|
import { createRequire as createRequire2 } from "module";
|
|
@@ -843,7 +844,7 @@ async function remotesOf(o, f, cwd, timeout) {
|
|
|
843
844
|
}
|
|
844
845
|
async function doctor(options = {}) {
|
|
845
846
|
;
|
|
846
|
-
({ satisfies } = await import("./dedupe-
|
|
847
|
+
({ satisfies } = await import("./dedupe-SRAPOK3V.js"));
|
|
847
848
|
const cwd = options.cwd ?? process.cwd();
|
|
848
849
|
const f = options.fetch ?? fetch;
|
|
849
850
|
const timeout = options.timeout ?? 15e3;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
protocol
|
|
3
3
|
} from "./chunk-GNPFWISJ.js";
|
|
4
|
+
import "./chunk-MLKGABMK.js";
|
|
4
5
|
|
|
5
6
|
// src/core/contract.ts
|
|
6
7
|
async function checkContract(c, range = protocol().settings().contract) {
|
|
7
|
-
const { satisfies } = await import("./dedupe-
|
|
8
|
+
const { satisfies } = await import("./dedupe-SRAPOK3V.js");
|
|
8
9
|
if (c.version && !satisfies(c.version, range)) return `o host aceita contrato ${range}, o remote publica ${c.version}`;
|
|
9
10
|
const offered = protocol().settings().offered ?? {};
|
|
10
11
|
for (const dep in c.peers) {
|