Rename all proposal plugins to -proposal- from -transform- (#6570)

This commit is contained in:
Henry Zhu
2017-10-27 15:26:38 -04:00
committed by GitHub
parent a94aa54230
commit c41abd79a1
599 changed files with 372 additions and 372 deletions

View File

@@ -0,0 +1,3 @@
src
test
*.log

View File

@@ -0,0 +1,148 @@
# @babel/plugin-proposal-optional-chaining
The Optional Chaining Operator allows you to handle properties of deeply nested
objects without worrying about undefined intermediate objects.
## Example
### Accessing deeply nested properties
```js
const obj = {
foo: {
bar: {
baz: 42,
},
},
};
const baz = obj?.foo?.bar?.baz; // 42
const safe = obj?.qux?.baz; // undefined
// Optional chaining and normal chaining can be intermixed
obj?.foo.bar?.baz; // Only access `foo` if `obj` exists, and `baz` if
// `bar` exists
```
### Calling deeply nested functions
```js
const obj = {
foo: {
bar: {
baz() {
return 42;
},
},
},
};
const baz = obj?.foo?.bar?.baz(); // 42
const safe = obj?.qux?.baz(); // undefined
const safe2 = obj?.foo.bar.qux?.(); // undefined
const willThrow = obj?.foo.bar.qux(); // Error: not a function
// Top function can be called directly, too.
function test() {
return 42;
}
test?.(); // 42
exists?.(); // undefined
```
### Constructing deeply nested classes
```js
const obj = {
foo: {
bar: {
baz: class {
},
},
},
};
const baz = new obj?.foo?.bar?.baz(); // baz instance
const safe = new obj?.qux?.baz(); // undefined
const safe2 = new obj?.foo.bar.qux?.(); // undefined
const willThrow = new obj?.foo.bar.qux(); // Error: not a constructor
// Top classes can be called directly, too.
class Test {
}
new Test?.(); // test instance
new exists?.(); // undefined
```
## Installation
```sh
npm install --save-dev @babel/plugin-proposal-optional-chaining
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["@babel/proposal-optional-chaining"]
}
```
### Via CLI
```sh
babel --plugins @babel/proposal-optional-chaining script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/proposal-optional-chaining"]
});
```
## Options
### `loose`
`boolean`, defaults to `false`.
When `true`, this transform will pretend `document.all` does not exist,
and perform loose equality checks with `null` instead of string equality checks
against both `null` and `undefined`.
#### Example
In
```javascript
foo?.bar;
```
Out (`loose === true`)
```javascript
foo == null ? void 0 : foo.bar;
```
Out (`loose === false`)
```javascript
foo === null || foo === void 0 ? void 0 : foo.bar;
```
## References
* [Proposal: Optional Chaining](https://github.com/tc39/proposal-optional-chaining)

View File

@@ -0,0 +1,20 @@
{
"name": "@babel/plugin-proposal-optional-chaining",
"version": "7.0.0-beta.3",
"description": "Transform optional chaining operators into a series of nil checks",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-chaining",
"license": "MIT",
"main": "lib/index.js",
"keywords": [
"babel-plugin"
],
"dependencies": {
"@babel/plugin-syntax-optional-chaining": "7.0.0-beta.3"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.3"
},
"devDependencies": {
"@babel/helper-plugin-test-runner": "7.0.0-beta.3"
}
}

View File

@@ -0,0 +1,142 @@
import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining";
export default function({ types: t }, options) {
const { loose = false } = options;
function optional(path, replacementPath) {
const { scope } = path;
const optionals = [];
const nil = scope.buildUndefinedNode();
let objectPath = path;
while (
objectPath.isMemberExpression() ||
objectPath.isCallExpression() ||
objectPath.isNewExpression()
) {
const { node } = objectPath;
if (node.optional) {
optionals.push(node);
}
if (objectPath.isMemberExpression()) {
objectPath = objectPath.get("object");
} else {
objectPath = objectPath.get("callee");
}
}
for (let i = optionals.length - 1; i >= 0; i--) {
const node = optionals[i];
node.optional = false;
const isCall = t.isCallExpression(node);
const replaceKey =
isCall || t.isNewExpression(node) ? "callee" : "object";
const chain = node[replaceKey];
let ref;
let check;
if (loose && isCall) {
// If we are using a loose transform (avoiding a Function#call) and we are at the call,
// we can avoid a needless memoize.
check = ref = chain;
} else {
ref = scope.maybeGenerateMemoised(chain);
if (ref) {
check = t.assignmentExpression("=", ref, chain);
node[replaceKey] = ref;
} else {
check = ref = chain;
}
}
// Ensure call expressions have the proper `this`
// `foo.bar()` has context `foo`.
if (isCall && t.isMemberExpression(chain)) {
if (loose) {
// To avoid a Function#call, we can instead re-grab the property from the context object.
// `a.?b.?()` translates roughly to `_a.b != null && _a.b()`
node.callee = chain;
} else {
// Otherwise, we need to memoize the context object, and change the call into a Function#call.
// `a.?b.?()` translates roughly to `(_b = _a.b) != null && _b.call(_a)`
const { object } = chain;
let context = scope.maybeGenerateMemoised(object);
if (context) {
chain.object = t.assignmentExpression("=", context, object);
} else {
context = object;
}
node.arguments.unshift(context);
node.callee = t.memberExpression(node.callee, t.identifier("call"));
}
}
replacementPath.replaceWith(
t.conditionalExpression(
loose
? t.binaryExpression("==", t.clone(check), t.nullLiteral())
: t.logicalExpression(
"||",
t.binaryExpression("===", t.clone(check), t.nullLiteral()),
t.binaryExpression(
"===",
t.clone(ref),
scope.buildUndefinedNode(),
),
),
nil,
replacementPath.node,
),
);
replacementPath = replacementPath.get("alternate");
}
}
function findReplacementPath(path) {
return path.find(path => {
const { parentPath } = path;
if (path.key == "left" && parentPath.isAssignmentExpression()) {
return false;
}
if (path.key == "object" && parentPath.isMemberExpression()) {
return false;
}
if (
path.key == "callee" &&
(parentPath.isCallExpression() || parentPath.isNewExpression())
) {
return false;
}
if (path.key == "argument" && parentPath.isUpdateExpression()) {
return false;
}
if (
path.key == "argument" &&
parentPath.isUnaryExpression({ operator: "delete" })
) {
return false;
}
return true;
});
}
return {
inherits: syntaxOptionalChaining,
visitor: {
"MemberExpression|NewExpression|CallExpression"(path) {
if (!path.node.optional) {
return;
}
optional(path, findReplacementPath(path));
},
},
};
}

View File

@@ -0,0 +1,16 @@
"use strict";
const obj = {
a: {
b: 0,
},
};
obj?.a.b = 1;
assert.equal(obj.a.b, 1);
obj?.a?.b = 2;
assert.equal(obj.a.b, 2);
obj?.b?.b = 3;
assert.equal(obj.b, undefined);

View File

@@ -0,0 +1,28 @@
"use strict";
const obj = {
a: {
b: {
c: {
d: 2,
},
},
},
};
const a = obj?.a;
assert.equal(a, obj.a);
const b = obj?.a?.b;
assert.equal(b, obj.a.b);
const bad = obj?.b?.b;
assert.equal(bad, undefined);
let val;
val = obj?.a?.b;
assert.equal(val, obj.a.b);
assert.throws(() => {
const bad = obj?.b.b;
});

View File

@@ -0,0 +1,63 @@
"use strict";
let calls = 0;
const obj = {
a: {
b(val) {
assert.equal(val, 1);
assert.equal(this, obj.a);
return calls++;
},
},
c(val) {
assert.equal(val, 1);
assert.equal(this, obj);
return calls++;
},
};
let ab = obj?.a?.b(1);
assert.equal(ab, 0);
ab = obj?.a.b(1);
assert.equal(ab, 1);
ab = obj?.a?.b?.(1);
assert.equal(ab, 2);
ab = obj?.a.b?.(1);
assert.equal(ab, 3);
ab = obj?.b?.b(1);
assert.equal(ab, undefined);
ab = obj?.b?.b?.(1);
assert.equal(ab, undefined);
let c = obj?.c(1);
assert.equal(c, 4);
c = obj?.c?.(1);
assert.equal(c, 5);
c = obj?.d?.(1);
assert.equal(c, undefined);
obj?.a.b(1);
assert.equal(calls, 7);
obj?.a?.b(1);
assert.equal(calls, 8);
obj?.a?.b?.(1);
assert.equal(calls, 9);
obj?.a.b?.(1);
assert.equal(calls, 10);
obj?.c?.(1);
assert.equal(calls, 11);
obj?.b?.b(1);
obj?.b?.b?.(1);
obj?.d?.(1);

View File

@@ -0,0 +1,22 @@
"use strict";
const obj = {
a: {
b: 0,
},
};
let test = delete obj?.a?.b;
assert.equal(obj.a.b, undefined);
assert.equal(test, true);
test = delete obj?.a.b;
assert.equal(obj.a.b, undefined);
assert.equal(test, true);
test = delete obj?.b?.b;
assert.equal(obj.b, undefined);
assert.equal(test, undefined);
delete obj?.a;
assert.equal(obj.a, undefined);

View File

@@ -0,0 +1,67 @@
"use strict";
let calls = 0;
const obj = {
a: {
b: class {
constructor(val) {
assert.equal(val, 1);
assert(this instanceof obj.a.b);
calls++;
}
},
},
c: class {
constructor(val) {
assert.equal(val, 1);
assert(this instanceof obj.c);
calls++;
}
},
};
let ab = new obj?.a?.b(1);
assert(ab instanceof obj.a.b);
ab = new obj?.a.b(1);
assert(ab instanceof obj.a.b);
ab = new obj?.a?.b?.(1);
assert(ab instanceof obj.a.b);
ab = new obj?.a.b?.(1);
assert(ab instanceof obj.a.b);
ab = new obj?.b?.b(1);
assert.equal(ab, undefined);
ab = new obj?.b?.b?.(1);
assert.equal(ab, undefined);
let c = new obj?.c(1);
assert(c instanceof obj.c);
c = new obj?.c?.(1);
assert(c instanceof obj.c);
c = new obj?.d?.(1);
assert.equal(c, undefined);
new obj?.a.b(1);
assert.equal(calls, 7);
new obj?.a?.b(1);
assert.equal(calls, 8);
new obj?.a?.b?.(1);
assert.equal(calls, 9);
new obj?.a.b?.(1);
assert.equal(calls, 10);
new obj?.c?.(1);
assert.equal(calls, 11);
new obj?.b?.b(1);
new obj?.b?.b?.(1);
new obj?.d?.(1);

View File

@@ -0,0 +1,19 @@
"use strict";
const obj = {
a: {
b: 0,
},
};
let test = +obj?.a?.b;
assert.equal(test, 0);
test = +obj?.a.b;
assert.equal(test, 0);
test = +obj?.b?.b;
assert.isNaN(test);
test = +obj?.b?.b;
assert.isNaN(test);

View File

@@ -0,0 +1,16 @@
"use strict";
const obj = {
a: {
b: 0,
},
};
obj?.a.b++;
assert.equal(obj.a.b, 1);
obj?.a?.b++;
assert.equal(obj.a.b, 2);
obj?.b?.b++;
assert.equal(obj.b, undefined);

View File

@@ -0,0 +1,7 @@
a?.b = 42
a?.b?.c?.d = 42
a?.b?.c?.d++
a?.b?.c?.d += 1

View File

@@ -0,0 +1,6 @@
var _a, _a2, _a2$b, _a2$b$c, _a3, _a3$b, _a3$b$c, _a4, _a4$b, _a4$b$c;
(_a = a) === null || _a === void 0 ? void 0 : _a.b = 42;
(_a2 = a) === null || _a2 === void 0 ? void 0 : (_a2$b = _a2.b) === null || _a2$b === void 0 ? void 0 : (_a2$b$c = _a2$b.c) === null || _a2$b$c === void 0 ? void 0 : _a2$b$c.d = 42;
(_a3 = a) === null || _a3 === void 0 ? void 0 : (_a3$b = _a3.b) === null || _a3$b === void 0 ? void 0 : (_a3$b$c = _a3$b.c) === null || _a3$b$c === void 0 ? void 0 : _a3$b$c.d++;
(_a4 = a) === null || _a4 === void 0 ? void 0 : (_a4$b = _a4.b) === null || _a4$b === void 0 ? void 0 : (_a4$b$c = _a4$b.c) === null || _a4$b$c === void 0 ? void 0 : _a4$b$c.d += 1;

View File

@@ -0,0 +1,6 @@
var street = user.address?.street
street = user.address?.street
test(a?.b, 1);
(1, a?.b, 2);

View File

@@ -0,0 +1,6 @@
var _user$address, _user$address2, _a, _a2;
var street = (_user$address = user.address) === null || _user$address === void 0 ? void 0 : _user$address.street;
street = (_user$address2 = user.address) === null || _user$address2 === void 0 ? void 0 : _user$address2.street;
test((_a = a) === null || _a === void 0 ? void 0 : _a.b, 1);
1, (_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b, 2;

View File

@@ -0,0 +1,3 @@
delete a?.b
delete a?.b?.c?.d

View File

@@ -0,0 +1,4 @@
var _a, _a2, _a2$b, _a2$b$c;
(_a = a) === null || _a === void 0 ? void 0 : delete _a.b;
(_a2 = a) === null || _a2 === void 0 ? void 0 : (_a2$b = _a2.b) === null || _a2$b === void 0 ? void 0 : (_a2$b$c = _a2$b.c) === null || _a2$b$c === void 0 ? void 0 : delete _a2$b$c.d;

View File

@@ -0,0 +1,7 @@
foo?.(foo);
foo?.bar()
foo.bar?.(foo.bar, false)
foo?.bar?.(foo.bar, true)

View File

@@ -0,0 +1,6 @@
var _foo, _foo2;
foo == null ? void 0 : foo(foo);
(_foo = foo) == null ? void 0 : _foo.bar();
foo.bar == null ? void 0 : foo.bar(foo.bar, false);
(_foo2 = foo) == null ? void 0 : _foo2.bar == null ? void 0 : _foo2.bar(foo.bar, true);

View File

@@ -0,0 +1,3 @@
{
"plugins": [["proposal-optional-chaining", {"loose": true}]]
}

View File

@@ -0,0 +1,19 @@
foo?.(foo);
foo?.bar()
foo.bar?.(foo.bar, false)
foo?.bar?.(foo.bar, true)
foo?.().bar
foo?.()?.bar
foo.bar?.().baz
foo.bar?.()?.baz
foo?.bar?.().baz
foo?.bar?.()?.baz

View File

@@ -0,0 +1,12 @@
var _foo, _foo2, _foo$bar, _foo3, _foo4, _foo4$bar, _foo5, _foo6, _foo7, _foo$bar2, _foo8, _foo$bar3, _foo9, _foo$bar3$call, _foo10, _foo10$bar, _foo11, _foo11$bar, _foo11$bar$call;
(_foo = foo) === null || _foo === void 0 ? void 0 : _foo(foo);
(_foo2 = foo) === null || _foo2 === void 0 ? void 0 : _foo2.bar();
(_foo$bar = (_foo3 = foo).bar) === null || _foo$bar === void 0 ? void 0 : _foo$bar.call(_foo3, foo.bar, false);
(_foo4 = foo) === null || _foo4 === void 0 ? void 0 : (_foo4$bar = _foo4.bar) === null || _foo4$bar === void 0 ? void 0 : _foo4$bar.call(_foo4, foo.bar, true);
(_foo5 = foo) === null || _foo5 === void 0 ? void 0 : _foo5().bar;
(_foo6 = foo) === null || _foo6 === void 0 ? void 0 : (_foo7 = _foo6()) === null || _foo7 === void 0 ? void 0 : _foo7.bar;
(_foo$bar2 = (_foo8 = foo).bar) === null || _foo$bar2 === void 0 ? void 0 : _foo$bar2.call(_foo8).baz;
(_foo$bar3 = (_foo9 = foo).bar) === null || _foo$bar3 === void 0 ? void 0 : (_foo$bar3$call = _foo$bar3.call(_foo9)) === null || _foo$bar3$call === void 0 ? void 0 : _foo$bar3$call.baz;
(_foo10 = foo) === null || _foo10 === void 0 ? void 0 : (_foo10$bar = _foo10.bar) === null || _foo10$bar === void 0 ? void 0 : _foo10$bar.call(_foo10).baz;
(_foo11 = foo) === null || _foo11 === void 0 ? void 0 : (_foo11$bar = _foo11.bar) === null || _foo11$bar === void 0 ? void 0 : (_foo11$bar$call = _foo11$bar.call(_foo11)) === null || _foo11$bar$call === void 0 ? void 0 : _foo11$bar$call.baz;

View File

@@ -0,0 +1,19 @@
foo?.bar;
a?.b.c?.d.e;
a.b?.c.d?.e;
a.b.c?.d?.e;
orders?.[0].price;
orders?.[0]?.price;
orders[client?.key].price;
orders[client.key]?.price;
(0, a?.b).c;
(0, (0, a?.b).c?.d).e;

View File

@@ -0,0 +1,12 @@
var _foo, _a, _a$b$c, _a$b, _a$b$c$d, _a$b$c2, _a$b$c2$d, _orders, _orders2, _orders2$, _client, _orders$client$key, _a2, _c, _a3;
(_foo = foo) === null || _foo === void 0 ? void 0 : _foo.bar;
(_a = a) === null || _a === void 0 ? void 0 : (_a$b$c = _a.b.c) === null || _a$b$c === void 0 ? void 0 : _a$b$c.d.e;
(_a$b = a.b) === null || _a$b === void 0 ? void 0 : (_a$b$c$d = _a$b.c.d) === null || _a$b$c$d === void 0 ? void 0 : _a$b$c$d.e;
(_a$b$c2 = a.b.c) === null || _a$b$c2 === void 0 ? void 0 : (_a$b$c2$d = _a$b$c2.d) === null || _a$b$c2$d === void 0 ? void 0 : _a$b$c2$d.e;
(_orders = orders) === null || _orders === void 0 ? void 0 : _orders[0].price;
(_orders2 = orders) === null || _orders2 === void 0 ? void 0 : (_orders2$ = _orders2[0]) === null || _orders2$ === void 0 ? void 0 : _orders2$.price;
orders[(_client = client) === null || _client === void 0 ? void 0 : _client.key].price;
(_orders$client$key = orders[client.key]) === null || _orders$client$key === void 0 ? void 0 : _orders$client$key.price;
(0, (_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b).c;
(0, (_c = (0, (_a3 = a) === null || _a3 === void 0 ? void 0 : _a3.b).c) === null || _c === void 0 ? void 0 : _c.d).e;

View File

@@ -0,0 +1,21 @@
function test(foo) {
foo?.bar;
foo?.bar?.baz;
foo?.(foo);
foo?.bar()
foo.bar?.(foo.bar, false)
foo?.bar?.(foo.bar, true)
foo.bar?.baz(foo.bar, false)
foo?.bar?.baz(foo.bar, true)
foo.bar?.baz?.(foo.bar, false)
foo?.bar?.baz?.(foo.bar, true)
}

View File

@@ -0,0 +1,14 @@
function test(foo) {
var _foo$bar, _foo$bar2, _foo$bar3, _foo$bar4, _foo$bar5;
foo == null ? void 0 : foo.bar;
foo == null ? void 0 : (_foo$bar = foo.bar) == null ? void 0 : _foo$bar.baz;
foo == null ? void 0 : foo(foo);
foo == null ? void 0 : foo.bar();
foo.bar == null ? void 0 : foo.bar(foo.bar, false);
foo == null ? void 0 : foo.bar == null ? void 0 : foo.bar(foo.bar, true);
(_foo$bar2 = foo.bar) == null ? void 0 : _foo$bar2.baz(foo.bar, false);
foo == null ? void 0 : (_foo$bar3 = foo.bar) == null ? void 0 : _foo$bar3.baz(foo.bar, true);
(_foo$bar4 = foo.bar) == null ? void 0 : _foo$bar4.baz == null ? void 0 : _foo$bar4.baz(foo.bar, false);
foo == null ? void 0 : (_foo$bar5 = foo.bar) == null ? void 0 : _foo$bar5.baz == null ? void 0 : _foo$bar5.baz(foo.bar, true);
}

View File

@@ -0,0 +1,3 @@
{
"plugins": [["proposal-optional-chaining", {"loose": true}]]
}

View File

@@ -0,0 +1,21 @@
function test(foo) {
foo?.bar;
foo?.bar?.baz;
foo?.(foo);
foo?.bar()
foo.bar?.(foo.bar, false)
foo?.bar?.(foo.bar, true)
foo.bar?.baz(foo.bar, false)
foo?.bar?.baz(foo.bar, true)
foo.bar?.baz?.(foo.bar, false)
foo?.bar?.baz?.(foo.bar, true)
}

View File

@@ -0,0 +1,14 @@
function test(foo) {
var _foo$bar, _foo$bar2, _foo$bar3, _foo$bar4, _foo$bar5, _foo$bar6, _foo$bar6$baz, _foo$bar7, _foo$bar7$baz;
foo === null || foo === void 0 ? void 0 : foo.bar;
foo === null || foo === void 0 ? void 0 : (_foo$bar = foo.bar) === null || _foo$bar === void 0 ? void 0 : _foo$bar.baz;
foo === null || foo === void 0 ? void 0 : foo(foo);
foo === null || foo === void 0 ? void 0 : foo.bar();
(_foo$bar2 = foo.bar) === null || _foo$bar2 === void 0 ? void 0 : _foo$bar2.call(foo, foo.bar, false);
foo === null || foo === void 0 ? void 0 : (_foo$bar3 = foo.bar) === null || _foo$bar3 === void 0 ? void 0 : _foo$bar3.call(foo, foo.bar, true);
(_foo$bar4 = foo.bar) === null || _foo$bar4 === void 0 ? void 0 : _foo$bar4.baz(foo.bar, false);
foo === null || foo === void 0 ? void 0 : (_foo$bar5 = foo.bar) === null || _foo$bar5 === void 0 ? void 0 : _foo$bar5.baz(foo.bar, true);
(_foo$bar6 = foo.bar) === null || _foo$bar6 === void 0 ? void 0 : (_foo$bar6$baz = _foo$bar6.baz) === null || _foo$bar6$baz === void 0 ? void 0 : _foo$bar6$baz.call(_foo$bar6, foo.bar, false);
foo === null || foo === void 0 ? void 0 : (_foo$bar7 = foo.bar) === null || _foo$bar7 === void 0 ? void 0 : (_foo$bar7$baz = _foo$bar7.baz) === null || _foo$bar7$baz === void 0 ? void 0 : _foo$bar7$baz.call(_foo$bar7, foo.bar, true);
}

View File

@@ -0,0 +1,16 @@
new a?.b
new a?.b?.c?.d
new a?.b()
new a?.b?.c?.d()
new b?.(b)
new a?.b?.(a.b, true)
new b?.().c
new b?.()?.c
new a.b?.().c
new a.b?.()?.c
new a?.b?.().c
new a?.b?.()?.c

View File

@@ -0,0 +1,14 @@
var _a, _a2, _a2$b, _a2$b$c, _a3, _a4, _a4$b, _a4$b$c, _b, _a5, _a5$b, _b2, _b3, _ref, _a$b, _a$b2, _ref2, _a6, _a6$b, _a7, _a7$b, _ref3;
(_a = a) === null || _a === void 0 ? void 0 : new _a.b();
(_a2 = a) === null || _a2 === void 0 ? void 0 : (_a2$b = _a2.b) === null || _a2$b === void 0 ? void 0 : (_a2$b$c = _a2$b.c) === null || _a2$b$c === void 0 ? void 0 : new _a2$b$c.d();
(_a3 = a) === null || _a3 === void 0 ? void 0 : new _a3.b();
(_a4 = a) === null || _a4 === void 0 ? void 0 : (_a4$b = _a4.b) === null || _a4$b === void 0 ? void 0 : (_a4$b$c = _a4$b.c) === null || _a4$b$c === void 0 ? void 0 : new _a4$b$c.d();
(_b = b) === null || _b === void 0 ? void 0 : new _b(b);
(_a5 = a) === null || _a5 === void 0 ? void 0 : (_a5$b = _a5.b) === null || _a5$b === void 0 ? void 0 : new _a5$b(a.b, true);
(_b2 = b) === null || _b2 === void 0 ? void 0 : new _b2().c;
(_b3 = b) === null || _b3 === void 0 ? void 0 : (_ref = new _b3()) === null || _ref === void 0 ? void 0 : _ref.c;
(_a$b = a.b) === null || _a$b === void 0 ? void 0 : new _a$b().c;
(_a$b2 = a.b) === null || _a$b2 === void 0 ? void 0 : (_ref2 = new _a$b2()) === null || _ref2 === void 0 ? void 0 : _ref2.c;
(_a6 = a) === null || _a6 === void 0 ? void 0 : (_a6$b = _a6.b) === null || _a6$b === void 0 ? void 0 : new _a6$b().c;
(_a7 = a) === null || _a7 === void 0 ? void 0 : (_a7$b = _a7.b) === null || _a7$b === void 0 ? void 0 : (_ref3 = new _a7$b()) === null || _ref3 === void 0 ? void 0 : _ref3.c;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["proposal-optional-chaining"]
}

View File

@@ -0,0 +1,3 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);