ttsc 0.26.2 → 0.28.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 +9 -0
- package/cmd/graphbench/main.go +26 -16
- package/cmd/graphdump/main.go +37 -12
- package/cmd/graphdump/run_declares_the_capability_its_output_carries_test.go +137 -0
- package/cmd/graphdump/run_reports_an_unknown_flag_without_exiting_the_process_test.go +56 -0
- package/cmd/graphdump/run_reports_an_unloadable_project_without_printing_a_dump_test.go +46 -0
- package/cmd/ttsc/api_transform.go +28 -3
- package/cmd/ttscgraph/auxiliary_identity_state_tracks_retargets_not_source_contents_test.go +85 -0
- package/cmd/ttscgraph/disk_realpath_other.go +16 -0
- package/cmd/ttscgraph/disk_realpath_windows.go +56 -0
- package/cmd/ttscgraph/dump.go +43 -11
- package/cmd/ttscgraph/run_dump_claims_artifacts_only_when_it_asked_test.go +135 -0
- package/cmd/ttscgraph/run_dump_declares_the_capability_its_output_carries_test.go +96 -0
- package/cmd/ttscgraph/serve.go +357 -60
- package/cmd/ttscgraph/serve_adopts_a_republished_artifact_set_test.go +348 -0
- package/cmd/ttscgraph/serve_projects_an_artifact_no_source_owns_test.go +90 -0
- package/cmd/ttscgraph/serve_shards.go +31 -9
- package/driver/config_discovery.go +121 -0
- package/driver/emit_plugin.go +77 -11
- package/driver/graph.go +64 -11
- package/driver/input_observation.go +273 -0
- package/driver/input_observation_test.go +149 -0
- package/driver/plugins.go +506 -15
- package/driver/program.go +54 -1
- package/driver/resolution_candidates.go +13 -5
- package/driver/rewrite.go +45 -2
- package/driver/transform_dependencies.go +283 -0
- package/driver/transform_dependencies_declares_every_file_without_a_contributor_test.go +28 -0
- package/driver/transform_dependencies_drops_a_self_reported_dependency_test.go +21 -0
- package/driver/transform_dependencies_keys_a_reported_path_like_the_envelope_test.go +46 -0
- package/driver/transform_dependencies_requires_every_contributor_to_declare_test.go +38 -0
- package/driver/transform_dependencies_stays_silent_for_an_undeclared_contributor_test.go +23 -0
- package/driver/transform_dependencies_withdraws_completeness_after_an_unusable_dependency_test.go +37 -0
- package/internal/graph/artifacts.go +230 -0
- package/internal/graph/artifacts_index_what_a_plugin_published_test.go +154 -0
- package/internal/graph/artifacts_survive_a_partial_rebuild_test.go +89 -0
- package/internal/graph/build.go +35 -0
- package/internal/graph/build_releases_the_scratch_it_no_longer_reads_test.go +118 -0
- package/internal/graph/doc_refs_are_the_use_the_checker_already_counts_test.go +93 -0
- package/internal/graph/doc_refs_resolve_documentation_links_test.go +335 -0
- package/internal/graph/doc_tags.go +416 -0
- package/internal/graph/doc_tags_are_claimed_before_they_are_read_test.go +131 -0
- package/internal/graph/doc_tags_capture_every_unrecognized_tag_test.go +165 -0
- package/internal/graph/doc_tags_read_only_what_the_parser_attached_test.go +97 -0
- package/internal/graph/doc_tags_stop_at_the_external_boundary_test.go +59 -0
- package/internal/graph/doc_tags_survive_line_endings_and_repeated_blocks_test.go +146 -0
- package/internal/graph/dump.go +60 -13
- package/internal/graph/dump_checkout_paths_are_stable_test.go +2 -2
- package/internal/graph/dump_paths.go +2 -2
- package/internal/graph/dump_paths_are_portable_and_injective_test.go +1 -1
- package/internal/graph/edge_kinds_names_every_declared_kind_test.go +49 -0
- package/internal/graph/edges.go +1 -0
- package/internal/graph/graph.go +79 -4
- package/internal/graph/provenance.go +29 -2
- package/lib/TtscCompiler.d.ts +12 -11
- package/lib/TtscCompiler.js +44 -29
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/compiler/internal/captureProcessOutput.js +2 -2
- package/lib/compiler/internal/captureProcessOutput.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.js +4 -3
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/project/createNativeProjectContextArgs.d.ts +9 -0
- package/lib/compiler/internal/project/createNativeProjectContextArgs.js +16 -4
- package/lib/compiler/internal/project/createNativeProjectContextArgs.js.map +1 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +2 -0
- package/lib/compiler/internal/resolveEmittedJavaScript.js +3 -0
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +1 -1
- package/lib/compiler/internal/runBuild.js +80 -34
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.js +2 -2
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/compiler/internal/sharedHostHelpers.d.ts +28 -0
- package/lib/compiler/internal/sharedHostHelpers.js +39 -0
- package/lib/compiler/internal/sharedHostHelpers.js.map +1 -1
- package/lib/compiler/internal/startResidentTransform.js +12 -4
- package/lib/compiler/internal/startResidentTransform.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.d.ts +3 -0
- package/lib/compiler/internal/transformProjectInMemory.js +239 -35
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/flags/schema.js +12 -5
- package/lib/flags/schema.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/internal/createCanonicalTempDirectory.d.ts +17 -0
- package/lib/internal/createCanonicalTempDirectory.js +42 -0
- package/lib/internal/createCanonicalTempDirectory.js.map +1 -0
- package/lib/internal/projectInputPathIdentity.d.ts +3 -0
- package/lib/internal/projectInputPathIdentity.js +11 -5
- package/lib/internal/projectInputPathIdentity.js.map +1 -1
- package/lib/internal/resolveNodeBinary.d.ts +14 -0
- package/lib/internal/resolveNodeBinary.js +150 -0
- package/lib/internal/resolveNodeBinary.js.map +1 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.d.ts +15 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.js +61 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.js.map +1 -0
- package/lib/launcher/internal/prepareExecution.d.ts +3 -0
- package/lib/launcher/internal/prepareExecution.js +42 -14
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +25 -13
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtscserver.js +18 -3
- package/lib/launcher/internal/runTtscserver.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +2 -0
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtimeHooks.d.ts +47 -3
- package/lib/launcher/internal/runtimeHooks.js +746 -64
- package/lib/launcher/internal/runtimeHooks.js.map +1 -1
- package/lib/plugin/internal/buildSourcePlugin.d.ts +62 -8
- package/lib/plugin/internal/buildSourcePlugin.js +754 -72
- package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/capabilityResolutionCache.d.ts +76 -0
- package/lib/plugin/internal/capabilityResolutionCache.js +224 -0
- package/lib/plugin/internal/capabilityResolutionCache.js.map +1 -0
- package/lib/plugin/internal/loadProjectPlugins.d.ts +17 -5
- package/lib/plugin/internal/loadProjectPlugins.js +1339 -77
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/resolveCapabilityPlugins.d.ts +55 -0
- package/lib/plugin/resolveCapabilityPlugins.js +118 -0
- package/lib/plugin/resolveCapabilityPlugins.js.map +1 -0
- package/lib/register.d.ts +1 -0
- package/lib/register.js +46 -0
- package/lib/register.js.map +1 -0
- package/lib/structures/ITtscCompilerContext.d.ts +6 -3
- package/lib/structures/ITtscCompilerTransformation.d.ts +38 -0
- package/lib/structures/ITtscPlugin.d.ts +33 -0
- package/package.json +16 -9
- package/shim/ast/parent.go +16 -3
- package/shim/checker/enums_gen.go +11 -0
- package/shim/checker/go.mod +9 -0
- package/shim/checker/go.sum +22 -0
- package/shim/checker/shim.go +78 -0
- package/shim/compiler/emithook.go +10 -0
- package/shim/compiler/incremental.go +45 -8
- package/src/TtscCompiler.ts +55 -33
- package/src/compiler/internal/captureProcessOutput.ts +3 -2
- package/src/compiler/internal/compileProjectInMemory.ts +4 -3
- package/src/compiler/internal/project/createNativeProjectContextArgs.ts +19 -4
- package/src/compiler/internal/resolveEmittedJavaScript.ts +6 -0
- package/src/compiler/internal/runBuild.ts +102 -39
- package/src/compiler/internal/runSingleFileEmit.ts +2 -2
- package/src/compiler/internal/sharedHostHelpers.ts +44 -0
- package/src/compiler/internal/startResidentTransform.ts +12 -3
- package/src/compiler/internal/transformProjectInMemory.ts +410 -39
- package/src/flags/schema.ts +12 -5
- package/src/index.ts +1 -0
- package/src/internal/createCanonicalTempDirectory.ts +53 -0
- package/src/internal/projectInputPathIdentity.ts +17 -4
- package/src/internal/resolveNodeBinary.ts +173 -0
- package/src/internal/resolveSafeCacheCleanupTargets.ts +85 -0
- package/src/launcher/internal/prepareExecution.ts +50 -14
- package/src/launcher/internal/runTtsc.ts +24 -13
- package/src/launcher/internal/runTtscserver.ts +18 -3
- package/src/launcher/internal/runTtsx.ts +2 -0
- package/src/launcher/internal/runtimeHooks.ts +934 -68
- package/src/plugin/internal/buildSourcePlugin.ts +984 -79
- package/src/plugin/internal/capabilityResolutionCache.ts +305 -0
- package/src/plugin/internal/loadProjectPlugins.ts +1718 -104
- package/src/plugin/resolveCapabilityPlugins.ts +171 -0
- package/src/register.ts +47 -0
- package/src/structures/ITtscCompilerContext.ts +6 -3
- package/src/structures/ITtscCompilerTransformation.ts +46 -0
- package/src/structures/ITtscPlugin.ts +36 -0
- package/tools/shim_audit/baseline.json +0 -2
- package/utility/host.go +18 -3
- package/lib/internal/assertSafeExplicitCacheDirectory.d.ts +0 -5
- package/lib/internal/assertSafeExplicitCacheDirectory.js +0 -26
- package/lib/internal/assertSafeExplicitCacheDirectory.js.map +0 -1
- package/src/internal/assertSafeExplicitCacheDirectory.ts +0 -29
|
@@ -14,6 +14,32 @@ export interface OwningModuleOptions {
|
|
|
14
14
|
module?: string;
|
|
15
15
|
target?: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Runtime manifest written by `runTtsx` (the parent) and read once here. It
|
|
19
|
+
* describes the already-built entry project so the hooks can serve its emit.
|
|
20
|
+
*/
|
|
21
|
+
export interface RuntimeManifest {
|
|
22
|
+
/** Project root of the entry's owning tsconfig. */
|
|
23
|
+
projectRoot: string;
|
|
24
|
+
/** Source-tree root the emit mirrors (tsgo strips this prefix). */
|
|
25
|
+
rootDir: string;
|
|
26
|
+
/** Directory holding the entry project's emitted JavaScript. */
|
|
27
|
+
emitDir: string;
|
|
28
|
+
/** Emitted file list from the entry build, for source→output matching. */
|
|
29
|
+
emittedFiles?: readonly string[];
|
|
30
|
+
/** Physical TypeScript root whose checked preparation created this manifest. */
|
|
31
|
+
entrySource?: string;
|
|
32
|
+
/** Exact JavaScript emitted for `entrySource`. */
|
|
33
|
+
entryFile?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The entry tsconfig's `module` and `target`, deciding emit CJS/ESM per file.
|
|
36
|
+
* `target` is not decoration: an absent `module` makes tsgo derive the module
|
|
37
|
+
* kind from it.
|
|
38
|
+
*/
|
|
39
|
+
moduleOptions?: OwningModuleOptions;
|
|
40
|
+
/** Root directory for per-dependency build output. */
|
|
41
|
+
depCacheDir: string;
|
|
42
|
+
}
|
|
17
43
|
/**
|
|
18
44
|
* Lowest Node.js the ttsx source runtime supports. The synchronous
|
|
19
45
|
* `module.registerHooks` (Node 22.15.0) is the highest floor among the runtime
|
|
@@ -35,6 +61,10 @@ export declare const TTSX_MINIMUM_NODE_VERSION = "22.15.0";
|
|
|
35
61
|
* around the floor cannot otherwise be pinned on CI.
|
|
36
62
|
*/
|
|
37
63
|
export declare function checkNodeRuntimeSupport(version: string): string | null;
|
|
64
|
+
export interface RuntimeHookOptions {
|
|
65
|
+
/** Prepare and type-check a TypeScript root discovered after registration. */
|
|
66
|
+
prepareEntry?: (filename: string) => RuntimeManifest;
|
|
67
|
+
}
|
|
38
68
|
/**
|
|
39
69
|
* Install the source-loading hooks on the current (main) thread. Idempotent:
|
|
40
70
|
* the bootstrap installs them for the entry process, and `NODE_OPTIONS`
|
|
@@ -45,10 +75,18 @@ export declare function checkNodeRuntimeSupport(version: string): string | null;
|
|
|
45
75
|
* `require()` made from inside a CommonJS module that was itself reached
|
|
46
76
|
* through an ESM `import` (the interop translator loads it on the raw CJS
|
|
47
77
|
* path). The ESM graph goes through `registerHooks`; the CommonJS `require`
|
|
48
|
-
* graph goes through `Module._extensions` — the
|
|
49
|
-
*
|
|
78
|
+
* graph goes through `Module._extensions` and `Module._resolveFilename` — the
|
|
79
|
+
* canonical loader extension points `ts-node`/`tsx` use for the same reason.
|
|
80
|
+
*
|
|
81
|
+
* Both halves of that second graph are required, and they answer different
|
|
82
|
+
* questions. `_extensions` decides how a file that was _found_ is compiled, and
|
|
83
|
+
* Node reuses its keys when it probes an extensionless request, so
|
|
84
|
+
* `require("./x")` reaches `x.ts` for free. Nothing there resolves a request
|
|
85
|
+
* that already carries an extension: `require("./x.js")` backed only by `x.ts`
|
|
86
|
+
* is a resolution failure before any compiler is consulted, which is why the
|
|
87
|
+
* rescue is installed on `_resolveFilename` as well (samchon/ttsc#1280).
|
|
50
88
|
*/
|
|
51
|
-
export declare function installRuntimeHooks(): void;
|
|
89
|
+
export declare function installRuntimeHooks(options?: RuntimeHookOptions): void;
|
|
52
90
|
/**
|
|
53
91
|
* The module format of the entry source file, derived from the entry project's
|
|
54
92
|
* compiler options (via the runtime manifest) the same way the served files are
|
|
@@ -88,6 +126,11 @@ export declare function projectModuleOptions(compilerOptions: Record<string, unk
|
|
|
88
126
|
* cannot pin both Windows case-semantics branches on CI.
|
|
89
127
|
*/
|
|
90
128
|
export declare function isWithin(real: string, directory: string, identities?: FilesystemPathIdentityContext): boolean;
|
|
129
|
+
/** Derive one dependency cache key; exported for isolation regressions. */
|
|
130
|
+
export declare function dependencyCacheKey(tsconfig: string, options?: {
|
|
131
|
+
descriptorLoad?: boolean;
|
|
132
|
+
descriptorNonce?: string;
|
|
133
|
+
}): string;
|
|
91
134
|
/**
|
|
92
135
|
* Reuse a dependency another process (or an earlier import) already built.
|
|
93
136
|
*
|
|
@@ -102,6 +145,7 @@ export declare function isWithin(real: string, directory: string, identities?: F
|
|
|
102
145
|
* Exported for the ttsx dependency-cache regressions.
|
|
103
146
|
*/
|
|
104
147
|
export declare function readDependencyCache(cacheDir: string, metaPath: string): BuiltProject | null;
|
|
148
|
+
export declare function dependencyCacheRoot(env?: NodeJS.ProcessEnv): string;
|
|
105
149
|
/** Ownership token returned only to the process that acquired `current`. */
|
|
106
150
|
export type DependencyBuildLockLease = {
|
|
107
151
|
generation: string;
|