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
|
@@ -176,9 +176,12 @@ export class Resolver {
|
|
|
176
176
|
/**
|
|
177
177
|
* Called before the resolver is shared with other threads, which makes it immutable
|
|
178
178
|
* (parallel-check.ts): from then on, each thread caches the results and `package.json` lookups the
|
|
179
|
-
* resolver did not have yet in tables of its own.
|
|
179
|
+
* resolver did not have yet in tables of its own. A resolver already shared (by an earlier program of
|
|
180
|
+
* a watch, which a rebuild updates: `Program.updateFile`) is immutable and stays as it is.
|
|
180
181
|
*/
|
|
181
182
|
prepareForSharing() {
|
|
183
|
+
if (this.shared)
|
|
184
|
+
return;
|
|
182
185
|
this.getPathPatterns();
|
|
183
186
|
this.packageJsonInfoCache.prepareForSharing();
|
|
184
187
|
this.shared = true;
|
|
@@ -241,24 +244,24 @@ export class Resolver {
|
|
|
241
244
|
return cached;
|
|
242
245
|
}
|
|
243
246
|
const options = optionsWithRedirect(this.options, redirect);
|
|
244
|
-
tracer?.push(messageWithArgs(
|
|
247
|
+
tracer?.push(messageWithArgs(1266 /* Diagnostics.Resolving_module_0_from_1 */, moduleName, containingFile));
|
|
245
248
|
if (tracer !== undefined)
|
|
246
249
|
traceRedirect(tracer, redirect);
|
|
247
250
|
const kind = getModuleResolutionKind(options);
|
|
248
251
|
tracer?.push(options.moduleResolution !== kind
|
|
249
|
-
? messageWithArgs(
|
|
250
|
-
: messageWithArgs(
|
|
252
|
+
? messageWithArgs(1268 /* Diagnostics.Module_resolution_kind_is_not_specified_using_0 */, moduleResolutionKindName(kind))
|
|
253
|
+
: messageWithArgs(1267 /* Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0 */, moduleResolutionKindName(kind)));
|
|
251
254
|
const state = new ResolutionState(this, tracer, moduleName, containingDirectory, false, mode, options);
|
|
252
255
|
const result = state.resolveNodeLike();
|
|
253
256
|
if (tracer !== undefined) {
|
|
254
257
|
if (result.resolvedFileName === '') {
|
|
255
|
-
tracer.push(messageWithArgs(
|
|
258
|
+
tracer.push(messageWithArgs(1270 /* Diagnostics.Module_name_0_was_not_resolved */, moduleName));
|
|
256
259
|
}
|
|
257
260
|
else if (result.packageId !== undefined) {
|
|
258
|
-
tracer.push(messageWithArgs(
|
|
261
|
+
tracer.push(messageWithArgs(1382 /* Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2 */, moduleName, result.resolvedFileName, packageIdToString(result.packageId)));
|
|
259
262
|
}
|
|
260
263
|
else {
|
|
261
|
-
tracer.push(messageWithArgs(
|
|
264
|
+
tracer.push(messageWithArgs(1269 /* Diagnostics.Module_name_0_was_successfully_resolved_to_1 */, moduleName, result.resolvedFileName));
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
267
|
const final = this.tryResolveFromTypingsLocation(moduleName, containingDirectory, result, tracer);
|
|
@@ -287,20 +290,20 @@ export class Resolver {
|
|
|
287
290
|
const typeRoots = getEffectiveTypeRoots(options, this.host.getCurrentDirectory());
|
|
288
291
|
const fromConfig = options.typeRoots !== undefined;
|
|
289
292
|
if (tracer !== undefined) {
|
|
290
|
-
tracer.push(messageWithArgs(
|
|
293
|
+
tracer.push(messageWithArgs(1295 /* Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2 */, name, containingFile, typeRoots.join(',')));
|
|
291
294
|
traceRedirect(tracer, redirect);
|
|
292
295
|
}
|
|
293
296
|
const state = new ResolutionState(this, tracer, name, containingDirectory, true, mode, options);
|
|
294
297
|
const result = state.resolveTypeReferenceDirective(typeRoots, fromConfig, fromInferredTypes);
|
|
295
298
|
if (tracer !== undefined) {
|
|
296
299
|
if (result.resolvedFileName === '') {
|
|
297
|
-
tracer.push(messageWithArgs(
|
|
300
|
+
tracer.push(messageWithArgs(1297 /* Diagnostics.Type_reference_directive_0_was_not_resolved */, name));
|
|
298
301
|
}
|
|
299
302
|
else if (result.packageId !== undefined) {
|
|
300
|
-
tracer.push(messageWithArgs(
|
|
303
|
+
tracer.push(messageWithArgs(1383 /* Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3 */, name, result.resolvedFileName, packageIdToString(result.packageId), String(result.primary)));
|
|
301
304
|
}
|
|
302
305
|
else {
|
|
303
|
-
tracer.push(messageWithArgs(
|
|
306
|
+
tracer.push(messageWithArgs(1296 /* Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2 */, name, result.resolvedFileName, String(result.primary)));
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
this.cacheTypeReference(cacheKey, result);
|
|
@@ -321,6 +324,24 @@ export class Resolver {
|
|
|
321
324
|
const state = new ResolutionState(this, undefined, '', directory, false, ModuleKind.None, this.options);
|
|
322
325
|
return state.getPackageScopeForPath(directory);
|
|
323
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* The TypeScript or declaration file a package's directory loads (its `typings`, `types` or `main` field, or
|
|
329
|
+
* an index file), as tsgo finds a package's main entrypoint; `''` for none.
|
|
330
|
+
*/
|
|
331
|
+
loadPackageMainEntrypoint(info) {
|
|
332
|
+
const state = this.entrypointState(info.packageDirectory);
|
|
333
|
+
return state.loadPackageMainEntrypoint(info);
|
|
334
|
+
}
|
|
335
|
+
/** The TypeScript or declaration file an `exports` target path of a package loads; `''` for none. */
|
|
336
|
+
loadPackageExportTargetEntrypoint(packageDirectory, candidate, target) {
|
|
337
|
+
return this.entrypointState(packageDirectory).loadPackageExportTargetEntrypoint(candidate, target);
|
|
338
|
+
}
|
|
339
|
+
entrypointState(packageDirectory) {
|
|
340
|
+
const state = new ResolutionState(this, undefined, '', packageDirectory, false, ModuleKind.None, this.options);
|
|
341
|
+
state.extensions = 1 /* Extensions.TypeScript */ | 4 /* Extensions.Declaration */;
|
|
342
|
+
state.features = 31 /* Features.All */;
|
|
343
|
+
return state;
|
|
344
|
+
}
|
|
324
345
|
/** Resolves an `extends` specifier of a tsconfig file. */
|
|
325
346
|
resolveConfig(moduleName, containingFile) {
|
|
326
347
|
const state = new ResolutionState(this, undefined, moduleName, getDirectoryPath(containingFile), false, ModuleKind.CommonJS, this.options);
|
|
@@ -335,7 +356,7 @@ export class Resolver {
|
|
|
335
356
|
return original;
|
|
336
357
|
}
|
|
337
358
|
const state = new ResolutionState(this, tracer, moduleName, containingDirectory, false, ModuleKind.None, this.options);
|
|
338
|
-
tracer?.push(messageWithArgs(
|
|
359
|
+
tracer?.push(messageWithArgs(1316 /* Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2 */, this.projectName, moduleName, this.typingsLocation));
|
|
339
360
|
const global = state.loadModuleFromImmediateNodeModulesDirectory(4 /* Extensions.Declaration */, this.typingsLocation, false);
|
|
340
361
|
if (global === undefined)
|
|
341
362
|
return original;
|
|
@@ -349,7 +370,7 @@ function optionsWithRedirect(options, redirect) {
|
|
|
349
370
|
}
|
|
350
371
|
function traceRedirect(tracer, redirect) {
|
|
351
372
|
if (redirect !== undefined && redirect.options !== undefined) {
|
|
352
|
-
tracer.push(messageWithArgs(
|
|
373
|
+
tracer.push(messageWithArgs(1379 /* Diagnostics.Using_compiler_options_of_project_reference_redirect_0 */, redirect.configName));
|
|
353
374
|
}
|
|
354
375
|
}
|
|
355
376
|
/** Resolves an `extends` specifier of a tsconfig file with `nodenext` rules. */
|
|
@@ -460,16 +481,17 @@ class ResolutionState {
|
|
|
460
481
|
const traces = this.traces;
|
|
461
482
|
if (typeRoots.length > 0) {
|
|
462
483
|
if (traces !== undefined)
|
|
463
|
-
this.trace(
|
|
484
|
+
this.trace(1298 /* Diagnostics.Resolving_with_primary_search_path_0 */, typeRoots.join(', '));
|
|
464
485
|
for (const typeRoot of typeRoots) {
|
|
465
486
|
const candidate = this.getCandidateFromTypeRoot(typeRoot);
|
|
466
487
|
if (!this.host.directoryExists(typeRoot)) {
|
|
467
488
|
if (traces !== undefined)
|
|
468
|
-
this.trace(
|
|
489
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, typeRoot);
|
|
469
490
|
continue;
|
|
470
491
|
}
|
|
471
|
-
|
|
472
|
-
|
|
492
|
+
// Configured type roots resolve as files or directories, like modules; a name ending in a separator
|
|
493
|
+
// only as a directory.
|
|
494
|
+
if (fromConfig && !hasTrailingDirectorySeparator(candidate)) {
|
|
473
495
|
const fromFile = this.loadModuleFromFile(4 /* Extensions.Declaration */, candidate);
|
|
474
496
|
if (fromFile !== undefined) {
|
|
475
497
|
this.setPackageIdFromNodeModulesPath(fromFile);
|
|
@@ -482,12 +504,12 @@ class ResolutionState {
|
|
|
482
504
|
}
|
|
483
505
|
}
|
|
484
506
|
else if (traces !== undefined) {
|
|
485
|
-
this.trace(
|
|
507
|
+
this.trace(1299 /* Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths */);
|
|
486
508
|
}
|
|
487
509
|
let resolved;
|
|
488
510
|
if (!fromConfig || !fromInferredTypes) {
|
|
489
511
|
if (traces !== undefined)
|
|
490
|
-
this.trace(
|
|
512
|
+
this.trace(1302 /* Diagnostics.Looking_up_in_node_modules_folder_initial_location_0 */, this.containingDirectory);
|
|
491
513
|
if (!isExternalModuleNameRelative(this.name)) {
|
|
492
514
|
resolved = this.loadModuleFromNearestNodeModulesDirectory(false);
|
|
493
515
|
}
|
|
@@ -497,7 +519,7 @@ class ResolutionState {
|
|
|
497
519
|
}
|
|
498
520
|
}
|
|
499
521
|
else if (traces !== undefined) {
|
|
500
|
-
this.trace(
|
|
522
|
+
this.trace(1428 /* Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder */);
|
|
501
523
|
}
|
|
502
524
|
return this.createResolvedTypeReferenceDirective(resolved, false);
|
|
503
525
|
}
|
|
@@ -507,16 +529,17 @@ class ResolutionState {
|
|
|
507
529
|
resolved.packageId = this.getPackageId(resolved.path, this.getPackageJsonInfo(packageDirectory));
|
|
508
530
|
}
|
|
509
531
|
}
|
|
532
|
+
/** The type root's path for the name, resolved against the type root as tsgo does: `./css` in it is `css`. */
|
|
510
533
|
getCandidateFromTypeRoot(typeRoot) {
|
|
511
534
|
const name = typeRoot.endsWith('/node_modules/@types') || typeRoot.endsWith('/node_modules/@types/')
|
|
512
535
|
? this.mangleScopedPackageName(this.name)
|
|
513
536
|
: this.name;
|
|
514
|
-
return combinePaths(typeRoot, name);
|
|
537
|
+
return normalizePath(combinePaths(typeRoot, name));
|
|
515
538
|
}
|
|
516
539
|
mangleScopedPackageName(name) {
|
|
517
540
|
const mangled = mangleScopedPackageName(name);
|
|
518
541
|
if (this.traces !== undefined && mangled !== name)
|
|
519
|
-
this.trace(
|
|
542
|
+
this.trace(1348 /* Diagnostics.Scoped_package_detected_looking_in_0 */, mangled);
|
|
520
543
|
return mangled;
|
|
521
544
|
}
|
|
522
545
|
/** Falls back to configured `typeRoots` for declaration lookups of bare names. */
|
|
@@ -528,13 +551,15 @@ class ResolutionState {
|
|
|
528
551
|
const candidate = this.getCandidateFromTypeRoot(typeRoot);
|
|
529
552
|
if (!this.host.directoryExists(typeRoot)) {
|
|
530
553
|
if (this.traces !== undefined)
|
|
531
|
-
this.trace(
|
|
554
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, typeRoot);
|
|
532
555
|
continue;
|
|
533
556
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
557
|
+
if (!hasTrailingDirectorySeparator(candidate)) {
|
|
558
|
+
const fromFile = this.loadModuleFromFile(4 /* Extensions.Declaration */, candidate);
|
|
559
|
+
if (fromFile !== undefined) {
|
|
560
|
+
this.setPackageIdFromNodeModulesPath(fromFile);
|
|
561
|
+
return fromFile;
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
const fromDirectory = this.loadNodeModuleFromDirectory(4 /* Extensions.Declaration */, candidate, true);
|
|
540
565
|
if (fromDirectory !== undefined)
|
|
@@ -558,7 +583,7 @@ class ResolutionState {
|
|
|
558
583
|
resolveNodeLike() {
|
|
559
584
|
if (this.traces !== undefined) {
|
|
560
585
|
const conditions = this.conditions.map((c) => "'" + c + "'").join(', ');
|
|
561
|
-
this.trace(
|
|
586
|
+
this.trace(1503 /* Diagnostics.Resolving_in_0_mode_with_conditions_1 */, this.esmMode ? 'ESM' : 'CJS', conditions);
|
|
562
587
|
}
|
|
563
588
|
const result = this.resolveNodeLikeWorker();
|
|
564
589
|
if (this.resolvedPackageDirectory &&
|
|
@@ -572,7 +597,7 @@ class ResolutionState {
|
|
|
572
597
|
this.conditions.includes('import')) {
|
|
573
598
|
// Find out whether the package would resolve to types without `exports`, to suggest a fix.
|
|
574
599
|
if (this.traces !== undefined) {
|
|
575
|
-
this.trace(
|
|
600
|
+
this.trace(1437 /* Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update */);
|
|
576
601
|
}
|
|
577
602
|
this.features &= ~4 /* Features.Exports */;
|
|
578
603
|
this.extensions &= 1 /* Extensions.TypeScript */ | 4 /* Extensions.Declaration */;
|
|
@@ -608,12 +633,12 @@ class ResolutionState {
|
|
|
608
633
|
}
|
|
609
634
|
if (this.name.includes(':')) {
|
|
610
635
|
if (this.traces !== undefined) {
|
|
611
|
-
this.trace(
|
|
636
|
+
this.trace(1338 /* Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1 */, this.name, extensionsToString(this.extensions));
|
|
612
637
|
}
|
|
613
638
|
return this.createResolvedModule(undefined, false);
|
|
614
639
|
}
|
|
615
640
|
if (this.traces !== undefined) {
|
|
616
|
-
this.trace(
|
|
641
|
+
this.trace(1278 /* Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1 */, this.name, extensionsToString(this.extensions));
|
|
617
642
|
}
|
|
618
643
|
const fromNodeModules = this.loadModuleFromNearestNodeModulesDirectory(false);
|
|
619
644
|
if (fromNodeModules !== undefined)
|
|
@@ -662,7 +687,7 @@ class ResolutionState {
|
|
|
662
687
|
loadModuleFromImports() {
|
|
663
688
|
if (this.name === '#' || (this.name.startsWith('#/') && (this.features & 16 /* Features.ImportsPatternRoot */) === 0)) {
|
|
664
689
|
if (this.traces !== undefined)
|
|
665
|
-
this.trace(
|
|
690
|
+
this.trace(1432 /* Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions */, this.name);
|
|
666
691
|
return undefined;
|
|
667
692
|
}
|
|
668
693
|
const directory = getNormalizedAbsolutePath(this.containingDirectory, this.host.getCurrentDirectory());
|
|
@@ -670,21 +695,21 @@ class ResolutionState {
|
|
|
670
695
|
const contents = scope?.contents;
|
|
671
696
|
if (scope === undefined || contents === undefined) {
|
|
672
697
|
if (this.traces !== undefined) {
|
|
673
|
-
this.trace(
|
|
698
|
+
this.trace(1430 /* Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve */, directory);
|
|
674
699
|
}
|
|
675
700
|
return undefined;
|
|
676
701
|
}
|
|
677
702
|
const imports = contents.imports;
|
|
678
703
|
if (imports === undefined || imports.type !== 'object') {
|
|
679
704
|
if (this.traces !== undefined)
|
|
680
|
-
this.trace(
|
|
705
|
+
this.trace(1433 /* Diagnostics.X_package_json_scope_0_has_no_imports_defined */, scope.packageDirectory);
|
|
681
706
|
return undefined;
|
|
682
707
|
}
|
|
683
708
|
const result = this.loadModuleFromExportsOrImports(this.extensions, this.name, imports, scope, true);
|
|
684
709
|
if (result !== undefined)
|
|
685
710
|
return result;
|
|
686
711
|
if (this.traces !== undefined) {
|
|
687
|
-
this.trace(
|
|
712
|
+
this.trace(1431 /* Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1 */, this.name, scope.packageDirectory);
|
|
688
713
|
}
|
|
689
714
|
return undefined;
|
|
690
715
|
}
|
|
@@ -709,7 +734,7 @@ class ResolutionState {
|
|
|
709
734
|
return result;
|
|
710
735
|
}
|
|
711
736
|
if (this.traces !== undefined) {
|
|
712
|
-
this.trace(
|
|
737
|
+
this.trace(1436 /* Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1 */, subpath, scope.packageDirectory);
|
|
713
738
|
}
|
|
714
739
|
return undefined;
|
|
715
740
|
}
|
|
@@ -750,7 +775,7 @@ class ResolutionState {
|
|
|
750
775
|
}
|
|
751
776
|
invalidTarget(scope, moduleName) {
|
|
752
777
|
if (this.traces !== undefined) {
|
|
753
|
-
this.trace(
|
|
778
|
+
this.trace(1435 /* Diagnostics.X_package_json_scope_0_has_invalid_type_for_target_of_specifier_1 */, scope.packageDirectory, moduleName);
|
|
754
779
|
}
|
|
755
780
|
return undefined;
|
|
756
781
|
}
|
|
@@ -779,7 +804,7 @@ class ResolutionState {
|
|
|
779
804
|
return this.invalidTarget(scope, moduleName);
|
|
780
805
|
}
|
|
781
806
|
if (traces !== undefined) {
|
|
782
|
-
this.trace(
|
|
807
|
+
this.trace(1505 /* Diagnostics.Using_0_subpath_1_with_target_2 */, isImports ? 'imports' : 'exports', key, isPattern ? replaceAllStars(targetString, subpath) : targetString + subpath);
|
|
783
808
|
}
|
|
784
809
|
const finalPath = getNormalizedAbsolutePath(isPattern ? replaceAllStars(resolvedTarget, subpath) : resolvedTarget + subpath, this.host.getCurrentDirectory());
|
|
785
810
|
const inputLink = this.tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, 'package.json'), isImports);
|
|
@@ -796,29 +821,29 @@ class ResolutionState {
|
|
|
796
821
|
}
|
|
797
822
|
case 'object': {
|
|
798
823
|
if (traces !== undefined)
|
|
799
|
-
this.trace(
|
|
824
|
+
this.trace(1514 /* Diagnostics.Entering_conditional_exports */);
|
|
800
825
|
for (const [condition, subTarget] of target.entries) {
|
|
801
826
|
if (!this.conditionMatches(condition)) {
|
|
802
827
|
if (traces !== undefined)
|
|
803
|
-
this.trace(
|
|
828
|
+
this.trace(1506 /* Diagnostics.Saw_non_matching_condition_0 */, condition);
|
|
804
829
|
continue;
|
|
805
830
|
}
|
|
806
831
|
if (traces !== undefined)
|
|
807
|
-
this.trace(
|
|
832
|
+
this.trace(1504 /* Diagnostics.Matched_0_condition_1 */, isImports ? 'imports' : 'exports', condition);
|
|
808
833
|
const result = this.loadModuleFromTargetExportOrImport(extensions, moduleName, scope, isImports, subTarget, subpath, isPattern, key);
|
|
809
834
|
if (result !== undefined) {
|
|
810
835
|
if (traces !== undefined) {
|
|
811
836
|
if (result.path !== '')
|
|
812
|
-
this.trace(
|
|
813
|
-
this.trace(
|
|
837
|
+
this.trace(1515 /* Diagnostics.Resolved_under_condition_0 */, condition);
|
|
838
|
+
this.trace(1517 /* Diagnostics.Exiting_conditional_exports */);
|
|
814
839
|
}
|
|
815
840
|
return result;
|
|
816
841
|
}
|
|
817
842
|
if (traces !== undefined)
|
|
818
|
-
this.trace(
|
|
843
|
+
this.trace(1516 /* Diagnostics.Failed_to_resolve_under_condition_0 */, condition);
|
|
819
844
|
}
|
|
820
845
|
if (traces !== undefined)
|
|
821
|
-
this.trace(
|
|
846
|
+
this.trace(1517 /* Diagnostics.Exiting_conditional_exports */);
|
|
822
847
|
return undefined;
|
|
823
848
|
}
|
|
824
849
|
case 'array':
|
|
@@ -832,7 +857,7 @@ class ResolutionState {
|
|
|
832
857
|
return this.invalidTarget(scope, moduleName);
|
|
833
858
|
case 'null':
|
|
834
859
|
if (traces !== undefined) {
|
|
835
|
-
this.trace(
|
|
860
|
+
this.trace(1434 /* Diagnostics.X_package_json_scope_0_explicitly_maps_specifier_1_to_null */, scope.packageDirectory, moduleName);
|
|
836
861
|
}
|
|
837
862
|
return unresolved();
|
|
838
863
|
default:
|
|
@@ -844,8 +869,8 @@ class ResolutionState {
|
|
|
844
869
|
const combinedLookup = isPattern ? replaceAllStars(targetString, subpath) : targetString + subpath;
|
|
845
870
|
const scopeDirectory = ensureTrailingDirectorySeparator(scope.packageDirectory);
|
|
846
871
|
if (this.traces !== undefined) {
|
|
847
|
-
this.trace(
|
|
848
|
-
this.trace(
|
|
872
|
+
this.trace(1505 /* Diagnostics.Using_0_subpath_1_with_target_2 */, 'imports', key, combinedLookup);
|
|
873
|
+
this.trace(1266 /* Diagnostics.Resolving_module_0_from_1 */, combinedLookup, scopeDirectory);
|
|
849
874
|
}
|
|
850
875
|
const name = this.name;
|
|
851
876
|
const containingDirectory = this.containingDirectory;
|
|
@@ -889,8 +914,8 @@ class ResolutionState {
|
|
|
889
914
|
}
|
|
890
915
|
else {
|
|
891
916
|
this.diagnostics.push(createDiagnostic(undefined, 0, 0, isImports
|
|
892
|
-
?
|
|
893
|
-
:
|
|
917
|
+
? 482 /* Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate */
|
|
918
|
+
: 481 /* Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate */, entry === '' ? '.' : entry, packagePath));
|
|
894
919
|
return unresolved();
|
|
895
920
|
}
|
|
896
921
|
// Output paths in a config are relative to the current directory; otherwise to the root.
|
|
@@ -931,7 +956,7 @@ class ResolutionState {
|
|
|
931
956
|
const secondary = this.extensions & ~(1 /* Extensions.TypeScript */ | 4 /* Extensions.Declaration */);
|
|
932
957
|
if (priority !== 0) {
|
|
933
958
|
if (this.traces !== undefined) {
|
|
934
|
-
this.trace(
|
|
959
|
+
this.trace(1518 /* Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0 */, extensionsToString(priority));
|
|
935
960
|
}
|
|
936
961
|
const result = this.loadModuleFromAncestorNodeModules(priority, typesScopeOnly);
|
|
937
962
|
if (result !== undefined)
|
|
@@ -939,7 +964,7 @@ class ResolutionState {
|
|
|
939
964
|
}
|
|
940
965
|
if (secondary !== 0 && !typesScopeOnly) {
|
|
941
966
|
if (this.traces !== undefined) {
|
|
942
|
-
this.trace(
|
|
967
|
+
this.trace(1519 /* Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0 */, extensionsToString(secondary));
|
|
943
968
|
}
|
|
944
969
|
return this.loadModuleFromAncestorNodeModules(secondary, typesScopeOnly);
|
|
945
970
|
}
|
|
@@ -963,7 +988,7 @@ class ResolutionState {
|
|
|
963
988
|
const nodeModules = combinePaths(directory, 'node_modules');
|
|
964
989
|
if (!this.host.directoryExists(nodeModules)) {
|
|
965
990
|
if (this.traces !== undefined)
|
|
966
|
-
this.trace(
|
|
991
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, nodeModules);
|
|
967
992
|
return undefined;
|
|
968
993
|
}
|
|
969
994
|
if (!typesScopeOnly) {
|
|
@@ -975,7 +1000,7 @@ class ResolutionState {
|
|
|
975
1000
|
const atTypes = combinePaths(nodeModules, '@types');
|
|
976
1001
|
if (!this.host.directoryExists(atTypes)) {
|
|
977
1002
|
if (this.traces !== undefined)
|
|
978
|
-
this.trace(
|
|
1003
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, atTypes);
|
|
979
1004
|
return undefined;
|
|
980
1005
|
}
|
|
981
1006
|
return this.loadModuleFromSpecificNodeModulesDirectory(4 /* Extensions.Declaration */, this.mangleScopedPackageName(this.name), atTypes);
|
|
@@ -1021,7 +1046,7 @@ class ResolutionState {
|
|
|
1021
1046
|
const versionPaths = contents.getVersionPaths(this.traces);
|
|
1022
1047
|
if (versionPaths !== undefined) {
|
|
1023
1048
|
if (this.traces !== undefined) {
|
|
1024
|
-
this.trace(
|
|
1049
|
+
this.trace(1372 /* Diagnostics.X_package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2 */, versionPaths.version, typeScriptVersion, rest);
|
|
1025
1050
|
}
|
|
1026
1051
|
const fromPaths = this.tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, parsePatterns(versionPaths.paths), { kind: 'package', rest, packageInfo });
|
|
1027
1052
|
if (fromPaths !== undefined)
|
|
@@ -1142,7 +1167,7 @@ class ResolutionState {
|
|
|
1142
1167
|
if (paths === undefined || paths.size === 0 || pathIsRelative(this.name))
|
|
1143
1168
|
return undefined;
|
|
1144
1169
|
if (this.traces !== undefined) {
|
|
1145
|
-
this.trace(
|
|
1170
|
+
this.trace(1271 /* Diagnostics.X_paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0 */, this.name);
|
|
1146
1171
|
}
|
|
1147
1172
|
const baseDirectory = this.options.pathsBasePath !== undefined && this.options.pathsBasePath !== ''
|
|
1148
1173
|
? this.options.pathsBasePath
|
|
@@ -1155,12 +1180,12 @@ class ResolutionState {
|
|
|
1155
1180
|
return undefined;
|
|
1156
1181
|
const star = matchedText(pattern, moduleName);
|
|
1157
1182
|
if (this.traces !== undefined)
|
|
1158
|
-
this.trace(
|
|
1183
|
+
this.trace(1272 /* Diagnostics.Module_name_0_matched_pattern_1 */, moduleName, pattern.text);
|
|
1159
1184
|
for (const substitution of paths.get(pattern.text) ?? []) {
|
|
1160
1185
|
const path = replaceFirstStar(substitution, star);
|
|
1161
1186
|
const candidate = normalizePath(combinePaths(containingDirectory, path));
|
|
1162
1187
|
if (this.traces !== undefined) {
|
|
1163
|
-
this.trace(
|
|
1188
|
+
this.trace(1273 /* Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1 */, substitution, path);
|
|
1164
1189
|
}
|
|
1165
1190
|
// A substitution may name a file with its extension.
|
|
1166
1191
|
const extension = tryGetExtensionFromPath(substitution);
|
|
@@ -1195,7 +1220,7 @@ class ResolutionState {
|
|
|
1195
1220
|
return undefined;
|
|
1196
1221
|
const traces = this.traces;
|
|
1197
1222
|
if (traces !== undefined)
|
|
1198
|
-
this.trace(
|
|
1223
|
+
this.trace(1286 /* Diagnostics.X_rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0 */, this.name);
|
|
1199
1224
|
const candidate = normalizePath(combinePaths(this.containingDirectory, this.name));
|
|
1200
1225
|
let matchedRootDir = '';
|
|
1201
1226
|
let matchedPrefix = '';
|
|
@@ -1203,7 +1228,7 @@ class ResolutionState {
|
|
|
1203
1228
|
const normalizedRoot = ensureTrailingDirectorySeparator(normalizePath(rootDir));
|
|
1204
1229
|
const isLongest = candidate.startsWith(normalizedRoot) && (matchedPrefix === '' || matchedPrefix.length < normalizedRoot.length);
|
|
1205
1230
|
if (traces !== undefined) {
|
|
1206
|
-
this.trace(
|
|
1231
|
+
this.trace(1283 /* Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2 */, normalizedRoot, candidate, String(isLongest));
|
|
1207
1232
|
}
|
|
1208
1233
|
if (isLongest) {
|
|
1209
1234
|
matchedPrefix = normalizedRoot;
|
|
@@ -1213,39 +1238,39 @@ class ResolutionState {
|
|
|
1213
1238
|
if (matchedPrefix === '')
|
|
1214
1239
|
return undefined;
|
|
1215
1240
|
if (traces !== undefined)
|
|
1216
|
-
this.trace(
|
|
1241
|
+
this.trace(1287 /* Diagnostics.Longest_matching_prefix_for_0_is_1 */, candidate, matchedPrefix);
|
|
1217
1242
|
const suffix = candidate.slice(matchedPrefix.length);
|
|
1218
1243
|
if (traces !== undefined)
|
|
1219
|
-
this.trace(
|
|
1244
|
+
this.trace(1288 /* Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2 */, suffix, matchedPrefix, candidate);
|
|
1220
1245
|
const initial = this.nodeLoadModuleByRelativeName(this.extensions, candidate, true);
|
|
1221
1246
|
if (initial !== undefined)
|
|
1222
1247
|
return initial;
|
|
1223
1248
|
if (traces !== undefined)
|
|
1224
|
-
this.trace(
|
|
1249
|
+
this.trace(1289 /* Diagnostics.Trying_other_entries_in_rootDirs */);
|
|
1225
1250
|
for (const rootDir of rootDirs) {
|
|
1226
1251
|
if (rootDir === matchedRootDir)
|
|
1227
1252
|
continue;
|
|
1228
1253
|
const other = combinePaths(normalizePath(rootDir), suffix);
|
|
1229
1254
|
if (traces !== undefined)
|
|
1230
|
-
this.trace(
|
|
1255
|
+
this.trace(1288 /* Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2 */, suffix, rootDir, other);
|
|
1231
1256
|
const resolved = this.nodeLoadModuleByRelativeName(this.extensions, other, true);
|
|
1232
1257
|
if (resolved !== undefined)
|
|
1233
1258
|
return resolved;
|
|
1234
1259
|
}
|
|
1235
1260
|
if (traces !== undefined)
|
|
1236
|
-
this.trace(
|
|
1261
|
+
this.trace(1290 /* Diagnostics.Module_resolution_using_rootDirs_has_failed */);
|
|
1237
1262
|
return undefined;
|
|
1238
1263
|
}
|
|
1239
1264
|
//// Files and directories
|
|
1240
1265
|
nodeLoadModuleByRelativeName(extensions, candidate, considerPackageJson) {
|
|
1241
1266
|
if (this.traces !== undefined) {
|
|
1242
|
-
this.trace(
|
|
1267
|
+
this.trace(1275 /* Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1 */, candidate, extensionsToString(extensions));
|
|
1243
1268
|
}
|
|
1244
1269
|
if (!hasTrailingDirectorySeparator(candidate)) {
|
|
1245
1270
|
const parent = getDirectoryPath(candidate);
|
|
1246
1271
|
if (!this.host.directoryExists(parent)) {
|
|
1247
1272
|
if (this.traces !== undefined)
|
|
1248
|
-
this.trace(
|
|
1273
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, parent);
|
|
1249
1274
|
return undefined;
|
|
1250
1275
|
}
|
|
1251
1276
|
const fromFile = this.loadModuleFromFile(extensions, candidate);
|
|
@@ -1257,7 +1282,7 @@ class ResolutionState {
|
|
|
1257
1282
|
}
|
|
1258
1283
|
if (!this.host.directoryExists(candidate)) {
|
|
1259
1284
|
if (this.traces !== undefined)
|
|
1260
|
-
this.trace(
|
|
1285
|
+
this.trace(1322 /* Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it */, candidate);
|
|
1261
1286
|
return undefined;
|
|
1262
1287
|
}
|
|
1263
1288
|
// ESM relative imports do no directory lookups (neither package.json nor index files).
|
|
@@ -1281,7 +1306,7 @@ class ResolutionState {
|
|
|
1281
1306
|
extensionless = candidate.slice(0, candidate.lastIndexOf('.'));
|
|
1282
1307
|
const extension = candidate.slice(extensionless.length);
|
|
1283
1308
|
if (this.traces !== undefined)
|
|
1284
|
-
this.trace(
|
|
1309
|
+
this.trace(1308 /* Diagnostics.File_name_0_has_a_1_extension_stripping_it */, candidate, extension);
|
|
1285
1310
|
return this.tryAddingExtensions(extensionless, extensions, extension);
|
|
1286
1311
|
}
|
|
1287
1312
|
tryAddingExtensions(extensionless, extensions, originalExtension) {
|
|
@@ -1367,13 +1392,19 @@ class ResolutionState {
|
|
|
1367
1392
|
tryFileLookup(fileName) {
|
|
1368
1393
|
if (this.host.fileExists(fileName)) {
|
|
1369
1394
|
if (this.traces !== undefined)
|
|
1370
|
-
this.trace(
|
|
1395
|
+
this.trace(1277 /* Diagnostics.File_0_exists_use_it_as_a_name_resolution_result */, fileName);
|
|
1371
1396
|
return true;
|
|
1372
1397
|
}
|
|
1373
1398
|
if (this.traces !== undefined)
|
|
1374
|
-
this.trace(
|
|
1399
|
+
this.trace(1276 /* Diagnostics.File_0_does_not_exist */, fileName);
|
|
1375
1400
|
return false;
|
|
1376
1401
|
}
|
|
1402
|
+
loadPackageMainEntrypoint(info) {
|
|
1403
|
+
return this.loadNodeModuleFromDirectoryWorker(this.extensions, info.packageDirectory, info)?.path ?? '';
|
|
1404
|
+
}
|
|
1405
|
+
loadPackageExportTargetEntrypoint(candidate, target) {
|
|
1406
|
+
return this.loadFileNameFromPackageJsonField(this.extensions, candidate, target)?.path ?? '';
|
|
1407
|
+
}
|
|
1377
1408
|
loadNodeModuleFromDirectory(extensions, candidate, considerPackageJson) {
|
|
1378
1409
|
const packageInfo = considerPackageJson ? this.getPackageJsonInfo(candidate) : undefined;
|
|
1379
1410
|
return this.loadNodeModuleFromDirectoryWorker(extensions, candidate, packageInfo);
|
|
@@ -1392,7 +1423,7 @@ class ResolutionState {
|
|
|
1392
1423
|
if (versionPaths !== undefined && (packageFile === '' || containsPath(candidate, packageFile, false))) {
|
|
1393
1424
|
const moduleName = getRelativePathFromDirectory(candidate, packageFile !== '' ? packageFile : indexPath, false);
|
|
1394
1425
|
if (this.traces !== undefined) {
|
|
1395
|
-
this.trace(
|
|
1426
|
+
this.trace(1372 /* Diagnostics.X_package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2 */, versionPaths.version, typeScriptVersion, moduleName);
|
|
1396
1427
|
}
|
|
1397
1428
|
const result = this.tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, parsePatterns(versionPaths.paths), { kind: 'directory', packageFile, packageInfo });
|
|
1398
1429
|
if (result !== undefined)
|
|
@@ -1475,11 +1506,11 @@ class ResolutionState {
|
|
|
1475
1506
|
if (existing !== undefined) {
|
|
1476
1507
|
if (existing.contents !== undefined) {
|
|
1477
1508
|
if (this.traces !== undefined)
|
|
1478
|
-
this.trace(
|
|
1509
|
+
this.trace(1402 /* Diagnostics.File_0_exists_according_to_earlier_cached_lookups */, packageJsonPath);
|
|
1479
1510
|
return withPackageDirectory(existing, packageDirectory);
|
|
1480
1511
|
}
|
|
1481
1512
|
if (existing.directoryExists && this.traces !== undefined) {
|
|
1482
|
-
this.trace(
|
|
1513
|
+
this.trace(1403 /* Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups */, packageJsonPath);
|
|
1483
1514
|
}
|
|
1484
1515
|
return undefined;
|
|
1485
1516
|
}
|
|
@@ -1487,12 +1518,12 @@ class ResolutionState {
|
|
|
1487
1518
|
if (directoryExists && this.host.fileExists(packageJsonPath)) {
|
|
1488
1519
|
const contents = parsePackageJson(this.host.readFile(packageJsonPath) ?? '');
|
|
1489
1520
|
if (this.traces !== undefined)
|
|
1490
|
-
this.trace(
|
|
1521
|
+
this.trace(1279 /* Diagnostics.Found_package_json_at_0 */, packageJsonPath);
|
|
1491
1522
|
const stored = cache.set(packageJsonPath, { packageDirectory, directoryExists: true, contents });
|
|
1492
1523
|
return withPackageDirectory(stored, packageDirectory);
|
|
1493
1524
|
}
|
|
1494
1525
|
if (directoryExists && this.traces !== undefined)
|
|
1495
|
-
this.trace(
|
|
1526
|
+
this.trace(1276 /* Diagnostics.File_0_does_not_exist */, packageJsonPath);
|
|
1496
1527
|
cache.set(packageJsonPath, { packageDirectory, directoryExists, contents: undefined });
|
|
1497
1528
|
return undefined;
|
|
1498
1529
|
}
|
|
@@ -1520,7 +1551,7 @@ class ResolutionState {
|
|
|
1520
1551
|
if (peers === undefined || peers.size === 0)
|
|
1521
1552
|
return '';
|
|
1522
1553
|
if (this.traces !== undefined)
|
|
1523
|
-
this.trace(
|
|
1554
|
+
this.trace(1441 /* Diagnostics.X_package_json_has_a_peerDependencies_field */);
|
|
1524
1555
|
const packageDirectory = this.realPath(packageInfo.packageDirectory);
|
|
1525
1556
|
const index = packageDirectory.lastIndexOf('/node_modules');
|
|
1526
1557
|
if (index === -1)
|
|
@@ -1535,10 +1566,10 @@ class ResolutionState {
|
|
|
1535
1566
|
const version = peerContents.version.value ?? '';
|
|
1536
1567
|
result += '+' + name + '@' + version;
|
|
1537
1568
|
if (this.traces !== undefined)
|
|
1538
|
-
this.trace(
|
|
1569
|
+
this.trace(1442 /* Diagnostics.Found_peerDependency_0_with_1_version */, name, version);
|
|
1539
1570
|
}
|
|
1540
1571
|
else if (this.traces !== undefined) {
|
|
1541
|
-
this.trace(
|
|
1572
|
+
this.trace(1443 /* Diagnostics.Failed_to_find_peerDependency_0 */, name);
|
|
1542
1573
|
}
|
|
1543
1574
|
}
|
|
1544
1575
|
return result;
|
|
@@ -1546,7 +1577,7 @@ class ResolutionState {
|
|
|
1546
1577
|
realPath(path) {
|
|
1547
1578
|
const real = normalizePath(this.host.realpath(path));
|
|
1548
1579
|
if (this.traces !== undefined)
|
|
1549
|
-
this.trace(
|
|
1580
|
+
this.trace(1306 /* Diagnostics.Resolving_real_path_for_0_result_1 */, path, real);
|
|
1550
1581
|
return real;
|
|
1551
1582
|
}
|
|
1552
1583
|
validatePackageJsonField(fieldName, field, expectedType) {
|
|
@@ -1554,11 +1585,11 @@ class ResolutionState {
|
|
|
1554
1585
|
if (field.value !== undefined)
|
|
1555
1586
|
return true;
|
|
1556
1587
|
if (this.traces !== undefined) {
|
|
1557
|
-
this.trace(
|
|
1588
|
+
this.trace(1284 /* Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2 */, fieldName, expectedType, field.actualType);
|
|
1558
1589
|
}
|
|
1559
1590
|
}
|
|
1560
1591
|
if (this.traces !== undefined)
|
|
1561
|
-
this.trace(
|
|
1592
|
+
this.trace(1280 /* Diagnostics.X_package_json_does_not_have_a_0_field */, fieldName);
|
|
1562
1593
|
return false;
|
|
1563
1594
|
}
|
|
1564
1595
|
/** The normalized path a string field points at, or `''`. */
|
|
@@ -1568,12 +1599,12 @@ class ResolutionState {
|
|
|
1568
1599
|
const value = field.value ?? '';
|
|
1569
1600
|
if (value === '') {
|
|
1570
1601
|
if (this.traces !== undefined)
|
|
1571
|
-
this.trace(
|
|
1602
|
+
this.trace(1384 /* Diagnostics.X_package_json_had_a_falsy_0_field */, fieldName);
|
|
1572
1603
|
return '';
|
|
1573
1604
|
}
|
|
1574
1605
|
const path = normalizePath(combinePaths(directory, value));
|
|
1575
1606
|
if (this.traces !== undefined)
|
|
1576
|
-
this.trace(
|
|
1607
|
+
this.trace(1281 /* Diagnostics.X_package_json_has_0_field_1_that_references_2 */, fieldName, value, path);
|
|
1577
1608
|
return path;
|
|
1578
1609
|
}
|
|
1579
1610
|
conditionMatches(condition) {
|