Spaces:
Sleeping
Sleeping
Download frontend/node_modules/@svgr/babel-plugin-transform-svg-component/lib/index.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40svgr/babel-plugin-transform-svg-component/lib/index.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/@svgr/babel-plugin-transform-svg-component/lib/index.js
-
curl -L -o index.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40svgr/babel-plugin-transform-svg-component/lib/index.js
1.25 kB
| ; | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| var _util = require("./util"); | |
| function defaultTemplate({ | |
| template | |
| }, opts, { | |
| imports, | |
| interfaces, | |
| componentName, | |
| props, | |
| jsx, | |
| exports | |
| }) { | |
| const plugins = ['jsx']; | |
| if (opts.typescript) { | |
| plugins.push('typescript'); | |
| } | |
| const typeScriptTpl = template.smart({ | |
| plugins | |
| }); | |
| return typeScriptTpl.ast`${imports} | |
| ${interfaces} | |
| function ${componentName}(${props}) { | |
| return ${jsx}; | |
| } | |
| ${exports} | |
| `; | |
| } | |
| const plugin = (api, opts) => ({ | |
| visitor: { | |
| Program(path) { | |
| const { | |
| types: t | |
| } = api; | |
| const template = opts.template || defaultTemplate; | |
| const body = template(api, opts, { | |
| componentName: t.identifier(opts.state.componentName), | |
| interfaces: (0, _util.getInterface)(api, opts), | |
| props: (0, _util.getProps)(api, opts), | |
| imports: (0, _util.getImport)(api, opts), | |
| exports: (0, _util.getExport)(api, opts), | |
| jsx: path.node.body[0].expression | |
| }); | |
| if (Array.isArray(body)) { | |
| path.node.body = body; | |
| } else { | |
| path.node.body = [body]; | |
| } | |
| path.replaceWith(path.node); | |
| } | |
| } | |
| }); | |
| var _default = plugin; | |
| exports.default = _default; |