Begin transition of Babel to a more scalable architecture, async flow to allow for RPC and better build system for multiple packages
This commit is contained in:
parent
4b3b6970b4
commit
fedf894904
7
.babelrc
7
.babelrc
@ -2,5 +2,10 @@
|
|||||||
"stage": 0,
|
"stage": 0,
|
||||||
"loose": ["all"],
|
"loose": ["all"],
|
||||||
"blacklist": ["es6.tailCall"],
|
"blacklist": ["es6.tailCall"],
|
||||||
"optional": ["optimisation.flow.forOf"]
|
"optional": ["optimisation.flow.forOf", "bluebirdCoroutines"],
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
|
"auxiliaryCommentBefore": "istanbul ignore next"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
src/babel/transformation/templates
|
packages/babel/src/transformation/templates
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@ -9,10 +9,12 @@ test/core/tmp
|
|||||||
/browser-polyfill.js
|
/browser-polyfill.js
|
||||||
/runtime.js
|
/runtime.js
|
||||||
/coverage
|
/coverage
|
||||||
/dist
|
dist
|
||||||
/.package.json
|
/.package.json
|
||||||
/packages/babel-runtime/core-js
|
/packages/babel-runtime/core-js
|
||||||
/packages/babel-runtime/helpers/*.js
|
/packages/babel-runtime/helpers/*.js
|
||||||
/packages/babel-runtime/regenerator/*.js
|
/packages/babel-runtime/regenerator/*.js
|
||||||
/lib
|
/packages/*/lib
|
||||||
_babel.github.io
|
_babel.github.io
|
||||||
|
scripts
|
||||||
|
/tests/.browser-build.js
|
||||||
|
|||||||
14
.travis.yml
14
.travis.yml
@ -1,15 +1,18 @@
|
|||||||
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
|
- iojs
|
||||||
|
- "0.8"
|
||||||
- "0.10"
|
- "0.10"
|
||||||
- "0.12"
|
- "0.12"
|
||||||
- iojs
|
|
||||||
|
|
||||||
before_script: ./tools/setup-git.sh
|
before_script: ./scripts/travis/setup-git.sh
|
||||||
script: make test-travis
|
script: make test-travis
|
||||||
after_success: ./tools/merge-development-with-master.sh
|
after_success: ./scripts/travis/merge-development-with-master.sh
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK
|
slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK
|
||||||
@ -29,7 +32,4 @@ deploy:
|
|||||||
repo: babel/babel
|
repo: babel/babel
|
||||||
|
|
||||||
after_deploy:
|
after_deploy:
|
||||||
- make publish-cli
|
- make travis-deploy
|
||||||
- make publish-runtime
|
|
||||||
- make build-website
|
|
||||||
- make comment-issues
|
|
||||||
|
|||||||
95
Makefile
95
Makefile
@ -1,84 +1,51 @@
|
|||||||
MAKEFLAGS = -j1
|
MAKEFLAGS = -j1
|
||||||
BROWSERIFY_CMD = node_modules/browserify/bin/cmd.js
|
|
||||||
ISTANBUL_CMD = node_modules/istanbul/lib/cli.js cover
|
ISTANBUL_CMD = node_modules/istanbul/lib/cli.js cover
|
||||||
UGLIFY_CMD = node_modules/uglify-js/bin/uglifyjs
|
|
||||||
#UGLIFY_CMD = node_modules/uglify-js/bin/uglifyjs --mangle sort
|
#UGLIFY_CMD = node_modules/uglify-js/bin/uglifyjs --mangle sort
|
||||||
MOCHA_CMD = node_modules/mocha/bin/_mocha
|
MOCHA_CMD = node_modules/mocha/bin/_mocha
|
||||||
BABEL_CMD = node_modules/babel/bin/babel
|
BABEL_CMD = node_modules/babel/bin/babel
|
||||||
BROWSERIFY_IGNORE = -i esprima-fb
|
|
||||||
|
|
||||||
export NODE_ENV = test
|
export NODE_ENV = test
|
||||||
|
|
||||||
.PHONY: clean test test-cov test-clean test-travis test-simple test-all test-browser test-parser publish build bootstrap publish-core publish-runtime build-website build-core watch-core build-core-test clean-core prepublish
|
.PHONY: clean test test-cov test-clean test-travis test-browser publish build bootstrap publish-core publish-runtime build-website build-core watch-core build-core-test clean-core prepublish
|
||||||
|
|
||||||
build-core: clean-core
|
build-core: clean-core
|
||||||
node $(BABEL_CMD) src --out-dir lib --copy-files
|
./scripts/build-core.sh
|
||||||
|
|
||||||
build-core-test: clean-core
|
|
||||||
node $(BABEL_CMD) src --out-dir lib --copy-files --auxiliary-comment-before "istanbul ignore next"
|
|
||||||
|
|
||||||
watch-core: clean-core
|
watch-core: clean-core
|
||||||
node $(BABEL_CMD) src --out-dir lib --watch --copy-files
|
./scripts/build-core.sh --watch
|
||||||
|
|
||||||
clean-core:
|
clean-core:
|
||||||
rm -rf lib
|
rm -rf packages/*/lib
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
eslint src/babel packages/babel-cli/bin
|
eslint packages/*/src
|
||||||
|
|
||||||
build:
|
build: build-core
|
||||||
mkdir -p dist
|
cd packages/babel; \
|
||||||
make build-core
|
scripts/build.sh
|
||||||
|
|
||||||
node tools/cache-templates
|
|
||||||
|
|
||||||
node $(BROWSERIFY_CMD) -e lib/babel/polyfill.js >dist/polyfill.js
|
|
||||||
node $(UGLIFY_CMD) dist/polyfill.js >dist/polyfill.min.js
|
|
||||||
|
|
||||||
node $(BROWSERIFY_CMD) lib/babel/api/browser.js -s babel $(BROWSERIFY_IGNORE) >dist/browser.js
|
|
||||||
node $(UGLIFY_CMD) dist/browser.js >dist/browser.min.js
|
|
||||||
|
|
||||||
node $(BROWSERIFY_CMD) lib/babel/api/node.js --node $(BROWSERIFY_IGNORE) >dist/node.js
|
|
||||||
|
|
||||||
node packages/babel-cli/bin/babel-external-helpers >dist/external-helpers.js
|
|
||||||
node $(UGLIFY_CMD) dist/external-helpers.js >dist/external-helpers.min.js
|
|
||||||
|
|
||||||
rm -rf templates.json
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf coverage templates.json test/tmp dist lib
|
rm -rf coverage packages/babel/templates.json test/tmp dist lib
|
||||||
|
|
||||||
test-clean:
|
test-clean:
|
||||||
rm -rf test/tmp
|
rm -rf test/tmp
|
||||||
|
|
||||||
test: test-parser
|
test:
|
||||||
node $(MOCHA_CMD) test/core
|
./scripts/test.sh
|
||||||
make test-clean
|
make test-clean
|
||||||
|
|
||||||
test-all:
|
test-browser:
|
||||||
export ALL_BABEL_TESTS=1; \
|
./scripts/test-browser.sh
|
||||||
make test
|
|
||||||
|
|
||||||
test-cov:
|
test-cov:
|
||||||
rm -rf coverage
|
rm -rf coverage
|
||||||
make build-core-test
|
BABEL_ENV=test; \
|
||||||
|
make build-core
|
||||||
node $(ISTANBUL_CMD) $(MOCHA_CMD) -- test/core
|
node $(ISTANBUL_CMD) $(MOCHA_CMD) -- test/core
|
||||||
|
|
||||||
test-parser:
|
|
||||||
node test/acorn/run.js
|
|
||||||
|
|
||||||
test-travis: bootstrap lint build test
|
test-travis: bootstrap lint build test
|
||||||
|
|
||||||
test-browser:
|
|
||||||
mkdir -p dist
|
|
||||||
|
|
||||||
node tools/cache-templates
|
|
||||||
node tools/build-tests
|
|
||||||
node $(BROWSERIFY_CMD) -e test/core/_browser.js >dist/babel-test.js
|
|
||||||
rm -rf templates.json tests.json
|
|
||||||
|
|
||||||
test -n "`which open`" && open test/browser.html
|
|
||||||
|
|
||||||
publish: lint
|
publish: lint
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
make test
|
make test
|
||||||
@ -86,35 +53,17 @@ publish: lint
|
|||||||
npm version $$version --message "v%s"
|
npm version $$version --message "v%s"
|
||||||
git push --follow-tags
|
git push --follow-tags
|
||||||
|
|
||||||
prepublish: build
|
|
||||||
cp dist/browser.js browser.js
|
|
||||||
cp dist/browser.min.js browser.min.js
|
|
||||||
cp dist/polyfill.js browser-polyfill.js
|
|
||||||
cp dist/polyfill.min.js browser-polyfill.min.js
|
|
||||||
cp dist/external-helpers.js external-helpers.js
|
|
||||||
cp dist/external-helpers.min.js external-helpers.min.js
|
|
||||||
node tools/cache-templates
|
|
||||||
test -f templates.json
|
|
||||||
|
|
||||||
publish-runtime:
|
publish-runtime:
|
||||||
cd packages; \
|
cd packages; \
|
||||||
node build-runtime.js; \
|
node build-runtime.js; \
|
||||||
cd babel-runtime; \
|
cd babel-runtime; \
|
||||||
npm publish
|
npm publish
|
||||||
|
|
||||||
publish-cli:
|
travis-deploy:
|
||||||
@./tools/publish-cli.sh
|
@./scripts/travis/publish-cli.sh
|
||||||
|
make publish-runtime
|
||||||
build-website:
|
@./scripts/travis/build-website.sh
|
||||||
@./tools/build-website.sh
|
@./scripts/travis/comment-issues.sh
|
||||||
|
|
||||||
comment-issues:
|
|
||||||
@./tools/comment-issues.sh
|
|
||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
npm list --global --depth 1 babel >/dev/null 2>&1 && npm uninstall -g babel || true
|
./scripts/bootstrap.sh
|
||||||
npm install
|
|
||||||
npm link
|
|
||||||
cd packages/babel-cli && npm install && npm link && npm link babel-core
|
|
||||||
git submodule update --init
|
|
||||||
make build
|
|
||||||
|
|||||||
82
package.json
82
package.json
@ -1,90 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "babel-core",
|
"private": true,
|
||||||
"description": "A compiler for writing next generation JavaScript",
|
|
||||||
"version": "5.6.17",
|
|
||||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
|
||||||
"homepage": "https://babeljs.io/",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "babel/babel",
|
|
||||||
"browser": {
|
|
||||||
"./lib/babel/api/register/node.js": "./lib/babel/api/register/browser.js"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"6to5",
|
|
||||||
"babel",
|
|
||||||
"classes",
|
|
||||||
"const",
|
|
||||||
"es6",
|
|
||||||
"harmony",
|
|
||||||
"let",
|
|
||||||
"modules",
|
|
||||||
"transpile",
|
|
||||||
"transpiler",
|
|
||||||
"var"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"bench": "make bench",
|
|
||||||
"test": "make test"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"acorn-jsx": "^1.0.0",
|
|
||||||
"babel-plugin-constant-folding": "^1.0.1",
|
|
||||||
"babel-plugin-dead-code-elimination": "^1.0.2",
|
|
||||||
"babel-plugin-eval": "^1.0.1",
|
|
||||||
"babel-plugin-inline-environment-variables": "^1.0.1",
|
|
||||||
"babel-plugin-jscript": "^1.0.1",
|
|
||||||
"babel-plugin-member-expression-literals": "^1.0.1",
|
|
||||||
"babel-plugin-property-literals": "^1.0.1",
|
|
||||||
"babel-plugin-proto-to-assign": "^1.0.3",
|
|
||||||
"babel-plugin-react-constant-elements": "^1.0.3",
|
|
||||||
"babel-plugin-react-display-name": "^1.0.3",
|
|
||||||
"babel-plugin-remove-console": "^1.0.1",
|
|
||||||
"babel-plugin-remove-debugger": "^1.0.1",
|
|
||||||
"babel-plugin-runtime": "^1.0.7",
|
|
||||||
"babel-plugin-undeclared-variables-check": "^1.0.2",
|
|
||||||
"babel-plugin-undefined-to-void": "^1.1.6",
|
|
||||||
"chalk": "^1.0.0",
|
|
||||||
"convert-source-map": "^1.1.0",
|
|
||||||
"core-js": "^0.9.0",
|
|
||||||
"debug": "^2.1.1",
|
|
||||||
"detect-indent": "^3.0.0",
|
|
||||||
"estraverse": "^4.0.0",
|
|
||||||
"esutils": "^2.0.0",
|
|
||||||
"fs-readdir-recursive": "^0.1.0",
|
|
||||||
"globals": "^6.4.0",
|
|
||||||
"home-or-tmp": "^1.0.0",
|
|
||||||
"is-integer": "^1.0.4",
|
|
||||||
"js-tokens": "1.0.1",
|
|
||||||
"line-numbers": "0.2.0",
|
|
||||||
"lodash": "^3.6.0",
|
|
||||||
"minimatch": "^2.0.3",
|
|
||||||
"output-file-sync": "^1.1.0",
|
|
||||||
"path-exists": "^1.0.0",
|
|
||||||
"path-is-absolute": "^1.0.0",
|
|
||||||
"private": "^0.1.6",
|
|
||||||
"regenerator": "0.8.34",
|
|
||||||
"regexpu": "^1.1.2",
|
|
||||||
"repeating": "^1.1.2",
|
|
||||||
"resolve": "^1.1.6",
|
|
||||||
"shebang-regex": "^1.0.0",
|
|
||||||
"slash": "^1.0.0",
|
|
||||||
"source-map": "^0.4.0",
|
|
||||||
"source-map-support": "^0.2.10",
|
|
||||||
"strip-json-comments": "^1.0.2",
|
|
||||||
"to-fast-properties": "^1.0.0",
|
|
||||||
"trim-right": "^1.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel": "5.6.10",
|
"babel": "5.6.10",
|
||||||
"babel-eslint": "^3.1.19",
|
"babel-eslint": "^3.1.19",
|
||||||
"browserify": "^9.0.8",
|
"browserify": "^9.0.8",
|
||||||
"chai": "^2.2.0",
|
"chai": "^2.2.0",
|
||||||
|
"es5-shim": "^4.1.7",
|
||||||
"eslint": "^0.21.2",
|
"eslint": "^0.21.2",
|
||||||
"esvalid": "^1.1.0",
|
"esvalid": "^1.1.0",
|
||||||
|
"fs-readdir-recursive": "^0.1.2",
|
||||||
"istanbul": "^0.3.5",
|
"istanbul": "^0.3.5",
|
||||||
"matcha": "^0.6.0",
|
"matcha": "^0.6.0",
|
||||||
"mocha": "2.2.0",
|
"mocha": "2.2.0",
|
||||||
"rimraf": "^2.3.2",
|
"output-file-sync": "^1.1.1",
|
||||||
|
"path-exists": "^1.0.0",
|
||||||
|
"rimraf": "^2.4.1",
|
||||||
"uglify-js": "^2.4.16"
|
"uglify-js": "^2.4.16"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,9 +20,9 @@
|
|||||||
"slash": "^1.0.0"
|
"slash": "^1.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"babel": "./bin/babel/index.js",
|
"babel": "./lib/babel/index.js",
|
||||||
"babel-node": "./bin/babel-node",
|
"babel-node": "./lib/babel-node",
|
||||||
"babel-external-helpers": "./bin/babel-external-helpers",
|
"babel-external-helpers": "./lib/babel-external-helpers",
|
||||||
"babel-plugin": "./bin/babel-plugin/index.js"
|
"babel-plugin": "./lib/babel-plugin/index.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,4 +10,6 @@ commander.option("-t, --output-type [type]", "Type of output (global|umd|var)",
|
|||||||
commander.usage("[options]");
|
commander.usage("[options]");
|
||||||
commander.parse(process.argv);
|
commander.parse(process.argv);
|
||||||
|
|
||||||
|
util.ensureTemplates().then(function () {
|
||||||
console.log(runtime(commander.whitelist, commander.outputType));
|
console.log(runtime(commander.whitelist, commander.outputType));
|
||||||
|
});
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
require("babel-core");
|
require("babel-core");
|
||||||
|
|
||||||
var moduleFormatters = require("babel-core/lib/babel/transformation/modules");
|
var moduleFormatters = require("babel-core/lib/transformation/modules");
|
||||||
var pathExists = require("path-exists");
|
var pathExists = require("path-exists");
|
||||||
var commander = require("commander");
|
var commander = require("commander");
|
||||||
var transform = require("babel-core").transform;
|
var transform = require("babel-core").transform;
|
||||||
@ -35,7 +35,7 @@ exports.transform = function (filename, code, opts) {
|
|||||||
opts.ignore = null;
|
opts.ignore = null;
|
||||||
opts.only = null;
|
opts.only = null;
|
||||||
|
|
||||||
var result = babel.transform(code, opts);
|
var result = babel.__plsDontUseThis(code, opts);
|
||||||
result.filename = filename;
|
result.filename = filename;
|
||||||
result.actual = code;
|
result.actual = code;
|
||||||
return result;
|
return result;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user