vite-node 0.13.1 → 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/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 +12 -11
- package/dist/cli.d.ts +2 -2
- package/dist/{cli.js → cli.mjs} +12 -11
- 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 +7 -8
- package/vite-node.mjs +1 -1
- package/cli.d.ts +0 -8
- package/client.d.ts +0 -37
- package/dist/utils.js +0 -3
- package/index.d.ts +0 -1
- package/server.d.ts +0 -26
- package/types.d.ts +0 -68
- package/utils.d.ts +0 -10
|
@@ -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) {
|
|
@@ -627,7 +627,7 @@ class CAC extends events.EventEmitter {
|
|
|
627
627
|
|
|
628
628
|
const cac = (name) => new CAC(name);
|
|
629
629
|
|
|
630
|
-
var version = "0.
|
|
630
|
+
var version = "0.14.0";
|
|
631
631
|
|
|
632
632
|
var __defProp = Object.defineProperty;
|
|
633
633
|
var __defProps = Object.defineProperties;
|
|
@@ -693,19 +693,20 @@ async function run(files, options = {}) {
|
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
function parseServerOptions(serverOptions) {
|
|
696
|
-
var _a, _b, _c, _d, _e
|
|
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);
|
|
697
698
|
return __spreadProps(__spreadValues({}, serverOptions), {
|
|
698
699
|
deps: __spreadProps(__spreadValues({}, serverOptions.deps), {
|
|
699
|
-
inline:
|
|
700
|
+
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
700
701
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
701
|
-
}),
|
|
702
|
-
external: (
|
|
702
|
+
}) : true,
|
|
703
|
+
external: utils.toArray((_c = serverOptions.deps) == null ? void 0 : _c.external).map((dep) => {
|
|
703
704
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
704
705
|
})
|
|
705
706
|
}),
|
|
706
707
|
transformMode: __spreadProps(__spreadValues({}, serverOptions.transformMode), {
|
|
707
|
-
ssr: (
|
|
708
|
-
web: (
|
|
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))
|
|
709
710
|
})
|
|
710
711
|
});
|
|
711
712
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as ViteNodeServerOptions } from './types-
|
|
1
|
+
import { e as ViteNodeServerOptions } from './types-93bdaf32.js';
|
|
2
2
|
|
|
3
3
|
interface CliOptions {
|
|
4
4
|
root?: string;
|
|
@@ -9,7 +9,7 @@ interface CliOptions {
|
|
|
9
9
|
}
|
|
10
10
|
declare type Optional<T> = T | undefined;
|
|
11
11
|
declare type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = {
|
|
12
|
-
[K in keyof T]: T[K] extends Optional<RegExp[]> ? string[] : T[K] extends Optional<(string | RegExp)[]> ? string[] : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K];
|
|
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
13
|
};
|
|
14
14
|
declare type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
|
|
15
15
|
|
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) {
|
|
@@ -625,7 +625,7 @@ class CAC extends EventEmitter {
|
|
|
625
625
|
|
|
626
626
|
const cac = (name) => new CAC(name);
|
|
627
627
|
|
|
628
|
-
var version = "0.
|
|
628
|
+
var version = "0.14.0";
|
|
629
629
|
|
|
630
630
|
var __defProp = Object.defineProperty;
|
|
631
631
|
var __defProps = Object.defineProperties;
|
|
@@ -691,19 +691,20 @@ async function run(files, options = {}) {
|
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
693
|
function parseServerOptions(serverOptions) {
|
|
694
|
-
var _a, _b, _c, _d, _e
|
|
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);
|
|
695
696
|
return __spreadProps(__spreadValues({}, serverOptions), {
|
|
696
697
|
deps: __spreadProps(__spreadValues({}, serverOptions.deps), {
|
|
697
|
-
inline:
|
|
698
|
+
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
698
699
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
699
|
-
}),
|
|
700
|
-
external: (
|
|
700
|
+
}) : true,
|
|
701
|
+
external: toArray((_c = serverOptions.deps) == null ? void 0 : _c.external).map((dep) => {
|
|
701
702
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
702
703
|
})
|
|
703
704
|
}),
|
|
704
705
|
transformMode: __spreadProps(__spreadValues({}, serverOptions.transformMode), {
|
|
705
|
-
ssr: (
|
|
706
|
-
web: (
|
|
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))
|
|
707
708
|
})
|
|
708
709
|
});
|
|
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.13.1",
|
|
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",
|
|
@@ -19,26 +18,26 @@
|
|
|
19
18
|
".": {
|
|
20
19
|
"types": "./dist/index.d.ts",
|
|
21
20
|
"require": "./dist/index.cjs",
|
|
22
|
-
"import": "./dist/index.
|
|
21
|
+
"import": "./dist/index.mjs"
|
|
23
22
|
},
|
|
24
23
|
"./client": {
|
|
25
24
|
"types": "./dist/client.d.ts",
|
|
26
25
|
"require": "./dist/client.cjs",
|
|
27
|
-
"import": "./dist/client.
|
|
26
|
+
"import": "./dist/client.mjs"
|
|
28
27
|
},
|
|
29
28
|
"./server": {
|
|
30
29
|
"types": "./dist/server.d.ts",
|
|
31
30
|
"require": "./dist/server.cjs",
|
|
32
|
-
"import": "./dist/server.
|
|
31
|
+
"import": "./dist/server.mjs"
|
|
33
32
|
},
|
|
34
33
|
"./utils": {
|
|
35
34
|
"types": "./dist/utils.d.ts",
|
|
36
35
|
"require": "./dist/utils.cjs",
|
|
37
|
-
"import": "./dist/utils.
|
|
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
|
"*": {
|
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/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/dist/utils.js
DELETED
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 };
|