python2ts 1.0.0 → 1.2.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/dist/cli/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -80,10 +80,15 @@ interface TransformContext {
|
|
|
80
80
|
definedClasses: Set<string>;
|
|
81
81
|
/** Whether currently processing an abstract class (ABC) */
|
|
82
82
|
isAbstractClass?: boolean;
|
|
83
|
+
/** Depth counter for function bodies (0 = module level, 1+ = inside function) */
|
|
84
|
+
insideFunctionBody: number;
|
|
85
|
+
/** Imports found inside function bodies that need to be hoisted to module level */
|
|
86
|
+
hoistedImports: string[];
|
|
83
87
|
}
|
|
84
88
|
interface TransformResult {
|
|
85
89
|
code: string;
|
|
86
90
|
usesRuntime: Set<string>;
|
|
91
|
+
hoistedImports: string[];
|
|
87
92
|
}
|
|
88
93
|
declare function transform(input: string | ParseResult): TransformResult;
|
|
89
94
|
|
|
@@ -107,7 +112,7 @@ declare function generate(input: string | ParseResult, options?: GeneratorOption
|
|
|
107
112
|
*/
|
|
108
113
|
declare function transpile(python: string, options?: GeneratorOptions): string;
|
|
109
114
|
/**
|
|
110
|
-
* Format TypeScript code using Prettier
|
|
115
|
+
* Format TypeScript code using ESLint fixes + Prettier
|
|
111
116
|
*/
|
|
112
117
|
declare function formatCode(code: string): Promise<string>;
|
|
113
118
|
/**
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "python2ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "AST-based Python to TypeScript transpiler. Convert Python code to clean, idiomatic TypeScript with full type preservation.",
|
|
5
5
|
"homepage": "https://sebastian-software.github.io/python2ts/",
|
|
6
6
|
"repository": {
|
|
@@ -47,10 +47,13 @@
|
|
|
47
47
|
"author": "Sebastian Software GmbH",
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@eslint/js": "^9.39.2",
|
|
50
51
|
"@lezer/common": "^1.5.0",
|
|
51
52
|
"@lezer/python": "^1.1.18",
|
|
53
|
+
"eslint": "^9.39.2",
|
|
52
54
|
"prettier": "^3.8.0",
|
|
53
|
-
"
|
|
55
|
+
"typescript-eslint": "^8.53.1",
|
|
56
|
+
"pythonlib": "1.0.2"
|
|
54
57
|
},
|
|
55
58
|
"devDependencies": {
|
|
56
59
|
"tsup": "^8.5.1",
|