tsc-ts 0.0.10 → 0.1.1
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 +29 -18
- package/dist/api/compiler/ast.js +1040 -1007
- 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 +136 -91
- package/dist/api/compiler/checker-contextual.d.ts +20 -0
- package/dist/api/compiler/checker-contextual.js +175 -62
- 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 +258 -212
- 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 +107 -89
- 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 +190 -46
- 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 +97 -31
- package/dist/api/compiler/checker.js +149 -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 +24 -4
- package/dist/api/compiler/compile-program.js +53 -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/expr-record.d.ts +11 -0
- package/dist/api/compiler/expr-record.js +53 -0
- 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/identifier-name.d.ts +9 -0
- package/dist/api/compiler/identifier-name.js +10 -0
- package/dist/api/compiler/instantiation.d.ts +7 -0
- package/dist/api/compiler/instantiation.js +101 -49
- package/dist/api/compiler/jsdoc.js +27 -25
- 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 +42 -20
- package/dist/api/compiler/parser.js +318 -224
- 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 +6 -3
- 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 +306 -283
- 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 +64 -59
- package/dist/api/compiler/scanner.d.ts +27 -2
- package/dist/api/compiler/scanner.js +181 -150
- package/dist/api/compiler/shared-results.d.ts +696 -0
- package/dist/api/compiler/shared-results.js +2905 -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 +307 -239
- 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 +74 -38
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/cgroup.ts +157 -0
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +76 -8
- package/src/compiler/checker-classes.ts +80 -25
- package/src/compiler/checker-contextual.ts +110 -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 +95 -47
- 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 +28 -5
- 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 +173 -35
- 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 +175 -41
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +59 -25
- package/src/compiler/decoder.ts +15 -5
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- package/src/compiler/doctor-report.ts +133 -0
- package/src/compiler/emitter.ts +57 -8
- package/src/compiler/encoder.ts +23 -8
- package/src/compiler/expr-record.ts +59 -0
- 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/identifier-name.ts +13 -0
- 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 +7 -3
- 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 +543 -147
- package/src/compiler/parallel-emit.ts +4 -4
- package/src/compiler/parser.ts +166 -47
- 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 +7 -3
- package/src/compiler/printer/helpers.ts +10 -1
- package/src/compiler/printer/name-generator.ts +24 -2
- package/src/compiler/printer/printer.ts +39 -16
- 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 +14 -5
- package/src/compiler/run-config.ts +1383 -0
- package/src/compiler/run-record-read.ts +87 -0
- package/src/compiler/run-records.ts +575 -0
- package/src/compiler/scanner.ts +166 -120
- package/src/compiler/shared-results.ts +3144 -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 +22 -3
- 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 +136 -49
- 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 +67 -6
- package/src/compiler/tsc-cli.ts +35 -4
- package/src/compiler/tsc-compile.ts +220 -10
- package/src/compiler/tsc-watch.ts +97 -47
- 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
|
@@ -527,26 +527,45 @@ export class ReferenceResolver {
|
|
|
527
527
|
const moduleDeclaration = moduleDeclarationOfSpecifier(declaration);
|
|
528
528
|
if (imported === undefined || moduleDeclaration === undefined) return false;
|
|
529
529
|
const moduleSymbol = this.resolveModuleSpecifier(declaration, getModuleSpecifierOf(moduleDeclaration));
|
|
530
|
-
return moduleSymbol !== undefined && this.isExportedThroughTypeOnlyStar(moduleSymbol, imported
|
|
530
|
+
return moduleSymbol !== undefined && this.isExportedThroughTypeOnlyStar(moduleSymbol, imported);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
533
|
+
/**
|
|
534
|
+
* Whether a module's export `name` comes from another module through an `export type *`, as tsgo's
|
|
535
|
+
* getExportsOfModuleWorker decides: a module reached through a type-only `export *` has its exports marked, and a
|
|
536
|
+
* module reached without one, even if already visited, clears the mark of its own exports.
|
|
537
|
+
*/
|
|
538
|
+
private isExportedThroughTypeOnlyStar(moduleSymbol: Symbol, name: string): boolean {
|
|
539
|
+
if (name === InternalSymbolName.Default) return false;
|
|
540
|
+
const walk = new TypeOnlyStarWalk(name);
|
|
541
|
+
this.visitExportStars(walk, moduleSymbol, false, false);
|
|
542
|
+
return walk.typeOnly && !walk.nonTypeOnly;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** Visits a module of an `export *` walk; returns whether it exports the walk's name. */
|
|
546
|
+
private visitExportStars(
|
|
547
|
+
walk: TypeOnlyStarWalk,
|
|
548
|
+
symbol: Symbol | undefined,
|
|
549
|
+
starIsTypeOnly: boolean,
|
|
550
|
+
isTypeOnly: boolean,
|
|
551
|
+
): boolean {
|
|
552
|
+
const exports = symbol === undefined ? undefined : symbol.exports;
|
|
553
|
+
if (!isTypeOnly && exports !== undefined && exports.has(walk.name)) walk.nonTypeOnly = true;
|
|
554
|
+
if (symbol === undefined || exports === undefined || walk.visited.has(symbol)) return false;
|
|
555
|
+
walk.visited.add(symbol);
|
|
556
|
+
let found = exports.has(walk.name);
|
|
539
557
|
const star = exports.get(InternalSymbolName.ExportStar);
|
|
540
|
-
if (star
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
558
|
+
if (star !== undefined)
|
|
559
|
+
for (const declaration of getDeclarations(star)) {
|
|
560
|
+
if (!(declaration instanceof ExportDeclaration)) continue;
|
|
561
|
+
const target = this.resolveExternalModuleSymbol(
|
|
562
|
+
this.resolveModuleSpecifier(declaration, declaration.moduleSpecifier),
|
|
563
|
+
);
|
|
564
|
+
if (this.visitExportStars(walk, target, declaration.isTypeOnly, isTypeOnly || declaration.isTypeOnly))
|
|
565
|
+
found = true;
|
|
566
|
+
}
|
|
567
|
+
if (starIsTypeOnly && found) walk.typeOnly = true;
|
|
568
|
+
return found;
|
|
550
569
|
}
|
|
551
570
|
|
|
552
571
|
/** Whether a symbol is declared in the global scope. */
|
|
@@ -803,6 +822,34 @@ export class ReferenceResolver {
|
|
|
803
822
|
|
|
804
823
|
// Constant values
|
|
805
824
|
|
|
825
|
+
/**
|
|
826
|
+
* The symbol an entity name expression such as `E.A` refers to as an expression: tsgo takes the symbol its checker
|
|
827
|
+
* resolves the expression to, where each name on the left is a value, so a local `let E` hides a const enum `E`.
|
|
828
|
+
*/
|
|
829
|
+
private resolveValueEntityName(name: Node): Symbol | undefined {
|
|
830
|
+
let symbol: Symbol | undefined;
|
|
831
|
+
if (name instanceof Identifier) {
|
|
832
|
+
const resolved = this.resolveName(name, name.text, SymbolFlags.Value | SymbolFlags.Alias);
|
|
833
|
+
symbol = resolved === undefined ? undefined : this.getMergedSymbol(resolved);
|
|
834
|
+
} else if (name instanceof PropertyAccessExpression) {
|
|
835
|
+
const left = this.resolveValueEntityName(name.expression);
|
|
836
|
+
const right = name.name;
|
|
837
|
+
if (left === undefined || !(right instanceof Identifier)) return undefined;
|
|
838
|
+
let member = left.exports === undefined ? undefined : left.exports.get(right.text);
|
|
839
|
+
// A namespace merged with an alias also has the members of what the alias names, as its type does.
|
|
840
|
+
if (member === undefined && (left.flags & SymbolFlags.Alias) !== 0) {
|
|
841
|
+
const target = this.resolveAlias(left);
|
|
842
|
+
const targetExports = target === undefined ? undefined : target.exports;
|
|
843
|
+
if (targetExports !== undefined) member = targetExports.get(right.text);
|
|
844
|
+
}
|
|
845
|
+
if (member === undefined || (member.flags & (SymbolFlags.Value | SymbolFlags.Alias)) === 0) return undefined;
|
|
846
|
+
symbol = this.getMergedSymbol(member);
|
|
847
|
+
} else return undefined;
|
|
848
|
+
if (symbol === undefined || (symbol.flags & SymbolFlags.Alias) === 0) return symbol;
|
|
849
|
+
const target = this.resolveAlias(symbol);
|
|
850
|
+
return target === undefined ? undefined : this.getMergedSymbol(target);
|
|
851
|
+
}
|
|
852
|
+
|
|
806
853
|
/** The value of an enum member, computing the values of its whole declaration. */
|
|
807
854
|
getEnumMemberValue(member: Node): Evaluation {
|
|
808
855
|
const declaration = member.parent;
|
|
@@ -816,11 +863,11 @@ export class ReferenceResolver {
|
|
|
816
863
|
if (node instanceof EnumMember) return this.getEnumMemberValue(node);
|
|
817
864
|
let symbol: Symbol | undefined;
|
|
818
865
|
if (node instanceof PropertyAccessExpression) {
|
|
819
|
-
if (isEntityNameExpressionNode(node)) symbol = this.
|
|
866
|
+
if (isEntityNameExpressionNode(node)) symbol = this.resolveValueEntityName(node);
|
|
820
867
|
} else if (node instanceof ElementAccessExpression) {
|
|
821
868
|
const argument = stringLiteralText(node.argumentExpression);
|
|
822
869
|
if (isEntityNameExpressionNode(node.expression) && argument !== undefined) {
|
|
823
|
-
const root = this.
|
|
870
|
+
const root = this.resolveValueEntityName(node.expression);
|
|
824
871
|
const exports = root === undefined ? undefined : root.exports;
|
|
825
872
|
const member = exports === undefined ? undefined : exports.get(argument);
|
|
826
873
|
if (member !== undefined) symbol = this.getMergedSymbol(member);
|
|
@@ -1131,6 +1178,23 @@ export function getDeclarationOfAliasSymbol(symbol: Symbol): Node | undefined {
|
|
|
1131
1178
|
return undefined;
|
|
1132
1179
|
}
|
|
1133
1180
|
|
|
1181
|
+
/** The state of `isExportedThroughTypeOnlyStar`'s walk over the `export *` declarations of modules for one name. */
|
|
1182
|
+
class TypeOnlyStarWalk {
|
|
1183
|
+
readonly name: string;
|
|
1184
|
+
readonly visited: Set<Symbol>;
|
|
1185
|
+
/** Whether a module reached through a type-only `export *` exports the name. */
|
|
1186
|
+
typeOnly: boolean;
|
|
1187
|
+
/** Whether a module reached without one exports the name itself. */
|
|
1188
|
+
nonTypeOnly: boolean;
|
|
1189
|
+
|
|
1190
|
+
constructor(name: string) {
|
|
1191
|
+
this.name = name;
|
|
1192
|
+
this.visited = new Set<Symbol>();
|
|
1193
|
+
this.typeOnly = false;
|
|
1194
|
+
this.nonTypeOnly = false;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1134
1198
|
function isTypeOnlyAlias(symbol: Symbol): boolean {
|
|
1135
1199
|
let node = getDeclarationOfAliasSymbol(symbol);
|
|
1136
1200
|
while (node !== undefined) {
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
import type { EmitResolver } from './emit-resolver.js';
|
|
57
57
|
import { ConstantKind, type Evaluation } from './reference-resolver.js';
|
|
58
58
|
import { type TypeScriptFacts } from './subtree-facts.js';
|
|
59
|
+
import { nodeIsDecorated } from './decorator-utilities.js';
|
|
59
60
|
import { Transformer } from './transformer.js';
|
|
60
61
|
import {
|
|
61
62
|
getInnermostModuleDeclaration,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
isInstantiatedModule,
|
|
66
67
|
isParameterPropertyDeclaration,
|
|
67
68
|
isSameNode,
|
|
69
|
+
modifierFlagsOf,
|
|
68
70
|
} from './utilities.js';
|
|
69
71
|
|
|
70
72
|
const typeScriptModifiers =
|
|
@@ -577,7 +579,10 @@ export class RuntimeSyntax extends Transformer {
|
|
|
577
579
|
let name = visitedName instanceof Identifier ? (visitedName as Identifier) : undefined;
|
|
578
580
|
if (
|
|
579
581
|
name === undefined &&
|
|
580
|
-
(exported ||
|
|
582
|
+
(exported ||
|
|
583
|
+
childIsDecorated(this.options.experimentalDecorators === true, node.members) ||
|
|
584
|
+
((modifierFlagsOf(node) & exportDefault) !== exportDefault &&
|
|
585
|
+
nodeIsDecorated(this.options.experimentalDecorators === true, node, undefined, undefined)))
|
|
581
586
|
)
|
|
582
587
|
name = this.factory.createGeneratedNameForNode(node, 0, '', '');
|
|
583
588
|
const updated: Node = this.factory.updateClassDeclaration(
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
BinaryExpression,
|
|
5
5
|
BindingElement,
|
|
6
6
|
BindingPattern,
|
|
7
|
-
CallExpression,
|
|
8
7
|
CatchClause,
|
|
9
8
|
ForInOrOfStatement,
|
|
10
9
|
FunctionDeclaration,
|
|
@@ -29,6 +28,7 @@ import {
|
|
|
29
28
|
import { ClusteredIntLinkTable } from '../link-tables.js';
|
|
30
29
|
import { isTypeNodeKind } from '../printer/utilities.js';
|
|
31
30
|
import { SyntaxKind } from '../syntax-kind.js';
|
|
31
|
+
import { isImportCall } from '../ast-utilities.js';
|
|
32
32
|
import { TokenFlags } from '../types.js';
|
|
33
33
|
import { getElementsOfBindingOrAssignmentPattern, getTargetOfBindingOrAssignmentElement } from './destructuring.js';
|
|
34
34
|
|
|
@@ -267,12 +267,7 @@ export class SyntaxFacts extends NodeVisitor {
|
|
|
267
267
|
: SubtreeFacts.None)
|
|
268
268
|
);
|
|
269
269
|
case SyntaxKind.CallExpression:
|
|
270
|
-
return (
|
|
271
|
-
this.children(node) |
|
|
272
|
-
(node instanceof CallExpression && node.expression.kind === SyntaxKind.ImportKeyword
|
|
273
|
-
? SubtreeFacts.ContainsDynamicImport
|
|
274
|
-
: SubtreeFacts.None)
|
|
275
|
-
);
|
|
270
|
+
return this.children(node) | (isImportCall(node) ? SubtreeFacts.ContainsDynamicImport : SubtreeFacts.None);
|
|
276
271
|
case SyntaxKind.MetaProperty:
|
|
277
272
|
return node instanceof MetaProperty ? this.propagate(node.name) & ~SubtreeFacts.ContainsIdentifier : 0;
|
|
278
273
|
case SyntaxKind.SpreadElement:
|
|
@@ -398,7 +398,16 @@ export class TypeEraser extends Transformer {
|
|
|
398
398
|
case SyntaxKind.ImportClause:
|
|
399
399
|
if (node instanceof ImportClause) {
|
|
400
400
|
if (node.phaseModifier === SyntaxKind.TypeKeyword) return undefined;
|
|
401
|
-
|
|
401
|
+
let bindings = this.visitNode(node.namedBindings);
|
|
402
|
+
// With a default import, `{}` left by erasing type-only specifiers goes; a `{}` written in the source stays.
|
|
403
|
+
if (
|
|
404
|
+
node.name !== undefined &&
|
|
405
|
+
bindings instanceof NamedImports &&
|
|
406
|
+
bindings.elements.nodes.length === 0 &&
|
|
407
|
+
node.namedBindings instanceof NamedImports &&
|
|
408
|
+
node.namedBindings.elements.nodes.length !== 0
|
|
409
|
+
)
|
|
410
|
+
bindings = undefined;
|
|
402
411
|
if (node.name === undefined && bindings === undefined) return undefined;
|
|
403
412
|
return factory.updateImportClause(node, node.phaseModifier, node.name, bindings);
|
|
404
413
|
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
UnionTypeNode,
|
|
23
23
|
VariableDeclaration,
|
|
24
24
|
getIsTypeOnly,
|
|
25
|
+
getText,
|
|
25
26
|
} from '../ast.js';
|
|
26
27
|
import { getStrictOptionValue } from '../options.js';
|
|
27
28
|
import { SyntaxKind } from '../syntax-kind.js';
|
|
@@ -119,10 +120,10 @@ function resolveEntityName(
|
|
|
119
120
|
const namespace = resolveEntityName(resolver, name.left, SymbolFlags.Namespace, false, location);
|
|
120
121
|
if (namespace === undefined) return undefined;
|
|
121
122
|
if (namespace === unknownSymbol) return namespace;
|
|
122
|
-
let member = resolver.getExportOfSymbol(namespace, name.right
|
|
123
|
+
let member = resolver.getExportOfSymbol(namespace, getText(name.right));
|
|
123
124
|
if (member === undefined && (namespace.flags & SymbolFlags.Alias) !== 0) {
|
|
124
125
|
const target = resolver.resolveAlias(namespace);
|
|
125
|
-
if (target !== undefined) member = resolver.getExportOfSymbol(target, name.right
|
|
126
|
+
if (target !== undefined) member = resolver.getExportOfSymbol(target, getText(name.right));
|
|
126
127
|
}
|
|
127
128
|
if (member === undefined || (member.flags & (meaning | SymbolFlags.Alias)) === 0) return undefined;
|
|
128
129
|
symbol = member;
|
|
@@ -1186,6 +1186,7 @@ export abstract class VisitorBase extends VisitorHooks {
|
|
|
1186
1186
|
this.visitModifiers(node.modifiers),
|
|
1187
1187
|
node.keyword,
|
|
1188
1188
|
required(this.visitNode(node.name), node.name),
|
|
1189
|
+
this.visitNode(node.attributes) as TypeLiteralNode | undefined,
|
|
1189
1190
|
this.visitNode(node.body),
|
|
1190
1191
|
);
|
|
1191
1192
|
break;
|
|
@@ -1340,7 +1341,7 @@ export abstract class VisitorBase extends VisitorHooks {
|
|
|
1340
1341
|
return this.factory.updateQualifiedName(
|
|
1341
1342
|
node,
|
|
1342
1343
|
required(this.visitNode(node.left), node.left),
|
|
1343
|
-
|
|
1344
|
+
required(this.visitNode(node.right), node.right),
|
|
1344
1345
|
);
|
|
1345
1346
|
break;
|
|
1346
1347
|
case SyntaxKind.RestType:
|
|
@@ -144,11 +144,16 @@ export abstract class VisitorHooks {
|
|
|
144
144
|
if (declarations.length === 0) return updated;
|
|
145
145
|
const factory = this.factory;
|
|
146
146
|
if (updated === undefined) return factory.createBlock(declarations, true);
|
|
147
|
-
if (!(updated instanceof Block))
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
if (!(updated instanceof Block)) {
|
|
148
|
+
// The return statement takes the expression's range, so its comments are emitted once, before `return`.
|
|
149
|
+
this.context.addEmitFlags(updated, EmitFlags.NoComments);
|
|
150
|
+
const block = this.context.convertToFunctionBlock(updated, false);
|
|
151
|
+
return factory.updateBlock(
|
|
152
|
+
block,
|
|
153
|
+
this.context.mergeEnvironmentList(block.statements, declarations),
|
|
154
|
+
block.multiLine,
|
|
151
155
|
);
|
|
156
|
+
}
|
|
152
157
|
return factory.updateBlock(
|
|
153
158
|
updated,
|
|
154
159
|
this.context.mergeEnvironmentList(updated.statements, declarations),
|
|
@@ -62,12 +62,15 @@ import {
|
|
|
62
62
|
exitStatusOf,
|
|
63
63
|
rechecksOnThreads,
|
|
64
64
|
reportEmitAndErrors,
|
|
65
|
+
saveRunRecord,
|
|
65
66
|
Statistics,
|
|
66
67
|
statisticsOf,
|
|
67
68
|
SystemTimeStamps,
|
|
68
69
|
} from './tsc-compile.js';
|
|
69
70
|
import { sharesPublishedGraphs } from '@scriptc/threads';
|
|
70
|
-
import { checkerThreads,
|
|
71
|
+
import { checkerThreads, shareWithCheckers, startParallelCheck } from './parallel-check.js';
|
|
72
|
+
import { preParseConfig, reportRunConfig, type RunConfig } from './run-config.js';
|
|
73
|
+
import { openRecord } from './run-record-read.js';
|
|
71
74
|
import { emitThreads } from './parallel-emit.js';
|
|
72
75
|
import { LoadKind, ParseSession, clearPreparedFiles, parallelParse, reportPreparedFiles } from './parallel-parse.js';
|
|
73
76
|
import { assignSymbolIdsAtCreation } from './symbol.js';
|
|
@@ -182,6 +185,8 @@ class BuildTask {
|
|
|
182
185
|
buildKind = BuildKind.None;
|
|
183
186
|
filesToDelete: string[] = [];
|
|
184
187
|
configTime = 0;
|
|
188
|
+
/** The project's run configuration (run-config.ts), one per project of the build. */
|
|
189
|
+
run: RunConfig | undefined = undefined;
|
|
185
190
|
|
|
186
191
|
constructor(readonly config: string) {}
|
|
187
192
|
}
|
|
@@ -726,6 +731,33 @@ export class Orchestrator {
|
|
|
726
731
|
const host = new BuildCompilerHost(sys, this.fs, this.locale);
|
|
727
732
|
const configOptions = config.options;
|
|
728
733
|
const checkers = threads ? checkerThreads(configOptions.checkers, configOptions.singleThreaded) : 1;
|
|
734
|
+
// The projects of a build that builds several at once run beside each other, and each one's timings
|
|
735
|
+
// are the machine's, not its own: none keeps a record (run-records.ts). A watcher's builds measure a
|
|
736
|
+
// change, not the project: they keep none either, and read none.
|
|
737
|
+
const builders = this.command.buildOptions.builders ?? (configOptions.singleThreaded === true ? 1 : 4);
|
|
738
|
+
const learning = builders === 1 && !this.watching;
|
|
739
|
+
const opened = learning
|
|
740
|
+
? openRecord({
|
|
741
|
+
configFile: configOptions.configFilePath ?? task.config,
|
|
742
|
+
rootNames: config.fileNames,
|
|
743
|
+
options: configOptions,
|
|
744
|
+
})
|
|
745
|
+
: undefined;
|
|
746
|
+
// One configuration per project: its parse threads, and the pins of its checker count and sharing.
|
|
747
|
+
const run = (task.run = preParseConfig(configOptions, checkers, process.env, opened?.record, learning));
|
|
748
|
+
if (opened !== undefined) {
|
|
749
|
+
run.recordDirectory = opened.directory;
|
|
750
|
+
run.recordKey = opened.key;
|
|
751
|
+
run.recordFile = opened.file;
|
|
752
|
+
}
|
|
753
|
+
if (builders > 1) {
|
|
754
|
+
run.records = false;
|
|
755
|
+
run.recordsReason = 'concurrent projects';
|
|
756
|
+
}
|
|
757
|
+
if (this.watching) {
|
|
758
|
+
run.records = false;
|
|
759
|
+
run.recordsReason = 'watch mode';
|
|
760
|
+
}
|
|
729
761
|
if (threads && configOptions.singleThreaded !== true && parallelParse.spawn !== undefined) {
|
|
730
762
|
// Threads parse and bind the program's files ahead of it (parallel-parse.ts), as for plain
|
|
731
763
|
// compiles. Here also when the program is checked on this thread, with one checker or after a
|
|
@@ -735,7 +767,7 @@ export class Orchestrator {
|
|
|
735
767
|
// and parse threads don't load them again.
|
|
736
768
|
const libraryDirectory = getNormalizedAbsolutePath(sys.defaultLibraryPath, sys.currentDirectory);
|
|
737
769
|
const session = new ParseSession(
|
|
738
|
-
parseThreads
|
|
770
|
+
run.parseThreads,
|
|
739
771
|
configOptions,
|
|
740
772
|
sys.currentDirectory,
|
|
741
773
|
task.config,
|
|
@@ -777,9 +809,21 @@ export class Orchestrator {
|
|
|
777
809
|
times.parseTime = performance.now() - parseStart;
|
|
778
810
|
const bindStart = performance.now();
|
|
779
811
|
const checked = new CheckedProgram(program);
|
|
812
|
+
// The project's incremental program, made after checking, keeps the globals found checking a file
|
|
813
|
+
// with the file.
|
|
814
|
+
checked.globalsInFileDiagnostics = true;
|
|
780
815
|
times.bindTime = performance.now() - bindStart;
|
|
781
816
|
const options = program.options;
|
|
782
817
|
const count = mayUseThreads ? checkerThreads(options.checkers, options.singleThreaded, program) : 1;
|
|
818
|
+
// The run's configuration reports the count that checks: a checker thread run decides again once
|
|
819
|
+
// the plan is made (`startParallelCheck`, run-config.ts).
|
|
820
|
+
if (task.run !== undefined) task.run.checkers = count;
|
|
821
|
+
// A project rebuilt on its old build info checks the files a change affects, not the project: it
|
|
822
|
+
// keeps no sample, which records only keep full checks of (`run-records.ts`).
|
|
823
|
+
if (task.run !== undefined && oldSnapshot !== undefined && isIncremental(options)) {
|
|
824
|
+
task.run.records = false;
|
|
825
|
+
task.run.recordsReason = 'incremental recheck';
|
|
826
|
+
}
|
|
783
827
|
if (count > 1 && oldSnapshot !== undefined) {
|
|
784
828
|
if (isIncremental(options)) return this.recheckOnThreads(task, checked, times, oldSnapshot, count, then);
|
|
785
829
|
// Build info of a project that is no longer incremental has no pending emit to give the threads,
|
|
@@ -791,10 +835,20 @@ export class Orchestrator {
|
|
|
791
835
|
if (count > 1) {
|
|
792
836
|
// Checker threads also emit the files they check; the incremental program records their
|
|
793
837
|
// declaration signatures on this thread.
|
|
794
|
-
startParallelCheck(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
838
|
+
startParallelCheck(
|
|
839
|
+
checked,
|
|
840
|
+
count,
|
|
841
|
+
(checkTime) => {
|
|
842
|
+
this.emitAndReport(task, checked, times, oldSnapshot, checkTime);
|
|
843
|
+
then();
|
|
844
|
+
},
|
|
845
|
+
true,
|
|
846
|
+
undefined,
|
|
847
|
+
true,
|
|
848
|
+
undefined,
|
|
849
|
+
undefined,
|
|
850
|
+
task.run,
|
|
851
|
+
);
|
|
798
852
|
return true;
|
|
799
853
|
}
|
|
800
854
|
if (mayUseThreads && this.emitsOnThreads(checked, oldSnapshot))
|
|
@@ -896,6 +950,9 @@ export class Orchestrator {
|
|
|
896
950
|
true,
|
|
897
951
|
incrementalProgram.emitKindsOnCheckers(files),
|
|
898
952
|
incrementalProgram.checksOnCheckers,
|
|
953
|
+
undefined,
|
|
954
|
+
undefined,
|
|
955
|
+
task.run,
|
|
899
956
|
);
|
|
900
957
|
return true;
|
|
901
958
|
}
|
|
@@ -942,10 +999,14 @@ export class Orchestrator {
|
|
|
942
999
|
task.exitStatus = exitStatusOf(result);
|
|
943
1000
|
if (parallelCheckTime !== undefined) times.checkTime = parallelCheckTime;
|
|
944
1001
|
const options = program.options;
|
|
1002
|
+
// A project's sample is kept whether or not the build reports statistics, and the section reports
|
|
1003
|
+
// where it went (`run-records.ts`).
|
|
1004
|
+
const records = saveRunRecord(sys, incrementalProgram, task.run);
|
|
945
1005
|
if (options.diagnostics === true || options.extendedDiagnostics === true) {
|
|
946
1006
|
times.totalTime = sys.sinceStart();
|
|
947
1007
|
const statistics = statisticsOf(incrementalProgram);
|
|
948
1008
|
statistics.report(sys);
|
|
1009
|
+
if (options.extendedDiagnostics === true && task.run !== undefined) reportRunConfig(sys, task.run, records);
|
|
949
1010
|
task.statistics = statistics;
|
|
950
1011
|
}
|
|
951
1012
|
const status = task.status;
|
package/src/compiler/tsc-cli.ts
CHANGED
|
@@ -33,8 +33,10 @@ import { Colors, defaultIsPretty, header, printBuildHelp, printHelp, printVersio
|
|
|
33
33
|
import { generateTSConfig } from './init.js';
|
|
34
34
|
import { isIncremental, type CompilerOptions } from './options.js';
|
|
35
35
|
import { combinePaths, getDirectoryPath, normalizePath } from './path.js';
|
|
36
|
-
import { checkerThreads
|
|
36
|
+
import { checkerThreads } from './parallel-check.js';
|
|
37
37
|
import { ParseSession, parallelParse, reportPreparedFiles } from './parallel-parse.js';
|
|
38
|
+
import { preParseConfig, type RunConfig } from './run-config.js';
|
|
39
|
+
import { openRecord } from './run-record-read.js';
|
|
38
40
|
import { showConfig, type ShowConfigInput } from './show-config.js';
|
|
39
41
|
import { assignSymbolIdsAtCreation } from './symbol.js';
|
|
40
42
|
import { sharesPublishedGraphs } from '@scriptc/threads';
|
|
@@ -64,6 +66,8 @@ export abstract class System extends CommandLineHost {
|
|
|
64
66
|
|
|
65
67
|
/** Returns `''` for unset variables. */
|
|
66
68
|
abstract getEnvironmentVariable(name: string): string;
|
|
69
|
+
/** Whether the variable is set, perhaps to `''`. */
|
|
70
|
+
abstract hasEnvironmentVariable(name: string): boolean;
|
|
67
71
|
abstract write(text: string): void;
|
|
68
72
|
abstract fileExists(path: string): boolean;
|
|
69
73
|
abstract directoryExists(path: string): boolean;
|
|
@@ -161,6 +165,8 @@ export type CommandLineResult =
|
|
|
161
165
|
readonly errorSummary: ErrorSummaryReporter;
|
|
162
166
|
/** The build info of an incremental program, read while threads parsed its files; `undefined` if not read yet. */
|
|
163
167
|
readonly buildInfo?: EarlyBuildInfo;
|
|
168
|
+
/** How the run is configured: parse threads, checker count and sharing (run-config.ts). */
|
|
169
|
+
readonly config: RunConfig;
|
|
164
170
|
}
|
|
165
171
|
/** Threads are preparing the program's files; `run` calls back with the result once they are done. */
|
|
166
172
|
| { readonly kind: 'deferred'; readonly run: (done: (result: CommandLineResult) => void) => void }
|
|
@@ -361,6 +367,31 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
|
|
|
361
367
|
const configStart = performance.now();
|
|
362
368
|
mark('config start');
|
|
363
369
|
const errors: Diagnostic[] = [];
|
|
370
|
+
// The run's configuration, made once the config's options are known: its parse threads are needed
|
|
371
|
+
// before the first file is parsed.
|
|
372
|
+
let run: RunConfig | undefined = undefined;
|
|
373
|
+
const runConfigOf = (projectOptions: CompilerOptions): RunConfig => {
|
|
374
|
+
if (run === undefined) {
|
|
375
|
+
const opened = openRecord({
|
|
376
|
+
configFile: projectOptions.configFilePath ?? (configFileName === '' ? undefined : configFileName),
|
|
377
|
+
rootNames: fileNames,
|
|
378
|
+
options: projectOptions,
|
|
379
|
+
});
|
|
380
|
+
const made = preParseConfig(
|
|
381
|
+
projectOptions,
|
|
382
|
+
checkerThreads(projectOptions.checkers, projectOptions.singleThreaded),
|
|
383
|
+
process.env,
|
|
384
|
+
opened?.record,
|
|
385
|
+
);
|
|
386
|
+
if (opened !== undefined) {
|
|
387
|
+
made.recordDirectory = opened.directory;
|
|
388
|
+
made.recordKey = opened.key;
|
|
389
|
+
made.recordFile = opened.file;
|
|
390
|
+
}
|
|
391
|
+
run = made;
|
|
392
|
+
}
|
|
393
|
+
return run;
|
|
394
|
+
};
|
|
364
395
|
// Where threads parse and bind the program's files ahead of it (parallel-parse.ts), they start with
|
|
365
396
|
// the libraries and the root files found so far while the config's `include` patterns are matched.
|
|
366
397
|
let session: ParseSession | undefined = undefined;
|
|
@@ -368,7 +399,7 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
|
|
|
368
399
|
if (projectOptions.watch === true || options.showConfig === true || !parsesAhead(projectOptions)) return undefined;
|
|
369
400
|
assignSymbolIdsAtCreation();
|
|
370
401
|
const started = new ParseSession(
|
|
371
|
-
|
|
402
|
+
runConfigOf(projectOptions).parseThreads,
|
|
372
403
|
projectOptions,
|
|
373
404
|
sys.currentDirectory,
|
|
374
405
|
configFileName,
|
|
@@ -422,20 +453,20 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
|
|
|
422
453
|
reporter,
|
|
423
454
|
errorSummary,
|
|
424
455
|
buildInfo,
|
|
456
|
+
config: runConfigOf(config.options),
|
|
425
457
|
};
|
|
426
458
|
};
|
|
427
459
|
if (parsesAhead(config.options)) {
|
|
428
460
|
// Threads parse and bind the files the program is expected to load first (parallel-parse.ts), and
|
|
429
461
|
// share the program it becomes: its symbols get their ids when they are created.
|
|
430
462
|
assignSymbolIdsAtCreation();
|
|
431
|
-
const threads = checkerThreads(config.options.checkers, config.options.singleThreaded);
|
|
432
463
|
return {
|
|
433
464
|
kind: 'deferred',
|
|
434
465
|
run: (done: (result: CommandLineResult) => void) => {
|
|
435
466
|
const session =
|
|
436
467
|
early ??
|
|
437
468
|
new ParseSession(
|
|
438
|
-
|
|
469
|
+
runConfigOf(config.options).parseThreads,
|
|
439
470
|
config.options,
|
|
440
471
|
sys.currentDirectory,
|
|
441
472
|
configFileName,
|