@ttsc/unplugin 0.28.5 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/lib/api.js +10 -0
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +3 -2
- package/lib/api.mjs.map +1 -1
- package/lib/bun-register.d.cts +10 -7
- package/lib/bun-register.d.mts +10 -7
- package/lib/bun-register.d.ts +10 -7
- package/lib/bun-register.js +90 -24
- package/lib/bun-register.js.map +1 -1
- package/lib/bun-register.mjs +90 -24
- package/lib/bun-register.mjs.map +1 -1
- package/lib/bun.d.cts +10 -8
- package/lib/bun.d.mts +10 -8
- package/lib/bun.d.ts +10 -8
- package/lib/bun.js +19 -17
- package/lib/bun.js.map +1 -1
- package/lib/bun.mjs +20 -18
- package/lib/bun.mjs.map +1 -1
- package/lib/core/index.d.cts +10 -8
- package/lib/core/index.d.mts +10 -8
- package/lib/core/index.d.ts +10 -8
- package/lib/core/index.js +88 -16
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +81 -18
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/projectDiscovery.d.cts +55 -0
- package/lib/core/projectDiscovery.d.mts +55 -0
- package/lib/core/projectDiscovery.d.ts +55 -0
- package/lib/core/projectDiscovery.js +187 -0
- package/lib/core/projectDiscovery.js.map +1 -0
- package/lib/core/projectDiscovery.mjs +182 -0
- package/lib/core/projectDiscovery.mjs.map +1 -0
- package/lib/core/sourceExtensions.d.cts +10 -0
- package/lib/core/sourceExtensions.d.mts +10 -0
- package/lib/core/sourceExtensions.d.ts +10 -0
- package/lib/core/sourceExtensions.js +38 -0
- package/lib/core/sourceExtensions.js.map +1 -0
- package/lib/core/sourceExtensions.mjs +32 -0
- package/lib/core/sourceExtensions.mjs.map +1 -0
- package/lib/core/transform.d.cts +96 -16
- package/lib/core/transform.d.mts +96 -16
- package/lib/core/transform.d.ts +96 -16
- package/lib/core/transform.js +1295 -309
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +1290 -310
- package/lib/core/transform.mjs.map +1 -1
- package/lib/core/tsconfigPaths.d.cts +55 -3
- package/lib/core/tsconfigPaths.d.mts +55 -3
- package/lib/core/tsconfigPaths.d.ts +55 -3
- package/lib/core/tsconfigPaths.js +260 -46
- package/lib/core/tsconfigPaths.js.map +1 -1
- package/lib/core/tsconfigPaths.mjs +255 -47
- package/lib/core/tsconfigPaths.mjs.map +1 -1
- package/lib/core/viteServe.d.cts +18 -21
- package/lib/core/viteServe.d.mts +18 -21
- package/lib/core/viteServe.d.ts +18 -21
- package/lib/core/viteServe.js +88 -47
- package/lib/core/viteServe.js.map +1 -1
- package/lib/core/viteServe.mjs +89 -49
- package/lib/core/viteServe.mjs.map +1 -1
- package/lib/next.d.cts +7 -0
- package/lib/next.d.mts +7 -0
- package/lib/next.d.ts +7 -0
- package/lib/next.js +186 -54
- package/lib/next.js.map +1 -1
- package/lib/next.mjs +186 -55
- package/lib/next.mjs.map +1 -1
- package/lib/turbopack.d.cts +6 -4
- package/lib/turbopack.d.mts +6 -4
- package/lib/turbopack.d.ts +6 -4
- package/lib/turbopack.js +11 -10
- package/lib/turbopack.js.map +1 -1
- package/lib/turbopack.mjs +11 -10
- package/lib/turbopack.mjs.map +1 -1
- package/package.json +7 -4
- package/src/bun-register.ts +112 -25
- package/src/bun.ts +60 -50
- package/src/core/index.ts +114 -19
- package/src/core/projectDiscovery.ts +256 -0
- package/src/core/sourceExtensions.ts +47 -0
- package/src/core/transform.ts +1671 -361
- package/src/core/tsconfigPaths.ts +406 -46
- package/src/core/viteServe.ts +125 -74
- package/src/next.ts +230 -54
- package/src/turbopack.ts +11 -10
package/lib/core/transform.d.mts
CHANGED
|
@@ -82,6 +82,8 @@ interface TtscProjectMutationTracker {
|
|
|
82
82
|
* graph-free envelopes retain complete-snapshot validation.
|
|
83
83
|
*/
|
|
84
84
|
export interface TtscCachedProjectTransform {
|
|
85
|
+
/** Predicate-preserving compiler proofs for external candidate spellings. */
|
|
86
|
+
externalInputObservations?: Record<string, ITtscCompilerTransformation.IInputObservation>;
|
|
85
87
|
/**
|
|
86
88
|
* SHA-256 hash of every input the compiler reported outside the project walk
|
|
87
89
|
* (keyed by filesystem identity), captured at the time of the transform.
|
|
@@ -201,6 +203,8 @@ export interface TtscCachedProjectTransform {
|
|
|
201
203
|
hostInputValidation?: TtscHostInputValidation;
|
|
202
204
|
/** Live notification state for file/directory creation, deletion, and rename. */
|
|
203
205
|
projectMutationTracker?: TtscProjectMutationTracker;
|
|
206
|
+
/** Whether a generated wrapper and its source config graph stayed coherent. */
|
|
207
|
+
configStateComplete?: boolean;
|
|
204
208
|
/**
|
|
205
209
|
* Whether the generation-time project walk observed every directory and file
|
|
206
210
|
* it attempted to snapshot. An incomplete walk may never authorize narrow
|
|
@@ -339,39 +343,92 @@ export declare function resetTtscTransformCache(cache: TtscTransformCache): void
|
|
|
339
343
|
* What the generation already knows about one derived watch input, handed to
|
|
340
344
|
* the adapter so it does not rederive it per input per delivery.
|
|
341
345
|
*
|
|
342
|
-
*
|
|
343
|
-
* {@link pathIdentityKey} of the input,
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* `
|
|
347
|
-
* inputs) for one
|
|
346
|
+
* All facts are generation state: the identity is the memoized
|
|
347
|
+
* {@link pathIdentityKey} of the input, `missing` preserves the original public
|
|
348
|
+
* existence contract, and `unavailable` distinguishes a failed file predicate
|
|
349
|
+
* from ordinary absence. An adapter that computes them itself pays a
|
|
350
|
+
* `realpath`, a case-sensitivity directory listing, and an `existsSync` for
|
|
351
|
+
* every input of every delivered module, which is O(modules x inputs) for one
|
|
352
|
+
* build (samchon/ttsc#1246).
|
|
348
353
|
*/
|
|
349
354
|
export interface TtscWatchInputEvidence {
|
|
350
355
|
/** Memoized filesystem identity of the input. */
|
|
351
356
|
identity: string;
|
|
352
|
-
/** Whether the generation recorded this input as
|
|
357
|
+
/** Whether the generation recorded this input as unavailable as a file. */
|
|
353
358
|
missing: boolean;
|
|
359
|
+
/** The generation state Metro can compare with its main-process baseline. */
|
|
360
|
+
state?: TtscWatchInputState;
|
|
361
|
+
/** Which unavailable predicate must become true before invalidation. */
|
|
362
|
+
unavailable?: "missing" | "not-file";
|
|
363
|
+
}
|
|
364
|
+
/** Exact generation state behind one derived watch input. */
|
|
365
|
+
export type TtscWatchInputState = {
|
|
366
|
+
/** A project-walk or dependency-only input read as ordinary host bytes. */
|
|
367
|
+
codec: "host";
|
|
368
|
+
hash: string;
|
|
369
|
+
} | {
|
|
370
|
+
/** A realized compiler-graph input, including its physical target. */
|
|
371
|
+
codec: "graph";
|
|
372
|
+
hash: string;
|
|
373
|
+
realpath: string | null;
|
|
374
|
+
} | {
|
|
375
|
+
/** The exact compiler predicates observed for a resolver input. */
|
|
376
|
+
codec: "predicates";
|
|
377
|
+
observation: ITtscCompilerTransformation.IInputObservation;
|
|
378
|
+
};
|
|
379
|
+
/** Main-process file predicate used only by project discovery. */
|
|
380
|
+
export interface TtscWatchInputFileBaseline {
|
|
381
|
+
fileExists: boolean;
|
|
382
|
+
identity: string;
|
|
383
|
+
}
|
|
384
|
+
/** Main-process state broad enough to compare every watch-input codec. */
|
|
385
|
+
export interface TtscWatchInputBaseline extends TtscWatchInputFileBaseline {
|
|
386
|
+
directoryExists: boolean;
|
|
387
|
+
graphHash: string;
|
|
388
|
+
graphReadHash: string | null;
|
|
389
|
+
hostHash: string;
|
|
390
|
+
realpath: {
|
|
391
|
+
ok: false;
|
|
392
|
+
path?: never;
|
|
393
|
+
} | {
|
|
394
|
+
ok: true;
|
|
395
|
+
path: string;
|
|
396
|
+
};
|
|
397
|
+
stat: "directory" | "file" | "missing";
|
|
398
|
+
}
|
|
399
|
+
/** Baseline shape stored for either a discovery predicate or a full input. */
|
|
400
|
+
export type TtscWatchInputKeyBaseline = TtscWatchInputFileBaseline | TtscWatchInputBaseline;
|
|
401
|
+
/** One derived input and its optional generation proof. */
|
|
402
|
+
export interface TtscWatchInput {
|
|
403
|
+
evidence?: TtscWatchInputEvidence;
|
|
404
|
+
file: string;
|
|
354
405
|
}
|
|
355
406
|
/**
|
|
356
407
|
* Hooks the bundler adapter passes into {@link transformTtsc} so transform
|
|
357
|
-
* side-channels (plugin-reported dependencies and host
|
|
358
|
-
*
|
|
359
|
-
* `TransformResult`.
|
|
408
|
+
* side-channels (plugin-reported dependencies and host resolver inputs) reach
|
|
409
|
+
* the bundler without leaking extra fields on the returned `TransformResult`.
|
|
360
410
|
*/
|
|
361
411
|
export interface TtscTransformHooks {
|
|
362
412
|
/**
|
|
363
413
|
* Invoked once per absolute watch-input path derived for the transformed file
|
|
364
414
|
* `F`: the plugin-reported `dependencies[F]` list unioned with the host-owned
|
|
365
415
|
* reference graph's contribution — the reachability closure of `graph.edges`
|
|
366
|
-
* from `F`, the `graph.globals` files, the `graph.configs` chain,
|
|
367
|
-
*
|
|
368
|
-
* `dependenciesComplete`, only `dependencies[F]`,
|
|
369
|
-
*
|
|
416
|
+
* from `F`, the `graph.globals` files, the `graph.configs` chain, importer
|
|
417
|
+
* `graph.candidates`, and universal `graph.resolutionInputs`. For a file the
|
|
418
|
+
* envelope declared `dependenciesComplete`, only `dependencies[F]`,
|
|
419
|
+
* `graph.candidates`, `graph.resolutionInputs`, and the universal
|
|
420
|
+
* `graph.configs` chain remain. Adapters forward this to the bundler's
|
|
370
421
|
* `addWatchFile` so type-only inputs participate in watch-mode and
|
|
371
422
|
* persistent-cache invalidation. See {@link selectWatchInputs} for the exact
|
|
372
423
|
* derivation.
|
|
373
424
|
*/
|
|
374
425
|
addWatchFile?: (file: string, evidence?: TtscWatchInputEvidence) => void;
|
|
426
|
+
/**
|
|
427
|
+
* Batched form of {@link addWatchFile}. When supplied, the transform calls it
|
|
428
|
+
* once per delivered module and does not call `addWatchFile` for that
|
|
429
|
+
* module.
|
|
430
|
+
*/
|
|
431
|
+
addWatchFiles?: (inputs: readonly TtscWatchInput[]) => void;
|
|
375
432
|
/**
|
|
376
433
|
* Invoked when the plugin declared the transformed file volatile (the
|
|
377
434
|
* envelope's `volatile` list): its output depends on non-file inputs that no
|
|
@@ -396,8 +453,7 @@ export interface TtscTransformHooks {
|
|
|
396
453
|
* @param id - Bundler module id (may carry a query string or virtual prefix).
|
|
397
454
|
* @param source - Current file content supplied by the bundler.
|
|
398
455
|
* @param options - Resolved plugin options.
|
|
399
|
-
* @param aliases - Raw
|
|
400
|
-
* object).
|
|
456
|
+
* @param aliases - Raw Vite alias configuration (object or array).
|
|
401
457
|
* @param cache - Optional project cache. Callers with a real `buildStart`
|
|
402
458
|
* boundary declare it through {@link beginTtscTransformBuild}; other hosts
|
|
403
459
|
* retain persistent validation.
|
|
@@ -464,6 +520,8 @@ export declare function isDeclarationFile(id: string): boolean;
|
|
|
464
520
|
* unnecessary module update and preserves the original source map.
|
|
465
521
|
*/
|
|
466
522
|
export declare function createTransformResult(source: string, code: string): TtscTransformResult | undefined;
|
|
523
|
+
/** Validate one predicate-preserving graph proof against a filesystem view. */
|
|
524
|
+
export declare function validateGraphInputObservation(file: string, observation: ITtscCompilerTransformation.IInputObservation, filesystem?: TtscTransformFilesystemOperations): string[];
|
|
467
525
|
/**
|
|
468
526
|
* Hash every input file under `projectRoot` (the same walk universe
|
|
469
527
|
* {@link matchesCachedSource} validates against), keyed by project-relative
|
|
@@ -471,6 +529,16 @@ export declare function createTransformResult(source: string, code: string): Tts
|
|
|
471
529
|
* can fold the identical input universe into their own cache fingerprints.
|
|
472
530
|
*/
|
|
473
531
|
export declare function collectProjectInputHashes(projectRoot: string, identities?: FilesystemPathIdentityContext, filesystem?: TtscTransformFilesystemOperations, policy?: ITtscProjectMembershipPolicy): Record<string, string>;
|
|
532
|
+
/** One project-walk hash set together with its completeness proof. */
|
|
533
|
+
export interface TtscProjectInputHashSnapshot {
|
|
534
|
+
complete: boolean;
|
|
535
|
+
hashes: Record<string, string>;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Hash the project walk and retain whether every attempted directory and file
|
|
539
|
+
* was observed coherently. Cache-key hosts must reject an incomplete set.
|
|
540
|
+
*/
|
|
541
|
+
export declare function collectProjectInputHashSnapshot(projectRoot: string, identities?: FilesystemPathIdentityContext, filesystem?: TtscTransformFilesystemOperations, policy?: ITtscProjectMembershipPolicy): TtscProjectInputHashSnapshot;
|
|
474
542
|
/**
|
|
475
543
|
* Report whether an absolute `file` belongs to the project walk universe of
|
|
476
544
|
* `root`: it lies under `root`, every component exists without traversing a
|
|
@@ -492,6 +560,18 @@ export declare function isProjectWalkPath(root: string, file: string, _identitie
|
|
|
492
560
|
* with identical semantics at cache-key time.
|
|
493
561
|
*/
|
|
494
562
|
export declare function collectExternalInputHashes(paths: readonly string[], filesystem?: TtscTransformFilesystemOperations): Record<string, string>;
|
|
563
|
+
/** Capture the stable file predicate used by implicit project discovery. */
|
|
564
|
+
export declare function captureWatchInputFileBaseline(file: string, filesystem?: TtscTransformFilesystemOperations): TtscWatchInputFileBaseline | undefined;
|
|
565
|
+
/**
|
|
566
|
+
* Capture one stable main-process baseline that can be compared with any
|
|
567
|
+
* generation-owned watch-input evidence. Two equal broad observations are
|
|
568
|
+
* required so a cache key never publishes a torn path state.
|
|
569
|
+
*/
|
|
570
|
+
export declare function captureWatchInputBaseline(file: string, filesystem?: TtscTransformFilesystemOperations): TtscWatchInputBaseline | undefined;
|
|
571
|
+
/** Compare generation evidence with the main process's exact key baseline. */
|
|
572
|
+
export declare function watchInputEvidenceMatchesBaseline(evidence: TtscWatchInputEvidence, baseline: TtscWatchInputKeyBaseline): boolean;
|
|
573
|
+
/** Validate the complete narrow or broad shape stored in a key baseline. */
|
|
574
|
+
export declare function isWatchInputKeyBaseline(baseline: unknown): baseline is TtscWatchInputKeyBaseline;
|
|
495
575
|
/**
|
|
496
576
|
* Build a comparison key for a path without changing the spelling handed to a
|
|
497
577
|
* filesystem or bundler. Windows is case-insensitive; macOS is probed per
|
package/lib/core/transform.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ interface TtscProjectMutationTracker {
|
|
|
82
82
|
* graph-free envelopes retain complete-snapshot validation.
|
|
83
83
|
*/
|
|
84
84
|
export interface TtscCachedProjectTransform {
|
|
85
|
+
/** Predicate-preserving compiler proofs for external candidate spellings. */
|
|
86
|
+
externalInputObservations?: Record<string, ITtscCompilerTransformation.IInputObservation>;
|
|
85
87
|
/**
|
|
86
88
|
* SHA-256 hash of every input the compiler reported outside the project walk
|
|
87
89
|
* (keyed by filesystem identity), captured at the time of the transform.
|
|
@@ -201,6 +203,8 @@ export interface TtscCachedProjectTransform {
|
|
|
201
203
|
hostInputValidation?: TtscHostInputValidation;
|
|
202
204
|
/** Live notification state for file/directory creation, deletion, and rename. */
|
|
203
205
|
projectMutationTracker?: TtscProjectMutationTracker;
|
|
206
|
+
/** Whether a generated wrapper and its source config graph stayed coherent. */
|
|
207
|
+
configStateComplete?: boolean;
|
|
204
208
|
/**
|
|
205
209
|
* Whether the generation-time project walk observed every directory and file
|
|
206
210
|
* it attempted to snapshot. An incomplete walk may never authorize narrow
|
|
@@ -339,39 +343,92 @@ export declare function resetTtscTransformCache(cache: TtscTransformCache): void
|
|
|
339
343
|
* What the generation already knows about one derived watch input, handed to
|
|
340
344
|
* the adapter so it does not rederive it per input per delivery.
|
|
341
345
|
*
|
|
342
|
-
*
|
|
343
|
-
* {@link pathIdentityKey} of the input,
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* `
|
|
347
|
-
* inputs) for one
|
|
346
|
+
* All facts are generation state: the identity is the memoized
|
|
347
|
+
* {@link pathIdentityKey} of the input, `missing` preserves the original public
|
|
348
|
+
* existence contract, and `unavailable` distinguishes a failed file predicate
|
|
349
|
+
* from ordinary absence. An adapter that computes them itself pays a
|
|
350
|
+
* `realpath`, a case-sensitivity directory listing, and an `existsSync` for
|
|
351
|
+
* every input of every delivered module, which is O(modules x inputs) for one
|
|
352
|
+
* build (samchon/ttsc#1246).
|
|
348
353
|
*/
|
|
349
354
|
export interface TtscWatchInputEvidence {
|
|
350
355
|
/** Memoized filesystem identity of the input. */
|
|
351
356
|
identity: string;
|
|
352
|
-
/** Whether the generation recorded this input as
|
|
357
|
+
/** Whether the generation recorded this input as unavailable as a file. */
|
|
353
358
|
missing: boolean;
|
|
359
|
+
/** The generation state Metro can compare with its main-process baseline. */
|
|
360
|
+
state?: TtscWatchInputState;
|
|
361
|
+
/** Which unavailable predicate must become true before invalidation. */
|
|
362
|
+
unavailable?: "missing" | "not-file";
|
|
363
|
+
}
|
|
364
|
+
/** Exact generation state behind one derived watch input. */
|
|
365
|
+
export type TtscWatchInputState = {
|
|
366
|
+
/** A project-walk or dependency-only input read as ordinary host bytes. */
|
|
367
|
+
codec: "host";
|
|
368
|
+
hash: string;
|
|
369
|
+
} | {
|
|
370
|
+
/** A realized compiler-graph input, including its physical target. */
|
|
371
|
+
codec: "graph";
|
|
372
|
+
hash: string;
|
|
373
|
+
realpath: string | null;
|
|
374
|
+
} | {
|
|
375
|
+
/** The exact compiler predicates observed for a resolver input. */
|
|
376
|
+
codec: "predicates";
|
|
377
|
+
observation: ITtscCompilerTransformation.IInputObservation;
|
|
378
|
+
};
|
|
379
|
+
/** Main-process file predicate used only by project discovery. */
|
|
380
|
+
export interface TtscWatchInputFileBaseline {
|
|
381
|
+
fileExists: boolean;
|
|
382
|
+
identity: string;
|
|
383
|
+
}
|
|
384
|
+
/** Main-process state broad enough to compare every watch-input codec. */
|
|
385
|
+
export interface TtscWatchInputBaseline extends TtscWatchInputFileBaseline {
|
|
386
|
+
directoryExists: boolean;
|
|
387
|
+
graphHash: string;
|
|
388
|
+
graphReadHash: string | null;
|
|
389
|
+
hostHash: string;
|
|
390
|
+
realpath: {
|
|
391
|
+
ok: false;
|
|
392
|
+
path?: never;
|
|
393
|
+
} | {
|
|
394
|
+
ok: true;
|
|
395
|
+
path: string;
|
|
396
|
+
};
|
|
397
|
+
stat: "directory" | "file" | "missing";
|
|
398
|
+
}
|
|
399
|
+
/** Baseline shape stored for either a discovery predicate or a full input. */
|
|
400
|
+
export type TtscWatchInputKeyBaseline = TtscWatchInputFileBaseline | TtscWatchInputBaseline;
|
|
401
|
+
/** One derived input and its optional generation proof. */
|
|
402
|
+
export interface TtscWatchInput {
|
|
403
|
+
evidence?: TtscWatchInputEvidence;
|
|
404
|
+
file: string;
|
|
354
405
|
}
|
|
355
406
|
/**
|
|
356
407
|
* Hooks the bundler adapter passes into {@link transformTtsc} so transform
|
|
357
|
-
* side-channels (plugin-reported dependencies and host
|
|
358
|
-
*
|
|
359
|
-
* `TransformResult`.
|
|
408
|
+
* side-channels (plugin-reported dependencies and host resolver inputs) reach
|
|
409
|
+
* the bundler without leaking extra fields on the returned `TransformResult`.
|
|
360
410
|
*/
|
|
361
411
|
export interface TtscTransformHooks {
|
|
362
412
|
/**
|
|
363
413
|
* Invoked once per absolute watch-input path derived for the transformed file
|
|
364
414
|
* `F`: the plugin-reported `dependencies[F]` list unioned with the host-owned
|
|
365
415
|
* reference graph's contribution — the reachability closure of `graph.edges`
|
|
366
|
-
* from `F`, the `graph.globals` files, the `graph.configs` chain,
|
|
367
|
-
*
|
|
368
|
-
* `dependenciesComplete`, only `dependencies[F]`,
|
|
369
|
-
*
|
|
416
|
+
* from `F`, the `graph.globals` files, the `graph.configs` chain, importer
|
|
417
|
+
* `graph.candidates`, and universal `graph.resolutionInputs`. For a file the
|
|
418
|
+
* envelope declared `dependenciesComplete`, only `dependencies[F]`,
|
|
419
|
+
* `graph.candidates`, `graph.resolutionInputs`, and the universal
|
|
420
|
+
* `graph.configs` chain remain. Adapters forward this to the bundler's
|
|
370
421
|
* `addWatchFile` so type-only inputs participate in watch-mode and
|
|
371
422
|
* persistent-cache invalidation. See {@link selectWatchInputs} for the exact
|
|
372
423
|
* derivation.
|
|
373
424
|
*/
|
|
374
425
|
addWatchFile?: (file: string, evidence?: TtscWatchInputEvidence) => void;
|
|
426
|
+
/**
|
|
427
|
+
* Batched form of {@link addWatchFile}. When supplied, the transform calls it
|
|
428
|
+
* once per delivered module and does not call `addWatchFile` for that
|
|
429
|
+
* module.
|
|
430
|
+
*/
|
|
431
|
+
addWatchFiles?: (inputs: readonly TtscWatchInput[]) => void;
|
|
375
432
|
/**
|
|
376
433
|
* Invoked when the plugin declared the transformed file volatile (the
|
|
377
434
|
* envelope's `volatile` list): its output depends on non-file inputs that no
|
|
@@ -396,8 +453,7 @@ export interface TtscTransformHooks {
|
|
|
396
453
|
* @param id - Bundler module id (may carry a query string or virtual prefix).
|
|
397
454
|
* @param source - Current file content supplied by the bundler.
|
|
398
455
|
* @param options - Resolved plugin options.
|
|
399
|
-
* @param aliases - Raw
|
|
400
|
-
* object).
|
|
456
|
+
* @param aliases - Raw Vite alias configuration (object or array).
|
|
401
457
|
* @param cache - Optional project cache. Callers with a real `buildStart`
|
|
402
458
|
* boundary declare it through {@link beginTtscTransformBuild}; other hosts
|
|
403
459
|
* retain persistent validation.
|
|
@@ -464,6 +520,8 @@ export declare function isDeclarationFile(id: string): boolean;
|
|
|
464
520
|
* unnecessary module update and preserves the original source map.
|
|
465
521
|
*/
|
|
466
522
|
export declare function createTransformResult(source: string, code: string): TtscTransformResult | undefined;
|
|
523
|
+
/** Validate one predicate-preserving graph proof against a filesystem view. */
|
|
524
|
+
export declare function validateGraphInputObservation(file: string, observation: ITtscCompilerTransformation.IInputObservation, filesystem?: TtscTransformFilesystemOperations): string[];
|
|
467
525
|
/**
|
|
468
526
|
* Hash every input file under `projectRoot` (the same walk universe
|
|
469
527
|
* {@link matchesCachedSource} validates against), keyed by project-relative
|
|
@@ -471,6 +529,16 @@ export declare function createTransformResult(source: string, code: string): Tts
|
|
|
471
529
|
* can fold the identical input universe into their own cache fingerprints.
|
|
472
530
|
*/
|
|
473
531
|
export declare function collectProjectInputHashes(projectRoot: string, identities?: FilesystemPathIdentityContext, filesystem?: TtscTransformFilesystemOperations, policy?: ITtscProjectMembershipPolicy): Record<string, string>;
|
|
532
|
+
/** One project-walk hash set together with its completeness proof. */
|
|
533
|
+
export interface TtscProjectInputHashSnapshot {
|
|
534
|
+
complete: boolean;
|
|
535
|
+
hashes: Record<string, string>;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Hash the project walk and retain whether every attempted directory and file
|
|
539
|
+
* was observed coherently. Cache-key hosts must reject an incomplete set.
|
|
540
|
+
*/
|
|
541
|
+
export declare function collectProjectInputHashSnapshot(projectRoot: string, identities?: FilesystemPathIdentityContext, filesystem?: TtscTransformFilesystemOperations, policy?: ITtscProjectMembershipPolicy): TtscProjectInputHashSnapshot;
|
|
474
542
|
/**
|
|
475
543
|
* Report whether an absolute `file` belongs to the project walk universe of
|
|
476
544
|
* `root`: it lies under `root`, every component exists without traversing a
|
|
@@ -492,6 +560,18 @@ export declare function isProjectWalkPath(root: string, file: string, _identitie
|
|
|
492
560
|
* with identical semantics at cache-key time.
|
|
493
561
|
*/
|
|
494
562
|
export declare function collectExternalInputHashes(paths: readonly string[], filesystem?: TtscTransformFilesystemOperations): Record<string, string>;
|
|
563
|
+
/** Capture the stable file predicate used by implicit project discovery. */
|
|
564
|
+
export declare function captureWatchInputFileBaseline(file: string, filesystem?: TtscTransformFilesystemOperations): TtscWatchInputFileBaseline | undefined;
|
|
565
|
+
/**
|
|
566
|
+
* Capture one stable main-process baseline that can be compared with any
|
|
567
|
+
* generation-owned watch-input evidence. Two equal broad observations are
|
|
568
|
+
* required so a cache key never publishes a torn path state.
|
|
569
|
+
*/
|
|
570
|
+
export declare function captureWatchInputBaseline(file: string, filesystem?: TtscTransformFilesystemOperations): TtscWatchInputBaseline | undefined;
|
|
571
|
+
/** Compare generation evidence with the main process's exact key baseline. */
|
|
572
|
+
export declare function watchInputEvidenceMatchesBaseline(evidence: TtscWatchInputEvidence, baseline: TtscWatchInputKeyBaseline): boolean;
|
|
573
|
+
/** Validate the complete narrow or broad shape stored in a key baseline. */
|
|
574
|
+
export declare function isWatchInputKeyBaseline(baseline: unknown): baseline is TtscWatchInputKeyBaseline;
|
|
495
575
|
/**
|
|
496
576
|
* Build a comparison key for a path without changing the spelling handed to a
|
|
497
577
|
* filesystem or bundler. Windows is case-insensitive; macOS is probed per
|