@sprucelabs/spruce-cli 17.1.47 → 17.1.48

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/node_modules/@typescript-eslint/parser/package.json +5 -5
  3. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  4. package/node_modules/@typescript-eslint/types/package.json +2 -2
  5. package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
  6. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  7. package/package.json +29 -29
  8. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/index.d.ts +0 -4
  9. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/parser.d.ts +0 -22
  10. package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +0 -1732
  11. package/node_modules/@typescript-eslint/types/_ts3.4/dist/index.d.ts +0 -5
  12. package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +0 -3
  13. package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +0 -36
  14. package/node_modules/@typescript-eslint/types/_ts3.4/dist/ts-estree.d.ts +0 -9
  15. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +0 -9
  16. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert-comments.d.ts +0 -11
  17. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert.d.ts +0 -159
  18. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +0 -13
  19. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +0 -12
  20. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +0 -9
  21. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +0 -11
  22. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +0 -5
  23. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +0 -19
  24. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/getScriptKind.d.ts +0 -5
  25. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +0 -22
  26. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +0 -13
  27. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/getModifiers.d.ts +0 -4
  28. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +0 -12
  29. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/jsx/xhtml-entities.d.ts +0 -2
  30. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/node-utils.d.ts +0 -231
  31. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +0 -188
  32. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +0 -25
  33. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/semantic-or-syntactic-errors.d.ts +0 -13
  34. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +0 -9
  35. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +0 -175
  36. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/index.d.ts +0 -4
  37. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +0 -18
  38. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/version-check.d.ts +0 -3
  39. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/get-keys.d.ts +0 -4
  40. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/index.d.ts +0 -3
  41. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/visitor-keys.d.ts +0 -6
@@ -1,5 +0,0 @@
1
- export { AST_NODE_TYPES, AST_TOKEN_TYPES } from './generated/ast-spec';
2
- export * from './lib';
3
- export * from './parser-options';
4
- export * from './ts-estree';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- declare type Lib = 'es5' | 'es6' | 'es2015' | 'es7' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext' | 'dom' | 'dom.iterable' | 'webworker' | 'webworker.importscripts' | 'webworker.iterable' | 'scripthost' | 'es2015.core' | 'es2015.collection' | 'es2015.generator' | 'es2015.iterable' | 'es2015.promise' | 'es2015.proxy' | 'es2015.reflect' | 'es2015.symbol' | 'es2015.symbol.wellknown' | 'es2016.array.include' | 'es2017.object' | 'es2017.sharedmemory' | 'es2017.string' | 'es2017.intl' | 'es2017.typedarrays' | 'es2018.asyncgenerator' | 'es2018.asynciterable' | 'es2018.intl' | 'es2018.promise' | 'es2018.regexp' | 'es2019.array' | 'es2019.object' | 'es2019.string' | 'es2019.symbol' | 'es2020.bigint' | 'es2020.date' | 'es2020.promise' | 'es2020.sharedmemory' | 'es2020.string' | 'es2020.symbol.wellknown' | 'es2020.intl' | 'es2020.number' | 'es2021.promise' | 'es2021.string' | 'es2021.weakref' | 'es2021.intl' | 'es2022.array' | 'es2022.error' | 'es2022.intl' | 'es2022.object' | 'es2022.sharedmemory' | 'es2022.string' | 'esnext.array' | 'esnext.symbol' | 'esnext.asynciterable' | 'esnext.intl' | 'esnext.bigint' | 'esnext.string' | 'esnext.promise' | 'esnext.weakref' | 'es2016.full' | 'es2017.full' | 'es2018.full' | 'es2019.full' | 'es2020.full' | 'es2021.full' | 'es2022.full' | 'esnext.full' | 'lib';
2
- export { Lib };
3
- //# sourceMappingURL=lib.d.ts.map
@@ -1,36 +0,0 @@
1
- import { Program } from 'typescript';
2
- import { Lib } from './lib';
3
- declare type DebugLevel = boolean | ('typescript-eslint' | 'eslint' | 'typescript')[];
4
- declare type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022;
5
- declare type SourceType = 'script' | 'module';
6
- interface ParserOptions {
7
- ecmaFeatures?: {
8
- globalReturn?: boolean;
9
- jsx?: boolean;
10
- };
11
- ecmaVersion?: EcmaVersion | 'latest';
12
- jsxPragma?: string | null;
13
- jsxFragmentName?: string | null;
14
- lib?: Lib[];
15
- emitDecoratorMetadata?: boolean;
16
- comment?: boolean;
17
- debugLevel?: DebugLevel;
18
- errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
19
- errorOnUnknownASTType?: boolean;
20
- EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean;
21
- extraFileExtensions?: string[];
22
- filePath?: string;
23
- loc?: boolean;
24
- program?: Program;
25
- project?: string | string[];
26
- projectFolderIgnoreList?: (string | RegExp)[];
27
- range?: boolean;
28
- sourceType?: SourceType;
29
- tokens?: boolean;
30
- tsconfigRootDir?: string;
31
- warnOnUnsupportedTypeScriptVersion?: boolean;
32
- moduleResolver?: string;
33
- [additionalProperties: string]: unknown;
34
- }
35
- export { DebugLevel, EcmaVersion, ParserOptions, SourceType };
36
- //# sourceMappingURL=parser-options.d.ts.map
@@ -1,9 +0,0 @@
1
- import * as TSESTree from './generated/ast-spec';
2
- declare module './generated/ast-spec' {
3
- interface BaseNode {
4
- parent?: TSESTree.Node;
5
- }
6
- }
7
- import * as TSESTree_1 from './generated/ast-spec';
8
- export { TSESTree_1 as TSESTree };
9
- //# sourceMappingURL=ts-estree.d.ts.map
@@ -1,9 +0,0 @@
1
- import { SourceFile } from 'typescript';
2
- import { ASTMaps } from './convert';
3
- import { Extra } from './parser-options';
4
- import { TSESTree } from './ts-estree';
5
- export declare function astConverter(ast: SourceFile, extra: Extra, shouldPreserveNodeMaps: boolean): {
6
- estree: TSESTree.Program;
7
- astMaps: ASTMaps;
8
- };
9
- //# sourceMappingURL=ast-converter.d.ts.map
@@ -1,11 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { TSESTree } from './ts-estree';
3
- /**
4
- * Convert all comments for the given AST.
5
- * @param ast the AST object
6
- * @param code the TypeScript code
7
- * @returns the converted ESTreeComment
8
- * @private
9
- */
10
- export declare function convertComments(ast: ts.SourceFile, code: string): TSESTree.Comment[];
11
- //# sourceMappingURL=convert-comments.d.ts.map
@@ -1,159 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { TSError } from './node-utils';
3
- import { ParserWeakMap, ParserWeakMapESTreeToTSNode } from './parser-options';
4
- import { SemanticOrSyntacticError } from './semantic-or-syntactic-errors';
5
- import { TSESTree, TSNode } from './ts-estree';
6
- interface ConverterOptions {
7
- errorOnUnknownASTType: boolean;
8
- shouldPreserveNodeMaps: boolean;
9
- }
10
- /**
11
- * Extends and formats a given error object
12
- * @param error the error object
13
- * @returns converted error object
14
- */
15
- export declare function convertError(error: ts.DiagnosticWithLocation | SemanticOrSyntacticError): TSError;
16
- export interface ASTMaps {
17
- esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode;
18
- tsNodeToESTreeNodeMap: ParserWeakMap<TSNode, TSESTree.Node>;
19
- }
20
- export declare class Converter {
21
- private readonly ast;
22
- private readonly options;
23
- private readonly esTreeNodeToTSNodeMap;
24
- private readonly tsNodeToESTreeNodeMap;
25
- private allowPattern;
26
- private inTypeMode;
27
- /**
28
- * Converts a TypeScript node into an ESTree node
29
- * @param ast the full TypeScript AST
30
- * @param options additional options for the conversion
31
- * @returns the converted ESTreeNode
32
- */
33
- constructor(ast: ts.SourceFile, options: ConverterOptions);
34
- getASTMaps(): ASTMaps;
35
- convertProgram(): TSESTree.Program;
36
- /**
37
- * Converts a TypeScript node into an ESTree node.
38
- * @param node the child ts.Node
39
- * @param parent parentNode
40
- * @param inTypeMode flag to determine if we are in typeMode
41
- * @param allowPattern flag to determine if patterns are allowed
42
- * @returns the converted ESTree node
43
- */
44
- private converter;
45
- /**
46
- * Fixes the exports of the given ts.Node
47
- * @param node the ts.Node
48
- * @param result result
49
- * @returns the ESTreeNode with fixed exports
50
- */
51
- private fixExports;
52
- /**
53
- * Register specific TypeScript node into map with first ESTree node provided
54
- */
55
- private registerTSNodeInNodeMap;
56
- /**
57
- * Converts a TypeScript node into an ESTree node.
58
- * @param child the child ts.Node
59
- * @param parent parentNode
60
- * @returns the converted ESTree node
61
- */
62
- private convertPattern;
63
- /**
64
- * Converts a TypeScript node into an ESTree node.
65
- * @param child the child ts.Node
66
- * @param parent parentNode
67
- * @returns the converted ESTree node
68
- */
69
- private convertChild;
70
- /**
71
- * Converts a TypeScript node into an ESTree node.
72
- * @param child the child ts.Node
73
- * @param parent parentNode
74
- * @returns the converted ESTree node
75
- */
76
- private convertType;
77
- private createNode;
78
- private convertBindingNameWithTypeAnnotation;
79
- /**
80
- * Converts a child into a type annotation. This creates an intermediary
81
- * TypeAnnotation node to match what Flow does.
82
- * @param child The TypeScript AST node to convert.
83
- * @param parent parentNode
84
- * @returns The type annotation node.
85
- */
86
- private convertTypeAnnotation;
87
- /**
88
- * Coverts body Nodes and add a directive field to StringLiterals
89
- * @param nodes of ts.Node
90
- * @param parent parentNode
91
- * @returns Array of body statements
92
- */
93
- private convertBodyExpressions;
94
- /**
95
- * Converts a ts.Node's typeArguments to TSTypeParameterInstantiation node
96
- * @param typeArguments ts.NodeArray typeArguments
97
- * @param node parent used to create this node
98
- * @returns TypeParameterInstantiation node
99
- */
100
- private convertTypeArgumentsToTypeParameters;
101
- /**
102
- * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node
103
- * @param typeParameters ts.Node typeParameters
104
- * @returns TypeParameterDeclaration node
105
- */
106
- private convertTSTypeParametersToTypeParametersDeclaration;
107
- /**
108
- * Converts an array of ts.Node parameters into an array of ESTreeNode params
109
- * @param parameters An array of ts.Node params to be converted
110
- * @returns an array of converted ESTreeNode params
111
- */
112
- private convertParameters;
113
- private convertChainExpression;
114
- /**
115
- * For nodes that are copied directly from the TypeScript AST into
116
- * ESTree mostly as-is. The only difference is the addition of a type
117
- * property instead of a kind property. Recursively copies all children.
118
- */
119
- private deeplyCopy;
120
- private convertJSXIdentifier;
121
- private convertJSXNamespaceOrIdentifier;
122
- /**
123
- * Converts a TypeScript JSX node.tagName into an ESTree node.name
124
- * @param node the tagName object from a JSX ts.Node
125
- * @param parent
126
- * @returns the converted ESTree name object
127
- */
128
- private convertJSXTagName;
129
- private convertMethodSignature;
130
- private convertAssertClasue;
131
- /**
132
- * Applies the given TS modifiers to the given result object.
133
- *
134
- * This method adds not standardized `modifiers` property in nodes
135
- *
136
- * @param result
137
- * @param modifiers original ts.Nodes from the node.modifiers array
138
- * @returns the current result object will be mutated
139
- */
140
- private applyModifiersToResult;
141
- /**
142
- * Uses the provided range location to adjust the location data of the given Node
143
- * @param result The node that will have its location data mutated
144
- * @param childRange The child node range used to expand location
145
- */
146
- private fixParentLocation;
147
- private assertModuleSpecifier;
148
- /**
149
- * Converts a TypeScript node into an ESTree node.
150
- * The core of the conversion logic:
151
- * Identify and convert each relevant TypeScript SyntaxKind
152
- * @param node the child ts.Node
153
- * @param parent parentNode
154
- * @returns the converted ESTree node
155
- */
156
- private convertNode;
157
- }
158
- export {};
159
- //# sourceMappingURL=convert.d.ts.map
@@ -1,13 +0,0 @@
1
- import * as ts from 'typescript';
2
- interface DirectoryStructureHost {
3
- readDirectory?(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
4
- }
5
- interface CachedDirectoryStructureHost extends DirectoryStructureHost {
6
- readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
7
- }
8
- interface WatchCompilerHostOfConfigFile<T extends ts.BuilderProgram> extends ts.WatchCompilerHostOfConfigFile<T> {
9
- onCachedDirectoryStructureHostCreate(host: CachedDirectoryStructureHost): void;
10
- extraFileExtensions?: readonly ts.FileExtensionInfo[];
11
- }
12
- export { WatchCompilerHostOfConfigFile };
13
- //# sourceMappingURL=WatchCompilerHostOfConfigFile.d.ts.map
@@ -1,12 +0,0 @@
1
- import { Extra } from '../parser-options';
2
- import { ASTAndProgram } from './shared';
3
- /**
4
- * @param code The code of the file being linted
5
- * @param extra The config object
6
- * @param extra.tsconfigRootDir The root directory for relative tsconfig paths
7
- * @param extra.projects Provided tsconfig paths
8
- * @returns If found, returns the source file corresponding to the code and the containing program
9
- */
10
- declare function createDefaultProgram(code: string, extra: Extra): ASTAndProgram | undefined;
11
- export { createDefaultProgram };
12
- //# sourceMappingURL=createDefaultProgram.d.ts.map
@@ -1,9 +0,0 @@
1
- import { Extra } from '../parser-options';
2
- import { ASTAndProgram } from './shared';
3
- /**
4
- * @param code The code of the file being linted
5
- * @returns Returns a new source file and program corresponding to the linted code
6
- */
7
- declare function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram;
8
- export { createIsolatedProgram };
9
- //# sourceMappingURL=createIsolatedProgram.d.ts.map
@@ -1,11 +0,0 @@
1
- import { Extra } from '../parser-options';
2
- import { ASTAndProgram } from './shared';
3
- /**
4
- * @param code The code of the file being linted
5
- * @param createDefaultProgram True if the default program should be created
6
- * @param extra The config object
7
- * @returns If found, returns the source file corresponding to the code and the containing program
8
- */
9
- declare function createProjectProgram(code: string, createDefaultProgram: boolean, extra: Extra): ASTAndProgram | undefined;
10
- export { createProjectProgram };
11
- //# sourceMappingURL=createProjectProgram.d.ts.map
@@ -1,5 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { Extra } from '../parser-options';
3
- declare function createSourceFile(code: string, extra: Extra): ts.SourceFile;
4
- export { createSourceFile };
5
- //# sourceMappingURL=createSourceFile.d.ts.map
@@ -1,19 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { Extra } from '../parser-options';
3
- /**
4
- * Clear all of the parser caches.
5
- * This should only be used in testing to ensure the parser is clean between tests.
6
- */
7
- declare function clearWatchCaches(): void;
8
- /**
9
- * Calculate project environments using options provided by consumer and paths from config
10
- * @param code The code being linted
11
- * @param filePathIn The path of the file being parsed
12
- * @param extra.tsconfigRootDir The root directory for relative tsconfig paths
13
- * @param extra.projects Provided tsconfig paths
14
- * @returns The programs corresponding to the supplied tsconfig paths
15
- */
16
- declare function getProgramsForProjects(code: string, filePathIn: string, extra: Extra): ts.Program[];
17
- declare function createWatchProgram(tsconfigPath: string, extra: Extra): ts.WatchOfConfigFile<ts.BuilderProgram>;
18
- export { clearWatchCaches, createWatchProgram, getProgramsForProjects };
19
- //# sourceMappingURL=createWatchProgram.d.ts.map
@@ -1,5 +0,0 @@
1
- import * as ts from 'typescript';
2
- declare function getScriptKind(filePath: string, jsx: boolean): ts.ScriptKind;
3
- declare function getLanguageVariant(scriptKind: ts.ScriptKind): ts.LanguageVariant;
4
- export { getScriptKind, getLanguageVariant };
5
- //# sourceMappingURL=getScriptKind.d.ts.map
@@ -1,22 +0,0 @@
1
- import { Program } from 'typescript';
2
- import * as ts from 'typescript';
3
- import { Extra, ModuleResolver } from '../parser-options';
4
- interface ASTAndProgram {
5
- ast: ts.SourceFile;
6
- program: ts.Program;
7
- }
8
- /**
9
- * Compiler options required to avoid critical functionality issues
10
- */
11
- declare const CORE_COMPILER_OPTIONS: ts.CompilerOptions;
12
- declare function createDefaultCompilerOptionsFromExtra(extra: Extra): ts.CompilerOptions;
13
- declare type CanonicalPath = string & {
14
- __brand: unknown;
15
- };
16
- declare function getCanonicalFileName(filePath: string): CanonicalPath;
17
- declare function ensureAbsolutePath(p: string, extra: Extra): string;
18
- declare function canonicalDirname(p: CanonicalPath): CanonicalPath;
19
- declare function getAstFromProgram(currentProgram: Program, extra: Extra): ASTAndProgram | undefined;
20
- declare function getModuleResolver(moduleResolverPath: string): ModuleResolver;
21
- export { ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, CanonicalPath, createDefaultCompilerOptionsFromExtra, ensureAbsolutePath, getCanonicalFileName, getAstFromProgram, getModuleResolver, };
22
- //# sourceMappingURL=shared.d.ts.map
@@ -1,13 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { Extra } from '../parser-options';
3
- import { ASTAndProgram } from './shared';
4
- declare function useProvidedPrograms(programInstances: Iterable<ts.Program>, extra: Extra): ASTAndProgram | undefined;
5
- /**
6
- * Utility offered by parser to help consumers construct their own program instance.
7
- *
8
- * @param configFile the path to the tsconfig.json file, relative to `projectDirectory`
9
- * @param projectDirectory the project directory to use as the CWD, defaults to `process.cwd()`
10
- */
11
- declare function createProgramFromConfigFile(configFile: string, projectDirectory?: string): ts.Program;
12
- export { useProvidedPrograms, createProgramFromConfigFile };
13
- //# sourceMappingURL=useProvidedPrograms.d.ts.map
@@ -1,4 +0,0 @@
1
- import * as ts from 'typescript';
2
- export declare function getModifiers(node: ts.Node | null | undefined): undefined | ts.Modifier[];
3
- export declare function getDecorators(node: ts.Node | null | undefined): undefined | ts.Decorator[];
4
- //# sourceMappingURL=getModifiers.d.ts.map
@@ -1,12 +0,0 @@
1
- export { AST, parse, parseAndGenerateServices, parseWithNodeMaps, ParseAndGenerateServicesResult, ParseWithNodeMapsResult, clearProgramCache, } from './parser';
2
- export { ParserServices, TSESTreeOptions } from './parser-options';
3
- export { simpleTraverse } from './simple-traverse';
4
- export * from './ts-estree';
5
- export { clearWatchCaches as clearCaches } from './create-program/createWatchProgram';
6
- export { createProgramFromConfigFile as createProgram } from './create-program/useProvidedPrograms';
7
- export * from './create-program/getScriptKind';
8
- export { typescriptVersionIsAtLeast } from './version-check';
9
- export * from './getModifiers';
10
- export { visitorKeys } from '@typescript-eslint/visitor-keys';
11
- export declare const version: string;
12
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const xhtmlEntities: Record<string, string>;
2
- //# sourceMappingURL=xhtml-entities.d.ts.map
@@ -1,231 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { TSESTree } from './ts-estree';
3
- import { AST_NODE_TYPES, AST_TOKEN_TYPES } from './ts-estree';
4
- declare const SyntaxKind: typeof ts.SyntaxKind;
5
- interface TokenToText extends TSESTree.PunctuatorTokenToText {
6
- [SyntaxKind.ImportKeyword]: 'import';
7
- [SyntaxKind.InKeyword]: 'in';
8
- [SyntaxKind.InstanceOfKeyword]: 'instanceof';
9
- [SyntaxKind.NewKeyword]: 'new';
10
- [SyntaxKind.KeyOfKeyword]: 'keyof';
11
- [SyntaxKind.ReadonlyKeyword]: 'readonly';
12
- [SyntaxKind.UniqueKeyword]: 'unique';
13
- }
14
- /**
15
- * Returns true if the given ts.Token is the assignment operator
16
- * @param operator the operator token
17
- * @returns is assignment
18
- */
19
- export declare function isAssignmentOperator<T extends ts.SyntaxKind>(operator: ts.Token<T>): boolean;
20
- /**
21
- * Returns true if the given ts.Token is a logical operator
22
- * @param operator the operator token
23
- * @returns is a logical operator
24
- */
25
- export declare function isLogicalOperator<T extends ts.SyntaxKind>(operator: ts.Token<T>): boolean;
26
- /**
27
- * Returns the string form of the given TSToken SyntaxKind
28
- * @param kind the token's SyntaxKind
29
- * @returns the token applicable token as a string
30
- */
31
- export declare function getTextForTokenKind<T extends ts.SyntaxKind>(kind: T): T extends keyof TokenToText ? TokenToText[T] : string | undefined;
32
- /**
33
- * Returns true if the given ts.Node is a valid ESTree class member
34
- * @param node TypeScript AST node
35
- * @returns is valid ESTree class member
36
- */
37
- export declare function isESTreeClassMember(node: ts.Node): boolean;
38
- /**
39
- * Checks if a ts.Node has a modifier
40
- * @param modifierKind TypeScript SyntaxKind modifier
41
- * @param node TypeScript AST node
42
- * @returns has the modifier specified
43
- */
44
- export declare function hasModifier(modifierKind: ts.KeywordSyntaxKind, node: ts.Node): boolean;
45
- /**
46
- * Get last last modifier in ast
47
- * @param node TypeScript AST node
48
- * @returns returns last modifier if present or null
49
- */
50
- export declare function getLastModifier(node: ts.Node): ts.Modifier | null;
51
- /**
52
- * Returns true if the given ts.Token is a comma
53
- * @param token the TypeScript token
54
- * @returns is comma
55
- */
56
- export declare function isComma(token: ts.Node): token is ts.Token<ts.SyntaxKind.CommaToken>;
57
- /**
58
- * Returns true if the given ts.Node is a comment
59
- * @param node the TypeScript node
60
- * @returns is comment
61
- */
62
- export declare function isComment(node: ts.Node): boolean;
63
- /**
64
- * Returns true if the given ts.Node is a JSDoc comment
65
- * @param node the TypeScript node
66
- * @returns is JSDoc comment
67
- */
68
- export declare function isJSDocComment(node: ts.Node): node is ts.JSDoc;
69
- /**
70
- * Returns the binary expression type of the given ts.Token
71
- * @param operator the operator token
72
- * @returns the binary expression type
73
- */
74
- export declare function getBinaryExpressionType<T extends ts.SyntaxKind>(operator: ts.Token<T>): AST_NODE_TYPES.AssignmentExpression | AST_NODE_TYPES.LogicalExpression | AST_NODE_TYPES.BinaryExpression;
75
- /**
76
- * Returns line and column data for the given positions,
77
- * @param pos position to check
78
- * @param ast the AST object
79
- * @returns line and column
80
- */
81
- export declare function getLineAndCharacterFor(pos: number, ast: ts.SourceFile): TSESTree.Position;
82
- /**
83
- * Returns line and column data for the given start and end positions,
84
- * for the given AST
85
- * @param start start data
86
- * @param end end data
87
- * @param ast the AST object
88
- * @returns the loc data
89
- */
90
- export declare function getLocFor(start: number, end: number, ast: ts.SourceFile): TSESTree.SourceLocation;
91
- /**
92
- * Check whatever node can contain directive
93
- * @param node
94
- * @returns returns true if node can contain directive
95
- */
96
- export declare function canContainDirective(node: ts.SourceFile | ts.Block | ts.ModuleBlock | ts.ClassStaticBlockDeclaration): boolean;
97
- /**
98
- * Returns range for the given ts.Node
99
- * @param node the ts.Node or ts.Token
100
- * @param ast the AST object
101
- * @returns the range data
102
- */
103
- export declare function getRange(node: ts.Node, ast: ts.SourceFile): [
104
- number,
105
- number
106
- ];
107
- /**
108
- * Returns true if a given ts.Node is a token
109
- * @param node the ts.Node
110
- * @returns is a token
111
- */
112
- export declare function isToken(node: ts.Node): node is ts.Token<ts.TokenSyntaxKind>;
113
- /**
114
- * Returns true if a given ts.Node is a JSX token
115
- * @param node ts.Node to be checked
116
- * @returns is a JSX token
117
- */
118
- export declare function isJSXToken(node: ts.Node): boolean;
119
- /**
120
- * Returns the declaration kind of the given ts.Node
121
- * @param node TypeScript AST node
122
- * @returns declaration kind
123
- */
124
- export declare function getDeclarationKind(node: ts.VariableDeclarationList): 'let' | 'const' | 'var';
125
- /**
126
- * Gets a ts.Node's accessibility level
127
- * @param node The ts.Node
128
- * @returns accessibility "public", "protected", "private", or null
129
- */
130
- export declare function getTSNodeAccessibility(node: ts.Node): 'public' | 'protected' | 'private' | null;
131
- /**
132
- * Finds the next token based on the previous one and its parent
133
- * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren
134
- * @param previousToken The previous TSToken
135
- * @param parent The parent TSNode
136
- * @param ast The TS AST
137
- * @returns the next TSToken
138
- */
139
- export declare function findNextToken(previousToken: ts.TextRange, parent: ts.Node, ast: ts.SourceFile): ts.Node | undefined;
140
- /**
141
- * Find the first matching ancestor based on the given predicate function.
142
- * @param node The current ts.Node
143
- * @param predicate The predicate function to apply to each checked ancestor
144
- * @returns a matching parent ts.Node
145
- */
146
- export declare function findFirstMatchingAncestor(node: ts.Node, predicate: (node: ts.Node) => boolean): ts.Node | undefined;
147
- /**
148
- * Returns true if a given ts.Node has a JSX token within its hierarchy
149
- * @param node ts.Node to be checked
150
- * @returns has JSX ancestor
151
- */
152
- export declare function hasJSXAncestor(node: ts.Node): boolean;
153
- /**
154
- * Unescape the text content of string literals, e.g. &amp; -> &
155
- * @param text The escaped string literal text.
156
- * @returns The unescaped string literal text.
157
- */
158
- export declare function unescapeStringLiteralText(text: string): string;
159
- /**
160
- * Returns true if a given ts.Node is a computed property
161
- * @param node ts.Node to be checked
162
- * @returns is Computed Property
163
- */
164
- export declare function isComputedProperty(node: ts.Node): node is ts.ComputedPropertyName;
165
- /**
166
- * Returns true if a given ts.Node is optional (has QuestionToken)
167
- * @param node ts.Node to be checked
168
- * @returns is Optional
169
- */
170
- export declare function isOptional(node: {
171
- questionToken?: ts.QuestionToken;
172
- }): boolean;
173
- /**
174
- * Returns true if the node is an optional chain node
175
- */
176
- export declare function isChainExpression(node: TSESTree.Node): node is TSESTree.ChainExpression;
177
- /**
178
- * Returns true of the child of property access expression is an optional chain
179
- */
180
- export declare function isChildUnwrappableOptionalChain(node: ts.PropertyAccessExpression | ts.ElementAccessExpression | ts.CallExpression | ts.NonNullExpression, child: TSESTree.Node): boolean;
181
- /**
182
- * Returns the type of a given ts.Token
183
- * @param token the ts.Token
184
- * @returns the token type
185
- */
186
- export declare function getTokenType(token: ts.Identifier | ts.Token<ts.SyntaxKind>): Exclude<AST_TOKEN_TYPES, AST_TOKEN_TYPES.Line | AST_TOKEN_TYPES.Block>;
187
- /**
188
- * Extends and formats a given ts.Token, for a given AST
189
- * @param token the ts.Token
190
- * @param ast the AST object
191
- * @returns the converted Token
192
- */
193
- export declare function convertToken(token: ts.Token<ts.TokenSyntaxKind>, ast: ts.SourceFile): TSESTree.Token;
194
- /**
195
- * Converts all tokens for the given AST
196
- * @param ast the AST object
197
- * @returns the converted Tokens
198
- */
199
- export declare function convertTokens(ast: ts.SourceFile): TSESTree.Token[];
200
- export declare class TSError extends Error {
201
- readonly fileName: string;
202
- readonly index: number;
203
- readonly lineNumber: number;
204
- readonly column: number;
205
- constructor(message: string, fileName: string, index: number, lineNumber: number, column: number);
206
- }
207
- /**
208
- * @param ast the AST object
209
- * @param start the index at which the error starts
210
- * @param message the error message
211
- * @returns converted error object
212
- */
213
- export declare function createError(ast: ts.SourceFile, start: number, message: string): TSError;
214
- /**
215
- * @param n the TSNode
216
- * @param ast the TS AST
217
- */
218
- export declare function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean;
219
- /**
220
- * Like `forEach`, but suitable for use with numbers and strings (which may be falsy).
221
- * @template T
222
- * @template U
223
- * @param array
224
- * @param callback
225
- */
226
- export declare function firstDefined<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
227
- export declare function identifierIsThisKeyword(id: ts.Identifier): boolean;
228
- export declare function isThisIdentifier(node: ts.Node | undefined): node is ts.Identifier;
229
- export declare function isThisInTypeQuery(node: ts.Node): boolean;
230
- export {};
231
- //# sourceMappingURL=node-utils.d.ts.map