@aiao/rxdb-client-generator 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@aiao/rxdb-client-generator",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
7
7
  "rxdb-client-generator": "./cli.js"
8
8
  },
9
9
  "peerDependencies": {
10
- "@aiao/utils": "0.0.2",
11
- "@aiao/rxdb": "0.0.2",
12
- "type-fest": "^4.41.0",
10
+ "@aiao/utils": "0.0.3",
11
+ "@aiao/rxdb": "0.0.3",
13
12
  "glob": "^11.0.3"
14
13
  },
15
14
  "optionalDependencies": {
@@ -2,12 +2,25 @@
2
2
  * @fileoverview 轻量级 TypeScript 解析器实现
3
3
  * 用于替代 ts-morph 在浏览器上的生成,减少包大小
4
4
  */
5
+ /**
6
+ * 变量声明类型枚举
7
+ * 用于指定变量声明的关键字类型
8
+ */
5
9
  export declare enum VariableDeclarationKind {
6
10
  Var = "var",
7
11
  Let = "let",
8
12
  Const = "const"
9
13
  }
14
+ /**
15
+ * 可选类型包装器
16
+ * 用于标记类型可能是可选的
17
+ * @template T - 原始类型
18
+ */
10
19
  export type OptionalKind<T> = T;
20
+ /**
21
+ * 属性声明结构
22
+ * 用于定义类或接口中的属性
23
+ */
11
24
  export interface PropertyDeclarationStructure {
12
25
  name: string;
13
26
  type?: string;
@@ -17,19 +30,27 @@ export interface PropertyDeclarationStructure {
17
30
  isStatic?: boolean;
18
31
  hasQuestionToken?: boolean;
19
32
  hasExclamationToken?: boolean;
20
- scope?: any;
33
+ scope?: Scope;
21
34
  }
35
+ /**
36
+ * 方法声明结构
37
+ * 用于定义类中的方法
38
+ */
22
39
  export interface MethodDeclarationStructure {
23
40
  name: string;
24
41
  returnType?: string;
25
- parameters?: any[];
42
+ parameters?: ParameterDeclarationStructure[];
26
43
  docs?: string[];
27
44
  isStatic?: boolean;
28
45
  isAsync?: boolean;
29
46
  hasQuestionToken?: boolean;
30
- scope?: any;
47
+ scope?: Scope;
31
48
  statements?: string[];
32
49
  }
50
+ /**
51
+ * 类声明结构
52
+ * 用于定义类的元数据
53
+ */
33
54
  export interface ClassDeclarationStructure {
34
55
  name: string;
35
56
  extends?: string;
@@ -39,8 +60,12 @@ export interface ClassDeclarationStructure {
39
60
  hasDeclareKeyword?: boolean;
40
61
  properties?: PropertyDeclarationStructure[];
41
62
  methods?: MethodDeclarationStructure[];
42
- decorators?: any[];
63
+ decorators?: DecoratorStructure[];
43
64
  }
65
+ /**
66
+ * 接口声明结构
67
+ * 用于定义接口的元数据
68
+ */
44
69
  export interface InterfaceDeclarationStructure {
45
70
  name: string;
46
71
  extends?: string[];
@@ -48,12 +73,20 @@ export interface InterfaceDeclarationStructure {
48
73
  isExported?: boolean;
49
74
  properties?: PropertyDeclarationStructure[];
50
75
  }
76
+ /**
77
+ * 模块声明结构
78
+ * 用于定义模块的元数据
79
+ */
51
80
  export interface ModuleDeclarationStructure {
52
81
  name: string;
53
82
  hasDeclareKeyword?: boolean;
54
83
  docs?: string[];
55
84
  interfaces?: InterfaceDeclarationStructure[];
56
85
  }
86
+ /**
87
+ * 类型别名声明结构
88
+ * 用于定义类型别名的元数据
89
+ */
57
90
  export interface TypeAliasDeclarationStructure {
58
91
  name: string;
59
92
  type: string;
@@ -61,21 +94,29 @@ export interface TypeAliasDeclarationStructure {
61
94
  isExported?: boolean;
62
95
  hasDeclareKeyword?: boolean;
63
96
  }
97
+ /**
98
+ * 导入声明结构
99
+ * 用于定义导入语句的元数据
100
+ */
64
101
  export interface ImportDeclarationStructure {
65
102
  namedImports?: string[];
66
103
  moduleSpecifier: string;
67
104
  isTypeOnly?: boolean;
68
105
  }
106
+ /**
107
+ * 变量语句结构
108
+ * 用于定义变量声明语句的元数据
109
+ */
69
110
  export interface VariableStatementStructure {
70
111
  declarationKind: VariableDeclarationKind;
71
112
  hasDeclareKeyword?: boolean;
72
113
  isExported?: boolean;
73
- declarations: Array<{
74
- name: string;
75
- type?: string;
76
- initializer?: string;
77
- }>;
114
+ declarations: VariableDeclaration[];
78
115
  }
116
+ /**
117
+ * AST节点接口
118
+ * 表示TypeScript AST中的一个节点
119
+ */
79
120
  export interface Node {
80
121
  getDecorators(): Decorator[];
81
122
  getName(): string | undefined;
@@ -84,25 +125,38 @@ export interface Node {
84
125
  getText(): string;
85
126
  getArguments?(): Node[];
86
127
  }
128
+ /**
129
+ * 装饰器接口
130
+ * 表示类或方法上的装饰器
131
+ */
87
132
  export interface Decorator {
88
133
  getName(): string;
89
134
  getExpression(): Node;
90
135
  }
136
+ /**
137
+ * 类声明接口
138
+ * 表示类声明节点
139
+ * @extends Node
140
+ */
91
141
  export interface ClassDeclaration extends Node {
92
142
  addJsDoc(doc: string): void;
93
143
  addProperties(properties: PropertyDeclarationStructure[]): void;
94
- addConstructor(constructor: any): void;
144
+ addConstructor(constructor: ConstructorData): void;
95
145
  addMethods(methods: MethodDeclarationStructure[]): void;
96
146
  properties?: PropertyDeclarationStructure[];
97
147
  methods?: MethodDeclarationStructure[];
98
- constructorData?: any;
148
+ constructorData?: ConstructorData;
99
149
  jsDoc?: string[];
100
150
  }
151
+ /**
152
+ * 源文件接口
153
+ * 表示一个TypeScript源文件
154
+ */
101
155
  export interface SourceFile {
102
156
  addClass(structure: ClassDeclarationStructure): ClassDeclaration;
103
- addInterface(structure: InterfaceDeclarationStructure): any;
104
- addModule(structure: ModuleDeclarationStructure): any;
105
- addTypeAlias(structure: TypeAliasDeclarationStructure): any;
157
+ addInterface(structure: InterfaceDeclarationStructure): AddedInterface;
158
+ addModule(structure: ModuleDeclarationStructure): AddedModule;
159
+ addTypeAlias(structure: TypeAliasDeclarationStructure): TypeAliasDeclarationStructure;
106
160
  addImportDeclaration(structure: ImportDeclarationStructure): void;
107
161
  addVariableStatement(structure: VariableStatementStructure): void;
108
162
  getClasses(): ClassDeclaration[];
@@ -112,13 +166,77 @@ export interface SourceFile {
112
166
  save(): Promise<void>;
113
167
  saveSync(): void;
114
168
  }
169
+ /**
170
+ * 轻量级Project类
171
+ * 用于管理源文件集合
172
+ */
115
173
  export declare class Project {
116
174
  private files;
117
175
  createSourceFile(filePath: string, content?: string): SourceFile;
118
176
  addSourceFileAtPath(filePath: string): SourceFile;
119
177
  getSourceFiles(): SourceFile[];
120
178
  }
179
+ /**
180
+ * 构造函数数据结构
181
+ * 用于定义类构造函数的元数据
182
+ */
183
+ interface ConstructorData {
184
+ parameters: ParameterDeclarationStructure[];
185
+ docs: string[];
186
+ }
187
+ /**
188
+ * 成员访问修饰符类型
189
+ * 表示类成员的可访问性
190
+ */
191
+ export type Scope = 'public' | 'protected' | 'private';
192
+ /**
193
+ * 方法/构造函数参数结构
194
+ * 用于定义方法或构造函数的参数
195
+ */
196
+ export interface ParameterDeclarationStructure {
197
+ name: string;
198
+ type?: string;
199
+ hasQuestionToken?: boolean;
200
+ initializer?: string;
201
+ isRestParameter?: boolean;
202
+ }
203
+ /**
204
+ * 变量声明结构
205
+ * 用于定义变量声明的元数据
206
+ */
207
+ export interface VariableDeclaration {
208
+ name: string;
209
+ type?: string;
210
+ initializer?: string;
211
+ }
212
+ /**
213
+ * 装饰器结构
214
+ * 用于定义装饰器的元数据
215
+ */
216
+ export interface DecoratorStructure {
217
+ name: string;
218
+ arguments?: string[];
219
+ }
220
+ /**
221
+ * 添加接口后的返回类型
222
+ * 提供向接口添加属性的方法
223
+ */
224
+ export interface AddedInterface {
225
+ addProperty(prop: PropertyDeclarationStructure): void;
226
+ }
227
+ /**
228
+ * 添加模块后的返回类型
229
+ * 提供向模块添加接口的方法
230
+ */
231
+ export interface AddedModule {
232
+ addInterface(iface: InterfaceDeclarationStructure): AddedInterface;
233
+ }
234
+ /**
235
+ * Node类型检查工具
236
+ * 提供判断节点类型的辅助方法
237
+ */
121
238
  export declare const Node: {
122
- isDecoratable(node: any): node is Node;
123
- isCallExpression(node: any): boolean;
239
+ isDecoratable(node: unknown): node is Node;
240
+ isCallExpression(node: unknown): node is Node;
124
241
  };
242
+ export {};
package/vite.d.ts CHANGED
@@ -1,6 +1,3 @@
1
1
  import { Plugin } from 'vite';
2
- export interface RxDBViteClientGeneratorOptions {
3
- entities: string[];
4
- outDir: string;
5
- }
6
- export declare function rxDBViteClientGenerator(options?: RxDBViteClientGeneratorOptions): Plugin;
2
+ import { RxDBClientCLIentGeneratorOptions } from './cli.interface';
3
+ export declare function rxDBViteClientGenerator(options: RxDBClientCLIentGeneratorOptions[]): Plugin;
package/vite.js CHANGED
@@ -1,11 +1,15 @@
1
- function n(e) {
1
+ import { b as r } from "./build_rxdb_client_lib-BPIw_COZ.js";
2
+ function l(t) {
2
3
  return {
3
4
  name: "rxdb-client-generator-vite-plugin",
4
5
  closeBundle: async () => {
5
- console.log("123556");
6
+ for (let e = 0; e < t.length; e++) {
7
+ const n = t[e];
8
+ await r(n);
9
+ }
6
10
  }
7
11
  };
8
12
  }
9
13
  export {
10
- n as rxDBViteClientGenerator
14
+ l as rxDBViteClientGenerator
11
15
  };