@lsby/net-core 0.5.0 → 0.5.2

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.
@@ -85,15 +85,16 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
85
85
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B,
86
86
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B,
87
87
  \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F,
88
+ GetNetCoreExportTypeName,
89
+ GetNetCoreExportTypeDefine
88
90
  } from '@lsby/net-core'
89
- import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}",
91
+ import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}"
90
92
 
91
93
  type jsonPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
92
94
  type jsonMethod = \u83B7\u5F97\u63A5\u53E3\u65B9\u6CD5\u7C7B\u578B<typeof \u5BFC\u5165>
93
95
  type jsonInput = \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
94
96
  type jsonErrorOutput = \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F<typeof \u5BFC\u5165>
95
97
  type jsonSuccessOutput = \u83B7\u5F97\u63A5\u53E3\u6B63\u786E\u5F62\u5F0F<typeof \u5BFC\u5165>
96
-
97
98
  type JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = jsonPath extends infer _
98
99
  ? jsonMethod extends infer _
99
100
  ? jsonInput extends infer _
@@ -114,7 +115,6 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
114
115
 
115
116
  type wsPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
116
117
  type wsData = \u53D6\u7B2C\u4E00\u4E2AWS\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
117
-
118
118
  type WS\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = wsPath extends infer _
119
119
  ? wsData extends infer _
120
120
  ? wsData extends Record<string, never>
@@ -125,6 +125,9 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
125
125
  }
126
126
  : never
127
127
  : never
128
+
129
+ type \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = GetNetCoreExportTypeName<\u5BFC\u5165>
130
+ type \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = GetNetCoreExportTypeDefine<\u5BFC\u5165>
128
131
  `;
129
132
  return import_typescript.default.createSourceFile(a.fileName.replaceAll(".ts", "-" + (0, import_node_crypto.randomUUID)() + ".ts"), \u4EE3\u7801, import_typescript.default.ScriptTarget.Latest);
130
133
  });
@@ -145,6 +148,7 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
145
148
  let \u7C7B\u578B\u68C0\u67E5\u5668 = \u65B0\u9879\u76EE.getTypeChecker();
146
149
  let JSON\u7ED3\u679C = [];
147
150
  let WS\u7ED3\u679C = [];
151
+ let \u5BFC\u51FA\u7C7B\u578B = [];
148
152
  for (let \u6E90\u6587\u4EF6 of \u4F34\u968F\u7684\u865A\u62DF\u6587\u4EF6\u4EEC) {
149
153
  import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
150
154
  if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C") {
@@ -167,12 +171,44 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
167
171
  );
168
172
  }
169
173
  });
174
+ let \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = void 0;
175
+ let \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = void 0;
176
+ import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
177
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0") {
178
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
179
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
180
+ type,
181
+ void 0,
182
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
183
+ );
184
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
185
+ \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = JSON.parse(\u5B57\u7B26\u4E32\u7ED3\u679C);
186
+ }
187
+ }
188
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49") {
189
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
190
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
191
+ type,
192
+ void 0,
193
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
194
+ );
195
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
196
+ \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = type.symbol.declarations?.[0]?.getText();
197
+ }
198
+ }
199
+ });
200
+ if (\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 !== void 0 && \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 !== void 0) {
201
+ \u5BFC\u51FA\u7C7B\u578B.push(`export type ${\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0} = ${\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49}`);
202
+ }
170
203
  }
171
204
  let \u6700\u7EC8\u7ED3\u679C_JSON = Array.from(new Set(JSON\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
172
205
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_JSON.length} \u4E2Ajson\u63A5\u53E3\u7C7B\u578B`);
173
206
  let \u6700\u7EC8\u7ED3\u679C_WS = Array.from(new Set(WS\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
174
207
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_WS.length} \u4E2Aws\u63A5\u53E3\u7C7B\u578B`);
208
+ let \u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B = Array.from(new Set(\u5BFC\u51FA\u7C7B\u578B.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
209
+ await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B.length} \u4E2A\u5BFC\u51FA\u7C7B\u578B`);
175
210
  let \u6700\u7EC8\u4EE3\u7801 = [
211
+ ...\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B,
176
212
  `export type InterfaceType = [${\u6700\u7EC8\u7ED3\u679C_JSON.join(",")}]`,
177
213
  `export type InterfaceWsType = [${\u6700\u7EC8\u7ED3\u679C_WS.join(",")}]`,
178
214
  \u9644\u52A0\u4EE3\u7801
@@ -90,15 +90,16 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
90
90
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B,
91
91
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B,
92
92
  \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F,
93
+ GetNetCoreExportTypeName,
94
+ GetNetCoreExportTypeDefine
93
95
  } from '@lsby/net-core'
94
- import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}",
96
+ import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}"
95
97
 
96
98
  type jsonPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
97
99
  type jsonMethod = \u83B7\u5F97\u63A5\u53E3\u65B9\u6CD5\u7C7B\u578B<typeof \u5BFC\u5165>
98
100
  type jsonInput = \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
99
101
  type jsonErrorOutput = \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F<typeof \u5BFC\u5165>
100
102
  type jsonSuccessOutput = \u83B7\u5F97\u63A5\u53E3\u6B63\u786E\u5F62\u5F0F<typeof \u5BFC\u5165>
101
-
102
103
  type JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = jsonPath extends infer _
103
104
  ? jsonMethod extends infer _
104
105
  ? jsonInput extends infer _
@@ -119,7 +120,6 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
119
120
 
120
121
  type wsPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
121
122
  type wsData = \u53D6\u7B2C\u4E00\u4E2AWS\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
122
-
123
123
  type WS\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = wsPath extends infer _
124
124
  ? wsData extends infer _
125
125
  ? wsData extends Record<string, never>
@@ -130,6 +130,9 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
130
130
  }
131
131
  : never
132
132
  : never
133
+
134
+ type \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = GetNetCoreExportTypeName<\u5BFC\u5165>
135
+ type \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = GetNetCoreExportTypeDefine<\u5BFC\u5165>
133
136
  `;
134
137
  return import_typescript.default.createSourceFile(a.fileName.replaceAll(".ts", "-" + (0, import_node_crypto.randomUUID)() + ".ts"), \u4EE3\u7801, import_typescript.default.ScriptTarget.Latest);
135
138
  });
@@ -150,6 +153,7 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
150
153
  let \u7C7B\u578B\u68C0\u67E5\u5668 = \u65B0\u9879\u76EE.getTypeChecker();
151
154
  let JSON\u7ED3\u679C = [];
152
155
  let WS\u7ED3\u679C = [];
156
+ let \u5BFC\u51FA\u7C7B\u578B = [];
153
157
  for (let \u6E90\u6587\u4EF6 of \u4F34\u968F\u7684\u865A\u62DF\u6587\u4EF6\u4EEC) {
154
158
  import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
155
159
  if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C") {
@@ -172,12 +176,44 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
172
176
  );
173
177
  }
174
178
  });
179
+ let \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = void 0;
180
+ let \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = void 0;
181
+ import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
182
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0") {
183
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
184
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
185
+ type,
186
+ void 0,
187
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
188
+ );
189
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
190
+ \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = JSON.parse(\u5B57\u7B26\u4E32\u7ED3\u679C);
191
+ }
192
+ }
193
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49") {
194
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
195
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
196
+ type,
197
+ void 0,
198
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
199
+ );
200
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
201
+ \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = type.symbol.declarations?.[0]?.getText();
202
+ }
203
+ }
204
+ });
205
+ if (\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 !== void 0 && \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 !== void 0) {
206
+ \u5BFC\u51FA\u7C7B\u578B.push(`export type ${\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0} = ${\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49}`);
207
+ }
175
208
  }
176
209
  let \u6700\u7EC8\u7ED3\u679C_JSON = Array.from(new Set(JSON\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
177
210
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_JSON.length} \u4E2Ajson\u63A5\u53E3\u7C7B\u578B`);
178
211
  let \u6700\u7EC8\u7ED3\u679C_WS = Array.from(new Set(WS\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
179
212
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_WS.length} \u4E2Aws\u63A5\u53E3\u7C7B\u578B`);
213
+ let \u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B = Array.from(new Set(\u5BFC\u51FA\u7C7B\u578B.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
214
+ await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B.length} \u4E2A\u5BFC\u51FA\u7C7B\u578B`);
180
215
  let \u6700\u7EC8\u4EE3\u7801 = [
216
+ ...\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B,
181
217
  `export type InterfaceType = [${\u6700\u7EC8\u7ED3\u679C_JSON.join(",")}]`,
182
218
  `export type InterfaceWsType = [${\u6700\u7EC8\u7ED3\u679C_WS.join(",")}]`,
183
219
  \u9644\u52A0\u4EE3\u7801
@@ -85,15 +85,16 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
85
85
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B,
86
86
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B,
87
87
  \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F,
88
+ GetNetCoreExportTypeName,
89
+ GetNetCoreExportTypeDefine
88
90
  } from '@lsby/net-core'
89
- import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}",
91
+ import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}"
90
92
 
91
93
  type jsonPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
92
94
  type jsonMethod = \u83B7\u5F97\u63A5\u53E3\u65B9\u6CD5\u7C7B\u578B<typeof \u5BFC\u5165>
93
95
  type jsonInput = \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
94
96
  type jsonErrorOutput = \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F<typeof \u5BFC\u5165>
95
97
  type jsonSuccessOutput = \u83B7\u5F97\u63A5\u53E3\u6B63\u786E\u5F62\u5F0F<typeof \u5BFC\u5165>
96
-
97
98
  type JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = jsonPath extends infer _
98
99
  ? jsonMethod extends infer _
99
100
  ? jsonInput extends infer _
@@ -114,7 +115,6 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
114
115
 
115
116
  type wsPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
116
117
  type wsData = \u53D6\u7B2C\u4E00\u4E2AWS\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
117
-
118
118
  type WS\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = wsPath extends infer _
119
119
  ? wsData extends infer _
120
120
  ? wsData extends Record<string, never>
@@ -125,6 +125,9 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
125
125
  }
126
126
  : never
127
127
  : never
128
+
129
+ type \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = GetNetCoreExportTypeName<\u5BFC\u5165>
130
+ type \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = GetNetCoreExportTypeDefine<\u5BFC\u5165>
128
131
  `;
129
132
  return import_typescript.default.createSourceFile(a.fileName.replaceAll(".ts", "-" + (0, import_node_crypto.randomUUID)() + ".ts"), \u4EE3\u7801, import_typescript.default.ScriptTarget.Latest);
130
133
  });
@@ -145,6 +148,7 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
145
148
  let \u7C7B\u578B\u68C0\u67E5\u5668 = \u65B0\u9879\u76EE.getTypeChecker();
146
149
  let JSON\u7ED3\u679C = [];
147
150
  let WS\u7ED3\u679C = [];
151
+ let \u5BFC\u51FA\u7C7B\u578B = [];
148
152
  for (let \u6E90\u6587\u4EF6 of \u4F34\u968F\u7684\u865A\u62DF\u6587\u4EF6\u4EEC) {
149
153
  import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
150
154
  if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C") {
@@ -167,12 +171,44 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
167
171
  );
168
172
  }
169
173
  });
174
+ let \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = void 0;
175
+ let \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = void 0;
176
+ import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
177
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0") {
178
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
179
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
180
+ type,
181
+ void 0,
182
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
183
+ );
184
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
185
+ \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = JSON.parse(\u5B57\u7B26\u4E32\u7ED3\u679C);
186
+ }
187
+ }
188
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49") {
189
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
190
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
191
+ type,
192
+ void 0,
193
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
194
+ );
195
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
196
+ \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = type.symbol.declarations?.[0]?.getText();
197
+ }
198
+ }
199
+ });
200
+ if (\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 !== void 0 && \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 !== void 0) {
201
+ \u5BFC\u51FA\u7C7B\u578B.push(`export type ${\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0} = ${\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49}`);
202
+ }
170
203
  }
171
204
  let \u6700\u7EC8\u7ED3\u679C_JSON = Array.from(new Set(JSON\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
172
205
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_JSON.length} \u4E2Ajson\u63A5\u53E3\u7C7B\u578B`);
173
206
  let \u6700\u7EC8\u7ED3\u679C_WS = Array.from(new Set(WS\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
174
207
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_WS.length} \u4E2Aws\u63A5\u53E3\u7C7B\u578B`);
208
+ let \u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B = Array.from(new Set(\u5BFC\u51FA\u7C7B\u578B.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
209
+ await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B.length} \u4E2A\u5BFC\u51FA\u7C7B\u578B`);
175
210
  let \u6700\u7EC8\u4EE3\u7801 = [
211
+ ...\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B,
176
212
  `export type InterfaceType = [${\u6700\u7EC8\u7ED3\u679C_JSON.join(",")}]`,
177
213
  `export type InterfaceWsType = [${\u6700\u7EC8\u7ED3\u679C_WS.join(",")}]`,
178
214
  \u9644\u52A0\u4EE3\u7801
@@ -90,15 +90,16 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
90
90
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B,
91
91
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B,
92
92
  \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F,
93
+ GetNetCoreExportTypeName,
94
+ GetNetCoreExportTypeDefine
93
95
  } from '@lsby/net-core'
94
- import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}",
96
+ import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}"
95
97
 
96
98
  type jsonPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
97
99
  type jsonMethod = \u83B7\u5F97\u63A5\u53E3\u65B9\u6CD5\u7C7B\u578B<typeof \u5BFC\u5165>
98
100
  type jsonInput = \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
99
101
  type jsonErrorOutput = \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F<typeof \u5BFC\u5165>
100
102
  type jsonSuccessOutput = \u83B7\u5F97\u63A5\u53E3\u6B63\u786E\u5F62\u5F0F<typeof \u5BFC\u5165>
101
-
102
103
  type JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = jsonPath extends infer _
103
104
  ? jsonMethod extends infer _
104
105
  ? jsonInput extends infer _
@@ -119,7 +120,6 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
119
120
 
120
121
  type wsPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
121
122
  type wsData = \u53D6\u7B2C\u4E00\u4E2AWS\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
122
-
123
123
  type WS\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = wsPath extends infer _
124
124
  ? wsData extends infer _
125
125
  ? wsData extends Record<string, never>
@@ -130,6 +130,9 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
130
130
  }
131
131
  : never
132
132
  : never
133
+
134
+ type \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = GetNetCoreExportTypeName<\u5BFC\u5165>
135
+ type \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = GetNetCoreExportTypeDefine<\u5BFC\u5165>
133
136
  `;
134
137
  return import_typescript.default.createSourceFile(a.fileName.replaceAll(".ts", "-" + (0, import_node_crypto.randomUUID)() + ".ts"), \u4EE3\u7801, import_typescript.default.ScriptTarget.Latest);
135
138
  });
@@ -150,6 +153,7 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
150
153
  let \u7C7B\u578B\u68C0\u67E5\u5668 = \u65B0\u9879\u76EE.getTypeChecker();
151
154
  let JSON\u7ED3\u679C = [];
152
155
  let WS\u7ED3\u679C = [];
156
+ let \u5BFC\u51FA\u7C7B\u578B = [];
153
157
  for (let \u6E90\u6587\u4EF6 of \u4F34\u968F\u7684\u865A\u62DF\u6587\u4EF6\u4EEC) {
154
158
  import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
155
159
  if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C") {
@@ -172,12 +176,44 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
172
176
  );
173
177
  }
174
178
  });
179
+ let \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = void 0;
180
+ let \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = void 0;
181
+ import_typescript.default.forEachChild(\u6E90\u6587\u4EF6, (node) => {
182
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0") {
183
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
184
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
185
+ type,
186
+ void 0,
187
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
188
+ );
189
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
190
+ \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = JSON.parse(\u5B57\u7B26\u4E32\u7ED3\u679C);
191
+ }
192
+ }
193
+ if (import_typescript.default.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49") {
194
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
195
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
196
+ type,
197
+ void 0,
198
+ import_typescript.default.TypeFormatFlags.NoTruncation | import_typescript.default.TypeFormatFlags.NoTypeReduction | import_typescript.default.TypeFormatFlags.AllowUniqueESSymbolType | import_typescript.default.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
199
+ );
200
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
201
+ \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = type.symbol.declarations?.[0]?.getText();
202
+ }
203
+ }
204
+ });
205
+ if (\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 !== void 0 && \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 !== void 0) {
206
+ \u5BFC\u51FA\u7C7B\u578B.push(`export type ${\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0} = ${\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49}`);
207
+ }
175
208
  }
176
209
  let \u6700\u7EC8\u7ED3\u679C_JSON = Array.from(new Set(JSON\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
177
210
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_JSON.length} \u4E2Ajson\u63A5\u53E3\u7C7B\u578B`);
178
211
  let \u6700\u7EC8\u7ED3\u679C_WS = Array.from(new Set(WS\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
179
212
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_WS.length} \u4E2Aws\u63A5\u53E3\u7C7B\u578B`);
213
+ let \u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B = Array.from(new Set(\u5BFC\u51FA\u7C7B\u578B.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
214
+ await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B.length} \u4E2A\u5BFC\u51FA\u7C7B\u578B`);
180
215
  let \u6700\u7EC8\u4EE3\u7801 = [
216
+ ...\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B,
181
217
  `export type InterfaceType = [${\u6700\u7EC8\u7ED3\u679C_JSON.join(",")}]`,
182
218
  `export type InterfaceWsType = [${\u6700\u7EC8\u7ED3\u679C_WS.join(",")}]`,
183
219
  \u9644\u52A0\u4EE3\u7801
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ EXPORT_TYPE: () => EXPORT_TYPE,
33
34
  JSON\u89E3\u6790\u63D2\u4EF6: () => JSON\u89E3\u6790\u63D2\u4EF6,
34
35
  WebSocket\u63D2\u4EF6: () => WebSocket\u63D2\u4EF6,
35
36
  \u4E1A\u52A1\u884C\u4E3A: () => \u4E1A\u52A1\u884C\u4E3A,
@@ -756,8 +757,12 @@ var \u670D\u52A1\u5668 = class {
756
757
  return Object.values((0, import_node_os.networkInterfaces)()).flatMap((iface) => iface ?? []).map((address) => `http://${address.address}:${this.\u7AEF\u53E3}`);
757
758
  }
758
759
  };
760
+
761
+ // src/symbol/export-type.ts
762
+ var EXPORT_TYPE = Symbol();
759
763
  // Annotate the CommonJS export names for ESM import in node:
760
764
  0 && (module.exports = {
765
+ EXPORT_TYPE,
761
766
  JSON\u89E3\u6790\u63D2\u4EF6,
762
767
  WebSocket\u63D2\u4EF6,
763
768
  \u4E1A\u52A1\u884C\u4E3A,
@@ -12,6 +12,8 @@ export { 任意插件, 包装插件项, 取Task插件内部类型, 取Task插件
12
12
  export { 截断字符串, 递归截断字符串 } from './tools/tools.cjs';
13
13
  export { 去除只读 } from './tools/types.cjs';
14
14
  export { 服务器 } from './server/server.cjs';
15
+ export { EXPORT_TYPE } from './symbol/export-type.cjs';
16
+ export { GetNetCoreExportTypeDefine, GetNetCoreExportTypeName, NetCoreExportType } from './types/export-type.cjs';
15
17
  import '@lsby/ts-fp-data';
16
18
  import 'zod';
17
19
  import 'express';
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/symbol/export-type.ts
21
+ var export_type_exports = {};
22
+ __export(export_type_exports, {
23
+ EXPORT_TYPE: () => EXPORT_TYPE
24
+ });
25
+ module.exports = __toCommonJS(export_type_exports);
26
+ var EXPORT_TYPE = Symbol();
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ EXPORT_TYPE
30
+ });
@@ -0,0 +1,3 @@
1
+ declare let EXPORT_TYPE: symbol;
2
+
3
+ export { EXPORT_TYPE };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/export-type.ts
17
+ var export_type_exports = {};
18
+ module.exports = __toCommonJS(export_type_exports);
@@ -0,0 +1,11 @@
1
+ import { EXPORT_TYPE } from '../symbol/export-type.cjs';
2
+
3
+ type NetCoreExportType<Name, T> = {
4
+ name: Name;
5
+ symbol: typeof EXPORT_TYPE;
6
+ type: T;
7
+ };
8
+ type GetNetCoreExportTypeName<T> = T extends NetCoreExportType<infer X, any> ? X : never;
9
+ type GetNetCoreExportTypeDefine<T> = T extends NetCoreExportType<any, infer X> ? X : never;
10
+
11
+ export type { GetNetCoreExportTypeDefine, GetNetCoreExportTypeName, NetCoreExportType };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../../chunk-UHOWN2M5.js";
4
+ } from "../../chunk-YRXFPMG3.js";
5
5
  import "../../chunk-JVDSGTFS.js";
6
6
 
7
7
  // src/bin/gen-api-type/bin.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  main
3
- } from "../../chunk-UHOWN2M5.js";
3
+ } from "../../chunk-YRXFPMG3.js";
4
4
  import "../../chunk-JVDSGTFS.js";
5
5
  export {
6
6
  main
File without changes
@@ -55,15 +55,16 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
55
55
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B,
56
56
  \u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B,
57
57
  \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F,
58
+ GetNetCoreExportTypeName,
59
+ GetNetCoreExportTypeDefine
58
60
  } from '@lsby/net-core'
59
- import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}",
61
+ import \u5BFC\u5165 from "./${a.fileName.split("/").at(-1)?.replaceAll(".ts", "")}"
60
62
 
61
63
  type jsonPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
62
64
  type jsonMethod = \u83B7\u5F97\u63A5\u53E3\u65B9\u6CD5\u7C7B\u578B<typeof \u5BFC\u5165>
63
65
  type jsonInput = \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
64
66
  type jsonErrorOutput = \u83B7\u5F97\u63A5\u53E3\u9519\u8BEF\u5F62\u5F0F<typeof \u5BFC\u5165>
65
67
  type jsonSuccessOutput = \u83B7\u5F97\u63A5\u53E3\u6B63\u786E\u5F62\u5F0F<typeof \u5BFC\u5165>
66
-
67
68
  type JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = jsonPath extends infer _
68
69
  ? jsonMethod extends infer _
69
70
  ? jsonInput extends infer _
@@ -84,7 +85,6 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
84
85
 
85
86
  type wsPath = \u83B7\u5F97\u63A5\u53E3\u8DEF\u5F84\u7C7B\u578B<typeof \u5BFC\u5165>
86
87
  type wsData = \u53D6\u7B2C\u4E00\u4E2AWS\u63D2\u4EF6\u7ED3\u679C<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u63D2\u4EF6\u7C7B\u578B<\u83B7\u5F97\u63A5\u53E3\u903B\u8F91\u7C7B\u578B<typeof \u5BFC\u5165>>>
87
-
88
88
  type WS\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C = wsPath extends infer _
89
89
  ? wsData extends infer _
90
90
  ? wsData extends Record<string, never>
@@ -95,6 +95,9 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
95
95
  }
96
96
  : never
97
97
  : never
98
+
99
+ type \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = GetNetCoreExportTypeName<\u5BFC\u5165>
100
+ type \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = GetNetCoreExportTypeDefine<\u5BFC\u5165>
98
101
  `;
99
102
  return ts.createSourceFile(a.fileName.replaceAll(".ts", "-" + randomUUID() + ".ts"), \u4EE3\u7801, ts.ScriptTarget.Latest);
100
103
  });
@@ -115,6 +118,7 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
115
118
  let \u7C7B\u578B\u68C0\u67E5\u5668 = \u65B0\u9879\u76EE.getTypeChecker();
116
119
  let JSON\u7ED3\u679C = [];
117
120
  let WS\u7ED3\u679C = [];
121
+ let \u5BFC\u51FA\u7C7B\u578B = [];
118
122
  for (let \u6E90\u6587\u4EF6 of \u4F34\u968F\u7684\u865A\u62DF\u6587\u4EF6\u4EEC) {
119
123
  ts.forEachChild(\u6E90\u6587\u4EF6, (node) => {
120
124
  if (ts.isTypeAliasDeclaration(node) && node.name.text === "JSON\u63A5\u53E3\u8BA1\u7B97\u7ED3\u679C") {
@@ -137,12 +141,44 @@ async function main(tsconfig\u8DEF\u5F84, \u76EE\u6807\u8DEF\u5F84, \u8F93\u51FA
137
141
  );
138
142
  }
139
143
  });
144
+ let \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = void 0;
145
+ let \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = void 0;
146
+ ts.forEachChild(\u6E90\u6587\u4EF6, (node) => {
147
+ if (ts.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0") {
148
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
149
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
150
+ type,
151
+ void 0,
152
+ ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.AllowUniqueESSymbolType | ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
153
+ );
154
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
155
+ \u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 = JSON.parse(\u5B57\u7B26\u4E32\u7ED3\u679C);
156
+ }
157
+ }
158
+ if (ts.isTypeAliasDeclaration(node) && node.name.text === "\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49") {
159
+ let type = \u7C7B\u578B\u68C0\u67E5\u5668.getTypeAtLocation(node);
160
+ let \u5B57\u7B26\u4E32\u7ED3\u679C = \u7C7B\u578B\u68C0\u67E5\u5668.typeToString(
161
+ type,
162
+ void 0,
163
+ ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.AllowUniqueESSymbolType | ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
164
+ );
165
+ if (\u5B57\u7B26\u4E32\u7ED3\u679C !== "unknown") {
166
+ \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 = type.symbol.declarations?.[0]?.getText();
167
+ }
168
+ }
169
+ });
170
+ if (\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0 !== void 0 && \u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49 !== void 0) {
171
+ \u5BFC\u51FA\u7C7B\u578B.push(`export type ${\u5BFC\u51FA\u7C7B\u578B\u540D\u79F0} = ${\u5BFC\u51FA\u7C7B\u578B\u5B9A\u4E49}`);
172
+ }
140
173
  }
141
174
  let \u6700\u7EC8\u7ED3\u679C_JSON = Array.from(new Set(JSON\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
142
175
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_JSON.length} \u4E2Ajson\u63A5\u53E3\u7C7B\u578B`);
143
176
  let \u6700\u7EC8\u7ED3\u679C_WS = Array.from(new Set(WS\u7ED3\u679C.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
144
177
  await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_WS.length} \u4E2Aws\u63A5\u53E3\u7C7B\u578B`);
178
+ let \u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B = Array.from(new Set(\u5BFC\u51FA\u7C7B\u578B.filter((a) => a !== "any" && a !== "never" && a !== "unknown")));
179
+ await log.debug(`\u6700\u7EC8\u7B5B\u9009\u51FA ${\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B.length} \u4E2A\u5BFC\u51FA\u7C7B\u578B`);
145
180
  let \u6700\u7EC8\u4EE3\u7801 = [
181
+ ...\u6700\u7EC8\u7ED3\u679C_\u5BFC\u51FA\u7C7B\u578B,
146
182
  `export type InterfaceType = [${\u6700\u7EC8\u7ED3\u679C_JSON.join(",")}]`,
147
183
  `export type InterfaceWsType = [${\u6700\u7EC8\u7ED3\u679C_WS.join(",")}]`,
148
184
  \u9644\u52A0\u4EE3\u7801
@@ -0,0 +1,6 @@
1
+ // src/symbol/export-type.ts
2
+ var EXPORT_TYPE = Symbol();
3
+
4
+ export {
5
+ EXPORT_TYPE
6
+ };
@@ -12,6 +12,8 @@ export { 任意插件, 包装插件项, 取Task插件内部类型, 取Task插件
12
12
  export { 截断字符串, 递归截断字符串 } from './tools/tools.js';
13
13
  export { 去除只读 } from './tools/types.js';
14
14
  export { 服务器 } from './server/server.js';
15
+ export { EXPORT_TYPE } from './symbol/export-type.js';
16
+ export { GetNetCoreExportTypeDefine, GetNetCoreExportTypeName, NetCoreExportType } from './types/export-type.js';
15
17
  import '@lsby/ts-fp-data';
16
18
  import 'zod';
17
19
  import 'express';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,9 @@
1
+ import {
2
+ 表单解析插件
3
+ } from "./chunk-L36NOE2J.js";
4
+ import {
5
+ WebSocket插件
6
+ } from "./chunk-Z3PYJGMZ.js";
1
7
  import {
2
8
  中文路径支持插件
3
9
  } from "./chunk-47T4ZLNQ.js";
@@ -7,23 +13,21 @@ import {
7
13
  import {
8
14
  JSON解析插件
9
15
  } from "./chunk-P6HJULSY.js";
10
- import {
11
- 表单解析插件
12
- } from "./chunk-L36NOE2J.js";
13
- import {
14
- WebSocket插件
15
- } from "./chunk-Z3PYJGMZ.js";
16
16
  import {
17
17
  插件
18
18
  } from "./chunk-43GZE5YL.js";
19
- import "./chunk-DAKGERGA.js";
20
19
  import {
21
20
  服务器
22
21
  } from "./chunk-JBHOWUYP.js";
22
+ import {
23
+ EXPORT_TYPE
24
+ } from "./chunk-ZF7EC2OM.js";
23
25
  import {
24
26
  截断字符串,
25
27
  递归截断字符串
26
28
  } from "./chunk-IGHJCQ2S.js";
29
+ import "./chunk-DAKGERGA.js";
30
+ import "./chunk-XPFEAXE4.js";
27
31
  import {
28
32
  业务行为
29
33
  } from "./chunk-CE4M2QA4.js";
@@ -42,6 +46,7 @@ import {
42
46
  接口测试
43
47
  } from "./chunk-GLZWRYH6.js";
44
48
  export {
49
+ EXPORT_TYPE,
45
50
  JSON\u89E3\u6790\u63D2\u4EF6,
46
51
  WebSocket\u63D2\u4EF6,
47
52
  \u4E1A\u52A1\u884C\u4E3A,
@@ -0,0 +1,3 @@
1
+ declare let EXPORT_TYPE: symbol;
2
+
3
+ export { EXPORT_TYPE };
@@ -0,0 +1,6 @@
1
+ import {
2
+ EXPORT_TYPE
3
+ } from "../chunk-ZF7EC2OM.js";
4
+ export {
5
+ EXPORT_TYPE
6
+ };
@@ -0,0 +1,11 @@
1
+ import { EXPORT_TYPE } from '../symbol/export-type.js';
2
+
3
+ type NetCoreExportType<Name, T> = {
4
+ name: Name;
5
+ symbol: typeof EXPORT_TYPE;
6
+ type: T;
7
+ };
8
+ type GetNetCoreExportTypeName<T> = T extends NetCoreExportType<infer X, any> ? X : never;
9
+ type GetNetCoreExportTypeDefine<T> = T extends NetCoreExportType<any, infer X> ? X : never;
10
+
11
+ export type { GetNetCoreExportTypeDefine, GetNetCoreExportTypeName, NetCoreExportType };
@@ -0,0 +1 @@
1
+ import "../chunk-XPFEAXE4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/net-core",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "require": "./dist/cjs/index.cjs",