java-bridge 2.2.3-beta.3 → 2.3.0-beta.4
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/README.md +5 -66
- package/dist/{ts-src/index.d.ts → index.d.ts} +0 -4
- package/dist/index.prod.min.js +1 -1
- package/dist/index.prod.min.js.map +1 -1
- package/dist/{ts-src/java.d.ts → java.d.ts} +36 -3
- package/java-src/build/libs/JavaBridge-2.1.1.jar +0 -0
- package/package.json +23 -25
- package/dist/java-ts-gen.js +0 -3
- package/dist/java-ts-gen.js.map +0 -1
- package/dist/ts-src/TypescriptBulkDefinitionGenerator.d.ts +0 -53
- package/dist/ts-src/TypescriptDefinitionGenerator.d.ts +0 -86
- package/dist/ts-src/scripts/cli.d.ts +0 -1
- /package/dist/{ts-src/definitions.d.ts → definitions.d.ts} +0 -0
- /package/dist/{ts-src/nativeLib.d.ts → nativeLib.d.ts} +0 -0
- /package/dist/{ts-src/util.d.ts → util.d.ts} +0 -0
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export interface MethodDeclaration {
|
|
2
|
-
returnType: string;
|
|
3
|
-
parameters: string[];
|
|
4
|
-
isStatic: boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* A java class declaration converted to typescript
|
|
8
|
-
*/
|
|
9
|
-
export interface ModuleDeclaration {
|
|
10
|
-
/**
|
|
11
|
-
* The fully-qualified class name
|
|
12
|
-
*/
|
|
13
|
-
name: string;
|
|
14
|
-
/**
|
|
15
|
-
* The generated typescript code
|
|
16
|
-
*/
|
|
17
|
-
contents: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A TypescriptDefinitionGenerator progress callback method
|
|
21
|
-
*/
|
|
22
|
-
export type ProgressCallback = (classname: string) => void;
|
|
23
|
-
/**
|
|
24
|
-
* A class to generate typescript definitions for java classes.
|
|
25
|
-
* Converts the given class and all of its dependencies to typescript.
|
|
26
|
-
*
|
|
27
|
-
* ## Example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { TypescriptDefinitionGenerator } from 'java-bridge';
|
|
30
|
-
*
|
|
31
|
-
* const generator = new TypescriptDefinitionGenerator('java.lang.String');
|
|
32
|
-
* // Generate the typescript definitions
|
|
33
|
-
* const definitions = await generator.generate();
|
|
34
|
-
*
|
|
35
|
-
* // Save the definitions to a directory
|
|
36
|
-
* await TypescriptDefinitionGenerator.save(definitions, './project');
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export default class TypescriptDefinitionGenerator {
|
|
40
|
-
private readonly classname;
|
|
41
|
-
private readonly progressCallback;
|
|
42
|
-
private readonly resolvedImports;
|
|
43
|
-
private usesBasicOrJavaType;
|
|
44
|
-
private readonly additionalImports;
|
|
45
|
-
private readonly importsToResolve;
|
|
46
|
-
/**
|
|
47
|
-
* Create a new `TypescriptDefinitionGenerator` instance
|
|
48
|
-
*
|
|
49
|
-
* @param classname the fully-qualified name of the class to generate a typescript definition for
|
|
50
|
-
* @param progressCallback a callback method to be called every time a java class is
|
|
51
|
-
* converted to typescript
|
|
52
|
-
* @param resolvedImports a list of imports that have already been resolved.
|
|
53
|
-
* This is used to prevent converting a class multiple times
|
|
54
|
-
*/
|
|
55
|
-
constructor(classname: string, progressCallback?: ProgressCallback | null, resolvedImports?: string[]);
|
|
56
|
-
private static convertMethods;
|
|
57
|
-
private convertFields;
|
|
58
|
-
private isAbstractOrInterface;
|
|
59
|
-
private createPrivateConstructor;
|
|
60
|
-
private convertConstructors;
|
|
61
|
-
private primitiveToClassType;
|
|
62
|
-
private isPrimitive;
|
|
63
|
-
private javaTypeToTypescriptType;
|
|
64
|
-
private convertParameter;
|
|
65
|
-
private convertParameters;
|
|
66
|
-
private static createMethodComment;
|
|
67
|
-
private createMethod;
|
|
68
|
-
private convertMethod;
|
|
69
|
-
private getAdditionalImports;
|
|
70
|
-
private getImports;
|
|
71
|
-
private getExportStatement;
|
|
72
|
-
private getText;
|
|
73
|
-
/**
|
|
74
|
-
* Generates the typescript definition for the given class.
|
|
75
|
-
*
|
|
76
|
-
* @returns the generated typescript definitions
|
|
77
|
-
*/
|
|
78
|
-
generate(): Promise<ModuleDeclaration[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Save the converted classes to the given directory.
|
|
81
|
-
*
|
|
82
|
-
* @param declarations the declarations to save
|
|
83
|
-
* @param sourceDir the directory to save the files to
|
|
84
|
-
*/
|
|
85
|
-
static save(declarations: ModuleDeclaration[], sourceDir: string): Promise<void>;
|
|
86
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|