luaut-parser 1.1.0 → 2.0.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/README.md +71 -30
- package/dist/index.cjs +501 -41
- package/dist/index.d.cts +98 -23
- package/dist/index.d.ts +98 -23
- package/dist/index.js +493 -31
- package/package.json +4 -5
- package/dist/luau.d.luaut +0 -245
- package/dist/roblox.d.luaut +0 -503
package/dist/index.d.cts
CHANGED
|
@@ -1080,6 +1080,12 @@ interface TypeAnalysis {
|
|
|
1080
1080
|
* `typeof x`, a property's type inside `{ ... }`. Inside a generic alias or
|
|
1081
1081
|
* function its parameters stay unresolved (`T`). */
|
|
1082
1082
|
readonly typeOfTypeNode: Map<TypeNode | TypePackNode, Type>;
|
|
1083
|
+
/** What each call argument is expected to be: the parameter it lands on,
|
|
1084
|
+
* with the signature's type parameters replaced by their constraints — a
|
|
1085
|
+
* union when an overload set disagrees. Recorded even for a call that does
|
|
1086
|
+
* not type-check, since that is exactly when an editor wants to offer the
|
|
1087
|
+
* values that would. */
|
|
1088
|
+
readonly expectedTypeOf: Map<Expression, Type>;
|
|
1083
1089
|
/** Top-level type aliases, resolved — and the type names this module
|
|
1084
1090
|
* imports, so tooling treats both alike. */
|
|
1085
1091
|
readonly aliases: Map<string, Type>;
|
|
@@ -1111,7 +1117,8 @@ interface AnalyzeTypesOptions {
|
|
|
1111
1117
|
libTypes?: Record<string, Type>;
|
|
1112
1118
|
/** Parsed definitions files (`.d.luaut`): their `type` aliases become
|
|
1113
1119
|
* available to annotations and their `declare` statements seed global
|
|
1114
|
-
* types.
|
|
1120
|
+
* types. A project lists them under `types` in `luaut.config.json`; see
|
|
1121
|
+
* `resolveTypeLibraries`. */
|
|
1115
1122
|
libs?: readonly Program[];
|
|
1116
1123
|
/** Resolve an `import`'s module path to what that module exports. Called
|
|
1117
1124
|
* once per distinct path. Return `undefined` when there is no such module:
|
|
@@ -1128,29 +1135,97 @@ declare function moduleExports(program: Program, scopes: ScopeAnalysis, types: T
|
|
|
1128
1135
|
/** For `export ... from`: the same resolver the module was analyzed with. */
|
|
1129
1136
|
resolveModule?: (specifier: string) => ModuleExports | undefined): ModuleExports;
|
|
1130
1137
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
declare const luauLib: Program;
|
|
1138
|
+
interface ProjectHost {
|
|
1139
|
+
/** A file's text, or `undefined` when there is no such file. */
|
|
1140
|
+
readFile(path: string): string | undefined;
|
|
1141
|
+
}
|
|
1142
|
+
declare const nodeHost: ProjectHost;
|
|
1137
1143
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
/**
|
|
1141
|
-
|
|
1142
|
-
/**
|
|
1143
|
-
|
|
1144
|
+
declare const CONFIG_FILE_NAMES: readonly ["luaut.config.json", "luaut.config.jsonc"];
|
|
1145
|
+
interface LuautConfig {
|
|
1146
|
+
/** Absolute path of the config file. */
|
|
1147
|
+
readonly path: string;
|
|
1148
|
+
/** The folder it sits in. Relative paths in it resolve from here. */
|
|
1149
|
+
readonly directory: string;
|
|
1150
|
+
/** The config file's text, for locating problems in it. */
|
|
1151
|
+
readonly source: string;
|
|
1152
|
+
/** Type libraries to load, in order: `"luau"`, `"@luaut/roblox"`, `"./types"`. */
|
|
1153
|
+
readonly types: readonly string[];
|
|
1154
|
+
/** Import path aliases, as in tsconfig: `{ "@shared/*": ["src/shared/*"] }`. */
|
|
1155
|
+
readonly paths: Readonly<Record<string, readonly string[]>>;
|
|
1156
|
+
/** Where `paths` targets resolve from, absolute. The config's folder unless set. */
|
|
1157
|
+
readonly baseUrl: string;
|
|
1158
|
+
/** Absolute path of a Rojo sourcemap, or `null` for none. */
|
|
1159
|
+
readonly sourceMap: string | null;
|
|
1160
|
+
}
|
|
1161
|
+
interface ConfigProblem {
|
|
1162
|
+
/** The file the problem is about: a config file, or a sourcemap it names. */
|
|
1163
|
+
readonly file: string;
|
|
1164
|
+
readonly message: string;
|
|
1165
|
+
/** 1-based position in `file`, when the problem has one. */
|
|
1166
|
+
readonly line?: number;
|
|
1167
|
+
readonly column?: number;
|
|
1168
|
+
}
|
|
1169
|
+
interface ConfigLookup {
|
|
1170
|
+
/** The config that applies, if one was found and could be read. */
|
|
1171
|
+
readonly config?: LuautConfig;
|
|
1172
|
+
readonly problems: readonly ConfigProblem[];
|
|
1173
|
+
/** Every config path looked at on the way up, found or not — what a cache
|
|
1174
|
+
* must watch, so that creating or deleting a config is noticed. */
|
|
1175
|
+
readonly searched: readonly string[];
|
|
1176
|
+
}
|
|
1177
|
+
/** The config that applies to `file`: the nearest one in its folder or above. */
|
|
1178
|
+
declare function findConfig(file: string, host?: ProjectHost): ConfigLookup;
|
|
1179
|
+
/** Read and check one config file. Problems do not stop the rest of it from
|
|
1180
|
+
* applying: an unknown option is reported and the known ones still work. */
|
|
1181
|
+
declare function loadConfig(path: string, host?: ProjectHost): {
|
|
1182
|
+
config?: LuautConfig;
|
|
1183
|
+
problems: ConfigProblem[];
|
|
1184
|
+
};
|
|
1185
|
+
/** Blank out `//` and `/* *\/` comments and trailing commas, keeping every
|
|
1186
|
+
* other character where it was — so a JSON error's position still points
|
|
1187
|
+
* into the original text. */
|
|
1188
|
+
declare function stripJsonComments(text: string): string;
|
|
1144
1189
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1190
|
+
interface TypeLibraries {
|
|
1191
|
+
/** Definitions files, dependencies before what depends on them. */
|
|
1192
|
+
readonly files: readonly string[];
|
|
1193
|
+
readonly problems: readonly ConfigProblem[];
|
|
1194
|
+
}
|
|
1195
|
+
declare function resolveTypeLibraries(config: LuautConfig, host?: ProjectHost): TypeLibraries;
|
|
1196
|
+
|
|
1197
|
+
/** Every file `specifier` could mean from `fromFile`, in the order they are
|
|
1198
|
+
* tried. A resolver that caches should watch all of them: creating an earlier
|
|
1199
|
+
* candidate changes what the import means. */
|
|
1200
|
+
declare function moduleCandidates(fromFile: string, specifier: string, config?: LuautConfig): string[];
|
|
1201
|
+
/** The file `specifier` names from `fromFile`, if it exists. */
|
|
1202
|
+
declare function resolveModulePath(fromFile: string, specifier: string, config?: LuautConfig, host?: ProjectHost): string | undefined;
|
|
1203
|
+
|
|
1204
|
+
interface SourceMapNode {
|
|
1205
|
+
name: string;
|
|
1206
|
+
className: string;
|
|
1207
|
+
filePaths?: string[];
|
|
1208
|
+
children?: SourceMapNode[];
|
|
1209
|
+
}
|
|
1210
|
+
interface SourceMapOptions {
|
|
1211
|
+
/** The type names the loaded libraries define. An instance of a class not
|
|
1212
|
+
* among them is typed as `Instance`. */
|
|
1213
|
+
readonly classes: ReadonlySet<string>;
|
|
1214
|
+
/** A class's own member names. A child whose name a member already takes
|
|
1215
|
+
* is left out — Roblox resolves the member first. Defaults to the members
|
|
1216
|
+
* every instance has. */
|
|
1217
|
+
readonly membersOf?: (className: string) => ReadonlySet<string>;
|
|
1218
|
+
}
|
|
1219
|
+
interface SourceMapTypes {
|
|
1220
|
+
/** The tree's type aliases, and `game` / `workspace` for a place. */
|
|
1221
|
+
readonly program: Program;
|
|
1222
|
+
/** `declare script: ...` for a file the tree maps, or `undefined`. */
|
|
1223
|
+
scriptFor(file: string): Program | undefined;
|
|
1224
|
+
}
|
|
1225
|
+
declare function sourceMapTypes(text: string, path: string, options: SourceMapOptions): {
|
|
1226
|
+
types?: SourceMapTypes;
|
|
1227
|
+
problem?: string;
|
|
1228
|
+
};
|
|
1154
1229
|
|
|
1155
1230
|
declare const luautparser: {
|
|
1156
1231
|
readonly tokenize: typeof tokenize;
|
|
@@ -1165,4 +1240,4 @@ declare const luautparser: {
|
|
|
1165
1240
|
readonly analyzeTypes: typeof analyzeTypes;
|
|
1166
1241
|
};
|
|
1167
1242
|
|
|
1168
|
-
export { type AnalyzeTypesOptions, type AnyType, type ArrayExpression, type ArrayPattern, type ArrayPatternElement, type ArrayType, type ArrayTypeNode, type AsConstExpression, type AssignmentStatement, type BaseNode, type BaseToken, type BinaryExpression, BinaryOperators, type Binding, type BindingId, type BindingKind, type BindingTarget, type Block, type BooleanLiteral, type BreakStatement, type CallExpression, type CallStatement, type CompoundAssignmentStatement, type ConditionalType, type ConditionalTypeNode, type ContinueStatement, type DeclareStatement, type DifferenceType, type DifferenceTypeNode, type DoStatement, type EOFToken, type ErrorStatement, type ExportAllStatement, type ExportDefaultStatement, type ExportNamedStatement, type ExportSpecifier, type ExportStatement, type ExportTypeAliasStatement, type ExportedType, type Expression, type FunctionBody, type FunctionDeclaration, type FunctionDeclarationStatement, type FunctionExpression, type FunctionName, type FunctionParam, type FunctionParameter, type FunctionSignature, type FunctionType, type FunctionTypeNode, type FunctionTypeParameter, type GenericForStatement, type GenericRefType, type GenericTypeParameter, type Identifier, type IdentifierPattern, type IdentifierToken, type IfClause, type IfElseExpression, type IfStatement, type ImportSpecifier, type ImportStatement, type IndexExpression, type IndexedAccessType, type IndexedAccessTypeNode, type InferType, type InferTypeNode, type InterpolatedStringExpression, type InterpolatedStringPart, type InterpolatedStringPart_Expression, type InterpolatedStringPart_String, type InterpolatedStringToken, type IntersectionType, type IntersectionTypeNode, type KeyofType, type KeyofTypeNode, type KeywordToken, Keywords, LexError, type LiteralToken, type LiteralType, type MappedType, type MappedTypeNode, type MemberExpression, type MethodCallExpression, type ModuleExports, type NeverType, type NilLiteral, type Node, type NumberLiteral, type NumericForStatement, type ObjectPattern, type ObjectPatternProperty, type ObjectProperty, type ObjectType, type OperatorToken, Operators, type ParenthesizedExpression, type ParenthesizedTypeNode, ParseError, type ParserOptions, type PrimitiveName, type PrimitiveType, type Program, type PunctuatorToken, Punctuators, type RecoverResult, type RepeatStatement, type ReturnStatement, type SatisfiesExpression, type ScopeAnalysis, type ScopeDiagnostic, type SpreadElement, type Statement, type StringLiteral, type TableExpression, type TableField, type TableTypeNode, type TableTypeProperty, type TemplateLiteralType, type TemplateLiteralTypeNode, type Token, type TupleType, type TupleTypeNode, type Type, type TypeAliasStatement, type TypeAnalysis, type TypeAssertionExpression, type TypeDiagnostic, type TypeLiteralBoolean, type TypeLiteralNumber, type TypeLiteralString, type TypeNode, type TypePackNode, type TypeParamType, type TypePredicate, type TypePredicateNode, type TypeReference, type TypedIdentifier, type TypeofTypeNode, type UnaryExpression, UnaryOperators, type UnionType, type UnionTypeNode, type UnknownType, type VarargExpression, type VariableDeclaration, type VariadicTypeNode, type WhileStatement, analyzeScopes, analyzeTypes, anyType, arrayOf, booleanType, bufferType, containsTypeParam, luautparser as default,
|
|
1243
|
+
export { type AnalyzeTypesOptions, type AnyType, type ArrayExpression, type ArrayPattern, type ArrayPatternElement, type ArrayType, type ArrayTypeNode, type AsConstExpression, type AssignmentStatement, type BaseNode, type BaseToken, type BinaryExpression, BinaryOperators, type Binding, type BindingId, type BindingKind, type BindingTarget, type Block, type BooleanLiteral, type BreakStatement, CONFIG_FILE_NAMES, type CallExpression, type CallStatement, type CompoundAssignmentStatement, type ConditionalType, type ConditionalTypeNode, type ConfigLookup, type ConfigProblem, type ContinueStatement, type DeclareStatement, type DifferenceType, type DifferenceTypeNode, type DoStatement, type EOFToken, type ErrorStatement, type ExportAllStatement, type ExportDefaultStatement, type ExportNamedStatement, type ExportSpecifier, type ExportStatement, type ExportTypeAliasStatement, type ExportedType, type Expression, type FunctionBody, type FunctionDeclaration, type FunctionDeclarationStatement, type FunctionExpression, type FunctionName, type FunctionParam, type FunctionParameter, type FunctionSignature, type FunctionType, type FunctionTypeNode, type FunctionTypeParameter, type GenericForStatement, type GenericRefType, type GenericTypeParameter, type Identifier, type IdentifierPattern, type IdentifierToken, type IfClause, type IfElseExpression, type IfStatement, type ImportSpecifier, type ImportStatement, type IndexExpression, type IndexedAccessType, type IndexedAccessTypeNode, type InferType, type InferTypeNode, type InterpolatedStringExpression, type InterpolatedStringPart, type InterpolatedStringPart_Expression, type InterpolatedStringPart_String, type InterpolatedStringToken, type IntersectionType, type IntersectionTypeNode, type KeyofType, type KeyofTypeNode, type KeywordToken, Keywords, LexError, type LiteralToken, type LiteralType, type LuautConfig, type MappedType, type MappedTypeNode, type MemberExpression, type MethodCallExpression, type ModuleExports, type NeverType, type NilLiteral, type Node, type NumberLiteral, type NumericForStatement, type ObjectPattern, type ObjectPatternProperty, type ObjectProperty, type ObjectType, type OperatorToken, Operators, type ParenthesizedExpression, type ParenthesizedTypeNode, ParseError, type ParserOptions, type PrimitiveName, type PrimitiveType, type Program, type ProjectHost, type PunctuatorToken, Punctuators, type RecoverResult, type RepeatStatement, type ReturnStatement, type SatisfiesExpression, type ScopeAnalysis, type ScopeDiagnostic, type SourceMapNode, type SourceMapOptions, type SourceMapTypes, type SpreadElement, type Statement, type StringLiteral, type TableExpression, type TableField, type TableTypeNode, type TableTypeProperty, type TemplateLiteralType, type TemplateLiteralTypeNode, type Token, type TupleType, type TupleTypeNode, type Type, type TypeAliasStatement, type TypeAnalysis, type TypeAssertionExpression, type TypeDiagnostic, type TypeLibraries, type TypeLiteralBoolean, type TypeLiteralNumber, type TypeLiteralString, type TypeNode, type TypePackNode, type TypeParamType, type TypePredicate, type TypePredicateNode, type TypeReference, type TypedIdentifier, type TypeofTypeNode, type UnaryExpression, UnaryOperators, type UnionType, type UnionTypeNode, type UnknownType, type VarargExpression, type VariableDeclaration, type VariadicTypeNode, type WhileStatement, analyzeScopes, analyzeTypes, anyType, arrayOf, booleanType, bufferType, containsTypeParam, luautparser as default, difference, equalTypes, falsyType, findConfig, fn, formatType, getBinding, intersection, isAssignable, isGlobal, isPossiblyFalsy, isPossiblyTruthy, isUnassignedGlobal, literal, loadConfig, luautparser, matchInfer, moduleCandidates, moduleExports, narrowExclude, narrowFalsy, narrowTo, narrowTruthy, neverType, nilType, nodeHost, numberType, objectType, optional, overlaps, parse, parseExpressionFromSource, parseTokens, parseWithRecovery, primitive, resolveModulePath, resolveTypeLibraries, setAliasExpander, sourceMapTypes, stringType, stripJsonComments, substitute, templateMatches, threadType, tokenize, tuple, typeParam, unify, union, unknownType, widen };
|
package/dist/index.d.ts
CHANGED
|
@@ -1080,6 +1080,12 @@ interface TypeAnalysis {
|
|
|
1080
1080
|
* `typeof x`, a property's type inside `{ ... }`. Inside a generic alias or
|
|
1081
1081
|
* function its parameters stay unresolved (`T`). */
|
|
1082
1082
|
readonly typeOfTypeNode: Map<TypeNode | TypePackNode, Type>;
|
|
1083
|
+
/** What each call argument is expected to be: the parameter it lands on,
|
|
1084
|
+
* with the signature's type parameters replaced by their constraints — a
|
|
1085
|
+
* union when an overload set disagrees. Recorded even for a call that does
|
|
1086
|
+
* not type-check, since that is exactly when an editor wants to offer the
|
|
1087
|
+
* values that would. */
|
|
1088
|
+
readonly expectedTypeOf: Map<Expression, Type>;
|
|
1083
1089
|
/** Top-level type aliases, resolved — and the type names this module
|
|
1084
1090
|
* imports, so tooling treats both alike. */
|
|
1085
1091
|
readonly aliases: Map<string, Type>;
|
|
@@ -1111,7 +1117,8 @@ interface AnalyzeTypesOptions {
|
|
|
1111
1117
|
libTypes?: Record<string, Type>;
|
|
1112
1118
|
/** Parsed definitions files (`.d.luaut`): their `type` aliases become
|
|
1113
1119
|
* available to annotations and their `declare` statements seed global
|
|
1114
|
-
* types.
|
|
1120
|
+
* types. A project lists them under `types` in `luaut.config.json`; see
|
|
1121
|
+
* `resolveTypeLibraries`. */
|
|
1115
1122
|
libs?: readonly Program[];
|
|
1116
1123
|
/** Resolve an `import`'s module path to what that module exports. Called
|
|
1117
1124
|
* once per distinct path. Return `undefined` when there is no such module:
|
|
@@ -1128,29 +1135,97 @@ declare function moduleExports(program: Program, scopes: ScopeAnalysis, types: T
|
|
|
1128
1135
|
/** For `export ... from`: the same resolver the module was analyzed with. */
|
|
1129
1136
|
resolveModule?: (specifier: string) => ModuleExports | undefined): ModuleExports;
|
|
1130
1137
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
declare const luauLib: Program;
|
|
1138
|
+
interface ProjectHost {
|
|
1139
|
+
/** A file's text, or `undefined` when there is no such file. */
|
|
1140
|
+
readFile(path: string): string | undefined;
|
|
1141
|
+
}
|
|
1142
|
+
declare const nodeHost: ProjectHost;
|
|
1137
1143
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
/**
|
|
1141
|
-
|
|
1142
|
-
/**
|
|
1143
|
-
|
|
1144
|
+
declare const CONFIG_FILE_NAMES: readonly ["luaut.config.json", "luaut.config.jsonc"];
|
|
1145
|
+
interface LuautConfig {
|
|
1146
|
+
/** Absolute path of the config file. */
|
|
1147
|
+
readonly path: string;
|
|
1148
|
+
/** The folder it sits in. Relative paths in it resolve from here. */
|
|
1149
|
+
readonly directory: string;
|
|
1150
|
+
/** The config file's text, for locating problems in it. */
|
|
1151
|
+
readonly source: string;
|
|
1152
|
+
/** Type libraries to load, in order: `"luau"`, `"@luaut/roblox"`, `"./types"`. */
|
|
1153
|
+
readonly types: readonly string[];
|
|
1154
|
+
/** Import path aliases, as in tsconfig: `{ "@shared/*": ["src/shared/*"] }`. */
|
|
1155
|
+
readonly paths: Readonly<Record<string, readonly string[]>>;
|
|
1156
|
+
/** Where `paths` targets resolve from, absolute. The config's folder unless set. */
|
|
1157
|
+
readonly baseUrl: string;
|
|
1158
|
+
/** Absolute path of a Rojo sourcemap, or `null` for none. */
|
|
1159
|
+
readonly sourceMap: string | null;
|
|
1160
|
+
}
|
|
1161
|
+
interface ConfigProblem {
|
|
1162
|
+
/** The file the problem is about: a config file, or a sourcemap it names. */
|
|
1163
|
+
readonly file: string;
|
|
1164
|
+
readonly message: string;
|
|
1165
|
+
/** 1-based position in `file`, when the problem has one. */
|
|
1166
|
+
readonly line?: number;
|
|
1167
|
+
readonly column?: number;
|
|
1168
|
+
}
|
|
1169
|
+
interface ConfigLookup {
|
|
1170
|
+
/** The config that applies, if one was found and could be read. */
|
|
1171
|
+
readonly config?: LuautConfig;
|
|
1172
|
+
readonly problems: readonly ConfigProblem[];
|
|
1173
|
+
/** Every config path looked at on the way up, found or not — what a cache
|
|
1174
|
+
* must watch, so that creating or deleting a config is noticed. */
|
|
1175
|
+
readonly searched: readonly string[];
|
|
1176
|
+
}
|
|
1177
|
+
/** The config that applies to `file`: the nearest one in its folder or above. */
|
|
1178
|
+
declare function findConfig(file: string, host?: ProjectHost): ConfigLookup;
|
|
1179
|
+
/** Read and check one config file. Problems do not stop the rest of it from
|
|
1180
|
+
* applying: an unknown option is reported and the known ones still work. */
|
|
1181
|
+
declare function loadConfig(path: string, host?: ProjectHost): {
|
|
1182
|
+
config?: LuautConfig;
|
|
1183
|
+
problems: ConfigProblem[];
|
|
1184
|
+
};
|
|
1185
|
+
/** Blank out `//` and `/* *\/` comments and trailing commas, keeping every
|
|
1186
|
+
* other character where it was — so a JSON error's position still points
|
|
1187
|
+
* into the original text. */
|
|
1188
|
+
declare function stripJsonComments(text: string): string;
|
|
1144
1189
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1190
|
+
interface TypeLibraries {
|
|
1191
|
+
/** Definitions files, dependencies before what depends on them. */
|
|
1192
|
+
readonly files: readonly string[];
|
|
1193
|
+
readonly problems: readonly ConfigProblem[];
|
|
1194
|
+
}
|
|
1195
|
+
declare function resolveTypeLibraries(config: LuautConfig, host?: ProjectHost): TypeLibraries;
|
|
1196
|
+
|
|
1197
|
+
/** Every file `specifier` could mean from `fromFile`, in the order they are
|
|
1198
|
+
* tried. A resolver that caches should watch all of them: creating an earlier
|
|
1199
|
+
* candidate changes what the import means. */
|
|
1200
|
+
declare function moduleCandidates(fromFile: string, specifier: string, config?: LuautConfig): string[];
|
|
1201
|
+
/** The file `specifier` names from `fromFile`, if it exists. */
|
|
1202
|
+
declare function resolveModulePath(fromFile: string, specifier: string, config?: LuautConfig, host?: ProjectHost): string | undefined;
|
|
1203
|
+
|
|
1204
|
+
interface SourceMapNode {
|
|
1205
|
+
name: string;
|
|
1206
|
+
className: string;
|
|
1207
|
+
filePaths?: string[];
|
|
1208
|
+
children?: SourceMapNode[];
|
|
1209
|
+
}
|
|
1210
|
+
interface SourceMapOptions {
|
|
1211
|
+
/** The type names the loaded libraries define. An instance of a class not
|
|
1212
|
+
* among them is typed as `Instance`. */
|
|
1213
|
+
readonly classes: ReadonlySet<string>;
|
|
1214
|
+
/** A class's own member names. A child whose name a member already takes
|
|
1215
|
+
* is left out — Roblox resolves the member first. Defaults to the members
|
|
1216
|
+
* every instance has. */
|
|
1217
|
+
readonly membersOf?: (className: string) => ReadonlySet<string>;
|
|
1218
|
+
}
|
|
1219
|
+
interface SourceMapTypes {
|
|
1220
|
+
/** The tree's type aliases, and `game` / `workspace` for a place. */
|
|
1221
|
+
readonly program: Program;
|
|
1222
|
+
/** `declare script: ...` for a file the tree maps, or `undefined`. */
|
|
1223
|
+
scriptFor(file: string): Program | undefined;
|
|
1224
|
+
}
|
|
1225
|
+
declare function sourceMapTypes(text: string, path: string, options: SourceMapOptions): {
|
|
1226
|
+
types?: SourceMapTypes;
|
|
1227
|
+
problem?: string;
|
|
1228
|
+
};
|
|
1154
1229
|
|
|
1155
1230
|
declare const luautparser: {
|
|
1156
1231
|
readonly tokenize: typeof tokenize;
|
|
@@ -1165,4 +1240,4 @@ declare const luautparser: {
|
|
|
1165
1240
|
readonly analyzeTypes: typeof analyzeTypes;
|
|
1166
1241
|
};
|
|
1167
1242
|
|
|
1168
|
-
export { type AnalyzeTypesOptions, type AnyType, type ArrayExpression, type ArrayPattern, type ArrayPatternElement, type ArrayType, type ArrayTypeNode, type AsConstExpression, type AssignmentStatement, type BaseNode, type BaseToken, type BinaryExpression, BinaryOperators, type Binding, type BindingId, type BindingKind, type BindingTarget, type Block, type BooleanLiteral, type BreakStatement, type CallExpression, type CallStatement, type CompoundAssignmentStatement, type ConditionalType, type ConditionalTypeNode, type ContinueStatement, type DeclareStatement, type DifferenceType, type DifferenceTypeNode, type DoStatement, type EOFToken, type ErrorStatement, type ExportAllStatement, type ExportDefaultStatement, type ExportNamedStatement, type ExportSpecifier, type ExportStatement, type ExportTypeAliasStatement, type ExportedType, type Expression, type FunctionBody, type FunctionDeclaration, type FunctionDeclarationStatement, type FunctionExpression, type FunctionName, type FunctionParam, type FunctionParameter, type FunctionSignature, type FunctionType, type FunctionTypeNode, type FunctionTypeParameter, type GenericForStatement, type GenericRefType, type GenericTypeParameter, type Identifier, type IdentifierPattern, type IdentifierToken, type IfClause, type IfElseExpression, type IfStatement, type ImportSpecifier, type ImportStatement, type IndexExpression, type IndexedAccessType, type IndexedAccessTypeNode, type InferType, type InferTypeNode, type InterpolatedStringExpression, type InterpolatedStringPart, type InterpolatedStringPart_Expression, type InterpolatedStringPart_String, type InterpolatedStringToken, type IntersectionType, type IntersectionTypeNode, type KeyofType, type KeyofTypeNode, type KeywordToken, Keywords, LexError, type LiteralToken, type LiteralType, type MappedType, type MappedTypeNode, type MemberExpression, type MethodCallExpression, type ModuleExports, type NeverType, type NilLiteral, type Node, type NumberLiteral, type NumericForStatement, type ObjectPattern, type ObjectPatternProperty, type ObjectProperty, type ObjectType, type OperatorToken, Operators, type ParenthesizedExpression, type ParenthesizedTypeNode, ParseError, type ParserOptions, type PrimitiveName, type PrimitiveType, type Program, type PunctuatorToken, Punctuators, type RecoverResult, type RepeatStatement, type ReturnStatement, type SatisfiesExpression, type ScopeAnalysis, type ScopeDiagnostic, type SpreadElement, type Statement, type StringLiteral, type TableExpression, type TableField, type TableTypeNode, type TableTypeProperty, type TemplateLiteralType, type TemplateLiteralTypeNode, type Token, type TupleType, type TupleTypeNode, type Type, type TypeAliasStatement, type TypeAnalysis, type TypeAssertionExpression, type TypeDiagnostic, type TypeLiteralBoolean, type TypeLiteralNumber, type TypeLiteralString, type TypeNode, type TypePackNode, type TypeParamType, type TypePredicate, type TypePredicateNode, type TypeReference, type TypedIdentifier, type TypeofTypeNode, type UnaryExpression, UnaryOperators, type UnionType, type UnionTypeNode, type UnknownType, type VarargExpression, type VariableDeclaration, type VariadicTypeNode, type WhileStatement, analyzeScopes, analyzeTypes, anyType, arrayOf, booleanType, bufferType, containsTypeParam, luautparser as default,
|
|
1243
|
+
export { type AnalyzeTypesOptions, type AnyType, type ArrayExpression, type ArrayPattern, type ArrayPatternElement, type ArrayType, type ArrayTypeNode, type AsConstExpression, type AssignmentStatement, type BaseNode, type BaseToken, type BinaryExpression, BinaryOperators, type Binding, type BindingId, type BindingKind, type BindingTarget, type Block, type BooleanLiteral, type BreakStatement, CONFIG_FILE_NAMES, type CallExpression, type CallStatement, type CompoundAssignmentStatement, type ConditionalType, type ConditionalTypeNode, type ConfigLookup, type ConfigProblem, type ContinueStatement, type DeclareStatement, type DifferenceType, type DifferenceTypeNode, type DoStatement, type EOFToken, type ErrorStatement, type ExportAllStatement, type ExportDefaultStatement, type ExportNamedStatement, type ExportSpecifier, type ExportStatement, type ExportTypeAliasStatement, type ExportedType, type Expression, type FunctionBody, type FunctionDeclaration, type FunctionDeclarationStatement, type FunctionExpression, type FunctionName, type FunctionParam, type FunctionParameter, type FunctionSignature, type FunctionType, type FunctionTypeNode, type FunctionTypeParameter, type GenericForStatement, type GenericRefType, type GenericTypeParameter, type Identifier, type IdentifierPattern, type IdentifierToken, type IfClause, type IfElseExpression, type IfStatement, type ImportSpecifier, type ImportStatement, type IndexExpression, type IndexedAccessType, type IndexedAccessTypeNode, type InferType, type InferTypeNode, type InterpolatedStringExpression, type InterpolatedStringPart, type InterpolatedStringPart_Expression, type InterpolatedStringPart_String, type InterpolatedStringToken, type IntersectionType, type IntersectionTypeNode, type KeyofType, type KeyofTypeNode, type KeywordToken, Keywords, LexError, type LiteralToken, type LiteralType, type LuautConfig, type MappedType, type MappedTypeNode, type MemberExpression, type MethodCallExpression, type ModuleExports, type NeverType, type NilLiteral, type Node, type NumberLiteral, type NumericForStatement, type ObjectPattern, type ObjectPatternProperty, type ObjectProperty, type ObjectType, type OperatorToken, Operators, type ParenthesizedExpression, type ParenthesizedTypeNode, ParseError, type ParserOptions, type PrimitiveName, type PrimitiveType, type Program, type ProjectHost, type PunctuatorToken, Punctuators, type RecoverResult, type RepeatStatement, type ReturnStatement, type SatisfiesExpression, type ScopeAnalysis, type ScopeDiagnostic, type SourceMapNode, type SourceMapOptions, type SourceMapTypes, type SpreadElement, type Statement, type StringLiteral, type TableExpression, type TableField, type TableTypeNode, type TableTypeProperty, type TemplateLiteralType, type TemplateLiteralTypeNode, type Token, type TupleType, type TupleTypeNode, type Type, type TypeAliasStatement, type TypeAnalysis, type TypeAssertionExpression, type TypeDiagnostic, type TypeLibraries, type TypeLiteralBoolean, type TypeLiteralNumber, type TypeLiteralString, type TypeNode, type TypePackNode, type TypeParamType, type TypePredicate, type TypePredicateNode, type TypeReference, type TypedIdentifier, type TypeofTypeNode, type UnaryExpression, UnaryOperators, type UnionType, type UnionTypeNode, type UnknownType, type VarargExpression, type VariableDeclaration, type VariadicTypeNode, type WhileStatement, analyzeScopes, analyzeTypes, anyType, arrayOf, booleanType, bufferType, containsTypeParam, luautparser as default, difference, equalTypes, falsyType, findConfig, fn, formatType, getBinding, intersection, isAssignable, isGlobal, isPossiblyFalsy, isPossiblyTruthy, isUnassignedGlobal, literal, loadConfig, luautparser, matchInfer, moduleCandidates, moduleExports, narrowExclude, narrowFalsy, narrowTo, narrowTruthy, neverType, nilType, nodeHost, numberType, objectType, optional, overlaps, parse, parseExpressionFromSource, parseTokens, parseWithRecovery, primitive, resolveModulePath, resolveTypeLibraries, setAliasExpander, sourceMapTypes, stringType, stripJsonComments, substitute, templateMatches, threadType, tokenize, tuple, typeParam, unify, union, unknownType, widen };
|