vitral 0.12.1 → 0.13.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 +5 -5
- package/dist/auto.js +5 -5
- package/dist/{chunk-B23S6737.js → chunk-2NMBPSMO.js} +35 -4
- package/dist/{chunk-JKTZODC5.js → chunk-5JNG3OG5.js} +2 -2
- package/dist/{chunk-52D6ZT4A.js → chunk-6XXPGS5Q.js} +8 -3
- package/dist/{chunk-QQWE5J6U.js → chunk-AJUORT35.js} +2 -1
- package/dist/chunk-B7LKO4HS.js +96 -0
- package/dist/{chunk-I7IFR65H.js → chunk-DSOK3BNO.js} +4 -4
- package/dist/{chunk-RGYVSS3X.js → chunk-F5USJIBT.js} +5 -5
- package/dist/{chunk-UFETTKDP.js → chunk-GB3J6I2T.js} +4 -4
- package/dist/{chunk-VDNFRNOG.js → chunk-LITYI5X7.js} +1 -1
- package/dist/{chunk-YKLWMIEH.js → chunk-SQ46TAP4.js} +1 -1
- 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-4CIS6AKL.js} +3 -3
- package/dist/federation.d.ts +1 -1
- package/dist/{hydrate-LS3MLFGN.js → hydrate-QPVDJHM7.js} +4 -4
- package/dist/i18n-TMQBOCPP.js +18 -0
- package/dist/i18n.d.ts +49 -0
- package/dist/i18n.js +50 -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/next.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-IV36WJRO.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 +104 -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
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
resolveModule,
|
|
3
3
|
resolveTarget,
|
|
4
4
|
splitName
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SQ46TAP4.js";
|
|
6
|
+
import "./chunk-6XXPGS5Q.js";
|
|
7
|
+
import "./chunk-OKXLOMAG.js";
|
|
8
8
|
import "./chunk-YDO7SPF4.js";
|
|
9
9
|
import "./chunk-VDVVEGAO.js";
|
|
10
10
|
import "./chunk-BQGVAXFM.js";
|
package/dist/federation.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hostSlot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5JNG3OG5.js";
|
|
4
4
|
import {
|
|
5
5
|
mountOnce,
|
|
6
6
|
refreshable,
|
|
7
7
|
registered,
|
|
8
8
|
track
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DSOK3BNO.js";
|
|
10
10
|
import {
|
|
11
11
|
load
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-6XXPGS5Q.js";
|
|
13
|
+
import "./chunk-OKXLOMAG.js";
|
|
14
14
|
import {
|
|
15
15
|
injectStyles
|
|
16
16
|
} from "./chunk-YDO7SPF4.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
languageReady,
|
|
3
|
+
loadTranslations,
|
|
4
|
+
pickLanguage,
|
|
5
|
+
resetTranslations
|
|
6
|
+
} from "./chunk-B7LKO4HS.js";
|
|
7
|
+
import "./chunk-UCFOXMOR.js";
|
|
8
|
+
import "./chunk-VDVVEGAO.js";
|
|
9
|
+
import "./chunk-BQGVAXFM.js";
|
|
10
|
+
import "./chunk-JWDDXX5O.js";
|
|
11
|
+
import "./chunk-GNPFWISJ.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
export {
|
|
14
|
+
languageReady,
|
|
15
|
+
loadTranslations,
|
|
16
|
+
pickLanguage,
|
|
17
|
+
resetTranslations
|
|
18
|
+
};
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { f as I18nHost } from './types-cSsvpvgE.js';
|
|
2
|
+
import './errors-kjBv6IH_.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Traduções dos remotes (`i18n` do `vitral.json`). Módulo à parte, baixado só
|
|
6
|
+
* quando um manifesto traz traduções e o host passou `configure({ i18n })`.
|
|
7
|
+
*
|
|
8
|
+
* Cada remote baixa só a língua aberta, junto com o JS, e as traduções entram
|
|
9
|
+
* no i18next (ou no que o host usar) antes da montagem. Numa troca de língua,
|
|
10
|
+
* os remotes já carregados baixam a língua nova.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Língua do remote para a língua aberta: a mesma, a base (`pt` para `pt-BR`),
|
|
15
|
+
* uma variante da base (`pt-PT` para `pt`), ou a primeira do `fallback` que o
|
|
16
|
+
* remote tiver.
|
|
17
|
+
*/
|
|
18
|
+
declare function pickLanguage(lng: string, available: string[], fallback?: string[]): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Baixa as traduções de `lng` de cada remote já carregado. Com o adaptador
|
|
21
|
+
* `i18next()`, o `changeLanguage` espera por ela: a tela troca de língua já
|
|
22
|
+
* com os textos dos remotes, sem mostrar as chaves enquanto os arquivos chegam.
|
|
23
|
+
* Uma tradução que falha não segura a troca.
|
|
24
|
+
*/
|
|
25
|
+
declare function languageReady(lng: string): Promise<void>;
|
|
26
|
+
|
|
27
|
+
/** O que o vitral usa de uma instância do i18next. */
|
|
28
|
+
interface I18nextLike {
|
|
29
|
+
language?: string;
|
|
30
|
+
options?: {
|
|
31
|
+
fallbackLng?: unknown;
|
|
32
|
+
};
|
|
33
|
+
addResourceBundle(lng: string, ns: string, resources: any, deep?: boolean, overwrite?: boolean): unknown;
|
|
34
|
+
on(event: 'languageChanged', fn: (lng: string) => void): unknown;
|
|
35
|
+
off(event: 'languageChanged', fn: (lng: string) => void): unknown;
|
|
36
|
+
changeLanguage(lng?: string, ...rest: any[]): unknown;
|
|
37
|
+
}
|
|
38
|
+
/** `fallbackLng` do i18next (texto, lista, objeto por língua ou função) como lista. */
|
|
39
|
+
declare function fallbacks(value: unknown, lng?: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Adaptador de uma instância do i18next para `configure({ i18n })`.
|
|
42
|
+
*
|
|
43
|
+
* O `changeLanguage` da instância passa a baixar antes as traduções da nova
|
|
44
|
+
* língua dos remotes já carregados: a tela troca já com os textos certos, e
|
|
45
|
+
* enquanto os arquivos chegam fica a língua anterior (nunca as chaves).
|
|
46
|
+
*/
|
|
47
|
+
declare function i18next(i: I18nextLike): I18nHost;
|
|
48
|
+
|
|
49
|
+
export { I18nHost, type I18nextLike, fallbacks, i18next, languageReady, pickLanguage };
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
languageReady,
|
|
3
|
+
pickLanguage
|
|
4
|
+
} from "./chunk-B7LKO4HS.js";
|
|
5
|
+
import "./chunk-UCFOXMOR.js";
|
|
6
|
+
import "./chunk-VDVVEGAO.js";
|
|
7
|
+
import "./chunk-BQGVAXFM.js";
|
|
8
|
+
import "./chunk-JWDDXX5O.js";
|
|
9
|
+
import "./chunk-GNPFWISJ.js";
|
|
10
|
+
import "./chunk-MLKGABMK.js";
|
|
11
|
+
|
|
12
|
+
// src/i18n.ts
|
|
13
|
+
var ready = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function fallbacks(value, lng = "") {
|
|
15
|
+
if (typeof value === "function") return fallbacks(value(lng), lng);
|
|
16
|
+
if (typeof value === "string") return [value];
|
|
17
|
+
if (Array.isArray(value)) return value.filter((x) => typeof x === "string");
|
|
18
|
+
if (value && typeof value === "object") {
|
|
19
|
+
const o = value;
|
|
20
|
+
return [...fallbacks(o[lng]), ...fallbacks(o[lng.split("-")[0]]), ...fallbacks(o.default)];
|
|
21
|
+
}
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
function i18next(i) {
|
|
25
|
+
let change = ready.get(i);
|
|
26
|
+
if (!change) {
|
|
27
|
+
const original = i.changeLanguage;
|
|
28
|
+
change = original.bind(i);
|
|
29
|
+
ready.set(i, change);
|
|
30
|
+
i.changeLanguage = (lng, ...rest) => lng ? languageReady(lng).then(() => original.call(i, lng, ...rest)) : original.call(i, lng, ...rest);
|
|
31
|
+
}
|
|
32
|
+
const set = change;
|
|
33
|
+
return {
|
|
34
|
+
language: () => i.language ?? "",
|
|
35
|
+
fallback: () => fallbacks(i.options?.fallbackLng, i.language),
|
|
36
|
+
add: (lng, ns, data) => void i.addResourceBundle(lng, ns, data, true, true),
|
|
37
|
+
onChange(fn) {
|
|
38
|
+
i.on("languageChanged", fn);
|
|
39
|
+
return () => void i.off("languageChanged", fn);
|
|
40
|
+
},
|
|
41
|
+
// O react-i18next desenha de novo no `languageChanged`, não quando um namespace entra.
|
|
42
|
+
refresh: () => void set(i.language)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
fallbacks,
|
|
47
|
+
i18next,
|
|
48
|
+
languageReady,
|
|
49
|
+
pickLanguage
|
|
50
|
+
};
|
package/dist/iframe.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
splitName
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SQ46TAP4.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyIntegrity
|
|
6
6
|
} from "./chunk-UCFOXMOR.js";
|
|
7
7
|
import {
|
|
8
8
|
setFrameMounter,
|
|
9
9
|
track
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DSOK3BNO.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveEntry
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-6XXPGS5Q.js";
|
|
14
|
+
import "./chunk-OKXLOMAG.js";
|
|
15
15
|
import "./chunk-YDO7SPF4.js";
|
|
16
16
|
import {
|
|
17
17
|
fetchBytes,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { V as VitralConfig, c as RemoteEntry, I as Isolation, e as StyleOptions, P as Props, M as MountedRemote, a as RemoteModule, E as EventBus, R as RemoteContext,
|
|
2
|
-
export {
|
|
1
|
+
import { V as VitralConfig, c as RemoteEntry, I as Isolation, e as StyleOptions, P as Props, M as MountedRemote, a as RemoteModule, E as EventBus, R as RemoteContext, g as SharedValue } from './types-cSsvpvgE.js';
|
|
2
|
+
export { h as Channel, i as ChannelContext, C as CheckedProps, D as DedupePlan, j as DevOverrides, H as Handler, k as McpAppBridge, l as PlannedCopy, m as Policy, n as PropsOf, o as ProvideOptions, p as ProvidedValue, q as RemoteContract, d as RemoteManifest, r as RemoteMetric, s as Remotes, t as RollbackInfo, S as Shared, u as SharedApi, b as SharedModules, v as SharedType, w as Signals, x as batch, y as choose, z as planDedupe, A as policy, B as provide, F as shared, G as signals, J as signalsFrom } from './types-cSsvpvgE.js';
|
|
3
3
|
import { R as RemoteError } from './errors-kjBv6IH_.js';
|
|
4
4
|
export { a as RemoteErrorCode } from './errors-kjBv6IH_.js';
|
|
5
|
-
export { P as PreloadOptions, l as loadModule, a as loadRemote, p as preload } from './loader-
|
|
6
|
-
export { R as RemoteSlot, a as SlotOptions, S as SlotStatus, c as createSlot } from './slot
|
|
7
|
-
export { e as events } from './events-
|
|
5
|
+
export { P as PreloadOptions, l as loadModule, a as loadRemote, p as preload } from './loader-vj8m2GQU.js';
|
|
6
|
+
export { R as RemoteSlot, a as SlotOptions, S as SlotStatus, c as createSlot } 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
|
export { r as __reset } from './state-B1FJi8I9.js';
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
syncTabs,
|
|
16
16
|
unsafeHTML,
|
|
17
17
|
watchUpdates
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DSOK3BNO.js";
|
|
19
19
|
import {
|
|
20
20
|
choose,
|
|
21
21
|
configure,
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
registerSrc,
|
|
28
28
|
signals,
|
|
29
29
|
signalsFrom
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-6XXPGS5Q.js";
|
|
31
|
+
import "./chunk-OKXLOMAG.js";
|
|
32
32
|
import "./chunk-YDO7SPF4.js";
|
|
33
33
|
import "./chunk-VDVVEGAO.js";
|
|
34
34
|
import {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Props, a as RemoteModule } from './types-
|
|
1
|
+
import { P as Props, a as RemoteModule } from './types-cSsvpvgE.js';
|
|
2
2
|
|
|
3
3
|
/** Baixa (uma vez só) e devolve o módulo de um remote. */
|
|
4
4
|
declare function loadRemote<P extends Props = Props>(name: string): Promise<RemoteModule<P>>;
|
package/dist/next-config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DedupePlan } from './types-
|
|
1
|
+
import { D as DedupePlan } from './types-cSsvpvgE.js';
|
|
2
2
|
import { ZoneRoute } from './next.js';
|
|
3
3
|
import './errors-kjBv6IH_.js';
|
|
4
4
|
import 'react';
|
|
@@ -14,6 +14,8 @@ interface HtmlHints {
|
|
|
14
14
|
offers?: string[];
|
|
15
15
|
/** Com `keys`: o `integrity` do preload do manifesto (só as assinaturas). */
|
|
16
16
|
signed?: string;
|
|
17
|
+
/** Traduções por língua: o HTML pré-carrega só as da língua aberta (`lang` do `VitralNext`). */
|
|
18
|
+
i18n?: Record<string, Hint[]>;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
interface NextRemoteConfig {
|
package/dist/next-config.js
CHANGED
package/dist/next-host.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { d as RemoteManifest } from './types-
|
|
2
|
+
import { d as RemoteManifest } from './types-cSsvpvgE.js';
|
|
3
3
|
import { RemoteProps } from './react.js';
|
|
4
4
|
import './errors-kjBv6IH_.js';
|
|
5
5
|
import './host-slot-Cz6EiGsB.js';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
|
-
import './loader-
|
|
8
|
-
import './events-
|
|
7
|
+
import './loader-vj8m2GQU.js';
|
|
8
|
+
import './events-XXC4si92.js';
|
|
9
9
|
|
|
10
10
|
/** O remote dono do caminho público `path`, se houver. */
|
|
11
11
|
declare function remoteFor(path: string): string | undefined;
|
|
@@ -19,13 +19,18 @@ interface VitralNextProps {
|
|
|
19
19
|
pageProps?: {
|
|
20
20
|
vitral?: Record<string, RemoteManifest | null>;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Língua aberta, para o HTML pré-carregar as traduções do remote nela
|
|
24
|
+
* (`i18n` do plugin). Padrão: o `locale` do roteador do Next.
|
|
25
|
+
*/
|
|
26
|
+
lang?: string;
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
24
29
|
* Coloque uma vez, no `_app`. Na página de um remote, o HTML já sai com as
|
|
25
30
|
* dicas de preload dele, mesmo quando a página só desenha o `NextRemote`
|
|
26
31
|
* no navegador (depois do login, por exemplo).
|
|
27
32
|
*/
|
|
28
|
-
declare function VitralNext({ pageProps }?: VitralNextProps): ReactNode;
|
|
33
|
+
declare function VitralNext({ pageProps, lang }?: VitralNextProps): ReactNode;
|
|
29
34
|
type NextRemoteProps = Omit<RemoteProps, 'name' | 'src'> & {
|
|
30
35
|
name: string;
|
|
31
36
|
/**
|
|
@@ -34,12 +39,14 @@ type NextRemoteProps = Omit<RemoteProps, 'name' | 'src'> & {
|
|
|
34
39
|
* pede o manifesto. `null` ou ausente: o preload do build e o pedido de sempre.
|
|
35
40
|
*/
|
|
36
41
|
manifest?: RemoteManifest | null;
|
|
42
|
+
/** Língua aberta, para o preload das traduções do remote. Padrão: o `locale` do roteador do Next. */
|
|
43
|
+
lang?: string;
|
|
37
44
|
};
|
|
38
45
|
/**
|
|
39
46
|
* O remote na página do host. Passa o roteador do Next ao remote (prop
|
|
40
47
|
* `__next`, lida pelo plugin no modo `next`): `useRouter`, `<Link>` e
|
|
41
48
|
* `router.push` do remote usam o do host, com as rotas públicas.
|
|
42
49
|
*/
|
|
43
|
-
declare function NextRemote({ name, props, fallback, manifest, ...rest }: NextRemoteProps): ReactNode;
|
|
50
|
+
declare function NextRemote({ name, props, fallback, manifest, lang, ...rest }: NextRemoteProps): ReactNode;
|
|
44
51
|
|
|
45
52
|
export { NextRemote, type NextRemoteProps, VitralNext, type VitralNextProps, interceptNavigation, remoteFor };
|
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-
|
|
11
|
+
} from "./chunk-F5USJIBT.js";
|
|
12
12
|
import "./chunk-KCF46XOX.js";
|
|
13
|
+
import {
|
|
14
|
+
pickLanguage
|
|
15
|
+
} from "./chunk-B7LKO4HS.js";
|
|
13
16
|
import "./chunk-UCFOXMOR.js";
|
|
14
17
|
import {
|
|
15
18
|
hintsOf
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-AJUORT35.js";
|
|
17
20
|
import "./chunk-5O6XDJBR.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-5JNG3OG5.js";
|
|
22
|
+
import "./chunk-DSOK3BNO.js";
|
|
20
23
|
import {
|
|
21
24
|
configure,
|
|
22
25
|
policy,
|
|
23
26
|
register
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6XXPGS5Q.js";
|
|
25
28
|
import {
|
|
26
29
|
bundled
|
|
27
|
-
} from "./chunk-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
|
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 {
|
package/dist/next-server.d.ts
CHANGED
|
@@ -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-
|
|
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/next.d.ts
CHANGED
|
@@ -118,7 +118,7 @@ type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'width' | 'h
|
|
|
118
118
|
}) => string;
|
|
119
119
|
onLoadingComplete?: (img: HTMLImageElement) => void;
|
|
120
120
|
};
|
|
121
|
-
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "
|
|
121
|
+
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "height" | "width" | "loading" | "src"> & {
|
|
122
122
|
src: string | StaticImage;
|
|
123
123
|
alt: string;
|
|
124
124
|
width?: number | string;
|
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-
|
|
4
|
-
export { R as RemoteContext } from './types-
|
|
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
|
|
7
|
-
export { e as events } from './events-
|
|
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-
|
|
3
|
+
} from "./chunk-5JNG3OG5.js";
|
|
4
4
|
import {
|
|
5
5
|
defineRemote,
|
|
6
6
|
memoSelect,
|
|
7
7
|
same,
|
|
8
8
|
shared
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-DSOK3BNO.js";
|
|
10
|
+
import "./chunk-6XXPGS5Q.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
package/dist/react-server.d.ts
CHANGED
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-
|
|
5
|
-
export { E as EventBus } from './types-
|
|
6
|
-
import { P as PreloadOptions } from './loader-
|
|
7
|
-
export { e as events } from './events-
|
|
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-
|
|
12
|
+
} from "./chunk-F5USJIBT.js";
|
|
13
13
|
import "./chunk-KCF46XOX.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-5JNG3OG5.js";
|
|
15
|
+
import "./chunk-DSOK3BNO.js";
|
|
16
|
+
import "./chunk-6XXPGS5Q.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-
|
|
3
|
+
} from "./chunk-SQ46TAP4.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyIntegrity
|
|
6
6
|
} from "./chunk-UCFOXMOR.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveEntry
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-6XXPGS5Q.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-
|
|
3
|
-
import { S as SlotStatus } from './slot
|
|
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-
|
|
6
|
+
} from "./chunk-DSOK3BNO.js";
|
|
7
7
|
import {
|
|
8
8
|
warmSsr
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-6XXPGS5Q.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-
|
|
125
|
+
import("./hydrate-QPVDJHM7.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
|
});
|
package/dist/single-spa.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
3
|
-
export { R as RemoteContext } from './types-
|
|
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-
|
|
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
|
|