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
package/dist/solid.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/sri-Z5U32IR2.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
importVerified,
|
|
3
3
|
signature,
|
|
4
4
|
verified
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LITYI5X7.js";
|
|
6
6
|
import "./chunk-UCFOXMOR.js";
|
|
7
|
-
import "./chunk-
|
|
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-
|
|
3
|
-
export { R as RemoteContext } from './types-
|
|
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
|
|
6
|
-
export { e as events } from './events-
|
|
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-
|
|
3
|
+
} from "./chunk-5JNG3OG5.js";
|
|
4
4
|
import {
|
|
5
5
|
defineRemote
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-DSOK3BNO.js";
|
|
7
|
+
import "./chunk-6XXPGS5Q.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
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Props, R as RemoteContext, a as RemoteModule } from './types-
|
|
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-
|
|
7
|
+
import "./chunk-DSOK3BNO.js";
|
|
8
8
|
import {
|
|
9
9
|
register
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./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";
|
|
@@ -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 {
|
|
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
|
package/dist/vite.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
dedupeIds,
|
|
5
5
|
groups,
|
|
6
6
|
usedNames
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2NMBPSMO.js";
|
|
8
8
|
import {
|
|
9
9
|
extractProps,
|
|
10
10
|
typesFile
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
import "./chunk-MLKGABMK.js";
|
|
13
13
|
|
|
14
14
|
// src/vite.ts
|
|
15
|
-
import { createHash as
|
|
15
|
+
import { createHash as createHash4 } from "crypto";
|
|
16
16
|
import { createRequire as createRequire3 } from "module";
|
|
17
|
-
import { readFileSync as
|
|
18
|
-
import { join as
|
|
17
|
+
import { readFileSync as readFileSync6, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
18
|
+
import { join as join6, resolve as resolve5 } from "path";
|
|
19
19
|
|
|
20
20
|
// src/vite-exposes.ts
|
|
21
21
|
import { resolve } from "path";
|
|
@@ -189,7 +189,7 @@ ${helper()}${code.slice(at)}`;
|
|
|
189
189
|
}
|
|
190
190
|
function withSplit(m, outDir, s, groups2 = []) {
|
|
191
191
|
const files = {};
|
|
192
|
-
for (const f of [m.entry, ...m.css ?? [], ...m.shadow?.css ?? [], ...m.shadow?.global ?? [], ...s?.files ?? []]) files[f] = sri(join(outDir, f));
|
|
192
|
+
for (const f of [m.entry, ...m.css ?? [], ...m.shadow?.css ?? [], ...m.shadow?.global ?? [], ...s?.files ?? [], ...Object.values(m.i18n ?? {}).flatMap((ns) => Object.values(ns))]) files[f] = sri(join(outDir, f));
|
|
193
193
|
const dedupe = groups2.filter((g) => s?.own[g.name]).map(({ name, range, version, keys }) => {
|
|
194
194
|
const uses = Object.fromEntries(keys.filter((k) => s.uses[k]).map((k) => [k, s.uses[k]]));
|
|
195
195
|
return { name, range, version, ...s.own[name], uses };
|
|
@@ -338,6 +338,58 @@ function createSbom(input) {
|
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
// src/vite/i18n.ts
|
|
342
|
+
import { createHash as createHash3 } from "crypto";
|
|
343
|
+
import { mkdirSync, readdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
344
|
+
import { join as join3, relative, resolve as resolve2 } from "path";
|
|
345
|
+
function findTranslations(root, pattern, fallbackNs) {
|
|
346
|
+
const norm = pattern.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
347
|
+
if (!norm.includes("{lng}")) throw new Error(`[vitral] i18n: o padr\xE3o precisa de {lng} (ex.: 'src/locales/{lng}/{ns}.json'), recebeu '${pattern}'`);
|
|
348
|
+
const base = norm.slice(0, norm.indexOf("{")).replace(/[^/]*$/, "");
|
|
349
|
+
const re = new RegExp(
|
|
350
|
+
"^" + norm.split(/(\{lng\}|\{ns\})/).map((part) => part === "{lng}" ? "(?<lng>[^/]+)" : part === "{ns}" ? "(?<ns>[^/]+)" : part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("") + "$"
|
|
351
|
+
);
|
|
352
|
+
let names;
|
|
353
|
+
try {
|
|
354
|
+
names = readdirSync(resolve2(root, base), { recursive: true });
|
|
355
|
+
} catch {
|
|
356
|
+
return [];
|
|
357
|
+
}
|
|
358
|
+
const out = [];
|
|
359
|
+
for (const n of names) {
|
|
360
|
+
const rel = (base + n).replace(/\\/g, "/");
|
|
361
|
+
const m = re.exec(rel);
|
|
362
|
+
if (m?.groups) out.push({ lng: m.groups.lng, ns: m.groups.ns ?? fallbackNs, file: resolve2(root, rel) });
|
|
363
|
+
}
|
|
364
|
+
return out.sort((a, b) => a.lng + a.ns < b.lng + b.ns ? -1 : 1);
|
|
365
|
+
}
|
|
366
|
+
function emitTranslations(root, outDir, pattern, fallbackNs) {
|
|
367
|
+
const found = findTranslations(root, pattern, fallbackNs);
|
|
368
|
+
if (!found.length) return;
|
|
369
|
+
const files = {};
|
|
370
|
+
for (const { lng, ns, file } of found) {
|
|
371
|
+
let text;
|
|
372
|
+
try {
|
|
373
|
+
text = JSON.stringify(JSON.parse(readFileSync3(file, "utf8")));
|
|
374
|
+
} catch (e) {
|
|
375
|
+
throw new Error(`[vitral] i18n: JSON inv\xE1lido em ${relative(root, file)}: ${e.message}`);
|
|
376
|
+
}
|
|
377
|
+
const hash = createHash3("sha256").update(text).digest("base64url").slice(0, 8);
|
|
378
|
+
const name = `i18n/${lng}/${ns}-${hash}.json`;
|
|
379
|
+
mkdirSync(join3(outDir, "i18n", lng), { recursive: true });
|
|
380
|
+
writeFileSync2(join3(outDir, name), text);
|
|
381
|
+
(files[lng] ??= {})[ns] = name;
|
|
382
|
+
}
|
|
383
|
+
return files;
|
|
384
|
+
}
|
|
385
|
+
function devTranslations(root, pattern, fallbackNs) {
|
|
386
|
+
const found = findTranslations(root, pattern, fallbackNs);
|
|
387
|
+
if (!found.length) return;
|
|
388
|
+
const files = {};
|
|
389
|
+
for (const { lng, ns, file } of found) (files[lng] ??= {})[ns] = "/" + relative(root, file).replace(/\\/g, "/");
|
|
390
|
+
return files;
|
|
391
|
+
}
|
|
392
|
+
|
|
341
393
|
// src/css-build.ts
|
|
342
394
|
import postcss2 from "postcss";
|
|
343
395
|
|
|
@@ -560,7 +612,7 @@ function splitShadowCss(text) {
|
|
|
560
612
|
|
|
561
613
|
// src/vite/adapter.ts
|
|
562
614
|
import { existsSync as existsSync2 } from "fs";
|
|
563
|
-
import { resolve as
|
|
615
|
+
import { resolve as resolve3 } from "path";
|
|
564
616
|
var PLUGINS = [
|
|
565
617
|
[/^(preact:|prefresh$)/, "preact"],
|
|
566
618
|
[/^vite:react/, "react"],
|
|
@@ -620,7 +672,7 @@ var CANDIDATES = ["src/remote", "src/App", "src/app"];
|
|
|
620
672
|
var EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".vue", ".svelte"];
|
|
621
673
|
function findEntry(root) {
|
|
622
674
|
for (const base of CANDIDATES) {
|
|
623
|
-
for (const ext of EXTENSIONS) if (existsSync2(
|
|
675
|
+
for (const ext of EXTENSIONS) if (existsSync2(resolve3(root, base + ext))) return base + ext;
|
|
624
676
|
}
|
|
625
677
|
}
|
|
626
678
|
|
|
@@ -781,9 +833,9 @@ function nextDefine(env, mode) {
|
|
|
781
833
|
}
|
|
782
834
|
|
|
783
835
|
// src/vite/tsconfig.ts
|
|
784
|
-
import { existsSync as existsSync3, readFileSync as
|
|
836
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
|
|
785
837
|
import { createRequire } from "module";
|
|
786
|
-
import { dirname as dirname2, join as
|
|
838
|
+
import { dirname as dirname2, join as join4, resolve as resolve4 } from "path";
|
|
787
839
|
function parseJsonc(text) {
|
|
788
840
|
let out = "";
|
|
789
841
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -809,18 +861,18 @@ function parseJsonc(text) {
|
|
|
809
861
|
function read(file, seen = /* @__PURE__ */ new Set()) {
|
|
810
862
|
if (seen.has(file)) return {};
|
|
811
863
|
seen.add(file);
|
|
812
|
-
const json = parseJsonc(
|
|
864
|
+
const json = parseJsonc(readFileSync4(file, "utf8"));
|
|
813
865
|
const dir = dirname2(file);
|
|
814
866
|
let inherited = {};
|
|
815
867
|
for (const ext of [json.extends ?? []].flat()) {
|
|
816
868
|
try {
|
|
817
|
-
const from = ext.startsWith(".") ?
|
|
869
|
+
const from = ext.startsWith(".") ? resolve4(dir, ext) : createRequire(file).resolve(ext);
|
|
818
870
|
inherited = { ...inherited, ...read(existsSync3(from) ? from : from + ".json", seen) };
|
|
819
871
|
} catch {
|
|
820
872
|
}
|
|
821
873
|
}
|
|
822
874
|
const o = json.compilerOptions ?? {};
|
|
823
|
-
const baseUrl = o.baseUrl != null ?
|
|
875
|
+
const baseUrl = o.baseUrl != null ? resolve4(dir, o.baseUrl) : inherited.baseUrl;
|
|
824
876
|
return {
|
|
825
877
|
baseUrl,
|
|
826
878
|
paths: o.paths ?? inherited.paths,
|
|
@@ -836,7 +888,7 @@ function pathsFor(file) {
|
|
|
836
888
|
}
|
|
837
889
|
function tsconfigFor(dir) {
|
|
838
890
|
if (cache.has(dir)) return cache.get(dir);
|
|
839
|
-
const file =
|
|
891
|
+
const file = join4(dir, "tsconfig.json");
|
|
840
892
|
let found;
|
|
841
893
|
if (existsSync3(file)) {
|
|
842
894
|
try {
|
|
@@ -859,7 +911,7 @@ function pathCandidates(id, c) {
|
|
|
859
911
|
}
|
|
860
912
|
if (!best) return;
|
|
861
913
|
const out = best.targets.map((t) => {
|
|
862
|
-
const path =
|
|
914
|
+
const path = resolve4(c.base, t.replace("*", best.rest));
|
|
863
915
|
return path.replace(/\\/g, "/").endsWith(`/node_modules/${id}`) ? id : path;
|
|
864
916
|
});
|
|
865
917
|
return out.every((t) => t === id) ? void 0 : out;
|
|
@@ -907,12 +959,12 @@ function optimizerPaths(rolldown) {
|
|
|
907
959
|
}
|
|
908
960
|
|
|
909
961
|
// src/vite/svg.ts
|
|
910
|
-
import { readFileSync as
|
|
962
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
911
963
|
import { createRequire as createRequire2 } from "module";
|
|
912
|
-
import { basename, join as
|
|
964
|
+
import { basename, join as join5 } from "path";
|
|
913
965
|
import { pathToFileURL } from "url";
|
|
914
966
|
async function svgComponents(root) {
|
|
915
|
-
const req = createRequire2(
|
|
967
|
+
const req = createRequire2(join5(root, "package.json"));
|
|
916
968
|
const load = async (id) => import(pathToFileURL(req.resolve(id)).href).then((m) => m.default ?? m);
|
|
917
969
|
let svgr;
|
|
918
970
|
let plugins;
|
|
@@ -930,7 +982,7 @@ async function svgComponents(root) {
|
|
|
930
982
|
return {
|
|
931
983
|
async transform(file) {
|
|
932
984
|
const name = basename(file, ".svg").replace(/(^|[^a-zA-Z0-9])([a-zA-Z0-9])/g, (_, _s, c) => c.toUpperCase());
|
|
933
|
-
const jsx = await svgr(
|
|
985
|
+
const jsx = await svgr(readFileSync5(file, "utf8"), { plugins, jsxRuntime: "automatic" }, { filePath: file, componentName: `Svg${name}` });
|
|
934
986
|
const out = vite.transformWithOxc ? await vite.transformWithOxc(jsx, file + ".jsx", { lang: "jsx", jsx: { runtime: "automatic" } }) : await vite.transformWithEsbuild(jsx, file + ".jsx", { loader: "jsx", jsx: "automatic" });
|
|
935
987
|
return { code: out.code, map: null };
|
|
936
988
|
}
|
|
@@ -1038,7 +1090,7 @@ function vitral(options = {}) {
|
|
|
1038
1090
|
let entry = options.entry;
|
|
1039
1091
|
let adapter = "element";
|
|
1040
1092
|
let framework = "element";
|
|
1041
|
-
const entryFile = () =>
|
|
1093
|
+
const entryFile = () => resolve5(root, entry);
|
|
1042
1094
|
let serve = false;
|
|
1043
1095
|
let minify = false;
|
|
1044
1096
|
let rolldown = false;
|
|
@@ -1057,8 +1109,8 @@ function vitral(options = {}) {
|
|
|
1057
1109
|
const mcpApp = (files2, js) => {
|
|
1058
1110
|
const css = files2.filter((f) => f.type === "asset" && f.fileName.endsWith(".css")).map((f) => f.fileName);
|
|
1059
1111
|
const read2 = (file) => {
|
|
1060
|
-
const text =
|
|
1061
|
-
rmSync2(
|
|
1112
|
+
const text = readFileSync6(join6(outDir, file), "utf8");
|
|
1113
|
+
rmSync2(join6(outDir, file));
|
|
1062
1114
|
return text;
|
|
1063
1115
|
};
|
|
1064
1116
|
const scope = options.scopeCss === false ? void 0 : scopeName();
|
|
@@ -1069,12 +1121,12 @@ function vitral(options = {}) {
|
|
|
1069
1121
|
code: read2(js),
|
|
1070
1122
|
css: css.map((f) => transformCss(read2(f), options, scopeName()))
|
|
1071
1123
|
});
|
|
1072
|
-
|
|
1124
|
+
writeFileSync3(join6(outDir, "mcp-app.html"), html);
|
|
1073
1125
|
};
|
|
1074
1126
|
return {
|
|
1075
1127
|
name: "vitral",
|
|
1076
1128
|
async config(user, { mode, command }) {
|
|
1077
|
-
entry ??= findEntry(
|
|
1129
|
+
entry ??= findEntry(resolve5(user.root ?? process.cwd()));
|
|
1078
1130
|
if (!entry) throw new Error("[vitral] n\xE3o achei a entrada do remote (src/remote.* ou src/App.*). Use vitral({ entry }).");
|
|
1079
1131
|
rolldown = "rolldownVersion" in (this?.meta ?? {});
|
|
1080
1132
|
if (next && command === "build" && mode !== "development" && process.env.VITE_USER_NODE_ENV === void 0) process.env.VITE_USER_NODE_ENV = "";
|
|
@@ -1126,9 +1178,9 @@ function vitral(options = {}) {
|
|
|
1126
1178
|
if (!serve && c.mode !== "development" && process.env.NODE_ENV === "development") {
|
|
1127
1179
|
throw new Error("[vitral] NODE_ENV=development (de um .env?) num build de produ\xE7\xE3o: o JSX sai com jsxDEV e o remote quebra. Rode com NODE_ENV=production.");
|
|
1128
1180
|
}
|
|
1129
|
-
outDir =
|
|
1181
|
+
outDir = resolve5(c.root, c.build.outDir);
|
|
1130
1182
|
try {
|
|
1131
|
-
pkg = JSON.parse(
|
|
1183
|
+
pkg = JSON.parse(readFileSync6(join6(root, "package.json"), "utf8"));
|
|
1132
1184
|
} catch {
|
|
1133
1185
|
}
|
|
1134
1186
|
},
|
|
@@ -1141,7 +1193,12 @@ function vitral(options = {}) {
|
|
|
1141
1193
|
// Modo dev: /vitral.json aponta para um módulo com o cliente HMR.
|
|
1142
1194
|
configureServer(server) {
|
|
1143
1195
|
const scope = options.scopeCss === false ? void 0 : scopeName();
|
|
1144
|
-
|
|
1196
|
+
const name = () => options.name ?? pkg.name ?? "remote";
|
|
1197
|
+
serveDevManifest(server, () => {
|
|
1198
|
+
const m = devManifest(name(), scope);
|
|
1199
|
+
const i18n = options.i18n ? devTranslations(root, options.i18n, name()) : void 0;
|
|
1200
|
+
return i18n ? { ...m, i18n } : m;
|
|
1201
|
+
});
|
|
1145
1202
|
},
|
|
1146
1203
|
// Filtros de hook (Rolldown, Vite 6.3+): os módulos que não são do vitral
|
|
1147
1204
|
// nem chegam ao JS. As checagens nos handlers continuam para Vite 5 e 6.0-6.2.
|
|
@@ -1196,8 +1253,8 @@ function vitral(options = {}) {
|
|
|
1196
1253
|
if (exposed != null) return exposed;
|
|
1197
1254
|
const shim = next && loadNext(id, next);
|
|
1198
1255
|
if (shim) return shim;
|
|
1199
|
-
if (id === VIRTUAL_ENTRY) return entryCode(
|
|
1200
|
-
if (id === VIRTUAL_DEV_ENTRY) return devEntryCode(framework, options.adapter === false ?
|
|
1256
|
+
if (id === VIRTUAL_ENTRY) return entryCode(resolve5(root, entry), adapter, scopeName(), !!next);
|
|
1257
|
+
if (id === VIRTUAL_DEV_ENTRY) return devEntryCode(framework, options.adapter === false ? resolve5(root, entry) : void 0);
|
|
1201
1258
|
return loadPreamble(id);
|
|
1202
1259
|
}
|
|
1203
1260
|
},
|
|
@@ -1225,15 +1282,15 @@ function vitral(options = {}) {
|
|
|
1225
1282
|
if (!entry2) return;
|
|
1226
1283
|
if (mcp) return mcpApp(files2, entry2.fileName);
|
|
1227
1284
|
const emit = (file, text, kind = "") => {
|
|
1228
|
-
const hash =
|
|
1285
|
+
const hash = createHash4("sha256").update(text).digest("base64url").slice(0, 8);
|
|
1229
1286
|
const name = file.replace(/\.css$/, `${kind}-${hash}.css`);
|
|
1230
|
-
|
|
1287
|
+
writeFileSync3(join6(outDir, name), text);
|
|
1231
1288
|
return name;
|
|
1232
1289
|
};
|
|
1233
1290
|
const shadow = { css: [] };
|
|
1234
1291
|
const css = files2.filter((f) => f.type === "asset" && f.fileName.endsWith(".css")).map((f) => {
|
|
1235
|
-
const from =
|
|
1236
|
-
const text = transformCss(
|
|
1292
|
+
const from = join6(outDir, f.fileName);
|
|
1293
|
+
const text = transformCss(readFileSync6(from, "utf8"), options, scopeName());
|
|
1237
1294
|
const name = emit(f.fileName, text);
|
|
1238
1295
|
if (name !== f.fileName) rmSync2(from);
|
|
1239
1296
|
const split2 = splitShadowCss(text);
|
|
@@ -1243,14 +1300,14 @@ function vitral(options = {}) {
|
|
|
1243
1300
|
if (split2.rebase) shadow.rebase = true;
|
|
1244
1301
|
return name;
|
|
1245
1302
|
});
|
|
1246
|
-
const code =
|
|
1303
|
+
const code = readFileSync6(join6(outDir, entry2.fileName));
|
|
1247
1304
|
manifest = {
|
|
1248
1305
|
name: options.name ?? pkg.name ?? "remote",
|
|
1249
1306
|
version: options.version ?? pkg.version,
|
|
1250
1307
|
entry: entry2.fileName,
|
|
1251
1308
|
css,
|
|
1252
1309
|
...css.length ? { shadow } : {},
|
|
1253
|
-
integrity: "sha384-" +
|
|
1310
|
+
integrity: "sha384-" + createHash4("sha384").update(code).digest("base64"),
|
|
1254
1311
|
...options.scopeCss === false ? {} : { scope: scopeName() },
|
|
1255
1312
|
...options.exposes ? { exposes: Object.keys(exposeKeys(options.exposes)) } : {},
|
|
1256
1313
|
...contractOf(options.contract?.version, shared)
|
|
@@ -1258,17 +1315,22 @@ function vitral(options = {}) {
|
|
|
1258
1315
|
},
|
|
1259
1316
|
async closeBundle() {
|
|
1260
1317
|
if (!manifest) return;
|
|
1318
|
+
if (options.i18n) {
|
|
1319
|
+
const i18n = emitTranslations(root, outDir, options.i18n, manifest.name);
|
|
1320
|
+
if (i18n) manifest.i18n = i18n;
|
|
1321
|
+
else this.warn(`i18n: nenhum arquivo em '${options.i18n}'`);
|
|
1322
|
+
}
|
|
1261
1323
|
const done = withSplit(manifest, outDir, split, shared);
|
|
1262
1324
|
if (options.sbom) {
|
|
1263
|
-
const bom = createSbom({ root, name: done.name, version: done.version, files: modules, entry:
|
|
1264
|
-
|
|
1265
|
-
done.sbom = { file: SBOM_FILE, integrity: sri(
|
|
1325
|
+
const bom = createSbom({ root, name: done.name, version: done.version, files: modules, entry: readFileSync6(join6(outDir, done.entry)), tool: ownVersion() });
|
|
1326
|
+
writeFileSync3(join6(outDir, SBOM_FILE), JSON.stringify(bom, null, 2) + "\n");
|
|
1327
|
+
done.sbom = { file: SBOM_FILE, integrity: sri(join6(outDir, SBOM_FILE)) };
|
|
1266
1328
|
}
|
|
1267
1329
|
manifest = split = void 0;
|
|
1268
1330
|
modules = /* @__PURE__ */ new Set();
|
|
1269
|
-
|
|
1331
|
+
writeFileSync3(join6(outDir, "vitral.json"), JSON.stringify(done, null, 2) + "\n");
|
|
1270
1332
|
const props = options.types === false ? null : await extractProps(root, entryFile());
|
|
1271
|
-
if (props)
|
|
1333
|
+
if (props) writeFileSync3(join6(outDir, "vitral.d.ts"), typesFile(done.name, props));
|
|
1272
1334
|
}
|
|
1273
1335
|
};
|
|
1274
1336
|
}
|
|
@@ -1291,18 +1353,18 @@ async function nodeResolve(id, importer) {
|
|
|
1291
1353
|
}
|
|
1292
1354
|
function ownVersion() {
|
|
1293
1355
|
try {
|
|
1294
|
-
return JSON.parse(
|
|
1356
|
+
return JSON.parse(readFileSync6(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
1295
1357
|
} catch {
|
|
1296
1358
|
return void 0;
|
|
1297
1359
|
}
|
|
1298
1360
|
}
|
|
1299
1361
|
function versionDir(root, outDir = "dist", version) {
|
|
1300
1362
|
try {
|
|
1301
|
-
version ??= JSON.parse(
|
|
1363
|
+
version ??= JSON.parse(readFileSync6(join6(resolve5(root), "package.json"), "utf8")).version;
|
|
1302
1364
|
} catch {
|
|
1303
1365
|
}
|
|
1304
1366
|
if (!version) throw new Error('[vitral] versionDir precisa de uma vers\xE3o: use vitral({ version }) ou "version" no package.json.');
|
|
1305
|
-
return
|
|
1367
|
+
return join6(outDir, version);
|
|
1306
1368
|
}
|
|
1307
1369
|
function contractOf(version, groups2) {
|
|
1308
1370
|
const contract = {
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, App, ShallowRef, WritableComputedRef, ComputedRef, Component } from 'vue';
|
|
3
|
-
import { P as Props, I as Isolation, R as RemoteContext, S as Shared, a as RemoteModule } from './types-
|
|
4
|
-
export { e as events } from './events-
|
|
3
|
+
import { P as Props, I as Isolation, R as RemoteContext, S as Shared, a as RemoteModule } from './types-cSsvpvgE.js';
|
|
4
|
+
export { e as events } from './events-XXC4si92.js';
|
|
5
5
|
import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
|
|
6
6
|
import './errors-kjBv6IH_.js';
|
|
7
7
|
|
package/dist/vue.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hostSlot,
|
|
3
3
|
timings
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5JNG3OG5.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-DSOK3BNO.js";
|
|
11
|
+
import "./chunk-6XXPGS5Q.js";
|
|
12
|
+
import "./chunk-OKXLOMAG.js";
|
|
13
13
|
import "./chunk-YDO7SPF4.js";
|
|
14
14
|
import {
|
|
15
15
|
absolute
|