@cmssy/codemod 8.0.0 → 8.0.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/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -195,13 +195,14 @@ function stripTypeArguments(source) {
|
|
|
195
195
|
}
|
|
196
196
|
return { code, changed };
|
|
197
197
|
}
|
|
198
|
+
var INLINE_SCHEMA = /props\s*:\s*\{/;
|
|
198
199
|
function transform3(source) {
|
|
199
200
|
const { code, changed } = stripTypeArguments(source);
|
|
200
201
|
const notes = [];
|
|
201
202
|
const usesBlockProps = /\bBlockProps\s*</.test(code);
|
|
202
|
-
if (/\bdefineBlock\s
|
|
203
|
+
if (/\bdefineBlock\s*\(/.test(code) && INLINE_SCHEMA.test(code)) {
|
|
203
204
|
notes.push(
|
|
204
|
-
"
|
|
205
|
+
"the schema is inline - export it, and type the component with BlockProps<typeof props>"
|
|
205
206
|
);
|
|
206
207
|
} else if (HAND_TYPED_CONTENT.test(code) && !usesBlockProps) {
|
|
207
208
|
notes.push(
|