@sprucelabs/spruce-cli 17.1.32 → 17.1.33

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 (50) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/__tests__/testDirsAndFiles/mercury-types-package.json +1 -1
  3. package/build/features/event/actions/SetRemoteAction.js +3 -0
  4. package/build/features/event/actions/SetRemoteAction.js.map +1 -1
  5. package/build/features/node/NodeFeature.d.ts +7 -2
  6. package/build/features/universalDevDependencies.d.ts +7 -2
  7. package/build/features/universalDevDependencies.js +1 -0
  8. package/build/features/universalDevDependencies.js.map +1 -1
  9. package/node_modules/@typescript-eslint/parser/package.json +5 -5
  10. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  11. package/node_modules/@typescript-eslint/types/package.json +2 -2
  12. package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
  13. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  14. package/package.json +33 -33
  15. package/src/__tests__/testDirsAndFiles/mercury-types-package.json +1 -1
  16. package/src/features/event/actions/SetRemoteAction.ts +4 -0
  17. package/src/features/universalDevDependencies.ts +1 -1
  18. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/index.d.ts +0 -4
  19. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/parser.d.ts +0 -20
  20. package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +0 -1732
  21. package/node_modules/@typescript-eslint/types/_ts3.4/dist/index.d.ts +0 -5
  22. package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +0 -3
  23. package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +0 -36
  24. package/node_modules/@typescript-eslint/types/_ts3.4/dist/ts-estree.d.ts +0 -9
  25. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +0 -9
  26. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert-comments.d.ts +0 -11
  27. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert.d.ts +0 -157
  28. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +0 -13
  29. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +0 -12
  30. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +0 -9
  31. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +0 -11
  32. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +0 -5
  33. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +0 -19
  34. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/getScriptKind.d.ts +0 -5
  35. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +0 -22
  36. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +0 -13
  37. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +0 -10
  38. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/jsx/xhtml-entities.d.ts +0 -2
  39. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/node-utils.d.ts +0 -230
  40. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +0 -188
  41. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +0 -25
  42. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/semantic-or-syntactic-errors.d.ts +0 -13
  43. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +0 -9
  44. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +0 -175
  45. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/index.d.ts +0 -4
  46. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +0 -18
  47. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/version-check.d.ts +0 -3
  48. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/get-keys.d.ts +0 -4
  49. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/index.d.ts +0 -3
  50. 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.object' | '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 { Lib } from './lib';
2
- import { Program } from 'typescript';
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,157 +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
- * @param result
134
- * @param modifiers original ts.Nodes from the node.modifiers array
135
- * @returns the current result object will be mutated
136
- * @deprecated This method adds not standardized `modifiers` property in nodes
137
- */
138
- private applyModifiersToResult;
139
- /**
140
- * Uses the provided range location to adjust the location data of the given Node
141
- * @param result The node that will have its location data mutated
142
- * @param childRange The child node range used to expand location
143
- */
144
- private fixParentLocation;
145
- private assertModuleSpecifier;
146
- /**
147
- * Converts a TypeScript node into an ESTree node.
148
- * The core of the conversion logic:
149
- * Identify and convert each relevant TypeScript SyntaxKind
150
- * @param node the child ts.Node
151
- * @param parent parentNode
152
- * @returns the converted ESTree node
153
- */
154
- private convertNode;
155
- }
156
- export {};
157
- //# 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 * as ts from 'typescript';
2
- import { Program } 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,10 +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 { visitorKeys } from '@typescript-eslint/visitor-keys';
9
- export declare const version: string;
10
- //# 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,230 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from './ts-estree';
3
- declare const SyntaxKind: typeof ts.SyntaxKind;
4
- interface TokenToText extends TSESTree.PunctuatorTokenToText {
5
- [SyntaxKind.ImportKeyword]: 'import';
6
- [SyntaxKind.InKeyword]: 'in';
7
- [SyntaxKind.InstanceOfKeyword]: 'instanceof';
8
- [SyntaxKind.NewKeyword]: 'new';
9
- [SyntaxKind.KeyOfKeyword]: 'keyof';
10
- [SyntaxKind.ReadonlyKeyword]: 'readonly';
11
- [SyntaxKind.UniqueKeyword]: 'unique';
12
- }
13
- /**
14
- * Returns true if the given ts.Token is the assignment operator
15
- * @param operator the operator token
16
- * @returns is assignment
17
- */
18
- export declare function isAssignmentOperator<T extends ts.SyntaxKind>(operator: ts.Token<T>): boolean;
19
- /**
20
- * Returns true if the given ts.Token is a logical operator
21
- * @param operator the operator token
22
- * @returns is a logical operator
23
- */
24
- export declare function isLogicalOperator<T extends ts.SyntaxKind>(operator: ts.Token<T>): boolean;
25
- /**
26
- * Returns the string form of the given TSToken SyntaxKind
27
- * @param kind the token's SyntaxKind
28
- * @returns the token applicable token as a string
29
- */
30
- export declare function getTextForTokenKind<T extends ts.SyntaxKind>(kind: T): T extends keyof TokenToText ? TokenToText[T] : string | undefined;
31
- /**
32
- * Returns true if the given ts.Node is a valid ESTree class member
33
- * @param node TypeScript AST node
34
- * @returns is valid ESTree class member
35
- */
36
- export declare function isESTreeClassMember(node: ts.Node): boolean;
37
- /**
38
- * Checks if a ts.Node has a modifier
39
- * @param modifierKind TypeScript SyntaxKind modifier
40
- * @param node TypeScript AST node
41
- * @returns has the modifier specified
42
- */
43
- export declare function hasModifier(modifierKind: ts.KeywordSyntaxKind, node: ts.Node): boolean;
44
- /**
45
- * Get last last modifier in ast
46
- * @param node TypeScript AST node
47
- * @returns returns last modifier if present or null
48
- */
49
- export declare function getLastModifier(node: ts.Node): ts.Modifier | null;
50
- /**
51
- * Returns true if the given ts.Token is a comma
52
- * @param token the TypeScript token
53
- * @returns is comma
54
- */
55
- export declare function isComma(token: ts.Node): token is ts.Token<ts.SyntaxKind.CommaToken>;
56
- /**
57
- * Returns true if the given ts.Node is a comment
58
- * @param node the TypeScript node
59
- * @returns is comment
60
- */
61
- export declare function isComment(node: ts.Node): boolean;
62
- /**
63
- * Returns true if the given ts.Node is a JSDoc comment
64
- * @param node the TypeScript node
65
- * @returns is JSDoc comment
66
- */
67
- export declare function isJSDocComment(node: ts.Node): node is ts.JSDoc;
68
- /**
69
- * Returns the binary expression type of the given ts.Token
70
- * @param operator the operator token
71
- * @returns the binary expression type
72
- */
73
- export declare function getBinaryExpressionType<T extends ts.SyntaxKind>(operator: ts.Token<T>): AST_NODE_TYPES.AssignmentExpression | AST_NODE_TYPES.LogicalExpression | AST_NODE_TYPES.BinaryExpression;
74
- /**
75
- * Returns line and column data for the given positions,
76
- * @param pos position to check
77
- * @param ast the AST object
78
- * @returns line and column
79
- */
80
- export declare function getLineAndCharacterFor(pos: number, ast: ts.SourceFile): TSESTree.Position;
81
- /**
82
- * Returns line and column data for the given start and end positions,
83
- * for the given AST
84
- * @param start start data
85
- * @param end end data
86
- * @param ast the AST object
87
- * @returns the loc data
88
- */
89
- export declare function getLocFor(start: number, end: number, ast: ts.SourceFile): TSESTree.SourceLocation;
90
- /**
91
- * Check whatever node can contain directive
92
- * @param node
93
- * @returns returns true if node can contain directive
94
- */
95
- export declare function canContainDirective(node: ts.SourceFile | ts.Block | ts.ModuleBlock | ts.ClassStaticBlockDeclaration): boolean;
96
- /**
97
- * Returns range for the given ts.Node
98
- * @param node the ts.Node or ts.Token
99
- * @param ast the AST object
100
- * @returns the range data
101
- */
102
- export declare function getRange(node: ts.Node, ast: ts.SourceFile): [
103
- number,
104
- number
105
- ];
106
- /**
107
- * Returns true if a given ts.Node is a token
108
- * @param node the ts.Node
109
- * @returns is a token
110
- */
111
- export declare function isToken(node: ts.Node): node is ts.Token<ts.TokenSyntaxKind>;
112
- /**
113
- * Returns true if a given ts.Node is a JSX token
114
- * @param node ts.Node to be checked
115
- * @returns is a JSX token
116
- */
117
- export declare function isJSXToken(node: ts.Node): boolean;
118
- /**
119
- * Returns the declaration kind of the given ts.Node
120
- * @param node TypeScript AST node
121
- * @returns declaration kind
122
- */
123
- export declare function getDeclarationKind(node: ts.VariableDeclarationList): 'let' | 'const' | 'var';
124
- /**
125
- * Gets a ts.Node's accessibility level
126
- * @param node The ts.Node
127
- * @returns accessibility "public", "protected", "private", or null
128
- */
129
- export declare function getTSNodeAccessibility(node: ts.Node): 'public' | 'protected' | 'private' | null;
130
- /**
131
- * Finds the next token based on the previous one and its parent
132
- * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren
133
- * @param previousToken The previous TSToken
134
- * @param parent The parent TSNode
135
- * @param ast The TS AST
136
- * @returns the next TSToken
137
- */
138
- export declare function findNextToken(previousToken: ts.TextRange, parent: ts.Node, ast: ts.SourceFile): ts.Node | undefined;
139
- /**
140
- * Find the first matching ancestor based on the given predicate function.
141
- * @param node The current ts.Node
142
- * @param predicate The predicate function to apply to each checked ancestor
143
- * @returns a matching parent ts.Node
144
- */
145
- export declare function findFirstMatchingAncestor(node: ts.Node, predicate: (node: ts.Node) => boolean): ts.Node | undefined;
146
- /**
147
- * Returns true if a given ts.Node has a JSX token within its hierarchy
148
- * @param node ts.Node to be checked
149
- * @returns has JSX ancestor
150
- */
151
- export declare function hasJSXAncestor(node: ts.Node): boolean;
152
- /**
153
- * Unescape the text content of string literals, e.g. &amp; -> &
154
- * @param text The escaped string literal text.
155
- * @returns The unescaped string literal text.
156
- */
157
- export declare function unescapeStringLiteralText(text: string): string;
158
- /**
159
- * Returns true if a given ts.Node is a computed property
160
- * @param node ts.Node to be checked
161
- * @returns is Computed Property
162
- */
163
- export declare function isComputedProperty(node: ts.Node): node is ts.ComputedPropertyName;
164
- /**
165
- * Returns true if a given ts.Node is optional (has QuestionToken)
166
- * @param node ts.Node to be checked
167
- * @returns is Optional
168
- */
169
- export declare function isOptional(node: {
170
- questionToken?: ts.QuestionToken;
171
- }): boolean;
172
- /**
173
- * Returns true if the node is an optional chain node
174
- */
175
- export declare function isChainExpression(node: TSESTree.Node): node is TSESTree.ChainExpression;
176
- /**
177
- * Returns true of the child of property access expression is an optional chain
178
- */
179
- export declare function isChildUnwrappableOptionalChain(node: ts.PropertyAccessExpression | ts.ElementAccessExpression | ts.CallExpression | ts.NonNullExpression, child: TSESTree.Node): boolean;
180
- /**
181
- * Returns the type of a given ts.Token
182
- * @param token the ts.Token
183
- * @returns the token type
184
- */
185
- export declare function getTokenType(token: ts.Identifier | ts.Token<ts.SyntaxKind>): Exclude<AST_TOKEN_TYPES, AST_TOKEN_TYPES.Line | AST_TOKEN_TYPES.Block>;
186
- /**
187
- * Extends and formats a given ts.Token, for a given AST
188
- * @param token the ts.Token
189
- * @param ast the AST object
190
- * @returns the converted Token
191
- */
192
- export declare function convertToken(token: ts.Token<ts.TokenSyntaxKind>, ast: ts.SourceFile): TSESTree.Token;
193
- /**
194
- * Converts all tokens for the given AST
195
- * @param ast the AST object
196
- * @returns the converted Tokens
197
- */
198
- export declare function convertTokens(ast: ts.SourceFile): TSESTree.Token[];
199
- export declare class TSError extends Error {
200
- readonly fileName: string;
201
- readonly index: number;
202
- readonly lineNumber: number;
203
- readonly column: number;
204
- constructor(message: string, fileName: string, index: number, lineNumber: number, column: number);
205
- }
206
- /**
207
- * @param ast the AST object
208
- * @param start the index at which the error starts
209
- * @param message the error message
210
- * @returns converted error object
211
- */
212
- export declare function createError(ast: ts.SourceFile, start: number, message: string): TSError;
213
- /**
214
- * @param n the TSNode
215
- * @param ast the TS AST
216
- */
217
- export declare function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean;
218
- /**
219
- * Like `forEach`, but suitable for use with numbers and strings (which may be falsy).
220
- * @template T
221
- * @template U
222
- * @param array
223
- * @param callback
224
- */
225
- export declare function firstDefined<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
226
- export declare function identifierIsThisKeyword(id: ts.Identifier): boolean;
227
- export declare function isThisIdentifier(node: ts.Node | undefined): node is ts.Identifier;
228
- export declare function isThisInTypeQuery(node: ts.Node): boolean;
229
- export {};
230
- //# sourceMappingURL=node-utils.d.ts.map