@ttsc/unplugin 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/bun/bun.d.cts +3 -2
- package/lib/core/bun/bun.d.mts +3 -2
- package/lib/core/bun/bun.d.ts +3 -2
- package/lib/core/bun/bun.js +8 -4
- package/lib/core/bun/bun.js.map +1 -1
- package/lib/core/bun/bun.mjs +8 -4
- package/lib/core/bun/bun.mjs.map +1 -1
- package/lib/core/observer/createInputObserver.js +6 -5
- package/lib/core/observer/createInputObserver.js.map +1 -1
- package/lib/core/observer/createInputObserver.mjs +6 -5
- package/lib/core/observer/createInputObserver.mjs.map +1 -1
- package/lib/core/observer/openIsolatedRecursiveWatch.d.cts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.d.mts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.d.ts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.js +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.js.map +1 -1
- package/lib/core/observer/openIsolatedRecursiveWatch.mjs +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.mjs.map +1 -1
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.cts +12 -3
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.mts +12 -3
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.ts +12 -3
- package/lib/core/transform/cache/selectCachedGenerationAction.d.cts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.d.mts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.d.ts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.js +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.js.map +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.mjs +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.mjs.map +1 -1
- package/lib/core/transform/deliverCachedTransform.d.cts +36 -0
- package/lib/core/transform/deliverCachedTransform.d.mts +36 -0
- package/lib/core/transform/deliverCachedTransform.d.ts +36 -0
- package/lib/core/transform/deliverCachedTransform.js +73 -0
- package/lib/core/transform/deliverCachedTransform.js.map +1 -0
- package/lib/core/transform/deliverCachedTransform.mjs +71 -0
- package/lib/core/transform/deliverCachedTransform.mjs.map +1 -0
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.cts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.mts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.ts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js +6 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js.map +1 -1
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs +6 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs.map +1 -1
- package/lib/core/transform/envelope/selectExternalInputPaths.d.cts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.d.mts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.d.ts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.js +8 -7
- package/lib/core/transform/envelope/selectExternalInputPaths.js.map +1 -1
- package/lib/core/transform/envelope/selectExternalInputPaths.mjs +8 -7
- package/lib/core/transform/envelope/selectExternalInputPaths.mjs.map +1 -1
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.cts +15 -12
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.mts +15 -12
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.ts +15 -12
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.cts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.mts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.ts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.js +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.js.map +1 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs.map +1 -1
- package/lib/core/transform/generation/transformProject.d.cts +9 -7
- package/lib/core/transform/generation/transformProject.d.mts +9 -7
- package/lib/core/transform/generation/transformProject.d.ts +9 -7
- package/lib/core/transform/generation/transformProject.js +14 -9
- package/lib/core/transform/generation/transformProject.js.map +1 -1
- package/lib/core/transform/generation/transformProject.mjs +14 -9
- package/lib/core/transform/generation/transformProject.mjs.map +1 -1
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.cts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.mts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.ts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.js +44 -7
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.js.map +1 -1
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs +44 -7
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/WatchBroker.d.cts +14 -4
- package/lib/core/transform/tracker/broker/WatchBroker.d.mts +14 -4
- package/lib/core/transform/tracker/broker/WatchBroker.d.ts +14 -4
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.cts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.mts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.ts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.js +89 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.js.map +1 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs +89 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs.map +1 -0
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.cts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.mts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.ts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.js +12 -13
- package/lib/core/transform/tracker/broker/drainWatchBroker.js.map +1 -1
- package/lib/core/transform/tracker/broker/drainWatchBroker.mjs +12 -13
- package/lib/core/transform/tracker/broker/drainWatchBroker.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/getWatchBroker.d.cts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.d.mts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.d.ts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.js +87 -17
- package/lib/core/transform/tracker/broker/getWatchBroker.js.map +1 -1
- package/lib/core/transform/tracker/broker/getWatchBroker.mjs +87 -17
- package/lib/core/transform/tracker/broker/getWatchBroker.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.cts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.mts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.ts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.js +11 -14
- package/lib/core/transform/tracker/broker/openBrokeredWatch.js.map +1 -1
- package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs +11 -14
- package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.cts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.mts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.ts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.js +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.mjs +7 -7
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.cts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.mts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.ts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.js +10 -11
- package/lib/core/transform/tracker/broker/watchBrokerSource.js.map +1 -1
- package/lib/core/transform/tracker/broker/watchBrokerSource.mjs +10 -11
- package/lib/core/transform/tracker/broker/watchBrokerSource.mjs.map +1 -1
- package/lib/core/transform/transformTtsc.d.cts +7 -4
- package/lib/core/transform/transformTtsc.d.mts +7 -4
- package/lib/core/transform/transformTtsc.d.ts +7 -4
- package/lib/core/transform/transformTtsc.js +37 -92
- package/lib/core/transform/transformTtsc.js.map +1 -1
- package/lib/core/transform/transformTtsc.mjs +37 -92
- package/lib/core/transform/transformTtsc.mjs.map +1 -1
- package/lib/core/transform/validation/TtscGenerationProof.d.cts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.d.mts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.d.ts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.js +149 -0
- package/lib/core/transform/validation/TtscGenerationProof.js.map +1 -0
- package/lib/core/transform/validation/TtscGenerationProof.mjs +149 -0
- package/lib/core/transform/validation/TtscGenerationProof.mjs.map +1 -0
- package/lib/core/transform/validation/matchesCachedSource.d.cts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.d.mts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.d.ts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.js +28 -22
- package/lib/core/transform/validation/matchesCachedSource.js.map +1 -1
- package/lib/core/transform/validation/matchesCachedSource.mjs +28 -22
- package/lib/core/transform/validation/matchesCachedSource.mjs.map +1 -1
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.cts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.mts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.ts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.js +4 -4
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.js.map +1 -1
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs +4 -4
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs.map +1 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.cts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.mts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.ts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.js +2 -2
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.js.map +1 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs +2 -2
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.cts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.mts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.ts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.js +5 -3
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.js.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs +5 -3
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.cts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.mts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.ts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.js +5 -5
- package/lib/core/transform/validation/matchesUniversalHostInputs.js.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputs.mjs +5 -5
- package/lib/core/transform/validation/matchesUniversalHostInputs.mjs.map +1 -1
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.cts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.mts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.ts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.js +31 -12
- package/lib/core/transform/validation/nativeInputPredicatesHold.js.map +1 -1
- package/lib/core/transform/validation/nativeInputPredicatesHold.mjs +31 -12
- package/lib/core/transform/validation/nativeInputPredicatesHold.mjs.map +1 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.cts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.mts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.ts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.js +2 -2
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.js.map +1 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs +2 -2
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs.map +1 -1
- package/lib/core/transform/watch/notifyWatchInputs.js +3 -0
- package/lib/core/transform/watch/notifyWatchInputs.js.map +1 -1
- package/lib/core/transform/watch/notifyWatchInputs.mjs +3 -0
- package/lib/core/transform/watch/notifyWatchInputs.mjs.map +1 -1
- package/lib/core/turbopack/turbopack.js +2 -1
- package/lib/core/turbopack/turbopack.js.map +1 -1
- package/lib/core/turbopack/turbopack.mjs +2 -1
- package/lib/core/turbopack/turbopack.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/bun/bun.ts +8 -4
- package/src/core/observer/createInputObserver.ts +6 -5
- package/src/core/observer/openIsolatedRecursiveWatch.ts +11 -12
- package/src/core/transform/cache/TtscCachedProjectTransform.ts +13 -3
- package/src/core/transform/cache/selectCachedGenerationAction.ts +9 -1
- package/src/core/transform/deliverCachedTransform.ts +97 -0
- package/src/core/transform/envelope/selectDeclaredProjectInputKeys.ts +5 -2
- package/src/core/transform/envelope/selectExternalInputPaths.ts +7 -7
- package/src/core/transform/filesystem/TtscTransformFilesystemOperations.ts +15 -12
- package/src/core/transform/generation/selectTransformAttemptDisposition.ts +3 -1
- package/src/core/transform/generation/transformProject.ts +13 -9
- package/src/core/transform/inputs/preparePluginBuildEnvironments.ts +41 -7
- package/src/core/transform/tracker/broker/WatchBroker.ts +15 -4
- package/src/core/transform/tracker/broker/WatchBrokerTransport.ts +82 -0
- package/src/core/transform/tracker/broker/drainWatchBroker.ts +12 -13
- package/src/core/transform/tracker/broker/getWatchBroker.ts +89 -18
- package/src/core/transform/tracker/broker/openBrokeredWatch.ts +11 -14
- package/src/core/transform/tracker/broker/usesWatchBroker.ts +7 -7
- package/src/core/transform/tracker/broker/watchBrokerSource.ts +10 -11
- package/src/core/transform/transformTtsc.ts +36 -92
- package/src/core/transform/validation/TtscGenerationProof.ts +201 -0
- package/src/core/transform/validation/matchesCachedSource.ts +27 -21
- package/src/core/transform/validation/matchesCompleteInputSnapshot.ts +5 -3
- package/src/core/transform/validation/matchesNarrowPersistentInputs.ts +3 -1
- package/src/core/transform/validation/matchesUniversalHostInputTrees.ts +6 -2
- package/src/core/transform/validation/matchesUniversalHostInputs.ts +6 -4
- package/src/core/transform/validation/nativeInputPredicatesHold.ts +36 -14
- package/src/core/transform/validation/notificationsProveProgramUnchanged.ts +3 -1
- package/src/core/transform/watch/notifyWatchInputs.ts +3 -0
- package/src/core/turbopack/turbopack.ts +2 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform.cjs";
|
|
2
|
+
import type { TtscTransformCache } from "../cache/TtscTransformCache.cjs";
|
|
3
|
+
import type { TtscTransformHooks } from "../watch/TtscTransformHooks.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* The shared ownership boundary for generation reuse in every adapter.
|
|
6
|
+
*
|
|
7
|
+
* WARNING (#1712, #1713): a module, a synchronous input-proof transaction, a
|
|
8
|
+
* delivery pass, and a persistent generation have different lifetimes. Keep
|
|
9
|
+
* those distinctions here. Do not add native preparation before every module,
|
|
10
|
+
* keep positive toolchain checks for a whole process, or make Bun's adapter
|
|
11
|
+
* invent its own cache policy. A proven pass shares its first deliveries;
|
|
12
|
+
* persistent/repeated deliveries require new current observations. Incomplete
|
|
13
|
+
* observations can share a coherent local result only inside an explicitly
|
|
14
|
+
* nonwatching pass with actual host-cache withdrawal, never a record or pool.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Explicit pass identity, source baseline and first-delivery membership delimit sharing; synchronous transactions independently qualify current native inputs and incomplete local outputs retain stricter lifecycle admission.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One core owner supplies the same preparation, pass and fresh-only policies to every adapter instead of separate host-specific caches.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observation never becomes complete snapshot authority; watching, persistent, repeated and unknown boundaries cannot borrow an incomplete pass result.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation Native context names the four lifetimes and warns against the specific performance and stale-cache regressions they prevent.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Members delegate native observations to the generation's filesystem and the native environment owner.
|
|
21
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms Members own baseline lookup, batch qualification and admission.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Members establish the distinct sharing boundaries.
|
|
23
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The namespace owns no registry; transactions and generations have explicit callers.
|
|
24
|
+
*/
|
|
25
|
+
export declare namespace TtscGenerationProof {
|
|
26
|
+
/**
|
|
27
|
+
* One synchronous admission after all asynchronous preparation has settled.
|
|
28
|
+
* Never retain this object in a generation or use it after an await.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation The exact cached owner prevents a proof of another result from supplying authority; optional native verdict is earned only by this synchronous transaction.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design One transaction carries environment observations and the shared native predicate verdict.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Absent environment or predicate proof remains absent, never implied success.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the no-await lifetime and members distinguish owner, environment and predicate authority.
|
|
34
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Native identity is retained by the referenced generation, not inferred by this carrier.
|
|
35
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This carrier executes no computation.
|
|
36
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The creating operation and validators own sharing decisions.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The synchronous caller owns this handle-free carrier.
|
|
38
|
+
*/
|
|
39
|
+
interface Transaction {
|
|
40
|
+
/** Exact generation being synchronously admitted. */
|
|
41
|
+
readonly cached: TtscCachedProjectTransform;
|
|
42
|
+
/** Current batch, absent when the pass already owns this input proof. */
|
|
43
|
+
readonly environments?: ReadonlyMap<string, string | undefined>;
|
|
44
|
+
/** Current native predicate verdict, unbuilt until its first gate. */
|
|
45
|
+
nativePredicates?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Prepare native authority only when this delivery needs a new input proof.
|
|
49
|
+
* The caller must create its synchronous transaction after awaiting this.
|
|
50
|
+
*
|
|
51
|
+
* @evidence contracts/common.md#principled-implementation A qualified first-delivery pass already owns environment proof; all other requests prepare actual authority before synchronous admission.
|
|
52
|
+
* @evidence contracts/common.md#clear-and-simple-design One branch delegates native preparation rather than repeating it in adapters.
|
|
53
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only the existing explicit pass contract permits skipping preparation; no watcher silence or process lifetime substitutes for it.
|
|
54
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states preparation versus transaction ordering.
|
|
55
|
+
* @evidence contracts/portability.md#os-neutral-implementation Preparation uses the actual generation filesystem and native toolchain reader.
|
|
56
|
+
* @evidence contracts/performance.md#efficient-algorithms Qualified first deliveries perform baseline/identity lookups; other deliveries delegate one preparation per unique plugin directory.
|
|
57
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The pass shares its existing first-delivery proof; persistent and repeated deliveries establish new native authority.
|
|
58
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Native requests belong to their environment owner; no transaction survives this await.
|
|
59
|
+
*/
|
|
60
|
+
function prepare(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Start fresh synchronous observation after notification and preparation
|
|
63
|
+
* awaits, sharing actual SDK queries and native predicate replay locally.
|
|
64
|
+
*
|
|
65
|
+
* @evidence contracts/common.md#principled-implementation Current environments are batch-qualified after asynchronous work; a qualified pass needs no redundant native environment observation.
|
|
66
|
+
* @evidence contracts/common.md#clear-and-simple-design One constructor binds observations to their exact generation.
|
|
67
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No current verdict is retained across deliveries or asynchronous boundaries.
|
|
68
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the mandatory ordering and synchronous lifetime.
|
|
69
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native observation remains with the environment witness owner and actual generation path identity.
|
|
70
|
+
* @evidence contracts/performance.md#efficient-algorithms Plugin selection is generation-indexed; one batch shares variable hashing and distinct SDK metadata queries.
|
|
71
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only the following synchronous validators borrow this batch; pass sharing uses its independent first-delivery contract.
|
|
72
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The caller releases the transaction at the end of synchronous admission; no registry or native handle is acquired.
|
|
73
|
+
*/
|
|
74
|
+
function create(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Transaction;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this module's first delivery belongs to this generation's proven
|
|
77
|
+
* pass. A missing source baseline cannot acquire this permission.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation Epoch equality, coherent snapshot or admitted local-pass state, a recorded source and an unserved identity are all required.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One predicate is shared by async preparation and synchronous source validation.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete ordinary generation or absent module baseline cannot earn pass reuse.
|
|
82
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the first-delivery and baseline restrictions.
|
|
83
|
+
* @evidence contracts/portability.md#os-neutral-implementation Baselines use the generation's actual identity and compiler project-key policy.
|
|
84
|
+
* @evidence contracts/performance.md#efficient-algorithms Baseline and served-set lookup avoid full input population traversal.
|
|
85
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only first deliveries in the same explicitly declared pass share its proof; repeated and later-pass requests do not.
|
|
86
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows generation state without retaining another owner.
|
|
87
|
+
*/
|
|
88
|
+
function sharesPass(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Admit and notify a fresh-only local delivery. A coherent pass-only success
|
|
91
|
+
* can keep its result inside this pass after releasing capture resources;
|
|
92
|
+
* every other fresh-only answer is detached before notifying the host.
|
|
93
|
+
* Callback failure always evicts the incomplete owner.
|
|
94
|
+
*
|
|
95
|
+
* @evidence contracts/common.md#principled-implementation Explicit nonwatching, consistent project lifecycle and cache-withdrawal capability are required on every successful incomplete delivery; retention additionally needs the compile's exact pass-only epoch.
|
|
96
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner handles initial and cached fresh-only admission, resource release and host notification.
|
|
97
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Incomplete output never acquires a persistent record or publication, and failed/unknown/watching capability cannot leave a reusable owner.
|
|
98
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish local pass retention, resource release and callback failure effects.
|
|
99
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This lifecycle operation delegates native resource release to the generation disposer.
|
|
100
|
+
* @evidence contracts/performance.md#efficient-algorithms Identity/epoch checks and one callback add no input scan; resource disposal visits the fixed tracker population.
|
|
101
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only coherent locally admitted output in its exact nonwatching pass survives; a later pass or repeated module must obtain another result.
|
|
102
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Capture resources are released even when local output is kept; rejection and callback failure detach the owning Promise, and the cache lifecycle bounds retained result lifetime.
|
|
103
|
+
*/
|
|
104
|
+
function admitFreshOnly(cached: TtscCachedProjectTransform, cache: TtscTransformCache | undefined, key: string, generation: Promise<TtscCachedProjectTransform>, epoch: number | undefined, hooks: TtscTransformHooks | undefined): void;
|
|
105
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform.mjs";
|
|
2
|
+
import type { TtscTransformCache } from "../cache/TtscTransformCache.mjs";
|
|
3
|
+
import type { TtscTransformHooks } from "../watch/TtscTransformHooks.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* The shared ownership boundary for generation reuse in every adapter.
|
|
6
|
+
*
|
|
7
|
+
* WARNING (#1712, #1713): a module, a synchronous input-proof transaction, a
|
|
8
|
+
* delivery pass, and a persistent generation have different lifetimes. Keep
|
|
9
|
+
* those distinctions here. Do not add native preparation before every module,
|
|
10
|
+
* keep positive toolchain checks for a whole process, or make Bun's adapter
|
|
11
|
+
* invent its own cache policy. A proven pass shares its first deliveries;
|
|
12
|
+
* persistent/repeated deliveries require new current observations. Incomplete
|
|
13
|
+
* observations can share a coherent local result only inside an explicitly
|
|
14
|
+
* nonwatching pass with actual host-cache withdrawal, never a record or pool.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Explicit pass identity, source baseline and first-delivery membership delimit sharing; synchronous transactions independently qualify current native inputs and incomplete local outputs retain stricter lifecycle admission.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One core owner supplies the same preparation, pass and fresh-only policies to every adapter instead of separate host-specific caches.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observation never becomes complete snapshot authority; watching, persistent, repeated and unknown boundaries cannot borrow an incomplete pass result.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation Native context names the four lifetimes and warns against the specific performance and stale-cache regressions they prevent.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Members delegate native observations to the generation's filesystem and the native environment owner.
|
|
21
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms Members own baseline lookup, batch qualification and admission.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Members establish the distinct sharing boundaries.
|
|
23
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The namespace owns no registry; transactions and generations have explicit callers.
|
|
24
|
+
*/
|
|
25
|
+
export declare namespace TtscGenerationProof {
|
|
26
|
+
/**
|
|
27
|
+
* One synchronous admission after all asynchronous preparation has settled.
|
|
28
|
+
* Never retain this object in a generation or use it after an await.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation The exact cached owner prevents a proof of another result from supplying authority; optional native verdict is earned only by this synchronous transaction.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design One transaction carries environment observations and the shared native predicate verdict.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Absent environment or predicate proof remains absent, never implied success.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the no-await lifetime and members distinguish owner, environment and predicate authority.
|
|
34
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Native identity is retained by the referenced generation, not inferred by this carrier.
|
|
35
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This carrier executes no computation.
|
|
36
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The creating operation and validators own sharing decisions.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The synchronous caller owns this handle-free carrier.
|
|
38
|
+
*/
|
|
39
|
+
interface Transaction {
|
|
40
|
+
/** Exact generation being synchronously admitted. */
|
|
41
|
+
readonly cached: TtscCachedProjectTransform;
|
|
42
|
+
/** Current batch, absent when the pass already owns this input proof. */
|
|
43
|
+
readonly environments?: ReadonlyMap<string, string | undefined>;
|
|
44
|
+
/** Current native predicate verdict, unbuilt until its first gate. */
|
|
45
|
+
nativePredicates?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Prepare native authority only when this delivery needs a new input proof.
|
|
49
|
+
* The caller must create its synchronous transaction after awaiting this.
|
|
50
|
+
*
|
|
51
|
+
* @evidence contracts/common.md#principled-implementation A qualified first-delivery pass already owns environment proof; all other requests prepare actual authority before synchronous admission.
|
|
52
|
+
* @evidence contracts/common.md#clear-and-simple-design One branch delegates native preparation rather than repeating it in adapters.
|
|
53
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only the existing explicit pass contract permits skipping preparation; no watcher silence or process lifetime substitutes for it.
|
|
54
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states preparation versus transaction ordering.
|
|
55
|
+
* @evidence contracts/portability.md#os-neutral-implementation Preparation uses the actual generation filesystem and native toolchain reader.
|
|
56
|
+
* @evidence contracts/performance.md#efficient-algorithms Qualified first deliveries perform baseline/identity lookups; other deliveries delegate one preparation per unique plugin directory.
|
|
57
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The pass shares its existing first-delivery proof; persistent and repeated deliveries establish new native authority.
|
|
58
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Native requests belong to their environment owner; no transaction survives this await.
|
|
59
|
+
*/
|
|
60
|
+
function prepare(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Start fresh synchronous observation after notification and preparation
|
|
63
|
+
* awaits, sharing actual SDK queries and native predicate replay locally.
|
|
64
|
+
*
|
|
65
|
+
* @evidence contracts/common.md#principled-implementation Current environments are batch-qualified after asynchronous work; a qualified pass needs no redundant native environment observation.
|
|
66
|
+
* @evidence contracts/common.md#clear-and-simple-design One constructor binds observations to their exact generation.
|
|
67
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No current verdict is retained across deliveries or asynchronous boundaries.
|
|
68
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the mandatory ordering and synchronous lifetime.
|
|
69
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native observation remains with the environment witness owner and actual generation path identity.
|
|
70
|
+
* @evidence contracts/performance.md#efficient-algorithms Plugin selection is generation-indexed; one batch shares variable hashing and distinct SDK metadata queries.
|
|
71
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only the following synchronous validators borrow this batch; pass sharing uses its independent first-delivery contract.
|
|
72
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The caller releases the transaction at the end of synchronous admission; no registry or native handle is acquired.
|
|
73
|
+
*/
|
|
74
|
+
function create(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Transaction;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this module's first delivery belongs to this generation's proven
|
|
77
|
+
* pass. A missing source baseline cannot acquire this permission.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation Epoch equality, coherent snapshot or admitted local-pass state, a recorded source and an unserved identity are all required.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One predicate is shared by async preparation and synchronous source validation.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete ordinary generation or absent module baseline cannot earn pass reuse.
|
|
82
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the first-delivery and baseline restrictions.
|
|
83
|
+
* @evidence contracts/portability.md#os-neutral-implementation Baselines use the generation's actual identity and compiler project-key policy.
|
|
84
|
+
* @evidence contracts/performance.md#efficient-algorithms Baseline and served-set lookup avoid full input population traversal.
|
|
85
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only first deliveries in the same explicitly declared pass share its proof; repeated and later-pass requests do not.
|
|
86
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows generation state without retaining another owner.
|
|
87
|
+
*/
|
|
88
|
+
function sharesPass(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Admit and notify a fresh-only local delivery. A coherent pass-only success
|
|
91
|
+
* can keep its result inside this pass after releasing capture resources;
|
|
92
|
+
* every other fresh-only answer is detached before notifying the host.
|
|
93
|
+
* Callback failure always evicts the incomplete owner.
|
|
94
|
+
*
|
|
95
|
+
* @evidence contracts/common.md#principled-implementation Explicit nonwatching, consistent project lifecycle and cache-withdrawal capability are required on every successful incomplete delivery; retention additionally needs the compile's exact pass-only epoch.
|
|
96
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner handles initial and cached fresh-only admission, resource release and host notification.
|
|
97
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Incomplete output never acquires a persistent record or publication, and failed/unknown/watching capability cannot leave a reusable owner.
|
|
98
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish local pass retention, resource release and callback failure effects.
|
|
99
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This lifecycle operation delegates native resource release to the generation disposer.
|
|
100
|
+
* @evidence contracts/performance.md#efficient-algorithms Identity/epoch checks and one callback add no input scan; resource disposal visits the fixed tracker population.
|
|
101
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only coherent locally admitted output in its exact nonwatching pass survives; a later pass or repeated module must obtain another result.
|
|
102
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Capture resources are released even when local output is kept; rejection and callback failure detach the owning Promise, and the cache lifecycle bounds retained result lifetime.
|
|
103
|
+
*/
|
|
104
|
+
function admitFreshOnly(cached: TtscCachedProjectTransform, cache: TtscTransformCache | undefined, key: string, generation: Promise<TtscCachedProjectTransform>, epoch: number | undefined, hooks: TtscTransformHooks | undefined): void;
|
|
105
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform";
|
|
2
|
+
import type { TtscTransformCache } from "../cache/TtscTransformCache";
|
|
3
|
+
import type { TtscTransformHooks } from "../watch/TtscTransformHooks";
|
|
4
|
+
/**
|
|
5
|
+
* The shared ownership boundary for generation reuse in every adapter.
|
|
6
|
+
*
|
|
7
|
+
* WARNING (#1712, #1713): a module, a synchronous input-proof transaction, a
|
|
8
|
+
* delivery pass, and a persistent generation have different lifetimes. Keep
|
|
9
|
+
* those distinctions here. Do not add native preparation before every module,
|
|
10
|
+
* keep positive toolchain checks for a whole process, or make Bun's adapter
|
|
11
|
+
* invent its own cache policy. A proven pass shares its first deliveries;
|
|
12
|
+
* persistent/repeated deliveries require new current observations. Incomplete
|
|
13
|
+
* observations can share a coherent local result only inside an explicitly
|
|
14
|
+
* nonwatching pass with actual host-cache withdrawal, never a record or pool.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Explicit pass identity, source baseline and first-delivery membership delimit sharing; synchronous transactions independently qualify current native inputs and incomplete local outputs retain stricter lifecycle admission.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One core owner supplies the same preparation, pass and fresh-only policies to every adapter instead of separate host-specific caches.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observation never becomes complete snapshot authority; watching, persistent, repeated and unknown boundaries cannot borrow an incomplete pass result.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation Native context names the four lifetimes and warns against the specific performance and stale-cache regressions they prevent.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Members delegate native observations to the generation's filesystem and the native environment owner.
|
|
21
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms Members own baseline lookup, batch qualification and admission.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Members establish the distinct sharing boundaries.
|
|
23
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The namespace owns no registry; transactions and generations have explicit callers.
|
|
24
|
+
*/
|
|
25
|
+
export declare namespace TtscGenerationProof {
|
|
26
|
+
/**
|
|
27
|
+
* One synchronous admission after all asynchronous preparation has settled.
|
|
28
|
+
* Never retain this object in a generation or use it after an await.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation The exact cached owner prevents a proof of another result from supplying authority; optional native verdict is earned only by this synchronous transaction.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design One transaction carries environment observations and the shared native predicate verdict.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Absent environment or predicate proof remains absent, never implied success.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the no-await lifetime and members distinguish owner, environment and predicate authority.
|
|
34
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Native identity is retained by the referenced generation, not inferred by this carrier.
|
|
35
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This carrier executes no computation.
|
|
36
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The creating operation and validators own sharing decisions.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The synchronous caller owns this handle-free carrier.
|
|
38
|
+
*/
|
|
39
|
+
interface Transaction {
|
|
40
|
+
/** Exact generation being synchronously admitted. */
|
|
41
|
+
readonly cached: TtscCachedProjectTransform;
|
|
42
|
+
/** Current batch, absent when the pass already owns this input proof. */
|
|
43
|
+
readonly environments?: ReadonlyMap<string, string | undefined>;
|
|
44
|
+
/** Current native predicate verdict, unbuilt until its first gate. */
|
|
45
|
+
nativePredicates?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Prepare native authority only when this delivery needs a new input proof.
|
|
49
|
+
* The caller must create its synchronous transaction after awaiting this.
|
|
50
|
+
*
|
|
51
|
+
* @evidence contracts/common.md#principled-implementation A qualified first-delivery pass already owns environment proof; all other requests prepare actual authority before synchronous admission.
|
|
52
|
+
* @evidence contracts/common.md#clear-and-simple-design One branch delegates native preparation rather than repeating it in adapters.
|
|
53
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only the existing explicit pass contract permits skipping preparation; no watcher silence or process lifetime substitutes for it.
|
|
54
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states preparation versus transaction ordering.
|
|
55
|
+
* @evidence contracts/portability.md#os-neutral-implementation Preparation uses the actual generation filesystem and native toolchain reader.
|
|
56
|
+
* @evidence contracts/performance.md#efficient-algorithms Qualified first deliveries perform baseline/identity lookups; other deliveries delegate one preparation per unique plugin directory.
|
|
57
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The pass shares its existing first-delivery proof; persistent and repeated deliveries establish new native authority.
|
|
58
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Native requests belong to their environment owner; no transaction survives this await.
|
|
59
|
+
*/
|
|
60
|
+
function prepare(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Start fresh synchronous observation after notification and preparation
|
|
63
|
+
* awaits, sharing actual SDK queries and native predicate replay locally.
|
|
64
|
+
*
|
|
65
|
+
* @evidence contracts/common.md#principled-implementation Current environments are batch-qualified after asynchronous work; a qualified pass needs no redundant native environment observation.
|
|
66
|
+
* @evidence contracts/common.md#clear-and-simple-design One constructor binds observations to their exact generation.
|
|
67
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No current verdict is retained across deliveries or asynchronous boundaries.
|
|
68
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the mandatory ordering and synchronous lifetime.
|
|
69
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native observation remains with the environment witness owner and actual generation path identity.
|
|
70
|
+
* @evidence contracts/performance.md#efficient-algorithms Plugin selection is generation-indexed; one batch shares variable hashing and distinct SDK metadata queries.
|
|
71
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only the following synchronous validators borrow this batch; pass sharing uses its independent first-delivery contract.
|
|
72
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The caller releases the transaction at the end of synchronous admission; no registry or native handle is acquired.
|
|
73
|
+
*/
|
|
74
|
+
function create(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): Transaction;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this module's first delivery belongs to this generation's proven
|
|
77
|
+
* pass. A missing source baseline cannot acquire this permission.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation Epoch equality, coherent snapshot or admitted local-pass state, a recorded source and an unserved identity are all required.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One predicate is shared by async preparation and synchronous source validation.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete ordinary generation or absent module baseline cannot earn pass reuse.
|
|
82
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the first-delivery and baseline restrictions.
|
|
83
|
+
* @evidence contracts/portability.md#os-neutral-implementation Baselines use the generation's actual identity and compiler project-key policy.
|
|
84
|
+
* @evidence contracts/performance.md#efficient-algorithms Baseline and served-set lookup avoid full input population traversal.
|
|
85
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only first deliveries in the same explicitly declared pass share its proof; repeated and later-pass requests do not.
|
|
86
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows generation state without retaining another owner.
|
|
87
|
+
*/
|
|
88
|
+
function sharesPass(cached: TtscCachedProjectTransform, file: string, epoch: number | undefined): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Admit and notify a fresh-only local delivery. A coherent pass-only success
|
|
91
|
+
* can keep its result inside this pass after releasing capture resources;
|
|
92
|
+
* every other fresh-only answer is detached before notifying the host.
|
|
93
|
+
* Callback failure always evicts the incomplete owner.
|
|
94
|
+
*
|
|
95
|
+
* @evidence contracts/common.md#principled-implementation Explicit nonwatching, consistent project lifecycle and cache-withdrawal capability are required on every successful incomplete delivery; retention additionally needs the compile's exact pass-only epoch.
|
|
96
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner handles initial and cached fresh-only admission, resource release and host notification.
|
|
97
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Incomplete output never acquires a persistent record or publication, and failed/unknown/watching capability cannot leave a reusable owner.
|
|
98
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish local pass retention, resource release and callback failure effects.
|
|
99
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This lifecycle operation delegates native resource release to the generation disposer.
|
|
100
|
+
* @evidence contracts/performance.md#efficient-algorithms Identity/epoch checks and one callback add no input scan; resource disposal visits the fixed tracker population.
|
|
101
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only coherent locally admitted output in its exact nonwatching pass survives; a later pass or repeated module must obtain another result.
|
|
102
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Capture resources are released even when local output is kept; rejection and callback failure detach the owning Promise, and the cache lifecycle bounds retained result lifetime.
|
|
103
|
+
*/
|
|
104
|
+
function admitFreshOnly(cached: TtscCachedProjectTransform, cache: TtscTransformCache | undefined, key: string, generation: Promise<TtscCachedProjectTransform>, epoch: number | undefined, hooks: TtscTransformHooks | undefined): void;
|
|
105
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var pluginSource = require('ttsc/plugin-source');
|
|
4
|
+
var disposeCachedTransform = require('../cache/disposeCachedTransform.js');
|
|
5
|
+
var evictGeneration = require('../cache/evictGeneration.js');
|
|
6
|
+
var resultFilesystem = require('../cache/resultFilesystem.js');
|
|
7
|
+
var envelopeDerivation = require('../envelope/envelopeDerivation.js');
|
|
8
|
+
var selectPluginSourceInputs = require('../envelope/selectPluginSourceInputs.js');
|
|
9
|
+
var pathIdentityKey = require('../filesystem/pathIdentityKey.js');
|
|
10
|
+
var preparePluginBuildEnvironments = require('../inputs/preparePluginBuildEnvironments.js');
|
|
11
|
+
var toProjectKey = require('../project/toProjectKey.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The shared ownership boundary for generation reuse in every adapter.
|
|
15
|
+
*
|
|
16
|
+
* WARNING (#1712, #1713): a module, a synchronous input-proof transaction, a
|
|
17
|
+
* delivery pass, and a persistent generation have different lifetimes. Keep
|
|
18
|
+
* those distinctions here. Do not add native preparation before every module,
|
|
19
|
+
* keep positive toolchain checks for a whole process, or make Bun's adapter
|
|
20
|
+
* invent its own cache policy. A proven pass shares its first deliveries;
|
|
21
|
+
* persistent/repeated deliveries require new current observations. Incomplete
|
|
22
|
+
* observations can share a coherent local result only inside an explicitly
|
|
23
|
+
* nonwatching pass with actual host-cache withdrawal, never a record or pool.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation Explicit pass identity, source baseline and first-delivery membership delimit sharing; synchronous transactions independently qualify current native inputs and incomplete local outputs retain stricter lifecycle admission.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design One core owner supplies the same preparation, pass and fresh-only policies to every adapter instead of separate host-specific caches.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observation never becomes complete snapshot authority; watching, persistent, repeated and unknown boundaries cannot borrow an incomplete pass result.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation Native context names the four lifetimes and warns against the specific performance and stale-cache regressions they prevent.
|
|
29
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Members delegate native observations to the generation's filesystem and the native environment owner.
|
|
30
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms Members own baseline lookup, batch qualification and admission.
|
|
31
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Members establish the distinct sharing boundaries.
|
|
32
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The namespace owns no registry; transactions and generations have explicit callers.
|
|
33
|
+
*/
|
|
34
|
+
exports.TtscGenerationProof = void 0;
|
|
35
|
+
(function (TtscGenerationProof) {
|
|
36
|
+
/**
|
|
37
|
+
* Prepare native authority only when this delivery needs a new input proof.
|
|
38
|
+
* The caller must create its synchronous transaction after awaiting this.
|
|
39
|
+
*
|
|
40
|
+
* @evidence contracts/common.md#principled-implementation A qualified first-delivery pass already owns environment proof; all other requests prepare actual authority before synchronous admission.
|
|
41
|
+
* @evidence contracts/common.md#clear-and-simple-design One branch delegates native preparation rather than repeating it in adapters.
|
|
42
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only the existing explicit pass contract permits skipping preparation; no watcher silence or process lifetime substitutes for it.
|
|
43
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states preparation versus transaction ordering.
|
|
44
|
+
* @evidence contracts/portability.md#os-neutral-implementation Preparation uses the actual generation filesystem and native toolchain reader.
|
|
45
|
+
* @evidence contracts/performance.md#efficient-algorithms Qualified first deliveries perform baseline/identity lookups; other deliveries delegate one preparation per unique plugin directory.
|
|
46
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The pass shares its existing first-delivery proof; persistent and repeated deliveries establish new native authority.
|
|
47
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Native requests belong to their environment owner; no transaction survives this await.
|
|
48
|
+
*/
|
|
49
|
+
async function prepare(cached, file, epoch) {
|
|
50
|
+
if (!sharesPass(cached, file, epoch))
|
|
51
|
+
await preparePluginBuildEnvironments.preparePluginBuildEnvironments(cached.result, resultFilesystem.resultFilesystem(cached.result), cached);
|
|
52
|
+
}
|
|
53
|
+
TtscGenerationProof.prepare = prepare;
|
|
54
|
+
/**
|
|
55
|
+
* Start fresh synchronous observation after notification and preparation
|
|
56
|
+
* awaits, sharing actual SDK queries and native predicate replay locally.
|
|
57
|
+
*
|
|
58
|
+
* @evidence contracts/common.md#principled-implementation Current environments are batch-qualified after asynchronous work; a qualified pass needs no redundant native environment observation.
|
|
59
|
+
* @evidence contracts/common.md#clear-and-simple-design One constructor binds observations to their exact generation.
|
|
60
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No current verdict is retained across deliveries or asynchronous boundaries.
|
|
61
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the mandatory ordering and synchronous lifetime.
|
|
62
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native observation remains with the environment witness owner and actual generation path identity.
|
|
63
|
+
* @evidence contracts/performance.md#efficient-algorithms Plugin selection is generation-indexed; one batch shares variable hashing and distinct SDK metadata queries.
|
|
64
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only the following synchronous validators borrow this batch; pass sharing uses its independent first-delivery contract.
|
|
65
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The caller releases the transaction at the end of synchronous admission; no registry or native handle is acquired.
|
|
66
|
+
*/
|
|
67
|
+
function create(cached, file, epoch) {
|
|
68
|
+
return {
|
|
69
|
+
cached,
|
|
70
|
+
...(sharesPass(cached, file, epoch)
|
|
71
|
+
? {}
|
|
72
|
+
: {
|
|
73
|
+
environments: pluginSource.PluginBuildEnvironmentReadings.cachedAll(selectPluginSourceInputs.selectPluginSourceInputs(cached.result).keys()),
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
TtscGenerationProof.create = create;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this module's first delivery belongs to this generation's proven
|
|
80
|
+
* pass. A missing source baseline cannot acquire this permission.
|
|
81
|
+
*
|
|
82
|
+
* @evidence contracts/common.md#principled-implementation Epoch equality, coherent snapshot or admitted local-pass state, a recorded source and an unserved identity are all required.
|
|
83
|
+
* @evidence contracts/common.md#clear-and-simple-design One predicate is shared by async preparation and synchronous source validation.
|
|
84
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete ordinary generation or absent module baseline cannot earn pass reuse.
|
|
85
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the first-delivery and baseline restrictions.
|
|
86
|
+
* @evidence contracts/portability.md#os-neutral-implementation Baselines use the generation's actual identity and compiler project-key policy.
|
|
87
|
+
* @evidence contracts/performance.md#efficient-algorithms Baseline and served-set lookup avoid full input population traversal.
|
|
88
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only first deliveries in the same explicitly declared pass share its proof; repeated and later-pass requests do not.
|
|
89
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows generation state without retaining another owner.
|
|
90
|
+
*/
|
|
91
|
+
function sharesPass(cached, file, epoch) {
|
|
92
|
+
if (epoch === undefined ||
|
|
93
|
+
cached.deliveryEpoch !== epoch ||
|
|
94
|
+
(cached.projectSnapshotComplete !== true &&
|
|
95
|
+
cached.passDeliveryOnly !== true) ||
|
|
96
|
+
(cached.freshDeliveryOnly === true && cached.passDeliveryOnly !== true))
|
|
97
|
+
return false;
|
|
98
|
+
const identities = envelopeDerivation.envelopeDerivation(cached).identityContext;
|
|
99
|
+
const identity = pathIdentityKey.pathIdentityKey(file, identities);
|
|
100
|
+
if (cached.servedFiles?.has(identity))
|
|
101
|
+
return false;
|
|
102
|
+
const key = toProjectKey.toProjectKey(cached.projectRoot, file, identities);
|
|
103
|
+
return (cached.sourceHashes?.[identity] !== undefined ||
|
|
104
|
+
Object.hasOwn(cached.inputHashes, key) ||
|
|
105
|
+
cached.externalInputHashes?.[identity] !== undefined);
|
|
106
|
+
}
|
|
107
|
+
TtscGenerationProof.sharesPass = sharesPass;
|
|
108
|
+
/**
|
|
109
|
+
* Admit and notify a fresh-only local delivery. A coherent pass-only success
|
|
110
|
+
* can keep its result inside this pass after releasing capture resources;
|
|
111
|
+
* every other fresh-only answer is detached before notifying the host.
|
|
112
|
+
* Callback failure always evicts the incomplete owner.
|
|
113
|
+
*
|
|
114
|
+
* @evidence contracts/common.md#principled-implementation Explicit nonwatching, consistent project lifecycle and cache-withdrawal capability are required on every successful incomplete delivery; retention additionally needs the compile's exact pass-only epoch.
|
|
115
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner handles initial and cached fresh-only admission, resource release and host notification.
|
|
116
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Incomplete output never acquires a persistent record or publication, and failed/unknown/watching capability cannot leave a reusable owner.
|
|
117
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish local pass retention, resource release and callback failure effects.
|
|
118
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This lifecycle operation delegates native resource release to the generation disposer.
|
|
119
|
+
* @evidence contracts/performance.md#efficient-algorithms Identity/epoch checks and one callback add no input scan; resource disposal visits the fixed tracker population.
|
|
120
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only coherent locally admitted output in its exact nonwatching pass survives; a later pass or repeated module must obtain another result.
|
|
121
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Capture resources are released even when local output is kept; rejection and callback failure detach the owning Promise, and the cache lifecycle bounds retained result lifetime.
|
|
122
|
+
*/
|
|
123
|
+
function admitFreshOnly(cached, cache, key, generation, epoch, hooks) {
|
|
124
|
+
if (cached.freshDeliveryOnly !== true)
|
|
125
|
+
return;
|
|
126
|
+
const authorized = hooks?.watching === false &&
|
|
127
|
+
hooks.markVolatile !== undefined &&
|
|
128
|
+
(hooks.project?.watching === undefined ||
|
|
129
|
+
hooks.project.watching === false);
|
|
130
|
+
const retain = authorized &&
|
|
131
|
+
epoch !== undefined &&
|
|
132
|
+
cached.deliveryEpoch === epoch &&
|
|
133
|
+
cached.passDeliveryOnly === true;
|
|
134
|
+
disposeCachedTransform.disposeCachedTransform(cached);
|
|
135
|
+
if (!retain)
|
|
136
|
+
evictGeneration.evictGeneration(cache, key, generation);
|
|
137
|
+
if (cached.result.type === "success" && !authorized)
|
|
138
|
+
throw new Error("@ttsc/unplugin: plugin input observation is unavailable; fresh output requires an explicitly nonwatching host with supported cache withdrawal. Watching, unknown or contradictory lifecycles cannot safely observe its changes.");
|
|
139
|
+
try {
|
|
140
|
+
hooks?.markVolatile?.();
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
evictGeneration.evictGeneration(cache, key, generation);
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
TtscGenerationProof.admitFreshOnly = admitFreshOnly;
|
|
148
|
+
})(exports.TtscGenerationProof || (exports.TtscGenerationProof = {}));
|
|
149
|
+
//# sourceMappingURL=TtscGenerationProof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGenerationProof.js","sources":["../../../../src/core/transform/validation/TtscGenerationProof.ts"],"sourcesContent":[null],"names":["TtscGenerationProof","preparePluginBuildEnvironments","resultFilesystem","PluginBuildEnvironmentReadings","selectPluginSourceInputs","envelopeDerivation","pathIdentityKey","toProjectKey","disposeCachedTransform","evictGeneration"],"mappings":";;;;;;;;;;;;AAcA;;;;;;;;;;;;;;;;;;;;AAoBG;AACcA;AAAjB,CAAA,UAAiB,mBAAmB,EAAA;AAyBlC;;;;;;;;;;;;AAYG;AACI,IAAA,eAAe,OAAO,CAC3B,MAAkC,EAClC,IAAY,EACZ,KAAyB,EAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC;AAClC,YAAA,MAAMC,6DAA8B,CAClC,MAAM,CAAC,MAAM,EACbC,iCAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,EAC/B,MAAM,CACP;IACL;AAXsB,IAAA,mBAAA,CAAA,OAAO,UAW5B;AAED;;;;;;;;;;;;AAYG;AACH,IAAA,SAAgB,MAAM,CACpB,MAAkC,EAClC,IAAY,EACZ,KAAyB,EAAA;QAEzB,OAAO;YACL,MAAM;YACN,IAAI,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK;AAChC,kBAAE;AACF,kBAAE;AACE,oBAAA,YAAY,EAAEC,2CAA8B,CAAC,SAAS,CACpDC,iDAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAC/C;iBACF,CAAC;SACP;IACH;AAfgB,IAAA,mBAAA,CAAA,MAAM,SAerB;AAED;;;;;;;;;;;;AAYG;AACH,IAAA,SAAgB,UAAU,CACxB,MAAkC,EAClC,IAAY,EACZ,KAAyB,EAAA;QAEzB,IACE,KAAK,KAAK,SAAS;YACnB,MAAM,CAAC,aAAa,KAAK,KAAK;AAC9B,aAAC,MAAM,CAAC,uBAAuB,KAAK,IAAI;AACtC,gBAAA,MAAM,CAAC,gBAAgB,KAAK,IAAI,CAAC;aAClC,MAAM,CAAC,iBAAiB,KAAK,IAAI,IAAI,MAAM,CAAC,gBAAgB,KAAK,IAAI,CAAC;AAEvE,YAAA,OAAO,KAAK;QACd,MAAM,UAAU,GAAGC,qCAAkB,CAAC,MAAM,CAAC,CAAC,eAAe;QAC7D,MAAM,QAAQ,GAAGC,+BAAe,CAAC,IAAI,EAAE,UAAU,CAAC;AAClD,QAAA,IAAI,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC;AAAE,YAAA,OAAO,KAAK;AACnD,QAAA,MAAM,GAAG,GAAGC,yBAAY,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC;QAC9D,QACE,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC,KAAK,SAAS;YAC7C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC;YACtC,MAAM,CAAC,mBAAmB,GAAG,QAAQ,CAAC,KAAK,SAAS;IAExD;AAtBgB,IAAA,mBAAA,CAAA,UAAU,aAsBzB;AAED;;;;;;;;;;;;;;AAcG;AACH,IAAA,SAAgB,cAAc,CAC5B,MAAkC,EAClC,KAAqC,EACrC,GAAW,EACX,UAA+C,EAC/C,KAAyB,EACzB,KAAqC,EAAA;AAErC,QAAA,IAAI,MAAM,CAAC,iBAAiB,KAAK,IAAI;YAAE;AACvC,QAAA,MAAM,UAAU,GACd,KAAK,EAAE,QAAQ,KAAK,KAAK;YACzB,KAAK,CAAC,YAAY,KAAK,SAAS;AAChC,aAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,KAAK,SAAS;AACpC,gBAAA,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC;QACrC,MAAM,MAAM,GACV,UAAU;AACV,YAAA,KAAK,KAAK,SAAS;YACnB,MAAM,CAAC,aAAa,KAAK,KAAK;AAC9B,YAAA,MAAM,CAAC,gBAAgB,KAAK,IAAI;QAClCC,6CAAsB,CAAC,MAAM,CAAC;AAC9B,QAAA,IAAI,CAAC,MAAM;AAAE,YAAAC,+BAAe,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,UAAU;AACjD,YAAA,MAAM,IAAI,KAAK,CACb,iOAAiO,CAClO;AACH,QAAA,IAAI;AACF,YAAA,KAAK,EAAE,YAAY,IAAI;QACzB;QAAE,OAAO,KAAK,EAAE;AACd,YAAAA,+BAAe,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC;AACvC,YAAA,MAAM,KAAK;QACb;IACF;AA/BgB,IAAA,mBAAA,CAAA,cAAc,iBA+B7B;AACH,CAAC,EArKgBT,2BAAmB,KAAnBA,2BAAmB,GAAA,EAAA,CAAA,CAAA;;"}
|