Files
meteor/tools/tool-env/install-runtime.js
Ben Newman a9e8cbe267 Move Promise runtime setup into its own module.
Test code was requiring the install-runtime.js module without requiring
the index.js module, so global.Promise was not defined.
2016-07-07 17:01:11 -04:00

30 lines
1.1 KiB
JavaScript

// Install ES2015-complaint polyfills for Object, Array, String, Function,
// Symbol, Map, Set, and Promise, patching the native implementations when
// they are available.
require("meteor-ecmascript-runtime");
require("./install-promise.js");
// Verify that the babel-runtime package is available to be required.
// The .join("/") prevents babel-plugin-transform-runtime from
// "intelligently" converting this to an import statement.
var regenerator = require([
"babel-runtime",
"regenerator"
].join("/"));
// Use Promise.asyncApply to wrap calls to runtime.async so that the
// entire async function will run in its own Fiber, not just the code that
// comes after the first await.
var realAsync = regenerator.async;
regenerator.async = function () {
return Promise.asyncApply(realAsync, regenerator, arguments);
};
// Install global.meteorBabelHelpers so that the compiler doesn't need to
// add boilerplate at the top of every file.
require("meteor-babel").defineHelpers();
// Installs source map support with a hook to add functions to look for
// source maps in custom places.
require('./source-map-retriever-stack.js');