vitral 0.9.0 → 0.10.1
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-ZRAGLT3I.js → chunk-CFJC4GRB.js} +4 -4
- package/dist/{chunk-6T25WKNK.js → chunk-EVVYV5ED.js} +41 -18
- package/dist/{chunk-JKNTXBZH.js → chunk-FOEXP52G.js} +8 -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/{chunk-P5JSFGPI.js → chunk-SOENZNXO.js} +70 -9
- 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 +36 -2
- package/dist/next-config.js +71 -4
- package/dist/next-host.d.ts +3 -3
- package/dist/next-host.js +48 -9
- 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-AK5XA2M5.js → portals-RLXKPXBZ.js} +2 -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 +15 -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-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
|
+
};
|
|
@@ -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";
|
|
@@ -44,7 +47,7 @@ function reactRemote(Component) {
|
|
|
44
47
|
const scope = ctx.portalContainer === document.body && el.closest("[data-vitral-scope]")?.getAttribute("data-vitral-scope");
|
|
45
48
|
let stop;
|
|
46
49
|
let gone = false;
|
|
47
|
-
if (scope) void import("./portals-
|
|
50
|
+
if (scope) void import("./portals-RLXKPXBZ.js").then((m) => gone || (stop = m.scopePortals(el, scope)));
|
|
48
51
|
const root = hydrate ? hydrateRoot(el, tree(props), options) : createRoot(el, options);
|
|
49
52
|
const render = (p) => root.render(tree(p));
|
|
50
53
|
if (!hydrate) render(props);
|
|
@@ -102,7 +105,7 @@ function offerReact() {
|
|
|
102
105
|
// O React 19 expõe o react/compiler-runtime pelo próprio react.
|
|
103
106
|
...compiler && { "react/compiler-runtime": compiler }
|
|
104
107
|
};
|
|
105
|
-
p.pending(
|
|
108
|
+
p.pending(dedupeModule().then((m) => m.offer(p, { react: { version: ReactAll.version, modules } })).catch(() => {
|
|
106
109
|
}));
|
|
107
110
|
}
|
|
108
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,4 +1,5 @@
|
|
|
1
1
|
// src/vite/dedupe.ts
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
2
3
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
3
4
|
import { dirname, join, resolve } from "path";
|
|
4
5
|
import { pathToFileURL } from "url";
|
|
@@ -101,6 +102,19 @@ var DEPS = "\0vitral-deps";
|
|
|
101
102
|
var OWN = "\0vitral-own:";
|
|
102
103
|
var SHIM = "\0vitral-shim:";
|
|
103
104
|
var DEEP = "\0vitral-deep:";
|
|
105
|
+
function usedNames(modules) {
|
|
106
|
+
const out = {};
|
|
107
|
+
const add = (spec, name) => (out[spec] ??= /* @__PURE__ */ new Set()).add(name);
|
|
108
|
+
for (const [id, m] of modules) {
|
|
109
|
+
if (id.startsWith(SHIM)) {
|
|
110
|
+
const spec = id.slice(SHIM.length);
|
|
111
|
+
out[spec] ??= /* @__PURE__ */ new Set();
|
|
112
|
+
for (const n of m.renderedExports ?? []) add(spec, n);
|
|
113
|
+
} else if (id.startsWith(DEEP)) for (const n of m.renderedExports ?? []) for (const [spec, name] of deepVia.get(id)?.get(n) ?? []) add(spec, name);
|
|
114
|
+
}
|
|
115
|
+
return Object.fromEntries(Object.entries(out).map(([k, v]) => [k, [...v].sort()]));
|
|
116
|
+
}
|
|
117
|
+
var deepVia = /* @__PURE__ */ new Map();
|
|
104
118
|
var pkgOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
105
119
|
var norm = (p) => p.replace(/\\/g, "/");
|
|
106
120
|
var groupOf = (spec) => REACT.includes(spec) || pkgOf(spec) === "scheduler" ? "react" : pkgOf(spec);
|
|
@@ -130,6 +144,7 @@ async function groups(list, root, entry, resolveId) {
|
|
|
130
144
|
byName.set(g, [.../* @__PURE__ */ new Set([...byName.get(g) ?? [], ...g === "react" ? REACT : [spec.endsWith("/*") ? g : spec]])]);
|
|
131
145
|
}
|
|
132
146
|
const out = [];
|
|
147
|
+
const files = [];
|
|
133
148
|
for (const [name, list2] of byName) {
|
|
134
149
|
const group = { name, range: "", version: "", keys: [], names: {}, pkgs: name === "react" ? ["react", "react-dom", "scheduler"] : [name] };
|
|
135
150
|
let specs = list2;
|
|
@@ -149,19 +164,55 @@ async function groups(list, root, entry, resolveId) {
|
|
|
149
164
|
specs = [.../* @__PURE__ */ new Set([...specs, ...subpaths(name, pkg.data)])];
|
|
150
165
|
}
|
|
151
166
|
}
|
|
152
|
-
|
|
153
|
-
const mod = await import(pathToFileURL(found.id.split("?")[0]).href);
|
|
154
|
-
const extra = mod.default && (typeof mod.default === "object" || typeof mod.default === "function") ? Object.keys(mod.default) : [];
|
|
155
|
-
group.names[spec] = [.../* @__PURE__ */ new Set([...Object.keys(mod), ...extra])].filter((n) => n !== "default" && ident.test(n));
|
|
156
|
-
} catch {
|
|
157
|
-
}
|
|
167
|
+
files.push([group, spec, found.id.split("?")[0]]);
|
|
158
168
|
group.keys.push(spec);
|
|
159
169
|
}
|
|
160
170
|
group.range = name === "svelte" || name.startsWith("@angular/") ? group.version : `^${group.version}`;
|
|
161
171
|
out.push(group);
|
|
162
172
|
}
|
|
173
|
+
const names = exportNames(files.map(([, , f]) => f));
|
|
174
|
+
files.forEach(([g, spec], i) => names[i] && (g.names[spec] = names[i]));
|
|
163
175
|
return out;
|
|
164
176
|
}
|
|
177
|
+
var MARK = "@@vitral-names@@";
|
|
178
|
+
function isCommonJs(file) {
|
|
179
|
+
if (/\.cjs$/.test(file)) return true;
|
|
180
|
+
if (!/\.js$/.test(file)) return false;
|
|
181
|
+
for (let dir = dirname(file); dir !== dirname(dir); dir = dirname(dir)) {
|
|
182
|
+
const json = join(dir, "package.json");
|
|
183
|
+
if (existsSync(json)) {
|
|
184
|
+
try {
|
|
185
|
+
return JSON.parse(readFileSync(json, "utf8")).type !== "module";
|
|
186
|
+
} catch {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
function exportNames(files) {
|
|
194
|
+
if (!files.length) return [];
|
|
195
|
+
const code = `const out = []
|
|
196
|
+
for (const [f, cjs] of JSON.parse(process.argv[1])) {
|
|
197
|
+
try {
|
|
198
|
+
const mod = await import(f)
|
|
199
|
+
// CommonJS: os nomes ficam no module.exports, que pode ser uma fun\xE7\xE3o (o axios \xE9).
|
|
200
|
+
const obj = mod.default && (typeof mod.default === "object" || typeof mod.default === "function") ? mod.default : undefined
|
|
201
|
+
const all = cjs ? Object.keys(obj ?? {}) : [...new Set([...Object.keys(mod), ...Object.keys(obj ?? {})])]
|
|
202
|
+
out.push(all.filter((n) => n !== "default" && ${ident}.test(n)))
|
|
203
|
+
} catch {
|
|
204
|
+
out.push(null)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
process.stdout.write("\\n${MARK}" + JSON.stringify(out))`;
|
|
208
|
+
const env = { ...process.env, NODE_ENV: process.env.NODE_ENV === "development" ? "development" : "production" };
|
|
209
|
+
try {
|
|
210
|
+
const out = execFileSync(process.execPath, ["--input-type=module", "-e", code, JSON.stringify(files.map((f) => [pathToFileURL(f).href, isCommonJs(f)]))], { env, encoding: "utf8", maxBuffer: 64 << 20, stdio: ["ignore", "pipe", "ignore"] });
|
|
211
|
+
return JSON.parse(out.slice(out.lastIndexOf(MARK) + MARK.length));
|
|
212
|
+
} catch {
|
|
213
|
+
return files.map(() => null);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
165
216
|
var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\0/g, "\\x00");
|
|
166
217
|
function dedupeIds(list) {
|
|
167
218
|
const specs = new Set(list.flatMap((s) => groupOf(s) === "react" ? REACT : [s.replace(/\/\*$/, "")]));
|
|
@@ -266,6 +317,7 @@ export { v${i} as ${JSON.stringify(n)} }
|
|
|
266
317
|
const f = JSON.stringify(file);
|
|
267
318
|
const shared = via.filter(([, v]) => v);
|
|
268
319
|
const rest = via.filter(([, v]) => !v).map(([name]) => name);
|
|
320
|
+
deepVia.set(id, new Map(shared.map(([name, v]) => [name, [[v.spec, v.name]]])));
|
|
269
321
|
if (!shared.length) {
|
|
270
322
|
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`);
|
|
271
323
|
return `export * from ${f}
|
|
@@ -292,11 +344,19 @@ function boot(entry, groups2) {
|
|
|
292
344
|
return `const { deps } = await import(${JSON.stringify(DEPS)})
|
|
293
345
|
const p = globalThis[Symbol.for("vitral")]
|
|
294
346
|
const shared = !!(p && p.dedupe) && /\\/split\\/[^/]*$/.test(import.meta.url)
|
|
347
|
+
const uses = (p && p.uses && p.uses[import.meta.url]) || {}
|
|
295
348
|
async function need(name, range, version, keys, load) {
|
|
296
349
|
let m = shared && (await p.dedupe(name, range, { version, load }))
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
350
|
+
// A oferta pode ter s\xF3 os nomes que o remote usa (host Next): confere cada um.
|
|
351
|
+
const has = (o, n) => n === "default" || (o != null && (n in o || (o.default != null && n in Object(o.default))))
|
|
352
|
+
const lacks = m ? keys.filter((k) => !(k in m)) : []
|
|
353
|
+
const names = m ? keys.flatMap((k) => (k in m ? (uses[name]?.[k] || []).filter((n) => !has(m[k], n)).map((n) => k + " " + n) : [])) : []
|
|
354
|
+
// React e React DOM nunca t\xEAm duas c\xF3pias na p\xE1gina (hooks e contexto
|
|
355
|
+
// quebram): um nome que falta s\xF3 gera aviso, e o remote fica com a oferta.
|
|
356
|
+
const keep = name === "react" && !lacks.length
|
|
357
|
+
if (lacks.length || names.length)
|
|
358
|
+
console.warn("[vitral] dedupe: a oferta de " + name + " n\xE3o tem " + [...lacks, ...names].join(", ") + (keep ? "; o remote usa a oferta do host mesmo assim" : "; o remote usa a c\xF3pia pr\xF3pria inteira"))
|
|
359
|
+
if (!m || ((lacks.length || names.length) && !keep)) m = await load()
|
|
300
360
|
Object.assign(deps, m)
|
|
301
361
|
}
|
|
302
362
|
await Promise.all([${calls.join(", ")}])
|
|
@@ -307,6 +367,7 @@ export default remote.default
|
|
|
307
367
|
|
|
308
368
|
export {
|
|
309
369
|
BOOT,
|
|
370
|
+
usedNames,
|
|
310
371
|
subpaths,
|
|
311
372
|
groups,
|
|
312
373
|
dedupeIds,
|
|
@@ -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;
|