@volue/wave-codemod__react 0.1.1-next.0 → 0.2.0-next.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/dist/index.cjs +92 -2
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +92 -2
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -86,19 +86,109 @@ function addRootToMultipartComps(j, ast) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
function renameLabelDot(j, ast) {
|
|
90
|
+
const waveImports = ast.find(j.ImportDeclaration, {
|
|
91
|
+
source: { value: "@volue/wave-react" }
|
|
92
|
+
});
|
|
93
|
+
const labelImports = waveImports.find(j.ImportSpecifier, {
|
|
94
|
+
imported: { name: "Label" }
|
|
95
|
+
});
|
|
96
|
+
if (labelImports.size() === 0) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const labelDotElements = ast.find(j.JSXElement, {
|
|
100
|
+
openingElement: {
|
|
101
|
+
name: {
|
|
102
|
+
type: "JSXMemberExpression",
|
|
103
|
+
object: {
|
|
104
|
+
type: "JSXIdentifier",
|
|
105
|
+
name: "Label"
|
|
106
|
+
},
|
|
107
|
+
property: {
|
|
108
|
+
type: "JSXIdentifier",
|
|
109
|
+
name: "Dot"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (labelDotElements.size() === 0) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
labelDotElements.forEach((path) => {
|
|
118
|
+
path.value.openingElement.name = j.jsxIdentifier("LabelDot");
|
|
119
|
+
if (path.value.closingElement) {
|
|
120
|
+
path.value.closingElement.name = j.jsxIdentifier("LabelDot");
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
waveImports.forEach((path) => {
|
|
124
|
+
const labelDotSpecifier = j.importSpecifier(j.identifier("LabelDot"));
|
|
125
|
+
if (path.node.specifiers) {
|
|
126
|
+
path.node.specifiers.push(labelDotSpecifier);
|
|
127
|
+
} else {
|
|
128
|
+
path.node.specifiers = [labelDotSpecifier];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function transformer$1(file, api, options) {
|
|
134
|
+
const { jscodeshift: j } = api;
|
|
135
|
+
const ast = j(file.source);
|
|
136
|
+
if (!utils.hasImportDeclaration(j, ast, "@volue/wave-react")) {
|
|
137
|
+
return file.source;
|
|
138
|
+
}
|
|
139
|
+
utils.applyMotions(j, ast, [addRootToMultipartComps, renameLabelDot]);
|
|
140
|
+
return ast.toSource(options.printOptions);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function renameAppFrame(j, ast) {
|
|
144
|
+
const waveImports = ast.find(j.ImportDeclaration, {
|
|
145
|
+
source: { value: "@volue/wave-react" }
|
|
146
|
+
});
|
|
147
|
+
const appFrameImports = waveImports.find(j.ImportSpecifier, {
|
|
148
|
+
imported: { name: "AppFrame" }
|
|
149
|
+
});
|
|
150
|
+
if (appFrameImports.size() === 0) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
appFrameImports.replaceWith(
|
|
154
|
+
j.importSpecifier(j.identifier("AppFrameWithSidebar"))
|
|
155
|
+
);
|
|
156
|
+
ast.find(j.JSXMemberExpression, {
|
|
157
|
+
object: {
|
|
158
|
+
type: "JSXIdentifier",
|
|
159
|
+
name: "AppFrame"
|
|
160
|
+
}
|
|
161
|
+
}).forEach((path) => {
|
|
162
|
+
if (path.node.object.type === "JSXIdentifier") {
|
|
163
|
+
path.node.object.name = "AppFrameWithSidebar";
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
ast.find(j.MemberExpression, {
|
|
167
|
+
object: {
|
|
168
|
+
type: "Identifier",
|
|
169
|
+
name: "AppFrame"
|
|
170
|
+
}
|
|
171
|
+
}).forEach((path) => {
|
|
172
|
+
if (path.node.object.type === "Identifier") {
|
|
173
|
+
path.node.object.name = "AppFrameWithSidebar";
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
89
178
|
function transformer(file, api, options) {
|
|
90
179
|
const { jscodeshift: j } = api;
|
|
91
180
|
const ast = j(file.source);
|
|
92
181
|
if (!utils.hasImportDeclaration(j, ast, "@volue/wave-react")) {
|
|
93
182
|
return file.source;
|
|
94
183
|
}
|
|
95
|
-
utils.applyMotions(j, ast, [
|
|
184
|
+
utils.applyMotions(j, ast, [renameAppFrame]);
|
|
96
185
|
return ast.toSource(options.printOptions);
|
|
97
186
|
}
|
|
98
187
|
|
|
99
188
|
var index = {
|
|
100
189
|
transforms: {
|
|
101
|
-
"1.0.0": transformer
|
|
190
|
+
"1.0.0": transformer$1,
|
|
191
|
+
"1.1.0": transformer
|
|
102
192
|
}
|
|
103
193
|
};
|
|
104
194
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FileInfo, API, Options } from 'jscodeshift';
|
|
2
2
|
|
|
3
|
+
declare function transformer$1(file: FileInfo, api: API, options: Options): string;
|
|
4
|
+
|
|
3
5
|
declare function transformer(file: FileInfo, api: API, options: Options): string;
|
|
4
6
|
|
|
5
7
|
declare const _default: {
|
|
6
8
|
transforms: {
|
|
7
|
-
'1.0.0': typeof transformer;
|
|
9
|
+
'1.0.0': typeof transformer$1;
|
|
10
|
+
'1.1.0': typeof transformer;
|
|
8
11
|
};
|
|
9
12
|
};
|
|
10
13
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FileInfo, API, Options } from 'jscodeshift';
|
|
2
2
|
|
|
3
|
+
declare function transformer$1(file: FileInfo, api: API, options: Options): string;
|
|
4
|
+
|
|
3
5
|
declare function transformer(file: FileInfo, api: API, options: Options): string;
|
|
4
6
|
|
|
5
7
|
declare const _default: {
|
|
6
8
|
transforms: {
|
|
7
|
-
'1.0.0': typeof transformer;
|
|
9
|
+
'1.0.0': typeof transformer$1;
|
|
10
|
+
'1.1.0': typeof transformer;
|
|
8
11
|
};
|
|
9
12
|
};
|
|
10
13
|
|
package/dist/index.mjs
CHANGED
|
@@ -84,19 +84,109 @@ function addRootToMultipartComps(j, ast) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
function renameLabelDot(j, ast) {
|
|
88
|
+
const waveImports = ast.find(j.ImportDeclaration, {
|
|
89
|
+
source: { value: "@volue/wave-react" }
|
|
90
|
+
});
|
|
91
|
+
const labelImports = waveImports.find(j.ImportSpecifier, {
|
|
92
|
+
imported: { name: "Label" }
|
|
93
|
+
});
|
|
94
|
+
if (labelImports.size() === 0) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const labelDotElements = ast.find(j.JSXElement, {
|
|
98
|
+
openingElement: {
|
|
99
|
+
name: {
|
|
100
|
+
type: "JSXMemberExpression",
|
|
101
|
+
object: {
|
|
102
|
+
type: "JSXIdentifier",
|
|
103
|
+
name: "Label"
|
|
104
|
+
},
|
|
105
|
+
property: {
|
|
106
|
+
type: "JSXIdentifier",
|
|
107
|
+
name: "Dot"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
if (labelDotElements.size() === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
labelDotElements.forEach((path) => {
|
|
116
|
+
path.value.openingElement.name = j.jsxIdentifier("LabelDot");
|
|
117
|
+
if (path.value.closingElement) {
|
|
118
|
+
path.value.closingElement.name = j.jsxIdentifier("LabelDot");
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
waveImports.forEach((path) => {
|
|
122
|
+
const labelDotSpecifier = j.importSpecifier(j.identifier("LabelDot"));
|
|
123
|
+
if (path.node.specifiers) {
|
|
124
|
+
path.node.specifiers.push(labelDotSpecifier);
|
|
125
|
+
} else {
|
|
126
|
+
path.node.specifiers = [labelDotSpecifier];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function transformer$1(file, api, options) {
|
|
132
|
+
const { jscodeshift: j } = api;
|
|
133
|
+
const ast = j(file.source);
|
|
134
|
+
if (!hasImportDeclaration(j, ast, "@volue/wave-react")) {
|
|
135
|
+
return file.source;
|
|
136
|
+
}
|
|
137
|
+
applyMotions(j, ast, [addRootToMultipartComps, renameLabelDot]);
|
|
138
|
+
return ast.toSource(options.printOptions);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function renameAppFrame(j, ast) {
|
|
142
|
+
const waveImports = ast.find(j.ImportDeclaration, {
|
|
143
|
+
source: { value: "@volue/wave-react" }
|
|
144
|
+
});
|
|
145
|
+
const appFrameImports = waveImports.find(j.ImportSpecifier, {
|
|
146
|
+
imported: { name: "AppFrame" }
|
|
147
|
+
});
|
|
148
|
+
if (appFrameImports.size() === 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
appFrameImports.replaceWith(
|
|
152
|
+
j.importSpecifier(j.identifier("AppFrameWithSidebar"))
|
|
153
|
+
);
|
|
154
|
+
ast.find(j.JSXMemberExpression, {
|
|
155
|
+
object: {
|
|
156
|
+
type: "JSXIdentifier",
|
|
157
|
+
name: "AppFrame"
|
|
158
|
+
}
|
|
159
|
+
}).forEach((path) => {
|
|
160
|
+
if (path.node.object.type === "JSXIdentifier") {
|
|
161
|
+
path.node.object.name = "AppFrameWithSidebar";
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
ast.find(j.MemberExpression, {
|
|
165
|
+
object: {
|
|
166
|
+
type: "Identifier",
|
|
167
|
+
name: "AppFrame"
|
|
168
|
+
}
|
|
169
|
+
}).forEach((path) => {
|
|
170
|
+
if (path.node.object.type === "Identifier") {
|
|
171
|
+
path.node.object.name = "AppFrameWithSidebar";
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
87
176
|
function transformer(file, api, options) {
|
|
88
177
|
const { jscodeshift: j } = api;
|
|
89
178
|
const ast = j(file.source);
|
|
90
179
|
if (!hasImportDeclaration(j, ast, "@volue/wave-react")) {
|
|
91
180
|
return file.source;
|
|
92
181
|
}
|
|
93
|
-
applyMotions(j, ast, [
|
|
182
|
+
applyMotions(j, ast, [renameAppFrame]);
|
|
94
183
|
return ast.toSource(options.printOptions);
|
|
95
184
|
}
|
|
96
185
|
|
|
97
186
|
var index = {
|
|
98
187
|
transforms: {
|
|
99
|
-
"1.0.0": transformer
|
|
188
|
+
"1.0.0": transformer$1,
|
|
189
|
+
"1.1.0": transformer
|
|
100
190
|
}
|
|
101
191
|
};
|
|
102
192
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volue/wave-codemod__react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-next.0",
|
|
4
4
|
"description": "Codemods for Wave React library",
|
|
5
5
|
"license": "UNLICENSED",
|
|
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.26.0",
|
|
54
54
|
"jest": "29.7.0",
|
|
55
55
|
"npm-run-all2": "7.0.2",
|
|
56
|
-
"pkgroll": "2.12.
|
|
56
|
+
"pkgroll": "2.12.2",
|
|
57
57
|
"premove": "4.0.0",
|
|
58
58
|
"prettier": "3.5.3",
|
|
59
|
-
"ts-jest": "29.3.
|
|
60
|
-
"typescript": "5.8.
|
|
59
|
+
"ts-jest": "29.3.3",
|
|
60
|
+
"typescript": "5.8.3"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@hypermod/utils": "0.6.0",
|