Changelog
3.0.0 (2022-07-17)
Provide ecmaVersion option to make cloned AST conform to each annual estree spec
Introduce espurify.purifyAst
as an alias of default function
Rename all WhiteList to AllowList in favor of more inclusive language
This release will not affect most users immediately. There are three notable changes.
espurify
function is still exported as default but deprecated in favor of named exports aiming ESM era, and will be removed in future major releases. Please use espurify.purifyAst
instead.
espurify.cloneWithWhitelist
is still exported but deprecated in favor of more inclusive language and will be removed in future major releases. Please use espurify.cloneWithAllowlist
instead.
Some new properties will appear in purified AST and may affect deep-equality of the tree, since default ecmaVersion is changed from 2018 to 2022 which add some properties to existing Nodes.
- CallExpression: ['type', 'callee', 'arguments'],
+ CallExpression: ['type', 'callee', 'arguments', 'optional'],
- ExportAllDeclaration: ['type', 'source'],
+ ExportAllDeclaration: ['type', 'source', 'exported'],
- Literal: ['type', 'value', 'regex'],
+ Literal: ['type', 'value', 'regex', 'bigint'],
To make espurify's behavior same as v2, please use espurify.customize
function with ecmaVersion: 2018
option.
const purify = espurify.customize({ ecmaVersion: 2018 });
const clonedAst = purify(originalAst);
Changelog
2.1.1 (2021-03-29)
Changelog
2.1.0 (2021-03-26)