tywrap 0.1.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.
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +263 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/index.d.ts +41 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +234 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/analyzer.d.ts +63 -0
- package/dist/core/analyzer.d.ts.map +1 -0
- package/dist/core/analyzer.js +676 -0
- package/dist/core/analyzer.js.map +1 -0
- package/dist/core/discovery.d.ts +85 -0
- package/dist/core/discovery.d.ts.map +1 -0
- package/dist/core/discovery.js +344 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/generator.d.ts +37 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/dist/core/generator.js +368 -0
- package/dist/core/generator.js.map +1 -0
- package/dist/core/mapper.d.ts +40 -0
- package/dist/core/mapper.d.ts.map +1 -0
- package/dist/core/mapper.js +401 -0
- package/dist/core/mapper.js.map +1 -0
- package/dist/core/validation.d.ts +79 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +486 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/base.d.ts +12 -0
- package/dist/runtime/base.d.ts.map +1 -0
- package/dist/runtime/base.js +6 -0
- package/dist/runtime/base.js.map +1 -0
- package/dist/runtime/errors.d.ts +17 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +21 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/http.d.ts +22 -0
- package/dist/runtime/http.d.ts.map +1 -0
- package/dist/runtime/http.js +79 -0
- package/dist/runtime/http.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +17 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/node.d.ts +48 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +328 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/optimized-node.d.ts +131 -0
- package/dist/runtime/optimized-node.d.ts.map +1 -0
- package/dist/runtime/optimized-node.js +622 -0
- package/dist/runtime/optimized-node.js.map +1 -0
- package/dist/runtime/protocol.d.ts +3 -0
- package/dist/runtime/protocol.d.ts.map +1 -0
- package/dist/runtime/protocol.js +3 -0
- package/dist/runtime/protocol.js.map +1 -0
- package/dist/runtime/pyodide.d.ts +27 -0
- package/dist/runtime/pyodide.d.ts.map +1 -0
- package/dist/runtime/pyodide.js +191 -0
- package/dist/runtime/pyodide.js.map +1 -0
- package/dist/tools/python_suite.js +173 -0
- package/dist/tools/python_suite.js.map +1 -0
- package/dist/types/index.d.ts +299 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/tywrap.d.ts +29 -0
- package/dist/tywrap.d.ts.map +1 -0
- package/dist/tywrap.js +589 -0
- package/dist/tywrap.js.map +1 -0
- package/dist/utils/bundle-optimizer.d.ts +182 -0
- package/dist/utils/bundle-optimizer.d.ts.map +1 -0
- package/dist/utils/bundle-optimizer.js +680 -0
- package/dist/utils/bundle-optimizer.js.map +1 -0
- package/dist/utils/cache.d.ts +149 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +492 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/codec.d.ts +94 -0
- package/dist/utils/codec.d.ts.map +1 -0
- package/dist/utils/codec.js +150 -0
- package/dist/utils/codec.js.map +1 -0
- package/dist/utils/logger.d.ts +42 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +140 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/memory-profiler.d.ts +123 -0
- package/dist/utils/memory-profiler.d.ts.map +1 -0
- package/dist/utils/memory-profiler.js +426 -0
- package/dist/utils/memory-profiler.js.map +1 -0
- package/dist/utils/parallel-processor.d.ts +146 -0
- package/dist/utils/parallel-processor.d.ts.map +1 -0
- package/dist/utils/parallel-processor.js +636 -0
- package/dist/utils/parallel-processor.js.map +1 -0
- package/dist/utils/python.d.ts +8 -0
- package/dist/utils/python.d.ts.map +1 -0
- package/dist/utils/python.js +56 -0
- package/dist/utils/python.js.map +1 -0
- package/dist/utils/runtime.d.ts +153 -0
- package/dist/utils/runtime.d.ts.map +1 -0
- package/dist/utils/runtime.js +519 -0
- package/dist/utils/runtime.js.map +1 -0
- package/package.json +136 -0
- package/runtime/python_bridge.py +476 -0
- package/src/cli.ts +331 -0
- package/src/config/index.ts +289 -0
- package/src/core/analyzer.ts +788 -0
- package/src/core/discovery.ts +415 -0
- package/src/core/generator.ts +447 -0
- package/src/core/mapper.ts +504 -0
- package/src/core/validation.ts +693 -0
- package/src/index.ts +83 -0
- package/src/runtime/base.ts +32 -0
- package/src/runtime/errors.ts +19 -0
- package/src/runtime/http.ts +132 -0
- package/src/runtime/index.ts +24 -0
- package/src/runtime/node.ts +431 -0
- package/src/runtime/optimized-node.ts +838 -0
- package/src/runtime/protocol.ts +2 -0
- package/src/runtime/pyodide.ts +228 -0
- package/src/types/global.d.ts +60 -0
- package/src/types/index.ts +410 -0
- package/src/tywrap.ts +669 -0
- package/src/utils/bundle-optimizer.ts +876 -0
- package/src/utils/cache.ts +634 -0
- package/src/utils/codec.ts +275 -0
- package/src/utils/logger.ts +201 -0
- package/src/utils/memory-profiler.ts +582 -0
- package/src/utils/parallel-processor.ts +879 -0
- package/src/utils/python.ts +79 -0
- package/src/utils/runtime.ts +616 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling & Validation Framework
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive error handling, syntax validation, and analysis reporting system
|
|
5
|
+
*/
|
|
6
|
+
export class ValidationEngine {
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
this.config = {
|
|
10
|
+
strictTypeChecking: config.strictTypeChecking ?? true,
|
|
11
|
+
allowMissingTypeHints: config.allowMissingTypeHints ?? false,
|
|
12
|
+
maxComplexityScore: 10,
|
|
13
|
+
deprecatedPatterns: [],
|
|
14
|
+
requiredDocstrings: false,
|
|
15
|
+
...config,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validate Python functions for type safety and best practices
|
|
20
|
+
*/
|
|
21
|
+
validateFunction(func, filePath) {
|
|
22
|
+
const errors = [];
|
|
23
|
+
const warnings = [];
|
|
24
|
+
const recommendations = [];
|
|
25
|
+
// Check type hints
|
|
26
|
+
this.validateTypeHints(func, errors, warnings);
|
|
27
|
+
// Check docstring
|
|
28
|
+
this.validateDocstring(func, warnings, filePath);
|
|
29
|
+
// Check parameter patterns
|
|
30
|
+
this.validateParameters(func, warnings, filePath);
|
|
31
|
+
// Check for deprecated patterns
|
|
32
|
+
this.validateDeprecatedPatterns(func, warnings, filePath);
|
|
33
|
+
// Check complexity
|
|
34
|
+
this.validateComplexity(func, warnings, filePath);
|
|
35
|
+
// Generate recommendations
|
|
36
|
+
this.generateFunctionRecommendations(func, recommendations, filePath);
|
|
37
|
+
const statistics = this.calculateFunctionStatistics(func, errors, warnings);
|
|
38
|
+
return {
|
|
39
|
+
errors,
|
|
40
|
+
warnings,
|
|
41
|
+
statistics,
|
|
42
|
+
recommendations,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validate Python classes for structure and best practices
|
|
47
|
+
*/
|
|
48
|
+
validateClass(cls, filePath) {
|
|
49
|
+
const errors = [];
|
|
50
|
+
const warnings = [];
|
|
51
|
+
const recommendations = [];
|
|
52
|
+
// Validate each method
|
|
53
|
+
for (const method of cls.methods) {
|
|
54
|
+
const methodReport = this.validateFunction(method, filePath);
|
|
55
|
+
errors.push(...methodReport.errors);
|
|
56
|
+
warnings.push(...methodReport.warnings);
|
|
57
|
+
recommendations.push(...methodReport.recommendations);
|
|
58
|
+
}
|
|
59
|
+
// Validate class-specific patterns
|
|
60
|
+
this.validateClassStructure(cls, warnings, filePath);
|
|
61
|
+
this.validateInheritance(cls, warnings, filePath);
|
|
62
|
+
const statistics = this.calculateClassStatistics(cls, errors, warnings);
|
|
63
|
+
return {
|
|
64
|
+
errors,
|
|
65
|
+
warnings,
|
|
66
|
+
statistics,
|
|
67
|
+
recommendations,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validate type annotations for correctness
|
|
72
|
+
*/
|
|
73
|
+
validateTypeAnnotation(type, context = '') {
|
|
74
|
+
const errors = [];
|
|
75
|
+
try {
|
|
76
|
+
this.validateTypeStructure(type, errors, context);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
errors.push({
|
|
80
|
+
type: 'type',
|
|
81
|
+
message: `Type validation failed: ${error}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return errors;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Generate comprehensive analysis report
|
|
88
|
+
*/
|
|
89
|
+
generateReport(functions, classes, filePath) {
|
|
90
|
+
const errors = [];
|
|
91
|
+
const warnings = [];
|
|
92
|
+
const recommendations = [];
|
|
93
|
+
// Validate all functions
|
|
94
|
+
for (const func of functions) {
|
|
95
|
+
const funcReport = this.validateFunction(func, filePath);
|
|
96
|
+
errors.push(...funcReport.errors);
|
|
97
|
+
warnings.push(...funcReport.warnings);
|
|
98
|
+
recommendations.push(...funcReport.recommendations);
|
|
99
|
+
}
|
|
100
|
+
// Validate all classes
|
|
101
|
+
for (const cls of classes) {
|
|
102
|
+
const classReport = this.validateClass(cls, filePath);
|
|
103
|
+
errors.push(...classReport.errors);
|
|
104
|
+
warnings.push(...classReport.warnings);
|
|
105
|
+
recommendations.push(...classReport.recommendations);
|
|
106
|
+
}
|
|
107
|
+
// Generate module-level recommendations
|
|
108
|
+
this.generateModuleRecommendations(functions, classes, recommendations, filePath);
|
|
109
|
+
const statistics = this.calculateModuleStatistics(functions, classes, errors, warnings);
|
|
110
|
+
return {
|
|
111
|
+
errors,
|
|
112
|
+
warnings,
|
|
113
|
+
statistics,
|
|
114
|
+
recommendations,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Private validation methods
|
|
119
|
+
*/
|
|
120
|
+
validateTypeHints(func, errors, warnings) {
|
|
121
|
+
// Check return type (skip __init__ methods as they conventionally don't need return type annotations)
|
|
122
|
+
if (this.isEmptyType(func.returnType) && func.name !== '__init__') {
|
|
123
|
+
if (this.config.allowMissingTypeHints) {
|
|
124
|
+
warnings.push({
|
|
125
|
+
type: 'missing-type',
|
|
126
|
+
message: `Function '${func.name}' is missing return type annotation`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (this.config.strictTypeChecking) {
|
|
130
|
+
// In strict mode without allowMissingTypeHints, we warn first then error
|
|
131
|
+
warnings.push({
|
|
132
|
+
type: 'missing-type',
|
|
133
|
+
message: `Function '${func.name}' is missing return type annotation`,
|
|
134
|
+
});
|
|
135
|
+
errors.push({
|
|
136
|
+
type: 'type',
|
|
137
|
+
message: `Function '${func.name}' requires return type annotation`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Check parameter types (skip 'self' and 'cls' parameters)
|
|
142
|
+
for (const param of func.parameters) {
|
|
143
|
+
if (this.isEmptyType(param.type) && param.name !== 'self' && param.name !== 'cls') {
|
|
144
|
+
if (this.config.allowMissingTypeHints) {
|
|
145
|
+
warnings.push({
|
|
146
|
+
type: 'missing-type',
|
|
147
|
+
message: `Parameter '${param.name}' in function '${func.name}' is missing type annotation`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else if (this.config.strictTypeChecking) {
|
|
151
|
+
// In strict mode without allowMissingTypeHints, we warn first then error
|
|
152
|
+
warnings.push({
|
|
153
|
+
type: 'missing-type',
|
|
154
|
+
message: `Parameter '${param.name}' in function '${func.name}' is missing type annotation`,
|
|
155
|
+
});
|
|
156
|
+
errors.push({
|
|
157
|
+
type: 'type',
|
|
158
|
+
message: `Parameter '${param.name}' in function '${func.name}' requires type annotation`,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Validate type structure only in strict mode (skip 'self' and 'cls' parameters)
|
|
163
|
+
if (this.config.strictTypeChecking &&
|
|
164
|
+
!this.config.allowMissingTypeHints &&
|
|
165
|
+
param.name !== 'self' &&
|
|
166
|
+
param.name !== 'cls') {
|
|
167
|
+
const typeErrors = this.validateTypeAnnotation(param.type, `parameter '${param.name}'`);
|
|
168
|
+
errors.push(...typeErrors);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Validate return type structure only in strict mode
|
|
172
|
+
if (this.config.strictTypeChecking && !this.config.allowMissingTypeHints) {
|
|
173
|
+
const returnTypeErrors = this.validateTypeAnnotation(func.returnType, 'return type');
|
|
174
|
+
errors.push(...returnTypeErrors);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
validateDocstring(func, warnings, filePath) {
|
|
178
|
+
if (this.config.requiredDocstrings && !func.docstring) {
|
|
179
|
+
warnings.push({
|
|
180
|
+
type: 'missing-type',
|
|
181
|
+
message: `Function '${func.name}' is missing docstring`,
|
|
182
|
+
file: filePath,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// Check docstring quality
|
|
186
|
+
if (func.docstring && func.docstring.length < 10) {
|
|
187
|
+
warnings.push({
|
|
188
|
+
type: 'missing-type',
|
|
189
|
+
message: `Function '${func.name}' has very short docstring`,
|
|
190
|
+
file: filePath,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
validateParameters(func, warnings, filePath) {
|
|
195
|
+
// Check for too many parameters
|
|
196
|
+
if (func.parameters.length > 8) {
|
|
197
|
+
warnings.push({
|
|
198
|
+
type: 'performance',
|
|
199
|
+
message: `Function '${func.name}' has too many parameters (${func.parameters.length})`,
|
|
200
|
+
file: filePath,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
// Check parameter naming
|
|
204
|
+
for (const param of func.parameters) {
|
|
205
|
+
if (param.name.length < 2 && !['x', 'y', 'z', 'i', 'j', 'k'].includes(param.name)) {
|
|
206
|
+
warnings.push({
|
|
207
|
+
type: 'missing-type',
|
|
208
|
+
message: `Parameter '${param.name}' in function '${func.name}' should have a more descriptive name`,
|
|
209
|
+
file: filePath,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
validateDeprecatedPatterns(func, warnings, filePath) {
|
|
215
|
+
for (const pattern of this.config.deprecatedPatterns) {
|
|
216
|
+
if (func.name.includes(pattern)) {
|
|
217
|
+
warnings.push({
|
|
218
|
+
type: 'deprecated',
|
|
219
|
+
message: `Function '${func.name}' uses deprecated pattern '${pattern}'`,
|
|
220
|
+
file: filePath,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
validateComplexity(func, warnings, filePath) {
|
|
226
|
+
// Simple complexity estimation based on parameters and async/generator flags
|
|
227
|
+
let complexity = func.parameters.length * 0.5;
|
|
228
|
+
if (func.isAsync) {
|
|
229
|
+
complexity += 1;
|
|
230
|
+
}
|
|
231
|
+
if (func.isGenerator) {
|
|
232
|
+
complexity += 1;
|
|
233
|
+
}
|
|
234
|
+
if (func.decorators.length > 0) {
|
|
235
|
+
complexity += func.decorators.length * 0.5;
|
|
236
|
+
}
|
|
237
|
+
if (complexity > this.config.maxComplexityScore) {
|
|
238
|
+
warnings.push({
|
|
239
|
+
type: 'performance',
|
|
240
|
+
message: `Function '${func.name}' has high complexity (${complexity.toFixed(1)})`,
|
|
241
|
+
file: filePath,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
validateClassStructure(cls, warnings, filePath) {
|
|
246
|
+
// Check for empty classes
|
|
247
|
+
if (cls.methods.length === 0 && cls.properties.length === 0) {
|
|
248
|
+
warnings.push({
|
|
249
|
+
type: 'missing-type',
|
|
250
|
+
message: `Class '${cls.name}' appears to be empty`,
|
|
251
|
+
file: filePath,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
// Check for missing __init__ method
|
|
255
|
+
const hasInit = cls.methods.some(method => method.name === '__init__');
|
|
256
|
+
if (!hasInit && cls.properties.length > 0) {
|
|
257
|
+
warnings.push({
|
|
258
|
+
type: 'missing-type',
|
|
259
|
+
message: `Class '${cls.name}' has properties but no __init__ method`,
|
|
260
|
+
file: filePath,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
validateInheritance(cls, warnings, filePath) {
|
|
265
|
+
// Check for deep inheritance chains
|
|
266
|
+
if (cls.bases.length > 3) {
|
|
267
|
+
warnings.push({
|
|
268
|
+
type: 'compatibility',
|
|
269
|
+
message: `Class '${cls.name}' inherits from many classes (${cls.bases.length})`,
|
|
270
|
+
file: filePath,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// Check for diamond inheritance pattern
|
|
274
|
+
if (cls.bases.length > 1) {
|
|
275
|
+
warnings.push({
|
|
276
|
+
type: 'compatibility',
|
|
277
|
+
message: `Class '${cls.name}' uses multiple inheritance, consider composition`,
|
|
278
|
+
file: filePath,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
validateTypeStructure(type, errors, context) {
|
|
283
|
+
switch (type.kind) {
|
|
284
|
+
case 'union':
|
|
285
|
+
if (type.types.length < 2) {
|
|
286
|
+
errors.push({
|
|
287
|
+
type: 'type',
|
|
288
|
+
message: `Union type in ${context} should have at least 2 types`,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
// Recursively validate union member types
|
|
292
|
+
for (const unionType of type.types) {
|
|
293
|
+
this.validateTypeStructure(unionType, errors, context);
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case 'collection':
|
|
297
|
+
if (type.itemTypes.length === 0 && ['list', 'dict', 'set'].includes(type.name)) {
|
|
298
|
+
errors.push({
|
|
299
|
+
type: 'type',
|
|
300
|
+
message: `Collection type '${type.name}' in ${context} should specify item types`,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
// Recursively validate item types
|
|
304
|
+
for (const itemType of type.itemTypes) {
|
|
305
|
+
this.validateTypeStructure(itemType, errors, context);
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
case 'optional':
|
|
309
|
+
this.validateTypeStructure(type.type, errors, context);
|
|
310
|
+
break;
|
|
311
|
+
case 'generic':
|
|
312
|
+
// Validate generic arguments
|
|
313
|
+
for (const arg of type.typeArgs) {
|
|
314
|
+
this.validateTypeStructure(arg, errors, context);
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
case 'custom':
|
|
318
|
+
// Could add checks for known custom types
|
|
319
|
+
break;
|
|
320
|
+
case 'primitive':
|
|
321
|
+
// Basic types are always valid
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
isEmptyType(type) {
|
|
326
|
+
return type.kind === 'primitive' && type.name === 'None';
|
|
327
|
+
}
|
|
328
|
+
generateFunctionRecommendations(func, recommendations, filePath) {
|
|
329
|
+
// Recommend async for I/O operations
|
|
330
|
+
if ((!func.isAsync && func.name.includes('read')) ||
|
|
331
|
+
func.name.includes('write') ||
|
|
332
|
+
func.name.includes('fetch')) {
|
|
333
|
+
recommendations.push({
|
|
334
|
+
type: 'performance',
|
|
335
|
+
severity: 'medium',
|
|
336
|
+
message: `Consider making '${func.name}' async for I/O operations`,
|
|
337
|
+
suggestion: `Add 'async def' instead of 'def' and use await for I/O operations`,
|
|
338
|
+
file: filePath,
|
|
339
|
+
impact: 'Improved performance for I/O-bound operations',
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
// Recommend type hints if missing
|
|
343
|
+
if (func.parameters.some(p => this.isEmptyType(p.type)) || this.isEmptyType(func.returnType)) {
|
|
344
|
+
recommendations.push({
|
|
345
|
+
type: 'type-safety',
|
|
346
|
+
severity: 'high',
|
|
347
|
+
message: `Add type hints to '${func.name}' for better IDE support`,
|
|
348
|
+
suggestion: 'Add type annotations to parameters and return type',
|
|
349
|
+
file: filePath,
|
|
350
|
+
impact: 'Better IDE support, type checking, and documentation',
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
// Recommend docstrings
|
|
354
|
+
if (!func.docstring) {
|
|
355
|
+
recommendations.push({
|
|
356
|
+
type: 'documentation',
|
|
357
|
+
severity: 'medium',
|
|
358
|
+
message: `Add docstring to '${func.name}'`,
|
|
359
|
+
suggestion: 'Add a docstring explaining the function purpose, parameters, and return value',
|
|
360
|
+
file: filePath,
|
|
361
|
+
impact: 'Better code documentation and IDE support',
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
generateModuleRecommendations(functions, classes, recommendations, filePath) {
|
|
366
|
+
const totalFunctions = functions.length + classes.reduce((acc, cls) => acc + cls.methods.length, 0);
|
|
367
|
+
// Recommend breaking up large modules
|
|
368
|
+
if (totalFunctions > 50) {
|
|
369
|
+
recommendations.push({
|
|
370
|
+
type: 'maintainability',
|
|
371
|
+
severity: 'medium',
|
|
372
|
+
message: 'Module has many functions, consider breaking it up',
|
|
373
|
+
suggestion: 'Split module into smaller, focused modules',
|
|
374
|
+
file: filePath,
|
|
375
|
+
impact: 'Improved maintainability and code organization',
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
// Check type hint coverage
|
|
379
|
+
const functionsWithTypes = functions.filter(f => !this.isEmptyType(f.returnType) || f.parameters.some(p => !this.isEmptyType(p.type)));
|
|
380
|
+
const typeHintCoverage = totalFunctions > 0 ? (functionsWithTypes.length / totalFunctions) * 100 : 100;
|
|
381
|
+
if (typeHintCoverage < 50) {
|
|
382
|
+
recommendations.push({
|
|
383
|
+
type: 'type-safety',
|
|
384
|
+
severity: 'high',
|
|
385
|
+
message: `Low type hint coverage (${typeHintCoverage.toFixed(1)}%)`,
|
|
386
|
+
suggestion: 'Add type annotations to improve type safety',
|
|
387
|
+
file: filePath,
|
|
388
|
+
impact: 'Better type checking and IDE support',
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
calculateFunctionStatistics(func, errors, warnings) {
|
|
393
|
+
const hasTypeHints = !this.isEmptyType(func.returnType) || func.parameters.some(p => !this.isEmptyType(p.type));
|
|
394
|
+
return {
|
|
395
|
+
totalIssues: errors.length + warnings.length,
|
|
396
|
+
errorCount: errors.length,
|
|
397
|
+
warningCount: warnings.length,
|
|
398
|
+
typeHintCoverage: hasTypeHints ? 100 : 0,
|
|
399
|
+
docstringCoverage: func.docstring ? 100 : 0,
|
|
400
|
+
complexityScore: this.calculateComplexity(func),
|
|
401
|
+
qualityScore: this.calculateQualityScore(func, errors, warnings),
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
calculateClassStatistics(cls, errors, warnings) {
|
|
405
|
+
const methodsWithTypes = cls.methods.filter(m => !this.isEmptyType(m.returnType) || m.parameters.some(p => !this.isEmptyType(p.type))).length;
|
|
406
|
+
const methodsWithDocstrings = cls.methods.filter(m => m.docstring).length;
|
|
407
|
+
const typeHintCoverage = cls.methods.length > 0 ? (methodsWithTypes / cls.methods.length) * 100 : 100;
|
|
408
|
+
const docstringCoverage = cls.methods.length > 0 ? (methodsWithDocstrings / cls.methods.length) * 100 : 100;
|
|
409
|
+
return {
|
|
410
|
+
totalIssues: errors.length + warnings.length,
|
|
411
|
+
errorCount: errors.length,
|
|
412
|
+
warningCount: warnings.length,
|
|
413
|
+
typeHintCoverage,
|
|
414
|
+
docstringCoverage,
|
|
415
|
+
complexityScore: Math.max(...cls.methods.map(m => this.calculateComplexity(m)), 0),
|
|
416
|
+
qualityScore: this.calculateClassQualityScore(cls, errors, warnings),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
calculateModuleStatistics(functions, classes, errors, warnings) {
|
|
420
|
+
const allMethods = classes.flatMap(cls => cls.methods);
|
|
421
|
+
const allFunctions = [...functions, ...allMethods];
|
|
422
|
+
const functionsWithTypes = allFunctions.filter(f => !this.isEmptyType(f.returnType) || f.parameters.some(p => !this.isEmptyType(p.type))).length;
|
|
423
|
+
const functionsWithDocstrings = allFunctions.filter(f => f.docstring).length;
|
|
424
|
+
const typeHintCoverage = allFunctions.length > 0 ? (functionsWithTypes / allFunctions.length) * 100 : 100;
|
|
425
|
+
const docstringCoverage = allFunctions.length > 0 ? (functionsWithDocstrings / allFunctions.length) * 100 : 100;
|
|
426
|
+
return {
|
|
427
|
+
totalIssues: errors.length + warnings.length,
|
|
428
|
+
errorCount: errors.length,
|
|
429
|
+
warningCount: warnings.length,
|
|
430
|
+
typeHintCoverage,
|
|
431
|
+
docstringCoverage,
|
|
432
|
+
complexityScore: Math.max(...allFunctions.map(f => this.calculateComplexity(f)), 0),
|
|
433
|
+
qualityScore: this.calculateModuleQualityScore(allFunctions, errors, warnings),
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
calculateComplexity(func) {
|
|
437
|
+
let complexity = 1; // Base complexity
|
|
438
|
+
complexity += func.parameters.length * 0.5;
|
|
439
|
+
complexity += func.isAsync ? 1 : 0;
|
|
440
|
+
complexity += func.isGenerator ? 1 : 0;
|
|
441
|
+
complexity += func.decorators.length * 0.5;
|
|
442
|
+
return Math.round(complexity * 10) / 10;
|
|
443
|
+
}
|
|
444
|
+
calculateQualityScore(func, errors, warnings) {
|
|
445
|
+
let score = 100;
|
|
446
|
+
// Deduct points for errors and warnings
|
|
447
|
+
score -= errors.length * 20;
|
|
448
|
+
score -= warnings.length * 10;
|
|
449
|
+
// Add points for good practices
|
|
450
|
+
if (!this.isEmptyType(func.returnType)) {
|
|
451
|
+
score += 10;
|
|
452
|
+
}
|
|
453
|
+
if (func.parameters.every(p => !this.isEmptyType(p.type))) {
|
|
454
|
+
score += 10;
|
|
455
|
+
}
|
|
456
|
+
if (func.docstring) {
|
|
457
|
+
score += 10;
|
|
458
|
+
}
|
|
459
|
+
return Math.max(0, Math.min(100, score));
|
|
460
|
+
}
|
|
461
|
+
calculateClassQualityScore(cls, errors, warnings) {
|
|
462
|
+
let score = 100;
|
|
463
|
+
// Deduct points for errors and warnings
|
|
464
|
+
score -= errors.length * 15;
|
|
465
|
+
score -= warnings.length * 8;
|
|
466
|
+
// Add points for good practices
|
|
467
|
+
if (cls.docstring) {
|
|
468
|
+
score += 10;
|
|
469
|
+
}
|
|
470
|
+
if (cls.methods.some(m => m.name === '__init__')) {
|
|
471
|
+
score += 10;
|
|
472
|
+
}
|
|
473
|
+
if (cls.methods.length > 0) {
|
|
474
|
+
score += 5;
|
|
475
|
+
}
|
|
476
|
+
return Math.max(0, Math.min(100, score));
|
|
477
|
+
}
|
|
478
|
+
calculateModuleQualityScore(functions, errors, warnings) {
|
|
479
|
+
if (functions.length === 0) {
|
|
480
|
+
return 100;
|
|
481
|
+
}
|
|
482
|
+
const functionScores = functions.map(f => this.calculateQualityScore(f, errors.filter(e => e.message?.includes(f.name)), warnings.filter(w => w.message?.includes(f.name))));
|
|
483
|
+
return functionScores.reduce((sum, score) => sum + score, 0) / functionScores.length;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8CH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAmB;IAEjC,YAAY,SAAoC,EAAE;QAChD,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,IAAI;YACrD,qBAAqB,EAAE,MAAM,CAAC,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MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;IACvF,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tywrap - TypeScript wrapper for Python libraries with full type safety
|
|
3
|
+
*
|
|
4
|
+
* @description Build-time code generation system that makes Python libraries
|
|
5
|
+
* feel native in TypeScript with zero runtime overhead
|
|
6
|
+
*/
|
|
7
|
+
import { tywrap } from './tywrap.js';
|
|
8
|
+
export type { TywrapConfig } from './config/index.js';
|
|
9
|
+
export { defineConfig, resolveConfig } from './config/index.js';
|
|
10
|
+
export { RuntimeBridge } from './runtime/base.js';
|
|
11
|
+
export { BridgeError, BridgeProtocolError, BridgeTimeoutError, BridgeDisposedError, BridgeExecutionError, } from './runtime/errors.js';
|
|
12
|
+
export { getRuntimeBridge, setRuntimeBridge, clearRuntimeBridge } from './runtime/index.js';
|
|
13
|
+
export { NodeBridge } from './runtime/node.js';
|
|
14
|
+
export { PyodideBridge } from './runtime/pyodide.js';
|
|
15
|
+
export { HttpBridge } from './runtime/http.js';
|
|
16
|
+
export type { PythonModule, PythonFunction, PythonClass, PythonType, PrimitiveType, CollectionType, UnionType, OptionalType, CustomType, GenericType, Parameter, Property, PythonImport, TypescriptType, RuntimeStrategy, TywrapOptions, PythonModuleConfig, OutputConfig, RuntimeConfig, PyodideConfig, NodeConfig, HttpConfig, PerformanceConfig, DevelopmentConfig, TypeMappingConfig, TypePreset, BridgeInfo, AnalysisResult, AnalysisError, AnalysisWarning, AnalysisStatistics, GeneratedCode, } from './types/index.js';
|
|
17
|
+
export { tywrap } from './tywrap.js';
|
|
18
|
+
export { generate } from './tywrap.js';
|
|
19
|
+
export { detectRuntime, isNodejs, isDeno, isBun, isBrowser } from './utils/runtime.js';
|
|
20
|
+
export { decodeValue, decodeValueAsync, registerArrowDecoder, clearArrowDecoder, } from './utils/codec.js';
|
|
21
|
+
export declare const VERSION = "0.1.0";
|
|
22
|
+
/**
|
|
23
|
+
* Quick setup function for getting started
|
|
24
|
+
*/
|
|
25
|
+
export default tywrap;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG5F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B;;GAEG;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tywrap - TypeScript wrapper for Python libraries with full type safety
|
|
3
|
+
*
|
|
4
|
+
* @description Build-time code generation system that makes Python libraries
|
|
5
|
+
* feel native in TypeScript with zero runtime overhead
|
|
6
|
+
*/
|
|
7
|
+
import { tywrap } from './tywrap.js';
|
|
8
|
+
export { defineConfig, resolveConfig } from './config/index.js';
|
|
9
|
+
export { RuntimeBridge } from './runtime/base.js';
|
|
10
|
+
export { BridgeError, BridgeProtocolError, BridgeTimeoutError, BridgeDisposedError, BridgeExecutionError, } from './runtime/errors.js';
|
|
11
|
+
export { getRuntimeBridge, setRuntimeBridge, clearRuntimeBridge } from './runtime/index.js';
|
|
12
|
+
// Runtime-specific exports
|
|
13
|
+
export { NodeBridge } from './runtime/node.js';
|
|
14
|
+
export { PyodideBridge } from './runtime/pyodide.js';
|
|
15
|
+
export { HttpBridge } from './runtime/http.js';
|
|
16
|
+
// Main API
|
|
17
|
+
export { tywrap } from './tywrap.js';
|
|
18
|
+
export { generate } from './tywrap.js';
|
|
19
|
+
// Runtime detection utilities
|
|
20
|
+
export { detectRuntime, isNodejs, isDeno, isBun, isBrowser } from './utils/runtime.js';
|
|
21
|
+
export { decodeValue, decodeValueAsync, registerArrowDecoder, clearArrowDecoder, } from './utils/codec.js';
|
|
22
|
+
// Version info
|
|
23
|
+
export const VERSION = '0.1.0';
|
|
24
|
+
/**
|
|
25
|
+
* Quick setup function for getting started
|
|
26
|
+
*/
|
|
27
|
+
// Default export for convenience
|
|
28
|
+
export default tywrap;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,2BAA2B;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAsC/C,WAAW;AACX,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,eAAe;AACf,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,iCAAiC;AACjC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base runtime bridge
|
|
3
|
+
*/
|
|
4
|
+
import type { RuntimeExecution } from '../types/index.js';
|
|
5
|
+
export declare abstract class RuntimeBridge implements RuntimeExecution {
|
|
6
|
+
abstract call<T = unknown>(module: string, functionName: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
|
|
7
|
+
abstract instantiate<T = unknown>(module: string, className: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
|
|
8
|
+
abstract callMethod<T = unknown>(handle: string, methodName: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
|
|
9
|
+
abstract disposeInstance(handle: string): Promise<void>;
|
|
10
|
+
abstract dispose(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/runtime/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,8BAAsB,aAAc,YAAW,gBAAgB;IAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,EACvB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EAAE,EACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC;IAEb,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO,EAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EAAE,EACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC;IAEb,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,EAC7B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,OAAO,EAAE,EACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC;IAEb,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvD,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/runtime/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,OAAgB,aAAa;CAyBlC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class BridgeError extends Error {
|
|
2
|
+
code?: string;
|
|
3
|
+
constructor(message: string, options?: {
|
|
4
|
+
code?: string;
|
|
5
|
+
cause?: unknown;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export declare class BridgeProtocolError extends BridgeError {
|
|
9
|
+
}
|
|
10
|
+
export declare class BridgeTimeoutError extends BridgeError {
|
|
11
|
+
}
|
|
12
|
+
export declare class BridgeDisposedError extends BridgeError {
|
|
13
|
+
}
|
|
14
|
+
export declare class BridgeExecutionError extends BridgeError {
|
|
15
|
+
traceback?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAQ1E;AAED,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AACvD,qBAAa,kBAAmB,SAAQ,WAAW;CAAG;AACtD,qBAAa,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class BridgeError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = new.target.name;
|
|
6
|
+
this.code = options?.code;
|
|
7
|
+
if (options?.cause) {
|
|
8
|
+
this.cause = options.cause;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class BridgeProtocolError extends BridgeError {
|
|
13
|
+
}
|
|
14
|
+
export class BridgeTimeoutError extends BridgeError {
|
|
15
|
+
}
|
|
16
|
+
export class BridgeDisposedError extends BridgeError {
|
|
17
|
+
}
|
|
18
|
+
export class BridgeExecutionError extends BridgeError {
|
|
19
|
+
traceback;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.js.map
|