@vkontakte/vkui-codemods 1.0.2 → 1.1.0-beta.1
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/README.md +1 -1
- package/dist/cli.js +2 -1
- package/dist/testHelpers/testHelper.js +81 -3
- package/dist/transforms/v8/alert.js +19 -0
- package/dist/transforms/v8/checkbox.js +41 -0
- package/dist/transforms/v8/chips-input.js +39 -0
- package/dist/transforms/v8/chips-select.js +39 -0
- package/dist/transforms/v8/common/moveAllPropsIntoSlotProp.js +23 -0
- package/dist/transforms/v8/common/moveInputPropsIntoSlotProps.js +56 -0
- package/dist/transforms/v8/common/movePropIntoSlotProps.js +197 -0
- package/dist/transforms/v8/custom-select.js +65 -0
- package/dist/transforms/v8/file.js +50 -0
- package/dist/transforms/v8/input.js +57 -0
- package/dist/transforms/v8/native-select.js +40 -0
- package/dist/transforms/v8/popout-wrapper.js +67 -0
- package/dist/transforms/v8/radio.js +47 -0
- package/dist/transforms/v8/rich-cell.js +50 -0
- package/dist/transforms/v8/search.js +53 -0
- package/dist/transforms/v8/select.js +53 -0
- package/dist/transforms/v8/snackbar.js +19 -0
- package/dist/transforms/v8/split-layout.js +40 -0
- package/dist/transforms/v8/switch.js +39 -0
- package/dist/transforms/v8/text-area.js +51 -0
- package/dist/transforms/v8/write-bar.js +51 -0
- package/package.json +8 -10
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Options:
|
|
|
34
34
|
-V, --version output the version number
|
|
35
35
|
-l --list list available codemods
|
|
36
36
|
--all apply all available codemods
|
|
37
|
-
--tv, --transforms-version <transformsVersion> vkui major version transforms (available versions: "6", "7")
|
|
37
|
+
--tv, --transforms-version <transformsVersion> vkui major version transforms (available versions: "6", "7", "8")
|
|
38
38
|
-p --path [paths...] file paths where codemods need to apply (space separated list), default: current
|
|
39
39
|
directory
|
|
40
40
|
--input-file <file> apply codemods only to file/directory listed in the file
|
package/dist/cli.js
CHANGED
|
@@ -83,6 +83,7 @@ var promptTransformVersions = function () { return __awaiter(void 0, void 0, voi
|
|
|
83
83
|
choices: [
|
|
84
84
|
{ title: 'v6', value: '6' },
|
|
85
85
|
{ title: 'v7', value: '7' },
|
|
86
|
+
{ title: 'v8', value: '8' },
|
|
86
87
|
],
|
|
87
88
|
}, {
|
|
88
89
|
onCancel: function () {
|
|
@@ -106,7 +107,7 @@ var runCli = function () { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
106
107
|
.usage("".concat(chalk_1.default.green('[codemod-names...]')))
|
|
107
108
|
.option('-l --list', 'list available codemods')
|
|
108
109
|
.option('--all', 'apply all available codemods')
|
|
109
|
-
.option('--tv, --transforms-version <transformsVersion>', 'vkui major version transforms (available versions: "6", "7")')
|
|
110
|
+
.option('--tv, --transforms-version <transformsVersion>', 'vkui major version transforms (available versions: "6", "7", "8")')
|
|
110
111
|
.option('-p --path [paths...]', 'file paths where codemods need to apply (space separated list), default: current directory')
|
|
111
112
|
.option('--input-file <file>', 'apply codemods only to file/directory listed in the file')
|
|
112
113
|
.option('--log-file <file>', 'log migration instructions with required manual changes to the file instead of the console')
|
|
@@ -1,4 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
+
function step(op) {
|
|
49
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
+
switch (op[0]) {
|
|
54
|
+
case 0: case 1: t = op; break;
|
|
55
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
+
default:
|
|
59
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
+
if (t[2]) _.ops.pop();
|
|
64
|
+
_.trys.pop(); continue;
|
|
65
|
+
}
|
|
66
|
+
op = body.call(thisArg, _);
|
|
67
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
2
71
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
72
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
73
|
};
|
|
@@ -22,7 +91,16 @@ function getTestFixturesInputPath(dirName, testFilePrefix, extension) {
|
|
|
22
91
|
* Избавляемся от необходимости в тестах постоянно указывать `module`
|
|
23
92
|
*/
|
|
24
93
|
function defineSnapshotTestFromFixture(dirName, transformName, options, testFilePrefix) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var module;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0: return [4 /*yield*/, Promise.resolve("".concat(path_1.default.join(dirName, '..', transformName) + '.ts')).then(function (s) { return __importStar(require(s)); })];
|
|
99
|
+
case 1:
|
|
100
|
+
module = _a.sent();
|
|
101
|
+
(0, testUtils_1.defineSnapshotTestFromFixture)(dirName, module, options, testFilePrefix, 'transforms correctly', { parser: 'tsx' });
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
28
106
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
exports.parser = 'tsx';
|
|
7
|
+
function transformer(file, api, options) {
|
|
8
|
+
var alias = options.alias;
|
|
9
|
+
var j = api.jscodeshift;
|
|
10
|
+
var source = j(file.source);
|
|
11
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Alert', alias).localName;
|
|
12
|
+
if (!localName) {
|
|
13
|
+
return source.toSource();
|
|
14
|
+
}
|
|
15
|
+
(0, codemod_helpers_1.renameProp)(j, source, localName, {
|
|
16
|
+
onClose: 'onClosed',
|
|
17
|
+
});
|
|
18
|
+
return source.toSource();
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Checkbox', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
[localName, "".concat(localName, ".Input")].forEach(function (componentName) {
|
|
16
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
17
|
+
root: source,
|
|
18
|
+
componentName: componentName,
|
|
19
|
+
propName: 'getRef',
|
|
20
|
+
slotName: 'input',
|
|
21
|
+
slotPropName: 'getRootRef',
|
|
22
|
+
});
|
|
23
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
24
|
+
root: source,
|
|
25
|
+
componentName: componentName,
|
|
26
|
+
slotName: 'input',
|
|
27
|
+
});
|
|
28
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
29
|
+
root: source,
|
|
30
|
+
componentName: componentName,
|
|
31
|
+
slotName: 'input',
|
|
32
|
+
});
|
|
33
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
34
|
+
root: source,
|
|
35
|
+
componentName: componentName,
|
|
36
|
+
excludedProps: ['checked', 'disabled', 'readOnly', 'required', 'name', 'value', 'form'],
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return source.toSource();
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'ChipsInput', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
excludedProps: ['disabled', 'readOnly', 'placeholder', 'value'],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return source.toSource();
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'ChipsSelect', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
excludedProps: ['disabled', 'readOnly', 'placeholder', 'value'],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return source.toSource();
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.moveAllPropsIntoSlotProp = moveAllPropsIntoSlotProp;
|
|
13
|
+
var movePropIntoSlotProps_1 = require("./movePropIntoSlotProps");
|
|
14
|
+
function moveAllPropsIntoSlotProp(j, _a) {
|
|
15
|
+
var root = _a.root, componentName = _a.componentName, slotName = _a.slotName, excludedProps = _a.excludedProps;
|
|
16
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
17
|
+
root: root,
|
|
18
|
+
componentName: componentName,
|
|
19
|
+
slotName: slotName,
|
|
20
|
+
propName: /.+/,
|
|
21
|
+
excludedProps: __spreadArray(__spreadArray([], (excludedProps || []), true), ['slotProps'], false),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moveInputPropsIntoSlotProps = moveInputPropsIntoSlotProps;
|
|
4
|
+
var movePropIntoSlotProps_1 = require("./movePropIntoSlotProps");
|
|
5
|
+
var INPUT_SPECIFIC_PROPS = [
|
|
6
|
+
'accept',
|
|
7
|
+
'alt',
|
|
8
|
+
'autoComplete',
|
|
9
|
+
'capture',
|
|
10
|
+
'checked',
|
|
11
|
+
'disabled',
|
|
12
|
+
'form',
|
|
13
|
+
'formAction',
|
|
14
|
+
'formEncType',
|
|
15
|
+
'formMethod',
|
|
16
|
+
'formNoValidate',
|
|
17
|
+
'formTarget',
|
|
18
|
+
'height',
|
|
19
|
+
'list',
|
|
20
|
+
'max',
|
|
21
|
+
'maxLength',
|
|
22
|
+
'min',
|
|
23
|
+
'minLength',
|
|
24
|
+
'multiple',
|
|
25
|
+
'name',
|
|
26
|
+
'pattern',
|
|
27
|
+
'placeholder',
|
|
28
|
+
'readOnly',
|
|
29
|
+
'required',
|
|
30
|
+
'size',
|
|
31
|
+
'src',
|
|
32
|
+
'step',
|
|
33
|
+
'type',
|
|
34
|
+
'value',
|
|
35
|
+
'width',
|
|
36
|
+
'onInput',
|
|
37
|
+
'onInputCapture',
|
|
38
|
+
'onClick',
|
|
39
|
+
'onClickCapture',
|
|
40
|
+
'onPaste',
|
|
41
|
+
'onPasteCapture',
|
|
42
|
+
'onKeyDown',
|
|
43
|
+
'onKeyDownCapture',
|
|
44
|
+
'onKeyUp',
|
|
45
|
+
'onKeyUpCapture',
|
|
46
|
+
];
|
|
47
|
+
function moveInputPropsIntoSlotProps(j, _a) {
|
|
48
|
+
var root = _a.root, componentName = _a.componentName, excludedProps = _a.excludedProps, _b = _a.slotName, slotName = _b === void 0 ? 'input' : _b;
|
|
49
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
50
|
+
root: root,
|
|
51
|
+
componentName: componentName,
|
|
52
|
+
propName: INPUT_SPECIFIC_PROPS,
|
|
53
|
+
excludedProps: excludedProps,
|
|
54
|
+
slotName: slotName,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.movePropIntoSlotProps = movePropIntoSlotProps;
|
|
13
|
+
exports.moveDataAttrsIntoSlotProps = moveDataAttrsIntoSlotProps;
|
|
14
|
+
exports.moveAriaAttrsIntoSlotProps = moveAriaAttrsIntoSlotProps;
|
|
15
|
+
function assignObject(j, options) {
|
|
16
|
+
var target = options.target, expression = options.expression, key = options.key;
|
|
17
|
+
if (target && target.type === 'JSXAttribute') {
|
|
18
|
+
var expContainer = target.value;
|
|
19
|
+
if (expContainer.expression.type === 'ObjectExpression') {
|
|
20
|
+
// case `<prop>={{ ... }}`
|
|
21
|
+
expContainer.expression.properties.push(j.objectProperty(j.identifier(key), expression));
|
|
22
|
+
}
|
|
23
|
+
else if (expContainer.expression.type === 'Identifier') {
|
|
24
|
+
// case `<prop>={outerVariable}
|
|
25
|
+
expContainer.expression = j.objectExpression([
|
|
26
|
+
j.spreadElement(j.identifier(expContainer.expression.name)),
|
|
27
|
+
j.objectProperty(j.identifier(key), expression),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function appendAttribute(j, options) {
|
|
33
|
+
var _a;
|
|
34
|
+
var target = options.target, attributeName = options.attributeName, expression = options.expression;
|
|
35
|
+
(_a = target.openingElement.attributes) === null || _a === void 0 ? void 0 : _a.push(j.jsxAttribute(j.jsxIdentifier(attributeName), j.jsxExpressionContainer(expression)));
|
|
36
|
+
}
|
|
37
|
+
function findComponentJSX(j, root, componentName, callback) {
|
|
38
|
+
var _a = componentName.split('.'), component = _a[0], subcomponent = _a[1];
|
|
39
|
+
if (subcomponent) {
|
|
40
|
+
root
|
|
41
|
+
.find(j.JSXElement, {
|
|
42
|
+
openingElement: {
|
|
43
|
+
name: {
|
|
44
|
+
type: 'JSXMemberExpression',
|
|
45
|
+
object: { name: component },
|
|
46
|
+
property: { name: subcomponent },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
.forEach(callback);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
root.find(j.JSXElement, { openingElement: { name: { name: component } } }).forEach(callback);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function moveJsxPropIntoSlotProps(j, element, propName, slotName, slotPropName) {
|
|
57
|
+
var attributes = element.openingElement.attributes;
|
|
58
|
+
var propIndex = attributes === null || attributes === void 0 ? void 0 : attributes.findIndex(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === propName; });
|
|
59
|
+
if (!attributes || propIndex === -1 || propIndex === undefined) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var removedAttr = attributes === null || attributes === void 0 ? void 0 : attributes.splice(propIndex, 1)[0];
|
|
63
|
+
if ((removedAttr === null || removedAttr === void 0 ? void 0 : removedAttr.type) !== 'JSXAttribute') {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var removedValue = (function () {
|
|
67
|
+
if (!(removedAttr === null || removedAttr === void 0 ? void 0 : removedAttr.value)) {
|
|
68
|
+
return j.literal(true);
|
|
69
|
+
}
|
|
70
|
+
switch (removedAttr.value.type) {
|
|
71
|
+
case 'StringLiteral':
|
|
72
|
+
return j.literal(removedAttr.value.value);
|
|
73
|
+
case 'JSXExpressionContainer':
|
|
74
|
+
return removedAttr.value.expression;
|
|
75
|
+
default:
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
})();
|
|
79
|
+
if (removedValue === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
var getSlotPropNameLiteral = function (name) {
|
|
83
|
+
return name.includes('-') ? j.stringLiteral(name) : j.identifier(name);
|
|
84
|
+
};
|
|
85
|
+
var hasSlotProps = false;
|
|
86
|
+
attributes.forEach(function (attr) {
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
if (attr.type === 'JSXAttribute' &&
|
|
89
|
+
((_a = attr.name) === null || _a === void 0 ? void 0 : _a.name) === 'slotProps' &&
|
|
90
|
+
((_b = attr.value) === null || _b === void 0 ? void 0 : _b.type) === 'JSXExpressionContainer' &&
|
|
91
|
+
((_c = attr.value) === null || _c === void 0 ? void 0 : _c.expression.type) === 'ObjectExpression') {
|
|
92
|
+
hasSlotProps = true;
|
|
93
|
+
var slots = (_d = attr.value) === null || _d === void 0 ? void 0 : _d.expression;
|
|
94
|
+
var slotIndex = slots.properties.findIndex(function (prop) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
return prop.type === 'ObjectProperty' &&
|
|
97
|
+
((_a = prop === null || prop === void 0 ? void 0 : prop.key) === null || _a === void 0 ? void 0 : _a.type) === 'Identifier' &&
|
|
98
|
+
((_b = prop === null || prop === void 0 ? void 0 : prop.key) === null || _b === void 0 ? void 0 : _b.name) === slotName;
|
|
99
|
+
});
|
|
100
|
+
if (slotIndex === -1) {
|
|
101
|
+
// Создаем новый слот
|
|
102
|
+
var slotValue = slotPropName
|
|
103
|
+
? j.objectExpression([
|
|
104
|
+
j.objectProperty(getSlotPropNameLiteral(slotPropName), removedValue),
|
|
105
|
+
])
|
|
106
|
+
: removedValue;
|
|
107
|
+
assignObject(j, {
|
|
108
|
+
target: attr,
|
|
109
|
+
key: slotName,
|
|
110
|
+
expression: slotValue,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if (slots.properties[slotIndex].type === 'ObjectProperty') {
|
|
114
|
+
var property = slots.properties[slotIndex];
|
|
115
|
+
// Добавляем свойство в существующий слот
|
|
116
|
+
var existingSlot = property.value;
|
|
117
|
+
if (slotPropName) {
|
|
118
|
+
if (existingSlot.type === 'ObjectExpression') {
|
|
119
|
+
existingSlot.properties.push(j.objectProperty(getSlotPropNameLiteral(slotPropName), removedValue));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
property.value = j.objectExpression([
|
|
123
|
+
j.objectProperty(getSlotPropNameLiteral(slotPropName), removedValue),
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
property.value = j.objectExpression([
|
|
129
|
+
j.spreadElement(removedValue),
|
|
130
|
+
j.spreadElement(existingSlot),
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
if (!hasSlotProps) {
|
|
137
|
+
// Создаем slotsProps
|
|
138
|
+
var slotValue = slotPropName
|
|
139
|
+
? j.objectExpression([j.objectProperty(getSlotPropNameLiteral(slotPropName), removedValue)])
|
|
140
|
+
: removedValue;
|
|
141
|
+
appendAttribute(j, {
|
|
142
|
+
target: element,
|
|
143
|
+
attributeName: 'slotProps',
|
|
144
|
+
expression: j.objectExpression([j.objectProperty(j.identifier(slotName), slotValue)]),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function moveMultipleJsxPropsIntoSlotProps(j, element, propName, slotName, excludedProps) {
|
|
149
|
+
var attributes = element.openingElement.attributes;
|
|
150
|
+
if (!attributes) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
var checkMatch = function (attrName) {
|
|
154
|
+
return (((propName instanceof RegExp && propName.test(attrName)) ||
|
|
155
|
+
(propName instanceof Array && propName.includes(attrName))) &&
|
|
156
|
+
!(excludedProps === null || excludedProps === void 0 ? void 0 : excludedProps.includes(attrName)));
|
|
157
|
+
};
|
|
158
|
+
__spreadArray([], attributes, true).reverse()
|
|
159
|
+
.forEach(function (attr) {
|
|
160
|
+
return attr.type === 'JSXAttribute' &&
|
|
161
|
+
typeof attr.name.name === 'string' &&
|
|
162
|
+
checkMatch(attr.name.name) &&
|
|
163
|
+
moveJsxPropIntoSlotProps(j, element, attr.name.name, slotName, attr.name.name);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function moveJsxPropIntoSlotPropsByName(j, element, propName, slotName, slotPropName) {
|
|
167
|
+
moveJsxPropIntoSlotProps(j, element, propName, slotName, slotPropName);
|
|
168
|
+
}
|
|
169
|
+
function movePropIntoSlotProps(j, options) {
|
|
170
|
+
var propName = options.propName, slotName = options.slotName, slotPropName = options.slotPropName, root = options.root, componentName = options.componentName, excludedProps = options.excludedProps;
|
|
171
|
+
findComponentJSX(j, root, componentName, function (elementPath) {
|
|
172
|
+
if (typeof propName === 'string') {
|
|
173
|
+
moveJsxPropIntoSlotPropsByName(j, elementPath.node, propName, slotName, slotPropName);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
moveMultipleJsxPropsIntoSlotProps(j, elementPath.node, propName, slotName, excludedProps);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function moveDataAttrsIntoSlotProps(j, _a) {
|
|
181
|
+
var root = _a.root, componentName = _a.componentName, slotName = _a.slotName;
|
|
182
|
+
movePropIntoSlotProps(j, {
|
|
183
|
+
root: root,
|
|
184
|
+
componentName: componentName,
|
|
185
|
+
propName: /data-.+/,
|
|
186
|
+
slotName: slotName,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function moveAriaAttrsIntoSlotProps(j, _a) {
|
|
190
|
+
var root = _a.root, componentName = _a.componentName, slotName = _a.slotName;
|
|
191
|
+
movePropIntoSlotProps(j, {
|
|
192
|
+
root: root,
|
|
193
|
+
componentName: componentName,
|
|
194
|
+
propName: /aria-.+/,
|
|
195
|
+
slotName: slotName,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'CustomSelect', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'select',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
propName: 'nativeSelectTestId',
|
|
26
|
+
slotName: 'select',
|
|
27
|
+
slotPropName: 'data-testid',
|
|
28
|
+
});
|
|
29
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
30
|
+
root: source,
|
|
31
|
+
componentName: localName,
|
|
32
|
+
propName: 'getSelectInputRef',
|
|
33
|
+
slotName: 'input',
|
|
34
|
+
slotPropName: 'getRootRef',
|
|
35
|
+
});
|
|
36
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
37
|
+
root: source,
|
|
38
|
+
componentName: localName,
|
|
39
|
+
slotName: 'input',
|
|
40
|
+
});
|
|
41
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
42
|
+
root: source,
|
|
43
|
+
componentName: localName,
|
|
44
|
+
slotName: 'input',
|
|
45
|
+
});
|
|
46
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
47
|
+
root: source,
|
|
48
|
+
componentName: localName,
|
|
49
|
+
excludedProps: [
|
|
50
|
+
'disabled',
|
|
51
|
+
'readOnly',
|
|
52
|
+
'required',
|
|
53
|
+
'name',
|
|
54
|
+
'value',
|
|
55
|
+
'placeholder',
|
|
56
|
+
'minLength',
|
|
57
|
+
'maxLength',
|
|
58
|
+
'pattern',
|
|
59
|
+
'form',
|
|
60
|
+
'onClick',
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return source.toSource();
|
|
65
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'File', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
excludedProps: [
|
|
36
|
+
'disabled',
|
|
37
|
+
'readOnly',
|
|
38
|
+
'required',
|
|
39
|
+
'name',
|
|
40
|
+
'value',
|
|
41
|
+
'accept',
|
|
42
|
+
'capture',
|
|
43
|
+
'multiple',
|
|
44
|
+
'size',
|
|
45
|
+
'form',
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return source.toSource();
|
|
50
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Input', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
excludedProps: [
|
|
36
|
+
'autoComplete',
|
|
37
|
+
'disabled',
|
|
38
|
+
'list',
|
|
39
|
+
'max',
|
|
40
|
+
'maxLength',
|
|
41
|
+
'min',
|
|
42
|
+
'minLength',
|
|
43
|
+
'multiple',
|
|
44
|
+
'name',
|
|
45
|
+
'pattern',
|
|
46
|
+
'placeholder',
|
|
47
|
+
'readOnly',
|
|
48
|
+
'required',
|
|
49
|
+
'step',
|
|
50
|
+
'type',
|
|
51
|
+
'value',
|
|
52
|
+
'form',
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return source.toSource();
|
|
57
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'NativeSelect', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'select',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'select',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'select',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
slotName: 'select',
|
|
36
|
+
excludedProps: ['disabled', 'readOnly', 'required', 'name', 'value', 'placeholder'],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return source.toSource();
|
|
40
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
exports.parser = 'tsx';
|
|
7
|
+
function transformer(file, api, options) {
|
|
8
|
+
var alias = options.alias;
|
|
9
|
+
var j = api.jscodeshift;
|
|
10
|
+
var source = j(file.source);
|
|
11
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PopoutWrapper', alias).localName;
|
|
12
|
+
if (!localName) {
|
|
13
|
+
return source.toSource();
|
|
14
|
+
}
|
|
15
|
+
source
|
|
16
|
+
.find(j.JSXElement, {
|
|
17
|
+
openingElement: {
|
|
18
|
+
name: {
|
|
19
|
+
name: localName,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
.forEach(function (path) {
|
|
24
|
+
var element = path.node;
|
|
25
|
+
var attributes = element.openingElement.attributes;
|
|
26
|
+
if (!attributes) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var fixedAttribute = null;
|
|
30
|
+
var fixedValueIsFalse = false;
|
|
31
|
+
// Находим атрибут fixed
|
|
32
|
+
attributes.forEach(function (attr) {
|
|
33
|
+
if (attr.type === 'JSXAttribute' && attr.name.name === 'fixed') {
|
|
34
|
+
fixedAttribute = attr;
|
|
35
|
+
// Проверяем значение атрибута
|
|
36
|
+
if (!attr.value) {
|
|
37
|
+
// fixed без значения считается true
|
|
38
|
+
fixedValueIsFalse = false;
|
|
39
|
+
}
|
|
40
|
+
else if (attr.value.type === 'JSXExpressionContainer' &&
|
|
41
|
+
attr.value.expression.type === 'BooleanLiteral') {
|
|
42
|
+
// fixed={true} или fixed={false}
|
|
43
|
+
fixedValueIsFalse = !attr.value.expression.value;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// Сложное выражение - оставляем как есть, но удалим fixed
|
|
47
|
+
fixedValueIsFalse = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// Если нашли атрибут fixed
|
|
52
|
+
if (fixedAttribute) {
|
|
53
|
+
// Удаляем атрибут fixed
|
|
54
|
+
attributes.splice(attributes.indexOf(fixedAttribute), 1);
|
|
55
|
+
// Если fixed={false}, добавляем strategy="none"
|
|
56
|
+
if (fixedValueIsFalse) {
|
|
57
|
+
// Проверяем, нет ли уже атрибута strategy
|
|
58
|
+
var hasStrategy = attributes.some(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === 'strategy'; });
|
|
59
|
+
if (!hasStrategy) {
|
|
60
|
+
// Добавляем strategy="none"
|
|
61
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('strategy'), j.stringLiteral('none')));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return source.toSource();
|
|
67
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Radio', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'labelProps',
|
|
19
|
+
slotName: 'root',
|
|
20
|
+
});
|
|
21
|
+
[localName, "".concat(localName, ".Input")].forEach(function (componentName) {
|
|
22
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: componentName,
|
|
25
|
+
propName: 'getRef',
|
|
26
|
+
slotName: 'input',
|
|
27
|
+
slotPropName: 'getRootRef',
|
|
28
|
+
});
|
|
29
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
30
|
+
root: source,
|
|
31
|
+
componentName: componentName,
|
|
32
|
+
slotName: 'input',
|
|
33
|
+
});
|
|
34
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
35
|
+
root: source,
|
|
36
|
+
componentName: componentName,
|
|
37
|
+
slotName: 'input',
|
|
38
|
+
});
|
|
39
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
40
|
+
root: source,
|
|
41
|
+
componentName: componentName,
|
|
42
|
+
excludedProps: ['checked', 'disabled', 'readOnly', 'required', 'name', 'value', 'form'],
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return source.toSource();
|
|
47
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
exports.parser = 'tsx';
|
|
7
|
+
function transformer(file, api, options) {
|
|
8
|
+
var alias = options.alias;
|
|
9
|
+
var j = api.jscodeshift;
|
|
10
|
+
var source = j(file.source);
|
|
11
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'RichCell', alias).localName;
|
|
12
|
+
if (!localName) {
|
|
13
|
+
return source.toSource();
|
|
14
|
+
}
|
|
15
|
+
source
|
|
16
|
+
.find(j.JSXElement, {
|
|
17
|
+
openingElement: {
|
|
18
|
+
name: {
|
|
19
|
+
name: localName,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
.forEach(function (path) {
|
|
24
|
+
var element = path.node;
|
|
25
|
+
var attributes = element.openingElement.attributes;
|
|
26
|
+
if (!attributes) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var afterAlignValue = null;
|
|
30
|
+
attributes.forEach(function (attr) {
|
|
31
|
+
if (attr.type === 'JSXAttribute' && attr.name.name === 'afterAlign') {
|
|
32
|
+
afterAlignValue = (0, codemod_helpers_1.getStringValueFromAttribute)(attr);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (afterAlignValue !== null && afterAlignValue !== 'start') {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
attributes.forEach(function (attr) {
|
|
39
|
+
if (attr.type === 'JSXAttribute') {
|
|
40
|
+
if (attr.name.name === 'after') {
|
|
41
|
+
attr.name.name = 'meta';
|
|
42
|
+
}
|
|
43
|
+
else if (attr.name.name === 'afterCaption') {
|
|
44
|
+
attr.name.name = 'submeta';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return source.toSource();
|
|
50
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Search', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
slotName: 'input',
|
|
36
|
+
excludedProps: [
|
|
37
|
+
'autoComplete',
|
|
38
|
+
'disabled',
|
|
39
|
+
'list',
|
|
40
|
+
'maxLength',
|
|
41
|
+
'minLength',
|
|
42
|
+
'name',
|
|
43
|
+
'pattern',
|
|
44
|
+
'placeholder',
|
|
45
|
+
'readOnly',
|
|
46
|
+
'required',
|
|
47
|
+
'value',
|
|
48
|
+
'form',
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return source.toSource();
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Select', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'select',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
propName: 'nativeSelectTestId',
|
|
26
|
+
slotName: 'select',
|
|
27
|
+
slotPropName: 'data-testid',
|
|
28
|
+
});
|
|
29
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
30
|
+
root: source,
|
|
31
|
+
componentName: localName,
|
|
32
|
+
propName: 'getSelectInputRef',
|
|
33
|
+
slotName: 'input',
|
|
34
|
+
slotPropName: 'getRootRef',
|
|
35
|
+
});
|
|
36
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
37
|
+
root: source,
|
|
38
|
+
componentName: localName,
|
|
39
|
+
slotName: 'input',
|
|
40
|
+
});
|
|
41
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
42
|
+
root: source,
|
|
43
|
+
componentName: localName,
|
|
44
|
+
slotName: 'input',
|
|
45
|
+
});
|
|
46
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
47
|
+
root: source,
|
|
48
|
+
componentName: localName,
|
|
49
|
+
excludedProps: ['disabled', 'readOnly', 'required', 'name', 'value', 'placeholder'],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return source.toSource();
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
exports.parser = 'tsx';
|
|
7
|
+
var RENAME_MAP = {
|
|
8
|
+
onClose: 'onClosed',
|
|
9
|
+
};
|
|
10
|
+
function transformer(file, api, options) {
|
|
11
|
+
var alias = options.alias;
|
|
12
|
+
var j = api.jscodeshift;
|
|
13
|
+
var source = j(file.source);
|
|
14
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Snackbar', alias).localName;
|
|
15
|
+
if (localName) {
|
|
16
|
+
(0, codemod_helpers_1.renameProp)(j, source, localName, RENAME_MAP);
|
|
17
|
+
}
|
|
18
|
+
return source.toSource();
|
|
19
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveAllPropsIntoSlotProp_1 = require("./common/moveAllPropsIntoSlotProp");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'SplitLayout', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'content',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'content',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'content',
|
|
31
|
+
});
|
|
32
|
+
(0, moveAllPropsIntoSlotProp_1.moveAllPropsIntoSlotProp)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
slotName: 'content',
|
|
36
|
+
excludedProps: ['header', 'children', 'getRootRef', 'center', 'modal', 'popout'],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return source.toSource();
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Switch', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'input',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'input',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'input',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
excludedProps: ['checked', 'disabled', 'readOnly', 'required', 'name', 'value', 'form'],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return source.toSource();
|
|
39
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Textarea', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'textArea',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'textArea',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'textArea',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
slotName: 'textArea',
|
|
36
|
+
excludedProps: [
|
|
37
|
+
'autoComplete',
|
|
38
|
+
'disabled',
|
|
39
|
+
'maxLength',
|
|
40
|
+
'minLength',
|
|
41
|
+
'name',
|
|
42
|
+
'placeholder',
|
|
43
|
+
'readOnly',
|
|
44
|
+
'required',
|
|
45
|
+
'value',
|
|
46
|
+
'form',
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return source.toSource();
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parser = void 0;
|
|
4
|
+
exports.default = transformer;
|
|
5
|
+
var codemod_helpers_1 = require("../../codemod-helpers");
|
|
6
|
+
var moveInputPropsIntoSlotProps_1 = require("./common/moveInputPropsIntoSlotProps");
|
|
7
|
+
var movePropIntoSlotProps_1 = require("./common/movePropIntoSlotProps");
|
|
8
|
+
exports.parser = 'tsx';
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
var alias = options.alias;
|
|
11
|
+
var j = api.jscodeshift;
|
|
12
|
+
var source = j(file.source);
|
|
13
|
+
var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'WriteBar', alias).localName;
|
|
14
|
+
if (localName) {
|
|
15
|
+
(0, movePropIntoSlotProps_1.movePropIntoSlotProps)(j, {
|
|
16
|
+
root: source,
|
|
17
|
+
componentName: localName,
|
|
18
|
+
propName: 'getRef',
|
|
19
|
+
slotName: 'textArea',
|
|
20
|
+
slotPropName: 'getRootRef',
|
|
21
|
+
});
|
|
22
|
+
(0, movePropIntoSlotProps_1.moveDataAttrsIntoSlotProps)(j, {
|
|
23
|
+
root: source,
|
|
24
|
+
componentName: localName,
|
|
25
|
+
slotName: 'textArea',
|
|
26
|
+
});
|
|
27
|
+
(0, movePropIntoSlotProps_1.moveAriaAttrsIntoSlotProps)(j, {
|
|
28
|
+
root: source,
|
|
29
|
+
componentName: localName,
|
|
30
|
+
slotName: 'textArea',
|
|
31
|
+
});
|
|
32
|
+
(0, moveInputPropsIntoSlotProps_1.moveInputPropsIntoSlotProps)(j, {
|
|
33
|
+
root: source,
|
|
34
|
+
componentName: localName,
|
|
35
|
+
slotName: 'textArea',
|
|
36
|
+
excludedProps: [
|
|
37
|
+
'autoComplete',
|
|
38
|
+
'disabled',
|
|
39
|
+
'maxLength',
|
|
40
|
+
'minLength',
|
|
41
|
+
'name',
|
|
42
|
+
'placeholder',
|
|
43
|
+
'readOnly',
|
|
44
|
+
'required',
|
|
45
|
+
'value',
|
|
46
|
+
'form',
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return source.toSource();
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/vkui-codemods",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.1",
|
|
4
4
|
"description": "Codemods for automatic VKUI major version upgrade",
|
|
5
5
|
"repository": "https://github.com/VKCOM/VKUI",
|
|
6
6
|
"homepage": "https://vkui.io/",
|
|
@@ -15,26 +15,24 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"chalk": "^4.1.2",
|
|
18
|
-
"commander": "^14.0.
|
|
18
|
+
"commander": "^14.0.3",
|
|
19
19
|
"cross-spawn": "^7.0.5",
|
|
20
20
|
"jscodeshift": "^17.3.0",
|
|
21
21
|
"prompts": "^2.4.2",
|
|
22
|
-
"typescript": "^5.9.
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@swc/core": "^1.
|
|
26
|
-
"@swc/jest": "^0.2.39",
|
|
25
|
+
"@swc/core": "^1.15.11",
|
|
27
26
|
"@types/cross-spawn": "^6.0.6",
|
|
28
|
-
"@types/jest": "^30.0.0",
|
|
29
27
|
"@types/jscodeshift": "^17.3.0",
|
|
30
|
-
"@types/node": "^
|
|
31
|
-
"@types/prompts": "^2.4.9"
|
|
32
|
-
"jest": "^30.0.5"
|
|
28
|
+
"@types/node": "^25.0.10",
|
|
29
|
+
"@types/prompts": "^2.4.9"
|
|
33
30
|
},
|
|
34
31
|
"scripts": {
|
|
35
32
|
"prepack": "yarn run build",
|
|
36
33
|
"build": "tsc",
|
|
37
|
-
"test": "
|
|
34
|
+
"test": "yarn run -T vitest run --pool=vmThreads",
|
|
35
|
+
"test:update": "yarn test -u",
|
|
38
36
|
"test:ci": "yarn test",
|
|
39
37
|
"migrate": "jscodeshift"
|
|
40
38
|
},
|