@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/viteServe.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ITtscCompilerTransformation } from "ttsc";
|
|
1
2
|
/** One module node inside a Vite module graph; opaque to this module. */
|
|
2
3
|
type ViteModuleNodeLike = object;
|
|
3
4
|
/**
|
|
@@ -35,24 +36,23 @@ export interface ViteDevServerLike {
|
|
|
35
36
|
ws?: ViteHotChannelLike;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
|
-
* Filesystem watch for derived watch inputs that
|
|
39
|
-
* server is running.
|
|
39
|
+
* Filesystem watch for derived watch inputs that Vite cannot safely register as
|
|
40
|
+
* added imports while a development server is running.
|
|
40
41
|
*
|
|
41
42
|
* Vite serve treats every transform-context `addWatchFile()` registration as an
|
|
42
43
|
* added import: `TransformPluginContext.addWatchFile` stores the path in
|
|
43
44
|
* `_addedImports`, and `vite:import-analysis` resolves each entry like a real
|
|
44
|
-
* import of the transformed module. A missing path
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* though the transform itself succeeded.
|
|
45
|
+
* import of the transformed module. A missing path or an existing directory
|
|
46
|
+
* that failed a compiler file predicate then fails that resolve and turns the
|
|
47
|
+
* importer's first request into a 500, even though the transform succeeded.
|
|
48
48
|
*
|
|
49
49
|
* This registry is the serve-only replacement for those registrations. Each
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* the new resolution winner. The
|
|
54
|
-
*
|
|
55
|
-
*
|
|
50
|
+
* path is polled until its exact compiler predicate observation changes; legacy
|
|
51
|
+
* envelopes retain their exists-or-file availability check. Its importers are
|
|
52
|
+
* then invalidated in the server's module graphs and one full-reload is sent,
|
|
53
|
+
* so the next request retransforms against the new resolution winner. The
|
|
54
|
+
* project transform cache re-validates the compiler observation, so the
|
|
55
|
+
* retransform recompiles instead of replaying.
|
|
56
56
|
*/
|
|
57
57
|
export interface ViteServeMissingInputWatch {
|
|
58
58
|
/** Adopt the dev server whose module graphs creation events invalidate. */
|
|
@@ -66,16 +66,13 @@ export interface ViteServeMissingInputWatch {
|
|
|
66
66
|
* config's `command`, as the adapter does.
|
|
67
67
|
*/
|
|
68
68
|
serving(): boolean;
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
* `identity` is the filesystem identity the transform generation already
|
|
73
|
-
* resolved for `input`. Resolving it here instead costs a `realpath` and a
|
|
74
|
-
* case-sensitivity directory listing per input per delivery, because a
|
|
75
|
-
* per-call identity context memoizes nothing (samchon/ttsc#1246).
|
|
76
|
-
*/
|
|
77
|
-
watch(input: string, importer: string, identity?: string): void;
|
|
69
|
+
/** Register one unsafe watch input and its exact recorded condition. */
|
|
70
|
+
watch(input: string, importer: string, condition: ViteServeInputWatchCondition): void;
|
|
78
71
|
}
|
|
72
|
+
/** A legacy availability condition or an exact compiler predicate proof. */
|
|
73
|
+
export type ViteServeInputWatchCondition = "exists" | "file" | ITtscCompilerTransformation.IInputObservation;
|
|
79
74
|
/** Create an empty missing-input watch for one plugin instance. */
|
|
80
75
|
export declare function createViteServeMissingInputWatch(): ViteServeMissingInputWatch;
|
|
76
|
+
/** Key a private poll by predicate and exact lexical spelling. */
|
|
77
|
+
export declare function viteServeMissingInputWatchKey(input: string, condition: ViteServeInputWatchCondition): string;
|
|
81
78
|
export {};
|
package/lib/core/viteServe.js
CHANGED
|
@@ -5,32 +5,56 @@ var path = require('node:path');
|
|
|
5
5
|
var transform = require('./transform.js');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* How often each registered
|
|
8
|
+
* How often each registered Vite-unsafe input is predicate-polled, in
|
|
9
9
|
* milliseconds.
|
|
10
10
|
*
|
|
11
11
|
* Polling is the only watch primitive that covers the whole class: the dev
|
|
12
12
|
* server's chokidar watcher ignores every `node_modules` directory, which is
|
|
13
13
|
* exactly where superseding resolution candidates usually live, and `fs.watch`
|
|
14
14
|
* cannot observe a path whose parent directories do not exist yet. One `stat`
|
|
15
|
-
* every half second per
|
|
16
|
-
* baseline.
|
|
15
|
+
* every half second per unavailable path is negligible against a dev server's
|
|
16
|
+
* baseline. Rich inputs replay only the predicates the compiler recorded.
|
|
17
17
|
*/
|
|
18
18
|
const MISSING_INPUT_POLL_INTERVAL = 500;
|
|
19
19
|
/** Create an empty missing-input watch for one plugin instance. */
|
|
20
20
|
function createViteServeMissingInputWatch() {
|
|
21
21
|
const entries = new Map();
|
|
22
|
+
let poller;
|
|
22
23
|
let server;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const stopPollingIfEmpty = () => {
|
|
25
|
+
if (entries.size !== 0 || poller === undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
clearInterval(poller);
|
|
29
|
+
poller = undefined;
|
|
30
|
+
};
|
|
31
|
+
const poll = () => {
|
|
32
|
+
const importers = new Set();
|
|
33
|
+
for (const [identity, entry] of entries) {
|
|
34
|
+
if (!viteServeInputWatchConditionChanged(entry)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
entries.delete(identity);
|
|
38
|
+
for (const importer of entry.importers) {
|
|
39
|
+
importers.add(importer);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
stopPollingIfEmpty();
|
|
43
|
+
if (server === undefined || importers.size === 0) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
invalidateImporters(server, importers);
|
|
47
|
+
sendFullReload(server);
|
|
26
48
|
};
|
|
27
49
|
return {
|
|
28
50
|
attach(next) {
|
|
29
51
|
server = next;
|
|
30
52
|
},
|
|
31
53
|
dispose() {
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
entries.clear();
|
|
55
|
+
if (poller !== undefined) {
|
|
56
|
+
clearInterval(poller);
|
|
57
|
+
poller = undefined;
|
|
34
58
|
}
|
|
35
59
|
// The server reference deliberately survives: `vite.restartServer`
|
|
36
60
|
// configures the replacement server (attach) before it closes the old
|
|
@@ -42,56 +66,72 @@ function createViteServeMissingInputWatch() {
|
|
|
42
66
|
serving() {
|
|
43
67
|
return server !== undefined;
|
|
44
68
|
},
|
|
45
|
-
watch(input, importer,
|
|
69
|
+
watch(input, importer, condition) {
|
|
46
70
|
const spelling = path.resolve(input);
|
|
47
|
-
const identity =
|
|
71
|
+
const identity = viteServeMissingInputWatchKey(spelling, condition);
|
|
48
72
|
const existing = entries.get(identity);
|
|
49
73
|
if (existing !== undefined) {
|
|
50
74
|
existing.importers.add(path.resolve(importer));
|
|
51
75
|
return;
|
|
52
76
|
}
|
|
53
|
-
|
|
77
|
+
entries.set(identity, {
|
|
78
|
+
condition,
|
|
54
79
|
importers: new Set([path.resolve(importer)]),
|
|
55
|
-
listener: (current) => {
|
|
56
|
-
// `fs.watchFile` reports a missing path as zeroed stats (and fires
|
|
57
|
-
// once with them right after registration); only a poll that
|
|
58
|
-
// observes a real file is a creation event.
|
|
59
|
-
if (current.mtimeMs === 0 && !fs.existsSync(entry.spelling)) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
unwatch(identity, entry);
|
|
63
|
-
if (server === undefined) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
invalidateImporters(server, entry.importers);
|
|
67
|
-
sendFullReload(server);
|
|
68
|
-
},
|
|
69
80
|
spelling,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// only on a subsequent change, so a file created between the adapter's
|
|
77
|
-
// existence check and this registration would count as "unchanged" and
|
|
78
|
-
// never fire. One deferred recheck closes that window; routing through
|
|
79
|
-
// the listener keeps a single finalization path.
|
|
80
|
-
const recheck = setTimeout(() => {
|
|
81
|
-
if (entries.get(identity) !== entry) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
entry.listener(fs.statSync(entry.spelling));
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
// Still missing (or deleted again): the ordinary poll stays armed.
|
|
89
|
-
}
|
|
90
|
-
}, MISSING_INPUT_POLL_INTERVAL);
|
|
91
|
-
recheck.unref?.();
|
|
81
|
+
});
|
|
82
|
+
if (poller === undefined) {
|
|
83
|
+
poller = setInterval(poll, MISSING_INPUT_POLL_INTERVAL);
|
|
84
|
+
// A poller must never keep the dev-server process alive on its own.
|
|
85
|
+
poller.unref?.();
|
|
86
|
+
}
|
|
92
87
|
},
|
|
93
88
|
};
|
|
94
89
|
}
|
|
90
|
+
/** Key a private poll by predicate and exact lexical spelling. */
|
|
91
|
+
function viteServeMissingInputWatchKey(input, condition) {
|
|
92
|
+
// Missing aliases can share a physical parent now and later retarget or
|
|
93
|
+
// diverge. Neither predicate may let one lexical spelling answer for another.
|
|
94
|
+
const predicate = typeof condition === "string"
|
|
95
|
+
? condition
|
|
96
|
+
: `predicates:${JSON.stringify([
|
|
97
|
+
condition.accessibleEntries === undefined
|
|
98
|
+
? null
|
|
99
|
+
: [
|
|
100
|
+
condition.accessibleEntries.directories,
|
|
101
|
+
condition.accessibleEntries.files,
|
|
102
|
+
],
|
|
103
|
+
condition.directoryExists ?? null,
|
|
104
|
+
condition.fileExists ?? null,
|
|
105
|
+
condition.readFile === undefined
|
|
106
|
+
? null
|
|
107
|
+
: condition.readFile.ok
|
|
108
|
+
? [true, condition.readFile.hash]
|
|
109
|
+
: [false],
|
|
110
|
+
condition.realpath === undefined
|
|
111
|
+
? null
|
|
112
|
+
: condition.realpath.ok
|
|
113
|
+
? [true, condition.realpath.path]
|
|
114
|
+
: [false],
|
|
115
|
+
condition.stat ?? null,
|
|
116
|
+
])}`;
|
|
117
|
+
return `${predicate}:${path.resolve(input)}`;
|
|
118
|
+
}
|
|
119
|
+
/** Whether one registered condition no longer describes its lexical path. */
|
|
120
|
+
function viteServeInputWatchConditionChanged(entry) {
|
|
121
|
+
if (typeof entry.condition !== "string") {
|
|
122
|
+
return (transform.validateGraphInputObservation(entry.spelling, entry.condition).length !==
|
|
123
|
+
0);
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
if (!fs.existsSync(entry.spelling)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return (entry.condition === "exists" || !fs.statSync(entry.spelling).isDirectory());
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
95
135
|
/**
|
|
96
136
|
* Invalidate every module-graph node of the registered importers so the next
|
|
97
137
|
* request retransforms them. Importers keep their original absolute spelling so
|
|
@@ -177,4 +217,5 @@ function sendFullReload(server) {
|
|
|
177
217
|
}
|
|
178
218
|
|
|
179
219
|
exports.createViteServeMissingInputWatch = createViteServeMissingInputWatch;
|
|
220
|
+
exports.viteServeMissingInputWatchKey = viteServeMissingInputWatchKey;
|
|
180
221
|
//# sourceMappingURL=viteServe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viteServe.js","sources":["../../src/core/viteServe.ts"],"sourcesContent":[null],"names":["pathIdentityKey"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"viteServe.js","sources":["../../src/core/viteServe.ts"],"sourcesContent":[null],"names":["validateGraphInputObservation","pathIdentityKey"],"mappings":";;;;;;AAMA;;;;;;;;;;AAUG;AACH,MAAM,2BAA2B,GAAG,GAAG;AA4FvC;SACgB,gCAAgC,GAAA;AAC9C,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B;AACrD,IAAA,IAAI,MAAkC;AACtC,IAAA,IAAI,MAAqC;IAEzC,MAAM,kBAAkB,GAAG,MAAW;QACpC,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,IAAI,MAAM,KAAK,SAAS,EAAE;YAC9C;QACF;QACA,aAAa,CAAC,MAAM,CAAC;QACrB,MAAM,GAAG,SAAS;AACpB,IAAA,CAAC;IACD,MAAM,IAAI,GAAG,MAAW;AACtB,QAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU;QACnC,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE;AACvC,YAAA,IAAI,CAAC,mCAAmC,CAAC,KAAK,CAAC,EAAE;gBAC/C;YACF;AACA,YAAA,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;AACxB,YAAA,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,S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1B,QAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACrE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;AAC7C,QAAA,OAAO,CAAC,GAAG,MAAM,CAAC;IACpB;AACA,IAAA,MAAM,QAAQ,GAAGC,yBAAe,CAAC,QAAQ,CAAC;IAC1C,MAAM,MAAM,GAAyB,EAAE;AACvC,IAAA,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,gBAAgB,IAAI,EAAE,EAAE;AACxD,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAIA,yBAAe,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;AAClE,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB;IACF;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;AAIG;AACH,SAAS,cAAc,CAAC,MAAyB,EAAA;IAC/C,KAAK,MAAM,OAAO,IAAI;AACpB,QAAA,MAAM,CAAC,EAAE;AACT,QAAA,MAAM,CAAC,GAAG;AACV,QAAA,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG;AACjC,KAAA,EAAE;AACD,QAAA,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE;YAC/B;QACF;AACA,QAAA,IAAI;AACF,YAAA,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;YAChD;QACF;AAAE,QAAA,MAAM;;;QAGR;IACF;AACF;;;;;"}
|
package/lib/core/viteServe.mjs
CHANGED
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { pathIdentityKey } from './transform.mjs';
|
|
3
|
+
import { validateGraphInputObservation, pathIdentityKey } from './transform.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* How often each registered
|
|
6
|
+
* How often each registered Vite-unsafe input is predicate-polled, in
|
|
7
7
|
* milliseconds.
|
|
8
8
|
*
|
|
9
9
|
* Polling is the only watch primitive that covers the whole class: the dev
|
|
10
10
|
* server's chokidar watcher ignores every `node_modules` directory, which is
|
|
11
11
|
* exactly where superseding resolution candidates usually live, and `fs.watch`
|
|
12
12
|
* cannot observe a path whose parent directories do not exist yet. One `stat`
|
|
13
|
-
* every half second per
|
|
14
|
-
* baseline.
|
|
13
|
+
* every half second per unavailable path is negligible against a dev server's
|
|
14
|
+
* baseline. Rich inputs replay only the predicates the compiler recorded.
|
|
15
15
|
*/
|
|
16
16
|
const MISSING_INPUT_POLL_INTERVAL = 500;
|
|
17
17
|
/** Create an empty missing-input watch for one plugin instance. */
|
|
18
18
|
function createViteServeMissingInputWatch() {
|
|
19
19
|
const entries = new Map();
|
|
20
|
+
let poller;
|
|
20
21
|
let server;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const stopPollingIfEmpty = () => {
|
|
23
|
+
if (entries.size !== 0 || poller === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
clearInterval(poller);
|
|
27
|
+
poller = undefined;
|
|
28
|
+
};
|
|
29
|
+
const poll = () => {
|
|
30
|
+
const importers = new Set();
|
|
31
|
+
for (const [identity, entry] of entries) {
|
|
32
|
+
if (!viteServeInputWatchConditionChanged(entry)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
entries.delete(identity);
|
|
36
|
+
for (const importer of entry.importers) {
|
|
37
|
+
importers.add(importer);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
stopPollingIfEmpty();
|
|
41
|
+
if (server === undefined || importers.size === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
invalidateImporters(server, importers);
|
|
45
|
+
sendFullReload(server);
|
|
24
46
|
};
|
|
25
47
|
return {
|
|
26
48
|
attach(next) {
|
|
27
49
|
server = next;
|
|
28
50
|
},
|
|
29
51
|
dispose() {
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
entries.clear();
|
|
53
|
+
if (poller !== undefined) {
|
|
54
|
+
clearInterval(poller);
|
|
55
|
+
poller = undefined;
|
|
32
56
|
}
|
|
33
57
|
// The server reference deliberately survives: `vite.restartServer`
|
|
34
58
|
// configures the replacement server (attach) before it closes the old
|
|
@@ -40,56 +64,72 @@ function createViteServeMissingInputWatch() {
|
|
|
40
64
|
serving() {
|
|
41
65
|
return server !== undefined;
|
|
42
66
|
},
|
|
43
|
-
watch(input, importer,
|
|
67
|
+
watch(input, importer, condition) {
|
|
44
68
|
const spelling = path.resolve(input);
|
|
45
|
-
const identity =
|
|
69
|
+
const identity = viteServeMissingInputWatchKey(spelling, condition);
|
|
46
70
|
const existing = entries.get(identity);
|
|
47
71
|
if (existing !== undefined) {
|
|
48
72
|
existing.importers.add(path.resolve(importer));
|
|
49
73
|
return;
|
|
50
74
|
}
|
|
51
|
-
|
|
75
|
+
entries.set(identity, {
|
|
76
|
+
condition,
|
|
52
77
|
importers: new Set([path.resolve(importer)]),
|
|
53
|
-
listener: (current) => {
|
|
54
|
-
// `fs.watchFile` reports a missing path as zeroed stats (and fires
|
|
55
|
-
// once with them right after registration); only a poll that
|
|
56
|
-
// observes a real file is a creation event.
|
|
57
|
-
if (current.mtimeMs === 0 && !fs.existsSync(entry.spelling)) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
unwatch(identity, entry);
|
|
61
|
-
if (server === undefined) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
invalidateImporters(server, entry.importers);
|
|
65
|
-
sendFullReload(server);
|
|
66
|
-
},
|
|
67
78
|
spelling,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// only on a subsequent change, so a file created between the adapter's
|
|
75
|
-
// existence check and this registration would count as "unchanged" and
|
|
76
|
-
// never fire. One deferred recheck closes that window; routing through
|
|
77
|
-
// the listener keeps a single finalization path.
|
|
78
|
-
const recheck = setTimeout(() => {
|
|
79
|
-
if (entries.get(identity) !== entry) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
try {
|
|
83
|
-
entry.listener(fs.statSync(entry.spelling));
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
// Still missing (or deleted again): the ordinary poll stays armed.
|
|
87
|
-
}
|
|
88
|
-
}, MISSING_INPUT_POLL_INTERVAL);
|
|
89
|
-
recheck.unref?.();
|
|
79
|
+
});
|
|
80
|
+
if (poller === undefined) {
|
|
81
|
+
poller = setInterval(poll, MISSING_INPUT_POLL_INTERVAL);
|
|
82
|
+
// A poller must never keep the dev-server process alive on its own.
|
|
83
|
+
poller.unref?.();
|
|
84
|
+
}
|
|
90
85
|
},
|
|
91
86
|
};
|
|
92
87
|
}
|
|
88
|
+
/** Key a private poll by predicate and exact lexical spelling. */
|
|
89
|
+
function viteServeMissingInputWatchKey(input, condition) {
|
|
90
|
+
// Missing aliases can share a physical parent now and later retarget or
|
|
91
|
+
// diverge. Neither predicate may let one lexical spelling answer for another.
|
|
92
|
+
const predicate = typeof condition === "string"
|
|
93
|
+
? condition
|
|
94
|
+
: `predicates:${JSON.stringify([
|
|
95
|
+
condition.accessibleEntries === undefined
|
|
96
|
+
? null
|
|
97
|
+
: [
|
|
98
|
+
condition.accessibleEntries.directories,
|
|
99
|
+
condition.accessibleEntries.files,
|
|
100
|
+
],
|
|
101
|
+
condition.directoryExists ?? null,
|
|
102
|
+
condition.fileExists ?? null,
|
|
103
|
+
condition.readFile === undefined
|
|
104
|
+
? null
|
|
105
|
+
: condition.readFile.ok
|
|
106
|
+
? [true, condition.readFile.hash]
|
|
107
|
+
: [false],
|
|
108
|
+
condition.realpath === undefined
|
|
109
|
+
? null
|
|
110
|
+
: condition.realpath.ok
|
|
111
|
+
? [true, condition.realpath.path]
|
|
112
|
+
: [false],
|
|
113
|
+
condition.stat ?? null,
|
|
114
|
+
])}`;
|
|
115
|
+
return `${predicate}:${path.resolve(input)}`;
|
|
116
|
+
}
|
|
117
|
+
/** Whether one registered condition no longer describes its lexical path. */
|
|
118
|
+
function viteServeInputWatchConditionChanged(entry) {
|
|
119
|
+
if (typeof entry.condition !== "string") {
|
|
120
|
+
return (validateGraphInputObservation(entry.spelling, entry.condition).length !==
|
|
121
|
+
0);
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
if (!fs.existsSync(entry.spelling)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return (entry.condition === "exists" || !fs.statSync(entry.spelling).isDirectory());
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
93
133
|
/**
|
|
94
134
|
* Invalidate every module-graph node of the registered importers so the next
|
|
95
135
|
* request retransforms them. Importers keep their original absolute spelling so
|
|
@@ -174,5 +214,5 @@ function sendFullReload(server) {
|
|
|
174
214
|
}
|
|
175
215
|
}
|
|
176
216
|
|
|
177
|
-
export { createViteServeMissingInputWatch };
|
|
217
|
+
export { createViteServeMissingInputWatch, viteServeMissingInputWatchKey };
|
|
178
218
|
//# sourceMappingURL=viteServe.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viteServe.mjs","sources":["../../src/core/viteServe.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"viteServe.mjs","sources":["../../src/core/viteServe.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA;;;;;;;;;;AAUG;AACH,MAAM,2BAA2B,GAAG,GAAG;AA4FvC;SACgB,gCAAgC,GAAA;AAC9C,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B;AACrD,IAAA,IAAI,MAAkC;AACtC,IAAA,IAAI,M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AAC,EAAE;AACT,QAAA,MAAM,CAAC,GAAG;AACV,QAAA,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG;AACjC,KAAA,EAAE;AACD,QAAA,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE;YAC/B;QACF;AACA,QAAA,IAAI;AACF,YAAA,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;YAChD;QACF;AAAE,QAAA,MAAM;;;QAGR;IACF;AACF;;;;"}
|
package/lib/next.d.cts
CHANGED
|
@@ -52,3 +52,10 @@ export type TurbopackLikeConfig = Record<string, unknown> & {
|
|
|
52
52
|
* @param options - Ttsc plugin options forwarded to both bundlers.
|
|
53
53
|
*/
|
|
54
54
|
export default function next(nextConfig?: NextLikeConfig, options?: TtscUnpluginOptions): NextLikeConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Measured project-wide Turbopack globs and the source extensions each covers.
|
|
57
|
+
*
|
|
58
|
+
* Exported so the packed-package E2E can measure the exact production allowlist
|
|
59
|
+
* instead of maintaining a second list that can drift from it.
|
|
60
|
+
*/
|
|
61
|
+
export declare const TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE: ReadonlyArray<readonly [string, readonly string[]]>;
|
package/lib/next.d.mts
CHANGED
|
@@ -52,3 +52,10 @@ export type TurbopackLikeConfig = Record<string, unknown> & {
|
|
|
52
52
|
* @param options - Ttsc plugin options forwarded to both bundlers.
|
|
53
53
|
*/
|
|
54
54
|
export default function next(nextConfig?: NextLikeConfig, options?: TtscUnpluginOptions): NextLikeConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Measured project-wide Turbopack globs and the source extensions each covers.
|
|
57
|
+
*
|
|
58
|
+
* Exported so the packed-package E2E can measure the exact production allowlist
|
|
59
|
+
* instead of maintaining a second list that can drift from it.
|
|
60
|
+
*/
|
|
61
|
+
export declare const TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE: ReadonlyArray<readonly [string, readonly string[]]>;
|
package/lib/next.d.ts
CHANGED
|
@@ -52,3 +52,10 @@ export type TurbopackLikeConfig = Record<string, unknown> & {
|
|
|
52
52
|
* @param options - Ttsc plugin options forwarded to both bundlers.
|
|
53
53
|
*/
|
|
54
54
|
export default function next(nextConfig?: NextLikeConfig, options?: TtscUnpluginOptions): NextLikeConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Measured project-wide Turbopack globs and the source extensions each covers.
|
|
57
|
+
*
|
|
58
|
+
* Exported so the packed-package E2E can measure the exact production allowlist
|
|
59
|
+
* instead of maintaining a second list that can drift from it.
|
|
60
|
+
*/
|
|
61
|
+
export declare const TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE: ReadonlyArray<readonly [string, readonly string[]]>;
|