Merge pull request #3050 from kpdecker/aux-chain

auxiliaryComment chaining
This commit is contained in:
Sebastian McKenzie 2015-11-15 20:13:47 -08:00
commit 1d34d19ce9
7 changed files with 61 additions and 1 deletions

View File

@ -66,7 +66,7 @@ export default class Printer extends Buffer {
printAuxBeforeComment(wasInAux) { printAuxBeforeComment(wasInAux) {
let comment = this.format.auxiliaryCommentBefore; let comment = this.format.auxiliaryCommentBefore;
if (!wasInAux && this.insideAux) { if (!wasInAux && this.insideAux && !this.printAuxAfterOnNextUserNode) {
this.printAuxAfterOnNextUserNode = true; this.printAuxAfterOnNextUserNode = true;
if (comment) this.printComment({ if (comment) this.printComment({
type: "CommentBlock", type: "CommentBlock",

View File

@ -0,0 +1,5 @@
{
"plugins": ["external-helpers-2", "transform-es2015-modules-commonjs"],
"auxiliaryCommentBefore": "before",
"auxiliaryCommentAfter": "after"
}

View File

@ -0,0 +1,14 @@
import "foo";
import "foo-bar";
import "./directory/foo-bar";
import foo from "foo2";
import * as foo2 from "foo3";
import {bar} from "foo4";
import {foo as bar2} from "foo5";
export {test};
export var test = 5;
bar;
bar2;
foo;

View File

@ -0,0 +1,32 @@
/*before*/"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.test = undefined;
require("foo");
require("foo-bar");
require("./directory/foo-bar");
var _foo = require("foo2");
var _foo2 = babelHelpers.interopRequireDefault(_foo);
var _foo3 = require("foo3");
var /*after*/foo2 = babelHelpers.interopRequireWildcard(_foo3);
/*before*/
var _foo4 = require("foo4");
var _foo5 = require("foo5");
exports. /*after*/test = test;
var test = /*before*/exports. /*after*/test = 5;
/*before*/_foo4. /*after*/bar;
/*before*/_foo5. /*after*/foo;
/*before*/_foo2.default;
/*after*/

View File

@ -0,0 +1,5 @@
{
"plugins": ["transform-strict-mode", "transform-es2015-modules-commonjs"],
"auxiliaryCommentBefore": "before",
"auxiliaryCommentAfter": "after"
}

View File

@ -0,0 +1,3 @@
/*before*/"use strict";
/*after*/foo();