vitral 0.4.0 → 0.5.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 (55) 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-W6322KGP.js → chunk-4Z77XNBR.js} +2 -2
  5. package/dist/{chunk-EMSB2NVX.js → chunk-5JNV45BB.js} +4 -4
  6. package/dist/{chunk-IH3ZT3QU.js → chunk-C3QOBAUE.js} +1 -1
  7. package/dist/chunk-DAESKNQ6.js +207 -0
  8. package/dist/{chunk-BCC25ANK.js → chunk-K6EG7DMO.js} +8 -5
  9. package/dist/{chunk-6EX5KYT5.js → chunk-KU6HF2EW.js} +2 -2
  10. package/dist/{chunk-WD4CDGDZ.js → chunk-KZBH5MPD.js} +12 -11
  11. package/dist/chunk-NZEQGRBL.js +93 -0
  12. package/dist/chunk-PY7P5BF4.js +404 -0
  13. package/dist/cli.js +414 -44
  14. package/dist/dict.d.ts +69 -0
  15. package/dist/dict.js +8 -0
  16. package/dist/edge.d.ts +118 -0
  17. package/dist/edge.js +398 -0
  18. package/dist/element.d.ts +2 -2
  19. package/dist/element.js +5 -5
  20. package/dist/embed.js +2 -2
  21. package/dist/{events-Dkpkw_Sv.d.ts → events-0rxFlWJJ.d.ts} +1 -1
  22. package/dist/{expose-OVWTPHH5.js → expose-IAKYHJXF.js} +3 -3
  23. package/dist/federation.d.ts +1 -1
  24. package/dist/hydrate-YVZDJ2V7.js +168 -0
  25. package/dist/iframe.js +4 -4
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +3 -3
  28. package/dist/otel.d.ts +29 -1
  29. package/dist/otel.js +13 -1
  30. package/dist/preact.d.ts +4 -4
  31. package/dist/preact.js +4 -4
  32. package/dist/prefetch.d.ts +25 -0
  33. package/dist/prefetch.js +178 -0
  34. package/dist/react.d.ts +3 -3
  35. package/dist/react.js +4 -4
  36. package/dist/reframe-LQL4DZYP.js +251 -0
  37. package/dist/routes.d.ts +2 -2
  38. package/dist/routes.js +3 -3
  39. package/dist/{shadow-PVSETNMZ.js → shadow-S4SKHTA7.js} +2 -2
  40. package/dist/single-spa.d.ts +1 -1
  41. package/dist/{slot-UPg6ob9v.d.ts → slot-D49L1rdU.d.ts} +1 -1
  42. package/dist/solid.d.ts +3 -3
  43. package/dist/solid.js +4 -4
  44. package/dist/{sri-M7ZRU57G.js → sri-576GTDIA.js} +2 -1
  45. package/dist/svelte.d.ts +4 -4
  46. package/dist/svelte.js +4 -4
  47. package/dist/testing.d.ts +171 -3
  48. package/dist/testing.js +191 -4
  49. package/dist/{types-CA2p9KHC.d.ts → types-DUtcF3HO.d.ts} +12 -1
  50. package/dist/vitals.d.ts +29 -0
  51. package/dist/vitals.js +152 -0
  52. package/dist/vite.js +28 -422
  53. package/dist/vue.d.ts +2 -2
  54. package/dist/vue.js +4 -4
  55. package/package.json +107 -16
package/dist/vite.js CHANGED
@@ -1,7 +1,12 @@
1
+ import {
2
+ extractProps,
3
+ typesFile
4
+ } from "./chunk-PY7P5BF4.js";
5
+
1
6
  // src/vite.ts
2
7
  import { createHash as createHash3 } from "crypto";
3
- import { readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
4
- import { join as join6, resolve as resolve5 } from "path";
8
+ import { readFileSync as readFileSync4, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
9
+ import { join as join4, resolve as resolve4 } from "path";
5
10
 
6
11
  // src/vite-exposes.ts
7
12
  import { resolve } from "path";
@@ -619,405 +624,6 @@ function findEntry(root) {
619
624
  }
620
625
  }
621
626
 
622
- // src/vite/types.ts
623
- import { createRequire as createRequire2 } from "module";
624
- import { join as join5 } from "path";
625
-
626
- // src/vite/oxc.ts
627
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
628
- import { createRequire } from "module";
629
- import { dirname as dirname3, join as join4, resolve as resolve4 } from "path";
630
- import { pathToFileURL as pathToFileURL2 } from "url";
631
- async function loadOxc(root) {
632
- const req = createRequire(join4(root, "package.json"));
633
- const ids = [() => req.resolve("oxc-transform"), () => createRequire(req.resolve("vite/package.json")).resolve("rolldown/experimental")];
634
- for (const id of ids) {
635
- try {
636
- const mod = await import(pathToFileURL2(id()).href);
637
- if (typeof mod.isolatedDeclarationSync === "function") return mod;
638
- } catch {
639
- }
640
- }
641
- return null;
642
- }
643
- var GLOBAL3 = /^(Date|RegExp|Error|Map|Set|WeakMap|WeakSet|Promise|PromiseLike|Record|Partial|Required|Readonly|Pick|Omit|URL|URLSearchParams|Blob|File|FormData|Headers|AbortSignal|EventTarget|Node|Element|Document|DocumentFragment|ShadowRoot|Window|(HTML|SVG)\w*Element|\w*Event)$/;
644
- var IDENT = /^[A-Za-z_$][\w$]*$/;
645
- var Unsupported = class extends Error {
646
- };
647
- var unsupported = () => {
648
- throw new Unsupported();
649
- };
650
- function propsFromOxc(ts, oxc, file) {
651
- try {
652
- const reader = new Reader(ts, oxc);
653
- const scope = reader.scope(file);
654
- const props = reader.defaultProps(scope);
655
- return props ? reader.print(props.node, props.scope, 0, { top: true }) : "Record<string, unknown>";
656
- } catch {
657
- return null;
658
- }
659
- }
660
- var Reader = class {
661
- constructor(ts, oxc) {
662
- this.ts = ts;
663
- this.oxc = oxc;
664
- this.scopes = /* @__PURE__ */ new Map();
665
- this.seen = /* @__PURE__ */ new Set();
666
- }
667
- /** Declarações de um arquivo: `.d.ts` como está, o resto pelo Oxc. */
668
- scope(file) {
669
- const cached = this.scopes.get(file);
670
- if (cached) return cached;
671
- const { ts } = this;
672
- let code = readFileSync4(file, "utf8");
673
- if (!/\.d\.[cm]?ts$/.test(file)) {
674
- const out = this.oxc.isolatedDeclarationSync(file, code, {});
675
- if (out.errors.length) unsupported();
676
- code = out.code;
677
- }
678
- const source = ts.createSourceFile(file + ".d.ts", code, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
679
- const scope = { file, types: /* @__PURE__ */ new Map(), values: /* @__PURE__ */ new Map(), imports: /* @__PURE__ */ new Map() };
680
- const isDefault = (n) => ts.canHaveModifiers(n) && !!ts.getModifiers(n)?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
681
- let defaultName;
682
- for (const st of source.statements) {
683
- if (ts.isInterfaceDeclaration(st) || ts.isTypeAliasDeclaration(st)) {
684
- if (scope.types.has(st.name.text)) unsupported();
685
- scope.types.set(st.name.text, st);
686
- } else if (ts.isImportDeclaration(st) && ts.isStringLiteral(st.moduleSpecifier)) {
687
- const from = st.moduleSpecifier.text;
688
- const clause = st.importClause;
689
- if (clause?.name) scope.imports.set(clause.name.text, { from, name: "default" });
690
- const bindings = clause?.namedBindings;
691
- if (bindings && ts.isNamespaceImport(bindings)) scope.imports.set(bindings.name.text, { from, name: "*" });
692
- if (bindings && ts.isNamedImports(bindings)) for (const el of bindings.elements) scope.imports.set(el.name.text, { from, name: (el.propertyName ?? el.name).text });
693
- } else if (ts.isFunctionDeclaration(st) || ts.isClassDeclaration(st)) {
694
- if (isDefault(st)) scope.default ??= st;
695
- else if (st.name && !scope.values.has(st.name.text)) scope.values.set(st.name.text, st);
696
- } else if (ts.isVariableStatement(st)) {
697
- for (const d of st.declarationList.declarations) if (ts.isIdentifier(d.name)) scope.values.set(d.name.text, d);
698
- } else if (ts.isExportAssignment(st) && !st.isExportEquals) {
699
- defaultName = ts.isIdentifier(st.expression) ? st.expression.text : unsupported();
700
- } else if (ts.isExportDeclaration(st) && !st.moduleSpecifier && st.exportClause && ts.isNamedExports(st.exportClause)) {
701
- const el = st.exportClause.elements.find((e) => e.name.text === "default");
702
- if (el) defaultName = (el.propertyName ?? el.name).text;
703
- }
704
- }
705
- if (defaultName) scope.default = scope.values.get(defaultName);
706
- this.scopes.set(file, scope);
707
- return scope;
708
- }
709
- /** `mount(el, props)`, componente-função `(props)` ou classe com `props`. `undefined`: sem props. */
710
- defaultProps(scope) {
711
- const { ts } = this;
712
- const node = scope.default ?? unsupported();
713
- const param = (params, i) => {
714
- const p = params[i];
715
- return p && { node: p.type ?? unsupported(), scope };
716
- };
717
- if (ts.isFunctionDeclaration(node)) return param(node.parameters, 0);
718
- if (ts.isClassDeclaration(node)) {
719
- if (node.heritageClauses?.length) unsupported();
720
- const props = node.members.find((m) => ts.isPropertyDeclaration(m) && m.name.getText() === "props");
721
- return props && { node: props.type ?? unsupported(), scope };
722
- }
723
- if (ts.isVariableDeclaration(node)) return this.propsOfType(node.type ?? unsupported(), scope);
724
- return unsupported();
725
- }
726
- propsOfType(node, scope) {
727
- const { ts } = this;
728
- const param = (params, i, at2) => {
729
- const p = params[i];
730
- return p && { node: p.type ?? unsupported(), scope: at2 };
731
- };
732
- if (ts.isParenthesizedTypeNode(node)) return this.propsOfType(node.type, scope);
733
- if (ts.isFunctionTypeNode(node)) return param(node.parameters, 0, scope);
734
- let members;
735
- let at = scope;
736
- if (ts.isTypeLiteralNode(node)) members = node.members;
737
- else if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && !node.typeArguments) {
738
- const found = this.lookup(node.typeName.text, scope);
739
- if (!found || found === "package" || found.decl.typeParameters) return unsupported();
740
- if (ts.isTypeAliasDeclaration(found.decl)) return this.propsOfType(found.decl.type, found.scope);
741
- if (found.decl.heritageClauses?.length) unsupported();
742
- members = found.decl.members;
743
- at = found.scope;
744
- } else return unsupported();
745
- const mount = members.find((m) => m.name?.getText() === "mount");
746
- if (mount) {
747
- if (ts.isMethodSignature(mount)) return param(mount.parameters, 1, at);
748
- if (ts.isPropertySignature(mount) && mount.type) return this.mountProps(mount.type, at);
749
- return unsupported();
750
- }
751
- const call = members.find(ts.isCallSignatureDeclaration);
752
- if (call) return param(call.parameters, 0, at);
753
- if (members.some(ts.isConstructSignatureDeclaration)) unsupported();
754
- return void 0;
755
- }
756
- mountProps(node, scope) {
757
- const { ts } = this;
758
- if (ts.isParenthesizedTypeNode(node)) return this.mountProps(node.type, scope);
759
- if (!ts.isFunctionTypeNode(node)) return unsupported();
760
- const p = node.parameters[1];
761
- return p && { node: p.type ?? unsupported(), scope };
762
- }
763
- /** Acha um tipo pelo nome: no arquivo, num import relativo ou num pacote. */
764
- lookup(name, scope) {
765
- const decl = scope.types.get(name);
766
- if (decl) return { decl, scope };
767
- const imp = scope.imports.get(name);
768
- if (!imp) return void 0;
769
- if (!imp.from.startsWith(".")) return "package";
770
- if (imp.name === "default" || imp.name === "*") return unsupported();
771
- const found = this.lookup(imp.name, this.scope(resolveFile(scope.file, imp.from)));
772
- return found ?? unsupported();
773
- }
774
- print(node, scope, depth, opts = {}) {
775
- const { ts } = this;
776
- const K = ts.SyntaxKind;
777
- switch (node.kind) {
778
- case K.AnyKeyword:
779
- case K.UnknownKeyword:
780
- return "unknown";
781
- case K.StringKeyword:
782
- case K.NumberKeyword:
783
- case K.BooleanKeyword:
784
- case K.BigIntKeyword:
785
- case K.SymbolKeyword:
786
- case K.UndefinedKeyword:
787
- case K.VoidKeyword:
788
- case K.NeverKeyword:
789
- return node.getText();
790
- }
791
- if (ts.isLiteralTypeNode(node)) {
792
- const lit = node.literal;
793
- if (ts.isStringLiteral(lit)) return JSON.stringify(lit.text);
794
- if (lit.kind === K.NullKeyword || lit.kind === K.TrueKeyword || lit.kind === K.FalseKeyword || ts.isNumericLiteral(lit) || ts.isPrefixUnaryExpression(lit)) return lit.getText();
795
- return unsupported();
796
- }
797
- if (ts.isParenthesizedTypeNode(node)) return this.print(node.type, scope, depth, opts);
798
- if (ts.isUnionTypeNode(node)) {
799
- const types = opts.nonNull ? node.types.filter((t) => t.kind !== K.UndefinedKeyword && !(ts.isLiteralTypeNode(t) && t.literal.kind === K.NullKeyword)) : node.types;
800
- const parts = [...new Set(types.map((t) => this.print(t, scope, depth)))];
801
- if (parts.includes("true") && parts.includes("false")) parts.splice(parts.indexOf("true"), 1, "boolean"), parts.splice(parts.indexOf("false"), 1);
802
- return parts.join(" | ");
803
- }
804
- if (ts.isIntersectionTypeNode(node)) {
805
- return node.types.map((t) => {
806
- const s = this.print(t, scope, depth);
807
- return ts.isUnionTypeNode(t) ? `(${s})` : s;
808
- }).join(" & ");
809
- }
810
- if (depth > 6) return "unknown";
811
- if (ts.isArrayTypeNode(node)) return `Array<${this.print(node.elementType, scope, depth + 1)}>`;
812
- if (ts.isTypeOperatorNode(node) && node.operator === K.ReadonlyKeyword && (ts.isArrayTypeNode(node.type) || ts.isTupleTypeNode(node.type))) return this.print(node.type, scope, depth);
813
- if (ts.isTupleTypeNode(node)) {
814
- if (node.elements.some((e) => ts.isNamedTupleMember(e) || ts.isOptionalTypeNode(e) || ts.isRestTypeNode(e))) unsupported();
815
- return `[${node.elements.map((e) => this.print(e, scope, depth + 1)).join(", ")}]`;
816
- }
817
- if (ts.isTypeLiteralNode(node)) return this.object(node.members, scope, depth, !!opts.top);
818
- if (ts.isFunctionTypeNode(node)) return this.signature(node, scope, depth);
819
- if (ts.isTypeReferenceNode(node)) return this.reference(node, scope, depth, opts);
820
- return unsupported();
821
- }
822
- reference(node, scope, depth, opts) {
823
- const { ts } = this;
824
- if (!ts.isIdentifier(node.typeName)) return unsupported();
825
- const name = node.typeName.text;
826
- const args = node.typeArguments ?? [];
827
- const found = this.lookup(name, scope);
828
- if (found === "package") return "unknown";
829
- if (found) {
830
- if (args.length || found.decl.typeParameters) unsupported();
831
- if (this.seen.has(found.decl)) return "unknown";
832
- this.seen.add(found.decl);
833
- try {
834
- const decl = found.decl;
835
- if (ts.isTypeAliasDeclaration(decl)) return this.print(decl.type, found.scope, depth, opts);
836
- if (decl.heritageClauses?.length) unsupported();
837
- return this.object(decl.members, found.scope, depth, !!opts.top);
838
- } finally {
839
- this.seen.delete(found.decl);
840
- }
841
- }
842
- if ((name === "Array" || name === "ReadonlyArray") && args.length === 1) return `Array<${this.print(args[0], scope, depth + 1)}>`;
843
- if (!GLOBAL3.test(name)) return unsupported();
844
- return args.length ? `${name}<${args.map((t) => this.print(t, scope, depth + 1)).join(", ")}>` : name;
845
- }
846
- object(members, scope, depth, top) {
847
- const { ts } = this;
848
- const fields = [];
849
- const calls = [];
850
- let index;
851
- for (const m of members) {
852
- if (ts.isPropertySignature(m) || ts.isMethodSignature(m)) {
853
- const name = ts.isIdentifier(m.name) || ts.isStringLiteral(m.name) || ts.isNumericLiteral(m.name) ? m.name.text : unsupported();
854
- if (top && name === "vitral") continue;
855
- const optional = m.questionToken ? "?" : "";
856
- const key = IDENT.test(name) ? name : JSON.stringify(name);
857
- const type = ts.isMethodSignature(m) ? this.signature(m, scope, depth + 1) : m.type ? this.print(m.type, scope, depth + 1, { nonNull: !!optional }) : "unknown";
858
- fields.push(`${key}${optional}: ${type}`);
859
- } else if (ts.isIndexSignatureDeclaration(m)) {
860
- const key = m.parameters[0]?.type;
861
- if (!key || key.kind !== ts.SyntaxKind.StringKeyword) unsupported();
862
- index = `[key: string]: ${this.print(m.type, scope, depth + 1)}`;
863
- } else if (ts.isCallSignatureDeclaration(m)) {
864
- calls.push(this.signature(m, scope, depth));
865
- } else unsupported();
866
- }
867
- if (calls.length && !fields.length) return calls[0];
868
- if (index) fields.push(index);
869
- for (const c of calls) fields.push(c.replace(" =>", ":"));
870
- return fields.length ? `{ ${fields.join("; ")} }` : "{}";
871
- }
872
- signature(sig, scope, depth) {
873
- const { ts } = this;
874
- if (sig.typeParameters?.length || !sig.type) unsupported();
875
- const params = sig.parameters.map((p, i) => {
876
- if (p.dotDotDotToken || ts.isIdentifier(p.name) && p.name.text === "this") unsupported();
877
- const name = ts.isIdentifier(p.name) && IDENT.test(p.name.text) ? p.name.text : `a${i}`;
878
- const type = p.type ? this.print(p.type, scope, depth + 1) : "unknown";
879
- return `${name}: ${p.questionToken || p.initializer ? `${type} | undefined` : type}`;
880
- });
881
- return `(${params.join(", ")}) => ${this.print(sig.type, scope, depth + 1)}`;
882
- }
883
- };
884
- function resolveFile(from, spec) {
885
- const base = resolve4(dirname3(from), spec);
886
- const stem = base.replace(/\.[cm]?jsx?$/, "");
887
- const candidates = [base, ...[".ts", ".tsx", ".mts", ".cts", ".d.ts"].map((ext) => stem + ext), ...["index.ts", "index.tsx", "index.d.ts"].map((f) => join4(base, f))];
888
- const file = candidates.find((f) => /\.[cm]?tsx?$/.test(f) && existsSync4(f));
889
- return file ?? unsupported();
890
- }
891
-
892
- // src/vite/types.ts
893
- function typesFile(name, props) {
894
- return `// Props do remote ${JSON.stringify(name)}, geradas pelo vitral. N\xE3o edite.
895
- export type Props = ${props}
896
- `;
897
- }
898
- async function loadTs(root) {
899
- const api = (ts) => typeof ts?.createProgram === "function" ? ts : null;
900
- try {
901
- const ts = api(createRequire2(join5(root, "package.json"))("typescript"));
902
- if (ts) return ts;
903
- } catch {
904
- }
905
- try {
906
- return api((await import("typescript")).default);
907
- } catch {
908
- return null;
909
- }
910
- }
911
- async function extractProps(root, file) {
912
- if (!/\.[cm]?[jt]sx?$/.test(file)) return null;
913
- const ts = await loadTs(root);
914
- if (!ts) return null;
915
- const oxc = /\.[cm]?tsx?$/.test(file) ? await loadOxc(root) : null;
916
- const fast = oxc && propsFromOxc(ts, oxc, file);
917
- if (fast) return fast;
918
- const configPath = ts.findConfigFile(root, ts.sys.fileExists);
919
- const base = configPath ? ts.parseJsonConfigFileContent(ts.readConfigFile(configPath, ts.sys.readFile).config, ts.sys, root).options : {};
920
- const options = {
921
- target: ts.ScriptTarget.ES2022,
922
- module: ts.ModuleKind.ESNext,
923
- moduleResolution: ts.ModuleResolutionKind.Bundler,
924
- jsx: ts.JsxEmit.Preserve,
925
- strict: true,
926
- ...base,
927
- allowJs: true,
928
- skipLibCheck: true,
929
- noEmit: true
930
- };
931
- const program = ts.createProgram([file], options);
932
- const checker = program.getTypeChecker();
933
- const source = program.getSourceFile(file);
934
- const moduleSymbol = source && checker.getSymbolAtLocation(source);
935
- let symbol = moduleSymbol && checker.getExportsOfModule(moduleSymbol).find((s) => s.escapedName === "default");
936
- if (!source || !symbol) return null;
937
- if (symbol.flags & ts.SymbolFlags.Alias) symbol = checker.getAliasedSymbol(symbol);
938
- const type = checker.getTypeOfSymbolAtLocation(symbol, source);
939
- const props = propsOf(checker, type, source);
940
- return props ? new Printer(ts, checker, program).print(props, 0, true) : "Record<string, unknown>";
941
- }
942
- function propsOf(checker, type, at) {
943
- const param = (t, i) => {
944
- const p = t.getCallSignatures()[0]?.parameters[i];
945
- return p && checker.getTypeOfSymbolAtLocation(p, at);
946
- };
947
- const mount = type.getProperty("mount");
948
- if (mount) return param(checker.getTypeOfSymbolAtLocation(mount, at), 1);
949
- if (type.getCallSignatures().length) return param(type, 0);
950
- const ctor = type.getConstructSignatures()[0];
951
- const props = ctor?.getReturnType().getProperty("props");
952
- return props && checker.getTypeOfSymbolAtLocation(props, at);
953
- }
954
- var Printer = class {
955
- constructor(ts, checker, program) {
956
- this.ts = ts;
957
- this.checker = checker;
958
- this.program = program;
959
- this.seen = /* @__PURE__ */ new Set();
960
- }
961
- /** Declarado na lib padrão (Date, Map…): vale em qualquer projeto pelo nome. */
962
- fromLib(type) {
963
- const decl = (type.aliasSymbol ?? type.getSymbol())?.declarations?.[0];
964
- return !!decl && this.program.isSourceFileDefaultLibrary(decl.getSourceFile());
965
- }
966
- fromPackage(type) {
967
- const decl = (type.aliasSymbol ?? type.getSymbol())?.declarations?.[0];
968
- return !!decl && /[/\\]node_modules[/\\]/.test(decl.getSourceFile().fileName);
969
- }
970
- print(type, depth, top = false) {
971
- const { ts, checker } = this;
972
- const f = type.flags;
973
- if (f & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) return "unknown";
974
- if (f & (ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.Void | ts.TypeFlags.Never | ts.TypeFlags.ESSymbolLike)) {
975
- return checker.typeToString(type);
976
- }
977
- if (type.isUnion()) {
978
- const parts = [...new Set(type.types.map((t) => this.print(t, depth)))];
979
- if (parts.includes("true") && parts.includes("false")) parts.splice(parts.indexOf("true"), 1, "boolean"), parts.splice(parts.indexOf("false"), 1);
980
- return parts.join(" | ");
981
- }
982
- if (type.isIntersection()) return type.types.map((t) => this.wrap(t, depth)).join(" & ");
983
- if (depth > 6 || this.seen.has(type)) return "unknown";
984
- if (checker.isArrayType(type)) return `Array<${this.print(checker.getTypeArguments(type)[0], depth + 1)}>`;
985
- if (checker.isTupleType(type)) return `[${checker.getTypeArguments(type).map((t) => this.print(t, depth + 1)).join(", ")}]`;
986
- if (this.fromLib(type)) {
987
- const args = type.aliasTypeArguments ?? (type.objectFlags & ts.ObjectFlags.Reference ? checker.getTypeArguments(type) : []);
988
- const name = (type.aliasSymbol ?? type.getSymbol()).name;
989
- return args.length ? `${name}<${args.map((t) => this.print(t, depth + 1)).join(", ")}>` : checker.typeToString(type);
990
- }
991
- if (this.fromPackage(type)) return "unknown";
992
- this.seen.add(type);
993
- try {
994
- const calls = type.getCallSignatures();
995
- const props = checker.getPropertiesOfType(type).filter((p) => !(top && p.name === "vitral"));
996
- if (calls.length && !props.length) return this.signature(calls[0], depth);
997
- const fields = props.map((p) => {
998
- const optional = p.flags & ts.SymbolFlags.Optional ? "?" : "";
999
- const key = /^[A-Za-z_$][\w$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
1000
- const t = checker.getTypeOfSymbol(p);
1001
- return `${key}${optional}: ${this.print(optional ? checker.getNonNullableType(t) : t, depth + 1)}`;
1002
- });
1003
- const index = type.getStringIndexType();
1004
- if (index) fields.push(`[key: string]: ${this.print(index, depth + 1)}`);
1005
- for (const c of calls) fields.push(this.signature(c, depth).replace(" =>", ":"));
1006
- return fields.length ? `{ ${fields.join("; ")} }` : "{}";
1007
- } finally {
1008
- this.seen.delete(type);
1009
- }
1010
- }
1011
- wrap(type, depth) {
1012
- const s = this.print(type, depth);
1013
- return type.isUnion() ? `(${s})` : s;
1014
- }
1015
- signature(sig, depth) {
1016
- const params = sig.parameters.map((p, i) => `${/^[A-Za-z_$][\w$]*$/.test(p.name) ? p.name : `a${i}`}: ${this.print(this.checker.getTypeOfSymbol(p), depth + 1)}`);
1017
- return `(${params.join(", ")}) => ${this.print(sig.getReturnType(), depth + 1)}`;
1018
- }
1019
- };
1020
-
1021
627
  // src/vite/mcp-app.ts
1022
628
  var MCP_APP_PROTOCOL = "2026-01-26";
1023
629
  var MCP_APP_GLOBAL = "__vitral_remote__";
@@ -1229,7 +835,7 @@ function vitral(options = {}) {
1229
835
  let entry = options.entry;
1230
836
  let adapter = "element";
1231
837
  let framework = "element";
1232
- const entryFile = () => resolve5(root, entry);
838
+ const entryFile = () => resolve4(root, entry);
1233
839
  let serve = false;
1234
840
  let shared = [];
1235
841
  const dedupe = !!options.dedupe?.length;
@@ -1242,8 +848,8 @@ function vitral(options = {}) {
1242
848
  const mcpApp = (files, js) => {
1243
849
  const css = files.filter((f) => f.type === "asset" && f.fileName.endsWith(".css")).map((f) => f.fileName);
1244
850
  const read = (file) => {
1245
- const text = readFileSync5(join6(outDir, file), "utf8");
1246
- rmSync2(join6(outDir, file));
851
+ const text = readFileSync4(join4(outDir, file), "utf8");
852
+ rmSync2(join4(outDir, file));
1247
853
  return text;
1248
854
  };
1249
855
  const scope = options.scopeCss === false ? void 0 : scopeName();
@@ -1254,12 +860,12 @@ function vitral(options = {}) {
1254
860
  code: read(js),
1255
861
  css: css.map((f) => transformCss(read(f), options, scopeName()))
1256
862
  });
1257
- writeFileSync2(join6(outDir, "mcp-app.html"), html);
863
+ writeFileSync2(join4(outDir, "mcp-app.html"), html);
1258
864
  };
1259
865
  return {
1260
866
  name: "vitral",
1261
867
  config(user, { mode, command }) {
1262
- entry ??= findEntry(resolve5(user.root ?? process.cwd()));
868
+ entry ??= findEntry(resolve4(user.root ?? process.cwd()));
1263
869
  if (!entry) throw new Error("[vitral] n\xE3o achei a entrada do remote (src/remote.* ou src/App.*). Use vitral({ entry }).");
1264
870
  const rolldown = "rolldownVersion" in this.meta;
1265
871
  const dir = options.versionDir ? versionDir(user.root ?? process.cwd(), user.build?.outDir, options.version) : void 0;
@@ -1292,9 +898,9 @@ function vitral(options = {}) {
1292
898
  framework = detectAdapter(c.plugins);
1293
899
  adapter = options.adapter || framework;
1294
900
  serve = c.command === "serve";
1295
- outDir = resolve5(c.root, c.build.outDir);
901
+ outDir = resolve4(c.root, c.build.outDir);
1296
902
  try {
1297
- pkg = JSON.parse(readFileSync5(join6(root, "package.json"), "utf8"));
903
+ pkg = JSON.parse(readFileSync4(join4(root, "package.json"), "utf8"));
1298
904
  } catch {
1299
905
  }
1300
906
  },
@@ -1327,8 +933,8 @@ function vitral(options = {}) {
1327
933
  if (own != null) return own;
1328
934
  const exposed = options.exposes ? loadExposes(id, root, entry, options.exposes, options.adapter === false ? void 0 : ENTRY_ID) : null;
1329
935
  if (exposed != null) return exposed;
1330
- if (id === VIRTUAL_ENTRY) return entryCode(resolve5(root, entry), adapter, scopeName());
1331
- if (id === VIRTUAL_DEV_ENTRY) return devEntryCode(framework, options.adapter === false ? resolve5(root, entry) : void 0);
936
+ if (id === VIRTUAL_ENTRY) return entryCode(resolve4(root, entry), adapter, scopeName());
937
+ if (id === VIRTUAL_DEV_ENTRY) return devEntryCode(framework, options.adapter === false ? resolve4(root, entry) : void 0);
1332
938
  return loadPreamble(id);
1333
939
  }
1334
940
  },
@@ -1348,13 +954,13 @@ function vitral(options = {}) {
1348
954
  const emit = (file, text, kind = "") => {
1349
955
  const hash = createHash3("sha256").update(text).digest("base64url").slice(0, 8);
1350
956
  const name = file.replace(/\.css$/, `${kind}-${hash}.css`);
1351
- writeFileSync2(join6(outDir, name), text);
957
+ writeFileSync2(join4(outDir, name), text);
1352
958
  return name;
1353
959
  };
1354
960
  const shadow = { css: [] };
1355
961
  const css = files.filter((f) => f.type === "asset" && f.fileName.endsWith(".css")).map((f) => {
1356
- const from = join6(outDir, f.fileName);
1357
- const text = transformCss(readFileSync5(from, "utf8"), options, scopeName());
962
+ const from = join4(outDir, f.fileName);
963
+ const text = transformCss(readFileSync4(from, "utf8"), options, scopeName());
1358
964
  const name = emit(f.fileName, text);
1359
965
  if (name !== f.fileName) rmSync2(from);
1360
966
  const split2 = splitShadowCss(text);
@@ -1364,7 +970,7 @@ function vitral(options = {}) {
1364
970
  if (split2.rebase) shadow.rebase = true;
1365
971
  return name;
1366
972
  });
1367
- const code = readFileSync5(join6(outDir, entry2.fileName));
973
+ const code = readFileSync4(join4(outDir, entry2.fileName));
1368
974
  manifest = {
1369
975
  name: options.name ?? pkg.name ?? "remote",
1370
976
  version: options.version ?? pkg.version,
@@ -1381,32 +987,32 @@ function vitral(options = {}) {
1381
987
  if (!manifest) return;
1382
988
  const done = withSplit(manifest, outDir, split, shared);
1383
989
  if (options.sbom) {
1384
- const bom = createSbom({ root, name: done.name, version: done.version, files: modules, entry: readFileSync5(join6(outDir, done.entry)), tool: ownVersion() });
1385
- writeFileSync2(join6(outDir, SBOM_FILE), JSON.stringify(bom, null, 2) + "\n");
1386
- done.sbom = { file: SBOM_FILE, integrity: sri(join6(outDir, SBOM_FILE)) };
990
+ const bom = createSbom({ root, name: done.name, version: done.version, files: modules, entry: readFileSync4(join4(outDir, done.entry)), tool: ownVersion() });
991
+ writeFileSync2(join4(outDir, SBOM_FILE), JSON.stringify(bom, null, 2) + "\n");
992
+ done.sbom = { file: SBOM_FILE, integrity: sri(join4(outDir, SBOM_FILE)) };
1387
993
  }
1388
994
  manifest = split = void 0;
1389
995
  modules = /* @__PURE__ */ new Set();
1390
- writeFileSync2(join6(outDir, "vitral.json"), JSON.stringify(done, null, 2) + "\n");
996
+ writeFileSync2(join4(outDir, "vitral.json"), JSON.stringify(done, null, 2) + "\n");
1391
997
  const props = options.types === false ? null : await extractProps(root, entryFile());
1392
- if (props) writeFileSync2(join6(outDir, "vitral.d.ts"), typesFile(done.name, props));
998
+ if (props) writeFileSync2(join4(outDir, "vitral.d.ts"), typesFile(done.name, props));
1393
999
  }
1394
1000
  };
1395
1001
  }
1396
1002
  function ownVersion() {
1397
1003
  try {
1398
- return JSON.parse(readFileSync5(new URL("../package.json", import.meta.url), "utf8")).version;
1004
+ return JSON.parse(readFileSync4(new URL("../package.json", import.meta.url), "utf8")).version;
1399
1005
  } catch {
1400
1006
  return void 0;
1401
1007
  }
1402
1008
  }
1403
1009
  function versionDir(root, outDir = "dist", version) {
1404
1010
  try {
1405
- version ??= JSON.parse(readFileSync5(join6(resolve5(root), "package.json"), "utf8")).version;
1011
+ version ??= JSON.parse(readFileSync4(join4(resolve4(root), "package.json"), "utf8")).version;
1406
1012
  } catch {
1407
1013
  }
1408
1014
  if (!version) throw new Error('[vitral] versionDir precisa de uma vers\xE3o: use vitral({ version }) ou "version" no package.json.');
1409
- return join6(outDir, version);
1015
+ return join4(outDir, version);
1410
1016
  }
1411
1017
  function contractOf(version, groups2) {
1412
1018
  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-CA2p9KHC.js';
4
- export { e as events } from './events-Dkpkw_Sv.js';
3
+ import { P as Props, I as Isolation, R as RemoteContext, S as Shared, a as RemoteModule } from './types-DUtcF3HO.js';
4
+ export { e as events } from './events-0rxFlWJJ.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,16 +1,16 @@
1
1
  import {
2
2
  hostSlot,
3
3
  timings
4
- } from "./chunk-W6322KGP.js";
4
+ } from "./chunk-4Z77XNBR.js";
5
5
  import {
6
6
  defineRemote,
7
7
  events,
8
8
  memoSelect,
9
9
  same,
10
10
  shared
11
- } from "./chunk-WD4CDGDZ.js";
12
- import "./chunk-EMSB2NVX.js";
13
- import "./chunk-6EX5KYT5.js";
11
+ } from "./chunk-KZBH5MPD.js";
12
+ import "./chunk-5JNV45BB.js";
13
+ import "./chunk-KU6HF2EW.js";
14
14
  import {
15
15
  absolute
16
16
  } from "./chunk-TW7KYJQ6.js";