@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/viteServe.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TtscWatchInput } from "./transform.cjs";
|
|
2
2
|
/** One module node inside a Vite module graph; opaque to this module. */
|
|
3
3
|
type ViteModuleNodeLike = object;
|
|
4
4
|
/**
|
|
@@ -30,49 +30,46 @@ interface ViteEnvironmentLike {
|
|
|
30
30
|
* carries.
|
|
31
31
|
*/
|
|
32
32
|
export interface ViteDevServerLike {
|
|
33
|
+
config?: {
|
|
34
|
+
root?: string;
|
|
35
|
+
};
|
|
33
36
|
environments?: Record<string, ViteEnvironmentLike>;
|
|
34
37
|
hot?: ViteHotChannelLike;
|
|
35
38
|
moduleGraph?: ViteModuleGraphLike;
|
|
36
39
|
ws?: ViteHotChannelLike;
|
|
37
40
|
}
|
|
41
|
+
export interface ViteServeWatchOperations {
|
|
42
|
+
/** Override case-policy discovery for a simulated host filesystem. */
|
|
43
|
+
caseSensitive?(directory: string): boolean;
|
|
44
|
+
/** Override path semantics when testing a non-host platform. */
|
|
45
|
+
platform?: NodeJS.Platform;
|
|
46
|
+
poll(listener: () => void): {
|
|
47
|
+
close(): void;
|
|
48
|
+
};
|
|
49
|
+
watch(root: string, listener: (eventType: string, file: string | null) => void, onError: () => void): {
|
|
50
|
+
close(): void;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Serve-time compiler dependencies never enter Vite's runtime import graph. */
|
|
54
|
+
export interface ViteServeInputWatch {
|
|
55
|
+
attach(server: ViteDevServerLike): void;
|
|
56
|
+
begin(): number;
|
|
57
|
+
dispose(): Promise<void>;
|
|
58
|
+
/** Release every compiler input owned by one removed source module. */
|
|
59
|
+
forget(importer: string): void;
|
|
60
|
+
replace(importer: string, inputs: readonly TtscWatchInput[], failed?: boolean, startedAt?: number): void;
|
|
61
|
+
}
|
|
38
62
|
/**
|
|
39
|
-
*
|
|
40
|
-
* added imports while a development server is running.
|
|
63
|
+
* A bounded recursive filesystem observer shared by all served modules.
|
|
41
64
|
*
|
|
42
|
-
* Vite
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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.
|
|
65
|
+
* Vite resolves transform-context addWatchFile as a runtime import, including
|
|
66
|
+
* type-only .server files and non-module plugin assets. Use a separate watcher
|
|
67
|
+
* for compiler inputs, including node_modules, which Vite's watcher ignores.
|
|
68
|
+
* Ordinary files use events after their initial subscription is observed.
|
|
69
|
+
* Missing spellings and directory predicates use the recursive observer for
|
|
70
|
+
* their nearest available scope. Inputs a native scope cannot safely cover
|
|
71
|
+
* share one bounded fallback poll; linked files also share topology checks
|
|
72
|
+
* because retargeting a junction need not emit events on its old descendants.
|
|
56
73
|
*/
|
|
57
|
-
export
|
|
58
|
-
/** Adopt the dev server whose module graphs creation events invalidate. */
|
|
59
|
-
attach(server: ViteDevServerLike): void;
|
|
60
|
-
/** Stop every poll; safe to call repeatedly. */
|
|
61
|
-
dispose(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Report whether a dev server has ever been attached. This is not a liveness
|
|
64
|
-
* predicate — the reference intentionally survives the server's close (see
|
|
65
|
-
* {@link dispose}) — so route decisions must also gate on the resolved
|
|
66
|
-
* config's `command`, as the adapter does.
|
|
67
|
-
*/
|
|
68
|
-
serving(): boolean;
|
|
69
|
-
/** Register one unsafe watch input and its exact recorded condition. */
|
|
70
|
-
watch(input: string, importer: string, condition: ViteServeInputWatchCondition): void;
|
|
71
|
-
}
|
|
72
|
-
/** A legacy availability condition or an exact compiler predicate proof. */
|
|
73
|
-
export type ViteServeInputWatchCondition = "exists" | "file" | ITtscCompilerTransformation.IInputObservation;
|
|
74
|
-
/** Create an empty missing-input watch for one plugin instance. */
|
|
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;
|
|
74
|
+
export declare function createViteServeInputWatch(operations?: Partial<ViteServeWatchOperations>): ViteServeInputWatch;
|
|
78
75
|
export {};
|
package/lib/core/viteServe.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TtscWatchInput } from "./transform.mjs";
|
|
2
2
|
/** One module node inside a Vite module graph; opaque to this module. */
|
|
3
3
|
type ViteModuleNodeLike = object;
|
|
4
4
|
/**
|
|
@@ -30,49 +30,46 @@ interface ViteEnvironmentLike {
|
|
|
30
30
|
* carries.
|
|
31
31
|
*/
|
|
32
32
|
export interface ViteDevServerLike {
|
|
33
|
+
config?: {
|
|
34
|
+
root?: string;
|
|
35
|
+
};
|
|
33
36
|
environments?: Record<string, ViteEnvironmentLike>;
|
|
34
37
|
hot?: ViteHotChannelLike;
|
|
35
38
|
moduleGraph?: ViteModuleGraphLike;
|
|
36
39
|
ws?: ViteHotChannelLike;
|
|
37
40
|
}
|
|
41
|
+
export interface ViteServeWatchOperations {
|
|
42
|
+
/** Override case-policy discovery for a simulated host filesystem. */
|
|
43
|
+
caseSensitive?(directory: string): boolean;
|
|
44
|
+
/** Override path semantics when testing a non-host platform. */
|
|
45
|
+
platform?: NodeJS.Platform;
|
|
46
|
+
poll(listener: () => void): {
|
|
47
|
+
close(): void;
|
|
48
|
+
};
|
|
49
|
+
watch(root: string, listener: (eventType: string, file: string | null) => void, onError: () => void): {
|
|
50
|
+
close(): void;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Serve-time compiler dependencies never enter Vite's runtime import graph. */
|
|
54
|
+
export interface ViteServeInputWatch {
|
|
55
|
+
attach(server: ViteDevServerLike): void;
|
|
56
|
+
begin(): number;
|
|
57
|
+
dispose(): Promise<void>;
|
|
58
|
+
/** Release every compiler input owned by one removed source module. */
|
|
59
|
+
forget(importer: string): void;
|
|
60
|
+
replace(importer: string, inputs: readonly TtscWatchInput[], failed?: boolean, startedAt?: number): void;
|
|
61
|
+
}
|
|
38
62
|
/**
|
|
39
|
-
*
|
|
40
|
-
* added imports while a development server is running.
|
|
63
|
+
* A bounded recursive filesystem observer shared by all served modules.
|
|
41
64
|
*
|
|
42
|
-
* Vite
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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.
|
|
65
|
+
* Vite resolves transform-context addWatchFile as a runtime import, including
|
|
66
|
+
* type-only .server files and non-module plugin assets. Use a separate watcher
|
|
67
|
+
* for compiler inputs, including node_modules, which Vite's watcher ignores.
|
|
68
|
+
* Ordinary files use events after their initial subscription is observed.
|
|
69
|
+
* Missing spellings and directory predicates use the recursive observer for
|
|
70
|
+
* their nearest available scope. Inputs a native scope cannot safely cover
|
|
71
|
+
* share one bounded fallback poll; linked files also share topology checks
|
|
72
|
+
* because retargeting a junction need not emit events on its old descendants.
|
|
56
73
|
*/
|
|
57
|
-
export
|
|
58
|
-
/** Adopt the dev server whose module graphs creation events invalidate. */
|
|
59
|
-
attach(server: ViteDevServerLike): void;
|
|
60
|
-
/** Stop every poll; safe to call repeatedly. */
|
|
61
|
-
dispose(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Report whether a dev server has ever been attached. This is not a liveness
|
|
64
|
-
* predicate — the reference intentionally survives the server's close (see
|
|
65
|
-
* {@link dispose}) — so route decisions must also gate on the resolved
|
|
66
|
-
* config's `command`, as the adapter does.
|
|
67
|
-
*/
|
|
68
|
-
serving(): boolean;
|
|
69
|
-
/** Register one unsafe watch input and its exact recorded condition. */
|
|
70
|
-
watch(input: string, importer: string, condition: ViteServeInputWatchCondition): void;
|
|
71
|
-
}
|
|
72
|
-
/** A legacy availability condition or an exact compiler predicate proof. */
|
|
73
|
-
export type ViteServeInputWatchCondition = "exists" | "file" | ITtscCompilerTransformation.IInputObservation;
|
|
74
|
-
/** Create an empty missing-input watch for one plugin instance. */
|
|
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;
|
|
74
|
+
export declare function createViteServeInputWatch(operations?: Partial<ViteServeWatchOperations>): ViteServeInputWatch;
|
|
78
75
|
export {};
|
package/lib/core/viteServe.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TtscWatchInput } from "./transform";
|
|
2
2
|
/** One module node inside a Vite module graph; opaque to this module. */
|
|
3
3
|
type ViteModuleNodeLike = object;
|
|
4
4
|
/**
|
|
@@ -30,49 +30,46 @@ interface ViteEnvironmentLike {
|
|
|
30
30
|
* carries.
|
|
31
31
|
*/
|
|
32
32
|
export interface ViteDevServerLike {
|
|
33
|
+
config?: {
|
|
34
|
+
root?: string;
|
|
35
|
+
};
|
|
33
36
|
environments?: Record<string, ViteEnvironmentLike>;
|
|
34
37
|
hot?: ViteHotChannelLike;
|
|
35
38
|
moduleGraph?: ViteModuleGraphLike;
|
|
36
39
|
ws?: ViteHotChannelLike;
|
|
37
40
|
}
|
|
41
|
+
export interface ViteServeWatchOperations {
|
|
42
|
+
/** Override case-policy discovery for a simulated host filesystem. */
|
|
43
|
+
caseSensitive?(directory: string): boolean;
|
|
44
|
+
/** Override path semantics when testing a non-host platform. */
|
|
45
|
+
platform?: NodeJS.Platform;
|
|
46
|
+
poll(listener: () => void): {
|
|
47
|
+
close(): void;
|
|
48
|
+
};
|
|
49
|
+
watch(root: string, listener: (eventType: string, file: string | null) => void, onError: () => void): {
|
|
50
|
+
close(): void;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Serve-time compiler dependencies never enter Vite's runtime import graph. */
|
|
54
|
+
export interface ViteServeInputWatch {
|
|
55
|
+
attach(server: ViteDevServerLike): void;
|
|
56
|
+
begin(): number;
|
|
57
|
+
dispose(): Promise<void>;
|
|
58
|
+
/** Release every compiler input owned by one removed source module. */
|
|
59
|
+
forget(importer: string): void;
|
|
60
|
+
replace(importer: string, inputs: readonly TtscWatchInput[], failed?: boolean, startedAt?: number): void;
|
|
61
|
+
}
|
|
38
62
|
/**
|
|
39
|
-
*
|
|
40
|
-
* added imports while a development server is running.
|
|
63
|
+
* A bounded recursive filesystem observer shared by all served modules.
|
|
41
64
|
*
|
|
42
|
-
* Vite
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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.
|
|
65
|
+
* Vite resolves transform-context addWatchFile as a runtime import, including
|
|
66
|
+
* type-only .server files and non-module plugin assets. Use a separate watcher
|
|
67
|
+
* for compiler inputs, including node_modules, which Vite's watcher ignores.
|
|
68
|
+
* Ordinary files use events after their initial subscription is observed.
|
|
69
|
+
* Missing spellings and directory predicates use the recursive observer for
|
|
70
|
+
* their nearest available scope. Inputs a native scope cannot safely cover
|
|
71
|
+
* share one bounded fallback poll; linked files also share topology checks
|
|
72
|
+
* because retargeting a junction need not emit events on its old descendants.
|
|
56
73
|
*/
|
|
57
|
-
export
|
|
58
|
-
/** Adopt the dev server whose module graphs creation events invalidate. */
|
|
59
|
-
attach(server: ViteDevServerLike): void;
|
|
60
|
-
/** Stop every poll; safe to call repeatedly. */
|
|
61
|
-
dispose(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Report whether a dev server has ever been attached. This is not a liveness
|
|
64
|
-
* predicate — the reference intentionally survives the server's close (see
|
|
65
|
-
* {@link dispose}) — so route decisions must also gate on the resolved
|
|
66
|
-
* config's `command`, as the adapter does.
|
|
67
|
-
*/
|
|
68
|
-
serving(): boolean;
|
|
69
|
-
/** Register one unsafe watch input and its exact recorded condition. */
|
|
70
|
-
watch(input: string, importer: string, condition: ViteServeInputWatchCondition): void;
|
|
71
|
-
}
|
|
72
|
-
/** A legacy availability condition or an exact compiler predicate proof. */
|
|
73
|
-
export type ViteServeInputWatchCondition = "exists" | "file" | ITtscCompilerTransformation.IInputObservation;
|
|
74
|
-
/** Create an empty missing-input watch for one plugin instance. */
|
|
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;
|
|
74
|
+
export declare function createViteServeInputWatch(operations?: Partial<ViteServeWatchOperations>): ViteServeInputWatch;
|
|
78
75
|
export {};
|