QMetaRam / node_modules /@tanstack /react-query /build /codemods /src /v4 /replace-import-specifier.cjs
Download node_modules/@tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs from metarm/QMetaRam: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs
- Command line
-
hf download hf://metarm/QMetaRam/node_modules/@tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs
-
curl -L -o replace-import-specifier.cjs https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs
605 Bytes
| module.exports = (file, api) => { | |
| const jscodeshift = api.jscodeshift | |
| const root = jscodeshift(file.source) | |
| const replacements = [ | |
| { from: 'react-query', to: '@tanstack/react-query' }, | |
| { from: 'react-query/devtools', to: '@tanstack/react-query-devtools' }, | |
| ] | |
| replacements.forEach(({ from, to }) => { | |
| root | |
| .find(jscodeshift.ImportDeclaration, { | |
| source: { | |
| value: from, | |
| }, | |
| }) | |
| .replaceWith(({ node }) => { | |
| node.source.value = to | |
| return node | |
| }) | |
| }) | |
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | |
| } | |