* Fixes #5108, browser.js and browser.js test removed * Moved api/node.js to index.js and adjusted associated file references
This commit is contained in:
parent
e4ba28c294
commit
1742035a98
@ -13,6 +13,12 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 6.22.1 (2017-01-19)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
Temporary fix with `babel-traverse` via [#5019](https://github.com/babel/babel/pull/5019) for transform-react-constant-elements.
|
||||
|
||||
## 6.22.0 (2017-01-19)
|
||||
|
||||
A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "2.0.0-beta.23",
|
||||
"version": "6.22.0",
|
||||
"version": "6.22.1",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"labels": {
|
||||
|
||||
@ -1,13 +1,22 @@
|
||||
{
|
||||
"name": "babel-cli",
|
||||
"version": "6.22.0",
|
||||
"version": "6.22.1",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-cli",
|
||||
"keywords": [
|
||||
"6to5",
|
||||
"babel",
|
||||
"es6",
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"babel-cli",
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-core": "^6.22.0",
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-register": "^6.22.0",
|
||||
"babel-polyfill": "^6.22.0",
|
||||
"babel-runtime": "^6.22.0",
|
||||
|
||||
@ -1 +1 @@
|
||||
module.exports = require("./lib/api/node.js");
|
||||
module.exports = require("./lib/index.js");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"version": "6.22.0",
|
||||
"version": "6.22.1",
|
||||
"description": "Babel compiler core.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@ -18,7 +18,8 @@
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"var",
|
||||
"babel-core"
|
||||
"babel-core",
|
||||
"compiler"
|
||||
],
|
||||
"scripts": {
|
||||
"bench": "make bench",
|
||||
@ -32,7 +33,7 @@
|
||||
"babel-template": "^6.22.0",
|
||||
"babel-runtime": "^6.22.0",
|
||||
"babel-register": "^6.22.0",
|
||||
"babel-traverse": "^6.22.0",
|
||||
"babel-traverse": "^6.22.1",
|
||||
"babel-types": "^6.22.0",
|
||||
"babylon": "^6.11.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
|
||||
@ -1,112 +0,0 @@
|
||||
/* eslint max-len: 0 */
|
||||
/* eslint no-new-func: 0 */
|
||||
|
||||
import { transform } from "./node";
|
||||
export {
|
||||
File,
|
||||
options,
|
||||
buildExternalHelpers,
|
||||
template,
|
||||
version,
|
||||
util,
|
||||
messages,
|
||||
types,
|
||||
traverse,
|
||||
OptionManager,
|
||||
Plugin,
|
||||
Pipeline,
|
||||
analyse,
|
||||
transform,
|
||||
transformFromAst,
|
||||
transformFile,
|
||||
transformFileSync
|
||||
} from "./node";
|
||||
|
||||
export function run(code: string, opts: Object = {}): any {
|
||||
return new Function(transform(code, opts).code)();
|
||||
}
|
||||
|
||||
export function load(url: string, callback: Function, opts: Object = {}, hold?: boolean) {
|
||||
opts.filename = opts.filename || url;
|
||||
|
||||
const xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest();
|
||||
xhr.open("GET", url, true);
|
||||
if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain");
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState !== 4) return;
|
||||
|
||||
const status = xhr.status;
|
||||
if (status === 0 || status === 200) {
|
||||
const param = [xhr.responseText, opts];
|
||||
if (!hold) run(param);
|
||||
if (callback) callback(param);
|
||||
} else {
|
||||
throw new Error(`Could not load ${url}`);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function runScripts() {
|
||||
const scripts: Array<Array<any> | Object> = [];
|
||||
const types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"];
|
||||
let index = 0;
|
||||
|
||||
/**
|
||||
* Transform and execute script. Ensures correct load order.
|
||||
*/
|
||||
|
||||
function exec() {
|
||||
const param = scripts[index];
|
||||
if (param instanceof Array) {
|
||||
run(param, index);
|
||||
index++;
|
||||
exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load, transform, and execute all scripts.
|
||||
*/
|
||||
|
||||
function run(script: Object, i: number) {
|
||||
const opts = {};
|
||||
|
||||
if (script.src) {
|
||||
load(script.src, function (param) {
|
||||
scripts[i] = param;
|
||||
exec();
|
||||
}, opts, true);
|
||||
} else {
|
||||
opts.filename = "embedded";
|
||||
scripts[i] = [script.innerHTML, opts];
|
||||
}
|
||||
}
|
||||
|
||||
// Collect scripts with Babel `types`.
|
||||
|
||||
const _scripts = global.document.getElementsByTagName("script");
|
||||
|
||||
for (let i = 0; i < _scripts.length; ++i) {
|
||||
const _script = _scripts[i];
|
||||
if (types.indexOf(_script.type) >= 0) scripts.push(_script);
|
||||
}
|
||||
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
run(scripts[i], i);
|
||||
}
|
||||
|
||||
exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register load event to transform and execute scripts.
|
||||
*/
|
||||
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener("DOMContentLoaded", runScripts, false);
|
||||
} else if (global.attachEvent) {
|
||||
global.attachEvent("onload", runScripts);
|
||||
}
|
||||
@ -1,14 +1,14 @@
|
||||
import fs from "fs";
|
||||
|
||||
export { default as File } from "../transformation/file";
|
||||
export { default as options } from "../transformation/file/options/config";
|
||||
export { default as buildExternalHelpers } from "../tools/build-external-helpers";
|
||||
export { default as File } from "./transformation/file";
|
||||
export { default as options } from "./transformation/file/options/config";
|
||||
export { default as buildExternalHelpers } from "./tools/build-external-helpers";
|
||||
export { default as template } from "babel-template";
|
||||
export { default as resolvePlugin } from "../helpers/resolve-plugin";
|
||||
export { default as resolvePreset } from "../helpers/resolve-preset";
|
||||
export { version } from "../../package";
|
||||
export { default as resolvePlugin } from "./helpers/resolve-plugin";
|
||||
export { default as resolvePreset } from "./helpers/resolve-preset";
|
||||
export { version } from "../package";
|
||||
|
||||
import * as util from "../util";
|
||||
import * as util from "./util";
|
||||
export { util };
|
||||
|
||||
import * as messages from "babel-messages";
|
||||
@ -20,14 +20,14 @@ export { t as types };
|
||||
import traverse from "babel-traverse";
|
||||
export { traverse };
|
||||
|
||||
import OptionManager from "../transformation/file/options/option-manager";
|
||||
import OptionManager from "./transformation/file/options/option-manager";
|
||||
export { OptionManager };
|
||||
|
||||
export function Plugin(alias) {
|
||||
throw new Error(`The (${alias}) Babel 5 plugin is being run with Babel 6.`);
|
||||
}
|
||||
|
||||
import Pipeline from "../transformation/pipeline";
|
||||
import Pipeline from "./transformation/pipeline";
|
||||
export { Pipeline };
|
||||
|
||||
const pipeline = new Pipeline;
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
import * as context from "../../../api/node";
|
||||
import * as context from "../../../index";
|
||||
import type Logger from "../logger";
|
||||
import Plugin from "../../plugin";
|
||||
import * as messages from "babel-messages";
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
if (process.browser) {
|
||||
require("../lib/api/browser");
|
||||
require("./generation");
|
||||
require("./transformation");
|
||||
require("./traverse");
|
||||
require("./util");
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import * as babel from "../lib/api/node";
|
||||
import * as babel from "../lib/index";
|
||||
import buildExternalHelpers from "../lib/tools/build-external-helpers";
|
||||
import sourceMap from "source-map";
|
||||
import assert from "assert";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { transform } from "../lib/api/node";
|
||||
import { transform } from "../lib/index";
|
||||
import Plugin from "../lib/transformation/plugin";
|
||||
import chai from "chai";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import assert from "assert";
|
||||
import async from "async";
|
||||
import * as babel from "../lib/api/node";
|
||||
import * as babel from "../lib/index";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
class AnchorLink extends Component {
|
||||
render() {
|
||||
const { isExternal, children } = this.props;
|
||||
if (isExternal) {
|
||||
return (<a>{children}</a>);
|
||||
}
|
||||
|
||||
return (<Link>{children}</Link>);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
class AnchorLink extends Component {
|
||||
render() {
|
||||
var _props = this.props;
|
||||
const isExternal = _props.isExternal,
|
||||
children = _props.children;
|
||||
|
||||
if (isExternal) {
|
||||
return <a>{children}</a>;
|
||||
}
|
||||
|
||||
return <Link>{children}</Link>;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"syntax-jsx",
|
||||
"transform-es2015-destructuring",
|
||||
"transform-react-constant-elements"
|
||||
]
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "babel-traverse",
|
||||
"version": "6.22.0",
|
||||
"version": "6.22.1",
|
||||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
|
||||
@ -121,7 +121,12 @@ export default class PathHoister {
|
||||
do {
|
||||
if (!path.parentPath ||
|
||||
(Array.isArray(path.container) && path.isStatement()) ||
|
||||
(path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1))
|
||||
(
|
||||
path.isVariableDeclarator() &&
|
||||
path.parentPath.node !== null &&
|
||||
path.parentPath.node.declarations.length > 1
|
||||
)
|
||||
)
|
||||
return path;
|
||||
} while ((path = path.parentPath));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user