@next/codemod 15.0.0-canary.175 → 15.0.0-canary.177
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
CHANGED
|
@@ -141,21 +141,18 @@ function insertReactUseImport(root, j) {
|
|
|
141
141
|
if (!hasReactUseImport) {
|
|
142
142
|
const reactImportDeclaration = root.find(j.ImportDeclaration, {
|
|
143
143
|
source: {
|
|
144
|
-
type: 'Literal',
|
|
145
144
|
value: 'react',
|
|
146
145
|
},
|
|
147
146
|
});
|
|
148
147
|
if (reactImportDeclaration.size() > 0) {
|
|
148
|
+
const importNode = reactImportDeclaration.get().node;
|
|
149
149
|
// Add 'use' to existing 'react' import declaration
|
|
150
|
-
|
|
151
|
-
.get()
|
|
152
|
-
.node.specifiers.push(j.importSpecifier(j.identifier('use')));
|
|
150
|
+
importNode.specifiers.push(j.importSpecifier(j.identifier('use')));
|
|
153
151
|
}
|
|
154
152
|
else {
|
|
155
153
|
// Final all type imports to 'react'
|
|
156
154
|
const reactImport = root.find(j.ImportDeclaration, {
|
|
157
155
|
source: {
|
|
158
|
-
type: 'Literal',
|
|
159
156
|
value: 'react',
|
|
160
157
|
},
|
|
161
158
|
});
|