We needed to go from v0.x to a major release, and it may as well happen now. jscodeshift has been around for nine years though, so going to v1.0.0 didn't feel quite right. I've instead promoted the minor version number to a major version number, similar to what React did when it went from 0.14 to 15.0.
importAttributes
(#585, @benasher44) and decoratorAutoAccessors
(#594, @syi0808) pluginsPublished by mroch almost 3 years ago
colors
to chalk
to mitigate a security vulnerability in [email protected]
.Full Changelog: https://github.com/facebook/jscodeshift/compare/0.13.0...0.13.1
Published by jbrown215 almost 5 years ago
@babel/register
/@babel/preset-env
is configured to not transpile any@babel/register
are now properly named and.ts
or .tsx
, @babel/preset-typescript
is used to--babel
option to be set (which it is bybabel-preset-es2015
and babel-preset-stage-1
in favor of@babel/preset-env
. Only @babel/proposal-class-properties
and@babel/proposal-object-rest-spread
are enabled as experimental features. If@babel/parser
instead of Babylon ( #291, @elliottsj )micromatch
=> v3.1.10, which doesn't (indirectly) depend on randomatic
<A bunch of changes to get jscodeshift in a better shape. This is minor version update because important dependencies and parser configurations have changed.
--parser-config
: This option accepts a path to a JSON file and overrides the default options for flow or babylon. This allows you to tweak parser settings (e.g. legacy decorators). (46d250f)--stdin
: If provided, the list of files/directories is read from stdin. This makes it easier to pass large lists of files. (b6eaa0a)api.report
lets you print arbitrary text to stdout. Useful if another tools consumes jscodeshift's stdout. (c902a00) Example:// In the transform
api.report('some data');
// in stdout
REP path/to/file.js some data
--parser=ts
or --parser=tsx
.hasAttributes
method understands value-less Boolean attributes (#277 , @artemruts )dynamicImport
plugin to babylon
parser. (#208)some()
and every()
methods for Collection (#216)renameTo
renaming React component prop name unexpectedly (#220)renameTo
not taking property shorthands into account (#211)template.expression
when a literal with no interpolation was used ( #196, @jsnajdr)es6-promise
( #189, @wtgtybhertgeghgtwtg)Thank you @xixixao, @jsnajdr and @wtgtybhertgeghgtwtg for contributing!
Collections now have a .length
property which is equivalent to .size()
(#151, @DrewML)
You can now reference jscodeshift as j
directly from the transform's API options. I.e. you can write
export default function transformer(file, { j }) {
return j(file.source).toSource();
}
instead of
export default function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source).toSource();
}
or
export default function transformer(file, {jscodeshift: j}) {
return j(file.source).toSource();
}
(#153, @vjeux)
Runner.run
includes elapsed time and stats collected via stats
method ( #128, @iamdustan).jscodeshift --version
also prints the used recast version ( #131, @keyanzhang)renameTo
ignores Identifier
s that are not variable references ( #125, Robby Nevels)