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/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
|
},
|
|
@@ -1214,6 +1271,9 @@ function vitral(options = {}) {
|
|
|
1214
1271
|
if (serve && options.scopeCss !== false) return scopeDevCss(code, id, scopeName(), options.scopeCss === "native");
|
|
1215
1272
|
}
|
|
1216
1273
|
},
|
|
1274
|
+
generateBundle(_, bundle) {
|
|
1275
|
+
if (dedupe && !serve && isSplit(bundle)) hooks.leaks(this, root);
|
|
1276
|
+
},
|
|
1217
1277
|
writeBundle(_, bundle) {
|
|
1218
1278
|
if (options.sbom) bundledFiles(bundle, modules);
|
|
1219
1279
|
if (isSplit(bundle)) return void (split = collect(outDir, bundle));
|
|
@@ -1222,15 +1282,15 @@ function vitral(options = {}) {
|
|
|
1222
1282
|
if (!entry2) return;
|
|
1223
1283
|
if (mcp) return mcpApp(files2, entry2.fileName);
|
|
1224
1284
|
const emit = (file, text, kind = "") => {
|
|
1225
|
-
const hash =
|
|
1285
|
+
const hash = createHash4("sha256").update(text).digest("base64url").slice(0, 8);
|
|
1226
1286
|
const name = file.replace(/\.css$/, `${kind}-${hash}.css`);
|
|
1227
|
-
|
|
1287
|
+
writeFileSync3(join6(outDir, name), text);
|
|
1228
1288
|
return name;
|
|
1229
1289
|
};
|
|
1230
1290
|
const shadow = { css: [] };
|
|
1231
1291
|
const css = files2.filter((f) => f.type === "asset" && f.fileName.endsWith(".css")).map((f) => {
|
|
1232
|
-
const from =
|
|
1233
|
-
const text = transformCss(
|
|
1292
|
+
const from = join6(outDir, f.fileName);
|
|
1293
|
+
const text = transformCss(readFileSync6(from, "utf8"), options, scopeName());
|
|
1234
1294
|
const name = emit(f.fileName, text);
|
|
1235
1295
|
if (name !== f.fileName) rmSync2(from);
|
|
1236
1296
|
const split2 = splitShadowCss(text);
|
|
@@ -1240,14 +1300,14 @@ function vitral(options = {}) {
|
|
|
1240
1300
|
if (split2.rebase) shadow.rebase = true;
|
|
1241
1301
|
return name;
|
|
1242
1302
|
});
|
|
1243
|
-
const code =
|
|
1303
|
+
const code = readFileSync6(join6(outDir, entry2.fileName));
|
|
1244
1304
|
manifest = {
|
|
1245
1305
|
name: options.name ?? pkg.name ?? "remote",
|
|
1246
1306
|
version: options.version ?? pkg.version,
|
|
1247
1307
|
entry: entry2.fileName,
|
|
1248
1308
|
css,
|
|
1249
1309
|
...css.length ? { shadow } : {},
|
|
1250
|
-
integrity: "sha384-" +
|
|
1310
|
+
integrity: "sha384-" + createHash4("sha384").update(code).digest("base64"),
|
|
1251
1311
|
...options.scopeCss === false ? {} : { scope: scopeName() },
|
|
1252
1312
|
...options.exposes ? { exposes: Object.keys(exposeKeys(options.exposes)) } : {},
|
|
1253
1313
|
...contractOf(options.contract?.version, shared)
|
|
@@ -1255,17 +1315,22 @@ function vitral(options = {}) {
|
|
|
1255
1315
|
},
|
|
1256
1316
|
async closeBundle() {
|
|
1257
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
|
+
}
|
|
1258
1323
|
const done = withSplit(manifest, outDir, split, shared);
|
|
1259
1324
|
if (options.sbom) {
|
|
1260
|
-
const bom = createSbom({ root, name: done.name, version: done.version, files: modules, entry:
|
|
1261
|
-
|
|
1262
|
-
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)) };
|
|
1263
1328
|
}
|
|
1264
1329
|
manifest = split = void 0;
|
|
1265
1330
|
modules = /* @__PURE__ */ new Set();
|
|
1266
|
-
|
|
1331
|
+
writeFileSync3(join6(outDir, "vitral.json"), JSON.stringify(done, null, 2) + "\n");
|
|
1267
1332
|
const props = options.types === false ? null : await extractProps(root, entryFile());
|
|
1268
|
-
if (props)
|
|
1333
|
+
if (props) writeFileSync3(join6(outDir, "vitral.d.ts"), typesFile(done.name, props));
|
|
1269
1334
|
}
|
|
1270
1335
|
};
|
|
1271
1336
|
}
|
|
@@ -1288,18 +1353,18 @@ async function nodeResolve(id, importer) {
|
|
|
1288
1353
|
}
|
|
1289
1354
|
function ownVersion() {
|
|
1290
1355
|
try {
|
|
1291
|
-
return JSON.parse(
|
|
1356
|
+
return JSON.parse(readFileSync6(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
1292
1357
|
} catch {
|
|
1293
1358
|
return void 0;
|
|
1294
1359
|
}
|
|
1295
1360
|
}
|
|
1296
1361
|
function versionDir(root, outDir = "dist", version) {
|
|
1297
1362
|
try {
|
|
1298
|
-
version ??= JSON.parse(
|
|
1363
|
+
version ??= JSON.parse(readFileSync6(join6(resolve5(root), "package.json"), "utf8")).version;
|
|
1299
1364
|
} catch {
|
|
1300
1365
|
}
|
|
1301
1366
|
if (!version) throw new Error('[vitral] versionDir precisa de uma vers\xE3o: use vitral({ version }) ou "version" no package.json.');
|
|
1302
|
-
return
|
|
1367
|
+
return join6(outDir, version);
|
|
1303
1368
|
}
|
|
1304
1369
|
function contractOf(version, groups2) {
|
|
1305
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-XNUU3YPA.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-WIQ3W6AY.js";
|
|
11
|
+
import "./chunk-NGO67IJR.js";
|
|
12
|
+
import "./chunk-OKXLOMAG.js";
|
|
13
13
|
import "./chunk-YDO7SPF4.js";
|
|
14
14
|
import {
|
|
15
15
|
absolute
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitral",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Micro-frontends com qualquer framework, sem configurar build no host. React, Next.js, Vue, Nuxt, Angular, Svelte e outros na mesma página.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"micro-frontend",
|
|
@@ -120,6 +120,10 @@
|
|
|
120
120
|
"types": "./dist/testing.d.ts",
|
|
121
121
|
"import": "./dist/testing.js"
|
|
122
122
|
},
|
|
123
|
+
"./i18n": {
|
|
124
|
+
"types": "./dist/i18n.d.ts",
|
|
125
|
+
"import": "./dist/i18n.js"
|
|
126
|
+
},
|
|
123
127
|
"./sentry": {
|
|
124
128
|
"types": "./dist/sentry.d.ts",
|
|
125
129
|
"import": "./dist/sentry.js"
|
|
@@ -282,9 +286,10 @@
|
|
|
282
286
|
"./expose-*",
|
|
283
287
|
"./capture-*",
|
|
284
288
|
"./channel-*",
|
|
285
|
-
"./hydrate-*"
|
|
289
|
+
"./hydrate-*",
|
|
290
|
+
"./i18n-*"
|
|
286
291
|
],
|
|
287
|
-
"limit": "5.
|
|
292
|
+
"limit": "5.35 kB"
|
|
288
293
|
},
|
|
289
294
|
{
|
|
290
295
|
"name": "núcleo",
|
|
@@ -301,9 +306,10 @@
|
|
|
301
306
|
"./expose-*",
|
|
302
307
|
"./capture-*",
|
|
303
308
|
"./channel-*",
|
|
304
|
-
"./hydrate-*"
|
|
309
|
+
"./hydrate-*",
|
|
310
|
+
"./i18n-*"
|
|
305
311
|
],
|
|
306
|
-
"limit": "6.
|
|
312
|
+
"limit": "6.33 kB"
|
|
307
313
|
},
|
|
308
314
|
{
|
|
309
315
|
"name": "SRI e dedupe (sob demanda, com as dependências)",
|
|
@@ -343,9 +349,10 @@
|
|
|
343
349
|
"./expose-*",
|
|
344
350
|
"./capture-*",
|
|
345
351
|
"./channel-*",
|
|
346
|
-
"./hydrate-*"
|
|
352
|
+
"./hydrate-*",
|
|
353
|
+
"./i18n-*"
|
|
347
354
|
],
|
|
348
|
-
"limit": "
|
|
355
|
+
"limit": "6.02 kB"
|
|
349
356
|
},
|
|
350
357
|
{
|
|
351
358
|
"name": "host mínimo + store + persist + syncTabs",
|
|
@@ -362,9 +369,10 @@
|
|
|
362
369
|
"./expose-*",
|
|
363
370
|
"./capture-*",
|
|
364
371
|
"./channel-*",
|
|
365
|
-
"./hydrate-*"
|
|
372
|
+
"./hydrate-*",
|
|
373
|
+
"./i18n-*"
|
|
366
374
|
],
|
|
367
|
-
"limit": "6.
|
|
375
|
+
"limit": "6.24 kB"
|
|
368
376
|
},
|
|
369
377
|
{
|
|
370
378
|
"name": "reframe: JS em iframe oculto, DOM no Shadow DOM (sob demanda, além do núcleo e do Shadow DOM)",
|
|
@@ -408,9 +416,10 @@
|
|
|
408
416
|
"./expose-*",
|
|
409
417
|
"./capture-*",
|
|
410
418
|
"./channel-*",
|
|
411
|
-
"./hydrate-*"
|
|
419
|
+
"./hydrate-*",
|
|
420
|
+
"./i18n-*"
|
|
412
421
|
],
|
|
413
|
-
"limit": "7.
|
|
422
|
+
"limit": "7.42 kB"
|
|
414
423
|
},
|
|
415
424
|
{
|
|
416
425
|
"name": "vue",
|
|
@@ -428,9 +437,10 @@
|
|
|
428
437
|
"./expose-*",
|
|
429
438
|
"./capture-*",
|
|
430
439
|
"./channel-*",
|
|
431
|
-
"./hydrate-*"
|
|
440
|
+
"./hydrate-*",
|
|
441
|
+
"./i18n-*"
|
|
432
442
|
],
|
|
433
|
-
"limit": "6.
|
|
443
|
+
"limit": "6.79 kB"
|
|
434
444
|
},
|
|
435
445
|
{
|
|
436
446
|
"name": "element",
|
|
@@ -447,9 +457,10 @@
|
|
|
447
457
|
"./expose-*",
|
|
448
458
|
"./capture-*",
|
|
449
459
|
"./channel-*",
|
|
450
|
-
"./hydrate-*"
|
|
460
|
+
"./hydrate-*",
|
|
461
|
+
"./i18n-*"
|
|
451
462
|
],
|
|
452
|
-
"limit": "7.
|
|
463
|
+
"limit": "7.16 kB"
|
|
453
464
|
},
|
|
454
465
|
{
|
|
455
466
|
"name": "devtools",
|
|
@@ -460,7 +471,7 @@
|
|
|
460
471
|
{
|
|
461
472
|
"name": "auto",
|
|
462
473
|
"path": "dist/auto.js",
|
|
463
|
-
"limit": "7.
|
|
474
|
+
"limit": "7.33 kB",
|
|
464
475
|
"ignore": [
|
|
465
476
|
"./shadow-*",
|
|
466
477
|
"./reframe-*",
|
|
@@ -472,20 +483,22 @@
|
|
|
472
483
|
"./expose-*",
|
|
473
484
|
"./capture-*",
|
|
474
485
|
"./channel-*",
|
|
475
|
-
"./hydrate-*"
|
|
486
|
+
"./hydrate-*",
|
|
487
|
+
"./i18n-*"
|
|
476
488
|
]
|
|
477
489
|
},
|
|
478
490
|
{
|
|
479
491
|
"name": "routes",
|
|
480
492
|
"path": "dist/routes.js",
|
|
481
493
|
"import": "{ routes }",
|
|
482
|
-
"limit": "10.
|
|
494
|
+
"limit": "10.56 kB",
|
|
483
495
|
"ignore": [
|
|
484
496
|
"./overrides-*",
|
|
485
497
|
"./stale-*",
|
|
486
498
|
"./channel-*",
|
|
487
499
|
"./reframe-*",
|
|
488
|
-
"./hydrate-*"
|
|
500
|
+
"./hydrate-*",
|
|
501
|
+
"./i18n-*"
|
|
489
502
|
]
|
|
490
503
|
},
|
|
491
504
|
{
|
|
@@ -504,7 +517,7 @@
|
|
|
504
517
|
"name": "prefetch",
|
|
505
518
|
"path": "dist/prefetch.js",
|
|
506
519
|
"import": "{ prefetch }",
|
|
507
|
-
"limit": "4.
|
|
520
|
+
"limit": "4.24 kB",
|
|
508
521
|
"ignore": [
|
|
509
522
|
"./shadow-*",
|
|
510
523
|
"./overrides-*",
|
|
@@ -514,26 +527,28 @@
|
|
|
514
527
|
"./contract-*",
|
|
515
528
|
"./expose-*",
|
|
516
529
|
"./capture-*",
|
|
517
|
-
"./channel-*"
|
|
530
|
+
"./channel-*",
|
|
531
|
+
"./i18n-*"
|
|
518
532
|
]
|
|
519
533
|
},
|
|
520
534
|
{
|
|
521
535
|
"name": "iframe",
|
|
522
536
|
"path": "dist/iframe.js",
|
|
523
537
|
"import": "{ enableIframe }",
|
|
524
|
-
"limit": "6.
|
|
538
|
+
"limit": "6.2 kB",
|
|
525
539
|
"ignore": [
|
|
526
540
|
"./overrides-*",
|
|
527
541
|
"./stale-*",
|
|
528
542
|
"./channel-*",
|
|
529
543
|
"./reframe-*",
|
|
530
|
-
"./hydrate-*"
|
|
544
|
+
"./hydrate-*",
|
|
545
|
+
"./i18n-*"
|
|
531
546
|
]
|
|
532
547
|
},
|
|
533
548
|
{
|
|
534
549
|
"name": "embed (loader de sites de terceiros, arquivo único com Shadow DOM, SRI e canal)",
|
|
535
550
|
"path": "dist/embed.js",
|
|
536
|
-
"limit": "13.
|
|
551
|
+
"limit": "13.55 kB"
|
|
537
552
|
},
|
|
538
553
|
{
|
|
539
554
|
"name": "snapshot (última tela na visita de volta)",
|
|
File without changes
|