hexo/node_modules/@babel/generator/lib/generators/base.js.map

1 line
6.4 KiB
Plaintext
Raw Normal View History

2023-09-25 15:58:56 +08:00
{"version":3,"names":["File","node","program","print","interpreter","Program","_node$directives","noIndentInnerCommentsHere","printInnerComments","directivesLen","directives","length","_node$directives$trai","newline","body","printSequence","trailingCommentsLineOffset","trailingComments","BlockStatement","_node$directives2","token","_node$directives$trai2","indent","sourceWithOffset","loc","rightBrace","Directive","value","semicolon","unescapedSingleQuoteRE","unescapedDoubleQuoteRE","DirectiveLiteral","raw","getPossibleRaw","format","minified","undefined","test","Error","InterpreterDirective","Placeholder","name","expectedNode"],"sources":["../../src/generators/base.ts"],"sourcesContent":["import type Printer from \"../printer\";\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, node);\n }\n\n this.print(node.program, node);\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.noIndentInnerCommentsHere();\n this.printInnerComments();\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node);\n}\n\nexport function BlockStatement(this: Printer, node: t.BlockStatement) {\n this.token(\"{\");\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n indent: true,\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node, { indent: true });\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.rightBrace();\n}\n\nexport function Directive(this: Printer, node: t.Directive) {\n this.print(node.value, node);\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(1, true);\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,EAAEH,IAAI,CAAC;EAC5C;EAEA,IAAI,CAACE,KAAK,CAACF,IAAI,CAACC,OAAO,EAAED,IAAI,CAAC;AAChC;AAEO,SAASI,OAAOA,CAAgBJ,IAAe,EAAE;EAAA,IAAAK,gBAAA;EAGtD,IAAI,CAACC,yBAAyB,EAAE;EAChC,IAAI,CAACC,kBAAkB,E