remove es20xx prefixes from plugins and rename folders (#6575)
This commit is contained in:
23
packages/babel-plugin-transform-function-name/test/fixtures/function-name/.smoke/exec.js
vendored
Normal file
23
packages/babel-plugin-transform-function-name/test/fixtures/function-name/.smoke/exec.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var foo = function () {};
|
||||
assert.equal(foo.name, "foo");
|
||||
|
||||
var obj = { foo: function () {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { "foo": function () {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { foo() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { "foo"() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
function noop() {}
|
||||
|
||||
var obj = { @noop foo() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
|
||||
var obj = { @noop foo: function () { return "foo"; } };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["proposal-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
var i = function () {
|
||||
i = 5;
|
||||
};
|
||||
|
||||
var j = function () {
|
||||
({ j } = 5);
|
||||
({ y: j } = 5);
|
||||
;
|
||||
};
|
||||
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/assignment/expected.js
vendored
Normal file
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/assignment/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var _i = function i() {
|
||||
_i = 5;
|
||||
};
|
||||
|
||||
var _j = function j() {
|
||||
({
|
||||
j: _j
|
||||
} = 5);
|
||||
({
|
||||
y: _j
|
||||
} = 5);
|
||||
;
|
||||
};
|
||||
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/await/actual.js
vendored
Normal file
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/await/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export {};
|
||||
|
||||
var obj = { await: function () {} };
|
||||
4
packages/babel-plugin-transform-function-name/test/fixtures/function-name/await/expected.js
vendored
Normal file
4
packages/babel-plugin-transform-function-name/test/fixtures/function-name/await/expected.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export {};
|
||||
var obj = {
|
||||
await: function _await() {}
|
||||
};
|
||||
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/basic/actual.js
vendored
Normal file
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/basic/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var g = function () {
|
||||
doSmth();
|
||||
};
|
||||
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/basic/expected.js
vendored
Normal file
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/basic/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var g = function g() {
|
||||
doSmth();
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
t(t) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
let Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "t",
|
||||
value: function t(_t) {
|
||||
return _t;
|
||||
}
|
||||
}]);
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,9 @@
|
||||
var obj = {
|
||||
search: function({search}) {
|
||||
console.log(search);
|
||||
}
|
||||
};
|
||||
|
||||
function search({search}) {
|
||||
console.log(search);
|
||||
}
|
||||
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/collisions/expected.js
vendored
Normal file
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/collisions/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var obj = {
|
||||
search: function search({
|
||||
search: _search
|
||||
}) {
|
||||
console.log(_search);
|
||||
}
|
||||
};
|
||||
|
||||
function search({
|
||||
search
|
||||
}) {
|
||||
console.log(search);
|
||||
}
|
||||
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/eval/actual.js
vendored
Normal file
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/eval/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var a = {
|
||||
eval: function () {
|
||||
return eval;
|
||||
}
|
||||
};
|
||||
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/eval/expected.js
vendored
Normal file
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/eval/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var a = {
|
||||
eval: function _eval() {
|
||||
return eval;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export default () => ({
|
||||
x: ({x}) => {}
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _default = function _default() {
|
||||
return {
|
||||
x: function x(_ref) {
|
||||
var _x = _ref.x;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["es2015"]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export default ({ onClick }) => (
|
||||
<div onClick={() => onClick()} />
|
||||
)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _default = function _default(_ref) {
|
||||
var _onClick = _ref.onClick;
|
||||
return React.createElement("div", {
|
||||
onClick: function onClick() {
|
||||
return _onClick();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["es2015", "react"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _default = function _default(_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = _default;
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [
|
||||
"transform-member-expression-literals",
|
||||
"transform-property-literals"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
define(["exports"], function (_exports) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(_exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
_exports.default = void 0;
|
||||
|
||||
var _default = function _default(_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_exports.default = _default;
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-name", "transform-shorthand-properties", "transform-arrow-functions", "transform-modules-amd"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export default (function (_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-name", "transform-shorthand-properties", "transform-arrow-functions"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
_export("default", function (_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-name", "transform-shorthand-properties", "transform-arrow-functions", "transform-modules-systemjs"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(mod.exports);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (_exports) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(_exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
_exports.default = void 0;
|
||||
|
||||
var _default = function _default(_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_exports.default = _default;
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-name", "transform-shorthand-properties", "transform-arrow-functions", "transform-modules-umd"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default (a) => {
|
||||
return { a() { return a } };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _default = function _default(_a) {
|
||||
return {
|
||||
a: function a() {
|
||||
return _a;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-name", "transform-shorthand-properties", "transform-arrow-functions", "transform-modules-commonjs"]
|
||||
}
|
||||
19
packages/babel-plugin-transform-function-name/test/fixtures/function-name/export/actual.js
vendored
Normal file
19
packages/babel-plugin-transform-function-name/test/fixtures/function-name/export/actual.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export var foo = "yes", foob = "no";
|
||||
|
||||
export function whatever() {}
|
||||
|
||||
export default function wowzers() {}
|
||||
|
||||
var bar = {
|
||||
foo: function () {
|
||||
foo;
|
||||
},
|
||||
|
||||
whatever: function () {
|
||||
whatever;
|
||||
},
|
||||
|
||||
wowzers: function () {
|
||||
wowzers;
|
||||
}
|
||||
};
|
||||
21
packages/babel-plugin-transform-function-name/test/fixtures/function-name/export/expected.js
vendored
Normal file
21
packages/babel-plugin-transform-function-name/test/fixtures/function-name/export/expected.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export { _whatever as whatever };
|
||||
export { _wowzers as default };
|
||||
var _foo = "yes",
|
||||
foob = "no";
|
||||
export { _foo as foo, foob };
|
||||
|
||||
function _whatever() {}
|
||||
|
||||
function _wowzers() {}
|
||||
|
||||
var bar = {
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
},
|
||||
whatever: function whatever() {
|
||||
_whatever;
|
||||
},
|
||||
wowzers: function wowzers() {
|
||||
_wowzers;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
var foo;
|
||||
foo = function() {
|
||||
};
|
||||
|
||||
var baz;
|
||||
baz = function() {
|
||||
baz();
|
||||
};
|
||||
baz = 12;
|
||||
|
||||
bar = function() {
|
||||
bar();
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
var foo;
|
||||
|
||||
foo = function foo() {};
|
||||
|
||||
var _baz;
|
||||
|
||||
_baz = function baz() {
|
||||
_baz();
|
||||
};
|
||||
|
||||
_baz = 12;
|
||||
|
||||
bar = function (_bar) {
|
||||
function bar() {
|
||||
return _bar.apply(this, arguments);
|
||||
}
|
||||
|
||||
bar.toString = function () {
|
||||
return _bar.toString();
|
||||
};
|
||||
|
||||
return bar;
|
||||
}(function () {
|
||||
bar();
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
function f() {
|
||||
f;
|
||||
}
|
||||
|
||||
{
|
||||
let obj = {
|
||||
f: function () {
|
||||
f;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
(function b() {
|
||||
var obj = {
|
||||
b: function () {
|
||||
b;
|
||||
}
|
||||
};
|
||||
|
||||
function commit(b) {
|
||||
b();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
function _f() {
|
||||
_f;
|
||||
}
|
||||
|
||||
{
|
||||
let obj = {
|
||||
f: function f() {
|
||||
_f;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
(function _b() {
|
||||
var obj = {
|
||||
b: function b() {
|
||||
_b;
|
||||
}
|
||||
};
|
||||
|
||||
function commit(b) {
|
||||
b();
|
||||
}
|
||||
});
|
||||
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/global/actual.js
vendored
Normal file
5
packages/babel-plugin-transform-function-name/test/fixtures/function-name/global/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var test = {
|
||||
setInterval: function(fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
}
|
||||
};
|
||||
15
packages/babel-plugin-transform-function-name/test/fixtures/function-name/global/expected.js
vendored
Normal file
15
packages/babel-plugin-transform-function-name/test/fixtures/function-name/global/expected.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var test = {
|
||||
setInterval: function (_setInterval) {
|
||||
function setInterval(_x, _x2) {
|
||||
return _setInterval.apply(this, arguments);
|
||||
}
|
||||
|
||||
setInterval.toString = function () {
|
||||
return _setInterval.toString();
|
||||
};
|
||||
|
||||
return setInterval;
|
||||
}(function (fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
({ x() {} });
|
||||
@@ -0,0 +1,4 @@
|
||||
({
|
||||
x() {}
|
||||
|
||||
});
|
||||
11
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/actual.js
vendored
Normal file
11
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/actual.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import last from "lodash/last"
|
||||
|
||||
export default class Container {
|
||||
last(key) {
|
||||
if (!this.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return last(this.tokens.get(key))
|
||||
}
|
||||
}
|
||||
30
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/expected.js
vendored
Normal file
30
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/expected.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _last2 = babelHelpers.interopRequireDefault(require("lodash/last"));
|
||||
|
||||
let Container =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Container() {
|
||||
babelHelpers.classCallCheck(this, Container);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Container, [{
|
||||
key: "last",
|
||||
value: function last(key) {
|
||||
if (!this.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (0, _last2.default)(this.tokens.get(key));
|
||||
}
|
||||
}]);
|
||||
return Container;
|
||||
}();
|
||||
|
||||
exports.default = Container;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", "transform-classes", "proposal-decorators", "transform-modules-commonjs"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import {getForm} from "./store"
|
||||
|
||||
export default class Login extends React.Component {
|
||||
getForm() {
|
||||
return getForm().toJS()
|
||||
}
|
||||
}
|
||||
29
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/expected.js
vendored
Normal file
29
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/expected.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _store = require("./store");
|
||||
|
||||
let Login =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
babelHelpers.inherits(Login, _React$Component);
|
||||
|
||||
function Login() {
|
||||
babelHelpers.classCallCheck(this, Login);
|
||||
return babelHelpers.possibleConstructorReturn(this, (Login.__proto__ || Object.getPrototypeOf(Login)).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Login, [{
|
||||
key: "getForm",
|
||||
value: function getForm() {
|
||||
return (0, _store.getForm)().toJS();
|
||||
}
|
||||
}]);
|
||||
return Login;
|
||||
}(React.Component);
|
||||
|
||||
exports.default = Login;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", "transform-modules-commonjs", "transform-classes", "proposal-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export function foo(bar) {
|
||||
|
||||
}
|
||||
|
||||
var bar = {
|
||||
foo: function () {
|
||||
foo;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
export { _foo as foo };
|
||||
|
||||
function _foo(bar) {}
|
||||
|
||||
var bar = {
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
}
|
||||
};
|
||||
9
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/actual.js
vendored
Normal file
9
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import events from "events";
|
||||
|
||||
class Template {
|
||||
events() {
|
||||
return events;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Template().events());
|
||||
21
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/expected.js
vendored
Normal file
21
packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/expected.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var _events2 = babelHelpers.interopRequireDefault(require("events"));
|
||||
|
||||
let Template =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Template() {
|
||||
babelHelpers.classCallCheck(this, Template);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Template, [{
|
||||
key: "events",
|
||||
value: function events() {
|
||||
return _events2.default;
|
||||
}
|
||||
}]);
|
||||
return Template;
|
||||
}();
|
||||
|
||||
console.log(new Template().events());
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", "transform-modules-commonjs", "transform-classes", "proposal-decorators"]
|
||||
}
|
||||
15
packages/babel-plugin-transform-function-name/test/fixtures/function-name/object/actual.js
vendored
Normal file
15
packages/babel-plugin-transform-function-name/test/fixtures/function-name/object/actual.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var obj = {
|
||||
f: function () {
|
||||
(function f() {
|
||||
console.log(f);
|
||||
})();
|
||||
},
|
||||
|
||||
h: function () {
|
||||
console.log(h);
|
||||
},
|
||||
|
||||
m: function () {
|
||||
doSmth();
|
||||
}
|
||||
};
|
||||
23
packages/babel-plugin-transform-function-name/test/fixtures/function-name/object/expected.js
vendored
Normal file
23
packages/babel-plugin-transform-function-name/test/fixtures/function-name/object/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var obj = {
|
||||
f: function f() {
|
||||
(function f() {
|
||||
console.log(f);
|
||||
})();
|
||||
},
|
||||
h: function (_h) {
|
||||
function h() {
|
||||
return _h.apply(this, arguments);
|
||||
}
|
||||
|
||||
h.toString = function () {
|
||||
return _h.toString();
|
||||
};
|
||||
|
||||
return h;
|
||||
}(function () {
|
||||
console.log(h);
|
||||
}),
|
||||
m: function m() {
|
||||
doSmth();
|
||||
}
|
||||
};
|
||||
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json
vendored
Normal file
3
packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", "transform-classes", "proposal-decorators"]
|
||||
}
|
||||
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/own-bindings/actual.js
vendored
Normal file
13
packages/babel-plugin-transform-function-name/test/fixtures/function-name/own-bindings/actual.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var f = function () {
|
||||
var f = 2;
|
||||
};
|
||||
|
||||
var g = function (g) {
|
||||
g;
|
||||
};
|
||||
|
||||
var obj = {
|
||||
f: function (f) {
|
||||
f;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
var f = function f() {
|
||||
var f = 2;
|
||||
};
|
||||
|
||||
var g = function g(_g) {
|
||||
_g;
|
||||
};
|
||||
|
||||
var obj = {
|
||||
f: function f(_f) {
|
||||
_f;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var f = function () {
|
||||
console.log(f, g);
|
||||
};
|
||||
|
||||
f = null;
|
||||
@@ -0,0 +1,5 @@
|
||||
var _f = function f() {
|
||||
console.log(_f, g);
|
||||
};
|
||||
|
||||
_f = null;
|
||||
@@ -0,0 +1,20 @@
|
||||
var Utils = {
|
||||
get: function() {}
|
||||
};
|
||||
|
||||
var { get } = Utils;
|
||||
|
||||
var bar = {
|
||||
get: function(arg) {
|
||||
get(arg, "baz");
|
||||
}
|
||||
};
|
||||
|
||||
var f = function ({ foo = "bar" }) {
|
||||
var obj = {
|
||||
// same name as parameter
|
||||
foo: function () {
|
||||
foo;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
var Utils = {
|
||||
get: function get() {}
|
||||
};
|
||||
var {
|
||||
get: _get
|
||||
} = Utils;
|
||||
var bar = {
|
||||
get: function get(arg) {
|
||||
_get(arg, "baz");
|
||||
}
|
||||
};
|
||||
|
||||
var f = function f({
|
||||
foo: _foo = "bar"
|
||||
}) {
|
||||
var obj = {
|
||||
// same name as parameter
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// These are actually handled by transform-arrow-functions
|
||||
const x = () => x;
|
||||
const y = x => x();
|
||||
const z = { z: () => y(x) }.z;
|
||||
@@ -0,0 +1,19 @@
|
||||
var _this = this;
|
||||
|
||||
// These are actually handled by transform-arrow-functions
|
||||
const x = function x() {
|
||||
babelHelpers.newArrowCheck(this, _this);
|
||||
return x;
|
||||
}.bind(this);
|
||||
|
||||
const y = function y(x) {
|
||||
babelHelpers.newArrowCheck(this, _this);
|
||||
return x();
|
||||
}.bind(this);
|
||||
|
||||
const z = {
|
||||
z: function z() {
|
||||
babelHelpers.newArrowCheck(this, _this);
|
||||
return y(x);
|
||||
}.bind(this)
|
||||
}.z;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", [ "transform-arrow-functions", { "spec": true } ]]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const x = () => x;
|
||||
const y = x => x();
|
||||
const z = { z: () => y(x) }.z;
|
||||
@@ -0,0 +1,13 @@
|
||||
const x = function x() {
|
||||
return x;
|
||||
};
|
||||
|
||||
const y = function y(x) {
|
||||
return x();
|
||||
};
|
||||
|
||||
const z = {
|
||||
z: function z() {
|
||||
return y(x);
|
||||
}
|
||||
}.z;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name", "transform-arrow-functions"]
|
||||
}
|
||||
2
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/actual.js
vendored
Normal file
2
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const x = ({x}) => x;
|
||||
export const y = function () {};
|
||||
4
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/expected.js
vendored
Normal file
4
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/expected.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export const x = ({
|
||||
x
|
||||
}) => x;
|
||||
export const y = function y() {};
|
||||
3
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/options.json
vendored
Normal file
3
packages/babel-plugin-transform-function-name/test/fixtures/issues/5004/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-function-name"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import runner from "@babel/helper-plugin-test-runner";
|
||||
|
||||
runner(__dirname);
|
||||
Reference in New Issue
Block a user