vite-node 0.25.6 → 0.25.8
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/chunk-hmr.cjs +4 -1
- package/dist/chunk-hmr.mjs +4 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.d.ts +4 -4
- package/dist/cli.mjs +1 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.ts +1 -1
- package/dist/client.mjs +4 -3
- package/dist/hmr.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/source-map.d.ts +1 -1
- package/dist/{types-60eb9672.d.ts → types-fc7e68bc.d.ts} +12 -12
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
package/dist/chunk-hmr.cjs
CHANGED
|
@@ -193,6 +193,9 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
193
193
|
get data() {
|
|
194
194
|
return maps.dataMap.get(ownerPath);
|
|
195
195
|
},
|
|
196
|
+
acceptExports(_, callback) {
|
|
197
|
+
acceptDeps([ownerPath], callback && (([mod2]) => callback(mod2)));
|
|
198
|
+
},
|
|
196
199
|
accept(deps, callback) {
|
|
197
200
|
if (typeof deps === "function" || !deps) {
|
|
198
201
|
acceptDeps([ownerPath], ([mod2]) => deps && deps(mod2));
|
|
@@ -211,7 +214,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
211
214
|
maps.pruneMap.set(ownerPath, cb);
|
|
212
215
|
},
|
|
213
216
|
invalidate() {
|
|
214
|
-
notifyListeners(runner, "vite:invalidate", { path: ownerPath });
|
|
217
|
+
notifyListeners(runner, "vite:invalidate", { path: ownerPath, message: void 0 });
|
|
215
218
|
return reload(runner, files);
|
|
216
219
|
},
|
|
217
220
|
on(event, cb) {
|
package/dist/chunk-hmr.mjs
CHANGED
|
@@ -187,6 +187,9 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
187
187
|
get data() {
|
|
188
188
|
return maps.dataMap.get(ownerPath);
|
|
189
189
|
},
|
|
190
|
+
acceptExports(_, callback) {
|
|
191
|
+
acceptDeps([ownerPath], callback && (([mod2]) => callback(mod2)));
|
|
192
|
+
},
|
|
190
193
|
accept(deps, callback) {
|
|
191
194
|
if (typeof deps === "function" || !deps) {
|
|
192
195
|
acceptDeps([ownerPath], ([mod2]) => deps && deps(mod2));
|
|
@@ -205,7 +208,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
205
208
|
maps.pruneMap.set(ownerPath, cb);
|
|
206
209
|
},
|
|
207
210
|
invalidate() {
|
|
208
|
-
notifyListeners(runner, "vite:invalidate", { path: ownerPath });
|
|
211
|
+
notifyListeners(runner, "vite:invalidate", { path: ownerPath, message: void 0 });
|
|
209
212
|
return reload(runner, files);
|
|
210
213
|
},
|
|
211
214
|
on(event, cb) {
|
package/dist/cli.cjs
CHANGED
|
@@ -632,7 +632,7 @@ class CAC extends events.EventEmitter {
|
|
|
632
632
|
|
|
633
633
|
const cac = (name = "") => new CAC(name);
|
|
634
634
|
|
|
635
|
-
var version = "0.25.
|
|
635
|
+
var version = "0.25.8";
|
|
636
636
|
|
|
637
637
|
const cli = cac("vite-node");
|
|
638
638
|
cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as ViteNodeServerOptions } from './types-
|
|
1
|
+
import { e as ViteNodeServerOptions } from './types-fc7e68bc.js';
|
|
2
2
|
|
|
3
3
|
interface CliOptions {
|
|
4
4
|
root?: string;
|
|
@@ -7,10 +7,10 @@ interface CliOptions {
|
|
|
7
7
|
options?: ViteNodeServerOptionsCLI;
|
|
8
8
|
'--'?: string[];
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type Optional<T> = T | undefined;
|
|
11
|
+
type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = {
|
|
12
12
|
[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];
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
|
|
15
15
|
|
|
16
16
|
export { CliOptions, ViteNodeServerOptionsCLI };
|
package/dist/cli.mjs
CHANGED
|
@@ -630,7 +630,7 @@ class CAC extends EventEmitter {
|
|
|
630
630
|
|
|
631
631
|
const cac = (name = "") => new CAC(name);
|
|
632
632
|
|
|
633
|
-
var version = "0.25.
|
|
633
|
+
var version = "0.25.8";
|
|
634
634
|
|
|
635
635
|
const cli = cac("vite-node");
|
|
636
636
|
cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
|
package/dist/client.cjs
CHANGED
|
@@ -169,10 +169,11 @@ class ViteNodeRunner {
|
|
|
169
169
|
return mod.promise;
|
|
170
170
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
171
171
|
Object.assign(mod, { promise, evaluated: false });
|
|
172
|
-
|
|
172
|
+
try {
|
|
173
|
+
return await promise;
|
|
174
|
+
} finally {
|
|
173
175
|
mod.evaluated = true;
|
|
174
|
-
}
|
|
175
|
-
return await promise;
|
|
176
|
+
}
|
|
176
177
|
}
|
|
177
178
|
async directRequest(id, fsPath, _callstack) {
|
|
178
179
|
const callstack = [..._callstack, fsPath];
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-
|
|
1
|
+
export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-fc7e68bc.js';
|
package/dist/client.mjs
CHANGED
|
@@ -142,10 +142,11 @@ class ViteNodeRunner {
|
|
|
142
142
|
return mod.promise;
|
|
143
143
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
144
144
|
Object.assign(mod, { promise, evaluated: false });
|
|
145
|
-
|
|
145
|
+
try {
|
|
146
|
+
return await promise;
|
|
147
|
+
} finally {
|
|
146
148
|
mod.evaluated = true;
|
|
147
|
-
}
|
|
148
|
-
return await promise;
|
|
149
|
+
}
|
|
149
150
|
}
|
|
150
151
|
async directRequest(id, fsPath, _callstack) {
|
|
151
152
|
const callstack = [..._callstack, fsPath];
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { HMRPayload, Plugin } from 'vite';
|
|
3
|
-
import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-
|
|
3
|
+
import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-fc7e68bc.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type EventType = string | symbol;
|
|
6
|
+
type Handler<T = unknown> = (event: T) => void;
|
|
7
7
|
interface Emitter<Events extends Record<EventType, unknown>> {
|
|
8
8
|
on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;
|
|
9
9
|
off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;
|
|
10
10
|
emit<Key extends keyof Events>(type: Key, event: Events[Key]): void;
|
|
11
11
|
emit<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
16
|
declare module 'vite' {
|
|
@@ -21,7 +21,7 @@ declare module 'vite' {
|
|
|
21
21
|
declare function createHmrEmitter(): HMREmitter;
|
|
22
22
|
declare function viteNodeHmrPlugin(): Plugin;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
type InferCustomEventPayload<T extends string> = T extends keyof CustomEventMap ? CustomEventMap[T] : any;
|
|
25
25
|
interface HotModule {
|
|
26
26
|
id: string;
|
|
27
27
|
callbacks: HotCallback[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-
|
|
1
|
+
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-fc7e68bc.js';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransformResult, ViteDevServer } from 'vite';
|
|
2
|
-
import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-
|
|
2
|
+
import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-fc7e68bc.js';
|
|
3
3
|
|
|
4
4
|
declare class Debugger {
|
|
5
5
|
options: DebuggerOptions;
|
package/dist/source-map.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransformResult } from 'vite';
|
|
2
|
-
import { R as RawSourceMap } from './types-
|
|
2
|
+
import { R as RawSourceMap } from './types-fc7e68bc.js';
|
|
3
3
|
|
|
4
4
|
interface InstallSourceMapSupportOptions {
|
|
5
5
|
getSourceMap: (source: string) => RawSourceMap | null | undefined;
|
|
@@ -71,6 +71,7 @@ interface CustomEventMap {
|
|
|
71
71
|
|
|
72
72
|
interface InvalidatePayload {
|
|
73
73
|
path: string
|
|
74
|
+
message: string | undefined
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
type InferCustomEventPayload<T extends string> =
|
|
@@ -88,22 +89,21 @@ interface ViteHotContext {
|
|
|
88
89
|
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
89
90
|
accept(
|
|
90
91
|
deps: readonly string[],
|
|
91
|
-
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
92
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
92
93
|
): void
|
|
93
94
|
|
|
94
|
-
acceptExports(exportNames: string | readonly string[]): void
|
|
95
95
|
acceptExports(
|
|
96
96
|
exportNames: string | readonly string[],
|
|
97
|
-
cb
|
|
97
|
+
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
98
98
|
): void
|
|
99
99
|
|
|
100
100
|
dispose(cb: (data: any) => void): void
|
|
101
|
-
|
|
102
|
-
invalidate(): void
|
|
101
|
+
prune(cb: (data: any) => void): void
|
|
102
|
+
invalidate(message?: string): void
|
|
103
103
|
|
|
104
104
|
on<T extends string>(
|
|
105
105
|
event: T,
|
|
106
|
-
cb: (payload: InferCustomEventPayload<T>) => void
|
|
106
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
107
107
|
): void
|
|
108
108
|
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
109
109
|
}
|
|
@@ -175,8 +175,8 @@ declare class ViteNodeRunner {
|
|
|
175
175
|
hasNestedDefault(target: any): any;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
type Nullable<T> = T | null | undefined;
|
|
179
|
+
type Arrayable<T> = T | Array<T>;
|
|
180
180
|
interface DepsHandlingOptions {
|
|
181
181
|
external?: (string | RegExp)[];
|
|
182
182
|
inline?: (string | RegExp)[] | true;
|
|
@@ -202,10 +202,10 @@ interface FetchResult {
|
|
|
202
202
|
externalize?: string;
|
|
203
203
|
map?: RawSourceMap;
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
|
|
206
|
+
type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
207
|
+
type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
208
|
+
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
209
209
|
interface ModuleCache {
|
|
210
210
|
promise?: Promise<any>;
|
|
211
211
|
exports?: any;
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-
|
|
1
|
+
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-fc7e68bc.js';
|
package/dist/utils.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.8",
|
|
4
4
|
"description": "Vite as Node.js runtime",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"pathe": "^0.2.0",
|
|
75
75
|
"source-map": "^0.6.1",
|
|
76
76
|
"source-map-support": "^0.5.21",
|
|
77
|
-
"vite": "^3.0.0"
|
|
77
|
+
"vite": "^3.0.0 || ^4.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/debug": "^4.1.7",
|