{"version":3,"names":["Buffer","constructor","map","_map","_buf","_str","_appendCount","_last","_queue","_queueCursor","_canMarkIdName","_position","line","column","_sourcePosition","identifierName","undefined","identifierNamePos","filename","_allocQueue","queue","i","push","char","repeat","_pushQueue","cursor","length","item","_popQueue","Error","get","_flush","result","code","trimRight","decodedMap","getDecoded","__mergedMap","resultMap","value","Object","defineProperty","writable","rawMappings","mappings","getRawMappings","append","str","maybeNewline","_append","appendChar","_appendChar","sourcePosition","queueIndentation","queueCursor","sourcePos","String","fromCharCode","_mark","len","position","charCodeAt","indexOf","last","_this$_map","mark","removeTrailingNewline","removeLastSemicolon","getLastChar","getNewlineCount","count","endsWithCharAndNewline","lastCp","hasContent","exactSource","loc","cb","source","prop","_normalizePosition","sourceWithOffset","lineOffset","columnOffset","withSource","pos","target","getCurrentColumn","lastIndex","getCurrentLine","exports","default"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map\";\nimport * as charcodes from \"charcodes\";\n\nexport type Pos = {\n line: number;\n column: number;\n};\nexport type Loc = {\n start?: Pos;\n end?: Pos;\n filename?: string;\n};\ntype SourcePos = {\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n filename: string | undefined;\n};\ntype InternalSourcePos = SourcePos & { identifierNamePos: Pos };\n\ntype QueueItem = {\n char: number;\n repeat: number;\n line: number | undefined;\n column: number | undefined;\n identifierName: undefined; // Not used, it always undefined.\n identifierNamePos: undefined; // Not used, it always undefined.\n filename: string | undefined;\n};\n\nexport default class Buffer {\n constructor(map?: SourceMap | null) {\n this._map = map;\n\n this._allocQueue();\n }\n\n _map: SourceMap = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _queue: QueueItem[] = [];\n _queueCursor = 0;\n _canMarkIdName = true;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition: InternalSourcePos = {\n identifierName: undefined,\n identifierNamePos: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n\n _allocQueue() {\n const queue = this._queue;\n\n for (let i = 0; i < 16; i++) {\n queue.push({\n char: 0,\n repeat: 1,\n line: undefined,\n column: undefined,\n identifierName: undefined,\n identifierNamePos: undefined,\n filename: \"\",\n });\n }\n }\n\n _pushQueue(\n char: number,\n repeat: number,\n line: number | undefined,\n column: number | undefined,\n filename: string | undefined,\n ) {\n const cursor = this._queueCursor;\n if (cursor === this._queue.length) {\n this._allocQueue();\n }\n const item = this._queue[cursor];\n item.char = char;\n item.repeat = repeat;\n item.line = line;\n item.column = column;\n item.filename = filename;\n\n this._queueCursor++;\n }\n\n _popQueue(): QueueItem {\n if (this._queueCursor === 0) {\n throw new Error(\"Cannot pop from empty queue\");\n }\n return this._queue[--this._queueCursor];\n }\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n this._flush();\n\n const map = this._map;\n const result = {\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 code: (this._buf + this._str).trimRight(),\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 ? map.get() : null;\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\n this._append(str, this._sourcePosition, maybeNewline);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, this._sourcePosition);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: number): void {\n // Drop trailing spaces when a newline is inserted.\n if (char === charcodes.lineFeed) {\n while (this._queueCursor !== 0) {\n const char = this._queue[this._queueCursor - 1].char;\n if (char !== charcodes.space && char !== charcodes.tab) {\n break;\n }\n\n this._queueCursor--;\n }\n }\n\n const sourcePosition = this._sourcePosition;\n this._pushQueue(\n char,\n 1,\n sourcePosition.line,\n sourcePosition.column,\n sourcePosition.filename,\n );\n }\n\n /**\n * Same as queue, but this indentation will never have a sourcemap marker.\n */\n queueIndentation(char: number, repeat: number): void {\n this._pushQueue(char, repeat, undefined, undefined, undefined);\n }\n\n _flush(): void {\n const queueCursor = this._queueCursor;\n const queue = this._queue;\n for (let i = 0; i < queueCursor; i++) {\n const item: QueueItem = queue[i];\n this._appendChar(item.char, item.repeat, item);\n }\n this._queueCursor = 0;\n }\n\n _appendChar(\n char: number,\n repeat: number,\n sourcePos: InternalSourcePos,\n ): void {\n this._last = char;\n\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n\n if (char !== charcodes.lineFeed) {\n this._mark(\n sourcePos.line,\n sourcePos.column,\n sourcePos.identifierName,\n sourcePos.identifierNamePos,\n sourcePos.filename,\n );\n this._position.column += repeat;\n } else {\n this._position.line++;\n this._position.column = 0;\n }\n\n if (this._canMarkIdName) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n }\n\n _append(\n str: string,\n sourcePos: InternalSourcePos,\n maybeNewline: boolean,\n ): void {\n const len = str.length;\n const position = this._position;\n\n this._last = str.charCodeAt(len - 1);\n\n if (++this._appendCount > 4096) {\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 if (!maybeNewline && !this._map) {\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 (i !== 0) {\n this._mark(line, column, identifierName, identifierNamePos, filename);\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 this._mark(++line, 0, null, null, filename);\n }\n i = str.indexOf(\"\\n\", last);\n }\n position.column += len - last;\n }\n\n _mark(\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n identifierNamePos: Pos | undefined,\n filename: string | undefined,\n ): void {\n this._map?.mark(\n this._position,\n line,\n column,\n identifierName,\n identifierNamePos,\n filename,\n );\n }\n\n removeTrailingNewline(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.lineFeed\n ) {\n this._queueCursor--;\n }\n }\n\n removeLastSemicolon(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.semicolon\n ) {\n this._queueCursor--;\n }\n }\n\n getLastChar(): number {\n const queueCursor = this._queueCursor;\n return queueCursor !== 0 ? this._queue[queueCursor - 1].char : 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 const queueCursor = this._queueCursor;\n let count = 0;\n if (queueCursor === 0) return this._last === charcodes.lineFeed ? 1 : 0;\n for (let i = queueCursor - 1; i >= 0; i--) {\n if (this._queue[i].char !== charcodes.lineFeed) {\n break;\n }\n count++;\n }\n return count === queueCursor && this._last === charcodes.lineFeed\n ? count + 1\n : count;\n }\n\n /**\n * check if current _last + queue ends with newline, return the character before newline\n *\n * @param {*} ch\n * @memberof Buffer\n */\n endsWithCharAndNewline(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n if (queueCursor !== 0) {\n // every element in queue is one-length whitespace string\n const lastCp = queue[queueCursor - 1].char;\n if (lastCp !== charcodes.lineFeed) return;\n if (queueCursor > 1) {\n return queue[queueCursor - 2].char;\n } else {\n return this._last;\n }\n }\n // We assume that everything being matched is at most a single token plus some whitespace,\n // which everything currently is, but otherwise we'd have to expand _last or check _buf.\n }\n\n hasContent(): boolean {\n return this._queueCursor !== 0 || !!this._last;\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 | undefined, cb: () => void) {\n if (!this._map) {\n cb();\n return;\n }\n\n this.source(\"start\", loc);\n // @ts-expect-error identifierName is not defined\n const identifierName = loc.identifierName;\n const sourcePos = this._sourcePosition;\n if (identifierName) {\n this._canMarkIdName = false;\n sourcePos.identifierName = identifierName;\n }\n cb();\n\n if (identifierName) {\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 | undefined): void {\n if (!this._map) return;\n\n // Since this is called extremely often, we re-use the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, 0, 0);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc | undefined,\n lineOffset: number,\n columnOffset: number,\n ): void {\n if (!this._map) return;\n\n this._normalizePosition(prop, loc, lineOffset, columnOffset);\n }\n\n /**\n * Call a callback with a specific source location\n */\n\n withSource(prop: \"start\" | \"end\", loc: Loc, cb: () => void): void {\n if (this._map) {\n this.source(prop, loc);\n }\n\n cb();\n }\n\n _normalizePosition(\n prop: \"start\" | \"end\",\n loc: Loc,\n lineOffset: number,\n columnOffset: number,\n ) {\n const pos = loc[prop];\n const target = this._sourcePosition;\n\n if (pos) {\n target.line = pos.line + lineOffset;\n target.column = pos.column + columnOffset;\n target.filename = loc.filename;\n }\n }\n\n getCurrentColumn(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n\n let lastIndex = -1;\n let len = 0;\n for (let i = 0; i < queueCursor; i++) {\n const item = queue[i];\n if (item.char === charcodes.lineFeed) {\n lastIndex = len;\n }\n len += item.repeat;\n }\n\n return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex;\n }\n\n getCurrentLine(): number {\n let count = 0;\n\n const queue = this._queue;\n for (let i = 0; i < this._queueCursor; i++) {\n if (queue[i].char === charcodes.lineFeed) {\n count++;\n }\n }\n\n return this._position.line + count;\n }\n}\n"],"mappings":";;;;;;AA8Be,MAAMA,MAAM,CAAC;EAC1BC,WAAWA,CAACC,GAAsB,EAAE;IAAA,KAMpCC,IAAI,GAAc,IAAI;IAAA,KACtBC,IAAI,GAAG,EAAE;IAAA,KACTC,IAAI,GAAG,EAAE;IAAA,KACTC,YAAY,GAAG,C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