rename imports and requires
Installations
npm install babel-plugin-transform-rename-import
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
9.11.1
NPM Version
5.6.0
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
laat
Download Statistics
Total Downloads
15,305,583
Last Day
11,135
Last Week
52,098
Last Month
260,983
Last Year
3,525,676
GitHub Statistics
45 Stars
61 Commits
6 Forks
3 Watching
1 Branches
2 Contributors
Bundle Size
1.13 kB
Minified
528.00 B
Minified + Gzipped
Package Meta Information
Latest Version
2.3.0
Package Id
babel-plugin-transform-rename-import@2.3.0
Size
2.49 kB
NPM Version
5.6.0
Node Version
9.11.1
Publised On
01 Jul 2018
Total Downloads
Cumulative downloads
Total Downloads
15,305,583
Last day
-12.7%
11,135
Compared to previous day
Last week
-20.5%
52,098
Compared to previous week
Last month
5%
260,983
Compared to previous month
Last year
2.2%
3,525,676
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
babel-plugin-transform-rename-import
![npm](https://img.shields.io/npm/v/babel-plugin-transform-rename-import.svg?style=flat)
replace import sources
Install
$ npm install --save babel-plugin-transform-rename-import
babelrc
1{ 2 "plugins": [["transform-rename-import", { original: 'assert', replacement: 'power-assert' }]] 3}
or multiple replacements:
1{ 2 "plugins": [ 3 ["transform-rename-import", { 4 replacements: [ 5 { original: 'replace-me', replacement: 'replaced' }, 6 { original: 'replace-me2', replacement: 'replaced2' } 7 ] 8 } 9 ]] 10}
RegExp:
1{ 2 "plugins": [["transform-rename-import", { original: '^(.+?)\\.less$', replacement: '$1.css' }]] 3}
Programatic Usage
1import plugin from 'babel-plugin-transform-rename-import' 2import { transform } from 'babel-core' 3 4function replace (code, original, replacement) { 5 return transform(code, { 6 babelrc: false, 7 plugins: [ 8 [plugin, { original, replacement} ], 9 ], 10 }).code; 11} 12 13replace("require('foo')", 'foo', 'bar') 14//=> "require('bar');" 15 16replace("import foo from 'foo'", 'foo', 'bar') 17//=> "import foo from 'bar';" 18 19replace("require('foo/thingy')", 'foo', 'bar') 20//=> "require('bar/thingy');" 21 22replace("require('foo/thingy.less')", '^(.+?)\\.less$', '$1.css') 23//=> "require('foo/thingy.css');"
License
MIT © Sigurd Fosseng
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/laat/babel-plugin-transform-rename-import/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/laat/babel-plugin-transform-rename-import/node.js.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:28
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More