typescript 5.5.0-dev.20240412 → 5.5.0-dev.20240414
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/lib/tsc.js +405 -139
- package/lib/typescript.d.ts +97 -30
- package/lib/typescript.js +810 -364
- package/package.json +2 -2
package/lib/typescript.d.ts
CHANGED
|
@@ -2814,7 +2814,6 @@ declare namespace ts {
|
|
|
2814
2814
|
addMissingFileRoot(fileName: NormalizedPath): void;
|
|
2815
2815
|
removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void;
|
|
2816
2816
|
registerFileUpdate(fileName: string): void;
|
|
2817
|
-
markAsDirty(): void;
|
|
2818
2817
|
/**
|
|
2819
2818
|
* Updates set of files that contribute to this project
|
|
2820
2819
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
@@ -2859,10 +2858,8 @@ declare namespace ts {
|
|
|
2859
2858
|
class AutoImportProviderProject extends Project {
|
|
2860
2859
|
private hostProject;
|
|
2861
2860
|
private rootFileNames;
|
|
2862
|
-
isOrphan(): boolean;
|
|
2863
2861
|
updateGraph(): boolean;
|
|
2864
2862
|
hasRoots(): boolean;
|
|
2865
|
-
markAsDirty(): void;
|
|
2866
2863
|
getScriptFileNames(): string[];
|
|
2867
2864
|
getLanguageService(): never;
|
|
2868
2865
|
getHostForAutoImportProvider(): never;
|
|
@@ -3119,7 +3116,7 @@ declare namespace ts {
|
|
|
3119
3116
|
/**
|
|
3120
3117
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
3121
3118
|
*/
|
|
3122
|
-
readonly openFiles: Map<
|
|
3119
|
+
readonly openFiles: Map<Path, NormalizedPath | undefined>;
|
|
3123
3120
|
/**
|
|
3124
3121
|
* Map of open files that are opened without complete path but have projectRoot as current directory
|
|
3125
3122
|
*/
|
|
@@ -3188,6 +3185,13 @@ declare namespace ts {
|
|
|
3188
3185
|
private delayUpdateSourceInfoProjects;
|
|
3189
3186
|
private delayUpdateProjectsOfScriptInfoPath;
|
|
3190
3187
|
private handleDeletedFile;
|
|
3188
|
+
/**
|
|
3189
|
+
* This function goes through all the openFiles and tries to file the config file for them.
|
|
3190
|
+
* If the config file is found and it refers to existing project, it schedules the reload it for reload
|
|
3191
|
+
* If there is no existing project it just opens the configured project for the config file
|
|
3192
|
+
* shouldReloadProjectFor provides a way to filter out files to reload configured project for
|
|
3193
|
+
*/
|
|
3194
|
+
private delayReloadConfiguredProjectsForFile;
|
|
3191
3195
|
private removeProject;
|
|
3192
3196
|
private assignOrphanScriptInfosToInferredProject;
|
|
3193
3197
|
/**
|
|
@@ -3247,7 +3251,6 @@ declare namespace ts {
|
|
|
3247
3251
|
private refreshScriptInfosInDirectory;
|
|
3248
3252
|
private stopWatchingScriptInfo;
|
|
3249
3253
|
private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath;
|
|
3250
|
-
private getOrCreateScriptInfoOpenedByClientForNormalizedPath;
|
|
3251
3254
|
getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: {
|
|
3252
3255
|
fileExists(path: string): boolean;
|
|
3253
3256
|
}): ScriptInfo | undefined;
|
|
@@ -3269,9 +3272,7 @@ declare namespace ts {
|
|
|
3269
3272
|
/**
|
|
3270
3273
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
3271
3274
|
* If the config file is found and it refers to existing project, it reloads it either immediately
|
|
3272
|
-
* or schedules it for reload depending on delayReload option
|
|
3273
3275
|
* If there is no existing project it just opens the configured project for the config file
|
|
3274
|
-
* reloadForInfo provides a way to filter out files to reload configured project for
|
|
3275
3276
|
*/
|
|
3276
3277
|
private reloadConfiguredProjectForFiles;
|
|
3277
3278
|
/**
|
|
@@ -3321,7 +3322,6 @@ declare namespace ts {
|
|
|
3321
3322
|
hasDeferredExtension(): boolean;
|
|
3322
3323
|
private enableRequestedPluginsAsync;
|
|
3323
3324
|
private enableRequestedPluginsWorker;
|
|
3324
|
-
private enableRequestedPluginsForProjectAsync;
|
|
3325
3325
|
configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
|
|
3326
3326
|
}
|
|
3327
3327
|
function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string;
|
|
@@ -5961,19 +5961,67 @@ declare namespace ts {
|
|
|
5961
5961
|
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
|
|
5962
5962
|
isSourceFileDefaultLibrary(file: SourceFile): boolean;
|
|
5963
5963
|
/**
|
|
5964
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
5965
|
-
*
|
|
5966
|
-
*
|
|
5967
|
-
*
|
|
5968
|
-
*
|
|
5964
|
+
* Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
|
|
5965
|
+
* settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
|
|
5966
|
+
* which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
|
|
5967
|
+
* overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
|
|
5968
|
+
* Some examples:
|
|
5969
|
+
*
|
|
5970
|
+
* ```ts
|
|
5971
|
+
* // tsc foo.mts --module nodenext
|
|
5972
|
+
* import {} from "mod";
|
|
5973
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
5974
|
+
*
|
|
5975
|
+
* // tsc foo.cts --module nodenext
|
|
5976
|
+
* import {} from "mod";
|
|
5977
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
5978
|
+
*
|
|
5979
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
5980
|
+
* import {} from "mod";
|
|
5981
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
5982
|
+
* // supports conditional imports/exports
|
|
5983
|
+
*
|
|
5984
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
5985
|
+
* import {} from "mod";
|
|
5986
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
5987
|
+
* // does not support conditional imports/exports
|
|
5988
|
+
*
|
|
5989
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
5990
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
5991
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
5992
|
+
* ```
|
|
5969
5993
|
*/
|
|
5970
5994
|
getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
|
|
5971
5995
|
/**
|
|
5972
|
-
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This
|
|
5973
|
-
*
|
|
5974
|
-
*
|
|
5975
|
-
*
|
|
5976
|
-
*
|
|
5996
|
+
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This function only returns a result
|
|
5997
|
+
* when module resolution settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided
|
|
5998
|
+
* via import attributes, which cause an `import` or `require` condition to be used during resolution regardless of module resolution
|
|
5999
|
+
* settings. In absence of overriding attributes, and in modes that support differing resolution, the result indicates the syntax the
|
|
6000
|
+
* usage would emit to JavaScript. Some examples:
|
|
6001
|
+
*
|
|
6002
|
+
* ```ts
|
|
6003
|
+
* // tsc foo.mts --module nodenext
|
|
6004
|
+
* import {} from "mod";
|
|
6005
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
6006
|
+
*
|
|
6007
|
+
* // tsc foo.cts --module nodenext
|
|
6008
|
+
* import {} from "mod";
|
|
6009
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
6010
|
+
*
|
|
6011
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
6012
|
+
* import {} from "mod";
|
|
6013
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
6014
|
+
* // supports conditional imports/exports
|
|
6015
|
+
*
|
|
6016
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
6017
|
+
* import {} from "mod";
|
|
6018
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
6019
|
+
* // does not support conditional imports/exports
|
|
6020
|
+
*
|
|
6021
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
6022
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
6023
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
6024
|
+
* ```
|
|
5977
6025
|
*/
|
|
5978
6026
|
getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
|
|
5979
6027
|
getProjectReferences(): readonly ProjectReference[] | undefined;
|
|
@@ -9325,24 +9373,43 @@ declare namespace ts {
|
|
|
9325
9373
|
function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
|
|
9326
9374
|
/**
|
|
9327
9375
|
* Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
|
|
9328
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
9329
|
-
*
|
|
9330
|
-
*
|
|
9331
|
-
*
|
|
9332
|
-
*
|
|
9376
|
+
* Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
|
|
9377
|
+
* settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
|
|
9378
|
+
* which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
|
|
9379
|
+
* overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
|
|
9380
|
+
* Some examples:
|
|
9381
|
+
*
|
|
9382
|
+
* ```ts
|
|
9383
|
+
* // tsc foo.mts --module nodenext
|
|
9384
|
+
* import {} from "mod";
|
|
9385
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
9386
|
+
*
|
|
9387
|
+
* // tsc foo.cts --module nodenext
|
|
9388
|
+
* import {} from "mod";
|
|
9389
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
9390
|
+
*
|
|
9391
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
9392
|
+
* import {} from "mod";
|
|
9393
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
9394
|
+
* // supports conditional imports/exports
|
|
9395
|
+
*
|
|
9396
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
9397
|
+
* import {} from "mod";
|
|
9398
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
9399
|
+
* // does not support conditional imports/exports
|
|
9400
|
+
*
|
|
9401
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
9402
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
9403
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
9404
|
+
* ```
|
|
9405
|
+
*
|
|
9333
9406
|
* @param file The file the import or import-like reference is contained within
|
|
9334
9407
|
* @param usage The module reference string
|
|
9335
9408
|
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
|
|
9336
9409
|
* should be the options of the referenced project, not the referencing project.
|
|
9337
9410
|
* @returns The final resolution mode of the import
|
|
9338
9411
|
*/
|
|
9339
|
-
function getModeForUsageLocation(
|
|
9340
|
-
file: {
|
|
9341
|
-
impliedNodeFormat?: ResolutionMode;
|
|
9342
|
-
},
|
|
9343
|
-
usage: StringLiteralLike,
|
|
9344
|
-
compilerOptions: CompilerOptions,
|
|
9345
|
-
): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
9412
|
+
function getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike, compilerOptions: CompilerOptions): ResolutionMode;
|
|
9346
9413
|
function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
|
|
9347
9414
|
/**
|
|
9348
9415
|
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|