Socket
Socket
Sign inDemoInstall

jscodeshift

Package Overview
Dependencies
286
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1

CHANGELOG.md

16

dist/Worker.js

@@ -18,2 +18,3 @@ /*

const writeFileAtomic = require('write-file-atomic');
const { DEFAULT_EXTENSIONS } = require('@babel/core');
const getParser = require('./getParser');

@@ -53,11 +54,16 @@

if (babel === 'babel') {
require('babel-register')({
require('@babel/register')({
babelrc: false,
presets: [
require('babel-preset-es2015'),
require('babel-preset-stage-1'),
'@babel/preset-env',
/\.tsx?$/.test(tr) ? '@babel/preset-typescript' : '@babel/preset-flow',
],
plugins: [
require('babel-plugin-transform-flow-strip-types'),
]
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread'
],
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
// By default, babel register only compiles things inside the current working directory.
// https://github.com/babel/babel/blob/2a4f16236656178e84b05b8915aab9261c55782c/packages/babel-register/src/node.js#L140-L157
ignore: []
});

@@ -64,0 +70,0 @@ }

{
"name": "jscodeshift",
"version": "0.6.0",
"version": "0.6.1",
"description": "A toolkit for JavaScript codemods",

@@ -27,11 +27,15 @@ "repository": {

"dependencies": {
"@babel/parser": "^7.0.0",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-1": "^6.5.0",
"babel-register": "^6.9.0",
"@babel/core": "^7.1.6",
"@babel/parser": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@babel/register": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"colors": "^1.1.2",
"flow-parser": "^0.*",
"flow-parser": "0.*",
"graceful-fs": "^4.1.11",
"micromatch": "^2.3.7",
"micromatch": "^3.1.10",
"neo-async": "^2.5.0",

@@ -44,5 +48,5 @@ "node-dir": "^0.1.17",

"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^3.1.1",
"jest": "^18.1.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.9.0",
"jest": "^21",
"jsdoc": "^3.4.0",

@@ -52,3 +56,3 @@ "mkdirp": "^0.5.1"

"jest": {
"testPathDirs": [
"roots": [
"src",

@@ -55,0 +59,0 @@ "bin",

@@ -13,3 +13,3 @@ /*

const babylon = require('babylon');
const babylon = require('@babel/parser');
const options = require('./tsOptions');

@@ -16,0 +16,0 @@

@@ -14,3 +14,3 @@ /*

const _ = require('lodash');
const babylon = require('babylon');
const babylon = require('@babel/parser');
const baseOptions = require('./tsOptions');

@@ -17,0 +17,0 @@

# jscodeshift [![Build Status](https://travis-ci.org/facebook/jscodeshift.svg?branch=master)](https://travis-ci.org/facebook/jscodeshift)
jscodeshift is a toolkit for running codemods over multiple JS files.
jscodeshift is a toolkit for running codemods over multiple JavaScript or
Typescript files.
It provides:

@@ -26,23 +27,44 @@

```text
```
$ jscodeshift --help
Usage: jscodeshift <path>... [options]
Usage: jscodeshift [OPTION]... PATH...
or: jscodeshift [OPTION]... -t TRANSFORM_PATH PATH...
or: jscodeshift [OPTION]... -t URL PATH...
or: jscodeshift [OPTION]... --stdin < file_list.txt
path Files or directory to transform
Apply transform logic in TRANSFORM_PATH (recursively) to every PATH.
If --stdin is set, each line of the standard input is used as a path.
Options:
-t FILE, --transform FILE Path to the transform file. Can be either a local path or url [./transform.js]
-c, --cpus (all by default) Determines the number of processes started.
-v, --verbose Show more information about the transform process [0]
-d, --dry Dry run (no changes are made to files)
-p, --print Print output, useful for development
--babel Apply Babel to transform files [true]
--extensions File extensions the transform file should be applied to [js]
--ignore-pattern Ignore files that match a provided glob expression
--ignore-config FILE Ignore files if they match patterns sourced from a configuration file (e.g., a .gitignore)
--run-in-band Run serially in the current process [false]
-s, --silent No output [false]
--parser The parser to use for parsing your source files (babel | babylon | flow | ts | tsx) [babel]
--version print version and exit
"..." behind an option means that it can be supplied multiple times.
All options are also passed to the transformer, which means you can supply custom options that are not listed here.
--(no-)babel apply babeljs to the transform file
(default: true)
-c, --cpus=N start at most N child processes to process source files
(default: max(all - 1, 1))
-d, --(no-)dry dry run (no changes are made to files)
(default: false)
--extensions=EXT transform files with these file extensions (comma separated list)
(default: js)
-h, --help print this help and exit
--ignore-config=FILE ... ignore files if they match patterns sourced from a configuration file (e.g. a .gitignore)
--ignore-pattern=GLOB ... ignore files that match a provided glob expression
--parser=babel|babylon|flow|ts|tsx the parser to use for parsing the source files
(default: babel)
--parser-config=FILE path to a JSON file containing a custom parser configuration for flow or babylon
-p, --(no-)print print transformed files to stdout, useful for development
(default: false)
--(no-)run-in-band run serially in the current process
(default: false)
-s, --(no-)silent do not write to stdout or stderr
(default: false)
--(no-)stdin read file/directory list from stdin
(default: false)
-t, --transform=FILE path to the transform file. Can be either a local path or url
(default: ./transform.js)
-v, --verbose=0|1|2 show more information about the transform process
(default: 0)
--version print version and exit
```

@@ -67,2 +89,4 @@

As of v0.6.1, this module can also be written in Typescript.
### Arguments

@@ -88,2 +112,3 @@

stats | A function to collect statistics during `--dry` runs
report | Prints the passed string to stdout

@@ -116,2 +141,7 @@ `jscodeshift` is a reference to the wrapper around recast and provides a

**`report`** allows you do print arbitrary strings to stdout. This can be
useful when other tools consume the output of jscodeshift. The reason to not
directly use `process.stdout` in transform code is to avoid mangled output when
many files are processed.
#### `options`

@@ -118,0 +148,0 @@

@@ -18,2 +18,3 @@ /*

const writeFileAtomic = require('write-file-atomic');
const { DEFAULT_EXTENSIONS } = require('@babel/core');
const getParser = require('./getParser');

@@ -53,11 +54,16 @@

if (babel === 'babel') {
require('babel-register')({
require('@babel/register')({
babelrc: false,
presets: [
require('babel-preset-es2015'),
require('babel-preset-stage-1'),
'@babel/preset-env',
/\.tsx?$/.test(tr) ? '@babel/preset-typescript' : '@babel/preset-flow',
],
plugins: [
require('babel-plugin-transform-flow-strip-types'),
]
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread'
],
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
// By default, babel register only compiles things inside the current working directory.
// https://github.com/babel/babel/blob/2a4f16236656178e84b05b8915aab9261c55782c/packages/babel-register/src/node.js#L140-L157
ignore: []
});

@@ -64,0 +70,0 @@ }

@@ -26,4 +26,4 @@ /*

function createTempFileWith(content, filename) {
const info = temp.openSync();
function createTempFileWith(content, filename, extension) {
const info = temp.openSync({ suffix: extension });
let filePath = info.path;

@@ -39,6 +39,8 @@ fs.writeSync(info.fd, content);

function createTransformWith(content, fileName) {
function createTransformWith(content) {
return createTempFileWith(
'module.exports = function(fileInfo, api, options) { ' + content + ' }',
fileName
undefined,
// Test transform files need a js extension to work with @babel/register
'.js'
);

@@ -45,0 +47,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc