{"id":28429514,"url":"https://github.com/uiwjs/babel-plugin-transform-uiw-import","last_synced_at":"2026-02-13T08:13:53.371Z","repository":{"id":51064826,"uuid":"226489323","full_name":"uiwjs/babel-plugin-transform-uiw-import","owner":"uiwjs","description":"Modular import plugin for babel.","archived":false,"fork":false,"pushed_at":"2025-03-24T18:39:41.000Z","size":14,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-18T22:35:18.646Z","etag":null,"topics":["babel","babel-plugin","babel7","uiw"],"latest_commit_sha":null,"homepage":"https://npm.im/babel-plugin-transform-uiw-import","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uiwjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-07T09:54:51.000Z","updated_at":"2021-05-15T20:14:21.000Z","dependencies_parsed_at":"2023-11-09T10:29:52.318Z","dependency_job_id":"c831362a-f14f-4dfe-a490-1c2f5fdd219d","html_url":"https://github.com/uiwjs/babel-plugin-transform-uiw-import","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":"0.46153846153846156","last_synced_commit":"8d88b20ac77b1f5271a9cb6b6ec1687dd8664670"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uiwjs/babel-plugin-transform-uiw-import","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Fbabel-plugin-transform-uiw-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Fbabel-plugin-transform-uiw-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Fbabel-plugin-transform-uiw-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Fbabel-plugin-transform-uiw-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uiwjs","download_url":"https://codeload.github.com/uiwjs/babel-plugin-transform-uiw-import/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Fbabel-plugin-transform-uiw-import/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267392562,"owners_count":24079919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","babel-plugin","babel7","uiw"],"created_at":"2025-06-05T13:38:16.752Z","updated_at":"2026-02-13T08:13:53.342Z","avatar_url":"https://github.com/uiwjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"babel-plugin-transform-uiw-import\n===\n\n[![NPM version](https://img.shields.io/npm/v/babel-plugin-transform-uiw-import.svg?style=flat)](https://npmjs.org/package/babel-plugin-transform-uiw-import)\n[![Build Status](https://img.shields.io/travis/uiwjs/babel-plugin-transform-uiw-import.svg?style=flat)](https://travis-ci.org/uiwjs/babel-plugin-transform-uiw-import)\n[![Coverage Status](https://coveralls.io/repos/github/uiwjs/babel-plugin-transform-uiw-import/badge.svg?branch=master)](https://coveralls.io/github/uiwjs/babel-plugin-transform-uiw-import?branch=master)\n\nModular import uiw plugin for babel. compatible with [**uiw**](https://github.com/uiwjs/uiw), [antd](https://www.npmjs.com/package/antd), [lodash](https://www.npmjs.com/package/lodash), material-ui, and so on.\n\n## Usage\n\n```bash\nnpm install babel-plugin-transform-uiw-import --save-dev\n```\n\nVia `.babelrc` or `babel-loader`.\n\n```js\n{\n  \"plugins\": [\n    [\"babel-plugin-transform-uiw-import\"]\n  ]\n}\n```\n\n```js\n// Input Code\nimport { Alert } from 'uiw';\nimport { CopyToClipboard } from 'uiw';\nimport { DateInput, DatePicker } from 'uiw';\n\n// Output   ↓ ↓ ↓ ↓ ↓ ↓\nimport Alert from \"uiw/lib/cjs/alert\";\nimport CopyToClipboard from \"uiw/lib/cjs/copy-to-clipboard\";\nimport DateInput from \"uiw/lib/cjs/date-input\";\nimport DatePicker from \"uiw/lib/cjs/date-picker\";\n```\n\nOutput Result\n\n```diff\n- import { Alert } from 'uiw';\n+ import Alert from \"uiw/lib/cjs/alert\";\n- import { CopyToClipboard } from 'uiw';\n+ import CopyToClipboard from \"uiw/lib/cjs/copy-to-clipboard\";\n- import { DateInput, DatePicker } from 'uiw';\n+ import DateInput from \"uiw/lib/cjs/date-input\";\n+ import DatePicker from \"uiw/lib/cjs/date-picker\";\n```\n\n## Options\n\n```typescript\nexport interface Options {\n  [key: string]: {\n    transform: (importName: string) =\u003e void | string;\n    preventFullImport?: boolean;\n    skipDefaultConversion?: boolean;\n  }\n}\n```\n\n**Default Options**\n\n```js\n/**\n * Camel conversion horizontal line interval\n * @param {String} name \n * `CopyToClipboard` =\u003e `copy-to-clipboard`\n */\nfunction toLine(name) {\n  return name.replace(/\\B([A-Z])/g, '-$1').toLowerCase()\n}\n\n// The default Options\n{\n  uiw: {\n    transform: importName =\u003e `uiw/lib/cjs/${toLine(importName)}`,\n  }\n}\n```\n\n#### `transform: string | function(importName: string): string`\n\nThe library name to use instead of the one specified in the import statement. `${member}` will be replaced with the import name, aka Grid/Row/Col/etc., and `${1-n}` will be replaced by any matched regular expression groups. If using a JS Babel config file, a function may be passed directly. (see [`Programmatic Usage`](#programmatic-usage))\n\n#### `preventFullImport: boolean`\n\n\u003e default `false`\n  \nWhether or not to throw when an import is encountered which would cause the entire module to be imported.\n\n#### `skipDefaultConversion: boolean`\n\n\u003e default `false`\n\nWhen set to true, will preserve `import { X }` syntax instead of converting to `import X`.\n\n```js\n// Input Code\nimport { Grid as gird } from 'uiw';\n// Output   ↓ ↓ ↓ ↓ ↓ ↓  ====\u003e skipDefaultConversion: true\nimport { Grid as gird } from 'uiw/lib/Grid';\n```\n\n```diff\n- import { Grid as gird } from 'uiw';\n+ import { Grid as gird } from 'uiw/lib/Grid';\n```\n\n## Programmatic Usage\n\n```js\nimport plugin from 'babel-plugin-transform-uiw-import'\nimport { transform } from 'babel-core'\n\n// `CopyToClipboard` =\u003e `copy-to-clipboard`\nfunction toLine(name) {\n  return name.replace(/\\B([A-Z])/g, '-$1').toLowerCase();\n}\n \nfunction replace (code) {\n  return transform(code, {\n    babelrc: false,\n    plugins: [\n      [plugin, {\n        'date-fns': {\n          transform: importName =\u003e `date-fns/${toLine(importName)}`,\n          preventFullImport: true,\n        },\n      }]\n    ],\n  }).code;\n}\n \nreplace(\"import { CopyToClipboard } from 'date-fns';\")\n//=\u003e \"import CopyToClipboard from \"date-fns/copy-to-clipboard\";\"\n```\n\n## License\n\nMIT © [`Kenny Wong`](https://github.com/jaywcjlove)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiwjs%2Fbabel-plugin-transform-uiw-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuiwjs%2Fbabel-plugin-transform-uiw-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiwjs%2Fbabel-plugin-transform-uiw-import/lists"}