@vue.ts/complex-types 1.0.0-beta.10 → 1.0.0-beta.11

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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.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-Ci8DJn1t.js";
1
+ import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.js";
3
3
  import * as _nuxt_schema0 from "@nuxt/schema";
4
4
 
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./src-Ci8DJn1t.js";
2
- import { t as vite_default } from "./vite-D-Xfh8NL.js";
3
- import { t as webpack_default } from "./webpack-By_BEclB.js";
1
+ import "./src-2v9kOGLq.js";
2
+ import { t as vite_default } from "./vite-DIsmg5Oh.js";
3
+ import { t as webpack_default } from "./webpack-XlZBixWC.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.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-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.js";
2
2
  import { createRspackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rspack.ts
@@ -3,20 +3,19 @@ import { ensureLanguage, getLanguage } from "@vue.ts/language";
3
3
  import { createFilter } from "unplugin-utils";
4
4
  import MagicString from "magic-string";
5
5
  import ts from "typescript";
6
- import { join } from "node:path";
7
- import { defu } from "defu";
8
- import { normalizePath } from "@vue.ts/shared";
6
+ import { createOptionsResolver, normalizePath } from "@vue.ts/shared";
9
7
  import { isReservedProp } from "@vue/shared";
10
8
 
11
9
  //#region src/core/utils.ts
12
10
  const defaultOptions = {
11
+ root: process.cwd(),
13
12
  include: ["**/*.vue"],
14
13
  exclude: ["node_modules/**"],
15
- tsconfigPath: join(process.cwd(), "tsconfig.json"),
14
+ tsconfigPath: "tsconfig.json",
16
15
  defineEmits: true,
17
16
  defineProps: true
18
17
  };
19
- const resolveOptions = (rawOptions) => defu(rawOptions, defaultOptions);
18
+ const resolveOptions = createOptionsResolver(defaultOptions);
20
19
  const quotesReg = /"/g;
21
20
  const escapeQuotes = (s) => s.replace(quotesReg, "\\\"");
22
21
 
@@ -25,21 +24,22 @@ const escapeQuotes = (s) => s.replace(quotesReg, "\\\"");
25
24
  var Printer = class {
26
25
  constructor(checker) {
27
26
  this.checker = checker;
27
+ this.isPropertyBlacklisted = () => false;
28
28
  }
29
29
  typeToString(type) {
30
30
  return this.checker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
31
31
  }
32
- printUnionOrIntersection(type, separator, isPropertyBlacklisted, inner) {
33
- return [...new Set(type.types.map((t) => this.printType(t, isPropertyBlacklisted, inner)).filter(Boolean))].join(separator);
32
+ printUnionOrIntersection(type, separator, inner) {
33
+ return [...new Set(type.types.map((t) => this.printType(t, inner)).filter(Boolean))].join(separator);
34
34
  }
35
35
  isSymbolOptional(symbol) {
36
36
  return !!(symbol.flags & ts.SymbolFlags.Optional);
37
37
  }
38
- printConditionType(type, isPropertyBlacklisted, inner) {
38
+ printConditionType(type, inner) {
39
39
  const { trueType, falseType } = type.root.node;
40
40
  const trueTypeNode = this.checker.getTypeAtLocation(trueType);
41
41
  const falseTypeNode = this.checker.getTypeAtLocation(falseType);
42
- return `${this.printType(trueTypeNode, isPropertyBlacklisted, inner)} | ${this.printType(falseTypeNode, isPropertyBlacklisted, inner)}`;
42
+ return `${this.printType(trueTypeNode, inner)} | ${this.printType(falseTypeNode, inner)}`;
43
43
  }
44
44
  printPrimitiveType(type) {
45
45
  if (type.flags & ts.TypeFlags.BooleanLiteral) return "boolean";
@@ -51,9 +51,9 @@ var Printer = class {
51
51
  else if (type.flags & ts.TypeFlags.Null) return "null";
52
52
  return "";
53
53
  }
54
- printType(type, isPropertyBlacklisted, inner = false) {
55
- if (type.isUnion()) return this.printUnionOrIntersection(type, " | ", isPropertyBlacklisted, inner);
56
- else if (type.isIntersection()) return this.printUnionOrIntersection(type, " & ", isPropertyBlacklisted, inner);
54
+ printType(type, inner = false) {
55
+ if (type.isUnion()) return this.printUnionOrIntersection(type, " | ", inner);
56
+ else if (type.isIntersection()) return this.printUnionOrIntersection(type, " & ", inner);
57
57
  if (this.checker.isArrayType(type)) return "Array";
58
58
  else if (type.flags & ts.TypeFlags.Object) {
59
59
  const decl = type.getSymbol()?.declarations?.[0];
@@ -64,9 +64,9 @@ var Printer = class {
64
64
  for (const prop of properties) {
65
65
  const propType = this.checker.getTypeOfSymbol(prop);
66
66
  const name = prop.getName();
67
- if (isPropertyBlacklisted(name)) continue;
67
+ if (this.isPropertyBlacklisted(name)) continue;
68
68
  props[name] = {
69
- value: this.printType(propType, isPropertyBlacklisted, true),
69
+ value: this.printType(propType, true),
70
70
  isOptional: this.isSymbolOptional(prop)
71
71
  };
72
72
  }
@@ -78,20 +78,21 @@ var Printer = class {
78
78
  return Object.keys(props).length > 0 ? `{\n${parts.join("\n")}\n}` : "";
79
79
  } 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);
80
80
  else if (type.flags & ts.TypeFlags.Undefined) return "";
81
- else if (type.flags & ts.TypeFlags.Conditional) return this.printConditionType(type, isPropertyBlacklisted, inner);
81
+ else if (type.flags & ts.TypeFlags.Conditional) return this.printConditionType(type, inner);
82
82
  else if (type.isTypeParameter()) {
83
83
  const decl = type.getSymbol()?.declarations?.[0];
84
84
  if (!decl || !ts.isTypeParameterDeclaration(decl)) return "";
85
85
  const ref = ts.getEffectiveConstraintOfTypeParameter(decl);
86
86
  if (!ref) return "";
87
87
  const refType = this.checker.getTypeAtLocation(ref);
88
- return this.printType(refType, isPropertyBlacklisted, inner);
88
+ return this.printType(refType, inner);
89
89
  }
90
90
  return this.typeToString(type);
91
91
  }
92
92
  printPropsTypeArg(node, isPropertyBlacklisted) {
93
+ this.isPropertyBlacklisted = isPropertyBlacklisted;
93
94
  const type = this.checker.getTypeAtLocation(node);
94
- return this.printType(type, isPropertyBlacklisted);
95
+ return this.printType(type);
95
96
  }
96
97
  printEventsByCallSignatures(callSignatures) {
97
98
  return callSignatures.map((c) => {
@@ -4,6 +4,8 @@ import ts from "typescript";
4
4
 
5
5
  //#region ../shared/src/types.d.ts
6
6
  interface BaseOptions {
7
+ root?: string;
8
+ tsconfigPath?: string;
7
9
  include?: FilterPattern;
8
10
  exclude?: FilterPattern;
9
11
  }
@@ -11,6 +13,7 @@ interface BaseOptions {
11
13
  //#region src/core/printer.d.ts
12
14
  declare class Printer {
13
15
  private checker;
16
+ private isPropertyBlacklisted;
14
17
  constructor(checker: ts.TypeChecker);
15
18
  private typeToString;
16
19
  private printUnionOrIntersection;
@@ -26,9 +29,7 @@ declare class Printer {
26
29
  //#endregion
27
30
  //#region src/core/types.d.ts
28
31
  type ValidTransforms = "defineEmits" | "defineProps";
29
- type Options = {
30
- tsconfigPath?: string;
31
- } & Partial<Record<ValidTransforms, boolean>> & BaseOptions;
32
+ type Options = Partial<Record<ValidTransforms, boolean>> & BaseOptions;
32
33
  type ResolvedOptions = Required<Options>;
33
34
  type TransformOptions = Pick<ResolvedOptions, ValidTransforms>;
34
35
  type Transformer = (printer: Printer, s: MagicString, id: string) => void;
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-B0cfnWIB.js";
1
+ import { a as Transformers, i as Transformer, n as ResolvedOptions, o as ValidTransforms, r as TransformOptions, t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.js";
3
3
  export { Options, ResolvedOptions, TransformOptions, Transformer, Transformers, ValidTransforms };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.js";
3
3
  import * as vite0 from "vite";
4
4
 
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-Ci8DJn1t.js";
2
- import { t as vite_default } from "./vite-D-Xfh8NL.js";
1
+ import "./src-2v9kOGLq.js";
2
+ import { t as vite_default } from "./vite-DIsmg5Oh.js";
3
3
 
4
4
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Ci8DJn1t.js";
1
+ import { r as unpluginFactory } from "./src-2v9kOGLq.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-B0cfnWIB.js";
1
+ import { t as Options } from "./types-CR_5PFfY.js";
2
2
  import "./types-u_Hr5uXA.js";
3
3
  import * as webpack0 from "webpack";
4
4
 
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-Ci8DJn1t.js";
2
- import { t as webpack_default } from "./webpack-By_BEclB.js";
1
+ import "./src-2v9kOGLq.js";
2
+ import { t as webpack_default } from "./webpack-XlZBixWC.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.10",
3
+ "version": "1.0.0-beta.11",
4
4
  "author": "Ray <i@mk1.io> (@so1ve)",
5
5
  "type": "module",
6
6
  "description": "Resolve complex types in Vue SFCs.",
@@ -64,19 +64,18 @@
64
64
  "dependencies": {
65
65
  "@nuxt/kit": "^4.2.0",
66
66
  "@vue/shared": "^3.5.22",
67
- "defu": "^6.1.4",
68
67
  "magic-string": "^0.30.21",
69
68
  "unplugin": "2.3.10",
70
69
  "unplugin-utils": "^0.3.1",
71
- "@vue.ts/language": "1.0.0-beta.10",
72
- "@vue.ts/shared": "1.0.0-beta.10"
70
+ "@vue.ts/language": "1.0.0-beta.11",
71
+ "@vue.ts/shared": "1.0.0-beta.11"
73
72
  },
74
73
  "devDependencies": {
75
74
  "@nuxt/schema": "^4.2.0",
76
75
  "@vue-macros/better-define": "^3.1.1",
77
- "rolldown": "1.0.0-beta.45",
76
+ "rolldown": "1.0.0-beta.47",
78
77
  "rollup": "^4.52.5",
79
- "vite": "7.1.12",
78
+ "vite": "7.2.2",
80
79
  "webpack": "^5.102.1"
81
80
  },
82
81
  "peerDependencies": {