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
|
@@ -9,11 +9,13 @@ import { readProjectConfig } from "../../compiler/internal/project/readProjectCo
|
|
|
9
9
|
import { resolveBinary } from "../../compiler/internal/resolveBinary";
|
|
10
10
|
import { resolveTsgo } from "../../compiler/internal/resolveTsgo";
|
|
11
11
|
import { outputText, spawnNative } from "../../compiler/internal/spawnNative";
|
|
12
|
+
import { createCanonicalTempDirectory } from "../../internal/createCanonicalTempDirectory";
|
|
12
13
|
import {
|
|
13
14
|
type ProjectInputPathIdentityContext,
|
|
14
15
|
createProjectInputPathIdentityContext,
|
|
15
16
|
resolveProjectInputPath,
|
|
16
17
|
} from "../../internal/projectInputPathIdentity";
|
|
18
|
+
import { resolveNodeBinary } from "../../internal/resolveNodeBinary";
|
|
17
19
|
import {
|
|
18
20
|
hasProjectPluginEntries,
|
|
19
21
|
loadProjectPlugins,
|
|
@@ -127,6 +129,9 @@ function resolveTtscserverEnv(argv: readonly string[]): TtscserverEnvironment {
|
|
|
127
129
|
}
|
|
128
130
|
const context = resolveLspExecutionContext(argv);
|
|
129
131
|
const env = lspSidecarEnvironment({
|
|
132
|
+
cwd:
|
|
133
|
+
context.projectContext?.logicalProjectRoot ??
|
|
134
|
+
path.resolve(optionValue(argv, "--cwd") ?? process.cwd()),
|
|
130
135
|
pluginConfigOrigin: context.projectContext?.pluginConfigOrigin,
|
|
131
136
|
tsgoBinary: context.tsgoBinary,
|
|
132
137
|
});
|
|
@@ -170,7 +175,7 @@ export function materializeLSPPluginManifest(manifest: unknown): {
|
|
|
170
175
|
dispose(): void;
|
|
171
176
|
path: string;
|
|
172
177
|
} {
|
|
173
|
-
const directory =
|
|
178
|
+
const directory = createCanonicalTempDirectory("ttsc-lsp-");
|
|
174
179
|
const location = path.join(directory, "plugins.json");
|
|
175
180
|
try {
|
|
176
181
|
fs.writeFileSync(location, JSON.stringify(manifest), {
|
|
@@ -194,17 +199,20 @@ export function materializeLSPPluginManifest(manifest: unknown): {
|
|
|
194
199
|
}
|
|
195
200
|
|
|
196
201
|
function lspSidecarEnvironment(options: {
|
|
202
|
+
cwd: string;
|
|
197
203
|
pluginConfigOrigin: string | undefined;
|
|
198
204
|
tsgoBinary: string;
|
|
199
205
|
}): NodeJS.ProcessEnv {
|
|
200
206
|
const env: NodeJS.ProcessEnv = {
|
|
201
207
|
...process.env,
|
|
202
|
-
TTSC_NODE_BINARY: process.env.TTSC_NODE_BINARY ?? process.execPath,
|
|
203
208
|
TTSC_TSGO_BINARY: options.tsgoBinary,
|
|
204
209
|
TTSC_TTSX_BINARY:
|
|
205
210
|
process.env.TTSC_TTSX_BINARY ??
|
|
206
211
|
path.join(__dirname, "..", "..", "launcher", "ttsx.js"),
|
|
207
212
|
};
|
|
213
|
+
const node = resolveNodeBinary(env, options.cwd);
|
|
214
|
+
if (node === undefined) delete env.TTSC_NODE_BINARY;
|
|
215
|
+
else env.TTSC_NODE_BINARY = node;
|
|
208
216
|
if (options.pluginConfigOrigin === undefined) {
|
|
209
217
|
delete env.TTSC_PLUGIN_CONFIG_DIR;
|
|
210
218
|
} else {
|
|
@@ -318,7 +326,13 @@ function loadLSPProjectPlugins(
|
|
|
318
326
|
pluginConfigDir: pluginConfigOrigin,
|
|
319
327
|
tsconfig: project.identity.logicalConfigPath,
|
|
320
328
|
})
|
|
321
|
-
: {
|
|
329
|
+
: {
|
|
330
|
+
hostInputHashes: {},
|
|
331
|
+
hostInputRealpaths: {},
|
|
332
|
+
hostInputs: [...project.configPaths],
|
|
333
|
+
nativePlugins: [],
|
|
334
|
+
project,
|
|
335
|
+
};
|
|
322
336
|
}
|
|
323
337
|
|
|
324
338
|
function captureInitialLSPProjectInputs(options: {
|
|
@@ -355,6 +369,7 @@ function captureInitialLSPProjectInputs(options: {
|
|
|
355
369
|
);
|
|
356
370
|
}
|
|
357
371
|
const env = lspSidecarEnvironment({
|
|
372
|
+
cwd: options.project.root,
|
|
358
373
|
pluginConfigOrigin: options.pluginConfigOrigin,
|
|
359
374
|
tsgoBinary: options.tsgoBinary,
|
|
360
375
|
});
|
|
@@ -278,6 +278,8 @@ function runPreparedEntry(
|
|
|
278
278
|
depCacheDir,
|
|
279
279
|
emitDir: execution.emitDir,
|
|
280
280
|
emittedFiles: execution.emittedFiles,
|
|
281
|
+
entryFile: execution.entryFile,
|
|
282
|
+
entrySource: execution.entrySource,
|
|
281
283
|
moduleOptions: execution.moduleOptions,
|
|
282
284
|
projectRoot: execution.projectRoot,
|
|
283
285
|
rootDir: execution.rootDir,
|