An interpreter for Typescript that can evaluate an arbitrary Node within a Typescript AST
MIT License
https://github.com/wessberg/ts-evaluator/compare/v1.1.0...v1.2.0
https://github.com/wessberg/ts-evaluator/compare/v1.0.7...v1.1.0
https://github.com/wessberg/ts-evaluator/compare/v1.0.6...v1.0.7
https://github.com/wessberg/ts-evaluator/compare/v1.0.5...v1.0.6
https://github.com/wessberg/ts-evaluator/compare/v1.0.4...v1.0.5
https://github.com/wessberg/ts-evaluator/compare/v1.0.3...v1.0.4
https://github.com/wessberg/ts-evaluator/compare/v1.0.2...v1.0.3
https://github.com/wessberg/ts-evaluator/compare/v1.0.1...v1.0.2
ts-evaluator
is now based on ESM and requires Node v14.19.0 (BREAKING CHANGE)Now that TypeScript v4.7 is out, it has finally received great support for ES modules in a Node.js environment that aligns with how it has been implemented across Node.js and browsers.
Because of this, now is a good time to make ts-evaluator
a type: "module"
package. However, it still provides a CommonJS fallback. If your codebase is still based on CommonJS, you should be fine. Please know however, that ts-evaluator
requires an environment running Node v14.19.0 or newer going forward.
ts-evaluator
now supports TypeScript v4.7 and its new features.
Nowadays, Node.js files may either be based on CommonJS or ES Modules, and depending on which it is, the execution environment has some differences. For example, in a CommonJS based Node.js file, globals like require
, __dirname
, and __filename
is available, whereas import.meta
is available in an ES Module based Node.js file.
To reflect this, two new Lexical Environment presets have been added to ts-evaluator
:
NODE_CJS
- An alias for NODE
.NODE_ESM
- Assumes an ESM-based Node.js environment. This means that built-in modules such as fs
and path
can be resolved, and Node-specific globals such as process
is present, as well as ones that are only present in an ESM-based Node.js environment, such as import.meta
.new.target
and import.meta
ts-evaluator
can now handle new.target
syntax, as well as import.meta
syntax inside ES Modules.
https://github.com/wessberg/ts-evaluator/compare/v1.0.0...v1.0.1
https://github.com/wessberg/ts-evaluator/compare/v0.1.0...v0.2.0
https://github.com/wessberg/ts-evaluator/compare/v0.0.29...v0.1.0
https://github.com/wessberg/ts-evaluator/compare/v0.0.28...v0.0.29
https://github.com/wessberg/ts-evaluator/compare/v0.0.27...v0.0.28
https://github.com/wessberg/ts-evaluator/compare/v0.0.26...v0.0.27
https://github.com/wessberg/ts-evaluator/compare/v0.0.25...v0.0.26
https://github.com/wessberg/ts-evaluator/compare/v0.0.24...v0.0.25
https://github.com/wessberg/ts-evaluator/compare/v0.0.23...v0.0.24
https://github.com/wessberg/ts-evaluator/compare/v0.0.22...v0.0.23
https://github.com/wessberg/ts-evaluator/compare/v0.0.21...v0.0.22
https://github.com/wessberg/ts-evaluator/compare/v0.0.20...v0.0.21