diff --git a/README.md b/README.md index a515fa8f..d0e20c56 100644 --- a/README.md +++ b/README.md @@ -502,6 +502,14 @@ defineInlineTest(transform, /* ... */) - [js-codemod](https://github.com/cpojer/js-codemod/) - Codemod scripts to transform code to next generation JS. - [js-transforms](https://github.com/jhgg/js-transforms) - Some documented codemod experiments to help you learn. +### Local Documentation Server + + To update docs in `/docs`, use `npm run docs`. + + To view these docs locally, use `npx http-server ./docs` + + + ### Recipes - [Retain leading comment(s) in file when replacing/removing first statement](recipes/retain-first-comment.md) diff --git a/docs/Collection.html b/docs/Collection.html index 354a6e5c..d40f2c40 100644 --- a/docs/Collection.html +++ b/docs/Collection.html @@ -28,7 +28,7 @@

Class: Collection

-

Collection(paths, parent, types)

+

Collection(paths, parent, types) → {Collection}

This represents a generic collection of node paths. It only has a generic API to access and process the elements of the list. It doesn't know anything @@ -47,7 +47,7 @@

Constructor

-

new Collection(paths, parent, types)

+

new Collection(paths, parent, types) → {Collection}

@@ -205,7 +205,7 @@
Parameters:
Source:
@@ -230,6 +230,26 @@
Parameters:
+
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + @@ -297,7 +317,7 @@

lengthSource:
@@ -431,7 +451,7 @@
Parameters:
Source:
@@ -454,6 +474,8 @@
Parameters:
+ +
Returns:
@@ -543,7 +565,7 @@

childEle
Source:
@@ -566,6 +588,8 @@

childEle + +

Returns:
@@ -595,7 +619,7 @@
Returns:
-

childNodes() → {Collection}

+

childElements() → {JSXElementCollection}

@@ -603,7 +627,7 @@

childNodes<
- Returns all child nodes, including literals and expressions. + Returns all children that are JSXElements.
@@ -637,7 +661,7 @@

childNodes<
@@ -655,7 +679,7 @@

childNodes<
Source:
@@ -678,6 +702,8 @@

childNodes< + +

Returns:
@@ -689,7 +715,7 @@
Returns:
-Collection +JSXElementCollection
@@ -707,7 +733,7 @@
Returns:
-

closest() → {Collection}

+

childNodes() → {Collection}

@@ -715,7 +741,7 @@

closest - Traverse the AST up and finds the closest node of the provided type. + Returns all child nodes, including literals and expressions.

@@ -726,72 +752,6 @@

closestParameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDescription
- - -Collection - - - -
- - -filter - - - -
- - @@ -815,7 +775,7 @@
Parameters:
@@ -833,7 +793,7 @@
Parameters:
Source:
@@ -856,6 +816,8 @@
Parameters:
+ +
Returns:
@@ -885,7 +847,7 @@
Returns:
-

closestScope() → {Collection}

+

childNodes() → {Collection}

@@ -893,8 +855,7 @@

closestSc
- Returns a collection containing the paths that create the scope of the -currently selected paths. Dedupes the paths. + Returns all child nodes, including literals and expressions.
@@ -928,7 +889,7 @@

closestSc
@@ -946,7 +907,7 @@

closestSc
Source:
@@ -969,6 +930,8 @@

closestSc + +

Returns:
@@ -998,7 +961,7 @@
Returns:
-

every(callback) → {boolean}

+

closest() → {Collection}

@@ -1006,7 +969,7 @@

every - Tests whether all paths pass the test implemented by the provided callback. + Traverse the AST up and finds the closest node of the provided type. @@ -1024,8 +987,6 @@
Parameters:
- Name - Type @@ -1042,13 +1003,32 @@
Parameters:
- callback + + + + +Collection + + + + + + + + + + + + + + + -function +filter @@ -1085,6 +1065,14 @@
Parameters:
+
Mixes In:
+ +
+ @@ -1099,7 +1087,7 @@
Parameters:
Source:
@@ -1122,6 +1110,8 @@
Parameters:
+ +
Returns:
@@ -1133,7 +1123,7 @@
Returns:
-boolean +Collection
@@ -1151,7 +1141,7 @@
Returns:
-

filter(callback) → {Collection}

+

closest() → {Collection}

@@ -1159,8 +1149,7 @@

filter - Returns a new collection containing the nodes for which the callback -returns true. + Traverse the AST up and finds the closest node of the provided type. @@ -1178,8 +1167,6 @@
Parameters:
- Name - Type @@ -1196,13 +1183,32 @@
Parameters:
- callback + + + + +Collection + + + + + + + + + + + + + + + -function +filter @@ -1239,6 +1245,14 @@
Parameters:
+
Mixes In:
+ +
+ @@ -1253,7 +1267,7 @@
Parameters:
Source:
@@ -1276,6 +1290,8 @@
Parameters:
+ +
Returns:
@@ -1305,7 +1321,7 @@
Returns:
-

find() → {Collection}

+

closestScope() → {Collection}

@@ -1313,7 +1329,8 @@

find - Find nodes of a specific type within the nodes of this collection. + Returns a collection containing the paths that create the scope of the +currently selected paths. Dedupes the paths. @@ -1324,61 +1341,1962 @@

find - - - - Type - - - Description - - +
- - - + - - - -type + + - - + - + - + +
Mixes In:
- - +
+ - - + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

closestScope() → {Collection}

+ + + + + + +
+ Returns a collection containing the paths that create the scope of the +currently selected paths. Dedupes the paths. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

every(callback) → {boolean}

+ + + + + + +
+ Tests whether all paths pass the test implemented by the provided callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callback + + +function + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + + + + +

filter(callback) → {Collection}

+ + + + + + +
+ Returns a new collection containing the nodes for which the callback +returns true. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callback + + +function + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

find() → {Collection}

+ + + + + + +
+ Find nodes of a specific type within the nodes of this collection. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +type + + + +
+ + +filter + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

find() → {Collection}

+ + + + + + +
+ Find nodes of a specific type within the nodes of this collection. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +type + + + +
+ + +filter + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

findJSXElements(name) → {Collection}

+ + + + + + +
+ Finds all JSXElements optionally filtered by name +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

findJSXElements(name) → {Collection}

+ + + + + + +
+ Finds all JSXElements optionally filtered by name +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

findJSXElementsByModuleName()

+ + + + + + +
+ Finds all JSXElements by module name. Given + + var Bar = require('Foo'); + + +findJSXElementsByModuleName('Foo') will find , without having to +know the variable name. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

findJSXElementsByModuleName()

+ + + + + + +
+ Finds all JSXElements by module name. Given + + var Bar = require('Foo'); + + +findJSXElementsByModuleName('Foo') will find , without having to +know the variable name. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

findVariableDeclarators(name) → {Collection}

+ + + + + + +
+ Finds all variable declarators, optionally filtered by name. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

findVariableDeclarators(name) → {Collection}

+ + + + + + +
+ Finds all variable declarators, optionally filtered by name. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + +
Mixes In:
+ +
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

forEach(callback) → {Collection}

+ + + + + + +
+ Executes callback for each node/path in the collection. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callback + + +function + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ The collection itself +
+ + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + + + + + + + + + + +

get()

+ + + + + + +
+ Proxies to NodePath#get of the first path. +
- - - -filter - - - + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1409,13 +3327,94 @@
Parameters:
-
Mixes In:
-
+ + + + + +

getTypes() → {Array.<string>}

+ + + + + + +
+ Returns the type(s) of the collection. This is only used for unit tests, +I don't think other consumers would need it. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + @@ -1431,7 +3430,7 @@
Parameters:
Source:
@@ -1454,6 +3453,8 @@
Parameters:
+ +
Returns:
@@ -1465,7 +3466,7 @@
Returns:
-Collection +Array.<string>
@@ -1483,7 +3484,7 @@
Returns:
-

findJSXElements(name) → {Collection}

+

getVariableDeclarators(nameGetter) → {Collection}

@@ -1491,7 +3492,11 @@

findJS
- Finds all JSXElements optionally filtered by name + Finds the declaration for each selected path. Useful for member expressions +or JSXElements. Expects a callback function that maps each path to the name +to look for. + +If the callback returns a falsey value, the element is skipped.
@@ -1527,13 +3532,13 @@

Parameters:
- + - + - + - + - + - + - -
NameTypeDescription
...fields + + +string +| + +number + + + +
namenameGetter -string +function @@ -1574,7 +3579,7 @@
Parameters:
@@ -1592,7 +3597,7 @@
Parameters:
Source:
@@ -1615,6 +3620,8 @@
Parameters:
+ +
Returns:
@@ -1644,7 +3651,7 @@
Returns:
-

findJSXElementsByModuleName()

+

getVariableDeclarators(nameGetter) → {Collection}

@@ -1652,13 +3659,11 @@

<
- Finds all JSXElements by module name. Given - - var Bar = require('Foo'); - + Finds the declaration for each selected path. Useful for member expressions +or JSXElements. Expects a callback function that maps each path to the name +to look for. -findJSXElementsByModuleName('Foo') will find , without having to -know the variable name. +If the callback returns a falsey value, the element is skipped.
@@ -1669,6 +3674,55 @@

< +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nameGetter + + +function + + + +
+ + @@ -1692,7 +3746,7 @@

<
@@ -1710,7 +3764,7 @@

<
Source:
@@ -1735,6 +3789,26 @@

< +
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + @@ -1744,7 +3818,7 @@

< -

findVariableDeclarators(name) → {Collection}

+

insertAfter(insert) → {Collection}

@@ -1752,7 +3826,7 @@

- Finds all variable declarators, optionally filtered by name. + Inserts a new node after the current one. @@ -1788,13 +3862,19 @@
Parameters:

nameinsert -string +Node +| + +Array.<Node> +| + +function @@ -1835,7 +3915,7 @@
Parameters:
@@ -1853,7 +3933,7 @@
Parameters:
Source:
@@ -1876,6 +3956,8 @@
Parameters:
+ +
Returns:
@@ -1905,7 +3987,7 @@
Returns:
-

forEach(callback) → {Collection}

+

insertAfter(insert) → {Collection}

@@ -1913,7 +3995,7 @@

forEach - Executes callback for each node/path in the collection. + Inserts a new node after the current one. @@ -1949,12 +4031,18 @@
Parameters:

callbackinsert +Node +| + +Array.<Node> +| + function @@ -1992,6 +4080,14 @@
Parameters:
+
Mixes In:
+ +
+ @@ -2006,7 +4102,7 @@
Parameters:
Source:
@@ -2029,13 +4125,11 @@
Parameters:
+ +
Returns:
-
- The collection itself -
-
@@ -2062,7 +4156,7 @@
Returns:
-

get()

+

insertBefore(insert) → {Collection}

@@ -2070,7 +4164,7 @@

get - Proxies to NodePath#get of the first path. + Inserts a new node before the current one. @@ -2106,16 +4200,19 @@
Parameters:

...fieldsinsert -string +Node | -number +Array.<Node> +| + +function @@ -2152,6 +4249,14 @@
Parameters:
+
Mixes In:
+ +
+ @@ -2166,7 +4271,7 @@
Parameters:
Source:
@@ -2191,6 +4296,26 @@
Parameters:
+
Returns:
+ + + + +
+
+ Type +
+
+ +Collection + + +
+
+ + + + @@ -2200,7 +4325,7 @@
Parameters:
-

getTypes() → {Array.<string>}

+

insertBefore(insert) → {Collection}

@@ -2208,8 +4333,7 @@

getTypes - Returns the type(s) of the collection. This is only used for unit tests, -I don't think other consumers would need it. + Inserts a new node before the current one. @@ -2220,6 +4344,61 @@

getTypesParameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
insert + + +Node +| + +Array.<Node> +| + +function + + + +
+ + @@ -2239,6 +4418,14 @@

getTypesMixes In: + +
+ @@ -2253,7 +4440,7 @@

getTypesSource:
@@ -2276,6 +4463,8 @@

getTypesReturns:

@@ -2287,7 +4476,7 @@
Returns:
-Array.<string> +Collection
@@ -2305,7 +4494,7 @@
Returns:
-

getVariableDeclarators(nameGetter) → {Collection}

+

isOfType(type) → {boolean}

@@ -2313,11 +4502,7 @@

- Finds the declaration for each selected path. Useful for member expressions -or JSXElements. Expects a callback function that maps each path to the name -to look for. - -If the callback returns a falsey value, the element is skipped. + Returns true if this collection has the type 'type'. @@ -2353,13 +4538,13 @@

Parameters:

nameGettertype -function +Type @@ -2396,14 +4581,6 @@
Parameters:
-
Mixes In:
- -
- @@ -2418,7 +4595,7 @@
Parameters:
Source:
@@ -2441,6 +4618,8 @@
Parameters:
+ +
Returns:
@@ -2452,7 +4631,7 @@
Returns:
-Collection +boolean
@@ -2470,7 +4649,7 @@
Returns:
-

insertAfter(insert) → {Collection}

+

map(callback, type)

@@ -2478,7 +4657,14 @@

insertAfte
- Inserts a new node after the current one. + Executes the callback for every path in the collection and returns a new +collection from the return values (which must be paths). + +The callback can return null to indicate to exclude the element from the +new collection. + +If an array is returned, the array will be flattened into the result +collection.
@@ -2514,18 +4700,12 @@

Parameters:
insertcallback -Node -| - -Array.<Node> -| - function @@ -2540,113 +4720,83 @@
Parameters:
- - - + + + type + + + + +Type -
- - - - - + + - + - + - + Force the new collection to be of a specific type + -
Mixes In:
+ + -
- - - - - - +
-
Source:
-
- -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Collection + -
-
+ + + + + - - + + +
Source:
+
-

insertBefore(insert) → {Collection}

+ +
+ + + + -
- Inserts a new node before the current one. -
@@ -2656,68 +4806,40 @@

insertBef -

Parameters:
- - - - - - - - - + - - - + - + +

nodes() → {Array}

- - - - + - - - - - - - -
NameTypeDescription
insert - - -Node -| -Array.<Node> -| -function +
+ Returns an array of AST nodes in this collection. +
- -
-
- +
@@ -2730,13 +4852,7 @@
Parameters:
-
Mixes In:
-
@@ -2752,7 +4868,7 @@
Parameters:
Source:
@@ -2775,6 +4891,8 @@
Parameters:
+ +
Returns:
@@ -2786,7 +4904,7 @@
Returns:
-Collection +Array
@@ -2804,7 +4922,7 @@
Returns:
-

isOfType(type) → {boolean}

+

renameTo(newName) → {Collection}

@@ -2812,7 +4930,7 @@

isOfType - Returns true if this collection has the type 'type'. + Renames a variable and all its occurrences. @@ -2848,13 +4966,13 @@
Parameters:
- type + newName -Type +string @@ -2891,6 +5009,14 @@
Parameters:
+
Mixes In:
+ +
+ @@ -2905,7 +5031,7 @@
Parameters:
Source:
@@ -2928,6 +5054,8 @@
Parameters:
+ +
Returns:
@@ -2939,7 +5067,7 @@
Returns:
-boolean +Collection
@@ -2957,7 +5085,7 @@
Returns:
-

map(callback, type)

+

renameTo(newName) → {Collection}

@@ -2965,14 +5093,7 @@

map - Executes the callback for every path in the collection and returns a new -collection from the return values (which must be paths). - -The callback can return null to indicate to exclude the element from the -new collection. - -If an array is returned, the array will be flattened into the result -collection. + Renames a variable and all its occurrences. @@ -3008,13 +5129,13 @@
Parameters:
- callback + newName -function +string @@ -3028,29 +5149,6 @@
Parameters:
- - - - type - - - - - -Type - - - - - - - - - - Force the new collection to be of a specific type - - - @@ -3074,91 +5172,13 @@
Parameters:
+
Mixes In:
- - - - - - - - - - - -
Source:
-
- - - - - - - -

- - - - - - - - - - - - - - - - - - +
    - - - - - -

    nodes() → {Array}

    - - - - - - -
    - Returns an array of AST nodes in this collection. -
    - - - - - - - - - - - - - -
    - - - - - - - - - - - - - +
  • transformMethods.renameTo
  • + +
@@ -3174,7 +5194,7 @@

nodesSource:
@@ -3197,6 +5217,8 @@

nodesReturns:

@@ -3208,7 +5230,7 @@
Returns:
-Array +Collection
@@ -3226,7 +5248,7 @@
Returns:
-

renameTo(newName) → {Collection}

+

replaceWith(nodes) → {Collection}

@@ -3234,7 +5256,9 @@

renameTo - Renames a variable and all its occurrences. + Simply replaces the selected nodes with the provided node. If a function +is provided it is executed for every node and the node is replaced with the +functions return value. @@ -3270,13 +5294,19 @@
Parameters:
- newName + nodes -string +Node +| + +Array.<Node> +| + +function @@ -3317,7 +5347,7 @@
Parameters:
@@ -3335,7 +5365,7 @@
Parameters:
Source:
@@ -3358,6 +5388,8 @@
Parameters:
+ +
Returns:
@@ -3504,7 +5536,7 @@
Parameters:
Source:
@@ -3527,6 +5559,8 @@
Parameters:
+ +
Returns:
@@ -3608,7 +5642,7 @@

sizeSource:
@@ -3631,6 +5665,8 @@

sizeSource:
@@ -3784,6 +5820,8 @@
Parameters:
+ +
Returns:
@@ -3829,7 +5867,7 @@

Home

Modules

  • diff --git a/docs/Collection.js.html b/docs/Collection.js.html index 01643ac5..074727b0 100644 --- a/docs/Collection.js.html +++ b/docs/Collection.js.html @@ -19,11 +19,11 @@

    Source: Collection.js

    + - - +
    
    @@ -37,8 +37,9 @@ 

    Source: Collection.js

    'use strict'; const assert = require('assert'); +const intersection = require('./utils/intersection'); const recast = require('recast'); -const _ = require('lodash'); +const union = require('./utils/union'); const astTypes = recast.types; var types = astTypes.namedTypes; @@ -286,8 +287,7 @@

    Source: Collection.js

    ); } else { // try to find a common type - _types = _.intersection.apply( - null, + _types = intersection( paths.map(path => astTypes.getSupertypeNames(path.node.type)) ); } @@ -300,12 +300,27 @@

    Source: Collection.js

    value = !Array.isArray(value) ? [value] : value; value = value.map(v => v.toString()); if (value.length > 1) { - return _.union(value, _.intersection.apply( - null, - value.map(type => astTypes.getSupertypeNames(type)) - )); + return union( + [value].concat(intersection(value.map(_getSupertypeNames))) + ); } else { - return value.concat(astTypes.getSupertypeNames(value[0])); + return value.concat(_getSupertypeNames(value[0])); + } +} + +function _getSupertypeNames(type) { + try { + return astTypes.getSupertypeNames(type); + } catch(error) { + if (error.message === '') { + // Likely the case that the passed type wasn't found in the definition + // list. Maybe a typo. ast-types doesn't throw a useful error in that + // case :( + throw new Error( + '"' + type + '" is not a known AST node type. Maybe a typo?' + ); + } + throw error; } } @@ -499,7 +514,7 @@

    Home

    Modules

    • diff --git a/docs/collections_JSXElement.js.html b/docs/collections_JSXElement.js.html index 3bbb3f35..8ede84c2 100644 --- a/docs/collections_JSXElement.js.html +++ b/docs/collections_JSXElement.js.html @@ -19,11 +19,11 @@

      Source: collections/JSXElement.js

      + - - +
      
      @@ -36,11 +36,11 @@ 

      Source: collections/JSXElement.js

      'use strict'; -const _ = require('lodash'); const Collection = require('../Collection'); const NodeCollection = require('./Node'); const assert = require('assert'); +const once = require('../utils/once'); const recast = require('recast'); const requiresModule = require('./VariableDeclarator').filters.requiresModule; @@ -225,7 +225,7 @@

      Source: collections/JSXElement.js

      Collection.registerMethods(traversalMethods, JSXElement); } -exports.register = _.once(register); +exports.register = once(register); exports.filters = filterMethods; exports.mappings = mappingMethods;
      @@ -244,7 +244,7 @@

      Home

      Modules

      • diff --git a/docs/collections_Node.js.html b/docs/collections_Node.js.html index a73d854b..2d3ebd55 100644 --- a/docs/collections_Node.js.html +++ b/docs/collections_Node.js.html @@ -19,11 +19,11 @@

        Source: collections/Node.js

        + - - +
        
        @@ -36,10 +36,10 @@ 

        Source: collections/Node.js

        'use strict'; -const _ = require('lodash'); const Collection = require('../Collection'); const matchNode = require('../matchNode'); +const once = require('../utils/once'); const recast = require('recast'); const Node = recast.types.namedTypes.Node; @@ -212,7 +212,7 @@

        Source: collections/Node.js

        Collection.setDefaultCollectionType(Node); } -exports.register = _.once(register); +exports.register = once(register);
        @@ -229,7 +229,7 @@

        Home

        Modules

        • diff --git a/docs/collections_VariableDeclarator.js.html b/docs/collections_VariableDeclarator.js.html index 0fb9cc5d..eed44b4a 100644 --- a/docs/collections_VariableDeclarator.js.html +++ b/docs/collections_VariableDeclarator.js.html @@ -19,11 +19,11 @@

          Source: collections/VariableDeclarator.js

          + - - +
          
          @@ -36,9 +36,9 @@ 

          Source: collections/VariableDeclarator.js

          'use strict'; -const _ = require('lodash'); const Collection = require('../Collection'); const NodeCollection = require('./Node'); +const once = require('../utils/once'); const recast = require('recast'); const astNodesAreEquivalent = recast.types.astNodesAreEquivalent; @@ -140,6 +140,15 @@

          Source: collections/VariableDeclarator.js

          return false; } + if ( + types.ClassProperty.check(parent) && + parent.key === path.node && + !parent.computed + ) { + // class A { oldName = 3 } + return false; + } + if ( types.JSXAttribute.check(parent) && parent.name === path.node && @@ -189,7 +198,7 @@

          Source: collections/VariableDeclarator.js

          Collection.registerMethods(transformMethods, VariableDeclarator); } -exports.register = _.once(register); +exports.register = once(register); exports.filters = filterMethods;
          @@ -207,7 +216,7 @@

          Home

          Modules

          • diff --git a/docs/collections_index.js.html b/docs/collections_index.js.html new file mode 100644 index 00000000..e4d43969 --- /dev/null +++ b/docs/collections_index.js.html @@ -0,0 +1,64 @@ + + + + + JSDoc: Source: collections/index.js + + + + + + + + + + +
            + +

            Source: collections/index.js

            + + + + + + +
            +
            +
            
            +/**
            + * Copyright (c) Facebook, Inc. and its affiliates.
            + *
            + * This source code is licensed under the MIT license found in the
            + * LICENSE file in the root directory of this source tree.
            + */
            +
            +module.exports = {
            +  Node: require('./Node'),
            +  JSXElement: require('./JSXElement'),
            +  VariableDeclarator: require('./VariableDeclarator'),
            +};
            +
            +
            +
            + + + + +
            + + + +
            + +
            + Documentation generated by JSDoc 3.6.7 on Fri Apr 08 2022 04:22:46 GMT-0400 (Eastern Daylight Time) +
            + + + + + diff --git a/docs/core.js.html b/docs/core.js.html index 12f07348..21289f2a 100644 --- a/docs/core.js.html +++ b/docs/core.js.html @@ -19,11 +19,11 @@

            Source: core.js

            + - - +
            
            @@ -225,7 +225,7 @@ 

            Home

            Modules

            • diff --git a/docs/external-astTypes.html b/docs/external-astTypes.html index 77400f7a..296bb991 100644 --- a/docs/external-astTypes.html +++ b/docs/external-astTypes.html @@ -73,7 +73,7 @@

              Source:
              @@ -131,7 +131,7 @@

              Home

              Modules

              • diff --git a/docs/global.html b/docs/global.html index 5b5e26ae..688a89fe 100644 --- a/docs/global.html +++ b/docs/global.html @@ -250,7 +250,7 @@
                Parameters:
                Source:
                @@ -278,6 +278,8 @@
                Parameters:
                + + @@ -300,7 +302,7 @@

                Home

                Modules

                • diff --git a/docs/globalMethods.html b/docs/globalMethods.html index 1c0fc9e9..cc5e896b 100644 --- a/docs/globalMethods.html +++ b/docs/globalMethods.html @@ -37,6 +37,8 @@

                  globalMethods

                  +
                  Contains filter methods and mutation methods for processing JSXElements.
                  + @@ -70,7 +72,7 @@

                  globalMethods

                  Source:
                  @@ -210,7 +212,7 @@
                  Parameters:
                  Source:
                  @@ -233,6 +235,8 @@
                  Parameters:
                  + +
                  Returns:
                  @@ -320,7 +324,7 @@

                  Source:
                  @@ -348,6 +352,8 @@

                  + + @@ -455,7 +461,7 @@
                  Parameters:
                  Source:
                  @@ -478,6 +484,8 @@
                  Parameters:
                  + +
                  Returns:
                  @@ -530,8 +538,6 @@

                  globalMethods

                  -
                  Contains filter methods and mutation methods for processing JSXElements.
                  - @@ -565,7 +571,7 @@

                  globalMethods

                  Source:
                  @@ -705,7 +711,7 @@
                  Parameters:
                  Source:
                  @@ -728,6 +734,8 @@
                  Parameters:
                  + +
                  Returns:
                  @@ -815,7 +823,7 @@

                  Source:
                  @@ -843,6 +851,8 @@

                  + + @@ -950,7 +960,7 @@
                  Parameters:
                  Source:
                  @@ -973,6 +983,8 @@
                  Parameters:
                  + +
                  Returns:
                  @@ -1018,7 +1030,7 @@

                  Home

                  Modules

                  • diff --git a/docs/index.html b/docs/index.html index 36842c79..f1b70583 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,9 @@

                    -

                    jscodeshift Build Status

                    jscodeshift is a toolkit for running codemods over multiple JS files. +

                    jscodeshift Support Ukraine Build Status

                    +

                    jscodeshift is a toolkit for running codemods over multiple JavaScript or +TypeScript files. It provides:

                    • A runner, which executes the provided transform for each file passed to it. @@ -52,38 +54,97 @@

                      AST-to-AST transform tool and also tries to preserve the style of original code as much as possible.
                    -

                    Install

                    Get jscodeshift from npm:

                    -
                    $ npm install -g jscodeshift

                    This will install the runner as jscodeshift.

                    -

                    Usage (CLI)

                    The CLI provides the following options:

                    -
                    $ jscodeshift --help
                    -
                    -Usage: jscodeshift <path>... [options]
                    -
                    -path     Files or directory to transform
                    +

                    Install

                    +

                    Get jscodeshift from npm:

                    +
                    $ npm install -g jscodeshift
                    +
                    +

                    This will install the runner as jscodeshift.

                    +

                    Usage (CLI)

                    +

                    The CLI provides the following options:

                    +
                    $ jscodeshift --help
                    +
                    +Usage: jscodeshift [OPTION]... PATH...
                    +  or:  jscodeshift [OPTION]... -t TRANSFORM_PATH PATH...
                    +  or:  jscodeshift [OPTION]... -t URL PATH...
                    +  or:  jscodeshift [OPTION]... --stdin < file_list.txt
                    +
                    +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)  [babel]
                    -   --version                   print version and exit

                    This passes the source of all passed through the transform module specified +"..." 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 + --fail-on-error return a 1 exit code when errors were found during execution of codemods +

                    +

                    This passes the source of all passed through the transform module specified with -t or --transform (defaults to transform.js in the current directory). The next section explains the structure of the transform module.

                    -

                    Transform module

                    The transform is simply a module that exports a function of the form:

                    +

                    Usage (JS)

                    +
                    const {run: jscodeshift} = require('jscodeshift/src/Runner')
                    +
                    +const transformPath = 'transform.js'
                    +const paths = ['foo.js', 'bar']
                    +const options = {
                    +  dry: true,
                    +  print: true,
                    +  verbose: 1,
                    +  // ...
                    +}
                    +
                    +const res = await jscodeshift(transformPath, paths, options)
                    +console.log(res)
                    +/*
                    +{
                    +  stats: {},
                    +  timeElapsed: '0.001',
                    +  error: 0,
                    +  ok: 0,
                    +  nochange: 0,
                    +  skip: 0
                    +}
                    +*/
                    +
                    +

                    Transform module

                    +

                    The transform is simply a module that exports a function of the form:

                    module.exports = function(fileInfo, api, options) {
                       // transform `fileInfo.source` here
                       // ...
                       // return changed source
                       return source;
                    -};

                    Arguments

                    fileInfo

                    Holds information about the currently processed file.

                    +}; +

            +

            As of v0.6.1, this module can also be written in TypeScript.

            +

            Arguments

            +

            fileInfo

            +

            Holds information about the currently processed file.

            @@ -102,7 +163,8 @@

            Transform module

            The transform is simply a module that exports a func

            -

            api

            This object exposes the jscodeshift library and helper functions from the +

            api

            +

            This object exposes the jscodeshift library and helper functions from the runner.

            @@ -120,6 +182,10 @@

            api

            This object exposes the jscodeshift lib

            + + + +
            stats A function to collect statistics during --dry runs
            reportPrints the passed string to stdout

            jscodeshift is a reference to the wrapper around recast and provides a @@ -133,18 +199,27 @@

            api

            This object exposes the jscodeshift lib .findVariableDeclarators('foo') .renameTo('bar') .toSource(); -}

    Note: This API is exposed for convenience, but you don't have to use it. +} + +

    Note: This API is exposed for convenience, but you don't have to use it. You can use any tool to modify the source.

    stats is a function that only works when the --dry options is set. It accepts a string, and will simply count how often it was called with that value.

    At the end, the CLI will report those values. This can be useful while developing the transform, e.g. to find out how often a certain construct appears in the source(s).

    -

    options

    Contains all options that have been passed to runner. This allows you to pass +

    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

    +

    Contains all options that have been passed to runner. This allows you to pass additional options to the transform. For example, if the CLI is called with

    -
    $ jscodeshift -t myTransforms fileA fileB --foo=bar

    options would contain {foo: 'bar'}. jscodeshift uses nomnom to parse -command line options.

    -

    Return value

    The return value of the function determines the status of the transformation:

    +
    $ jscodeshift -t myTransforms fileA fileB --foo=bar
    +
    +

    options would contain {foo: 'bar'}.

    +

    Return value

    +

    The return value of the function determines the status of the transformation:

    • If a string is returned and it is different from passed source, the transform is considered to be successful.
    • @@ -156,11 +231,12 @@

      Return value

      The return value of the function determines the status o

      The CLI provides a summary of the transformation at the end. You can get more detailed information by setting the -v option to 1 or 2.

      You can collect even more stats via the stats function as explained above.

      -

      Parser

      The transform can let jscodeshift know with which parser to parse the source +

      Parser

      +

      The transform can let jscodeshift know with which parser to parse the source files (and features like templates).

      -

      To do that, the transform module can export parser, which can either be one -of the strings "babel", "babylon", or "flow", or it can be a parser -object that is compatible with recast.

      +

      To do that, the transform module can export parser, which can either be one +of the strings "babel", "babylon", "flow", "ts", or "tsx", +or it can be a parser object that is compatible with recast.

      For example:

      module.exports.parser = 'flow'; // use the flow parser
       // or
      @@ -168,14 +244,22 @@ 

      Parser

      The transform can let jscodeshift know with which parser to pa parse: function(source) { // return estree compatible AST }, -};

      Example output

      $ jscodeshift -t myTransform.js src
      +};
      +
      +

      Example output

      +
      $ jscodeshift -t myTransform.js src
       Processing 10 files...
       Spawning 2 workers with 5 files each...
       All workers done.
      -Results: 0 errors 2 unmodified 3 skipped 5 ok

      The jscodeshift API

      As already mentioned, jscodeshift also provides a wrapper around recast. +Results: 0 errors 2 unmodified 3 skipped 5 ok + +

      The jscodeshift API

      +

      As already mentioned, jscodeshift also provides a wrapper around recast. In order to properly use the jscodeshift API, one has to understand the basic building blocks of recast (and ASTs) as well.

      -

      Core Concepts

      AST nodes

      An AST node is a plain JavaScript object with a specific set of fields, in +

      Core Concepts

      +

      AST nodes

      +

      An AST node is a plain JavaScript object with a specific set of fields, in accordance with the Mozilla Parser API. The primary way to identify nodes is via their type.

      For example, string literals are represented via Literal nodes, which @@ -185,10 +269,13 @@

      Core Concepts

      AST nodes

      An AST node is a plain JavaScript obj type: 'Literal', value: 'foo', raw: '"foo"' -}

      It's OK to not know the structure of every AST node type. +} + +

      It's OK to not know the structure of every AST node type. The (esprima) AST explorer is an online tool to inspect the AST for a given piece of JS code.

      -

      Path objects

      Recast itself relies heavily on ast-types which defines methods to traverse +

      Path objects

      +

      Recast itself relies heavily on ast-types which defines methods to traverse the AST, access node fields and build new nodes. ast-types wraps every AST node into a path object. Paths contain meta-information and helper methods to process AST nodes.

      @@ -197,7 +284,8 @@

      Path objects

      Recast itself relies heavily on ast-types.

      -

      Builders

      To make creating AST nodes a bit simpler and "safer", ast-types defines a couple +

      Builders

      +

      To make creating AST nodes a bit simpler and "safer", ast-types defines a couple of builder methods, which are also exposed on jscodeshift.

      For example, the following creates an AST equivalent to foo(bar):

      // inside a module transform
      @@ -206,9 +294,12 @@ 

      Builders

      To make creating AST nodes a bit simpler and "safer&quo var ast = j.callExpression( j.identifier('foo'), [j.identifier('bar')] -);

      The signature of each builder function is best learned by having a look at the +); + +

      The signature of each builder function is best learned by having a look at the definition files.

      -

      Collections and Traversal

      In order to transform the AST, you have to traverse it and find the nodes that +

      Collections and Traversal

      +

      In order to transform the AST, you have to traverse it and find the nodes that need to be changed. jscodeshift is built around the idea of collections of paths and thus provides a different way of processing an AST than recast or ast-types.

      @@ -235,9 +326,12 @@

      Collections and Traversal

      In order to transform the AST, you have to .find(jscodeshift.Identifier) .forEach(function(path) { // do something with path - });

      To learn about the provided methods, have a look at the + }); + +

      To learn about the provided methods, have a look at the Collection.js and its extensions.

      -

      Extensibility

      jscodeshift provides an API to extend collections. By moving common operators +

      Extensibility

      +

      jscodeshift provides an API to extend collections. By moving common operators into helper functions (which can be stored separately in other modules), a transform can be made more readable.

      There are two types of extensions: generic extensions and type-specific @@ -245,29 +339,38 @@

      Extensibility

      jscodeshift provides an API to extend collections. By m they typically don't access specific node data, but rather traverse the AST from the nodes in the collection. Type-specific extensions work only on specific node types and are not callable on differently typed collections.

      -

      Examples

      // Adding a method to all Identifiers
      +

      Examples

      +
      // Adding a method to all Identifiers
       jscodeshift.registerMethods({
      -    logNames: function() {
      -        return this.forEach(function(path) {
      -            console.log(path.node.name);
      -        });
      -    }
      +  logNames: function() {
      +    return this.forEach(function(path) {
      +      console.log(path.node.name);
      +    });
      +  }
       }, jscodeshift.Identifier);
       
       // Adding a method to all collections
       jscodeshift.registerMethods({
      -    findIdentifiers: function() {
      -        return this.find(jscodeshift.Identifier);
      -    }
      +  findIdentifiers: function() {
      +    return this.find(jscodeshift.Identifier);
      +  }
       });
       
       jscodeshift(ast).findIdentifiers().logNames();
      -jscodeshift(ast).logNames(); // error, unless `ast` only consists of Identifier nodes

      Passing options to recast

      You may want to change some of the output settings (like setting ' instead of "). +jscodeshift(ast).logNames(); // error, unless `ast` only consists of Identifier nodes +

      +

      Passing options to recast

      +

      You may want to change some of the output settings (like setting ' instead of "). This can be done by passing config options to recast.

      -
      .toSource({quote: 'single'}); // sets strings to use single quotes in transformed code.

      You can also pass options to recast's parse method by passing an object to +

      .toSource({quote: 'single'}); // sets strings to use single quotes in transformed code.
      +
      +

      You can also pass options to recast's parse method by passing an object to jscodeshift as second argument:

      -
      jscodeshift(source, {...})

      More on config options here

      -

      Unit Testing

      jscodeshift comes with a simple utility to allow easy unit testing with Jest, without having to write a lot of boilerplate code. This utility makes some assumptions in order to reduce the amount of configuration required:

      +
      jscodeshift(source, {...})
      +
      +

      More on config options here

      +

      Unit Testing

      +

      jscodeshift comes with a simple utility to allow easy unit testing with Jest, without having to write a lot of boilerplate code. This utility makes some assumptions in order to reduce the amount of configuration required:

      • The test is located in a subdirectory under the directory the transform itself is located in (eg. __tests__)
      • Test fixtures are located in a __testfixtures__ directory
      • @@ -276,23 +379,85 @@

        Unit Testing

        jscodeshift comes with a simple utility to allow easy un

        /MyTransform.js
         /__tests__/MyTransform-test.js
         /__testfixtures__/MyTransform.input.js
        -/__testfixtures__/MyTransform.output.js

        To define a test, use defineTest or defineInlineTest from the testUtils module. A simple example is bundled in the sample directory.

        -

        defineTest

        jest.autoMockOff();
        +/__testfixtures__/MyTransform.output.js
        +
        +

        A simple example of unit tests is bundled in the sample directory.

        +

        The testUtils module exposes a number of useful helpers for unit testing.

        +

        defineTest

        +

        Defines a Jest/Jasmine test for a jscodeshift transform which depends on fixtures

        +
        jest.autoMockOff();
         const defineTest = require('jscodeshift/dist/testUtils').defineTest;
        -defineTest(__dirname, 'MyTransform');

        An alternate fixture filename can be provided as the fourth argument to defineTest. This also means that multiple test fixtures can be provided:

        +defineTest(__dirname, 'MyTransform'); + +

        An alternate fixture filename can be provided as the fourth argument to defineTest. +This also means that multiple test fixtures can be provided:

        defineTest(__dirname, 'MyTransform', null, 'FirstFixture');
        -defineTest(__dirname, 'MyTransform', null, 'SecondFixture');

        This will run two tests: One for __testfixtures__/FirstFixture.input.js and one for __testfixtures__/SecondFixture.input.js

        -

        defineInlineTest

        const transform = require('../myTransform');
        -defineInlineTest(transform, {}, 'input', 'expected output', 'test name (optional)');

        Example Codemods

          +defineTest(__dirname, 'MyTransform', null, 'SecondFixture'); + +

          This will run two tests:

          +
            +
          • __testfixtures__/FirstFixture.input.js
          • +
          • __testfixtures__/SecondFixture.input.js
          • +
          +

          defineInlineTest

          +

          Defines a Jest/Jasmine test suite for a jscodeshift transform which accepts inline values

          +

          This is a more flexible alternative to defineTest, as this allows to also provide options to your transform

          +
          const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
          +const transform = require('../myTransform');
          +const transformOptions = {};
          +defineInlineTest(transform, transformOptions, 'input', 'expected output', 'test name (optional)');
          +
          +

          defineSnapshotTest

          +

          Similar to defineInlineTest but instead of requiring an output value, it uses Jest's toMatchSnapshot()

          +
          const defineSnapshotTest = require('jscodeshift/dist/testUtils').defineSnapshotTest;
          +const transform = require('../myTransform');
          +const transformOptions = {};
          +defineSnapshotTest(transform, transformOptions, 'input', 'test name (optional)');
          +
          +

          For more information on snapshots, check out Jest's docs

          +

          defineSnapshotTestFromFixture

          +

          Similar to defineSnapshotTest but will load the file using same file-directory defaults as defineTest

          +
          const defineSnapshotTestDefault = require('jscodeshift/dist/testUtils').defineSnapshotTestDefault;
          +const transform = require('../myTransform');
          +const transformOptions = {};
          +defineSnapshotTestFromFixture(__dirname, transform, transformOptions, 'FirstFixture', 'test name (optional)');
          +
          +

          applyTransform

          +

          Executes your transform using the options and the input given and returns the result. +This function is used internally by the other helpers, but it can prove useful in other cases.

          +
          const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
          +const transform = require('../myTransform');
          +const transformOptions = {};
          +const output = applyTransform(transform, transformOptions, 'input');
          +
          +

          ES modules

          +

          If you're authoring your transforms and tests using ES modules, make sure to import the transform's parser (if specified) in your tests:

          +
          // MyTransform.js
          +export const parser = 'flow'
          +export default function MyTransform(fileInfo, api) {
          +  // ...
          +}
          +
          +
          // __tests__/MyTransform-test.js
          +import { defineInlineTest } from 'jscodeshift/dist/testUtils
          +import * as transform from '../MyTransform
          +
          +console.log(transform.parser) // 'flow'
          +
          +defineInlineTest(transform, /* ... */)
          +
          +

          Example Codemods

          +
          • react-codemod - React codemod scripts to update React APIs.
          • js-codemod - Codemod scripts to transform code to next generation JS.
          • js-transforms - Some documented codemod experiments to help you learn.
          -

          Recipes

    @@ -310,7 +475,7 @@

    Home

    Modules

    • diff --git a/docs/module-jscodeshift.html b/docs/module-jscodeshift.html index de0fc8a5..29f87fdc 100644 --- a/docs/module-jscodeshift.html +++ b/docs/module-jscodeshift.html @@ -176,7 +176,7 @@
      Parameters:
      Source:
      @@ -199,6 +199,8 @@
      Parameters:
      + +
      Returns:
      @@ -293,7 +295,7 @@
      Type:
      Source:
      @@ -428,7 +430,7 @@
      Parameters:
      Source:
      @@ -451,6 +453,8 @@
      Parameters:
      + +
      Returns:
      @@ -577,7 +581,7 @@
      Parameters:
      Source:
      @@ -605,6 +609,8 @@
      Parameters:
      + + @@ -664,7 +670,7 @@

      (static) w
      Source:
      @@ -692,6 +698,8 @@

      (static) w + + @@ -714,7 +722,7 @@

      Home

      Modules

      • diff --git a/docs/mutationMethods.html b/docs/mutationMethods.html index 5235fb5b..8a98542b 100644 --- a/docs/mutationMethods.html +++ b/docs/mutationMethods.html @@ -70,7 +70,7 @@

        mutationMethods

        Source:
        @@ -216,7 +216,7 @@
        Parameters:
        Source:
        @@ -239,6 +239,8 @@
        Parameters:
        + +
        Returns:
        @@ -375,7 +377,7 @@
        Parameters:
        Source:
        @@ -398,6 +400,8 @@
        Parameters:
        + +
        Returns:
        @@ -536,7 +540,7 @@
        Parameters:
        Source:
        @@ -559,6 +563,8 @@
        Parameters:
        + +
        Returns:
        @@ -604,7 +610,7 @@

        Home

        Modules

        • diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js index 8d52f7ea..4354785c 100644 --- a/docs/scripts/linenumber.js +++ b/docs/scripts/linenumber.js @@ -1,12 +1,12 @@ /*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; +(() => { + const source = document.getElementsByClassName('prettyprint source linenums'); + let i = 0; + let lineNumber = 0; + let lineId; + let lines; + let totalLines; + let anchorHash; if (source && source[0]) { anchorHash = document.location.hash.substring(1); @@ -15,7 +15,7 @@ for (; i < totalLines; i++) { lineNumber++; - lineId = 'line' + lineNumber; + lineId = `line${lineNumber}`; lines[i].id = lineId; if (lineId === anchorHash) { lines[i].className += ' selected'; diff --git a/docs/styles/jsdoc-default.css b/docs/styles/jsdoc-default.css index 9207bc82..7d1729dc 100644 --- a/docs/styles/jsdoc-default.css +++ b/docs/styles/jsdoc-default.css @@ -273,7 +273,7 @@ tr > th:last-child { border-right: 1px solid #ddd; } margin: 0; } -.prettyprint +.source { border: 1px solid #ddd; width: 80%; @@ -284,7 +284,7 @@ tr > th:last-child { border-right: 1px solid #ddd; } width: inherit; } -.prettyprint code +.source code { font-size: 100%; line-height: 18px; diff --git a/docs/transformMethods.html b/docs/transformMethods.html index 1bfc6209..2c7aeebb 100644 --- a/docs/transformMethods.html +++ b/docs/transformMethods.html @@ -70,7 +70,7 @@

          transformMethods

          Source:
          @@ -210,7 +210,7 @@
          Parameters:
          Source:
          @@ -233,6 +233,8 @@
          Parameters:
          + +
          Returns:
          @@ -278,7 +280,7 @@

          Home

          Modules

          • diff --git a/docs/traversalMethods.html b/docs/traversalMethods.html index 51d526d4..8324e9b0 100644 --- a/docs/traversalMethods.html +++ b/docs/traversalMethods.html @@ -70,7 +70,7 @@

            traversalMethods

            Source:
            @@ -161,7 +161,7 @@

            (static) Source:
            @@ -184,6 +184,8 @@

            (static) Returns:

            @@ -265,7 +267,7 @@

            (static) c
            Source:
            @@ -288,6 +290,8 @@

            (static) c + +

            Returns:
            @@ -435,7 +439,7 @@
            Parameters:
            Source:
            @@ -458,6 +462,8 @@
            Parameters:
            + +
            Returns:
            @@ -540,7 +546,7 @@

            (static) Source:
            @@ -563,6 +569,8 @@

            (static) Returns:

            @@ -710,7 +718,7 @@
            Parameters:
            Source:
            @@ -733,6 +741,8 @@
            Parameters:
            + +
            Returns:
            @@ -867,7 +877,7 @@
            Parameters:
            Source:
            @@ -890,6 +900,8 @@
            Parameters:
            + +
            Returns:
            @@ -975,7 +987,7 @@

            traversalMethods

            Source:
            @@ -1066,7 +1078,7 @@

            (static) Source:
            @@ -1089,6 +1101,8 @@

            (static) Returns:

            @@ -1170,7 +1184,7 @@

            (static) c
            Source:
            @@ -1193,6 +1207,8 @@

            (static) c + +

            Returns:
            @@ -1340,7 +1356,7 @@
            Parameters:
            Source:
            @@ -1363,6 +1379,8 @@
            Parameters:
            + +
            Returns:
            @@ -1445,7 +1463,7 @@

            (static) Source:
            @@ -1468,6 +1486,8 @@

            (static) Returns:

            @@ -1615,7 +1635,7 @@
            Parameters:
            Source:
            @@ -1638,6 +1658,8 @@
            Parameters:
            + +
            Returns:
            @@ -1772,7 +1794,7 @@
            Parameters:
            Source:
            @@ -1795,6 +1817,8 @@
            Parameters:
            + +
            Returns:
            @@ -1840,7 +1864,7 @@

            Home

            Modules

            • diff --git a/package.json b/package.json index e7fdb988..39a3437a 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "babel-eslint": "^10.0.1", "eslint": "^5.9.0", "jest": "^26", - "jsdoc": "^3.4.0", + "jsdoc": "3.6.7", "mkdirp": "^0.5.1" }, "jest": { diff --git a/yarn.lock b/yarn.lock index 8612d9f2..66a060f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -407,6 +407,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.16.tgz#0f18179b0448e6939b1f3f5c4c355a3a9bcdfd37" integrity sha512-6bAg36mCwuqLO0hbR+z7PHuqWiCeP7Dzg73OpQwsAB1Eb8HnGEz5xYBzCfbu+YjoaJsJs+qheDxVAuqbt3ILEw== +"@babel/parser@^7.9.4": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.9.tgz#9c94189a6062f0291418ca021077983058e171ef" + integrity sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg== + "@babel/plugin-proposal-class-properties@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.13.0.tgz#146376000b94efd001e57a40a88a525afaab9f37" @@ -1271,11 +1276,6 @@ babel-preset-jest@^26.6.2: babel-plugin-jest-hoist "^26.6.2" babel-preset-current-node-syntax "^1.0.0" -babylon@7.0.0-beta.19: - version "7.0.0-beta.19" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.19.tgz#e928c7e807e970e0536b078ab3e0c48f9e052503" - integrity sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A== - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -1294,10 +1294,10 @@ base@^0.11.1: mixin-deep "^1.2.0" pascalcase "^0.1.1" -bluebird@~3.5.0: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" - integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== brace-expansion@^1.1.7: version "1.1.11" @@ -1400,12 +1400,12 @@ capture-exit@^2.0.0: dependencies: rsvp "^4.8.4" -catharsis@~0.8.9: - version "0.8.9" - resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.8.9.tgz#98cc890ca652dd2ef0e70b37925310ff9e90fc8b" - integrity sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is= +catharsis@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121" + integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A== dependencies: - underscore-contrib "~0.3.0" + lodash "^4.17.15" chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: version "2.4.2" @@ -1758,6 +1758,11 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" +entities@~2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" + integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -1770,7 +1775,7 @@ escalade@^3.1.1: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-string-regexp@^1.0.5, escape-string-regexp@~1.0.5: +escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2223,11 +2228,16 @@ globals@^11.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -graceful-fs@^4.1.11, graceful-fs@^4.1.9, graceful-fs@^4.2.4: +graceful-fs@^4.1.11, graceful-fs@^4.2.4: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +graceful-fs@^4.1.9: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" @@ -3016,30 +3026,32 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js2xmlparser@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-3.0.0.tgz#3fb60eaa089c5440f9319f51760ccd07e2499733" - integrity sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM= - dependencies: - xmlcreate "^1.0.1" - -jsdoc@^3.4.0: - version "3.5.5" - resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-3.5.5.tgz#484521b126e81904d632ff83ec9aaa096708fa4d" - integrity sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg== - dependencies: - babylon "7.0.0-beta.19" - bluebird "~3.5.0" - catharsis "~0.8.9" - escape-string-regexp "~1.0.5" - js2xmlparser "~3.0.0" - klaw "~2.0.0" - marked "~0.3.6" - mkdirp "~0.5.1" - requizzle "~0.2.1" - strip-json-comments "~2.0.1" +js2xmlparser@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a" + integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA== + dependencies: + xmlcreate "^2.0.4" + +jsdoc@3.6.7: + version "3.6.7" + resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-3.6.7.tgz#00431e376bed7f9de4716c6f15caa80e64492b89" + integrity sha512-sxKt7h0vzCd+3Y81Ey2qinupL6DpRSZJclS04ugHDNmRUXGzqicMJ6iwayhSA0S0DwwX30c5ozyUthr1QKF6uw== + dependencies: + "@babel/parser" "^7.9.4" + bluebird "^3.7.2" + catharsis "^0.9.0" + escape-string-regexp "^2.0.0" + js2xmlparser "^4.0.1" + klaw "^3.0.0" + markdown-it "^10.0.0" + markdown-it-anchor "^5.2.7" + marked "^2.0.3" + mkdirp "^1.0.4" + requizzle "^0.2.3" + strip-json-comments "^3.1.0" taffydb "2.6.2" - underscore "~1.8.3" + underscore "~1.13.1" jsdom@^16.4.0: version "16.7.0" @@ -3125,10 +3137,10 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== -klaw@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-2.0.0.tgz#59c128e0dc5ce410201151194eeb9cbf858650f6" - integrity sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY= +klaw@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146" + integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g== dependencies: graceful-fs "^4.1.9" @@ -3155,6 +3167,13 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +linkify-it@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" + integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== + dependencies: + uc.micro "^1.0.1" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -3170,7 +3189,7 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.7.0: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.7.0: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3223,10 +3242,31 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -marked@~0.3.6: - version "0.3.19" - resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" - integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg== +markdown-it-anchor@^5.2.7: + version "5.3.0" + resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz#d549acd64856a8ecd1bea58365ef385effbac744" + integrity sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA== + +markdown-it@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" + integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== + dependencies: + argparse "^1.0.7" + entities "~2.0.0" + linkify-it "^2.0.0" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +marked@^2.0.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/marked/-/marked-2.1.3.tgz#bd017cef6431724fd4b27e0657f5ceb14bff3753" + integrity sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA== + +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= merge-stream@^2.0.0: version "2.0.0" @@ -3310,13 +3350,18 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@^0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -3777,12 +3822,12 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -requizzle@~0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.1.tgz#6943c3530c4d9a7e46f1cddd51c158fc670cdbde" - integrity sha1-aUPDUwxNmn5G8c3dUcFY/GcM294= +requizzle@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.3.tgz#4675c90aacafb2c036bd39ba2daa4a1cb777fded" + integrity sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ== dependencies: - underscore "~1.6.0" + lodash "^4.17.14" resolve-cwd@^3.0.0: version "3.0.0" @@ -4207,11 +4252,16 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strip-json-comments@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -4412,22 +4462,15 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -underscore-contrib@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/underscore-contrib/-/underscore-contrib-0.3.0.tgz#665b66c24783f8fa2b18c9f8cbb0e2c7d48c26c7" - integrity sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc= - dependencies: - underscore "1.6.0" - -underscore@1.6.0, underscore@~1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" - integrity sha1-izixDKze9jM3uLJOT/htRa6lKag= +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== -underscore@~1.8.3: - version "1.8.3" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022" - integrity sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI= +underscore@~1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.2.tgz#276cea1e8b9722a8dbed0100a407dda572125881" + integrity sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g== union-value@^1.0.0: version "1.0.0" @@ -4629,10 +4672,10 @@ xmlchars@^2.2.0: resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== -xmlcreate@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-1.0.2.tgz#fa6bf762a60a413fb3dd8f4b03c5b269238d308f" - integrity sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8= +xmlcreate@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be" + integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg== y18n@^4.0.0: version "4.0.3"