vite-node 3.0.8 → 3.0.9
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/dist/cli.cjs +3 -1
- package/dist/cli.d.ts +11 -13
- package/dist/cli.mjs +3 -1
- package/dist/client.cjs +4 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.mjs +4 -1
- package/dist/hmr.d.ts +24 -24
- package/dist/index.d-CvjHzhRV.d.ts +321 -0
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +43 -43
- package/dist/server.mjs +1 -1
- package/dist/source-map.cjs +2 -2
- package/dist/source-map.d.ts +4 -4
- package/dist/source-map.mjs +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +8 -8
- package/package.json +1 -1
- package/dist/index-LQxw79Gm.d.ts +0 -321
package/dist/cli.cjs
CHANGED
|
@@ -21,7 +21,7 @@ require('es-module-lexer');
|
|
|
21
21
|
require('./constants.cjs');
|
|
22
22
|
require('node:events');
|
|
23
23
|
|
|
24
|
-
var version = "3.0.
|
|
24
|
+
var version = "3.0.9";
|
|
25
25
|
|
|
26
26
|
const cli = cac("vite-node");
|
|
27
27
|
cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
|
|
@@ -76,6 +76,8 @@ async function run(files, options = {}) {
|
|
|
76
76
|
});
|
|
77
77
|
if (Number(vite.version.split(".")[0]) < 6) {
|
|
78
78
|
await server$1.pluginContainer.buildStart({});
|
|
79
|
+
} else {
|
|
80
|
+
await server$1.environments.client.pluginContainer.buildStart({});
|
|
79
81
|
}
|
|
80
82
|
const env = vite.loadEnv(server$1.config.mode, server$1.config.envDir, "");
|
|
81
83
|
for (const key in env) {
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { V as ViteNodeServerOptions } from './index-
|
|
1
|
+
import { V as ViteNodeServerOptions } from './index.d-CvjHzhRV.js';
|
|
2
2
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
3
3
|
|
|
4
4
|
interface CliOptions {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
"root"?: string;
|
|
6
|
+
"script"?: boolean;
|
|
7
|
+
"config"?: string;
|
|
8
|
+
"mode"?: string;
|
|
9
|
+
"watch"?: boolean;
|
|
10
|
+
"options"?: ViteNodeServerOptionsCLI;
|
|
11
|
+
"version"?: boolean;
|
|
12
|
+
"help"?: boolean;
|
|
13
|
+
"--"?: string[];
|
|
14
14
|
}
|
|
15
15
|
type Optional<T> = T | undefined;
|
|
16
|
-
type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = {
|
|
17
|
-
[K in keyof T]: T[K] extends Optional<RegExp[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[] | true> ? string | string[] | true : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K];
|
|
18
|
-
};
|
|
16
|
+
type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = { [K in keyof T] : T[K] extends Optional<RegExp[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[] | true> ? string | string[] | true : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K] };
|
|
19
17
|
type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
|
|
20
18
|
|
|
21
19
|
export type { CliOptions, ViteNodeServerOptionsCLI };
|
package/dist/cli.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import 'es-module-lexer';
|
|
|
19
19
|
import './constants.mjs';
|
|
20
20
|
import 'node:events';
|
|
21
21
|
|
|
22
|
-
var version = "3.0.
|
|
22
|
+
var version = "3.0.9";
|
|
23
23
|
|
|
24
24
|
const cli = cac("vite-node");
|
|
25
25
|
cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
|
|
@@ -74,6 +74,8 @@ async function run(files, options = {}) {
|
|
|
74
74
|
});
|
|
75
75
|
if (Number(version$1.split(".")[0]) < 6) {
|
|
76
76
|
await server.pluginContainer.buildStart({});
|
|
77
|
+
} else {
|
|
78
|
+
await server.environments.client.pluginContainer.buildStart({});
|
|
77
79
|
}
|
|
78
80
|
const env = loadEnv(server.config.mode, server.config.envDir, "");
|
|
79
81
|
for (const key in env) {
|
package/dist/client.cjs
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
2
|
-
export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, f as ModuleExecutionInfo, a as ViteNodeRunner } from './index-
|
|
2
|
+
export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, f as ModuleExecutionInfo, a as ViteNodeRunner } from './index.d-CvjHzhRV.js';
|
package/dist/client.mjs
CHANGED
package/dist/hmr.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { HMRPayload, Plugin } from 'vite';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
|
-
import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-
|
|
3
|
+
import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index.d-CvjHzhRV.js';
|
|
4
4
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
7
7
|
type Handler<T = unknown> = (event: T) => void;
|
|
8
8
|
interface Emitter<Events extends Record<EventType, unknown>> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
on: <Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>) => void;
|
|
10
|
+
off: <Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>) => void;
|
|
11
|
+
emit: (<Key extends keyof Events>(type: Key, event: Events[Key]) => void) & (<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never) => void);
|
|
12
12
|
}
|
|
13
13
|
type HMREmitter = Emitter<{
|
|
14
|
-
|
|
14
|
+
message: HMRPayload
|
|
15
15
|
}> & EventEmitter;
|
|
16
|
-
declare module
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
declare module "vite" {
|
|
17
|
+
interface ViteDevServer {
|
|
18
|
+
emitter: HMREmitter;
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
declare function createHmrEmitter(): HMREmitter;
|
|
22
22
|
declare function viteNodeHmrPlugin(): Plugin;
|
|
23
23
|
|
|
24
24
|
type ModuleNamespace = Record<string, any> & {
|
|
25
|
-
|
|
25
|
+
[Symbol.toStringTag]: "Module"
|
|
26
26
|
};
|
|
27
27
|
type InferCustomEventPayload<T extends string> = T extends keyof CustomEventMap ? CustomEventMap[T] : any;
|
|
28
28
|
interface HotModule {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
id: string;
|
|
30
|
+
callbacks: HotCallback[];
|
|
31
31
|
}
|
|
32
32
|
interface HotCallback {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
deps: string[];
|
|
34
|
+
fn: (modules: (ModuleNamespace | undefined)[]) => void;
|
|
35
35
|
}
|
|
36
36
|
interface CacheData {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
hotModulesMap: Map<string, HotModule>;
|
|
38
|
+
dataMap: Map<string, any>;
|
|
39
|
+
disposeMap: Map<string, (data: any) => void | Promise<void>>;
|
|
40
|
+
pruneMap: Map<string, (data: any) => void | Promise<void>>;
|
|
41
|
+
customListenersMap: Map<string, ((data: any) => void)[]>;
|
|
42
|
+
ctxToListenersMap: Map<string, Map<string, ((data: any) => void)[]>>;
|
|
43
|
+
messageBuffer: string[];
|
|
44
|
+
isFirstUpdate: boolean;
|
|
45
|
+
pending: boolean;
|
|
46
|
+
queued: Promise<(() => void) | undefined>[];
|
|
47
47
|
}
|
|
48
48
|
declare function getCache(runner: ViteNodeRunner): CacheData;
|
|
49
49
|
declare function sendMessageBuffer(runner: ViteNodeRunner, emitter: HMREmitter): void;
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
2
|
+
|
|
3
|
+
/** @deprecated use HotPayload */
|
|
4
|
+
type HMRPayload = HotPayload
|
|
5
|
+
type HotPayload =
|
|
6
|
+
| ConnectedPayload
|
|
7
|
+
| PingPayload
|
|
8
|
+
| UpdatePayload
|
|
9
|
+
| FullReloadPayload
|
|
10
|
+
| CustomPayload
|
|
11
|
+
| ErrorPayload
|
|
12
|
+
| PrunePayload
|
|
13
|
+
|
|
14
|
+
interface ConnectedPayload {
|
|
15
|
+
type: 'connected'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface PingPayload {
|
|
19
|
+
type: 'ping'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface UpdatePayload {
|
|
23
|
+
type: 'update'
|
|
24
|
+
updates: Update[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Update {
|
|
28
|
+
type: 'js-update' | 'css-update'
|
|
29
|
+
path: string
|
|
30
|
+
acceptedPath: string
|
|
31
|
+
timestamp: number
|
|
32
|
+
/** @internal */
|
|
33
|
+
explicitImportRequired?: boolean
|
|
34
|
+
/** @internal */
|
|
35
|
+
isWithinCircularImport?: boolean
|
|
36
|
+
/** @internal */
|
|
37
|
+
invalidates?: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface PrunePayload {
|
|
41
|
+
type: 'prune'
|
|
42
|
+
paths: string[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface FullReloadPayload {
|
|
46
|
+
type: 'full-reload'
|
|
47
|
+
path?: string
|
|
48
|
+
/** @internal */
|
|
49
|
+
triggeredBy?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface CustomPayload {
|
|
53
|
+
type: 'custom'
|
|
54
|
+
event: string
|
|
55
|
+
data?: any
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ErrorPayload {
|
|
59
|
+
type: 'error'
|
|
60
|
+
err: {
|
|
61
|
+
[name: string]: any
|
|
62
|
+
message: string
|
|
63
|
+
stack: string
|
|
64
|
+
id?: string
|
|
65
|
+
frame?: string
|
|
66
|
+
plugin?: string
|
|
67
|
+
pluginCode?: string
|
|
68
|
+
loc?: {
|
|
69
|
+
file?: string
|
|
70
|
+
line: number
|
|
71
|
+
column: number
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface CustomEventMap {
|
|
77
|
+
'vite:beforeUpdate': UpdatePayload
|
|
78
|
+
'vite:afterUpdate': UpdatePayload
|
|
79
|
+
'vite:beforePrune': PrunePayload
|
|
80
|
+
'vite:beforeFullReload': FullReloadPayload
|
|
81
|
+
'vite:error': ErrorPayload
|
|
82
|
+
'vite:invalidate': InvalidatePayload
|
|
83
|
+
'vite:ws:connect': WebSocketConnectionPayload
|
|
84
|
+
'vite:ws:disconnect': WebSocketConnectionPayload
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface WebSocketConnectionPayload {
|
|
88
|
+
/**
|
|
89
|
+
* @experimental
|
|
90
|
+
* We expose this instance experimentally to see potential usage.
|
|
91
|
+
* This might be removed in the future if we didn't find reasonable use cases.
|
|
92
|
+
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
|
93
|
+
*/
|
|
94
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
95
|
+
webSocket: WebSocket
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface InvalidatePayload {
|
|
99
|
+
path: string
|
|
100
|
+
message: string | undefined
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* provides types for built-in Vite events
|
|
105
|
+
*/
|
|
106
|
+
type InferCustomEventPayload<T extends string> =
|
|
107
|
+
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
108
|
+
|
|
109
|
+
type ModuleNamespace = Record<string, any> & {
|
|
110
|
+
[Symbol.toStringTag]: 'Module'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface ViteHotContext {
|
|
114
|
+
readonly data: any
|
|
115
|
+
|
|
116
|
+
accept(): void
|
|
117
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
118
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
119
|
+
accept(
|
|
120
|
+
deps: readonly string[],
|
|
121
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
122
|
+
): void
|
|
123
|
+
|
|
124
|
+
acceptExports(
|
|
125
|
+
exportNames: string | readonly string[],
|
|
126
|
+
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
127
|
+
): void
|
|
128
|
+
|
|
129
|
+
dispose(cb: (data: any) => void): void
|
|
130
|
+
prune(cb: (data: any) => void): void
|
|
131
|
+
invalidate(message?: string): void
|
|
132
|
+
|
|
133
|
+
on<T extends string>(
|
|
134
|
+
event: T,
|
|
135
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
136
|
+
): void
|
|
137
|
+
off<T extends string>(
|
|
138
|
+
event: T,
|
|
139
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
140
|
+
): void
|
|
141
|
+
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>;
|
|
145
|
+
declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
146
|
+
normalizePath(fsPath: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Assign partial data to the map
|
|
149
|
+
*/
|
|
150
|
+
update(fsPath: string, mod: ModuleCache): this;
|
|
151
|
+
setByModuleId(modulePath: string, mod: ModuleCache): this;
|
|
152
|
+
set(fsPath: string, mod: ModuleCache): this;
|
|
153
|
+
getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>;
|
|
154
|
+
get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, "importers" | "imports">>;
|
|
155
|
+
deleteByModuleId(modulePath: string): boolean;
|
|
156
|
+
delete(fsPath: string): boolean;
|
|
157
|
+
invalidateModule(mod: ModuleCache): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Invalidate modules that dependent on the given modules, up to the main entry
|
|
160
|
+
*/
|
|
161
|
+
invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
162
|
+
/**
|
|
163
|
+
* Invalidate dependency modules of the given modules, down to the bottom-level dependencies
|
|
164
|
+
*/
|
|
165
|
+
invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
166
|
+
/**
|
|
167
|
+
* Return parsed source map based on inlined source map of the module
|
|
168
|
+
*/
|
|
169
|
+
getSourceMap(id: string): EncodedSourceMap | null;
|
|
170
|
+
}
|
|
171
|
+
type ModuleExecutionInfo = Map<string, {
|
|
172
|
+
startOffset: number
|
|
173
|
+
}>;
|
|
174
|
+
declare class ViteNodeRunner {
|
|
175
|
+
options: ViteNodeRunnerOptions;
|
|
176
|
+
root: string;
|
|
177
|
+
debug: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Holds the cache of modules
|
|
180
|
+
* Keys of the map are filepaths, or plain package names
|
|
181
|
+
*/
|
|
182
|
+
moduleCache: ModuleCacheMap;
|
|
183
|
+
constructor(options: ViteNodeRunnerOptions);
|
|
184
|
+
executeFile(file: string): Promise<any>;
|
|
185
|
+
executeId(rawId: string): Promise<any>;
|
|
186
|
+
shouldResolveId(id: string, _importee?: string): boolean;
|
|
187
|
+
private _resolveUrl;
|
|
188
|
+
resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
|
|
189
|
+
protected getContextPrimitives(): {
|
|
190
|
+
Object: ObjectConstructor
|
|
191
|
+
Reflect: typeof Reflect
|
|
192
|
+
Symbol: SymbolConstructor
|
|
193
|
+
};
|
|
194
|
+
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
|
|
195
|
+
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
196
|
+
/**
|
|
197
|
+
* Define if a module should be interop-ed
|
|
198
|
+
* This function mostly for the ability to override by subclass
|
|
199
|
+
*/
|
|
200
|
+
shouldInterop(path: string, mod: any): boolean;
|
|
201
|
+
protected importExternalModule(path: string): Promise<any>;
|
|
202
|
+
/**
|
|
203
|
+
* Import a module and interop it
|
|
204
|
+
*/
|
|
205
|
+
interopedImport(path: string): Promise<any>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type Nullable<T> = T | null | undefined;
|
|
209
|
+
type Arrayable<T> = T | Array<T>;
|
|
210
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
211
|
+
interface DepsHandlingOptions {
|
|
212
|
+
external?: (string | RegExp)[];
|
|
213
|
+
inline?: (string | RegExp)[] | true;
|
|
214
|
+
inlineFiles?: string[];
|
|
215
|
+
/**
|
|
216
|
+
* A list of directories that are considered to hold Node.js modules
|
|
217
|
+
* Have to include "/" at the start and end of the path
|
|
218
|
+
*
|
|
219
|
+
* Vite-Node checks the whole absolute path of the import, so make sure you don't include
|
|
220
|
+
* unwanted files accidentally
|
|
221
|
+
* @default ['/node_modules/']
|
|
222
|
+
*/
|
|
223
|
+
moduleDirectories?: string[];
|
|
224
|
+
cacheDir?: string;
|
|
225
|
+
/**
|
|
226
|
+
* Try to guess the CJS version of a package when it's invalid ESM
|
|
227
|
+
* @default false
|
|
228
|
+
*/
|
|
229
|
+
fallbackCJS?: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface StartOfSourceMap {
|
|
232
|
+
file?: string;
|
|
233
|
+
sourceRoot?: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
237
|
+
version: number;
|
|
238
|
+
sources: string[];
|
|
239
|
+
names: string[];
|
|
240
|
+
sourcesContent?: (string | null)[];
|
|
241
|
+
mappings: string;
|
|
242
|
+
}
|
|
243
|
+
interface FetchResult {
|
|
244
|
+
code?: string;
|
|
245
|
+
externalize?: string;
|
|
246
|
+
map?: EncodedSourceMap | null;
|
|
247
|
+
}
|
|
248
|
+
type HotContext = Omit<ViteHotContext, "acceptDeps" | "decline">;
|
|
249
|
+
type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
250
|
+
type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
|
|
251
|
+
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
252
|
+
interface ModuleCache {
|
|
253
|
+
promise?: Promise<any>;
|
|
254
|
+
exports?: any;
|
|
255
|
+
evaluated?: boolean;
|
|
256
|
+
resolving?: boolean;
|
|
257
|
+
code?: string;
|
|
258
|
+
map?: EncodedSourceMap;
|
|
259
|
+
/**
|
|
260
|
+
* Module ids that imports this module
|
|
261
|
+
*/
|
|
262
|
+
importers?: Set<string>;
|
|
263
|
+
imports?: Set<string>;
|
|
264
|
+
}
|
|
265
|
+
interface ViteNodeRunnerOptions {
|
|
266
|
+
root: string;
|
|
267
|
+
fetchModule: FetchFunction;
|
|
268
|
+
resolveId?: ResolveIdFunction;
|
|
269
|
+
createHotContext?: CreateHotContextFunction;
|
|
270
|
+
base?: string;
|
|
271
|
+
moduleCache?: ModuleCacheMap;
|
|
272
|
+
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
273
|
+
interopDefault?: boolean;
|
|
274
|
+
requestStubs?: Record<string, any>;
|
|
275
|
+
debug?: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface ViteNodeResolveId {
|
|
278
|
+
external?: boolean | "absolute" | "relative";
|
|
279
|
+
id: string;
|
|
280
|
+
meta?: Record<string, any> | null;
|
|
281
|
+
moduleSideEffects?: boolean | "no-treeshake" | null;
|
|
282
|
+
syntheticNamedExports?: boolean | string | null;
|
|
283
|
+
}
|
|
284
|
+
interface ViteNodeResolveModule {
|
|
285
|
+
external: string | null;
|
|
286
|
+
id: string;
|
|
287
|
+
fsPath: string;
|
|
288
|
+
}
|
|
289
|
+
interface ViteNodeServerOptions {
|
|
290
|
+
/**
|
|
291
|
+
* Inject inline sourcemap to modules
|
|
292
|
+
* @default 'inline'
|
|
293
|
+
*/
|
|
294
|
+
sourcemap?: "inline" | boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Deps handling
|
|
297
|
+
*/
|
|
298
|
+
deps?: DepsHandlingOptions;
|
|
299
|
+
/**
|
|
300
|
+
* Transform method for modules
|
|
301
|
+
*/
|
|
302
|
+
transformMode?: {
|
|
303
|
+
ssr?: RegExp[]
|
|
304
|
+
web?: RegExp[]
|
|
305
|
+
};
|
|
306
|
+
debug?: DebuggerOptions;
|
|
307
|
+
}
|
|
308
|
+
interface DebuggerOptions {
|
|
309
|
+
/**
|
|
310
|
+
* Dump the transformed module to filesystem
|
|
311
|
+
* Passing a string will dump to the specified path
|
|
312
|
+
*/
|
|
313
|
+
dumpModules?: boolean | string;
|
|
314
|
+
/**
|
|
315
|
+
* Read dumpped module from filesystem whenever exists.
|
|
316
|
+
* Useful for debugging by modifying the dump result from the filesystem.
|
|
317
|
+
*/
|
|
318
|
+
loadDumppedModules?: boolean;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { type Arrayable as A, type CustomEventMap as C, type DebuggerOptions as D, type FetchResult as F, type HMRPayload as H, ModuleCacheMap as M, type Nullable as N, type RawSourceMap as R, type StartOfSourceMap as S, type ViteNodeServerOptions as V, ViteNodeRunner as a, type HotContext as b, type DepsHandlingOptions as c, type ViteNodeResolveId as d, DEFAULT_REQUEST_STUBS as e, type ModuleExecutionInfo as f, type Awaitable as g, type FetchFunction as h, type ResolveIdFunction as i, type CreateHotContextFunction as j, type ModuleCache as k, type ViteNodeRunnerOptions as l, type ViteNodeResolveModule as m };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-
|
|
1
|
+
export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index.d-CvjHzhRV.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
package/dist/server.cjs
CHANGED
|
@@ -566,7 +566,7 @@ class ViteNodeServer {
|
|
|
566
566
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
567
567
|
}
|
|
568
568
|
const sourcemap = this.options.sourcemap ?? "inline";
|
|
569
|
-
if (sourcemap === "inline" && result
|
|
569
|
+
if (sourcemap === "inline" && result) {
|
|
570
570
|
result = await this.processTransformResult(filepath, result);
|
|
571
571
|
}
|
|
572
572
|
if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) {
|
package/dist/server.d.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { TransformResult, ViteDevServer } from 'vite';
|
|
2
|
-
import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index-
|
|
2
|
+
import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index.d-CvjHzhRV.js';
|
|
3
3
|
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
4
4
|
|
|
5
5
|
declare class Debugger {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
options: DebuggerOptions;
|
|
7
|
+
dumpDir: string | undefined;
|
|
8
|
+
initPromise: Promise<void> | undefined;
|
|
9
|
+
externalizeMap: Map<string, string>;
|
|
10
|
+
constructor(root: string, options: DebuggerOptions);
|
|
11
|
+
clearDump(): Promise<void>;
|
|
12
|
+
encodeId(id: string): string;
|
|
13
|
+
recordExternalize(id: string, path: string): Promise<void>;
|
|
14
|
+
dumpFile(id: string, result: TransformResult | null): Promise<void>;
|
|
15
|
+
loadDump(id: string): Promise<TransformResult | null>;
|
|
16
|
+
writeInfo(): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
declare function guessCJSversion(id: string): string | undefined;
|
|
20
20
|
declare function shouldExternalize(id: string, options?: DepsHandlingOptions, cache?: Map<string, Promise<string | false>>): Promise<string | false>;
|
|
21
21
|
|
|
22
22
|
interface FetchCache {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
duration?: number;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
result: FetchResult;
|
|
26
26
|
}
|
|
27
27
|
declare class ViteNodeServer {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
28
|
+
server: ViteDevServer;
|
|
29
|
+
options: ViteNodeServerOptions;
|
|
30
|
+
private fetchPromiseMap;
|
|
31
|
+
private transformPromiseMap;
|
|
32
|
+
private durations;
|
|
33
|
+
private existingOptimizedDeps;
|
|
34
|
+
fetchCaches: Record<"ssr" | "web", Map<string, FetchCache>>;
|
|
35
|
+
fetchCache: Map<string, FetchCache>;
|
|
36
|
+
externalizeCache: Map<string, Promise<string | false>>;
|
|
37
|
+
debugger?: Debugger;
|
|
38
|
+
constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
|
|
39
|
+
shouldExternalize(id: string): Promise<string | false>;
|
|
40
|
+
getTotalDuration(): number;
|
|
41
|
+
private ensureExists;
|
|
42
|
+
resolveId(id: string, importer?: string, transformMode?: "web" | "ssr"): Promise<ViteNodeResolveId | null>;
|
|
43
|
+
getSourceMap(source: string): EncodedSourceMap | null;
|
|
44
|
+
private assertMode;
|
|
45
|
+
fetchModule(id: string, transformMode?: "web" | "ssr"): Promise<FetchResult>;
|
|
46
|
+
fetchResult(id: string, mode: "web" | "ssr"): Promise<FetchResult>;
|
|
47
|
+
transformRequest(id: string, filepath?: string, transformMode?: "web" | "ssr"): Promise<TransformResult | null | undefined>;
|
|
48
|
+
transformModule(id: string, transformMode?: "web" | "ssr"): Promise<{
|
|
49
|
+
code: string | undefined
|
|
50
|
+
}>;
|
|
51
|
+
getTransformMode(id: string): "ssr" | "web";
|
|
52
|
+
private getChangedModule;
|
|
53
|
+
private _fetchModule;
|
|
54
|
+
protected processTransformResult(filepath: string, result: TransformResult): Promise<TransformResult>;
|
|
55
|
+
private _transformRequest;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export { ViteNodeServer, guessCJSversion, shouldExternalize };
|
package/dist/server.mjs
CHANGED
|
@@ -545,7 +545,7 @@ class ViteNodeServer {
|
|
|
545
545
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
546
546
|
}
|
|
547
547
|
const sourcemap = this.options.sourcemap ?? "inline";
|
|
548
|
-
if (sourcemap === "inline" && result
|
|
548
|
+
if (sourcemap === "inline" && result) {
|
|
549
549
|
result = await this.processTransformResult(filepath, result);
|
|
550
550
|
}
|
|
551
551
|
if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) {
|
package/dist/source-map.cjs
CHANGED
|
@@ -882,7 +882,7 @@ function prepareStackTrace(error, stack) {
|
|
|
882
882
|
}
|
|
883
883
|
retrieveFileHandlers.slice(0);
|
|
884
884
|
retrieveMapHandlers.slice(0);
|
|
885
|
-
|
|
885
|
+
function install(options) {
|
|
886
886
|
options = options || {};
|
|
887
887
|
if (options.retrieveFile) {
|
|
888
888
|
if (options.overrideRetrieveFile) {
|
|
@@ -900,7 +900,7 @@ const install = function(options) {
|
|
|
900
900
|
errorFormatterInstalled = true;
|
|
901
901
|
Error.prepareStackTrace = prepareStackTrace;
|
|
902
902
|
}
|
|
903
|
-
}
|
|
903
|
+
}
|
|
904
904
|
|
|
905
905
|
let SOURCEMAPPING_URL = "sourceMa";
|
|
906
906
|
SOURCEMAPPING_URL += "ppingURL";
|
package/dist/source-map.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { TransformResult } from 'vite';
|
|
|
2
2
|
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
3
3
|
|
|
4
4
|
interface InstallSourceMapSupportOptions {
|
|
5
|
-
|
|
5
|
+
getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
|
|
6
6
|
}
|
|
7
7
|
declare function withInlineSourcemap(result: TransformResult, options: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
root: string
|
|
9
|
+
filepath: string
|
|
10
|
+
noFirstLineMapping?: boolean
|
|
11
11
|
}): TransformResult;
|
|
12
12
|
declare function extractSourceMap(code: string): EncodedSourceMap | null;
|
|
13
13
|
declare function installSourcemapsSupport(options: InstallSourceMapSupportOptions): void;
|
package/dist/source-map.mjs
CHANGED
|
@@ -880,7 +880,7 @@ function prepareStackTrace(error, stack) {
|
|
|
880
880
|
}
|
|
881
881
|
retrieveFileHandlers.slice(0);
|
|
882
882
|
retrieveMapHandlers.slice(0);
|
|
883
|
-
|
|
883
|
+
function install(options) {
|
|
884
884
|
options = options || {};
|
|
885
885
|
if (options.retrieveFile) {
|
|
886
886
|
if (options.overrideRetrieveFile) {
|
|
@@ -898,7 +898,7 @@ const install = function(options) {
|
|
|
898
898
|
errorFormatterInstalled = true;
|
|
899
899
|
Error.prepareStackTrace = prepareStackTrace;
|
|
900
900
|
}
|
|
901
|
-
}
|
|
901
|
+
}
|
|
902
902
|
|
|
903
903
|
let SOURCEMAPPING_URL = "sourceMa";
|
|
904
904
|
SOURCEMAPPING_URL += "ppingURL";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
|
2
|
-
export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-
|
|
2
|
+
export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index.d-CvjHzhRV.js';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as Nullable, A as Arrayable } from './index-
|
|
1
|
+
import { N as Nullable, A as Arrayable } from './index.d-CvjHzhRV.js';
|
|
2
2
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
3
3
|
|
|
4
4
|
declare const isWindows: boolean;
|
|
@@ -10,22 +10,22 @@ declare function isInternalRequest(id: string): boolean;
|
|
|
10
10
|
declare function normalizeModuleId(id: string): string;
|
|
11
11
|
declare function isPrimitive(v: any): boolean;
|
|
12
12
|
declare function toFilePath(id: string, root: string): {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
path: string
|
|
14
|
+
exists: boolean
|
|
15
15
|
};
|
|
16
16
|
declare function isNodeBuiltin(id: string): boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
19
|
+
*
|
|
20
|
+
* @category Array
|
|
21
|
+
*/
|
|
22
22
|
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
23
23
|
declare function getCachedData<T>(cache: Map<string, T>, basedir: string, originalBasedir: string): NonNullable<T> | undefined;
|
|
24
24
|
declare function setCacheData<T>(cache: Map<string, T>, data: T, basedir: string, originalBasedir: string): void;
|
|
25
25
|
declare function withTrailingSlash(path: string): string;
|
|
26
26
|
declare function createImportMetaEnvProxy(): NodeJS.ProcessEnv;
|
|
27
27
|
declare function findNearestPackageData(basedir: string): Promise<{
|
|
28
|
-
|
|
28
|
+
type?: "module" | "commonjs"
|
|
29
29
|
}>;
|
|
30
30
|
|
|
31
31
|
export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
|
package/package.json
CHANGED
package/dist/index-LQxw79Gm.d.ts
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
2
|
-
|
|
3
|
-
/** @deprecated use HotPayload */
|
|
4
|
-
type HMRPayload = HotPayload
|
|
5
|
-
type HotPayload =
|
|
6
|
-
| ConnectedPayload
|
|
7
|
-
| PingPayload
|
|
8
|
-
| UpdatePayload
|
|
9
|
-
| FullReloadPayload
|
|
10
|
-
| CustomPayload
|
|
11
|
-
| ErrorPayload
|
|
12
|
-
| PrunePayload
|
|
13
|
-
|
|
14
|
-
interface ConnectedPayload {
|
|
15
|
-
type: 'connected'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface PingPayload {
|
|
19
|
-
type: 'ping'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface UpdatePayload {
|
|
23
|
-
type: 'update'
|
|
24
|
-
updates: Update[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface Update {
|
|
28
|
-
type: 'js-update' | 'css-update'
|
|
29
|
-
path: string
|
|
30
|
-
acceptedPath: string
|
|
31
|
-
timestamp: number
|
|
32
|
-
/** @internal */
|
|
33
|
-
explicitImportRequired?: boolean
|
|
34
|
-
/** @internal */
|
|
35
|
-
isWithinCircularImport?: boolean
|
|
36
|
-
/** @internal */
|
|
37
|
-
invalidates?: string[]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface PrunePayload {
|
|
41
|
-
type: 'prune'
|
|
42
|
-
paths: string[]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface FullReloadPayload {
|
|
46
|
-
type: 'full-reload'
|
|
47
|
-
path?: string
|
|
48
|
-
/** @internal */
|
|
49
|
-
triggeredBy?: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface CustomPayload {
|
|
53
|
-
type: 'custom'
|
|
54
|
-
event: string
|
|
55
|
-
data?: any
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface ErrorPayload {
|
|
59
|
-
type: 'error'
|
|
60
|
-
err: {
|
|
61
|
-
[name: string]: any
|
|
62
|
-
message: string
|
|
63
|
-
stack: string
|
|
64
|
-
id?: string
|
|
65
|
-
frame?: string
|
|
66
|
-
plugin?: string
|
|
67
|
-
pluginCode?: string
|
|
68
|
-
loc?: {
|
|
69
|
-
file?: string
|
|
70
|
-
line: number
|
|
71
|
-
column: number
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
interface CustomEventMap {
|
|
77
|
-
'vite:beforeUpdate': UpdatePayload
|
|
78
|
-
'vite:afterUpdate': UpdatePayload
|
|
79
|
-
'vite:beforePrune': PrunePayload
|
|
80
|
-
'vite:beforeFullReload': FullReloadPayload
|
|
81
|
-
'vite:error': ErrorPayload
|
|
82
|
-
'vite:invalidate': InvalidatePayload
|
|
83
|
-
'vite:ws:connect': WebSocketConnectionPayload
|
|
84
|
-
'vite:ws:disconnect': WebSocketConnectionPayload
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
interface WebSocketConnectionPayload {
|
|
88
|
-
/**
|
|
89
|
-
* @experimental
|
|
90
|
-
* We expose this instance experimentally to see potential usage.
|
|
91
|
-
* This might be removed in the future if we didn't find reasonable use cases.
|
|
92
|
-
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
|
93
|
-
*/
|
|
94
|
-
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
95
|
-
webSocket: WebSocket
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface InvalidatePayload {
|
|
99
|
-
path: string
|
|
100
|
-
message: string | undefined
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* provides types for built-in Vite events
|
|
105
|
-
*/
|
|
106
|
-
type InferCustomEventPayload<T extends string> =
|
|
107
|
-
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
108
|
-
|
|
109
|
-
type ModuleNamespace = Record<string, any> & {
|
|
110
|
-
[Symbol.toStringTag]: 'Module'
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
interface ViteHotContext {
|
|
114
|
-
readonly data: any
|
|
115
|
-
|
|
116
|
-
accept(): void
|
|
117
|
-
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
118
|
-
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
119
|
-
accept(
|
|
120
|
-
deps: readonly string[],
|
|
121
|
-
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
122
|
-
): void
|
|
123
|
-
|
|
124
|
-
acceptExports(
|
|
125
|
-
exportNames: string | readonly string[],
|
|
126
|
-
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
127
|
-
): void
|
|
128
|
-
|
|
129
|
-
dispose(cb: (data: any) => void): void
|
|
130
|
-
prune(cb: (data: any) => void): void
|
|
131
|
-
invalidate(message?: string): void
|
|
132
|
-
|
|
133
|
-
on<T extends string>(
|
|
134
|
-
event: T,
|
|
135
|
-
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
136
|
-
): void
|
|
137
|
-
off<T extends string>(
|
|
138
|
-
event: T,
|
|
139
|
-
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
140
|
-
): void
|
|
141
|
-
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>;
|
|
145
|
-
declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
146
|
-
normalizePath(fsPath: string): string;
|
|
147
|
-
/**
|
|
148
|
-
* Assign partial data to the map
|
|
149
|
-
*/
|
|
150
|
-
update(fsPath: string, mod: ModuleCache): this;
|
|
151
|
-
setByModuleId(modulePath: string, mod: ModuleCache): this;
|
|
152
|
-
set(fsPath: string, mod: ModuleCache): this;
|
|
153
|
-
getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>;
|
|
154
|
-
get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, 'importers' | 'imports'>>;
|
|
155
|
-
deleteByModuleId(modulePath: string): boolean;
|
|
156
|
-
delete(fsPath: string): boolean;
|
|
157
|
-
invalidateModule(mod: ModuleCache): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Invalidate modules that dependent on the given modules, up to the main entry
|
|
160
|
-
*/
|
|
161
|
-
invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
162
|
-
/**
|
|
163
|
-
* Invalidate dependency modules of the given modules, down to the bottom-level dependencies
|
|
164
|
-
*/
|
|
165
|
-
invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
166
|
-
/**
|
|
167
|
-
* Return parsed source map based on inlined source map of the module
|
|
168
|
-
*/
|
|
169
|
-
getSourceMap(id: string): EncodedSourceMap | null;
|
|
170
|
-
}
|
|
171
|
-
type ModuleExecutionInfo = Map<string, {
|
|
172
|
-
startOffset: number;
|
|
173
|
-
}>;
|
|
174
|
-
declare class ViteNodeRunner {
|
|
175
|
-
options: ViteNodeRunnerOptions;
|
|
176
|
-
root: string;
|
|
177
|
-
debug: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Holds the cache of modules
|
|
180
|
-
* Keys of the map are filepaths, or plain package names
|
|
181
|
-
*/
|
|
182
|
-
moduleCache: ModuleCacheMap;
|
|
183
|
-
constructor(options: ViteNodeRunnerOptions);
|
|
184
|
-
executeFile(file: string): Promise<any>;
|
|
185
|
-
executeId(rawId: string): Promise<any>;
|
|
186
|
-
shouldResolveId(id: string, _importee?: string): boolean;
|
|
187
|
-
private _resolveUrl;
|
|
188
|
-
resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
|
|
189
|
-
protected getContextPrimitives(): {
|
|
190
|
-
Object: ObjectConstructor;
|
|
191
|
-
Reflect: typeof Reflect;
|
|
192
|
-
Symbol: SymbolConstructor;
|
|
193
|
-
};
|
|
194
|
-
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
|
|
195
|
-
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
196
|
-
/**
|
|
197
|
-
* Define if a module should be interop-ed
|
|
198
|
-
* This function mostly for the ability to override by subclass
|
|
199
|
-
*/
|
|
200
|
-
shouldInterop(path: string, mod: any): boolean;
|
|
201
|
-
protected importExternalModule(path: string): Promise<any>;
|
|
202
|
-
/**
|
|
203
|
-
* Import a module and interop it
|
|
204
|
-
*/
|
|
205
|
-
interopedImport(path: string): Promise<any>;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
type Nullable<T> = T | null | undefined;
|
|
209
|
-
type Arrayable<T> = T | Array<T>;
|
|
210
|
-
type Awaitable<T> = T | PromiseLike<T>;
|
|
211
|
-
interface DepsHandlingOptions {
|
|
212
|
-
external?: (string | RegExp)[];
|
|
213
|
-
inline?: (string | RegExp)[] | true;
|
|
214
|
-
inlineFiles?: string[];
|
|
215
|
-
/**
|
|
216
|
-
* A list of directories that are considered to hold Node.js modules
|
|
217
|
-
* Have to include "/" at the start and end of the path
|
|
218
|
-
*
|
|
219
|
-
* Vite-Node checks the whole absolute path of the import, so make sure you don't include
|
|
220
|
-
* unwanted files accidentally
|
|
221
|
-
* @default ['/node_modules/']
|
|
222
|
-
*/
|
|
223
|
-
moduleDirectories?: string[];
|
|
224
|
-
cacheDir?: string;
|
|
225
|
-
/**
|
|
226
|
-
* Try to guess the CJS version of a package when it's invalid ESM
|
|
227
|
-
* @default false
|
|
228
|
-
*/
|
|
229
|
-
fallbackCJS?: boolean;
|
|
230
|
-
}
|
|
231
|
-
interface StartOfSourceMap {
|
|
232
|
-
file?: string;
|
|
233
|
-
sourceRoot?: string;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface RawSourceMap extends StartOfSourceMap {
|
|
237
|
-
version: number;
|
|
238
|
-
sources: string[];
|
|
239
|
-
names: string[];
|
|
240
|
-
sourcesContent?: (string | null)[];
|
|
241
|
-
mappings: string;
|
|
242
|
-
}
|
|
243
|
-
interface FetchResult {
|
|
244
|
-
code?: string;
|
|
245
|
-
externalize?: string;
|
|
246
|
-
map?: EncodedSourceMap | null;
|
|
247
|
-
}
|
|
248
|
-
type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
|
|
249
|
-
type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
250
|
-
type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
|
|
251
|
-
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
252
|
-
interface ModuleCache {
|
|
253
|
-
promise?: Promise<any>;
|
|
254
|
-
exports?: any;
|
|
255
|
-
evaluated?: boolean;
|
|
256
|
-
resolving?: boolean;
|
|
257
|
-
code?: string;
|
|
258
|
-
map?: EncodedSourceMap;
|
|
259
|
-
/**
|
|
260
|
-
* Module ids that imports this module
|
|
261
|
-
*/
|
|
262
|
-
importers?: Set<string>;
|
|
263
|
-
imports?: Set<string>;
|
|
264
|
-
}
|
|
265
|
-
interface ViteNodeRunnerOptions {
|
|
266
|
-
root: string;
|
|
267
|
-
fetchModule: FetchFunction;
|
|
268
|
-
resolveId?: ResolveIdFunction;
|
|
269
|
-
createHotContext?: CreateHotContextFunction;
|
|
270
|
-
base?: string;
|
|
271
|
-
moduleCache?: ModuleCacheMap;
|
|
272
|
-
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
273
|
-
interopDefault?: boolean;
|
|
274
|
-
requestStubs?: Record<string, any>;
|
|
275
|
-
debug?: boolean;
|
|
276
|
-
}
|
|
277
|
-
interface ViteNodeResolveId {
|
|
278
|
-
external?: boolean | 'absolute' | 'relative';
|
|
279
|
-
id: string;
|
|
280
|
-
meta?: Record<string, any> | null;
|
|
281
|
-
moduleSideEffects?: boolean | 'no-treeshake' | null;
|
|
282
|
-
syntheticNamedExports?: boolean | string | null;
|
|
283
|
-
}
|
|
284
|
-
interface ViteNodeResolveModule {
|
|
285
|
-
external: string | null;
|
|
286
|
-
id: string;
|
|
287
|
-
fsPath: string;
|
|
288
|
-
}
|
|
289
|
-
interface ViteNodeServerOptions {
|
|
290
|
-
/**
|
|
291
|
-
* Inject inline sourcemap to modules
|
|
292
|
-
* @default 'inline'
|
|
293
|
-
*/
|
|
294
|
-
sourcemap?: 'inline' | boolean;
|
|
295
|
-
/**
|
|
296
|
-
* Deps handling
|
|
297
|
-
*/
|
|
298
|
-
deps?: DepsHandlingOptions;
|
|
299
|
-
/**
|
|
300
|
-
* Transform method for modules
|
|
301
|
-
*/
|
|
302
|
-
transformMode?: {
|
|
303
|
-
ssr?: RegExp[];
|
|
304
|
-
web?: RegExp[];
|
|
305
|
-
};
|
|
306
|
-
debug?: DebuggerOptions;
|
|
307
|
-
}
|
|
308
|
-
interface DebuggerOptions {
|
|
309
|
-
/**
|
|
310
|
-
* Dump the transformed module to filesystem
|
|
311
|
-
* Passing a string will dump to the specified path
|
|
312
|
-
*/
|
|
313
|
-
dumpModules?: boolean | string;
|
|
314
|
-
/**
|
|
315
|
-
* Read dumpped module from filesystem whenever exists.
|
|
316
|
-
* Useful for debugging by modifying the dump result from the filesystem.
|
|
317
|
-
*/
|
|
318
|
-
loadDumppedModules?: boolean;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export { type Arrayable as A, type CustomEventMap as C, type DebuggerOptions as D, type FetchResult as F, type HMRPayload as H, ModuleCacheMap as M, type Nullable as N, type RawSourceMap as R, type StartOfSourceMap as S, type ViteNodeServerOptions as V, ViteNodeRunner as a, type HotContext as b, type DepsHandlingOptions as c, type ViteNodeResolveId as d, DEFAULT_REQUEST_STUBS as e, type ModuleExecutionInfo as f, type Awaitable as g, type FetchFunction as h, type ResolveIdFunction as i, type CreateHotContextFunction as j, type ModuleCache as k, type ViteNodeRunnerOptions as l, type ViteNodeResolveModule as m };
|