@ttsc/unplugin 0.34.0 → 0.34.2
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 -0
- package/lib/api.js +4 -0
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +2 -0
- package/lib/api.mjs.map +1 -1
- package/lib/core/bridge/TtscProjectRecord.d.cts +4 -1
- package/lib/core/bridge/TtscProjectRecord.d.mts +4 -1
- package/lib/core/bridge/TtscProjectRecord.d.ts +4 -1
- package/lib/core/bridge/projectRecordArgumentsMatch.d.cts +18 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.d.mts +18 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.d.ts +18 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.js +36 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.js.map +1 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.mjs +34 -0
- package/lib/core/bridge/projectRecordArgumentsMatch.mjs.map +1 -0
- package/lib/core/bridge/projectRecordMoved.d.cts +14 -12
- package/lib/core/bridge/projectRecordMoved.d.mts +14 -12
- package/lib/core/bridge/projectRecordMoved.d.ts +14 -12
- package/lib/core/bridge/projectRecordMoved.js +17 -12
- package/lib/core/bridge/projectRecordMoved.js.map +1 -1
- package/lib/core/bridge/projectRecordMoved.mjs +17 -12
- package/lib/core/bridge/projectRecordMoved.mjs.map +1 -1
- package/lib/core/bridge/readProjectRecordFile.d.cts +4 -3
- package/lib/core/bridge/readProjectRecordFile.d.mts +4 -3
- package/lib/core/bridge/readProjectRecordFile.d.ts +4 -3
- package/lib/core/bridge/readProjectRecordFile.js +26 -3
- package/lib/core/bridge/readProjectRecordFile.js.map +1 -1
- package/lib/core/bridge/readProjectRecordFile.mjs +26 -3
- package/lib/core/bridge/readProjectRecordFile.mjs.map +1 -1
- package/lib/core/bridge/refreshProjectRecordFile.d.cts +3 -2
- package/lib/core/bridge/refreshProjectRecordFile.d.mts +3 -2
- package/lib/core/bridge/refreshProjectRecordFile.d.ts +3 -2
- package/lib/core/bridge/refreshProjectRecordFile.js +9 -3
- package/lib/core/bridge/refreshProjectRecordFile.js.map +1 -1
- package/lib/core/bridge/refreshProjectRecordFile.mjs +9 -3
- package/lib/core/bridge/refreshProjectRecordFile.mjs.map +1 -1
- package/lib/core/bridge/refreshProjectRecordFiles.d.cts +1 -1
- package/lib/core/bridge/refreshProjectRecordFiles.d.mts +1 -1
- package/lib/core/bridge/refreshProjectRecordFiles.d.ts +1 -1
- package/lib/core/bridge/refreshProjectRecordFiles.js +2 -2
- package/lib/core/bridge/refreshProjectRecordFiles.js.map +1 -1
- package/lib/core/bridge/refreshProjectRecordFiles.mjs +2 -2
- package/lib/core/bridge/refreshProjectRecordFiles.mjs.map +1 -1
- package/lib/core/index.d.cts +2 -0
- package/lib/core/index.d.mts +2 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +2 -0
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/next/next.js +5 -2
- package/lib/core/next/next.js.map +1 -1
- package/lib/core/next/next.mjs +5 -2
- package/lib/core/next/next.mjs.map +1 -1
- package/lib/core/options/ResolvedTtscUnpluginOptions.d.cts +2 -0
- package/lib/core/options/ResolvedTtscUnpluginOptions.d.mts +2 -0
- package/lib/core/options/ResolvedTtscUnpluginOptions.d.ts +2 -0
- package/lib/core/options/TtscUnpluginOptions.d.cts +8 -0
- package/lib/core/options/TtscUnpluginOptions.d.mts +8 -0
- package/lib/core/options/TtscUnpluginOptions.d.ts +8 -0
- package/lib/core/options/resolveOptions.d.cts +4 -3
- package/lib/core/options/resolveOptions.d.mts +4 -3
- package/lib/core/options/resolveOptions.d.ts +4 -3
- package/lib/core/options/resolveOptions.js +5 -3
- package/lib/core/options/resolveOptions.js.map +1 -1
- package/lib/core/options/resolveOptions.mjs +5 -3
- package/lib/core/options/resolveOptions.mjs.map +1 -1
- package/lib/core/rollup/rollupDeliveryOptions.d.cts +6 -6
- package/lib/core/rollup/rollupDeliveryOptions.d.mts +6 -6
- package/lib/core/rollup/rollupDeliveryOptions.d.ts +6 -6
- package/lib/core/rollup/rollupDeliveryOptions.js +9 -6
- package/lib/core/rollup/rollupDeliveryOptions.js.map +1 -1
- package/lib/core/rollup/rollupDeliveryOptions.mjs +9 -6
- package/lib/core/rollup/rollupDeliveryOptions.mjs.map +1 -1
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.d.cts +10 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.d.mts +10 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.d.ts +10 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.js +13 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.js.map +1 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.mjs +11 -0
- package/lib/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.mjs.map +1 -0
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.cts +6 -0
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.mts +6 -0
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.ts +6 -0
- package/lib/core/transform/cache/createTransformCacheKey.d.cts +11 -8
- package/lib/core/transform/cache/createTransformCacheKey.d.mts +11 -8
- package/lib/core/transform/cache/createTransformCacheKey.d.ts +11 -8
- package/lib/core/transform/cache/createTransformCacheKey.js +11 -8
- package/lib/core/transform/cache/createTransformCacheKey.js.map +1 -1
- package/lib/core/transform/cache/createTransformCacheKey.mjs +11 -8
- package/lib/core/transform/cache/createTransformCacheKey.mjs.map +1 -1
- package/lib/core/transform/generation/TtscCompilerMembershipHint.d.cts +20 -0
- package/lib/core/transform/generation/TtscCompilerMembershipHint.d.mts +20 -0
- package/lib/core/transform/generation/TtscCompilerMembershipHint.d.ts +20 -0
- package/lib/core/transform/generation/applyCompilerMembership.d.cts +15 -0
- package/lib/core/transform/generation/applyCompilerMembership.d.mts +15 -0
- package/lib/core/transform/generation/applyCompilerMembership.d.ts +15 -0
- package/lib/core/transform/generation/applyCompilerMembership.js +41 -0
- package/lib/core/transform/generation/applyCompilerMembership.js.map +1 -0
- package/lib/core/transform/generation/applyCompilerMembership.mjs +39 -0
- package/lib/core/transform/generation/applyCompilerMembership.mjs.map +1 -0
- package/lib/core/transform/generation/captureTransformGeneration.d.cts +7 -0
- package/lib/core/transform/generation/captureTransformGeneration.d.mts +7 -0
- package/lib/core/transform/generation/captureTransformGeneration.d.ts +7 -0
- package/lib/core/transform/generation/captureTransformGeneration.js +20 -7
- package/lib/core/transform/generation/captureTransformGeneration.js.map +1 -1
- package/lib/core/transform/generation/captureTransformGeneration.mjs +20 -7
- package/lib/core/transform/generation/captureTransformGeneration.mjs.map +1 -1
- package/lib/core/transform/generation/onlyLearnedCompileFacts.d.cts +5 -5
- package/lib/core/transform/generation/onlyLearnedCompileFacts.d.mts +5 -5
- package/lib/core/transform/generation/onlyLearnedCompileFacts.d.ts +5 -5
- package/lib/core/transform/generation/onlyLearnedCompileFacts.js +7 -5
- package/lib/core/transform/generation/onlyLearnedCompileFacts.js.map +1 -1
- package/lib/core/transform/generation/onlyLearnedCompileFacts.mjs +7 -5
- package/lib/core/transform/generation/onlyLearnedCompileFacts.mjs.map +1 -1
- package/lib/core/transform/generation/primeCompilerMembership.d.cts +22 -0
- package/lib/core/transform/generation/primeCompilerMembership.d.mts +22 -0
- package/lib/core/transform/generation/primeCompilerMembership.d.ts +22 -0
- package/lib/core/transform/generation/primeCompilerMembership.js +32 -0
- package/lib/core/transform/generation/primeCompilerMembership.js.map +1 -0
- package/lib/core/transform/generation/primeCompilerMembership.mjs +30 -0
- package/lib/core/transform/generation/primeCompilerMembership.mjs.map +1 -0
- package/lib/core/transform/generation/selectReportedMembershipPolicy.d.cts +7 -7
- package/lib/core/transform/generation/selectReportedMembershipPolicy.d.mts +7 -7
- package/lib/core/transform/generation/selectReportedMembershipPolicy.d.ts +7 -7
- package/lib/core/transform/generation/selectReportedMembershipPolicy.js +43 -9
- package/lib/core/transform/generation/selectReportedMembershipPolicy.js.map +1 -1
- package/lib/core/transform/generation/selectReportedMembershipPolicy.mjs +43 -9
- package/lib/core/transform/generation/selectReportedMembershipPolicy.mjs.map +1 -1
- package/lib/core/transform/generation/transformProject.d.cts +7 -0
- package/lib/core/transform/generation/transformProject.d.mts +7 -0
- package/lib/core/transform/generation/transformProject.d.ts +7 -0
- package/lib/core/transform/generation/transformProject.js +3 -0
- package/lib/core/transform/generation/transformProject.js.map +1 -1
- package/lib/core/transform/generation/transformProject.mjs +3 -0
- package/lib/core/transform/generation/transformProject.mjs.map +1 -1
- package/lib/core/transform/project/isPossibleProgramFileName.d.cts +13 -11
- package/lib/core/transform/project/isPossibleProgramFileName.d.mts +13 -11
- package/lib/core/transform/project/isPossibleProgramFileName.d.ts +13 -11
- package/lib/core/transform/project/isPossibleProgramFileName.js +21 -13
- package/lib/core/transform/project/isPossibleProgramFileName.js.map +1 -1
- package/lib/core/transform/project/isPossibleProgramFileName.mjs +21 -13
- package/lib/core/transform/project/isPossibleProgramFileName.mjs.map +1 -1
- package/lib/core/transform/session/sharedCompileIdentity.d.cts +8 -5
- package/lib/core/transform/session/sharedCompileIdentity.d.mts +8 -5
- package/lib/core/transform/session/sharedCompileIdentity.d.ts +8 -5
- package/lib/core/transform/session/sharedCompileIdentity.js +8 -5
- package/lib/core/transform/session/sharedCompileIdentity.js.map +1 -1
- package/lib/core/transform/session/sharedCompileIdentity.mjs +8 -5
- package/lib/core/transform/session/sharedCompileIdentity.mjs.map +1 -1
- package/lib/core/transform/transformTtsc.js +18 -0
- package/lib/core/transform/transformTtsc.js.map +1 -1
- package/lib/core/transform/transformTtsc.mjs +18 -0
- package/lib/core/transform/transformTtsc.mjs.map +1 -1
- package/lib/core/transform/tsconfig/TtscCompilerArgumentsWitness.d.cts +19 -0
- package/lib/core/transform/tsconfig/TtscCompilerArgumentsWitness.d.mts +19 -0
- package/lib/core/transform/tsconfig/TtscCompilerArgumentsWitness.d.ts +19 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.d.cts +14 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.d.mts +14 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.d.ts +14 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.js +26 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.js.map +1 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.mjs +24 -0
- package/lib/core/transform/tsconfig/captureCompilerArguments.mjs.map +1 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.d.cts +13 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.d.mts +13 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.d.ts +13 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.js +23 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.js.map +1 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.mjs +21 -0
- package/lib/core/transform/tsconfig/compilerEnvironmentIdentity.mjs.map +1 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.d.cts +17 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.d.mts +17 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.d.ts +17 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.js +57 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.js.map +1 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.mjs +55 -0
- package/lib/core/transform/tsconfig/resolveCompilerEnvironment.mjs.map +1 -0
- package/lib/core/transform/tsconfig/transformScratchEnvironment.d.cts +6 -6
- package/lib/core/transform/tsconfig/transformScratchEnvironment.d.mts +6 -6
- package/lib/core/transform/tsconfig/transformScratchEnvironment.d.ts +6 -6
- package/lib/core/transform/tsconfig/transformScratchEnvironment.js +7 -7
- package/lib/core/transform/tsconfig/transformScratchEnvironment.js.map +1 -1
- package/lib/core/transform/tsconfig/transformScratchEnvironment.mjs +7 -7
- package/lib/core/transform/tsconfig/transformScratchEnvironment.mjs.map +1 -1
- package/lib/core/transform/watch/notifyProjectRecord.js +3 -0
- package/lib/core/transform/watch/notifyProjectRecord.js.map +1 -1
- package/lib/core/transform/watch/notifyProjectRecord.mjs +3 -0
- package/lib/core/transform/watch/notifyProjectRecord.mjs.map +1 -1
- package/lib/core/tsconfig/ITtscProjectMembershipPolicy.d.cts +14 -1
- package/lib/core/tsconfig/ITtscProjectMembershipPolicy.d.mts +14 -1
- package/lib/core/tsconfig/ITtscProjectMembershipPolicy.d.ts +14 -1
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.d.cts +4 -3
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.d.mts +4 -3
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.d.ts +4 -3
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.js +36 -6
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.js.map +1 -1
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.mjs +36 -6
- package/lib/core/tsconfig/mergeMembershipPolicyOverlay.mjs.map +1 -1
- package/lib/core/tsconfig/readProjectMembershipPolicy.d.cts +3 -2
- package/lib/core/tsconfig/readProjectMembershipPolicy.d.mts +3 -2
- package/lib/core/tsconfig/readProjectMembershipPolicy.d.ts +3 -2
- package/lib/core/tsconfig/readProjectMembershipPolicy.js +49 -15
- package/lib/core/tsconfig/readProjectMembershipPolicy.js.map +1 -1
- package/lib/core/tsconfig/readProjectMembershipPolicy.mjs +49 -15
- package/lib/core/tsconfig/readProjectMembershipPolicy.mjs.map +1 -1
- package/lib/core/tsconfig/resolveMembershipInputExtensions.d.cts +16 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.d.mts +16 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.d.ts +16 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.js +45 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.js.map +1 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.mjs +43 -0
- package/lib/core/tsconfig/resolveMembershipInputExtensions.mjs.map +1 -0
- package/lib/core/turbopack/turbopack.d.cts +2 -2
- package/lib/core/turbopack/turbopack.d.mts +2 -2
- package/lib/core/turbopack/turbopack.d.ts +2 -2
- package/lib/core/turbopack/turbopack.js +15 -7
- package/lib/core/turbopack/turbopack.js.map +1 -1
- package/lib/core/turbopack/turbopack.mjs +15 -7
- package/lib/core/turbopack/turbopack.mjs.map +1 -1
- package/lib/core/unplugin.js +21 -8
- package/lib/core/unplugin.js.map +1 -1
- package/lib/core/unplugin.mjs +21 -8
- package/lib/core/unplugin.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/bridge/TtscProjectRecord.ts +4 -1
- package/src/core/bridge/projectRecordArgumentsMatch.ts +37 -0
- package/src/core/bridge/projectRecordMoved.ts +17 -11
- package/src/core/bridge/readProjectRecordFile.ts +39 -3
- package/src/core/bridge/refreshProjectRecordFile.ts +9 -2
- package/src/core/bridge/refreshProjectRecordFiles.ts +7 -1
- package/src/core/index.ts +2 -0
- package/src/core/next/next.ts +18 -2
- package/src/core/options/ResolvedTtscUnpluginOptions.ts +3 -0
- package/src/core/options/TtscUnpluginOptions.ts +9 -0
- package/src/core/options/resolveOptions.ts +5 -3
- package/src/core/rollup/rollupDeliveryOptions.ts +9 -5
- package/src/core/transform/cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES.ts +14 -0
- package/src/core/transform/cache/TtscCachedProjectTransform.ts +7 -0
- package/src/core/transform/cache/createTransformCacheKey.ts +13 -8
- package/src/core/transform/generation/TtscCompilerMembershipHint.ts +24 -0
- package/src/core/transform/generation/applyCompilerMembership.ts +44 -0
- package/src/core/transform/generation/captureTransformGeneration.ts +43 -10
- package/src/core/transform/generation/onlyLearnedCompileFacts.ts +7 -5
- package/src/core/transform/generation/primeCompilerMembership.ts +39 -0
- package/src/core/transform/generation/selectReportedMembershipPolicy.ts +59 -13
- package/src/core/transform/generation/transformProject.ts +12 -0
- package/src/core/transform/project/isPossibleProgramFileName.ts +28 -15
- package/src/core/transform/session/sharedCompileIdentity.ts +10 -5
- package/src/core/transform/transformTtsc.ts +21 -0
- package/src/core/transform/tsconfig/TtscCompilerArgumentsWitness.ts +19 -0
- package/src/core/transform/tsconfig/captureCompilerArguments.ts +25 -0
- package/src/core/transform/tsconfig/compilerEnvironmentIdentity.ts +20 -0
- package/src/core/transform/tsconfig/resolveCompilerEnvironment.ts +61 -0
- package/src/core/transform/tsconfig/transformScratchEnvironment.ts +7 -6
- package/src/core/transform/watch/notifyProjectRecord.ts +3 -0
- package/src/core/tsconfig/ITtscProjectMembershipPolicy.ts +15 -1
- package/src/core/tsconfig/mergeMembershipPolicyOverlay.ts +31 -6
- package/src/core/tsconfig/readProjectMembershipPolicy.ts +61 -17
- package/src/core/tsconfig/resolveMembershipInputExtensions.ts +45 -0
- package/src/core/turbopack/turbopack.ts +27 -7
- package/src/core/unplugin.ts +34 -9
|
@@ -8,27 +8,29 @@ const LEARNED_FACTS = new Set([
|
|
|
8
8
|
// The compiler's case policy, first reported by this compile's envelope,
|
|
9
9
|
// which the walk before it did not match under (samchon/ttsc#1545).
|
|
10
10
|
"case-policy-learned",
|
|
11
|
+
// Effective suffix/output settings reported after provisional root discovery.
|
|
12
|
+
"membership-policy-learned",
|
|
11
13
|
]);
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Whether the retained, lossless failure aggregate names only facts learned
|
|
15
17
|
* after the attempt's pre-compile observation.
|
|
16
18
|
*
|
|
17
|
-
* The retry owner carries learned dependencies and compiler
|
|
18
|
-
* the next attempt, without spending its movement budget for this
|
|
19
|
+
* The retry owner carries learned dependencies and compiler membership policy
|
|
20
|
+
* into the next attempt, without spending its movement budget for this
|
|
19
21
|
* classification. This predicate classifies recorded failures, not independent
|
|
20
22
|
* disk stability; producers must record other failed proofs. An omitted witness
|
|
21
23
|
* could be anything, so it prevents that exemption. The retry owner separately
|
|
22
24
|
* enforces the absolute attempt cap and handles refuted adoptions.
|
|
23
25
|
*
|
|
24
26
|
* @param failures The attempt's recorded proof failures.
|
|
25
|
-
* @evidence contracts/common.md#principled-implementation A nonempty aggregate
|
|
27
|
+
* @evidence contracts/common.md#principled-implementation A nonempty lossless aggregate containing only dependency-unwitnessed, case-policy-learned or membership-policy-learned qualifies for the learned-fact exemption. Other recorded failures prevent it; this classification is not independent proof of project stability.
|
|
26
28
|
* @evidence contracts/common.md#clear-and-simple-design One predicate centralizes which proof classes consume the retry movement budget, leaving actual attempts and the absolute cap to transformProject.
|
|
27
29
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The recognized kinds express real compile facts learned after pre-witnessing, and no omitted or mixed failure is excused by a fixture-specific retry exception.
|
|
28
30
|
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain the missing-knowledge distinction, retry consequence and conservative dropped-witness rule, with params and acknowledgment separation.
|
|
29
31
|
* @evidence contracts/performance.md#efficient-algorithms Zero omissions and nonempty entries guard an every scan that stops at the first other kind. The recorder bounds normal retained count, while the supplied kind text still contributes to Set hashing/comparison. No per-call index or copied entry list is allocated.
|
|
30
|
-
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The fixed
|
|
31
|
-
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows the aggregate and reads a fixed private
|
|
32
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The fixed kind table is algorithm data, not cached computation. The retry owner carries learned observations.
|
|
33
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows the aggregate and reads a fixed private table without acquiring state or handles.
|
|
32
34
|
* @evidenceExclude contracts/portability.md#os-neutral-implementation Classifies failure kinds by a fixed set of strings; it reads no filesystem or path.
|
|
33
35
|
*/
|
|
34
36
|
export function onlyLearnedCompileFacts(
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ITtscProjectMembershipPolicy } from "../../tsconfig/ITtscProjectMembershipPolicy";
|
|
2
|
+
import { hashText } from "../utils/hashText";
|
|
3
|
+
import { stableStringify } from "../utils/stableStringify";
|
|
4
|
+
import type { TtscCompilerMembershipHint } from "./TtscCompilerMembershipHint";
|
|
5
|
+
import { applyCompilerMembership } from "./applyCompilerMembership";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Prime a walk with a native hint only while its JSON policy premise matches. A
|
|
9
|
+
* match predicts settings; current native reports and walk proofs remain
|
|
10
|
+
* required.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/common.md#principled-implementation Canonical JSON hashing compares the complete supplied config and overlay policy, including explicit option origins. A changed premise discards the previous projection before the pre-compile walk.
|
|
13
|
+
* @evidence contracts/common.md#clear-and-simple-design One operation returns both the premise identity for capture and the policy to walk; the projection helper retains native path semantics.
|
|
14
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Matching config semantics supplies no filesystem freshness claim and cannot certify a post-compile walk as pre-compile evidence.
|
|
15
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose and result members distinguish prediction identity from current generation proof.
|
|
16
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Policy paths are serialized as supplied and projected by their owning helper; this function performs no native observation or case rewriting.
|
|
17
|
+
* @evidence contracts/performance.md#efficient-algorithms Canonical serialization sorts record keys and visits policy bytes once before hashing; a matching hint additionally copies the suffix and exclusion population. Temporary storage follows policy size.
|
|
18
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only a hint learned under the same config policy can prime this walk; no work result, input witness or native authority is reused here.
|
|
19
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned identity and borrowed or projected policy transfer to the caller; this call retains no cache or resource.
|
|
20
|
+
*/
|
|
21
|
+
export function primeCompilerMembership(
|
|
22
|
+
policy: ITtscProjectMembershipPolicy,
|
|
23
|
+
hint?: TtscCompilerMembershipHint,
|
|
24
|
+
): {
|
|
25
|
+
/** Config-policy identity used to qualify a subsequently learned report. */
|
|
26
|
+
basis: string;
|
|
27
|
+
|
|
28
|
+
/** Fresh config policy, optionally projected by an equivalent prior hint. */
|
|
29
|
+
policy: ITtscProjectMembershipPolicy;
|
|
30
|
+
} {
|
|
31
|
+
const basis = hashText(stableStringify(policy));
|
|
32
|
+
return {
|
|
33
|
+
basis,
|
|
34
|
+
policy:
|
|
35
|
+
hint?.basis === basis
|
|
36
|
+
? applyCompilerMembership(policy, hint.report)
|
|
37
|
+
: policy,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import type { ITtscCompilerTransformation } from "ttsc";
|
|
2
3
|
|
|
3
4
|
import type { ITtscProjectMembershipPolicy } from "../../tsconfig/ITtscProjectMembershipPolicy";
|
|
5
|
+
import { applyCompilerMembership } from "./applyCompilerMembership";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
* Replace
|
|
8
|
+
* Replace provisional root settings and comparison rules with native reports.
|
|
7
9
|
*
|
|
8
10
|
* Capture supplies an explicit priming answer before walking. An exception or
|
|
9
|
-
* an envelope without
|
|
11
|
+
* an envelope without reports leaves that same policy intact. A differing
|
|
10
12
|
* report marks the old walk for refusal; this operation neither performs the
|
|
11
13
|
* walk nor establishes that a predicted answer matched the native compiler.
|
|
12
14
|
*
|
|
13
|
-
* @evidence contracts/common.md#principled-implementation
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation Native case, suffix and output settings replace provisional answers; set equality determines whether a fresh walk is needed. Missing reports preserve the original policy identity and explicit excludes retain authored provenance.
|
|
14
16
|
* @evidence contracts/common.md#clear-and-simple-design One report-selection operation returns the policy and changed-rule fact; capture retains ownership of enumeration authority and proof refusal.
|
|
15
17
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts No OS label or filesystem probe substitutes for a compiler report, and no report supplies missing walk evidence.
|
|
16
18
|
* @evidence contracts/common.md#meaningful-documentation Native prose states the explicit primer requirement, missing-report identity and changed-policy refusal boundary.
|
|
17
|
-
* @evidence contracts/portability.md#os-neutral-implementation
|
|
18
|
-
* @evidence contracts/performance.md#efficient-algorithms
|
|
19
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native path grammar resolves directory spelling; component-boundary prefixes map only observed project root aliases to a shared anchor. Insensitive reports permit ASCII case equivalence, while non-ASCII spellings stay conservatively distinct instead of colliding through full lowercasing or Windows path.relative.
|
|
20
|
+
* @evidence contracts/performance.md#efficient-algorithms Available settings copy extension/exclusion populations; Set comparisons visit their text. At most three observed anchors are resolved once and each exclusion compares their component-boundary prefixes. Temporary storage follows those populations and path lengths; no filesystem query runs here.
|
|
19
21
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Selects this envelope's reported rule without retaining a memo or certifying reuse of the primed walk.
|
|
20
22
|
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Borrows the primer or returns a shallow policy object; capture owns retained policy and observer lifetimes, with no handle or historical state acquired here.
|
|
21
23
|
*/
|
|
@@ -23,22 +25,66 @@ export function selectReportedMembershipPolicy(
|
|
|
23
25
|
primed: ITtscProjectMembershipPolicy & { useCaseSensitiveFileNames: boolean },
|
|
24
26
|
result: ITtscCompilerTransformation,
|
|
25
27
|
): {
|
|
26
|
-
/** Borrowed primer or
|
|
28
|
+
/** Borrowed primer or native settings overlay for this capture's validators. */
|
|
27
29
|
membershipPolicy: ITtscProjectMembershipPolicy;
|
|
28
30
|
|
|
29
31
|
/** Whether the primed walk used a different rule from this compiler report. */
|
|
30
|
-
|
|
32
|
+
membershipPolicyLearned: boolean;
|
|
31
33
|
} {
|
|
32
34
|
const reported =
|
|
33
35
|
result.type === "exception"
|
|
34
36
|
? undefined
|
|
35
37
|
: result.graph?.useCaseSensitiveFileNames;
|
|
38
|
+
const rootReport =
|
|
39
|
+
result.type === "exception" ? undefined : result.graph?.membership;
|
|
40
|
+
const policy = applyCompilerMembership(
|
|
41
|
+
reported === undefined
|
|
42
|
+
? primed
|
|
43
|
+
: { ...primed, useCaseSensitiveFileNames: reported },
|
|
44
|
+
rootReport,
|
|
45
|
+
);
|
|
46
|
+
// ASCII equivalence cannot introduce Unicode expansion collisions. Other
|
|
47
|
+
// spelling changes conservatively require a fresh walk under the report.
|
|
48
|
+
const asciiFold = (value: string): string =>
|
|
49
|
+
value.replace(/[A-Z]/g, (character) => character.toLowerCase());
|
|
50
|
+
const canonical = (value: string): string =>
|
|
51
|
+
policy.useCaseSensitiveFileNames === false ? asciiFold(value) : value;
|
|
52
|
+
const root = primed.rootFileSpecs?.root;
|
|
53
|
+
const anchors =
|
|
54
|
+
root === undefined
|
|
55
|
+
? []
|
|
56
|
+
: [root.path, root.realpath, root.nativepath]
|
|
57
|
+
.filter((anchor): anchor is string => anchor !== undefined)
|
|
58
|
+
.map((anchor) => canonical(path.resolve(anchor)));
|
|
59
|
+
const directoryKey = (directory: string): string => {
|
|
60
|
+
const target = canonical(path.resolve(directory));
|
|
61
|
+
for (const anchor of anchors) {
|
|
62
|
+
if (target === anchor) return "root:";
|
|
63
|
+
const prefix = anchor.endsWith(path.sep) ? anchor : anchor + path.sep;
|
|
64
|
+
if (target.startsWith(prefix))
|
|
65
|
+
return "root:" + target.slice(prefix.length);
|
|
66
|
+
}
|
|
67
|
+
return "absolute:" + target;
|
|
68
|
+
};
|
|
69
|
+
const sameSet = (
|
|
70
|
+
left: readonly string[],
|
|
71
|
+
right: readonly string[],
|
|
72
|
+
key: (value: string) => string,
|
|
73
|
+
): boolean => {
|
|
74
|
+
const a = new Set(left.map(key));
|
|
75
|
+
const b = new Set(right.map(key));
|
|
76
|
+
return a.size === b.size && [...a].every((entry) => b.has(entry));
|
|
77
|
+
};
|
|
36
78
|
return {
|
|
37
|
-
membershipPolicy:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
79
|
+
membershipPolicy: policy,
|
|
80
|
+
membershipPolicyLearned:
|
|
81
|
+
(reported !== undefined &&
|
|
82
|
+
reported !== primed.useCaseSensitiveFileNames) ||
|
|
83
|
+
!sameSet(primed.inputExtensions, policy.inputExtensions, asciiFold) ||
|
|
84
|
+
!sameSet(
|
|
85
|
+
primed.excludedDirectories,
|
|
86
|
+
policy.excludedDirectories,
|
|
87
|
+
directoryKey,
|
|
88
|
+
),
|
|
43
89
|
};
|
|
44
90
|
}
|
|
@@ -8,6 +8,7 @@ import type { TtscTransformFilesystemOperations } from "../filesystem/TtscTransf
|
|
|
8
8
|
import { TRANSFORM_ADOPTED_RESULTS } from "../session/TRANSFORM_ADOPTED_RESULTS";
|
|
9
9
|
import { TRANSFORM_FAILED_GENERATION_VALIDATIONS } from "./TRANSFORM_FAILED_GENERATION_VALIDATIONS";
|
|
10
10
|
import { TRANSFORM_GENERATION_FAILURES } from "./TRANSFORM_GENERATION_FAILURES";
|
|
11
|
+
import type { TtscCompilerMembershipHint } from "./TtscCompilerMembershipHint";
|
|
11
12
|
import type { TtscGenerationProofFailures } from "./TtscGenerationProofFailures";
|
|
12
13
|
import { captureTransformGeneration } from "./captureTransformGeneration";
|
|
13
14
|
import { carryTransformAttemptInputs } from "./carryTransformAttemptInputs";
|
|
@@ -91,6 +92,14 @@ export async function transformProject(props: {
|
|
|
91
92
|
/** Compiler-option overlay, preserving the underlying config semantics. */
|
|
92
93
|
compilerOptions: Record<string, unknown>;
|
|
93
94
|
|
|
95
|
+
/** Detached environment selected before this generation's cache lookup. */
|
|
96
|
+
compilerEnvironment?: NodeJS.ProcessEnv;
|
|
97
|
+
/** Explicit override retained with persisted invocation proof. */
|
|
98
|
+
runExternalCode?: boolean;
|
|
99
|
+
|
|
100
|
+
/** Previous native root policy; the new compiler report can refute it. */
|
|
101
|
+
compilerMembership?: TtscCompilerMembershipHint;
|
|
102
|
+
|
|
94
103
|
/** Native path of the module whose delivery initiated this capture. */
|
|
95
104
|
currentFile: string;
|
|
96
105
|
|
|
@@ -160,9 +169,11 @@ export async function transformProject(props: {
|
|
|
160
169
|
let moved = 0;
|
|
161
170
|
let witnessed = new Set(props.witnessedDependencies);
|
|
162
171
|
let useCaseSensitiveFileNames = props.useCaseSensitiveFileNames;
|
|
172
|
+
let compilerMembership = props.compilerMembership;
|
|
163
173
|
for (let attempt = 0; ; attempt += 1) {
|
|
164
174
|
const cached = await captureTransformGeneration({
|
|
165
175
|
...props,
|
|
176
|
+
compilerMembership,
|
|
166
177
|
rejected,
|
|
167
178
|
useCaseSensitiveFileNames,
|
|
168
179
|
witnessedDependencies: [...witnessed],
|
|
@@ -222,6 +233,7 @@ export async function transformProject(props: {
|
|
|
222
233
|
);
|
|
223
234
|
witnessed = nextInputs.witnessed;
|
|
224
235
|
useCaseSensitiveFileNames = nextInputs.useCaseSensitiveFileNames;
|
|
236
|
+
compilerMembership = cached.compilerMembership;
|
|
225
237
|
// A publication refuted here would be found again by a retry for the same
|
|
226
238
|
// state, which therefore compiles and replaces it. A retry whose project
|
|
227
239
|
// moved to another state claims that state's publication, and adopts it:
|
|
@@ -3,27 +3,40 @@ import type { ITtscProjectMembershipPolicy } from "../../tsconfig/ITtscProjectMe
|
|
|
3
3
|
/**
|
|
4
4
|
* Whether a bare filename has an extension admitted by the project policy.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Literal expressions preserve Unicode simple case folding without expanding or
|
|
7
|
+
* contextually lowercasing either operand. This remains conservative root
|
|
8
|
+
* eligibility, independently of filesystem identity or compiler enumeration.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation Escaped literal suffixes use Unicode simple folding and a strict end boundary; this preserves dotted I and contextual sigma without treating mapper punctuation as regex grammar.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One weakly owned expression list per immutable policy serves an early-terminating suffix scan without filesystem work.
|
|
8
12
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The predicate uses compiler-derived extension policy rather than selected test filenames or bundler output-directory exceptions.
|
|
9
13
|
* @evidence contracts/common.md#meaningful-documentation The native comment states the bare-name input and policy boundary, avoiding an ambiguous reference to another helper's question.
|
|
10
|
-
* @evidenceExclude contracts/portability.md#os-neutral-implementation Compares
|
|
14
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Compares basename text using literal Unicode suffixes; it reads no filesystem or OS-name policy.
|
|
11
15
|
* @evidence contracts/performance.md#efficient-algorithms
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* suffix
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
17
|
-
*
|
|
18
|
-
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
|
|
19
|
-
* Acquires no handle, timer or retained state of its own.
|
|
16
|
+
* A cold policy compiles its suffix text once. Queries scan the supplied
|
|
17
|
+
* expressions until a match, with literal search work following filename
|
|
18
|
+
* length and suffix text; no authored wildcard or repeated pattern activates
|
|
19
|
+
* backtracking partitions. Retained expression text follows the suffix list.
|
|
20
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Compiled literal expressions are shared only by the same immutable policy identity; changing its suffix list requires a new policy, as other membership matchers require.
|
|
21
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The WeakMap retains expressions while their policy remains reachable and does not pin discarded policies; there are no filename histories, handles or timers.
|
|
20
22
|
*/
|
|
21
23
|
export function isPossibleProgramFileName(
|
|
22
24
|
name: string,
|
|
23
25
|
policy: ITtscProjectMembershipPolicy,
|
|
24
26
|
): boolean {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
let patterns = compiled.get(policy);
|
|
28
|
+
if (patterns === undefined) {
|
|
29
|
+
patterns = policy.inputExtensions.map(
|
|
30
|
+
(extension) =>
|
|
31
|
+
new RegExp(
|
|
32
|
+
`${extension.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&")}(?![\\s\\S])`,
|
|
33
|
+
"iu",
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
compiled.set(policy, patterns);
|
|
37
|
+
}
|
|
38
|
+
return patterns.some((pattern) => pattern.test(name));
|
|
29
39
|
}
|
|
40
|
+
|
|
41
|
+
/** Literal suffix expressions owned weakly by immutable membership policy. */
|
|
42
|
+
const compiled = new WeakMap<ITtscProjectMembershipPolicy, readonly RegExp[]>();
|
|
@@ -2,6 +2,7 @@ import crypto from "node:crypto";
|
|
|
2
2
|
import { pluginBuildVersions } from "ttsc/plugin-source";
|
|
3
3
|
|
|
4
4
|
import type { ResolvedTtscUnpluginOptions } from "../../options/ResolvedTtscUnpluginOptions";
|
|
5
|
+
import { compilerEnvironmentIdentity } from "../tsconfig/compilerEnvironmentIdentity";
|
|
5
6
|
import { unpluginVersion } from "./unpluginVersion";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -10,11 +11,12 @@ import { unpluginVersion } from "./unpluginVersion";
|
|
|
10
11
|
*
|
|
11
12
|
* The ordered JSON tuple groups sharing candidates by spelled config and source
|
|
12
13
|
* root, serialized compiler-option/alias/plugin payloads, reported versions and
|
|
13
|
-
* binary platform
|
|
14
|
-
*
|
|
15
|
-
* dimensions. This is a truncated
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* binary platform and effective compiler argument transport. Supported option
|
|
15
|
+
* values must preserve their meaning through JSON; omitted or unsupported
|
|
16
|
+
* JavaScript values are not independent key dimensions. This is a truncated
|
|
17
|
+
* digest, not a complete filesystem or output equivalence proof. Claim
|
|
18
|
+
* publication and adoption separately establish the recorded input/stability
|
|
19
|
+
* premises for a reused compile.
|
|
18
20
|
*
|
|
19
21
|
* A compile is kept beyond the process that published it, so a dev server
|
|
20
22
|
* started again adopts what the last one compiled (samchon/ttsc#1483). The
|
|
@@ -41,6 +43,8 @@ import { unpluginVersion } from "./unpluginVersion";
|
|
|
41
43
|
export function sharedCompileIdentity(props: {
|
|
42
44
|
aliasPaths: Record<string, string[]>;
|
|
43
45
|
compilerOptions: Record<string, unknown>;
|
|
46
|
+
/** Effective compiler arguments and their original working directory. */
|
|
47
|
+
compilerEnvironment?: NodeJS.ProcessEnv;
|
|
44
48
|
plugins?: ResolvedTtscUnpluginOptions["plugins"];
|
|
45
49
|
projectRoot: string;
|
|
46
50
|
tsconfig: string;
|
|
@@ -52,6 +56,7 @@ export function sharedCompileIdentity(props: {
|
|
|
52
56
|
props.tsconfig,
|
|
53
57
|
props.projectRoot,
|
|
54
58
|
props.compilerOptions,
|
|
59
|
+
compilerEnvironmentIdentity(props.compilerEnvironment),
|
|
55
60
|
props.aliasPaths,
|
|
56
61
|
props.plugins ?? null,
|
|
57
62
|
pluginBuildVersions(props.projectRoot),
|
|
@@ -7,6 +7,7 @@ import { createAliasPaths } from "./alias/createAliasPaths";
|
|
|
7
7
|
import { TERMINAL_TRANSFORM_GENERATIONS } from "./cache/TERMINAL_TRANSFORM_GENERATIONS";
|
|
8
8
|
import { TRANSFORM_CACHE_CASE_POLICIES } from "./cache/TRANSFORM_CACHE_CASE_POLICIES";
|
|
9
9
|
import { TRANSFORM_CACHE_DEPENDENCY_WITNESSES } from "./cache/TRANSFORM_CACHE_DEPENDENCY_WITNESSES";
|
|
10
|
+
import { TRANSFORM_CACHE_MEMBERSHIP_POLICIES } from "./cache/TRANSFORM_CACHE_MEMBERSHIP_POLICIES";
|
|
10
11
|
import { TRANSFORM_RESULT_FILESYSTEM } from "./cache/TRANSFORM_RESULT_FILESYSTEM";
|
|
11
12
|
import type { TtscTransformCache } from "./cache/TtscTransformCache";
|
|
12
13
|
import { awaitOrEvict } from "./cache/awaitOrEvict";
|
|
@@ -24,6 +25,7 @@ import { transformProject } from "./generation/transformProject";
|
|
|
24
25
|
import { preparePluginBuildEnvironments } from "./inputs/preparePluginBuildEnvironments";
|
|
25
26
|
import { TRANSFORM_CACHE_SESSIONS } from "./session/TRANSFORM_CACHE_SESSIONS";
|
|
26
27
|
import { settleProjectMutationEvents } from "./tracker/settleProjectMutationEvents";
|
|
28
|
+
import { resolveCompilerEnvironment } from "./tsconfig/resolveCompilerEnvironment";
|
|
27
29
|
import { resolveProjectSelection } from "./tsconfig/resolveProjectSelection";
|
|
28
30
|
import { isDeclarationFile } from "./utils/isDeclarationFile";
|
|
29
31
|
import { isHostWrapperQuery } from "./utils/isHostWrapperQuery";
|
|
@@ -162,8 +164,12 @@ async function runTransformTtsc(
|
|
|
162
164
|
),
|
|
163
165
|
);
|
|
164
166
|
}
|
|
167
|
+
const compilerEnvironment = resolveCompilerEnvironment(
|
|
168
|
+
options.runExternalCode,
|
|
169
|
+
);
|
|
165
170
|
const key = createTransformCacheKey({
|
|
166
171
|
aliasPaths,
|
|
172
|
+
compilerEnvironment,
|
|
167
173
|
compilerOptions: options.compilerOptions,
|
|
168
174
|
plugins: options.plugins,
|
|
169
175
|
projectRoot: selectedProjectRoot,
|
|
@@ -294,6 +300,12 @@ async function runTransformTtsc(
|
|
|
294
300
|
transformed = transformProject({
|
|
295
301
|
aliasPaths,
|
|
296
302
|
compilerOptions: options.compilerOptions,
|
|
303
|
+
compilerEnvironment,
|
|
304
|
+
runExternalCode: options.runExternalCode,
|
|
305
|
+
compilerMembership:
|
|
306
|
+
cache === undefined
|
|
307
|
+
? undefined
|
|
308
|
+
: TRANSFORM_CACHE_MEMBERSHIP_POLICIES.get(cache)?.get(key),
|
|
297
309
|
projectRoot: selectedProjectRoot,
|
|
298
310
|
currentFile: file,
|
|
299
311
|
currentSource: source,
|
|
@@ -354,6 +366,15 @@ async function runTransformTtsc(
|
|
|
354
366
|
TRANSFORM_CACHE_DEPENDENCY_WITNESSES.set(cache, witnesses);
|
|
355
367
|
}
|
|
356
368
|
witnesses.set(key, cached.externalDependencyInputs ?? []);
|
|
369
|
+
const membership = cached.compilerMembership;
|
|
370
|
+
if (membership !== undefined) {
|
|
371
|
+
let policies = TRANSFORM_CACHE_MEMBERSHIP_POLICIES.get(cache);
|
|
372
|
+
if (policies === undefined) {
|
|
373
|
+
policies = new Map();
|
|
374
|
+
TRANSFORM_CACHE_MEMBERSHIP_POLICIES.set(cache, policies);
|
|
375
|
+
}
|
|
376
|
+
policies.set(key, membership);
|
|
377
|
+
}
|
|
357
378
|
const reported = cached.membershipPolicy.useCaseSensitiveFileNames;
|
|
358
379
|
if (reported !== undefined) {
|
|
359
380
|
let policies = TRANSFORM_CACHE_CASE_POLICIES.get(cache);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Captured argument transport and the policy used to derive it from
|
|
3
|
+
* inheritance.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation The digest describes actual effective argv/cwd; the optional override lets detached readers derive the same invocation under current inheritance.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design Two scalar facts cross generation and persisted-record boundaries without retaining environment objects.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing witnesses remain unknown and cannot certify an older record's invocation.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes transport identity from the override policy needed for later comparison.
|
|
9
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The value carries an opaque digest and boolean; normalization belongs to its producer.
|
|
10
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This interface performs no computation.
|
|
11
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This interface establishes no reuse verdict.
|
|
12
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources This interface owns no runtime resource.
|
|
13
|
+
*/
|
|
14
|
+
export interface TtscCompilerArgumentsWitness {
|
|
15
|
+
/** SHA-256 of the normalized effective argv/cwd transport tuple. */
|
|
16
|
+
identity: string;
|
|
17
|
+
/** Explicit override; omission preserves inherited compiler arguments. */
|
|
18
|
+
runExternalCode?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { hashText } from "../utils/hashText";
|
|
2
|
+
import type { TtscCompilerArgumentsWitness } from "./TtscCompilerArgumentsWitness";
|
|
3
|
+
import { compilerEnvironmentIdentity } from "./compilerEnvironmentIdentity";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Fingerprint the exact normalized environment chosen for this invocation.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The digest uses supplied effective argv/cwd rather than rereading a later parent environment; the supplied override retains its inheritance meaning.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One compact witness travels with generations and persisted host records.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No compiler result or filesystem proof is inferred from argument identity.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states the normalized-snapshot premise and capture timing.
|
|
12
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The environment owner has already normalized native names; tuple spelling is preserved.
|
|
13
|
+
* @evidence contracts/performance.md#efficient-algorithms Tuple encoding scans argument/cwd text and SHA-256 scans the encoded bytes and retain only a fixed digest and optional boolean.
|
|
14
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This projection retains no previous result or in-flight operation.
|
|
15
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned scalar witness transfers to its caller without handles or history.
|
|
16
|
+
*/
|
|
17
|
+
export function captureCompilerArguments(
|
|
18
|
+
environment: NodeJS.ProcessEnv,
|
|
19
|
+
runExternalCode?: boolean,
|
|
20
|
+
): TtscCompilerArgumentsWitness {
|
|
21
|
+
return {
|
|
22
|
+
identity: hashText(compilerEnvironmentIdentity(environment)),
|
|
23
|
+
...(runExternalCode === undefined ? {} : { runExternalCode }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identify the argument transport in a normalized invocation snapshot.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation The ordered pair retains raw argv and cwd; absence differs from explicit empty argv.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design All cache owners use this transport projection, separate from capture.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No argument is dropped based on a consumer or expected output.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The headline states the normalized-snapshot premise and transport scope.
|
|
8
|
+
* @evidence contracts/portability.md#os-neutral-implementation resolveCompilerEnvironment normalizes native environment names; cwd spelling and JSON argv remain unchanged.
|
|
9
|
+
* @evidence contracts/performance.md#efficient-algorithms Serialization scans two transport strings and allocates their encoded bytes.
|
|
10
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This projection owns no cache or shared operation.
|
|
11
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Only the returned string escapes the call.
|
|
12
|
+
*/
|
|
13
|
+
export function compilerEnvironmentIdentity(
|
|
14
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
15
|
+
): string {
|
|
16
|
+
return JSON.stringify([
|
|
17
|
+
env.TTSC_TSGO_ARGS ?? null,
|
|
18
|
+
env.TTSC_TSGO_ARGS_CWD ?? null,
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture one invocation's environment and explicit content-mapper permission.
|
|
3
|
+
*
|
|
4
|
+
* Omission preserves inherited arguments. An explicit boolean appends its
|
|
5
|
+
* upstream assignment after inherited arguments, keeping their order and cwd.
|
|
6
|
+
* Invalid transport fails instead of discarding inherited choices.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation A detached environment and ordered JSON argv preserve inherited choices; an explicit boolean assignment has final precedence.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design Capture happens before cache selection; scratch routing derives a child copy afterward.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No process global or compiler behavior is replaced.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose documents omission, precedence, cwd and invalid transport.
|
|
12
|
+
* @evidence contracts/portability.md#os-neutral-implementation Windows environment names follow their native case-insensitive rule; POSIX names remain exact. JSON preserves argv without shell syntax.
|
|
13
|
+
* @evidence contracts/performance.md#efficient-algorithms Copying visits environment keys; Windows normalization scans them once, and an explicit permission parses and serializes argument bytes once.
|
|
14
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Every invocation observes current inherited values; cache owners compare its snapshot.
|
|
15
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The detached result transfers to its caller and acquires no handle or history.
|
|
16
|
+
*/
|
|
17
|
+
export function resolveCompilerEnvironment(
|
|
18
|
+
runExternalCode?: boolean,
|
|
19
|
+
inherited: NodeJS.ProcessEnv = process.env,
|
|
20
|
+
): NodeJS.ProcessEnv {
|
|
21
|
+
const env = { ...inherited };
|
|
22
|
+
if (process.platform === "win32") {
|
|
23
|
+
const selected = new Map<
|
|
24
|
+
string,
|
|
25
|
+
{ key: string; value: string | undefined }
|
|
26
|
+
>();
|
|
27
|
+
for (const key of Object.keys(env)) {
|
|
28
|
+
const name = key.toUpperCase();
|
|
29
|
+
if (name === "TTSC_TSGO_ARGS" || name === "TTSC_TSGO_ARGS_CWD") {
|
|
30
|
+
const prior = selected.get(name);
|
|
31
|
+
if (prior === undefined || key < prior.key)
|
|
32
|
+
selected.set(name, { key, value: env[key] });
|
|
33
|
+
delete env[key];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
for (const [name, value] of selected) env[name] = value.value;
|
|
37
|
+
}
|
|
38
|
+
// Own absent channels too: a later process.env edit must not become a new
|
|
39
|
+
// inherited argument between this cache lookup and the compiler spawn.
|
|
40
|
+
env.TTSC_TSGO_ARGS = env.TTSC_TSGO_ARGS;
|
|
41
|
+
env.TTSC_TSGO_ARGS_CWD = env.TTSC_TSGO_ARGS_CWD;
|
|
42
|
+
if (runExternalCode === undefined) return env;
|
|
43
|
+
if (typeof runExternalCode !== "boolean")
|
|
44
|
+
throw new TypeError("@ttsc/unplugin: runExternalCode must be a boolean");
|
|
45
|
+
// Go's environment transport trims Unicode White_Space, which excludes BOM.
|
|
46
|
+
const raw = env.TTSC_TSGO_ARGS?.replace(
|
|
47
|
+
/^\p{White_Space}+|\p{White_Space}+$/gu,
|
|
48
|
+
"",
|
|
49
|
+
);
|
|
50
|
+
const args: unknown = raw === undefined || raw === "" ? [] : JSON.parse(raw);
|
|
51
|
+
if (!Array.isArray(args) || args.some((value) => typeof value !== "string"))
|
|
52
|
+
throw new TypeError(
|
|
53
|
+
"@ttsc/unplugin: TTSC_TSGO_ARGS must be a JSON string array",
|
|
54
|
+
);
|
|
55
|
+
env.TTSC_TSGO_ARGS = JSON.stringify([
|
|
56
|
+
...args,
|
|
57
|
+
"--runExternalCode",
|
|
58
|
+
String(runExternalCode),
|
|
59
|
+
]);
|
|
60
|
+
return env;
|
|
61
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The environment a compile runs under:
|
|
3
|
-
* `TMPDIR` naming the compile's scratch directory. Consumers
|
|
4
|
-
* variables use that temporary root; explicit paths or
|
|
5
|
-
* environments are not confined by these settings.
|
|
2
|
+
* The environment a compile runs under: its captured snapshot, with `TEMP`,
|
|
3
|
+
* `TMP`, and `TMPDIR` naming the compile's scratch directory. Consumers
|
|
4
|
+
* honoring these variables use that temporary root; explicit paths or
|
|
5
|
+
* overridden child environments are not confined by these settings.
|
|
6
6
|
*
|
|
7
7
|
* Capture hands this copy to the compiler as `env` (samchon/ttsc#1488);
|
|
8
8
|
* applying it to workers and inherited child environments belongs to the
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @evidence contracts/common.md#meaningful-documentation The native paragraphs identify the child-process propagation boundary and explicitly distinguish it from changing the host environment.
|
|
16
16
|
* @evidence contracts/portability.md#os-neutral-implementation All three native temporary-directory variables receive the same owned directory, covering Windows and Unix child consumers without constructing shell syntax or mutating the host environment.
|
|
17
17
|
* @evidence contracts/performance.md#efficient-algorithms
|
|
18
|
-
* The spread enumerates K
|
|
18
|
+
* The spread enumerates K supplied environment keys/values into a fresh object
|
|
19
19
|
* before three assignments. Key/value text and native environment retrieval
|
|
20
20
|
* contribute costs; absence of an explicit loop is not constant work.
|
|
21
21
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
*/
|
|
27
27
|
export function transformScratchEnvironment(
|
|
28
28
|
directory: string,
|
|
29
|
+
inherited: NodeJS.ProcessEnv = process.env,
|
|
29
30
|
): NodeJS.ProcessEnv {
|
|
30
31
|
return {
|
|
31
|
-
...
|
|
32
|
+
...inherited,
|
|
32
33
|
TEMP: directory,
|
|
33
34
|
TMP: directory,
|
|
34
35
|
TMPDIR: directory,
|
|
@@ -227,6 +227,9 @@ function recordOf(
|
|
|
227
227
|
): TtscProjectRecord {
|
|
228
228
|
const dependencies = cached.externalDependencyInputs ?? [];
|
|
229
229
|
const record: TtscProjectRecord = {
|
|
230
|
+
...(cached.compilerArguments === undefined
|
|
231
|
+
? {}
|
|
232
|
+
: { compilerArguments: cached.compilerArguments }),
|
|
230
233
|
...(dependencies.length === 0 ? {} : { dependencies }),
|
|
231
234
|
inputs: {},
|
|
232
235
|
membership:
|
|
@@ -78,9 +78,23 @@ export interface ITtscProjectMembershipPolicy {
|
|
|
78
78
|
/** Absolute directory exclusions represented for project-root discovery. */
|
|
79
79
|
readonly excludedDirectories: readonly string[];
|
|
80
80
|
|
|
81
|
-
/**
|
|
81
|
+
/** Literal suffix spellings a file needs to be a possible program input. */
|
|
82
82
|
readonly inputExtensions: readonly string[];
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Explicit extension options before compiler defaults, plus declared mapper
|
|
86
|
+
* suffixes. Missing options use the pinned compiler's defaults. Optional for
|
|
87
|
+
* older policy producers, whose extension lists remain their own authority.
|
|
88
|
+
*/
|
|
89
|
+
readonly extensionOptionOrigins?: Readonly<{
|
|
90
|
+
allowJs?: boolean;
|
|
91
|
+
checkJs?: boolean;
|
|
92
|
+
resolveJsonModule?: boolean;
|
|
93
|
+
module?: string;
|
|
94
|
+
moduleResolution?: string;
|
|
95
|
+
mapperExtensions: readonly string[];
|
|
96
|
+
}>;
|
|
97
|
+
|
|
84
98
|
/**
|
|
85
99
|
* Every config file consulted to produce this policy, including inherited
|
|
86
100
|
* declarations and unresolved file candidates. A query can stop at its own
|