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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
package graph
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"os"
|
|
5
|
+
"regexp"
|
|
6
|
+
"slices"
|
|
7
|
+
"testing"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// TestEdgeKindsNamesEveryDeclaredKind verifies that EdgeKinds returns exactly the
|
|
11
|
+
// EdgeKind constants this package declares.
|
|
12
|
+
//
|
|
13
|
+
// EdgeKinds exists so a consumer reporting per-kind numbers can seed every family
|
|
14
|
+
// rather than only the ones a particular project contains. That guarantee is only
|
|
15
|
+
// worth having if the list cannot fall behind the constants: a kind added to the
|
|
16
|
+
// block and not to the list is reported as absent rather than as zero, which is
|
|
17
|
+
// the defect the list was introduced to end. Go has no reflection over a const
|
|
18
|
+
// block, so the declarations are read from the source that makes them.
|
|
19
|
+
//
|
|
20
|
+
// 1. Read the EdgeKind constant block from graph.go.
|
|
21
|
+
// 2. Collect every declared wire value.
|
|
22
|
+
// 3. Assert EdgeKinds returns that set, with no extra and no missing member.
|
|
23
|
+
func TestEdgeKindsNamesEveryDeclaredKind(t *testing.T) {
|
|
24
|
+
source, err := os.ReadFile("graph.go")
|
|
25
|
+
if err != nil {
|
|
26
|
+
t.Fatal(err)
|
|
27
|
+
}
|
|
28
|
+
matches := regexp.MustCompile(`(?m)^\s*Edge\w+ EdgeKind = "([a-z-]+)"`).
|
|
29
|
+
FindAllStringSubmatch(string(source), -1)
|
|
30
|
+
if len(matches) == 0 {
|
|
31
|
+
t.Fatal("no EdgeKind constant declarations were found in graph.go")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declared := make([]string, 0, len(matches))
|
|
35
|
+
for _, match := range matches {
|
|
36
|
+
declared = append(declared, match[1])
|
|
37
|
+
}
|
|
38
|
+
returned := make([]string, 0, len(EdgeKinds()))
|
|
39
|
+
for _, kind := range EdgeKinds() {
|
|
40
|
+
returned = append(returned, string(kind))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
slices.Sort(declared)
|
|
44
|
+
slices.Sort(returned)
|
|
45
|
+
if !slices.Equal(declared, returned) {
|
|
46
|
+
t.Fatalf("EdgeKinds returns %v, but graph.go declares %v; a kind missing "+
|
|
47
|
+
"from the list is reported as absent rather than as zero", returned, declared)
|
|
48
|
+
}
|
|
49
|
+
}
|
package/internal/graph/edges.go
CHANGED
|
@@ -31,6 +31,7 @@ func (g *Graph) addEdges(prog *driver.Program, selected map[string]bool, partial
|
|
|
31
31
|
g.collectHeritage(checker, file)
|
|
32
32
|
g.collectCalls(checker, file)
|
|
33
33
|
g.collectTypeRefs(checker, file)
|
|
34
|
+
g.collectDocRefs(checker, file)
|
|
34
35
|
g.collectLiterals(checker, file)
|
|
35
36
|
if file.Statements != nil {
|
|
36
37
|
g.collectDecorators(file.FileName(), file.Statements.Nodes)
|
package/internal/graph/graph.go
CHANGED
|
@@ -24,6 +24,18 @@ const (
|
|
|
24
24
|
// imports from. A barrel declares nothing, so this is the only node it has,
|
|
25
25
|
// and it is the node a package.json entry path resolves to.
|
|
26
26
|
NodeModule NodeKind = "module"
|
|
27
|
+
// The artifact kinds. These are not declarations and they are not this
|
|
28
|
+
// Program's facts: a plugin materialized them from a Markdown document, a
|
|
29
|
+
// Prisma schema, or an API document, and the graph indexes what it was handed
|
|
30
|
+
// without interpreting any of it. Their ids are the address a citation names
|
|
31
|
+
// rather than the `path#name:kind` grammar, which is why a consumer parsing an
|
|
32
|
+
// id gates on the kind first.
|
|
33
|
+
NodeMarkdownDocument NodeKind = "markdown_document"
|
|
34
|
+
NodeMarkdownSection NodeKind = "markdown_section"
|
|
35
|
+
NodePrismaModel NodeKind = "prisma_model"
|
|
36
|
+
NodePrismaColumn NodeKind = "prisma_column"
|
|
37
|
+
NodePrismaRelation NodeKind = "prisma_relation"
|
|
38
|
+
NodeSwaggerOperation NodeKind = "swagger_operation"
|
|
27
39
|
)
|
|
28
40
|
|
|
29
41
|
// Node is one declared symbol. Its ID is position-invariant, built from the file
|
|
@@ -39,10 +51,22 @@ type Node struct {
|
|
|
39
51
|
// (`"a.b"` → Name `C.a.b`), so the simple/qualified boundary cannot be
|
|
40
52
|
// recovered from Name by splitting on a dot. Recording it here keeps the dump
|
|
41
53
|
// split exact instead of guessing.
|
|
42
|
-
Simple
|
|
43
|
-
Kind
|
|
44
|
-
File
|
|
45
|
-
|
|
54
|
+
Simple string
|
|
55
|
+
Kind NodeKind
|
|
56
|
+
File string
|
|
57
|
+
// ArtifactLine is the 1-based line a published artifact starts on, and is 0
|
|
58
|
+
// for every declaration — a declaration carries a real span, resolved from the
|
|
59
|
+
// compiler, and does not need this. It exists because an artifact has no AST
|
|
60
|
+
// position to take a span from: the plugin that parsed the document reports
|
|
61
|
+
// where the heading is, and that single number is the whole span an index
|
|
62
|
+
// carries. The section's content is read from the file when someone needs it,
|
|
63
|
+
// exactly as a function body is.
|
|
64
|
+
ArtifactLine int
|
|
65
|
+
// ArtifactParent is the id of the artifact containing this one — a section's
|
|
66
|
+
// document or enclosing section, a column's model. Empty for every
|
|
67
|
+
// declaration, whose containment the TypeScript memory layer synthesizes.
|
|
68
|
+
ArtifactParent string
|
|
69
|
+
External bool
|
|
46
70
|
// Exported marks a node that is part of its module's export surface, resolved
|
|
47
71
|
// through the checker's export table so a re-export (`export { Foo } from`) or
|
|
48
72
|
// a barrel (`export *`) counts, not only an inline `export` modifier. It is
|
|
@@ -163,6 +187,19 @@ const (
|
|
|
163
187
|
// type it mentions (a parameter, return, property, or alias type). It is not a
|
|
164
188
|
// runtime call, so an impact query can filter value edges from type edges.
|
|
165
189
|
EdgeTypeRef EdgeKind = "type-ref"
|
|
190
|
+
// EdgeDocRef is a reference from a declaration to a symbol its own
|
|
191
|
+
// documentation names through an inline link. The checker resolves the name
|
|
192
|
+
// and counts it as a use — an import that exists only to support one survives
|
|
193
|
+
// `noUnusedLocals` — so the relationship is a compiler fact like every other
|
|
194
|
+
// edge here, and it was the one class of resolved reference the graph held no
|
|
195
|
+
// edge for.
|
|
196
|
+
//
|
|
197
|
+
// It is its own kind rather than a type-ref because it is not a type
|
|
198
|
+
// position: a link may name a function, and a consumer filtering type edges
|
|
199
|
+
// from value edges would be told a documentation mention is one or the other
|
|
200
|
+
// when it is neither. The tag around the link decides nothing; a link under
|
|
201
|
+
// `@evidence`, under `@see`, or in ordinary prose is one relation.
|
|
202
|
+
EdgeDocRef EdgeKind = "doc-ref"
|
|
166
203
|
// EdgeExports runs from a module to a declaration its export table resolves
|
|
167
204
|
// to, through re-exports and barrels. It records which surface a symbol is
|
|
168
205
|
// public on, which the Exported flag cannot: a package's front door and its
|
|
@@ -170,6 +207,24 @@ const (
|
|
|
170
207
|
EdgeExports EdgeKind = "exports"
|
|
171
208
|
)
|
|
172
209
|
|
|
210
|
+
// EdgeKinds returns every kind Build can put on an edge, in declaration order.
|
|
211
|
+
//
|
|
212
|
+
// A consumer that reports per-kind numbers needs the whole vocabulary rather
|
|
213
|
+
// than the subset a particular project happens to contain: counting only what
|
|
214
|
+
// was seen makes the reported shape depend on the project measured, and a
|
|
215
|
+
// family that dropped to zero disappears instead of reading zero.
|
|
216
|
+
func EdgeKinds() []EdgeKind {
|
|
217
|
+
return []EdgeKind{
|
|
218
|
+
EdgeHeritage,
|
|
219
|
+
EdgeMemberRelation,
|
|
220
|
+
EdgeValueCall,
|
|
221
|
+
EdgeValueAccess,
|
|
222
|
+
EdgeTypeRef,
|
|
223
|
+
EdgeDocRef,
|
|
224
|
+
EdgeExports,
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
173
228
|
// Edge is a directed, checker-resolved relationship from one node to another,
|
|
174
229
|
// both referenced by Node.ID. File, Pos, and End bound the source expression
|
|
175
230
|
// that produced the edge. File is empty when the From node names it and is set
|
|
@@ -204,6 +259,26 @@ type Graph struct {
|
|
|
204
259
|
// re-parsing source. It is dump-only metadata, separate from Edges so the
|
|
205
260
|
// existing checker-resolved relationships are untouched.
|
|
206
261
|
Decorators []*Decorator
|
|
262
|
+
// DocTags holds the documentation tags TypeScript does not recognize, written
|
|
263
|
+
// on the workspace's declarations and captured verbatim so the JSON dump can
|
|
264
|
+
// attach them to each target node. A convention that attaches a declaration to
|
|
265
|
+
// something outside the type system — a specification section, an API
|
|
266
|
+
// operation, a reference document — writes it here and nowhere the graph could
|
|
267
|
+
// otherwise see. Dump-only metadata, separate from Edges for the same reason
|
|
268
|
+
// Decorators is.
|
|
269
|
+
DocTags []*DocTag
|
|
270
|
+
// docTagPositions deduplicates DocTags by where each tag is written, so a
|
|
271
|
+
// declaration presented to putDeclaredNode more than once contributes its tags
|
|
272
|
+
// once. Build-only, like bodyNodes.
|
|
273
|
+
docTagPositions map[docTagKey]struct{}
|
|
274
|
+
// docHosts are the declarations the node pass found documentation on, paired
|
|
275
|
+
// with the node it attributed them to and keyed by their file. The edge pass
|
|
276
|
+
// resolves documentation links from this set rather than from a walk of its
|
|
277
|
+
// own, so both halves of a citation cover the same declarations, and it asks
|
|
278
|
+
// per file so a project's whole documented population is never rescanned for
|
|
279
|
+
// each one. Build-only.
|
|
280
|
+
docHosts map[string][]docHost
|
|
281
|
+
docHostPositions map[docTagKey]struct{}
|
|
207
282
|
// bodyNodes tracks whether a callable node's display span is the overload
|
|
208
283
|
// implementation rather than an overload signature. It is build-only metadata
|
|
209
284
|
// and intentionally stays out of JSON dumps.
|
|
@@ -15,7 +15,7 @@ import (
|
|
|
15
15
|
// field is added, removed, or given a new meaning, independently of the serve
|
|
16
16
|
// envelope's protocol version: a one-shot `ttscgraph dump` written to a file has
|
|
17
17
|
// a schema but never rode the protocol.
|
|
18
|
-
const DumpSchemaVersion =
|
|
18
|
+
const DumpSchemaVersion = 8
|
|
19
19
|
|
|
20
20
|
// The capabilities a snapshot can declare. Each names one class of evidence a
|
|
21
21
|
// consumer may rely on when, and only when, the snapshot lists it.
|
|
@@ -26,6 +26,13 @@ const (
|
|
|
26
26
|
// CapabilitySourceDigests means Sources covers every file the program
|
|
27
27
|
// loaded, each with the digest of the text the checker read.
|
|
28
28
|
CapabilitySourceDigests = "sourceDigests"
|
|
29
|
+
// CapabilityArtifactNodes means the producer asked the project's configured
|
|
30
|
+
// plugins for the artifacts a citation can name, so a dump carrying none is a
|
|
31
|
+
// project that publishes none rather than a producer that never looked. The
|
|
32
|
+
// two states are otherwise the same absent nodes, and a consumer honouring the
|
|
33
|
+
// difference is the whole reason a capability is declared rather than
|
|
34
|
+
// inferred.
|
|
35
|
+
CapabilityArtifactNodes = "artifactNodes"
|
|
29
36
|
// CapabilityDiskDigests means Sources also carries each file's on-disk
|
|
30
37
|
// digest, so an empty one genuinely means the file could not be read.
|
|
31
38
|
//
|
|
@@ -37,6 +44,15 @@ const (
|
|
|
37
44
|
// CapabilityDiagnostics means Diagnostics is the compiler's complete
|
|
38
45
|
// findings for this generation, as opposed to not having been collected.
|
|
39
46
|
CapabilityDiagnostics = "diagnostics"
|
|
47
|
+
// CapabilityDocTags means every node carries the documentation tags
|
|
48
|
+
// TypeScript does not recognize, so an absent `docTags` genuinely means the
|
|
49
|
+
// declaration carries none.
|
|
50
|
+
//
|
|
51
|
+
// It is a separate claim rather than an inference from emptiness for the
|
|
52
|
+
// reason CapabilityDiskDigests is: a producer built before the field existed
|
|
53
|
+
// emits nothing, and a consumer reading that as "this declaration cites
|
|
54
|
+
// nothing" would answer a citation question with a confident, wrong "no".
|
|
55
|
+
CapabilityDocTags = "docTags"
|
|
40
56
|
)
|
|
41
57
|
|
|
42
58
|
// Provenance is the snapshot's evidence about the program that produced it.
|
|
@@ -67,6 +83,17 @@ type Provenance struct {
|
|
|
67
83
|
// Producer identifies the binary and the checker behind the facts.
|
|
68
84
|
Producer Producer `json:"producer"`
|
|
69
85
|
|
|
86
|
+
// ArtifactProducer identifies the second producer behind the artifact nodes,
|
|
87
|
+
// and is absent when the dump carries none.
|
|
88
|
+
//
|
|
89
|
+
// Every other fact here came from one Program. These did not: a plugin parsed
|
|
90
|
+
// documents this Program never read, in a process of its own, and saying so is
|
|
91
|
+
// what keeps the dump's one-generation contract honest instead of letting an
|
|
92
|
+
// overlay ride the same claim as the compiler's facts. A consumer that must
|
|
93
|
+
// not mix the two reads this field; one that only answers "what does this
|
|
94
|
+
// address name" does not care.
|
|
95
|
+
ArtifactProducer *Producer `json:"artifactProducer,omitempty"`
|
|
96
|
+
|
|
70
97
|
// Universe fingerprints the inputs that decide which files are in the
|
|
71
98
|
// program at all, as opposed to what is inside them.
|
|
72
99
|
Universe Universe `json:"universe"`
|
|
@@ -219,7 +246,7 @@ func TypescriptVersion() string { return shimcore.Version() }
|
|
|
219
246
|
|
|
220
247
|
// NewProvenance assembles the evidence for a snapshot while retaining the
|
|
221
248
|
// compiler's physical paths. NewDump projects those paths together with every
|
|
222
|
-
// node, edge, span, and diagnostic through its one cached
|
|
249
|
+
// node, edge, span, and diagnostic through its one cached path mapper.
|
|
223
250
|
// texts maps a source file's path to the text the checker read (as SourceTexts
|
|
224
251
|
// returns it); disk maps that path to the hex digest of its on-disk bytes, and
|
|
225
252
|
// a path absent from it is reported with an empty Disk. configs and roots come
|
package/lib/TtscCompiler.d.ts
CHANGED
|
@@ -48,15 +48,16 @@ export declare class TtscCompiler {
|
|
|
48
48
|
/**
|
|
49
49
|
* Remove compiled cache artifacts for this compiler instance.
|
|
50
50
|
*
|
|
51
|
-
* Removes
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* project-local caches. A user-provided `GOCACHE` is never removed.
|
|
51
|
+
* Removes an explicit `cacheDir` wholesale. Otherwise removes the plugin
|
|
52
|
+
* binary subdirectory, a safely identified ttsc-owned Go build cache
|
|
53
|
+
* (including an external `TTSC_GO_CACHE_DIR`), and the two legacy
|
|
54
|
+
* project-local caches. A user-provided `GOCACHE` is never removed. Every
|
|
55
|
+
* resolved deletion target is validated before the first removal. The cache
|
|
55
56
|
* location comes from this instance's `cacheDir` and environment
|
|
56
57
|
* (`TTSC_CACHE_DIR` / `TTSC_GO_CACHE_DIR`), defaulting to
|
|
57
|
-
* `<workspaceRoot>/node_modules/.cache/ttsc`.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* `<workspaceRoot>/node_modules/.cache/ttsc`. Any resolved cache target that
|
|
59
|
+
* equals or contains the project, or names a filesystem root, is rejected
|
|
60
|
+
* before any directory is removed.
|
|
60
61
|
*
|
|
61
62
|
* @returns Cache directories that were removed.
|
|
62
63
|
*/
|
|
@@ -107,10 +108,10 @@ export declare class TtscCompiler {
|
|
|
107
108
|
* The effective environment for this instance's source-plugin builds and
|
|
108
109
|
* clean targets: `context.env` merged over `process.env`, matching the
|
|
109
110
|
* documented {@link ITtscCompilerContext.env} contract that child compiler,
|
|
110
|
-
* native-plugin,
|
|
111
|
-
* fresh object so callers never mutate the shared
|
|
112
|
-
* `context.env` was supplied this is a plain copy of
|
|
113
|
-
* default behavior is unchanged.
|
|
111
|
+
* native-plugin, native-host, and isolated descriptor processes already
|
|
112
|
+
* receive. Returned as a fresh object so callers never mutate the shared
|
|
113
|
+
* `process.env`; when no `context.env` was supplied this is a plain copy of
|
|
114
|
+
* `process.env`, so CLI / default behavior is unchanged.
|
|
114
115
|
*/
|
|
115
116
|
private resolveEffectiveEnv;
|
|
116
117
|
}
|
package/lib/TtscCompiler.js
CHANGED
|
@@ -11,7 +11,7 @@ const resolveProjectConfig_1 = require("./compiler/internal/project/resolveProje
|
|
|
11
11
|
const resolveBinary_1 = require("./compiler/internal/resolveBinary");
|
|
12
12
|
const runBuild_1 = require("./compiler/internal/runBuild");
|
|
13
13
|
const transformProjectInMemory_1 = require("./compiler/internal/transformProjectInMemory");
|
|
14
|
-
const
|
|
14
|
+
const resolveSafeCacheCleanupTargets_1 = require("./internal/resolveSafeCacheCleanupTargets");
|
|
15
15
|
const buildSourcePlugin_1 = require("./plugin/internal/buildSourcePlugin");
|
|
16
16
|
const loadProjectPlugins_1 = require("./plugin/internal/loadProjectPlugins");
|
|
17
17
|
/**
|
|
@@ -82,15 +82,16 @@ class TtscCompiler {
|
|
|
82
82
|
/**
|
|
83
83
|
* Remove compiled cache artifacts for this compiler instance.
|
|
84
84
|
*
|
|
85
|
-
* Removes
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* project-local caches. A user-provided `GOCACHE` is never removed.
|
|
85
|
+
* Removes an explicit `cacheDir` wholesale. Otherwise removes the plugin
|
|
86
|
+
* binary subdirectory, a safely identified ttsc-owned Go build cache
|
|
87
|
+
* (including an external `TTSC_GO_CACHE_DIR`), and the two legacy
|
|
88
|
+
* project-local caches. A user-provided `GOCACHE` is never removed. Every
|
|
89
|
+
* resolved deletion target is validated before the first removal. The cache
|
|
89
90
|
* location comes from this instance's `cacheDir` and environment
|
|
90
91
|
* (`TTSC_CACHE_DIR` / `TTSC_GO_CACHE_DIR`), defaulting to
|
|
91
|
-
* `<workspaceRoot>/node_modules/.cache/ttsc`.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* `<workspaceRoot>/node_modules/.cache/ttsc`. Any resolved cache target that
|
|
93
|
+
* equals or contains the project, or names a filesystem root, is rejected
|
|
94
|
+
* before any directory is removed.
|
|
94
95
|
*
|
|
95
96
|
* @returns Cache directories that were removed.
|
|
96
97
|
*/
|
|
@@ -101,25 +102,32 @@ class TtscCompiler {
|
|
|
101
102
|
node_path_1.default.join(projectRoot, ".ttsc"),
|
|
102
103
|
];
|
|
103
104
|
const explicitCacheDir = this.resolveCacheDir();
|
|
105
|
+
let targets;
|
|
104
106
|
if (explicitCacheDir !== undefined) {
|
|
105
|
-
(0, assertSafeExplicitCacheDirectory_1.assertSafeExplicitCacheDirectory)(projectRoot, explicitCacheDir);
|
|
106
107
|
// An explicit constructor `cacheDir` names the cache directory for this
|
|
107
108
|
// instance — exactly like `ttsc clean --cache-dir X` on the CLI — so
|
|
108
109
|
// remove it wholesale plus the legacy project-local caches. This keeps
|
|
109
110
|
// the programmatic and CLI clean contracts identical for an explicit
|
|
110
111
|
// cache dir.
|
|
111
|
-
|
|
112
|
+
targets = [explicitCacheDir, ...legacyTargets];
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
else {
|
|
115
|
+
// Default / `context.env.TTSC_CACHE_DIR`: resolve the cache root and the Go
|
|
116
|
+
// build cache (`TTSC_GO_CACHE_DIR`) from this instance's effective
|
|
117
|
+
// environment — the same `{ ...process.env, ...context.env }` that
|
|
118
|
+
// prepare()/compile()/transform() build with — then remove only the
|
|
119
|
+
// ttsc-owned subdirectories, so a possibly-shared root is never deleted and
|
|
120
|
+
// a user-provided `GOCACHE` is never touched. Using the effective env (not
|
|
121
|
+
// ambient `process.env`) makes clean() remove exactly the artifacts this
|
|
122
|
+
// instance owns, including a `TTSC_GO_CACHE_DIR` supplied only in
|
|
123
|
+
// `context.env`.
|
|
124
|
+
targets = (0, buildSourcePlugin_1.resolveCleanTargets)(projectRoot, this.resolvePluginCacheDir(), this.resolveEffectiveEnv());
|
|
125
|
+
}
|
|
126
|
+
// Validate the complete deletion set before removing the first directory.
|
|
127
|
+
// This includes an environment-selected TTSC_GO_CACHE_DIR and project-local
|
|
128
|
+
// legacy locations, not only an explicit constructor cacheDir.
|
|
129
|
+
const safeTargets = (0, resolveSafeCacheCleanupTargets_1.resolveSafeCacheCleanupTargets)(projectRoot, targets);
|
|
130
|
+
return removeExistingDirectories(safeTargets);
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* Compile the configured project.
|
|
@@ -210,10 +218,10 @@ class TtscCompiler {
|
|
|
210
218
|
* The effective environment for this instance's source-plugin builds and
|
|
211
219
|
* clean targets: `context.env` merged over `process.env`, matching the
|
|
212
220
|
* documented {@link ITtscCompilerContext.env} contract that child compiler,
|
|
213
|
-
* native-plugin,
|
|
214
|
-
* fresh object so callers never mutate the shared
|
|
215
|
-
* `context.env` was supplied this is a plain copy of
|
|
216
|
-
* default behavior is unchanged.
|
|
221
|
+
* native-plugin, native-host, and isolated descriptor processes already
|
|
222
|
+
* receive. Returned as a fresh object so callers never mutate the shared
|
|
223
|
+
* `process.env`; when no `context.env` was supplied this is a plain copy of
|
|
224
|
+
* `process.env`, so CLI / default behavior is unchanged.
|
|
217
225
|
*/
|
|
218
226
|
resolveEffectiveEnv() {
|
|
219
227
|
return { ...process.env, ...this.context.env };
|
|
@@ -222,12 +230,16 @@ class TtscCompiler {
|
|
|
222
230
|
exports.TtscCompiler = TtscCompiler;
|
|
223
231
|
function removeExistingDirectories(directories) {
|
|
224
232
|
const removed = [];
|
|
225
|
-
|
|
226
|
-
|
|
233
|
+
const visited = new Set();
|
|
234
|
+
for (const directory of directories) {
|
|
235
|
+
if (visited.has(directory.path))
|
|
236
|
+
continue;
|
|
237
|
+
visited.add(directory.path);
|
|
238
|
+
if (!directory.exists || !node_fs_1.default.existsSync(directory.path)) {
|
|
227
239
|
continue;
|
|
228
240
|
}
|
|
229
|
-
node_fs_1.default.rmSync(directory, { recursive: true, force: true });
|
|
230
|
-
removed.push(directory);
|
|
241
|
+
node_fs_1.default.rmSync(directory.path, { recursive: true, force: true });
|
|
242
|
+
removed.push(directory.requestedPath);
|
|
231
243
|
}
|
|
232
244
|
return removed;
|
|
233
245
|
}
|
|
@@ -324,11 +336,14 @@ function toCompilerResult(project) {
|
|
|
324
336
|
};
|
|
325
337
|
}
|
|
326
338
|
function toCompilerTransformation(project) {
|
|
327
|
-
const { dependencies, dependenciesComplete, graph, result, typescript, volatile, } = project;
|
|
339
|
+
const { dependencies, dependenciesComplete, graph, hostInputHashes, hostInputRealpaths, hostInputs, result, typescript, volatile, } = project;
|
|
328
340
|
const advisoryFields = {
|
|
329
341
|
...(dependencies === undefined ? {} : { dependencies }),
|
|
330
342
|
...(dependenciesComplete === undefined ? {} : { dependenciesComplete }),
|
|
331
343
|
...(graph === undefined ? {} : { graph }),
|
|
344
|
+
...(hostInputHashes === undefined ? {} : { hostInputHashes }),
|
|
345
|
+
...(hostInputRealpaths === undefined ? {} : { hostInputRealpaths }),
|
|
346
|
+
...(hostInputs === undefined ? {} : { hostInputs }),
|
|
332
347
|
...(volatile === undefined ? {} : { volatile }),
|
|
333
348
|
};
|
|
334
349
|
if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
|
package/lib/TtscCompiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2DAAuE;AACvE,2FAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2DAAuE;AACvE,2FAAwF;AACxF,8FAGmD;AACnD,2EAA0E;AAC1E,6EAA0E;AAO1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IACmB,OAAO,CAAuB;IAE/C;;;;;;OAMG;IACH,YAAmB,OAAO,GAAyB,EAAE;QACnD,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,OAAO;YACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS;YACjD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;gBACrC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;gBACtB,CAAC,CAAC,OAAO,CAAC,OAAO;SACpB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,OAAO;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,IAAA,uCAAkB,EAAC;YAChC,MAAM,EAAE,IAAA,6BAAa,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE;YACnD,QAAQ,EAAE,IAAI,CAAC,qBAAqB,EAAE;YACtC,GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7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AAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.captureProcessOutput = captureProcessOutput;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
10
10
|
/**
|
|
11
11
|
* A pair of temporary files standing in for a child process's pipes.
|
|
12
12
|
*
|
|
@@ -25,7 +25,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
25
25
|
* bytes.
|
|
26
26
|
*/
|
|
27
27
|
function captureProcessOutput() {
|
|
28
|
-
const directory =
|
|
28
|
+
const directory = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsc-spawn-");
|
|
29
29
|
const stdoutPath = node_path_1.default.join(directory, "stdout");
|
|
30
30
|
const stderrPath = node_path_1.default.join(directory, "stderr");
|
|
31
31
|
const stdoutFd = node_fs_1.default.openSync(stdoutPath, "w+");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"captureProcessOutput.js","sourceRoot":"","sources":["../../../src/compiler/internal/captureProcessOutput.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB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qEAAqE;gBACrE,kDAAkD;gBAClD,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;YACD,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC;QACxE,CAAC;QACD,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,SAAS,YAAY,CAAC,EAAU;IAC9B,IAAI,CAAC;QACH,iBAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;IACvE,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,SAAiB;IACtC,IAAI,CAAC;QACH,iBAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.compileProjectInMemory = compileProjectInMemory;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
10
10
|
const loadProjectPlugins_1 = require("../../plugin/internal/loadProjectPlugins");
|
|
11
11
|
const buildNativeCompiler_1 = require("./buildNativeCompiler");
|
|
12
12
|
const paths_1 = require("./paths");
|
|
13
13
|
const readProjectConfig_1 = require("./project/readProjectConfig");
|
|
14
14
|
const runBuild_1 = require("./runBuild");
|
|
15
|
+
const sharedHostHelpers_1 = require("./sharedHostHelpers");
|
|
15
16
|
const spawnNative_1 = require("./spawnNative");
|
|
16
17
|
/**
|
|
17
18
|
* Compile a project and capture emitted files without writing to the project
|
|
@@ -44,7 +45,7 @@ function compileProjectInMemory(options) {
|
|
|
44
45
|
});
|
|
45
46
|
const res = (0, spawnNative_1.spawnNative)(binary, ["api-compile", "--cwd", project.root, "--tsconfig", tsconfig], {
|
|
46
47
|
cwd: project.root,
|
|
47
|
-
env:
|
|
48
|
+
env: (0, sharedHostHelpers_1.inheritedSidecarEnv)(options.env),
|
|
48
49
|
});
|
|
49
50
|
if (res.error) {
|
|
50
51
|
throw new Error(`ttsc: failed to spawn native compiler host ${binary}: ${res.error.message}`);
|
|
@@ -82,7 +83,7 @@ function shouldUsePluginBuild(options, project) {
|
|
|
82
83
|
* read back every file the build wrote so they can be returned as strings.
|
|
83
84
|
*/
|
|
84
85
|
function compileProjectWithPlugins(options, cwd, project) {
|
|
85
|
-
const tempRoot =
|
|
86
|
+
const tempRoot = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsc-api-output-");
|
|
86
87
|
const tempOutDir = node_path_1.default.join(tempRoot, "out");
|
|
87
88
|
try {
|
|
88
89
|
const result = (0, runBuild_1.runBuild)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileProjectInMemory.js","sourceRoot":"","sources":["../../../src/compiler/internal/compileProjectInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"compileProjectInMemory.js","sourceRoot":"","sources":["../../../src/compiler/internal/compileProjectInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,8FAA2F;AAC3F,iFAAmF;AAKnF,+DAA4D;AAC5D,mCAAgE;AAChE,mEAAgE;AAChE,yCAAsC;AACtC,2DAA0D;AAC1D,+CAAwD;AAExD;;;;;;;;;;;;GAYG;AACH,gCAAuC,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AM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE;YACvB,+CAA+C,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { ITtscParsedProjectConfig } from "../../../structures/internal/ITtscParsedProjectConfig";
|
|
2
2
|
/** Serialize the retained project identity for a native sidecar invocation. */
|
|
3
3
|
export declare function createNativeProjectContextArgs(project: ITtscParsedProjectConfig, pluginConfigOrigin?: string): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The identity payload itself, for a caller that spawns a sidecar without going
|
|
6
|
+
* through the compiler's own argument list.
|
|
7
|
+
*
|
|
8
|
+
* Split from the flag so there is still exactly one place that decides what a
|
|
9
|
+
* sidecar is told about the project. A second caller assembling the same JSON,
|
|
10
|
+
* or slicing it back out of the flag, is how the two drift.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createNativeProjectContextJson(project: ITtscParsedProjectConfig, pluginConfigOrigin?: string): string;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNativeProjectContextArgs = createNativeProjectContextArgs;
|
|
4
|
+
exports.createNativeProjectContextJson = createNativeProjectContextJson;
|
|
4
5
|
/** Serialize the retained project identity for a native sidecar invocation. */
|
|
5
6
|
function createNativeProjectContextArgs(project, pluginConfigOrigin) {
|
|
6
7
|
return [
|
|
7
8
|
"--project-context-json=" +
|
|
8
|
-
|
|
9
|
-
...project.identity,
|
|
10
|
-
...(pluginConfigOrigin === undefined ? {} : { pluginConfigOrigin }),
|
|
11
|
-
}),
|
|
9
|
+
createNativeProjectContextJson(project, pluginConfigOrigin),
|
|
12
10
|
];
|
|
13
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The identity payload itself, for a caller that spawns a sidecar without going
|
|
14
|
+
* through the compiler's own argument list.
|
|
15
|
+
*
|
|
16
|
+
* Split from the flag so there is still exactly one place that decides what a
|
|
17
|
+
* sidecar is told about the project. A second caller assembling the same JSON,
|
|
18
|
+
* or slicing it back out of the flag, is how the two drift.
|
|
19
|
+
*/
|
|
20
|
+
function createNativeProjectContextJson(project, pluginConfigOrigin) {
|
|
21
|
+
return JSON.stringify({
|
|
22
|
+
...project.identity,
|
|
23
|
+
...(pluginConfigOrigin === undefined ? {} : { pluginConfigOrigin }),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
14
26
|
//# sourceMappingURL=createNativeProjectContextArgs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNativeProjectContextArgs.js","sourceRoot":"","sources":["../../../../src/compiler/internal/project/createNativeProjectContextArgs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createNativeProjectContextArgs.js","sourceRoot":"","sources":["../../../../src/compiler/internal/project/createNativeProjectContextArgs.ts"],"names":[],"mappings":";;;;AAEA,+EAA+E;AAC/E,wCACE,OAAiC,EACjC,kBAA2B;IAE3B,OAAO;QACL,yBAAyB;YACvB,8BAA8B,CAAC,OAAO,EAAE,kBAAkB,CAAC;KAC9D,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,wCACE,OAAiC,EACjC,kBAA2B;IAE3B,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,GAAG,OAAO,CAAC,QAAQ;QACnB,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC;KACpE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* Returns `null` when no matching output file is found on disk.
|
|
16
16
|
*/
|
|
17
17
|
export declare function resolveEmittedJavaScript(options: {
|
|
18
|
+
/** Skip trailing-stem recovery when exact source ownership is required. */
|
|
19
|
+
allowStemFallback?: boolean;
|
|
18
20
|
/** Pre-computed list of emitted paths; when absent `outDir` is scanned. */
|
|
19
21
|
emittedFiles?: readonly string[];
|
|
20
22
|
outDir: string;
|
|
@@ -36,6 +36,9 @@ function resolveEmittedJavaScript(options) {
|
|
|
36
36
|
return candidate;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
if (options.allowStemFallback === false) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
39
42
|
// Score the pre-computed emit list first (cheap). When it yields nothing —
|
|
40
43
|
// because the list is incomplete (a native transform host such as typia emits
|
|
41
44
|
// without printing the `--listEmittedFiles` lines) or because the emit landed
|