This repository was archived by the owner on Jun 15, 2024. It is now read-only.
Releases: jordimarimon/ts-ast-parser
Releases · jordimarimon/ts-ast-parser
v0.3.2
2023-06-18
core
- 0.3.2
Bug Fixes
- Add
chalk
as a dependency in thepackage.json
v0.3.0
2023-06-18
core
- 0.3.0
The library has been rewritten from scratch.
If you want to still use the old behaviour, you can by calling the serialize
method in the reflected module node:
import { ModuleNode, Module } from '@ts-ast-parser/core';
///////////////
// BEFORE
///////////////
const beforeReflectedNodes: Module[] = parseFromFiles(['...']);
////////////////
// AFTER
///////////////
// Same applies for `parseFromGlob`
const afterReflectedNodes: ModuleNode[] = parseFromFiles(['...']);
// const afterReflectedNode: ModuleNode = parseFromSource(`....`);
// Converts the array of `ModuleNode` to `Module`.
// A `Module` is a plain old javascript object without methods, only read-only properties.
const serializedNodes: Module[] = afterReflectedNodes.map(node => node.serialize());
Make sure to check what a ModuleNode
is before working with it.
Be aware of the breaking changes listed below.
Features
- The constraints defined in a type parameter will be reflected.
- TypeScript versions
5.0
and5.1
are supported
Bug Fixes
- Reflect imports with side effects (example:
import './foo.js'
). - Imports with different kinds weren't reflected correctly (example:
import Foo, { bar } from './foo'
). - The type and name of a parameter in an index signature wasn't being reflected correctly.
- Getters and Setters (property accessors) were not being reflected when defined inside an interface.
- Class expressions used as initializers in variable declarations weren't being reflected.
🚨 Breaking Changes
- The field
type
in the Imports and Exports nodes has been renamed tokind
for consistency with the same field in
the declaration node. - Now all the fields
kind
(including the new one in the imports and exports) are capitalized. - The functions
parseFromFiles
andparseFromGlob
now return an array of instances ofModuleNode
. - The function
parseFromSource
returns an instance ofModuleNode
. - The field
members
in theInterface
andClass
nodes has been split intoproperties
,staticProperties
,
methods
andstaticMethods
. - The package
@ts-ast-parser/readers
has been deleted. There is no need for this packages as now all the
functionalities are already included in the package@ts-ast-parser/core
. - The field
value
in aNamedParameter
has been renamed todefault
. - The field
isTypeOnly
in imports and exports has been renamed totypeOnly
- The field
isBareModuleSpecifier
in imports has been renamed tobareModuleSpecifier
- Drop support for Node
14.x
- Drop support for CommonJS
v0.2.0
2022-12-25
core
- 0.2.0
Bug Fixes
- Analyse star exports and namespace exports
- Support nested namespaces
Features
- Add references to type definitions
- Support older versions of NodeJS. Now it is supported:
14.20
,16.x
and18.x
- Support older version of TypeScript. Now it is supported:
4.7
,4.8
and4.9
. Older versions could be supported
in the future.
Breaking Changes
- The property
source
in atype
has changed tosources
and is an array instead of an object.
This property represents all the type definitions that are involved in the type. A type may be composed of
other types. Example of types that are composed of others are union types, intersection types, array type, etc...
readers
- 0.2.0
Breaking Changes
- Now the
TypeReader
will return an array of type definitions when you call the methodgetSourceReferences()
v0.1.0
2022-11-05
core
- 0.1.0
Release of the first version of the package
readers
- 0.1.0
Release of the first version of the package