@mutates/core 0.2.0 → 1.0.0
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/package.json +1 -1
- package/src/lib/imports/index.d.ts +2 -0
- package/src/lib/imports/index.js +2 -0
- package/src/lib/imports/index.js.map +1 -1
- package/src/lib/utils/helpers/get-declaration-editor.js +5 -3
- package/src/lib/utils/helpers/get-declaration-editor.js.map +1 -1
- package/src/lib/utils/types/structure-editor.d.ts +1 -1
package/package.json
CHANGED
package/src/lib/imports/index.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./add-imports"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./edit-imports"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./get-import-refs"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./get-imports"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./get-named-imports"), exports);
|
|
7
9
|
tslib_1.__exportStar(require("./remove-imports"), exports);
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/imports/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B;AAC/B,wDAA8B;AAC9B,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/imports/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B;AAC/B,4DAAkC;AAClC,wDAA8B;AAC9B,8DAAoC;AACpC,2DAAiC"}
|
|
@@ -6,11 +6,13 @@ const utils_1 = require("../../utils");
|
|
|
6
6
|
function getDeclarationEditor() {
|
|
7
7
|
return function editDeclarations(declarations, editor) {
|
|
8
8
|
(0, utils_1.coerceArray)(declarations).forEach((declaration) => {
|
|
9
|
-
const newStructure = Object.assign({}, declaration.getStructure(),
|
|
10
|
-
// TODO: refactor it to support new typings
|
|
11
9
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
10
|
// @ts-ignore
|
|
13
|
-
editor(declaration.getStructure(), declaration)
|
|
11
|
+
const result = editor(declaration.getStructure(), declaration);
|
|
12
|
+
if (!result) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const newStructure = Object.assign({}, declaration.getStructure(), result);
|
|
14
16
|
// todo: see https://github.com/dsherret/ts-morph/issues/882
|
|
15
17
|
// if the issue is resolved code will be remove
|
|
16
18
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-declaration-editor.js","sourceRoot":"","sources":["../../../../../../../packages/core/src/lib/utils/helpers/get-declaration-editor.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAG3C,uCAA0C;AAK1C,SAAgB,oBAAoB;IAIlC,OAAO,SAAS,gBAAgB,CAC9B,YAAyC,EACzC,MAA8D;QAE9D,IAAA,mBAAW,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YAChD,MAAM,
|
|
1
|
+
{"version":3,"file":"get-declaration-editor.js","sourceRoot":"","sources":["../../../../../../../packages/core/src/lib/utils/helpers/get-declaration-editor.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAG3C,uCAA0C;AAK1C,SAAgB,oBAAoB;IAIlC,OAAO,SAAS,gBAAgB,CAC9B,YAAyC,EACzC,MAA8D;QAE9D,IAAA,mBAAW,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YAChD,6DAA6D;YAC7D,aAAa;YACb,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,EAAE,WAAW,CAAC,CAAC;YAE/D,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,CAAe,CAAC;YAEzF,4DAA4D;YAC5D,+CAA+C;YAC/C,6DAA6D;YAC7D,mBAAmB;YACnB,IAAI,oBAAS,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,eAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;gBACtE,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBACtC,6DAA6D;gBAC7D,kBAAkB;gBAClB,OAAO,YAAY,CAAC,IAAI,CAAC;YAC3B,CAAC;YAED,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAjCD,oDAiCC"}
|
|
@@ -2,4 +2,4 @@ import type { FilterPrimitive } from '../types/filter-primitive';
|
|
|
2
2
|
import type { StructureType } from '../types/structure-type';
|
|
3
3
|
import type { StructuredStatement } from '../types/structured-statement';
|
|
4
4
|
import { OptionalKind } from './optional-kind';
|
|
5
|
-
export type StructureEditor<Declaration extends StructuredStatement<Declaration>, Structure extends OptionalKind<StructureType<Declaration>> = OptionalKind<StructureType<Declaration>>, UpdatableData extends FilterPrimitive<Structure> = FilterPrimitive<Structure>> = (structure: Structure, declaration: Declaration) => Partial<UpdatableData
|
|
5
|
+
export type StructureEditor<Declaration extends StructuredStatement<Declaration>, Structure extends OptionalKind<StructureType<Declaration>> = OptionalKind<StructureType<Declaration>>, UpdatableData extends FilterPrimitive<Structure> = FilterPrimitive<Structure>> = (structure: Structure, declaration: Declaration) => Partial<UpdatableData> | void;
|