Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@babel/generator

Package Overview
Dependencies
Maintainers
4
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/generator - npm Package Compare versions

Comparing version
7.29.1
to
7.29.6
+11
-8
lib/buffer.js

@@ -83,5 +83,5 @@ "use strict";

}
append(str, maybeNewline) {
append(str, maybeNewline, ignoreMapping = false) {
this._flush();
this._append(str, maybeNewline);
this._append(str, maybeNewline, ignoreMapping);
}

@@ -132,3 +132,3 @@ appendChar(char) {

}
_append(str, maybeNewline) {
_append(str, maybeNewline, ignoreMapping) {
const len = str.length;

@@ -146,3 +146,3 @@ const position = this._position;

}
const hasMap = this._map !== null;
const hasMap = !ignoreMapping && this._map !== null;
if (!maybeNewline && !hasMap) {

@@ -231,9 +231,12 @@ position.column += len;

const pos = loc[prop];
const target = this._sourcePosition;
if (pos) {
target.line = pos.line;
target.column = Math.max(pos.column + columnOffset, 0);
target.filename = loc.filename;
this.setSourcePosition(pos.line, Math.max(pos.column + columnOffset, 0));
this._sourcePosition.filename = loc.filename;
}
}
setSourcePosition(line, column) {
const target = this._sourcePosition;
target.line = line;
target.column = column;
}
getCurrentColumn() {

@@ -240,0 +243,0 @@ return this._position.column + (this._queuedChar ? 1 : 0);

@@ -1,1 +0,1 @@

{"version":3,"names":["spaceIndents","i","push","repeat","Buffer","constructor","map","indentChar","_map","_buf","_str","_appendCount","_last","_canMarkIdName","_indentChar","_queuedChar","_position","line","column","_sourcePosition","identifierName","undefined","identifierNamePos","filename","get","_flush","code","trimRight","decodedMap","rawMappings","result","getDecoded","__mergedMap","resultMap","value","Object","defineProperty","writable","mappings","getRawMappings","append","str","maybeNewline","_append","appendChar","char","_appendChar","queue","queuedChar","useSourcePos","indent","String","fromCharCode","isSpace","position","sourcePos","mark","len","length","hasMap","indexOf","last","removeLastSemicolon","getLastChar","checkQueue","getNewlineCount","hasContent","exactSource","loc","cb","source","prop","_normalizePosition","sourceWithOffset","columnOffset","pos","target","Math","max","getCurrentColumn","getCurrentLine","exports","default"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map.ts\";\nimport type { SourceLocation } from \"@babel/types\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charcodes from \"charcodes\";\n\nexport type Loc = SourceLocation;\nexport type Pos = SourceLocation[\"start\"];\n\ntype SourcePosition = {\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n identifierNamePos: Pos | undefined;\n filename: string | undefined;\n};\n\nconst spaceIndents: string[] = [];\nfor (let i = 0; i < 32; i++) {\n spaceIndents.push(\" \".repeat(i * 2));\n}\n\nexport default class Buffer {\n constructor(map: SourceMap | null, indentChar: string) {\n this._map = map;\n this._indentChar = indentChar;\n }\n\n _map: SourceMap | null = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _canMarkIdName = true;\n _indentChar = \"\";\n _queuedChar: typeof charcodes.space | typeof charcodes.semicolon | 0 = 0;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition: SourcePosition = {\n identifierName: undefined,\n identifierNamePos: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n const { _map, _last } = this;\n if (this._queuedChar !== charcodes.space) {\n this._flush();\n }\n\n // Whatever trim is used here should not execute a regex against the\n // source string since it may be arbitrarily large after all transformations\n const code =\n _last === charcodes.lineFeed\n ? (this._buf + this._str).trimRight()\n : this._buf + this._str;\n\n // Creating objects with getters is expensive.\n if (_map === null) {\n return {\n code: code,\n decodedMap: undefined,\n map: null,\n rawMappings: undefined,\n };\n }\n\n const result = {\n code: code,\n // Decoded sourcemap is free to generate.\n decodedMap: _map.getDecoded(),\n // Used as a marker for backwards compatibility. We moved input map merging\n // into the generator. We cannot merge the input map a second time, so the\n // presence of this field tells us we've already done the work.\n get __mergedMap() {\n return this.map;\n },\n // Encoding the sourcemap is moderately CPU expensive.\n get map() {\n const resultMap = _map.get();\n result.map = resultMap;\n return resultMap;\n },\n set map(value) {\n Object.defineProperty(result, \"map\", { value, writable: true });\n },\n // Retrieving the raw mappings is very memory intensive.\n get rawMappings() {\n const mappings = _map.getRawMappings();\n result.rawMappings = mappings;\n return mappings;\n },\n set rawMappings(value) {\n Object.defineProperty(result, \"rawMappings\", { value, writable: true });\n },\n };\n\n return result;\n }\n\n /**\n * Add a string to the buffer that cannot be reverted.\n */\n\n append(str: string, maybeNewline: boolean): void {\n this._flush();\n this._append(str, maybeNewline);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, true);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: typeof charcodes.space | typeof charcodes.semicolon): void {\n this._flush();\n this._queuedChar = char;\n }\n\n _flush(): void {\n const queuedChar = this._queuedChar;\n if (queuedChar !== 0) {\n this._appendChar(queuedChar, 1, true);\n this._queuedChar = 0;\n }\n }\n\n _appendChar(char: number, repeat: number, useSourcePos: boolean): void {\n this._last = char;\n\n if (char === -1) {\n const indent =\n repeat >= 64\n ? this._indentChar.repeat(repeat)\n : spaceIndents[repeat / 2];\n this._str += indent;\n } else {\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n }\n\n const isSpace = char === charcodes.space;\n const position = this._position;\n if (char !== charcodes.lineFeed) {\n if (this._map) {\n const sourcePos = this._sourcePosition;\n if (useSourcePos && sourcePos) {\n this._map.mark(\n position,\n sourcePos.line,\n sourcePos.column,\n isSpace ? undefined : sourcePos.identifierName,\n isSpace ? undefined : sourcePos.identifierNamePos,\n sourcePos.filename,\n );\n\n if (!isSpace && this._canMarkIdName) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n } else {\n this._map.mark(position);\n }\n }\n\n position.column += repeat;\n } else {\n position.line++;\n position.column = 0;\n }\n }\n\n _append(str: string, maybeNewline: boolean): void {\n const len = str.length;\n const position = this._position;\n const sourcePos = this._sourcePosition;\n\n this._last = -1; /* LAST_CHAR_KINDS.NORMAL */\n\n if (++this._appendCount > 4096) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n +this._str; // Unexplainable huge performance boost. Ref: https://github.com/davidmarkclements/flatstr License: MIT\n this._buf += this._str;\n this._str = str;\n this._appendCount = 0;\n } else {\n this._str += str;\n }\n\n const hasMap = this._map !== null;\n\n if (!maybeNewline && !hasMap) {\n position.column += len;\n return;\n }\n\n const { column, identifierName, identifierNamePos, filename } = sourcePos;\n let line = sourcePos.line;\n\n if (\n (identifierName != null || identifierNamePos != null) &&\n this._canMarkIdName\n ) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n\n // Search for newline chars. We search only for `\\n`, since both `\\r` and\n // `\\r\\n` are normalized to `\\n` during parse. We exclude `\\u2028` and\n // `\\u2029` for performance reasons, they're so uncommon that it's probably\n // ok. It's also unclear how other sourcemap utilities handle them...\n let i = str.indexOf(\"\\n\");\n let last = 0;\n\n // If the string starts with a newline char, then adding a mark is redundant.\n // This catches both \"no newlines\" and \"newline after several chars\".\n if (hasMap && i !== 0) {\n this._map!.mark(\n position,\n line,\n column,\n identifierName,\n identifierNamePos,\n filename,\n );\n }\n\n // Now, find each remaining newline char in the string.\n while (i !== -1) {\n position.line++;\n position.column = 0;\n last = i + 1;\n\n // We mark the start of each line, which happens directly after this newline char\n // unless this is the last char.\n // When manually adding multi-line content (such as a comment), `line` will be `undefined`.\n if (last < len && line !== undefined) {\n line++;\n if (hasMap) {\n this._map!.mark(position, line, 0, undefined, undefined, filename);\n }\n }\n i = str.indexOf(\"\\n\", last);\n }\n position.column += len - last;\n }\n\n removeLastSemicolon(): void {\n if (this._queuedChar === charcodes.semicolon) {\n this._queuedChar = 0;\n }\n }\n\n getLastChar(checkQueue?: boolean): number {\n if (!checkQueue) {\n return this._last;\n }\n const queuedChar = this._queuedChar;\n return queuedChar !== 0 ? queuedChar : this._last;\n }\n\n /**\n * This will only detect at most 1 newline after a call to `flush()`,\n * but this has not been found so far, and an accurate count can be achieved if needed later.\n */\n getNewlineCount(): number {\n return this._queuedChar === 0 && this._last === charcodes.lineFeed ? 1 : 0;\n }\n\n hasContent(): boolean {\n return this._last !== 0 /*|| this._queuedChar !== 0*/;\n }\n\n /**\n * Certain sourcemap usecases expect mappings to be more accurate than\n * Babel's generic sourcemap handling allows. For now, we special-case\n * identifiers to allow for the primary cases to work.\n * The goal of this line is to ensure that the map output from Babel will\n * have an exact range on identifiers in the output code. Without this\n * line, Babel would potentially include some number of trailing tokens\n * that are printed after the identifier, but before another location has\n * been assigned.\n * This allows tooling like Rollup and Webpack to more accurately perform\n * their own transformations. Most importantly, this allows the import/export\n * transformations performed by those tools to loose less information when\n * applying their own transformations on top of the code and map results\n * generated by Babel itself.\n *\n * The primary example of this is the snippet:\n *\n * import mod from \"mod\";\n * mod();\n *\n * With this line, there will be one mapping range over \"mod\" and another\n * over \"();\", where previously it would have been a single mapping.\n */\n exactSource(loc: Loc, cb: () => void) {\n if (!this._map) {\n cb();\n return;\n }\n\n this.source(\"start\", loc);\n const identifierName = loc.identifierName;\n const sourcePos = this._sourcePosition;\n if (identifierName != null) {\n this._canMarkIdName = false;\n sourcePos.identifierName = identifierName;\n }\n cb();\n\n if (identifierName != null) {\n this._canMarkIdName = true;\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n this.source(\"end\", loc);\n }\n\n /**\n * Sets a given position as the current source location so generated code after this call\n * will be given this position in the sourcemap.\n */\n\n source(prop: \"start\" | \"end\", loc: Loc): void {\n if (!this._map) return;\n\n // Since this is called extremely often, we reuse the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, 0);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc,\n columnOffset: number,\n ): void {\n if (!this._map) return;\n\n this._normalizePosition(prop, loc, columnOffset);\n }\n\n _normalizePosition(prop: \"start\" | \"end\", loc: Loc, columnOffset: number) {\n this._flush();\n\n const pos = loc[prop];\n const target = this._sourcePosition;\n\n if (pos) {\n target.line = pos.line;\n // TODO: Fix https://github.com/babel/babel/issues/15712 in downstream\n target.column = Math.max(pos.column + columnOffset, 0);\n target.filename = loc.filename;\n }\n }\n\n getCurrentColumn(): number {\n return this._position.column + (this._queuedChar ? 1 : 0);\n }\n\n getCurrentLine(): number {\n return this._position.line;\n }\n}\n"],"mappings":";;;;;;AAkBA,MAAMA,YAAsB,GAAG,EAAE;AACjC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;EAC3BD,YAAY,CAACE,IAAI,CAAC,GAAG,CAACC,MAAM,CAACF,CAAC,GAAG,CAAC,CAAC,CAAC;AACtC;AAEe,MAAMG,MAAM,CAAC;EAC1BC,WAAWA,CAACC,GAAqB,EAAEC,UAAkB,EAAE;IAAA,KAKvDC,IAAI,GAAqB,IAAI;IAAA,KAC7BC,IAAI,GAAG,EAAE;IAAA,KACTC,IAAI,GAAG,EAAE;IAAA,KACTC,YAAY,GAAG,CAAC;IAAA,KAChBC,KAAK,GAAG,CAAC;IAAA,KACTC,cAAc,GAAG,IAAI;IAAA,KACrBC,WAAW,GAAG,EAAE;IAAA,KAChBC,WAAW,GAA4D,CAAC;IAAA,KAExEC,SAAS,GAAG;MACVC,IAAI,EAAE,CAAC;MACPC,MAAM,EAAE;IACV,CAAC;IAAA,KACDC,eAAe,GAAmB;MAChCC,cAAc,EAAEC,SAAS;MACzBC,iBAAiB,EAAED,SAAS;MAC5BJ,IAAI,EAAEI,SAAS;MACfH,MAAM,EAAEG,SAAS;MACjBE,QAAQ,EAAEF;IACZ,CAAC;IAvBC,IAAI,CAACb,IAAI,GAAGF,GAAG;IACf,IAAI,CAACQ,WAAW,GAAGP,UAAU;EAC/B;EA2BAiB,GAAGA,CAAA,EAAG;IACJ,MA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S,CAACC,IAAI;EAC5B;AACF;AAACgE,OAAA,CAAAC,OAAA,GAAA9E,MAAA","ignoreList":[]}
{"version":3,"names":["spaceIndents","i","push","repeat","Buffer","constructor","map","indentChar","_map","_buf","_str","_appendCount","_last","_canMarkIdName","_indentChar","_queuedChar","_position","line","column","_sourcePosition","identifierName","undefined","identifierNamePos","filename","get","_flush","code","trimRight","decodedMap","rawMappings","result","getDecoded","__mergedMap","resultMap","value","Object","defineProperty","writable","mappings","getRawMappings","append","str","maybeNewline","ignoreMapping","_append","appendChar","char","_appendChar","queue","queuedChar","useSourcePos","indent","String","fromCharCode","isSpace","position","sourcePos","mark","len","length","hasMap","indexOf","last","removeLastSemicolon","getLastChar","checkQueue","getNewlineCount","hasContent","exactSource","loc","cb","source","prop","_normalizePosition","sourceWithOffset","columnOffset","pos","setSourcePosition","Math","max","target","getCurrentColumn","getCurrentLine","exports","default"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map.ts\";\nimport type { SourceLocation } from \"@babel/types\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charcodes from \"charcodes\";\n\nexport type Loc = SourceLocation;\nexport type Pos = SourceLocation[\"start\"];\n\ntype SourcePosition = {\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n identifierNamePos: Pos | undefined;\n filename: string | undefined;\n};\n\nconst spaceIndents: string[] = [];\nfor (let i = 0; i < 32; i++) {\n spaceIndents.push(\" \".repeat(i * 2));\n}\n\nexport default class Buffer {\n constructor(map: SourceMap | null, indentChar: string) {\n this._map = map;\n this._indentChar = indentChar;\n }\n\n _map: SourceMap | null = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _canMarkIdName = true;\n _indentChar = \"\";\n _queuedChar: typeof charcodes.space | typeof charcodes.semicolon | 0 = 0;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition: SourcePosition = {\n identifierName: undefined,\n identifierNamePos: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n const { _map, _last } = this;\n if (this._queuedChar !== charcodes.space) {\n this._flush();\n }\n\n // Whatever trim is used here should not execute a regex against the\n // source string since it may be arbitrarily large after all transformations\n const code =\n _last === charcodes.lineFeed\n ? (this._buf + this._str).trimRight()\n : this._buf + this._str;\n\n // Creating objects with getters is expensive.\n if (_map === null) {\n return {\n code: code,\n decodedMap: undefined,\n map: null,\n rawMappings: undefined,\n };\n }\n\n const result = {\n code: code,\n // Decoded sourcemap is free to generate.\n decodedMap: _map.getDecoded(),\n // Used as a marker for backwards compatibility. We moved input map merging\n // into the generator. We cannot merge the input map a second time, so the\n // presence of this field tells us we've already done the work.\n get __mergedMap() {\n return this.map;\n },\n // Encoding the sourcemap is moderately CPU expensive.\n get map() {\n const resultMap = _map.get();\n result.map = resultMap;\n return resultMap;\n },\n set map(value) {\n Object.defineProperty(result, \"map\", { value, writable: true });\n },\n // Retrieving the raw mappings is very memory intensive.\n get rawMappings() {\n const mappings = _map.getRawMappings();\n result.rawMappings = mappings;\n return mappings;\n },\n set rawMappings(value) {\n Object.defineProperty(result, \"rawMappings\", { value, writable: true });\n },\n };\n\n return result;\n }\n\n /**\n * Add a string to the buffer that cannot be reverted.\n */\n\n append(\n str: string,\n maybeNewline: boolean,\n ignoreMapping: boolean = false,\n ): void {\n this._flush();\n this._append(str, maybeNewline, ignoreMapping);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, true);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: typeof charcodes.space | typeof charcodes.semicolon): void {\n this._flush();\n this._queuedChar = char;\n }\n\n _flush(): void {\n const queuedChar = this._queuedChar;\n if (queuedChar !== 0) {\n this._appendChar(queuedChar, 1, true);\n this._queuedChar = 0;\n }\n }\n\n _appendChar(char: number, repeat: number, useSourcePos: boolean): void {\n this._last = char;\n\n if (char === -1) {\n const indent =\n repeat >= 64\n ? this._indentChar.repeat(repeat)\n : spaceIndents[repeat / 2];\n this._str += indent;\n } else {\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n }\n\n const isSpace = char === charcodes.space;\n const position = this._position;\n if (char !== charcodes.lineFeed) {\n if (this._map) {\n const sourcePos = this._sourcePosition;\n if (useSourcePos && sourcePos) {\n this._map.mark(\n position,\n sourcePos.line,\n sourcePos.column,\n isSpace ? undefined : sourcePos.identifierName,\n isSpace ? undefined : sourcePos.identifierNamePos,\n sourcePos.filename,\n );\n\n if (!isSpace && this._canMarkIdName) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n } else {\n this._map.mark(position);\n }\n }\n\n position.column += repeat;\n } else {\n position.line++;\n position.column = 0;\n }\n }\n\n _append(str: string, maybeNewline: boolean, ignoreMapping: boolean): void {\n const len = str.length;\n const position = this._position;\n const sourcePos = this._sourcePosition;\n\n this._last = -1; /* LAST_CHAR_KINDS.NORMAL */\n\n if (++this._appendCount > 4096) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n +this._str; // Unexplainable huge performance boost. Ref: https://github.com/davidmarkclements/flatstr License: MIT\n this._buf += this._str;\n this._str = str;\n this._appendCount = 0;\n } else {\n this._str += str;\n }\n\n const hasMap = !ignoreMapping && this._map !== null;\n\n if (!maybeNewline && !hasMap) {\n position.column += len;\n return;\n }\n\n const { column, identifierName, identifierNamePos, filename } = sourcePos;\n let line = sourcePos.line;\n\n if (\n (identifierName != null || identifierNamePos != null) &&\n this._canMarkIdName\n ) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n\n // Search for newline chars. We search only for `\\n`, since both `\\r` and\n // `\\r\\n` are normalized to `\\n` during parse. We exclude `\\u2028` and\n // `\\u2029` for performance reasons, they're so uncommon that it's probably\n // ok. It's also unclear how other sourcemap utilities handle them...\n let i = str.indexOf(\"\\n\");\n let last = 0;\n\n // If the string starts with a newline char, then adding a mark is redundant.\n // This catches both \"no newlines\" and \"newline after several chars\".\n if (hasMap && i !== 0) {\n this._map!.mark(\n position,\n line,\n column,\n identifierName,\n identifierNamePos,\n filename,\n );\n }\n\n // Now, find each remaining newline char in the string.\n while (i !== -1) {\n position.line++;\n position.column = 0;\n last = i + 1;\n\n // We mark the start of each line, which happens directly after this newline char\n // unless this is the last char.\n // When manually adding multi-line content (such as a comment), `line` will be `undefined`.\n if (last < len && line !== undefined) {\n line++;\n if (hasMap) {\n this._map!.mark(position, line, 0, undefined, undefined, filename);\n }\n }\n i = str.indexOf(\"\\n\", last);\n }\n position.column += len - last;\n }\n\n removeLastSemicolon(): void {\n if (this._queuedChar === charcodes.semicolon) {\n this._queuedChar = 0;\n }\n }\n\n getLastChar(checkQueue?: boolean): number {\n if (!checkQueue) {\n return this._last;\n }\n const queuedChar = this._queuedChar;\n return queuedChar !== 0 ? queuedChar : this._last;\n }\n\n /**\n * This will only detect at most 1 newline after a call to `flush()`,\n * but this has not been found so far, and an accurate count can be achieved if needed later.\n */\n getNewlineCount(): number {\n return this._queuedChar === 0 && this._last === charcodes.lineFeed ? 1 : 0;\n }\n\n hasContent(): boolean {\n return this._last !== 0 /*|| this._queuedChar !== 0*/;\n }\n\n /**\n * Certain sourcemap usecases expect mappings to be more accurate than\n * Babel's generic sourcemap handling allows. For now, we special-case\n * identifiers to allow for the primary cases to work.\n * The goal of this line is to ensure that the map output from Babel will\n * have an exact range on identifiers in the output code. Without this\n * line, Babel would potentially include some number of trailing tokens\n * that are printed after the identifier, but before another location has\n * been assigned.\n * This allows tooling like Rollup and Webpack to more accurately perform\n * their own transformations. Most importantly, this allows the import/export\n * transformations performed by those tools to loose less information when\n * applying their own transformations on top of the code and map results\n * generated by Babel itself.\n *\n * The primary example of this is the snippet:\n *\n * import mod from \"mod\";\n * mod();\n *\n * With this line, there will be one mapping range over \"mod\" and another\n * over \"();\", where previously it would have been a single mapping.\n */\n exactSource(loc: Loc, cb: () => void) {\n if (!this._map) {\n cb();\n return;\n }\n\n this.source(\"start\", loc);\n const identifierName = loc.identifierName;\n const sourcePos = this._sourcePosition;\n if (identifierName != null) {\n this._canMarkIdName = false;\n sourcePos.identifierName = identifierName;\n }\n cb();\n\n if (identifierName != null) {\n this._canMarkIdName = true;\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n this.source(\"end\", loc);\n }\n\n /**\n * Sets a given position as the current source location so generated code after this call\n * will be given this position in the sourcemap.\n */\n\n source(prop: \"start\" | \"end\", loc: Loc): void {\n if (!this._map) return;\n\n // Since this is called extremely often, we reuse the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, 0);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc,\n columnOffset: number,\n ): void {\n if (!this._map) return;\n\n this._normalizePosition(prop, loc, columnOffset);\n }\n\n _normalizePosition(prop: \"start\" | \"end\", loc: Loc, columnOffset: number) {\n this._flush();\n\n const pos = loc[prop];\n if (pos) {\n this.setSourcePosition(\n pos.line,\n // TODO: Fix https://github.com/babel/babel/issues/15712 in downstream\n Math.max(pos.column + columnOffset, 0),\n );\n this._sourcePosition.filename = loc.filename;\n }\n }\n\n setSourcePosition(line: number, column: number): void {\n const target = this._sourcePosition;\n target.line = line;\n target.column = column;\n }\n\n getCurrentColumn(): number {\n return this._position.column + (this._queuedChar ? 1 : 0);\n }\n\n getCurrentLine(): number {\n return this._position.line;\n }\n}\n"],"mappings":";;;;;;AAkBA,MAAMA,YAAsB,GAAG,EAAE;AACjC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;EAC3BD,YAAY,CAACE,IAAI,CAAC,GAAG,CAACC,MAAM,CAACF,CAAC,GAAG,CAAC,CAAC,CAAC;AACtC;AAEe,MAAMG,MAAM,CAAC;EAC1BC,WAAWA,CAACC,GAAqB,EAAEC,UAAkB,EAAE;IAAA,KAKvDC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,CAAC;EAClD;EAEAF,kBAAkBA,CAACD,IAAqB,EAAEH,GAAQ,EAAEM,YAAoB,EAAE;IACxE,IAAI,CAAClD,MAAM,CAAC,CAAC;IAEb,MAAMmD,GAAG,GAAGP,GAAG,CAACG,IAAI,CAAC;IACrB,IAAII,GAAG,EAAE;MACP,IAAI,CAACC,iBAAiB,CACpBD,GAAG,CAAC3D,IAAI,EAER6D,IAAI,CAACC,GAAG,CAACH,GAAG,CAAC1D,MAAM,GAAGyD,YAAY,EAAE,CAAC,CACvC,CAAC;MACD,IAAI,CAACxD,eAAe,CAACI,QAAQ,GAAG8C,GAAG,CAAC9C,QAAQ;IAC9C;EACF;EAEAsD,iBAAiBA,CAAC5D,IAAY,EAAEC,MAAc,EAAQ;IACpD,MAAM8D,MAAM,GAAG,IAAI,CAAC7D,eAAe;IACnC6D,MAAM,CAAC/D,IAAI,GAAGA,IAAI;IAClB+D,MAAM,CAAC9D,MAAM,GAAGA,MAAM;EACxB;EAEA+D,gBAAgBA,CAAA,EAAW;IACzB,OAAO,IAAI,CAACjE,SAAS,CAACE,MAAM,IAAI,IAAI,CAACH,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;EAC3D;EAEAmE,cAAcA,CAAA,EAAW;IACvB,OAAO,IAAI,CAAClE,SAAS,CAACC,IAAI;EAC5B;AACF;AAACkE,OAAA,CAAAC,OAAA,GAAAhF,MAAA","ignoreList":[]}

@@ -340,3 +340,4 @@ "use strict";

const spaces = this._originalCode ? this._originalCode.slice(index - spacesCount, index).replace(/[^\t\x0B\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/gu, " ") : " ".repeat(spacesCount);
this._append(spaces, false);
this._buf.append(spaces, false, true);
this._buf.setSourcePosition(line, column);
this.setLastChar(32);

@@ -343,0 +344,0 @@ }

@@ -61,3 +61,5 @@ "use strict";

});
if (!originalMapping.name && identifierNamePos) {
if (originalMapping.name && (identifierNamePos || identifierName != null && originalMapping.column === column)) {
identifierName = originalMapping.name;
} else if (identifierNamePos) {
const originalIdentifierMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, identifierNamePos);

@@ -64,0 +66,0 @@ if (originalIdentifierMapping.name) {

@@ -1,1 +0,1 @@

{"version":3,"names":["_genMapping","require","_traceMapping","SourceMap","constructor","opts","code","_opts$sourceFileName","_map","_rawMappings","_sourceFileName","_lastGenLine","_lastSourceLine","_lastSourceColumn","_inputMap","map","GenMapping","sourceRoot","sourceFileName","replace","undefined","inputSourceMap","TraceMap","resolvedSources","length","i","_this$_inputMap$sourc","setSourceContent","sourcesContent","Object","keys","get","toEncodedMap","getDecoded","toDecodedMap","getRawMappings","allMappings","mark","generated","line","column","identifierName","identifierNamePos","filename","_originalMapping","originalMapping","originalPositionFor","name","originalIdentifierMapping","source","maybeAddMapping","original","exports","default"],"sources":["../src/source-map.ts"],"sourcesContent":["import {\n GenMapping,\n maybeAddMapping,\n setSourceContent,\n allMappings,\n toEncodedMap,\n toDecodedMap,\n} from \"@jridgewell/gen-mapping\";\n\nimport type {\n EncodedSourceMap,\n DecodedSourceMap,\n Mapping,\n} from \"@jridgewell/gen-mapping\";\n\nimport type {\n InvalidOriginalMapping,\n OriginalMapping,\n SourceMapInput,\n} from \"@jridgewell/trace-mapping\";\nimport { originalPositionFor, TraceMap } from \"@jridgewell/trace-mapping\";\n\n/**\n * Build a sourcemap.\n */\n\nexport default class SourceMap {\n private _map: GenMapping;\n private _rawMappings: Mapping[] | undefined;\n private _sourceFileName: string | undefined;\n\n // Any real line is > 0, so init to 0 is fine.\n private _lastGenLine = 0;\n private _lastSourceLine = 0;\n\n // Source columns can be 0, but we only check in unison with sourceLine, which\n // inits to an impossible value. So init to 0 is fine.\n private _lastSourceColumn = 0;\n\n public _inputMap: TraceMap | null = null;\n\n constructor(\n opts: {\n sourceFileName?: string;\n sourceRoot?: string;\n inputSourceMap?: SourceMapInput;\n },\n code: string | Record<string, string> | null | undefined,\n ) {\n const map = (this._map = new GenMapping({ sourceRoot: opts.sourceRoot }));\n this._sourceFileName = opts.sourceFileName?.replace(/\\\\/g, \"/\");\n this._rawMappings = undefined;\n\n if (opts.inputSourceMap) {\n this._inputMap = new TraceMap(opts.inputSourceMap);\n const resolvedSources = this._inputMap.resolvedSources;\n if (resolvedSources.length) {\n for (let i = 0; i < resolvedSources.length; i++) {\n setSourceContent(\n map,\n resolvedSources[i],\n // @ts-expect-error FIXME: this._inputMap.sourcesContent?.[i] may be undefined, which is not acceptable by setSourceContent\n this._inputMap.sourcesContent?.[i],\n );\n }\n }\n }\n\n if (typeof code === \"string\" && !opts.inputSourceMap) {\n setSourceContent(map, this._sourceFileName!, code);\n } else if (typeof code === \"object\") {\n for (const sourceFileName of Object.keys(code!)) {\n setSourceContent(\n map,\n sourceFileName.replace(/\\\\/g, \"/\"),\n code![sourceFileName],\n );\n }\n }\n }\n\n /**\n * Get the sourcemap.\n */\n get(): EncodedSourceMap {\n return toEncodedMap(this._map);\n }\n\n getDecoded(): DecodedSourceMap {\n return toDecodedMap(this._map);\n }\n\n getRawMappings(): Mapping[] {\n return (this._rawMappings ||= allMappings(this._map));\n }\n\n /**\n * Mark the current generated position with a source position. May also be passed null line/column\n * values to insert a mapping to nothing.\n */\n\n mark(\n generated: { line: number; column: number },\n line?: number,\n column?: number,\n identifierName?: string | null,\n identifierNamePos?: { line: number; column: number },\n filename?: string | null,\n ) {\n this._rawMappings = undefined;\n\n let originalMapping: OriginalMapping | InvalidOriginalMapping | undefined;\n\n if (line != null) {\n if (this._inputMap) {\n // This is the lookup for this mark\n originalMapping = originalPositionFor(this._inputMap, {\n line,\n column: column!,\n });\n\n // If the we found a name, nothing else needs to be done\n // Maybe we're marking a `(` and the input map already had a name attached there,\n // or we're marking a `(` and the sourcemap spanned a `foo(`,\n // or we're marking an identifier, etc.\n if (!originalMapping.name && identifierNamePos) {\n // We're trying to mark a `(` (as that's the only thing that provides\n // an identifierNamePos currently), and we the AST had an identifier attached.\n // Lookup it's original name.\n const originalIdentifierMapping = originalPositionFor(\n this._inputMap,\n identifierNamePos,\n );\n if (originalIdentifierMapping.name) {\n identifierName = originalIdentifierMapping.name;\n }\n }\n } else {\n originalMapping = {\n name: null,\n source: filename?.replace(/\\\\/g, \"/\") || this._sourceFileName!,\n line: line,\n column: column!,\n };\n }\n }\n\n // @ts-expect-error FIXME: original cannot be InvalidOriginalMapping\n maybeAddMapping(this._map, {\n name: identifierName,\n generated,\n source: originalMapping?.source,\n original: originalMapping,\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAoBA,IAAAC,aAAA,GAAAD,OAAA;AAMe,MAAME,SAAS,CAAC;EAe7BC,WAAWA,CACTC,IAIC,EACDC,IAAwD,EACxD;IAAA,IAAAC,oBAAA;IAAA,KArBMC,IAAI;IAAA,KACJC,YAAY;IAAA,KACZC,eAAe;IAAA,KAGfC,YAAY,GAAG,CAAC;IAAA,KAChBC,eAAe,GAAG,CAAC;IAAA,KAInBC,iBAAiB,GAAG,CAAC;IAAA,KAEtBC,SAAS,GAAoB,IAAI;IAUtC,MAAMC,GAAG,GAAI,IAAI,CAACP,IAAI,GAAG,IAAIQ,sBAAU,CAAC;MAAEC,UAAU,EAAEZ,IAAI,CAACY;IAAW,CAAC,CAAE;IACzE,IAAI,CAACP,eAAe,IAAAH,oBAAA,GAAGF,IAAI,CAACa,cAAc,qBAAnBX,oBAAA,CAAqBY,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAC/D,IAAI,CAACV,YAAY,GAAGW,SAAS;IAE7B,IAAIf,IAAI,CAACgB,cAAc,EAAE;MACvB,IAAI,CAACP,SAAS,GAAG,IAAIQ,sBAAQ,CAACjB,IAAI,CAACgB,cAAc,CAAC;MAClD,MAAME,eAAe,GAAG,IAAI,CAACT,SAAS,CAACS,eAAe;MACtD,IAAIA,eAAe,CAACC,MAAM,EAAE;QAC1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,eAAe,CAACC,MAAM,EAAEC,CAAC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S,EAAE;QAElB+B,eAAe,GAAG,IAAAC,iCAAmB,EAAC,IAAI,CAAChC,SAAS,EAAE;UACpDyB,IAAI;UACJC,MAAM,EAAEA;QACV,CAAC,CAAC;QAMF,IAAI,CAACK,eAAe,CAACE,IAAI,IAAIL,iBAAiB,EAAE;UAI9C,MAAMM,yBAAyB,GAAG,IAAAF,iCAAmB,EACnD,IAAI,CAAChC,SAAS,EACd4B,iBACF,CAAC;UACD,IAAIM,yBAAyB,CAACD,IAAI,EAAE;YAClCN,cAAc,GAAGO,yBAAyB,CAACD,IAAI;UACjD;QACF;MACF,CAAC,MAAM;QACLF,eAAe,GAAG;UAChBE,IAAI,EAAE,IAAI;UACVE,MAAM,EAAE,CAAAN,QAAQ,oBAARA,QAAQ,CAAExB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAI,IAAI,CAACT,eAAgB;UAC9D6B,IAAI,EAAEA,IAAI;UACVC,MAAM,EAAEA;QACV,CAAC;MACH;IACF;IAGA,IAAAU,2BAAe,EAAC,IAAI,CAAC1C,IAAI,EAAE;MACzBuC,IAAI,EAAEN,cAAc;MACpBH,SAAS;MACTW,MAAM,GAAAL,gBAAA,GAAEC,eAAe,qBAAfD,gBAAA,CAAiBK,MAAM;MAC/BE,QAAQ,EAAEN;IACZ,CAAC,CAAC;EACJ;AACF;AAACO,OAAA,CAAAC,OAAA,GAAAlD,SAAA","ignoreList":[]}
{"version":3,"names":["_genMapping","require","_traceMapping","SourceMap","constructor","opts","code","_opts$sourceFileName","_map","_rawMappings","_sourceFileName","_lastGenLine","_lastSourceLine","_lastSourceColumn","_inputMap","map","GenMapping","sourceRoot","sourceFileName","replace","undefined","inputSourceMap","TraceMap","resolvedSources","length","i","_this$_inputMap$sourc","setSourceContent","sourcesContent","Object","keys","get","toEncodedMap","getDecoded","toDecodedMap","getRawMappings","allMappings","mark","generated","line","column","identifierName","identifierNamePos","filename","_originalMapping","originalMapping","originalPositionFor","name","originalIdentifierMapping","source","maybeAddMapping","original","exports","default"],"sources":["../src/source-map.ts"],"sourcesContent":["import {\n GenMapping,\n maybeAddMapping,\n setSourceContent,\n allMappings,\n toEncodedMap,\n toDecodedMap,\n} from \"@jridgewell/gen-mapping\";\n\nimport type {\n EncodedSourceMap,\n DecodedSourceMap,\n Mapping,\n} from \"@jridgewell/gen-mapping\";\n\nimport type {\n InvalidOriginalMapping,\n OriginalMapping,\n SourceMapInput,\n} from \"@jridgewell/trace-mapping\";\nimport { originalPositionFor, TraceMap } from \"@jridgewell/trace-mapping\";\n\n/**\n * Build a sourcemap.\n */\n\nexport default class SourceMap {\n private _map: GenMapping;\n private _rawMappings: Mapping[] | undefined;\n private _sourceFileName: string | undefined;\n\n // Any real line is > 0, so init to 0 is fine.\n private _lastGenLine = 0;\n private _lastSourceLine = 0;\n\n // Source columns can be 0, but we only check in unison with sourceLine, which\n // inits to an impossible value. So init to 0 is fine.\n private _lastSourceColumn = 0;\n\n public _inputMap: TraceMap | null = null;\n\n constructor(\n opts: {\n sourceFileName?: string;\n sourceRoot?: string;\n inputSourceMap?: SourceMapInput;\n },\n code: string | Record<string, string> | null | undefined,\n ) {\n const map = (this._map = new GenMapping({ sourceRoot: opts.sourceRoot }));\n this._sourceFileName = opts.sourceFileName?.replace(/\\\\/g, \"/\");\n this._rawMappings = undefined;\n\n if (opts.inputSourceMap) {\n this._inputMap = new TraceMap(opts.inputSourceMap);\n const resolvedSources = this._inputMap.resolvedSources;\n if (resolvedSources.length) {\n for (let i = 0; i < resolvedSources.length; i++) {\n setSourceContent(\n map,\n resolvedSources[i],\n // @ts-expect-error FIXME: this._inputMap.sourcesContent?.[i] may be undefined, which is not acceptable by setSourceContent\n this._inputMap.sourcesContent?.[i],\n );\n }\n }\n }\n\n if (typeof code === \"string\" && !opts.inputSourceMap) {\n setSourceContent(map, this._sourceFileName!, code);\n } else if (typeof code === \"object\") {\n for (const sourceFileName of Object.keys(code!)) {\n setSourceContent(\n map,\n sourceFileName.replace(/\\\\/g, \"/\"),\n code![sourceFileName],\n );\n }\n }\n }\n\n /**\n * Get the sourcemap.\n */\n get(): EncodedSourceMap {\n return toEncodedMap(this._map);\n }\n\n getDecoded(): DecodedSourceMap {\n return toDecodedMap(this._map);\n }\n\n getRawMappings(): Mapping[] {\n return (this._rawMappings ||= allMappings(this._map));\n }\n\n /**\n * Mark the current generated position with a source position. May also be passed null line/column\n * values to insert a mapping to nothing.\n */\n\n mark(\n generated: { line: number; column: number },\n line?: number,\n column?: number,\n identifierName?: string | null,\n identifierNamePos?: { line: number; column: number },\n filename?: string | null,\n ) {\n this._rawMappings = undefined;\n\n let originalMapping: OriginalMapping | InvalidOriginalMapping | undefined;\n\n if (line != null) {\n if (this._inputMap) {\n // This is the lookup for this mark\n originalMapping = originalPositionFor(this._inputMap, {\n line,\n column: column!,\n });\n\n // Prefer the original name from the input sourcemap when marking an\n // identifier token at the same column, or when marking a related\n // token such as `(` via identifierNamePos.\n if (\n originalMapping.name &&\n (identifierNamePos ||\n (identifierName != null && originalMapping.column === column))\n ) {\n identifierName = originalMapping.name;\n } else if (identifierNamePos) {\n // Maybe we're marking a `(` and the input map already had a name attached there,\n // or we're marking a `(` and the sourcemap spanned a `foo(`,\n // or we're marking an identifier, etc.\n // We're trying to mark a `(` (as that's the only thing that provides\n // an identifierNamePos currently), and we the AST had an identifier attached.\n // Lookup it's original name.\n const originalIdentifierMapping = originalPositionFor(\n this._inputMap,\n identifierNamePos,\n );\n if (originalIdentifierMapping.name) {\n identifierName = originalIdentifierMapping.name;\n }\n }\n } else {\n originalMapping = {\n name: null,\n source: filename?.replace(/\\\\/g, \"/\") || this._sourceFileName!,\n line: line,\n column: column!,\n };\n }\n }\n\n // @ts-expect-error FIXME: original cannot be InvalidOriginalMapping\n maybeAddMapping(this._map, {\n name: identifierName,\n generated,\n source: originalMapping?.source,\n original: originalMapping,\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAoBA,IAAAC,aAAA,GAAAD,OAAA;AAMe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IAAI,CAAChC,SAAS,EACd4B,iBACF,CAAC;UACD,IAAIM,yBAAyB,CAACD,IAAI,EAAE;YAClCN,cAAc,GAAGO,yBAAyB,CAACD,IAAI;UACjD;QACF;MACF,CAAC,MAAM;QACLF,eAAe,GAAG;UAChBE,IAAI,EAAE,IAAI;UACVE,MAAM,EAAE,CAAAN,QAAQ,oBAARA,QAAQ,CAAExB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAI,IAAI,CAACT,eAAgB;UAC9D6B,IAAI,EAAEA,IAAI;UACVC,MAAM,EAAEA;QACV,CAAC;MACH;IACF;IAGA,IAAAU,2BAAe,EAAC,IAAI,CAAC1C,IAAI,EAAE;MACzBuC,IAAI,EAAEN,cAAc;MACpBH,SAAS;MACTW,MAAM,GAAAL,gBAAA,GAAEC,eAAe,qBAAfD,gBAAA,CAAiBK,MAAM;MAC/BE,QAAQ,EAAEN;IACZ,CAAC,CAAC;EACJ;AACF;AAACO,OAAA,CAAAC,OAAA,GAAAlD,SAAA","ignoreList":[]}
{
"name": "@babel/generator",
"version": "7.29.1",
"version": "7.29.6",
"description": "Turns an AST into code.",

@@ -22,3 +22,3 @@ "author": "The Babel Team (https://babel.dev/team)",

"dependencies": {
"@babel/parser": "^7.29.0",
"@babel/parser": "^7.29.3",
"@babel/types": "^7.29.0",

@@ -30,3 +30,3 @@ "@jridgewell/gen-mapping": "^0.3.12",

"devDependencies": {
"@babel/core": "^7.29.0",
"@babel/core": "^7.29.6",
"@babel/helper-fixtures": "^7.28.6",

@@ -33,0 +33,0 @@ "@babel/plugin-transform-typescript": "^7.28.6",

Sorry, the diff of this file is too big to display