diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index 76db204668..69c61db864 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -46,6 +46,8 @@ export default class Buffer { }; if (map) { + // The `.map` property is lazy to allow callers to use the raw mappings + // without any overhead Object.defineProperty(result, "map", { configurable: true, enumerable: true, diff --git a/packages/babel-generator/src/source-map.js b/packages/babel-generator/src/source-map.js index c94c9140cf..4388debc89 100644 --- a/packages/babel-generator/src/source-map.js +++ b/packages/babel-generator/src/source-map.js @@ -70,6 +70,8 @@ export default class SourceMap { this._lastSourceLine = line; this._lastSourceColumn = column; + // We are deliberately not using the `source-map` library here to allow + // callers to use these mappings without any overhead this._rawMappings.push({ // undefined to allow for more compact json serialization name: identifierName || undefined,