source: frontend/node_modules/@babel/generator/lib/generators/base.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.7 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.BlockStatement = BlockStatement;
7exports.Directive = Directive;
8exports.DirectiveLiteral = DirectiveLiteral;
9exports.File = File;
10exports.InterpreterDirective = InterpreterDirective;
11exports.Placeholder = Placeholder;
12exports.Program = Program;
13function File(node) {
14 if (node.program) {
15 this.print(node.program.interpreter);
16 }
17 this.print(node.program);
18}
19function Program(node) {
20 var _node$directives;
21 this.printInnerComments(false);
22 const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
23 if (directivesLen) {
24 var _node$directives$trai;
25 const newline = node.body.length ? 2 : 1;
26 this.printSequence(node.directives, undefined, undefined, newline);
27 if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
28 this.newline(newline);
29 }
30 }
31 this.printSequence(node.body);
32}
33function BlockStatement(node) {
34 var _node$directives2;
35 this.tokenChar(123);
36 const oldNoLineTerminatorAfterNode = this.enterDelimited();
37 const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
38 if (directivesLen) {
39 var _node$directives$trai2;
40 const newline = node.body.length ? 2 : 1;
41 this.printSequence(node.directives, true, true, newline);
42 if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
43 this.newline(newline);
44 }
45 }
46 this.printSequence(node.body, true, true);
47 this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
48 this.rightBrace(node);
49}
50function Directive(node) {
51 this.print(node.value);
52 this.semicolon();
53}
54const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
55const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
56function DirectiveLiteral(node) {
57 const raw = this.getPossibleRaw(node);
58 if (!this.format.minified && raw !== undefined) {
59 this.token(raw);
60 return;
61 }
62 const {
63 value
64 } = node;
65 if (!unescapedDoubleQuoteRE.test(value)) {
66 this.token(`"${value}"`);
67 } else if (!unescapedSingleQuoteRE.test(value)) {
68 this.token(`'${value}'`);
69 } else {
70 throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
71 }
72}
73function InterpreterDirective(node) {
74 this.token(`#!${node.value}`);
75 this._newline();
76}
77function Placeholder(node) {
78 this.token("%%");
79 this.print(node.name);
80 this.token("%%");
81 if (node.expectedNode === "Statement") {
82 this.semicolon();
83 }
84}
85
86//# sourceMappingURL=base.js.map
Note: See TracBrowser for help on using the repository browser.