vitral 0.12.0 → 0.13.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 +5 -5
- package/dist/auto.js +5 -5
- package/dist/{chunk-SOENZNXO.js → chunk-2NMBPSMO.js} +87 -7
- package/dist/{chunk-QQWE5J6U.js → chunk-AJUORT35.js} +2 -1
- package/dist/{chunk-UFETTKDP.js → chunk-B4LYXSNK.js} +4 -4
- package/dist/{chunk-RGYVSS3X.js → chunk-C3LH5DSE.js} +5 -5
- package/dist/chunk-EGUHWWE4.js +86 -0
- package/dist/{chunk-YKLWMIEH.js → chunk-GJY5QTOO.js} +1 -1
- package/dist/{chunk-VDNFRNOG.js → chunk-LITYI5X7.js} +1 -1
- package/dist/{chunk-52D6ZT4A.js → chunk-NGO67IJR.js} +8 -3
- package/dist/{chunk-I7IFR65H.js → chunk-WIQ3W6AY.js} +4 -4
- package/dist/{chunk-JKTZODC5.js → chunk-XNUU3YPA.js} +2 -2
- package/dist/edge.d.ts +1 -1
- package/dist/element.d.ts +2 -2
- package/dist/element.js +5 -5
- package/dist/embed.js +2 -2
- package/dist/{events-II6hXM3Q.d.ts → events-XXC4si92.d.ts} +1 -1
- package/dist/{expose-KL6TA472.js → expose-PY7A4VM2.js} +3 -3
- package/dist/federation.d.ts +1 -1
- package/dist/{hydrate-LS3MLFGN.js → hydrate-UOEAX7D3.js} +4 -4
- package/dist/i18n-WISV4IP6.js +16 -0
- package/dist/i18n.d.ts +52 -0
- package/dist/i18n.js +39 -0
- package/dist/iframe.js +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/{loader-Bmul2-5T.d.ts → loader-vj8m2GQU.d.ts} +1 -1
- package/dist/next-config.d.ts +3 -1
- package/dist/next-config.js +2 -2
- package/dist/next-host.d.ts +12 -5
- package/dist/next-host.js +33 -19
- package/dist/next-server.d.ts +1 -1
- package/dist/preact.d.ts +4 -4
- package/dist/preact.js +4 -4
- package/dist/prefetch.js +2 -2
- package/dist/react-server.d.ts +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +5 -5
- package/dist/{reframe-AD2UEPIO.js → reframe-RLSKSEJS.js} +3 -3
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +4 -4
- package/dist/single-spa.d.ts +1 -1
- package/dist/{slot--WLgdcW_.d.ts → slot-CxhuVuka.d.ts} +1 -1
- package/dist/solid.d.ts +3 -3
- package/dist/solid.js +4 -4
- package/dist/sri-Z5U32IR2.js +2 -2
- package/dist/svelte.d.ts +4 -4
- package/dist/svelte.js +4 -4
- package/dist/sw.d.ts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -3
- package/dist/{types-DJautV-K.d.ts → types-cSsvpvgE.d.ts} +26 -1
- package/dist/vite.d.ts +10 -0
- package/dist/vite.js +107 -42
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +4 -4
- package/package.json +39 -24
- /package/dist/{chunk-QGAEXUP5.js → chunk-OKXLOMAG.js} +0 -0
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-cSsvpvgE.js';
|
|
3
|
+
export { e as events } from './events-XXC4si92.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,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-B4LYXSNK.js";
|
|
4
|
+
import "./chunk-XNUU3YPA.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WIQ3W6AY.js";
|
|
11
11
|
import {
|
|
12
12
|
configure
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-NGO67IJR.js";
|
|
14
|
+
import "./chunk-OKXLOMAG.js";
|
|
15
15
|
import "./chunk-YDO7SPF4.js";
|
|
16
16
|
import "./chunk-VDVVEGAO.js";
|
|
17
17
|
import "./chunk-BQGVAXFM.js";
|
package/dist/auto.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-B4LYXSNK.js";
|
|
4
|
+
import "./chunk-XNUU3YPA.js";
|
|
5
|
+
import "./chunk-WIQ3W6AY.js";
|
|
6
|
+
import "./chunk-NGO67IJR.js";
|
|
7
|
+
import "./chunk-OKXLOMAG.js";
|
|
8
8
|
import "./chunk-YDO7SPF4.js";
|
|
9
9
|
import "./chunk-VDVVEGAO.js";
|
|
10
10
|
import "./chunk-BQGVAXFM.js";
|
|
@@ -29,6 +29,25 @@ async function exportOrigins(ctx, file, cache) {
|
|
|
29
29
|
}
|
|
30
30
|
return origins(file, parsed, /* @__PURE__ */ new Map(), []);
|
|
31
31
|
}
|
|
32
|
+
async function exportSources(ctx, file, cache) {
|
|
33
|
+
await exportOrigins(ctx, file, cache);
|
|
34
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const [f, p] of cache) parsed.set(f, await p);
|
|
36
|
+
return sources(file, parsed, /* @__PURE__ */ new Map(), []);
|
|
37
|
+
}
|
|
38
|
+
function sources(file, parsed, memo, stack) {
|
|
39
|
+
const p = parsed.get(file);
|
|
40
|
+
if (!p || stack.includes(file)) return /* @__PURE__ */ new Map();
|
|
41
|
+
const known = memo.get(file);
|
|
42
|
+
if (known) return known;
|
|
43
|
+
const next = [...stack, file];
|
|
44
|
+
const out = /* @__PURE__ */ new Map();
|
|
45
|
+
for (const name of p.local.keys()) out.set(name, [file, name]);
|
|
46
|
+
for (const n of p.named) out.set(n.exported, n.source && sources(n.source, parsed, memo, next).get(n.name) || [file, n.exported]);
|
|
47
|
+
for (const s of p.star) for (const [name, v] of sources(s, parsed, memo, next)) if (name !== "default" && !out.has(name)) out.set(name, v);
|
|
48
|
+
memo.set(file, out);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
32
51
|
function origins(file, parsed, memo, stack) {
|
|
33
52
|
if (stack.includes(file)) return /* @__PURE__ */ new Map();
|
|
34
53
|
const known = memo.get(file);
|
|
@@ -257,6 +276,32 @@ function dedupeHooks(entry, getGroups) {
|
|
|
257
276
|
origins2 = /* @__PURE__ */ new Map();
|
|
258
277
|
exports.clear();
|
|
259
278
|
},
|
|
279
|
+
/**
|
|
280
|
+
* Depois do build dividido: arquivos de um grupo que o código principal
|
|
281
|
+
* alcança sem passar pela cópia própria. Eles baixam e rodam mesmo com o
|
|
282
|
+
* pacote oferecido pelo host; o aviso mostra um caminho até cada grupo.
|
|
283
|
+
*/
|
|
284
|
+
leaks(ctx, root) {
|
|
285
|
+
const from = /* @__PURE__ */ new Map();
|
|
286
|
+
const stack = ["\0" + BOOT];
|
|
287
|
+
while (stack.length) {
|
|
288
|
+
const id = stack.pop();
|
|
289
|
+
const m = ctx.getModuleInfo(id);
|
|
290
|
+
for (const d of [...m?.importedIds ?? [], ...m?.dynamicallyImportedIds ?? []]) if (!d.startsWith(OWN) && !from.has(d)) from.set(d, id), stack.push(d);
|
|
291
|
+
}
|
|
292
|
+
const r = norm(root) + "/";
|
|
293
|
+
const show = (id) => {
|
|
294
|
+
const v = /^\0([\w:-]*?:)(\/.*)$/.exec(id);
|
|
295
|
+
return v ? v[1] + show(v[2]) : norm(id).startsWith(r) ? norm(id).slice(r.length) : id.replace(/^\0/, "");
|
|
296
|
+
};
|
|
297
|
+
for (const g of getGroups()) {
|
|
298
|
+
const found = [...from.keys()].filter((id) => !id.startsWith("\0") && inside(g, id));
|
|
299
|
+
if (!found.length) continue;
|
|
300
|
+
const chain = [found[0]];
|
|
301
|
+
while (from.has(chain[0]) && !chain[0].startsWith("\0" + BOOT)) chain.unshift(from.get(chain[0]));
|
|
302
|
+
ctx.warn?.(`dedupe: ${found.length} arquivo(s) de ${g.name} entram no c\xF3digo principal do remote, fora da c\xF3pia pr\xF3pria: baixam e rodam mesmo com o pacote oferecido pelo host. Um caminho: ${chain.slice(1).map(show).join(" \u2192 ")}`);
|
|
303
|
+
}
|
|
304
|
+
},
|
|
260
305
|
/** Algum grupo troca também os imports que chegam a arquivos do pacote? */
|
|
261
306
|
files: () => getGroups().some((g) => g.files),
|
|
262
307
|
resolveId: {
|
|
@@ -324,23 +369,56 @@ export { v${i} as ${JSON.stringify(n)} }
|
|
|
324
369
|
` + (own.has("default") ? `export { default } from ${f}
|
|
325
370
|
` : "");
|
|
326
371
|
}
|
|
372
|
+
const from = rest.length ? await exportSources(ctx, file, exports) : /* @__PURE__ */ new Map();
|
|
373
|
+
const src = (n) => from.get(n) ?? [file, n];
|
|
374
|
+
const rel = (x) => x.slice(g.dir.length + 1);
|
|
327
375
|
if (rest.length)
|
|
328
|
-
ctx.warn?.(`dedupe: ${file
|
|
376
|
+
ctx.warn?.(`dedupe: ${rel(file)}: ${rest.join(", ")} n\xE3o sai(em) por nenhum export de ${g.name}: esses nomes v\xEAm de uma c\xF3pia pr\xF3pria de ${[...new Set(rest.map((n) => rel(src(n)[0])))].join(", ")}, que entra no c\xF3digo principal do remote`);
|
|
377
|
+
const q = (n) => n === "default" ? "default" : JSON.stringify(n);
|
|
329
378
|
return `import { deps } from ${JSON.stringify(DEPS)}
|
|
330
379
|
` + shared.map(([name, v], i) => `const v${i} = deps[${JSON.stringify(v.spec)}][${JSON.stringify(v.name)}]
|
|
331
380
|
` + (name === "default" ? `export default v${i}
|
|
332
381
|
` : `export { v${i} as ${JSON.stringify(name)} }
|
|
333
|
-
`)).join("") +
|
|
334
|
-
`
|
|
382
|
+
`)).join("") + rest.map((n) => `export { ${q(src(n)[1])} as ${q(n)} } from ${JSON.stringify(src(n)[0])}
|
|
383
|
+
`).join("");
|
|
335
384
|
}
|
|
336
385
|
return null;
|
|
337
386
|
}
|
|
338
387
|
};
|
|
339
388
|
}
|
|
340
|
-
function
|
|
341
|
-
const
|
|
342
|
-
|
|
389
|
+
function groupDeps(groups2) {
|
|
390
|
+
const names = new Set(groups2.map((g) => g.name));
|
|
391
|
+
const direct = new Map(
|
|
392
|
+
groups2.map((g) => {
|
|
393
|
+
let data = {};
|
|
394
|
+
try {
|
|
395
|
+
if (g.dir) data = JSON.parse(readFileSync(join(g.dir, "package.json"), "utf8"));
|
|
396
|
+
} catch {
|
|
397
|
+
}
|
|
398
|
+
const deps = Object.keys({ ...data.dependencies, ...data.peerDependencies }).map(groupOf);
|
|
399
|
+
return [g.name, [...new Set(deps)].filter((d) => d !== g.name && names.has(d))];
|
|
400
|
+
})
|
|
343
401
|
);
|
|
402
|
+
const out = /* @__PURE__ */ new Map();
|
|
403
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
404
|
+
const visit = (n) => {
|
|
405
|
+
if (out.has(n) || visiting.has(n)) return;
|
|
406
|
+
visiting.add(n);
|
|
407
|
+
for (const d of direct.get(n) ?? []) visit(d);
|
|
408
|
+
visiting.delete(n);
|
|
409
|
+
out.set(n, (direct.get(n) ?? []).filter((d) => out.has(d)));
|
|
410
|
+
};
|
|
411
|
+
for (const g of groups2) visit(g.name);
|
|
412
|
+
return out;
|
|
413
|
+
}
|
|
414
|
+
function boot(entry, groups2) {
|
|
415
|
+
const uses = groupDeps(groups2);
|
|
416
|
+
const order = [...uses.keys()];
|
|
417
|
+
const calls = [...groups2].sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name)).map((g) => {
|
|
418
|
+
const call = `need(${JSON.stringify(g.name)}, ${JSON.stringify(g.range)}, ${JSON.stringify(g.version)}, ${JSON.stringify(g.keys)}, () => import(${JSON.stringify(OWN + g.name)}).then((m) => m.default))`;
|
|
419
|
+
const before = uses.get(g.name) ?? [];
|
|
420
|
+
return `done[${JSON.stringify(g.name)}] = ` + (before.length ? `Promise.all(${JSON.stringify(before)}.map((n) => done[n])).then(() => ${call})` : call);
|
|
421
|
+
});
|
|
344
422
|
return `const { deps } = await import(${JSON.stringify(DEPS)})
|
|
345
423
|
const p = globalThis[Symbol.for("vitral")]
|
|
346
424
|
const shared = !!(p && p.dedupe) && /\\/split\\/[^/]*$/.test(import.meta.url)
|
|
@@ -359,7 +437,9 @@ async function need(name, range, version, keys, load) {
|
|
|
359
437
|
if (!m || ((lacks.length || names.length) && !keep)) m = await load()
|
|
360
438
|
Object.assign(deps, m)
|
|
361
439
|
}
|
|
362
|
-
|
|
440
|
+
const done = {}
|
|
441
|
+
${calls.join("\n")}
|
|
442
|
+
await Promise.all(Object.values(done))
|
|
363
443
|
const remote = await import(${JSON.stringify(entry)})
|
|
364
444
|
export default remote.default
|
|
365
445
|
`;
|
|
@@ -28,7 +28,8 @@ function hintsOf(m, url, offered, integrity, keys) {
|
|
|
28
28
|
css: (m.css ?? []).map(hint),
|
|
29
29
|
js: (m.split ? ordered([...own, ...m.split.chunks ?? [], m.split.entry], m.split.order) : [m.entry]).map(hint),
|
|
30
30
|
...offers.length && { offers },
|
|
31
|
-
...k && { signed: k.trim() }
|
|
31
|
+
...k && { signed: k.trim() },
|
|
32
|
+
...m.i18n && { i18n: Object.fromEntries(Object.entries(m.i18n).map(([lng, ns]) => [lng, Object.values(ns).map((f) => hint(f).slice(0, 2))])) }
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
hostSlot,
|
|
3
3
|
timings,
|
|
4
4
|
when
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XNUU3YPA.js";
|
|
6
6
|
import {
|
|
7
7
|
defineRemote,
|
|
8
8
|
memoSelect,
|
|
9
9
|
same,
|
|
10
10
|
shared
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WIQ3W6AY.js";
|
|
12
12
|
import {
|
|
13
13
|
policy,
|
|
14
14
|
registerSrc,
|
|
15
15
|
warmSsr
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NGO67IJR.js";
|
|
17
17
|
|
|
18
18
|
// src/element.ts
|
|
19
19
|
var Base = typeof HTMLElement === "undefined" ? class {
|
|
@@ -77,7 +77,7 @@ var VitralRemoteElement = class extends Base {
|
|
|
77
77
|
};
|
|
78
78
|
const ssr = true ? this.querySelector(":scope>[data-vitral-ssr]") : null;
|
|
79
79
|
if (ssr) {
|
|
80
|
-
const go = () => (warmSsr(ssr), import("./hydrate-
|
|
80
|
+
const go = () => (warmSsr(ssr), import("./hydrate-UOEAX7D3.js").then((m) => this.isConnected && !this.#slot && (this.#slot = m.hydrateSlot(this, ssr, { ...options, props: this.#props }))));
|
|
81
81
|
if (policy() === "lazy") when(this, "visible", go);
|
|
82
82
|
else go();
|
|
83
83
|
} else this.#slot = hostSlot(this, options);
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
hostSlot,
|
|
8
8
|
when
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XNUU3YPA.js";
|
|
10
10
|
import {
|
|
11
11
|
defineRemote,
|
|
12
12
|
memoSelect,
|
|
13
13
|
same,
|
|
14
14
|
shared
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WIQ3W6AY.js";
|
|
16
16
|
import {
|
|
17
17
|
policy,
|
|
18
18
|
preload
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NGO67IJR.js";
|
|
20
20
|
import {
|
|
21
21
|
dedupeModule
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OKXLOMAG.js";
|
|
23
23
|
import {
|
|
24
24
|
events
|
|
25
25
|
} from "./chunk-EQZOJU3B.js";
|
|
@@ -192,7 +192,7 @@ function Remote({
|
|
|
192
192
|
let dead = false;
|
|
193
193
|
let s = null;
|
|
194
194
|
if (holder) {
|
|
195
|
-
const go = () => import("./hydrate-
|
|
195
|
+
const go = () => import("./hydrate-UOEAX7D3.js").then((m) => {
|
|
196
196
|
if (!dead) slot.current = s = m.hydrateSlot(target.current, holder, { ...options, props: latest.current ?? {} });
|
|
197
197
|
});
|
|
198
198
|
const stop = policy() === "lazy" ? when(target.current, "visible", go) : (go(), () => {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
verifyIntegrity
|
|
3
|
+
} from "./chunk-UCFOXMOR.js";
|
|
4
|
+
import {
|
|
5
|
+
absolute,
|
|
6
|
+
fetchBytes
|
|
7
|
+
} from "./chunk-VDVVEGAO.js";
|
|
8
|
+
import {
|
|
9
|
+
RemoteError
|
|
10
|
+
} from "./chunk-BQGVAXFM.js";
|
|
11
|
+
|
|
12
|
+
// src/core/i18n.ts
|
|
13
|
+
var asked = /* @__PURE__ */ new Map();
|
|
14
|
+
var remotes = /* @__PURE__ */ new Map();
|
|
15
|
+
var watching;
|
|
16
|
+
var stop;
|
|
17
|
+
function pickLanguage(lng, available, fallback = []) {
|
|
18
|
+
const low = available.map((a) => a.toLowerCase());
|
|
19
|
+
const base = (x) => x.toLowerCase().split(/[-_]/)[0];
|
|
20
|
+
for (const want of [lng, ...fallback]) {
|
|
21
|
+
if (!want) continue;
|
|
22
|
+
const exact = low.indexOf(want.toLowerCase());
|
|
23
|
+
if (exact >= 0) return available[exact];
|
|
24
|
+
const b = low.indexOf(base(want));
|
|
25
|
+
if (b >= 0) return available[b];
|
|
26
|
+
const variant = low.findIndex((a) => base(a) === base(want));
|
|
27
|
+
if (variant >= 0) return available[variant];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function loadTranslations(name, t, sri, host, timeout, priority) {
|
|
31
|
+
const files = {};
|
|
32
|
+
for (const lng in t.files) for (const ns in t.files[lng]) (files[lng] ??= {})[ns] = absolute(t.files[lng][ns], t.base);
|
|
33
|
+
remotes.set(name, { files, sri });
|
|
34
|
+
watch(host, timeout);
|
|
35
|
+
return load(name, files, sri, host, host.language(), timeout, priority);
|
|
36
|
+
}
|
|
37
|
+
function load(name, files, sri, host, lng, timeout, priority) {
|
|
38
|
+
const pick = pickLanguage(lng, Object.keys(files), host.fallback?.() ?? []);
|
|
39
|
+
if (!pick) return Promise.resolve(false);
|
|
40
|
+
return Promise.all(
|
|
41
|
+
Object.entries(files[pick]).map(([ns, url]) => {
|
|
42
|
+
let p = asked.get(url);
|
|
43
|
+
if (!p) {
|
|
44
|
+
const want = sri[url];
|
|
45
|
+
const here = !!want && !!globalThis.crypto?.subtle && want.split(/\s+/).every((t) => /^sha(256|384|512)-/.test(t));
|
|
46
|
+
p = fetchBytes(url, timeout, name, { credentials: "same-origin", priority, ...want && !here && { integrity: want } }).then(async (bytes) => {
|
|
47
|
+
if (here) await verifyIntegrity(name, bytes, want);
|
|
48
|
+
let data;
|
|
49
|
+
try {
|
|
50
|
+
data = JSON.parse(new TextDecoder().decode(bytes));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
throw new RemoteError("INVALID_MODULE", name, `JSON inv\xE1lido em ${url}`, e);
|
|
53
|
+
}
|
|
54
|
+
host.add(pick, ns, data);
|
|
55
|
+
return true;
|
|
56
|
+
});
|
|
57
|
+
p.catch(() => asked.delete(url));
|
|
58
|
+
asked.set(url, p);
|
|
59
|
+
return p;
|
|
60
|
+
}
|
|
61
|
+
return p.then(() => false);
|
|
62
|
+
})
|
|
63
|
+
).then((added) => added.includes(true));
|
|
64
|
+
}
|
|
65
|
+
function watch(host, timeout) {
|
|
66
|
+
if (watching === host || !host.onChange) return;
|
|
67
|
+
stop?.();
|
|
68
|
+
watching = host;
|
|
69
|
+
stop = host.onChange((lng) => {
|
|
70
|
+
Promise.all([...remotes].map(([name, r]) => load(name, r.files, r.sri, host, lng, timeout).catch(() => false))).then((added) => {
|
|
71
|
+
if (added.includes(true)) host.refresh?.();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function resetTranslations() {
|
|
76
|
+
stop?.();
|
|
77
|
+
asked.clear();
|
|
78
|
+
remotes.clear();
|
|
79
|
+
watching = stop = void 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
pickLanguage,
|
|
84
|
+
loadTranslations,
|
|
85
|
+
resetTranslations
|
|
86
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dedupeModule,
|
|
3
3
|
sriModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OKXLOMAG.js";
|
|
5
5
|
import {
|
|
6
6
|
prefetchCss
|
|
7
7
|
} from "./chunk-YDO7SPF4.js";
|
|
@@ -106,7 +106,7 @@ function loadRemote(name) {
|
|
|
106
106
|
return load(name).then((r) => r.module);
|
|
107
107
|
}
|
|
108
108
|
function loadModule(name) {
|
|
109
|
-
return import("./expose-
|
|
109
|
+
return import("./expose-PY7A4VM2.js").then((m) => m.resolveModule(name, (n) => loadFile(n))).catch(fail);
|
|
110
110
|
}
|
|
111
111
|
function preload(name, options = {}) {
|
|
112
112
|
const done = load(name);
|
|
@@ -146,7 +146,7 @@ function warmSsr(holder) {
|
|
|
146
146
|
}
|
|
147
147
|
function load(name, isolate, priority) {
|
|
148
148
|
const file = (n) => loadFile(n, isolate, priority);
|
|
149
|
-
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-
|
|
149
|
+
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-PY7A4VM2.js").then((m) => m.resolveTarget(name, file))).catch(fail);
|
|
150
150
|
}
|
|
151
151
|
function loadFile(name, isolate, priority) {
|
|
152
152
|
const p = protocol();
|
|
@@ -167,8 +167,11 @@ function loadFile(name, isolate, priority) {
|
|
|
167
167
|
const d = resolved.split?.dedupe;
|
|
168
168
|
if (d?.some((x) => x.uses)) (p.uses ??= {})[resolved.split.entry] = Object.fromEntries(d.map((x) => [x.name, x.uses]));
|
|
169
169
|
prefetchCss(resolved, (isolate ?? resolved.isolate ?? p.settings().isolate) === "shadow", priority);
|
|
170
|
+
const { i18n, timeout } = p.settings();
|
|
171
|
+
const words = resolved.i18n && i18n && import("./i18n-WISV4IP6.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));
|
|
170
172
|
t = performance.now();
|
|
171
173
|
const ns = await withRetry(p.settings().retries, () => importModule(name, resolved));
|
|
174
|
+
await words;
|
|
172
175
|
metric(name, "js", t);
|
|
173
176
|
return { ...resolved, module: ns?.default ?? ns, exports: ns };
|
|
174
177
|
} catch (e) {
|
|
@@ -216,6 +219,8 @@ async function resolveEntry(name, entry, priority, early) {
|
|
|
216
219
|
version: m.version,
|
|
217
220
|
sri,
|
|
218
221
|
priority,
|
|
222
|
+
// As URLs viram absolutas no módulo das traduções, que só baixa quando há o que traduzir.
|
|
223
|
+
...m.i18n && { i18n: { files: m.i18n, base: entry.url } },
|
|
219
224
|
split: m.split && typeof entry.integrity !== "string" ? {
|
|
220
225
|
entry: abs(m.split.entry),
|
|
221
226
|
chunks: (m.split.chunks ?? []).map(abs),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
loadFile,
|
|
4
4
|
registerSrc,
|
|
5
5
|
resolveEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NGO67IJR.js";
|
|
7
7
|
import {
|
|
8
8
|
injectStyles
|
|
9
9
|
} from "./chunk-YDO7SPF4.js";
|
|
@@ -87,7 +87,7 @@ var noop = () => {
|
|
|
87
87
|
async function checkUpdates() {
|
|
88
88
|
const p = protocol();
|
|
89
89
|
const found = [];
|
|
90
|
-
const { splitName } = await import("./expose-
|
|
90
|
+
const { splitName } = await import("./expose-PY7A4VM2.js");
|
|
91
91
|
const remotes = /* @__PURE__ */ new Map();
|
|
92
92
|
for (const name of live.keys()) {
|
|
93
93
|
const root = splitName(name)[0];
|
|
@@ -132,8 +132,8 @@ async function mountOnce(target, name, props, options) {
|
|
|
132
132
|
const p = protocol();
|
|
133
133
|
await p.pending();
|
|
134
134
|
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-
|
|
135
|
+
if (isolate === "iframe") return (frames ?? (await import("./reframe-RLSKSEJS.js")).noFrames)(target, name, props, options).catch(fail);
|
|
136
|
+
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-RLSKSEJS.js")).load : load)(name, isolate, options.priority);
|
|
137
137
|
const untrack = track(name, resolved);
|
|
138
138
|
ctxHooks.watch?.(name);
|
|
139
139
|
const label = resolved.name ?? name;
|
package/dist/edge.d.ts
CHANGED
package/dist/element.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Props, S as Shared, a as RemoteModule } from './types-
|
|
2
|
-
import { S as SlotStatus } from './slot
|
|
1
|
+
import { P as Props, S as Shared, a as RemoteModule } from './types-cSsvpvgE.js';
|
|
2
|
+
import { S as SlotStatus } from './slot-CxhuVuka.js';
|
|
3
3
|
import './errors-kjBv6IH_.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/element.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
VitralRemoteElement,
|
|
4
4
|
defineVitralElement,
|
|
5
5
|
elementRemote
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-B4LYXSNK.js";
|
|
7
|
+
import "./chunk-XNUU3YPA.js";
|
|
8
|
+
import "./chunk-WIQ3W6AY.js";
|
|
9
|
+
import "./chunk-NGO67IJR.js";
|
|
10
|
+
import "./chunk-OKXLOMAG.js";
|
|
11
11
|
import "./chunk-YDO7SPF4.js";
|
|
12
12
|
import "./chunk-VDVVEGAO.js";
|
|
13
13
|
import "./chunk-BQGVAXFM.js";
|