tsc-ts 0.0.10 → 0.1.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 +1 -1
- package/bin/tsc-ts.js +70 -1
- package/dist/api/compiler/ast-utilities.d.ts +19 -1
- package/dist/api/compiler/ast-utilities.js +180 -95
- package/dist/api/compiler/ast.d.ts +20 -15
- package/dist/api/compiler/ast.js +1023 -995
- package/dist/api/compiler/astnav.js +15 -15
- package/dist/api/compiler/binder-utilities.js +186 -186
- package/dist/api/compiler/binder.js +290 -263
- package/dist/api/compiler/character-codes.js +2 -2
- package/dist/api/compiler/checker-calls.js +173 -123
- package/dist/api/compiler/checker-classes.d.ts +14 -3
- package/dist/api/compiler/checker-classes.js +134 -90
- package/dist/api/compiler/checker-contextual.js +64 -61
- package/dist/api/compiler/checker-declaration-order.js +79 -79
- package/dist/api/compiler/checker-declarations.d.ts +1 -0
- package/dist/api/compiler/checker-declarations.js +160 -136
- package/dist/api/compiler/checker-declared-types.js +67 -65
- package/dist/api/compiler/checker-decorators.js +77 -77
- package/dist/api/compiler/checker-deprecation.d.ts +8 -3
- package/dist/api/compiler/checker-deprecation.js +76 -55
- package/dist/api/compiler/checker-destructuring.js +47 -45
- package/dist/api/compiler/checker-elaboration.js +24 -24
- package/dist/api/compiler/checker-emit-helpers.js +4 -4
- package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
- package/dist/api/compiler/checker-emit-resolver.js +25 -13
- package/dist/api/compiler/checker-evaluator.js +9 -9
- package/dist/api/compiler/checker-expressions.js +244 -211
- package/dist/api/compiler/checker-functions.js +113 -107
- package/dist/api/compiler/checker-generated-code.d.ts +0 -11
- package/dist/api/compiler/checker-generated-code.js +28 -52
- package/dist/api/compiler/checker-grammar.d.ts +1 -0
- package/dist/api/compiler/checker-grammar.js +469 -438
- package/dist/api/compiler/checker-heritage.js +91 -93
- package/dist/api/compiler/checker-inference.d.ts +77 -5
- package/dist/api/compiler/checker-inference.js +487 -113
- package/dist/api/compiler/checker-iteration.d.ts +0 -10
- package/dist/api/compiler/checker-iteration.js +35 -52
- package/dist/api/compiler/checker-javascript.js +14 -14
- package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
- package/dist/api/compiler/checker-jsdoc.js +67 -58
- package/dist/api/compiler/checker-jsx.js +105 -88
- package/dist/api/compiler/checker-members.d.ts +9 -2
- package/dist/api/compiler/checker-members.js +210 -74
- package/dist/api/compiler/checker-modules.d.ts +15 -6
- package/dist/api/compiler/checker-modules.js +469 -309
- package/dist/api/compiler/checker-narrowing.js +273 -189
- package/dist/api/compiler/checker-object-literals.js +25 -22
- package/dist/api/compiler/checker-operators.js +126 -118
- package/dist/api/compiler/checker-overloads.js +27 -27
- package/dist/api/compiler/checker-property-access.js +59 -55
- package/dist/api/compiler/checker-services.d.ts +1 -0
- package/dist/api/compiler/checker-services.js +222 -210
- package/dist/api/compiler/checker-signatures.js +65 -49
- package/dist/api/compiler/checker-source-file.d.ts +5 -0
- package/dist/api/compiler/checker-source-file.js +154 -130
- package/dist/api/compiler/checker-statements.js +33 -32
- package/dist/api/compiler/checker-super.js +50 -50
- package/dist/api/compiler/checker-symbol-types.js +109 -93
- package/dist/api/compiler/checker-symbols.d.ts +13 -1
- package/dist/api/compiler/checker-symbols.js +264 -149
- package/dist/api/compiler/checker-type-factory.d.ts +5 -0
- package/dist/api/compiler/checker-type-factory.js +137 -34
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
- package/dist/api/compiler/checker-type-nodes.js +179 -141
- package/dist/api/compiler/checker-type-operators.d.ts +2 -0
- package/dist/api/compiler/checker-type-operators.js +110 -63
- package/dist/api/compiler/checker-types.d.ts +80 -3
- package/dist/api/compiler/checker-types.js +121 -2
- package/dist/api/compiler/checker-unused.js +114 -118
- package/dist/api/compiler/checker-utilities.js +11 -11
- package/dist/api/compiler/checker.d.ts +93 -31
- package/dist/api/compiler/checker.js +143 -35
- package/dist/api/compiler/command-line.d.ts +1 -3
- package/dist/api/compiler/command-line.js +47 -44
- package/dist/api/compiler/compile-program.d.ts +19 -4
- package/dist/api/compiler/compile-program.js +45 -26
- package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
- package/dist/api/compiler/diagnostic-messages.js +128 -122
- package/dist/api/compiler/diagnostics.js +7 -7
- package/dist/api/compiler/emitter.d.ts +7 -1
- package/dist/api/compiler/emitter.js +53 -11
- package/dist/api/compiler/file-include.d.ts +2 -1
- package/dist/api/compiler/file-include.js +11 -7
- package/dist/api/compiler/file-loader.d.ts +10 -0
- package/dist/api/compiler/file-loader.js +138 -41
- package/dist/api/compiler/instantiation.d.ts +7 -0
- package/dist/api/compiler/instantiation.js +101 -49
- package/dist/api/compiler/jsdoc.js +23 -23
- package/dist/api/compiler/link-tables.d.ts +48 -18
- package/dist/api/compiler/link-tables.js +80 -37
- package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
- package/dist/api/compiler/locales/cs-CZ.js +1 -1
- package/dist/api/compiler/locales/de-DE.d.ts +1 -1
- package/dist/api/compiler/locales/de-DE.js +1 -1
- package/dist/api/compiler/locales/es-ES.d.ts +1 -1
- package/dist/api/compiler/locales/es-ES.js +1 -1
- package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
- package/dist/api/compiler/locales/fr-FR.js +1 -1
- package/dist/api/compiler/locales/it-IT.d.ts +1 -1
- package/dist/api/compiler/locales/it-IT.js +1 -1
- package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
- package/dist/api/compiler/locales/ja-JP.js +1 -1
- package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
- package/dist/api/compiler/locales/ko-KR.js +1 -1
- package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
- package/dist/api/compiler/locales/pl-PL.js +1 -1
- package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
- package/dist/api/compiler/locales/pt-BR.js +1 -1
- package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
- package/dist/api/compiler/locales/ru-RU.js +1 -1
- package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
- package/dist/api/compiler/locales/tr-TR.js +1 -1
- package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
- package/dist/api/compiler/locales/zh-CN.js +1 -1
- package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
- package/dist/api/compiler/locales/zh-TW.js +1 -1
- package/dist/api/compiler/module-resolution-types.js +6 -6
- package/dist/api/compiler/module-resolution.d.ts +10 -1
- package/dist/api/compiler/module-resolution.js +115 -84
- package/dist/api/compiler/module-specifiers.d.ts +15 -0
- package/dist/api/compiler/module-specifiers.js +24 -18
- package/dist/api/compiler/name-resolver.js +74 -65
- package/dist/api/compiler/node-builder-names.d.ts +11 -3
- package/dist/api/compiler/node-builder-names.js +210 -90
- package/dist/api/compiler/node-builder-pseudo.js +29 -31
- package/dist/api/compiler/node-builder-reuse.js +23 -22
- package/dist/api/compiler/node-builder.d.ts +18 -1
- package/dist/api/compiler/node-builder.js +191 -102
- package/dist/api/compiler/option-declarations.d.ts +2 -6
- package/dist/api/compiler/option-declarations.js +315 -375
- package/dist/api/compiler/options.d.ts +15 -33
- package/dist/api/compiler/options.js +21 -54
- package/dist/api/compiler/output-paths.d.ts +4 -1
- package/dist/api/compiler/output-paths.js +6 -11
- package/dist/api/compiler/package-json.d.ts +3 -3
- package/dist/api/compiler/package-json.js +11 -10
- package/dist/api/compiler/parser.d.ts +40 -19
- package/dist/api/compiler/parser.js +308 -216
- package/dist/api/compiler/path.d.ts +9 -0
- package/dist/api/compiler/path.js +20 -3
- package/dist/api/compiler/printer/emit-context.d.ts +3 -1
- package/dist/api/compiler/printer/emit-context.js +16 -1
- package/dist/api/compiler/printer/factory-base.d.ts +2 -2
- package/dist/api/compiler/printer/factory-base.js +7 -3
- package/dist/api/compiler/printer/factory.js +3 -1
- package/dist/api/compiler/printer/helpers.js +10 -1
- package/dist/api/compiler/printer/name-generator.d.ts +1 -1
- package/dist/api/compiler/printer/name-generator.js +35 -16
- package/dist/api/compiler/printer/printer.d.ts +1 -0
- package/dist/api/compiler/printer/printer.js +303 -281
- package/dist/api/compiler/printer/utilities.js +149 -147
- package/dist/api/compiler/program-checker.d.ts +8 -2
- package/dist/api/compiler/program-checker.js +84 -34
- package/dist/api/compiler/program-utilities.d.ts +3 -1
- package/dist/api/compiler/program-utilities.js +28 -15
- package/dist/api/compiler/program.d.ts +2 -0
- package/dist/api/compiler/program.js +69 -57
- package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
- package/dist/api/compiler/pseudo-bigint.js +18 -0
- package/dist/api/compiler/regexp-checker.d.ts +1 -1
- package/dist/api/compiler/regexp-checker.js +93 -76
- package/dist/api/compiler/relations.d.ts +27 -4
- package/dist/api/compiler/relations.js +337 -180
- package/dist/api/compiler/reparser.js +60 -56
- package/dist/api/compiler/scanner.d.ts +19 -2
- package/dist/api/compiler/scanner.js +123 -108
- package/dist/api/compiler/shared-results.d.ts +463 -0
- package/dist/api/compiler/shared-results.js +2128 -0
- package/dist/api/compiler/sourcemap.js +2 -2
- package/dist/api/compiler/symbol-accessibility.js +87 -74
- package/dist/api/compiler/symbol.d.ts +22 -13
- package/dist/api/compiler/symbol.js +15 -1
- package/dist/api/compiler/syntax-kind.d.ts +198 -197
- package/dist/api/compiler/transformers/alias-references.js +247 -139
- package/dist/api/compiler/transformers/async-utilities.js +25 -25
- package/dist/api/compiler/transformers/async.d.ts +0 -1
- package/dist/api/compiler/transformers/async.js +64 -77
- package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
- package/dist/api/compiler/transformers/class-fields.js +81 -78
- package/dist/api/compiler/transformers/commonjs-module.js +18 -15
- package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
- package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
- package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
- package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
- package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
- package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
- package/dist/api/compiler/transformers/declarations.d.ts +4 -1
- package/dist/api/compiler/transformers/declarations.js +305 -238
- package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
- package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
- package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
- package/dist/api/compiler/transformers/destructuring.js +19 -18
- package/dist/api/compiler/transformers/emit-resolver.js +1 -1
- package/dist/api/compiler/transformers/es-decorators.js +55 -55
- package/dist/api/compiler/transformers/external-module-info.js +3 -3
- package/dist/api/compiler/transformers/for-await.js +25 -25
- package/dist/api/compiler/transformers/import-elision.js +14 -14
- package/dist/api/compiler/transformers/jsx.js +12 -12
- package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
- package/dist/api/compiler/transformers/module.js +8 -8
- package/dist/api/compiler/transformers/named-evaluation.js +4 -4
- package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
- package/dist/api/compiler/transformers/optional-chain.js +10 -10
- package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
- package/dist/api/compiler/transformers/reference-resolver.js +131 -69
- package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
- package/dist/api/compiler/transformers/subtree-facts.js +47 -47
- package/dist/api/compiler/transformers/syntax-facts.js +56 -58
- package/dist/api/compiler/transformers/type-eraser.js +73 -66
- package/dist/api/compiler/transformers/type-serialization.js +24 -24
- package/dist/api/compiler/transformers/using.js +12 -12
- package/dist/api/compiler/transformers/utilities.js +77 -77
- package/dist/api/compiler/transformers/visitor-base.js +172 -172
- package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
- package/dist/api/compiler/tsconfig.d.ts +10 -2
- package/dist/api/compiler/tsconfig.js +136 -48
- package/dist/api/compiler/type-printer.js +40 -3
- package/dist/api/compiler/types.d.ts +2 -1
- package/dist/api/library/ast.generated.d.ts +42 -39
- package/dist/api/library/ast.generated.js +1 -1
- package/dist/api/library/compiler-options.generated.d.ts +111 -100
- package/dist/api/library/compiler-options.generated.js +1 -1
- package/dist/api/library/disk.js +12 -1
- package/dist/api/library/enums.generated.d.ts +206 -206
- package/dist/api/library/enums.generated.js +206 -206
- package/dist/api/library/nodes.js +26 -26
- package/package.json +9 -9
- package/src/compiler/ast-utilities.ts +99 -7
- package/src/compiler/ast.ts +55 -26
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +76 -8
- package/src/compiler/checker-classes.ts +78 -24
- package/src/compiler/checker-contextual.ts +6 -1
- package/src/compiler/checker-declarations.ts +31 -4
- package/src/compiler/checker-declared-types.ts +8 -5
- package/src/compiler/checker-decorators.ts +1 -1
- package/src/compiler/checker-deprecation.ts +29 -8
- package/src/compiler/checker-destructuring.ts +10 -3
- package/src/compiler/checker-emit-helpers.ts +1 -0
- package/src/compiler/checker-emit-resolver.ts +16 -6
- package/src/compiler/checker-expressions.ts +79 -46
- package/src/compiler/checker-functions.ts +21 -6
- package/src/compiler/checker-generated-code.ts +2 -22
- package/src/compiler/checker-grammar.ts +133 -60
- package/src/compiler/checker-heritage.ts +22 -21
- package/src/compiler/checker-inference.ts +514 -87
- package/src/compiler/checker-iteration.ts +18 -31
- package/src/compiler/checker-javascript.ts +1 -1
- package/src/compiler/checker-jsdoc.ts +50 -27
- package/src/compiler/checker-jsx.ts +26 -4
- package/src/compiler/checker-members.ts +197 -55
- package/src/compiler/checker-modules.ts +332 -65
- package/src/compiler/checker-narrowing.ts +98 -19
- package/src/compiler/checker-object-literals.ts +3 -0
- package/src/compiler/checker-operators.ts +11 -4
- package/src/compiler/checker-property-access.ts +7 -2
- package/src/compiler/checker-services.ts +39 -12
- package/src/compiler/checker-signatures.ts +15 -1
- package/src/compiler/checker-source-file.ts +39 -13
- package/src/compiler/checker-statements.ts +3 -2
- package/src/compiler/checker-symbol-types.ts +29 -6
- package/src/compiler/checker-symbols.ts +158 -15
- package/src/compiler/checker-type-factory.ts +120 -21
- package/src/compiler/checker-type-nodes.ts +46 -3
- package/src/compiler/checker-type-operators.ts +83 -26
- package/src/compiler/checker-types.ts +147 -4
- package/src/compiler/checker-unused.ts +9 -14
- package/src/compiler/checker.ts +168 -41
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +51 -25
- package/src/compiler/decoder.ts +13 -4
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- package/src/compiler/emitter.ts +57 -8
- package/src/compiler/encoder.ts +23 -8
- package/src/compiler/file-include.ts +9 -3
- package/src/compiler/file-loader.ts +139 -32
- package/src/compiler/help.ts +10 -14
- package/src/compiler/incremental.ts +86 -18
- package/src/compiler/init.ts +2 -7
- package/src/compiler/instantiation.ts +77 -22
- package/src/compiler/jsdoc.ts +3 -1
- package/src/compiler/link-tables.ts +82 -37
- package/src/compiler/locales/cs-CZ.ts +1 -1
- package/src/compiler/locales/de-DE.ts +1 -1
- package/src/compiler/locales/es-ES.ts +1 -1
- package/src/compiler/locales/fr-FR.ts +1 -1
- package/src/compiler/locales/it-IT.ts +1 -1
- package/src/compiler/locales/ja-JP.ts +1 -1
- package/src/compiler/locales/ko-KR.ts +1 -1
- package/src/compiler/locales/pl-PL.ts +1 -1
- package/src/compiler/locales/pt-BR.ts +1 -1
- package/src/compiler/locales/ru-RU.ts +1 -1
- package/src/compiler/locales/tr-TR.ts +1 -1
- package/src/compiler/locales/zh-CN.ts +1 -1
- package/src/compiler/locales/zh-TW.ts +1 -1
- package/src/compiler/module-resolution.ts +44 -8
- package/src/compiler/module-specifiers.ts +62 -20
- package/src/compiler/name-resolver.ts +9 -1
- package/src/compiler/node-builder-names.ts +236 -54
- package/src/compiler/node-builder-pseudo.ts +4 -7
- package/src/compiler/node-builder-reuse.ts +5 -4
- package/src/compiler/node-builder.ts +130 -31
- package/src/compiler/option-declarations.ts +33 -103
- package/src/compiler/options.ts +23 -62
- package/src/compiler/output-paths.ts +5 -18
- package/src/compiler/package-entrypoints.ts +345 -0
- package/src/compiler/package-json.ts +4 -4
- package/src/compiler/parallel-check.ts +197 -8
- package/src/compiler/parallel-emit.ts +1 -1
- package/src/compiler/parser.ts +156 -39
- package/src/compiler/path.ts +22 -2
- package/src/compiler/printer/emit-context.ts +16 -0
- package/src/compiler/printer/factory-base.ts +10 -3
- package/src/compiler/printer/factory.ts +4 -1
- package/src/compiler/printer/helpers.ts +10 -1
- package/src/compiler/printer/name-generator.ts +24 -2
- package/src/compiler/printer/printer.ts +35 -14
- package/src/compiler/printer/utilities.ts +8 -2
- package/src/compiler/program-checker.ts +53 -5
- package/src/compiler/program-utilities.ts +23 -10
- package/src/compiler/program.ts +13 -1
- package/src/compiler/pseudo-bigint.ts +17 -0
- package/src/compiler/regexp-checker.ts +63 -30
- package/src/compiler/relations.ts +233 -77
- package/src/compiler/reparser.ts +7 -2
- package/src/compiler/scanner.ts +109 -79
- package/src/compiler/shared-results.ts +2414 -0
- package/src/compiler/show-config.ts +18 -1
- package/src/compiler/sourcemap.ts +2 -2
- package/src/compiler/symbol-accessibility.ts +26 -3
- package/src/compiler/symbol.ts +31 -14
- package/src/compiler/syntax-kind.ts +188 -187
- package/src/compiler/thread-entry.ts +19 -2
- package/src/compiler/transformers/alias-references.ts +123 -4
- package/src/compiler/transformers/async.ts +2 -17
- package/src/compiler/transformers/class-fields.ts +13 -12
- package/src/compiler/transformers/commonjs-module.ts +11 -7
- package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
- package/src/compiler/transformers/declarations-pseudo.ts +2 -4
- package/src/compiler/transformers/declarations-resolver.ts +0 -3
- package/src/compiler/transformers/declarations-syntactic.ts +1 -21
- package/src/compiler/transformers/declarations.ts +134 -48
- package/src/compiler/transformers/decorator-metadata.ts +9 -1
- package/src/compiler/transformers/destructuring.ts +4 -3
- package/src/compiler/transformers/external-module-info.ts +1 -1
- package/src/compiler/transformers/jsx.ts +2 -1
- package/src/compiler/transformers/reference-resolver.ts +83 -19
- package/src/compiler/transformers/runtime-syntax.ts +6 -1
- package/src/compiler/transformers/syntax-facts.ts +2 -7
- package/src/compiler/transformers/type-eraser.ts +10 -1
- package/src/compiler/transformers/type-serialization.ts +3 -2
- package/src/compiler/transformers/visitor-base.ts +2 -1
- package/src/compiler/transformers/visitor-hooks.ts +9 -4
- package/src/compiler/tsc-build.ts +3 -0
- package/src/compiler/tsc-cli.ts +2 -0
- package/src/compiler/tsc-compile.ts +7 -2
- package/src/compiler/tsc-watch.ts +74 -45
- package/src/compiler/tsconfig.ts +176 -19
- package/src/compiler/type-printer.ts +36 -2
- package/src/compiler/types.ts +2 -1
- package/src/library/ast.generated.ts +57 -41
- package/src/library/compiler-options.generated.ts +117 -103
- package/src/library/disk.ts +10 -1
- package/src/library/enums.generated.ts +196 -196
|
@@ -15,10 +15,11 @@ import { getTypesPackageName, moduleResolutionKindName } from './module-resoluti
|
|
|
15
15
|
import { getAllowJS, getEmitDeclarations, getEmitModuleKind, getEmitScriptTarget, getModuleResolutionKind, getStrictOptionValue, JsxEmit, ModuleKind, ModuleResolutionKind, ScriptTarget, } from './options.js';
|
|
16
16
|
import { getCommonSourceDirectory, getComputedCommonSourceDirectory, getOutputPathsFor, getSourceFilePathInNewDirWorker, } from './output-paths.js';
|
|
17
17
|
import { parseIsolatedEntityName } from './parser.js';
|
|
18
|
-
import { combinePaths, comparePaths, containsPath, getBaseFileName, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getPathComponentsRelativeTo, getPathFromPathComponents, getRelativePathFromFile, getRootLength, pathIsAbsolute, pathIsRelative, toFileNameLowerCase, toPath, } from './path.js';
|
|
18
|
+
import { combinePaths, comparePaths, containsPath, getBaseFileName, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getPathComponentsRelativeTo, getPathFromPathComponents, getRelativePathFromFile, getRootLength, pathIsAbsolute, pathIsRelative, toFileNameLowerCase, toPath, isNetworkPathValue, } from './path.js';
|
|
19
19
|
import { getDefaultResolutionModeForFile, getImpliedNodeFormatForEmit, getModeForUsageLocation, isCheckJsEnabledForFile, isSourceFileJS, jsxEmitName, moduleKindName, libFileMetadata, } from './program-utilities.js';
|
|
20
20
|
import { isIdentifierText } from './scanner.js';
|
|
21
21
|
import { diagnosticAtNode, findPropertyAssignment, getTsConfigObjectLiteral, } from './tsconfig.js';
|
|
22
|
+
import { isSourcePhaseImport } from './ast-utilities.js';
|
|
22
23
|
import { KnownSymlinks } from './symlinks.js';
|
|
23
24
|
import { mark } from './timeline.js';
|
|
24
25
|
// The symlink caches and packages maps of programs shared with other threads (`prepareForSharing`),
|
|
@@ -187,6 +188,10 @@ export class Program {
|
|
|
187
188
|
getRedirectTargets(path) {
|
|
188
189
|
return this.processed.redirectTargets.get(path) ?? [];
|
|
189
190
|
}
|
|
191
|
+
/** The nearest `package.json` lookup at or above `directory`. */
|
|
192
|
+
getPackageScopeForPath(directory) {
|
|
193
|
+
return this.processed.resolver.getPackageScopeForPath(directory);
|
|
194
|
+
}
|
|
190
195
|
/** The directory of the nearest `package.json` at or above `directory`, or `''`. */
|
|
191
196
|
getNearestAncestorDirectoryWithPackageJson(directory) {
|
|
192
197
|
const scope = this.processed.resolver.getPackageScopeForPath(directory);
|
|
@@ -255,7 +260,8 @@ export class Program {
|
|
|
255
260
|
symlinks.hasDirectory(this.toPath(combinePaths(combinePaths(directory, 'node_modules'), getTypesPackageName(dependency)))))
|
|
256
261
|
continue;
|
|
257
262
|
const resolved = resolver.resolvePackageDirectory(dependency, packageJsonName, ModuleKind.CommonJS);
|
|
258
|
-
|
|
263
|
+
// A dependency installed in place has no original path to map from.
|
|
264
|
+
if (resolved !== undefined && resolved.resolvedFileName !== '' && resolved.originalPath !== '')
|
|
259
265
|
symlinks.processResolution(combinePaths(resolved.originalPath, 'package.json'), combinePaths(resolved.resolvedFileName, 'package.json'));
|
|
260
266
|
}
|
|
261
267
|
}
|
|
@@ -334,6 +340,9 @@ export class Program {
|
|
|
334
340
|
return this.processed.jsxRuntimeImports.get(path)?.specifier;
|
|
335
341
|
}
|
|
336
342
|
getResolvedModuleFromModuleSpecifier(file, specifier) {
|
|
343
|
+
// A source phase import loads no module declarations.
|
|
344
|
+
if (specifier.parent !== undefined && isSourcePhaseImport(specifier.parent))
|
|
345
|
+
return undefined;
|
|
337
346
|
const text = specifierText(specifier);
|
|
338
347
|
return this.getResolvedModule(file, text, this.getModeForUsageLocation(file, specifier));
|
|
339
348
|
}
|
|
@@ -383,7 +392,7 @@ export class Program {
|
|
|
383
392
|
if (containsPath(root, file, this.useCaseSensitiveFileNames, this.currentDirectory))
|
|
384
393
|
continue;
|
|
385
394
|
const absolute = getCanonicalFileName(getNormalizedAbsolutePath(file, this.currentDirectory), this.useCaseSensitiveFileNames);
|
|
386
|
-
this.includeProcessor.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude(absolute, undefined,
|
|
395
|
+
this.includeProcessor.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude(absolute, undefined, 1245 /* Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files */, [file, root]));
|
|
387
396
|
}
|
|
388
397
|
}
|
|
389
398
|
/**
|
|
@@ -549,10 +558,10 @@ export class Program {
|
|
|
549
558
|
}
|
|
550
559
|
removedOptionDiagnostic(name, value, useInstead) {
|
|
551
560
|
const diagnostic = value === ''
|
|
552
|
-
? this.optionDiagnostic(true, name, '',
|
|
553
|
-
: this.optionDiagnostic(false, name, '',
|
|
561
|
+
? this.optionDiagnostic(true, name, '', 1181 /* Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration */, [name])
|
|
562
|
+
: this.optionDiagnostic(false, name, '', 1187 /* Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration */, [name, value]);
|
|
554
563
|
if (useInstead !== '')
|
|
555
|
-
diagnostic.addMessageChain(createCompilerDiagnostic(
|
|
564
|
+
diagnostic.addMessageChain(createCompilerDiagnostic(1185 /* Diagnostics.Use_0_instead */, useInstead));
|
|
556
565
|
}
|
|
557
566
|
pathsDiagnostic(onKey, key, message, args) {
|
|
558
567
|
const paths = findPropertyAssignment(this.compilerOptionsObject(), 'paths');
|
|
@@ -614,37 +623,37 @@ export class Program {
|
|
|
614
623
|
this.removedOptionDiagnostic('downlevelIteration', '', '');
|
|
615
624
|
const strictNullChecks = getStrictOptionValue(options, options.strictNullChecks);
|
|
616
625
|
if (options.strictPropertyInitialization === true && !strictNullChecks) {
|
|
617
|
-
this.optionNameDiagnostic(
|
|
626
|
+
this.optionNameDiagnostic(1135 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1 */, 'strictPropertyInitialization', 'strictNullChecks');
|
|
618
627
|
}
|
|
619
628
|
if (options.exactOptionalPropertyTypes === true && !strictNullChecks) {
|
|
620
|
-
this.optionNameDiagnostic(
|
|
629
|
+
this.optionNameDiagnostic(1135 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1 */, 'exactOptionalPropertyTypes', 'strictNullChecks');
|
|
621
630
|
}
|
|
622
631
|
if (options.isolatedDeclarations === true) {
|
|
623
632
|
if (getAllowJS(options)) {
|
|
624
|
-
this.optionNameDiagnostic(
|
|
633
|
+
this.optionNameDiagnostic(1136 /* Diagnostics.Option_0_cannot_be_specified_with_option_1 */, 'allowJs', 'isolatedDeclarations');
|
|
625
634
|
}
|
|
626
635
|
if (!getEmitDeclarations(options)) {
|
|
627
|
-
this.optionNameDiagnostic(
|
|
636
|
+
this.optionNameDiagnostic(1151 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 */, 'isolatedDeclarations', 'declaration', 'composite');
|
|
628
637
|
}
|
|
629
638
|
}
|
|
630
639
|
if (options.inlineSourceMap === true) {
|
|
631
640
|
if (options.sourceMap === true) {
|
|
632
|
-
this.optionNameDiagnostic(
|
|
641
|
+
this.optionNameDiagnostic(1136 /* Diagnostics.Option_0_cannot_be_specified_with_option_1 */, 'sourceMap', 'inlineSourceMap');
|
|
633
642
|
}
|
|
634
643
|
if (options.mapRoot !== undefined) {
|
|
635
|
-
this.optionNameDiagnostic(
|
|
644
|
+
this.optionNameDiagnostic(1136 /* Diagnostics.Option_0_cannot_be_specified_with_option_1 */, 'mapRoot', 'inlineSourceMap');
|
|
636
645
|
}
|
|
637
646
|
}
|
|
638
647
|
if (options.composite === true) {
|
|
639
648
|
if (options.declaration === false) {
|
|
640
|
-
this.optionNameDiagnostic(
|
|
649
|
+
this.optionNameDiagnostic(1454 /* Diagnostics.Composite_projects_may_not_disable_declaration_emit */, 'declaration', '');
|
|
641
650
|
}
|
|
642
651
|
if (options.incremental === false) {
|
|
643
|
-
this.optionNameDiagnostic(
|
|
652
|
+
this.optionNameDiagnostic(1480 /* Diagnostics.Composite_projects_may_not_disable_incremental_compilation */, 'declaration', '');
|
|
644
653
|
}
|
|
645
654
|
}
|
|
646
655
|
if (options.tsBuildInfoFile === undefined && options.incremental === true && options.configFilePath === undefined) {
|
|
647
|
-
this.compilerOptionsDiagnostic(
|
|
656
|
+
this.compilerOptionsDiagnostic(1156 /* Diagnostics.Option_incremental_is_only_valid_with_a_known_configuration_file_like_tsconfig_json_or_when_tsBuildInfoFile_is_explicitly_provided */, []);
|
|
648
657
|
}
|
|
649
658
|
this.verifyProjectReferences();
|
|
650
659
|
if (options.composite === true) {
|
|
@@ -653,57 +662,60 @@ export class Program {
|
|
|
653
662
|
rootPaths.add(this.toPath(fileName));
|
|
654
663
|
for (const file of this.processed.files) {
|
|
655
664
|
if (this.sourceFileMayBeEmitted(file, false) && !rootPaths.has(file.path)) {
|
|
656
|
-
this.includeProcessor.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude(file.path, undefined,
|
|
665
|
+
this.includeProcessor.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude(file.path, undefined, 1457 /* Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern */, [file.fileName, configFilePath]));
|
|
657
666
|
}
|
|
658
667
|
}
|
|
659
668
|
}
|
|
660
669
|
if (options.paths !== undefined) {
|
|
661
670
|
for (const [key, value] of options.paths) {
|
|
662
671
|
if (!hasZeroOrOneAsterisk(key)) {
|
|
663
|
-
this.pathsDiagnostic(true, key,
|
|
672
|
+
this.pathsDiagnostic(true, key, 1143 /* Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character */, [key]);
|
|
664
673
|
}
|
|
665
674
|
if (value === undefined) {
|
|
666
|
-
this.pathsDiagnostic(false, key,
|
|
675
|
+
this.pathsDiagnostic(false, key, 1145 /* Diagnostics.Substitutions_for_pattern_0_should_be_an_array */, [key]);
|
|
667
676
|
}
|
|
668
677
|
else if (value.length === 0) {
|
|
669
|
-
this.pathsDiagnostic(false, key,
|
|
678
|
+
this.pathsDiagnostic(false, key, 1148 /* Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array */, [key]);
|
|
670
679
|
}
|
|
671
680
|
if (value === undefined)
|
|
672
681
|
continue;
|
|
673
682
|
for (let i = 0; i < value.length; i++) {
|
|
674
683
|
const substitution = value[i];
|
|
675
684
|
if (!hasZeroOrOneAsterisk(substitution)) {
|
|
676
|
-
this.pathsValueDiagnostic(key, i,
|
|
685
|
+
this.pathsValueDiagnostic(key, i, 1144 /* Diagnostics.Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character */, [substitution, key]);
|
|
677
686
|
}
|
|
678
687
|
if (!pathIsRelative(substitution) && !pathIsAbsolute(substitution)) {
|
|
679
|
-
this.pathsValueDiagnostic(key, i,
|
|
688
|
+
this.pathsValueDiagnostic(key, i, 1171 /* Diagnostics.Non_relative_paths_are_not_allowed_Did_you_forget_a_leading_Slash */, []);
|
|
689
|
+
}
|
|
690
|
+
else if (isNetworkPathValue(substitution, options.pathsBasePath ?? this.currentDirectory)) {
|
|
691
|
+
this.pathsValueDiagnostic(key, i, 1195 /* Diagnostics.Network_path_0_is_not_supported */, [substitution]);
|
|
680
692
|
}
|
|
681
693
|
}
|
|
682
694
|
}
|
|
683
695
|
}
|
|
684
696
|
if (options.sourceMap !== true && options.inlineSourceMap !== true) {
|
|
685
697
|
if (options.inlineSources === true) {
|
|
686
|
-
this.optionNameDiagnostic(
|
|
698
|
+
this.optionNameDiagnostic(1134 /* Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided */, 'inlineSources', '');
|
|
687
699
|
}
|
|
688
700
|
if (options.sourceRoot !== undefined) {
|
|
689
|
-
this.optionNameDiagnostic(
|
|
701
|
+
this.optionNameDiagnostic(1134 /* Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided */, 'sourceRoot', '');
|
|
690
702
|
}
|
|
691
703
|
}
|
|
692
704
|
if (options.mapRoot !== undefined && !(options.sourceMap === true || options.declarationMap === true)) {
|
|
693
|
-
this.optionNameDiagnostic(
|
|
705
|
+
this.optionNameDiagnostic(1151 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 */, 'mapRoot', 'sourceMap', 'declarationMap');
|
|
694
706
|
}
|
|
695
707
|
if (options.declarationDir !== undefined && !getEmitDeclarations(options)) {
|
|
696
|
-
this.optionNameDiagnostic(
|
|
708
|
+
this.optionNameDiagnostic(1151 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 */, 'declarationDir', 'declaration', 'composite');
|
|
697
709
|
}
|
|
698
710
|
if (options.declarationMap === true && !getEmitDeclarations(options)) {
|
|
699
|
-
this.optionNameDiagnostic(
|
|
711
|
+
this.optionNameDiagnostic(1151 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 */, 'declarationMap', 'declaration', 'composite');
|
|
700
712
|
}
|
|
701
713
|
if (options.lib !== undefined && options.noLib === true) {
|
|
702
|
-
this.optionNameDiagnostic(
|
|
714
|
+
this.optionNameDiagnostic(1136 /* Diagnostics.Option_0_cannot_be_specified_with_option_1 */, 'lib', 'noLib');
|
|
703
715
|
}
|
|
704
716
|
if ((options.isolatedModules === true || options.verbatimModuleSyntax === true) &&
|
|
705
717
|
options.preserveConstEnums === false) {
|
|
706
|
-
this.optionNameDiagnostic(
|
|
718
|
+
this.optionNameDiagnostic(1172 /* Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_0_is_enabled */, options.verbatimModuleSyntax === true ? 'verbatimModuleSyntax' : 'isolatedModules', 'preserveConstEnums');
|
|
707
719
|
}
|
|
708
720
|
if (options.outDir !== undefined ||
|
|
709
721
|
options.rootDir !== undefined ||
|
|
@@ -717,7 +729,7 @@ export class Program {
|
|
|
717
729
|
if (getRootLength(file.fileName) > 1)
|
|
718
730
|
rooted = true;
|
|
719
731
|
if (rooted)
|
|
720
|
-
this.optionNameDiagnostic(
|
|
732
|
+
this.optionNameDiagnostic(1124 /* Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files */, 'outDir', '');
|
|
721
733
|
}
|
|
722
734
|
}
|
|
723
735
|
if (options.noEmit !== true &&
|
|
@@ -740,91 +752,91 @@ export class Program {
|
|
|
740
752
|
getCanonicalFileName(computed, this.useCaseSensitiveFileNames)) {
|
|
741
753
|
const option1 = options.outFile !== undefined ? 'outFile' : options.outDir !== undefined ? 'outDir' : 'declarationDir';
|
|
742
754
|
const option2 = options.outFile === undefined && options.outDir !== undefined ? 'declarationDir' : '';
|
|
743
|
-
const diagnostic = this.optionDiagnostic(true, option1, option2,
|
|
755
|
+
const diagnostic = this.optionDiagnostic(true, option1, option2, 1126 /* Diagnostics.The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout */, [
|
|
744
756
|
getBaseFileName(options.configFilePath),
|
|
745
757
|
getRelativePathFromFile(options.configFilePath, computed, this.useCaseSensitiveFileNames),
|
|
746
758
|
]);
|
|
747
|
-
diagnostic.addMessageChain(createCompilerDiagnostic(
|
|
759
|
+
diagnostic.addMessageChain(createCompilerDiagnostic(1190 /* Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information */));
|
|
748
760
|
}
|
|
749
761
|
}
|
|
750
762
|
if (options.checkJs === true && !getAllowJS(options)) {
|
|
751
|
-
this.optionNameDiagnostic(
|
|
763
|
+
this.optionNameDiagnostic(1135 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1 */, 'checkJs', 'allowJs');
|
|
752
764
|
}
|
|
753
765
|
if (options.emitDeclarationOnly === true && !getEmitDeclarations(options)) {
|
|
754
|
-
this.optionNameDiagnostic(
|
|
766
|
+
this.optionNameDiagnostic(1151 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 */, 'emitDeclarationOnly', 'declaration', 'composite');
|
|
755
767
|
}
|
|
756
768
|
if (options.emitDecoratorMetadata === true && options.experimentalDecorators !== true) {
|
|
757
|
-
this.optionNameDiagnostic(
|
|
769
|
+
this.optionNameDiagnostic(1135 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1 */, 'emitDecoratorMetadata', 'experimentalDecorators');
|
|
758
770
|
}
|
|
759
771
|
const jsx = options.jsx;
|
|
760
772
|
const automaticJsx = jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev;
|
|
761
773
|
if (options.jsxFactory !== undefined) {
|
|
762
774
|
if (options.reactNamespace !== undefined) {
|
|
763
|
-
this.optionNameDiagnostic(
|
|
775
|
+
this.optionNameDiagnostic(1136 /* Diagnostics.Option_0_cannot_be_specified_with_option_1 */, 'reactNamespace', 'jsxFactory');
|
|
764
776
|
}
|
|
765
777
|
if (automaticJsx && jsx !== undefined) {
|
|
766
|
-
this.optionNameDiagnostic(
|
|
778
|
+
this.optionNameDiagnostic(1170 /* Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1 */, 'jsxFactory', jsxEmitName(jsx));
|
|
767
779
|
}
|
|
768
780
|
if (parseIsolatedEntityName(options.jsxFactory) === undefined) {
|
|
769
|
-
this.optionValueDiagnostic('jsxFactory',
|
|
781
|
+
this.optionValueDiagnostic('jsxFactory', 1149 /* Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name */, options.jsxFactory);
|
|
770
782
|
}
|
|
771
783
|
}
|
|
772
784
|
else if (options.reactNamespace !== undefined &&
|
|
773
785
|
!isIdentifierText(options.reactNamespace, 0 /* LanguageVariant.Standard */)) {
|
|
774
|
-
this.optionValueDiagnostic('reactNamespace',
|
|
786
|
+
this.optionValueDiagnostic('reactNamespace', 1142 /* Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier */, options.reactNamespace);
|
|
775
787
|
}
|
|
776
788
|
if (options.jsxFragmentFactory !== undefined) {
|
|
777
789
|
if (options.jsxFactory === undefined) {
|
|
778
|
-
this.optionNameDiagnostic(
|
|
790
|
+
this.optionNameDiagnostic(1135 /* Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1 */, 'jsxFragmentFactory', 'jsxFactory');
|
|
779
791
|
}
|
|
780
792
|
if (automaticJsx && jsx !== undefined) {
|
|
781
|
-
this.optionNameDiagnostic(
|
|
793
|
+
this.optionNameDiagnostic(1170 /* Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1 */, 'jsxFragmentFactory', jsxEmitName(jsx));
|
|
782
794
|
}
|
|
783
795
|
if (parseIsolatedEntityName(options.jsxFragmentFactory) === undefined) {
|
|
784
|
-
this.optionValueDiagnostic('jsxFragmentFactory',
|
|
796
|
+
this.optionValueDiagnostic('jsxFragmentFactory', 1872 /* Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name */, options.jsxFragmentFactory);
|
|
785
797
|
}
|
|
786
798
|
}
|
|
787
799
|
if (options.reactNamespace !== undefined && automaticJsx && jsx !== undefined) {
|
|
788
|
-
this.optionNameDiagnostic(
|
|
800
|
+
this.optionNameDiagnostic(1170 /* Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1 */, 'reactNamespace', jsxEmitName(jsx));
|
|
789
801
|
}
|
|
790
802
|
if (options.jsxImportSource !== undefined && jsx === JsxEmit.React) {
|
|
791
|
-
this.optionNameDiagnostic(
|
|
803
|
+
this.optionNameDiagnostic(1170 /* Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1 */, 'jsxImportSource', jsxEmitName(jsx));
|
|
792
804
|
}
|
|
793
805
|
const moduleKind = getEmitModuleKind(options);
|
|
794
806
|
if (options.allowImportingTsExtensions === true &&
|
|
795
807
|
!(options.noEmit === true ||
|
|
796
808
|
options.emitDeclarationOnly === true ||
|
|
797
809
|
options.rewriteRelativeImportExtensions === true)) {
|
|
798
|
-
this.optionValueDiagnostic('allowImportingTsExtensions',
|
|
810
|
+
this.optionValueDiagnostic('allowImportingTsExtensions', 1177 /* Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set */);
|
|
799
811
|
}
|
|
800
812
|
const moduleResolution = getModuleResolutionKind(options);
|
|
801
813
|
const supportsExportsAndImports = (moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext) ||
|
|
802
814
|
moduleResolution === ModuleResolutionKind.Bundler;
|
|
803
815
|
if (options.resolvePackageJsonExports === true && !supportsExportsAndImports) {
|
|
804
|
-
this.optionNameDiagnostic(
|
|
816
|
+
this.optionNameDiagnostic(1179 /* Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler */, 'resolvePackageJsonExports', '');
|
|
805
817
|
}
|
|
806
818
|
if (options.resolvePackageJsonImports === true && !supportsExportsAndImports) {
|
|
807
|
-
this.optionNameDiagnostic(
|
|
819
|
+
this.optionNameDiagnostic(1179 /* Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler */, 'resolvePackageJsonImports', '');
|
|
808
820
|
}
|
|
809
821
|
if (options.customConditions !== undefined && !supportsExportsAndImports) {
|
|
810
|
-
this.optionNameDiagnostic(
|
|
822
|
+
this.optionNameDiagnostic(1179 /* Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler */, 'customConditions', '');
|
|
811
823
|
}
|
|
812
824
|
const isNonNodeESM = moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext;
|
|
813
825
|
if (moduleResolution === ModuleResolutionKind.Bundler &&
|
|
814
826
|
!isNonNodeESM &&
|
|
815
827
|
moduleKind !== ModuleKind.Preserve &&
|
|
816
828
|
moduleKind !== ModuleKind.CommonJS) {
|
|
817
|
-
this.optionValueDiagnostic('moduleResolution',
|
|
829
|
+
this.optionValueDiagnostic('moduleResolution', 1176 /* Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later */, 'bundler');
|
|
818
830
|
}
|
|
819
831
|
const isNodeModule = ModuleKind.Node16 <= moduleKind && moduleKind <= ModuleKind.NodeNext;
|
|
820
832
|
const isNodeResolution = ModuleResolutionKind.Node16 <= moduleResolution && moduleResolution <= ModuleResolutionKind.NodeNext;
|
|
821
833
|
if (isNodeModule && !isNodeResolution) {
|
|
822
834
|
const resolutionName = moduleKind === ModuleKind.NodeNext ? 'NodeNext' : 'Node16';
|
|
823
|
-
this.optionValueDiagnostic('moduleResolution',
|
|
835
|
+
this.optionValueDiagnostic('moduleResolution', 1188 /* Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1 */, resolutionName, moduleKindName(moduleKind));
|
|
824
836
|
}
|
|
825
837
|
else if (isNodeResolution && !isNodeModule) {
|
|
826
838
|
const name = moduleResolutionKindName(moduleResolution);
|
|
827
|
-
this.optionValueDiagnostic('module',
|
|
839
|
+
this.optionValueDiagnostic('module', 1189 /* Diagnostics.Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1 */, name, name);
|
|
828
840
|
}
|
|
829
841
|
// Outputs must be unique and must not overwrite inputs.
|
|
830
842
|
if (options.noEmit !== true && options.suppressOutputPathCheck !== true) {
|
|
@@ -846,15 +858,15 @@ export class Program {
|
|
|
846
858
|
return;
|
|
847
859
|
const path = this.toPath(fileName);
|
|
848
860
|
if (this.processed.filesByPath.has(path)) {
|
|
849
|
-
const diagnostic = createCompilerDiagnostic(
|
|
861
|
+
const diagnostic = createCompilerDiagnostic(1138 /* Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file */, fileName);
|
|
850
862
|
if (configFilePath === '') {
|
|
851
|
-
diagnostic.addMessageChain(createCompilerDiagnostic(
|
|
863
|
+
diagnostic.addMessageChain(createCompilerDiagnostic(1150 /* Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig */));
|
|
852
864
|
}
|
|
853
865
|
this.blockEmittingOfFile(fileName, diagnostic);
|
|
854
866
|
}
|
|
855
867
|
const key = this.useCaseSensitiveFileNames ? path : toFileNameLowerCase(path);
|
|
856
868
|
if (seen.has(key)) {
|
|
857
|
-
this.blockEmittingOfFile(fileName, createCompilerDiagnostic(
|
|
869
|
+
this.blockEmittingOfFile(fileName, createCompilerDiagnostic(1139 /* Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files */, fileName));
|
|
858
870
|
}
|
|
859
871
|
else {
|
|
860
872
|
seen.add(key);
|
|
@@ -888,22 +900,22 @@ export class Program {
|
|
|
888
900
|
verifyProjectReference(config, parent, index, buildInfoFileName) {
|
|
889
901
|
const reference = parent.projectReferences[index];
|
|
890
902
|
if (config === undefined) {
|
|
891
|
-
this.referenceDiagnostic(parent, index,
|
|
903
|
+
this.referenceDiagnostic(parent, index, 1240 /* Diagnostics.File_0_not_found */, [reference.path]);
|
|
892
904
|
return;
|
|
893
905
|
}
|
|
894
906
|
const options = config.options;
|
|
895
907
|
if ((options.composite !== true || options.noEmit === true) && parent.fileNames.length > 0) {
|
|
896
908
|
if (options.composite !== true) {
|
|
897
|
-
this.referenceDiagnostic(parent, index,
|
|
909
|
+
this.referenceDiagnostic(parent, index, 1456 /* Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true */, [reference.path]);
|
|
898
910
|
}
|
|
899
911
|
if (options.noEmit === true) {
|
|
900
|
-
this.referenceDiagnostic(parent, index,
|
|
912
|
+
this.referenceDiagnostic(parent, index, 1458 /* Diagnostics.Referenced_project_0_may_not_disable_emit */, [
|
|
901
913
|
reference.path,
|
|
902
914
|
]);
|
|
903
915
|
}
|
|
904
916
|
}
|
|
905
917
|
if (buildInfoFileName !== '' && buildInfoFileName === config.buildInfoFileName()) {
|
|
906
|
-
this.referenceDiagnostic(parent, index,
|
|
918
|
+
this.referenceDiagnostic(parent, index, 1479 /* Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1 */, [buildInfoFileName, reference.path]);
|
|
907
919
|
this.emitBlockingPaths.add(this.toPath(buildInfoFileName));
|
|
908
920
|
}
|
|
909
921
|
}
|
|
@@ -3,3 +3,5 @@
|
|
|
3
3
|
* to its decimal digits.
|
|
4
4
|
*/
|
|
5
5
|
export declare function parsePseudoBigInt(literal: string): string;
|
|
6
|
+
/** Compares two bigint values in decimal, each optionally prefixed with `-`, by numeric value. */
|
|
7
|
+
export declare function comparePseudoBigInts(a: string, b: string): number;
|
|
@@ -59,3 +59,21 @@ export function parsePseudoBigInt(literal) {
|
|
|
59
59
|
}
|
|
60
60
|
return result;
|
|
61
61
|
}
|
|
62
|
+
/** Compares two bigint values in decimal, each optionally prefixed with `-`, by numeric value. */
|
|
63
|
+
export function comparePseudoBigInts(a, b) {
|
|
64
|
+
const negative = a.charCodeAt(0) === 45 /* CharacterCodes.minus */;
|
|
65
|
+
const r = pseudoBigIntSign(a) - pseudoBigIntSign(b);
|
|
66
|
+
if (r !== 0)
|
|
67
|
+
return r;
|
|
68
|
+
const digitsA = negative ? a.substring(1) : a;
|
|
69
|
+
const digitsB = negative ? b.substring(1) : b;
|
|
70
|
+
let magnitude = digitsA.length - digitsB.length;
|
|
71
|
+
if (magnitude === 0)
|
|
72
|
+
magnitude = digitsA < digitsB ? -1 : digitsA > digitsB ? 1 : 0;
|
|
73
|
+
return negative ? -magnitude : magnitude;
|
|
74
|
+
}
|
|
75
|
+
function pseudoBigIntSign(value) {
|
|
76
|
+
if (value.charCodeAt(0) === 45 /* CharacterCodes.minus */)
|
|
77
|
+
return -1;
|
|
78
|
+
return value === '0' ? 0 : 1;
|
|
79
|
+
}
|