vite-node 2.0.0-beta.11 → 2.0.0-beta.13
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 +7 -3
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +8 -4
- package/dist/client.d.ts +1 -1
- package/dist/hmr.d.ts +1 -1
- package/dist/{index-D1EszD4V.d.ts → index-CCsqCcr7.d.ts} +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/server.d.ts +1 -1
- 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.13";
|
|
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");
|
|
@@ -35,7 +35,7 @@ if (cli.args.length === 0) {
|
|
|
35
35
|
cli.parse(executeArgs);
|
|
36
36
|
}
|
|
37
37
|
async function run(files, options = {}) {
|
|
38
|
-
var _a;
|
|
38
|
+
var _a, _b;
|
|
39
39
|
if (options.script) {
|
|
40
40
|
files = [files[0]];
|
|
41
41
|
options = {};
|
|
@@ -73,6 +73,10 @@ async function run(files, options = {}) {
|
|
|
73
73
|
plugins: [options.watch && hmr.viteNodeHmrPlugin()]
|
|
74
74
|
});
|
|
75
75
|
await server$1.pluginContainer.buildStart({});
|
|
76
|
+
const env = vite.loadEnv(server$1.config.mode, server$1.config.envDir, "");
|
|
77
|
+
for (const key in env) {
|
|
78
|
+
(_a = process.env)[key] ?? (_a[key] = env[key]);
|
|
79
|
+
}
|
|
76
80
|
const node = new server.ViteNodeServer(server$1, serverOptions);
|
|
77
81
|
sourceMap.installSourcemapsSupport({
|
|
78
82
|
getSourceMap: (source) => node.getSourceMap(source)
|
|
@@ -97,7 +101,7 @@ async function run(files, options = {}) {
|
|
|
97
101
|
if (!options.watch) {
|
|
98
102
|
await server$1.close();
|
|
99
103
|
}
|
|
100
|
-
(
|
|
104
|
+
(_b = server$1.emitter) == null ? void 0 : _b.on("message", (payload) => {
|
|
101
105
|
hmr.handleMessage(runner, server$1.emitter, files, payload);
|
|
102
106
|
});
|
|
103
107
|
if (options.watch) {
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { createServer } from 'vite';
|
|
4
|
+
import { createServer, loadEnv } from 'vite';
|
|
5
5
|
import { ViteNodeServer } from './server.mjs';
|
|
6
6
|
import { ViteNodeRunner } from './client.mjs';
|
|
7
7
|
import { toArray } from './utils.mjs';
|
|
@@ -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.13";
|
|
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");
|
|
@@ -33,7 +33,7 @@ if (cli.args.length === 0) {
|
|
|
33
33
|
cli.parse(executeArgs);
|
|
34
34
|
}
|
|
35
35
|
async function run(files, options = {}) {
|
|
36
|
-
var _a;
|
|
36
|
+
var _a, _b;
|
|
37
37
|
if (options.script) {
|
|
38
38
|
files = [files[0]];
|
|
39
39
|
options = {};
|
|
@@ -71,6 +71,10 @@ async function run(files, options = {}) {
|
|
|
71
71
|
plugins: [options.watch && viteNodeHmrPlugin()]
|
|
72
72
|
});
|
|
73
73
|
await server.pluginContainer.buildStart({});
|
|
74
|
+
const env = loadEnv(server.config.mode, server.config.envDir, "");
|
|
75
|
+
for (const key in env) {
|
|
76
|
+
(_a = process.env)[key] ?? (_a[key] = env[key]);
|
|
77
|
+
}
|
|
74
78
|
const node = new ViteNodeServer(server, serverOptions);
|
|
75
79
|
installSourcemapsSupport({
|
|
76
80
|
getSourceMap: (source) => node.getSourceMap(source)
|
|
@@ -95,7 +99,7 @@ async function run(files, options = {}) {
|
|
|
95
99
|
if (!options.watch) {
|
|
96
100
|
await server.close();
|
|
97
101
|
}
|
|
98
|
-
(
|
|
102
|
+
(_b = server.emitter) == null ? void 0 : _b.on("message", (payload) => {
|
|
99
103
|
handleMessage(runner, server.emitter, files, payload);
|
|
100
104
|
});
|
|
101
105
|
if (options.watch) {
|
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-CCsqCcr7.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-CCsqCcr7.js';
|
|
4
4
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
@@ -84,6 +84,7 @@ interface WebSocketConnectionPayload {
|
|
|
84
84
|
* This might be removed in the future if we didn't find reasonable use cases.
|
|
85
85
|
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
|
86
86
|
*/
|
|
87
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
87
88
|
webSocket: WebSocket
|
|
88
89
|
}
|
|
89
90
|
|
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, l as ViteNodeResolveModule, 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-CCsqCcr7.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
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-CCsqCcr7.js';
|
|
3
3
|
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
4
4
|
|
|
5
5
|
declare class Debugger {
|
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, l as ViteNodeResolveModule, 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-CCsqCcr7.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