Merge pull request #3050 from kpdecker/aux-chain
auxiliaryComment chaining
This commit is contained in:
commit
1d34d19ce9
@ -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",
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["external-helpers-2", "transform-es2015-modules-commonjs"],
|
||||||
|
"auxiliaryCommentBefore": "before",
|
||||||
|
"auxiliaryCommentAfter": "after"
|
||||||
|
}
|
||||||
@ -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;
|
||||||
@ -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*/
|
||||||
5
packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/options.json
vendored
Normal file
5
packages/babel-plugin-transform-strict-mode/test/fixtures/auxiliary-comment/options.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["transform-strict-mode", "transform-es2015-modules-commonjs"],
|
||||||
|
"auxiliaryCommentBefore": "before",
|
||||||
|
"auxiliaryCommentAfter": "after"
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
foo();
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
/*before*/"use strict";
|
||||||
|
|
||||||
|
/*after*/foo();
|
||||||
Loading…
x
Reference in New Issue
Block a user