rename to babel

This commit is contained in:
Sebastian McKenzie 2015-02-15 18:09:05 +11:00
parent e05aed0394
commit 1d34d03ac8
253 changed files with 1279 additions and 1248 deletions

View File

4
.gitignore vendored
View File

@ -11,5 +11,5 @@ test/tmp
coverage coverage
dist dist
.package.json .package.json
packages/6to5-runtime/*.js packages/babel-runtime/*.js
packages/6to5-runtime/regenerator/*.js packages/babel-runtime/regenerator/*.js

2
.gitmodules vendored
View File

@ -3,7 +3,7 @@
url = https://github.com/google/traceur-compiler url = https://github.com/google/traceur-compiler
[submodule "vendor/regenerator"] [submodule "vendor/regenerator"]
path = vendor/regenerator path = vendor/regenerator
url = https://github.com/6to5/regenerator-6to5 url = https://github.com/babel/regenerator-babel
[submodule "vendor/test262"] [submodule "vendor/test262"]
path = vendor/test262 path = vendor/test262
url = https://github.com/tc39/test262 url = https://github.com/tc39/test262

View File

@ -1,5 +1,5 @@
{ {
"excludeFiles": ["lib/6to5/transformation/templates"], "excludeFiles": ["lib/babel/transformation/templates"],
"disallowSpacesInNamedFunctionExpression": { "disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true "beforeOpeningRoundBrace": true
}, },

View File

@ -1 +1 @@
lib/6to5/transformation/templates lib/babel/transformation/templates

View File

@ -1,7 +1,7 @@
node_modules node_modules
*.log *.log
*.cache *.cache
lib/6to5/transformation/templates lib/babel/transformation/templates
test test
benchmark benchmark
Makefile Makefile

1093
CHANGELOG-6to5.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Contributions are always welcome, no matter how large or small. Before Contributions are always welcome, no matter how large or small. Before
contributing, please read the contributing, please read the
[code of conduct](https://github.com/6to5/6to5/blob/master/CODE_OF_CONDUCT.md). [code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md).
**NOTE:** Please do not send pull requests that fix linting issues. It's highly **NOTE:** Please do not send pull requests that fix linting issues. It's highly
likely that they've already been fixed by the time it's submitted and it just likely that they've already been fixed by the time it's submitted and it just
@ -13,7 +13,7 @@ pollutes the git tree.
#### Workflow #### Workflow
* Fork the repository * Fork the repository
* Clone your fork and change directory to it (`git clone git@github.com:yourUserName/6to5.git && cd 6to5`) * Clone your fork and change directory to it (`git clone git@github.com:yourUserName/babel.git && cd 6to5`)
* Install the project dependencies (`make bootstrap`) * Install the project dependencies (`make bootstrap`)
* Link your forked clone (`npm link`) * Link your forked clone (`npm link`)
* Develop your changes ensuring you're fetching updates from upstream often * Develop your changes ensuring you're fetching updates from upstream often

View File

@ -5,31 +5,31 @@ UGLIFY_CMD = node_modules/uglify-js/bin/uglifyjs
JSHINT_CMD = node_modules/jshint/bin/jshint JSHINT_CMD = node_modules/jshint/bin/jshint
MOCHA_CMD = node_modules/mocha/bin/_mocha MOCHA_CMD = node_modules/mocha/bin/_mocha
JSCS_CMD = node_modules/jscs/bin/jscs JSCS_CMD = node_modules/jscs/bin/jscs
6TO5_CMD = node_modules/6to5/bin/6to5 BABEL_CMD = node_modules/babel/bin/babel
export NODE_ENV = test export NODE_ENV = test
.PHONY: clean test test-cov test-clean lint test-travis test-simple test-all test-browser publish build bootstrap publish-core publish-runtime build-core watch-core .PHONY: clean test test-cov test-clean lint test-travis test-simple test-all test-browser publish build bootstrap publish-core publish-runtime build-core watch-core
build-core: build-core:
#node $(6TO5_CMD) src --out-dir lib #node $(BABEL_CMD) src --out-dir lib
watch-core: watch-core:
#node $(6TO5_CMD) src --out-dir lib --watch #node $(BABEL_CMD) src --out-dir lib --watch
build: build:
mkdir -p dist mkdir -p dist
node tools/cache-templates node tools/cache-templates
node $(BROWSERIFY_CMD) -e lib/6to5/polyfill.js >dist/polyfill.js node $(BROWSERIFY_CMD) -e lib/babel/polyfill.js >dist/polyfill.js
node $(UGLIFY_CMD) dist/polyfill.js >dist/polyfill.min.js node $(UGLIFY_CMD) dist/polyfill.js >dist/polyfill.min.js
node $(BROWSERIFY_CMD) lib/6to5/api/browser.js -s to5 >dist/6to5.js node $(BROWSERIFY_CMD) lib/babel/api/browser.js -s to5 >dist/babel.js
node $(UGLIFY_CMD) dist/6to5.js >dist/6to5.min.js node $(UGLIFY_CMD) dist/babel.js >dist/babel.min.js
node bin/6to5-runtime >dist/runtime.js node bin/babel-external-helpers >dist/external-helpers.js
node $(UGLIFY_CMD) dist/runtime.js >dist/runtime.min.js node $(UGLIFY_CMD) dist/external-helpers.js >dist/external-helpers.min.js
rm -rf templates.json rm -rf templates.json
@ -71,7 +71,7 @@ test-browser:
node tools/cache-templates node tools/cache-templates
node tools/cache-tests node tools/cache-tests
node $(BROWSERIFY_CMD) -e test/_browser.js >dist/6to5-test.js node $(BROWSERIFY_CMD) -e test/_browser.js >dist/babel-test.js
rm -rf templates.json tests.json rm -rf templates.json tests.json
test -n "`which open`" && open test/browser.html test -n "`which open`" && open test/browser.html
@ -85,9 +85,9 @@ publish:
npm version $$version --message "v%s" npm version $$version --message "v%s"
make build make build
cp dist/6to5.min.js browser.js cp dist/babel.min.js browser.js
cp dist/polyfill.min.js browser-polyfill.js cp dist/polyfill.min.js browser-polyfill.js
cp dist/runtime.min.js runtime.js cp dist/external-helpers.min.js external-helpers.js
node tools/cache-templates node tools/cache-templates
test -f templates.json test -f templates.json
@ -99,12 +99,12 @@ publish:
make publish-core make publish-core
make publish-runtime make publish-runtime
rm -rf templates.json browser.js browser-polyfill.js runtime.js rm -rf templates.json browser.js browser-polyfill.js external-helpers.js
publish-runtime: publish-runtime:
cd packages; \ cd packages; \
node build-runtime.js; \ node build-runtime.js; \
cd 6to5-runtime; \ cd babel-runtime; \
npm publish npm publish
publish-core: publish-core:

View File

@ -1,3 +0,0 @@
# Notes
* Wildcard exports/imports wont normalize if `export default` is a non-object. See [#224](https://github.com/6to5/6to5/issues/224).

View File

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img alt="6to5" src="https://raw.githubusercontent.com/6to5/logo/master/logo.png" width="546"> <img alt="babel" src="https://raw.githubusercontent.com/babel/logo/master/logo.png" width="546">
</p> </p>
<p align="center"> <p align="center">
@ -7,6 +7,6 @@
</p> </p>
<p align="center"> <p align="center">
For more information view the <a href="https://6to5.github.io">documentation</a>. For For more information view the <a href="https://babeljs.io/">documentation</a>. For
support visit the <a href="https://gitter.im/6to5/6to5">gitter room</a>. support visit the <a href="https://gitter.im/babel/babel">gitter room</a>.
</p> </p>

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
var runtime = require("../lib/6to5/build-runtime");
console.log(runtime());

View File

@ -2,14 +2,14 @@
var commander = require("commander"); var commander = require("commander");
var Module = require("module"); var Module = require("module");
var babel = require("../lib/babel/api/node");
var path = require("path"); var path = require("path");
var repl = require("repl"); var repl = require("repl");
var to5 = require("../lib/6to5/api/node"); var util = require("../lib/babel/util");
var util = require("../lib/6to5/util");
var vm = require("vm"); var vm = require("vm");
var _ = require("lodash"); var _ = require("lodash");
var program = new commander.Command("6to5-node"); var program = new commander.Command("babel-node");
program.option("-e, --eval [script]", "Evaluate script"); program.option("-e, --eval [script]", "Evaluate script");
program.option("-p, --print [code]", "Evaluate script and print result"); program.option("-p, --print [code]", "Evaluate script and print result");
@ -28,7 +28,7 @@ program.parse(process.argv);
// //
to5.register({ babel.register({
experimental: program.experimental, experimental: program.experimental,
extensions: program.extensions, extensions: program.extensions,
playground: program.playground, playground: program.playground,
@ -41,7 +41,7 @@ to5.register({
// //
var _eval = function (code, filename) { var _eval = function (code, filename) {
code = to5.transform(code, { code = babel.transform(code, {
filename: filename, filename: filename,
blacklist: ["useStrict"].concat(program.blacklist || []), blacklist: ["useStrict"].concat(program.blacklist || []),
whitelist: program.whitelist, whitelist: program.whitelist,
@ -60,7 +60,7 @@ if (program.eval || program.print) {
if (program.print) console.log(result); if (program.print) console.log(result);
} else { } else {
if (program.args.length) { if (program.args.length) {
// slice all arguments up to the first filename since they're 6to5 args that we handle // slice all arguments up to the first filename since they're babel args that we handle
var args = process.argv.slice(2); var args = process.argv.slice(2);
var i = 0; var i = 0;

4
bin/babel-external-helpers Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env node
var runtime = require("../lib/babel/build-external-helpers");
console.log(runtime());

View File

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
var opts = require("./6to5").opts; var opts = require("./babel").opts;
opts.optional = (opts.optional || []).concat("minification"); opts.optional = (opts.optional || []).concat("minification");
opts.format = { opts.format = {
compact: true compact: true

View File

@ -2,10 +2,10 @@
/** /**
* This tiny wrapper file checks for known node flags and appends them * This tiny wrapper file checks for known node flags and appends them
* when found, before invoking the "real" _6to5-node(1) executable. * when found, before invoking the "real" _babel-node(1) executable.
*/ */
var args = [__dirname + "/_6to5-node"]; var args = [__dirname + "/_babel-node"];
process.argv.slice(2).forEach(function(arg){ process.argv.slice(2).forEach(function(arg){
var flag = arg.split("=")[0]; var flag = arg.split("=")[0];

View File

@ -1,6 +1,6 @@
var sourceMap = require("source-map"); var sourceMap = require("source-map");
var chokidar = require("chokidar"); var chokidar = require("chokidar");
var util2 = require("../../lib/6to5/util"); var util2 = require("../../lib/babel/util");
var path = require("path"); var path = require("path");
var util = require("./util"); var util = require("./util");
var fs = require("fs"); var fs = require("fs");

View File

@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node
var commander = require("commander"); var commander = require("commander");
var transform = require("../../lib/6to5/transformation"); var transform = require("../../lib/babel/transformation");
var util = require("../../lib/6to5/util"); var util = require("../../lib/babel/util");
var fs = require("fs"); var fs = require("fs");
var each = require("lodash/collection/each"); var each = require("lodash/collection/each");
var keys = require("lodash/object/keys"); var keys = require("lodash/object/keys");
@ -11,7 +11,7 @@ commander.option("-t, --source-maps-inline", "Append sourceMappingURL comment to
commander.option("-s, --source-maps", "Save source map alongside the compiled code"); commander.option("-s, --source-maps", "Save source map alongside the compiled code");
commander.option("-f, --filename [filename]", "Filename to use when reading from stdin - this will be used in source-maps, errors etc [stdin]", "stdin"); commander.option("-f, --filename [filename]", "Filename to use when reading from stdin - this will be used in source-maps, errors etc [stdin]", "stdin");
commander.option("-w, --watch", "Recompile files on changes"); commander.option("-w, --watch", "Recompile files on changes");
commander.option("-r, --runtime", "Replace 6to5 declarations with references to a runtime"); commander.option("-r, --runtime", "Replace babel helpers with references to a runtime");
commander.option("-e, --experimental", "Enable experimental support for proposed ES7 features"); commander.option("-e, --experimental", "Enable experimental support for proposed ES7 features");
commander.option("-p, --playground", "Enable playground support"); commander.option("-p, --playground", "Enable playground support");
@ -117,7 +117,7 @@ exports.opts = {
}; };
setTimeout(function () { setTimeout(function () {
// this is just a hack to give `6to5-minify` and other files including this // this is just a hack to give `babel-minify` and other files including this
// time to modify `exports.opts` // time to modify `exports.opts`
var fn; var fn;

View File

@ -1,8 +1,8 @@
var readdir = require("fs-readdir-recursive"); var readdir = require("fs-readdir-recursive");
var index = require("./index"); var index = require("./index");
var util = require("../../lib/6to5/util"); var babel = require("../../lib/babel/api/node");
var util = require("../../lib/babel/util");
var path = require("path"); var path = require("path");
var to5 = require("../../lib/6to5/api/node");
var fs = require("fs"); var fs = require("fs");
var _ = require("lodash"); var _ = require("lodash");
@ -26,7 +26,7 @@ exports.transform = function (filename, code, opts) {
var result; var result;
try { try {
result = to5.transform(code, opts); result = babel.transform(code, opts);
} catch (e) { } catch (e) {
if (e instanceof SyntaxError) { if (e instanceof SyntaxError) {
console.error("SyntaxError:", e.message); console.error("SyntaxError:", e.message);

3
bin/deprecated/6to5 Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
console.error("`6to5` has been renamed to `babel`");
require("../babel");

3
bin/deprecated/6to5-minify Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
console.error("`6to5-minify` has been renamed to `babel-minify`");
require("../babel-minify");

3
bin/deprecated/6to5-node Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
console.error("`6to5-node` has been renamed to `babel-node`");
require("../_babel-node");

3
bin/deprecated/6to5-runtime Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
console.error("`6to5-runtime` has been renamed to `babel-external-helpers`");
require("../babel-external-helpers");

View File

@ -1,9 +0,0 @@
"use strict";
if (global._6to5Polyfill) {
throw new Error("only one instance of 6to5/polyfill is allowed");
}
global._6to5Polyfill = true;
require("core-js/shim");
require("regenerator-6to5/runtime");

View File

@ -38,7 +38,7 @@ transform.load = function (url, callback, opts, hold) {
var runScripts = function () { var runScripts = function () {
var scripts = []; var scripts = [];
var types = ["text/ecmascript-6", "text/6to5", "module"]; var types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"];
var index = 0; var index = 0;
var exec = function () { var exec = function () {

View File

@ -7,7 +7,7 @@ var fs = require("fs");
exports.version = require("../../../package").version; exports.version = require("../../../package").version;
exports.runtime = require("../build-runtime"); exports.buildExternalHelpers = require("../build-external-helpers");
exports.types = require("../types"); exports.types = require("../types");
@ -23,7 +23,7 @@ exports.polyfill = function () {
exports.canCompile = util.canCompile; exports.canCompile = util.canCompile;
// do not use this - this is for use by official maintained 6to5 plugins // do not use this - this is for use by official maintained babel plugins
exports._util = util; exports._util = util;
exports.transform = transform; exports.transform = transform;

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
// required to safely use 6to5/register within a browserify codebase // required to safely use babel/register within a browserify codebase
module.exports = function () {}; module.exports = function () {};

View File

@ -4,7 +4,7 @@ var path = require("path");
var os = require("os"); var os = require("os");
var fs = require("fs"); var fs = require("fs");
var FILENAME = path.join(os.tmpdir(), "6to5.json"); var FILENAME = path.join(os.tmpdir(), "babel.json");
var data = {}; var data = {};
exports.save = function () { exports.save = function () {

View File

@ -5,9 +5,9 @@ require("../../polyfill");
var sourceMapSupport = require("source-map-support"); var sourceMapSupport = require("source-map-support");
var registerCache = require("./cache"); var registerCache = require("./cache");
var extend = require("lodash/object/extend"); var extend = require("lodash/object/extend");
var babel = require("../node");
var each = require("lodash/collection/each"); var each = require("lodash/collection/each");
var util = require("../../util"); var util = require("../../util");
var to5 = require("../node");
var fs = require("fs"); var fs = require("fs");
sourceMapSupport.install({ sourceMapSupport.install({
@ -54,7 +54,7 @@ var compile = function (filename) {
} }
if (!result) { if (!result) {
result = to5.transformFileSync(filename, extend({ result = babel.transformFileSync(filename, extend({
sourceMap: true, sourceMap: true,
ast: false ast: false
}, transformOpts)); }, transformOpts));

View File

@ -6,7 +6,7 @@ var util = require("./util");
var t = require("./types"); var t = require("./types");
module.exports = function () { module.exports = function () {
var namespace = t.identifier("to5Runtime"); var namespace = t.identifier("babelHelpers");
var body = []; var body = [];
var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));

View File

@ -1,7 +1,7 @@
var normalizeAst = require("./normalize-ast"); var normalizeAst = require("./normalize-ast");
var estraverse = require("estraverse"); var estraverse = require("estraverse");
var codeFrame = require("./code-frame"); var codeFrame = require("./code-frame");
var acorn = require("acorn-6to5"); var acorn = require("acorn-babel");
module.exports = function (opts, code, callback) { module.exports = function (opts, code, callback) {
try { try {
@ -30,8 +30,8 @@ module.exports = function (opts, code, callback) {
return ast; return ast;
} }
} catch (err) { } catch (err) {
if (!err._6to5) { if (!err._babel) {
err._6to5 = true; err._babel = true;
var message = opts.filename + ": " + err.message; var message = opts.filename + ": " + err.message;
var loc = err.loc; var loc = err.loc;

View File

@ -8,7 +8,7 @@ var t = require("./types");
var estraverse = require("estraverse"); var estraverse = require("estraverse");
extend(estraverse.VisitorKeys, t.VISITOR_KEYS); extend(estraverse.VisitorKeys, t.VISITOR_KEYS);
// regenerator-6to5/ast-types // regenerator-babel/ast-types
var types = require("ast-types"); var types = require("ast-types");
var def = types.Type.def; var def = types.Type.def;

9
lib/babel/polyfill.js Normal file
View File

@ -0,0 +1,9 @@
"use strict";
if (global._babelPolyfill) {
throw new Error("only one instance of babel/polyfill is allowed");
}
global._babelPolyfill = true;
require("core-js/shim");
require("regenerator-babel/runtime");

View File

@ -165,7 +165,7 @@ File.prototype.normalizeOptions = function (opts) {
} }
if (opts.runtime) { if (opts.runtime) {
this.set("runtimeIdentifier", t.identifier("to5Runtime")); this.set("runtimeIdentifier", t.identifier("babelHelpers"));
} }
opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist); opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist);

View File

@ -48,7 +48,7 @@ transform._ensureTransformerNames = function (type, rawKeys) {
"Unknown transformer " + key + " specified in " + type + " - " + "Unknown transformer " + key + " specified in " + type + " - " +
"transformer key names have been changed in 3.0.0 see " + "transformer key names have been changed in 3.0.0 see " +
"the changelog for more info " + "the changelog for more info " +
"https://github.com/6to5/6to5/blob/master/CHANGELOG.md#300" "https://github.com/babel/babel/blob/master/CHANGELOG.md#300"
); );
} }
} }

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