@atlaskit/codemod-utils 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/codemod-utils
|
|
2
2
|
|
|
3
|
+
## 4.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9358d42eeaa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9358d42eeaa) - NO-ISSUE: fixed codemod utils tryCreateImport() and addToImport() causing multiple insert in certain scenarios
|
|
8
|
+
|
|
3
9
|
## 4.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -297,13 +297,13 @@ function tryCreateImport(j, base, relativeToPackage, packageName) {
|
|
|
297
297
|
|
|
298
298
|
base.find(j.ImportDeclaration).filter(function (path) {
|
|
299
299
|
return path.value.source.value === relativeToPackage;
|
|
300
|
-
}).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
300
|
+
}).at(0).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
function addToImport(j, base, importSpecifier, packageName) {
|
|
304
304
|
base.find(j.ImportDeclaration).filter(function (path) {
|
|
305
305
|
return path.value.source.value === packageName;
|
|
306
|
-
}).replaceWith(function (declaration) {
|
|
306
|
+
}).at(0).replaceWith(function (declaration) {
|
|
307
307
|
return j.importDeclaration([].concat((0, _toConsumableArray2.default)((declaration.value.specifiers || []).filter(function (item) {
|
|
308
308
|
return item.type === 'ImportSpecifier' && item.imported != null;
|
|
309
309
|
})), [importSpecifier]), j.literal(packageName));
|
package/dist/cjs/version.json
CHANGED
|
@@ -222,11 +222,11 @@ function tryCreateImport(j, base, relativeToPackage, packageName) {
|
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
base.find(j.ImportDeclaration).filter(path => path.value.source.value === relativeToPackage).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
225
|
+
base.find(j.ImportDeclaration).filter(path => path.value.source.value === relativeToPackage).at(0).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function addToImport(j, base, importSpecifier, packageName) {
|
|
229
|
-
base.find(j.ImportDeclaration).filter(path => path.value.source.value === packageName).replaceWith(declaration => {
|
|
229
|
+
base.find(j.ImportDeclaration).filter(path => path.value.source.value === packageName).at(0).replaceWith(declaration => {
|
|
230
230
|
return j.importDeclaration([// we are appending to the existing specifiers
|
|
231
231
|
// We are doing a filter hear because sometimes specifiers can be removed
|
|
232
232
|
// but they hand around in the declaration
|
package/dist/es2019/version.json
CHANGED
|
@@ -252,13 +252,13 @@ function tryCreateImport(j, base, relativeToPackage, packageName) {
|
|
|
252
252
|
|
|
253
253
|
base.find(j.ImportDeclaration).filter(function (path) {
|
|
254
254
|
return path.value.source.value === relativeToPackage;
|
|
255
|
-
}).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
255
|
+
}).at(0).insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
function addToImport(j, base, importSpecifier, packageName) {
|
|
259
259
|
base.find(j.ImportDeclaration).filter(function (path) {
|
|
260
260
|
return path.value.source.value === packageName;
|
|
261
|
-
}).replaceWith(function (declaration) {
|
|
261
|
+
}).at(0).replaceWith(function (declaration) {
|
|
262
262
|
return j.importDeclaration([].concat(_toConsumableArray((declaration.value.specifiers || []).filter(function (item) {
|
|
263
263
|
return item.type === 'ImportSpecifier' && item.imported != null;
|
|
264
264
|
})), [importSpecifier]), j.literal(packageName));
|
package/dist/esm/version.json
CHANGED