vite-node 0.20.3 → 0.22.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/dist/cli.cjs +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/client.cjs +5 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.mjs +5 -1
- package/dist/hmr.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +2 -2
- package/dist/{types-b9c999e6.d.ts → types-24fd0349.d.ts} +0 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +3 -3
- package/cli.d.ts +0 -8
- package/client.d.ts +0 -37
- package/index.d.ts +0 -1
- package/server.d.ts +0 -26
- package/types.d.ts +0 -68
- package/utils.d.ts +0 -10
package/dist/cli.cjs
CHANGED
|
@@ -629,7 +629,7 @@ class CAC extends events.EventEmitter {
|
|
|
629
629
|
|
|
630
630
|
const cac = (name = "") => new CAC(name);
|
|
631
631
|
|
|
632
|
-
var version = "0.
|
|
632
|
+
var version = "0.22.0";
|
|
633
633
|
|
|
634
634
|
const cli = cac("vite-node");
|
|
635
635
|
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
package/dist/cli.mjs
CHANGED
|
@@ -627,7 +627,7 @@ class CAC extends EventEmitter {
|
|
|
627
627
|
|
|
628
628
|
const cac = (name = "") => new CAC(name);
|
|
629
629
|
|
|
630
|
-
var version = "0.
|
|
630
|
+
var version = "0.22.0";
|
|
631
631
|
|
|
632
632
|
const cli = cac("vite-node");
|
|
633
633
|
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,7 +169,11 @@ ${getStack()}`), 2e3);
|
|
|
169
169
|
const url$1 = url.pathToFileURL(fsPath).href;
|
|
170
170
|
const meta = { url: url$1 };
|
|
171
171
|
const exports = /* @__PURE__ */ Object.create(null);
|
|
172
|
-
exports
|
|
172
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
173
|
+
value: "Module",
|
|
174
|
+
enumerable: false,
|
|
175
|
+
configurable: false
|
|
176
|
+
});
|
|
173
177
|
this.moduleCache.set(fsPath, { code: transformed, exports });
|
|
174
178
|
const __filename = url.fileURLToPath(url$1);
|
|
175
179
|
const moduleProxy = {
|
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-24fd0349.js';
|
package/dist/client.mjs
CHANGED
|
@@ -142,7 +142,11 @@ ${getStack()}`), 2e3);
|
|
|
142
142
|
const url = pathToFileURL(fsPath).href;
|
|
143
143
|
const meta = { url };
|
|
144
144
|
const exports = /* @__PURE__ */ Object.create(null);
|
|
145
|
-
exports
|
|
145
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
146
|
+
value: "Module",
|
|
147
|
+
enumerable: false,
|
|
148
|
+
configurable: false
|
|
149
|
+
});
|
|
146
150
|
this.moduleCache.set(fsPath, { code: transformed, exports });
|
|
147
151
|
const __filename = fileURLToPath(url);
|
|
148
152
|
const moduleProxy = {
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { HMRPayload, Plugin } from 'vite';
|
|
3
|
-
import { U as UpdatePayload, P as PrunePayload, g as FullReloadPayload, E as ErrorPayload, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-
|
|
3
|
+
import { U as UpdatePayload, P as PrunePayload, g as FullReloadPayload, E as ErrorPayload, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-24fd0349.js';
|
|
4
4
|
|
|
5
5
|
declare type EventType = string | symbol;
|
|
6
6
|
declare type Handler<T = unknown> = (event: T) => void;
|
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-24fd0349.js';
|
package/dist/server.cjs
CHANGED
|
@@ -135,7 +135,7 @@ class ViteNodeServer {
|
|
|
135
135
|
}
|
|
136
136
|
async resolveId(id, importer) {
|
|
137
137
|
if (importer && !importer.startsWith(this.server.config.root))
|
|
138
|
-
importer = pathe.
|
|
138
|
+
importer = pathe.resolve(this.server.config.root, importer);
|
|
139
139
|
const mode = importer && this.getTransformMode(importer) || "ssr";
|
|
140
140
|
return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
|
|
141
141
|
}
|
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 } from './types-
|
|
2
|
+
import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-24fd0349.js';
|
|
3
3
|
|
|
4
4
|
declare class Debugger {
|
|
5
5
|
options: DebuggerOptions;
|
package/dist/server.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolve } from 'pathe';
|
|
2
2
|
import createDebug from 'debug';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
4
|
import { isNodeBuiltin, isValidNodeImport } from 'mlly';
|
|
@@ -127,7 +127,7 @@ class ViteNodeServer {
|
|
|
127
127
|
}
|
|
128
128
|
async resolveId(id, importer) {
|
|
129
129
|
if (importer && !importer.startsWith(this.server.config.root))
|
|
130
|
-
importer =
|
|
130
|
+
importer = resolve(this.server.config.root, importer);
|
|
131
131
|
const mode = importer && this.getTransformMode(importer) || "ssr";
|
|
132
132
|
return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
|
|
133
133
|
}
|
|
File without changes
|
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-24fd0349.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.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Vite as Node.js runtime",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"debug": "^4.3.4",
|
|
68
|
-
"mlly": "^0.5.
|
|
68
|
+
"mlly": "^0.5.12",
|
|
69
69
|
"pathe": "^0.2.0",
|
|
70
70
|
"vite": "^2.9.12 || ^3.0.0-0"
|
|
71
71
|
},
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/debug": "^4.1.7",
|
|
74
74
|
"cac": "^6.7.12",
|
|
75
75
|
"picocolors": "^1.0.0",
|
|
76
|
-
"rollup": "^2.77.
|
|
76
|
+
"rollup": "^2.77.3"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"build": "rimraf dist && rollup -c",
|
package/cli.d.ts
DELETED
package/client.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ViteNodeRunnerOptions, ModuleCache } from './types.js';
|
|
2
|
-
|
|
3
|
-
declare const DEFAULT_REQUEST_STUBS: {
|
|
4
|
-
'/@vite/client': {
|
|
5
|
-
injectQuery: (id: string) => string;
|
|
6
|
-
createHotContext(): {
|
|
7
|
-
accept: () => void;
|
|
8
|
-
prune: () => void;
|
|
9
|
-
};
|
|
10
|
-
updateStyle(): void;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
declare class ViteNodeRunner {
|
|
14
|
-
options: ViteNodeRunnerOptions;
|
|
15
|
-
root: string;
|
|
16
|
-
moduleCache: Map<string, ModuleCache>;
|
|
17
|
-
constructor(options: ViteNodeRunnerOptions);
|
|
18
|
-
executeFile(file: string): Promise<any>;
|
|
19
|
-
executeId(id: string): Promise<any>;
|
|
20
|
-
cachedRequest(rawId: string, callstack: string[]): Promise<any>;
|
|
21
|
-
directRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
|
|
22
|
-
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
23
|
-
setCache(id: string, mod: Partial<ModuleCache>): void;
|
|
24
|
-
shouldResolveId(dep: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Define if a module should be interop-ed
|
|
27
|
-
* This function mostly for the ability to override by subclass
|
|
28
|
-
*/
|
|
29
|
-
shouldInterop(path: string, mod: any): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Import a module and interop it
|
|
32
|
-
*/
|
|
33
|
-
interopedImport(path: string): Promise<any>;
|
|
34
|
-
hasNestedDefault(target: any): any;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { DEFAULT_REQUEST_STUBS, ViteNodeRunner };
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DepsHandlingOptions, FetchFunction, FetchResult, ModuleCache, RawSourceMap, ResolveIdFunction, StartOfSourceMap, ViteNodeResolveId, ViteNodeRunnerOptions, ViteNodeServerOptions } from './types.js';
|
package/server.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ViteDevServer, TransformResult } from 'vite';
|
|
2
|
-
import { DepsHandlingOptions, ViteNodeServerOptions, FetchResult, ViteNodeResolveId } from './types.js';
|
|
3
|
-
|
|
4
|
-
declare function guessCJSversion(id: string): string | undefined;
|
|
5
|
-
declare function shouldExternalize(id: string, options?: DepsHandlingOptions, cache?: Map<string, Promise<string | false>>): Promise<string | false>;
|
|
6
|
-
|
|
7
|
-
declare class ViteNodeServer {
|
|
8
|
-
server: ViteDevServer;
|
|
9
|
-
options: ViteNodeServerOptions;
|
|
10
|
-
private fetchPromiseMap;
|
|
11
|
-
private transformPromiseMap;
|
|
12
|
-
fetchCache: Map<string, {
|
|
13
|
-
timestamp: number;
|
|
14
|
-
result: FetchResult;
|
|
15
|
-
}>;
|
|
16
|
-
constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
|
|
17
|
-
shouldExternalize(id: string): Promise<string | false>;
|
|
18
|
-
resolveId(id: string, importer?: string): Promise<ViteNodeResolveId | null>;
|
|
19
|
-
fetchModule(id: string): Promise<FetchResult>;
|
|
20
|
-
transformRequest(id: string): Promise<TransformResult | null | undefined>;
|
|
21
|
-
getTransformMode(id: string): "web" | "ssr";
|
|
22
|
-
private _fetchModule;
|
|
23
|
-
private _transformRequest;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { ViteNodeServer, guessCJSversion, shouldExternalize };
|
package/types.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
interface DepsHandlingOptions {
|
|
2
|
-
external?: (string | RegExp)[];
|
|
3
|
-
inline?: (string | RegExp)[];
|
|
4
|
-
/**
|
|
5
|
-
* Try to guess the CJS version of a package when it's invalid ESM
|
|
6
|
-
* @default true
|
|
7
|
-
*/
|
|
8
|
-
fallbackCJS?: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface StartOfSourceMap {
|
|
11
|
-
file?: string;
|
|
12
|
-
sourceRoot?: string;
|
|
13
|
-
}
|
|
14
|
-
interface RawSourceMap extends StartOfSourceMap {
|
|
15
|
-
version: string;
|
|
16
|
-
sources: string[];
|
|
17
|
-
names: string[];
|
|
18
|
-
sourcesContent?: string[];
|
|
19
|
-
mappings: string;
|
|
20
|
-
}
|
|
21
|
-
interface FetchResult {
|
|
22
|
-
code?: string;
|
|
23
|
-
externalize?: string;
|
|
24
|
-
map?: RawSourceMap;
|
|
25
|
-
}
|
|
26
|
-
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
27
|
-
declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
28
|
-
interface ModuleCache {
|
|
29
|
-
promise?: Promise<any>;
|
|
30
|
-
exports?: any;
|
|
31
|
-
code?: string;
|
|
32
|
-
}
|
|
33
|
-
interface ViteNodeRunnerOptions {
|
|
34
|
-
fetchModule: FetchFunction;
|
|
35
|
-
resolveId: ResolveIdFunction;
|
|
36
|
-
root: string;
|
|
37
|
-
base?: string;
|
|
38
|
-
moduleCache?: Map<string, ModuleCache>;
|
|
39
|
-
interopDefault?: boolean;
|
|
40
|
-
requestStubs?: Record<string, any>;
|
|
41
|
-
}
|
|
42
|
-
interface ViteNodeResolveId {
|
|
43
|
-
external?: boolean | 'absolute' | 'relative';
|
|
44
|
-
id: string;
|
|
45
|
-
meta?: Record<string, any> | null;
|
|
46
|
-
moduleSideEffects?: boolean | 'no-treeshake' | null;
|
|
47
|
-
syntheticNamedExports?: boolean | string | null;
|
|
48
|
-
}
|
|
49
|
-
interface ViteNodeServerOptions {
|
|
50
|
-
/**
|
|
51
|
-
* Inject inline sourcemap to modules
|
|
52
|
-
* @default 'inline'
|
|
53
|
-
*/
|
|
54
|
-
sourcemap?: 'inline' | boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Deps handling
|
|
57
|
-
*/
|
|
58
|
-
deps?: DepsHandlingOptions;
|
|
59
|
-
/**
|
|
60
|
-
* Transform method for modules
|
|
61
|
-
*/
|
|
62
|
-
transformMode?: {
|
|
63
|
-
ssr?: RegExp[];
|
|
64
|
-
web?: RegExp[];
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { DepsHandlingOptions, FetchFunction, FetchResult, ModuleCache, RawSourceMap, ResolveIdFunction, StartOfSourceMap, ViteNodeResolveId, ViteNodeRunnerOptions, ViteNodeServerOptions };
|
package/utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TransformResult } from 'vite';
|
|
2
|
-
|
|
3
|
-
declare const isWindows: boolean;
|
|
4
|
-
declare function slash(str: string): string;
|
|
5
|
-
declare function normalizeId(id: string, base?: string): string;
|
|
6
|
-
declare function isPrimitive(v: any): boolean;
|
|
7
|
-
declare function toFilePath(id: string, root: string): string;
|
|
8
|
-
declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
|
|
9
|
-
|
|
10
|
-
export { isPrimitive, isWindows, normalizeId, slash, toFilePath, withInlineSourcemap };
|