@meteorjs/babel 7.20.2-rc.0 → 7.20.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/register.js +12 -4
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.20.2-rc.0",
4
+ "version": "7.20.2",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "description": "Babel wrapper package for use with Meteor",
package/register.js CHANGED
@@ -16,6 +16,7 @@ var config = {
16
16
  excludedFiles: Object.create(null),
17
17
  babelOptions: null
18
18
  };
19
+ var compilationDepth = 0;
19
20
 
20
21
  function setBabelOptions(options) {
21
22
  config.babelOptions = util.deepClone(options);
@@ -79,7 +80,9 @@ enableExtension(".js");
79
80
  enableExtension(".ts");
80
81
 
81
82
  exports.retrieveSourceMap = function(filename) {
82
- if (shouldNotTransform(filename)) {
83
+ // Formatting a stack trace can request a source map while Babel is still
84
+ // loading its plugins. Compiling here would re-enter an incomplete preset.
85
+ if (compilationDepth > 0 || shouldNotTransform(filename)) {
83
86
  return null;
84
87
  }
85
88
 
@@ -182,7 +185,12 @@ function getBabelResult(filename) {
182
185
 
183
186
  babelOptions.filename = filename;
184
187
 
185
- return meteorBabel.compile(source, babelOptions, {
186
- cacheDirectory: config.cacheDirectory
187
- });
188
+ compilationDepth++;
189
+ try {
190
+ return meteorBabel.compile(source, babelOptions, {
191
+ cacheDirectory: config.cacheDirectory
192
+ });
193
+ } finally {
194
+ compilationDepth--;
195
+ }
188
196
  }