Buble.js 开源项目使用教程

Buble.js 开源项目使用教程

buble项目地址:https://gitcode.com/gh_mirrors/bu/buble

1. 项目的目录结构及介绍

buble/
├── bin/
│   └── buble.js
├── dist/
│   ├── buble.js
│   └── buble.min.js
├── src/
│   ├── ast.js
│   ├── compiler.js
│   ├── index.js
│   ├── transforms/
│   │   ├── arrow.js
│   │   ├── classes.js
│   │   ├── default-param.js
│   │   ├── destructuring.js
│   │   ├── for-of.js
│   │   ├── modules.js
│   │   ├── spread.js
│   │   └── template-literals.js
│   └── utils.js
├── test/
│   ├── fixtures/
│   ├── helpers.js
│   └── index.js
├── .babelrc
├── .editorconfig
├── .eslintrc
├── .gitignore
├── .npmignore
├── .travis.yml
├── LICENSE
├── package.json
├── README.md
└── yarn.lock

目录结构介绍

  • bin/: 包含可执行文件。
  • dist/: 包含编译后的文件。
  • src/: 包含源代码文件。
    • ast.js: 抽象语法树相关代码。
    • compiler.js: 编译器核心代码。
    • index.js: 入口文件。
    • transforms/: 包含各种转换器代码。
  • test/: 包含测试文件。
  • .babelrc: Babel 配置文件。
  • .editorconfig: 编辑器配置文件。
  • .eslintrc: ESLint 配置文件。
  • .gitignore: Git 忽略文件配置。
  • .npmignore: npm 忽略文件配置。
  • .travis.yml: Travis CI 配置文件。
  • LICENSE: 许可证文件。
  • package.json: 项目依赖和脚本配置。
  • README.md: 项目说明文档。
  • yarn.lock: Yarn 锁定文件。

2. 项目的启动文件介绍

项目的启动文件位于 bin/ 目录下的 buble.js。这个文件是 Buble.js 的命令行入口,负责解析命令行参数并调用相应的功能。

#!/usr/bin/env node

const buble = require('../dist/buble.js');
const fs = require('fs');
const path = require('path');

// 命令行参数解析和功能调用

3. 项目的配置文件介绍

.babelrc

Babel 配置文件,用于指定 Babel 的转换规则和插件。

{
  "presets": ["es2015"],
  "plugins": ["transform-runtime"]
}

.eslintrc

ESLint 配置文件,用于指定代码风格和检查规则。

{
  "extends": "eslint:recommended",
  "rules": {
    "indent": ["error", 2],
    "linebreak-style": ["error", "unix"],
    "quotes": ["error", "single"],
    "semi": ["error", "always"]
  }
}

package.json

项目依赖和脚本配置文件。

{
  "name": "buble",
  "version": "0.19.8",
  "description": "The blazing fast, batteries-included ES2015 compiler",
  "main": "dist/buble.js",
  "bin": {
    "buble": "bin/buble.js"
  },
  "scripts": {
    "build": "rollup -c",
    "prepublish": "npm run build",
    "test": "mocha"
  },
  "dependencies": {
    "acorn": "^5.7.3",
    "magic-string": "^0.25.1",
    "minimist": "^1.2.0",
    "source-map": "^0.6.1"
  },
  "devDependencies": {
    "chai": "^4.1.2",
    "eslint": "^4.19.1",
    "mocha": "^5.2.

buble项目地址:https://gitcode.com/gh_mirrors/bu/buble

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孙爽知Kody

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值