Update npm packages (73 packages including @jqhtml 2.3.36)

Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-02-20 11:31:28 +00:00
parent d01a6179aa
commit b5eb27a827
1690 changed files with 47348 additions and 16848 deletions

View File

@@ -18,13 +18,12 @@ function File(node) {
}
function Program(node) {
var _node$directives;
this.noIndentInnerCommentsHere();
this.printInnerComments();
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, newline);
this.printSequence(node.directives, undefined, undefined, newline);
if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
this.newline(newline);
}
@@ -34,18 +33,18 @@ function Program(node) {
function BlockStatement(node) {
var _node$directives2;
this.tokenChar(123);
const exit = this.enterDelimited();
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, newline);
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);
exit();
this.printSequence(node.body, true, true);
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightBrace(node);
}
function Directive(node) {
@@ -73,7 +72,7 @@ function DirectiveLiteral(node) {
}
function InterpreterDirective(node) {
this.token(`#!${node.value}`);
this.newline(1, true);
this._newline();
}
function Placeholder(node) {
this.token("%%");

File diff suppressed because one or more lines are too long

View File

@@ -13,13 +13,17 @@ 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 || !this._shouldPrintDecoratorsBeforeExport(parent)) {
if (!inExport || !_expressions._shouldPrintDecoratorsBeforeExport.call(this, parent)) {
this.printJoin(node.decorators);
}
if (node.declare) {
@@ -57,12 +61,11 @@ function ClassBody(node) {
if (node.body.length === 0) {
this.tokenChar(125);
} else {
this.newline();
const separator = classBodyEmptySemicolonsPrinter(this, node);
separator == null || separator(-1);
const exit = this.enterDelimited();
this.printJoin(node.body, true, true, separator, true);
exit();
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);
}
@@ -90,7 +93,7 @@ function classBodyEmptySemicolonsPrinter(printer, node) {
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.token(";", undefined, occurrenceCount++);
printer.tokenChar(59, occurrenceCount++);
k++;
}
};
@@ -102,13 +105,13 @@ function ClassProperty(node) {
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);
}
this.tsPrintClassMemberModifiers(node);
_typescript._tsPrintClassMemberModifiers.call(this, node);
if (node.computed) {
this.tokenChar(91);
this.print(node.key);
this.tokenChar(93);
} else {
this._variance(node);
_flow._variance.call(this, node);
this.print(node.key);
}
if (node.optional) {
@@ -131,7 +134,7 @@ function ClassAccessorProperty(node) {
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);
this.tsPrintClassMemberModifiers(node);
_typescript._tsPrintClassMemberModifiers.call(this, node);
this.word("accessor", true);
this.space();
if (node.computed) {
@@ -139,7 +142,7 @@ function ClassAccessorProperty(node) {
this.print(node.key);
this.tokenChar(93);
} else {
this._variance(node);
_flow._variance.call(this, node);
this.print(node.key);
}
if (node.optional) {
@@ -159,7 +162,7 @@ function ClassAccessorProperty(node) {
}
function ClassPrivateProperty(node) {
this.printJoin(node.decorators);
this.tsPrintClassMemberModifiers(node);
_typescript._tsPrintClassMemberModifiers.call(this, node);
this.print(node.key);
if (node.optional) {
this.tokenChar(63);
@@ -177,12 +180,12 @@ function ClassPrivateProperty(node) {
this.semicolon();
}
function ClassMethod(node) {
this._classMethodHead(node);
_classMethodHead.call(this, node);
this.space();
this.print(node.body);
}
function ClassPrivateMethod(node) {
this._classMethodHead(node);
_classMethodHead.call(this, node);
this.space();
this.print(node.body);
}
@@ -193,8 +196,8 @@ function _classMethodHead(node) {
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);
}
this.tsPrintClassMemberModifiers(node);
this._methodHead(node);
_typescript._tsPrintClassMemberModifiers.call(this, node);
_methods._methodHead.call(this, node);
}
function StaticBlock(node) {
this.word("static");

File diff suppressed because one or more lines are too long

View File

@@ -3,72 +3,71 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addDeprecatedGenerators = addDeprecatedGenerators;
function addDeprecatedGenerators(PrinterClass) {
const deprecatedBabel7Generators = {
Noop() {},
TSExpressionWithTypeArguments(node) {
this.print(node.expression);
this.print(node.typeParameters);
},
DecimalLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw !== undefined) {
this.word(raw);
return;
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.word(node.value + "m");
},
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);
},
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);
}
};
Object.assign(PrinterClass.prototype, deprecatedBabel7Generators);
}
this.token(endToken);
}
//# sourceMappingURL=deprecated.js.map

File diff suppressed because one or more lines are too long

View File

@@ -3,9 +3,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression;
exports.LogicalExpression = exports.AssignmentExpression = AssignmentExpression;
exports.AssignmentPattern = AssignmentPattern;
exports.AwaitExpression = AwaitExpression;
exports.BinaryExpression = BinaryExpression;
exports.BindExpression = BindExpression;
exports.CallExpression = CallExpression;
exports.ConditionalExpression = ConditionalExpression;
@@ -43,11 +44,12 @@ function UnaryExpression(node) {
const {
operator
} = node;
if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") {
const firstChar = operator.charCodeAt(0);
if (firstChar >= 97 && firstChar <= 122) {
this.word(operator);
this.space();
} else {
this.token(operator);
this.tokenChar(firstChar);
}
this.print(node.argument);
}
@@ -62,18 +64,18 @@ function DoExpression(node) {
}
function ParenthesizedExpression(node) {
this.tokenChar(40);
const exit = this.enterDelimited();
this.print(node.expression);
exit();
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);
this.token(node.operator, false, 0, true);
this.print(node.argument);
} else {
this.print(node.argument, true);
this.token(node.operator);
this.token(node.operator, false, 0, true);
}
}
function ConditionalExpression(node) {
@@ -105,9 +107,9 @@ function NewExpression(node, parent) {
return;
}
this.tokenChar(40);
const exit = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
exit();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node);
}
function SequenceExpression(node) {
@@ -127,7 +129,10 @@ function _shouldPrintDecoratorsBeforeExport(node) {
}
function Decorator(node) {
this.tokenChar(64);
this.print(node.expression);
const {
expression
} = node;
this.print(expression);
this.newline();
}
function OptionalMemberExpression(node) {
@@ -167,9 +172,9 @@ function OptionalCallExpression(node) {
}
this.print(node.typeArguments);
this.tokenChar(40);
const exit = this.enterDelimited();
this.printList(node.arguments);
exit();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments, undefined, undefined, undefined, undefined, true);
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node);
}
function CallExpression(node) {
@@ -177,9 +182,9 @@ function CallExpression(node) {
this.print(node.typeArguments);
this.print(node.typeParameters);
this.tokenChar(40);
const exit = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
exit();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node);
}
function Import() {
@@ -228,11 +233,21 @@ function AssignmentPattern(node) {
function AssignmentExpression(node) {
this.print(node.left);
this.space();
if (node.operator === "in" || node.operator === "instanceof") {
this.word(node.operator);
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(node.operator);
this._endsWithDiv = node.operator === "/";
this.token(operator, false, 0, true);
this.setLastChar(operator.charCodeAt(operator.length - 1));
}
this.space();
this.print(node.right);
@@ -252,11 +267,11 @@ function MemberExpression(node) {
computed = true;
}
if (computed) {
const exit = this.enterDelimited();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.tokenChar(91);
this.print(node.property);
this.print(node.property, undefined, true);
this.tokenChar(93);
exit();
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
} else {
this.tokenChar(46);
this.print(node.property);

File diff suppressed because one or more lines are too long

View File

@@ -109,7 +109,7 @@ function DeclareClass(node, parent) {
}
this.word("class");
this.space();
this._interfaceish(node);
_interfaceish.call(this, node);
}
function DeclareFunction(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
@@ -140,7 +140,7 @@ function DeclaredPredicate(node) {
function DeclareInterface(node) {
this.word("declare");
this.space();
this.InterfaceDeclaration(node);
InterfaceDeclaration.call(this, node);
}
function DeclareModule(node) {
this.word("declare");
@@ -162,14 +162,14 @@ function DeclareModuleExports(node) {
function DeclareTypeAlias(node) {
this.word("declare");
this.space();
this.TypeAlias(node);
TypeAlias.call(this, node);
}
function DeclareOpaqueType(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.OpaqueType(node);
OpaqueType.call(this, node);
}
function DeclareVariable(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
@@ -397,7 +397,7 @@ function _variance(node) {
function InterfaceDeclaration(node) {
this.word("interface");
this.space();
this._interfaceish(node);
_interfaceish.call(this, node);
}
function andSeparator(occurrenceCount) {
this.space();
@@ -475,7 +475,7 @@ function TypeParameterInstantiation(node) {
this.tokenChar(62);
}
function TypeParameter(node) {
this._variance(node);
_variance.call(this, node);
this.word(node.name);
if (node.bound) {
this.print(node.bound);
@@ -517,12 +517,12 @@ function ObjectTypeAnnotation(node) {
if (props.length) {
this.newline();
this.space();
this.printJoin(props, true, true, undefined, undefined, () => {
this.printJoin(props, true, true, () => {
if (props.length !== 1 || node.inexact) {
this.tokenChar(44);
this.space();
}
});
}, true);
this.space();
}
if (node.inexact) {
@@ -568,7 +568,7 @@ function ObjectTypeIndexer(node) {
this.word("static");
this.space();
}
this._variance(node);
_variance.call(this, node);
this.tokenChar(91);
if (node.id) {
this.print(node.id);
@@ -594,7 +594,7 @@ function ObjectTypeProperty(node) {
this.word(node.kind);
this.space();
}
this._variance(node);
_variance.call(this, node);
this.print(node.key);
if (node.optional) this.tokenChar(63);
if (!node.method) {

File diff suppressed because one or more lines are too long

View File

@@ -17,39 +17,40 @@ var _index = require("../node/index.js");
const {
isIdentifier
} = _t;
function _params(node, idNode, parentNode) {
function _params(node, noLineTerminator, idNode, parentNode) {
this.print(node.typeParameters);
const nameInfo = _getFuncIdName.call(this, idNode, parentNode);
if (nameInfo) {
this.sourceIdentifierName(nameInfo.name, nameInfo.pos);
if (idNode !== undefined || parentNode !== undefined) {
const nameInfo = _getFuncIdName.call(this, idNode, parentNode);
if (nameInfo) {
this.sourceIdentifierName(nameInfo.name, nameInfo.pos);
}
}
this.tokenChar(40);
this._parameters(node.params, ")");
const noLineTerminator = node.type === "ArrowFunctionExpression";
_parameters.call(this, node.params, 41);
this.print(node.returnType, noLineTerminator);
this._noLineTerminator = noLineTerminator;
}
function _parameters(parameters, endToken) {
const exit = this.enterDelimited();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
const trailingComma = this.shouldPrintTrailingComma(endToken);
const paramLength = parameters.length;
for (let i = 0; i < paramLength; i++) {
this._param(parameters[i]);
_param.call(this, parameters[i]);
if (trailingComma || i < paramLength - 1) {
this.token(",", undefined, i);
this.tokenChar(44, i);
this.space();
}
}
this.token(endToken);
exit();
this.tokenChar(endToken);
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
}
function _param(parameter) {
this.printJoin(parameter.decorators);
this.print(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);
this.print(parameter.typeAnnotation, undefined, true);
}
function _methodHead(node) {
const kind = node.kind;
@@ -77,7 +78,11 @@ function _methodHead(node) {
if (node.optional) {
this.tokenChar(63);
}
this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key);
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) {
@@ -88,18 +93,18 @@ function _predicate(node, noLineTerminatorAfter) {
this.print(node.predicate, noLineTerminatorAfter);
}
}
function _functionHead(node, parent) {
function _functionHead(node, parent, hasPredicate) {
if (node.async) {
this.word("async");
if (!this.format.preserveFormat) {
this._endsWithInnerRaw = false;
this._innerCommentsState = 0;
}
this.space();
}
this.word("function");
if (node.generator) {
if (!this.format.preserveFormat) {
this._endsWithInnerRaw = false;
this._innerCommentsState = 0;
}
this.tokenChar(42);
}
@@ -107,13 +112,17 @@ function _functionHead(node, parent) {
if (node.id) {
this.print(node.id);
}
this._params(node, node.id, parent);
if (node.type !== "TSDeclareFunction") {
this._predicate(node);
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) {
this._functionHead(node, parent);
_functionHead.call(this, node, parent, true);
this.space();
this.print(node.body);
}
@@ -122,12 +131,12 @@ function ArrowFunctionExpression(node, parent) {
this.word("async", true);
this.space();
}
if (this._shouldPrintArrowParamsParens(node)) {
this._params(node, undefined, parent);
if (_shouldPrintArrowParamsParens.call(this, node)) {
_params.call(this, node, true, undefined, this._buf._map ? parent : undefined);
} else {
this.print(node.params[0], true);
}
this._predicate(node, true);
_predicate.call(this, node, true);
this.space();
this.printInnerComments();
this.token("=>");

File diff suppressed because one or more lines are too long

View File

@@ -18,6 +18,7 @@ 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,
@@ -116,14 +117,14 @@ function ExportAllDeclaration(node) {
if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) {
this.print(node.source, true);
this.space();
this._printAttributes(node, false);
_printAttributes.call(this, node, false);
} else {
this.print(node.source);
}
this.semicolon();
}
function maybePrintDecoratorsBeforeExport(printer, node) {
if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) {
if (isClassDeclaration(node.declaration) && _expressions._shouldPrintDecoratorsBeforeExport.call(printer, node)) {
printer.printJoin(node.declaration.decorators);
}
}
@@ -174,7 +175,7 @@ function ExportNamedDeclaration(node) {
if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) {
this.print(node.source, true);
this.space();
this._printAttributes(node, hasBrace);
_printAttributes.call(this, node, hasBrace);
} else {
this.print(node.source);
}
@@ -247,7 +248,7 @@ function ImportDeclaration(node) {
if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) {
this.print(node.source, true);
this.space();
this._printAttributes(node, hasBrace);
_printAttributes.call(this, node, hasBrace);
} else {
this.print(node.source);
}

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,8 @@ exports.CatchClause = CatchClause;
exports.ContinueStatement = ContinueStatement;
exports.DebuggerStatement = DebuggerStatement;
exports.DoWhileStatement = DoWhileStatement;
exports.ForOfStatement = exports.ForInStatement = void 0;
exports.ForInStatement = ForInStatement;
exports.ForOfStatement = ForOfStatement;
exports.ForStatement = ForStatement;
exports.IfStatement = IfStatement;
exports.LabeledStatement = LabeledStatement;
@@ -22,9 +23,9 @@ exports.VariableDeclarator = VariableDeclarator;
exports.WhileStatement = WhileStatement;
exports.WithStatement = WithStatement;
var _t = require("@babel/types");
var _index = require("../node/index.js");
const {
isFor,
isForStatement,
isIfStatement,
isStatement
} = _t;
@@ -34,7 +35,7 @@ function WithStatement(node) {
this.tokenChar(40);
this.print(node.object);
this.tokenChar(41);
this.printBlock(node);
this.printBlock(node.body);
}
function IfStatement(node) {
this.word("if");
@@ -75,23 +76,21 @@ function ForStatement(node) {
this.word("for");
this.space();
this.tokenChar(40);
{
const exit = this.enterForStatementInit();
this.print(node.init);
exit();
}
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.token(";", false, 1);
this.tokenChar(59, 1);
if (node.update) {
this.space();
this.print(node.update);
}
this.tokenChar(41);
this.printBlock(node);
this.printBlock(node.body);
}
function WhileStatement(node) {
this.word("while");
@@ -99,32 +98,41 @@ function WhileStatement(node) {
this.tokenChar(40);
this.print(node.test);
this.tokenChar(41);
this.printBlock(node);
this.printBlock(node.body);
}
function ForXStatement(node) {
function ForInStatement(node) {
this.word("for");
this.space();
const isForOf = node.type === "ForOfStatement";
if (isForOf && node.await) {
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);
{
const exit = this.enterForXStatementInit(isForOf);
this.print(node.left);
exit == null || exit();
}
this.tokenContext |= _index.TokenContext.forOfHead;
this.print(node.left);
this.space();
this.word(isForOf ? "of" : "in");
this.word("of");
this.space();
this.print(node.right);
this.tokenChar(41);
this.printBlock(node);
this.printBlock(node.body);
}
const ForInStatement = exports.ForInStatement = ForXStatement;
const ForOfStatement = exports.ForOfStatement = ForXStatement;
function DoWhileStatement(node) {
this.word("do");
this.space();
@@ -225,6 +233,10 @@ 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");
@@ -233,12 +245,15 @@ function VariableDeclaration(node, parent) {
const {
kind
} = node;
if (kind === "await using") {
this.word("await");
this.space();
this.word("using", true);
} else {
this.word(kind, kind === "using");
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;
@@ -246,18 +261,23 @@ function VariableDeclaration(node, parent) {
for (const declar of node.declarations) {
if (declar.init) {
hasInits = true;
break;
}
}
}
this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? function (occurrenceCount) {
this.token(",", false, occurrenceCount);
this.newline();
} : undefined);
if (isFor(parent)) {
if (isForStatement(parent)) {
if (parent.init === node) return;
} else {
if (parent.left === node) return;
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();

File diff suppressed because one or more lines are too long

View File

@@ -32,7 +32,7 @@ function _printTemplate(node, substitutions) {
this.token(partRaw + "`", true);
}
function TemplateLiteral(node) {
this._printTemplate(node, node.expressions);
_printTemplate.call(this, node, node.expressions);
}
//# sourceMappingURL=template-literals.js.map

View File

@@ -1 +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","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 this._printTemplate(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;EACtE,IAAI,CAACO,cAAc,CAACP,IAAI,EAAEA,IAAI,CAACsB,WAAW,CAAC;AAC7C","ignoreList":[]}
{"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":[]}

View File

@@ -24,15 +24,13 @@ 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 lastRawIdentNode = null;
let lastRawIdentResult = "";
function _getRawIdentifier(node) {
if (node === lastRawIdentNode) return lastRawIdentResult;
lastRawIdentNode = node;
const {
name
} = node;
@@ -44,9 +42,11 @@ function _getRawIdentifier(node) {
return lastRawIdentResult = node.name;
}
function Identifier(node) {
var _node$loc;
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
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);
@@ -59,18 +59,17 @@ function ObjectExpression(node) {
const props = node.properties;
this.tokenChar(123);
if (props.length) {
const exit = this.enterDelimited();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.space();
this.printList(props, this.shouldPrintTrailingComma("}"), true, true);
this.printList(props, this.shouldPrintTrailingComma("}"), true, true, undefined, true);
this.space();
exit();
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
}
this.sourceWithOffset("end", node.loc, -1);
this.tokenChar(125);
this.rightBrace(node);
}
function ObjectMethod(node) {
this.printJoin(node.decorators);
this._methodHead(node);
_methods._methodHead.call(this, node);
this.space();
this.print(node.body);
}
@@ -98,24 +97,24 @@ function ArrayExpression(node) {
const elems = node.elements;
const len = elems.length;
this.tokenChar(91);
const exit = this.enterDelimited();
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);
this.print(elem, undefined, true);
if (i < len - 1 || this.shouldPrintTrailingComma("]")) {
this.token(",", false, i);
this.tokenChar(44, i);
}
} else {
this.token(",", false, i);
this.tokenChar(44, i);
}
}
exit();
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenChar(93);
}
function RegExpLiteral(node) {
this.word(`/${node.pattern}/${node.flags}`);
this.word(`/${node.pattern}/${node.flags}`, false);
}
function BooleanLiteral(node) {
this.word(node.value ? "true" : "false");

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.TSAnyKeyword = TSAnyKeyword;
exports.TSArrayType = TSArrayType;
exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression;
exports.TSAsExpression = TSAsExpression;
exports.TSBigIntKeyword = TSBigIntKeyword;
exports.TSBooleanKeyword = TSBooleanKeyword;
exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
@@ -49,6 +49,7 @@ exports.TSParenthesizedType = TSParenthesizedType;
exports.TSPropertySignature = TSPropertySignature;
exports.TSQualifiedName = TSQualifiedName;
exports.TSRestType = TSRestType;
exports.TSSatisfiesExpression = TSSatisfiesExpression;
exports.TSStringKeyword = TSStringKeyword;
exports.TSSymbolKeyword = TSSymbolKeyword;
exports.TSTemplateLiteralType = TSTemplateLiteralType;
@@ -68,10 +69,10 @@ exports.TSUndefinedKeyword = TSUndefinedKeyword;
exports.TSUnionType = TSUnionType;
exports.TSUnknownKeyword = TSUnknownKeyword;
exports.TSVoidKeyword = TSVoidKeyword;
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType;
exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
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();
@@ -124,18 +125,18 @@ function TSParameterProperty(node) {
this.word("readonly");
this.space();
}
this._param(node.parameter);
_methods._param.call(this, node.parameter);
}
function TSDeclareFunction(node, parent) {
if (node.declare) {
this.word("declare");
this.space();
}
this._functionHead(node, parent);
_methods._functionHead.call(this, node, parent, false);
this.semicolon();
}
function TSDeclareMethod(node) {
this._classMethodHead(node);
_classes._classMethodHead.call(this, node);
this.semicolon();
}
function TSQualifiedName(node) {
@@ -144,7 +145,7 @@ function TSQualifiedName(node) {
this.print(node.right);
}
function TSCallSignatureDeclaration(node) {
this.tsPrintSignatureDeclarationBase(node);
tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node);
}
function maybePrintTrailingCommaOrSemicolon(printer, node) {
@@ -161,7 +162,7 @@ function maybePrintTrailingCommaOrSemicolon(printer, node) {
function TSConstructSignatureDeclaration(node) {
this.word("new");
this.space();
this.tsPrintSignatureDeclarationBase(node);
tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node);
}
function TSPropertySignature(node) {
@@ -172,7 +173,7 @@ function TSPropertySignature(node) {
this.word("readonly");
this.space();
}
this.tsPrintPropertyOrMethodName(node);
tsPrintPropertyOrMethodName.call(this, node);
this.print(node.typeAnnotation);
maybePrintTrailingCommaOrSemicolon(this, node);
}
@@ -196,8 +197,8 @@ function TSMethodSignature(node) {
this.word(kind);
this.space();
}
this.tsPrintPropertyOrMethodName(node);
this.tsPrintSignatureDeclarationBase(node);
tsPrintPropertyOrMethodName.call(this, node);
tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node);
}
function TSIndexSignature(node) {
@@ -214,7 +215,7 @@ function TSIndexSignature(node) {
this.space();
}
this.tokenChar(91);
this._parameters(node.parameters, "]");
_methods._parameters.call(this, node.parameters, 93);
this.print(node.typeAnnotation);
maybePrintTrailingCommaOrSemicolon(this, node);
}
@@ -261,7 +262,7 @@ function TSThisType() {
this.word("this");
}
function TSFunctionType(node) {
this.tsPrintFunctionOrConstructorType(node);
tsPrintFunctionOrConstructorType.call(this, node);
}
function TSConstructorType(node) {
if (node.abstract) {
@@ -270,7 +271,7 @@ function TSConstructorType(node) {
}
this.word("new");
this.space();
this.tsPrintFunctionOrConstructorType(node);
tsPrintFunctionOrConstructorType.call(this, node);
}
function tsPrintFunctionOrConstructorType(node) {
const {
@@ -279,7 +280,7 @@ function tsPrintFunctionOrConstructorType(node) {
const parameters = node.parameters;
this.print(typeParameters);
this.tokenChar(40);
this._parameters(parameters, ")");
_methods._parameters.call(this, parameters, 41);
this.space();
const returnType = node.typeAnnotation;
this.print(returnType);
@@ -312,7 +313,7 @@ function TSTypeQuery(node) {
}
}
function TSTypeLiteral(node) {
printBraced(this, node, () => this.printJoin(node.members, true, true));
printBraced(this, node, () => this.printJoin(node.members, true, true, undefined, undefined, true));
}
function TSArrayType(node) {
this.print(node.elementType, true);
@@ -401,7 +402,7 @@ function TSMappedType(node) {
typeAnnotation
} = node;
this.tokenChar(123);
const exit = this.enterDelimited();
const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.space();
if (readonly) {
tokenIfPlusMinus(this, readonly);
@@ -413,12 +414,12 @@ function TSMappedType(node) {
this.space();
this.word("in");
this.space();
this.print(node.typeParameter.constraint);
this.print(node.typeParameter.constraint, undefined, true);
if (nameType) {
this.space();
this.word("as");
this.space();
this.print(nameType);
this.print(nameType, undefined, true);
}
this.tokenChar(93);
if (optional) {
@@ -428,10 +429,10 @@ function TSMappedType(node) {
if (typeAnnotation) {
this.tokenChar(58);
this.space();
this.print(typeAnnotation);
this.print(typeAnnotation, undefined, true);
}
this.space();
exit();
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenChar(125);
}
function tokenIfPlusMinus(self, tok) {
@@ -440,7 +441,7 @@ function tokenIfPlusMinus(self, tok) {
}
}
function TSTemplateLiteralType(node) {
this._printTemplate(node, node.types);
_templateLiterals._printTemplate.call(this, node, node.types);
}
function TSLiteralType(node) {
this.print(node.literal);
@@ -475,7 +476,7 @@ function TSInterfaceDeclaration(node) {
this.print(body);
}
function TSInterfaceBody(node) {
printBraced(this, node, () => this.printJoin(node.body, true, true));
printBraced(this, node, () => this.printJoin(node.body, true, true, undefined, undefined, true));
}
function TSTypeAliasDeclaration(node) {
const {
@@ -498,15 +499,25 @@ function TSTypeAliasDeclaration(node) {
this.print(typeAnnotation);
this.semicolon();
}
function TSTypeExpression(node) {
function TSAsExpression(node) {
const {
type,
expression,
typeAnnotation
} = node;
this.print(expression, true);
this.space();
this.word(type === "TSAsExpression" ? "as" : "satisfies");
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);
}
@@ -548,7 +559,7 @@ function TSEnumDeclaration(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);
return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true, undefined, true);
});
}
function TSEnumMember(node) {
@@ -593,7 +604,7 @@ function TSModuleDeclaration(node) {
this.print(body);
}
function TSModuleBlock(node) {
printBraced(this, node, () => this.printSequence(node.body, true));
printBraced(this, node, () => this.printSequence(node.body, true, true));
}
function TSImportType(node) {
const {
@@ -643,6 +654,7 @@ function TSExternalModuleReference(node) {
function TSNonNullExpression(node) {
this.print(node.expression);
this.tokenChar(33);
this.setLastChar(33);
}
function TSExportAssignment(node) {
this.word("export");
@@ -669,11 +681,11 @@ function tsPrintSignatureDeclarationBase(node) {
const parameters = node.parameters;
this.print(typeParameters);
this.tokenChar(40);
this._parameters(parameters, ")");
_methods._parameters.call(this, parameters, 41);
const returnType = node.typeAnnotation;
this.print(returnType);
}
function tsPrintClassMemberModifiers(node) {
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]);
@@ -685,9 +697,9 @@ function tsPrintClassMemberModifiers(node) {
}
function printBraced(printer, node, cb) {
printer.token("{");
const exit = printer.enterDelimited();
const oldNoLineTerminatorAfterNode = printer.enterDelimited();
cb();
exit();
printer._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
printer.rightBrace(node);
}
function printModifiersList(printer, node, modifiers) {

File diff suppressed because one or more lines are too long