@meteorjs/babel 7.18.0-beta.6 → 7.19.0-beta.2
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 +15 -10
- package/package.json +2 -3
- package/plugins/async-await.js +1 -1
- package/runtime.js +0 -18
package/options.js
CHANGED
|
@@ -35,6 +35,10 @@ function getReifyOptions(features) {
|
|
|
35
35
|
// wrap it with a function to rename the `module` identifier.
|
|
36
36
|
reifyOptions.moduleAlias = "module";
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
if (features.topLevelAwait) {
|
|
40
|
+
reifyOptions.topLevelAwait = true;
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
return reifyOptions;
|
|
@@ -182,18 +186,19 @@ function getDefaultsForNode8(features) {
|
|
|
182
186
|
require("@babel/plugin-syntax-object-rest-spread"),
|
|
183
187
|
require("@babel/plugin-proposal-object-rest-spread")
|
|
184
188
|
);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// full advantage of native async/await support in Node 8.
|
|
188
|
-
const isFiberDisabled = process.env.DISABLE_FIBERS === '1';
|
|
189
|
+
// TODO [fibers]: instead of removing the code below, consider this comment:
|
|
190
|
+
// https://github.com/meteor/meteor/pull/12471/files#r1089610144
|
|
189
191
|
const ignoreAsyncPlugin = process.env.IGNORE_ASYNC_PLUGIN === '1';
|
|
190
192
|
|
|
191
|
-
if (!ignoreAsyncPlugin) {
|
|
192
|
-
combined.plugins.push([
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
if (!features.useNativeAsyncAwait && !ignoreAsyncPlugin) {
|
|
194
|
+
combined.plugins.push([
|
|
195
|
+
require('./plugins/async-await.js'),
|
|
196
|
+
{
|
|
197
|
+
// Even though Node 8 supports native async/await, it is not
|
|
198
|
+
// compatible with fibers.
|
|
199
|
+
useNativeAsyncAwait: false,
|
|
200
|
+
},
|
|
201
|
+
]);
|
|
197
202
|
}
|
|
198
203
|
// Enable async generator functions proposal.
|
|
199
204
|
combined.plugins.push(require("@babel/plugin-proposal-async-generator-functions"));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meteorjs/babel",
|
|
3
3
|
"author": "Meteor <dev@meteor.com>",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.19.0-beta.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Babel wrapper package for use with Meteor",
|
|
7
7
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@babel/template": "^7.16.7",
|
|
42
42
|
"@babel/traverse": "^7.17.0",
|
|
43
43
|
"@babel/types": "^7.17.0",
|
|
44
|
-
"@meteorjs/reify": "
|
|
44
|
+
"@meteorjs/reify": "https://github.com/meteor/reify/tarball/ee36898798645097948258eb9106dd0af60cec64",
|
|
45
45
|
"babel-preset-meteor": "^7.10.0",
|
|
46
46
|
"babel-preset-minify": "^0.5.1",
|
|
47
47
|
"convert-source-map": "^1.6.0",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@babel/plugin-syntax-decorators": "7.14.5",
|
|
55
55
|
"d3": "4.13.0",
|
|
56
56
|
"fibers": "5.0.0",
|
|
57
|
-
"meteor-promise": "0.9.0",
|
|
58
57
|
"mocha": "6.2.3",
|
|
59
58
|
"promise": "8.1.0",
|
|
60
59
|
"source-map": "0.6.1"
|
package/plugins/async-await.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = function (babel) {
|
|
|
27
27
|
node.body,
|
|
28
28
|
// The inner function called by Promise.asyncApply should be
|
|
29
29
|
// async if we have native async/await support.
|
|
30
|
-
!!
|
|
30
|
+
!!this.opts.useNativeAsyncAwait
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
const promiseResultExpression = t.callExpression(
|
package/runtime.js
CHANGED
|
@@ -11,21 +11,3 @@ Module.prototype.resolve = function (id) {
|
|
|
11
11
|
|
|
12
12
|
require("@meteorjs/reify/lib/runtime").enable(Module.prototype);
|
|
13
13
|
|
|
14
|
-
if (!process.env.DISABLE_FIBERS) {
|
|
15
|
-
require("meteor-promise").makeCompatible(
|
|
16
|
-
global.Promise = global.Promise ||
|
|
17
|
-
require("promise/lib/es6-extensions"),
|
|
18
|
-
require("fibers")
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
// If Promise.asyncApply is defined, use it to wrap calls to
|
|
22
|
-
// regeneratorRuntime.async so that the entire async function will run in
|
|
23
|
-
// its own Fiber, not just the code that comes after the first await.
|
|
24
|
-
if (typeof Promise.asyncApply === "function") {
|
|
25
|
-
var regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
26
|
-
var realAsync = regeneratorRuntime.async;
|
|
27
|
-
regeneratorRuntime.async = function (innerFn) {
|
|
28
|
-
return Promise.asyncApply(realAsync, regeneratorRuntime, arguments);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|