diff options
| author | Christian Cleberg <[email protected]> | 2026-04-18 22:32:53 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-18 22:32:53 -0500 |
| commit | 580e798e16346eb894eb899edac82d2efdf40adc (patch) | |
| tree | 6dec3b7db678f781138b40d34da37d21ac8fbe7d /node_modules/@babel/generator/lib | |
| download | brand-bench-580e798e16346eb894eb899edac82d2efdf40adc.tar.gz brand-bench-580e798e16346eb894eb899edac82d2efdf40adc.tar.bz2 brand-bench-580e798e16346eb894eb899edac82d2efdf40adc.zip | |
initial commit
Diffstat (limited to 'node_modules/@babel/generator/lib')
42 files changed, 5168 insertions, 0 deletions
diff --git a/node_modules/@babel/generator/lib/buffer.js b/node_modules/@babel/generator/lib/buffer.js new file mode 100644 index 0000000..05b5279 --- /dev/null +++ b/node_modules/@babel/generator/lib/buffer.js @@ -0,0 +1,244 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +const spaceIndents = []; +for (let i = 0; i < 32; i++) { + spaceIndents.push(" ".repeat(i * 2)); +} +class Buffer { + constructor(map, indentChar) { + this._map = null; + this._buf = ""; + this._str = ""; + this._appendCount = 0; + this._last = 0; + this._canMarkIdName = true; + this._indentChar = ""; + this._queuedChar = 0; + this._position = { + line: 1, + column: 0 + }; + this._sourcePosition = { + identifierName: undefined, + identifierNamePos: undefined, + line: undefined, + column: undefined, + filename: undefined + }; + this._map = map; + this._indentChar = indentChar; + } + get() { + const { + _map, + _last + } = this; + if (this._queuedChar !== 32) { + this._flush(); + } + const code = _last === 10 ? (this._buf + this._str).trimRight() : this._buf + this._str; + if (_map === null) { + return { + code: code, + decodedMap: undefined, + map: null, + rawMappings: undefined + }; + } + const result = { + code: code, + decodedMap: _map.getDecoded(), + get __mergedMap() { + return this.map; + }, + get map() { + const resultMap = _map.get(); + result.map = resultMap; + return resultMap; + }, + set map(value) { + Object.defineProperty(result, "map", { + value, + writable: true + }); + }, + get rawMappings() { + const mappings = _map.getRawMappings(); + result.rawMappings = mappings; + return mappings; + }, + set rawMappings(value) { + Object.defineProperty(result, "rawMappings", { + value, + writable: true + }); + } + }; + return result; + } + append(str, maybeNewline) { + this._flush(); + this._append(str, maybeNewline); + } + appendChar(char) { + this._flush(); + this._appendChar(char, 1, true); + } + queue(char) { + this._flush(); + this._queuedChar = char; + } + _flush() { + const queuedChar = this._queuedChar; + if (queuedChar !== 0) { + this._appendChar(queuedChar, 1, true); + this._queuedChar = 0; + } + } + _appendChar(char, repeat, useSourcePos) { + this._last = char; + if (char === -1) { + const indent = repeat >= 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2]; + this._str += indent; + } else { + this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); + } + const isSpace = char === 32; + const position = this._position; + if (char !== 10) { + if (this._map) { + const sourcePos = this._sourcePosition; + if (useSourcePos && sourcePos) { + this._map.mark(position, sourcePos.line, sourcePos.column, isSpace ? undefined : sourcePos.identifierName, isSpace ? undefined : sourcePos.identifierNamePos, sourcePos.filename); + if (!isSpace && this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + } else { + this._map.mark(position); + } + } + position.column += repeat; + } else { + position.line++; + position.column = 0; + } + } + _append(str, maybeNewline) { + const len = str.length; + const position = this._position; + const sourcePos = this._sourcePosition; + this._last = -1; + if (++this._appendCount > 4096) { + +this._str; + this._buf += this._str; + this._str = str; + this._appendCount = 0; + } else { + this._str += str; + } + const hasMap = this._map !== null; + if (!maybeNewline && !hasMap) { + position.column += len; + return; + } + const { + column, + identifierName, + identifierNamePos, + filename + } = sourcePos; + let line = sourcePos.line; + if ((identifierName != null || identifierNamePos != null) && this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + let i = str.indexOf("\n"); + let last = 0; + if (hasMap && i !== 0) { + this._map.mark(position, line, column, identifierName, identifierNamePos, filename); + } + while (i !== -1) { + position.line++; + position.column = 0; + last = i + 1; + if (last < len && line !== undefined) { + line++; + if (hasMap) { + this._map.mark(position, line, 0, undefined, undefined, filename); + } + } + i = str.indexOf("\n", last); + } + position.column += len - last; + } + removeLastSemicolon() { + if (this._queuedChar === 59) { + this._queuedChar = 0; + } + } + getLastChar(checkQueue) { + if (!checkQueue) { + return this._last; + } + const queuedChar = this._queuedChar; + return queuedChar !== 0 ? queuedChar : this._last; + } + getNewlineCount() { + return this._queuedChar === 0 && this._last === 10 ? 1 : 0; + } + hasContent() { + return this._last !== 0; + } + exactSource(loc, cb) { + if (!this._map) { + cb(); + return; + } + this.source("start", loc); + const identifierName = loc.identifierName; + const sourcePos = this._sourcePosition; + if (identifierName != null) { + this._canMarkIdName = false; + sourcePos.identifierName = identifierName; + } + cb(); + if (identifierName != null) { + this._canMarkIdName = true; + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + this.source("end", loc); + } + source(prop, loc) { + if (!this._map) return; + this._normalizePosition(prop, loc, 0); + } + sourceWithOffset(prop, loc, columnOffset) { + if (!this._map) return; + this._normalizePosition(prop, loc, columnOffset); + } + _normalizePosition(prop, loc, columnOffset) { + this._flush(); + 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; + } + } + getCurrentColumn() { + return this._position.column + (this._queuedChar ? 1 : 0); + } + getCurrentLine() { + return this._position.line; + } +} +exports.default = Buffer; + +//# sourceMappingURL=buffer.js.map diff --git a/node_modules/@babel/generator/lib/buffer.js.map b/node_modules/@babel/generator/lib/buffer.js.map new file mode 100644 index 0000000..804ea0a --- /dev/null +++ b/node_modules/@babel/generator/lib/buffer.js.map @@ -0,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;MA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;IAChC;EACF;EAEAwD,gBAAgBA,CAAA,EAAW;IACzB,OAAO,IAAI,CAAC/D,SAAS,CAACE,MAAM,IAAI,IAAI,CAACH,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;EAC3D;EAEAiE,cAAcA,CAAA,EAAW;IACvB,OAAO,IAAI,CAAChE,SAAS,CAACC,IAAI;EAC5B;AACF;AAACgE,OAAA,CAAAC,OAAA,GAAA9E,MAAA","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/base.js b/node_modules/@babel/generator/lib/generators/base.js new file mode 100644 index 0000000..4768b9b --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/base.js @@ -0,0 +1,86 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BlockStatement = BlockStatement; +exports.Directive = Directive; +exports.DirectiveLiteral = DirectiveLiteral; +exports.File = File; +exports.InterpreterDirective = InterpreterDirective; +exports.Placeholder = Placeholder; +exports.Program = Program; +function File(node) { + if (node.program) { + this.print(node.program.interpreter); + } + this.print(node.program); +} +function Program(node) { + var _node$directives; + this.printInnerComments(false); + const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; + if (directivesLen) { + var _node$directives$trai; + const newline = node.body.length ? 2 : 1; + this.printSequence(node.directives, undefined, undefined, newline); + if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) { + this.newline(newline); + } + } + this.printSequence(node.body); +} +function BlockStatement(node) { + var _node$directives2; + this.tokenChar(123); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length; + if (directivesLen) { + var _node$directives$trai2; + const newline = node.body.length ? 2 : 1; + this.printSequence(node.directives, true, true, newline); + if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) { + this.newline(newline); + } + } + this.printSequence(node.body, true, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.rightBrace(node); +} +function Directive(node) { + this.print(node.value); + this.semicolon(); +} +const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; +const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; +function DirectiveLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.token(raw); + return; + } + const { + value + } = node; + if (!unescapedDoubleQuoteRE.test(value)) { + this.token(`"${value}"`); + } else if (!unescapedSingleQuoteRE.test(value)) { + this.token(`'${value}'`); + } else { + throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes."); + } +} +function InterpreterDirective(node) { + this.token(`#!${node.value}`); + this._newline(); +} +function Placeholder(node) { + this.token("%%"); + this.print(node.name); + this.token("%%"); + if (node.expectedNode === "Statement") { + this.semicolon(); + } +} + +//# sourceMappingURL=base.js.map diff --git a/node_modules/@babel/generator/lib/generators/base.js.map b/node_modules/@babel/generator/lib/generators/base.js.map new file mode 100644 index 0000000..1bf7773 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/base.js.map @@ -0,0 +1 @@ +{"version":3,"names":["File","node","program","print","interpreter","Program","_node$directives","printInnerComments","directivesLen","directives","length","_node$directives$trai","newline","body","printSequence","undefined","trailingComments","BlockStatement","_node$directives2","token","oldNoLineTerminatorAfterNode","enterDelimited","_node$directives$trai2","_noLineTerminatorAfterNode","rightBrace","Directive","value","semicolon","unescapedSingleQuoteRE","unescapedDoubleQuoteRE","DirectiveLiteral","raw","getPossibleRaw","format","minified","test","Error","InterpreterDirective","_newline","Placeholder","name","expectedNode"],"sources":["../../src/generators/base.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function File(this: Printer, node: t.File) {\n if (node.program) {\n // Print this here to ensure that Program node 'leadingComments' still\n // get printed after the hashbang.\n this.print(node.program.interpreter);\n }\n\n this.print(node.program);\n}\n\nexport function Program(this: Printer, node: t.Program) {\n // An empty Program doesn't have any inner tokens, so\n // we must explicitly print its inner comments.\n this.printInnerComments(false);\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, undefined, undefined, newline);\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body);\n}\n\nexport function BlockStatement(this: Printer, node: t.BlockStatement) {\n this.token(\"{\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, true, true, newline);\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, true, true);\n\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightBrace(node);\n}\n\nexport function Directive(this: Printer, node: t.Directive) {\n this.print(node.value);\n this.semicolon();\n}\n\n// These regexes match an even number of \\ followed by a quote\nconst unescapedSingleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*'/;\nconst unescapedDoubleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*\"/;\n\nexport function DirectiveLiteral(this: Printer, node: t.DirectiveLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const { value } = node;\n\n // NOTE: In directives we can't change escapings,\n // because they change the behavior.\n // e.g. \"us\\x65 strict\" (\\x65 is e) is not a \"use strict\" directive.\n\n if (!unescapedDoubleQuoteRE.test(value)) {\n this.token(`\"${value}\"`);\n } else if (!unescapedSingleQuoteRE.test(value)) {\n this.token(`'${value}'`);\n } else {\n throw new Error(\n \"Malformed AST: it is not possible to print a directive containing\" +\n \" both unescaped single and double quotes.\",\n );\n }\n}\n\nexport function InterpreterDirective(\n this: Printer,\n node: t.InterpreterDirective,\n) {\n this.token(`#!${node.value}`);\n this._newline();\n}\n\nexport function Placeholder(this: Printer, node: t.Placeholder) {\n this.token(\"%%\");\n this.print(node.name);\n this.token(\"%%\");\n\n if (node.expectedNode === \"Statement\") {\n this.semicolon();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAGO,SAASA,IAAIA,CAAgBC,IAAY,EAAE;EAChD,IAAIA,IAAI,CAACC,OAAO,EAAE;IAGhB,IAAI,CAACC,KAAK,CAACF,IAAI,CAACC,OAAO,CAACE,WAAW,CAAC;EACtC;EAEA,IAAI,CAACD,KAAK,CAACF,IAAI,CAACC,OAAO,CAAC;AAC1B;AAEO,SAASG,OAAOA,CAAgBJ,IAAe,EAAE;EAAA,IAAAK,gBAAA;EAGtD,IAAI,CAACC,kBAAkB,CAAC,KAAK,CAAC;EAE9B,MAAMC,aAAa,IAAAF,gBAAA,GAAGL,IAAI,CAACQ,UAAU,qBAAfH,gBAAA,CAAiBI,MAAM;EAC7C,IAAIF,aAAa,EAAE;IAAA,IAAAG,qBAAA;IACjB,MAAMC,OAAO,GAAGX,IAAI,CAACY,IAAI,CAACH,MAAM,GAAG,CAAC,GAAG,CAAC;IACxC,IAAI,CAACI,aAAa,CAACb,IAAI,CAACQ,UAAU,EAAEM,SAAS,EAAEA,SAAS,EAAEH,OAAO,CAAC;IAClE,IAAI,GAAAD,qBAAA,GAACV,IAAI,CAACQ,UAAU,CAACD,aAAa,GAAG,CAAC,CAAC,CAACQ,gBAAgB,aAAnDL,qBAAA,CAAqDD,MAAM,GAAE;MAChE,IAAI,CAACE,OAAO,CAACA,OAAO,CAAC;IACvB;EACF;EAEA,IAAI,CAACE,aAAa,CAACb,IAAI,CAACY,IAAI,CAAC;AAC/B;AAEO,SAASI,cAAcA,CAAgBhB,IAAsB,EAAE;EAAA,IAAAiB,iBAAA;EACpE,IAAI,CAACC,SAAK,IAAI,CAAC;EACf,MAAMC,4BAA4B,GAAG,IAAI,CAACC,cAAc,CAAC,CAAC;EAE1D,MAAMb,aAAa,IAAAU,iBAAA,GAAGjB,IAAI,CAACQ,UAAU,qBAAf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;EAC1B,CAAC,MAAM,IAAI,CAACE,sBAAsB,CAACO,IAAI,CAACT,KAAK,CAAC,EAAE;IAC9C,IAAI,CAACP,KAAK,CAAC,IAAIO,KAAK,GAAG,CAAC;EAC1B,CAAC,MAAM;IACL,MAAM,IAAIU,KAAK,CACb,mEAAmE,GACjE,2CACJ,CAAC;EACH;AACF;AAEO,SAASC,oBAAoBA,CAElCpC,IAA4B,EAC5B;EACA,IAAI,CAACkB,KAAK,CAAC,KAAKlB,IAAI,CAACyB,KAAK,EAAE,CAAC;EAC7B,IAAI,CAACY,QAAQ,CAAC,CAAC;AACjB;AAEO,SAASC,WAAWA,CAAgBtC,IAAmB,EAAE;EAC9D,IAAI,CAACkB,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAAChB,KAAK,CAACF,IAAI,CAACuC,IAAI,CAAC;EACrB,IAAI,CAACrB,KAAK,CAAC,IAAI,CAAC;EAEhB,IAAIlB,IAAI,CAACwC,YAAY,KAAK,WAAW,EAAE;IACrC,IAAI,CAACd,SAAS,CAAC,CAAC;EAClB;AACF","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/classes.js b/node_modules/@babel/generator/lib/generators/classes.js new file mode 100644 index 0000000..75272f8 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/classes.js @@ -0,0 +1,215 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ClassAccessorProperty = ClassAccessorProperty; +exports.ClassBody = ClassBody; +exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration; +exports.ClassMethod = ClassMethod; +exports.ClassPrivateMethod = ClassPrivateMethod; +exports.ClassPrivateProperty = ClassPrivateProperty; +exports.ClassProperty = ClassProperty; +exports.StaticBlock = StaticBlock; +exports._classMethodHead = _classMethodHead; +var _t = require("@babel/types"); +var _expressions = require("./expressions.js"); +var _typescript = require("./typescript.js"); +var _flow = require("./flow.js"); +var _methods = require("./methods.js"); +const { + isExportDefaultDeclaration, + isExportNamedDeclaration +} = _t; +function ClassDeclaration(node, parent) { + const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); + if (!inExport || !_expressions._shouldPrintDecoratorsBeforeExport.call(this, parent)) { + this.printJoin(node.decorators); + } + if (node.declare) { + this.word("declare"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + this.word("class"); + if (node.id) { + this.space(); + this.print(node.id); + } + this.print(node.typeParameters); + if (node.superClass) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.superClass); + this.print(node.superTypeParameters); + } + if (node.implements) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements); + } + this.space(); + this.print(node.body); +} +function ClassBody(node) { + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + const separator = classBodyEmptySemicolonsPrinter(this, node); + separator == null || separator(-1); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.printJoin(node.body, true, true, separator, true, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + if (!this.endsWith(10)) this.newline(); + this.rightBrace(node); + } +} +function classBodyEmptySemicolonsPrinter(printer, node) { + if (!printer.tokenMap || node.start == null || node.end == null) { + return null; + } + const indexes = printer.tokenMap.getIndexes(node); + if (!indexes) return null; + let k = 1; + let occurrenceCount = 0; + let nextLocIndex = 0; + const advanceNextLocIndex = () => { + while (nextLocIndex < node.body.length && node.body[nextLocIndex].start == null) { + nextLocIndex++; + } + }; + advanceNextLocIndex(); + return i => { + if (nextLocIndex <= i) { + nextLocIndex = i + 1; + advanceNextLocIndex(); + } + const end = nextLocIndex === node.body.length ? node.end : node.body[nextLocIndex].start; + let tok; + while (k < indexes.length && printer.tokenMap.matchesOriginal(tok = printer._tokens[indexes[k]], ";") && tok.start < end) { + printer.tokenChar(59, occurrenceCount++); + k++; + } + }; +} +function ClassProperty(node) { + this.printJoin(node.decorators); + if (!node.static && !this.format.preserveFormat) { + var _node$key$loc; + const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; + if (endLine) this.catchUp(endLine); + } + _typescript._tsPrintClassMemberModifiers.call(this, node); + if (node.computed) { + this.tokenChar(91); + this.print(node.key); + this.tokenChar(93); + } else { + _flow._variance.call(this, node); + this.print(node.key); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value); + } + this.semicolon(); +} +function ClassAccessorProperty(node) { + var _node$key$loc2; + this.printJoin(node.decorators); + const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line; + if (endLine) this.catchUp(endLine); + _typescript._tsPrintClassMemberModifiers.call(this, node); + this.word("accessor", true); + this.space(); + if (node.computed) { + this.tokenChar(91); + this.print(node.key); + this.tokenChar(93); + } else { + _flow._variance.call(this, node); + this.print(node.key); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value); + } + this.semicolon(); +} +function ClassPrivateProperty(node) { + this.printJoin(node.decorators); + _typescript._tsPrintClassMemberModifiers.call(this, node); + this.print(node.key); + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value); + } + this.semicolon(); +} +function ClassMethod(node) { + _classMethodHead.call(this, node); + this.space(); + this.print(node.body); +} +function ClassPrivateMethod(node) { + _classMethodHead.call(this, node); + this.space(); + this.print(node.body); +} +function _classMethodHead(node) { + this.printJoin(node.decorators); + if (!this.format.preserveFormat) { + var _node$key$loc3; + const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; + if (endLine) this.catchUp(endLine); + } + _typescript._tsPrintClassMemberModifiers.call(this, node); + _methods._methodHead.call(this, node); +} +function StaticBlock(node) { + this.word("static"); + this.space(); + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + this.newline(); + this.printSequence(node.body, true); + this.rightBrace(node); + } +} + +//# sourceMappingURL=classes.js.map diff --git a/node_modules/@babel/generator/lib/generators/classes.js.map b/node_modules/@babel/generator/lib/generators/classes.js.map new file mode 100644 index 0000000..d764d73 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/classes.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_expressions","_typescript","_flow","_methods","isExportDefaultDeclaration","isExportNamedDeclaration","ClassDeclaration","node","parent","inExport","_shouldPrintDecoratorsBeforeExport","call","printJoin","decorators","declare","word","space","abstract","id","print","typeParameters","superClass","superTypeParameters","implements","printList","body","ClassBody","token","length","separator","classBodyEmptySemicolonsPrinter","oldNoLineTerminatorAfterNode","enterDelimited","_noLineTerminatorAfterNode","endsWith","newline","rightBrace","printer","tokenMap","start","end","indexes","getIndexes","k","occurrenceCount","nextLocIndex","advanceNextLocIndex","i","tok","matchesOriginal","_tokens","tokenChar","ClassProperty","static","format","preserveFormat","_node$key$loc","endLine","key","loc","line","catchUp","_tsPrintClassMemberModifiers","computed","_variance","optional","definite","typeAnnotation","value","semicolon","ClassAccessorProperty","_node$key$loc2","ClassPrivateProperty","ClassMethod","_classMethodHead","ClassPrivateMethod","_node$key$loc3","_methodHead","StaticBlock","printSequence"],"sources":["../../src/generators/classes.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport {\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport { _shouldPrintDecoratorsBeforeExport } from \"./expressions.ts\";\nimport { _tsPrintClassMemberModifiers } from \"./typescript.ts\";\nimport { _variance } from \"./flow.ts\";\nimport { _methodHead } from \"./methods.ts\";\n\nexport function ClassDeclaration(\n this: Printer,\n node: t.ClassDeclaration,\n parent: t.Node,\n) {\n const inExport =\n isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent);\n\n if (\n !inExport ||\n !_shouldPrintDecoratorsBeforeExport.call(\n this,\n parent as t.ExportDeclaration & { declaration: t.ClassDeclaration },\n )\n ) {\n this.printJoin(node.decorators);\n }\n\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n if (node.abstract) {\n // TS\n this.word(\"abstract\");\n this.space();\n }\n\n this.word(\"class\");\n\n if (node.id) {\n this.space();\n this.print(node.id);\n }\n\n this.print(node.typeParameters);\n\n if (node.superClass) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.superClass);\n this.print(\n process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Renamed\n node.superTypeArguments\n : // @ts-ignore(Babel 7 vs Babel 8) Renamed\n node.superTypeParameters,\n );\n }\n\n if (node.implements) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements);\n }\n\n this.space();\n this.print(node.body);\n}\n\nexport { ClassDeclaration as ClassExpression };\n\nexport function ClassBody(this: Printer, node: t.ClassBody) {\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n const separator = classBodyEmptySemicolonsPrinter(this, node);\n separator?.(-1); // print leading semicolons in preserveFormat mode\n\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.printJoin(node.body, true, true, separator, true, true);\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n\n if (!this.endsWith(charCodes.lineFeed)) this.newline();\n\n this.rightBrace(node);\n }\n}\n\nfunction classBodyEmptySemicolonsPrinter(printer: Printer, node: t.ClassBody) {\n if (!printer.tokenMap || node.start == null || node.end == null) {\n return null;\n }\n\n // \"empty statements\" in class bodies are not represented in the AST.\n // Print them by checking if there are any ; tokens between the current AST\n // member and the next one.\n\n const indexes = printer.tokenMap.getIndexes(node);\n if (!indexes) return null;\n\n let k = 1; // start from 1 to skip '{'\n\n let occurrenceCount = 0;\n\n let nextLocIndex = 0;\n const advanceNextLocIndex = () => {\n while (\n nextLocIndex < node.body.length &&\n node.body[nextLocIndex].start == null\n ) {\n nextLocIndex++;\n }\n };\n advanceNextLocIndex();\n\n return (i: number) => {\n if (nextLocIndex <= i) {\n nextLocIndex = i + 1;\n advanceNextLocIndex();\n }\n\n const end =\n nextLocIndex === node.body.length\n ? node.end\n : node.body[nextLocIndex].start;\n\n let tok;\n while (\n k < indexes.length &&\n printer.tokenMap!.matchesOriginal(\n (tok = printer._tokens![indexes[k]]),\n \";\",\n ) &&\n tok.start < end!\n ) {\n printer.tokenChar(charCodes.semicolon, occurrenceCount++);\n k++;\n }\n };\n}\n\nexport function ClassProperty(this: Printer, node: t.ClassProperty) {\n this.printJoin(node.decorators);\n\n if (!node.static && !this.format.preserveFormat) {\n // catch up to property key, avoid line break\n // between member TS modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n }\n\n _tsPrintClassMemberModifiers.call(this, node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key);\n this.token(\"]\");\n } else {\n _variance.call(this, node);\n this.print(node.key);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value);\n }\n this.semicolon();\n}\n\nexport function ClassAccessorProperty(\n this: Printer,\n node: t.ClassAccessorProperty,\n) {\n this.printJoin(node.decorators);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n // TS does not support class accessor property yet\n _tsPrintClassMemberModifiers.call(this, node);\n\n this.word(\"accessor\", true);\n this.space();\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key);\n this.token(\"]\");\n } else {\n // Todo: Flow does not support class accessor property yet.\n _variance.call(this, node);\n this.print(node.key);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value);\n }\n this.semicolon();\n}\n\nexport function ClassPrivateProperty(\n this: Printer,\n node: t.ClassPrivateProperty,\n) {\n this.printJoin(node.decorators);\n _tsPrintClassMemberModifiers.call(this, node);\n this.print(node.key);\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n this.print(node.typeAnnotation);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value);\n }\n this.semicolon();\n}\n\nexport function ClassMethod(this: Printer, node: t.ClassMethod) {\n _classMethodHead.call(this, node);\n this.space();\n this.print(node.body);\n}\n\nexport function ClassPrivateMethod(this: Printer, node: t.ClassPrivateMethod) {\n _classMethodHead.call(this, node);\n this.space();\n this.print(node.body);\n}\n\nexport function _classMethodHead(\n this: Printer,\n node: t.ClassMethod | t.ClassPrivateMethod | t.TSDeclareMethod,\n) {\n this.printJoin(node.decorators);\n\n if (!this.format.preserveFormat) {\n // catch up to method key, avoid line break\n // between member modifiers/method heads and the method key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n }\n\n _tsPrintClassMemberModifiers.call(this, node);\n _methodHead.call(this, node);\n}\n\nexport function StaticBlock(this: Printer, node: t.StaticBlock) {\n this.word(\"static\");\n this.space();\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n this.printSequence(node.body, true);\n this.rightBrace(node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,O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AI;IACvC,IAAIH,OAAO,EAAE,IAAI,CAACI,OAAO,CAACJ,OAAO,CAAC;EACpC;EAEAK,wCAA4B,CAACnD,IAAI,CAAC,IAAI,EAAEJ,IAAI,CAAC;EAC7CsE,oBAAW,CAAClE,IAAI,CAAC,IAAI,EAAEJ,IAAI,CAAC;AAC9B;AAEO,SAASuE,WAAWA,CAAgBvE,IAAmB,EAAE;EAC9D,IAAI,CAACQ,IAAI,CAAC,QAAQ,CAAC;EACnB,IAAI,CAACC,KAAK,CAAC,CAAC;EACZ,IAAI,CAACW,SAAK,IAAI,CAAC;EACf,IAAIpB,IAAI,CAACkB,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;IAC1B,IAAI,CAACD,SAAK,IAAI,CAAC;EACjB,CAAC,MAAM;IACL,IAAI,CAACQ,OAAO,CAAC,CAAC;IACd,IAAI,CAAC4C,aAAa,CAACxE,IAAI,CAACkB,IAAI,EAAE,IAAI,CAAC;IACnC,IAAI,CAACW,UAAU,CAAC7B,IAAI,CAAC;EACvB;AACF","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/deprecated.js b/node_modules/@babel/generator/lib/generators/deprecated.js new file mode 100644 index 0000000..bc1f409 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/deprecated.js @@ -0,0 +1,73 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DecimalLiteral = DecimalLiteral; +exports.Noop = Noop; +exports.RecordExpression = RecordExpression; +exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments; +exports.TupleExpression = TupleExpression; +function Noop() {} +function TSExpressionWithTypeArguments(node) { + this.print(node.expression); + this.print(node.typeParameters); +} +function DecimalLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.word(raw); + return; + } + this.word(node.value + "m"); +} +function RecordExpression(node) { + const props = node.properties; + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "{|"; + endToken = "|}"; + } else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) { + throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`); + } else { + startToken = "#{"; + endToken = "}"; + } + this.token(startToken); + if (props.length) { + this.space(); + this.printList(props, this.shouldPrintTrailingComma(endToken), true, true); + this.space(); + } + this.token(endToken); +} +function TupleExpression(node) { + const elems = node.elements; + const len = elems.length; + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "[|"; + endToken = "|]"; + } else if (this.format.recordAndTupleSyntaxType === "hash") { + startToken = "#["; + endToken = "]"; + } else { + throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`); + } + this.token(startToken); + for (let i = 0; i < elems.length; i++) { + const elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem); + if (i < len - 1 || this.shouldPrintTrailingComma(endToken)) { + this.token(",", false, i); + } + } + } + this.token(endToken); +} + +//# sourceMappingURL=deprecated.js.map diff --git a/node_modules/@babel/generator/lib/generators/deprecated.js.map b/node_modules/@babel/generator/lib/generators/deprecated.js.map new file mode 100644 index 0000000..ceb91e9 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/deprecated.js.map @@ -0,0 +1 @@ +{"version":3,"names":["Noop","TSExpressionWithTypeArguments","node","print","expression","typeParameters","DecimalLiteral","raw","getPossibleRaw","format","minified","undefined","word","value","RecordExpression","props","properties","startToken","endToken","recordAndTupleSyntaxType","Error","JSON","stringify","token","length","space","printList","shouldPrintTrailingComma","TupleExpression","elems","elements","len","i","elem"],"sources":["../../src/generators/deprecated.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport type DeprecatedBabel7ASTTypes =\n | \"Noop\"\n | \"TSExpressionWithTypeArguments\"\n | \"DecimalLiteral\"\n | \"RecordExpression\"\n | \"TupleExpression\";\n\nexport function Noop(this: Printer) {}\n\nexport function TSExpressionWithTypeArguments(\n this: Printer,\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n node: t.TSExpressionWithTypeArguments,\n) {\n this.print(node.expression);\n this.print(node.typeParameters);\n}\n\nexport function DecimalLiteral(this: Printer, node: any) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"m\");\n}\n\n// @ts-ignore(Babel 7 vs Babel 8) - t.RecordExpression only exists in Babel 7\nexport function RecordExpression(this: Printer, node: t.RecordExpression) {\n const props = node.properties;\n\n let startToken;\n let endToken;\n\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"{|\";\n endToken = \"|}\";\n } else if (\n this.format.recordAndTupleSyntaxType !== \"hash\" &&\n this.format.recordAndTupleSyntaxType != null\n ) {\n throw new Error(\n `The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (${JSON.stringify(\n this.format.recordAndTupleSyntaxType,\n )} received).`,\n );\n } else {\n startToken = \"#{\";\n endToken = \"}\";\n }\n\n this.token(startToken);\n\n if (props.length) {\n this.space();\n this.printList(props, this.shouldPrintTrailingComma(endToken), true, true);\n this.space();\n }\n this.token(endToken);\n}\n\n// @ts-ignore(Babel 7 vs Babel 8) - t.TupleExpression only exists in Babel 7\nexport function TupleExpression(this: Printer, node: t.TupleExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n let startToken;\n let endToken;\n if (process.env.BABEL_8_BREAKING) {\n startToken = \"#[\";\n endToken = \"]\";\n } else {\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"[|\";\n endToken = \"|]\";\n } else if (this.format.recordAndTupleSyntaxType === \"hash\") {\n startToken = \"#[\";\n endToken = \"]\";\n } else {\n throw new Error(\n `${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`,\n );\n }\n }\n\n this.token(startToken);\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem);\n if (i < len - 1 || this.shouldPrintTrailingComma(endToken)) {\n this.token(\",\", false, i);\n }\n }\n }\n\n this.token(endToken);\n}\n"],"mappings":";;;;;;;;;;AAUO,SAASA,IAAIA,CAAA,EAAgB,CAAC;AAE9B,SAASC,6BAA6BA,CAG3CC,IAAqC,EACrC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,UAAU,CAAC;EAC3B,IAAI,CAACD,KAAK,CAACD,IAAI,CAACG,cAAc,CAAC;AACjC;AAEO,SAASC,cAAcA,CAAgBJ,IAAS,EAAE;EACvD,MAAMK,GAAG,GAAG,IAAI,CAACC,cAAc,CAACN,IAAI,CAAC;EACrC,IAAI,CAAC,IAAI,CAACO,MAAM,CAACC,QAAQ,IAAIH,GAAG,KAAKI,SAAS,EAAE;IAC9C,IAAI,CAACC,IAAI,CAACL,GAAG,CAAC;IACd;EACF;EACA,IAAI,CAACK,IAAI,CAACV,IAAI,CAACW,KAAK,GAAG,GAAG,CAAC;AAC7B;AAGO,SAASC,gBAAgBA,CAAgBZ,IAAwB,EAAE;EACxE,MAAMa,KAAK,GAAGb,IAAI,CAACc,UAAU;EAE7B,IAAIC,UAAU;EACd,IAAIC,QAAQ;EAEZ,IAAI,IAAI,CAACT,MAAM,CAACU,wBAAwB,KAAK,KAAK,EAAE;IAClDF,UAAU,GAAG,IAAI;IACjBC,QAAQ,GAAG,IAAI;EACjB,CAAC,MAAM,IACL,IAAI,CAACT,MAAM,CAACU,wBAAwB,KAAK,MAAM,IAC/C,IAAI,CAACV,MAAM,CAACU,wBAAwB,IAAI,IAAI,EAC5C;IACA,MAAM,IAAIC,KAAK,CACb,4EAA4EC,IAAI,CAACC,SAAS,CACxF,IAAI,CAACb,MAAM,CAACU,wBACd,CAAC,aACH,CAAC;EACH,CAAC,MAAM;IACLF,UAAU,GAAG,IAAI;IACjBC,QAAQ,GAAG,GAAG;EAChB;EAEA,IAAI,CAACK,KAAK,C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,CAAC,EAAE;QAC1D,IAAI,CAACK,KAAK,CAAC,GAAG,EAAE,KAAK,EAAES,CAAC,CAAC;MAC3B;IACF;EACF;EAEA,IAAI,CAACT,KAAK,CAACL,QAAQ,CAAC;AACtB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/expressions.js b/node_modules/@babel/generator/lib/generators/expressions.js new file mode 100644 index 0000000..7448795 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/expressions.js @@ -0,0 +1,309 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.LogicalExpression = exports.AssignmentExpression = AssignmentExpression; +exports.AssignmentPattern = AssignmentPattern; +exports.AwaitExpression = AwaitExpression; +exports.BinaryExpression = BinaryExpression; +exports.BindExpression = BindExpression; +exports.CallExpression = CallExpression; +exports.ConditionalExpression = ConditionalExpression; +exports.Decorator = Decorator; +exports.DoExpression = DoExpression; +exports.EmptyStatement = EmptyStatement; +exports.ExpressionStatement = ExpressionStatement; +exports.Import = Import; +exports.MemberExpression = MemberExpression; +exports.MetaProperty = MetaProperty; +exports.ModuleExpression = ModuleExpression; +exports.NewExpression = NewExpression; +exports.OptionalCallExpression = OptionalCallExpression; +exports.OptionalMemberExpression = OptionalMemberExpression; +exports.ParenthesizedExpression = ParenthesizedExpression; +exports.PrivateName = PrivateName; +exports.SequenceExpression = SequenceExpression; +exports.Super = Super; +exports.ThisExpression = ThisExpression; +exports.UnaryExpression = UnaryExpression; +exports.UpdateExpression = UpdateExpression; +exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier; +exports.YieldExpression = YieldExpression; +exports._shouldPrintDecoratorsBeforeExport = _shouldPrintDecoratorsBeforeExport; +var _t = require("@babel/types"); +var _index = require("../node/index.js"); +const { + isCallExpression, + isLiteral, + isMemberExpression, + isNewExpression, + isPattern +} = _t; +function UnaryExpression(node) { + const { + operator + } = node; + const firstChar = operator.charCodeAt(0); + if (firstChar >= 97 && firstChar <= 122) { + this.word(operator); + this.space(); + } else { + this.tokenChar(firstChar); + } + this.print(node.argument); +} +function DoExpression(node) { + if (node.async) { + this.word("async", true); + this.space(); + } + this.word("do"); + this.space(); + this.print(node.body); +} +function ParenthesizedExpression(node) { + this.tokenChar(40); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.print(node.expression, undefined, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.rightParens(node); +} +function UpdateExpression(node) { + if (node.prefix) { + this.token(node.operator, false, 0, true); + this.print(node.argument); + } else { + this.print(node.argument, true); + this.token(node.operator, false, 0, true); + } +} +function ConditionalExpression(node) { + this.print(node.test); + this.space(); + this.tokenChar(63); + this.space(); + this.print(node.consequent); + this.space(); + this.tokenChar(58); + this.space(); + this.print(node.alternate); +} +function NewExpression(node, parent) { + this.word("new"); + this.space(); + this.print(node.callee); + if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { + callee: node + }) && !isMemberExpression(parent) && !isNewExpression(parent)) { + return; + } + this.print(node.typeArguments); + this.print(node.typeParameters); + if (node.optional) { + this.token("?."); + } + if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) { + return; + } + this.tokenChar(40); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.rightParens(node); +} +function SequenceExpression(node) { + this.printList(node.expressions); +} +function ThisExpression() { + this.word("this"); +} +function Super() { + this.word("super"); +} +function _shouldPrintDecoratorsBeforeExport(node) { + if (typeof this.format.decoratorsBeforeExport === "boolean") { + return this.format.decoratorsBeforeExport; + } + return typeof node.start === "number" && node.start === node.declaration.start; +} +function Decorator(node) { + this.tokenChar(64); + const { + expression + } = node; + this.print(expression); + this.newline(); +} +function OptionalMemberExpression(node) { + let { + computed + } = node; + const { + optional, + property + } = node; + this.print(node.object); + if (!computed && isMemberExpression(property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + if (isLiteral(property) && typeof property.value === "number") { + computed = true; + } + if (optional) { + this.token("?."); + } + if (computed) { + this.tokenChar(91); + this.print(property); + this.tokenChar(93); + } else { + if (!optional) { + this.tokenChar(46); + } + this.print(property); + } +} +function OptionalCallExpression(node) { + this.print(node.callee); + this.print(node.typeParameters); + if (node.optional) { + this.token("?."); + } + this.print(node.typeArguments); + this.tokenChar(40); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.printList(node.arguments, undefined, undefined, undefined, undefined, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.rightParens(node); +} +function CallExpression(node) { + this.print(node.callee); + this.print(node.typeArguments); + this.print(node.typeParameters); + this.tokenChar(40); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.rightParens(node); +} +function Import() { + this.word("import"); +} +function AwaitExpression(node) { + this.word("await"); + this.space(); + this.print(node.argument); +} +function YieldExpression(node) { + if (node.delegate) { + this.word("yield", true); + this.tokenChar(42); + if (node.argument) { + this.space(); + this.print(node.argument); + } + } else if (node.argument) { + this.word("yield", true); + this.space(); + this.print(node.argument); + } else { + this.word("yield"); + } +} +function EmptyStatement() { + this.semicolon(true); +} +function ExpressionStatement(node) { + this.tokenContext |= _index.TokenContext.expressionStatement; + this.print(node.expression); + this.semicolon(); +} +function AssignmentPattern(node) { + this.print(node.left); + if (node.left.type === "Identifier" || isPattern(node.left)) { + if (node.left.optional) this.tokenChar(63); + this.print(node.left.typeAnnotation); + } + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.right); +} +function AssignmentExpression(node) { + this.print(node.left); + this.space(); + this.token(node.operator, false, 0, true); + this.space(); + this.print(node.right); +} +function BinaryExpression(node) { + this.print(node.left); + this.space(); + const { + operator + } = node; + if (operator.charCodeAt(0) === 105) { + this.word(operator); + } else { + this.token(operator, false, 0, true); + this.setLastChar(operator.charCodeAt(operator.length - 1)); + } + this.space(); + this.print(node.right); +} +function BindExpression(node) { + this.print(node.object); + this.token("::"); + this.print(node.callee); +} +function MemberExpression(node) { + this.print(node.object); + if (!node.computed && isMemberExpression(node.property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + let computed = node.computed; + if (isLiteral(node.property) && typeof node.property.value === "number") { + computed = true; + } + if (computed) { + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.tokenChar(91); + this.print(node.property, undefined, true); + this.tokenChar(93); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + } else { + this.tokenChar(46); + this.print(node.property); + } +} +function MetaProperty(node) { + this.print(node.meta); + this.tokenChar(46); + this.print(node.property); +} +function PrivateName(node) { + this.tokenChar(35); + this.print(node.id); +} +function V8IntrinsicIdentifier(node) { + this.tokenChar(37); + this.word(node.name); +} +function ModuleExpression(node) { + this.word("module", true); + this.space(); + this.tokenChar(123); + this.indent(); + const { + body + } = node; + if (body.body.length || body.directives.length) { + this.newline(); + } + this.print(body); + this.dedent(); + this.rightBrace(node); +} + +//# sourceMappingURL=expressions.js.map diff --git a/node_modules/@babel/generator/lib/generators/expressions.js.map b/node_modules/@babel/generator/lib/generators/expressions.js.map new file mode 100644 index 0000000..c9c6d85 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/expressions.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","isCallExpression","isLiteral","isMemberExpression","isNewExpression","isPattern","UnaryExpression","node","operator","firstChar","charCodeAt","word","space","tokenChar","print","argument","DoExpression","async","body","ParenthesizedExpression","token","oldNoLineTerminatorAfterNode","enterDelimited","expression","undefined","_noLineTerminatorAfterNode","rightParens","UpdateExpression","prefix","ConditionalExpression","test","consequent","alternate","NewExpression","parent","callee","format","minified","arguments","length","optional","typeArguments","typeParameters","tokenMap","endMatches","printList","shouldPrintTrailingComma","SequenceExpression","expressions","ThisExpression","Super","_shouldPrintDecoratorsBeforeExport","decoratorsBeforeExport","start","declaration","Decorator","newline","OptionalMemberExpression","computed","property","object","TypeError","value","OptionalCallExpression","CallExpression","Import","AwaitExpression","YieldExpression","delegate","EmptyStatement","semicolon","ExpressionStatement","tokenContext","TokenContext","expressionStatement","AssignmentPattern","left","type","typeAnnotation","right","AssignmentExpression","BinaryExpression","setLastChar","BindExpression","MemberExpression","MetaProperty","meta","PrivateName","id","V8IntrinsicIdentifier","name","ModuleExpression","indent","directives","dedent","rightBrace"],"sources":["../../src/generators/expressions.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport {\n isCallExpression,\n isLiteral,\n isMemberExpression,\n isNewExpression,\n isPattern,\n} from \"@babel/types\";\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport type * as t from \"@babel/types\";\nimport { TokenContext } from \"../node/index.ts\";\n\nexport function UnaryExpression(this: Printer, node: t.UnaryExpression) {\n const { operator } = node;\n const firstChar = operator.charCodeAt(0);\n if (firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ) {\n this.word(operator);\n this.space();\n } else {\n this.tokenChar(firstChar);\n }\n\n this.print(node.argument);\n}\n\nexport function DoExpression(this: Printer, node: t.DoExpression) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n this.word(\"do\");\n this.space();\n this.print(node.body);\n}\n\nexport function ParenthesizedExpression(\n this: Printer,\n node: t.ParenthesizedExpression,\n) {\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.print(node.expression, undefined, true);\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function UpdateExpression(this: Printer, node: t.UpdateExpression) {\n if (node.prefix) {\n this.token(node.operator, false, 0, true);\n this.print(node.argument);\n } else {\n this.print(node.argument, true);\n this.token(node.operator, false, 0, true);\n }\n}\n\nexport function ConditionalExpression(\n this: Printer,\n node: t.ConditionalExpression,\n) {\n this.print(node.test);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.consequent);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.alternate);\n}\n\nexport function NewExpression(\n this: Printer,\n node: t.NewExpression,\n parent: t.Node,\n) {\n this.word(\"new\");\n this.space();\n this.print(node.callee);\n if (\n this.format.minified &&\n node.arguments.length === 0 &&\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n !node.optional &&\n !isCallExpression(parent, { callee: node }) &&\n !isMemberExpression(parent) &&\n !isNewExpression(parent)\n ) {\n return;\n }\n\n this.print(node.typeArguments);\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters); // Legacy TS AST\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n if (node.optional) {\n this.token(\"?.\");\n }\n }\n\n if (\n node.arguments.length === 0 &&\n this.tokenMap &&\n !this.tokenMap.endMatches(node, \")\")\n ) {\n return;\n }\n\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.printList(\n node.arguments,\n this.shouldPrintTrailingComma(\")\"),\n undefined,\n undefined,\n undefined,\n true,\n );\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function SequenceExpression(this: Printer, node: t.SequenceExpression) {\n this.printList(node.expressions);\n}\n\nexport function ThisExpression(this: Printer) {\n this.word(\"this\");\n}\n\nexport function Super(this: Printer) {\n this.word(\"super\");\n}\n\nexport function _shouldPrintDecoratorsBeforeExport(\n this: Printer,\n node: t.ExportDeclaration & { declaration: t.ClassDeclaration },\n) {\n if (typeof this.format.decoratorsBeforeExport === \"boolean\") {\n return this.format.decoratorsBeforeExport;\n }\n return (\n typeof node.start === \"number\" && node.start === node.declaration.start\n );\n}\n\nexport function Decorator(this: Printer, node: t.Decorator) {\n this.token(\"@\");\n const { expression } = node;\n this.print(expression);\n this.newline();\n}\n\nexport function OptionalMemberExpression(\n this: Printer,\n node: t.OptionalMemberExpression,\n) {\n let { computed } = node;\n const { optional, property } = node;\n\n this.print(node.object);\n\n if (!computed && isMemberExpression(property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n // @ts-expect-error todo(flow->ts) maybe instead of typeof check specific literal types?\n if (isLiteral(property) && typeof property.value === \"number\") {\n computed = true;\n }\n if (optional) {\n this.token(\"?.\");\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(property);\n this.token(\"]\");\n } else {\n if (!optional) {\n this.token(\".\");\n }\n this.print(property);\n }\n}\n\nexport function OptionalCallExpression(\n this: Printer,\n node: t.OptionalCallExpression,\n) {\n this.print(node.callee);\n\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters); // legacy TS AST\n }\n\n if (node.optional) {\n this.token(\"?.\");\n }\n\n this.print(node.typeArguments);\n\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.printList(\n node.arguments,\n undefined,\n undefined,\n undefined,\n undefined,\n true,\n );\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function CallExpression(this: Printer, node: t.CallExpression) {\n this.print(node.callee);\n\n this.print(node.typeArguments);\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters); // legacy TS AST\n }\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.printList(\n node.arguments,\n this.shouldPrintTrailingComma(\")\"),\n undefined,\n undefined,\n undefined,\n true,\n );\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function Import(this: Printer) {\n this.word(\"import\");\n}\n\nexport function AwaitExpression(this: Printer, node: t.AwaitExpression) {\n this.word(\"await\");\n this.space();\n this.print(node.argument);\n}\n\nexport function YieldExpression(this: Printer, node: t.YieldExpression) {\n if (node.delegate) {\n this.word(\"yield\", true);\n this.token(\"*\");\n if (node.argument) {\n this.space();\n // line terminators are allowed after yield*\n this.print(node.argument);\n }\n } else if (node.argument) {\n this.word(\"yield\", true);\n this.space();\n this.print(node.argument);\n } else {\n this.word(\"yield\");\n }\n}\n\nexport function EmptyStatement(this: Printer) {\n this.semicolon(true /* force */);\n}\n\nexport function ExpressionStatement(\n this: Printer,\n node: t.ExpressionStatement,\n) {\n this.tokenContext |= TokenContext.expressionStatement;\n this.print(node.expression);\n this.semicolon();\n}\n\nexport function AssignmentPattern(this: Printer, node: t.AssignmentPattern) {\n this.print(node.left);\n if (node.left.type === \"Identifier\" || isPattern(node.left)) {\n if (node.left.optional) this.token(\"?\");\n this.print(node.left.typeAnnotation);\n }\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right);\n}\n\nexport function AssignmentExpression(\n this: Printer,\n node: t.AssignmentExpression | t.LogicalExpression,\n) {\n this.print(node.left);\n\n this.space();\n this.token(node.operator, false, 0, true);\n this.space();\n\n this.print(node.right);\n}\n\nexport { AssignmentExpression as LogicalExpression };\n\nexport function BinaryExpression(this: Printer, node: t.BinaryExpression) {\n this.print(node.left);\n\n this.space();\n const { operator } = node;\n if (operator.charCodeAt(0) === charCodes.lowercaseI) {\n this.word(operator);\n } else {\n this.token(operator, false, 0, true);\n this.setLastChar(operator.charCodeAt(operator.length - 1));\n }\n this.space();\n\n this.print(node.right);\n}\n\nexport function BindExpression(this: Printer, node: t.BindExpression) {\n this.print(node.object);\n this.token(\"::\");\n this.print(node.callee);\n}\n\nexport function MemberExpression(this: Printer, node: t.MemberExpression) {\n this.print(node.object);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe use specific literal types\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n\n if (computed) {\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.token(\"[\");\n this.print(node.property, undefined, true);\n this.token(\"]\");\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n } else {\n this.token(\".\");\n this.print(node.property);\n }\n}\n\nexport function MetaProperty(this: Printer, node: t.MetaProperty) {\n this.print(node.meta);\n this.token(\".\");\n this.print(node.property);\n}\n\nexport function PrivateName(this: Printer, node: t.PrivateName) {\n this.token(\"#\");\n this.print(node.id);\n}\n\nexport function V8IntrinsicIdentifier(\n this: Printer,\n node: t.V8IntrinsicIdentifier,\n) {\n this.token(\"%\");\n this.word(node.name);\n}\n\nexport function ModuleExpression(this: Printer, node: t.ModuleExpression) {\n this.word(\"module\", true);\n this.space();\n this.token(\"{\");\n this.indent();\n const { body } = node;\n if (body.body.length || body.directives.length) {\n this.newline();\n }\n this.print(body);\n this.dedent();\n this.rightBrace(node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAWA,IAAAC,MAAA,GAAAD,OAAA;AAAgD;EAV9CE,gBAAgB;EAChBC,SAAS;EACTC,kBAAkB;EAClBC,eAAe;EACfC;AAAS,IAAAP,EAAA;AAQJ,SAASQ,eAAeA,CAAgBC,IAAuB,EAAE;EACtE,MAAM;IAAEC;EAAS,CAAC,GAAGD,IAAI;EACzB,MAAME,SAAS,GAAGD,QAAQ,CAACE,UAAU,CAAC,CAAC,CAAC;EACxC,IAAID,SAAS,MAAwB,IAAIA,SAAS,OAAwB,EAAE;IAC1E,IAAI,CAACE,IAAI,CAACH,QAAQ,CAAC;IACnB,IAAI,CAACI,KAAK,CAAC,CAAC;EACd,CAAC,MAAM;IACL,IAAI,CAACC,SAAS,CAACJ,SAAS,CAAC;EAC3B;EAEA,IAAI,CAACK,KAAK,CAACP,IAAI,CAACQ,QAAQ,CAAC;AAC3B;AAEO,SAASC,YAAYA,CAAgBT,IAAoB,EAAE;EAChE,IAAIA,I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CAACA,IAAI,CAACqB,MAAM,IAAIrB,IAAI,CAAC2E,UAAU,CAACtD,MAAM,EAAE;IAC9C,IAAI,CAACiB,OAAO,CAAC,CAAC;EAChB;EACA,IAAI,CAAC1C,KAAK,CAACI,IAAI,CAAC;EAChB,IAAI,CAAC4E,MAAM,CAAC,CAAC;EACb,IAAI,CAACC,UAAU,CAACxF,IAAI,CAAC;AACvB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/flow.js b/node_modules/@babel/generator/lib/generators/flow.js new file mode 100644 index 0000000..62445cb --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/flow.js @@ -0,0 +1,658 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AnyTypeAnnotation = AnyTypeAnnotation; +exports.ArrayTypeAnnotation = ArrayTypeAnnotation; +exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; +exports.BooleanTypeAnnotation = BooleanTypeAnnotation; +exports.DeclareClass = DeclareClass; +exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration; +exports.DeclareExportDeclaration = DeclareExportDeclaration; +exports.DeclareFunction = DeclareFunction; +exports.DeclareInterface = DeclareInterface; +exports.DeclareModule = DeclareModule; +exports.DeclareModuleExports = DeclareModuleExports; +exports.DeclareOpaqueType = DeclareOpaqueType; +exports.DeclareTypeAlias = DeclareTypeAlias; +exports.DeclareVariable = DeclareVariable; +exports.DeclaredPredicate = DeclaredPredicate; +exports.EmptyTypeAnnotation = EmptyTypeAnnotation; +exports.EnumBooleanBody = EnumBooleanBody; +exports.EnumBooleanMember = EnumBooleanMember; +exports.EnumDeclaration = EnumDeclaration; +exports.EnumDefaultedMember = EnumDefaultedMember; +exports.EnumNumberBody = EnumNumberBody; +exports.EnumNumberMember = EnumNumberMember; +exports.EnumStringBody = EnumStringBody; +exports.EnumStringMember = EnumStringMember; +exports.EnumSymbolBody = EnumSymbolBody; +exports.ExistsTypeAnnotation = ExistsTypeAnnotation; +exports.FunctionTypeAnnotation = FunctionTypeAnnotation; +exports.FunctionTypeParam = FunctionTypeParam; +exports.IndexedAccessType = IndexedAccessType; +exports.InferredPredicate = InferredPredicate; +exports.InterfaceDeclaration = InterfaceDeclaration; +exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends; +exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation; +exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; +exports.MixedTypeAnnotation = MixedTypeAnnotation; +exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation; +exports.NullableTypeAnnotation = NullableTypeAnnotation; +Object.defineProperty(exports, "NumberLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _types2.NumericLiteral; + } +}); +exports.NumberTypeAnnotation = NumberTypeAnnotation; +exports.ObjectTypeAnnotation = ObjectTypeAnnotation; +exports.ObjectTypeCallProperty = ObjectTypeCallProperty; +exports.ObjectTypeIndexer = ObjectTypeIndexer; +exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot; +exports.ObjectTypeProperty = ObjectTypeProperty; +exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty; +exports.OpaqueType = OpaqueType; +exports.OptionalIndexedAccessType = OptionalIndexedAccessType; +exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; +Object.defineProperty(exports, "StringLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _types2.StringLiteral; + } +}); +exports.StringTypeAnnotation = StringTypeAnnotation; +exports.SymbolTypeAnnotation = SymbolTypeAnnotation; +exports.ThisTypeAnnotation = ThisTypeAnnotation; +exports.TupleTypeAnnotation = TupleTypeAnnotation; +exports.TypeAlias = TypeAlias; +exports.TypeAnnotation = TypeAnnotation; +exports.TypeCastExpression = TypeCastExpression; +exports.TypeParameter = TypeParameter; +exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation; +exports.TypeofTypeAnnotation = TypeofTypeAnnotation; +exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.Variance = Variance; +exports.VoidTypeAnnotation = VoidTypeAnnotation; +exports._interfaceish = _interfaceish; +exports._variance = _variance; +var _t = require("@babel/types"); +var _modules = require("./modules.js"); +var _index = require("../node/index.js"); +var _types2 = require("./types.js"); +const { + isDeclareExportDeclaration, + isStatement +} = _t; +function AnyTypeAnnotation() { + this.word("any"); +} +function ArrayTypeAnnotation(node) { + this.print(node.elementType, true); + this.tokenChar(91); + this.tokenChar(93); +} +function BooleanTypeAnnotation() { + this.word("boolean"); +} +function BooleanLiteralTypeAnnotation(node) { + this.word(node.value ? "true" : "false"); +} +function NullLiteralTypeAnnotation() { + this.word("null"); +} +function DeclareClass(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("class"); + this.space(); + _interfaceish.call(this, node); +} +function DeclareFunction(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("function"); + this.space(); + this.print(node.id); + this.print(node.id.typeAnnotation.typeAnnotation); + if (node.predicate) { + this.space(); + this.print(node.predicate); + } + this.semicolon(); +} +function InferredPredicate() { + this.tokenChar(37); + this.word("checks"); +} +function DeclaredPredicate(node) { + this.tokenChar(37); + this.word("checks"); + this.tokenChar(40); + this.print(node.value); + this.tokenChar(41); +} +function DeclareInterface(node) { + this.word("declare"); + this.space(); + InterfaceDeclaration.call(this, node); +} +function DeclareModule(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.space(); + this.print(node.id); + this.space(); + this.print(node.body); +} +function DeclareModuleExports(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.tokenChar(46); + this.word("exports"); + this.print(node.typeAnnotation); +} +function DeclareTypeAlias(node) { + this.word("declare"); + this.space(); + TypeAlias.call(this, node); +} +function DeclareOpaqueType(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + OpaqueType.call(this, node); +} +function DeclareVariable(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("var"); + this.space(); + this.print(node.id); + this.print(node.id.typeAnnotation); + this.semicolon(); +} +function DeclareExportDeclaration(node) { + this.word("declare"); + this.space(); + this.word("export"); + this.space(); + if (node.default) { + this.word("default"); + this.space(); + } + FlowExportDeclaration.call(this, node); +} +function DeclareExportAllDeclaration(node) { + this.word("declare"); + this.space(); + _modules.ExportAllDeclaration.call(this, node); +} +function EnumDeclaration(node) { + const { + id, + body + } = node; + this.word("enum"); + this.space(); + this.print(id); + this.print(body); +} +function enumExplicitType(context, name, hasExplicitType) { + if (hasExplicitType) { + context.space(); + context.word("of"); + context.space(); + context.word(name); + } + context.space(); +} +function enumBody(context, node) { + const { + members + } = node; + context.token("{"); + context.indent(); + context.newline(); + for (const member of members) { + context.print(member); + context.newline(); + } + if (node.hasUnknownMembers) { + context.token("..."); + context.newline(); + } + context.dedent(); + context.token("}"); +} +function EnumBooleanBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "boolean", explicitType); + enumBody(this, node); +} +function EnumNumberBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "number", explicitType); + enumBody(this, node); +} +function EnumStringBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "string", explicitType); + enumBody(this, node); +} +function EnumSymbolBody(node) { + enumExplicitType(this, "symbol", true); + enumBody(this, node); +} +function EnumDefaultedMember(node) { + const { + id + } = node; + this.print(id); + this.tokenChar(44); +} +function enumInitializedMember(context, node) { + context.print(node.id); + context.space(); + context.token("="); + context.space(); + context.print(node.init); + context.token(","); +} +function EnumBooleanMember(node) { + enumInitializedMember(this, node); +} +function EnumNumberMember(node) { + enumInitializedMember(this, node); +} +function EnumStringMember(node) { + enumInitializedMember(this, node); +} +function FlowExportDeclaration(node) { + if (node.declaration) { + const declar = node.declaration; + this.print(declar); + if (!isStatement(declar)) this.semicolon(); + } else { + this.tokenChar(123); + if (node.specifiers.length) { + this.space(); + this.printList(node.specifiers); + this.space(); + } + this.tokenChar(125); + if (node.source) { + this.space(); + this.word("from"); + this.space(); + this.print(node.source); + } + this.semicolon(); + } +} +function ExistsTypeAnnotation() { + this.tokenChar(42); +} +function FunctionTypeAnnotation(node, parent) { + this.print(node.typeParameters); + this.tokenChar(40); + if (node.this) { + this.word("this"); + this.tokenChar(58); + this.space(); + this.print(node.this.typeAnnotation); + if (node.params.length || node.rest) { + this.tokenChar(44); + this.space(); + } + } + this.printList(node.params); + if (node.rest) { + if (node.params.length) { + this.tokenChar(44); + this.space(); + } + this.token("..."); + this.print(node.rest); + } + this.tokenChar(41); + const type = parent == null ? void 0 : parent.type; + if (type != null && (type === "ObjectTypeCallProperty" || type === "ObjectTypeInternalSlot" || type === "DeclareFunction" || type === "ObjectTypeProperty" && parent.method)) { + this.tokenChar(58); + } else { + this.space(); + this.token("=>"); + } + this.space(); + this.print(node.returnType); +} +function FunctionTypeParam(node) { + this.print(node.name); + if (node.optional) this.tokenChar(63); + if (node.name) { + this.tokenChar(58); + this.space(); + } + this.print(node.typeAnnotation); +} +function InterfaceExtends(node) { + this.print(node.id); + this.print(node.typeParameters, true); +} +function _interfaceish(node) { + var _node$extends; + this.print(node.id); + this.print(node.typeParameters); + if ((_node$extends = node.extends) != null && _node$extends.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(node.extends); + } + if (node.type === "DeclareClass") { + var _node$mixins, _node$implements; + if ((_node$mixins = node.mixins) != null && _node$mixins.length) { + this.space(); + this.word("mixins"); + this.space(); + this.printList(node.mixins); + } + if ((_node$implements = node.implements) != null && _node$implements.length) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements); + } + } + this.space(); + this.print(node.body); +} +function _variance(node) { + var _node$variance; + const kind = (_node$variance = node.variance) == null ? void 0 : _node$variance.kind; + if (kind != null) { + if (kind === "plus") { + this.tokenChar(43); + } else if (kind === "minus") { + this.tokenChar(45); + } + } +} +function InterfaceDeclaration(node) { + this.word("interface"); + this.space(); + _interfaceish.call(this, node); +} +function andSeparator(occurrenceCount) { + this.space(); + this.token("&", false, occurrenceCount); + this.space(); +} +function InterfaceTypeAnnotation(node) { + var _node$extends2; + this.word("interface"); + if ((_node$extends2 = node.extends) != null && _node$extends2.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(node.extends); + } + this.space(); + this.print(node.body); +} +function IntersectionTypeAnnotation(node) { + this.printJoin(node.types, undefined, undefined, andSeparator); +} +function MixedTypeAnnotation() { + this.word("mixed"); +} +function EmptyTypeAnnotation() { + this.word("empty"); +} +function NullableTypeAnnotation(node) { + this.tokenChar(63); + this.print(node.typeAnnotation); +} +function NumberTypeAnnotation() { + this.word("number"); +} +function StringTypeAnnotation() { + this.word("string"); +} +function ThisTypeAnnotation() { + this.word("this"); +} +function TupleTypeAnnotation(node) { + this.tokenChar(91); + this.printList(node.types); + this.tokenChar(93); +} +function TypeofTypeAnnotation(node) { + this.word("typeof"); + this.space(); + this.print(node.argument); +} +function TypeAlias(node) { + this.word("type"); + this.space(); + this.print(node.id); + this.print(node.typeParameters); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.right); + this.semicolon(); +} +function TypeAnnotation(node, parent) { + this.tokenChar(58); + this.space(); + if (parent.type === "ArrowFunctionExpression") { + this.tokenContext |= _index.TokenContext.arrowFlowReturnType; + } else if (node.optional) { + this.tokenChar(63); + } + this.print(node.typeAnnotation); +} +function TypeParameterInstantiation(node) { + this.tokenChar(60); + this.printList(node.params); + this.tokenChar(62); +} +function TypeParameter(node) { + _variance.call(this, node); + this.word(node.name); + if (node.bound) { + this.print(node.bound); + } + if (node.default) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.default); + } +} +function OpaqueType(node) { + this.word("opaque"); + this.space(); + this.word("type"); + this.space(); + this.print(node.id); + this.print(node.typeParameters); + if (node.supertype) { + this.tokenChar(58); + this.space(); + this.print(node.supertype); + } + if (node.impltype) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.impltype); + } + this.semicolon(); +} +function ObjectTypeAnnotation(node) { + if (node.exact) { + this.token("{|"); + } else { + this.tokenChar(123); + } + const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])]; + if (props.length) { + this.newline(); + this.space(); + this.printJoin(props, true, true, () => { + if (props.length !== 1 || node.inexact) { + this.tokenChar(44); + this.space(); + } + }, true); + this.space(); + } + if (node.inexact) { + this.indent(); + this.token("..."); + if (props.length) { + this.newline(); + } + this.dedent(); + } + if (node.exact) { + this.token("|}"); + } else { + this.tokenChar(125); + } +} +function ObjectTypeInternalSlot(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this.tokenChar(91); + this.tokenChar(91); + this.print(node.id); + this.tokenChar(93); + this.tokenChar(93); + if (node.optional) this.tokenChar(63); + if (!node.method) { + this.tokenChar(58); + this.space(); + } + this.print(node.value); +} +function ObjectTypeCallProperty(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this.print(node.value); +} +function ObjectTypeIndexer(node) { + if (node.static) { + this.word("static"); + this.space(); + } + _variance.call(this, node); + this.tokenChar(91); + if (node.id) { + this.print(node.id); + this.tokenChar(58); + this.space(); + } + this.print(node.key); + this.tokenChar(93); + this.tokenChar(58); + this.space(); + this.print(node.value); +} +function ObjectTypeProperty(node) { + if (node.proto) { + this.word("proto"); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.kind === "get" || node.kind === "set") { + this.word(node.kind); + this.space(); + } + _variance.call(this, node); + this.print(node.key); + if (node.optional) this.tokenChar(63); + if (!node.method) { + this.tokenChar(58); + this.space(); + } + this.print(node.value); +} +function ObjectTypeSpreadProperty(node) { + this.token("..."); + this.print(node.argument); +} +function QualifiedTypeIdentifier(node) { + this.print(node.qualification); + this.tokenChar(46); + this.print(node.id); +} +function SymbolTypeAnnotation() { + this.word("symbol"); +} +function orSeparator(occurrenceCount) { + this.space(); + this.token("|", false, occurrenceCount); + this.space(); +} +function UnionTypeAnnotation(node) { + this.printJoin(node.types, undefined, undefined, orSeparator); +} +function TypeCastExpression(node) { + this.tokenChar(40); + this.print(node.expression); + this.print(node.typeAnnotation); + this.tokenChar(41); +} +function Variance(node) { + if (node.kind === "plus") { + this.tokenChar(43); + } else { + this.tokenChar(45); + } +} +function VoidTypeAnnotation() { + this.word("void"); +} +function IndexedAccessType(node) { + this.print(node.objectType, true); + this.tokenChar(91); + this.print(node.indexType); + this.tokenChar(93); +} +function OptionalIndexedAccessType(node) { + this.print(node.objectType); + if (node.optional) { + this.token("?."); + } + this.tokenChar(91); + this.print(node.indexType); + this.tokenChar(93); +} + +//# sourceMappingURL=flow.js.map diff --git a/node_modules/@babel/generator/lib/generators/flow.js.map b/node_modules/@babel/generator/lib/generators/flow.js.map new file mode 100644 index 0000000..b44691a --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/flow.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_modules","_index","_types2","isDeclareExportDeclaration","isStatement","AnyTypeAnnotation","word","ArrayTypeAnnotation","node","print","elementType","token","BooleanTypeAnnotation","BooleanLiteralTypeAnnotation","value","NullLiteralTypeAnnotation","DeclareClass","parent","space","_interfaceish","call","DeclareFunction","id","typeAnnotation","predicate","semicolon","InferredPredicate","DeclaredPredicate","DeclareInterface","InterfaceDeclaration","DeclareModule","body","DeclareModuleExports","DeclareTypeAlias","TypeAlias","DeclareOpaqueType","OpaqueType","DeclareVariable","DeclareExportDeclaration","default","FlowExportDeclaration","DeclareExportAllDeclaration","ExportAllDeclaration","EnumDeclaration","enumExplicitType","context","name","hasExplicitType","enumBody","members","indent","newline","member","hasUnknownMembers","dedent","EnumBooleanBody","explicitType","EnumNumberBody","EnumStringBody","EnumSymbolBody","EnumDefaultedMember","enumInitializedMember","init","EnumBooleanMember","EnumNumberMember","EnumStringMember","declaration","declar","specifiers","length","printList","source","ExistsTypeAnnotation","FunctionTypeAnnotation","typeParameters","this","params","rest","type","method","returnType","FunctionTypeParam","optional","InterfaceExtends","_node$extends","extends","_node$mixins","_node$implements","mixins","implements","_variance","_node$variance","kind","variance","andSeparator","occurrenceCount","InterfaceTypeAnnotation","_node$extends2","IntersectionTypeAnnotation","printJoin","types","undefined","MixedTypeAnnotation","EmptyTypeAnnotation","NullableTypeAnnotation","NumberTypeAnnotation","StringTypeAnnotation","ThisTypeAnnotation","TupleTypeAnnotation","TypeofTypeAnnotation","argument","right","TypeAnnotation","tokenContext","TokenContext","arrowFlowReturnType","TypeParameterInstantiation","TypeParameter","bound","supertype","impltype","ObjectTypeAnnotation","exact","props","properties","callProperties","indexers","internalSlots","inexact","ObjectTypeInternalSlot","static","ObjectTypeCallProperty","ObjectTypeIndexer","key","ObjectTypeProperty","proto","ObjectTypeSpreadProperty","QualifiedTypeIdentifier","qualification","SymbolTypeAnnotation","orSeparator","UnionTypeAnnotation","TypeCastExpression","expression","Variance","VoidTypeAnnotation","IndexedAccessType","objectType","indexType","OptionalIndexedAccessType"],"sources":["../../src/generators/flow.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport { isDeclareExportDeclaration, isStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { ExportAllDeclaration } from \"./modules.ts\";\nimport { TokenContext } from \"../node/index.ts\";\n\nexport function AnyTypeAnnotation(this: Printer) {\n this.word(\"any\");\n}\n\nexport function ArrayTypeAnnotation(\n this: Printer,\n node: t.ArrayTypeAnnotation,\n) {\n this.print(node.elementType, true);\n this.token(\"[\");\n this.token(\"]\");\n}\n\nexport function BooleanTypeAnnotation(this: Printer) {\n this.word(\"boolean\");\n}\n\nexport function BooleanLiteralTypeAnnotation(\n this: Printer,\n node: t.BooleanLiteralTypeAnnotation,\n) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteralTypeAnnotation(this: Printer) {\n this.word(\"null\");\n}\n\nexport function DeclareClass(\n this: Printer,\n node: t.DeclareClass,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"class\");\n this.space();\n _interfaceish.call(this, node);\n}\n\nexport function DeclareFunction(\n this: Printer,\n node: t.DeclareFunction,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"function\");\n this.space();\n this.print(node.id);\n // @ts-ignore(Babel 7 vs Babel 8) TODO(Babel 8) Remove this comment, since we'll remove the Noop node\n this.print(node.id.typeAnnotation.typeAnnotation);\n\n if (node.predicate) {\n this.space();\n this.print(node.predicate);\n }\n\n this.semicolon();\n}\n\nexport function InferredPredicate(this: Printer) {\n this.token(\"%\");\n this.word(\"checks\");\n}\n\nexport function DeclaredPredicate(this: Printer, node: t.DeclaredPredicate) {\n this.token(\"%\");\n this.word(\"checks\");\n this.token(\"(\");\n this.print(node.value);\n this.token(\")\");\n}\n\nexport function DeclareInterface(this: Printer, node: t.DeclareInterface) {\n this.word(\"declare\");\n this.space();\n InterfaceDeclaration.call(this, node);\n}\n\nexport function DeclareModule(this: Printer, node: t.DeclareModule) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.space();\n this.print(node.id);\n this.space();\n this.print(node.body);\n}\n\nexport function DeclareModuleExports(\n this: Printer,\n node: t.DeclareModuleExports,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.token(\".\");\n this.word(\"exports\");\n this.print(node.typeAnnotation);\n}\n\nexport function DeclareTypeAlias(this: Printer, node: t.DeclareTypeAlias) {\n this.word(\"declare\");\n this.space();\n TypeAlias.call(this, node);\n}\n\nexport function DeclareOpaqueType(\n this: Printer,\n node: t.DeclareOpaqueType,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n OpaqueType.call(this, node);\n}\n\nexport function DeclareVariable(\n this: Printer,\n node: t.DeclareVariable,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"var\");\n this.space();\n this.print(node.id);\n this.print(node.id.typeAnnotation);\n this.semicolon();\n}\n\nexport function DeclareExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"export\");\n this.space();\n if (node.default) {\n this.word(\"default\");\n this.space();\n }\n\n FlowExportDeclaration.call(this, node);\n}\n\nexport function DeclareExportAllDeclaration(\n this: Printer,\n node: t.DeclareExportAllDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n ExportAllDeclaration.call(this, node);\n}\n\nexport function EnumDeclaration(this: Printer, node: t.EnumDeclaration) {\n const { id, body } = node;\n this.word(\"enum\");\n this.space();\n this.print(id);\n this.print(body);\n}\n\nfunction enumExplicitType(\n context: Printer,\n name: string,\n hasExplicitType: boolean,\n) {\n if (hasExplicitType) {\n context.space();\n context.word(\"of\");\n context.space();\n context.word(name);\n }\n context.space();\n}\n\nfunction enumBody(context: Printer, node: t.EnumBody) {\n const { members } = node;\n context.token(\"{\");\n context.indent();\n context.newline();\n for (const member of members) {\n context.print(member);\n context.newline();\n }\n if (node.hasUnknownMembers) {\n context.token(\"...\");\n context.newline();\n }\n context.dedent();\n context.token(\"}\");\n}\n\nexport function EnumBooleanBody(this: Printer, node: t.EnumBooleanBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"boolean\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumNumberBody(this: Printer, node: t.EnumNumberBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"number\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumStringBody(this: Printer, node: t.EnumStringBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"string\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumSymbolBody(this: Printer, node: t.EnumSymbolBody) {\n enumExplicitType(this, \"symbol\", true);\n enumBody(this, node);\n}\n\nexport function EnumDefaultedMember(\n this: Printer,\n node: t.EnumDefaultedMember,\n) {\n const { id } = node;\n this.print(id);\n this.token(\",\");\n}\n\nfunction enumInitializedMember(\n context: Printer,\n node: t.EnumBooleanMember | t.EnumNumberMember | t.EnumStringMember,\n) {\n context.print(node.id);\n context.space();\n context.token(\"=\");\n context.space();\n context.print(node.init);\n context.token(\",\");\n}\n\nexport function EnumBooleanMember(this: Printer, node: t.EnumBooleanMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumNumberMember(this: Printer, node: t.EnumNumberMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumStringMember(this: Printer, node: t.EnumStringMember) {\n enumInitializedMember(this, node);\n}\n\nfunction FlowExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar);\n if (!isStatement(declar)) this.semicolon();\n } else {\n this.token(\"{\");\n if (node.specifiers!.length) {\n this.space();\n this.printList(node.specifiers);\n this.space();\n }\n this.token(\"}\");\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source);\n }\n\n this.semicolon();\n }\n}\n\nexport function ExistsTypeAnnotation(this: Printer) {\n this.token(\"*\");\n}\n\nexport function FunctionTypeAnnotation(\n this: Printer,\n node: t.FunctionTypeAnnotation,\n parent?: t.Node,\n) {\n this.print(node.typeParameters);\n this.token(\"(\");\n\n if (node.this) {\n this.word(\"this\");\n this.token(\":\");\n this.space();\n this.print(node.this.typeAnnotation);\n if (node.params.length || node.rest) {\n this.token(\",\");\n this.space();\n }\n }\n\n this.printList(node.params);\n\n if (node.rest) {\n if (node.params.length) {\n this.token(\",\");\n this.space();\n }\n this.token(\"...\");\n this.print(node.rest);\n }\n\n this.token(\")\");\n\n // this node type is overloaded, not sure why but it makes it EXTREMELY annoying\n\n const type = parent?.type;\n if (\n type != null &&\n (type === \"ObjectTypeCallProperty\" ||\n type === \"ObjectTypeInternalSlot\" ||\n type === \"DeclareFunction\" ||\n (type === \"ObjectTypeProperty\" && parent.method))\n ) {\n this.token(\":\");\n } else {\n this.space();\n this.token(\"=>\");\n }\n\n this.space();\n this.print(node.returnType);\n}\n\nexport function FunctionTypeParam(this: Printer, node: t.FunctionTypeParam) {\n this.print(node.name);\n if (node.optional) this.token(\"?\");\n if (node.name) {\n this.token(\":\");\n this.space();\n }\n this.print(node.typeAnnotation);\n}\n\nexport function InterfaceExtends(this: Printer, node: t.InterfaceExtends) {\n this.print(node.id);\n this.print(node.typeParameters, true);\n}\n\nexport {\n InterfaceExtends as ClassImplements,\n InterfaceExtends as GenericTypeAnnotation,\n};\n\nexport function _interfaceish(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface | t.DeclareClass,\n) {\n this.print(node.id);\n this.print(node.typeParameters);\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends);\n }\n if (node.type === \"DeclareClass\") {\n if (node.mixins?.length) {\n this.space();\n this.word(\"mixins\");\n this.space();\n this.printList(node.mixins);\n }\n if (node.implements?.length) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements);\n }\n }\n this.space();\n this.print(node.body);\n}\n\nexport function _variance(\n this: Printer,\n node:\n | t.TypeParameter\n | t.ObjectTypeIndexer\n | t.ObjectTypeProperty\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty,\n) {\n const kind = node.variance?.kind;\n if (kind != null) {\n if (kind === \"plus\") {\n this.token(\"+\");\n } else if (kind === \"minus\") {\n this.token(\"-\");\n }\n }\n}\n\nexport function InterfaceDeclaration(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface,\n) {\n this.word(\"interface\");\n this.space();\n _interfaceish.call(this, node);\n}\n\nfunction andSeparator(this: Printer, occurrenceCount: number) {\n this.space();\n this.token(\"&\", false, occurrenceCount);\n this.space();\n}\n\nexport function InterfaceTypeAnnotation(\n this: Printer,\n node: t.InterfaceTypeAnnotation,\n) {\n this.word(\"interface\");\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends);\n }\n this.space();\n this.print(node.body);\n}\n\nexport function IntersectionTypeAnnotation(\n this: Printer,\n node: t.IntersectionTypeAnnotation,\n) {\n this.printJoin(node.types, undefined, undefined, andSeparator);\n}\n\nexport function MixedTypeAnnotation(this: Printer) {\n this.word(\"mixed\");\n}\n\nexport function EmptyTypeAnnotation(this: Printer) {\n this.word(\"empty\");\n}\n\nexport function NullableTypeAnnotation(\n this: Printer,\n node: t.NullableTypeAnnotation,\n) {\n this.token(\"?\");\n this.print(node.typeAnnotation);\n}\n\nexport {\n NumericLiteral as NumberLiteralTypeAnnotation,\n StringLiteral as StringLiteralTypeAnnotation,\n} from \"./types.ts\";\n\nexport function NumberTypeAnnotation(this: Printer) {\n this.word(\"number\");\n}\n\nexport function StringTypeAnnotation(this: Printer) {\n this.word(\"string\");\n}\n\nexport function ThisTypeAnnotation(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TupleTypeAnnotation(\n this: Printer,\n node: t.TupleTypeAnnotation,\n) {\n this.token(\"[\");\n this.printList(node.types);\n this.token(\"]\");\n}\n\nexport function TypeofTypeAnnotation(\n this: Printer,\n node: t.TypeofTypeAnnotation,\n) {\n this.word(\"typeof\");\n this.space();\n this.print(node.argument);\n}\n\nexport function TypeAlias(\n this: Printer,\n node: t.TypeAlias | t.DeclareTypeAlias,\n) {\n this.word(\"type\");\n this.space();\n this.print(node.id);\n this.print(node.typeParameters);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right);\n this.semicolon();\n}\n\nexport function TypeAnnotation(\n this: Printer,\n node: t.TypeAnnotation,\n parent: t.Node,\n) {\n this.token(\":\");\n this.space();\n if (parent.type === \"ArrowFunctionExpression\") {\n this.tokenContext |= TokenContext.arrowFlowReturnType;\n } else if (\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n node.optional\n ) {\n this.token(\"?\");\n }\n this.print(node.typeAnnotation);\n}\n\nexport function TypeParameterInstantiation(\n this: Printer,\n node: t.TypeParameterInstantiation,\n): void {\n this.token(\"<\");\n this.printList(node.params);\n this.token(\">\");\n}\n\nexport { TypeParameterInstantiation as TypeParameterDeclaration };\n\nexport function TypeParameter(this: Printer, node: t.TypeParameter) {\n _variance.call(this, node);\n\n this.word(node.name);\n\n if (node.bound) {\n this.print(node.bound);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default);\n }\n}\n\nexport function OpaqueType(\n this: Printer,\n node: t.OpaqueType | t.DeclareOpaqueType,\n) {\n this.word(\"opaque\");\n this.space();\n this.word(\"type\");\n this.space();\n this.print(node.id);\n this.print(node.typeParameters);\n if (node.supertype) {\n this.token(\":\");\n this.space();\n this.print(node.supertype);\n }\n\n if (node.impltype) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.impltype);\n }\n this.semicolon();\n}\n\nexport function ObjectTypeAnnotation(\n this: Printer,\n node: t.ObjectTypeAnnotation,\n) {\n if (node.exact) {\n this.token(\"{|\");\n } else {\n this.token(\"{\");\n }\n\n // TODO: remove the array fallbacks and instead enforce the types to require an array\n const props = [\n ...node.properties,\n ...(node.callProperties || []),\n ...(node.indexers || []),\n ...(node.internalSlots || []),\n ];\n\n if (props.length) {\n this.newline();\n\n this.space();\n\n this.printJoin(\n props,\n true,\n true,\n () => {\n if (props.length !== 1 || node.inexact) {\n this.token(\",\");\n this.space();\n }\n },\n true,\n );\n\n this.space();\n }\n\n if (node.inexact) {\n this.indent();\n this.token(\"...\");\n if (props.length) {\n this.newline();\n }\n this.dedent();\n }\n\n if (node.exact) {\n this.token(\"|}\");\n } else {\n this.token(\"}\");\n }\n}\n\nexport function ObjectTypeInternalSlot(\n this: Printer,\n node: t.ObjectTypeInternalSlot,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.token(\"[\");\n this.token(\"[\");\n this.print(node.id);\n this.token(\"]\");\n this.token(\"]\");\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value);\n}\n\nexport function ObjectTypeCallProperty(\n this: Printer,\n node: t.ObjectTypeCallProperty,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.value);\n}\n\nexport function ObjectTypeIndexer(this: Printer, node: t.ObjectTypeIndexer) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n _variance.call(this, node);\n this.token(\"[\");\n if (node.id) {\n this.print(node.id);\n this.token(\":\");\n this.space();\n }\n this.print(node.key);\n this.token(\"]\");\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ObjectTypeProperty(this: Printer, node: t.ObjectTypeProperty) {\n if (node.proto) {\n this.word(\"proto\");\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.kind === \"get\" || node.kind === \"set\") {\n this.word(node.kind);\n this.space();\n }\n _variance.call(this, node);\n this.print(node.key);\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value);\n}\n\nexport function ObjectTypeSpreadProperty(\n this: Printer,\n node: t.ObjectTypeSpreadProperty,\n) {\n this.token(\"...\");\n this.print(node.argument);\n}\n\nexport function QualifiedTypeIdentifier(\n this: Printer,\n node: t.QualifiedTypeIdentifier,\n) {\n this.print(node.qualification);\n this.token(\".\");\n this.print(node.id);\n}\n\nexport function SymbolTypeAnnotation(this: Printer) {\n this.word(\"symbol\");\n}\n\nfunction orSeparator(this: Printer, occurrenceCount: number) {\n this.space();\n this.token(\"|\", false, occurrenceCount);\n this.space();\n}\n\nexport function UnionTypeAnnotation(\n this: Printer,\n node: t.UnionTypeAnnotation,\n) {\n this.printJoin(node.types, undefined, undefined, orSeparator);\n}\n\nexport function TypeCastExpression(this: Printer, node: t.TypeCastExpression) {\n this.token(\"(\");\n this.print(node.expression);\n this.print(node.typeAnnotation);\n this.token(\")\");\n}\n\nexport function Variance(this: Printer, node: t.Variance) {\n if (node.kind === \"plus\") {\n this.token(\"+\");\n } else {\n this.token(\"-\");\n }\n}\n\nexport function VoidTypeAnnotation(this: Printer) {\n this.word(\"void\");\n}\n\nexport function IndexedAccessType(this: Printer, node: t.IndexedAccessType) {\n this.print(node.objectType, true);\n this.token(\"[\");\n this.print(node.indexType);\n this.token(\"]\");\n}\n\nexport function OptionalIndexedAccessType(\n this: Printer,\n node: t.OptionalIndexedAccessType,\n) {\n this.print(node.objectType);\n if (node.optional) {\n this.token(\"?.\");\n }\n this.token(\"[\");\n this.print(node.indexType);\n this.token(\"]\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAqdA,IAAAG,OAAA,GAAAH,OAAA;AAGoB;EA3dXI,0BAA0B;EAAEC;AAAW,IAAAN,EAAA;AAKzC,SAASO,iBAAiBA,CAAA,EAAgB;EAC/C,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC;AAClB;AAEO,SAASC,mBAAmBA,CAEjCC,IAA2B,EAC3B;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,WAAW,EAAE,IAAI,CAAC;EAClC,IAAI,CAACC,SAAK,GAAI,CAAC;EACf,IAAI,CAACA,SAAK,GAAI,CAAC;AACjB;AAEO,SAASC,qBAAqBA,CAAA,EAAgB;EACnD,IAAI,CAACN,IAAI,CAAC,SAAS,CAAC;AACtB;AAEO,SAASO,4BAA4BA,CAE1CL,IAAoC,EACpC;EACA,IAAI,CAACF,IAAI,CAACE,IAAI,CAACM,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1C;AAEO,SAASC,yBAAyBA,CAAA,EAAgB;EACvD,IAAI,CAACT,IAAI,CAAC,MAAM,CAAC;AACnB;AAEO,SAASU,YAAYA,CAE1BR,IAAoB,EACpBS,MAAc,EACd;EACA,IAAI,CAACd,0BAA0B,CAACc,MAAM,CAAC,EAAE;IACvC,IAAI,CAACX,IAAI,CAAC,SAAS,CAAC;IACpB,IAAI,CAACY,KAAK,CAAC,CAAC;EACd;EACA,IAAI,CAACZ,IAAI,CAAC,OAAO,C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AC;EAC1B,IAAI,CAACzI,SAAK,GAAI,CAAC;AACjB;AAEO,SAAS0I,yBAAyBA,CAEvC7I,IAAiC,EACjC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAAC2I,UAAU,CAAC;EAC3B,IAAI3I,IAAI,CAAC0E,QAAQ,EAAE;IACjB,IAAI,CAACvE,KAAK,CAAC,IAAI,CAAC;EAClB;EACA,IAAI,CAACA,SAAK,GAAI,CAAC;EACf,IAAI,CAACF,KAAK,CAACD,IAAI,CAAC4I,SAAS,CAAC;EAC1B,IAAI,CAACzI,SAAK,GAAI,CAAC;AACjB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/index.js b/node_modules/@babel/generator/lib/generators/index.js new file mode 100644 index 0000000..331c73f --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/index.js @@ -0,0 +1,128 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _templateLiterals = require("./template-literals.js"); +Object.keys(_templateLiterals).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _templateLiterals[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _templateLiterals[key]; + } + }); +}); +var _expressions = require("./expressions.js"); +Object.keys(_expressions).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _expressions[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _expressions[key]; + } + }); +}); +var _statements = require("./statements.js"); +Object.keys(_statements).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _statements[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _statements[key]; + } + }); +}); +var _classes = require("./classes.js"); +Object.keys(_classes).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _classes[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _classes[key]; + } + }); +}); +var _methods = require("./methods.js"); +Object.keys(_methods).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _methods[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _methods[key]; + } + }); +}); +var _modules = require("./modules.js"); +Object.keys(_modules).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _modules[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _modules[key]; + } + }); +}); +var _types = require("./types.js"); +Object.keys(_types).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _types[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _types[key]; + } + }); +}); +var _flow = require("./flow.js"); +Object.keys(_flow).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _flow[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _flow[key]; + } + }); +}); +var _base = require("./base.js"); +Object.keys(_base).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _base[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _base[key]; + } + }); +}); +var _jsx = require("./jsx.js"); +Object.keys(_jsx).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _jsx[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _jsx[key]; + } + }); +}); +var _typescript = require("./typescript.js"); +Object.keys(_typescript).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _typescript[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _typescript[key]; + } + }); +}); + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/generators/index.js.map b/node_modules/@babel/generator/lib/generators/index.js.map new file mode 100644 index 0000000..e8b0341 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_templateLiterals","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_expressions","_statements","_classes","_methods","_modules","_types","_flow","_base","_jsx","_typescript"],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from \"./template-literals.ts\";\nexport * from \"./expressions.ts\";\nexport * from \"./statements.ts\";\nexport * from \"./classes.ts\";\nexport * from \"./methods.ts\";\nexport * from \"./modules.ts\";\nexport * from \"./types.ts\";\nexport * from \"./flow.ts\";\nexport * from \"./base.ts\";\nexport * from \"./jsx.ts\";\nexport * from \"./typescript.ts\";\n"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,WAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,WAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,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AAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,IAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,IAAA,CAAAb,GAAA;IAAA;EAAA;AAAA;AACA,IAAAc,WAAA,GAAAlB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAgB,WAAA,EAAAf,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAc,WAAA,CAAAd,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAU,WAAA,CAAAd,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/jsx.js b/node_modules/@babel/generator/lib/generators/jsx.js new file mode 100644 index 0000000..be7c512 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/jsx.js @@ -0,0 +1,124 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.JSXAttribute = JSXAttribute; +exports.JSXClosingElement = JSXClosingElement; +exports.JSXClosingFragment = JSXClosingFragment; +exports.JSXElement = JSXElement; +exports.JSXEmptyExpression = JSXEmptyExpression; +exports.JSXExpressionContainer = JSXExpressionContainer; +exports.JSXFragment = JSXFragment; +exports.JSXIdentifier = JSXIdentifier; +exports.JSXMemberExpression = JSXMemberExpression; +exports.JSXNamespacedName = JSXNamespacedName; +exports.JSXOpeningElement = JSXOpeningElement; +exports.JSXOpeningFragment = JSXOpeningFragment; +exports.JSXSpreadAttribute = JSXSpreadAttribute; +exports.JSXSpreadChild = JSXSpreadChild; +exports.JSXText = JSXText; +function JSXAttribute(node) { + this.print(node.name); + if (node.value) { + this.tokenChar(61); + this.print(node.value); + } +} +function JSXIdentifier(node) { + this.word(node.name); +} +function JSXNamespacedName(node) { + this.print(node.namespace); + this.tokenChar(58); + this.print(node.name); +} +function JSXMemberExpression(node) { + this.print(node.object); + this.tokenChar(46); + this.print(node.property); +} +function JSXSpreadAttribute(node) { + this.tokenChar(123); + this.token("..."); + this.print(node.argument); + this.rightBrace(node); +} +function JSXExpressionContainer(node) { + this.tokenChar(123); + this.print(node.expression); + this.rightBrace(node); +} +function JSXSpreadChild(node) { + this.tokenChar(123); + this.token("..."); + this.print(node.expression); + this.rightBrace(node); +} +function JSXText(node) { + const raw = this.getPossibleRaw(node); + if (raw !== undefined) { + this.token(raw, true); + } else { + this.token(node.value, true); + } +} +function JSXElement(node) { + const open = node.openingElement; + this.print(open); + if (open.selfClosing) return; + this.indent(); + for (const child of node.children) { + this.print(child); + } + this.dedent(); + this.print(node.closingElement); +} +function spaceSeparator() { + this.space(); +} +function JSXOpeningElement(node) { + this.tokenChar(60); + this.print(node.name); + if (node.typeArguments) { + this.print(node.typeArguments); + } + this.print(node.typeParameters); + if (node.attributes.length > 0) { + this.space(); + this.printJoin(node.attributes, undefined, undefined, spaceSeparator); + } + if (node.selfClosing) { + this.space(); + this.tokenChar(47); + } + this.tokenChar(62); +} +function JSXClosingElement(node) { + this.tokenChar(60); + this.tokenChar(47); + this.print(node.name); + this.tokenChar(62); +} +function JSXEmptyExpression() { + this.printInnerComments(); +} +function JSXFragment(node) { + this.print(node.openingFragment); + this.indent(); + for (const child of node.children) { + this.print(child); + } + this.dedent(); + this.print(node.closingFragment); +} +function JSXOpeningFragment() { + this.tokenChar(60); + this.tokenChar(62); +} +function JSXClosingFragment() { + this.token("</"); + this.tokenChar(62); +} + +//# sourceMappingURL=jsx.js.map diff --git a/node_modules/@babel/generator/lib/generators/jsx.js.map b/node_modules/@babel/generator/lib/generators/jsx.js.map new file mode 100644 index 0000000..ef1cb85 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/jsx.js.map @@ -0,0 +1 @@ +{"version":3,"names":["JSXAttribute","node","print","name","value","token","JSXIdentifier","word","JSXNamespacedName","namespace","JSXMemberExpression","object","property","JSXSpreadAttribute","argument","rightBrace","JSXExpressionContainer","expression","JSXSpreadChild","JSXText","raw","getPossibleRaw","undefined","JSXElement","open","openingElement","selfClosing","indent","child","children","dedent","closingElement","spaceSeparator","space","JSXOpeningElement","typeArguments","typeParameters","attributes","length","printJoin","JSXClosingElement","JSXEmptyExpression","printInnerComments","JSXFragment","openingFragment","closingFragment","JSXOpeningFragment","JSXClosingFragment"],"sources":["../../src/generators/jsx.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function JSXAttribute(this: Printer, node: t.JSXAttribute) {\n this.print(node.name);\n if (node.value) {\n this.token(\"=\");\n this.print(node.value);\n }\n}\n\nexport function JSXIdentifier(this: Printer, node: t.JSXIdentifier) {\n this.word(node.name);\n}\n\nexport function JSXNamespacedName(this: Printer, node: t.JSXNamespacedName) {\n this.print(node.namespace);\n this.token(\":\");\n this.print(node.name);\n}\n\nexport function JSXMemberExpression(\n this: Printer,\n node: t.JSXMemberExpression,\n) {\n this.print(node.object);\n this.token(\".\");\n this.print(node.property);\n}\n\nexport function JSXSpreadAttribute(this: Printer, node: t.JSXSpreadAttribute) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.argument);\n this.rightBrace(node);\n}\n\nexport function JSXExpressionContainer(\n this: Printer,\n node: t.JSXExpressionContainer,\n) {\n this.token(\"{\");\n this.print(node.expression);\n this.rightBrace(node);\n}\n\nexport function JSXSpreadChild(this: Printer, node: t.JSXSpreadChild) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.expression);\n this.rightBrace(node);\n}\n\nexport function JSXText(this: Printer, node: t.JSXText) {\n const raw = this.getPossibleRaw(node);\n\n if (raw !== undefined) {\n this.token(raw, true);\n } else {\n this.token(node.value, true);\n }\n}\n\nexport function JSXElement(this: Printer, node: t.JSXElement) {\n const open = node.openingElement;\n this.print(open);\n if (open.selfClosing) return;\n\n this.indent();\n for (const child of node.children) {\n this.print(child);\n }\n this.dedent();\n\n this.print(node.closingElement);\n}\n\nfunction spaceSeparator(this: Printer) {\n this.space();\n}\n\nexport function JSXOpeningElement(this: Printer, node: t.JSXOpeningElement) {\n this.token(\"<\");\n this.print(node.name);\n if (process.env.BABEL_8_BREAKING) {\n //@ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.typeArguments);\n } else {\n if (node.typeArguments) {\n this.print(node.typeArguments); // Flow AST\n }\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters); // Legacy TS AST\n }\n\n if (node.attributes.length > 0) {\n this.space();\n this.printJoin(node.attributes, undefined, undefined, spaceSeparator);\n }\n if (node.selfClosing) {\n this.space();\n this.token(\"/\");\n }\n this.token(\">\");\n}\n\nexport function JSXClosingElement(this: Printer, node: t.JSXClosingElement) {\n this.token(\"<\");\n this.token(\"/\");\n this.print(node.name);\n this.token(\">\");\n}\n\nexport function JSXEmptyExpression(this: Printer) {\n // This node is empty, so forcefully print its inner comments.\n this.printInnerComments();\n}\n\nexport function JSXFragment(this: Printer, node: t.JSXFragment) {\n this.print(node.openingFragment);\n\n this.indent();\n for (const child of node.children) {\n this.print(child);\n }\n this.dedent();\n\n this.print(node.closingFragment);\n}\n\nexport function JSXOpeningFragment(this: Printer) {\n this.token(\"<\");\n this.token(\">\");\n}\n\nexport function JSXClosingFragment(this: Printer) {\n this.token(\"</\");\n this.token(\">\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,SAASA,YAAYA,CAAgBC,IAAoB,EAAE;EAChE,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,IAAI,CAAC;EACrB,IAAIF,IAAI,CAACG,KAAK,EAAE;IACd,IAAI,CAACC,SAAK,GAAI,CAAC;IACf,IAAI,CAACH,KAAK,CAACD,I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,IAAI,CAACyB,WAAW,EAAE;IACpB,IAAI,CAACO,KAAK,CAAC,CAAC;IACZ,IAAI,CAAC5B,SAAK,GAAI,CAAC;EACjB;EACA,IAAI,CAACA,SAAK,GAAI,CAAC;AACjB;AAEO,SAASmC,iBAAiBA,CAAgBvC,IAAyB,EAAE;EAC1E,IAAI,CAACI,SAAK,GAAI,CAAC;EACf,IAAI,CAACA,SAAK,GAAI,CAAC;EACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACE,IAAI,CAAC;EACrB,IAAI,CAACE,SAAK,GAAI,CAAC;AACjB;AAEO,SAASoC,kBAAkBA,CAAA,EAAgB;EAEhD,IAAI,CAACC,kBAAkB,CAAC,CAAC;AAC3B;AAEO,SAASC,WAAWA,CAAgB1C,IAAmB,EAAE;EAC9D,IAAI,CAACC,KAAK,CAACD,IAAI,CAAC2C,eAAe,CAAC;EAEhC,IAAI,CAACjB,MAAM,CAAC,CAAC;EACb,KAAK,MAAMC,KAAK,IAAI3B,IAAI,CAAC4B,QAAQ,EAAE;IACjC,IAAI,CAAC3B,KAAK,CAAC0B,KAAK,CAAC;EACnB;EACA,IAAI,CAACE,MAAM,CAAC,CAAC;EAEb,IAAI,CAAC5B,KAAK,CAACD,IAAI,CAAC4C,eAAe,CAAC;AAClC;AAEO,SAASC,kBAAkBA,CAAA,EAAgB;EAChD,IAAI,CAACzC,SAAK,GAAI,CAAC;EACf,IAAI,CAACA,SAAK,GAAI,CAAC;AACjB;AAEO,SAAS0C,kBAAkBA,CAAA,EAAgB;EAChD,IAAI,CAAC1C,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAACA,SAAK,GAAI,CAAC;AACjB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/methods.js b/node_modules/@babel/generator/lib/generators/methods.js new file mode 100644 index 0000000..01b90aa --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/methods.js @@ -0,0 +1,207 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ArrowFunctionExpression = ArrowFunctionExpression; +exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression; +exports._functionHead = _functionHead; +exports._methodHead = _methodHead; +exports._param = _param; +exports._parameters = _parameters; +exports._params = _params; +exports._predicate = _predicate; +exports._shouldPrintArrowParamsParens = _shouldPrintArrowParamsParens; +var _t = require("@babel/types"); +var _index = require("../node/index.js"); +const { + isIdentifier +} = _t; +function _params(node, noLineTerminator, idNode, parentNode) { + this.print(node.typeParameters); + if (idNode !== undefined || parentNode !== undefined) { + const nameInfo = _getFuncIdName.call(this, idNode, parentNode); + if (nameInfo) { + this.sourceIdentifierName(nameInfo.name, nameInfo.pos); + } + } + this.tokenChar(40); + _parameters.call(this, node.params, 41); + this.print(node.returnType, noLineTerminator); + this._noLineTerminator = noLineTerminator; +} +function _parameters(parameters, endToken) { + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + const trailingComma = this.shouldPrintTrailingComma(endToken); + const paramLength = parameters.length; + for (let i = 0; i < paramLength; i++) { + _param.call(this, parameters[i]); + if (trailingComma || i < paramLength - 1) { + this.tokenChar(44, i); + this.space(); + } + } + this.tokenChar(endToken); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; +} +function _param(parameter) { + this.printJoin(parameter.decorators, undefined, undefined, undefined, undefined, true); + this.print(parameter, undefined, true); + if (parameter.optional) { + this.tokenChar(63); + } + this.print(parameter.typeAnnotation, undefined, true); +} +function _methodHead(node) { + const kind = node.kind; + const key = node.key; + if (kind === "get" || kind === "set") { + this.word(kind); + this.space(); + } + if (node.async) { + this.word("async", true); + this.space(); + } + if (kind === "method" || kind === "init") { + if (node.generator) { + this.tokenChar(42); + } + } + if (node.computed) { + this.tokenChar(91); + this.print(key); + this.tokenChar(93); + } else { + this.print(key); + } + if (node.optional) { + this.tokenChar(63); + } + if (this._buf._map) { + _params.call(this, node, false, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key); + } else { + _params.call(this, node, false); + } +} +function _predicate(node, noLineTerminatorAfter) { + if (node.predicate) { + if (!node.returnType) { + this.tokenChar(58); + } + this.space(); + this.print(node.predicate, noLineTerminatorAfter); + } +} +function _functionHead(node, parent, hasPredicate) { + if (node.async) { + this.word("async"); + if (!this.format.preserveFormat) { + this._innerCommentsState = 0; + } + this.space(); + } + this.word("function"); + if (node.generator) { + if (!this.format.preserveFormat) { + this._innerCommentsState = 0; + } + this.tokenChar(42); + } + this.space(); + if (node.id) { + this.print(node.id); + } + if (this._buf._map) { + _params.call(this, node, false, node.id, parent); + } else { + _params.call(this, node, false); + } + if (hasPredicate) { + _predicate.call(this, node); + } +} +function FunctionExpression(node, parent) { + _functionHead.call(this, node, parent, true); + this.space(); + this.print(node.body); +} +function ArrowFunctionExpression(node, parent) { + if (node.async) { + this.word("async", true); + this.space(); + } + if (_shouldPrintArrowParamsParens.call(this, node)) { + _params.call(this, node, true, undefined, this._buf._map ? parent : undefined); + } else { + this.print(node.params[0], true); + } + _predicate.call(this, node, true); + this.space(); + this.printInnerComments(); + this.token("=>"); + this.space(); + this.tokenContext |= _index.TokenContext.arrowBody; + this.print(node.body); +} +function _shouldPrintArrowParamsParens(node) { + var _firstParam$leadingCo, _firstParam$trailingC; + if (node.params.length !== 1) return true; + if (node.typeParameters || node.returnType || node.predicate) { + return true; + } + const firstParam = node.params[0]; + if (!isIdentifier(firstParam) || firstParam.typeAnnotation || firstParam.optional || (_firstParam$leadingCo = firstParam.leadingComments) != null && _firstParam$leadingCo.length || (_firstParam$trailingC = firstParam.trailingComments) != null && _firstParam$trailingC.length) { + return true; + } + if (this.tokenMap) { + if (node.loc == null) return true; + if (this.tokenMap.findMatching(node, "(") !== null) return true; + const arrowToken = this.tokenMap.findMatching(node, "=>"); + if ((arrowToken == null ? void 0 : arrowToken.loc) == null) return true; + return arrowToken.loc.start.line !== node.loc.start.line; + } + if (this.format.retainLines) return true; + return false; +} +function _getFuncIdName(idNode, parent) { + let id = idNode; + if (!id && parent) { + const parentType = parent.type; + if (parentType === "VariableDeclarator") { + id = parent.id; + } else if (parentType === "AssignmentExpression" || parentType === "AssignmentPattern") { + id = parent.left; + } else if (parentType === "ObjectProperty" || parentType === "ClassProperty") { + if (!parent.computed || parent.key.type === "StringLiteral") { + id = parent.key; + } + } else if (parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty") { + id = parent.key; + } + } + if (!id) return; + let nameInfo; + if (id.type === "Identifier") { + var _id$loc, _id$loc2; + nameInfo = { + pos: (_id$loc = id.loc) == null ? void 0 : _id$loc.start, + name: ((_id$loc2 = id.loc) == null ? void 0 : _id$loc2.identifierName) || id.name + }; + } else if (id.type === "PrivateName") { + var _id$loc3; + nameInfo = { + pos: (_id$loc3 = id.loc) == null ? void 0 : _id$loc3.start, + name: "#" + id.id.name + }; + } else if (id.type === "StringLiteral") { + var _id$loc4; + nameInfo = { + pos: (_id$loc4 = id.loc) == null ? void 0 : _id$loc4.start, + name: id.value + }; + } + return nameInfo; +} + +//# sourceMappingURL=methods.js.map diff --git a/node_modules/@babel/generator/lib/generators/methods.js.map b/node_modules/@babel/generator/lib/generators/methods.js.map new file mode 100644 index 0000000..d448e32 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/methods.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","isIdentifier","_params","node","noLineTerminator","idNode","parentNode","print","typeParameters","undefined","nameInfo","_getFuncIdName","call","sourceIdentifierName","name","pos","token","_parameters","params","returnType","_noLineTerminator","parameters","endToken","oldNoLineTerminatorAfterNode","enterDelimited","trailingComma","shouldPrintTrailingComma","paramLength","length","i","_param","tokenChar","space","_noLineTerminatorAfterNode","parameter","printJoin","decorators","optional","typeAnnotation","_methodHead","kind","key","word","async","generator","computed","_buf","_map","type","_predicate","noLineTerminatorAfter","predicate","_functionHead","parent","hasPredicate","format","preserveFormat","_innerCommentsState","id","FunctionExpression","body","ArrowFunctionExpression","_shouldPrintArrowParamsParens","printInnerComments","tokenContext","TokenContext","arrowBody","_firstParam$leadingCo","_firstParam$trailingC","firstParam","leadingComments","trailingComments","tokenMap","loc","findMatching","arrowToken","start","line","retainLines","parentType","left","_id$loc","_id$loc2","identifierName","_id$loc3","_id$loc4","value"],"sources":["../../src/generators/methods.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\nimport { isIdentifier, type ParentMaps } from \"@babel/types\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport { TokenContext } from \"../node/index.ts\";\n\ntype ParentsOf<T extends t.Node> = ParentMaps[T[\"type\"]];\n\nexport function _params(\n this: Printer,\n node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction,\n noLineTerminator: boolean,\n idNode?: t.Expression | t.PrivateName | null,\n parentNode?: ParentsOf<typeof node>,\n) {\n this.print(node.typeParameters);\n\n if (idNode !== undefined || parentNode !== undefined) {\n const nameInfo = _getFuncIdName.call(this, idNode, parentNode);\n if (nameInfo) {\n this.sourceIdentifierName(nameInfo.name, nameInfo.pos);\n }\n }\n\n this.token(\"(\");\n _parameters.call(this, node.params, charCodes.rightParenthesis);\n\n this.print(node.returnType, noLineTerminator);\n\n this._noLineTerminator = noLineTerminator;\n}\n\nexport function _parameters(\n this: Printer,\n parameters: t.Function[\"params\"],\n endToken: number,\n) {\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n\n const trailingComma = this.shouldPrintTrailingComma(endToken);\n\n const paramLength = parameters.length;\n for (let i = 0; i < paramLength; i++) {\n _param.call(this, parameters[i]);\n\n if (trailingComma || i < paramLength - 1) {\n this.tokenChar(charCodes.comma, i);\n this.space();\n }\n }\n\n this.tokenChar(endToken);\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n}\n\nexport function _param(\n this: Printer,\n parameter: t.Identifier | t.RestElement | t.Pattern | t.TSParameterProperty,\n) {\n this.printJoin(\n // @ts-expect-error decorators is not in VoidPattern\n parameter.decorators,\n undefined,\n undefined,\n undefined,\n undefined,\n true,\n );\n this.print(parameter, undefined, true);\n if (\n // @ts-expect-error optional is not in TSParameterProperty\n parameter.optional\n ) {\n this.token(\"?\"); // TS / flow\n }\n\n this.print(\n // @ts-expect-error typeAnnotation is not in TSParameterProperty\n parameter.typeAnnotation,\n undefined,\n true,\n ); // TS / flow\n}\n\nexport function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {\n const kind = node.kind;\n const key = node.key;\n\n if (kind === \"get\" || kind === \"set\") {\n this.word(kind);\n this.space();\n }\n\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n if (\n kind === \"method\" ||\n // @ts-expect-error Fixme: kind: \"init\" is not defined\n kind === \"init\"\n ) {\n if (node.generator) {\n this.token(\"*\");\n }\n }\n\n if (node.computed) {\n this.token(\"[\");\n this.print(key);\n this.token(\"]\");\n } else {\n this.print(key);\n }\n\n if (\n // @ts-expect-error optional is not in ObjectMethod\n node.optional\n ) {\n // TS\n this.token(\"?\");\n }\n\n if (this._buf._map) {\n _params.call(\n this,\n node,\n false,\n node.computed && node.key.type !== \"StringLiteral\" ? undefined : node.key,\n );\n } else {\n _params.call(this, node, false);\n }\n}\n\nexport function _predicate(\n this: Printer,\n node:\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.ArrowFunctionExpression,\n noLineTerminatorAfter?: boolean,\n) {\n if (node.predicate) {\n if (!node.returnType) {\n this.token(\":\");\n }\n this.space();\n this.print(node.predicate, noLineTerminatorAfter);\n }\n}\n\nexport function _functionHead(\n this: Printer,\n node: t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction,\n parent: ParentsOf<typeof node>,\n hasPredicate: boolean,\n) {\n if (node.async) {\n this.word(\"async\");\n if (!this.format.preserveFormat) {\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._innerCommentsState = 0 /* INNER_COMMENT_STATE.DISALLOWED */;\n }\n this.space();\n }\n this.word(\"function\");\n if (node.generator) {\n if (!this.format.preserveFormat) {\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._innerCommentsState = 0 /* INNER_COMMENT_STATE.DISALLOWED */;\n }\n this.token(\"*\");\n }\n\n this.space();\n if (node.id) {\n this.print(node.id);\n }\n\n if (this._buf._map) {\n _params.call(this, node, false, node.id, parent);\n } else {\n _params.call(this, node, false);\n }\n if (hasPredicate) {\n _predicate.call(this, node as t.FunctionDeclaration | t.FunctionExpression);\n }\n}\n\nexport function FunctionExpression(\n this: Printer,\n node: t.FunctionExpression,\n parent: ParentsOf<typeof node>,\n) {\n _functionHead.call(this, node, parent, true);\n this.space();\n this.print(node.body);\n}\n\nexport { FunctionExpression as FunctionDeclaration };\n\nexport function ArrowFunctionExpression(\n this: Printer,\n node: t.ArrowFunctionExpression,\n parent: ParentsOf<typeof node>,\n) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n if (_shouldPrintArrowParamsParens.call(this, node)) {\n _params.call(\n this,\n node,\n true,\n undefined,\n this._buf._map ? parent : undefined,\n );\n } else {\n this.print(node.params[0], true);\n }\n\n _predicate.call(this, node, true);\n this.space();\n // When printing (x)/*1*/=>{}, we remove the parentheses\n // and thus there aren't two contiguous inner tokens.\n // We forcefully print inner comments here.\n this.printInnerComments();\n this.token(\"=>\");\n\n this.space();\n\n this.tokenContext |= TokenContext.arrowBody;\n this.print(node.body);\n}\n\n// Try to avoid printing parens in simple cases, but only if we're pretty\n// sure that they aren't needed by type annotations or potential newlines.\nexport function _shouldPrintArrowParamsParens(\n this: Printer,\n node: t.ArrowFunctionExpression,\n): boolean {\n if (node.params.length !== 1) return true;\n\n if (node.typeParameters || node.returnType || node.predicate) {\n return true;\n }\n\n const firstParam = node.params[0];\n if (\n !isIdentifier(firstParam) ||\n firstParam.typeAnnotation ||\n firstParam.optional ||\n // Flow does not support `foo /*: string*/ => {};`\n firstParam.leadingComments?.length ||\n firstParam.trailingComments?.length\n ) {\n return true;\n }\n\n if (this.tokenMap) {\n if (node.loc == null) return true;\n if (this.tokenMap.findMatching(node, \"(\") !== null) return true;\n const arrowToken = this.tokenMap.findMatching(node, \"=>\");\n if (arrowToken?.loc == null) return true;\n return arrowToken.loc.start.line !== node.loc.start.line;\n }\n\n if (this.format.retainLines) return true;\n\n return false;\n}\n\nfunction _getFuncIdName(\n this: Printer,\n idNode: t.Expression | t.PrivateName,\n parent: ParentsOf<t.Function | t.TSDeclareMethod | t.TSDeclareFunction>,\n) {\n let id: t.Expression | t.PrivateName | t.LVal | t.VoidPattern = idNode;\n\n if (!id && parent) {\n const parentType = parent.type;\n\n if (parentType === \"VariableDeclarator\") {\n id = parent.id;\n } else if (\n parentType === \"AssignmentExpression\" ||\n parentType === \"AssignmentPattern\"\n ) {\n id = parent.left;\n } else if (\n parentType === \"ObjectProperty\" ||\n parentType === \"ClassProperty\"\n ) {\n if (!parent.computed || parent.key.type === \"StringLiteral\") {\n id = parent.key;\n }\n } else if (\n parentType === \"ClassPrivateProperty\" ||\n parentType === \"ClassAccessorProperty\"\n ) {\n id = parent.key;\n }\n }\n\n if (!id) return;\n\n let nameInfo;\n\n if (id.type === \"Identifier\") {\n nameInfo = {\n pos: id.loc?.start,\n name: id.loc?.identifierName || id.name,\n };\n } else if (id.type === \"PrivateName\") {\n nameInfo = {\n pos: id.loc?.start,\n name: \"#\" + id.id.name,\n };\n } else if (id.type === \"StringLiteral\") {\n nameInfo = {\n pos: id.loc?.start,\n name: id.value,\n };\n }\n\n return nameInfo;\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAAgD;EAHvCE;AAAY,IAAAH,EAAA;AAOd,SAASI,OAAOA,CAErBC,IAA0D,EAC1DC,gBAAyB,EACzBC,MAA4C,EAC5CC,UAAmC,EACnC;EACA,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACK,cAAc,CAAC;EAE/B,IAAIH,MAAM,KAAKI,SAAS,IAAIH,UAAU,KAAKG,SAAS,EAAE;IAC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,CAAC;EACH,CAAC,MAAM,IAAI4C,EAAE,CAACV,IAAI,KAAK,aAAa,EAAE;IAAA,IAAAoC,QAAA;IACpC1E,QAAQ,GAAG;MACTK,GAAG,GAAAqE,QAAA,GAAE1B,EAAE,CAACe,GAAG,qBAANW,QAAA,CAAQR,KAAK;MAClB9D,IAAI,EAAE,GAAG,GAAG4C,EAAE,CAACA,EAAE,CAAC5C;IACpB,CAAC;EACH,CAAC,MAAM,IAAI4C,EAAE,CAACV,IAAI,KAAK,eAAe,EAAE;IAAA,IAAAqC,QAAA;IACtC3E,QAAQ,GAAG;MACTK,GAAG,GAAAsE,QAAA,GAAE3B,EAAE,CAACe,GAAG,qBAANY,QAAA,CAAQT,KAAK;MAClB9D,IAAI,EAAE4C,EAAE,CAAC4B;IACX,CAAC;EACH;EAEA,OAAO5E,QAAQ;AACjB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/modules.js b/node_modules/@babel/generator/lib/generators/modules.js new file mode 100644 index 0000000..b787d42 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/modules.js @@ -0,0 +1,290 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ExportAllDeclaration = ExportAllDeclaration; +exports.ExportDefaultDeclaration = ExportDefaultDeclaration; +exports.ExportDefaultSpecifier = ExportDefaultSpecifier; +exports.ExportNamedDeclaration = ExportNamedDeclaration; +exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; +exports.ExportSpecifier = ExportSpecifier; +exports.ImportAttribute = ImportAttribute; +exports.ImportDeclaration = ImportDeclaration; +exports.ImportDefaultSpecifier = ImportDefaultSpecifier; +exports.ImportExpression = ImportExpression; +exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; +exports.ImportSpecifier = ImportSpecifier; +exports._printAttributes = _printAttributes; +var _t = require("@babel/types"); +var _index = require("../node/index.js"); +var _expressions = require("./expressions.js"); +const { + isClassDeclaration, + isExportDefaultSpecifier, + isExportNamespaceSpecifier, + isImportDefaultSpecifier, + isImportNamespaceSpecifier, + isStatement +} = _t; +function ImportSpecifier(node) { + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + this.print(node.imported); + if (node.local && node.local.name !== node.imported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.local); + } +} +function ImportDefaultSpecifier(node) { + this.print(node.local); +} +function ExportDefaultSpecifier(node) { + this.print(node.exported); +} +function ExportSpecifier(node) { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.print(node.local); + if (node.exported && node.local.name !== node.exported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.exported); + } +} +function ExportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.exported); +} +let warningShown = false; +function _printAttributes(node, hasPreviousBrace) { + var _node$extra; + const { + attributes + } = node; + var { + assertions + } = node; + const { + importAttributesKeyword + } = this.format; + if (attributes && !importAttributesKeyword && node.extra && (node.extra.deprecatedAssertSyntax || node.extra.deprecatedWithLegacySyntax) && !warningShown) { + warningShown = true; + console.warn(`\ +You are using import attributes, without specifying the desired output syntax. +Please specify the "importAttributesKeyword" generator option, whose value can be one of: + - "with" : \`import { a } from "b" with { type: "json" };\` + - "assert" : \`import { a } from "b" assert { type: "json" };\` + - "with-legacy" : \`import { a } from "b" with type: "json";\` +`); + } + const useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions; + this.word(useAssertKeyword ? "assert" : "with"); + this.space(); + if (!useAssertKeyword && (importAttributesKeyword === "with-legacy" || !importAttributesKeyword && (_node$extra = node.extra) != null && _node$extra.deprecatedWithLegacySyntax)) { + this.printList(attributes || assertions); + return; + } + const occurrenceCount = hasPreviousBrace ? 1 : 0; + this.token("{", undefined, occurrenceCount); + this.space(); + this.printList(attributes || assertions, this.shouldPrintTrailingComma("}")); + this.space(); + this.token("}", undefined, occurrenceCount); +} +function ExportAllDeclaration(node) { + var _node$attributes, _node$assertions; + this.word("export"); + this.space(); + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.tokenChar(42); + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) { + this.print(node.source, true); + this.space(); + _printAttributes.call(this, node, false); + } else { + this.print(node.source); + } + this.semicolon(); +} +function maybePrintDecoratorsBeforeExport(printer, node) { + if (isClassDeclaration(node.declaration) && _expressions._shouldPrintDecoratorsBeforeExport.call(printer, node)) { + printer.printJoin(node.declaration.decorators); + } +} +function ExportNamedDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.space(); + if (node.declaration) { + const declar = node.declaration; + this.print(declar); + if (!isStatement(declar)) this.semicolon(); + } else { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + const specifiers = node.specifiers.slice(0); + let hasSpecial = false; + for (;;) { + const first = specifiers[0]; + if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { + hasSpecial = true; + this.print(specifiers.shift()); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + let hasBrace = false; + if (specifiers.length || !specifiers.length && !hasSpecial) { + hasBrace = true; + this.tokenChar(123); + if (specifiers.length) { + this.space(); + this.printList(specifiers, this.shouldPrintTrailingComma("}")); + this.space(); + } + this.tokenChar(125); + } + if (node.source) { + var _node$attributes2, _node$assertions2; + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) { + this.print(node.source, true); + this.space(); + _printAttributes.call(this, node, hasBrace); + } else { + this.print(node.source); + } + } + this.semicolon(); + } +} +function ExportDefaultDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.noIndentInnerCommentsHere(); + this.space(); + this.word("default"); + this.space(); + this.tokenContext |= _index.TokenContext.exportDefault; + const declar = node.declaration; + this.print(declar); + if (!isStatement(declar)) this.semicolon(); +} +function ImportDeclaration(node) { + var _node$attributes3, _node$assertions3; + this.word("import"); + this.space(); + const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; + if (isTypeKind) { + this.noIndentInnerCommentsHere(); + this.word(node.importKind); + this.space(); + } else if (node.module) { + this.noIndentInnerCommentsHere(); + this.word("module"); + this.space(); + } else if (node.phase) { + this.noIndentInnerCommentsHere(); + this.word(node.phase); + this.space(); + } + const specifiers = node.specifiers.slice(0); + const hasSpecifiers = !!specifiers.length; + while (hasSpecifiers) { + const first = specifiers[0]; + if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { + this.print(specifiers.shift()); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + let hasBrace = false; + if (specifiers.length) { + hasBrace = true; + this.tokenChar(123); + this.space(); + this.printList(specifiers, this.shouldPrintTrailingComma("}")); + this.space(); + this.tokenChar(125); + } else if (isTypeKind && !hasSpecifiers) { + hasBrace = true; + this.tokenChar(123); + this.tokenChar(125); + } + if (hasSpecifiers || isTypeKind) { + this.space(); + this.word("from"); + this.space(); + } + if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) { + this.print(node.source, true); + this.space(); + _printAttributes.call(this, node, hasBrace); + } else { + this.print(node.source); + } + this.semicolon(); +} +function ImportAttribute(node) { + this.print(node.key); + this.tokenChar(58); + this.space(); + this.print(node.value); +} +function ImportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.local); +} +function ImportExpression(node) { + this.word("import"); + if (node.phase) { + this.tokenChar(46); + this.word(node.phase); + } + this.tokenChar(40); + const shouldPrintTrailingComma = this.shouldPrintTrailingComma(")"); + this.print(node.source); + if (node.options != null) { + this.tokenChar(44); + this.space(); + this.print(node.options); + } + if (shouldPrintTrailingComma) { + this.tokenChar(44); + } + this.rightParens(node); +} + +//# sourceMappingURL=modules.js.map diff --git a/node_modules/@babel/generator/lib/generators/modules.js.map b/node_modules/@babel/generator/lib/generators/modules.js.map new file mode 100644 index 0000000..c642e93 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/modules.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","_expressions","isClassDeclaration","isExportDefaultSpecifier","isExportNamespaceSpecifier","isImportDefaultSpecifier","isImportNamespaceSpecifier","isStatement","ImportSpecifier","node","importKind","word","space","print","imported","local","name","ImportDefaultSpecifier","ExportDefaultSpecifier","exported","ExportSpecifier","exportKind","ExportNamespaceSpecifier","token","warningShown","_printAttributes","hasPreviousBrace","_node$extra","attributes","assertions","importAttributesKeyword","format","extra","deprecatedAssertSyntax","deprecatedWithLegacySyntax","console","warn","useAssertKeyword","printList","occurrenceCount","undefined","shouldPrintTrailingComma","ExportAllDeclaration","_node$attributes","_node$assertions","length","source","call","semicolon","maybePrintDecoratorsBeforeExport","printer","declaration","_shouldPrintDecoratorsBeforeExport","printJoin","decorators","ExportNamedDeclaration","declar","specifiers","slice","hasSpecial","first","shift","hasBrace","_node$attributes2","_node$assertions2","ExportDefaultDeclaration","noIndentInnerCommentsHere","tokenContext","TokenContext","exportDefault","ImportDeclaration","_node$attributes3","_node$assertions3","isTypeKind","module","phase","hasSpecifiers","ImportAttribute","key","value","ImportNamespaceSpecifier","ImportExpression","options","rightParens"],"sources":["../../src/generators/modules.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport {\n isClassDeclaration,\n isExportDefaultSpecifier,\n isExportNamespaceSpecifier,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { TokenContext } from \"../node/index.ts\";\nimport { _shouldPrintDecoratorsBeforeExport } from \"./expressions.ts\";\n\nexport function ImportSpecifier(this: Printer, node: t.ImportSpecifier) {\n if (node.importKind === \"type\" || node.importKind === \"typeof\") {\n this.word(node.importKind);\n this.space();\n }\n\n this.print(node.imported);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.local && node.local.name !== node.imported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local);\n }\n}\n\nexport function ImportDefaultSpecifier(\n this: Printer,\n node: t.ImportDefaultSpecifier,\n) {\n this.print(node.local);\n}\n\nexport function ExportDefaultSpecifier(\n this: Printer,\n node: t.ExportDefaultSpecifier,\n) {\n this.print(node.exported);\n}\n\nexport function ExportSpecifier(this: Printer, node: t.ExportSpecifier) {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n this.print(node.local);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.exported && node.local.name !== node.exported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported);\n }\n}\n\nexport function ExportNamespaceSpecifier(\n this: Printer,\n node: t.ExportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported);\n}\n\nlet warningShown = false;\n\nexport function _printAttributes(\n this: Printer,\n node: Extract<t.Node, { attributes?: t.ImportAttribute[] | null }>,\n hasPreviousBrace: boolean,\n) {\n const { attributes } = node;\n\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n // eslint-disable-next-line no-var\n var { assertions } = node;\n const { importAttributesKeyword } = this.format;\n\n if (\n attributes &&\n !importAttributesKeyword &&\n node.extra &&\n (node.extra.deprecatedAssertSyntax ||\n node.extra.deprecatedWithLegacySyntax) &&\n // In the production build only show the warning once.\n // We want to show it per-usage locally for tests.\n (!process.env.IS_PUBLISH || !warningShown)\n ) {\n warningShown = true;\n console.warn(`\\\nYou are using import attributes, without specifying the desired output syntax.\nPlease specify the \"importAttributesKeyword\" generator option, whose value can be one of:\n - \"with\" : \\`import { a } from \"b\" with { type: \"json\" };\\`\n - \"assert\" : \\`import { a } from \"b\" assert { type: \"json\" };\\`\n - \"with-legacy\" : \\`import { a } from \"b\" with type: \"json\";\\`\n`);\n }\n\n const useAssertKeyword =\n importAttributesKeyword === \"assert\" ||\n (!importAttributesKeyword && assertions);\n\n this.word(useAssertKeyword ? \"assert\" : \"with\");\n this.space();\n\n if (\n !useAssertKeyword &&\n (importAttributesKeyword === \"with-legacy\" ||\n (!importAttributesKeyword && node.extra?.deprecatedWithLegacySyntax))\n ) {\n // with-legacy\n this.printList(attributes || assertions);\n return;\n }\n } else {\n this.word(\"with\");\n this.space();\n }\n\n const occurrenceCount = hasPreviousBrace ? 1 : 0;\n\n this.token(\"{\", undefined, occurrenceCount);\n this.space();\n this.printList(\n process.env.BABEL_8_BREAKING ? attributes : attributes || assertions,\n this.shouldPrintTrailingComma(\"}\"),\n );\n this.space();\n this.token(\"}\", undefined, occurrenceCount);\n}\n\nexport function ExportAllDeclaration(\n this: Printer,\n node: t.ExportAllDeclaration | t.DeclareExportAllDeclaration,\n) {\n this.word(\"export\");\n this.space();\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n this.token(\"*\");\n this.space();\n this.word(\"from\");\n this.space();\n if (\n node.attributes?.length ||\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n (!process.env.BABEL_8_BREAKING && node.assertions?.length)\n ) {\n this.print(node.source, true);\n this.space();\n _printAttributes.call(this, node, false);\n } else {\n this.print(node.source);\n }\n\n this.semicolon();\n}\n\nfunction maybePrintDecoratorsBeforeExport(\n printer: Printer,\n node: t.ExportNamedDeclaration | t.ExportDefaultDeclaration,\n) {\n if (\n isClassDeclaration(node.declaration) &&\n _shouldPrintDecoratorsBeforeExport.call(\n printer,\n node as t.ExportNamedDeclaration & { declaration: t.ClassDeclaration },\n )\n ) {\n printer.printJoin(node.declaration.decorators);\n }\n}\n\nexport function ExportNamedDeclaration(\n this: Printer,\n node: t.ExportNamedDeclaration,\n) {\n maybePrintDecoratorsBeforeExport(this, node);\n\n this.word(\"export\");\n this.space();\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar);\n if (!isStatement(declar)) this.semicolon();\n } else {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n\n // print \"special\" specifiers first\n let hasSpecial = false;\n for (;;) {\n const first = specifiers[0];\n if (\n isExportDefaultSpecifier(first) ||\n isExportNamespaceSpecifier(first)\n ) {\n hasSpecial = true;\n this.print(specifiers.shift());\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n let hasBrace = false;\n if (specifiers.length || (!specifiers.length && !hasSpecial)) {\n hasBrace = true;\n this.token(\"{\");\n if (specifiers.length) {\n this.space();\n this.printList(specifiers, this.shouldPrintTrailingComma(\"}\"));\n this.space();\n }\n this.token(\"}\");\n }\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n if (\n node.attributes?.length ||\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n (!process.env.BABEL_8_BREAKING && node.assertions?.length)\n ) {\n this.print(node.source, true);\n this.space();\n _printAttributes.call(this, node, hasBrace);\n } else {\n this.print(node.source);\n }\n }\n\n this.semicolon();\n }\n}\n\nexport function ExportDefaultDeclaration(\n this: Printer,\n node: t.ExportDefaultDeclaration,\n) {\n maybePrintDecoratorsBeforeExport(this, node);\n\n this.word(\"export\");\n this.noIndentInnerCommentsHere();\n this.space();\n this.word(\"default\");\n this.space();\n this.tokenContext |= TokenContext.exportDefault;\n const declar = node.declaration;\n this.print(declar);\n if (!isStatement(declar)) this.semicolon();\n}\n\nexport function ImportDeclaration(this: Printer, node: t.ImportDeclaration) {\n this.word(\"import\");\n this.space();\n\n const isTypeKind = node.importKind === \"type\" || node.importKind === \"typeof\";\n if (isTypeKind) {\n this.noIndentInnerCommentsHere();\n this.word(node.importKind!);\n this.space();\n } else if (node.module) {\n this.noIndentInnerCommentsHere();\n this.word(\"module\");\n this.space();\n } else if (node.phase) {\n this.noIndentInnerCommentsHere();\n this.word(node.phase);\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n const hasSpecifiers = !!specifiers.length;\n // print \"special\" specifiers first. The loop condition is constant,\n // but there is a \"break\" in the body.\n while (hasSpecifiers) {\n const first = specifiers[0];\n if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {\n this.print(specifiers.shift());\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n let hasBrace = false;\n if (specifiers.length) {\n hasBrace = true;\n this.token(\"{\");\n this.space();\n this.printList(specifiers, this.shouldPrintTrailingComma(\"}\"));\n this.space();\n this.token(\"}\");\n } else if (isTypeKind && !hasSpecifiers) {\n hasBrace = true;\n this.token(\"{\");\n this.token(\"}\");\n }\n\n if (hasSpecifiers || isTypeKind) {\n this.space();\n this.word(\"from\");\n this.space();\n }\n\n if (\n node.attributes?.length ||\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n (!process.env.BABEL_8_BREAKING && node.assertions?.length)\n ) {\n this.print(node.source, true);\n this.space();\n _printAttributes.call(this, node, hasBrace);\n } else {\n this.print(node.source);\n }\n\n this.semicolon();\n}\n\nexport function ImportAttribute(this: Printer, node: t.ImportAttribute) {\n this.print(node.key);\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ImportNamespaceSpecifier(\n this: Printer,\n node: t.ImportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local);\n}\n\nexport function ImportExpression(this: Printer, node: t.ImportExpression) {\n this.word(\"import\");\n if (node.phase) {\n this.token(\".\");\n this.word(node.phase);\n }\n this.token(\"(\");\n const shouldPrintTrailingComma = this.shouldPrintTrailingComma(\")\");\n this.print(node.source);\n if (node.options != null) {\n this.token(\",\");\n this.space();\n this.print(node.options);\n }\n if (shouldPrintTrailingComma) {\n this.token(\",\");\n }\n this.rightParens(node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAS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gBA,CAAgBxE,IAAwB,EAAE;EACxE,IAAI,CAACE,IAAI,CAAC,QAAQ,CAAC;EACnB,IAAIF,IAAI,CAACkE,KAAK,EAAE;IACd,IAAI,CAACpD,SAAK,GAAI,CAAC;IACf,IAAI,CAACZ,IAAI,CAACF,IAAI,CAACkE,KAAK,CAAC;EACvB;EACA,IAAI,CAACpD,SAAK,GAAI,CAAC;EACf,MAAMkB,wBAAwB,GAAG,IAAI,CAACA,wBAAwB,CAAC,GAAG,CAAC;EACnE,IAAI,CAAC5B,KAAK,CAACJ,IAAI,CAACqC,MAAM,CAAC;EACvB,IAAIrC,IAAI,CAACyE,OAAO,IAAI,IAAI,EAAE;IACxB,IAAI,CAAC3D,SAAK,GAAI,CAAC;IACf,IAAI,CAACX,KAAK,CAAC,CAAC;IACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACyE,OAAO,CAAC;EAC1B;EACA,IAAIzC,wBAAwB,EAAE;IAC5B,IAAI,CAAClB,SAAK,GAAI,CAAC;EACjB;EACA,IAAI,CAAC4D,WAAW,CAAC1E,IAAI,CAAC;AACxB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/statements.js b/node_modules/@babel/generator/lib/generators/statements.js new file mode 100644 index 0000000..ab139b3 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/statements.js @@ -0,0 +1,297 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BreakStatement = BreakStatement; +exports.CatchClause = CatchClause; +exports.ContinueStatement = ContinueStatement; +exports.DebuggerStatement = DebuggerStatement; +exports.DoWhileStatement = DoWhileStatement; +exports.ForInStatement = ForInStatement; +exports.ForOfStatement = ForOfStatement; +exports.ForStatement = ForStatement; +exports.IfStatement = IfStatement; +exports.LabeledStatement = LabeledStatement; +exports.ReturnStatement = ReturnStatement; +exports.SwitchCase = SwitchCase; +exports.SwitchStatement = SwitchStatement; +exports.ThrowStatement = ThrowStatement; +exports.TryStatement = TryStatement; +exports.VariableDeclaration = VariableDeclaration; +exports.VariableDeclarator = VariableDeclarator; +exports.WhileStatement = WhileStatement; +exports.WithStatement = WithStatement; +var _t = require("@babel/types"); +var _index = require("../node/index.js"); +const { + isFor, + isIfStatement, + isStatement +} = _t; +function WithStatement(node) { + this.word("with"); + this.space(); + this.tokenChar(40); + this.print(node.object); + this.tokenChar(41); + this.printBlock(node.body); +} +function IfStatement(node) { + this.word("if"); + this.space(); + this.tokenChar(40); + this.print(node.test); + this.tokenChar(41); + this.space(); + const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); + if (needsBlock) { + this.tokenChar(123); + this.newline(); + this.indent(); + } + this.printAndIndentOnComments(node.consequent); + if (needsBlock) { + this.dedent(); + this.newline(); + this.tokenChar(125); + } + if (node.alternate) { + if (this.endsWith(125)) this.space(); + this.word("else"); + this.space(); + this.printAndIndentOnComments(node.alternate); + } +} +function getLastStatement(statement) { + const { + body + } = statement; + if (isStatement(body) === false) { + return statement; + } + return getLastStatement(body); +} +function ForStatement(node) { + this.word("for"); + this.space(); + this.tokenChar(40); + this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate; + this.print(node.init); + this.tokenContext = _index.TokenContext.normal; + this.tokenChar(59); + if (node.test) { + this.space(); + this.print(node.test); + } + this.tokenChar(59, 1); + if (node.update) { + this.space(); + this.print(node.update); + } + this.tokenChar(41); + this.printBlock(node.body); +} +function WhileStatement(node) { + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test); + this.tokenChar(41); + this.printBlock(node.body); +} +function ForInStatement(node) { + this.word("for"); + this.space(); + this.noIndentInnerCommentsHere(); + this.tokenChar(40); + this.tokenContext |= _index.TokenContext.forInHead | _index.TokenContext.forInOrInitHeadAccumulate; + this.print(node.left); + this.tokenContext = _index.TokenContext.normal; + this.space(); + this.word("in"); + this.space(); + this.print(node.right); + this.tokenChar(41); + this.printBlock(node.body); +} +function ForOfStatement(node) { + this.word("for"); + this.space(); + if (node.await) { + this.word("await"); + this.space(); + } + this.noIndentInnerCommentsHere(); + this.tokenChar(40); + this.tokenContext |= _index.TokenContext.forOfHead; + this.print(node.left); + this.space(); + this.word("of"); + this.space(); + this.print(node.right); + this.tokenChar(41); + this.printBlock(node.body); +} +function DoWhileStatement(node) { + this.word("do"); + this.space(); + this.print(node.body); + this.space(); + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test); + this.tokenChar(41); + this.semicolon(); +} +function printStatementAfterKeyword(printer, node) { + if (node) { + printer.space(); + printer.printTerminatorless(node); + } + printer.semicolon(); +} +function BreakStatement(node) { + this.word("break"); + printStatementAfterKeyword(this, node.label); +} +function ContinueStatement(node) { + this.word("continue"); + printStatementAfterKeyword(this, node.label); +} +function ReturnStatement(node) { + this.word("return"); + printStatementAfterKeyword(this, node.argument); +} +function ThrowStatement(node) { + this.word("throw"); + printStatementAfterKeyword(this, node.argument); +} +function LabeledStatement(node) { + this.print(node.label); + this.tokenChar(58); + this.space(); + this.print(node.body); +} +function TryStatement(node) { + this.word("try"); + this.space(); + this.print(node.block); + this.space(); + if (node.handlers) { + this.print(node.handlers[0]); + } else { + this.print(node.handler); + } + if (node.finalizer) { + this.space(); + this.word("finally"); + this.space(); + this.print(node.finalizer); + } +} +function CatchClause(node) { + this.word("catch"); + this.space(); + if (node.param) { + this.tokenChar(40); + this.print(node.param); + this.print(node.param.typeAnnotation); + this.tokenChar(41); + this.space(); + } + this.print(node.body); +} +function SwitchStatement(node) { + this.word("switch"); + this.space(); + this.tokenChar(40); + this.print(node.discriminant); + this.tokenChar(41); + this.space(); + this.tokenChar(123); + this.printSequence(node.cases, true); + this.rightBrace(node); +} +function SwitchCase(node) { + if (node.test) { + this.word("case"); + this.space(); + this.print(node.test); + this.tokenChar(58); + } else { + this.word("default"); + this.tokenChar(58); + } + if (node.consequent.length) { + this.newline(); + this.printSequence(node.consequent, true); + } +} +function DebuggerStatement() { + this.word("debugger"); + this.semicolon(); +} +function commaSeparatorWithNewline(occurrenceCount) { + this.tokenChar(44, occurrenceCount); + this.newline(); +} +function VariableDeclaration(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + const { + kind + } = node; + switch (kind) { + case "await using": + this.word("await"); + this.space(); + case "using": + this.word("using", true); + break; + default: + this.word(kind); + } + this.space(); + let hasInits = false; + if (!isFor(parent)) { + for (const declar of node.declarations) { + if (declar.init) { + hasInits = true; + break; + } + } + } + this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? commaSeparatorWithNewline : undefined); + if (parent != null) { + switch (parent.type) { + case "ForStatement": + if (parent.init === node) { + return; + } + break; + case "ForInStatement": + case "ForOfStatement": + if (parent.left === node) { + return; + } + } + } + this.semicolon(); +} +function VariableDeclarator(node) { + this.print(node.id); + if (node.definite) this.tokenChar(33); + this.print(node.id.typeAnnotation); + if (node.init) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.init); + } +} + +//# sourceMappingURL=statements.js.map diff --git a/node_modules/@babel/generator/lib/generators/statements.js.map b/node_modules/@babel/generator/lib/generators/statements.js.map new file mode 100644 index 0000000..b01021c --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/statements.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","isFor","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","body","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","ForStatement","tokenContext","TokenContext","forInitHead","forInOrInitHeadAccumulate","init","normal","tokenChar","update","WhileStatement","ForInStatement","noIndentInnerCommentsHere","forInHead","left","right","ForOfStatement","await","forOfHead","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","rightBrace","SwitchCase","length","DebuggerStatement","commaSeparatorWithNewline","occurrenceCount","VariableDeclaration","parent","declare","kind","hasInits","declar","declarations","printList","undefined","type","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport { isFor, isIfStatement, isStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport { TokenContext } from \"../node/index.ts\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object);\n this.token(\")\");\n this.printBlock(node.body);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.tokenContext |=\n TokenContext.forInitHead | TokenContext.forInOrInitHeadAccumulate;\n this.print(node.init);\n this.tokenContext = TokenContext.normal;\n\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test);\n }\n this.tokenChar(charCodes.semicolon, 1);\n\n if (node.update) {\n this.space();\n this.print(node.update);\n }\n\n this.token(\")\");\n this.printBlock(node.body);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test);\n this.token(\")\");\n this.printBlock(node.body);\n}\n\nexport function ForInStatement(this: Printer, node: t.ForInStatement) {\n this.word(\"for\");\n this.space();\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.tokenContext |=\n TokenContext.forInHead | TokenContext.forInOrInitHeadAccumulate;\n this.print(node.left);\n this.tokenContext = TokenContext.normal;\n this.space();\n this.word(\"in\");\n this.space();\n this.print(node.right);\n this.token(\")\");\n this.printBlock(node.body);\n}\n\nexport function ForOfStatement(this: Printer, node: t.ForOfStatement) {\n this.word(\"for\");\n this.space();\n if (node.await) {\n this.word(\"await\");\n this.space();\n }\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.tokenContext |= TokenContext.forOfHead;\n this.print(node.left);\n this.space();\n this.word(\"of\");\n this.space();\n this.print(node.right);\n this.token(\")\");\n this.printBlock(node.body);\n}\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node | null | undefined,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label);\n this.token(\":\");\n this.space();\n this.print(node.body);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0]);\n } else {\n this.print(node.handler);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param);\n this.print(node.param.typeAnnotation);\n this.token(\")\");\n this.space();\n }\n this.print(node.body);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, true);\n\n this.rightBrace(node);\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, true);\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nfunction commaSeparatorWithNewline(this: Printer, occurrenceCount: number) {\n this.tokenChar(charCodes.comma, occurrenceCount);\n this.newline();\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n const { kind } = node;\n switch (kind) {\n case \"await using\":\n this.word(\"await\");\n this.space();\n // fallthrough\n case \"using\":\n this.word(\"using\", true);\n break;\n default:\n this.word(kind);\n }\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n break;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n this.printList(\n node.declarations,\n undefined,\n undefined,\n node.declarations.length > 1,\n hasInits ? commaSeparatorWithNewline : undefined,\n );\n\n if (parent != null) {\n switch (parent.type) {\n case \"ForStatement\":\n if (parent.init === node) {\n return;\n }\n break;\n case \"ForInStatement\":\n case \"ForOfStatement\":\n if (parent.left === node) {\n return;\n }\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-ignore(Babel 7 vs Babel 8) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAAgD;EANvCE,KAAK;EAAEC,aAAa;EAAEC;AAAW,IAAAL,EAAA;AAQnC,SAASM,aAAaA,CAAgBC,IAAqB,EAAE;EAClE,IAAI,CAACC,IAAI,CAAC,MAAM,CAAC;EACjB,IAAI,CAACC,KAAK,CAAC,CAAC;EACZ,IAAI,CAACC,SAAK,GAAI,CAAC;EACf,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACK,MAAM,CAAC;EACvB,IAAI,CAACF,SAAK,GAAI,CAAC;EACf,IAAI,CAACG,UAAU,CAACN,IAAI,CAACO,I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AAI,EAAE;UACxB;QACF;QACA;MACF,KAAK,gBAAgB;MACrB,KAAK,gBAAgB;QACnB,IAAIqE,MAAM,CAACpC,IAAI,KAAKjC,IAAI,EAAE;UACxB;QACF;IACJ;EACF;EAEA,IAAI,CAACuC,SAAS,CAAC,CAAC;AAClB;AAEO,SAASuC,kBAAkBA,CAAgB9E,IAA0B,EAAE;EAC5E,IAAI,CAACI,KAAK,CAACJ,IAAI,CAAC+E,EAAE,CAAC;EACnB,IAAI/E,IAAI,CAACgF,QAAQ,EAAE,IAAI,CAAC7E,SAAK,GAAI,CAAC;EAElC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC+E,EAAE,CAACtB,cAAc,CAAC;EAClC,IAAIzD,IAAI,CAACyB,IAAI,EAAE;IACb,IAAI,CAACvB,KAAK,CAAC,CAAC;IACZ,IAAI,CAACC,SAAK,GAAI,CAAC;IACf,IAAI,CAACD,KAAK,CAAC,CAAC;IACZ,IAAI,CAACE,KAAK,CAACJ,IAAI,CAACyB,IAAI,CAAC;EACvB;AACF","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js b/node_modules/@babel/generator/lib/generators/template-literals.js new file mode 100644 index 0000000..b0c029c --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/template-literals.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TaggedTemplateExpression = TaggedTemplateExpression; +exports.TemplateElement = TemplateElement; +exports.TemplateLiteral = TemplateLiteral; +exports._printTemplate = _printTemplate; +function TaggedTemplateExpression(node) { + this.print(node.tag); + this.print(node.typeParameters); + this.print(node.quasi); +} +function TemplateElement() { + throw new Error("TemplateElement printing is handled in TemplateLiteral"); +} +function _printTemplate(node, substitutions) { + const quasis = node.quasis; + let partRaw = "`"; + for (let i = 0; i < quasis.length - 1; i++) { + partRaw += quasis[i].value.raw; + this.token(partRaw + "${", true); + this.print(substitutions[i]); + partRaw = "}"; + if (this.tokenMap) { + const token = this.tokenMap.findMatching(node, "}", i); + if (token) this._catchUpTo(token.loc.start); + } + } + partRaw += quasis[quasis.length - 1].value.raw; + this.token(partRaw + "`", true); +} +function TemplateLiteral(node) { + _printTemplate.call(this, node, node.expressions); +} + +//# sourceMappingURL=template-literals.js.map diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js.map b/node_modules/@babel/generator/lib/generators/template-literals.js.map new file mode 100644 index 0000000..59fa221 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/template-literals.js.map @@ -0,0 +1 @@ +{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","Error","_printTemplate","substitutions","quasis","partRaw","i","length","value","raw","token","tokenMap","findMatching","_catchUpTo","loc","start","TemplateLiteral","call","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag);\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.typeArguments);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n this.print(node.typeParameters);\n }\n this.print(node.quasi);\n}\n\nexport function TemplateElement(this: Printer) {\n throw new Error(\"TemplateElement printing is handled in TemplateLiteral\");\n}\n\nexport type TemplateLiteralBase = t.Node & {\n quasis: t.TemplateElement[];\n};\n\nexport function _printTemplate<T extends t.Node>(\n this: Printer,\n node: TemplateLiteralBase,\n substitutions: T[],\n) {\n const quasis = node.quasis;\n let partRaw = \"`\";\n for (let i = 0; i < quasis.length - 1; i++) {\n partRaw += quasis[i].value.raw;\n this.token(partRaw + \"${\", true);\n this.print(substitutions[i]);\n partRaw = \"}\";\n\n // In Babel 7 we have individual tokens for ${ and }, so the automatic\n // catchup logic does not work. Manually look for those tokens.\n if (!process.env.BABEL_8_BREAKING && this.tokenMap) {\n const token = this.tokenMap.findMatching(node, \"}\", i);\n if (token) this._catchUpTo(token.loc.start);\n }\n }\n partRaw += quasis[quasis.length - 1].value.raw;\n this.token(partRaw + \"`\", true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n _printTemplate.call(this, node, node.expressions);\n}\n"],"mappings":";;;;;;;;;AAGO,SAASA,wBAAwBA,CAEtCC,IAAgC,EAChC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,GAAG,CAAC;EAMlB,IAAI,CAACD,KAAK,CAACD,IAAI,CAACG,cAAc,CAAC;EAEjC,IAAI,CAACF,KAAK,CAACD,IAAI,CAACI,KAAK,CAAC;AACxB;AAEO,SAASC,eAAeA,CAAA,EAAgB;EAC7C,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;AAC3E;AAMO,SAASC,cAAcA,CAE5BP,IAAyB,EACzBQ,aAAkB,EAClB;EACA,MAAMC,MAAM,GAAGT,IAAI,CAACS,MAAM;EAC1B,IAAIC,OAAO,GAAG,GAAG;EACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,EAAE,EAAE;IAC1CD,OAAO,IAAID,MAAM,CAACE,CAAC,CAAC,CAACE,KAAK,CAACC,GAAG;IAC9B,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,IAAI,EAAE,IAAI,CAAC;IAChC,IAAI,CAACT,KAAK,CAACO,aAAa,CAACG,CAAC,CAAC,CAAC;IAC5BD,OAAO,GAAG,GAAG;IAIb,IAAqC,IAAI,CAACM,QAAQ,EAAE;MAClD,MAAMD,KAAK,GAAG,IAAI,CAACC,QAAQ,CAACC,YAAY,CAACjB,IAAI,EAAE,GAAG,EAAEW,CAAC,CAAC;MACtD,IAAII,KAAK,EAAE,IAAI,CAACG,UAAU,CAACH,KAAK,CAACI,GAAG,CAACC,KAAK,CAAC;IAC7C;EACF;EACAV,OAAO,IAAID,MAAM,CAACA,MAAM,CAACG,MAAM,GAAG,CAAC,CAAC,CAACC,KAAK,CAACC,GAAG;EAC9C,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,GAAG,EAAE,IAAI,CAAC;AACjC;AAEO,SAASW,eAAeA,CAAgBrB,IAAuB,EAAE;EACtEO,cAAc,CAACe,IAAI,CAAC,IAAI,EAAEtB,IAAI,EAAEA,IAAI,CAACuB,WAAW,CAAC;AACnD","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/types.js b/node_modules/@babel/generator/lib/generators/types.js new file mode 100644 index 0000000..cfe9618 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/types.js @@ -0,0 +1,183 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ArgumentPlaceholder = ArgumentPlaceholder; +exports.ArrayPattern = exports.ArrayExpression = ArrayExpression; +exports.BigIntLiteral = BigIntLiteral; +exports.BooleanLiteral = BooleanLiteral; +exports.Identifier = Identifier; +exports.NullLiteral = NullLiteral; +exports.NumericLiteral = NumericLiteral; +exports.ObjectPattern = exports.ObjectExpression = ObjectExpression; +exports.ObjectMethod = ObjectMethod; +exports.ObjectProperty = ObjectProperty; +exports.PipelineBareFunction = PipelineBareFunction; +exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; +exports.PipelineTopicExpression = PipelineTopicExpression; +exports.RegExpLiteral = RegExpLiteral; +exports.SpreadElement = exports.RestElement = RestElement; +exports.StringLiteral = StringLiteral; +exports.TopicReference = TopicReference; +exports.VoidPattern = VoidPattern; +exports._getRawIdentifier = _getRawIdentifier; +var _t = require("@babel/types"); +var _jsesc = require("jsesc"); +var _methods = require("./methods.js"); +const { + isAssignmentPattern, + isIdentifier +} = _t; +let lastRawIdentResult = ""; +function _getRawIdentifier(node) { + const { + name + } = node; + const token = this.tokenMap.find(node, tok => tok.value === name); + if (token) { + lastRawIdentResult = this._originalCode.slice(token.start, token.end); + return lastRawIdentResult; + } + return lastRawIdentResult = node.name; +} +function Identifier(node) { + if (this._buf._map) { + var _node$loc; + this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name); + } + this.word(this.tokenMap ? lastRawIdentResult : node.name); +} +function ArgumentPlaceholder() { + this.tokenChar(63); +} +function RestElement(node) { + this.token("..."); + this.print(node.argument); +} +function ObjectExpression(node) { + const props = node.properties; + this.tokenChar(123); + if (props.length) { + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.space(); + this.printList(props, this.shouldPrintTrailingComma("}"), true, true, undefined, true); + this.space(); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + } + this.rightBrace(node); +} +function ObjectMethod(node) { + this.printJoin(node.decorators); + _methods._methodHead.call(this, node); + this.space(); + this.print(node.body); +} +function ObjectProperty(node) { + this.printJoin(node.decorators); + if (node.computed) { + this.tokenChar(91); + this.print(node.key); + this.tokenChar(93); + } else { + if (isAssignmentPattern(node.value) && isIdentifier(node.key) && node.key.name === node.value.left.name) { + this.print(node.value); + return; + } + this.print(node.key); + if (node.shorthand && isIdentifier(node.key) && isIdentifier(node.value) && node.key.name === node.value.name) { + return; + } + } + this.tokenChar(58); + this.space(); + this.print(node.value); +} +function ArrayExpression(node) { + const elems = node.elements; + const len = elems.length; + this.tokenChar(91); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + for (let i = 0; i < elems.length; i++) { + const elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem, undefined, true); + if (i < len - 1 || this.shouldPrintTrailingComma("]")) { + this.tokenChar(44, i); + } + } else { + this.tokenChar(44, i); + } + } + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.tokenChar(93); +} +function RegExpLiteral(node) { + this.word(`/${node.pattern}/${node.flags}`, false); +} +function BooleanLiteral(node) { + this.word(node.value ? "true" : "false"); +} +function NullLiteral() { + this.word("null"); +} +function NumericLiteral(node) { + const raw = this.getPossibleRaw(node); + const opts = this.format.jsescOption; + const value = node.value; + const str = value + ""; + if (opts.numbers) { + this.number(_jsesc(value, opts), value); + } else if (raw == null) { + this.number(str, value); + } else if (this.format.minified) { + this.number(raw.length < str.length ? raw : str, value); + } else { + this.number(raw, value); + } +} +function StringLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.token(raw); + return; + } + const val = _jsesc(node.value, this.format.jsescOption); + this.token(val); +} +function BigIntLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.word(raw); + return; + } + this.word(node.value + "n"); +} +const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]); +function TopicReference() { + const { + topicToken + } = this.format; + if (validTopicTokenSet.has(topicToken)) { + this.token(topicToken); + } else { + const givenTopicTokenJSON = JSON.stringify(topicToken); + const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v)); + throw new Error(`The "topicToken" generator option must be one of ` + `${validTopics.join(", ")} (${givenTopicTokenJSON} received instead).`); + } +} +function PipelineTopicExpression(node) { + this.print(node.expression); +} +function PipelineBareFunction(node) { + this.print(node.callee); +} +function PipelinePrimaryTopicReference() { + this.tokenChar(35); +} +function VoidPattern() { + this.word("void"); +} + +//# sourceMappingURL=types.js.map diff --git a/node_modules/@babel/generator/lib/generators/types.js.map b/node_modules/@babel/generator/lib/generators/types.js.map new file mode 100644 index 0000000..9f27ab1 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/types.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_jsesc","_methods","isAssignmentPattern","isIdentifier","lastRawIdentResult","_getRawIdentifier","node","name","token","tokenMap","find","tok","value","_originalCode","slice","start","end","Identifier","_buf","_map","_node$loc","sourceIdentifierName","loc","identifierName","word","ArgumentPlaceholder","RestElement","print","argument","ObjectExpression","props","properties","length","oldNoLineTerminatorAfterNode","enterDelimited","space","printList","shouldPrintTrailingComma","undefined","_noLineTerminatorAfterNode","rightBrace","ObjectMethod","printJoin","decorators","_methodHead","call","body","ObjectProperty","computed","key","left","shorthand","ArrayExpression","elems","elements","len","i","elem","tokenChar","RegExpLiteral","pattern","flags","BooleanLiteral","NullLiteral","NumericLiteral","raw","getPossibleRaw","opts","format","jsescOption","str","numbers","number","jsesc","minified","StringLiteral","val","BigIntLiteral","validTopicTokenSet","Set","TopicReference","topicToken","has","givenTopicTokenJSON","JSON","stringify","validTopics","Array","from","v","Error","join","PipelineTopicExpression","expression","PipelineBareFunction","callee","PipelinePrimaryTopicReference","VoidPattern"],"sources":["../../src/generators/types.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport { isAssignmentPattern, isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport jsesc from \"jsesc\";\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport { _methodHead } from \"./methods.ts\";\n\nlet lastRawIdentResult: string = \"\";\nexport function _getRawIdentifier(this: Printer, node: t.Identifier) {\n const { name } = node;\n const token = this.tokenMap!.find(node, tok => tok.value === name);\n if (token) {\n lastRawIdentResult = this._originalCode!.slice(token.start, token.end);\n return lastRawIdentResult;\n }\n return (lastRawIdentResult = node.name);\n}\n\nexport function Identifier(this: Printer, node: t.Identifier) {\n if (this._buf._map) {\n this.sourceIdentifierName(node.loc?.identifierName || node.name);\n }\n\n this.word(this.tokenMap ? lastRawIdentResult : node.name);\n}\n\nexport function ArgumentPlaceholder(this: Printer) {\n this.token(\"?\");\n}\n\nexport function RestElement(this: Printer, node: t.RestElement) {\n this.token(\"...\");\n this.print(node.argument);\n}\n\nexport { RestElement as SpreadElement };\n\nexport function ObjectExpression(this: Printer, node: t.ObjectExpression) {\n const props = node.properties;\n\n this.token(\"{\");\n\n if (props.length) {\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.space();\n this.printList(\n props,\n this.shouldPrintTrailingComma(\"}\"),\n true,\n true,\n undefined,\n true,\n );\n this.space();\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n }\n\n this.rightBrace(node);\n}\n\nexport { ObjectExpression as ObjectPattern };\n\nexport function ObjectMethod(this: Printer, node: t.ObjectMethod) {\n this.printJoin(node.decorators);\n _methodHead.call(this, node);\n this.space();\n this.print(node.body);\n}\n\nexport function ObjectProperty(this: Printer, node: t.ObjectProperty) {\n this.printJoin(node.decorators);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key);\n this.token(\"]\");\n } else {\n // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`\n if (\n isAssignmentPattern(node.value) &&\n isIdentifier(node.key) &&\n // @ts-expect-error todo(flow->ts) `.name` does not exist on some types in union\n node.key.name === node.value.left.name\n ) {\n this.print(node.value);\n return;\n }\n\n this.print(node.key);\n\n // shorthand!\n if (\n node.shorthand &&\n isIdentifier(node.key) &&\n isIdentifier(node.value) &&\n node.key.name === node.value.name\n ) {\n return;\n }\n }\n\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ArrayExpression(this: Printer, node: t.ArrayExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n this.token(\"[\");\n\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, undefined, true);\n if (i < len - 1 || this.shouldPrintTrailingComma(\"]\")) {\n this.tokenChar(charCodes.comma, i);\n }\n } else {\n // If the array expression ends with a hole, that hole\n // will be ignored by the interpreter, but if it ends with\n // two (or more) holes, we need to write out two (or more)\n // commas so that the resulting code is interpreted with\n // both (all) of the holes.\n this.tokenChar(charCodes.comma, i);\n }\n }\n\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n\n this.token(\"]\");\n}\n\nexport { ArrayExpression as ArrayPattern };\n\nexport function RegExpLiteral(this: Printer, node: t.RegExpLiteral) {\n this.word(`/${node.pattern}/${node.flags}`, false);\n}\n\nexport function BooleanLiteral(this: Printer, node: t.BooleanLiteral) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteral(this: Printer) {\n this.word(\"null\");\n}\n\nexport function NumericLiteral(this: Printer, node: t.NumericLiteral) {\n const raw = this.getPossibleRaw(node);\n const opts = this.format.jsescOption;\n const value = node.value;\n const str = value + \"\";\n if (opts.numbers) {\n this.number(jsesc(value, opts), value);\n } else if (raw == null) {\n this.number(str, value); // normalize\n } else if (this.format.minified) {\n this.number(raw.length < str.length ? raw : str, value);\n } else {\n this.number(raw, value);\n }\n}\n\nexport function StringLiteral(this: Printer, node: t.StringLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const val = jsesc(node.value, this.format.jsescOption);\n\n this.token(val);\n}\n\nexport function BigIntLiteral(this: Printer, node: t.BigIntLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"n\");\n}\n\n// Hack pipe operator\nconst validTopicTokenSet = new Set<string | undefined>([\n \"^^\",\n \"@@\",\n \"^\",\n \"%\",\n \"#\",\n]);\nexport function TopicReference(this: Printer) {\n const { topicToken } = this.format;\n\n if (validTopicTokenSet.has(topicToken)) {\n this.token(topicToken!);\n } else {\n const givenTopicTokenJSON = JSON.stringify(topicToken);\n const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v));\n throw new Error(\n `The \"topicToken\" generator option must be one of ` +\n `${validTopics.join(\", \")} (${givenTopicTokenJSON} received instead).`,\n );\n }\n}\n\n// Smart-mix pipe operator\nexport function PipelineTopicExpression(\n this: Printer,\n node: t.PipelineTopicExpression,\n) {\n this.print(node.expression);\n}\n\nexport function PipelineBareFunction(\n this: Printer,\n node: t.PipelineBareFunction,\n) {\n this.print(node.callee);\n}\n\nexport function PipelinePrimaryTopicReference(this: Printer) {\n this.token(\"#\");\n}\n\n// discard binding\nexport function VoidPattern(this: Printer) {\n this.word(\"void\");\n}\n"],"mappings":";;;;;;;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,kBAAkB,EAAEW,CAAC,IAAIL,IAAI,CAACC,SAAS,CAACI,CAAC,CAAC,CAAC;IAC1E,MAAM,IAAIC,KAAK,CACb,mDAAmD,GACjD,GAAGJ,WAAW,CAACK,IAAI,CAAC,IAAI,CAAC,KAAKR,mBAAmB,qBACrD,CAAC;EACH;AACF;AAGO,SAASS,uBAAuBA,CAErCtF,IAA+B,EAC/B;EACA,IAAI,CAACqB,KAAK,CAACrB,IAAI,CAACuF,UAAU,CAAC;AAC7B;AAEO,SAASC,oBAAoBA,CAElCxF,IAA4B,EAC5B;EACA,IAAI,CAACqB,KAAK,CAACrB,IAAI,CAACyF,MAAM,CAAC;AACzB;AAEO,SAASC,6BAA6BA,CAAA,EAAgB;EAC3D,IAAI,CAACxF,SAAK,GAAI,CAAC;AACjB;AAGO,SAASyF,WAAWA,CAAA,EAAgB;EACzC,IAAI,CAACzE,IAAI,CAAC,MAAM,CAAC;AACnB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/typescript.js b/node_modules/@babel/generator/lib/generators/typescript.js new file mode 100644 index 0000000..ca9edb8 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/typescript.js @@ -0,0 +1,726 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TSAnyKeyword = TSAnyKeyword; +exports.TSArrayType = TSArrayType; +exports.TSAsExpression = TSAsExpression; +exports.TSBigIntKeyword = TSBigIntKeyword; +exports.TSBooleanKeyword = TSBooleanKeyword; +exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; +exports.TSInterfaceHeritage = exports.TSClassImplements = TSClassImplements; +exports.TSConditionalType = TSConditionalType; +exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration; +exports.TSConstructorType = TSConstructorType; +exports.TSDeclareFunction = TSDeclareFunction; +exports.TSDeclareMethod = TSDeclareMethod; +exports.TSEnumBody = TSEnumBody; +exports.TSEnumDeclaration = TSEnumDeclaration; +exports.TSEnumMember = TSEnumMember; +exports.TSExportAssignment = TSExportAssignment; +exports.TSExternalModuleReference = TSExternalModuleReference; +exports.TSFunctionType = TSFunctionType; +exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration; +exports.TSImportType = TSImportType; +exports.TSIndexSignature = TSIndexSignature; +exports.TSIndexedAccessType = TSIndexedAccessType; +exports.TSInferType = TSInferType; +exports.TSInstantiationExpression = TSInstantiationExpression; +exports.TSInterfaceBody = TSInterfaceBody; +exports.TSInterfaceDeclaration = TSInterfaceDeclaration; +exports.TSIntersectionType = TSIntersectionType; +exports.TSIntrinsicKeyword = TSIntrinsicKeyword; +exports.TSLiteralType = TSLiteralType; +exports.TSMappedType = TSMappedType; +exports.TSMethodSignature = TSMethodSignature; +exports.TSModuleBlock = TSModuleBlock; +exports.TSModuleDeclaration = TSModuleDeclaration; +exports.TSNamedTupleMember = TSNamedTupleMember; +exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration; +exports.TSNeverKeyword = TSNeverKeyword; +exports.TSNonNullExpression = TSNonNullExpression; +exports.TSNullKeyword = TSNullKeyword; +exports.TSNumberKeyword = TSNumberKeyword; +exports.TSObjectKeyword = TSObjectKeyword; +exports.TSOptionalType = TSOptionalType; +exports.TSParameterProperty = TSParameterProperty; +exports.TSParenthesizedType = TSParenthesizedType; +exports.TSPropertySignature = TSPropertySignature; +exports.TSQualifiedName = TSQualifiedName; +exports.TSRestType = TSRestType; +exports.TSSatisfiesExpression = TSSatisfiesExpression; +exports.TSStringKeyword = TSStringKeyword; +exports.TSSymbolKeyword = TSSymbolKeyword; +exports.TSTemplateLiteralType = TSTemplateLiteralType; +exports.TSThisType = TSThisType; +exports.TSTupleType = TSTupleType; +exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration; +exports.TSTypeAnnotation = TSTypeAnnotation; +exports.TSTypeAssertion = TSTypeAssertion; +exports.TSTypeLiteral = TSTypeLiteral; +exports.TSTypeOperator = TSTypeOperator; +exports.TSTypeParameter = TSTypeParameter; +exports.TSTypeParameterDeclaration = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation; +exports.TSTypePredicate = TSTypePredicate; +exports.TSTypeQuery = TSTypeQuery; +exports.TSTypeReference = TSTypeReference; +exports.TSUndefinedKeyword = TSUndefinedKeyword; +exports.TSUnionType = TSUnionType; +exports.TSUnknownKeyword = TSUnknownKeyword; +exports.TSVoidKeyword = TSVoidKeyword; +exports._tsPrintClassMemberModifiers = _tsPrintClassMemberModifiers; +var _methods = require("./methods.js"); +var _classes = require("./classes.js"); +var _templateLiterals = require("./template-literals.js"); +function TSTypeAnnotation(node, parent) { + this.token((parent.type === "TSFunctionType" || parent.type === "TSConstructorType") && parent.typeAnnotation === node ? "=>" : ":"); + this.space(); + if (node.optional) this.tokenChar(63); + this.print(node.typeAnnotation); +} +function TSTypeParameterInstantiation(node, parent) { + this.tokenChar(60); + let printTrailingSeparator = parent.type === "ArrowFunctionExpression" && node.params.length === 1; + if (this.tokenMap && node.start != null && node.end != null) { + printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, t => this.tokenMap.matchesOriginal(t, ","))); + printTrailingSeparator || (printTrailingSeparator = this.shouldPrintTrailingComma(">")); + } + this.printList(node.params, printTrailingSeparator); + this.tokenChar(62); +} +function TSTypeParameter(node) { + if (node.const) { + this.word("const"); + this.space(); + } + if (node.in) { + this.word("in"); + this.space(); + } + if (node.out) { + this.word("out"); + this.space(); + } + this.word(node.name); + if (node.constraint) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.constraint); + } + if (node.default) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.default); + } +} +function TSParameterProperty(node) { + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.readonly) { + this.word("readonly"); + this.space(); + } + _methods._param.call(this, node.parameter); +} +function TSDeclareFunction(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + _methods._functionHead.call(this, node, parent, false); + this.semicolon(); +} +function TSDeclareMethod(node) { + _classes._classMethodHead.call(this, node); + this.semicolon(); +} +function TSQualifiedName(node) { + this.print(node.left); + this.tokenChar(46); + this.print(node.right); +} +function TSCallSignatureDeclaration(node) { + tsPrintSignatureDeclarationBase.call(this, node); + maybePrintTrailingCommaOrSemicolon(this, node); +} +function maybePrintTrailingCommaOrSemicolon(printer, node) { + if (!printer.tokenMap || !node.start || !node.end) { + printer.semicolon(); + return; + } + if (printer.tokenMap.endMatches(node, ",")) { + printer.token(","); + } else if (printer.tokenMap.endMatches(node, ";")) { + printer.semicolon(); + } +} +function TSConstructSignatureDeclaration(node) { + this.word("new"); + this.space(); + tsPrintSignatureDeclarationBase.call(this, node); + maybePrintTrailingCommaOrSemicolon(this, node); +} +function TSPropertySignature(node) { + const { + readonly + } = node; + if (readonly) { + this.word("readonly"); + this.space(); + } + tsPrintPropertyOrMethodName.call(this, node); + this.print(node.typeAnnotation); + maybePrintTrailingCommaOrSemicolon(this, node); +} +function tsPrintPropertyOrMethodName(node) { + if (node.computed) { + this.tokenChar(91); + } + this.print(node.key); + if (node.computed) { + this.tokenChar(93); + } + if (node.optional) { + this.tokenChar(63); + } +} +function TSMethodSignature(node) { + const { + kind + } = node; + if (kind === "set" || kind === "get") { + this.word(kind); + this.space(); + } + tsPrintPropertyOrMethodName.call(this, node); + tsPrintSignatureDeclarationBase.call(this, node); + maybePrintTrailingCommaOrSemicolon(this, node); +} +function TSIndexSignature(node) { + const { + readonly, + static: isStatic + } = node; + if (isStatic) { + this.word("static"); + this.space(); + } + if (readonly) { + this.word("readonly"); + this.space(); + } + this.tokenChar(91); + _methods._parameters.call(this, node.parameters, 93); + this.print(node.typeAnnotation); + maybePrintTrailingCommaOrSemicolon(this, node); +} +function TSAnyKeyword() { + this.word("any"); +} +function TSBigIntKeyword() { + this.word("bigint"); +} +function TSUnknownKeyword() { + this.word("unknown"); +} +function TSNumberKeyword() { + this.word("number"); +} +function TSObjectKeyword() { + this.word("object"); +} +function TSBooleanKeyword() { + this.word("boolean"); +} +function TSStringKeyword() { + this.word("string"); +} +function TSSymbolKeyword() { + this.word("symbol"); +} +function TSVoidKeyword() { + this.word("void"); +} +function TSUndefinedKeyword() { + this.word("undefined"); +} +function TSNullKeyword() { + this.word("null"); +} +function TSNeverKeyword() { + this.word("never"); +} +function TSIntrinsicKeyword() { + this.word("intrinsic"); +} +function TSThisType() { + this.word("this"); +} +function TSFunctionType(node) { + tsPrintFunctionOrConstructorType.call(this, node); +} +function TSConstructorType(node) { + if (node.abstract) { + this.word("abstract"); + this.space(); + } + this.word("new"); + this.space(); + tsPrintFunctionOrConstructorType.call(this, node); +} +function tsPrintFunctionOrConstructorType(node) { + const { + typeParameters + } = node; + const parameters = node.parameters; + this.print(typeParameters); + this.tokenChar(40); + _methods._parameters.call(this, parameters, 41); + this.space(); + const returnType = node.typeAnnotation; + this.print(returnType); +} +function TSTypeReference(node) { + const typeArguments = node.typeParameters; + this.print(node.typeName, !!typeArguments); + this.print(typeArguments); +} +function TSTypePredicate(node) { + if (node.asserts) { + this.word("asserts"); + this.space(); + } + this.print(node.parameterName); + if (node.typeAnnotation) { + this.space(); + this.word("is"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation); + } +} +function TSTypeQuery(node) { + this.word("typeof"); + this.space(); + this.print(node.exprName); + const typeArguments = node.typeParameters; + if (typeArguments) { + this.print(typeArguments); + } +} +function TSTypeLiteral(node) { + printBraced(this, node, () => this.printJoin(node.members, true, true, undefined, undefined, true)); +} +function TSArrayType(node) { + this.print(node.elementType, true); + this.tokenChar(91); + this.tokenChar(93); +} +function TSTupleType(node) { + this.tokenChar(91); + this.printList(node.elementTypes, this.shouldPrintTrailingComma("]")); + this.tokenChar(93); +} +function TSOptionalType(node) { + this.print(node.typeAnnotation); + this.tokenChar(63); +} +function TSRestType(node) { + this.token("..."); + this.print(node.typeAnnotation); +} +function TSNamedTupleMember(node) { + this.print(node.label); + if (node.optional) this.tokenChar(63); + this.tokenChar(58); + this.space(); + this.print(node.elementType); +} +function TSUnionType(node) { + tsPrintUnionOrIntersectionType(this, node, "|"); +} +function TSIntersectionType(node) { + tsPrintUnionOrIntersectionType(this, node, "&"); +} +function tsPrintUnionOrIntersectionType(printer, node, sep) { + var _printer$tokenMap; + let hasLeadingToken = 0; + if ((_printer$tokenMap = printer.tokenMap) != null && _printer$tokenMap.startMatches(node, sep)) { + hasLeadingToken = 1; + printer.token(sep); + } + printer.printJoin(node.types, undefined, undefined, function (i) { + this.space(); + this.token(sep, undefined, i + hasLeadingToken); + this.space(); + }); +} +function TSConditionalType(node) { + this.print(node.checkType); + this.space(); + this.word("extends"); + this.space(); + this.print(node.extendsType); + this.space(); + this.tokenChar(63); + this.space(); + this.print(node.trueType); + this.space(); + this.tokenChar(58); + this.space(); + this.print(node.falseType); +} +function TSInferType(node) { + this.word("infer"); + this.print(node.typeParameter); +} +function TSParenthesizedType(node) { + this.tokenChar(40); + this.print(node.typeAnnotation); + this.tokenChar(41); +} +function TSTypeOperator(node) { + this.word(node.operator); + this.space(); + this.print(node.typeAnnotation); +} +function TSIndexedAccessType(node) { + this.print(node.objectType, true); + this.tokenChar(91); + this.print(node.indexType); + this.tokenChar(93); +} +function TSMappedType(node) { + const { + nameType, + optional, + readonly, + typeAnnotation + } = node; + this.tokenChar(123); + const oldNoLineTerminatorAfterNode = this.enterDelimited(); + this.space(); + if (readonly) { + tokenIfPlusMinus(this, readonly); + this.word("readonly"); + this.space(); + } + this.tokenChar(91); + this.word(node.typeParameter.name); + this.space(); + this.word("in"); + this.space(); + this.print(node.typeParameter.constraint, undefined, true); + if (nameType) { + this.space(); + this.word("as"); + this.space(); + this.print(nameType, undefined, true); + } + this.tokenChar(93); + if (optional) { + tokenIfPlusMinus(this, optional); + this.tokenChar(63); + } + if (typeAnnotation) { + this.tokenChar(58); + this.space(); + this.print(typeAnnotation, undefined, true); + } + this.space(); + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + this.tokenChar(125); +} +function tokenIfPlusMinus(self, tok) { + if (tok !== true) { + self.token(tok); + } +} +function TSTemplateLiteralType(node) { + _templateLiterals._printTemplate.call(this, node, node.types); +} +function TSLiteralType(node) { + this.print(node.literal); +} +function TSClassImplements(node) { + this.print(node.expression); + this.print(node.typeArguments); +} +function TSInterfaceDeclaration(node) { + const { + declare, + id, + typeParameters, + extends: extendz, + body + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + this.word("interface"); + this.space(); + this.print(id); + this.print(typeParameters); + if (extendz != null && extendz.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(extendz); + } + this.space(); + this.print(body); +} +function TSInterfaceBody(node) { + printBraced(this, node, () => this.printJoin(node.body, true, true, undefined, undefined, true)); +} +function TSTypeAliasDeclaration(node) { + const { + declare, + id, + typeParameters, + typeAnnotation + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + this.word("type"); + this.space(); + this.print(id); + this.print(typeParameters); + this.space(); + this.tokenChar(61); + this.space(); + this.print(typeAnnotation); + this.semicolon(); +} +function TSAsExpression(node) { + const { + expression, + typeAnnotation + } = node; + this.print(expression, true); + this.space(); + this.word("as"); + this.space(); + this.print(typeAnnotation); +} +function TSSatisfiesExpression(node) { + const { + expression, + typeAnnotation + } = node; + this.print(expression, true); + this.space(); + this.word("satisfies"); + this.space(); + this.print(typeAnnotation); +} +function TSTypeAssertion(node) { + const { + typeAnnotation, + expression + } = node; + this.tokenChar(60); + this.print(typeAnnotation); + this.tokenChar(62); + this.space(); + this.print(expression); +} +function TSInstantiationExpression(node) { + this.print(node.expression); + this.print(node.typeParameters); +} +function TSEnumDeclaration(node) { + const { + declare, + const: isConst, + id + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + if (isConst) { + this.word("const"); + this.space(); + } + this.word("enum"); + this.space(); + this.print(id); + this.space(); + TSEnumBody.call(this, node); +} +function TSEnumBody(node) { + printBraced(this, node, () => { + var _this$shouldPrintTrai; + return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true, undefined, true); + }); +} +function TSEnumMember(node) { + const { + id, + initializer + } = node; + this.print(id); + if (initializer) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(initializer); + } +} +function TSModuleDeclaration(node) { + const { + declare, + id, + kind + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + if (!node.global) { + this.word(kind != null ? kind : id.type === "Identifier" ? "namespace" : "module"); + this.space(); + } + this.print(id); + if (!node.body) { + this.semicolon(); + return; + } + let body = node.body; + while (body.type === "TSModuleDeclaration") { + this.tokenChar(46); + this.print(body.id); + body = body.body; + } + this.space(); + this.print(body); +} +function TSModuleBlock(node) { + printBraced(this, node, () => this.printSequence(node.body, true, true)); +} +function TSImportType(node) { + const { + qualifier, + options + } = node; + this.word("import"); + this.tokenChar(40); + this.print(node.argument); + if (options) { + this.tokenChar(44); + this.print(options); + } + this.tokenChar(41); + if (qualifier) { + this.tokenChar(46); + this.print(qualifier); + } + const typeArguments = node.typeParameters; + if (typeArguments) { + this.print(typeArguments); + } +} +function TSImportEqualsDeclaration(node) { + const { + id, + moduleReference + } = node; + if (node.isExport) { + this.word("export"); + this.space(); + } + this.word("import"); + this.space(); + this.print(id); + this.space(); + this.tokenChar(61); + this.space(); + this.print(moduleReference); + this.semicolon(); +} +function TSExternalModuleReference(node) { + this.token("require("); + this.print(node.expression); + this.tokenChar(41); +} +function TSNonNullExpression(node) { + this.print(node.expression); + this.tokenChar(33); + this.setLastChar(33); +} +function TSExportAssignment(node) { + this.word("export"); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.expression); + this.semicolon(); +} +function TSNamespaceExportDeclaration(node) { + this.word("export"); + this.space(); + this.word("as"); + this.space(); + this.word("namespace"); + this.space(); + this.print(node.id); + this.semicolon(); +} +function tsPrintSignatureDeclarationBase(node) { + const { + typeParameters + } = node; + const parameters = node.parameters; + this.print(typeParameters); + this.tokenChar(40); + _methods._parameters.call(this, parameters, 41); + const returnType = node.typeAnnotation; + this.print(returnType); +} +function _tsPrintClassMemberModifiers(node) { + const isPrivateField = node.type === "ClassPrivateProperty"; + const isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty"; + printModifiersList(this, node, [isPublicField && node.declare && "declare", !isPrivateField && node.accessibility]); + if (node.static) { + this.word("static"); + this.space(); + } + printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]); +} +function printBraced(printer, node, cb) { + printer.token("{"); + const oldNoLineTerminatorAfterNode = printer.enterDelimited(); + cb(); + printer._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + printer.rightBrace(node); +} +function printModifiersList(printer, node, modifiers) { + var _printer$tokenMap2; + const modifiersSet = new Set(); + for (const modifier of modifiers) { + if (modifier) modifiersSet.add(modifier); + } + (_printer$tokenMap2 = printer.tokenMap) == null || _printer$tokenMap2.find(node, tok => { + if (modifiersSet.has(tok.value)) { + printer.token(tok.value); + printer.space(); + modifiersSet.delete(tok.value); + return modifiersSet.size === 0; + } + return false; + }); + for (const modifier of modifiersSet) { + printer.word(modifier); + printer.space(); + } +} + +//# sourceMappingURL=typescript.js.map diff --git a/node_modules/@babel/generator/lib/generators/typescript.js.map b/node_modules/@babel/generator/lib/generators/typescript.js.map new file mode 100644 index 0000000..5e9bd15 --- /dev/null +++ b/node_modules/@babel/generator/lib/generators/typescript.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_methods","require","_classes","_templateLiterals","TSTypeAnnotation","node","parent","token","type","typeAnnotation","space","optional","print","TSTypeParameterInstantiation","printTrailingSeparator","params","length","tokenMap","start","end","find","t","matchesOriginal","shouldPrintTrailingComma","printList","TSTypeParameter","const","word","in","out","name","constraint","default","TSParameterProperty","accessibility","readonly","_param","call","parameter","TSDeclareFunction","declare","_functionHead","semicolon","TSDeclareMethod","_classMethodHead","TSQualifiedName","left","right","TSCallSignatureDeclaration","tsPrintSignatureDeclarationBase","maybePrintTrailingCommaOrSemicolon","printer","endMatches","TSConstructSignatureDeclaration","TSPropertySignature","tsPrintPropertyOrMethodName","computed","key","TSMethodSignature","kind","TSIndexSignature","static","isStatic","_parameters","parameters","TSAnyKeyword","TSBigIntKeyword","TSUnknownKeyword","TSNumberKeyword","TSObjectKeyword","TSBooleanKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSUndefinedKeyword","TSNullKeyword","TSNeverKeyword","TSIntrinsicKeyword","TSThisType","TSFunctionType","tsPrintFunctionOrConstructorType","TSConstructorType","abstract","typeParameters","returnType","TSTypeReference","typeArguments","typeName","TSTypePredicate","asserts","parameterName","TSTypeQuery","exprName","TSTypeLiteral","printBraced","printJoin","members","undefined","TSArrayType","elementType","TSTupleType","elementTypes","TSOptionalType","TSRestType","TSNamedTupleMember","label","TSUnionType","tsPrintUnionOrIntersectionType","TSIntersectionType","sep","_printer$tokenMap","hasLeadingToken","startMatches","types","i","TSConditionalType","checkType","extendsType","trueType","falseType","TSInferType","typeParameter","TSParenthesizedType","TSTypeOperator","operator","TSIndexedAccessType","objectType","indexType","TSMappedType","nameType","oldNoLineTerminatorAfterNode","enterDelimited","tokenIfPlusMinus","_noLineTerminatorAfterNode","self","tok","TSTemplateLiteralType","_printTemplate","TSLiteralType","literal","TSClassImplements","expression","TSInterfaceDeclaration","id","extends","extendz","body","TSInterfaceBody","TSTypeAliasDeclaration","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSInstantiationExpression","TSEnumDeclaration","isConst","TSEnumBody","_this$shouldPrintTrai","TSEnumMember","initializer","TSModuleDeclaration","global","TSModuleBlock","printSequence","TSImportType","qualifier","options","argument","TSImportEqualsDeclaration","moduleReference","isExport","TSExternalModuleReference","TSNonNullExpression","setLastChar","TSExportAssignment","TSNamespaceExportDeclaration","_tsPrintClassMemberModifiers","isPrivateField","isPublicField","printModifiersList","override","cb","rightBrace","modifiers","_printer$tokenMap2","modifiersSet","Set","modifier","add","has","value","delete","size"],"sources":["../../src/generators/typescript.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport { _functionHead, _param, _parameters } from \"./methods.ts\";\nimport { _classMethodHead } from \"./classes.ts\";\nimport { _printTemplate } from \"./template-literals.ts\";\n\nexport function TSTypeAnnotation(\n this: Printer,\n node: t.TSTypeAnnotation,\n parent: t.Node,\n) {\n // TODO(@nicolo-ribaudo): investigate not including => in the range\n // of the return type of an arrow function type\n this.token(\n (parent.type === \"TSFunctionType\" || parent.type === \"TSConstructorType\") &&\n (process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n parent.returnType\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n parent.typeAnnotation) === node\n ? \"=>\"\n : \":\",\n );\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation);\n}\n\nexport function TSTypeParameterInstantiation(\n this: Printer,\n node: t.TSTypeParameterInstantiation,\n parent: t.Node,\n): void {\n this.token(\"<\");\n\n let printTrailingSeparator: boolean | null =\n parent.type === \"ArrowFunctionExpression\" && node.params.length === 1;\n if (this.tokenMap && node.start != null && node.end != null) {\n // Only force the trailing comma for pre-existing nodes if they\n // already had a comma (either because they were multi-param, or\n // because they had a trailing comma)\n printTrailingSeparator &&= !!this.tokenMap.find(node, t =>\n this.tokenMap!.matchesOriginal(t, \",\"),\n );\n // Preserve the trailing comma if it was there before\n printTrailingSeparator ||= this.shouldPrintTrailingComma(\">\");\n }\n\n this.printList(node.params, printTrailingSeparator);\n this.token(\">\");\n}\n\nexport { TSTypeParameterInstantiation as TSTypeParameterDeclaration };\n\nexport function TSTypeParameter(this: Printer, node: t.TSTypeParameter) {\n if (node.const) {\n this.word(\"const\");\n this.space();\n }\n\n if (node.in) {\n this.word(\"in\");\n this.space();\n }\n\n if (node.out) {\n this.word(\"out\");\n this.space();\n }\n\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (node.name as unknown as string)\n : (node.name as unknown as t.Identifier).name,\n );\n\n if (node.constraint) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.constraint);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default);\n }\n}\n\nexport function TSParameterProperty(\n this: Printer,\n node: t.TSParameterProperty,\n) {\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n\n if (node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n\n _param.call(this, node.parameter);\n}\n\nexport function TSDeclareFunction(\n this: Printer,\n node: t.TSDeclareFunction,\n parent: t.ParentMaps[\"TSDeclareFunction\"],\n) {\n if (node.declare) {\n this.word(\"declare\");\n this.space();\n }\n _functionHead.call(this, node, parent, false);\n this.semicolon();\n}\n\nexport function TSDeclareMethod(this: Printer, node: t.TSDeclareMethod) {\n _classMethodHead.call(this, node);\n this.semicolon();\n}\n\nexport function TSQualifiedName(this: Printer, node: t.TSQualifiedName) {\n this.print(node.left);\n this.token(\".\");\n this.print(node.right);\n}\n\nexport function TSCallSignatureDeclaration(\n this: Printer,\n node: t.TSCallSignatureDeclaration,\n) {\n tsPrintSignatureDeclarationBase.call(this, node);\n maybePrintTrailingCommaOrSemicolon(this, node);\n}\n\nfunction maybePrintTrailingCommaOrSemicolon(printer: Printer, node: t.Node) {\n if (!printer.tokenMap || !node.start || !node.end) {\n printer.semicolon();\n return;\n }\n\n if (printer.tokenMap.endMatches(node, \",\")) {\n printer.token(\",\");\n } else if (printer.tokenMap.endMatches(node, \";\")) {\n printer.semicolon();\n }\n}\n\nexport function TSConstructSignatureDeclaration(\n this: Printer,\n node: t.TSConstructSignatureDeclaration,\n) {\n this.word(\"new\");\n this.space();\n tsPrintSignatureDeclarationBase.call(this, node);\n maybePrintTrailingCommaOrSemicolon(this, node);\n}\n\nexport function TSPropertySignature(\n this: Printer,\n node: t.TSPropertySignature,\n) {\n const { readonly } = node;\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n tsPrintPropertyOrMethodName.call(this, node);\n this.print(node.typeAnnotation);\n maybePrintTrailingCommaOrSemicolon(this, node);\n}\n\nfunction tsPrintPropertyOrMethodName(\n this: Printer,\n node: t.TSPropertySignature | t.TSMethodSignature,\n) {\n if (node.computed) {\n this.token(\"[\");\n }\n this.print(node.key);\n if (node.computed) {\n this.token(\"]\");\n }\n if (node.optional) {\n this.token(\"?\");\n }\n}\n\nexport function TSMethodSignature(this: Printer, node: t.TSMethodSignature) {\n const { kind } = node;\n if (kind === \"set\" || kind === \"get\") {\n this.word(kind);\n this.space();\n }\n tsPrintPropertyOrMethodName.call(this, node);\n tsPrintSignatureDeclarationBase.call(this, node);\n maybePrintTrailingCommaOrSemicolon(this, node);\n}\n\nexport function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {\n const { readonly, static: isStatic } = node;\n if (isStatic) {\n this.word(\"static\");\n this.space();\n }\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.token(\"[\");\n _parameters.call(this, node.parameters, charCodes.rightSquareBracket);\n this.print(node.typeAnnotation);\n maybePrintTrailingCommaOrSemicolon(this, node);\n}\n\nexport function TSAnyKeyword(this: Printer) {\n this.word(\"any\");\n}\nexport function TSBigIntKeyword(this: Printer) {\n this.word(\"bigint\");\n}\nexport function TSUnknownKeyword(this: Printer) {\n this.word(\"unknown\");\n}\nexport function TSNumberKeyword(this: Printer) {\n this.word(\"number\");\n}\nexport function TSObjectKeyword(this: Printer) {\n this.word(\"object\");\n}\nexport function TSBooleanKeyword(this: Printer) {\n this.word(\"boolean\");\n}\nexport function TSStringKeyword(this: Printer) {\n this.word(\"string\");\n}\nexport function TSSymbolKeyword(this: Printer) {\n this.word(\"symbol\");\n}\nexport function TSVoidKeyword(this: Printer) {\n this.word(\"void\");\n}\nexport function TSUndefinedKeyword(this: Printer) {\n this.word(\"undefined\");\n}\nexport function TSNullKeyword(this: Printer) {\n this.word(\"null\");\n}\nexport function TSNeverKeyword(this: Printer) {\n this.word(\"never\");\n}\nexport function TSIntrinsicKeyword(this: Printer) {\n this.word(\"intrinsic\");\n}\n\nexport function TSThisType(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TSFunctionType(this: Printer, node: t.TSFunctionType) {\n tsPrintFunctionOrConstructorType.call(this, node);\n}\n\nexport function TSConstructorType(this: Printer, node: t.TSConstructorType) {\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n this.word(\"new\");\n this.space();\n tsPrintFunctionOrConstructorType.call(this, node);\n}\n\nfunction tsPrintFunctionOrConstructorType(\n this: Printer,\n node: t.TSFunctionType | t.TSConstructorType,\n) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.params\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.parameters;\n this.print(typeParameters);\n this.token(\"(\");\n _parameters.call(this, parameters, charCodes.rightParenthesis);\n this.space();\n const returnType = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.returnType\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.typeAnnotation;\n this.print(returnType);\n}\n\nexport function TSTypeReference(this: Printer, node: t.TSTypeReference) {\n const typeArguments = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.typeArguments\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.typeParameters;\n this.print(node.typeName, !!typeArguments);\n this.print(typeArguments);\n}\n\nexport function TSTypePredicate(this: Printer, node: t.TSTypePredicate) {\n if (node.asserts) {\n this.word(\"asserts\");\n this.space();\n }\n this.print(node.parameterName);\n if (node.typeAnnotation) {\n this.space();\n this.word(\"is\");\n this.space();\n this.print(node.typeAnnotation.typeAnnotation);\n }\n}\n\nexport function TSTypeQuery(this: Printer, node: t.TSTypeQuery) {\n this.word(\"typeof\");\n this.space();\n this.print(node.exprName);\n\n const typeArguments = process.env.BABEL_8_BREAKING\n ? //@ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n node.typeArguments\n : //@ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n node.typeParameters;\n if (typeArguments) {\n this.print(typeArguments);\n }\n}\n\nexport function TSTypeLiteral(this: Printer, node: t.TSTypeLiteral) {\n printBraced(this, node, () =>\n this.printJoin(node.members, true, true, undefined, undefined, true),\n );\n}\n\nexport function TSArrayType(this: Printer, node: t.TSArrayType) {\n this.print(node.elementType, true);\n\n this.token(\"[\");\n this.token(\"]\");\n}\n\nexport function TSTupleType(this: Printer, node: t.TSTupleType) {\n this.token(\"[\");\n this.printList(node.elementTypes, this.shouldPrintTrailingComma(\"]\"));\n this.token(\"]\");\n}\n\nexport function TSOptionalType(this: Printer, node: t.TSOptionalType) {\n this.print(node.typeAnnotation);\n this.token(\"?\");\n}\n\nexport function TSRestType(this: Printer, node: t.TSRestType) {\n this.token(\"...\");\n this.print(node.typeAnnotation);\n}\n\nexport function TSNamedTupleMember(this: Printer, node: t.TSNamedTupleMember) {\n this.print(node.label);\n if (node.optional) this.token(\"?\");\n this.token(\":\");\n this.space();\n this.print(node.elementType);\n}\n\nexport function TSUnionType(this: Printer, node: t.TSUnionType) {\n tsPrintUnionOrIntersectionType(this, node, \"|\");\n}\n\nexport function TSIntersectionType(this: Printer, node: t.TSIntersectionType) {\n tsPrintUnionOrIntersectionType(this, node, \"&\");\n}\n\nfunction tsPrintUnionOrIntersectionType(\n printer: Printer,\n node: t.TSUnionType | t.TSIntersectionType,\n sep: \"|\" | \"&\",\n) {\n let hasLeadingToken = 0;\n if (printer.tokenMap?.startMatches(node, sep)) {\n hasLeadingToken = 1;\n printer.token(sep);\n }\n\n printer.printJoin(node.types, undefined, undefined, function (i) {\n this.space();\n this.token(sep, undefined, i + hasLeadingToken);\n this.space();\n });\n}\n\nexport function TSConditionalType(this: Printer, node: t.TSConditionalType) {\n this.print(node.checkType);\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.extendsType);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.trueType);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.falseType);\n}\n\nexport function TSInferType(this: Printer, node: t.TSInferType) {\n this.word(\"infer\");\n this.print(node.typeParameter);\n}\n\nexport function TSParenthesizedType(\n this: Printer,\n node: t.TSParenthesizedType,\n) {\n this.token(\"(\");\n this.print(node.typeAnnotation);\n this.token(\")\");\n}\n\nexport function TSTypeOperator(this: Printer, node: t.TSTypeOperator) {\n this.word(node.operator);\n this.space();\n this.print(node.typeAnnotation);\n}\n\nexport function TSIndexedAccessType(\n this: Printer,\n node: t.TSIndexedAccessType,\n) {\n this.print(node.objectType, true);\n this.token(\"[\");\n this.print(node.indexType);\n this.token(\"]\");\n}\n\nexport function TSMappedType(this: Printer, node: t.TSMappedType) {\n const { nameType, optional, readonly, typeAnnotation } = node;\n this.token(\"{\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.space();\n if (readonly) {\n tokenIfPlusMinus(this, readonly);\n this.word(\"readonly\");\n this.space();\n }\n\n this.token(\"[\");\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n this.word(node.key.name);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n this.word(node.typeParameter.name);\n }\n\n this.space();\n this.word(\"in\");\n this.space();\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n this.print(node.constraint, undefined, true);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n this.print(node.typeParameter.constraint, undefined, true);\n }\n\n if (nameType) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(nameType, undefined, true);\n }\n\n this.token(\"]\");\n\n if (optional) {\n tokenIfPlusMinus(this, optional);\n this.token(\"?\");\n }\n\n if (typeAnnotation) {\n this.token(\":\");\n this.space();\n this.print(typeAnnotation, undefined, true);\n }\n this.space();\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.token(\"}\");\n}\n\nfunction tokenIfPlusMinus(self: Printer, tok: true | \"+\" | \"-\") {\n if (tok !== true) {\n self.token(tok);\n }\n}\n\nexport function TSTemplateLiteralType(\n this: Printer,\n node: t.TSTemplateLiteralType,\n) {\n _printTemplate.call(this, node, node.types);\n}\n\nexport function TSLiteralType(this: Printer, node: t.TSLiteralType) {\n this.print(node.literal);\n}\n\nexport function TSClassImplements(\n this: Printer,\n // TODO(Babel 8): Just use t.TSClassImplements\n node: t.Node & {\n expression: t.TSEntityName;\n typeArguments?: t.TSTypeParameterInstantiation;\n },\n) {\n this.print(node.expression);\n this.print(node.typeArguments);\n}\n\nexport { TSClassImplements as TSInterfaceHeritage };\n\nexport function TSInterfaceDeclaration(\n this: Printer,\n node: t.TSInterfaceDeclaration,\n) {\n const { declare, id, typeParameters, extends: extendz, body } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"interface\");\n this.space();\n this.print(id);\n this.print(typeParameters);\n if (extendz?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(extendz);\n }\n this.space();\n this.print(body);\n}\n\nexport function TSInterfaceBody(this: Printer, node: t.TSInterfaceBody) {\n printBraced(this, node, () =>\n this.printJoin(node.body, true, true, undefined, undefined, true),\n );\n}\n\nexport function TSTypeAliasDeclaration(\n this: Printer,\n node: t.TSTypeAliasDeclaration,\n) {\n const { declare, id, typeParameters, typeAnnotation } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"type\");\n this.space();\n this.print(id);\n this.print(typeParameters);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(typeAnnotation);\n this.semicolon();\n}\n\nexport function TSAsExpression(this: Printer, node: t.TSAsExpression) {\n const { expression, typeAnnotation } = node;\n this.print(expression, true);\n this.space();\n this.word(\"as\");\n this.space();\n this.print(typeAnnotation);\n}\n\nexport function TSSatisfiesExpression(\n this: Printer,\n node: t.TSSatisfiesExpression,\n) {\n const { expression, typeAnnotation } = node;\n this.print(expression, true);\n this.space();\n this.word(\"satisfies\");\n this.space();\n this.print(typeAnnotation);\n}\n\nexport function TSTypeAssertion(this: Printer, node: t.TSTypeAssertion) {\n const { typeAnnotation, expression } = node;\n this.token(\"<\");\n this.print(typeAnnotation);\n this.token(\">\");\n this.space();\n this.print(expression);\n}\n\nexport function TSInstantiationExpression(\n this: Printer,\n node: t.TSInstantiationExpression,\n) {\n this.print(node.expression);\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.typeArguments);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters);\n }\n}\n\nexport function TSEnumDeclaration(this: Printer, node: t.TSEnumDeclaration) {\n const { declare, const: isConst, id } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n if (isConst) {\n this.word(\"const\");\n this.space();\n }\n this.word(\"enum\");\n this.space();\n this.print(id);\n this.space();\n\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.body);\n } else {\n // cast to TSEnumBody for Babel 7 AST\n TSEnumBody.call(this, node as unknown as t.TSEnumBody);\n }\n}\n\nexport function TSEnumBody(this: Printer, node: t.TSEnumBody) {\n printBraced(this, node, () =>\n this.printList(\n node.members,\n this.shouldPrintTrailingComma(\"}\") ??\n (process.env.BABEL_8_BREAKING ? false : true),\n true,\n true,\n undefined,\n true,\n ),\n );\n}\n\nexport function TSEnumMember(this: Printer, node: t.TSEnumMember) {\n const { id, initializer } = node;\n this.print(id);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer);\n }\n}\n\nexport function TSModuleDeclaration(\n this: Printer,\n node: t.TSModuleDeclaration,\n) {\n const { declare, id, kind } = node;\n\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (kind !== \"global\") {\n this.word(kind);\n this.space();\n }\n\n this.print(node.id);\n if (!node.body) {\n this.semicolon();\n return;\n }\n this.space();\n this.print(node.body);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n if (!node.global) {\n this.word(kind ?? (id.type === \"Identifier\" ? \"namespace\" : \"module\"));\n this.space();\n }\n\n this.print(id);\n\n if (!node.body) {\n this.semicolon();\n return;\n }\n\n let body = node.body;\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n while (body.type === \"TSModuleDeclaration\") {\n this.token(\".\");\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n this.print(body.id);\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n body = body.body;\n }\n\n this.space();\n this.print(body);\n }\n}\n\nexport function TSModuleBlock(this: Printer, node: t.TSModuleBlock) {\n printBraced(this, node, () => this.printSequence(node.body, true, true));\n}\n\nexport function TSImportType(this: Printer, node: t.TSImportType) {\n const { qualifier, options } = node;\n this.word(\"import\");\n this.token(\"(\");\n this.print(\n //@ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n process.env.BABEL_8_BREAKING ? node.source : node.argument,\n );\n if (options) {\n this.token(\",\");\n this.print(options);\n }\n this.token(\")\");\n if (qualifier) {\n this.token(\".\");\n this.print(qualifier);\n }\n const typeArguments = process.env.BABEL_8_BREAKING\n ? //@ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n node.typeArguments\n : //@ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n node.typeParameters;\n if (typeArguments) {\n this.print(typeArguments);\n }\n}\n\nexport function TSImportEqualsDeclaration(\n this: Printer,\n node: t.TSImportEqualsDeclaration,\n) {\n const { id, moduleReference } = node;\n if (\n !process.env.BABEL_8_BREAKING &&\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n node.isExport\n ) {\n this.word(\"export\");\n this.space();\n }\n this.word(\"import\");\n this.space();\n this.print(id);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(moduleReference);\n this.semicolon();\n}\n\nexport function TSExternalModuleReference(\n this: Printer,\n node: t.TSExternalModuleReference,\n) {\n this.token(\"require(\");\n this.print(node.expression);\n this.token(\")\");\n}\n\nexport function TSNonNullExpression(\n this: Printer,\n node: t.TSNonNullExpression,\n) {\n this.print(node.expression);\n this.token(\"!\");\n this.setLastChar(charCodes.exclamationMark);\n}\n\nexport function TSExportAssignment(this: Printer, node: t.TSExportAssignment) {\n this.word(\"export\");\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.expression);\n this.semicolon();\n}\n\nexport function TSNamespaceExportDeclaration(\n this: Printer,\n node: t.TSNamespaceExportDeclaration,\n) {\n this.word(\"export\");\n this.space();\n this.word(\"as\");\n this.space();\n this.word(\"namespace\");\n this.space();\n this.print(node.id);\n this.semicolon();\n}\n\nfunction tsPrintSignatureDeclarationBase(this: Printer, node: any) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? node.params\n : node.parameters;\n this.print(typeParameters);\n this.token(\"(\");\n _parameters.call(this, parameters, charCodes.rightParenthesis);\n const returnType = process.env.BABEL_8_BREAKING\n ? node.returnType\n : node.typeAnnotation;\n this.print(returnType);\n}\n\nexport function _tsPrintClassMemberModifiers(\n this: Printer,\n node:\n | t.ClassProperty\n | t.ClassAccessorProperty\n | t.ClassPrivateProperty\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.TSDeclareMethod,\n) {\n const isPrivateField = node.type === \"ClassPrivateProperty\";\n const isPublicField =\n node.type === \"ClassAccessorProperty\" || node.type === \"ClassProperty\";\n printModifiersList(this, node, [\n isPublicField && node.declare && \"declare\",\n !isPrivateField && node.accessibility,\n ]);\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n printModifiersList(this, node, [\n !isPrivateField && node.abstract && \"abstract\",\n !isPrivateField && node.override && \"override\",\n (isPublicField || isPrivateField) && node.readonly && \"readonly\",\n ]);\n}\n\nfunction printBraced(printer: Printer, node: t.Node, cb: () => void) {\n printer.token(\"{\");\n const oldNoLineTerminatorAfterNode = printer.enterDelimited();\n cb();\n printer._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n printer.rightBrace(node);\n}\n\nfunction printModifiersList(\n printer: Printer,\n node: t.Node,\n modifiers: (string | false | null | undefined)[],\n) {\n const modifiersSet = new Set<string>();\n for (const modifier of modifiers) {\n if (modifier) modifiersSet.add(modifier);\n }\n\n printer.tokenMap?.find(node, tok => {\n if (modifiersSet.has(tok.value)) {\n printer.token(tok.value);\n printer.space();\n modifiersSet.delete(tok.value);\n return modifiersSet.size === 0;\n }\n return false;\n });\n\n for (const modifier of modifiersSet) {\n printer.word(modifier);\n printer.space();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,gBAAgBA,CAE9BC,IAAwB,EACxBC,MAAc,EACd;EAGA,IAAI,CAACC,KAAK,CACR,CAACD,MAAM,CAACE,IAAI,KAAK,gBAAgB,IAAIF,MAAM,CAACE,IAAI,KAAK,mBAAmB,KAKlEF,MAAM,CAACG,cAAc,KAAMJ,IAAI,GACjC,IAAI,GACJ,GACN,CAAC;EACD,IAAI,CAACK,KAAK,CAAC,CAAC;EAEZ,IAAIL,IAAI,CAACM,QAAQ,EAAE,IAAI,CAACJ,SAAK,GAAI,CAAC;EAClC,IAAI,CAACK,KAAK,CAACP,IAAI,CAACI,cAAc,CAAC;AACjC;AAEO,SAASI,4BAA4BA,CAE1CR,IAAoC,EACpCC,MAAc,EACR;EACN,IAAI,CAACC,SAAK,GAAI,CAAC;EAEf,IAAIO,sBAAsC,GACxCR,MAAM,CAACE,IAAI,KAAK,yBAAyB,IAAIH,IAAI,CAACU,MAAM,C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,OAAO,CAAC5C,KAAK,CAAC,GAAG,CAAC;EAClB,MAAM2H,4BAA4B,GAAG/E,OAAO,CAACgF,cAAc,CAAC,CAAC;EAC7DiD,EAAE,CAAC,CAAC;EACJjI,OAAO,CAACkF,0BAA0B,GAAGH,4BAA4B;EACjE/E,OAAO,CAACkI,UAAU,CAAChL,IAAI,CAAC;AAC1B;AAEA,SAAS6K,kBAAkBA,CACzB/H,OAAgB,EAChB9C,IAAY,EACZiL,SAAgD,EAChD;EAAA,IAAAC,kBAAA;EACA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAS,CAAC;EACtC,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAE;IAChC,IAAII,QAAQ,EAAEF,YAAY,CAACG,GAAG,CAACD,QAAQ,CAAC;EAC1C;EAEA,CAAAH,kBAAA,GAAApI,OAAO,CAAClC,QAAQ,aAAhBsK,kBAAA,CAAkBnK,IAAI,CAACf,IAAI,EAAEkI,GAAG,IAAI;IAClC,IAAIiD,YAAY,CAACI,GAAG,CAACrD,GAAG,CAACsD,KAAK,CAAC,EAAE;MAC/B1I,OAAO,CAAC5C,KAAK,CAACgI,GAAG,CAACsD,KAAK,CAAC;MACxB1I,OAAO,CAACzC,KAAK,CAAC,CAAC;MACf8K,YAAY,CAACM,MAAM,CAACvD,GAAG,CAACsD,KAAK,CAAC;MAC9B,OAAOL,YAAY,CAACO,IAAI,KAAK,CAAC;IAChC;IACA,OAAO,KAAK;EACd,CAAC,CAAC;EAEF,KAAK,MAAML,QAAQ,IAAIF,YAAY,EAAE;IACnCrI,OAAO,CAACxB,IAAI,CAAC+J,QAAQ,CAAC;IACtBvI,OAAO,CAACzC,KAAK,CAAC,CAAC;EACjB;AACF","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/index.js b/node_modules/@babel/generator/lib/index.js new file mode 100644 index 0000000..e8b3bcc --- /dev/null +++ b/node_modules/@babel/generator/lib/index.js @@ -0,0 +1,108 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +exports.generate = generate; +var _sourceMap = require("./source-map.js"); +var _printer = require("./printer.js"); +function normalizeOptions(code, opts, ast) { + var _opts$recordAndTupleS; + if (opts.experimental_preserveFormat) { + if (typeof code !== "string") { + throw new Error("`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string"); + } + if (!opts.retainLines) { + throw new Error("`experimental_preserveFormat` requires `retainLines` to be set to `true`"); + } + if (opts.compact && opts.compact !== "auto") { + throw new Error("`experimental_preserveFormat` is not compatible with the `compact` option"); + } + if (opts.minified) { + throw new Error("`experimental_preserveFormat` is not compatible with the `minified` option"); + } + if (opts.jsescOption) { + throw new Error("`experimental_preserveFormat` is not compatible with the `jsescOption` option"); + } + if (!Array.isArray(ast.tokens)) { + throw new Error("`experimental_preserveFormat` requires the AST to have attached the token of the input code. Make sure to enable the `tokens: true` parser option."); + } + } + const format = { + auxiliaryCommentBefore: opts.auxiliaryCommentBefore, + auxiliaryCommentAfter: opts.auxiliaryCommentAfter, + shouldPrintComment: opts.shouldPrintComment, + preserveFormat: opts.experimental_preserveFormat, + retainLines: opts.retainLines, + retainFunctionParens: opts.retainFunctionParens, + comments: opts.comments == null || opts.comments, + compact: opts.compact, + minified: opts.minified, + concise: opts.concise, + indent: { + adjustMultilineComment: true, + style: " " + }, + jsescOption: Object.assign({ + quotes: "double", + wrap: true, + minimal: false + }, opts.jsescOption), + topicToken: opts.topicToken + }; + format.decoratorsBeforeExport = opts.decoratorsBeforeExport; + format.jsescOption.json = opts.jsonCompatibleStrings; + format.recordAndTupleSyntaxType = (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash"; + format.importAttributesKeyword = opts.importAttributesKeyword; + if (format.minified) { + format.compact = true; + format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); + } else { + format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.includes("@license") || value.includes("@preserve")); + } + if (format.compact === "auto") { + format.compact = typeof code === "string" && code.length > 500000; + if (format.compact) { + console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`); + } + } + if (format.compact || format.preserveFormat) { + format.indent.adjustMultilineComment = false; + } + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment + } = format; + if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { + format.auxiliaryCommentBefore = undefined; + } + if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) { + format.auxiliaryCommentAfter = undefined; + } + return format; +} +exports.CodeGenerator = class CodeGenerator { + constructor(ast, opts = {}, code) { + this._ast = void 0; + this._format = void 0; + this._map = void 0; + this._ast = ast; + this._format = normalizeOptions(code, opts, ast); + this._map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null; + } + generate() { + const printer = new _printer.default(this._format, this._map); + return printer.generate(this._ast); + } +}; +function generate(ast, opts = {}, code) { + const format = normalizeOptions(code, opts, ast); + const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null; + const printer = new _printer.default(format, map, ast.tokens, typeof code === "string" ? code : null); + return printer.generate(ast); +} +var _default = exports.default = generate; + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/index.js.map b/node_modules/@babel/generator/lib/index.js.map new file mode 100644 index 0000000..e6a7901 --- /dev/null +++ b/node_modules/@babel/generator/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_sourceMap","require","_printer","normalizeOptions","code","opts","ast","_opts$recordAndTupleS","experimental_preserveFormat","Error","retainLines","compact","minified","jsescOption","Array","isArray","tokens","format","auxiliaryCommentBefore","auxiliaryCommentAfter","shouldPrintComment","preserveFormat","retainFunctionParens","comments","concise","indent","adjustMultilineComment","style","Object","assign","quotes","wrap","minimal","topicToken","decoratorsBeforeExport","json","jsonCompatibleStrings","recordAndTupleSyntaxType","importAttributesKeyword","value","includes","length","console","error","filename","undefined","exports","CodeGenerator","constructor","_ast","_format","_map","sourceMaps","SourceMap","generate","printer","Printer","map","_default","default"],"sources":["../src/index.ts"],"sourcesContent":["import SourceMap from \"./source-map.ts\";\nimport Printer from \"./printer.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\nimport type { Format } from \"./printer.ts\";\nimport type {\n EncodedSourceMap,\n DecodedSourceMap,\n Mapping,\n} from \"@jridgewell/gen-mapping\";\n\n/**\n * Normalize generator options, setting defaults.\n *\n * - Detects code indentation.\n * - If `opts.compact = \"auto\"` and the code is over 500KB, `compact` will be set to `true`.\n */\n\nfunction normalizeOptions(\n code: string | Record<string, string> | undefined,\n opts: GeneratorOptions,\n ast: t.Node,\n): Format {\n if (opts.experimental_preserveFormat) {\n if (typeof code !== \"string\") {\n throw new Error(\n \"`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string\",\n );\n }\n if (!opts.retainLines) {\n throw new Error(\n \"`experimental_preserveFormat` requires `retainLines` to be set to `true`\",\n );\n }\n if (opts.compact && opts.compact !== \"auto\") {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `compact` option\",\n );\n }\n if (opts.minified) {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `minified` option\",\n );\n }\n if (opts.jsescOption) {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `jsescOption` option\",\n );\n }\n if (!Array.isArray((ast as any).tokens)) {\n throw new Error(\n \"`experimental_preserveFormat` requires the AST to have attached the token of the input code. Make sure to enable the `tokens: true` parser option.\",\n );\n }\n }\n\n const format: Format = {\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n // @ts-expect-error define it later\n shouldPrintComment: opts.shouldPrintComment,\n preserveFormat: opts.experimental_preserveFormat,\n retainLines: opts.retainLines,\n retainFunctionParens: opts.retainFunctionParens,\n comments: opts.comments == null || opts.comments,\n compact: opts.compact,\n minified: opts.minified,\n concise: opts.concise,\n indent: {\n adjustMultilineComment: true,\n style: \" \",\n },\n jsescOption: {\n quotes: \"double\",\n wrap: true,\n minimal: process.env.BABEL_8_BREAKING ? true : false,\n ...opts.jsescOption,\n },\n topicToken: opts.topicToken,\n };\n\n if (!process.env.BABEL_8_BREAKING) {\n format.decoratorsBeforeExport = opts.decoratorsBeforeExport;\n format.jsescOption.json = opts.jsonCompatibleStrings;\n format.recordAndTupleSyntaxType = opts.recordAndTupleSyntaxType ?? \"hash\";\n format.importAttributesKeyword = opts.importAttributesKeyword;\n }\n\n if (format.minified) {\n format.compact = true;\n\n format.shouldPrintComment =\n format.shouldPrintComment || (() => format.comments);\n } else {\n format.shouldPrintComment =\n format.shouldPrintComment ||\n (value =>\n format.comments ||\n value.includes(\"@license\") ||\n value.includes(\"@preserve\"));\n }\n\n if (format.compact === \"auto\") {\n format.compact = typeof code === \"string\" && code.length > 500_000; // 500KB\n\n if (format.compact) {\n console.error(\n \"[BABEL] Note: The code generator has deoptimised the styling of \" +\n `${opts.filename} as it exceeds the max of ${\"500KB\"}.`,\n );\n }\n }\n\n if (format.compact || format.preserveFormat) {\n format.indent.adjustMultilineComment = false;\n }\n\n const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } =\n format;\n\n if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) {\n format.auxiliaryCommentBefore = undefined;\n }\n if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) {\n format.auxiliaryCommentAfter = undefined;\n }\n\n return format;\n}\n\nexport interface GeneratorOptions {\n /**\n * Optional string to add as a block comment at the start of the output file.\n */\n auxiliaryCommentBefore?: string;\n\n /**\n * Optional string to add as a block comment at the end of the output file.\n */\n auxiliaryCommentAfter?: string;\n\n /**\n * Function that takes a comment (as a string) and returns true if the comment should be included in the output.\n * By default, comments are included if `opts.comments` is `true` or if `opts.minified` is `false` and the comment\n * contains `@preserve` or `@license`.\n */\n shouldPrintComment?(comment: string): boolean;\n\n /**\n * Preserve the input code format while printing the transformed code.\n * This is experimental, and may have breaking changes in future\n * patch releases. It will be removed in a future minor release,\n * when it will graduate to stable.\n */\n experimental_preserveFormat?: boolean;\n\n /**\n * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).\n * Defaults to `false`.\n */\n retainLines?: boolean;\n\n /**\n * Retain parens around function expressions (could be used to change engine parsing behavior)\n * Defaults to `false`.\n */\n retainFunctionParens?: boolean;\n\n /**\n * Should comments be included in output? Defaults to `true`.\n */\n comments?: boolean;\n\n /**\n * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.\n */\n compact?: boolean | \"auto\";\n\n /**\n * Should the output be minified. Defaults to `false`.\n */\n minified?: boolean;\n\n /**\n * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.\n */\n concise?: boolean;\n\n /**\n * Used in warning messages\n */\n filename?: string;\n\n /**\n * Enable generating source maps. Defaults to `false`.\n */\n sourceMaps?: boolean;\n\n inputSourceMap?: any;\n\n /**\n * A root for all relative URLs in the source map.\n */\n sourceRoot?: string;\n\n /**\n * The filename for the source code (i.e. the code in the `code` argument).\n * This will only be used if `code` is a string.\n */\n sourceFileName?: string;\n\n /**\n * Set to true to run jsesc with \"json\": true to print \"\\u00A9\" vs. \"©\";\n * @deprecated use `jsescOptions: { json: true }` instead\n */\n jsonCompatibleStrings?: boolean;\n\n /**\n * Set to true to enable support for experimental decorators syntax before\n * module exports. If not specified, decorators will be printed in the same\n * position as they were in the input source code.\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n\n /**\n * Options for outputting jsesc representation.\n */\n jsescOption?: jsescOptions;\n\n /**\n * For use with the recordAndTuple token.\n * @deprecated It will be removed in Babel 8.\n */\n recordAndTupleSyntaxType?: \"bar\" | \"hash\";\n\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: \"%\" | \"#\" | \"@@\" | \"^^\" | \"^\";\n\n /**\n * The import attributes syntax style:\n * - \"with\" : `import { a } from \"b\" with { type: \"json\" };`\n * - \"assert\" : `import { a } from \"b\" assert { type: \"json\" };`\n * - \"with-legacy\" : `import { a } from \"b\" with type: \"json\";`\n * @deprecated Removed in Babel 8.\n */\n importAttributesKeyword?: \"with\" | \"assert\" | \"with-legacy\";\n}\n\nexport interface GeneratorResult {\n code: string;\n map: EncodedSourceMap | null;\n decodedMap: DecodedSourceMap | undefined;\n rawMappings: Mapping[] | undefined;\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * We originally exported the Generator class above, but to make it extra clear that it is a private API,\n * we have moved that to an internal class instance and simplified the interface to the two public methods\n * that we wish to support.\n */\n\n // eslint-disable-next-line no-restricted-globals\n exports.CodeGenerator = class CodeGenerator {\n private _ast: t.Node;\n private _format: Format;\n private _map: SourceMap | null;\n constructor(ast: t.Node, opts: GeneratorOptions = {}, code?: string) {\n this._ast = ast;\n this._format = normalizeOptions(code, opts, ast);\n this._map = opts.sourceMaps ? new SourceMap(opts, code) : null;\n }\n generate(): GeneratorResult {\n const printer = new Printer(this._format, this._map);\n\n return printer.generate(this._ast);\n }\n };\n}\n\n/**\n * Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.\n * @param ast - the abstract syntax tree from which to generate output code.\n * @param opts - used for specifying options for code generation.\n * @param code - the original source code, used for source maps.\n * @returns - an object containing the output code and source map.\n */\nexport function generate(\n ast: t.Node,\n opts: GeneratorOptions = {},\n code?: string | Record<string, string>,\n): GeneratorResult {\n const format = normalizeOptions(code, opts, ast);\n const map = opts.sourceMaps ? new SourceMap(opts, code) : null;\n\n const printer = new Printer(\n format,\n map,\n (ast as any).tokens,\n typeof code === \"string\" ? code : null,\n );\n\n return printer.generate(ast);\n}\n\nexport default generate;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAiBA,SAASE,gBAAgBA,CACvBC,IAAiD,EACjDC,IAAsB,EACtBC,GAAW,EACH;E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GpD,IAAI,CAAC+C,UAAU,GAAG,IAAIC,kBAAS,CAAChD,IAAI,EAAED,IAAI,CAAC,GAAG,IAAI;EAE9D,MAAMmD,OAAO,GAAG,IAAIC,gBAAO,CACzBvC,MAAM,EACNwC,GAAG,EACFnD,GAAG,CAASU,MAAM,EACnB,OAAOZ,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAG,IACpC,CAAC;EAED,OAAOmD,OAAO,CAACD,QAAQ,CAAChD,GAAG,CAAC;AAC9B;AAAC,IAAAoD,QAAA,GAAAZ,OAAA,CAAAa,OAAA,GAEcL,QAAQ","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/index.js b/node_modules/@babel/generator/lib/node/index.js new file mode 100644 index 0000000..58cb15c --- /dev/null +++ b/node_modules/@babel/generator/lib/node/index.js @@ -0,0 +1,81 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TokenContext = void 0; +exports.isLastChild = isLastChild; +exports.parentNeedsParens = parentNeedsParens; +var parens = require("./parentheses.js"); +var _t = require("@babel/types"); +var _nodes = require("../nodes.js"); +const { + VISITOR_KEYS +} = _t; +const TokenContext = exports.TokenContext = { + normal: 0, + expressionStatement: 1, + arrowBody: 2, + exportDefault: 4, + arrowFlowReturnType: 8, + forInitHead: 16, + forInHead: 32, + forOfHead: 64, + forInOrInitHeadAccumulate: 128, + forInOrInitHeadAccumulatePassThroughMask: 128 +}; +for (const type of Object.keys(parens)) { + const func = parens[type]; + if (_nodes.generatorInfosMap.has(type)) { + _nodes.generatorInfosMap.get(type)[2] = func; + } +} +function isOrHasCallExpression(node) { + switch (node.type) { + case "CallExpression": + return true; + case "MemberExpression": + return isOrHasCallExpression(node.object); + } + return false; +} +function parentNeedsParens(node, parent, parentId) { + switch (parentId) { + case 112: + if (parent.callee === node) { + if (isOrHasCallExpression(node)) return true; + } + break; + case 42: + return !isDecoratorMemberExpression(node) && !(node.type === "CallExpression" && isDecoratorMemberExpression(node.callee)) && node.type !== "ParenthesizedExpression"; + } + return false; +} +function isDecoratorMemberExpression(node) { + switch (node.type) { + case "Identifier": + return true; + case "MemberExpression": + return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); + default: + return false; + } +} +function isLastChild(parent, child) { + const visitorKeys = VISITOR_KEYS[parent.type]; + for (let i = visitorKeys.length - 1; i >= 0; i--) { + const val = parent[visitorKeys[i]]; + if (val === child) { + return true; + } else if (Array.isArray(val)) { + let j = val.length - 1; + while (j >= 0 && val[j] === null) j--; + return j >= 0 && val[j] === child; + } else if (val) { + return false; + } + } + return false; +} + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/node/index.js.map b/node_modules/@babel/generator/lib/node/index.js.map new file mode 100644 index 0000000..bae168f --- /dev/null +++ b/node_modules/@babel/generator/lib/node/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["parens","require","_t","_nodes","VISITOR_KEYS","TokenContext","exports","normal","expressionStatement","arrowBody","exportDefault","arrowFlowReturnType","forInitHead","forInHead","forOfHead","forInOrInitHeadAccumulate","forInOrInitHeadAccumulatePassThroughMask","type","Object","keys","func","generatorInfosMap","has","get","isOrHasCallExpression","node","object","parentNeedsParens","parent","parentId","callee","isDecoratorMemberExpression","computed","property","isLastChild","child","visitorKeys","i","length","val","Array","isArray","j"],"sources":["../../src/node/index.ts"],"sourcesContent":["import * as parens from \"./parentheses.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport { generatorInfosMap } from \"../nodes.ts\";\n\nexport const enum TokenContext {\n normal = 0,\n expressionStatement = 1 << 0,\n arrowBody = 1 << 1,\n exportDefault = 1 << 2,\n arrowFlowReturnType = 1 << 3,\n forInitHead = 1 << 4,\n forInHead = 1 << 5,\n forOfHead = 1 << 6,\n // This flag lives across the token boundary, and will\n // be reset after forIn or forInit head is printed\n forInOrInitHeadAccumulate = 1 << 7,\n forInOrInitHeadAccumulatePassThroughMask = 0b10000000,\n}\n\nexport type NodeHandler<R> = (\n node: t.Node,\n // todo:\n // node: K extends keyof typeof t\n // ? Extract<typeof t[K], { type: \"string\" }>\n // : t.Node,\n parent: t.Node,\n parentId: number,\n tokenContext?: number,\n getRawIdentifier?: (node: t.Identifier) => string,\n) => R | undefined;\n\nfor (const type of Object.keys(parens) as (keyof typeof parens)[]) {\n const func = parens[type];\n if (generatorInfosMap.has(type)) {\n generatorInfosMap.get(type)![2] = func;\n }\n}\n\nfunction isOrHasCallExpression(node: t.Node): boolean {\n switch (node.type) {\n case \"CallExpression\":\n return true;\n case \"MemberExpression\":\n return isOrHasCallExpression(node.object);\n }\n return false;\n}\n\nexport function parentNeedsParens(\n node: t.Node,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"NewExpression\"):\n if (parent.callee === node) {\n if (isOrHasCallExpression(node)) return true;\n }\n break;\n case __node(\"Decorator\"):\n return (\n !isDecoratorMemberExpression(node) &&\n !(\n node.type === \"CallExpression\" &&\n isDecoratorMemberExpression(node.callee)\n ) &&\n node.type !== \"ParenthesizedExpression\"\n );\n }\n return false;\n}\n\nfunction isDecoratorMemberExpression(node: t.Node): boolean {\n switch (node.type) {\n case \"Identifier\":\n return true;\n case \"MemberExpression\":\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n isDecoratorMemberExpression(node.object)\n );\n default:\n return false;\n }\n}\n\nexport function isLastChild(parent: t.Node, child: t.Node) {\n const visitorKeys = VISITOR_KEYS[parent.type];\n for (let i = visitorKeys.length - 1; i >= 0; i--) {\n const val = (parent as any)[visitorKeys[i]] as t.Node | t.Node[] | null;\n if (val === child) {\n return true;\n } else if (Array.isArray(val)) {\n let j = val.length - 1;\n while (j >= 0 && val[j] === null) j--;\n return j >= 0 && val[j] === child;\n } else if (val) {\n return false;\n }\n }\n return false;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,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Y;MACf,OAAO,IAAI;IACb,KAAK,kBAAkB;MACrB,OACE,CAACQ,IAAI,CAACO,QAAQ,IACdP,IAAI,CAACQ,QAAQ,CAAChB,IAAI,KAAK,YAAY,IACnCc,2BAA2B,CAACN,IAAI,CAACC,MAAM,CAAC;IAE5C;MACE,OAAO,KAAK;EAChB;AACF;AAEO,SAASQ,WAAWA,CAACN,MAAc,EAAEO,KAAa,EAAE;EACzD,MAAMC,WAAW,GAAGhC,YAAY,CAACwB,MAAM,CAACX,IAAI,CAAC;EAC7C,KAAK,IAAIoB,CAAC,GAAGD,WAAW,CAACE,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAChD,MAAME,GAAG,GAAIX,MAAM,CAASQ,WAAW,CAACC,CAAC,CAAC,CAA6B;IACvE,IAAIE,GAAG,KAAKJ,KAAK,EAAE;MACjB,OAAO,IAAI;IACb,CAAC,MAAM,IAAIK,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;MAC7B,IAAIG,CAAC,GAAGH,GAAG,CAACD,MAAM,GAAG,CAAC;MACtB,OAAOI,CAAC,IAAI,CAAC,IAAIH,GAAG,CAACG,CAAC,CAAC,KAAK,IAAI,EAAEA,CAAC,EAAE;MACrC,OAAOA,CAAC,IAAI,CAAC,IAAIH,GAAG,CAACG,CAAC,CAAC,KAAKP,KAAK;IACnC,CAAC,MAAM,IAAII,GAAG,EAAE;MACd,OAAO,KAAK;IACd;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/parentheses.js b/node_modules/@babel/generator/lib/node/parentheses.js new file mode 100644 index 0000000..b7e1f4f --- /dev/null +++ b/node_modules/@babel/generator/lib/node/parentheses.js @@ -0,0 +1,298 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AssignmentExpression = AssignmentExpression; +exports.BinaryExpression = BinaryExpression; +exports.ClassExpression = ClassExpression; +exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression; +exports.DoExpression = DoExpression; +exports.FunctionExpression = FunctionExpression; +exports.FunctionTypeAnnotation = FunctionTypeAnnotation; +exports.Identifier = Identifier; +exports.LogicalExpression = LogicalExpression; +exports.NullableTypeAnnotation = NullableTypeAnnotation; +exports.ObjectExpression = ObjectExpression; +exports.OptionalIndexedAccessType = OptionalIndexedAccessType; +exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression; +exports.SequenceExpression = SequenceExpression; +exports.TSSatisfiesExpression = exports.TSAsExpression = TSAsExpression; +exports.TSConditionalType = TSConditionalType; +exports.TSConstructorType = exports.TSFunctionType = TSFunctionType; +exports.TSInferType = TSInferType; +exports.TSInstantiationExpression = TSInstantiationExpression; +exports.TSIntersectionType = TSIntersectionType; +exports.SpreadElement = exports.UnaryExpression = exports.TSTypeAssertion = UnaryLike; +exports.TSTypeOperator = TSTypeOperator; +exports.TSUnionType = TSUnionType; +exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.UpdateExpression = UpdateExpression; +exports.AwaitExpression = exports.YieldExpression = YieldExpression; +var _t = require("@babel/types"); +var _index = require("./index.js"); +const { + isMemberExpression, + isOptionalMemberExpression, + isYieldExpression, + isStatement +} = _t; +const PRECEDENCE = new Map([["||", 0], ["??", 1], ["&&", 2], ["|", 3], ["^", 4], ["&", 5], ["==", 6], ["===", 6], ["!=", 6], ["!==", 6], ["<", 7], [">", 7], ["<=", 7], [">=", 7], ["in", 7], ["instanceof", 7], [">>", 8], ["<<", 8], [">>>", 8], ["+", 9], ["-", 9], ["*", 10], ["/", 10], ["%", 10], ["**", 11]]); +function isTSTypeExpression(nodeId) { + return nodeId === 156 || nodeId === 201 || nodeId === 209; +} +const isClassExtendsClause = (node, parent, parentId) => { + return (parentId === 21 || parentId === 22) && parent.superClass === node; +}; +const hasPostfixPart = (node, parent, parentId) => { + switch (parentId) { + case 108: + case 132: + return parent.object === node; + case 17: + case 130: + case 112: + return parent.callee === node; + case 222: + return parent.tag === node; + case 191: + return true; + } + return false; +}; +function NullableTypeAnnotation(node, parent, parentId) { + return parentId === 4; +} +function FunctionTypeAnnotation(node, parent, parentId, tokenContext) { + return (parentId === 239 || parentId === 90 || parentId === 4 || (tokenContext & _index.TokenContext.arrowFlowReturnType) > 0 + ); +} +function UpdateExpression(node, parent, parentId) { + return hasPostfixPart(node, parent, parentId) || isClassExtendsClause(node, parent, parentId); +} +function needsParenBeforeExpressionBrace(tokenContext) { + return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody)) > 0; +} +function ObjectExpression(node, parent, parentId, tokenContext) { + return needsParenBeforeExpressionBrace(tokenContext); +} +function DoExpression(node, parent, parentId, tokenContext) { + return (tokenContext & _index.TokenContext.expressionStatement) > 0 && !node.async; +} +function BinaryLike(node, parent, parentId, nodeType) { + if (isClassExtendsClause(node, parent, parentId)) { + return true; + } + if (hasPostfixPart(node, parent, parentId) || parentId === 238 || parentId === 145 || parentId === 8) { + return true; + } + let parentPos; + switch (parentId) { + case 10: + case 107: + parentPos = PRECEDENCE.get(parent.operator); + break; + case 156: + case 201: + parentPos = 7; + } + if (parentPos !== undefined) { + const nodePos = nodeType === 2 ? 7 : PRECEDENCE.get(node.operator); + if (parentPos > nodePos) return true; + if (parentPos === nodePos && parentId === 10 && (nodePos === 11 ? parent.left === node : parent.right === node)) { + return true; + } + if (nodeType === 1 && parentId === 107 && (nodePos === 1 && parentPos !== 1 || parentPos === 1 && nodePos !== 1)) { + return true; + } + } + return false; +} +function UnionTypeAnnotation(node, parent, parentId) { + switch (parentId) { + case 4: + case 115: + case 90: + case 239: + return true; + } + return false; +} +function OptionalIndexedAccessType(node, parent, parentId) { + return parentId === 84 && parent.objectType === node; +} +function TSAsExpression(node, parent, parentId) { + if ((parentId === 6 || parentId === 7) && parent.left === node) { + return true; + } + if (parentId === 10 && (parent.operator === "|" || parent.operator === "&") && node === parent.left) { + return true; + } + return BinaryLike(node, parent, parentId, 2); +} +function TSConditionalType(node, parent, parentId) { + switch (parentId) { + case 155: + case 195: + case 211: + case 212: + return true; + case 175: + return parent.objectType === node; + case 181: + case 219: + return parent.types[0] === node; + case 161: + return parent.checkType === node || parent.extendsType === node; + } + return false; +} +function TSUnionType(node, parent, parentId) { + switch (parentId) { + case 181: + case 211: + case 155: + case 195: + return true; + case 175: + return parent.objectType === node; + } + return false; +} +function TSIntersectionType(node, parent, parentId) { + return parentId === 211 || TSTypeOperator(node, parent, parentId); +} +function TSInferType(node, parent, parentId) { + if (TSTypeOperator(node, parent, parentId)) { + return true; + } + if ((parentId === 181 || parentId === 219) && node.typeParameter.constraint && parent.types[0] === node) { + return true; + } + return false; +} +function TSTypeOperator(node, parent, parentId) { + switch (parentId) { + case 155: + case 195: + return true; + case 175: + if (parent.objectType === node) { + return true; + } + } + return false; +} +function TSInstantiationExpression(node, parent, parentId) { + switch (parentId) { + case 17: + case 130: + case 112: + case 177: + return (parent.typeParameters + ) != null; + } + return false; +} +function TSFunctionType(node, parent, parentId) { + if (TSUnionType(node, parent, parentId)) return true; + return parentId === 219 || parentId === 161 && (parent.checkType === node || parent.extendsType === node); +} +function BinaryExpression(node, parent, parentId, tokenContext) { + if (BinaryLike(node, parent, parentId, 0)) return true; + return (tokenContext & _index.TokenContext.forInOrInitHeadAccumulate) > 0 && node.operator === "in"; +} +function LogicalExpression(node, parent, parentId) { + return BinaryLike(node, parent, parentId, 1); +} +function SequenceExpression(node, parent, parentId) { + if (parentId === 144 || parentId === 133 || parentId === 108 && parent.property === node || parentId === 132 && parent.property === node || parentId === 224) { + return false; + } + if (parentId === 21) { + return true; + } + if (parentId === 68) { + return parent.right === node; + } + if (parentId === 60) { + return true; + } + return !isStatement(parent); +} +function YieldExpression(node, parent, parentId) { + return parentId === 10 || parentId === 107 || parentId === 238 || parentId === 145 || hasPostfixPart(node, parent, parentId) || parentId === 8 && isYieldExpression(node) || parentId === 28 && node === parent.test || isClassExtendsClause(node, parent, parentId) || isTSTypeExpression(parentId); +} +function ClassExpression(node, parent, parentId, tokenContext) { + return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0; +} +function UnaryLike(node, parent, parentId) { + return hasPostfixPart(node, parent, parentId) || parentId === 10 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId); +} +function FunctionExpression(node, parent, parentId, tokenContext) { + return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0; +} +function ConditionalExpression(node, parent, parentId) { + switch (parentId) { + case 238: + case 145: + case 10: + case 107: + case 8: + return true; + case 28: + if (parent.test === node) { + return true; + } + } + if (isTSTypeExpression(parentId)) { + return true; + } + return UnaryLike(node, parent, parentId); +} +function OptionalMemberExpression(node, parent, parentId) { + switch (parentId) { + case 17: + return parent.callee === node; + case 108: + return parent.object === node; + } + return false; +} +function AssignmentExpression(node, parent, parentId, tokenContext) { + if (needsParenBeforeExpressionBrace(tokenContext) && node.left.type === "ObjectPattern") { + return true; + } + return ConditionalExpression(node, parent, parentId); +} +function Identifier(node, parent, parentId, tokenContext, getRawIdentifier) { + var _node$extra; + if (getRawIdentifier && getRawIdentifier(node) !== node.name) { + return false; + } + if (parentId === 6 && (_node$extra = node.extra) != null && _node$extra.parenthesized && parent.left === node) { + const rightType = parent.right.type; + if ((rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null) { + return true; + } + } + if (tokenContext & _index.TokenContext.forOfHead || (parentId === 108 || parentId === 132) && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) { + if (node.name === "let") { + const isFollowedByBracket = isMemberExpression(parent, { + object: node, + computed: true + }) || isOptionalMemberExpression(parent, { + object: node, + computed: true, + optional: false + }); + if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) { + return true; + } + return (tokenContext & _index.TokenContext.forOfHead) > 0; + } + } + return parentId === 68 && parent.left === node && node.name === "async" && !parent.await; +} + +//# sourceMappingURL=parentheses.js.map diff --git a/node_modules/@babel/generator/lib/node/parentheses.js.map b/node_modules/@babel/generator/lib/node/parentheses.js.map new file mode 100644 index 0000000..0120e9c --- /dev/null +++ b/node_modules/@babel/generator/lib/node/parentheses.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","_index","isMemberExpression","isOptionalMemberExpression","isYieldExpression","isStatement","PRECEDENCE","Map","isTSTypeExpression","nodeId","isClassExtendsClause","node","parent","parentId","superClass","hasPostfixPart","object","callee","tag","NullableTypeAnnotation","FunctionTypeAnnotation","tokenContext","TokenContext","arrowFlowReturnType","UpdateExpression","needsParenBeforeExpressionBrace","expressionStatement","arrowBody","ObjectExpression","DoExpression","async","BinaryLike","nodeType","parentPos","get","operator","undefined","nodePos","left","right","UnionTypeAnnotation","OptionalIndexedAccessType","objectType","TSAsExpression","TSConditionalType","types","checkType","extendsType","TSUnionType","TSIntersectionType","TSTypeOperator","TSInferType","typeParameter","constraint","TSInstantiationExpression","typeParameters","TSFunctionType","BinaryExpression","forInOrInitHeadAccumulate","LogicalExpression","SequenceExpression","property","YieldExpression","test","ClassExpression","exportDefault","UnaryLike","FunctionExpression","ConditionalExpression","OptionalMemberExpression","AssignmentExpression","type","Identifier","getRawIdentifier","_node$extra","name","extra","parenthesized","rightType","id","forOfHead","forInitHead","forInHead","isFollowedByBracket","computed","optional","await"],"sources":["../../src/node/parentheses.ts"],"sourcesContent":["import {\n isMemberExpression,\n isOptionalMemberExpression,\n isYieldExpression,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport { TokenContext } from \"./index.ts\";\n\nconst PRECEDENCE = new Map([\n [\"||\", 0],\n [\"??\", 1],\n [\"&&\", 2],\n [\"|\", 3],\n [\"^\", 4],\n [\"&\", 5],\n [\"==\", 6],\n [\"===\", 6],\n [\"!=\", 6],\n [\"!==\", 6],\n [\"<\", 7],\n [\">\", 7],\n [\"<=\", 7],\n [\">=\", 7],\n [\"in\", 7],\n [\"instanceof\", 7],\n [\">>\", 8],\n [\"<<\", 8],\n [\">>>\", 8],\n [\"+\", 9],\n [\"-\", 9],\n [\"*\", 10],\n [\"/\", 10],\n [\"%\", 10],\n [\"**\", 11],\n]);\n\nfunction isTSTypeExpression(nodeId: number) {\n return (\n nodeId === __node(\"TSAsExpression\") ||\n nodeId === __node(\"TSSatisfiesExpression\") ||\n nodeId === __node(\"TSTypeAssertion\")\n );\n}\n\nconst isClassExtendsClause = (\n node: t.Node,\n parent: any,\n parentId: number,\n): parent is t.Class => {\n return (\n (parentId === __node(\"ClassDeclaration\") ||\n parentId === __node(\"ClassExpression\")) &&\n parent.superClass === node\n );\n};\n\nconst hasPostfixPart = (node: t.Node, parent: any, parentId: number) => {\n switch (parentId) {\n case __node(\"MemberExpression\"):\n case __node(\"OptionalMemberExpression\"):\n return parent.object === node;\n case __node(\"CallExpression\"):\n case __node(\"OptionalCallExpression\"):\n case __node(\"NewExpression\"):\n return parent.callee === node;\n case __node(\"TaggedTemplateExpression\"):\n return parent.tag === node;\n case __node(\"TSNonNullExpression\"):\n return true;\n }\n\n return false;\n};\n\nexport function NullableTypeAnnotation(\n node: t.NullableTypeAnnotation,\n parent: any,\n parentId: number,\n): boolean {\n return parentId === __node(\"ArrayTypeAnnotation\");\n}\n\nexport function FunctionTypeAnnotation(\n node: t.FunctionTypeAnnotation,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n return (\n // (() => A) | (() => B)\n parentId === __node(\"UnionTypeAnnotation\") ||\n // (() => A) & (() => B)\n parentId === __node(\"IntersectionTypeAnnotation\") ||\n // (() => A)[]\n parentId === __node(\"ArrayTypeAnnotation\") ||\n (tokenContext & TokenContext.arrowFlowReturnType) > 0\n );\n}\n\nexport function UpdateExpression(\n node: t.UpdateExpression,\n parent: any,\n parentId: number,\n): boolean {\n return (\n hasPostfixPart(node, parent, parentId) ||\n isClassExtendsClause(node, parent, parentId)\n );\n}\n\nfunction needsParenBeforeExpressionBrace(tokenContext: number) {\n return (\n (tokenContext &\n (TokenContext.expressionStatement | TokenContext.arrowBody)) >\n 0\n );\n}\n\nexport function ObjectExpression(\n node: t.ObjectExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n return needsParenBeforeExpressionBrace(tokenContext);\n}\n\nexport function DoExpression(\n node: t.DoExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n // `async do` can start an expression statement\n return (tokenContext & TokenContext.expressionStatement) > 0 && !node.async;\n}\n\nconst enum BinaryLikeType {\n Binary = 0,\n Logical = 1,\n TypeScript = 2,\n}\n\nfunction BinaryLike(\n node: t.Binary | t.TSAsExpression | t.TSSatisfiesExpression,\n parent: any,\n parentId: number,\n nodeType: BinaryLikeType,\n): boolean {\n if (isClassExtendsClause(node, parent, parentId)) {\n return true;\n }\n\n if (\n hasPostfixPart(node, parent, parentId) ||\n parentId === __node(\"UnaryExpression\") ||\n parentId === __node(\"SpreadElement\") ||\n parentId === __node(\"AwaitExpression\")\n ) {\n return true;\n }\n let parentPos: number | undefined;\n switch (parentId) {\n case __node(\"BinaryExpression\"):\n case __node(\"LogicalExpression\"):\n parentPos = PRECEDENCE.get(parent.operator);\n break;\n case __node(\"TSAsExpression\"):\n case __node(\"TSSatisfiesExpression\"):\n parentPos = 7; /* in */\n }\n if (parentPos !== undefined) {\n const nodePos =\n nodeType === BinaryLikeType.TypeScript\n ? 7 /* in */\n : PRECEDENCE.get((node as t.Binary).operator)!;\n if (parentPos > nodePos) return true;\n if (\n parentPos === nodePos &&\n parentId === __node(\"BinaryExpression\") &&\n (nodePos === 11 /* ** */ ? parent.left === node : parent.right === node)\n ) {\n return true;\n }\n if (\n nodeType === BinaryLikeType.Logical &&\n parentId === __node(\"LogicalExpression\") &&\n // 1: ??\n ((nodePos === 1 && parentPos !== 1) || (parentPos === 1 && nodePos !== 1))\n ) {\n return true;\n }\n }\n return false;\n}\n\nexport function UnionTypeAnnotation(\n node: t.UnionTypeAnnotation | t.IntersectionTypeAnnotation,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"ArrayTypeAnnotation\"):\n case __node(\"NullableTypeAnnotation\"):\n case __node(\"IntersectionTypeAnnotation\"):\n case __node(\"UnionTypeAnnotation\"):\n return true;\n }\n return false;\n}\n\nexport { UnionTypeAnnotation as IntersectionTypeAnnotation };\n\nexport function OptionalIndexedAccessType(\n node: t.OptionalIndexedAccessType,\n parent: any,\n parentId: number,\n): boolean {\n return parentId === __node(\"IndexedAccessType\") && parent.objectType === node;\n}\n\nexport function TSAsExpression(\n node: t.TSAsExpression | t.TSSatisfiesExpression,\n parent: any,\n parentId: number,\n): boolean {\n if (\n (parentId === __node(\"AssignmentExpression\") ||\n parentId === __node(\"AssignmentPattern\")) &&\n parent.left === node\n ) {\n return true;\n }\n if (\n parentId === __node(\"BinaryExpression\") &&\n (parent.operator === \"|\" || parent.operator === \"&\") &&\n node === parent.left\n ) {\n return true;\n }\n return BinaryLike(node, parent, parentId, BinaryLikeType.TypeScript);\n}\n\nexport { TSAsExpression as TSSatisfiesExpression };\n\nexport { UnaryLike as TSTypeAssertion };\n\nexport function TSConditionalType(\n node: t.TSConditionalType,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"TSArrayType\"):\n case __node(\"TSOptionalType\"):\n case __node(\"TSTypeOperator\"):\n // for `infer K extends (L extends M ? M : ...)`\n // fallthrough\n case __node(\"TSTypeParameter\"):\n return true;\n case __node(\"TSIndexedAccessType\"):\n return parent.objectType === node;\n case __node(\"TSIntersectionType\"):\n case __node(\"TSUnionType\"):\n return parent.types[0] === node;\n case __node(\"TSConditionalType\"):\n return parent.checkType === node || parent.extendsType === node;\n }\n return false;\n}\n\nexport function TSUnionType(\n node: t.TSUnionType | t.TSFunctionType,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"TSIntersectionType\"):\n case __node(\"TSTypeOperator\"):\n case __node(\"TSArrayType\"):\n case __node(\"TSOptionalType\"):\n return true;\n case __node(\"TSIndexedAccessType\"):\n return parent.objectType === node;\n }\n return false;\n}\n\nexport function TSIntersectionType(\n node: t.TSUnionType,\n parent: any,\n parentId: number,\n): boolean {\n return (\n parentId === __node(\"TSTypeOperator\") ||\n TSTypeOperator(node, parent, parentId)\n );\n}\n\nexport function TSInferType(\n node: t.TSInferType,\n parent: any,\n parentId: number,\n): boolean {\n if (TSTypeOperator(node, parent, parentId)) {\n return true;\n }\n if (\n (parentId === __node(\"TSIntersectionType\") ||\n parentId === __node(\"TSUnionType\")) &&\n node.typeParameter.constraint &&\n parent.types[0] === node\n ) {\n return true;\n }\n return false;\n}\n\nexport function TSTypeOperator(\n node: t.TSTypeOperator | t.TSUnionType | t.TSInferType,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"TSArrayType\"):\n case __node(\"TSOptionalType\"):\n return true;\n case __node(\"TSIndexedAccessType\"):\n if (parent.objectType === node) {\n return true;\n }\n }\n return false;\n}\n\nexport function TSInstantiationExpression(\n node: t.TSInstantiationExpression,\n parent: any,\n parentId: number,\n) {\n switch (parentId) {\n case __node(\"CallExpression\"):\n case __node(\"OptionalCallExpression\"):\n case __node(\"NewExpression\"):\n case __node(\"TSInstantiationExpression\"):\n return (\n (process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n parent.typeArguments\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n parent.typeParameters) != null\n );\n }\n\n return false;\n}\n\nexport function TSFunctionType(\n node: t.TSFunctionType,\n parent: any,\n parentId: number,\n): boolean {\n if (TSUnionType(node, parent, parentId)) return true;\n\n return (\n parentId === __node(\"TSUnionType\") ||\n (parentId === __node(\"TSConditionalType\") &&\n (parent.checkType === node || parent.extendsType === node))\n );\n}\n\nexport { TSFunctionType as TSConstructorType };\n\nexport function BinaryExpression(\n node: t.BinaryExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n if (BinaryLike(node, parent, parentId, BinaryLikeType.Binary)) return true;\n\n // for ((1 in []);;);\n // for (var x = (1 in []) in 2);\n return (\n (tokenContext & TokenContext.forInOrInitHeadAccumulate) > 0 &&\n node.operator === \"in\"\n );\n}\n\nexport function LogicalExpression(\n node: t.LogicalExpression,\n parent: any,\n parentId: number,\n): boolean {\n return BinaryLike(node, parent, parentId, BinaryLikeType.Logical);\n}\n\nexport function SequenceExpression(\n node: t.SequenceExpression,\n parent: any,\n parentId: number,\n): boolean {\n if (\n parentId === __node(\"SequenceExpression\") ||\n parentId === __node(\"ParenthesizedExpression\") ||\n (parentId === __node(\"MemberExpression\") && parent.property === node) ||\n (parentId === __node(\"OptionalMemberExpression\") &&\n parent.property === node) ||\n parentId === __node(\"TemplateLiteral\")\n ) {\n return false;\n }\n if (parentId === __node(\"ClassDeclaration\")) {\n return true;\n }\n if (parentId === __node(\"ForOfStatement\")) {\n return parent.right === node;\n }\n if (parentId === __node(\"ExportDefaultDeclaration\")) {\n return true;\n }\n\n return !isStatement(parent);\n}\n\nexport function YieldExpression(\n node: t.YieldExpression,\n parent: any,\n parentId: number,\n): boolean {\n return (\n parentId === __node(\"BinaryExpression\") ||\n parentId === __node(\"LogicalExpression\") ||\n parentId === __node(\"UnaryExpression\") ||\n parentId === __node(\"SpreadElement\") ||\n hasPostfixPart(node, parent, parentId) ||\n (parentId === __node(\"AwaitExpression\") && isYieldExpression(node)) ||\n (parentId === __node(\"ConditionalExpression\") && node === parent.test) ||\n isClassExtendsClause(node, parent, parentId) ||\n isTSTypeExpression(parentId)\n );\n}\n\nexport { YieldExpression as AwaitExpression };\n\nexport function ClassExpression(\n node: t.ClassExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n return (\n (tokenContext &\n (TokenContext.expressionStatement | TokenContext.exportDefault)) >\n 0\n );\n}\n\nfunction UnaryLike(\n node:\n | t.UnaryLike\n | t.TSTypeAssertion\n | t.ArrowFunctionExpression\n | t.ConditionalExpression\n | t.AssignmentExpression,\n parent: any,\n parentId: number,\n): boolean {\n return (\n hasPostfixPart(node, parent, parentId) ||\n (parentId === __node(\"BinaryExpression\") &&\n parent.operator === \"**\" &&\n parent.left === node) ||\n isClassExtendsClause(node, parent, parentId)\n );\n}\n\nexport { UnaryLike as UnaryExpression, UnaryLike as SpreadElement };\n\nexport function FunctionExpression(\n node: t.FunctionExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n return (\n (tokenContext &\n (TokenContext.expressionStatement | TokenContext.exportDefault)) >\n 0\n );\n}\n\nexport function ConditionalExpression(\n node:\n | t.ConditionalExpression\n | t.ArrowFunctionExpression\n | t.AssignmentExpression,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"UnaryExpression\"):\n case __node(\"SpreadElement\"):\n case __node(\"BinaryExpression\"):\n case __node(\"LogicalExpression\"):\n case __node(\"AwaitExpression\"):\n return true;\n case __node(\"ConditionalExpression\"):\n if (parent.test === node) {\n return true;\n }\n }\n\n if (isTSTypeExpression(parentId)) {\n return true;\n }\n\n return UnaryLike(node, parent, parentId);\n}\n\nexport { ConditionalExpression as ArrowFunctionExpression };\n\nexport function OptionalMemberExpression(\n node: t.OptionalMemberExpression,\n parent: any,\n parentId: number,\n): boolean {\n switch (parentId) {\n case __node(\"CallExpression\"):\n return parent.callee === node;\n case __node(\"MemberExpression\"):\n return parent.object === node;\n }\n return false;\n}\n\nexport { OptionalMemberExpression as OptionalCallExpression };\n\nexport function AssignmentExpression(\n node: t.AssignmentExpression,\n parent: any,\n parentId: number,\n tokenContext: number,\n): boolean {\n if (\n needsParenBeforeExpressionBrace(tokenContext) &&\n node.left.type === \"ObjectPattern\"\n ) {\n return true;\n }\n return ConditionalExpression(node, parent, parentId);\n}\n\nexport function Identifier(\n node: t.Identifier,\n parent: any,\n parentId: number,\n tokenContext: number,\n getRawIdentifier: (node: t.Identifier) => string,\n): boolean {\n if (getRawIdentifier && getRawIdentifier(node) !== node.name) {\n return false;\n }\n\n // 13.15.2 AssignmentExpression RS: Evaluation\n // (fn) = function () {};\n if (\n parentId === __node(\"AssignmentExpression\") &&\n node.extra?.parenthesized &&\n parent.left === node\n ) {\n const rightType = parent.right.type;\n if (\n (rightType === \"FunctionExpression\" || rightType === \"ClassExpression\") &&\n parent.right.id == null\n ) {\n return true;\n }\n }\n\n // fast path\n if (\n tokenContext & TokenContext.forOfHead ||\n ((parentId === __node(\"MemberExpression\") ||\n parentId === __node(\"OptionalMemberExpression\")) &&\n tokenContext &\n (TokenContext.expressionStatement |\n TokenContext.forInitHead |\n TokenContext.forInHead))\n ) {\n // Non-strict code allows the identifier `let`, but it cannot occur as-is in\n // certain contexts to avoid ambiguity with contextual keyword `let`.\n if (node.name === \"let\") {\n // Some contexts only forbid `let [`, so check if the next token would\n // be the left bracket of a computed member expression.\n const isFollowedByBracket =\n isMemberExpression(parent, {\n object: node,\n computed: true,\n }) ||\n isOptionalMemberExpression(parent, {\n object: node,\n computed: true,\n optional: false,\n });\n if (\n isFollowedByBracket &&\n tokenContext &\n (TokenContext.expressionStatement |\n TokenContext.forInitHead |\n TokenContext.forInHead)\n ) {\n return true;\n }\n return (tokenContext & TokenContext.forOfHead) > 0;\n }\n }\n\n // ECMAScript specifically forbids a for-of loop from starting with the\n // token sequence `for (async of`, because it would be ambiguous with\n // `for (async of => {};;)`, so we need to add extra parentheses.\n return (\n parentId === __node(\"ForOfStatement\") &&\n parent.left === node &&\n node.name === \"async\" &&\n !parent.await\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAA0C;EAPxCE,kBAAkB;EAClBC,0BAA0B;EAC1BC,iBAAiB;EACjBC;AAAW,IAAAN,EAAA;AAMb,MAAMO,UAAU,GAAG,IAAIC,GAAG,CAAC,CACzB,CAAC,IAAI,EAAE,CAAC,CAAC,EACT,CAAC,IAAI,EAAE,CAAC,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Y,CAAC4D,SAAS,CAAE,EAC9B;IAGA,IAAIvE,IAAI,CAACgE,IAAI,KAAK,KAAK,EAAE;MAGvB,MAAMQ,mBAAmB,GACvBjF,kBAAkB,CAACU,MAAM,EAAE;QACzBI,MAAM,EAAEL,IAAI;QACZyE,QAAQ,EAAE;MACZ,CAAC,CAAC,IACFjF,0BAA0B,CAACS,MAAM,EAAE;QACjCI,MAAM,EAAEL,IAAI;QACZyE,QAAQ,EAAE,IAAI;QACdC,QAAQ,EAAE;MACZ,CAAC,CAAC;MACJ,IACEF,mBAAmB,IACnB9D,YAAY,IACTC,mBAAY,CAACI,mBAAmB,GAC/BJ,mBAAY,CAAC2D,WAAW,GACxB3D,mBAAY,CAAC4D,SAAS,CAAC,EAC3B;QACA,OAAO,IAAI;MACb;MACA,OAAO,CAAC7D,YAAY,GAAGC,mBAAY,CAAC0D,SAAS,IAAI,CAAC;IACpD;EACF;EAKA,OACEnE,QAAQ,OAA6B,IACrCD,MAAM,CAAC0B,IAAI,KAAK3B,IAAI,IACpBA,IAAI,CAACgE,IAAI,KAAK,OAAO,IACrB,CAAC/D,MAAM,CAAC0E,KAAK;AAEjB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/nodes.js b/node_modules/@babel/generator/lib/nodes.js new file mode 100644 index 0000000..8754a38 --- /dev/null +++ b/node_modules/@babel/generator/lib/nodes.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.generatorInfosMap = void 0; +var generatorFunctions = require("./generators/index.js"); +var deprecatedGeneratorFunctions = require("./generators/deprecated.js"); +const generatorInfosMap = exports.generatorInfosMap = new Map(); +let index = 0; +for (const key of Object.keys(generatorFunctions).sort()) { + if (key.startsWith("_")) continue; + generatorInfosMap.set(key, [generatorFunctions[key], index++, undefined]); +} +for (const key of Object.keys(deprecatedGeneratorFunctions)) { + generatorInfosMap.set(key, [deprecatedGeneratorFunctions[key], index++, undefined]); +} + +//# sourceMappingURL=nodes.js.map diff --git a/node_modules/@babel/generator/lib/nodes.js.map b/node_modules/@babel/generator/lib/nodes.js.map new file mode 100644 index 0000000..6aa8283 --- /dev/null +++ b/node_modules/@babel/generator/lib/nodes.js.map @@ -0,0 +1 @@ +{"version":3,"names":["generatorFunctions","require","deprecatedGeneratorFunctions","generatorInfosMap","exports","Map","index","key","Object","keys","sort","startsWith","set","undefined"],"sources":["../src/nodes.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\n\nimport * as generatorFunctions from \"./generators/index.ts\";\nimport * as deprecatedGeneratorFunctions from \"./generators/deprecated.ts\";\nimport type { NodeHandler } from \"./node/index.ts\";\nimport type Printer from \"./printer.ts\";\n\ndeclare global {\n function __node(type: t.Node[\"type\"]): number;\n}\n\nconst generatorInfosMap = new Map<\n string,\n [\n (this: Printer, node: t.Node, parent?: t.Node | null) => void,\n number,\n NodeHandler<boolean> | undefined,\n ]\n>();\nlet index = 0;\n\nfor (const key of Object.keys(generatorFunctions).sort() as Exclude<\n keyof typeof generatorFunctions,\n `_${string}`\n>[]) {\n if (key.startsWith(\"_\")) continue;\n generatorInfosMap.set(key, [generatorFunctions[key], index++, undefined]);\n}\nif (!process.env.BABEL_8_BREAKING) {\n for (const key of Object.keys(\n deprecatedGeneratorFunctions,\n ) as (keyof typeof deprecatedGeneratorFunctions)[]) {\n generatorInfosMap.set(key, [\n deprecatedGeneratorFunctions[key],\n index++,\n undefined,\n ]);\n }\n}\n\nexport { generatorInfosMap };\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,4BAAA,GAAAD,OAAA;AAQA,MAAME,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAIE,GAAG,CAO/B,CAAC;AACH,IAAIC,KAAK,GAAG,CAAC;AAEb,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACU,IAAI,CAAC,CAAC,EAGnD;EACH,IAAIH,GAAG,CAACI,UAAU,CAAC,GAAG,CAAC,EAAE;EACzBR,iBAAiB,CAACS,GAAG,CAACL,GAAG,EAAE,CAACP,kBAAkB,CAACO,GAAG,CAAC,EAAED,KAAK,EAAE,EAAEO,SAAS,CAAC,CAAC;AAC3E;AAEE,KAAK,MAAMN,GAAG,IAAIC,MAAM,CAACC,IAAI,CAC3BP,4BACF,CAAC,EAAmD;EAClDC,iBAAiB,CAACS,GAAG,CAACL,GAAG,EAAE,CACzBL,4BAA4B,CAACK,GAAG,CAAC,EACjCD,KAAK,EAAE,EACPO,SAAS,CACV,CAAC;AACJ","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/printer.js b/node_modules/@babel/generator/lib/printer.js new file mode 100644 index 0000000..ffdd45f --- /dev/null +++ b/node_modules/@babel/generator/lib/printer.js @@ -0,0 +1,782 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _buffer = require("./buffer.js"); +var _index = require("./node/index.js"); +var _nodes = require("./nodes.js"); +var _t = require("@babel/types"); +var _tokenMap = require("./token-map.js"); +var _types2 = require("./generators/types.js"); +const { + isExpression, + isFunction, + isStatement, + isClassBody, + isTSInterfaceBody, + isTSEnumMember +} = _t; +const SCIENTIFIC_NOTATION = /e/i; +const ZERO_DECIMAL_INTEGER = /\.0+$/; +const HAS_NEWLINE = /[\n\r\u2028\u2029]/; +const HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\n\r\u2028\u2029]|\*\//; +function commentIsNewline(c) { + return c.type === "CommentLine" || HAS_NEWLINE.test(c.value); +} +class Printer { + constructor(format, map, tokens = null, originalCode = null) { + this.tokenContext = _index.TokenContext.normal; + this._tokens = null; + this._originalCode = null; + this._currentNode = null; + this._currentTypeId = null; + this._indent = 0; + this._indentRepeat = 0; + this._insideAux = false; + this._noLineTerminator = false; + this._noLineTerminatorAfterNode = null; + this._printAuxAfterOnNextUserNode = false; + this._printedComments = new Set(); + this._lastCommentLine = 0; + this._innerCommentsState = 0; + this._flags = 0; + this.tokenMap = null; + this._boundGetRawIdentifier = null; + this._printSemicolonBeforeNextNode = -1; + this._printSemicolonBeforeNextToken = -1; + this.format = format; + this._tokens = tokens; + this._originalCode = originalCode; + this._indentRepeat = format.indent.style.length; + this._inputMap = (map == null ? void 0 : map._inputMap) || null; + this._buf = new _buffer.default(map, format.indent.style[0]); + const { + preserveFormat, + compact, + concise, + retainLines, + retainFunctionParens + } = format; + if (preserveFormat) { + this._flags |= 1; + } + if (compact) { + this._flags |= 2; + } + if (concise) { + this._flags |= 4; + } + if (retainLines) { + this._flags |= 8; + } + if (retainFunctionParens) { + this._flags |= 16; + } + if (format.auxiliaryCommentBefore || format.auxiliaryCommentAfter) { + this._flags |= 32; + } + } + enterDelimited() { + const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode; + if (oldNoLineTerminatorAfterNode !== null) { + this._noLineTerminatorAfterNode = null; + } + return oldNoLineTerminatorAfterNode; + } + generate(ast) { + if (this.format.preserveFormat) { + this.tokenMap = new _tokenMap.TokenMap(ast, this._tokens, this._originalCode); + this._boundGetRawIdentifier = _types2._getRawIdentifier.bind(this); + } + this.print(ast); + this._maybeAddAuxComment(); + return this._buf.get(); + } + indent(flags = this._flags) { + if (flags & (1 | 2 | 4)) { + return; + } + this._indent += this._indentRepeat; + } + dedent(flags = this._flags) { + if (flags & (1 | 2 | 4)) { + return; + } + this._indent -= this._indentRepeat; + } + semicolon(force = false) { + const flags = this._flags; + if (flags & 32) { + this._maybeAddAuxComment(); + } + if (flags & 1) { + const node = this._currentNode; + if (node.start != null && node.end != null) { + if (!this.tokenMap.endMatches(node, ";")) { + this._printSemicolonBeforeNextNode = this._buf.getCurrentLine(); + return; + } + const indexes = this.tokenMap.getIndexes(this._currentNode); + this._catchUpTo(this._tokens[indexes[indexes.length - 1]].loc.start); + } + } + if (force) { + this._appendChar(59); + } else { + this._queue(59); + } + this._noLineTerminator = false; + } + rightBrace(node) { + if (this.format.minified) { + this._buf.removeLastSemicolon(); + } + this.sourceWithOffset("end", node.loc, -1); + this.tokenChar(125); + } + rightParens(node) { + this.sourceWithOffset("end", node.loc, -1); + this.tokenChar(41); + } + space(force = false) { + if (this._flags & (1 | 2)) { + return; + } + if (force) { + this._space(); + } else { + const lastCp = this.getLastChar(true); + if (lastCp !== 0 && lastCp !== 32 && lastCp !== 10) { + this._space(); + } + } + } + word(str, noLineTerminatorAfter = false) { + this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; + this._maybePrintInnerComments(str); + const flags = this._flags; + if (flags & 32) { + this._maybeAddAuxComment(); + } + if (flags & 1) this._catchUpToCurrentToken(str); + const lastChar = this.getLastChar(); + if (lastChar === -2 || lastChar === -3 || lastChar === 47 && str.charCodeAt(0) === 47) { + this._space(); + } + this._append(str, false); + this.setLastChar(-3); + this._noLineTerminator = noLineTerminatorAfter; + } + number(str, number) { + function isNonDecimalLiteral(str) { + if (str.length > 2 && str.charCodeAt(0) === 48) { + const secondChar = str.charCodeAt(1); + return secondChar === 98 || secondChar === 111 || secondChar === 120; + } + return false; + } + this.word(str); + if (Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46) { + this.setLastChar(-2); + } + } + token(str, maybeNewline = false, occurrenceCount = 0, mayNeedSpace = false) { + this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; + this._maybePrintInnerComments(str, occurrenceCount); + const flags = this._flags; + if (flags & 32) { + this._maybeAddAuxComment(); + } + if (flags & 1) { + this._catchUpToCurrentToken(str, occurrenceCount); + } + if (mayNeedSpace) { + const strFirst = str.charCodeAt(0); + if ((strFirst === 45 && str === "--" || strFirst === 61) && this.getLastChar() === 33 || strFirst === 43 && this.getLastChar() === 43 || strFirst === 45 && this.getLastChar() === 45 || strFirst === 46 && this.getLastChar() === -2) { + this._space(); + } + } + this._append(str, maybeNewline); + this._noLineTerminator = false; + } + tokenChar(char, occurrenceCount = 0) { + this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; + this._maybePrintInnerComments(char, occurrenceCount); + const flags = this._flags; + if (flags & 32) { + this._maybeAddAuxComment(); + } + if (flags & 1) { + this._catchUpToCurrentToken(char, occurrenceCount); + } + if (char === 43 && this.getLastChar() === 43 || char === 45 && this.getLastChar() === 45 || char === 46 && this.getLastChar() === -2) { + this._space(); + } + this._appendChar(char); + this._noLineTerminator = false; + } + newline(i = 1, flags = this._flags) { + if (i <= 0) return; + if (flags & (8 | 2)) { + return; + } + if (flags & 4) { + this.space(); + return; + } + if (i > 2) i = 2; + i -= this._buf.getNewlineCount(); + for (let j = 0; j < i; j++) { + this._newline(); + } + } + endsWith(char) { + return this.getLastChar(true) === char; + } + getLastChar(checkQueue) { + return this._buf.getLastChar(checkQueue); + } + setLastChar(char) { + this._buf._last = char; + } + exactSource(loc, cb) { + if (!loc) { + cb(); + return; + } + this._catchUp("start", loc); + this._buf.exactSource(loc, cb); + } + source(prop, loc) { + if (!loc) return; + this._catchUp(prop, loc); + this._buf.source(prop, loc); + } + sourceWithOffset(prop, loc, columnOffset) { + if (!loc || this.format.preserveFormat) return; + this._catchUp(prop, loc); + this._buf.sourceWithOffset(prop, loc, columnOffset); + } + sourceIdentifierName(identifierName, pos) { + if (!this._buf._canMarkIdName) return; + const sourcePosition = this._buf._sourcePosition; + sourcePosition.identifierNamePos = pos; + sourcePosition.identifierName = identifierName; + } + _space() { + this._queue(32); + } + _newline() { + if (this._buf._queuedChar === 32) this._buf._queuedChar = 0; + this._appendChar(10, true); + } + _catchUpToCurrentToken(str, occurrenceCount = 0) { + const token = this.tokenMap.findMatching(this._currentNode, str, occurrenceCount); + if (token) this._catchUpTo(token.loc.start); + if (this._printSemicolonBeforeNextToken !== -1 && this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()) { + this._appendChar(59, true); + } + this._printSemicolonBeforeNextToken = -1; + this._printSemicolonBeforeNextNode = -1; + } + _append(str, maybeNewline) { + this._maybeIndent(); + this._buf.append(str, maybeNewline); + } + _appendChar(char, noIndent) { + if (!noIndent) { + this._maybeIndent(); + } + this._buf.appendChar(char); + } + _queue(char) { + this._buf.queue(char); + this.setLastChar(-1); + } + _maybeIndent() { + const indent = this._shouldIndent(); + if (indent > 0) { + this._buf._appendChar(-1, indent, false); + } + } + _shouldIndent() { + return this.endsWith(10) ? this._indent : 0; + } + catchUp(line) { + if (!this.format.retainLines) return; + const count = line - this._buf.getCurrentLine(); + for (let i = 0; i < count; i++) { + this._newline(); + } + } + _catchUp(prop, loc) { + const flags = this._flags; + if ((flags & 1) === 0) { + if (flags & 8 && loc != null && loc[prop]) { + this.catchUp(loc[prop].line); + } + return; + } + const pos = loc == null ? void 0 : loc[prop]; + if (pos != null) this._catchUpTo(pos); + } + _catchUpTo({ + line, + column, + index + }) { + const count = line - this._buf.getCurrentLine(); + if (count > 0 && this._noLineTerminator) { + return; + } + for (let i = 0; i < count; i++) { + this._newline(); + } + const spacesCount = count > 0 ? column : column - this._buf.getCurrentColumn(); + if (spacesCount > 0) { + 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.setLastChar(32); + } + } + printTerminatorless(node) { + this._noLineTerminator = true; + this.print(node); + } + print(node, noLineTerminatorAfter = false, resetTokenContext = false, trailingCommentsLineOffset) { + var _node$leadingComments, _node$leadingComments2; + if (!node) return; + this._innerCommentsState = 0; + const { + type, + loc, + extra + } = node; + const flags = this._flags; + let changedFlags = false; + if (node._compact) { + this._flags |= 4; + changedFlags = true; + } + const nodeInfo = _nodes.generatorInfosMap.get(type); + if (nodeInfo === undefined) { + throw new ReferenceError(`unknown node of type ${JSON.stringify(type)} with constructor ${JSON.stringify(node.constructor.name)}`); + } + const [printMethod, nodeId, needsParens] = nodeInfo; + const parent = this._currentNode; + const parentId = this._currentTypeId; + this._currentNode = node; + this._currentTypeId = nodeId; + if (flags & 1) { + this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode; + } + let oldInAux; + if (flags & 32) { + oldInAux = this._insideAux; + this._insideAux = loc == null; + this._maybeAddAuxComment(this._insideAux && !oldInAux); + } + let oldTokenContext = 0; + if (resetTokenContext) { + oldTokenContext = this.tokenContext; + if (oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) { + this.tokenContext = 0; + } else { + oldTokenContext = 0; + } + } + const parenthesized = extra != null && extra.parenthesized; + let shouldPrintParens = parenthesized && flags & 1 || parenthesized && flags & 16 && nodeId === 71 || parent && ((0, _index.parentNeedsParens)(node, parent, parentId) || needsParens != null && needsParens(node, parent, parentId, this.tokenContext, flags & 1 ? this._boundGetRawIdentifier : undefined)); + if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") { + switch (parentId) { + case 65: + case 243: + case 6: + case 143: + break; + case 17: + case 130: + case 112: + if (parent.callee !== node) break; + default: + shouldPrintParens = true; + } + } + let indentParenthesized = false; + if (!shouldPrintParens && this._noLineTerminator && ((_node$leadingComments2 = node.leadingComments) != null && _node$leadingComments2.some(commentIsNewline) || flags & 8 && loc && loc.start.line > this._buf.getCurrentLine())) { + shouldPrintParens = true; + indentParenthesized = true; + } + let oldNoLineTerminatorAfterNode; + if (!shouldPrintParens) { + noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && (0, _index.isLastChild)(parent, node)); + if (noLineTerminatorAfter) { + var _node$trailingComment; + if ((_node$trailingComment = node.trailingComments) != null && _node$trailingComment.some(commentIsNewline)) { + if (isExpression(node)) shouldPrintParens = true; + } else { + oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode; + this._noLineTerminatorAfterNode = node; + } + } + } + if (shouldPrintParens) { + this.tokenChar(40); + if (indentParenthesized) this.indent(); + this._innerCommentsState = 0; + if (!resetTokenContext) { + oldTokenContext = this.tokenContext; + } + if (oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) { + this.tokenContext = 0; + } + oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode; + this._noLineTerminatorAfterNode = null; + } + this._printLeadingComments(node, parent); + this.exactSource(nodeId === 139 || nodeId === 66 ? null : loc, printMethod.bind(this, node, parent)); + if (shouldPrintParens) { + this._printTrailingComments(node, parent); + if (indentParenthesized) { + this.dedent(); + this.newline(); + } + this.tokenChar(41); + this._noLineTerminator = noLineTerminatorAfter; + } else if (noLineTerminatorAfter && !this._noLineTerminator) { + this._noLineTerminator = true; + this._printTrailingComments(node, parent); + } else { + this._printTrailingComments(node, parent, trailingCommentsLineOffset); + } + if (oldTokenContext) this.tokenContext = oldTokenContext; + this._currentNode = parent; + this._currentTypeId = parentId; + if (changedFlags) { + this._flags = flags; + } + if (flags & 32) { + this._insideAux = oldInAux; + } + if (oldNoLineTerminatorAfterNode != null) { + this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; + } + this._innerCommentsState = 0; + } + _maybeAddAuxComment(enteredPositionlessNode) { + if (enteredPositionlessNode) this._printAuxBeforeComment(); + if (!this._insideAux) this._printAuxAfterComment(); + } + _printAuxBeforeComment() { + if (this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = true; + const comment = this.format.auxiliaryCommentBefore; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }, 0); + } + } + _printAuxAfterComment() { + if (!this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = false; + const comment = this.format.auxiliaryCommentAfter; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }, 0); + } + } + getPossibleRaw(node) { + const extra = node.extra; + if ((extra == null ? void 0 : extra.raw) != null && extra.rawValue != null && node.value === extra.rawValue) { + return extra.raw; + } + } + printJoin(nodes, statement, indent, separator, printTrailingSeparator, resetTokenContext, trailingCommentsLineOffset) { + if (!(nodes != null && nodes.length)) return; + const flags = this._flags; + if (indent == null && flags & 8) { + var _nodes$0$loc; + const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line; + if (startLine != null && startLine !== this._buf.getCurrentLine()) { + indent = true; + } + } + if (indent) this.indent(flags); + const len = nodes.length; + for (let i = 0; i < len; i++) { + const node = nodes[i]; + if (!node) continue; + if (statement && i === 0 && this._buf.hasContent()) { + this.newline(1, flags); + } + this.print(node, false, resetTokenContext, trailingCommentsLineOffset || 0); + if (separator != null) { + if (i < len - 1) separator.call(this, i, false);else if (printTrailingSeparator) separator.call(this, i, true); + } + if (statement) { + if (i + 1 === len) { + this.newline(1, flags); + } else { + const lastCommentLine = this._lastCommentLine; + if (lastCommentLine > 0) { + var _nodes$loc; + const offset = (((_nodes$loc = nodes[i + 1].loc) == null ? void 0 : _nodes$loc.start.line) || 0) - lastCommentLine; + if (offset >= 0) { + this.newline(offset || 1, flags); + continue; + } + } + this.newline(1, flags); + } + } + } + if (indent) this.dedent(flags); + } + printAndIndentOnComments(node) { + const indent = node.leadingComments && node.leadingComments.length > 0; + if (indent) this.indent(); + this.print(node); + if (indent) this.dedent(); + } + printBlock(body) { + if (body.type !== "EmptyStatement") { + this.space(); + } + this.print(body); + } + _printTrailingComments(node, parent, lineOffset) { + const { + innerComments, + trailingComments + } = node; + if (innerComments != null && innerComments.length) { + this._printComments(2, innerComments, node, parent, lineOffset); + } + if (trailingComments != null && trailingComments.length) { + this._printComments(2, trailingComments, node, parent, lineOffset); + } else { + this._lastCommentLine = 0; + } + } + _printLeadingComments(node, parent) { + const comments = node.leadingComments; + if (!(comments != null && comments.length)) return; + this._printComments(0, comments, node, parent); + } + _maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) { + var _this$tokenMap; + const state = this._innerCommentsState; + switch (state & 3) { + case 0: + this._innerCommentsState = 1 | 4; + return; + case 1: + this.printInnerComments((state & 4) > 0, (_this$tokenMap = this.tokenMap) == null ? void 0 : _this$tokenMap.findMatching(this._currentNode, nextTokenStr, nextTokenOccurrenceCount)); + } + } + printInnerComments(indent = true, nextToken) { + const node = this._currentNode; + const comments = node.innerComments; + if (!(comments != null && comments.length)) { + this._innerCommentsState = 2; + return; + } + const hasSpace = this.endsWith(32); + if (indent) this.indent(); + switch (this._printComments(1, comments, node, undefined, undefined, nextToken)) { + case 2: + this._innerCommentsState = 2; + case 1: + if (hasSpace) this.space(); + } + if (indent) this.dedent(); + } + noIndentInnerCommentsHere() { + this._innerCommentsState &= ~4; + } + printSequence(nodes, indent, resetTokenContext, trailingCommentsLineOffset) { + this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, resetTokenContext, trailingCommentsLineOffset); + } + printList(items, printTrailingSeparator, statement, indent, separator, resetTokenContext) { + this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, resetTokenContext); + } + shouldPrintTrailingComma(listEnd) { + if (!this.tokenMap) return null; + const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, typeof listEnd === "number" ? String.fromCharCode(listEnd) : listEnd)); + if (listEndIndex <= 0) return null; + return this.tokenMap.matchesOriginal(this._tokens[listEndIndex - 1], ","); + } + _shouldPrintComment(comment, nextToken) { + if (comment.ignore) return 0; + if (this._printedComments.has(comment)) return 0; + if (this._noLineTerminator && HAS_NEWLINE_OR_BlOCK_COMMENT_END.test(comment.value)) { + return 2; + } + if (nextToken && this.tokenMap) { + const commentTok = this.tokenMap.find(this._currentNode, token => token.value === comment.value); + if (commentTok && commentTok.start > nextToken.start) { + return 2; + } + } + this._printedComments.add(comment); + if (!this.format.shouldPrintComment(comment.value)) { + return 0; + } + return 1; + } + _printComment(comment, skipNewLines) { + const noLineTerminator = this._noLineTerminator; + const isBlockComment = comment.type === "CommentBlock"; + const printNewLines = isBlockComment && skipNewLines !== 1 && !noLineTerminator; + if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) { + this.newline(1); + } + switch (this.getLastChar(true)) { + case 47: + this._space(); + case 91: + case 123: + case 40: + break; + default: + this.space(); + } + let val; + if (isBlockComment) { + val = `/*${comment.value}*/`; + if (this.format.indent.adjustMultilineComment) { + var _comment$loc; + const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column; + if (offset) { + const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); + val = val.replace(newlineRegex, "\n"); + } + if (this._flags & 4) { + val = val.replace(/\n(?!$)/g, `\n`); + } else { + let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn(); + if (this._shouldIndent() || this.format.retainLines) { + indentSize += this._indent; + } + val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); + } + } + } else if (!noLineTerminator) { + val = `//${comment.value}`; + } else { + val = `/*${comment.value}*/`; + } + this.source("start", comment.loc); + this._append(val, isBlockComment); + if (!isBlockComment && !noLineTerminator) { + this._newline(); + } + if (printNewLines && skipNewLines !== 3) { + this.newline(1); + } + } + _printComments(type, comments, node, parent, lineOffset = 0, nextToken) { + const nodeLoc = node.loc; + const len = comments.length; + let hasLoc = !!nodeLoc; + const nodeStartLine = hasLoc ? nodeLoc.start.line : 0; + const nodeEndLine = hasLoc ? nodeLoc.end.line : 0; + let lastLine = 0; + let leadingCommentNewline = 0; + const { + _noLineTerminator, + _flags + } = this; + for (let i = 0; i < len; i++) { + const comment = comments[i]; + const shouldPrint = this._shouldPrintComment(comment, nextToken); + if (shouldPrint === 2) { + return i === 0 ? 0 : 1; + } + if (hasLoc && comment.loc && shouldPrint === 1) { + const commentStartLine = comment.loc.start.line; + const commentEndLine = comment.loc.end.line; + if (type === 0) { + let offset = 0; + if (i === 0) { + if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine !== commentEndLine)) { + offset = leadingCommentNewline = 1; + } + } else { + offset = commentStartLine - lastLine; + } + lastLine = commentEndLine; + if (offset > 0 && !_noLineTerminator) { + this.newline(offset, _flags); + } + this._printComment(comment, 1); + if (i + 1 === len) { + const count = Math.max(nodeStartLine - lastLine, leadingCommentNewline); + if (count > 0 && !_noLineTerminator) { + this.newline(count, _flags); + } + lastLine = nodeStartLine; + } + } else if (type === 1) { + const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine); + lastLine = commentEndLine; + if (offset > 0 && !_noLineTerminator) { + this.newline(offset, _flags); + } + this._printComment(comment, 1); + if (i + 1 === len) { + const count = Math.min(1, nodeEndLine - lastLine); + if (count > 0 && !_noLineTerminator) { + this.newline(count, _flags); + } + lastLine = nodeEndLine; + } + } else { + const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine); + lastLine = commentEndLine; + if (offset > 0 && !_noLineTerminator) { + this.newline(offset, _flags); + } + this._printComment(comment, 1); + } + } else { + hasLoc = false; + if (shouldPrint !== 1) { + continue; + } + if (len === 1) { + const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value); + const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumMember(node); + if (type === 0) { + this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent) && parent.body === node ? 1 : 0); + } else if (shouldSkipNewline && type === 2) { + this._printComment(comment, 1); + } else { + this._printComment(comment, 0); + } + } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") { + this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0); + } else { + this._printComment(comment, 0); + } + } + } + if (type === 2 && hasLoc && lastLine) { + this._lastCommentLine = lastLine; + } + return 2; + } +} +var _default = exports.default = Printer; +function commaSeparator(occurrenceCount, last) { + this.tokenChar(44, occurrenceCount); + if (!last) this.space(); +} + +//# sourceMappingURL=printer.js.map diff --git a/node_modules/@babel/generator/lib/printer.js.map b/node_modules/@babel/generator/lib/printer.js.map new file mode 100644 index 0000000..1576929 --- /dev/null +++ b/node_modules/@babel/generator/lib/printer.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_buffer","require","_index","_nodes","_t","_tokenMap","_types2","isExpression","isFunction","isStatement","isClassBody","isTSInterfaceBody","isTSEnumMember","SCIENTIFIC_NOTATION","ZERO_DECIMAL_INTEGER","HAS_NEWLINE","HAS_NEWLINE_OR_BlOCK_COMMENT_END","commentIsNewline","c","type","test","value","Printer","constructor","format","map","tokens","originalCode","tokenContext","TokenContext","normal","_tokens","_originalCode","_currentNode","_currentTypeId","_indent","_indentRepeat","_insideAux","_noLineTerminator","_noLineTerminatorAfterNode","_printAuxAfterOnNextUserNode","_printedComments","Set","_lastCommentLine","_innerCommentsState","_flags","tokenMap","_boundGetRawIdentifier","_printSemicolonBeforeNextNode","_printSemicolonBeforeNextToken","indent","style","length","_inputMap","_buf","Buffer","preserveFormat","compact","concise","retainLines","retainFunctionParens","auxiliaryCommentBefore","auxiliaryCommentAfter","enterDelimited","oldNoLineTerminatorAfterNode","generate","ast","TokenMap","_getRawIdentifier","bind","print","_maybeAddAuxComment","get","flags","dedent","semicolon","force","node","start","end","endMatches","getCurrentLine","indexes","getIndexes","_catchUpTo","loc","_appendChar","_queue","rightBrace","minified","removeLastSemicolon","sourceWithOffset","token","rightParens","space","_space","lastCp","getLastChar","word","str","noLineTerminatorAfter","forInOrInitHeadAccumulatePassThroughMask","_maybePrintInnerComments","_catchUpToCurrentToken","lastChar","charCodeAt","_append","setLastChar","number","isNonDecimalLiteral","secondChar","Number","isInteger","maybeNewline","occurrenceCount","mayNeedSpace","strFirst","tokenChar","char","newline","i","getNewlineCount","j","_newline","endsWith","checkQueue","_last","exactSource","cb","_catchUp","source","prop","columnOffset","sourceIdentifierName","identifierName","pos","_canMarkIdName","sourcePosition","_sourcePosition","identifierNamePos","_queuedChar","findMatching","_maybeIndent","append","noIndent","appendChar","queue","_shouldIndent","catchUp","line","count","column","index","spacesCount","getCurrentColumn","spaces","slice","replace","repeat","printTerminatorless","resetTokenContext","trailingCommentsLineOffset","_node$leadingComments","_node$leadingComments2","extra","changedFlags","_compact","nodeInfo","generatorInfosMap","undefined","ReferenceError","JSON","stringify","name","printMethod","nodeId","needsParens","parent","parentId","oldInAux","oldTokenContext","forInOrInitHeadAccumulate","parenthesized","shouldPrintParens","parentNeedsParens","leadingComments","callee","indentParenthesized","some","isLastChild","_node$trailingComment","trailingComments","_printLeadingComments","_printTrailingComments","enteredPositionlessNode","_printAuxBeforeComment","_printAuxAfterComment","comment","_printComment","getPossibleRaw","raw","rawValue","printJoin","nodes","statement","separator","printTrailingSeparator","_nodes$0$loc","startLine","len","hasContent","call","lastCommentLine","_nodes$loc","offset","printAndIndentOnComments","printBlock","body","lineOffset","innerComments","_printComments","comments","nextTokenStr","nextTokenOccurrenceCount","_this$tokenMap","state","printInnerComments","nextToken","hasSpace","noIndentInnerCommentsHere","printSequence","printList","items","commaSeparator","shouldPrintTrailingComma","listEnd","listEndIndex","findLastIndex","matchesOriginal","String","fromCharCode","_shouldPrintComment","ignore","has","commentTok","find","add","shouldPrintComment","skipNewLines","noLineTerminator","isBlockComment","printNewLines","val","adjustMultilineComment","_comment$loc","newlineRegex","RegExp","indentSize","nodeLoc","hasLoc","nodeStartLine","nodeEndLine","lastLine","leadingCommentNewline","shouldPrint","commentStartLine","commentEndLine","Math","max","min","singleLine","shouldSkipNewline","properties","_default","exports","default","last"],"sources":["../src/printer.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n\nimport Buffer from \"./buffer.ts\";\nimport type { Loc, Pos } from \"./buffer.ts\";\nimport { isLastChild, parentNeedsParens } from \"./node/index.ts\";\nimport { generatorInfosMap } from \"./nodes.ts\";\nimport type * as t from \"@babel/types\";\nimport {\n isExpression,\n isFunction,\n isStatement,\n isClassBody,\n isTSInterfaceBody,\n isTSEnumMember,\n} from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\n\nimport { TokenMap } from \"./token-map.ts\";\n\nimport type { GeneratorOptions } from \"./index.ts\";\nimport type SourceMap from \"./source-map.ts\";\nimport type { TraceMap } from \"@jridgewell/trace-mapping\";\nimport type { Token } from \"@babel/parser\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\n\nconst SCIENTIFIC_NOTATION = /e/i;\nconst ZERO_DECIMAL_INTEGER = /\\.0+$/;\nconst HAS_NEWLINE = /[\\n\\r\\u2028\\u2029]/;\nconst HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\\n\\r\\u2028\\u2029]|\\*\\//;\n\nfunction commentIsNewline(c: t.Comment) {\n return c.type === \"CommentLine\" || HAS_NEWLINE.test(c.value);\n}\n\nimport { TokenContext } from \"./node/index.ts\";\nimport { _getRawIdentifier } from \"./generators/types.ts\";\n\nconst enum COMMENT_TYPE {\n LEADING,\n INNER,\n TRAILING,\n}\n\nconst enum COMMENT_SKIP_NEWLINE {\n DEFAULT,\n ALL,\n LEADING,\n TRAILING,\n}\n\nconst enum PRINT_COMMENT_HINT {\n SKIP,\n ALLOW,\n DEFER,\n}\n\nconst enum PRINTER_FLAGS {\n EMPTY = 0,\n PRESERVE_FORMAT = 1 << 0,\n COMPACT = 1 << 1,\n CONCISE = 1 << 2,\n RETAIN_LINES = 1 << 3,\n RETAIN_FUNCTION_PARENS = 1 << 4,\n AUX_COMMENTS = 1 << 5,\n}\n\nconst enum LAST_CHAR_KINDS {\n EMPTY = 0,\n NORMAL = -1,\n INTEGER = -2,\n WORD = -3,\n}\n\nconst enum INNER_COMMENTS_STATE {\n DISALLOWED = 0,\n ALLOWED = 1,\n PRINTED = 2,\n\n WITH_INDENT = 4,\n MASK = 3,\n}\n\nconst enum PRINT_COMMENTS_RESULT {\n PRINTED_NONE = 0,\n PRINTED_SOME = 1,\n PRINTED_ALL = 2,\n}\n\nexport type Format = {\n shouldPrintComment: (comment: string) => boolean;\n preserveFormat: boolean | undefined;\n retainLines: boolean | undefined;\n retainFunctionParens: boolean | undefined;\n comments: boolean | undefined;\n auxiliaryCommentBefore: string | undefined;\n auxiliaryCommentAfter: string | undefined;\n compact: boolean | \"auto\" | undefined;\n minified: boolean | undefined;\n concise: boolean | undefined;\n indent: {\n adjustMultilineComment: boolean;\n style: string;\n };\n /**\n * @deprecated Removed in Babel 8, syntax type is always 'hash'\n */\n recordAndTupleSyntaxType?: GeneratorOptions[\"recordAndTupleSyntaxType\"];\n jsescOption: jsescOptions;\n /**\n * @deprecated Removed in Babel 8, use `jsescOption` instead\n */\n jsonCompatibleStrings?: boolean;\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: GeneratorOptions[\"topicToken\"];\n /**\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n /**\n * The import attributes syntax style:\n * - \"with\" : `import { a } from \"b\" with { type: \"json\" };`\n * - \"assert\" : `import { a } from \"b\" assert { type: \"json\" };`\n * - \"with-legacy\" : `import { a } from \"b\" with type: \"json\";`\n * @deprecated Removed in Babel 8.\n */\n importAttributesKeyword?: \"with\" | \"assert\" | \"with-legacy\";\n};\n\ninterface PrintSequenceOptions {\n statement?: boolean;\n indent?: boolean;\n trailingCommentsLineOffset?: number;\n}\n\ninterface PrintListOptions {\n separator?: (this: Printer, occurrenceCount: number, last: boolean) => void;\n statement?: boolean;\n indent?: boolean;\n printTrailingSeparator?: boolean;\n}\n\nexport type PrintJoinOptions = PrintListOptions & PrintSequenceOptions;\nclass Printer {\n constructor(\n format: Format,\n map: SourceMap | null,\n tokens: Token[] | null = null,\n originalCode: string | null = null,\n ) {\n this.format = format;\n\n this._tokens = tokens;\n this._originalCode = originalCode;\n\n this._indentRepeat = format.indent.style.length;\n\n this._inputMap = map?._inputMap || null;\n\n this._buf = new Buffer(map, format.indent.style[0]);\n\n const {\n preserveFormat,\n compact,\n concise,\n retainLines,\n retainFunctionParens,\n } = format;\n if (preserveFormat) {\n this._flags |= PRINTER_FLAGS.PRESERVE_FORMAT;\n }\n if (compact) {\n this._flags |= PRINTER_FLAGS.COMPACT;\n }\n if (concise) {\n this._flags |= PRINTER_FLAGS.CONCISE;\n }\n if (retainLines) {\n this._flags |= PRINTER_FLAGS.RETAIN_LINES;\n }\n if (retainFunctionParens) {\n this._flags |= PRINTER_FLAGS.RETAIN_FUNCTION_PARENS;\n }\n if (format.auxiliaryCommentBefore || format.auxiliaryCommentAfter) {\n this._flags |= PRINTER_FLAGS.AUX_COMMENTS;\n }\n }\n declare _inputMap: TraceMap | null;\n\n declare format: Format;\n\n enterDelimited() {\n const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;\n if (oldNoLineTerminatorAfterNode !== null) {\n this._noLineTerminatorAfterNode = null;\n }\n return oldNoLineTerminatorAfterNode;\n }\n\n tokenContext: number = TokenContext.normal;\n\n _tokens: Token[] | null = null;\n _originalCode: string | null = null;\n\n declare _buf: Buffer;\n _currentNode: t.Node | null = null;\n _currentTypeId: number | null = null;\n _indent: number = 0;\n _indentRepeat: number = 0;\n _insideAux: boolean = false;\n _noLineTerminator: boolean = false;\n _noLineTerminatorAfterNode: t.Node | null = null;\n _printAuxAfterOnNextUserNode: boolean = false;\n _printedComments = new Set<t.Comment>();\n _lastCommentLine = 0;\n _innerCommentsState = INNER_COMMENTS_STATE.DISALLOWED;\n _flags = PRINTER_FLAGS.EMPTY;\n\n tokenMap: TokenMap | null = null;\n\n _boundGetRawIdentifier: ((node: t.Identifier) => string) | null = null;\n\n generate(ast: t.Node) {\n if (this.format.preserveFormat) {\n this.tokenMap = new TokenMap(ast, this._tokens!, this._originalCode!);\n this._boundGetRawIdentifier = _getRawIdentifier.bind(this);\n }\n this.print(ast);\n this._maybeAddAuxComment();\n\n return this._buf.get();\n }\n\n /**\n * Increment indent size.\n */\n\n indent(flags = this._flags): void {\n if (\n flags &\n (PRINTER_FLAGS.PRESERVE_FORMAT |\n PRINTER_FLAGS.COMPACT |\n PRINTER_FLAGS.CONCISE)\n ) {\n return;\n }\n\n this._indent += this._indentRepeat;\n }\n\n /**\n * Decrement indent size.\n */\n\n dedent(flags = this._flags): void {\n if (\n flags &\n (PRINTER_FLAGS.PRESERVE_FORMAT |\n PRINTER_FLAGS.COMPACT |\n PRINTER_FLAGS.CONCISE)\n ) {\n return;\n }\n\n this._indent -= this._indentRepeat;\n }\n\n /**\n * If the next token is on the same line, we must first print a semicolon.\n * This option is only used in `preserveFormat` node, for semicolons that\n * might have omitted due to them being absent in the original code (thanks\n * to ASI).\n *\n * We need both *NextToken and *NextNode because we only want to insert the\n * semicolon when the next token starts a new node, and not in cases like\n * foo} (where } is not starting a new node). So we first set *NextNode, and\n * then the print() method will move it to *NextToken.\n */\n _printSemicolonBeforeNextNode: number = -1;\n _printSemicolonBeforeNextToken: number = -1;\n\n /**\n * Add a semicolon to the buffer.\n */\n semicolon(force: boolean = false): void {\n const flags = this._flags;\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n this._maybeAddAuxComment();\n }\n if (flags & PRINTER_FLAGS.PRESERVE_FORMAT) {\n const node = this._currentNode!;\n if (node.start != null && node.end != null) {\n if (!this.tokenMap!.endMatches(node, \";\")) {\n // no semicolon\n this._printSemicolonBeforeNextNode = this._buf.getCurrentLine();\n return;\n }\n const indexes = this.tokenMap!.getIndexes(this._currentNode!)!;\n this._catchUpTo(this._tokens![indexes[indexes.length - 1]].loc.start);\n }\n }\n if (force) {\n this._appendChar(charCodes.semicolon);\n } else {\n this._queue(charCodes.semicolon);\n }\n this._noLineTerminator = false;\n }\n\n /**\n * Add a right brace to the buffer.\n */\n\n rightBrace(node: t.Node): void {\n if (this.format.minified) {\n this._buf.removeLastSemicolon();\n }\n this.sourceWithOffset(\"end\", node.loc, -1);\n this.token(\"}\");\n }\n\n rightParens(node: t.Node): void {\n this.sourceWithOffset(\"end\", node.loc, -1);\n this.token(\")\");\n }\n\n /**\n * Add a space to the buffer unless it is compact.\n */\n\n space(force: boolean = false): void {\n if (this._flags & (PRINTER_FLAGS.PRESERVE_FORMAT | PRINTER_FLAGS.COMPACT)) {\n return;\n }\n\n if (force) {\n this._space();\n } else {\n const lastCp = this.getLastChar(true);\n if (\n lastCp !== 0 &&\n lastCp !== charCodes.space &&\n lastCp !== charCodes.lineFeed\n ) {\n this._space();\n }\n }\n }\n\n /**\n * Writes a token that can't be safely parsed without taking whitespace into account.\n */\n\n word(str: string, noLineTerminatorAfter: boolean = false): void {\n this.tokenContext &= TokenContext.forInOrInitHeadAccumulatePassThroughMask;\n\n this._maybePrintInnerComments(str);\n\n const flags = this._flags;\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n this._maybeAddAuxComment();\n }\n\n if (flags & PRINTER_FLAGS.PRESERVE_FORMAT) this._catchUpToCurrentToken(str);\n\n const lastChar = this.getLastChar();\n\n if (\n lastChar === LAST_CHAR_KINDS.INTEGER ||\n lastChar === LAST_CHAR_KINDS.WORD ||\n // prevent concatenating words and creating // comment out of division and regex\n (lastChar === charCodes.slash && str.charCodeAt(0) === charCodes.slash)\n ) {\n this._space();\n }\n this._append(str, false);\n\n this.setLastChar(-3);\n this._noLineTerminator = noLineTerminatorAfter;\n }\n\n /**\n * Writes a number token so that we can validate if it is an integer.\n */\n\n number(str: string, number?: number): void {\n // const NON_DECIMAL_LITERAL = /^0[box]/;\n function isNonDecimalLiteral(str: string) {\n if (str.length > 2 && str.charCodeAt(0) === charCodes.digit0) {\n const secondChar = str.charCodeAt(1);\n return (\n secondChar === charCodes.lowercaseB ||\n secondChar === charCodes.lowercaseO ||\n secondChar === charCodes.lowercaseX\n );\n }\n return false;\n }\n this.word(str);\n\n // Integer tokens need special handling because they cannot have '.'s inserted immediately after them.\n if (\n Number.isInteger(number) &&\n !isNonDecimalLiteral(str) &&\n !SCIENTIFIC_NOTATION.test(str) &&\n !ZERO_DECIMAL_INTEGER.test(str) &&\n str.charCodeAt(str.length - 1) !== charCodes.dot\n ) {\n this.setLastChar(LAST_CHAR_KINDS.INTEGER);\n }\n }\n\n /**\n * Writes a simple token.\n *\n * @param {string} str The string to append.\n * @param {boolean} [maybeNewline=false] Wether `str` might potentially\n * contain a line terminator or not.\n * @param {number} [occurrenceCount=0] The occurrence count of this token in\n * the current node. This is used when printing in `preserveFormat` mode,\n * to know which token we should map to (for example, to disambiguate the\n * commas in an array literal).\n */\n token(\n str: string,\n maybeNewline = false,\n occurrenceCount = 0,\n mayNeedSpace: boolean = false,\n ): void {\n this.tokenContext &= TokenContext.forInOrInitHeadAccumulatePassThroughMask;\n\n this._maybePrintInnerComments(str, occurrenceCount);\n\n const flags = this._flags;\n\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n this._maybeAddAuxComment();\n }\n\n if (flags & PRINTER_FLAGS.PRESERVE_FORMAT) {\n this._catchUpToCurrentToken(str, occurrenceCount);\n }\n\n if (mayNeedSpace) {\n const strFirst = str.charCodeAt(0);\n if (\n // space is mandatory to avoid outputting <!--\n // http://javascript.spec.whatwg.org/#comment-syntax\n (((strFirst === charCodes.dash && str === \"--\") ||\n // Needs spaces to avoid changing a! == 0 to a!== 0\n strFirst === charCodes.equalsTo) &&\n this.getLastChar() === charCodes.exclamationMark) ||\n // Need spaces for operators of the same kind to avoid: `a+++b`\n (strFirst === charCodes.plusSign &&\n this.getLastChar() === charCodes.plusSign) ||\n (strFirst === charCodes.dash &&\n this.getLastChar() === charCodes.dash) ||\n // Needs spaces to avoid changing '34' to '34.', which would still be a valid number.\n (strFirst === charCodes.dot &&\n this.getLastChar() === LAST_CHAR_KINDS.INTEGER)\n ) {\n this._space();\n }\n }\n this._append(str, maybeNewline);\n this._noLineTerminator = false;\n }\n\n tokenChar(char: number, occurrenceCount = 0): void {\n this.tokenContext &= TokenContext.forInOrInitHeadAccumulatePassThroughMask;\n\n this._maybePrintInnerComments(char, occurrenceCount);\n\n const flags = this._flags;\n\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n this._maybeAddAuxComment();\n }\n\n if (flags & PRINTER_FLAGS.PRESERVE_FORMAT) {\n this._catchUpToCurrentToken(char, occurrenceCount);\n }\n\n if (\n // Need spaces for operators of the same kind to avoid: `a+++b`\n (char === charCodes.plusSign &&\n this.getLastChar() === charCodes.plusSign) ||\n (char === charCodes.dash && this.getLastChar() === charCodes.dash) ||\n // Needs spaces to avoid changing '34' to '34.', which would still be a valid number.\n (char === charCodes.dot && this.getLastChar() === LAST_CHAR_KINDS.INTEGER)\n ) {\n this._space();\n }\n this._appendChar(char);\n this._noLineTerminator = false;\n }\n\n /**\n * Add a newline (or many newlines), maintaining formatting.\n * This function checks the number of newlines in the queue and subtracts them.\n * It currently has some limitations.\n * @see {Buffer#getNewlineCount}\n */\n newline(i: number = 1, flags = this._flags): void {\n if (i <= 0) return;\n\n if (flags & (PRINTER_FLAGS.RETAIN_LINES | PRINTER_FLAGS.COMPACT)) {\n return;\n }\n\n if (flags & PRINTER_FLAGS.CONCISE) {\n this.space();\n return;\n }\n\n if (i > 2) i = 2; // Max two lines\n\n i -= this._buf.getNewlineCount();\n\n for (let j = 0; j < i; j++) {\n this._newline();\n }\n }\n\n endsWith(char: number): boolean {\n return this.getLastChar(true) === char;\n }\n\n getLastChar(checkQueue?: boolean): number {\n return this._buf.getLastChar(checkQueue);\n }\n\n setLastChar(char: number) {\n this._buf._last = char;\n }\n\n exactSource(loc: Loc | null | undefined, cb: () => void) {\n if (!loc) {\n cb();\n return;\n }\n\n this._catchUp(\"start\", loc);\n\n this._buf.exactSource(loc, cb);\n }\n\n source(prop: \"start\" | \"end\", loc: Loc | undefined): void {\n if (!loc) return;\n\n this._catchUp(prop, loc);\n\n this._buf.source(prop, loc);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc | null | undefined,\n columnOffset: number,\n ): void {\n if (!loc || this.format.preserveFormat) return;\n\n this._catchUp(prop, loc);\n\n this._buf.sourceWithOffset(prop, loc, columnOffset);\n }\n\n sourceIdentifierName(identifierName: string, pos?: Pos): void {\n if (!this._buf._canMarkIdName) return;\n\n const sourcePosition = this._buf._sourcePosition;\n sourcePosition.identifierNamePos = pos;\n sourcePosition.identifierName = identifierName;\n }\n\n _space(): void {\n this._queue(charCodes.space);\n }\n\n _newline(): void {\n // Drop trailing spaces when a newline is inserted.\n if (this._buf._queuedChar === charCodes.space) this._buf._queuedChar = 0;\n\n this._appendChar(charCodes.lineFeed, true);\n }\n\n _catchUpToCurrentToken(\n str: string | number,\n occurrenceCount: number = 0,\n ): void {\n // Assert: this.tokenMap\n\n const token = this.tokenMap!.findMatching(\n this._currentNode!,\n str,\n occurrenceCount,\n );\n if (token) this._catchUpTo(token.loc.start);\n\n if (\n this._printSemicolonBeforeNextToken !== -1 &&\n this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()\n ) {\n this._appendChar(charCodes.semicolon, true);\n }\n this._printSemicolonBeforeNextToken = -1;\n this._printSemicolonBeforeNextNode = -1;\n }\n\n _append(str: string, maybeNewline: boolean): void {\n this._maybeIndent();\n\n this._buf.append(str, maybeNewline);\n }\n\n _appendChar(char: number, noIndent?: boolean): void {\n if (!noIndent) {\n this._maybeIndent();\n }\n\n this._buf.appendChar(char);\n }\n\n _queue(char: typeof charCodes.space | typeof charCodes.semicolon): void {\n this._buf.queue(char);\n\n this.setLastChar(-1);\n }\n\n _maybeIndent(): void {\n const indent = this._shouldIndent();\n if (indent > 0) {\n this._buf._appendChar(-1, indent, false);\n }\n }\n\n _shouldIndent() {\n // we've got a newline before us so prepend on the indentation\n return this.endsWith(charCodes.lineFeed) ? this._indent : 0;\n }\n\n catchUp(line: number) {\n if (!this.format.retainLines) return;\n\n // catch up to this nodes newline if we're behind\n const count = line - this._buf.getCurrentLine();\n\n for (let i = 0; i < count; i++) {\n this._newline();\n }\n }\n\n _catchUp(prop: \"start\" | \"end\", loc?: Loc) {\n const flags = this._flags;\n if ((flags & PRINTER_FLAGS.PRESERVE_FORMAT) === 0) {\n if (flags & PRINTER_FLAGS.RETAIN_LINES && loc?.[prop]) {\n this.catchUp(loc[prop].line);\n }\n return;\n }\n\n // catch up to this nodes newline if we're behind\n const pos = loc?.[prop];\n if (pos != null) this._catchUpTo(pos);\n }\n\n _catchUpTo({ line, column, index }: Pos) {\n const count = line - this._buf.getCurrentLine();\n if (count > 0 && this._noLineTerminator) {\n // We cannot inject new lines when _noLineTemrinator is set\n // to `true`, or we would generate invalid code.\n return;\n }\n\n for (let i = 0; i < count; i++) {\n this._newline();\n }\n\n const spacesCount =\n count > 0 ? column : column - this._buf.getCurrentColumn();\n if (spacesCount > 0) {\n const spaces = this._originalCode\n ? this._originalCode\n .slice(index - spacesCount, index)\n // https://tc39.es/ecma262/#sec-white-space\n .replace(/[^\\t\\v\\f\\uFEFF\\p{Space_Separator}]/gu, \" \")\n : \" \".repeat(spacesCount);\n this._append(spaces, false);\n this.setLastChar(charCodes.space);\n }\n }\n\n printTerminatorless(node: t.Node) {\n /**\n * Set some state that will be modified if a newline has been inserted before any\n * non-space characters.\n *\n * This is to prevent breaking semantics for terminatorless separator nodes. eg:\n *\n * return foo;\n *\n * returns `foo`. But if we do:\n *\n * return\n * foo;\n *\n * `undefined` will be returned and not `foo` due to the terminator.\n */\n this._noLineTerminator = true;\n this.print(node);\n }\n\n print(\n node: t.Node | null | undefined,\n noLineTerminatorAfter: boolean = false,\n resetTokenContext: boolean = false,\n // trailingCommentsLineOffset also used to check if called from printJoin\n // it will be ignored if `noLineTerminatorAfter||this._noLineTerminator`\n trailingCommentsLineOffset?: number,\n ) {\n if (!node) return;\n\n this._innerCommentsState = INNER_COMMENTS_STATE.DISALLOWED;\n\n const { type, loc, extra } = node;\n\n const flags = this._flags;\n let changedFlags = false;\n if (\n // @ts-expect-error document _compact AST properties\n node._compact\n ) {\n this._flags |= PRINTER_FLAGS.CONCISE;\n changedFlags = true;\n }\n\n const nodeInfo = generatorInfosMap.get(type);\n if (nodeInfo === undefined) {\n throw new ReferenceError(\n `unknown node of type ${JSON.stringify(\n type,\n )} with constructor ${JSON.stringify(node.constructor.name)}`,\n );\n }\n\n const [printMethod, nodeId, needsParens] = nodeInfo;\n\n const parent = this._currentNode;\n const parentId = this._currentTypeId;\n this._currentNode = node;\n this._currentTypeId = nodeId;\n\n if (flags & PRINTER_FLAGS.PRESERVE_FORMAT) {\n this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode;\n }\n\n let oldInAux;\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n oldInAux = this._insideAux;\n this._insideAux = loc == null;\n this._maybeAddAuxComment(this._insideAux && !oldInAux);\n }\n\n let oldTokenContext = 0;\n if (resetTokenContext) {\n oldTokenContext = this.tokenContext;\n if (oldTokenContext & TokenContext.forInOrInitHeadAccumulate) {\n this.tokenContext = 0;\n } else {\n oldTokenContext = 0;\n }\n }\n\n const parenthesized =\n extra != null && (extra.parenthesized as boolean | undefined);\n let shouldPrintParens =\n (parenthesized && flags & PRINTER_FLAGS.PRESERVE_FORMAT) ||\n (parenthesized &&\n flags & PRINTER_FLAGS.RETAIN_FUNCTION_PARENS &&\n nodeId === __node(\"FunctionExpression\")) ||\n (parent &&\n (parentNeedsParens(node, parent, parentId!) ||\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n (needsParens != null &&\n needsParens(\n node,\n parent,\n parentId!,\n this.tokenContext,\n flags & PRINTER_FLAGS.PRESERVE_FORMAT\n ? this._boundGetRawIdentifier!\n : undefined,\n ))));\n\n if (\n !shouldPrintParens &&\n parenthesized &&\n node.leadingComments?.length &&\n node.leadingComments[0].type === \"CommentBlock\"\n ) {\n switch (parentId) {\n case __node(\"ExpressionStatement\"):\n case __node(\"VariableDeclarator\"):\n case __node(\"AssignmentExpression\"):\n case __node(\"ReturnStatement\"):\n break;\n case __node(\"CallExpression\"):\n case __node(\"OptionalCallExpression\"):\n case __node(\"NewExpression\"):\n // @ts-expect-error checked by parentTypeId\n if (parent.callee !== node) break;\n // falls through\n default:\n shouldPrintParens = true;\n }\n }\n\n let indentParenthesized = false;\n if (\n !shouldPrintParens &&\n this._noLineTerminator &&\n (node.leadingComments?.some(commentIsNewline) ||\n (flags & PRINTER_FLAGS.RETAIN_LINES &&\n loc &&\n loc.start.line > this._buf.getCurrentLine()))\n ) {\n shouldPrintParens = true;\n indentParenthesized = true;\n }\n\n let oldNoLineTerminatorAfterNode;\n if (!shouldPrintParens) {\n noLineTerminatorAfter ||=\n !!parent &&\n this._noLineTerminatorAfterNode === parent &&\n isLastChild(parent, node);\n if (noLineTerminatorAfter) {\n if (node.trailingComments?.some(commentIsNewline)) {\n if (isExpression(node)) shouldPrintParens = true;\n } else {\n oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;\n this._noLineTerminatorAfterNode = node;\n }\n }\n }\n\n if (shouldPrintParens) {\n this.token(\"(\");\n if (indentParenthesized) this.indent();\n this._innerCommentsState = INNER_COMMENTS_STATE.DISALLOWED;\n if (!resetTokenContext) {\n oldTokenContext = this.tokenContext;\n }\n if (oldTokenContext & TokenContext.forInOrInitHeadAccumulate) {\n this.tokenContext = 0;\n }\n oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;\n this._noLineTerminatorAfterNode = null;\n }\n\n this._printLeadingComments(node, parent);\n\n this.exactSource(\n nodeId === __node(\"Program\") || nodeId === __node(\"File\") ? null : loc,\n printMethod.bind(this, node, parent),\n );\n\n if (shouldPrintParens) {\n this._printTrailingComments(node, parent);\n if (indentParenthesized) {\n this.dedent();\n this.newline();\n }\n this.token(\")\");\n this._noLineTerminator = noLineTerminatorAfter;\n } else if (noLineTerminatorAfter && !this._noLineTerminator) {\n this._noLineTerminator = true;\n this._printTrailingComments(node, parent);\n } else {\n this._printTrailingComments(node, parent, trailingCommentsLineOffset);\n }\n if (oldTokenContext) this.tokenContext = oldTokenContext;\n\n // end\n this._currentNode = parent;\n this._currentTypeId = parentId;\n if (changedFlags) {\n this._flags = flags;\n }\n if (flags & PRINTER_FLAGS.AUX_COMMENTS) {\n this._insideAux = oldInAux!;\n }\n\n if (oldNoLineTerminatorAfterNode != null) {\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n }\n\n this._innerCommentsState = INNER_COMMENTS_STATE.DISALLOWED;\n }\n\n _maybeAddAuxComment(enteredPositionlessNode?: boolean) {\n if (enteredPositionlessNode) this._printAuxBeforeComment();\n if (!this._insideAux) this._printAuxAfterComment();\n }\n\n _printAuxBeforeComment() {\n if (this._printAuxAfterOnNextUserNode) return;\n this._printAuxAfterOnNextUserNode = true;\n\n const comment = this.format.auxiliaryCommentBefore;\n if (comment) {\n this._printComment(\n {\n type: \"CommentBlock\",\n value: comment,\n },\n COMMENT_SKIP_NEWLINE.DEFAULT,\n );\n }\n }\n\n _printAuxAfterComment() {\n if (!this._printAuxAfterOnNextUserNode) return;\n this._printAuxAfterOnNextUserNode = false;\n\n const comment = this.format.auxiliaryCommentAfter;\n if (comment) {\n this._printComment(\n {\n type: \"CommentBlock\",\n value: comment,\n },\n COMMENT_SKIP_NEWLINE.DEFAULT,\n );\n }\n }\n\n getPossibleRaw(\n node:\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral\n | t.DirectiveLiteral\n | t.JSXText,\n ): string | undefined {\n const extra = node.extra;\n if (\n extra?.raw != null &&\n extra.rawValue != null &&\n node.value === extra.rawValue\n ) {\n // @ts-expect-error: The extra.raw of these AST node types must be a string\n return extra.raw;\n }\n }\n\n printJoin(\n nodes: t.Node[] | undefined | null,\n statement?: boolean,\n indent?: boolean,\n separator?: PrintJoinOptions[\"separator\"] | null,\n printTrailingSeparator?: boolean | null,\n resetTokenContext?: boolean,\n trailingCommentsLineOffset?: number,\n ) {\n if (!nodes?.length) return;\n\n const flags = this._flags;\n\n if (indent == null && flags & PRINTER_FLAGS.RETAIN_LINES) {\n const startLine = nodes[0].loc?.start.line;\n if (startLine != null && startLine !== this._buf.getCurrentLine()) {\n indent = true;\n }\n }\n\n if (indent) this.indent(flags);\n\n const len = nodes.length;\n for (let i = 0; i < len; i++) {\n const node = nodes[i];\n if (!node) continue;\n\n // don't add newlines at the beginning of the file\n if (statement && i === 0 && this._buf.hasContent()) {\n this.newline(1, flags);\n }\n\n this.print(\n node,\n false,\n resetTokenContext,\n trailingCommentsLineOffset || 0,\n );\n\n if (separator != null) {\n if (i < len - 1) separator.call(this, i, false);\n else if (printTrailingSeparator) separator.call(this, i, true);\n }\n\n if (statement) {\n if (i + 1 === len) {\n this.newline(1, flags);\n } else {\n const lastCommentLine = this._lastCommentLine;\n if (lastCommentLine > 0) {\n const offset =\n (nodes[i + 1].loc?.start.line || 0) - lastCommentLine;\n if (offset >= 0) {\n this.newline(offset || 1, flags);\n continue;\n }\n }\n\n this.newline(1, flags);\n }\n }\n }\n\n if (indent) this.dedent(flags);\n }\n\n printAndIndentOnComments(node: t.Node) {\n const indent = node.leadingComments && node.leadingComments.length > 0;\n if (indent) this.indent();\n this.print(node);\n if (indent) this.dedent();\n }\n\n printBlock(body: t.Statement) {\n if (body.type !== \"EmptyStatement\") {\n this.space();\n }\n\n this.print(body);\n }\n\n _printTrailingComments(\n node: t.Node,\n parent?: t.Node | null,\n lineOffset?: number,\n ) {\n const { innerComments, trailingComments } = node;\n // We print inner comments here, so that if for some reason they couldn't\n // be printed in earlier locations they are still printed *somewhere*,\n // even if at the end of the node.\n if (innerComments?.length) {\n this._printComments(\n COMMENT_TYPE.TRAILING,\n innerComments,\n node,\n parent,\n lineOffset,\n );\n }\n if (trailingComments?.length) {\n this._printComments(\n COMMENT_TYPE.TRAILING,\n trailingComments,\n node,\n parent,\n lineOffset,\n );\n } else {\n this._lastCommentLine = 0;\n }\n }\n\n _printLeadingComments(node: t.Node, parent: t.Node | null) {\n const comments = node.leadingComments;\n if (!comments?.length) return;\n this._printComments(COMMENT_TYPE.LEADING, comments, node, parent);\n }\n\n _maybePrintInnerComments(\n nextTokenStr: string | number,\n nextTokenOccurrenceCount?: number,\n ) {\n const state = this._innerCommentsState;\n switch (state & INNER_COMMENTS_STATE.MASK) {\n case INNER_COMMENTS_STATE.DISALLOWED:\n this._innerCommentsState =\n INNER_COMMENTS_STATE.ALLOWED | INNER_COMMENTS_STATE.WITH_INDENT;\n return;\n case INNER_COMMENTS_STATE.ALLOWED:\n this.printInnerComments(\n (state & INNER_COMMENTS_STATE.WITH_INDENT) > 0,\n this.tokenMap?.findMatching(\n this._currentNode!,\n nextTokenStr,\n nextTokenOccurrenceCount,\n ),\n );\n }\n }\n\n printInnerComments(indent = true, nextToken?: Token | null) {\n const node = this._currentNode!;\n const comments = node.innerComments;\n if (!comments?.length) {\n this._innerCommentsState = INNER_COMMENTS_STATE.PRINTED;\n return;\n }\n\n const hasSpace = this.endsWith(charCodes.space);\n if (indent) this.indent();\n\n switch (\n this._printComments(\n COMMENT_TYPE.INNER,\n comments,\n node,\n undefined,\n undefined,\n nextToken,\n )\n ) {\n case PRINT_COMMENTS_RESULT.PRINTED_ALL:\n this._innerCommentsState = INNER_COMMENTS_STATE.PRINTED;\n // falls through\n case PRINT_COMMENTS_RESULT.PRINTED_SOME:\n if (hasSpace) this.space();\n }\n\n if (indent) this.dedent();\n }\n\n noIndentInnerCommentsHere() {\n this._innerCommentsState &= ~INNER_COMMENTS_STATE.WITH_INDENT;\n }\n\n printSequence(\n nodes: t.Node[],\n indent?: boolean,\n resetTokenContext?: boolean,\n trailingCommentsLineOffset?: number,\n ) {\n this.printJoin(\n nodes,\n true,\n indent ?? false,\n undefined,\n undefined,\n resetTokenContext,\n trailingCommentsLineOffset,\n );\n }\n\n printList(\n items: t.Node[] | null | undefined,\n printTrailingSeparator?: boolean | null,\n statement?: boolean,\n indent?: boolean,\n separator?: PrintListOptions[\"separator\"],\n resetTokenContext?: boolean,\n ) {\n this.printJoin(\n items,\n statement,\n indent,\n separator ?? commaSeparator,\n printTrailingSeparator,\n resetTokenContext,\n );\n }\n\n shouldPrintTrailingComma(listEnd: string | number): boolean | null {\n if (!this.tokenMap) return null;\n\n const listEndIndex = this.tokenMap.findLastIndex(\n this._currentNode!,\n token =>\n this.tokenMap!.matchesOriginal(\n token,\n typeof listEnd === \"number\" ? String.fromCharCode(listEnd) : listEnd,\n ),\n );\n if (listEndIndex <= 0) return null;\n return this.tokenMap.matchesOriginal(this._tokens![listEndIndex - 1], \",\");\n }\n\n // Returns `PRINT_COMMENT_HINT.DEFER` if the comment cannot be printed in this position due to\n // line terminators, signaling that the print comments loop can stop and\n // resume printing comments at the next possible position. This happens when\n // printing inner comments, since if we have an inner comment with a multiline\n // there is at least one inner position where line terminators are allowed.\n _shouldPrintComment(\n comment: t.Comment,\n nextToken?: Token | null,\n ): PRINT_COMMENT_HINT {\n // Some plugins (such as flow-strip-types) use this to mark comments as removed using the AST-root 'comments' property,\n // where they can't manually mutate the AST node comment lists.\n if (comment.ignore) return PRINT_COMMENT_HINT.SKIP;\n\n if (this._printedComments.has(comment)) return PRINT_COMMENT_HINT.SKIP;\n\n if (\n this._noLineTerminator &&\n HAS_NEWLINE_OR_BlOCK_COMMENT_END.test(comment.value)\n ) {\n return PRINT_COMMENT_HINT.DEFER;\n }\n\n if (nextToken && this.tokenMap) {\n const commentTok = this.tokenMap.find(\n this._currentNode!,\n token => token.value === comment.value,\n );\n if (commentTok && commentTok.start > nextToken.start) {\n return PRINT_COMMENT_HINT.DEFER;\n }\n }\n\n this._printedComments.add(comment);\n\n if (!this.format.shouldPrintComment(comment.value)) {\n return PRINT_COMMENT_HINT.SKIP;\n }\n\n return PRINT_COMMENT_HINT.ALLOW;\n }\n\n _printComment(comment: t.Comment, skipNewLines: COMMENT_SKIP_NEWLINE) {\n const noLineTerminator = this._noLineTerminator;\n const isBlockComment = comment.type === \"CommentBlock\";\n\n // Add a newline before and after a block comment, unless explicitly\n // disallowed\n const printNewLines =\n isBlockComment &&\n skipNewLines !== COMMENT_SKIP_NEWLINE.ALL &&\n !noLineTerminator;\n\n if (\n printNewLines &&\n this._buf.hasContent() &&\n skipNewLines !== COMMENT_SKIP_NEWLINE.LEADING\n ) {\n this.newline(1);\n }\n\n switch (this.getLastChar(true)) {\n // Avoid converting a / operator into a line comment by appending /* to it\n case charCodes.slash:\n this._space();\n // falls through\n case charCodes.leftSquareBracket:\n case charCodes.leftCurlyBrace:\n case charCodes.leftParenthesis:\n break;\n\n default:\n this.space();\n }\n\n let val;\n if (isBlockComment) {\n val = `/*${comment.value}*/`;\n if (this.format.indent.adjustMultilineComment) {\n const offset = comment.loc?.start.column;\n if (offset) {\n const newlineRegex = new RegExp(\"\\\\n\\\\s{1,\" + offset + \"}\", \"g\");\n val = val.replace(newlineRegex, \"\\n\");\n }\n if (this._flags & PRINTER_FLAGS.CONCISE) {\n val = val.replace(/\\n(?!$)/g, `\\n`);\n } else {\n let indentSize = this.format.retainLines\n ? 0\n : this._buf.getCurrentColumn();\n\n if (this._shouldIndent() || this.format.retainLines) {\n indentSize += this._indent;\n }\n\n val = val.replace(/\\n(?!$)/g, `\\n${\" \".repeat(indentSize)}`);\n }\n }\n } else if (!noLineTerminator) {\n val = `//${comment.value}`;\n } else {\n // It was a single-line comment, so it's guaranteed to not\n // contain newlines and it can be safely printed as a block\n // comment.\n val = `/*${comment.value}*/`;\n }\n\n this.source(\"start\", comment.loc);\n this._append(val, isBlockComment);\n\n if (!isBlockComment && !noLineTerminator) {\n this._newline();\n }\n\n if (printNewLines && skipNewLines !== COMMENT_SKIP_NEWLINE.TRAILING) {\n this.newline(1);\n }\n }\n\n _printComments(\n type: COMMENT_TYPE,\n comments: t.Comment[],\n node: t.Node,\n parent?: t.Node | null,\n lineOffset: number = 0,\n nextToken?: Token | null,\n ): PRINT_COMMENTS_RESULT {\n const nodeLoc = node.loc;\n const len = comments.length;\n let hasLoc = !!nodeLoc;\n const nodeStartLine = hasLoc ? nodeLoc!.start.line : 0;\n const nodeEndLine = hasLoc ? nodeLoc!.end.line : 0;\n let lastLine = 0;\n let leadingCommentNewline = 0;\n\n const { _noLineTerminator, _flags } = this;\n\n for (let i = 0; i < len; i++) {\n const comment = comments[i];\n\n const shouldPrint = this._shouldPrintComment(comment, nextToken);\n if (shouldPrint === PRINT_COMMENT_HINT.DEFER) {\n return i === 0\n ? PRINT_COMMENTS_RESULT.PRINTED_NONE\n : PRINT_COMMENTS_RESULT.PRINTED_SOME;\n }\n if (hasLoc && comment.loc && shouldPrint === PRINT_COMMENT_HINT.ALLOW) {\n const commentStartLine = comment.loc.start.line;\n const commentEndLine = comment.loc.end.line;\n if (type === COMMENT_TYPE.LEADING) {\n let offset = 0;\n if (i === 0) {\n // Because currently we cannot handle blank lines before leading comments,\n // we always wrap before and after multi-line comments.\n if (\n this._buf.hasContent() &&\n (comment.type === \"CommentLine\" ||\n commentStartLine !== commentEndLine)\n ) {\n offset = leadingCommentNewline = 1;\n }\n } else {\n offset = commentStartLine - lastLine;\n }\n lastLine = commentEndLine;\n\n if (offset > 0 && !_noLineTerminator) {\n this.newline(offset, _flags);\n }\n this._printComment(comment, COMMENT_SKIP_NEWLINE.ALL);\n\n if (i + 1 === len) {\n const count = Math.max(\n nodeStartLine - lastLine,\n leadingCommentNewline,\n );\n if (count > 0 && !_noLineTerminator) {\n this.newline(count, _flags);\n }\n lastLine = nodeStartLine;\n }\n } else if (type === COMMENT_TYPE.INNER) {\n const offset =\n commentStartLine - (i === 0 ? nodeStartLine : lastLine);\n lastLine = commentEndLine;\n\n if (offset > 0 && !_noLineTerminator) {\n this.newline(offset, _flags);\n }\n this._printComment(comment, COMMENT_SKIP_NEWLINE.ALL);\n\n if (i + 1 === len) {\n const count = Math.min(1, nodeEndLine - lastLine);\n if (count > 0 && !_noLineTerminator) {\n this.newline(count, _flags);\n }\n lastLine = nodeEndLine;\n }\n } else {\n const offset =\n commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);\n lastLine = commentEndLine;\n\n if (offset > 0 && !_noLineTerminator) {\n this.newline(offset, _flags);\n }\n this._printComment(comment, COMMENT_SKIP_NEWLINE.ALL);\n }\n } else {\n hasLoc = false;\n if (shouldPrint !== PRINT_COMMENT_HINT.ALLOW) {\n continue;\n }\n\n if (len === 1) {\n const singleLine = comment.loc\n ? comment.loc.start.line === comment.loc.end.line\n : !HAS_NEWLINE.test(comment.value);\n\n const shouldSkipNewline =\n singleLine &&\n !isStatement(node) &&\n !isClassBody(parent) &&\n !isTSInterfaceBody(parent) &&\n !isTSEnumMember(node);\n\n if (type === COMMENT_TYPE.LEADING) {\n this._printComment(\n comment,\n (shouldSkipNewline && node.type !== \"ObjectExpression\") ||\n (singleLine && isFunction(parent) && parent.body === node)\n ? COMMENT_SKIP_NEWLINE.ALL\n : COMMENT_SKIP_NEWLINE.DEFAULT,\n );\n } else if (shouldSkipNewline && type === COMMENT_TYPE.TRAILING) {\n this._printComment(comment, COMMENT_SKIP_NEWLINE.ALL);\n } else {\n this._printComment(comment, COMMENT_SKIP_NEWLINE.DEFAULT);\n }\n } else if (\n type === COMMENT_TYPE.INNER &&\n !(node.type === \"ObjectExpression\" && node.properties.length > 1) &&\n node.type !== \"ClassBody\" &&\n node.type !== \"TSInterfaceBody\"\n ) {\n // class X {\n // /*:: a: number*/\n // /*:: b: ?string*/\n // }\n\n this._printComment(\n comment,\n i === 0\n ? COMMENT_SKIP_NEWLINE.LEADING\n : i === len - 1\n ? COMMENT_SKIP_NEWLINE.TRAILING\n : COMMENT_SKIP_NEWLINE.DEFAULT,\n );\n } else {\n this._printComment(comment, COMMENT_SKIP_NEWLINE.DEFAULT);\n }\n }\n }\n\n if (type === COMMENT_TYPE.TRAILING && hasLoc && lastLine) {\n this._lastCommentLine = lastLine;\n }\n return PRINT_COMMENTS_RESULT.PRINTED_ALL;\n }\n}\n\nexport default Printer;\n\nfunction commaSeparator(this: Printer, occurrenceCount: number, last: boolean) {\n this.tokenChar(charCodes.comma, occurrenceCount);\n if (!last) this.space();\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,EAAA,GAAAH,OAAA;AAUA,IAAAI,SAAA,GAAAJ,OAAA;AAqBA,IAAAK,OAAA,GAAAL,OAAA;AAA0D;EA9BxDM,YAAY;EACZC,UAAU;EACVC,WAAW;EACXC,WAAW;EACXC,iBAAiB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CAAC,QAGnB,CAAC;QACH,CAAC,MAAM;UACL,IAAI,CAACX,aAAa,CAACD,OAAO,GAA8B,CAAC;QAC3D;MACF;IACF;IAEA,IAAIlL,IAAI,MAA0B,IAAIgP,MAAM,IAAIG,QAAQ,EAAE;MACxD,IAAI,CAAC3N,gBAAgB,GAAG2N,QAAQ;IAClC;IACA;EACF;AACF;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7P,OAAO;AAEtB,SAASmN,cAAcA,CAAgBvH,eAAuB,EAAEkK,IAAa,EAAE;EAC7E,IAAI,CAAC/J,SAAS,KAAkBH,eAAe,CAAC;EAChD,IAAI,CAACkK,IAAI,EAAE,IAAI,CAACtL,KAAK,CAAC,CAAC;AACzB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/source-map.js b/node_modules/@babel/generator/lib/source-map.js new file mode 100644 index 0000000..34211c0 --- /dev/null +++ b/node_modules/@babel/generator/lib/source-map.js @@ -0,0 +1,86 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _genMapping = require("@jridgewell/gen-mapping"); +var _traceMapping = require("@jridgewell/trace-mapping"); +class SourceMap { + constructor(opts, code) { + var _opts$sourceFileName; + this._map = void 0; + this._rawMappings = void 0; + this._sourceFileName = void 0; + this._lastGenLine = 0; + this._lastSourceLine = 0; + this._lastSourceColumn = 0; + this._inputMap = null; + const map = this._map = new _genMapping.GenMapping({ + sourceRoot: opts.sourceRoot + }); + this._sourceFileName = (_opts$sourceFileName = opts.sourceFileName) == null ? void 0 : _opts$sourceFileName.replace(/\\/g, "/"); + this._rawMappings = undefined; + if (opts.inputSourceMap) { + this._inputMap = new _traceMapping.TraceMap(opts.inputSourceMap); + const resolvedSources = this._inputMap.resolvedSources; + if (resolvedSources.length) { + for (let i = 0; i < resolvedSources.length; i++) { + var _this$_inputMap$sourc; + (0, _genMapping.setSourceContent)(map, resolvedSources[i], (_this$_inputMap$sourc = this._inputMap.sourcesContent) == null ? void 0 : _this$_inputMap$sourc[i]); + } + } + } + if (typeof code === "string" && !opts.inputSourceMap) { + (0, _genMapping.setSourceContent)(map, this._sourceFileName, code); + } else if (typeof code === "object") { + for (const sourceFileName of Object.keys(code)) { + (0, _genMapping.setSourceContent)(map, sourceFileName.replace(/\\/g, "/"), code[sourceFileName]); + } + } + } + get() { + return (0, _genMapping.toEncodedMap)(this._map); + } + getDecoded() { + return (0, _genMapping.toDecodedMap)(this._map); + } + getRawMappings() { + return this._rawMappings || (this._rawMappings = (0, _genMapping.allMappings)(this._map)); + } + mark(generated, line, column, identifierName, identifierNamePos, filename) { + var _originalMapping; + this._rawMappings = undefined; + let originalMapping; + if (line != null) { + if (this._inputMap) { + originalMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, { + line, + column: column + }); + if (!originalMapping.name && identifierNamePos) { + const originalIdentifierMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, identifierNamePos); + if (originalIdentifierMapping.name) { + identifierName = originalIdentifierMapping.name; + } + } + } else { + originalMapping = { + name: null, + source: (filename == null ? void 0 : filename.replace(/\\/g, "/")) || this._sourceFileName, + line: line, + column: column + }; + } + } + (0, _genMapping.maybeAddMapping)(this._map, { + name: identifierName, + generated, + source: (_originalMapping = originalMapping) == null ? void 0 : _originalMapping.source, + original: originalMapping + }); + } +} +exports.default = SourceMap; + +//# sourceMappingURL=source-map.js.map diff --git a/node_modules/@babel/generator/lib/source-map.js.map b/node_modules/@babel/generator/lib/source-map.js.map new file mode 100644 index 0000000..e2cb614 --- /dev/null +++ b/node_modules/@babel/generator/lib/source-map.js.map @@ -0,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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AAI;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":[]}
\ No newline at end of file diff --git a/node_modules/@babel/generator/lib/token-map.js b/node_modules/@babel/generator/lib/token-map.js new file mode 100644 index 0000000..fde7684 --- /dev/null +++ b/node_modules/@babel/generator/lib/token-map.js @@ -0,0 +1,195 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TokenMap = void 0; +var _t = require("@babel/types"); +const { + traverseFast, + VISITOR_KEYS +} = _t; +class TokenMap { + constructor(ast, tokens, source) { + this._tokens = void 0; + this._source = void 0; + this._nodesToTokenIndexes = new Map(); + this._nodesOccurrencesCountCache = new Map(); + this._tokensCache = new Map(); + this._tokens = tokens; + this._source = source; + traverseFast(ast, node => { + const indexes = this._getTokensIndexesOfNode(node); + if (indexes.length > 0) this._nodesToTokenIndexes.set(node, indexes); + }); + this._tokensCache.clear(); + } + has(node) { + return this._nodesToTokenIndexes.has(node); + } + getIndexes(node) { + return this._nodesToTokenIndexes.get(node); + } + find(node, condition) { + const indexes = this._nodesToTokenIndexes.get(node); + if (indexes) { + for (let k = 0; k < indexes.length; k++) { + const index = indexes[k]; + const tok = this._tokens[index]; + if (condition(tok, index)) return tok; + } + } + return null; + } + findLastIndex(node, condition) { + const indexes = this._nodesToTokenIndexes.get(node); + if (indexes) { + for (let k = indexes.length - 1; k >= 0; k--) { + const index = indexes[k]; + const tok = this._tokens[index]; + if (condition(tok, index)) return index; + } + } + return -1; + } + findMatching(node, test, occurrenceCount = 0) { + const indexes = this._nodesToTokenIndexes.get(node); + if (indexes) { + if (typeof test === "number") { + test = String.fromCharCode(test); + } + let i = 0; + const count = occurrenceCount; + if (count > 1) { + const cache = this._nodesOccurrencesCountCache.get(node); + if ((cache == null ? void 0 : cache.test) === test && cache.count < count) { + i = cache.i + 1; + occurrenceCount -= cache.count + 1; + } + } + for (; i < indexes.length; i++) { + const tok = this._tokens[indexes[i]]; + if (this.matchesOriginal(tok, test)) { + if (occurrenceCount === 0) { + if (count > 0) { + this._nodesOccurrencesCountCache.set(node, { + test, + count, + i + }); + } + return tok; + } + occurrenceCount--; + } + } + } + return null; + } + matchesOriginal(token, test) { + if (token.end - token.start !== test.length) return false; + if (token.value != null) return token.value === test; + return this._source.startsWith(test, token.start); + } + startMatches(node, test) { + const indexes = this._nodesToTokenIndexes.get(node); + if (!indexes) return false; + const tok = this._tokens[indexes[0]]; + if (tok.start !== node.start) return false; + return this.matchesOriginal(tok, test); + } + endMatches(node, test) { + const indexes = this._nodesToTokenIndexes.get(node); + if (!indexes) return false; + const tok = this._tokens[indexes[indexes.length - 1]]; + if (tok.end !== node.end) return false; + return this.matchesOriginal(tok, test); + } + _getTokensIndexesOfNode(node) { + var _node$declaration; + if (node.start == null || node.end == null) return []; + const { + first, + last + } = this._findTokensOfNode(node, 0, this._tokens.length - 1); + let low = first; + const children = childrenIterator(node); + if ((node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") && ((_node$declaration = node.declaration) == null ? void 0 : _node$declaration.type) === "ClassDeclaration") { + children.next(); + } + const indexes = []; + for (const child of children) { + if (child == null) continue; + if (child.start == null || child.end == null) continue; + const childTok = this._findTokensOfNode(child, low, last); + const high = childTok.first; + for (let k = low; k < high; k++) indexes.push(k); + low = childTok.last + 1; + } + for (let k = low; k <= last; k++) indexes.push(k); + return indexes; + } + _findTokensOfNode(node, low, high) { + const cached = this._tokensCache.get(node); + if (cached) return cached; + const first = this._findFirstTokenOfNode(node.start, low, high); + const last = this._findLastTokenOfNode(node.end, first, high); + this._tokensCache.set(node, { + first, + last + }); + return { + first, + last + }; + } + _findFirstTokenOfNode(start, low, high) { + while (low <= high) { + const mid = high + low >> 1; + if (start < this._tokens[mid].start) { + high = mid - 1; + } else if (start > this._tokens[mid].start) { + low = mid + 1; + } else { + return mid; + } + } + return low; + } + _findLastTokenOfNode(end, low, high) { + while (low <= high) { + const mid = high + low >> 1; + if (end < this._tokens[mid].end) { + high = mid - 1; + } else if (end > this._tokens[mid].end) { + low = mid + 1; + } else { + return mid; + } + } + return high; + } +} +exports.TokenMap = TokenMap; +function* childrenIterator(node) { + if (node.type === "TemplateLiteral") { + yield node.quasis[0]; + for (let i = 1; i < node.quasis.length; i++) { + yield node.expressions[i - 1]; + yield node.quasis[i]; + } + return; + } + const keys = VISITOR_KEYS[node.type]; + for (const key of keys) { + const child = node[key]; + if (!child) continue; + if (Array.isArray(child)) { + yield* child; + } else { + yield child; + } + } +} + +//# sourceMappingURL=token-map.js.map diff --git a/node_modules/@babel/generator/lib/token-map.js.map b/node_modules/@babel/generator/lib/token-map.js.map new file mode 100644 index 0000000..ae00a1e --- /dev/null +++ b/node_modules/@babel/generator/lib/token-map.js.map @@ -0,0 +1 @@ +{"version":3,"names":["_t","require","traverseFast","VISITOR_KEYS","TokenMap","constructor","ast","tokens","source","_tokens","_source","_nodesToTokenIndexes","Map","_nodesOccurrencesCountCache","_tokensCache","node","indexes","_getTokensIndexesOfNode","length","set","clear","has","getIndexes","get","find","condition","k","index","tok","findLastIndex","findMatching","test","occurrenceCount","String","fromCharCode","i","count","cache","matchesOriginal","token","end","start","value","startsWith","startMatches","endMatches","_node$declaration","first","last","_findTokensOfNode","low","children","childrenIterator","type","declaration","next","child","childTok","high","push","cached","_findFirstTokenOfNode","_findLastTokenOfNode","mid","exports","quasis","expressions","keys","key","Array","isArray"],"sources":["../src/token-map.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\nimport type { Token } from \"@babel/parser\";\n\nimport { traverseFast, VISITOR_KEYS } from \"@babel/types\";\n\nexport class TokenMap {\n _tokens: Token[];\n _source: string;\n\n _nodesToTokenIndexes = new Map<t.Node, number[]>();\n _nodesOccurrencesCountCache = new Map<\n t.Node,\n { test: string; count: number; i: number }\n >();\n\n _tokensCache = new Map<t.Node, { first: number; last: number }>();\n\n constructor(ast: t.Node, tokens: Token[], source: string) {\n this._tokens = tokens;\n this._source = source;\n\n traverseFast(ast, node => {\n const indexes = this._getTokensIndexesOfNode(node);\n if (indexes.length > 0) this._nodesToTokenIndexes.set(node, indexes);\n });\n\n this._tokensCache.clear();\n }\n\n has(node: t.Node): boolean {\n return this._nodesToTokenIndexes.has(node);\n }\n\n getIndexes(node: t.Node): readonly number[] | undefined {\n return this._nodesToTokenIndexes.get(node);\n }\n\n find(\n node: t.Node,\n condition: (token: Token, index: number) => boolean,\n ): Token | null {\n const indexes = this._nodesToTokenIndexes.get(node);\n if (indexes) {\n for (let k = 0; k < indexes.length; k++) {\n const index = indexes[k];\n const tok = this._tokens[index];\n if (condition(tok, index)) return tok;\n }\n }\n return null;\n }\n\n findLastIndex(\n node: t.Node,\n condition: (token: Token, index: number) => boolean,\n ): number {\n const indexes = this._nodesToTokenIndexes.get(node);\n if (indexes) {\n for (let k = indexes.length - 1; k >= 0; k--) {\n const index = indexes[k];\n const tok = this._tokens[index];\n if (condition(tok, index)) return index;\n }\n }\n return -1;\n }\n\n findMatching(\n node: t.Node,\n test: string | number,\n occurrenceCount: number = 0,\n ): Token | null {\n const indexes = this._nodesToTokenIndexes.get(node);\n if (indexes) {\n if (typeof test === \"number\") {\n test = String.fromCharCode(test);\n }\n let i = 0;\n const count = occurrenceCount;\n\n // To avoid O(n^2) search when printing lists (such as arrays), we\n // cache the last index of a given token for a given occurrence count.\n // If then we are asked to find the next occurrence of the same token,\n // we start from the index of the previously found token.\n // This cache only kicks in after 2 tokens of the same type, to avoid\n // overhead in the simple case of having unique tokens per node.\n if (count > 1) {\n const cache = this._nodesOccurrencesCountCache.get(node);\n if (cache?.test === test && cache.count < count) {\n i = cache.i + 1;\n occurrenceCount -= cache.count + 1;\n }\n }\n\n for (; i < indexes.length; i++) {\n const tok = this._tokens[indexes[i]];\n if (this.matchesOriginal(tok, test)) {\n if (occurrenceCount === 0) {\n if (count > 0) {\n this._nodesOccurrencesCountCache.set(node, { test, count, i });\n }\n return tok;\n }\n occurrenceCount--;\n }\n }\n }\n return null;\n }\n\n matchesOriginal(token: Token, test: string) {\n if (token.end - token.start !== test.length) return false;\n if (token.value != null) return token.value === test;\n return this._source.startsWith(test, token.start);\n }\n\n startMatches(node: t.Node, test: string): boolean {\n const indexes = this._nodesToTokenIndexes.get(node);\n if (!indexes) return false;\n const tok = this._tokens[indexes[0]];\n if (tok.start !== node.start) return false;\n return this.matchesOriginal(tok, test);\n }\n\n endMatches(node: t.Node, test: string): boolean {\n const indexes = this._nodesToTokenIndexes.get(node);\n if (!indexes) return false;\n const tok = this._tokens[indexes[indexes.length - 1]];\n if (tok.end !== node.end) return false;\n return this.matchesOriginal(tok, test);\n }\n\n _getTokensIndexesOfNode(node: t.Node): number[] {\n if (node.start == null || node.end == null) return [];\n\n const { first, last } = this._findTokensOfNode(\n node,\n 0,\n this._tokens.length - 1,\n );\n\n let low = first;\n\n const children = childrenIterator(node);\n\n if (\n (node.type === \"ExportNamedDeclaration\" ||\n node.type === \"ExportDefaultDeclaration\") &&\n node.declaration?.type === \"ClassDeclaration\"\n ) {\n // Exported class declarations can be not properly nested inside\n // the export declaration that contains them. For example, in\n // `@dec export class Foo {}` the `export` is covered by the\n // ClassDeclaration range. Skip the class declaration from the list\n // of children to skip, so that when looking for `export` we also\n // traverse its tokens.\n children.next();\n }\n\n const indexes = [];\n\n for (const child of children) {\n if (child == null) continue;\n if (child.start == null || child.end == null) continue;\n\n const childTok = this._findTokensOfNode(child, low, last);\n\n const high = childTok.first;\n for (let k = low; k < high; k++) indexes.push(k);\n\n low = childTok.last + 1;\n }\n\n for (let k = low; k <= last; k++) indexes.push(k);\n\n return indexes;\n }\n\n _findTokensOfNode(node: t.Node, low: number, high: number) {\n const cached = this._tokensCache.get(node);\n if (cached) return cached;\n\n const first = this._findFirstTokenOfNode(node.start!, low, high);\n const last = this._findLastTokenOfNode(node.end!, first, high);\n\n this._tokensCache.set(node, { first, last });\n return { first, last };\n }\n\n _findFirstTokenOfNode(start: number, low: number, high: number): number {\n while (low <= high) {\n const mid = (high + low) >> 1;\n if (start < this._tokens[mid].start) {\n high = mid - 1;\n } else if (start > this._tokens[mid].start) {\n low = mid + 1;\n } else {\n return mid;\n }\n }\n return low;\n }\n\n _findLastTokenOfNode(end: number, low: number, high: number): number {\n while (low <= high) {\n const mid = (high + low) >> 1;\n if (end < this._tokens[mid].end) {\n high = mid - 1;\n } else if (end > this._tokens[mid].end) {\n low = mid + 1;\n } else {\n return mid;\n }\n }\n return high;\n }\n}\n\nfunction* childrenIterator(node: t.Node) {\n // We need special handling to iterate TemplateLiteral\n // children in order, since the two lists are interleaved.\n if (node.type === \"TemplateLiteral\") {\n yield node.quasis[0];\n for (let i = 1; i < node.quasis.length; i++) {\n yield node.expressions[i - 1];\n yield node.quasis[i];\n }\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n for (const key of keys) {\n const child = (node as any)[key];\n if (!child) continue;\n if (Array.isArray(child)) {\n yield* child;\n } else {\n yield child;\n }\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,EAAA,GAAAC,OAAA;AAA0D;EAAjDC,YAAY;EAAEC;AAAY,IAAAH,EAAA;AAE5B,MAAMI,QAAQ,CAAC;EAYpBC,WAAWA,CAACC,GAAW,EAAEC,MAAe,EAAEC,MAAc,EAAE;IAAA,KAX1DC,OAAO;IAAA,KACPC,OAAO;IAAA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