Files
agency/.pnpm-store/v3/files/19/67a39273add527fc07ddaa26fcaf9521b384691b6c9ef2ad127bcc0125ce17364c3f7d4a2b480c0379e7ae37f7a399710e2d8b8d74eb67d1af43f7dacb2b1a
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

42 lines
1.1 KiB
Plaintext

module.exports = (file, api) => {
const jscodeshift = api.jscodeshift
const root = jscodeshift(file.source)
const baseRenameLogic = (kind, from, to) => {
root
.find(kind, (node) => {
return (
node.computed === false &&
(node.key?.name === from || node.key?.value === from)
)
})
.replaceWith(({ node: mutableNode }) => {
if (mutableNode.key.name !== undefined) {
mutableNode.key.name = to
}
if (mutableNode.key.value !== undefined) {
mutableNode.key.value = to
}
return mutableNode
})
}
const renameObjectProperty = (from, to) => {
baseRenameLogic(jscodeshift.ObjectProperty, from, to)
}
const renameTypeScriptPropertySignature = (from, to) => {
baseRenameLogic(jscodeshift.TSPropertySignature, from, to)
}
renameObjectProperty('cacheTime', 'gcTime')
renameObjectProperty('useErrorBoundary', 'throwOnError')
renameTypeScriptPropertySignature('cacheTime', 'gcTime')
renameTypeScriptPropertySignature('useErrorBoundary', 'throwOnError')
return root.toSource({ quote: 'single', lineTerminator: '\n' })
}