@volue/wave-codemod__react 0.1.0-next.4 → 0.1.0-next.6
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/dist/index.cjs +1 -29
- package/dist/index.mjs +1 -29
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -86,34 +86,6 @@ function addRootToMultipartComps(j, ast) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
const REG_RETURN = /return\s+\((\s+)\(<([^\s>]+)/g;
|
|
90
|
-
function removeParentheses(string) {
|
|
91
|
-
const matches = string.matchAll(REG_RETURN);
|
|
92
|
-
let result = "";
|
|
93
|
-
const allMatches = [...matches];
|
|
94
|
-
if (allMatches.length === 0) return string;
|
|
95
|
-
allMatches.forEach((match) => {
|
|
96
|
-
const [, spaces, componentName] = match;
|
|
97
|
-
const sl = spaces.length;
|
|
98
|
-
const REG_DOUBLE_TAG = `(return\\s+\\(\\s{${sl}})\\((<${componentName}.+?\\s{${sl}}<\\/${componentName}>)\\)(\\s+\\))`;
|
|
99
|
-
const REG_SELF_CLOSING = `(return\\s+\\(\\s{${sl}})\\((<${componentName}.+?\\/>)\\)(\\s+\\))`;
|
|
100
|
-
const regexp = new RegExp(`${REG_DOUBLE_TAG}|${REG_SELF_CLOSING}`, "gs");
|
|
101
|
-
result = string.replace(
|
|
102
|
-
regexp,
|
|
103
|
-
(match2, doubleTagStart, doubleTagContent, doubleTagEnd, selfTagStart, selfTagContent, selfTagEnd) => {
|
|
104
|
-
if (doubleTagStart && doubleTagContent && doubleTagEnd) {
|
|
105
|
-
return doubleTagStart + doubleTagContent + doubleTagEnd;
|
|
106
|
-
}
|
|
107
|
-
if (selfTagStart && selfTagContent && selfTagEnd) {
|
|
108
|
-
return selfTagStart + selfTagContent + selfTagEnd;
|
|
109
|
-
}
|
|
110
|
-
return match2;
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
89
|
function transformer(file, api, options) {
|
|
118
90
|
const { jscodeshift: j } = api;
|
|
119
91
|
const ast = j(file.source);
|
|
@@ -121,7 +93,7 @@ function transformer(file, api, options) {
|
|
|
121
93
|
return file.source;
|
|
122
94
|
}
|
|
123
95
|
utils.applyMotions(j, ast, [addRootToMultipartComps]);
|
|
124
|
-
return
|
|
96
|
+
return ast.toSource(options.printOptions);
|
|
125
97
|
}
|
|
126
98
|
|
|
127
99
|
var index = {
|
package/dist/index.mjs
CHANGED
|
@@ -84,34 +84,6 @@ function addRootToMultipartComps(j, ast) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
const REG_RETURN = /return\s+\((\s+)\(<([^\s>]+)/g;
|
|
88
|
-
function removeParentheses(string) {
|
|
89
|
-
const matches = string.matchAll(REG_RETURN);
|
|
90
|
-
let result = "";
|
|
91
|
-
const allMatches = [...matches];
|
|
92
|
-
if (allMatches.length === 0) return string;
|
|
93
|
-
allMatches.forEach((match) => {
|
|
94
|
-
const [, spaces, componentName] = match;
|
|
95
|
-
const sl = spaces.length;
|
|
96
|
-
const REG_DOUBLE_TAG = `(return\\s+\\(\\s{${sl}})\\((<${componentName}.+?\\s{${sl}}<\\/${componentName}>)\\)(\\s+\\))`;
|
|
97
|
-
const REG_SELF_CLOSING = `(return\\s+\\(\\s{${sl}})\\((<${componentName}.+?\\/>)\\)(\\s+\\))`;
|
|
98
|
-
const regexp = new RegExp(`${REG_DOUBLE_TAG}|${REG_SELF_CLOSING}`, "gs");
|
|
99
|
-
result = string.replace(
|
|
100
|
-
regexp,
|
|
101
|
-
(match2, doubleTagStart, doubleTagContent, doubleTagEnd, selfTagStart, selfTagContent, selfTagEnd) => {
|
|
102
|
-
if (doubleTagStart && doubleTagContent && doubleTagEnd) {
|
|
103
|
-
return doubleTagStart + doubleTagContent + doubleTagEnd;
|
|
104
|
-
}
|
|
105
|
-
if (selfTagStart && selfTagContent && selfTagEnd) {
|
|
106
|
-
return selfTagStart + selfTagContent + selfTagEnd;
|
|
107
|
-
}
|
|
108
|
-
return match2;
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
87
|
function transformer(file, api, options) {
|
|
116
88
|
const { jscodeshift: j } = api;
|
|
117
89
|
const ast = j(file.source);
|
|
@@ -119,7 +91,7 @@ function transformer(file, api, options) {
|
|
|
119
91
|
return file.source;
|
|
120
92
|
}
|
|
121
93
|
applyMotions(j, ast, [addRootToMultipartComps]);
|
|
122
|
-
return
|
|
94
|
+
return ast.toSource(options.printOptions);
|
|
123
95
|
}
|
|
124
96
|
|
|
125
97
|
var index = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volue/wave-codemod__react",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.6",
|
|
4
4
|
"description": "Codemods for Wave React library",
|
|
5
5
|
"license": "",
|
|
6
6
|
"repository": {
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"@jest/types": "29.6.3",
|
|
51
51
|
"@types/jest": "29.5.14",
|
|
52
52
|
"@volue/eslint-config": "1.3.11",
|
|
53
|
-
"eslint": "9.
|
|
53
|
+
"eslint": "9.22.0",
|
|
54
54
|
"jest": "29.7.0",
|
|
55
55
|
"npm-run-all2": "7.0.2",
|
|
56
|
-
"pkgroll": "2.11.
|
|
56
|
+
"pkgroll": "2.11.2",
|
|
57
57
|
"premove": "4.0.0",
|
|
58
|
-
"prettier": "3.5.
|
|
58
|
+
"prettier": "3.5.3",
|
|
59
59
|
"ts-jest": "29.2.6",
|
|
60
|
-
"typescript": "5.
|
|
60
|
+
"typescript": "5.8.2"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@hypermod/utils": "0.6.0",
|