@vue.ts/complex-types 1.0.0-beta.6 → 1.0.0-beta.8

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/astro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
package/dist/astro.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/astro.ts
package/dist/esbuild.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as esbuild0 from "esbuild";
4
4
 
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createEsbuildPlugin } from "unplugin";
3
3
 
4
4
  //#region src/esbuild.ts
package/dist/farm.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as _farmfe_core0 from "@farmfe/core";
4
4
 
package/dist/farm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createFarmPlugin } from "unplugin";
3
3
 
4
4
  //#region src/farm.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import * as unplugin0 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-CnhKn4py.js";
1
+ import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-BdrJkBhP.js";
2
2
 
3
3
  export { src_default as default, unplugin, unpluginFactory };
package/dist/nuxt.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as _nuxt_schema0 from "@nuxt/schema";
4
4
 
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./src-CnhKn4py.js";
2
- import { t as vite_default } from "./vite-DVKZ9IvP.js";
3
- import { t as webpack_default } from "./webpack-BHbVMJs_.js";
1
+ import "./src-BdrJkBhP.js";
2
+ import { t as vite_default } from "./vite-Be1u3jtj.js";
3
+ import { t as webpack_default } from "./webpack-C0BFuSnK.js";
4
4
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
5
5
 
6
6
  //#region src/nuxt.ts
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as rolldown0 from "rolldown";
4
4
 
package/dist/rolldown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createRolldownPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rolldown.ts
package/dist/rollup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as rollup0 from "rollup";
4
4
 
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createRollupPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rollup.ts
package/dist/rspack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
 
4
4
  //#region src/rspack.d.ts
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createRspackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rspack.ts
@@ -5,6 +5,7 @@ import MagicString from "magic-string";
5
5
  import ts from "typescript";
6
6
  import { join } from "node:path";
7
7
  import { defu } from "defu";
8
+ import { isReservedProp } from "@vue/shared";
8
9
 
9
10
  //#region src/core/utils.ts
10
11
  const defaultOptions = {
@@ -27,17 +28,17 @@ var Printer = class {
27
28
  typeToString(type) {
28
29
  return this.checker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
29
30
  }
30
- printUnionOrIntersection(type, separator, inner) {
31
- return [...new Set(type.types.map((t) => this.printType(t, inner)).filter(Boolean))].join(separator);
31
+ printUnionOrIntersection(type, separator, isPropertyBlacklisted, inner) {
32
+ return [...new Set(type.types.map((t) => this.printType(t, isPropertyBlacklisted, inner)).filter(Boolean))].join(separator);
32
33
  }
33
- containsUndefined(type) {
34
- return type.isUnion() ? type.types.some((t) => t.flags & ts.TypeFlags.Undefined) : !!(type.flags & ts.TypeFlags.Undefined);
34
+ isSymbolOptional(symbol) {
35
+ return !!(symbol.flags & ts.SymbolFlags.Optional);
35
36
  }
36
- printConditionType(type, inner) {
37
+ printConditionType(type, isPropertyBlacklisted, inner) {
37
38
  const { trueType, falseType } = type.root.node;
38
39
  const trueTypeNode = this.checker.getTypeAtLocation(trueType);
39
40
  const falseTypeNode = this.checker.getTypeAtLocation(falseType);
40
- return `${this.printType(trueTypeNode, inner)} | ${this.printType(falseTypeNode, inner)}`;
41
+ return `${this.printType(trueTypeNode, isPropertyBlacklisted, inner)} | ${this.printType(falseTypeNode, isPropertyBlacklisted, inner)}`;
41
42
  }
42
43
  printPrimitiveType(type) {
43
44
  if (type.flags & ts.TypeFlags.BooleanLiteral) return "boolean";
@@ -49,9 +50,9 @@ var Printer = class {
49
50
  else if (type.flags & ts.TypeFlags.Null) return "null";
50
51
  return "";
51
52
  }
52
- printType(type, inner = false) {
53
- if (type.isUnion()) return this.printUnionOrIntersection(type, " | ", inner);
54
- else if (type.isIntersection()) return this.printUnionOrIntersection(type, " & ", inner);
53
+ printType(type, isPropertyBlacklisted, inner = false) {
54
+ if (type.isUnion()) return this.printUnionOrIntersection(type, " | ", isPropertyBlacklisted, inner);
55
+ else if (type.isIntersection()) return this.printUnionOrIntersection(type, " & ", isPropertyBlacklisted, inner);
55
56
  if (this.checker.isArrayType(type)) return "Array";
56
57
  else if (type.flags & ts.TypeFlags.Object) {
57
58
  const decl = type.getSymbol()?.declarations?.[0];
@@ -61,9 +62,11 @@ var Printer = class {
61
62
  const props = {};
62
63
  for (const prop of properties) {
63
64
  const propType = this.checker.getTypeOfSymbol(prop);
64
- props[prop.getName()] = {
65
- value: this.printType(propType, true),
66
- isOptional: this.containsUndefined(propType)
65
+ const name = prop.getName();
66
+ if (isPropertyBlacklisted(name)) continue;
67
+ props[name] = {
68
+ value: this.printType(propType, isPropertyBlacklisted, true),
69
+ isOptional: this.isSymbolOptional(prop)
67
70
  };
68
71
  }
69
72
  const parts = [];
@@ -74,20 +77,20 @@ var Printer = class {
74
77
  return Object.keys(props).length > 0 ? `{\n${parts.join("\n")}\n}` : "";
75
78
  } else if (type.isLiteral() || type.flags & ts.TypeFlags.BooleanLiteral || type.flags & ts.TypeFlags.String || type.flags & ts.TypeFlags.Number || type.flags & ts.TypeFlags.BigInt || type.flags & ts.TypeFlags.Any || type.flags & ts.TypeFlags.Unknown || type.flags & ts.TypeFlags.Null) return this.printPrimitiveType(type);
76
79
  else if (type.flags & ts.TypeFlags.Undefined) return "";
77
- else if (type.flags & ts.TypeFlags.Conditional) return this.printConditionType(type, inner);
80
+ else if (type.flags & ts.TypeFlags.Conditional) return this.printConditionType(type, isPropertyBlacklisted, inner);
78
81
  else if (type.isTypeParameter()) {
79
82
  const decl = type.getSymbol()?.declarations?.[0];
80
83
  if (!decl || !ts.isTypeParameterDeclaration(decl)) return "";
81
84
  const ref = ts.getEffectiveConstraintOfTypeParameter(decl);
82
85
  if (!ref) return "";
83
86
  const refType = this.checker.getTypeAtLocation(ref);
84
- return this.printType(refType, inner);
87
+ return this.printType(refType, isPropertyBlacklisted, inner);
85
88
  }
86
89
  return this.typeToString(type);
87
90
  }
88
- printPropsTypeArg(node) {
91
+ printPropsTypeArg(node, isPropertyBlacklisted) {
89
92
  const type = this.checker.getTypeAtLocation(node);
90
- return this.printType(type);
93
+ return this.printType(type, isPropertyBlacklisted);
91
94
  }
92
95
  printEventsByCallSignatures(callSignatures) {
93
96
  return callSignatures.map((c) => {
@@ -148,7 +151,7 @@ const transformDefineProps = (printer, s, id) => {
148
151
  const scriptSetupDefinePropsTypeRange = language.parseScriptSetupRanges(scriptSetupAst).defineProps?.typeArg;
149
152
  const virtualFileDefinePropsTypeNode = language.findNodeByName(virtualFileAst, "__VLS_Props");
150
153
  if (!scriptSetupDefinePropsTypeRange || !virtualFileDefinePropsTypeNode) return;
151
- const printedType = printer.printPropsTypeArg(virtualFileDefinePropsTypeNode);
154
+ const printedType = printer.printPropsTypeArg(virtualFileDefinePropsTypeNode, isReservedProp);
152
155
  const offset = scriptSetupBlock.startTagEnd;
153
156
  s.overwrite(offset + scriptSetupDefinePropsTypeRange.start, offset + scriptSetupDefinePropsTypeRange.end, printedType);
154
157
  };
@@ -179,6 +182,7 @@ const unpluginFactory = (options = {}) => {
179
182
  const filter = createFilter(resolvedOptions.include, resolvedOptions.exclude);
180
183
  return {
181
184
  name: "@vue.ts/complex-types",
185
+ enforce: "pre",
182
186
  buildStart() {
183
187
  ensureLanguage(resolveOptions(options).tsconfigPath);
184
188
  },
@@ -14,11 +14,11 @@ declare class Printer {
14
14
  constructor(checker: ts.TypeChecker);
15
15
  private typeToString;
16
16
  private printUnionOrIntersection;
17
- private containsUndefined;
17
+ private isSymbolOptional;
18
18
  private printConditionType;
19
19
  private printPrimitiveType;
20
20
  private printType;
21
- printPropsTypeArg(node: ts.Node): string;
21
+ printPropsTypeArg(node: ts.Node, isPropertyBlacklisted: (prop: string) => boolean): string;
22
22
  private printEventsByCallSignatures;
23
23
  private printEventsByMembers;
24
24
  printEventsRuntimeArg(node: ts.Node): string;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as Transformers, i as Transformer, n as ResolvedOptions, o as ValidTransforms, r as TransformOptions, t as Options } from "./types-DoyG2eeQ.js";
1
+ import { a as Transformers, i as Transformer, n as ResolvedOptions, o as ValidTransforms, r as TransformOptions, t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  export { Options, ResolvedOptions, TransformOptions, Transformer, Transformers, ValidTransforms };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/vite.ts
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as vite0 from "vite";
4
4
 
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-CnhKn4py.js";
2
- import { t as vite_default } from "./vite-DVKZ9IvP.js";
1
+ import "./src-BdrJkBhP.js";
2
+ import { t as vite_default } from "./vite-Be1u3jtj.js";
3
3
 
4
4
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-CnhKn4py.js";
1
+ import { r as unpluginFactory } from "./src-BdrJkBhP.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/webpack.ts
package/dist/webpack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DoyG2eeQ.js";
1
+ import { t as Options } from "./types-Uzu3N3Su.js";
2
2
  import "./types-B3d3HWOR.js";
3
3
  import * as webpack0 from "webpack";
4
4
 
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-CnhKn4py.js";
2
- import { t as webpack_default } from "./webpack-BHbVMJs_.js";
1
+ import "./src-BdrJkBhP.js";
2
+ import { t as webpack_default } from "./webpack-C0BFuSnK.js";
3
3
 
4
4
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue.ts/complex-types",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.8",
4
4
  "author": "Ray <i@mk1.io> (@so1ve)",
5
5
  "type": "module",
6
6
  "description": "Resolve complex types in Vue SFCs.",
@@ -63,16 +63,17 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@nuxt/kit": "^4.2.0",
66
+ "@vue/shared": "^3.5.22",
66
67
  "defu": "^6.1.4",
67
68
  "magic-string": "^0.30.21",
68
69
  "unplugin": "^2.3.10",
69
- "@vue.ts/language": "1.0.0-beta.6",
70
- "@vue.ts/shared": "1.0.0-beta.6"
70
+ "@vue.ts/language": "1.0.0-beta.8",
71
+ "@vue.ts/shared": "1.0.0-beta.8"
71
72
  },
72
73
  "devDependencies": {
73
74
  "@nuxt/schema": "^4.2.0",
74
75
  "@vue-macros/better-define": "^3.1.1",
75
- "rolldown": "1.0.0-beta.27",
76
+ "rolldown": "1.0.0-beta.45",
76
77
  "rollup": "^4.52.5",
77
78
  "vite": "^7.1.12",
78
79
  "webpack": "^5.102.1"