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.
Files changed (59) hide show
  1. package/dist/angular.d.ts +2 -2
  2. package/dist/angular.js +5 -5
  3. package/dist/auto.js +5 -5
  4. package/dist/{chunk-SOENZNXO.js → chunk-2NMBPSMO.js} +87 -7
  5. package/dist/{chunk-QQWE5J6U.js → chunk-AJUORT35.js} +2 -1
  6. package/dist/{chunk-UFETTKDP.js → chunk-B4LYXSNK.js} +4 -4
  7. package/dist/{chunk-RGYVSS3X.js → chunk-C3LH5DSE.js} +5 -5
  8. package/dist/chunk-EGUHWWE4.js +86 -0
  9. package/dist/{chunk-YKLWMIEH.js → chunk-GJY5QTOO.js} +1 -1
  10. package/dist/{chunk-VDNFRNOG.js → chunk-LITYI5X7.js} +1 -1
  11. package/dist/{chunk-52D6ZT4A.js → chunk-NGO67IJR.js} +8 -3
  12. package/dist/{chunk-I7IFR65H.js → chunk-WIQ3W6AY.js} +4 -4
  13. package/dist/{chunk-JKTZODC5.js → chunk-XNUU3YPA.js} +2 -2
  14. package/dist/edge.d.ts +1 -1
  15. package/dist/element.d.ts +2 -2
  16. package/dist/element.js +5 -5
  17. package/dist/embed.js +2 -2
  18. package/dist/{events-II6hXM3Q.d.ts → events-XXC4si92.d.ts} +1 -1
  19. package/dist/{expose-KL6TA472.js → expose-PY7A4VM2.js} +3 -3
  20. package/dist/federation.d.ts +1 -1
  21. package/dist/{hydrate-LS3MLFGN.js → hydrate-UOEAX7D3.js} +4 -4
  22. package/dist/i18n-WISV4IP6.js +16 -0
  23. package/dist/i18n.d.ts +52 -0
  24. package/dist/i18n.js +39 -0
  25. package/dist/iframe.js +4 -4
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.js +3 -3
  28. package/dist/{loader-Bmul2-5T.d.ts → loader-vj8m2GQU.d.ts} +1 -1
  29. package/dist/next-config.d.ts +3 -1
  30. package/dist/next-config.js +2 -2
  31. package/dist/next-host.d.ts +12 -5
  32. package/dist/next-host.js +33 -19
  33. package/dist/next-server.d.ts +1 -1
  34. package/dist/preact.d.ts +4 -4
  35. package/dist/preact.js +4 -4
  36. package/dist/prefetch.js +2 -2
  37. package/dist/react-server.d.ts +1 -1
  38. package/dist/react.d.ts +4 -4
  39. package/dist/react.js +5 -5
  40. package/dist/{reframe-AD2UEPIO.js → reframe-RLSKSEJS.js} +3 -3
  41. package/dist/routes.d.ts +2 -2
  42. package/dist/routes.js +4 -4
  43. package/dist/single-spa.d.ts +1 -1
  44. package/dist/{slot--WLgdcW_.d.ts → slot-CxhuVuka.d.ts} +1 -1
  45. package/dist/solid.d.ts +3 -3
  46. package/dist/solid.js +4 -4
  47. package/dist/sri-Z5U32IR2.js +2 -2
  48. package/dist/svelte.d.ts +4 -4
  49. package/dist/svelte.js +4 -4
  50. package/dist/sw.d.ts +1 -1
  51. package/dist/testing.d.ts +1 -1
  52. package/dist/testing.js +3 -3
  53. package/dist/{types-DJautV-K.d.ts → types-cSsvpvgE.d.ts} +26 -1
  54. package/dist/vite.d.ts +10 -0
  55. package/dist/vite.js +107 -42
  56. package/dist/vue.d.ts +2 -2
  57. package/dist/vue.js +4 -4
  58. package/package.json +39 -24
  59. /package/dist/{chunk-QGAEXUP5.js → chunk-OKXLOMAG.js} +0 -0
package/dist/next-host.js CHANGED
@@ -1,30 +1,33 @@
1
1
  "use client";
2
- import {
3
- sri_exports
4
- } from "./chunk-VDNFRNOG.js";
5
2
  import {
6
3
  dedupe_exports
7
4
  } from "./chunk-LDOSAAEF.js";
5
+ import {
6
+ sri_exports
7
+ } from "./chunk-LITYI5X7.js";
8
8
  import {
9
9
  Remote,
10
10
  preload
11
- } from "./chunk-RGYVSS3X.js";
11
+ } from "./chunk-C3LH5DSE.js";
12
12
  import "./chunk-KCF46XOX.js";
13
+ import {
14
+ pickLanguage
15
+ } from "./chunk-EGUHWWE4.js";
13
16
  import "./chunk-UCFOXMOR.js";
14
17
  import {
15
18
  hintsOf
16
- } from "./chunk-QQWE5J6U.js";
19
+ } from "./chunk-AJUORT35.js";
17
20
  import "./chunk-5O6XDJBR.js";
18
- import "./chunk-JKTZODC5.js";
19
- import "./chunk-I7IFR65H.js";
21
+ import "./chunk-XNUU3YPA.js";
22
+ import "./chunk-WIQ3W6AY.js";
20
23
  import {
21
24
  configure,
22
25
  policy,
23
26
  register
24
- } from "./chunk-52D6ZT4A.js";
27
+ } from "./chunk-NGO67IJR.js";
25
28
  import {
26
29
  bundled
27
- } from "./chunk-QGAEXUP5.js";
30
+ } from "./chunk-OKXLOMAG.js";
28
31
  import "./chunk-YDO7SPF4.js";
29
32
  import "./chunk-VDVVEGAO.js";
30
33
  import "./chunk-BQGVAXFM.js";
@@ -38,7 +41,7 @@ import "./chunk-MLKGABMK.js";
38
41
  // src/next-host.tsx
39
42
  import Head from "next/head";
40
43
  import Router, { useRouter } from "next/router";
41
- import { createElement, Fragment, useEffect, useMemo, version as reactVersion } from "react";
44
+ import { createElement, Fragment, useEffect, useMemo, useState, version as reactVersion } from "react";
42
45
  import { plan, remotes, shared } from "vitral-next-host-config";
43
46
  var under = (path, prefix) => path === prefix || path.startsWith(prefix + "/");
44
47
  function remoteFor(path) {
@@ -109,11 +112,12 @@ function interceptClicks() {
109
112
  document.addEventListener("click", on);
110
113
  return () => document.removeEventListener("click", on);
111
114
  }
112
- function VitralNext({ pageProps } = {}) {
115
+ function VitralNext({ pageProps, lang } = {}) {
113
116
  setup();
114
117
  const router = useRouter();
115
118
  const name = remoteFor((router?.asPath ?? "/").split(/[?#]/)[0]);
116
119
  useEffect(() => {
120
+ hydrated = true;
117
121
  const here = remoteFor(location.pathname);
118
122
  const go = (name2) => preload(name2, { routes: !!remotes[name2].warmRoutes });
119
123
  if (here) go(here);
@@ -128,7 +132,8 @@ function VitralNext({ pageProps } = {}) {
128
132
  for (const id of idle) typeof cancelIdleCallback === "function" ? cancelIdleCallback(id) : clearTimeout(id);
129
133
  };
130
134
  }, []);
131
- return useMemo(() => name ? linksFor(name, pageProps?.vitral?.[name], false) : null, [name, pageProps]);
135
+ const lng = lang ?? router?.locale;
136
+ return useMemo(() => name ? linksFor(name, pageProps?.vitral?.[name], false, false, true, lng) : null, [name, pageProps, lng]);
132
137
  }
133
138
  var seeded = /* @__PURE__ */ new Map();
134
139
  function seed(name, m) {
@@ -139,33 +144,42 @@ function seed(name, m) {
139
144
  }
140
145
  var push = (url, options) => void Router.push(url, void 0, options);
141
146
  var replace = (url, options) => void Router.replace(url, void 0, options);
142
- function hints(h, shadow, replaces) {
147
+ function hints(h, shadow, replaces, low, lang) {
143
148
  if (!h) return null;
144
- const link = (as, [href, integrity, fetchPriority]) => createElement("link", { key: `vitral:${href}`, rel: "preload", as, href, crossOrigin: "anonymous", ...integrity && { integrity }, ...fetchPriority && { fetchPriority } });
149
+ const link = (as, [href, integrity, high]) => {
150
+ const fetchPriority = low ? "low" : high;
151
+ const sri = as !== "fetch" && integrity;
152
+ return createElement("link", { key: `vitral:${href}`, rel: "preload", as, href, crossOrigin: "anonymous", ...sri && { integrity: sri }, ...fetchPriority && { fetchPriority } });
153
+ };
145
154
  const out = [
146
155
  ...h.manifest ? [link("fetch", [h.manifest, h.signed])] : [],
147
156
  // Com Shadow DOM o CSS vem por fetch: o preload de estilo não serviria.
148
157
  ...shadow ? [] : h.css.map((c) => link("style", c)),
149
- ...h.js.map((j) => link("script", j))
158
+ ...h.js.map((j) => link("script", j)),
159
+ // Traduções da língua aberta, junto com o JS: o remote monta depois que elas entram.
160
+ ...lang && h.i18n ? (h.i18n[pickLanguage(lang, Object.keys(h.i18n)) ?? ""] ?? []).map((t) => link("fetch", t)) : []
150
161
  ];
151
162
  const have = new Set(out.map((l) => l.key));
152
163
  for (const href of replaces ? [replaces.manifest, ...replaces.css.map((c) => c[0]), ...replaces.js.map((j) => j[0])] : [])
153
164
  if (href && !have.has(`vitral:${href}`)) out.push(createElement("link", { key: `vitral:${href}`, rel: "dns-prefetch", href: new URL(href, "http://h.invalid").origin.replace("http://h.invalid", "/") }));
154
165
  return createElement(Head, null, ...out);
155
166
  }
156
- function linksFor(name, manifest, shadow, replaces) {
167
+ var hydrated = false;
168
+ function linksFor(name, manifest, shadow, replaces, low, lang) {
157
169
  const r = remotes[name];
158
170
  const h = manifest && r ? hintsOf(manifest, r.url, offered(), r.integrity, r.keys) : r?.hints;
159
- return hints(manifest && h ? { ...h, manifest: "" } : h, shadow, replaces ? r?.hints : void 0);
171
+ return hints(manifest && h ? { ...h, manifest: "" } : h, shadow, replaces ? r?.hints : void 0, low, lang);
160
172
  }
161
- function NextRemote({ name, props, fallback = null, manifest, ...rest }) {
173
+ function NextRemote({ name, props, fallback = null, manifest, lang, ...rest }) {
162
174
  setup();
163
175
  if (manifest) seed(name, manifest);
164
176
  const router = useRouter();
165
177
  const r = remotes[name];
166
178
  const host = useMemo(() => ({ asPath: router.asPath, basePath: r?.basePath, routes: r?.routes, push, replace, events: Router.events }), [router.asPath, r]);
167
179
  const all = useMemo(() => ({ ...props, __next: host }), [props, host]);
168
- const links = useMemo(() => linksFor(name, manifest, rest.isolate === "shadow", true), [name, manifest, rest.isolate]);
180
+ const lng = lang ?? router.locale;
181
+ const [late] = useState(() => hydrated);
182
+ const links = useMemo(() => linksFor(name, manifest, rest.isolate === "shadow", true, late, lng), [name, manifest, rest.isolate, late, lng]);
169
183
  return createElement(Fragment, null, links, router.isReady ? createElement(Remote, { ...rest, name, fallback, props: all }) : fallback);
170
184
  }
171
185
  export {
@@ -1,5 +1,5 @@
1
1
  import { S as ServerRendered } from './ssr-markup-BCPpGmss.js';
2
- import { P as Props, d as RemoteManifest } from './types-DJautV-K.js';
2
+ import { P as Props, d as RemoteManifest } from './types-cSsvpvgE.js';
3
3
  import './errors-kjBv6IH_.js';
4
4
 
5
5
  /** SSR de um remote na página do host: o `render` do servidor do remote e as props. */
package/dist/preact.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as preact from 'preact';
2
2
  import { VNode, ComponentType } from 'preact';
3
- import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-DJautV-K.js';
4
- export { R as RemoteContext } from './types-DJautV-K.js';
3
+ import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-cSsvpvgE.js';
4
+ export { R as RemoteContext } from './types-cSsvpvgE.js';
5
5
  import { R as RemoteError } from './errors-kjBv6IH_.js';
6
- import { S as SlotStatus } from './slot--WLgdcW_.js';
7
- export { e as events } from './events-II6hXM3Q.js';
6
+ import { S as SlotStatus } from './slot-CxhuVuka.js';
7
+ export { e as events } from './events-XXC4si92.js';
8
8
  export { n as navigate } from './navigate-BRG1WJUM.js';
9
9
  import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
10
10
 
package/dist/preact.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  hostSlot
3
- } from "./chunk-JKTZODC5.js";
3
+ } from "./chunk-XNUU3YPA.js";
4
4
  import {
5
5
  defineRemote,
6
6
  memoSelect,
7
7
  same,
8
8
  shared
9
- } from "./chunk-I7IFR65H.js";
10
- import "./chunk-52D6ZT4A.js";
11
- import "./chunk-QGAEXUP5.js";
9
+ } from "./chunk-WIQ3W6AY.js";
10
+ import "./chunk-NGO67IJR.js";
11
+ import "./chunk-OKXLOMAG.js";
12
12
  import "./chunk-YDO7SPF4.js";
13
13
  import "./chunk-VDVVEGAO.js";
14
14
  import "./chunk-BQGVAXFM.js";
package/dist/prefetch.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  policy,
3
3
  resolveEntry
4
- } from "./chunk-52D6ZT4A.js";
5
- import "./chunk-QGAEXUP5.js";
4
+ } from "./chunk-NGO67IJR.js";
5
+ import "./chunk-OKXLOMAG.js";
6
6
  import "./chunk-YDO7SPF4.js";
7
7
  import {
8
8
  addLink
@@ -1,6 +1,6 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { S as ServerRendered } from './ssr-markup-BCPpGmss.js';
3
- import { P as Props } from './types-DJautV-K.js';
3
+ import { P as Props } from './types-cSsvpvgE.js';
4
4
  import './errors-kjBv6IH_.js';
5
5
 
6
6
  /**
package/dist/react.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { ReactNode, ComponentType } from 'react';
2
2
  import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
3
3
  import * as JSXRuntime from 'react/jsx-runtime';
4
- import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared, R as RemoteContext } from './types-DJautV-K.js';
5
- export { E as EventBus } from './types-DJautV-K.js';
6
- import { P as PreloadOptions } from './loader-Bmul2-5T.js';
7
- export { e as events } from './events-II6hXM3Q.js';
4
+ import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared, R as RemoteContext } from './types-cSsvpvgE.js';
5
+ export { E as EventBus } from './types-cSsvpvgE.js';
6
+ import { P as PreloadOptions } from './loader-vj8m2GQU.js';
7
+ export { e as events } from './events-XXC4si92.js';
8
8
  import './errors-kjBv6IH_.js';
9
9
 
10
10
  /**
package/dist/react.js CHANGED
@@ -9,12 +9,12 @@ import {
9
9
  usePortalContainer,
10
10
  useShared,
11
11
  useVitral
12
- } from "./chunk-RGYVSS3X.js";
12
+ } from "./chunk-C3LH5DSE.js";
13
13
  import "./chunk-KCF46XOX.js";
14
- import "./chunk-JKTZODC5.js";
15
- import "./chunk-I7IFR65H.js";
16
- import "./chunk-52D6ZT4A.js";
17
- import "./chunk-QGAEXUP5.js";
14
+ import "./chunk-XNUU3YPA.js";
15
+ import "./chunk-WIQ3W6AY.js";
16
+ import "./chunk-NGO67IJR.js";
17
+ import "./chunk-OKXLOMAG.js";
18
18
  import "./chunk-YDO7SPF4.js";
19
19
  import "./chunk-VDVVEGAO.js";
20
20
  import "./chunk-BQGVAXFM.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  splitName
3
- } from "./chunk-YKLWMIEH.js";
3
+ } from "./chunk-GJY5QTOO.js";
4
4
  import {
5
5
  verifyIntegrity
6
6
  } from "./chunk-UCFOXMOR.js";
7
7
  import {
8
8
  resolveEntry
9
- } from "./chunk-52D6ZT4A.js";
10
- import "./chunk-QGAEXUP5.js";
9
+ } from "./chunk-NGO67IJR.js";
10
+ import "./chunk-OKXLOMAG.js";
11
11
  import {
12
12
  prefetchCss
13
13
  } from "./chunk-YDO7SPF4.js";
package/dist/routes.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { R as Routes, a as RouteMatch } from './match-CMBM_jLW.js';
2
- import { P as Props } from './types-DJautV-K.js';
3
- import { S as SlotStatus } from './slot--WLgdcW_.js';
2
+ import { P as Props } from './types-cSsvpvgE.js';
3
+ import { S as SlotStatus } from './slot-CxhuVuka.js';
4
4
  import './errors-kjBv6IH_.js';
5
5
 
6
6
  interface RoutesOptions {
package/dist/routes.js CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-OVVGVPIV.js";
4
4
  import {
5
5
  createSlot
6
- } from "./chunk-I7IFR65H.js";
6
+ } from "./chunk-WIQ3W6AY.js";
7
7
  import {
8
8
  warmSsr
9
- } from "./chunk-52D6ZT4A.js";
10
- import "./chunk-QGAEXUP5.js";
9
+ } from "./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";
@@ -122,7 +122,7 @@ var VitralOutletElement = class extends Base {
122
122
  if (ssr?.getAttribute("data-vitral-slot") === name) {
123
123
  this.#status("loading", null);
124
124
  warmSsr(ssr);
125
- import("./hydrate-LS3MLFGN.js").then((m) => {
125
+ import("./hydrate-UOEAX7D3.js").then((m) => {
126
126
  if (this.#route === name && !this.#slot) this.#slot = m.hydrateSlot(this, ssr, { ...options, props: this.#props });
127
127
  else ssr.remove();
128
128
  });
@@ -1,4 +1,4 @@
1
- import { P as Props, a as RemoteModule } from './types-DJautV-K.js';
1
+ import { P as Props, a as RemoteModule } from './types-cSsvpvgE.js';
2
2
  import './errors-kjBv6IH_.js';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { R as RemoteError } from './errors-kjBv6IH_.js';
2
- import { P as Props, I as Isolation, e as StyleOptions } from './types-DJautV-K.js';
2
+ import { P as Props, I as Isolation, e as StyleOptions } from './types-cSsvpvgE.js';
3
3
 
4
4
  type SlotStatus = 'loading' | 'ready' | 'error';
5
5
  interface SlotOptions<P extends Props = Props> {
package/dist/solid.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { JSX, Component, Accessor } from 'solid-js';
2
- import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-DJautV-K.js';
3
- export { R as RemoteContext } from './types-DJautV-K.js';
2
+ import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-cSsvpvgE.js';
3
+ export { R as RemoteContext } from './types-cSsvpvgE.js';
4
4
  import { R as RemoteError } from './errors-kjBv6IH_.js';
5
- export { e as events } from './events-II6hXM3Q.js';
5
+ export { e as events } from './events-XXC4si92.js';
6
6
  export { n as navigate } from './navigate-BRG1WJUM.js';
7
7
  import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
8
8
 
package/dist/solid.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  hostSlot
3
- } from "./chunk-JKTZODC5.js";
3
+ } from "./chunk-XNUU3YPA.js";
4
4
  import {
5
5
  defineRemote,
6
6
  memoSelect,
7
7
  same,
8
8
  shared
9
- } from "./chunk-I7IFR65H.js";
10
- import "./chunk-52D6ZT4A.js";
11
- import "./chunk-QGAEXUP5.js";
9
+ } from "./chunk-WIQ3W6AY.js";
10
+ import "./chunk-NGO67IJR.js";
11
+ import "./chunk-OKXLOMAG.js";
12
12
  import "./chunk-YDO7SPF4.js";
13
13
  import "./chunk-VDVVEGAO.js";
14
14
  import "./chunk-BQGVAXFM.js";
@@ -2,9 +2,9 @@ import {
2
2
  importVerified,
3
3
  signature,
4
4
  verified
5
- } from "./chunk-VDNFRNOG.js";
5
+ } from "./chunk-LITYI5X7.js";
6
6
  import "./chunk-UCFOXMOR.js";
7
- import "./chunk-QGAEXUP5.js";
7
+ import "./chunk-OKXLOMAG.js";
8
8
  import "./chunk-VDVVEGAO.js";
9
9
  import "./chunk-BQGVAXFM.js";
10
10
  import "./chunk-JWDDXX5O.js";
package/dist/svelte.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Component } from 'svelte';
2
- import { P as Props, I as Isolation, a as RemoteModule } from './types-DJautV-K.js';
3
- export { R as RemoteContext } from './types-DJautV-K.js';
2
+ import { P as Props, I as Isolation, a as RemoteModule } from './types-cSsvpvgE.js';
3
+ export { R as RemoteContext } from './types-cSsvpvgE.js';
4
4
  import { R as RemoteError } from './errors-kjBv6IH_.js';
5
- import { S as SlotStatus } from './slot--WLgdcW_.js';
6
- export { e as events } from './events-II6hXM3Q.js';
5
+ import { S as SlotStatus } from './slot-CxhuVuka.js';
6
+ export { e as events } from './events-XXC4si92.js';
7
7
  export { n as navigate } from './navigate-BRG1WJUM.js';
8
8
  import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
9
9
 
package/dist/svelte.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  hostSlot
3
- } from "./chunk-JKTZODC5.js";
3
+ } from "./chunk-XNUU3YPA.js";
4
4
  import {
5
5
  defineRemote
6
- } from "./chunk-I7IFR65H.js";
7
- import "./chunk-52D6ZT4A.js";
8
- import "./chunk-QGAEXUP5.js";
6
+ } from "./chunk-WIQ3W6AY.js";
7
+ import "./chunk-NGO67IJR.js";
8
+ import "./chunk-OKXLOMAG.js";
9
9
  import "./chunk-YDO7SPF4.js";
10
10
  import "./chunk-VDVVEGAO.js";
11
11
  import "./chunk-BQGVAXFM.js";
package/dist/sw.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as RemoteManifest } from './types-DJautV-K.js';
1
+ import { d as RemoteManifest } from './types-cSsvpvgE.js';
2
2
  import './errors-kjBv6IH_.js';
3
3
 
4
4
  interface FilesOptions {
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Props, R as RemoteContext, a as RemoteModule } from './types-DJautV-K.js';
1
+ import { P as Props, R as RemoteContext, a as RemoteModule } from './types-cSsvpvgE.js';
2
2
  export { r as resetVitral } from './state-B1FJi8I9.js';
3
3
  import './errors-kjBv6IH_.js';
4
4
 
package/dist/testing.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  harness,
5
5
  verify
6
6
  } from "./chunk-DAESKNQ6.js";
7
- import "./chunk-I7IFR65H.js";
7
+ import "./chunk-WIQ3W6AY.js";
8
8
  import {
9
9
  register
10
- } from "./chunk-52D6ZT4A.js";
11
- import "./chunk-QGAEXUP5.js";
10
+ } from "./chunk-NGO67IJR.js";
11
+ import "./chunk-OKXLOMAG.js";
12
12
  import "./chunk-YDO7SPF4.js";
13
13
  import "./chunk-VDVVEGAO.js";
14
14
  import "./chunk-BQGVAXFM.js";
@@ -437,6 +437,25 @@ interface VitralConfig {
437
437
  * host volta para a estável (veja `RemoteEntry.rollback`).
438
438
  */
439
439
  onRollback?: (info: RollbackInfo) => void;
440
+ /**
441
+ * Onde entram as traduções dos remotes (`i18n` do `vitral.json`). Com
442
+ * i18next, use `i18next(instancia)` de `vitral/i18n`. Cada remote baixa só a
443
+ * língua aberta, junto com o JS, e monta depois que ela entra.
444
+ */
445
+ i18n?: I18nHost;
446
+ }
447
+ /** As traduções do host, vistas pelo vitral (`configure({ i18n })`). */
448
+ interface I18nHost {
449
+ /** Língua aberta agora (`pt-BR`). */
450
+ language(): string;
451
+ /** Línguas a tentar quando o remote não tem a aberta, em ordem. */
452
+ fallback?(): string[];
453
+ /** Junta as traduções de um namespace (no i18next, `addResourceBundle`). */
454
+ add(lng: string, ns: string, data: unknown): void;
455
+ /** Avisa cada troca de língua. Devolve a função que para de avisar. */
456
+ onChange?(fn: (lng: string) => void): () => void;
457
+ /** Chamado quando traduções chegam depois de uma troca de língua, para a tela desenhar de novo. */
458
+ refresh?(): void;
440
459
  }
441
460
  /** Módulos de um grupo de `dedupe`, por especificador (`'react-dom/client'`). */
442
461
  type SharedModules = Record<string, unknown>;
@@ -471,6 +490,12 @@ interface RemoteManifest {
471
490
  * caminho relativo ao manifesto.
472
491
  */
473
492
  files?: Record<string, string>;
493
+ /**
494
+ * Traduções do remote, um arquivo por língua e namespace, pelo caminho
495
+ * relativo ao manifesto: `{ 'pt-BR': { conta: 'i18n/pt-BR/conta-a1b2.json' } }`.
496
+ * Com `configure({ i18n })` no host, só a língua aberta baixa, junto com o JS.
497
+ */
498
+ i18n?: Record<string, Record<string, string>>;
474
499
  /**
475
500
  * Build dividido, para navegadores que conferem o hash de cada módulo:
476
501
  * a entrada e os chunks que ela importa logo. `entry` e `integrity`
@@ -554,4 +579,4 @@ interface EventBus {
554
579
  last<T = unknown>(type: string): T | undefined;
555
580
  }
556
581
 
557
- export { provide as A, shared as B, type CheckedProps as C, type DedupePlan as D, type EventBus as E, signals as F, signalsFrom as G, type Handler as H, type Isolation as I, type MountedRemote as M, type Props as P, type RemoteContext as R, type Shared as S, type VitralConfig as V, type RemoteModule as a, type SharedModules as b, type RemoteEntry as c, type RemoteManifest as d, type StyleOptions as e, type SharedValue as f, type Channel as g, type ChannelContext as h, type DevOverrides as i, type McpAppBridge as j, type PlannedCopy as k, type Policy as l, type PropsOf as m, type ProvideOptions as n, type ProvidedValue as o, type RemoteContract as p, type RemoteMetric as q, type Remotes as r, type RollbackInfo as s, type SharedApi as t, type SharedType as u, type Signals as v, batch as w, choose as x, planDedupe as y, policy as z };
582
+ export { policy as A, provide as B, type CheckedProps as C, type DedupePlan as D, type EventBus as E, shared as F, signals as G, type Handler as H, type Isolation as I, signalsFrom as J, type MountedRemote as M, type Props as P, type RemoteContext as R, type Shared as S, type VitralConfig as V, type RemoteModule as a, type SharedModules as b, type RemoteEntry as c, type RemoteManifest as d, type StyleOptions as e, type I18nHost as f, type SharedValue as g, type Channel as h, type ChannelContext as i, type DevOverrides as j, type McpAppBridge as k, type PlannedCopy as l, type Policy as m, type PropsOf as n, type ProvideOptions as o, type ProvidedValue as p, type RemoteContract as q, type RemoteMetric as r, type Remotes as s, type RollbackInfo as t, type SharedApi as u, type SharedType as v, type Signals as w, batch as x, choose as y, planDedupe as z };
package/dist/vite.d.ts CHANGED
@@ -127,6 +127,16 @@ interface VitralViteOptions extends CssBuildOptions {
127
127
  * código-fonte sem `sideEffects` no package.json. Ex.: `['@empresa/ui']`.
128
128
  */
129
129
  sideEffectFree?: string[];
130
+ /**
131
+ * Traduções do remote, com `{lng}` (e, se houver, `{ns}`) no caminho:
132
+ * `'src/locales/{lng}/{ns}.json'` ou `'src/locales/{lng}.json'` (o
133
+ * namespace é o `name` do remote). Cada arquivo sai com hash em
134
+ * `i18n/<lng>/`, listado no `vitral.json`. Com `configure({ i18n })` no
135
+ * host, o remote baixa só a língua aberta, junto com o JS, e as traduções
136
+ * entram no i18next do host antes de montar. Tire o import estático das
137
+ * traduções do código do remote. Padrão: nenhum.
138
+ */
139
+ i18n?: string;
130
140
  /**
131
141
  * Builda com o Vite um código escrito para Next.js: `next/link`,
132
142
  * `next/image`, `next/head`, `next/dynamic`, `next/router` e