vite-node 2.0.0-beta.3 → 2.0.0-beta.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/dist/cli.cjs +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/hmr.d.ts +1 -1
- package/dist/{index-C38RQo3J.d.ts → index-D1EszD4V.d.ts} +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +14 -0
- package/dist/server.d.ts +7 -1
- package/dist/server.mjs +16 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -20,7 +20,7 @@ require('node:url');
|
|
|
20
20
|
require('node:vm');
|
|
21
21
|
require('node:events');
|
|
22
22
|
|
|
23
|
-
var version = "2.0.0-beta.
|
|
23
|
+
var version = "2.0.0-beta.4";
|
|
24
24
|
|
|
25
25
|
const cli = cac("vite-node");
|
|
26
26
|
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");
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import 'node:url';
|
|
|
18
18
|
import 'node:vm';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
|
|
21
|
-
var version = "2.0.0-beta.
|
|
21
|
+
var version = "2.0.0-beta.4";
|
|
22
22
|
|
|
23
23
|
const cli = cac("vite-node");
|
|
24
24
|
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");
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-
|
|
1
|
+
export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-D1EszD4V.js';
|
|
2
2
|
import './trace-mapping.d-DLVdEqOp.js';
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { HMRPayload, Plugin } from 'vite';
|
|
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-D1EszD4V.js';
|
|
4
4
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
@@ -274,6 +274,11 @@ interface ViteNodeResolveId {
|
|
|
274
274
|
moduleSideEffects?: boolean | 'no-treeshake' | null;
|
|
275
275
|
syntheticNamedExports?: boolean | string | null;
|
|
276
276
|
}
|
|
277
|
+
interface ViteNodeResolveModule {
|
|
278
|
+
external: string | null;
|
|
279
|
+
id: string;
|
|
280
|
+
fsPath: string;
|
|
281
|
+
}
|
|
277
282
|
interface ViteNodeServerOptions {
|
|
278
283
|
/**
|
|
279
284
|
* Inject inline sourcemap to modules
|
|
@@ -306,4 +311,4 @@ interface DebuggerOptions {
|
|
|
306
311
|
loadDumppedModules?: boolean;
|
|
307
312
|
}
|
|
308
313
|
|
|
309
|
-
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 Awaitable as f, type FetchFunction as g, type ResolveIdFunction as h, type CreateHotContextFunction as i, type ModuleCache as j, type ViteNodeRunnerOptions as k };
|
|
314
|
+
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 Awaitable as f, type FetchFunction as g, type ResolveIdFunction as h, type CreateHotContextFunction as i, type ModuleCache as j, type ViteNodeRunnerOptions as k, type ViteNodeResolveModule as l };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-
|
|
1
|
+
export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-D1EszD4V.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
package/dist/server.cjs
CHANGED
|
@@ -284,6 +284,20 @@ class ViteNodeServer {
|
|
|
284
284
|
const mode = transformMode ?? (importer && this.getTransformMode(importer) || "ssr");
|
|
285
285
|
return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
|
|
286
286
|
}
|
|
287
|
+
async resolveModule(rawId, resolved) {
|
|
288
|
+
const id = (resolved == null ? void 0 : resolved.id) || rawId;
|
|
289
|
+
const external = !pathe.isAbsolute(id) || this.isModuleDirectory(id) ? rawId : null;
|
|
290
|
+
return {
|
|
291
|
+
id,
|
|
292
|
+
fsPath: utils.cleanUrl(id),
|
|
293
|
+
external
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
isModuleDirectory(path) {
|
|
297
|
+
var _a;
|
|
298
|
+
const moduleDirectories = ((_a = this.options.deps) == null ? void 0 : _a.moduleDirectories) || ["/node_modules/"];
|
|
299
|
+
return moduleDirectories.some((dir) => path.includes(dir));
|
|
300
|
+
}
|
|
287
301
|
getSourceMap(source) {
|
|
288
302
|
var _a, _b;
|
|
289
303
|
const fetchResult = (_a = this.fetchCache.get(source)) == null ? void 0 : _a.result;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransformResult, ViteDevServer } from 'vite';
|
|
2
|
-
import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, d as ViteNodeResolveId, F as FetchResult } from './index-
|
|
2
|
+
import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, d as ViteNodeResolveId, F as FetchResult } from './index-D1EszD4V.js';
|
|
3
3
|
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
4
4
|
|
|
5
5
|
declare class Debugger {
|
|
@@ -43,6 +43,12 @@ declare class ViteNodeServer {
|
|
|
43
43
|
getTotalDuration(): number;
|
|
44
44
|
private ensureExists;
|
|
45
45
|
resolveId(id: string, importer?: string, transformMode?: 'web' | 'ssr'): Promise<ViteNodeResolveId | null>;
|
|
46
|
+
resolveModule(rawId: string, resolved: ViteNodeResolveId | null): Promise<{
|
|
47
|
+
id: string;
|
|
48
|
+
fsPath: string;
|
|
49
|
+
external: string | null;
|
|
50
|
+
}>;
|
|
51
|
+
private isModuleDirectory;
|
|
46
52
|
getSourceMap(source: string): EncodedSourceMap | null;
|
|
47
53
|
private assertMode;
|
|
48
54
|
fetchModule(id: string, transformMode?: 'web' | 'ssr'): Promise<FetchResult>;
|
package/dist/server.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { existsSync, promises } from 'node:fs';
|
|
3
3
|
import assert from 'node:assert';
|
|
4
|
-
import { join, extname, dirname, resolve, relative, normalize } from 'pathe';
|
|
4
|
+
import { join, extname, dirname, resolve, relative, normalize, isAbsolute } from 'pathe';
|
|
5
5
|
import createDebug from 'debug';
|
|
6
|
-
import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, normalizeModuleId, toFilePath } from './utils.mjs';
|
|
6
|
+
import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, cleanUrl, normalizeModuleId, toFilePath } from './utils.mjs';
|
|
7
7
|
import { KNOWN_ASSET_TYPES } from './constants.mjs';
|
|
8
8
|
import c from 'picocolors';
|
|
9
9
|
import { withInlineSourcemap } from './source-map.mjs';
|
|
@@ -282,6 +282,20 @@ class ViteNodeServer {
|
|
|
282
282
|
const mode = transformMode ?? (importer && this.getTransformMode(importer) || "ssr");
|
|
283
283
|
return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
|
|
284
284
|
}
|
|
285
|
+
async resolveModule(rawId, resolved) {
|
|
286
|
+
const id = (resolved == null ? void 0 : resolved.id) || rawId;
|
|
287
|
+
const external = !isAbsolute(id) || this.isModuleDirectory(id) ? rawId : null;
|
|
288
|
+
return {
|
|
289
|
+
id,
|
|
290
|
+
fsPath: cleanUrl(id),
|
|
291
|
+
external
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
isModuleDirectory(path) {
|
|
295
|
+
var _a;
|
|
296
|
+
const moduleDirectories = ((_a = this.options.deps) == null ? void 0 : _a.moduleDirectories) || ["/node_modules/"];
|
|
297
|
+
return moduleDirectories.some((dir) => path.includes(dir));
|
|
298
|
+
}
|
|
285
299
|
getSourceMap(source) {
|
|
286
300
|
var _a, _b;
|
|
287
301
|
const fetchResult = (_a = this.fetchCache.get(source)) == null ? void 0 : _a.result;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-
|
|
1
|
+
export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-D1EszD4V.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
package/dist/utils.d.ts
CHANGED