mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Don't apply async-await plugin and don't modify promise functions.
This commit is contained in:
@@ -185,11 +185,13 @@ function getDefaultsForNode8(features) {
|
||||
|
||||
// Ensure that async functions run in a Fiber, while also taking
|
||||
// full advantage of native async/await support in Node 8.
|
||||
combined.plugins.push([require("./plugins/async-await.js"), {
|
||||
// Do not transform `await x` to `Promise.await(x)`, since Node
|
||||
// 8 has native support for await expressions.
|
||||
useNativeAsyncAwait: false
|
||||
}]);
|
||||
if (!process.env.DISABLE_FIBERS) {
|
||||
combined.plugins.push([require("./plugins/async-await.js"), {
|
||||
// Do not transform `await x` to `Promise.await(x)`, since Node
|
||||
// 8 has native support for await expressions.
|
||||
useNativeAsyncAwait: false
|
||||
}]);
|
||||
}
|
||||
|
||||
// Enable async generator functions proposal.
|
||||
combined.plugins.push(require("@babel/plugin-proposal-async-generator-functions"));
|
||||
|
||||
@@ -11,19 +11,21 @@ Module.prototype.resolve = function (id) {
|
||||
|
||||
require("@meteorjs/reify/lib/runtime").enable(Module.prototype);
|
||||
|
||||
require("meteor-promise").makeCompatible(
|
||||
global.Promise = global.Promise ||
|
||||
require("promise/lib/es6-extensions"),
|
||||
require("fibers")
|
||||
);
|
||||
if (!process.env.DISABLE_FIBERS) {
|
||||
require("meteor-promise").makeCompatible(
|
||||
global.Promise = global.Promise ||
|
||||
require("promise/lib/es6-extensions"),
|
||||
require("fibers")
|
||||
);
|
||||
|
||||
// If Promise.asyncApply is defined, use it to wrap calls to
|
||||
// regeneratorRuntime.async so that the entire async function will run in
|
||||
// its own Fiber, not just the code that comes after the first await.
|
||||
if (typeof Promise.asyncApply === "function") {
|
||||
var regeneratorRuntime = require("@babel/runtime/regenerator");
|
||||
var realAsync = regeneratorRuntime.async;
|
||||
regeneratorRuntime.async = function (innerFn) {
|
||||
return Promise.asyncApply(realAsync, regeneratorRuntime, arguments);
|
||||
};
|
||||
if (typeof Promise.asyncApply === "function") {
|
||||
var regeneratorRuntime = require("@babel/runtime/regenerator");
|
||||
var realAsync = regeneratorRuntime.async;
|
||||
regeneratorRuntime.async = function (innerFn) {
|
||||
return Promise.asyncApply(realAsync, regeneratorRuntime, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
require("./extensions.js");
|
||||
|
||||
require("meteor-promise").makeCompatible(
|
||||
Promise,
|
||||
// Allow every Promise callback to run in a Fiber drawn from a pool of
|
||||
// reusable Fibers.
|
||||
require("fibers")
|
||||
);
|
||||
if (!process.env.DISABLE_FIBERS) {
|
||||
require("meteor-promise").makeCompatible(
|
||||
Promise,
|
||||
// Allow every Promise callback to run in a Fiber drawn from a pool of
|
||||
// reusable Fibers.
|
||||
require("fibers")
|
||||
);
|
||||
}
|
||||
|
||||
// Reference: https://caniuse.com/#feat=promises
|
||||
require("meteor/modern-browsers").setMinimumBrowserVersions({
|
||||
|
||||
Reference in New Issue
Block a user