Major changes
Reduced the package size
The code is now packed into chunks for more efficient use of space.
Added new generation options
The class definitions can now be read using Java, which is a lot faster than the old method.
Additionally, the definition tree can now be exported as a JSON file, without generating the typescript definitions:
import {
TypescriptDefinitionGenerator,
JavaDefinitions
} from 'java-ts-definition-generator';
import fs from 'fs/promises';
const generator = new TypescriptDefinitionGenerator('java.lang.String');
const definitions = await generator.createDefinitionTree();
await fs.writeFile('./project/definitions.json', JSON.stringify(definitions));
The TypescriptBulkDefinitionGenerator
class has also been removed, as the TypescriptDefinitionGenerator
class is now
able to generate definitions for multiple classes at once:
import { TypescriptDefinitionGenerator } from 'java-ts-definition-generator';
const generator = new TypescriptDefinitionGenerator([
'java.lang.String',
'java.util.List',
]);
// Generate the typescript definitions
await generator.createModuleDeclarations();
// Save the definitions to a directory
await TypescriptDefinitionGenerator.save('./project');
Also, the method previously called generate
is now called createModuleDeclarations
.
What's Changed
- refactor: reduce package size by @MarkusJx in #2
- refactor(rewrite): generate class definition using java by @MarkusJx in #3
- docs: update method names by @MarkusJx in #4
Full Changelog: v1.0.0...v1.1.0