vite-node 2.1.2 → 2.1.3
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 +8 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +8 -7
- package/dist/client.d.ts +1 -1
- package/dist/hmr.d.ts +1 -1
- package/dist/{index-CCsqCcr7.d.ts → index-z0R8hVRu.d.ts} +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +13 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +13 -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
|
@@ -12,15 +12,15 @@ var hmr = require('./chunk-hmr.cjs');
|
|
|
12
12
|
require('node:perf_hooks');
|
|
13
13
|
require('node:fs');
|
|
14
14
|
require('node:assert');
|
|
15
|
+
require('node:url');
|
|
15
16
|
require('pathe');
|
|
16
17
|
require('debug');
|
|
17
18
|
require('./constants.cjs');
|
|
18
19
|
require('node:module');
|
|
19
|
-
require('node:url');
|
|
20
20
|
require('node:vm');
|
|
21
21
|
require('node:events');
|
|
22
22
|
|
|
23
|
-
var version = "2.1.
|
|
23
|
+
var version = "2.1.3";
|
|
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");
|
|
@@ -112,26 +112,27 @@ async function run(files, options = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
function parseServerOptions(serverOptions) {
|
|
115
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
115
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
116
116
|
const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : utils.toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline);
|
|
117
117
|
return {
|
|
118
118
|
...serverOptions,
|
|
119
119
|
deps: {
|
|
120
120
|
...serverOptions.deps,
|
|
121
|
+
inlineFiles: utils.toArray((_c = serverOptions.deps) == null ? void 0 : _c.inlineFiles),
|
|
121
122
|
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
122
123
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
123
124
|
}) : true,
|
|
124
|
-
external: utils.toArray((
|
|
125
|
+
external: utils.toArray((_d = serverOptions.deps) == null ? void 0 : _d.external).map((dep) => {
|
|
125
126
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
126
127
|
}),
|
|
127
|
-
moduleDirectories: ((
|
|
128
|
+
moduleDirectories: ((_e = serverOptions.deps) == null ? void 0 : _e.moduleDirectories) ? utils.toArray((_f = serverOptions.deps) == null ? void 0 : _f.moduleDirectories) : void 0
|
|
128
129
|
},
|
|
129
130
|
transformMode: {
|
|
130
131
|
...serverOptions.transformMode,
|
|
131
|
-
ssr: utils.toArray((
|
|
132
|
+
ssr: utils.toArray((_g = serverOptions.transformMode) == null ? void 0 : _g.ssr).map(
|
|
132
133
|
(dep) => new RegExp(dep)
|
|
133
134
|
),
|
|
134
|
-
web: utils.toArray((
|
|
135
|
+
web: utils.toArray((_h = serverOptions.transformMode) == null ? void 0 : _h.web).map(
|
|
135
136
|
(dep) => new RegExp(dep)
|
|
136
137
|
)
|
|
137
138
|
}
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -10,15 +10,15 @@ import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } fro
|
|
|
10
10
|
import 'node:perf_hooks';
|
|
11
11
|
import 'node:fs';
|
|
12
12
|
import 'node:assert';
|
|
13
|
+
import 'node:url';
|
|
13
14
|
import 'pathe';
|
|
14
15
|
import 'debug';
|
|
15
16
|
import './constants.mjs';
|
|
16
17
|
import 'node:module';
|
|
17
|
-
import 'node:url';
|
|
18
18
|
import 'node:vm';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
|
|
21
|
-
var version = "2.1.
|
|
21
|
+
var version = "2.1.3";
|
|
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");
|
|
@@ -110,26 +110,27 @@ async function run(files, options = {}) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function parseServerOptions(serverOptions) {
|
|
113
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
113
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
114
114
|
const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline);
|
|
115
115
|
return {
|
|
116
116
|
...serverOptions,
|
|
117
117
|
deps: {
|
|
118
118
|
...serverOptions.deps,
|
|
119
|
+
inlineFiles: toArray((_c = serverOptions.deps) == null ? void 0 : _c.inlineFiles),
|
|
119
120
|
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
120
121
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
121
122
|
}) : true,
|
|
122
|
-
external: toArray((
|
|
123
|
+
external: toArray((_d = serverOptions.deps) == null ? void 0 : _d.external).map((dep) => {
|
|
123
124
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
124
125
|
}),
|
|
125
|
-
moduleDirectories: ((
|
|
126
|
+
moduleDirectories: ((_e = serverOptions.deps) == null ? void 0 : _e.moduleDirectories) ? toArray((_f = serverOptions.deps) == null ? void 0 : _f.moduleDirectories) : void 0
|
|
126
127
|
},
|
|
127
128
|
transformMode: {
|
|
128
129
|
...serverOptions.transformMode,
|
|
129
|
-
ssr: toArray((
|
|
130
|
+
ssr: toArray((_g = serverOptions.transformMode) == null ? void 0 : _g.ssr).map(
|
|
130
131
|
(dep) => new RegExp(dep)
|
|
131
132
|
),
|
|
132
|
-
web: toArray((
|
|
133
|
+
web: toArray((_h = serverOptions.transformMode) == null ? void 0 : _h.web).map(
|
|
133
134
|
(dep) => new RegExp(dep)
|
|
134
135
|
)
|
|
135
136
|
}
|
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-z0R8hVRu.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-z0R8hVRu.js';
|
|
4
4
|
import './trace-mapping.d-DLVdEqOp.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
@@ -207,6 +207,7 @@ type Awaitable<T> = T | PromiseLike<T>;
|
|
|
207
207
|
interface DepsHandlingOptions {
|
|
208
208
|
external?: (string | RegExp)[];
|
|
209
209
|
inline?: (string | RegExp)[] | true;
|
|
210
|
+
inlineFiles?: string[];
|
|
210
211
|
/**
|
|
211
212
|
* A list of directories that are considered to hold Node.js modules
|
|
212
213
|
* Have to include "/" at the start and end of the path
|
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-z0R8hVRu.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
|
package/dist/server.cjs
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var node_perf_hooks = require('node:perf_hooks');
|
|
4
4
|
var fs = require('node:fs');
|
|
5
5
|
var assert = require('node:assert');
|
|
6
|
+
var node_url = require('node:url');
|
|
6
7
|
var pathe = require('pathe');
|
|
7
8
|
var createDebug = require('debug');
|
|
8
9
|
var utils = require('./utils.cjs');
|
|
9
10
|
var constants = require('./constants.cjs');
|
|
10
11
|
var browser = require('./chunk-browser.cjs');
|
|
11
12
|
var sourceMap = require('./source-map.cjs');
|
|
12
|
-
require('node:url');
|
|
13
13
|
require('node:module');
|
|
14
14
|
require('node:path');
|
|
15
15
|
|
|
@@ -94,6 +94,9 @@ async function _shouldExternalize(id, options) {
|
|
|
94
94
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) {
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
|
+
if ((options == null ? void 0 : options.inlineFiles) && (options == null ? void 0 : options.inlineFiles.includes(id))) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
97
100
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) {
|
|
98
101
|
return id;
|
|
99
102
|
}
|
|
@@ -278,6 +281,15 @@ class ViteNodeServer {
|
|
|
278
281
|
if (options.debug) {
|
|
279
282
|
this.debugger = new Debugger(server.config.root, options.debug);
|
|
280
283
|
}
|
|
284
|
+
if (options.deps.inlineFiles) {
|
|
285
|
+
options.deps.inlineFiles = options.deps.inlineFiles.flatMap((file) => {
|
|
286
|
+
if (file.startsWith("file://")) {
|
|
287
|
+
return file;
|
|
288
|
+
}
|
|
289
|
+
const resolvedId = pathe.resolve(file);
|
|
290
|
+
return [resolvedId, node_url.pathToFileURL(resolvedId).href];
|
|
291
|
+
});
|
|
292
|
+
}
|
|
281
293
|
(_c = options.deps).moduleDirectories ?? (_c.moduleDirectories = []);
|
|
282
294
|
const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES;
|
|
283
295
|
const customModuleDirectories = envValue == null ? void 0 : envValue.split(",");
|
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-z0R8hVRu.js';
|
|
3
3
|
import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
|
|
4
4
|
|
|
5
5
|
declare class Debugger {
|
package/dist/server.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 { pathToFileURL } from 'node:url';
|
|
4
5
|
import { join, extname, dirname, resolve, relative, normalize } from 'pathe';
|
|
5
6
|
import createDebug from 'debug';
|
|
6
7
|
import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, normalizeModuleId, toFilePath } from './utils.mjs';
|
|
7
8
|
import { KNOWN_ASSET_RE } from './constants.mjs';
|
|
8
9
|
import { f } from './chunk-browser.mjs';
|
|
9
10
|
import { withInlineSourcemap } from './source-map.mjs';
|
|
10
|
-
import 'node:url';
|
|
11
11
|
import 'node:module';
|
|
12
12
|
import 'node:path';
|
|
13
13
|
|
|
@@ -92,6 +92,9 @@ async function _shouldExternalize(id, options) {
|
|
|
92
92
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) {
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
|
+
if ((options == null ? void 0 : options.inlineFiles) && (options == null ? void 0 : options.inlineFiles.includes(id))) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
95
98
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) {
|
|
96
99
|
return id;
|
|
97
100
|
}
|
|
@@ -276,6 +279,15 @@ class ViteNodeServer {
|
|
|
276
279
|
if (options.debug) {
|
|
277
280
|
this.debugger = new Debugger(server.config.root, options.debug);
|
|
278
281
|
}
|
|
282
|
+
if (options.deps.inlineFiles) {
|
|
283
|
+
options.deps.inlineFiles = options.deps.inlineFiles.flatMap((file) => {
|
|
284
|
+
if (file.startsWith("file://")) {
|
|
285
|
+
return file;
|
|
286
|
+
}
|
|
287
|
+
const resolvedId = resolve(file);
|
|
288
|
+
return [resolvedId, pathToFileURL(resolvedId).href];
|
|
289
|
+
});
|
|
290
|
+
}
|
|
279
291
|
(_c = options.deps).moduleDirectories ?? (_c.moduleDirectories = []);
|
|
280
292
|
const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES;
|
|
281
293
|
const customModuleDirectories = envValue == null ? void 0 : envValue.split(",");
|
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-z0R8hVRu.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