@meteorjs/babel 7.18.0-beta.2 → 7.18.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/options.js +1 -0
- package/package.json +1 -1
- package/plugins/async-await.js +12 -5
package/options.js
CHANGED
|
@@ -191,6 +191,7 @@ function getDefaultsForNode8(features) {
|
|
|
191
191
|
// 8 has native support for await expressions.
|
|
192
192
|
useNativeAsyncAwait: !isFiberDisabled,
|
|
193
193
|
isFiberDisabled: isFiberDisabled,
|
|
194
|
+
overwriteFiberExit: process.env.OVERWRITE_FIBERS_EXIT === '1',
|
|
194
195
|
}]);
|
|
195
196
|
|
|
196
197
|
// Enable async generator functions proposal.
|
package/package.json
CHANGED
package/plugins/async-await.js
CHANGED
|
@@ -9,14 +9,10 @@ module.exports = function (babel) {
|
|
|
9
9
|
Function: {
|
|
10
10
|
exit: function (path) {
|
|
11
11
|
const node = path.node;
|
|
12
|
-
if (!node.async
|
|
12
|
+
if (!node.async) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// The original function becomes a non-async function that
|
|
17
|
-
// returns a Promise.
|
|
18
|
-
node.async = false;
|
|
19
|
-
|
|
20
16
|
// The inner function should inherit lexical environment items
|
|
21
17
|
// like `this`, `super`, and `arguments` from the outer
|
|
22
18
|
// function, and arrow functions provide exactly that behavior.
|
|
@@ -30,6 +26,17 @@ module.exports = function (babel) {
|
|
|
30
26
|
!! this.opts.useNativeAsyncAwait
|
|
31
27
|
);
|
|
32
28
|
|
|
29
|
+
if (this.opts.isFiberDisabled && this.opts.overwriteFiberExit) {
|
|
30
|
+
if (node.type === "ArrowFunctionExpression") {
|
|
31
|
+
node.body = innerFn;
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The original function becomes a non-async function that
|
|
37
|
+
// returns a Promise.
|
|
38
|
+
node.async = false;
|
|
39
|
+
|
|
33
40
|
const promiseResultExpression = t.callExpression(
|
|
34
41
|
t.memberExpression(
|
|
35
42
|
t.identifier("Promise"),
|