1.0.0 • Published 5 months ago
babel-plugin-hoist-block-scoped-functions v1.0.0
Babel Plugin My Transform
A Babel plugin for code transformation.
Introduction
在 ES6 中引入了块级作用域,定义在块级作用域的函数无法被外部访问。 但是在 ES5 中,不存在块级作用域,定义在 Block 中的函数作用域会被提升至它最近的函数作用域或全局作用域
Installation
npm install --save-dev babel-plugin-hoist-block-scoped-functions
Usage
Add the plugin to your Babel configuration:
// babel.config.js
module.exports = {
plugins: [
['babel-plugin-hoist-block-scoped-functions', {
// Plugin options
someOption: true
}]
]
};
Development
- Clone the repository
- Install dependencies:
npm install
- Build the plugin:
npm run build
- Run tests:
npm test
Features
- Transforms console.log calls by adding a prefix to string arguments
- Written in TypeScript with ES6 module syntax
- Full test coverage
License
MIT
1.0.0
5 months ago