+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+
+
+
+
+
+ Runs the transformations from an object we get from yeoman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+
+
+
+ checkIfExistsAndAddValue(j, node, key, value) → {Void}
+
+
+
+
+
+
+
+ If a prop exists, it overrides it, else it creates a new one
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ node |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ objectexpression to check |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ Key of the property |
+
+
+
+
+
+
+ value |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ computed value of the property |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createArrayWithChildren(j, key, subProps, shouldDropKeys) → {Array}
+
+
+
+
+
+
+
+ Creates an array and iterates on an object with properties
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ object name |
+
+
+
+
+
+
+ subProps |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ computed value of the property |
+
+
+
+
+
+
+ shouldDropKeys |
+
+
+
+
+
+Boolean
+
+
+
+ |
+
+
+
+
+
+ bool to ask to use obj.keys or not |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ arr - An array with the object properties
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createEmptyArrayProperty(j, key) → {Array}
+
+
+
+
+
+
+
+ Creates an empty array
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ array name |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ arr - An empty array
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createEmptyCallableFunctionWithArguments(j, name) → {Node}
+
+
+
+
+
+
+
+ Creates a function call with arguments
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ name |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ Name for the given function |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - Returns the node for the created
+function
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createExternalRegExp(j, prop) → {Node}
+
+
+
+
+
+
+
+ Finds a regexp property with an already parsed AST from the user
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ prop |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ property to find the value at |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - A literal node with the found regexp
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createIdentifierOrLiteral(j, val) → {Node}
+
+
+
+
+
+
+
+ Creates an appropriate identifier or literal property
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ val |
+
+
+
+
+
+String
+|
+
+Boolean
+|
+
+Number
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createLiteral(j, val) → {Node}
+
+
+
+
+
+
+
+ Creates an appropriate literal property
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ val |
+
+
+
+
+
+String
+|
+
+Boolean
+|
+
+Number
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createObjectWithSuppliedProperty(j, key, prop) → {Node}
+
+
+
+
+
+
+
+ Creates an object with an supplied property as parameter
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ object name |
+
+
+
+
+
+
+ prop |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ property to be added |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - An property with the supplied property
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createOrUpdatePluginByName(j, rootNodePath, pluginName, options) → {Void}
+
+
+
+
+
+
+
+ Findes or creates a node for a given plugin name string with options object
+If plugin decalaration already exist, options are merged.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ rootNodePath |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ `plugins: []` NodePath where plugin should be added. See https://github.com/facebook/jscodeshift/wiki/jscodeshift-Documentation#nodepaths |
+
+
+
+
+
+
+ pluginName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ ex. `webpack.LoaderOptionsPlugin` |
+
+
+
+
+
+
+ options |
+
+
+
+
+
+Object
+
+
+
+ |
+
+
+
+
+
+ plugin options |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createProperty(j, key, value) → {Node}
+
+
+
+
+
+
+
+ Creates an Object's property with a given key and value
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+|
+
+Number
+
+
+
+ |
+
+
+
+
+
+ Property key |
+
+
+
+
+
+
+ value |
+
+
+
+
+
+String
+|
+
+Number
+|
+
+Boolean
+
+
+
+ |
+
+
+
+
+
+ Property value |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ creator(options) → {function}
+
+
+
+
+
+
+
+ Runs yeoman and runs the transformations based on the object
+built up from an author/user
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ options |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ An path to the given generator |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ runTransform - Run transformations based on the finished
+yeoman instance
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ defineTest(dirName, transformName, testFilePrefixopt, transformObject, action) → {Void}
+
+
+
+
+
+
+
+ Handles some boilerplate around defining a simple jest/Jasmine test for a
+jscodeshift transform.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Attributes |
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ dirName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ contains the name of the directory the test is located in. This
+ should normally be passed via __dirname. |
+
+
+
+
+
+
+ transformName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ contains the filename of the transform being tested,
+ excluding the .js extension. |
+
+
+
+
+
+
+ testFilePrefix |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ Optionally contains the name of the file with the test
+ data. If not specified, it defaults to the same value as `transformName`.
+ This will be suffixed with ".input.js" for the input file and ".output.js"
+ for the expected output. For example, if set to "foo", we will read the
+ "foo.input.js" file, pass this to the transform, and expect its output to
+ be equal to the contents of "foo.output.js". |
+
+
+
+
+
+
+ transformObject |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ Object to be transformed with the transformations |
+
+
+
+
+
+
+ action |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ init, update or remove, decides how to format the AST |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ Jest makes sure to execute the globally defined functions
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ findPluginsByName(j, node, pluginNamesArray) → {Node}
+
+
+
+
+
+
+
+ Find paths that match `new name.space.PluginName()` for a
+given array of plugin names
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ node |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ Node to start search from |
+
+
+
+
+
+
+ pluginNamesArray |
+
+
+
+
+
+Array.<String>
+
+
+
+ |
+
+
+
+
+
+ Array of plugin names like `webpack.LoaderOptionsPlugin` |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ Node that has the pluginName
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ findRootNodesByName(j, node, propName) → {Node}
+
+
+
+
+
+
+
+ Finds the path to the `name: []` node
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ node |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ Node to start search from |
+
+
+
+
+
+
+ propName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ property to search for |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ found node and
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ findVariableToPlugin(j, rootNode, pluginPackageName) → {String}
+
+
+
+
+
+
+
+ Finds the variable to which a third party plugin is assigned to
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ rootNode |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ `plugins: []` Root Node. See https://github.com/facebook/jscodeshift/wiki/jscodeshift-Documentation#nodepaths |
+
+
+
+
+
+
+ pluginPackageName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ ex. `extract-text-plugin` |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ variable name - ex. 'var s = require(s) gives "s"`
+
+
+
+
+
+ -
+ Type
+
+ -
+
+String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generatorCopy(generator, templateDir) → {function}
+
+
+
+
+
+
+
+ Takes in a file path in the `./templates` directory. Copies that
+file to the destination, with the `.tpl` extension stripped.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ generator |
+
+
+
+
+
+Generator
+
+
+
+ |
+
+
+
+
+
+ A Yeoman Generator instance |
+
+
+
+
+
+
+ templateDir |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ Absolute path to template directory |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ A curried function that takes a file path and copies it
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generatorCopyTpl(generator, templateDir, templateData) → {function}
+
+
+
+
+
+
+
+ Takes in a file path in the `./templates` directory. Copies that
+file to the destination, with the `.tpl` extension and `_` prefix
+stripped. Passes `this.props` to the template.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ generator |
+
+
+
+
+
+Generator
+
+
+
+ |
+
+
+
+
+
+ A Yeoman Generator instance |
+
+
+
+
+
+
+ templateDir |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ Absolute path to template directory |
+
+
+
+
+
+
+ templateData |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ An object containing the data passed to
+the template files. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ A curried function that takes a file path and copies it
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getPackageManager() → {String}
+
+
+
+
+
+
+
+ Returns the name of package manager to use,
+preferring yarn over npm if available
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - The package manager name
+
+
+
+
+
+ -
+ Type
+
+ -
+
+String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getRequire(j, constName, packagePath) → {Node}
+
+
+
+
+
+
+
+ Returns constructed require symbol
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ constName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ Name of require |
+
+
+
+
+
+
+ packagePath |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ path of required package |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - the created ast
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isAssignment(j, p, cb, identifier, property) → {function}
+
+
+
+
+
+
+
+ Checks if we are at the correct node and later invokes a callback
+for the transforms to either use their own transform function or
+use pushCreateProperty if the transform doesn't expect any properties
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ p |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ Node to push against |
+
+
+
+
+
+
+ cb |
+
+
+
+
+
+function
+
+
+
+ |
+
+
+
+
+
+ callback to be invoked |
+
+
+
+
+
+
+ identifier |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ key to use as property |
+
+
+
+
+
+
+ property |
+
+
+
+
+
+Object
+
+
+
+ |
+
+
+
+
+
+ WebpackOptions that later will be converted via
+pushCreateProperty via WebpackOptions[identifier] |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ cb - Returns the callback and pushes a new node
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isType(path, type) → {Boolean}
+
+
+
+
+
+
+
+ Returns true if type is given type
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ path |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ pathNode |
+
+
+
+
+
+
+ type |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ node type |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ loaderCreator() → {void}
+
+
+
+
+
+
+
+ Runs a yeoman generator to create a new webpack loader project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ loopThroughObjects(j, p, obj) → {function|Node}
+
+
+
+
+
+
+
+ Loops through an object and adds property to an object with no identifier
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ p |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ node to add value to |
+
+
+
+
+
+
+ obj |
+
+
+
+
+
+Object
+
+
+
+ |
+
+
+
+
+
+ Object to loop through |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - Either pushes the node, or reruns until
+nothing is left
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+|
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ makeLoaderName(name) → {string}
+
+
+
+
+
+
+
+ Formats a string into webpack loader format
+(eg: 'style-loader', 'raw-loader')
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ name |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ A loader name to be formatted |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ The formatted string
+
+
+
+
+
+ -
+ Type
+
+ -
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pluginCreator() → {void}
+
+
+
+
+
+
+
+ Runs a yeoman generator to create a new webpack plugin project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ processPromise(child) → {Promise}
+
+
+
+
+
+
+
+ Attaches a promise to the installation of the package
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ child |
+
+
+
+
+
+function
+
+
+
+ |
+
+
+
+
+
+ The function to attach a promise to |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ promise - Returns a promise to the installation
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pushCreateProperty(j, p, key, val) → {Node}
+
+
+
+
+
+
+
+ Creates a property and pushes the value to a node
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ p |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ Node to push against |
+
+
+
+
+
+
+ key |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ key used as identifier |
+
+
+
+
+
+
+ val |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ property value |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ - Returns node the pushed property
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pushObjectKeys(j, p, webpackProperties, name) → {Node|function}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ j |
+
+
+
+
+
+any
+
+
+
+ |
+
+
+
+
+
+ — jscodeshift API |
+
+
+
+
+
+
+ p |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ path to push |
+
+
+
+
+
+
+ webpackProperties |
+
+
+
+
+
+Object
+
+
+
+ |
+
+
+
+
+
+ The object to loop over |
+
+
+
+
+
+
+ name |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ Key that will be the identifier we find and add values to |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ Returns a function that will push a node if
+subProperty is an array, else it will invoke a function that will push a single node
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Node
+|
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ replaceAt(string, index, replace) → {String}
+
+
+
+
+
+
+
+ Replaces the string with a substring at the given index
+https://gist.github.com/efenacigiray/9367920
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ string |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ string to be modified |
+
+
+
+
+
+
+ index |
+
+
+
+
+
+Number
+
+
+
+ |
+
+
+
+
+
+ index to replace from |
+
+
+
+
+
+
+ replace |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ string to replace starting from index |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ string - The newly mutated string
+
+
+
+
+
+ -
+ Type
+
+ -
+
+String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Utility function to run a jscodeshift script within a unit test.
+This makes several assumptions about the environment.
+
+Notes:
+- The test should be located in a subdirectory next to the transform itself.
+ Commonly tests are located in a directory called __tests__.
+
+- Test data should be located in a directory called __testfixtures__
+ alongside the transform and __tests__ directory.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Attributes |
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ dirName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ contains the name of the directory the test is located in. This
+ should normally be passed via __dirname. |
+
+
+
+
+
+
+ transformName |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ contains the filename of the transform being tested,
+ excluding the .js extension. |
+
+
+
+
+
+
+ testFilePrefix |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ Optionally contains the name of the file with the test
+ data. If not specified, it defaults to the same value as `transformName`.
+ This will be suffixed with ".input.js" for the input file and ".output.js"
+ for the expected output. For example, if set to "foo", we will read the
+ "foo.input.js" file, pass this to the transform, and expect its output to
+ be equal to the contents of "foo.output.js". |
+
+
+
+
+
+
+ initOptions |
+
+
+
+
+
+Object
+|
+
+Boolean
+|
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ TBD |
+
+
+
+
+
+
+ action |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ init, update or remove, decides how to format the AST |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ Function that fires of the transforms
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ spawnChild(pkg) → {function}
+
+
+
+
+
+
+
+ Spawns a new process that installs the addon/dependency
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ pkg |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ The dependency to be installed |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ spawn - Installs the package
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ spawnNPM(pkg, isNew) → {function}
+
+
+
+
+
+
+
+ Spawns a new process using npm
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ pkg |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ The dependency to be installed |
+
+
+
+
+
+
+ isNew |
+
+
+
+
+
+Boolean
+
+
+
+ |
+
+
+
+
+
+ indicates if it needs to be updated or installed |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ spawn - Installs the package
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ spawnYarn(pkg, isNew) → {function}
+
+
+
+
+
+
+
+ Spawns a new process using yarn
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ pkg |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ The dependency to be installed |
+
+
+
+
+
+
+ isNew |
+
+
+
+
+
+Boolean
+
+
+
+ |
+
+
+
+
+
+ indicates if it needs to be updated or installed |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ spawn - Installs the package
+
+
+
+
+
+ -
+ Type
+
+ -
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ traverseAndGetProperties(arr, prop) → {Boolean}
+
+
+
+
+
+
+
+ Checks if the given array has a given property
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ arr |
+
+
+
+
+
+Array
+
+
+
+ |
+
+
+
+
+
+ array to check |
+
+
+
+
+
+
+ prop |
+
+
+
+
+
+String
+
+
+
+ |
+
+
+
+
+
+ property to check existence of |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ hasProp - Boolean indicating if the property
+is present
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ webpackGenerator(prompts, templateDir, copyFiles, copyTemplateFiles, templateFn) → {Generator}
+
+
+
+
+
+
+
+ Creates a Yeoman Generator that generates a project conforming
+to webpack-defaults.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ prompts |
+
+
+
+
+
+Array.<any>
+
+
+
+ |
+
+
+
+
+
+ An array of Yeoman prompt objects |
+
+
+
+
+
+
+ templateDir |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ Absolute path to template directory |
+
+
+
+
+
+
+ copyFiles |
+
+
+
+
+
+Array.<string>
+
+
+
+ |
+
+
+
+
+
+ An array of file paths (relative to `./templates`)
+of files to be copied to the generated project. File paths should be of the
+form `path/to/file.js.tpl`. |
+
+
+
+
+
+
+ copyTemplateFiles |
+
+
+
+
+
+Array.<string>
+
+
+
+ |
+
+
+
+
+
+ An array of file paths (relative to
+`./templates`) of files to be copied to the generated project. Template
+file paths should be of the form `path/to/_file.js.tpl`. |
+
+
+
+
+
+
+ templateFn |
+
+
+
+
+
+function
+
+
+
+ |
+
+
+
+
+
+ A function that is passed a generator instance and
+returns an object containing data to be supplied to the template files. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ A class extending Generator
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Generator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+