@tslite/printer 0.5.7 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +55 -0
- package/NOTICE +15 -0
- package/dist/_namespaces/ts.d.ts +4 -0
- package/dist/_namespaces/ts.js +6 -0
- package/dist/emitter.d.ts +2 -0
- package/dist/emitter.js +2751 -0
- package/dist/index.d.ts +1 -64
- package/dist/index.js +4 -1
- package/dist/types.d.ts +197 -0
- package/dist/types.js +65 -0
- package/dist/utilities.d.ts +24 -0
- package/dist/utilities.js +427 -0
- package/package.json +17 -38
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -64
package/dist/index.d.ts
CHANGED
|
@@ -1,64 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { CapabilityProfile } from '@tslite/capability';
|
|
3
|
-
|
|
4
|
-
type PrintInput = BaseNode | BaseNode[] | (BaseNode | null)[] | null | undefined;
|
|
5
|
-
declare const print: (node: PrintInput) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Printer **sob-contrato** (D37): emite só o que o `profile` permite e **recusa o
|
|
8
|
-
* resto** (lança `node-not-allowed`). É o limite hard do lado JIT — simétrico ao
|
|
9
|
-
* `evaluate(ast, env, { profile })` do interpret. O `print` padrão (standalone)
|
|
10
|
-
* segue emitindo qualquer nó.
|
|
11
|
-
*/
|
|
12
|
-
declare const printWithProfile: (ast: PrintInput, profile: CapabilityProfile) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Uma expressão é PRIMÁRIA em posição de membro/callee? (isto é: reparsa certo
|
|
15
|
-
* ali, sem parênteses)
|
|
16
|
-
*
|
|
17
|
-
* **Fonte única.** O `@tslite/format` faz a mesma pergunta ao imprimir a callee
|
|
18
|
-
* de uma chamada, e derivá-la duas vezes já custou um defeito: o formatador
|
|
19
|
-
* emitia `() => { … }()`, que o TSLite reparsa mas o **TypeScript recusa** — e a
|
|
20
|
-
* promessa da plataforma é ser um subset PURO de TS.
|
|
21
|
-
*/
|
|
22
|
-
declare function isPrimaryOperand(node: BaseNode): boolean;
|
|
23
|
-
/** Operando que começa com unário/`await` (à esquerda de `**` exige parênteses). */
|
|
24
|
-
declare const unaryLike: (node: BaseNode) => boolean;
|
|
25
|
-
declare const mixesCoalesce: (parentOp: string, child: BaseNode) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the operator precedence of an expression node.
|
|
28
|
-
* Higher value = binds tighter. Returns Infinity for atoms (Identifier, Literal, etc).
|
|
29
|
-
*/
|
|
30
|
-
/** A precedência efetiva de uma expressão (erasure de `as`); `Infinity` = primária. */
|
|
31
|
-
declare const getExpressionPrecedence: (node: BaseNode) => number;
|
|
32
|
-
/**
|
|
33
|
-
* Wraps a child node in parentheses when its precedence is lower than
|
|
34
|
-
* the parent's, respecting left/right associativity rules.
|
|
35
|
-
*
|
|
36
|
-
* For left-associative operators (most):
|
|
37
|
-
* - left child: parens when childPrec < parentPrec
|
|
38
|
-
* - right child: parens when childPrec <= parentPrec
|
|
39
|
-
*
|
|
40
|
-
* For right-associative operators (**):
|
|
41
|
-
* - left child: parens when childPrec <= parentPrec
|
|
42
|
-
* - right child: parens when childPrec < parentPrec
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* A DECISÃO de parentizar um operando pela precedência — exportada para quem
|
|
46
|
-
* imprime por outra via (o `@tslite/emit` renderiza `Doc`, não texto) tomar a
|
|
47
|
-
* mesma decisão, em vez de manter uma segunda máquina de precedência.
|
|
48
|
-
*/
|
|
49
|
-
declare const needsParens: (node: BaseNode, parentPrec: number, isRight: boolean, rightAssociative?: boolean) => boolean;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Prints the hybrid JSON form (a value with `#expr` islands) as JS source.
|
|
53
|
-
*
|
|
54
|
-
* Static data is emitted as an object/array literal; each `#expr` island is
|
|
55
|
-
* handed back to `print()` — the same `#expr` boundary the type layer walks.
|
|
56
|
-
*
|
|
57
|
-
* ```ts
|
|
58
|
-
* printJson({ name: "John", init: { "#expr": "CallExpression", ... } })
|
|
59
|
-
* // '{ name: "John", init: setup() }'
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
declare function printJson(node: TSLite): string;
|
|
63
|
-
|
|
64
|
-
export { getExpressionPrecedence, isPrimaryOperand, mixesCoalesce, needsParens, print, printJson, printWithProfile, unaryLike };
|
|
1
|
+
export * from "./_namespaces/ts.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// A entrada dos testes deste pacote: reexporta o barril, que é a entrada do pacote (o `exports` do `package.json`). O
|
|
2
|
+
// barril avalia os arquivos na ordem do outFile da tag, e um import direto de um arquivo avaliaria os outros noutra
|
|
3
|
+
// ordem.
|
|
4
|
+
export * from "./_namespaces/ts.js";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { CompilerOptions, EmitHint, ModuleDeclaration, NewLineKind, Node, NodeArray, SourceFile, Symbol, SymbolFlags, SyntaxKind } from "./_namespaces/ts.js";
|
|
2
|
+
interface SymbolWriter extends SymbolTracker {
|
|
3
|
+
writeKeyword(text: string): void;
|
|
4
|
+
writeOperator(text: string): void;
|
|
5
|
+
writePunctuation(text: string): void;
|
|
6
|
+
writeSpace(text: string): void;
|
|
7
|
+
writeStringLiteral(text: string): void;
|
|
8
|
+
writeParameter(text: string): void;
|
|
9
|
+
writeProperty(text: string): void;
|
|
10
|
+
writeSymbol(text: string, symbol: Symbol): void;
|
|
11
|
+
writeLine(force?: boolean): void;
|
|
12
|
+
increaseIndent(): void;
|
|
13
|
+
decreaseIndent(): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface Printer {
|
|
17
|
+
/**
|
|
18
|
+
* Imprime o nó e a subárvore dele como estão. O `hint` diz o papel do nó (um `Identifier` numa expressão, ou como
|
|
19
|
+
* nome de uma declaração); para a maior parte dos nós, `Unspecified`. O `sourceFile` dá o texto de onde saem os
|
|
20
|
+
* literais e os identificadores como foram escritos, e os nomes do arquivo, com que os nomes gerados não colidem.
|
|
21
|
+
*/
|
|
22
|
+
printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string;
|
|
23
|
+
/** Imprime uma lista de nós com o formato pedido. */
|
|
24
|
+
printList<T extends Node>(format: ListFormat, list: NodeArray<T>, sourceFile: SourceFile): string;
|
|
25
|
+
/** Imprime um arquivo como está, com os comentários (a menos que `removeComments`). */
|
|
26
|
+
printFile(sourceFile: SourceFile): string;
|
|
27
|
+
/** Escreve o nó e a subárvore dele no `writer`, como estão (o checker imprime assim os tipos das mensagens). */
|
|
28
|
+
writeNode(hint: EmitHint, node: Node, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void;
|
|
29
|
+
writeList<T extends Node>(format: ListFormat, list: NodeArray<T> | undefined, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void;
|
|
30
|
+
writeFile(sourceFile: SourceFile, writer: EmitTextWriter): void;
|
|
31
|
+
}
|
|
32
|
+
export interface PrintHandlers {
|
|
33
|
+
/**
|
|
34
|
+
* A hook used by the Printer when generating unique names to avoid collisions with
|
|
35
|
+
* globally defined names that exist outside of the current source file.
|
|
36
|
+
*/
|
|
37
|
+
hasGlobalName?(name: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A hook used by the Printer to provide notifications prior to emitting a node. A
|
|
40
|
+
* compatible implementation **must** invoke `emitCallback` with the provided `hint` and
|
|
41
|
+
* `node` values.
|
|
42
|
+
* @param hint A hint indicating the intended purpose of the node.
|
|
43
|
+
* @param node The node to emit.
|
|
44
|
+
* @param emitCallback A callback that, when invoked, will emit the node.
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* var printer = createPrinter(printerOptions, {
|
|
48
|
+
* onEmitNode(hint, node, emitCallback) {
|
|
49
|
+
* // set up or track state prior to emitting the node...
|
|
50
|
+
* emitCallback(hint, node);
|
|
51
|
+
* // restore state after emitting the node...
|
|
52
|
+
* }
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
onEmitNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void;
|
|
57
|
+
/**
|
|
58
|
+
* A hook used to check if an emit notification is required for a node.
|
|
59
|
+
* @param node The node to emit.
|
|
60
|
+
*/
|
|
61
|
+
isEmitNotificationEnabled?(node: Node | undefined): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* A hook used by the Printer to perform just-in-time substitution of a node. This is
|
|
64
|
+
* primarily used by node transformations that need to substitute one node for another,
|
|
65
|
+
* such as replacing `myExportedVar` with `exports.myExportedVar`.
|
|
66
|
+
* @param hint A hint indicating the intended purpose of the node.
|
|
67
|
+
* @param node The node to emit.
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* var printer = createPrinter(printerOptions, {
|
|
71
|
+
* substituteNode(hint, node) {
|
|
72
|
+
* // perform substitution if necessary...
|
|
73
|
+
* return node;
|
|
74
|
+
* }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
substituteNode?(hint: EmitHint, node: Node): Node;
|
|
79
|
+
onEmitSourceMapOfNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void;
|
|
80
|
+
onEmitSourceMapOfToken?: (node: Node | undefined, token: SyntaxKind, writer: (s: string) => void, pos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, pos: number) => number) => number;
|
|
81
|
+
onEmitSourceMapOfPosition?: (pos: number) => void;
|
|
82
|
+
onSetSourceFile?: (node: SourceFile) => void;
|
|
83
|
+
onBeforeEmitNodeArray?: (nodes: NodeArray<any> | undefined) => void;
|
|
84
|
+
onAfterEmitNodeArray?: (nodes: NodeArray<any> | undefined) => void;
|
|
85
|
+
onBeforeEmitToken?: (node: Node) => void;
|
|
86
|
+
onAfterEmitToken?: (node: Node) => void;
|
|
87
|
+
}
|
|
88
|
+
export interface PrinterOptions {
|
|
89
|
+
removeComments?: boolean;
|
|
90
|
+
newLine?: NewLineKind;
|
|
91
|
+
omitTrailingSemicolon?: boolean;
|
|
92
|
+
noEmitHelpers?: boolean;
|
|
93
|
+
module?: CompilerOptions["module"];
|
|
94
|
+
target?: CompilerOptions["target"];
|
|
95
|
+
sourceMap?: boolean;
|
|
96
|
+
inlineSourceMap?: boolean;
|
|
97
|
+
inlineSources?: boolean;
|
|
98
|
+
extendedDiagnostics?: boolean;
|
|
99
|
+
onlyPrintJsDocStyle?: boolean;
|
|
100
|
+
neverAsciiEscape?: boolean;
|
|
101
|
+
writeBundleFileInfo?: boolean;
|
|
102
|
+
recordInternalSection?: boolean;
|
|
103
|
+
stripInternal?: boolean;
|
|
104
|
+
preserveSourceNewlines?: boolean;
|
|
105
|
+
relativeToBuildInfo?: (path: string) => string;
|
|
106
|
+
}
|
|
107
|
+
export interface EmitTextWriter extends SymbolWriter {
|
|
108
|
+
write(s: string): void;
|
|
109
|
+
writeTrailingSemicolon(text: string): void;
|
|
110
|
+
writeComment(text: string): void;
|
|
111
|
+
getText(): string;
|
|
112
|
+
rawWrite(s: string): void;
|
|
113
|
+
writeLiteral(s: string): void;
|
|
114
|
+
getTextPos(): number;
|
|
115
|
+
getLine(): number;
|
|
116
|
+
getColumn(): number;
|
|
117
|
+
getIndent(): number;
|
|
118
|
+
isAtStartOfLine(): boolean;
|
|
119
|
+
hasTrailingComment(): boolean;
|
|
120
|
+
hasTrailingWhitespace(): boolean;
|
|
121
|
+
getTextPosWithWriteLine?(): number;
|
|
122
|
+
}
|
|
123
|
+
/** O que o cálculo de um specifier pergunta: o diretório corrente e a comparação dos nomes de arquivo. */
|
|
124
|
+
export interface ModuleSpecifierResolutionHost {
|
|
125
|
+
useCaseSensitiveFileNames?(): boolean;
|
|
126
|
+
getCurrentDirectory(): string;
|
|
127
|
+
}
|
|
128
|
+
export interface SymbolTracker {
|
|
129
|
+
trackSymbol?(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags): void;
|
|
130
|
+
reportInaccessibleThisError?(): void;
|
|
131
|
+
reportInaccessibleUniqueSymbolError?(): void;
|
|
132
|
+
reportCyclicStructureError?(): void;
|
|
133
|
+
reportLikelyUnsafeImportRequiredError?(specifier: string): void;
|
|
134
|
+
moduleResolverHost?: ModuleSpecifierResolutionHost;
|
|
135
|
+
trackReferencedAmbientModule?(decl: ModuleDeclaration, symbol: Symbol): void;
|
|
136
|
+
trackExternalModuleSymbolOfImportTypeNode?(symbol: Symbol): void;
|
|
137
|
+
reportNonlocalAugmentation?(containingFile: SourceFile, parentSymbol: Symbol, augmentingSymbol: Symbol): void;
|
|
138
|
+
}
|
|
139
|
+
export declare enum ListFormat {
|
|
140
|
+
None = 0,
|
|
141
|
+
SingleLine = 0,// Prints the list on a single line (default).
|
|
142
|
+
MultiLine = 1,// Prints the list on multiple lines.
|
|
143
|
+
PreserveLines = 2,// Prints the list using line preservation if possible.
|
|
144
|
+
LinesMask = 3,
|
|
145
|
+
NotDelimited = 0,// There is no delimiter between list items (default).
|
|
146
|
+
BarDelimited = 4,// Each list item is space-and-bar (" |") delimited.
|
|
147
|
+
AmpersandDelimited = 8,// Each list item is space-and-ampersand (" &") delimited.
|
|
148
|
+
CommaDelimited = 16,// Each list item is comma (",") delimited.
|
|
149
|
+
DelimitersMask = 28,
|
|
150
|
+
AllowTrailingComma = 64,// Write a trailing comma (",") if present.
|
|
151
|
+
Indented = 128,// The list should be indented.
|
|
152
|
+
SpaceBetweenBraces = 256,// Inserts a space after the opening brace and before the closing brace.
|
|
153
|
+
SpaceBetweenSiblings = 512,// Inserts a space between each sibling node.
|
|
154
|
+
Braces = 1024,// The list is surrounded by "{" and "}".
|
|
155
|
+
Parenthesis = 2048,// The list is surrounded by "(" and ")".
|
|
156
|
+
AngleBrackets = 4096,// The list is surrounded by "<" and ">".
|
|
157
|
+
SquareBrackets = 8192,// The list is surrounded by "[" and "]".
|
|
158
|
+
BracketsMask = 15360,
|
|
159
|
+
OptionalIfUndefined = 16384,// Do not emit brackets if the list is undefined.
|
|
160
|
+
OptionalIfEmpty = 32768,// Do not emit brackets if the list is empty.
|
|
161
|
+
Optional = 49152,
|
|
162
|
+
PreferNewLine = 65536,// Prefer adding a LineTerminator between synthesized nodes.
|
|
163
|
+
NoTrailingNewLine = 131072,// Do not emit a trailing NewLine for a MultiLine list.
|
|
164
|
+
NoInterveningComments = 262144,// Do not emit comments between each node
|
|
165
|
+
NoSpaceIfEmpty = 524288,// If the literal is empty, do not add spaces between braces.
|
|
166
|
+
SingleElement = 1048576,
|
|
167
|
+
SpaceAfterList = 2097152,// Add space after list
|
|
168
|
+
Modifiers = 262656,
|
|
169
|
+
SingleLineTypeLiteralMembers = 768,
|
|
170
|
+
MultiLineTypeLiteralMembers = 32897,
|
|
171
|
+
TupleTypeElements = 528,
|
|
172
|
+
UnionTypeConstituents = 516,
|
|
173
|
+
IntersectionTypeConstituents = 520,
|
|
174
|
+
ObjectBindingPatternElements = 525136,
|
|
175
|
+
ArrayBindingPatternElements = 524880,
|
|
176
|
+
ObjectLiteralExpressionProperties = 526226,
|
|
177
|
+
ArrayLiteralExpressionElements = 8914,
|
|
178
|
+
CommaListElements = 528,
|
|
179
|
+
CallExpressionArguments = 2576,
|
|
180
|
+
TemplateExpressionSpans = 262144,
|
|
181
|
+
SingleLineBlockStatements = 768,
|
|
182
|
+
MultiLineBlockStatements = 129,
|
|
183
|
+
VariableDeclarationList = 528,
|
|
184
|
+
SingleLineFunctionBodyStatements = 768,
|
|
185
|
+
MultiLineFunctionBodyStatements = 1,
|
|
186
|
+
CaseBlockClauses = 129,
|
|
187
|
+
NamedImportsOrExportsElements = 525136,
|
|
188
|
+
JsxElementOrFragmentChildren = 262144,
|
|
189
|
+
JsxElementAttributes = 262656,
|
|
190
|
+
CaseOrDefaultClauseStatements = 163969,
|
|
191
|
+
SourceFileStatements = 131073,
|
|
192
|
+
TypeArguments = 53776,
|
|
193
|
+
TypeParameters = 53776,
|
|
194
|
+
Parameters = 2576,
|
|
195
|
+
IndexSignatureParameters = 8848
|
|
196
|
+
}
|
|
197
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export var ListFormat;
|
|
2
|
+
(function (ListFormat) {
|
|
3
|
+
ListFormat[ListFormat["None"] = 0] = "None";
|
|
4
|
+
// Line separators
|
|
5
|
+
ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine";
|
|
6
|
+
ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine";
|
|
7
|
+
ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines";
|
|
8
|
+
ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask";
|
|
9
|
+
// Delimiters
|
|
10
|
+
ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited";
|
|
11
|
+
ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited";
|
|
12
|
+
ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited";
|
|
13
|
+
ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited";
|
|
14
|
+
ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask";
|
|
15
|
+
ListFormat[ListFormat["AllowTrailingComma"] = 64] = "AllowTrailingComma";
|
|
16
|
+
// Whitespace
|
|
17
|
+
ListFormat[ListFormat["Indented"] = 128] = "Indented";
|
|
18
|
+
ListFormat[ListFormat["SpaceBetweenBraces"] = 256] = "SpaceBetweenBraces";
|
|
19
|
+
ListFormat[ListFormat["SpaceBetweenSiblings"] = 512] = "SpaceBetweenSiblings";
|
|
20
|
+
// Brackets/Braces
|
|
21
|
+
ListFormat[ListFormat["Braces"] = 1024] = "Braces";
|
|
22
|
+
ListFormat[ListFormat["Parenthesis"] = 2048] = "Parenthesis";
|
|
23
|
+
ListFormat[ListFormat["AngleBrackets"] = 4096] = "AngleBrackets";
|
|
24
|
+
ListFormat[ListFormat["SquareBrackets"] = 8192] = "SquareBrackets";
|
|
25
|
+
ListFormat[ListFormat["BracketsMask"] = 15360] = "BracketsMask";
|
|
26
|
+
ListFormat[ListFormat["OptionalIfUndefined"] = 16384] = "OptionalIfUndefined";
|
|
27
|
+
ListFormat[ListFormat["OptionalIfEmpty"] = 32768] = "OptionalIfEmpty";
|
|
28
|
+
ListFormat[ListFormat["Optional"] = 49152] = "Optional";
|
|
29
|
+
// Other
|
|
30
|
+
ListFormat[ListFormat["PreferNewLine"] = 65536] = "PreferNewLine";
|
|
31
|
+
ListFormat[ListFormat["NoTrailingNewLine"] = 131072] = "NoTrailingNewLine";
|
|
32
|
+
ListFormat[ListFormat["NoInterveningComments"] = 262144] = "NoInterveningComments";
|
|
33
|
+
ListFormat[ListFormat["NoSpaceIfEmpty"] = 524288] = "NoSpaceIfEmpty";
|
|
34
|
+
ListFormat[ListFormat["SingleElement"] = 1048576] = "SingleElement";
|
|
35
|
+
ListFormat[ListFormat["SpaceAfterList"] = 2097152] = "SpaceAfterList";
|
|
36
|
+
// Precomputed Formats
|
|
37
|
+
ListFormat[ListFormat["Modifiers"] = 262656] = "Modifiers";
|
|
38
|
+
ListFormat[ListFormat["SingleLineTypeLiteralMembers"] = 768] = "SingleLineTypeLiteralMembers";
|
|
39
|
+
ListFormat[ListFormat["MultiLineTypeLiteralMembers"] = 32897] = "MultiLineTypeLiteralMembers";
|
|
40
|
+
ListFormat[ListFormat["TupleTypeElements"] = 528] = "TupleTypeElements";
|
|
41
|
+
ListFormat[ListFormat["UnionTypeConstituents"] = 516] = "UnionTypeConstituents";
|
|
42
|
+
ListFormat[ListFormat["IntersectionTypeConstituents"] = 520] = "IntersectionTypeConstituents";
|
|
43
|
+
ListFormat[ListFormat["ObjectBindingPatternElements"] = 525136] = "ObjectBindingPatternElements";
|
|
44
|
+
ListFormat[ListFormat["ArrayBindingPatternElements"] = 524880] = "ArrayBindingPatternElements";
|
|
45
|
+
ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 526226] = "ObjectLiteralExpressionProperties";
|
|
46
|
+
ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 8914] = "ArrayLiteralExpressionElements";
|
|
47
|
+
ListFormat[ListFormat["CommaListElements"] = 528] = "CommaListElements";
|
|
48
|
+
ListFormat[ListFormat["CallExpressionArguments"] = 2576] = "CallExpressionArguments";
|
|
49
|
+
ListFormat[ListFormat["TemplateExpressionSpans"] = 262144] = "TemplateExpressionSpans";
|
|
50
|
+
ListFormat[ListFormat["SingleLineBlockStatements"] = 768] = "SingleLineBlockStatements";
|
|
51
|
+
ListFormat[ListFormat["MultiLineBlockStatements"] = 129] = "MultiLineBlockStatements";
|
|
52
|
+
ListFormat[ListFormat["VariableDeclarationList"] = 528] = "VariableDeclarationList";
|
|
53
|
+
ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 768] = "SingleLineFunctionBodyStatements";
|
|
54
|
+
ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements";
|
|
55
|
+
ListFormat[ListFormat["CaseBlockClauses"] = 129] = "CaseBlockClauses";
|
|
56
|
+
ListFormat[ListFormat["NamedImportsOrExportsElements"] = 525136] = "NamedImportsOrExportsElements";
|
|
57
|
+
ListFormat[ListFormat["JsxElementOrFragmentChildren"] = 262144] = "JsxElementOrFragmentChildren";
|
|
58
|
+
ListFormat[ListFormat["JsxElementAttributes"] = 262656] = "JsxElementAttributes";
|
|
59
|
+
ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 163969] = "CaseOrDefaultClauseStatements";
|
|
60
|
+
ListFormat[ListFormat["SourceFileStatements"] = 131073] = "SourceFileStatements";
|
|
61
|
+
ListFormat[ListFormat["TypeArguments"] = 53776] = "TypeArguments";
|
|
62
|
+
ListFormat[ListFormat["TypeParameters"] = 53776] = "TypeParameters";
|
|
63
|
+
ListFormat[ListFormat["Parameters"] = 2576] = "Parameters";
|
|
64
|
+
ListFormat[ListFormat["IndexSignatureParameters"] = 8848] = "IndexSignatureParameters";
|
|
65
|
+
})(ListFormat || (ListFormat = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CommentRange, CompilerOptions, EmitHint, EmitTextWriter, Node, PrintHandlers, PrinterOptions, SourceFile, TextRange } from "./_namespaces/ts.js";
|
|
2
|
+
export declare function usingSingleLineStringWriter(action: (writer: EmitTextWriter) => void): string;
|
|
3
|
+
/**
|
|
4
|
+
* Returns a value indicating whether a name is unique globally or within the current file.
|
|
5
|
+
* Note: This does not consider whether a name appears as a free identifier or not, so at the expression `x.y` this includes both `x` and `y`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isFileLevelUniqueName(sourceFile: SourceFile, name: string, hasGlobalName?: PrintHandlers["hasGlobalName"]): boolean;
|
|
8
|
+
export declare function createTextWriter(newLine: string): EmitTextWriter;
|
|
9
|
+
export declare function getTrailingSemicolonDeferringWriter(writer: EmitTextWriter): EmitTextWriter;
|
|
10
|
+
export declare function emitNewLineBeforeLeadingComments(lineMap: readonly number[], writer: EmitTextWriter, node: TextRange, leadingComments: readonly CommentRange[] | undefined): void;
|
|
11
|
+
export declare function emitNewLineBeforeLeadingCommentsOfPosition(lineMap: readonly number[], writer: EmitTextWriter, pos: number, leadingComments: readonly CommentRange[] | undefined): void;
|
|
12
|
+
export declare function emitNewLineBeforeLeadingCommentOfPosition(lineMap: readonly number[], writer: EmitTextWriter, pos: number, commentPos: number): void;
|
|
13
|
+
export declare function emitComments(text: string, lineMap: readonly number[], writer: EmitTextWriter, comments: readonly CommentRange[] | undefined, leadingSeparator: boolean, trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: readonly number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void): void;
|
|
14
|
+
/**
|
|
15
|
+
* Detached comment is a comment at the top of file or function body that is separated from
|
|
16
|
+
* the next statement by space.
|
|
17
|
+
*/
|
|
18
|
+
export declare function emitDetachedComments(text: string, lineMap: readonly number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: readonly number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): {
|
|
19
|
+
nodePos: number;
|
|
20
|
+
detachedCommentEndPos: number;
|
|
21
|
+
} | undefined;
|
|
22
|
+
export declare function writeCommentRange(text: string, lineMap: readonly number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string): void;
|
|
23
|
+
export declare function getNewLineCharacter(options: CompilerOptions | PrinterOptions, getNewLine?: () => string): string;
|
|
24
|
+
export declare function noEmitNotification(hint: EmitHint, node: Node, callback: (hint: EmitHint, node: Node) => void): void;
|