Merge pull request #1978 from babel/top-secret

5.7.0
This commit is contained in:
Sebastian McKenzie 2015-07-14 21:21:01 +01:00
commit 91fb64eaf5
1992 changed files with 9509 additions and 5524 deletions

View File

@ -2,6 +2,10 @@
"stage": 0,
"loose": ["all"],
"blacklist": ["es6.tailCall"],
"optional": ["optimisation.flow.forOf"],
"plugins": ["./tools/build-plugins/protect"]
"optional": ["optimisation.flow.forOf", "bluebirdCoroutines"],
"env": {
"test": {
"auxiliaryCommentBefore": "istanbul ignore next"
}
}
}

View File

@ -1 +1,2 @@
src/babel/transformation/templates
packages/babel/src/transformation/templates
scripts

View File

@ -19,7 +19,8 @@
"no-loop-func": 0,
"no-unreachable": 0,
"no-labels": 0,
"no-process-exit": 0
"no-process-exit": 0,
"camelcase": 0
},
"env": {
"node": true

7
.gitignore vendored
View File

@ -1,6 +1,6 @@
.DS_Store
node_modules
test/core/tmp
test/tmp
*.log
*.cache
/templates.json
@ -9,10 +9,11 @@ test/core/tmp
/browser-polyfill.js
/runtime.js
/coverage
/dist
dist
/.package.json
/packages/babel-runtime/core-js
/packages/babel-runtime/helpers/*.js
/packages/babel-runtime/regenerator/*.js
/lib
/packages/*/lib
_babel.github.io
/tests/.browser-build.js

View File

@ -1,35 +1,18 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
node_js:
- "0.10"
- "0.12"
- iojs
before_script: ./tools/setup-git.sh
node_js:
- iojs
- "0.10"
- "0.12"
script: make test-travis
after_success: ./tools/merge-development-with-master.sh
after_success:
- ./scripts/travis/setup-git.sh
- ./scripts/travis/merge-development-with-master.sh
notifications:
slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK
before_deploy:
- make prepublish
deploy:
provider: npm
email: sebmck@gmail.com
skip_cleanup: true
api_key:
secure: Q/pZStwherdYPCqCa0aUuiEktLcx6ccBxieyH8j9IXdDgty0ydmnajZfUnlZuCjN13XI9esM44nSJFTWZvntTryDQAQm37c63VXhAEnw/qrAINI06yt0gLBTT69/fKvIAkH8l48nmW32ZS2dse3rHRPZF1CwyQLC/pdMip8I4sM=
on:
branch: master
tags: true
repo: babel/babel
after_deploy:
- make publish-cli
- make publish-runtime
- make build-website
- make comment-issues

View File

@ -26,129 +26,8 @@ contributing, please read the
## Developing
> Note: Babel moves fast. Only the latest release is guaranteed to build correctly.
> Older releases are not officially supported. If you attempt to build them, do that at your own risk.
#### Setup
```sh
$ git clone https://github.com/babel/babel
$ cd babel
$ make bootstrap
```
Then you can either run:
```sh
$ make build-core
```
to build Babel **once** or:
```sh
$ make watch-core
```
to have Babel build itself then incrementally build files on change.
#### Running tests
You can run tests via:
```sh
$ make test
```
This is mostly overkill and you can limit the tests to a select few by directly
running them with `mocha`:
```sh
$ mocha test/core/transformation.js
```
Use mocha's `--grep` option to run a subset of tests by name:
```sh
$ mocha test/core/transformation.js --grep es7
```
If you don't have `mocha` installed globally, you can still use it from Babel's
dependencies in `node_modules`, but make sure `node_modules/.bin` is added to
your [`$PATH`](http://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) environment variable.
#### Workflow
* Fork the repository
* Clone your fork and change directory to it (`git clone git@github.com:yourUserName/babel.git && cd babel`)
* Install the project dependencies (`make bootstrap`)
* Link your forked clone (`npm link`)
* Develop your changes ensuring you're fetching updates from upstream often
* Ensure the test are passing (`make test`)
* Create new pull request explaining your proposed change or reference an issue in your commit message
#### Dependencies
+ [ast-types](http://ghub.io/ast-types) This is required to monkeypatch regenerators AST definitions. Could be improved in the future.
+ [chalk](http://ghub.io/chalk) This is used for terminal color highlighting for syntax errors.
+ [convert-source-map](http://ghub.io/convert-source-map) Turns a source map object into a comment etc.
+ [core-js](http://ghub.io/core-js) Used for the polyfill.
+ [debug](http://ghub.io/debug) Used to output debugging information when NODE_DEBUG is set to babel.
+ [detect-indent](http://ghub.io/detect-indent) This is used in the code generator so it can infer indentation.
+ [estraverse](http://ghub.io/estraverse) The only method on this is attachComments. I'd like to implement our own comment attachment algorithm eventually though.
+ [esutils](http://ghub.io/esutils) Various ES related utilities. Check whether something is a keyword etc.
+ [fs-readdir-recursive](http://ghub.io/fs-readdir-recursive) Recursively search a directory for.
+ [globals](http://ghub.io/globals) A list of JavaScript global variables. This is used by the scope tracking to check for colliding variables.
+ [is-integer](http://ghub.io/is-integer) Checks if something is an integer.
+ [js-tokens](http://ghub.io/js-tokens) This is used to get tokens for syntax error highlighting.
+ [line-numbers](http://ghub.io/line-numbers) Used to produce the code frames in syntax errors.
+ [lodash](http://ghub.io/lodash) Used for various utilities.
+ [minimatch](http://ghub.io/minimatch) This is used to match glob-style ignore/only filters.
+ [output-file-sync](http://ghub.io/output-file-sync) Synchronously writes a file and create its ancestor directories if needed.
+ [path-is-absolute](http://ghub.io/path-is-absolute) Checks if a path is absolute. C:\foo and \foo are considered absolute.
+ [regenerator](http://ghub.io/regenerator) This is used to transform generators/async functions.
+ [regexpu](http://ghub.io/regexpu) Used to transform unicode regex patterns.
+ [repeating](http://ghub.io/repeating) Repeats a string.
+ [shebang-regex](http://ghub.io/shebang-regex) Literally just a regex that matches shebangs.
+ [slash](http://ghub.io/slash) Normalises path separators.
+ [source-map](http://ghub.io/source-map) Generates sourcemaps.
+ [source-map-support](http://ghub.io/source-map-support) Adds source map support to babel-node/babel/register.
+ [strip-json-comments](http://ghub.io/strip-json-comments) Remove comments from a JSON string. This is used for .babelrc files.
+ [to-fast-properties](http://ghub.io/to-fast-properties) A V8 trick to put an object into fast properties mode.
+ [trim-right](http://ghub.io/trim-right) Trims the rightside whitespace.
+ [path-exists](https://www.npmjs.com/package/path-exists) Checks if a path exists. (replaces the deprecated `fs.exists` methods)
+ [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) Gets the user home directory with fallback to the system temporary directory. This is used to resolve the babel-node/babel/register cache.
+ [resolve](https://www.npmjs.com/package/resolve) Implements the [`require.resolve()` algorithm](http://nodejs.org/docs/v0.12.0/api/all.html#all_require_resolve) such that we can `require.resolve()` on behalf of a file asynchronously and synchronously.
#### Code Standards
* **General**
@ -177,4 +56,5 @@ your [`$PATH`](http://unix.stackexchange.com/questions/26047/how-to-correctly-ad
* No pollution of global variables and prototypes
#### Internals
Please see [`/doc`](/doc) for internals documentation relevant to developing babel.

122
Makefile
View File

@ -1,120 +1,52 @@
MAKEFLAGS = -j1
BROWSERIFY_CMD = node_modules/browserify/bin/cmd.js
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
MOCHA_CMD = node_modules/mocha/bin/_mocha
BABEL_CMD = node_modules/babel/bin/babel
BROWSERIFY_IGNORE = -i esprima-fb
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
node $(BABEL_CMD) src --out-dir lib --copy-files
build: clean
./scripts/build.sh
build-core-test: clean-core
node $(BABEL_CMD) src --out-dir lib --copy-files --auxiliary-comment-before "istanbul ignore next"
build-dist: build
cd packages/babel; \
scripts/build-dist.sh
cd packages/babel-runtime; \
node scripts/build-dist.js
watch-core: clean-core
node $(BABEL_CMD) src --out-dir lib --watch --copy-files
clean-core:
rm -rf lib
watch: clean
scripts/build.sh --watch
lint:
eslint src/babel packages/babel-cli/bin
eslint packages/*/src
build:
mkdir -p dist
make build-core
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:
rm -rf coverage templates.json test/tmp dist lib
clean: test-clean
rm -rf coverage
rm -rf packages/*/lib packages/babel/templates.json
test-clean:
rm -rf test/tmp
rm -rf packages/*/test/tmp
test: test-parser
node $(MOCHA_CMD) test/core
test: lint
./scripts/test.sh
make test-clean
test-all:
export ALL_BABEL_TESTS=1; \
make test
test-browser:
./scripts/test-browser.sh
test-cov:
rm -rf coverage
make build-core-test
test-cov: clean
BABEL_ENV=test; \
make build
node $(ISTANBUL_CMD) $(MOCHA_CMD) -- test/core
test-parser:
node test/acorn/run.js
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: build-dist
git pull --rebase
make test
read -p "Version: " version; \
npm version $$version --message "v%s"
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:
cd packages; \
node build-runtime.js; \
cd babel-runtime; \
npm publish
publish-cli:
@./tools/publish-cli.sh
build-website:
@./tools/build-website.sh
comment-issues:
@./tools/comment-issues.sh
node scripts/publish.js
make clean
./scripts/build-website.sh
bootstrap:
npm list --global --depth 1 babel >/dev/null 2>&1 && npm uninstall -g babel || true
npm install
npm link
cd packages/babel-cli && npm install && npm link && npm link babel-core
git submodule update --init
make build
node scripts/bootstrap.js

1
VERSION Normal file
View File

@ -0,0 +1 @@
5.6.21

View File

@ -1 +0,0 @@
module.exports = require("./lib/babel/api/node.js");

View File

@ -1,90 +1,22 @@
{
"name": "babel-core",
"description": "A compiler for writing next generation JavaScript",
"version": "5.6.20",
"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"
},
"private": true,
"devDependencies": {
"babel": "5.6.10",
"babel-eslint": "^3.1.19",
"browserify": "^9.0.8",
"chai": "^2.2.0",
"es5-shim": "^4.1.7",
"eslint": "^0.21.2",
"esvalid": "^1.1.0",
"fs-readdir-recursive": "^0.1.2",
"istanbul": "^0.3.5",
"matcha": "^0.6.0",
"mocha": "2.2.0",
"rimraf": "^2.3.2",
"output-file-sync": "^1.1.1",
"path-exists": "^1.0.0",
"readline-sync": "^1.2.19",
"rimraf": "^2.4.1",
"semver": "^5.0.0",
"shelljs": "^0.5.1",
"uglify-js": "^2.4.16"
}
}

View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require("../lib/babel-external-helpers");

View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require("../lib/babel-node");

View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require("../lib/babel-plugin");

View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require("../lib/babel");

View File

@ -1,5 +1,6 @@
{
"name": "babel",
"version": "5.6.21",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@ -7,6 +8,7 @@
"repository": "babel/babel",
"preferGlobal": true,
"dependencies": {
"babel-core": "^5.6.21",
"chokidar": "^1.0.0",
"commander": "^2.6.0",
"convert-source-map": "^1.1.0",
@ -20,9 +22,9 @@
"slash": "^1.0.0"
},
"bin": {
"babel": "./bin/babel/index.js",
"babel-node": "./bin/babel-node",
"babel-external-helpers": "./bin/babel-external-helpers",
"babel-plugin": "./bin/babel-plugin/index.js"
"babel": "./bin/babel.js",
"babel-node": "./bin/babel-node.js",
"babel-external-helpers": "./bin/babel-external-helpers.js",
"babel-plugin": "./bin/babel-plugin.js"
}
}

View File

@ -0,0 +1,3 @@
#!/bin/sh
set -e
npm link babel-core

View File

@ -1,5 +1,3 @@
#!/usr/bin/env node
var commander = require("commander");
var util = require("babel-core").util;
var runtime = require("babel-core").buildExternalHelpers;

View File

@ -1,11 +1,10 @@
#!/usr/bin/env node
/**
* This tiny wrapper file checks for known node flags and appends them
* when found, before invoking the "real" _babel-node(1) executable.
*/
var args = [__dirname + "/_babel-node"];
var path = require("path");
var args = [path.join(__dirname, "_babel-node")];
var babelArgs = process.argv.slice(2);
var userArgs;
@ -407,7 +406,6 @@ babelArgs.forEach(function(arg){
case "--debugger_port":
case "--debug_compile_events":
case "--debug_script_collected_events":
case "--gdbjit":
case "--log_runtime":
case "--prof_auto":
case "--prof_lazy":
@ -446,6 +444,6 @@ try {
} else {
process.exit(code);
}
})
});
});
}

View File

@ -2,7 +2,7 @@
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 commander = require("commander");
var transform = require("babel-core").transform;

Some files were not shown because too many files have changed in this diff Show More