Releases: wessberg/ts-evaluator
v2.0.0
v1.2.0
v1.1.0
v1.0.7
v1.0.6
v1.0.5
v1.0.4
v1.0.3
v1.0.2
v1.0.1
New Features
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.
TypeScript v4.7 support
ts-evaluator
now supports TypeScript v4.7 and its new features.
New presets: NODE_CJS and NODE_ESM
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 forNODE
.NODE_ESM
- Assumes an ESM-based Node.js environment. This means that built-in modules such asfs
andpath
can be resolved, and Node-specific globals such asprocess
is present, as well as ones that are only present in an ESM-based Node.js environment, such asimport.meta
.
Support for evaluating new.target
and import.meta
ts-evaluator
can now handle new.target
syntax, as well as import.meta
syntax inside ES Modules.