Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Avoid transpiling transforms #63

Merged
merged 1 commit into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/smart-lamps-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"types-react-codemod": minor
---

Avoid transpiling transforms

Previously jscodeshift would transpile the transforms before using them.
This was largely unnecessary and resulted in bugs to to usage of undeclared Babel dependencies.
2 changes: 2 additions & 0 deletions bin/types-react-codemod.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ async function main() {
const args = [
"--extensions=tsx,ts",
`"--ignore-pattern=${argv.ignorePattern}"`,
// The transforms are published as JS compatible with the supported Node.js versions.
"--no-babel",
`--transform ${path.join(transformsRoot, `${codemod}.js`)}`,
];

Expand Down
2 changes: 1 addition & 1 deletion transforms/context-any.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ const contextAnyTransform = (file, api) => {
return file.source;
};

export default contextAnyTransform;
module.exports = contextAnyTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-react-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ const deprecatedReactChildTransform = (file, api) => {
return file.source;
};

export default deprecatedReactChildTransform;
module.exports = deprecatedReactChildTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-react-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ const deprecatedReactTextTransform = (file, api) => {
return file.source;
};

export default deprecatedReactTextTransform;
module.exports = deprecatedReactTextTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-react-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const deprecatedReactTypeTransform = (file, api) => {
return file.source;
};

export default deprecatedReactTypeTransform;
module.exports = deprecatedReactTypeTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-sfc-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const deprecatedSFCElementTransform = (file, api) => {
return file.source;
};

export default deprecatedSFCElementTransform;
module.exports = deprecatedSFCElementTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-sfc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const deprecatedSFCTransform = (file, api) => {
return file.source;
};

export default deprecatedSFCTransform;
module.exports = deprecatedSFCTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-stateless-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const deprecatedStatelessComponentTransform = (file, api) => {
return file.source;
};

export default deprecatedStatelessComponentTransform;
module.exports = deprecatedStatelessComponentTransform;
2 changes: 1 addition & 1 deletion transforms/deprecated-void-function-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ const deprecatedVoidFunctionComponentTransform = (file, api) => {
return file.source;
};

export default deprecatedVoidFunctionComponentTransform;
module.exports = deprecatedVoidFunctionComponentTransform;
2 changes: 1 addition & 1 deletion transforms/implicit-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ const implicitChildrenTransform = (file, api) => {
return file.source;
};

export default implicitChildrenTransform;
module.exports = implicitChildrenTransform;
2 changes: 1 addition & 1 deletion transforms/preset-18.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ const transform = (file, api, options) => {
}
};

export default transform;
module.exports = transform;
2 changes: 1 addition & 1 deletion transforms/preset-19.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ const transform = (file, api, options) => {
}
};

export default transform;
module.exports = transform;
2 changes: 1 addition & 1 deletion transforms/useCallback-implicit-any.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ const useCallbackImplicitAnyTransform = (file, api) => {
return file.source;
};

export default useCallbackImplicitAnyTransform;
module.exports = useCallbackImplicitAnyTransform;