vite-node 0.12.10 → 0.14.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/README.md +10 -0
- package/dist/{client-f221b9b5.js → chunk-client.cjs} +1 -1
- package/dist/{client-3270fd45.js → chunk-client.mjs} +1 -1
- package/dist/{server-f6511dc4.js → chunk-server.cjs} +15 -2
- package/dist/{server-013a4491.js → chunk-server.mjs} +15 -2
- package/dist/{utils-c2e3d5fd.js → chunk-utils.cjs} +8 -0
- package/dist/{utils-b4f03380.js → chunk-utils.mjs} +8 -1
- package/dist/cli.cjs +46 -8
- package/dist/cli.d.ts +9 -1
- package/dist/{cli.js → cli.mjs} +46 -8
- package/dist/client.cjs +2 -2
- package/dist/client.d.ts +1 -1
- package/dist/{client.js → client.mjs} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/{index.js → index.mjs} +0 -0
- package/dist/server.cjs +2 -2
- package/dist/server.d.ts +1 -1
- package/dist/{server.js → server.mjs} +2 -2
- package/dist/{types-4b326db0.d.ts → types-93bdaf32.d.ts} +4 -2
- package/dist/types.d.ts +1 -1
- package/dist/{types.js → types.mjs} +0 -0
- package/dist/utils.cjs +2 -1
- package/dist/utils.d.ts +8 -1
- package/dist/utils.mjs +3 -0
- package/package.json +12 -13
- package/vite-node.mjs +1 -1
- package/dist/utils.js +0 -3
package/README.md
CHANGED
|
@@ -27,6 +27,16 @@ Options:
|
|
|
27
27
|
npx vite-node -h
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
### Options via CLI
|
|
31
|
+
|
|
32
|
+
[All `ViteNodeServer` options](https://github.com/vitest-dev/vitest/blob/main/packages/vite-node/src/types.ts#L61-L78) are supported by the CLI. They may be defined through the dot syntax, as shown below:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx vite-node --options.deps.inline="module-name" --options.deps.external="/module-regexp/" index.ts
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Note that for options supporting RegExps, strings passed to the CLI must start _and_ end with a `/`;
|
|
39
|
+
|
|
30
40
|
## Programmatic Usage
|
|
31
41
|
|
|
32
42
|
In Vite Node, the server and runner (client) are separated, so you can integrate them in different contexts (workers, cross-process, or remote) if needed. The demo below shows a simple example of having both (server and runner) running in the same context
|
|
@@ -6,7 +6,7 @@ var vm = require('vm');
|
|
|
6
6
|
var pathe = require('pathe');
|
|
7
7
|
var mlly = require('mlly');
|
|
8
8
|
var createDebug = require('debug');
|
|
9
|
-
var utils = require('./utils
|
|
9
|
+
var utils = require('./chunk-utils.cjs');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ import vm from 'vm';
|
|
|
4
4
|
import { resolve, dirname, isAbsolute, extname } from 'pathe';
|
|
5
5
|
import { isNodeBuiltin } from 'mlly';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
|
-
import { n as normalizeModuleId, s as slash,
|
|
7
|
+
import { n as normalizeModuleId, s as slash, b as normalizeRequestId, a as toFilePath, i as isPrimitive, m as mergeSlashes } from './chunk-utils.mjs';
|
|
8
8
|
|
|
9
9
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
10
10
|
const debugNative = createDebug("vite-node:client:native");
|
|
@@ -4,7 +4,7 @@ var pathe = require('pathe');
|
|
|
4
4
|
var createDebug = require('debug');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var mlly = require('mlly');
|
|
7
|
-
var utils = require('./utils
|
|
7
|
+
var utils = require('./chunk-utils.cjs');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
@@ -71,8 +71,10 @@ async function _shouldExternalize(id, options) {
|
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
function matchExternalizePattern(id, patterns) {
|
|
74
|
-
if (
|
|
74
|
+
if (patterns == null)
|
|
75
75
|
return false;
|
|
76
|
+
if (patterns === true)
|
|
77
|
+
return true;
|
|
76
78
|
for (const ex of patterns) {
|
|
77
79
|
if (typeof ex === "string") {
|
|
78
80
|
if (id.includes(`/node_modules/${ex}/`))
|
|
@@ -121,6 +123,17 @@ class ViteNodeServer {
|
|
|
121
123
|
this.fetchPromiseMap = /* @__PURE__ */ new Map();
|
|
122
124
|
this.transformPromiseMap = /* @__PURE__ */ new Map();
|
|
123
125
|
this.fetchCache = /* @__PURE__ */ new Map();
|
|
126
|
+
var _a, _b;
|
|
127
|
+
const ssrOptions = server.config.ssr;
|
|
128
|
+
if (ssrOptions) {
|
|
129
|
+
options.deps ?? (options.deps = {});
|
|
130
|
+
if (ssrOptions.noExternal === true) {
|
|
131
|
+
(_a = options.deps).inline ?? (_a.inline = true);
|
|
132
|
+
} else if (options.deps.inline !== true) {
|
|
133
|
+
(_b = options.deps).inline ?? (_b.inline = []);
|
|
134
|
+
options.deps.inline.push(...utils.toArray(ssrOptions.noExternal));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
124
137
|
}
|
|
125
138
|
shouldExternalize(id) {
|
|
126
139
|
return shouldExternalize(id, this.options.deps);
|
|
@@ -2,7 +2,7 @@ import { join } from 'pathe';
|
|
|
2
2
|
import createDebug from 'debug';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
4
|
import { isNodeBuiltin, isValidNodeImport } from 'mlly';
|
|
5
|
-
import { s as slash, t as toFilePath, w as withInlineSourcemap } from './utils
|
|
5
|
+
import { s as slash, t as toArray, a as toFilePath, w as withInlineSourcemap } from './chunk-utils.mjs';
|
|
6
6
|
|
|
7
7
|
const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
|
|
8
8
|
const ESM_FOLDER_RE = /\/esm\/(.*\.js)$/;
|
|
@@ -65,8 +65,10 @@ async function _shouldExternalize(id, options) {
|
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
67
|
function matchExternalizePattern(id, patterns) {
|
|
68
|
-
if (
|
|
68
|
+
if (patterns == null)
|
|
69
69
|
return false;
|
|
70
|
+
if (patterns === true)
|
|
71
|
+
return true;
|
|
70
72
|
for (const ex of patterns) {
|
|
71
73
|
if (typeof ex === "string") {
|
|
72
74
|
if (id.includes(`/node_modules/${ex}/`))
|
|
@@ -115,6 +117,17 @@ class ViteNodeServer {
|
|
|
115
117
|
this.fetchPromiseMap = /* @__PURE__ */ new Map();
|
|
116
118
|
this.transformPromiseMap = /* @__PURE__ */ new Map();
|
|
117
119
|
this.fetchCache = /* @__PURE__ */ new Map();
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const ssrOptions = server.config.ssr;
|
|
122
|
+
if (ssrOptions) {
|
|
123
|
+
options.deps ?? (options.deps = {});
|
|
124
|
+
if (ssrOptions.noExternal === true) {
|
|
125
|
+
(_a = options.deps).inline ?? (_a.inline = true);
|
|
126
|
+
} else if (options.deps.inline !== true) {
|
|
127
|
+
(_b = options.deps).inline ?? (_b.inline = []);
|
|
128
|
+
options.deps.inline.push(...toArray(ssrOptions.noExternal));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
118
131
|
}
|
|
119
132
|
shouldExternalize(id) {
|
|
120
133
|
return shouldExternalize(id, this.options.deps);
|
|
@@ -40,6 +40,13 @@ async function withInlineSourcemap(result) {
|
|
|
40
40
|
`;
|
|
41
41
|
return result;
|
|
42
42
|
}
|
|
43
|
+
function toArray(array) {
|
|
44
|
+
if (array === null || array === void 0)
|
|
45
|
+
array = [];
|
|
46
|
+
if (Array.isArray(array))
|
|
47
|
+
return array;
|
|
48
|
+
return [array];
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
exports.isPrimitive = isPrimitive;
|
|
45
52
|
exports.isWindows = isWindows;
|
|
@@ -47,5 +54,6 @@ exports.mergeSlashes = mergeSlashes;
|
|
|
47
54
|
exports.normalizeModuleId = normalizeModuleId;
|
|
48
55
|
exports.normalizeRequestId = normalizeRequestId;
|
|
49
56
|
exports.slash = slash;
|
|
57
|
+
exports.toArray = toArray;
|
|
50
58
|
exports.toFilePath = toFilePath;
|
|
51
59
|
exports.withInlineSourcemap = withInlineSourcemap;
|
|
@@ -38,5 +38,12 @@ async function withInlineSourcemap(result) {
|
|
|
38
38
|
`;
|
|
39
39
|
return result;
|
|
40
40
|
}
|
|
41
|
+
function toArray(array) {
|
|
42
|
+
if (array === null || array === void 0)
|
|
43
|
+
array = [];
|
|
44
|
+
if (Array.isArray(array))
|
|
45
|
+
return array;
|
|
46
|
+
return [array];
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
export {
|
|
49
|
+
export { toFilePath as a, normalizeRequestId as b, isWindows as c, isPrimitive as i, mergeSlashes as m, normalizeModuleId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
package/dist/cli.cjs
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
var events = require('events');
|
|
4
4
|
var kolorist = require('kolorist');
|
|
5
5
|
var vite = require('vite');
|
|
6
|
-
var server = require('./server
|
|
7
|
-
var client = require('./client
|
|
6
|
+
var server = require('./chunk-server.cjs');
|
|
7
|
+
var client = require('./chunk-client.cjs');
|
|
8
|
+
var utils = require('./chunk-utils.cjs');
|
|
8
9
|
require('pathe');
|
|
9
10
|
require('debug');
|
|
10
11
|
require('fs');
|
|
11
12
|
require('mlly');
|
|
12
|
-
require('./utils-c2e3d5fd.js');
|
|
13
|
-
require('url');
|
|
14
13
|
require('module');
|
|
14
|
+
require('url');
|
|
15
15
|
require('vm');
|
|
16
16
|
|
|
17
17
|
function toArr(any) {
|
|
@@ -625,12 +625,31 @@ class CAC extends events.EventEmitter {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
|
|
628
|
-
const cac = (name
|
|
628
|
+
const cac = (name) => new CAC(name);
|
|
629
629
|
|
|
630
|
-
var version = "0.
|
|
630
|
+
var version = "0.14.0";
|
|
631
631
|
|
|
632
|
+
var __defProp = Object.defineProperty;
|
|
633
|
+
var __defProps = Object.defineProperties;
|
|
634
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
635
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
636
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
637
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
638
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
639
|
+
var __spreadValues = (a, b) => {
|
|
640
|
+
for (var prop in b || (b = {}))
|
|
641
|
+
if (__hasOwnProp.call(b, prop))
|
|
642
|
+
__defNormalProp(a, prop, b[prop]);
|
|
643
|
+
if (__getOwnPropSymbols)
|
|
644
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
645
|
+
if (__propIsEnum.call(b, prop))
|
|
646
|
+
__defNormalProp(a, prop, b[prop]);
|
|
647
|
+
}
|
|
648
|
+
return a;
|
|
649
|
+
};
|
|
650
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
632
651
|
const cli = cac("vite-node");
|
|
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"').help();
|
|
652
|
+
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();
|
|
634
653
|
cli.command("[...files]").action(run);
|
|
635
654
|
cli.parse();
|
|
636
655
|
async function run(files, options = {}) {
|
|
@@ -640,13 +659,14 @@ async function run(files, options = {}) {
|
|
|
640
659
|
process.exit(1);
|
|
641
660
|
}
|
|
642
661
|
process.argv = [...process.argv.slice(0, 2), ...options["--"] || []];
|
|
662
|
+
const parsedServerOptions = options.options ? parseServerOptions(options.options) : void 0;
|
|
643
663
|
const server$1 = await vite.createServer({
|
|
644
664
|
logLevel: "error",
|
|
645
665
|
configFile: options.config,
|
|
646
666
|
root: options.root
|
|
647
667
|
});
|
|
648
668
|
await server$1.pluginContainer.buildStart({});
|
|
649
|
-
const node = new server.ViteNodeServer(server$1);
|
|
669
|
+
const node = new server.ViteNodeServer(server$1, parsedServerOptions);
|
|
650
670
|
const runner = new client.ViteNodeRunner({
|
|
651
671
|
root: server$1.config.root,
|
|
652
672
|
base: server$1.config.base,
|
|
@@ -672,3 +692,21 @@ async function run(files, options = {}) {
|
|
|
672
692
|
await runner.executeFile(file);
|
|
673
693
|
});
|
|
674
694
|
}
|
|
695
|
+
function parseServerOptions(serverOptions) {
|
|
696
|
+
var _a, _b, _c, _d, _e;
|
|
697
|
+
const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : utils.toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline);
|
|
698
|
+
return __spreadProps(__spreadValues({}, serverOptions), {
|
|
699
|
+
deps: __spreadProps(__spreadValues({}, serverOptions.deps), {
|
|
700
|
+
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
701
|
+
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
702
|
+
}) : true,
|
|
703
|
+
external: utils.toArray((_c = serverOptions.deps) == null ? void 0 : _c.external).map((dep) => {
|
|
704
|
+
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
705
|
+
})
|
|
706
|
+
}),
|
|
707
|
+
transformMode: __spreadProps(__spreadValues({}, serverOptions.transformMode), {
|
|
708
|
+
ssr: utils.toArray((_d = serverOptions.transformMode) == null ? void 0 : _d.ssr).map((dep) => new RegExp(dep)),
|
|
709
|
+
web: utils.toArray((_e = serverOptions.transformMode) == null ? void 0 : _e.web).map((dep) => new RegExp(dep))
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { e as ViteNodeServerOptions } from './types-93bdaf32.js';
|
|
2
|
+
|
|
1
3
|
interface CliOptions {
|
|
2
4
|
root?: string;
|
|
3
5
|
config?: string;
|
|
4
6
|
watch?: boolean;
|
|
7
|
+
options?: ViteNodeServerOptionsCLI;
|
|
5
8
|
'--'?: string[];
|
|
6
9
|
}
|
|
10
|
+
declare type Optional<T> = T | undefined;
|
|
11
|
+
declare type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = {
|
|
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
|
+
};
|
|
14
|
+
declare type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
|
|
7
15
|
|
|
8
|
-
export { CliOptions };
|
|
16
|
+
export { CliOptions, ViteNodeServerOptionsCLI };
|
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { red, cyan, dim } from 'kolorist';
|
|
3
3
|
import { createServer } from 'vite';
|
|
4
|
-
import { V as ViteNodeServer } from './server
|
|
5
|
-
import { V as ViteNodeRunner } from './client
|
|
4
|
+
import { V as ViteNodeServer } from './chunk-server.mjs';
|
|
5
|
+
import { V as ViteNodeRunner } from './chunk-client.mjs';
|
|
6
|
+
import { t as toArray } from './chunk-utils.mjs';
|
|
6
7
|
import 'pathe';
|
|
7
8
|
import 'debug';
|
|
8
9
|
import 'fs';
|
|
9
10
|
import 'mlly';
|
|
10
|
-
import './utils-b4f03380.js';
|
|
11
|
-
import 'url';
|
|
12
11
|
import 'module';
|
|
12
|
+
import 'url';
|
|
13
13
|
import 'vm';
|
|
14
14
|
|
|
15
15
|
function toArr(any) {
|
|
@@ -623,12 +623,31 @@ class CAC extends EventEmitter {
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
const cac = (name
|
|
626
|
+
const cac = (name) => new CAC(name);
|
|
627
627
|
|
|
628
|
-
var version = "0.
|
|
628
|
+
var version = "0.14.0";
|
|
629
629
|
|
|
630
|
+
var __defProp = Object.defineProperty;
|
|
631
|
+
var __defProps = Object.defineProperties;
|
|
632
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
633
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
634
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
635
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
636
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
637
|
+
var __spreadValues = (a, b) => {
|
|
638
|
+
for (var prop in b || (b = {}))
|
|
639
|
+
if (__hasOwnProp.call(b, prop))
|
|
640
|
+
__defNormalProp(a, prop, b[prop]);
|
|
641
|
+
if (__getOwnPropSymbols)
|
|
642
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
643
|
+
if (__propIsEnum.call(b, prop))
|
|
644
|
+
__defNormalProp(a, prop, b[prop]);
|
|
645
|
+
}
|
|
646
|
+
return a;
|
|
647
|
+
};
|
|
648
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
630
649
|
const cli = cac("vite-node");
|
|
631
|
-
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"').help();
|
|
650
|
+
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();
|
|
632
651
|
cli.command("[...files]").action(run);
|
|
633
652
|
cli.parse();
|
|
634
653
|
async function run(files, options = {}) {
|
|
@@ -638,13 +657,14 @@ async function run(files, options = {}) {
|
|
|
638
657
|
process.exit(1);
|
|
639
658
|
}
|
|
640
659
|
process.argv = [...process.argv.slice(0, 2), ...options["--"] || []];
|
|
660
|
+
const parsedServerOptions = options.options ? parseServerOptions(options.options) : void 0;
|
|
641
661
|
const server = await createServer({
|
|
642
662
|
logLevel: "error",
|
|
643
663
|
configFile: options.config,
|
|
644
664
|
root: options.root
|
|
645
665
|
});
|
|
646
666
|
await server.pluginContainer.buildStart({});
|
|
647
|
-
const node = new ViteNodeServer(server);
|
|
667
|
+
const node = new ViteNodeServer(server, parsedServerOptions);
|
|
648
668
|
const runner = new ViteNodeRunner({
|
|
649
669
|
root: server.config.root,
|
|
650
670
|
base: server.config.base,
|
|
@@ -670,3 +690,21 @@ async function run(files, options = {}) {
|
|
|
670
690
|
await runner.executeFile(file);
|
|
671
691
|
});
|
|
672
692
|
}
|
|
693
|
+
function parseServerOptions(serverOptions) {
|
|
694
|
+
var _a, _b, _c, _d, _e;
|
|
695
|
+
const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline);
|
|
696
|
+
return __spreadProps(__spreadValues({}, serverOptions), {
|
|
697
|
+
deps: __spreadProps(__spreadValues({}, serverOptions.deps), {
|
|
698
|
+
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
699
|
+
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
700
|
+
}) : true,
|
|
701
|
+
external: toArray((_c = serverOptions.deps) == null ? void 0 : _c.external).map((dep) => {
|
|
702
|
+
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
703
|
+
})
|
|
704
|
+
}),
|
|
705
|
+
transformMode: __spreadProps(__spreadValues({}, serverOptions.transformMode), {
|
|
706
|
+
ssr: toArray((_d = serverOptions.transformMode) == null ? void 0 : _d.ssr).map((dep) => new RegExp(dep)),
|
|
707
|
+
web: toArray((_e = serverOptions.transformMode) == null ? void 0 : _e.web).map((dep) => new RegExp(dep))
|
|
708
|
+
})
|
|
709
|
+
});
|
|
710
|
+
}
|
package/dist/client.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var client = require('./client
|
|
5
|
+
var client = require('./chunk-client.cjs');
|
|
6
6
|
require('module');
|
|
7
7
|
require('url');
|
|
8
8
|
require('vm');
|
|
9
9
|
require('pathe');
|
|
10
10
|
require('mlly');
|
|
11
11
|
require('debug');
|
|
12
|
-
require('./utils
|
|
12
|
+
require('./chunk-utils.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, g as ViteNodeRunner } from './types-
|
|
1
|
+
export { f as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, g as ViteNodeRunner } from './types-93bdaf32.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { D as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, V as ViteNodeRunner } from './client
|
|
1
|
+
export { D as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, V as ViteNodeRunner } from './chunk-client.mjs';
|
|
2
2
|
import 'module';
|
|
3
3
|
import 'url';
|
|
4
4
|
import 'vm';
|
|
5
5
|
import 'pathe';
|
|
6
6
|
import 'mlly';
|
|
7
7
|
import 'debug';
|
|
8
|
-
import './utils
|
|
8
|
+
import './chunk-utils.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, c as ModuleCache, M as ModuleCacheMap, 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, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, 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-93bdaf32.js';
|
|
File without changes
|
package/dist/server.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var server = require('./server
|
|
5
|
+
var server = require('./chunk-server.cjs');
|
|
6
6
|
require('pathe');
|
|
7
7
|
require('debug');
|
|
8
8
|
require('fs');
|
|
9
9
|
require('mlly');
|
|
10
|
-
require('./utils
|
|
10
|
+
require('./chunk-utils.cjs');
|
|
11
11
|
require('url');
|
|
12
12
|
|
|
13
13
|
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViteDevServer, TransformResult } from 'vite';
|
|
2
|
-
import { D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-
|
|
2
|
+
import { D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-93bdaf32.js';
|
|
3
3
|
|
|
4
4
|
declare function guessCJSversion(id: string): string | undefined;
|
|
5
5
|
declare function shouldExternalize(id: string, options?: DepsHandlingOptions, cache?: Map<string, Promise<string | false>>): Promise<string | false>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { V as ViteNodeServer, g as guessCJSversion, s as shouldExternalize } from './server
|
|
1
|
+
export { V as ViteNodeServer, g as guessCJSversion, s as shouldExternalize } from './chunk-server.mjs';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'debug';
|
|
4
4
|
import 'fs';
|
|
5
5
|
import 'mlly';
|
|
6
|
-
import './utils
|
|
6
|
+
import './chunk-utils.mjs';
|
|
7
7
|
import 'url';
|
|
@@ -49,9 +49,11 @@ declare class ViteNodeRunner {
|
|
|
49
49
|
private debugLog;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
declare type Nullable<T> = T | null | undefined;
|
|
53
|
+
declare type Arrayable<T> = T | Array<T>;
|
|
52
54
|
interface DepsHandlingOptions {
|
|
53
55
|
external?: (string | RegExp)[];
|
|
54
|
-
inline?: (string | RegExp)[];
|
|
56
|
+
inline?: (string | RegExp)[] | true;
|
|
55
57
|
/**
|
|
56
58
|
* Try to guess the CJS version of a package when it's invalid ESM
|
|
57
59
|
* @default false
|
|
@@ -117,4 +119,4 @@ interface ViteNodeServerOptions {
|
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
export { DepsHandlingOptions as D, FetchResult as F, ModuleCacheMap as M, RawSourceMap as R, StartOfSourceMap as S, ViteNodeRunnerOptions as V, FetchFunction as a, ResolveIdFunction as b, ModuleCache as c, ViteNodeResolveId as d, ViteNodeServerOptions as e, DEFAULT_REQUEST_STUBS as f, ViteNodeRunner as g };
|
|
122
|
+
export { Arrayable as A, DepsHandlingOptions as D, FetchResult as F, ModuleCacheMap as M, Nullable as N, RawSourceMap as R, StartOfSourceMap as S, ViteNodeRunnerOptions as V, FetchFunction as a, ResolveIdFunction as b, ModuleCache as c, ViteNodeResolveId as d, ViteNodeServerOptions as e, DEFAULT_REQUEST_STUBS as f, ViteNodeRunner as g };
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, c as ModuleCache, M as ModuleCacheMap, 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, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, 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-93bdaf32.js';
|
|
File without changes
|
package/dist/utils.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var utils = require('./utils
|
|
5
|
+
var utils = require('./chunk-utils.cjs');
|
|
6
6
|
require('url');
|
|
7
7
|
require('pathe');
|
|
8
8
|
|
|
@@ -14,5 +14,6 @@ exports.mergeSlashes = utils.mergeSlashes;
|
|
|
14
14
|
exports.normalizeModuleId = utils.normalizeModuleId;
|
|
15
15
|
exports.normalizeRequestId = utils.normalizeRequestId;
|
|
16
16
|
exports.slash = utils.slash;
|
|
17
|
+
exports.toArray = utils.toArray;
|
|
17
18
|
exports.toFilePath = utils.toFilePath;
|
|
18
19
|
exports.withInlineSourcemap = utils.withInlineSourcemap;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TransformResult } from 'vite';
|
|
2
|
+
import { N as Nullable, A as Arrayable } from './types-93bdaf32.js';
|
|
2
3
|
|
|
3
4
|
declare const isWindows: boolean;
|
|
4
5
|
declare function slash(str: string): string;
|
|
@@ -8,5 +9,11 @@ declare function normalizeModuleId(id: string): string;
|
|
|
8
9
|
declare function isPrimitive(v: any): boolean;
|
|
9
10
|
declare function toFilePath(id: string, root: string): string;
|
|
10
11
|
declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
14
|
+
*
|
|
15
|
+
* @category Array
|
|
16
|
+
*/
|
|
17
|
+
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
11
18
|
|
|
12
|
-
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, slash, toFilePath, withInlineSourcemap };
|
|
19
|
+
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, slash, toArray, toFilePath, withInlineSourcemap };
|
package/dist/utils.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.12.10",
|
|
3
|
+
"version": "0.14.0",
|
|
5
4
|
"description": "Vite as Node.js runtime",
|
|
6
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
6
|
"license": "MIT",
|
|
@@ -18,27 +17,27 @@
|
|
|
18
17
|
"exports": {
|
|
19
18
|
".": {
|
|
20
19
|
"types": "./dist/index.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
20
|
+
"require": "./dist/index.cjs",
|
|
21
|
+
"import": "./dist/index.mjs"
|
|
23
22
|
},
|
|
24
23
|
"./client": {
|
|
25
24
|
"types": "./dist/client.d.ts",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"require": "./dist/client.cjs",
|
|
26
|
+
"import": "./dist/client.mjs"
|
|
28
27
|
},
|
|
29
28
|
"./server": {
|
|
30
29
|
"types": "./dist/server.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
30
|
+
"require": "./dist/server.cjs",
|
|
31
|
+
"import": "./dist/server.mjs"
|
|
33
32
|
},
|
|
34
33
|
"./utils": {
|
|
35
34
|
"types": "./dist/utils.d.ts",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
35
|
+
"require": "./dist/utils.cjs",
|
|
36
|
+
"import": "./dist/utils.mjs"
|
|
38
37
|
}
|
|
39
38
|
},
|
|
40
|
-
"main": "./dist/index.
|
|
41
|
-
"module": "./dist/index.
|
|
39
|
+
"main": "./dist/index.mjs",
|
|
40
|
+
"module": "./dist/index.mjs",
|
|
42
41
|
"types": "./dist/index.d.ts",
|
|
43
42
|
"typesVersions": {
|
|
44
43
|
"*": {
|
|
@@ -69,7 +68,7 @@
|
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@types/debug": "^4.1.7",
|
|
71
70
|
"cac": "^6.7.12",
|
|
72
|
-
"rollup": "^2.
|
|
71
|
+
"rollup": "^2.75.3"
|
|
73
72
|
},
|
|
74
73
|
"scripts": {
|
|
75
74
|
"build": "rimraf dist && rollup -c",
|
package/vite-node.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import('./dist/cli.
|
|
2
|
+
import('./dist/cli.mjs')
|
package/dist/utils.js
DELETED