Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.

Releases: jordimarimon/ts-ast-parser

v0.3.2

18 Jun 15:24
Compare
Choose a tag to compare

2023-06-18

core - 0.3.2

Bug Fixes

  • Add chalk as a dependency in the package.json

v0.3.0

18 Jun 15:22
Compare
Choose a tag to compare

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 and 5.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 to kind 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 and parseFromGlob now return an array of instances of ModuleNode.
  • The function parseFromSource returns an instance of ModuleNode.
  • The field members in the Interface and Class nodes has been split into properties, staticProperties,
    methods and staticMethods.
  • 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 a NamedParameter has been renamed to default.
  • The field isTypeOnly in imports and exports has been renamed to typeOnly
  • The field isBareModuleSpecifier in imports has been renamed to bareModuleSpecifier
  • Drop support for Node 14.x
  • Drop support for CommonJS

v0.2.0

25 Dec 19:22
Compare
Choose a tag to compare

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 and 18.x
  • Support older version of TypeScript. Now it is supported: 4.7, 4.8 and 4.9. Older versions could be supported
    in the future.

Breaking Changes

  • The property source in a type has changed to sources 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 method getSourceReferences()

v0.1.0

23 Dec 21:04
Compare
Choose a tag to compare

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