@ttsc/unplugin 0.30.2 → 0.30.4
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/bun.js +3 -16
- package/lib/bun.js.map +1 -1
- package/lib/bun.mjs +3 -16
- package/lib/bun.mjs.map +1 -1
- package/lib/core/esbuild.d.cts +4 -0
- package/lib/core/esbuild.d.mts +4 -0
- package/lib/core/esbuild.d.ts +4 -0
- package/lib/core/esbuild.js +110 -0
- package/lib/core/esbuild.js.map +1 -0
- package/lib/core/esbuild.mjs +108 -0
- package/lib/core/esbuild.mjs.map +1 -0
- package/lib/core/index.js +60 -89
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +61 -90
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/transform.d.cts +18 -8
- package/lib/core/transform.d.mts +18 -8
- package/lib/core/transform.d.ts +18 -8
- package/lib/core/transform.js +472 -125
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +472 -125
- package/lib/core/transform.mjs.map +1 -1
- package/lib/core/viteServe.d.cts +35 -38
- package/lib/core/viteServe.d.mts +35 -38
- package/lib/core/viteServe.d.ts +35 -38
- package/lib/core/viteServe.js +731 -94
- package/lib/core/viteServe.js.map +1 -1
- package/lib/core/viteServe.mjs +732 -94
- package/lib/core/viteServe.mjs.map +1 -1
- package/package.json +3 -3
- package/src/bun.ts +2 -17
- package/src/core/esbuild.ts +127 -0
- package/src/core/index.ts +62 -100
- package/src/core/transform.ts +620 -170
- package/src/core/viteServe.ts +838 -157
package/lib/core/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
1
|
import { createUnplugin } from 'unplugin';
|
|
2
|
+
import { createEsbuildOptions } from './esbuild.mjs';
|
|
4
3
|
import { resolveOptions } from './options.mjs';
|
|
5
4
|
import { typescriptTransformSourcePattern } from './sourceExtensions.mjs';
|
|
6
5
|
import { createTtscTransformCache, stripQuery, transformTtsc, beginTtscTransformBuild, resetTtscTransformCache, isDeclarationFile } from './transform.mjs';
|
|
7
6
|
export { captureWatchInputBaseline, captureWatchInputFileBaseline, collectExternalInputHashes, collectProjectInputHashSnapshot, collectProjectInputHashes, isProjectWalkPath, isWatchInputKeyBaseline, watchInputEvidenceMatchesBaseline } from './transform.mjs';
|
|
8
|
-
import {
|
|
7
|
+
import { createViteServeInputWatch } from './viteServe.mjs';
|
|
9
8
|
export { mergeMembershipPolicyOverlay, readProjectMembershipPolicy, readTsconfigSourceSnapshot } from './tsconfigPaths.mjs';
|
|
10
9
|
export { discoverNearestProjectTsconfig, findNearestProjectTsconfig, findProjectTsconfigs } from './projectDiscovery.mjs';
|
|
11
10
|
|
|
@@ -41,10 +40,13 @@ const virtualModulePattern = /\0/;
|
|
|
41
40
|
* server configured without a watcher takes the pass lifecycle with them,
|
|
42
41
|
* having declared it will observe no edit at all.
|
|
43
42
|
*/
|
|
44
|
-
const unpluginFactory = (rawOptions = {}) => {
|
|
43
|
+
const unpluginFactory = (rawOptions = {}, meta) => {
|
|
45
44
|
const options = resolveOptions(rawOptions);
|
|
45
|
+
if (meta.framework === "esbuild") {
|
|
46
|
+
return createEsbuildOptions(options, isTransformTarget);
|
|
47
|
+
}
|
|
46
48
|
const transformCache = createTtscTransformCache();
|
|
47
|
-
const
|
|
49
|
+
const serveInputs = createViteServeInputWatch();
|
|
48
50
|
let aliases;
|
|
49
51
|
let viteCommand;
|
|
50
52
|
let viteWatching = true;
|
|
@@ -59,13 +61,6 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
59
61
|
// old containers cannot dispose a replacement's freshly initialized cache.
|
|
60
62
|
let viteBuildOwners = new WeakSet();
|
|
61
63
|
let viteBuildLifecycles = 0;
|
|
62
|
-
// esbuild schedules one-shot onDispose callbacks after it settles the build
|
|
63
|
-
// Promise. Acquire ownership only at onStart: plugin setup runs before build
|
|
64
|
-
// option validation, and a validation failure has no onDispose callback with
|
|
65
|
-
// which to release a setup-time owner. Once a build has actually started, the
|
|
66
|
-
// count keeps an older delayed callback from disposing its active generation.
|
|
67
|
-
const esbuildOwners = new WeakSet();
|
|
68
|
-
let esbuildLifecycles = 0;
|
|
69
64
|
return {
|
|
70
65
|
name,
|
|
71
66
|
enforce: "pre",
|
|
@@ -95,14 +90,15 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
95
90
|
viteBuildWatching =
|
|
96
91
|
config.build?.watch != null;
|
|
97
92
|
},
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
// hook can route watch inputs that do not exist yet — superseding
|
|
102
|
-
// resolution candidates above all — around that graph and still
|
|
103
|
-
// invalidate their importers when the path is created.
|
|
93
|
+
// Compiler dependencies belong to the filesystem watch graph. Vite's
|
|
94
|
+
// transform-context addWatchFile also inserts runtime imports, so none
|
|
95
|
+
// of those dependencies may use that channel during serve (#1368).
|
|
104
96
|
configureServer(server) {
|
|
105
|
-
|
|
97
|
+
serveInputs.attach(server);
|
|
98
|
+
},
|
|
99
|
+
watchChange(id, change) {
|
|
100
|
+
if (change.event === "delete")
|
|
101
|
+
serveInputs.forget(stripQuery(id));
|
|
106
102
|
},
|
|
107
103
|
// Vite calls buildEnd when the dev server closes, and Rollup calls it at
|
|
108
104
|
// the end of every build phase; drop every poller and, once the last
|
|
@@ -119,15 +115,15 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
119
115
|
// fixing one of the two sites alone left this host recompiling the whole
|
|
120
116
|
// project per edit (samchon/ttsc#1301). The watching build hands its
|
|
121
117
|
// teardown to `closeWatcher` below instead.
|
|
122
|
-
buildEnd() {
|
|
118
|
+
async buildEnd() {
|
|
123
119
|
if (viteBuildOwners.delete(this)) {
|
|
124
120
|
viteBuildLifecycles -= 1;
|
|
125
121
|
}
|
|
126
122
|
if (viteBuildLifecycles === 0) {
|
|
127
|
-
missingInputs.dispose();
|
|
128
123
|
if (viteCommand === "serve" || !viteBuildWatching) {
|
|
129
124
|
resetTtscTransformCache(transformCache);
|
|
130
125
|
}
|
|
126
|
+
await serveInputs.dispose();
|
|
131
127
|
}
|
|
132
128
|
},
|
|
133
129
|
// The watching build's real teardown, and the only hook in a
|
|
@@ -144,11 +140,11 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
144
140
|
// `buildEnd` would then decrement a counter that is already zero and
|
|
145
141
|
// strand it below zero, after which the disposal above could never fire
|
|
146
142
|
// again for this plugin instance.
|
|
147
|
-
closeWatcher() {
|
|
143
|
+
async closeWatcher() {
|
|
148
144
|
viteBuildOwners = new WeakSet();
|
|
149
145
|
viteBuildLifecycles = 0;
|
|
150
|
-
missingInputs.dispose();
|
|
151
146
|
resetTtscTransformCache(transformCache);
|
|
147
|
+
await serveInputs.dispose();
|
|
152
148
|
},
|
|
153
149
|
},
|
|
154
150
|
// Rollup and Rolldown carry none of the Vite block's hooks, so before this
|
|
@@ -198,23 +194,14 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
198
194
|
resetTtscTransformCache(transformCache);
|
|
199
195
|
});
|
|
200
196
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
build.onDispose(() => {
|
|
210
|
-
if (!esbuildOwners.delete(build)) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
esbuildLifecycles -= 1;
|
|
214
|
-
if (esbuildLifecycles === 0) {
|
|
215
|
-
resetTtscTransformCache(transformCache);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
197
|
+
farm: {
|
|
198
|
+
// Farm calls buildStart only for the initial compilation. Every update
|
|
199
|
+
// opens a new pass so a failed verdict can recover, while an unchanged
|
|
200
|
+
// successful generation remains reusable across its module deliveries.
|
|
201
|
+
updateModules: {
|
|
202
|
+
executor() {
|
|
203
|
+
beginTtscTransformBuild(transformCache);
|
|
204
|
+
},
|
|
218
205
|
},
|
|
219
206
|
},
|
|
220
207
|
buildStart() {
|
|
@@ -257,59 +244,43 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
257
244
|
if (!isTransformTarget(file)) {
|
|
258
245
|
return undefined;
|
|
259
246
|
}
|
|
247
|
+
// The project-root observer is already live when a Vite serve transform
|
|
248
|
+
// begins. Its sequence token lets registration prove only inputs that
|
|
249
|
+
// could have changed during compilation, instead of synchronously
|
|
250
|
+
// re-reading every input in a large compiler graph.
|
|
251
|
+
const serveStartedAt = viteCommand === "serve" && viteWatching
|
|
252
|
+
? serveInputs.begin()
|
|
253
|
+
: undefined;
|
|
260
254
|
return transformTtsc(file, source, options, aliases, transformCache, {
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// missing paths and directories, so those are watched against their
|
|
269
|
-
// compiler predicates instead and invalidate this module when the
|
|
270
|
-
// observation changes.
|
|
271
|
-
addWatchFile: (watched, evidence) => {
|
|
272
|
-
if (viteCommand === "serve" && missingInputs.serving()) {
|
|
273
|
-
const observation = evidence?.state?.codec === "predicates"
|
|
274
|
-
? evidence.state.observation
|
|
275
|
-
: undefined;
|
|
276
|
-
const unsafePredicate = observation !== undefined &&
|
|
277
|
-
observation.fileExists !== true &&
|
|
278
|
-
observation.stat !== "file" &&
|
|
279
|
-
observation.readFile?.ok !== true
|
|
280
|
-
? observation
|
|
281
|
-
: undefined;
|
|
282
|
-
if (unsafePredicate !== undefined) {
|
|
283
|
-
missingInputs.watch(watched, path.resolve(file), unsafePredicate);
|
|
284
|
-
return;
|
|
255
|
+
// A watcherless server has no invalidation channel and needs no
|
|
256
|
+
// watch-input derivation. Every other host keeps its native contract.
|
|
257
|
+
addWatchFiles: viteCommand === "serve" && !viteWatching
|
|
258
|
+
? undefined
|
|
259
|
+
: (inputs, failed) => {
|
|
260
|
+
if (viteCommand === "serve") {
|
|
261
|
+
serveInputs.replace(file, inputs, failed, serveStartedAt);
|
|
285
262
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
263
|
+
else {
|
|
264
|
+
const native = this.getNativeBuildContext?.();
|
|
265
|
+
for (const input of inputs) {
|
|
266
|
+
if (native?.framework === "rspack" &&
|
|
267
|
+
native.loaderContext !== undefined) {
|
|
268
|
+
// Compilation-level dependencies schedule a pass but do
|
|
269
|
+
// not invalidate Rspack's cached transformed modules.
|
|
270
|
+
if (input.evidence?.missing === true)
|
|
271
|
+
native.loaderContext.addMissingDependency(input.file);
|
|
272
|
+
else
|
|
273
|
+
native.loaderContext.addDependency(input.file);
|
|
274
|
+
}
|
|
275
|
+
else if (native?.framework === "farm") {
|
|
276
|
+
native.context.addWatchFile(file, input.file);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.addWatchFile(input.file);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
300
282
|
}
|
|
301
|
-
}
|
|
302
|
-
// A dev server configured without a watcher can never deliver a
|
|
303
|
-
// change event, so a registration here buys nothing, and it is not
|
|
304
|
-
// free: Vite's import analysis resolves every registered path like a
|
|
305
|
-
// real import of the transformed module, once per module. The
|
|
306
|
-
// adapter's own missing-input poll above stays active either way,
|
|
307
|
-
// because it never depended on Vite's watcher.
|
|
308
|
-
if (viteCommand === "serve" && !viteWatching) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
this.addWatchFile(watched);
|
|
312
|
-
},
|
|
283
|
+
},
|
|
313
284
|
// A module the plugin declared volatile depends on non-file inputs,
|
|
314
285
|
// which no file-dependency snapshot can represent; mark it
|
|
315
286
|
// uncacheable where the bundler exposes that control.
|
package/lib/core/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAyBA,MAAM,IAAI,GAAG,eAAe;AAC5B;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG;AACjC;AACA,MAAM,kBAAkB,GAAG,oCAAoC;AAC/D;;;AAGG;AACH,MAAM,oBAAoB,GAAG,IAAI;AAEjC;;;;;;;;;;;;;AAaG;AACH,MAAM,eAAe,GAGjB,CAAC,UAAU,GAAG,EAAE,EAAE,IAAI,KAAI;AAC5B,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC;AAC1C,IAAA,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;AAChC,QAAA,OAAO,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACzD;AACA,IAAA,MAAM,cAAc,GAAG,wBAAwB,EAAE;AACjD,IAAA,MAAM,WAAW,GAAG,yBAAyB,EAAE;AAC/C,IAAA,IAAI,OAAgB;AACpB,IAAA,IAAI,WAA+B;IACnC,IAAI,YAAY,GAAG,IAAI;;;;;IAKvB,IAAI,iBAAiB,GAAG,KAAK;;;;;AAK7B,IAAA,IAAI,eAAe,GAAG,IAAI,OAAO,EAAU;IAC3C,IAAI,mBAAmB,GAAG,CAAC;IAE3B,OAAO;QACL,IAAI;AACJ,QAAA,OAAO,EAAE,KAAK;AAEd,QAAA,IAAI,EAAE;AACJ,YAAA,cAAc,CAAC,MAAM,EAAA;AACnB,gBAAA,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;;;;;AAK9B,gBAAA,WAAW,GAAG,MAAM,CAAC,OAAO;;;;;;;;;gBAS5B,YAAY;AACT,oBAAA,MAA2C,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI;;;;;;gBAMrE,iBAAiB;AACd,oBAAA,MAA0C,CAAC,KAAK,EAAE,KAAK,IAAI,IAAI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M,GAAG,IAAI,CAAC,qBAAqB,IAAI;AAC7C,oBAAA,IACE,MAAM,EAAE,SAAS,KAAK,SAAS;AAC/B,wBAAA,MAAM,EAAE,SAAS,KAAK,QAAQ,EAC9B;wBACA,MAAM,CAAC,aAAa,EAAE,SAAS,GAAG,KAAK,CAAC;oBAC1C;gBACF,CAAC;AACF,aAAA,CAAC;QACJ,CAAC;KACF;AACH,CAAC;AAED,MAAM,QAAQ,GACZ,cAAc,CAAC,eAAe;AAwDhC;;;;;;;;;;;AAWG;AACG,SAAU,iBAAiB,CAAC,EAAU,EAAA;AAC1C,IAAA,QACE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,QAAA,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,CAAC,iBAAiB,CAAC,EAAE,CAAC;AACtB,QAAA,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;AAEhC;;;;"}
|
package/lib/core/transform.d.cts
CHANGED
|
@@ -56,6 +56,8 @@ interface TtscProjectMutationTracker {
|
|
|
56
56
|
* whole, which cannot answer for one name.
|
|
57
57
|
*/
|
|
58
58
|
covered?: ReadonlySet<string>;
|
|
59
|
+
/** Whether this is the repository-owned backend with content-event coverage. */
|
|
60
|
+
contentAuthoritative?: boolean;
|
|
59
61
|
/**
|
|
60
62
|
* Wait until every event this tracker's watcher has already dispatched has
|
|
61
63
|
* been applied to it.
|
|
@@ -69,6 +71,8 @@ interface TtscProjectMutationTracker {
|
|
|
69
71
|
drain?: () => Promise<void>;
|
|
70
72
|
failed: boolean;
|
|
71
73
|
membershipChanged: boolean;
|
|
74
|
+
/** Compare event and input paths through this tracker's filesystem identity. */
|
|
75
|
+
overlaps?: (input: string, changed: string) => boolean;
|
|
72
76
|
settle?: Promise<void>;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
@@ -303,7 +307,7 @@ export interface TtscTransformFilesystemOperations {
|
|
|
303
307
|
* native abort Node's Windows fs-event backend can raise when a watched
|
|
304
308
|
* temporary tree is deleted.
|
|
305
309
|
*/
|
|
306
|
-
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void): {
|
|
310
|
+
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void, recursive?: boolean): {
|
|
307
311
|
close: () => void;
|
|
308
312
|
};
|
|
309
313
|
}
|
|
@@ -425,10 +429,12 @@ export interface TtscTransformHooks {
|
|
|
425
429
|
addWatchFile?: (file: string, evidence?: TtscWatchInputEvidence) => void;
|
|
426
430
|
/**
|
|
427
431
|
* Batched form of {@link addWatchFile}. When supplied, the transform calls it
|
|
428
|
-
* once per delivered module and does not call `addWatchFile` for that
|
|
429
|
-
*
|
|
432
|
+
* once per delivered module and does not call `addWatchFile` for that module.
|
|
433
|
+
* `failed` marks a recovery batch: a failed compiler can omit inputs from its
|
|
434
|
+
* previous successful result, so replacing hosts should retain those
|
|
435
|
+
* spellings until the next successful delivery.
|
|
430
436
|
*/
|
|
431
|
-
addWatchFiles?: (inputs: readonly TtscWatchInput[]) => void;
|
|
437
|
+
addWatchFiles?: (inputs: readonly TtscWatchInput[], failed?: boolean) => void;
|
|
432
438
|
/**
|
|
433
439
|
* Invoked when the plugin declared the transformed file volatile (the
|
|
434
440
|
* envelope's `volatile` list): its output depends on non-file inputs that no
|
|
@@ -467,10 +473,14 @@ interface TtscHostInputValidation {
|
|
|
467
473
|
readonly entries: Map<string, {
|
|
468
474
|
path: string;
|
|
469
475
|
/**
|
|
470
|
-
* Whether the recorded state of this input
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* bytes
|
|
476
|
+
* Whether the recorded state of this input has been matched to readable
|
|
477
|
+
* bytes. Capture sets it immediately for compiler-proven inputs; a
|
|
478
|
+
* current module supplied from an editor buffer can earn it later after
|
|
479
|
+
* its disk bytes match the recorded source.
|
|
480
|
+
*
|
|
481
|
+
* An input that still cannot be read records a missing state, so no
|
|
482
|
+
* signature may stand in for it: its metadata holds still while the bytes
|
|
483
|
+
* behind it appear.
|
|
474
484
|
*/
|
|
475
485
|
readable: boolean;
|
|
476
486
|
realpath: string | null;
|
package/lib/core/transform.d.mts
CHANGED
|
@@ -56,6 +56,8 @@ interface TtscProjectMutationTracker {
|
|
|
56
56
|
* whole, which cannot answer for one name.
|
|
57
57
|
*/
|
|
58
58
|
covered?: ReadonlySet<string>;
|
|
59
|
+
/** Whether this is the repository-owned backend with content-event coverage. */
|
|
60
|
+
contentAuthoritative?: boolean;
|
|
59
61
|
/**
|
|
60
62
|
* Wait until every event this tracker's watcher has already dispatched has
|
|
61
63
|
* been applied to it.
|
|
@@ -69,6 +71,8 @@ interface TtscProjectMutationTracker {
|
|
|
69
71
|
drain?: () => Promise<void>;
|
|
70
72
|
failed: boolean;
|
|
71
73
|
membershipChanged: boolean;
|
|
74
|
+
/** Compare event and input paths through this tracker's filesystem identity. */
|
|
75
|
+
overlaps?: (input: string, changed: string) => boolean;
|
|
72
76
|
settle?: Promise<void>;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
@@ -303,7 +307,7 @@ export interface TtscTransformFilesystemOperations {
|
|
|
303
307
|
* native abort Node's Windows fs-event backend can raise when a watched
|
|
304
308
|
* temporary tree is deleted.
|
|
305
309
|
*/
|
|
306
|
-
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void): {
|
|
310
|
+
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void, recursive?: boolean): {
|
|
307
311
|
close: () => void;
|
|
308
312
|
};
|
|
309
313
|
}
|
|
@@ -425,10 +429,12 @@ export interface TtscTransformHooks {
|
|
|
425
429
|
addWatchFile?: (file: string, evidence?: TtscWatchInputEvidence) => void;
|
|
426
430
|
/**
|
|
427
431
|
* Batched form of {@link addWatchFile}. When supplied, the transform calls it
|
|
428
|
-
* once per delivered module and does not call `addWatchFile` for that
|
|
429
|
-
*
|
|
432
|
+
* once per delivered module and does not call `addWatchFile` for that module.
|
|
433
|
+
* `failed` marks a recovery batch: a failed compiler can omit inputs from its
|
|
434
|
+
* previous successful result, so replacing hosts should retain those
|
|
435
|
+
* spellings until the next successful delivery.
|
|
430
436
|
*/
|
|
431
|
-
addWatchFiles?: (inputs: readonly TtscWatchInput[]) => void;
|
|
437
|
+
addWatchFiles?: (inputs: readonly TtscWatchInput[], failed?: boolean) => void;
|
|
432
438
|
/**
|
|
433
439
|
* Invoked when the plugin declared the transformed file volatile (the
|
|
434
440
|
* envelope's `volatile` list): its output depends on non-file inputs that no
|
|
@@ -467,10 +473,14 @@ interface TtscHostInputValidation {
|
|
|
467
473
|
readonly entries: Map<string, {
|
|
468
474
|
path: string;
|
|
469
475
|
/**
|
|
470
|
-
* Whether the recorded state of this input
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* bytes
|
|
476
|
+
* Whether the recorded state of this input has been matched to readable
|
|
477
|
+
* bytes. Capture sets it immediately for compiler-proven inputs; a
|
|
478
|
+
* current module supplied from an editor buffer can earn it later after
|
|
479
|
+
* its disk bytes match the recorded source.
|
|
480
|
+
*
|
|
481
|
+
* An input that still cannot be read records a missing state, so no
|
|
482
|
+
* signature may stand in for it: its metadata holds still while the bytes
|
|
483
|
+
* behind it appear.
|
|
474
484
|
*/
|
|
475
485
|
readable: boolean;
|
|
476
486
|
realpath: string | null;
|
package/lib/core/transform.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ interface TtscProjectMutationTracker {
|
|
|
56
56
|
* whole, which cannot answer for one name.
|
|
57
57
|
*/
|
|
58
58
|
covered?: ReadonlySet<string>;
|
|
59
|
+
/** Whether this is the repository-owned backend with content-event coverage. */
|
|
60
|
+
contentAuthoritative?: boolean;
|
|
59
61
|
/**
|
|
60
62
|
* Wait until every event this tracker's watcher has already dispatched has
|
|
61
63
|
* been applied to it.
|
|
@@ -69,6 +71,8 @@ interface TtscProjectMutationTracker {
|
|
|
69
71
|
drain?: () => Promise<void>;
|
|
70
72
|
failed: boolean;
|
|
71
73
|
membershipChanged: boolean;
|
|
74
|
+
/** Compare event and input paths through this tracker's filesystem identity. */
|
|
75
|
+
overlaps?: (input: string, changed: string) => boolean;
|
|
72
76
|
settle?: Promise<void>;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
@@ -303,7 +307,7 @@ export interface TtscTransformFilesystemOperations {
|
|
|
303
307
|
* native abort Node's Windows fs-event backend can raise when a watched
|
|
304
308
|
* temporary tree is deleted.
|
|
305
309
|
*/
|
|
306
|
-
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void): {
|
|
310
|
+
watch?(directory: string, listener: (eventType: string, filename: string | null) => void, onError: () => void, recursive?: boolean): {
|
|
307
311
|
close: () => void;
|
|
308
312
|
};
|
|
309
313
|
}
|
|
@@ -425,10 +429,12 @@ export interface TtscTransformHooks {
|
|
|
425
429
|
addWatchFile?: (file: string, evidence?: TtscWatchInputEvidence) => void;
|
|
426
430
|
/**
|
|
427
431
|
* Batched form of {@link addWatchFile}. When supplied, the transform calls it
|
|
428
|
-
* once per delivered module and does not call `addWatchFile` for that
|
|
429
|
-
*
|
|
432
|
+
* once per delivered module and does not call `addWatchFile` for that module.
|
|
433
|
+
* `failed` marks a recovery batch: a failed compiler can omit inputs from its
|
|
434
|
+
* previous successful result, so replacing hosts should retain those
|
|
435
|
+
* spellings until the next successful delivery.
|
|
430
436
|
*/
|
|
431
|
-
addWatchFiles?: (inputs: readonly TtscWatchInput[]) => void;
|
|
437
|
+
addWatchFiles?: (inputs: readonly TtscWatchInput[], failed?: boolean) => void;
|
|
432
438
|
/**
|
|
433
439
|
* Invoked when the plugin declared the transformed file volatile (the
|
|
434
440
|
* envelope's `volatile` list): its output depends on non-file inputs that no
|
|
@@ -467,10 +473,14 @@ interface TtscHostInputValidation {
|
|
|
467
473
|
readonly entries: Map<string, {
|
|
468
474
|
path: string;
|
|
469
475
|
/**
|
|
470
|
-
* Whether the recorded state of this input
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* bytes
|
|
476
|
+
* Whether the recorded state of this input has been matched to readable
|
|
477
|
+
* bytes. Capture sets it immediately for compiler-proven inputs; a
|
|
478
|
+
* current module supplied from an editor buffer can earn it later after
|
|
479
|
+
* its disk bytes match the recorded source.
|
|
480
|
+
*
|
|
481
|
+
* An input that still cannot be read records a missing state, so no
|
|
482
|
+
* signature may stand in for it: its metadata holds still while the bytes
|
|
483
|
+
* behind it appear.
|
|
474
484
|
*/
|
|
475
485
|
readable: boolean;
|
|
476
486
|
realpath: string | null;
|