vite-node 0.2.2 → 0.2.6
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/client.d.ts +12 -9
- package/dist/cli.cjs +34 -16
- package/dist/cli.js +34 -16
- package/dist/server.cjs +34 -13
- package/dist/server.js +34 -13
- package/index.d.ts +15 -5
- package/package.json +3 -3
- package/server.d.ts +22 -8
package/client.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
interface StartOfSourceMap {
|
|
2
|
+
file?: string;
|
|
3
|
+
sourceRoot?: string;
|
|
4
|
+
}
|
|
5
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
6
|
+
version: string;
|
|
7
|
+
sources: string[];
|
|
8
|
+
names: string[];
|
|
9
|
+
sourcesContent?: string[];
|
|
10
|
+
mappings: string;
|
|
11
|
+
}
|
|
1
12
|
interface FetchResult {
|
|
2
13
|
code?: string;
|
|
3
14
|
externalize?: string;
|
|
15
|
+
map?: RawSourceMap;
|
|
4
16
|
}
|
|
5
17
|
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
6
|
-
declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
7
18
|
interface ModuleCache {
|
|
8
19
|
promise?: Promise<any>;
|
|
9
20
|
exports?: any;
|
|
@@ -11,20 +22,12 @@ interface ModuleCache {
|
|
|
11
22
|
}
|
|
12
23
|
interface ViteNodeRunnerOptions {
|
|
13
24
|
fetchModule: FetchFunction;
|
|
14
|
-
resolveId: ResolveIdFunction;
|
|
15
25
|
root: string;
|
|
16
26
|
base?: string;
|
|
17
27
|
moduleCache?: Map<string, ModuleCache>;
|
|
18
28
|
interopDefault?: boolean;
|
|
19
29
|
requestStubs?: Record<string, any>;
|
|
20
30
|
}
|
|
21
|
-
interface ViteNodeResolveId {
|
|
22
|
-
external?: boolean | 'absolute' | 'relative';
|
|
23
|
-
id: string;
|
|
24
|
-
meta?: Record<string, any> | null;
|
|
25
|
-
moduleSideEffects?: boolean | 'no-treeshake' | null;
|
|
26
|
-
syntheticNamedExports?: boolean | string | null;
|
|
27
|
-
}
|
|
28
31
|
|
|
29
32
|
declare const DEFAULT_REQUEST_STUBS: {
|
|
30
33
|
'/@vite/client': {
|
package/dist/cli.cjs
CHANGED
|
@@ -148,6 +148,25 @@ function patchWindowsImportPath(path) {
|
|
|
148
148
|
return path;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
var __defProp = Object.defineProperty;
|
|
152
|
+
var __defProps = Object.defineProperties;
|
|
153
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
154
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
155
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
156
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
157
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
158
|
+
var __spreadValues = (a, b) => {
|
|
159
|
+
for (var prop in b || (b = {}))
|
|
160
|
+
if (__hasOwnProp.call(b, prop))
|
|
161
|
+
__defNormalProp(a, prop, b[prop]);
|
|
162
|
+
if (__getOwnPropSymbols)
|
|
163
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
164
|
+
if (__propIsEnum.call(b, prop))
|
|
165
|
+
__defNormalProp(a, prop, b[prop]);
|
|
166
|
+
}
|
|
167
|
+
return a;
|
|
168
|
+
};
|
|
169
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
151
170
|
class ViteNodeServer {
|
|
152
171
|
constructor(server, options = {}) {
|
|
153
172
|
this.server = server;
|
|
@@ -164,7 +183,9 @@ class ViteNodeServer {
|
|
|
164
183
|
}
|
|
165
184
|
async fetchModule(id) {
|
|
166
185
|
if (!this.fetchPromiseMap.has(id)) {
|
|
167
|
-
this.fetchPromiseMap.set(id, this._fetchModule(id).
|
|
186
|
+
this.fetchPromiseMap.set(id, this._fetchModule(id).then((r) => {
|
|
187
|
+
return this.options.sourcemap !== true ? __spreadProps(__spreadValues({}, r), { map: void 0 }) : r;
|
|
188
|
+
}).finally(() => {
|
|
168
189
|
this.fetchPromiseMap.delete(id);
|
|
169
190
|
}));
|
|
170
191
|
}
|
|
@@ -190,25 +211,24 @@ class ViteNodeServer {
|
|
|
190
211
|
return "web";
|
|
191
212
|
}
|
|
192
213
|
async _fetchModule(id) {
|
|
193
|
-
var _a;
|
|
194
214
|
let result;
|
|
195
|
-
const
|
|
196
|
-
const
|
|
215
|
+
const filePath = toFilePath(id, this.server.config.root);
|
|
216
|
+
const module = this.server.moduleGraph.getModuleById(id);
|
|
217
|
+
const timestamp = (module == null ? void 0 : module.lastHMRTimestamp) || Date.now();
|
|
218
|
+
const cache = this.fetchCache.get(filePath);
|
|
197
219
|
if (timestamp && cache && cache.timestamp >= timestamp)
|
|
198
220
|
return cache.result;
|
|
199
|
-
const externalize = await this.shouldExternalize(
|
|
221
|
+
const externalize = await this.shouldExternalize(filePath);
|
|
200
222
|
if (externalize) {
|
|
201
223
|
result = { externalize };
|
|
202
224
|
} else {
|
|
203
225
|
const r = await this._transformRequest(id);
|
|
204
|
-
result = { code: r == null ? void 0 : r.code };
|
|
205
|
-
}
|
|
206
|
-
if (timestamp) {
|
|
207
|
-
this.fetchCache.set(id, {
|
|
208
|
-
timestamp,
|
|
209
|
-
result
|
|
210
|
-
});
|
|
226
|
+
result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
|
|
211
227
|
}
|
|
228
|
+
this.fetchCache.set(filePath, {
|
|
229
|
+
timestamp,
|
|
230
|
+
result
|
|
231
|
+
});
|
|
212
232
|
return result;
|
|
213
233
|
}
|
|
214
234
|
async _transformRequest(id) {
|
|
@@ -220,7 +240,8 @@ class ViteNodeServer {
|
|
|
220
240
|
} else {
|
|
221
241
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
222
242
|
}
|
|
223
|
-
|
|
243
|
+
const sourcemap = this.options.sourcemap ?? "inline";
|
|
244
|
+
if (sourcemap === "inline" && result && !id.includes("node_modules"))
|
|
224
245
|
withInlineSourcemap(result);
|
|
225
246
|
return result;
|
|
226
247
|
}
|
|
@@ -437,9 +458,6 @@ async function run(options = {}) {
|
|
|
437
458
|
base: server.config.base,
|
|
438
459
|
fetchModule(id) {
|
|
439
460
|
return node.fetchModule(id);
|
|
440
|
-
},
|
|
441
|
-
resolveId(id, importer) {
|
|
442
|
-
return node.resolveId(id, importer);
|
|
443
461
|
}
|
|
444
462
|
});
|
|
445
463
|
for (const file of files)
|
package/dist/cli.js
CHANGED
|
@@ -123,6 +123,25 @@ function patchWindowsImportPath(path) {
|
|
|
123
123
|
return path;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
var __defProp = Object.defineProperty;
|
|
127
|
+
var __defProps = Object.defineProperties;
|
|
128
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
129
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
130
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
131
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
132
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
133
|
+
var __spreadValues = (a, b) => {
|
|
134
|
+
for (var prop in b || (b = {}))
|
|
135
|
+
if (__hasOwnProp.call(b, prop))
|
|
136
|
+
__defNormalProp(a, prop, b[prop]);
|
|
137
|
+
if (__getOwnPropSymbols)
|
|
138
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
139
|
+
if (__propIsEnum.call(b, prop))
|
|
140
|
+
__defNormalProp(a, prop, b[prop]);
|
|
141
|
+
}
|
|
142
|
+
return a;
|
|
143
|
+
};
|
|
144
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
126
145
|
class ViteNodeServer {
|
|
127
146
|
constructor(server, options = {}) {
|
|
128
147
|
this.server = server;
|
|
@@ -139,7 +158,9 @@ class ViteNodeServer {
|
|
|
139
158
|
}
|
|
140
159
|
async fetchModule(id) {
|
|
141
160
|
if (!this.fetchPromiseMap.has(id)) {
|
|
142
|
-
this.fetchPromiseMap.set(id, this._fetchModule(id).
|
|
161
|
+
this.fetchPromiseMap.set(id, this._fetchModule(id).then((r) => {
|
|
162
|
+
return this.options.sourcemap !== true ? __spreadProps(__spreadValues({}, r), { map: void 0 }) : r;
|
|
163
|
+
}).finally(() => {
|
|
143
164
|
this.fetchPromiseMap.delete(id);
|
|
144
165
|
}));
|
|
145
166
|
}
|
|
@@ -165,25 +186,24 @@ class ViteNodeServer {
|
|
|
165
186
|
return "web";
|
|
166
187
|
}
|
|
167
188
|
async _fetchModule(id) {
|
|
168
|
-
var _a;
|
|
169
189
|
let result;
|
|
170
|
-
const
|
|
171
|
-
const
|
|
190
|
+
const filePath = toFilePath(id, this.server.config.root);
|
|
191
|
+
const module = this.server.moduleGraph.getModuleById(id);
|
|
192
|
+
const timestamp = (module == null ? void 0 : module.lastHMRTimestamp) || Date.now();
|
|
193
|
+
const cache = this.fetchCache.get(filePath);
|
|
172
194
|
if (timestamp && cache && cache.timestamp >= timestamp)
|
|
173
195
|
return cache.result;
|
|
174
|
-
const externalize = await this.shouldExternalize(
|
|
196
|
+
const externalize = await this.shouldExternalize(filePath);
|
|
175
197
|
if (externalize) {
|
|
176
198
|
result = { externalize };
|
|
177
199
|
} else {
|
|
178
200
|
const r = await this._transformRequest(id);
|
|
179
|
-
result = { code: r == null ? void 0 : r.code };
|
|
180
|
-
}
|
|
181
|
-
if (timestamp) {
|
|
182
|
-
this.fetchCache.set(id, {
|
|
183
|
-
timestamp,
|
|
184
|
-
result
|
|
185
|
-
});
|
|
201
|
+
result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
|
|
186
202
|
}
|
|
203
|
+
this.fetchCache.set(filePath, {
|
|
204
|
+
timestamp,
|
|
205
|
+
result
|
|
206
|
+
});
|
|
187
207
|
return result;
|
|
188
208
|
}
|
|
189
209
|
async _transformRequest(id) {
|
|
@@ -195,7 +215,8 @@ class ViteNodeServer {
|
|
|
195
215
|
} else {
|
|
196
216
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
197
217
|
}
|
|
198
|
-
|
|
218
|
+
const sourcemap = this.options.sourcemap ?? "inline";
|
|
219
|
+
if (sourcemap === "inline" && result && !id.includes("node_modules"))
|
|
199
220
|
withInlineSourcemap(result);
|
|
200
221
|
return result;
|
|
201
222
|
}
|
|
@@ -412,9 +433,6 @@ async function run(options = {}) {
|
|
|
412
433
|
base: server.config.base,
|
|
413
434
|
fetchModule(id) {
|
|
414
435
|
return node.fetchModule(id);
|
|
415
|
-
},
|
|
416
|
-
resolveId(id, importer) {
|
|
417
|
-
return node.resolveId(id, importer);
|
|
418
436
|
}
|
|
419
437
|
});
|
|
420
438
|
for (const file of files)
|
package/dist/server.cjs
CHANGED
|
@@ -114,6 +114,25 @@ function patchWindowsImportPath(path) {
|
|
|
114
114
|
return path;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
var __defProp = Object.defineProperty;
|
|
118
|
+
var __defProps = Object.defineProperties;
|
|
119
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
120
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
121
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
122
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
123
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
124
|
+
var __spreadValues = (a, b) => {
|
|
125
|
+
for (var prop in b || (b = {}))
|
|
126
|
+
if (__hasOwnProp.call(b, prop))
|
|
127
|
+
__defNormalProp(a, prop, b[prop]);
|
|
128
|
+
if (__getOwnPropSymbols)
|
|
129
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
130
|
+
if (__propIsEnum.call(b, prop))
|
|
131
|
+
__defNormalProp(a, prop, b[prop]);
|
|
132
|
+
}
|
|
133
|
+
return a;
|
|
134
|
+
};
|
|
135
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
117
136
|
class ViteNodeServer {
|
|
118
137
|
constructor(server, options = {}) {
|
|
119
138
|
this.server = server;
|
|
@@ -130,7 +149,9 @@ class ViteNodeServer {
|
|
|
130
149
|
}
|
|
131
150
|
async fetchModule(id) {
|
|
132
151
|
if (!this.fetchPromiseMap.has(id)) {
|
|
133
|
-
this.fetchPromiseMap.set(id, this._fetchModule(id).
|
|
152
|
+
this.fetchPromiseMap.set(id, this._fetchModule(id).then((r) => {
|
|
153
|
+
return this.options.sourcemap !== true ? __spreadProps(__spreadValues({}, r), { map: void 0 }) : r;
|
|
154
|
+
}).finally(() => {
|
|
134
155
|
this.fetchPromiseMap.delete(id);
|
|
135
156
|
}));
|
|
136
157
|
}
|
|
@@ -156,25 +177,24 @@ class ViteNodeServer {
|
|
|
156
177
|
return "web";
|
|
157
178
|
}
|
|
158
179
|
async _fetchModule(id) {
|
|
159
|
-
var _a;
|
|
160
180
|
let result;
|
|
161
|
-
const
|
|
162
|
-
const
|
|
181
|
+
const filePath = toFilePath(id, this.server.config.root);
|
|
182
|
+
const module = this.server.moduleGraph.getModuleById(id);
|
|
183
|
+
const timestamp = (module == null ? void 0 : module.lastHMRTimestamp) || Date.now();
|
|
184
|
+
const cache = this.fetchCache.get(filePath);
|
|
163
185
|
if (timestamp && cache && cache.timestamp >= timestamp)
|
|
164
186
|
return cache.result;
|
|
165
|
-
const externalize = await this.shouldExternalize(
|
|
187
|
+
const externalize = await this.shouldExternalize(filePath);
|
|
166
188
|
if (externalize) {
|
|
167
189
|
result = { externalize };
|
|
168
190
|
} else {
|
|
169
191
|
const r = await this._transformRequest(id);
|
|
170
|
-
result = { code: r == null ? void 0 : r.code };
|
|
171
|
-
}
|
|
172
|
-
if (timestamp) {
|
|
173
|
-
this.fetchCache.set(id, {
|
|
174
|
-
timestamp,
|
|
175
|
-
result
|
|
176
|
-
});
|
|
192
|
+
result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
|
|
177
193
|
}
|
|
194
|
+
this.fetchCache.set(filePath, {
|
|
195
|
+
timestamp,
|
|
196
|
+
result
|
|
197
|
+
});
|
|
178
198
|
return result;
|
|
179
199
|
}
|
|
180
200
|
async _transformRequest(id) {
|
|
@@ -186,7 +206,8 @@ class ViteNodeServer {
|
|
|
186
206
|
} else {
|
|
187
207
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
188
208
|
}
|
|
189
|
-
|
|
209
|
+
const sourcemap = this.options.sourcemap ?? "inline";
|
|
210
|
+
if (sourcemap === "inline" && result && !id.includes("node_modules"))
|
|
190
211
|
withInlineSourcemap(result);
|
|
191
212
|
return result;
|
|
192
213
|
}
|
package/dist/server.js
CHANGED
|
@@ -110,6 +110,25 @@ function patchWindowsImportPath(path) {
|
|
|
110
110
|
return path;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
var __defProp = Object.defineProperty;
|
|
114
|
+
var __defProps = Object.defineProperties;
|
|
115
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
116
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
117
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
118
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
119
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
120
|
+
var __spreadValues = (a, b) => {
|
|
121
|
+
for (var prop in b || (b = {}))
|
|
122
|
+
if (__hasOwnProp.call(b, prop))
|
|
123
|
+
__defNormalProp(a, prop, b[prop]);
|
|
124
|
+
if (__getOwnPropSymbols)
|
|
125
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
126
|
+
if (__propIsEnum.call(b, prop))
|
|
127
|
+
__defNormalProp(a, prop, b[prop]);
|
|
128
|
+
}
|
|
129
|
+
return a;
|
|
130
|
+
};
|
|
131
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
113
132
|
class ViteNodeServer {
|
|
114
133
|
constructor(server, options = {}) {
|
|
115
134
|
this.server = server;
|
|
@@ -126,7 +145,9 @@ class ViteNodeServer {
|
|
|
126
145
|
}
|
|
127
146
|
async fetchModule(id) {
|
|
128
147
|
if (!this.fetchPromiseMap.has(id)) {
|
|
129
|
-
this.fetchPromiseMap.set(id, this._fetchModule(id).
|
|
148
|
+
this.fetchPromiseMap.set(id, this._fetchModule(id).then((r) => {
|
|
149
|
+
return this.options.sourcemap !== true ? __spreadProps(__spreadValues({}, r), { map: void 0 }) : r;
|
|
150
|
+
}).finally(() => {
|
|
130
151
|
this.fetchPromiseMap.delete(id);
|
|
131
152
|
}));
|
|
132
153
|
}
|
|
@@ -152,25 +173,24 @@ class ViteNodeServer {
|
|
|
152
173
|
return "web";
|
|
153
174
|
}
|
|
154
175
|
async _fetchModule(id) {
|
|
155
|
-
var _a;
|
|
156
176
|
let result;
|
|
157
|
-
const
|
|
158
|
-
const
|
|
177
|
+
const filePath = toFilePath(id, this.server.config.root);
|
|
178
|
+
const module = this.server.moduleGraph.getModuleById(id);
|
|
179
|
+
const timestamp = (module == null ? void 0 : module.lastHMRTimestamp) || Date.now();
|
|
180
|
+
const cache = this.fetchCache.get(filePath);
|
|
159
181
|
if (timestamp && cache && cache.timestamp >= timestamp)
|
|
160
182
|
return cache.result;
|
|
161
|
-
const externalize = await this.shouldExternalize(
|
|
183
|
+
const externalize = await this.shouldExternalize(filePath);
|
|
162
184
|
if (externalize) {
|
|
163
185
|
result = { externalize };
|
|
164
186
|
} else {
|
|
165
187
|
const r = await this._transformRequest(id);
|
|
166
|
-
result = { code: r == null ? void 0 : r.code };
|
|
167
|
-
}
|
|
168
|
-
if (timestamp) {
|
|
169
|
-
this.fetchCache.set(id, {
|
|
170
|
-
timestamp,
|
|
171
|
-
result
|
|
172
|
-
});
|
|
188
|
+
result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
|
|
173
189
|
}
|
|
190
|
+
this.fetchCache.set(filePath, {
|
|
191
|
+
timestamp,
|
|
192
|
+
result
|
|
193
|
+
});
|
|
174
194
|
return result;
|
|
175
195
|
}
|
|
176
196
|
async _transformRequest(id) {
|
|
@@ -182,7 +202,8 @@ class ViteNodeServer {
|
|
|
182
202
|
} else {
|
|
183
203
|
result = await this.server.transformRequest(id, { ssr: true });
|
|
184
204
|
}
|
|
185
|
-
|
|
205
|
+
const sourcemap = this.options.sourcemap ?? "inline";
|
|
206
|
+
if (sourcemap === "inline" && result && !id.includes("node_modules"))
|
|
186
207
|
withInlineSourcemap(result);
|
|
187
208
|
return result;
|
|
188
209
|
}
|
package/index.d.ts
CHANGED
|
@@ -7,12 +7,23 @@ interface DepsHandlingOptions {
|
|
|
7
7
|
*/
|
|
8
8
|
fallbackCJS?: boolean;
|
|
9
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
|
+
}
|
|
10
21
|
interface FetchResult {
|
|
11
22
|
code?: string;
|
|
12
23
|
externalize?: string;
|
|
24
|
+
map?: RawSourceMap;
|
|
13
25
|
}
|
|
14
26
|
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
15
|
-
declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
16
27
|
interface ModuleCache {
|
|
17
28
|
promise?: Promise<any>;
|
|
18
29
|
exports?: any;
|
|
@@ -20,7 +31,6 @@ interface ModuleCache {
|
|
|
20
31
|
}
|
|
21
32
|
interface ViteNodeRunnerOptions {
|
|
22
33
|
fetchModule: FetchFunction;
|
|
23
|
-
resolveId: ResolveIdFunction;
|
|
24
34
|
root: string;
|
|
25
35
|
base?: string;
|
|
26
36
|
moduleCache?: Map<string, ModuleCache>;
|
|
@@ -37,9 +47,9 @@ interface ViteNodeResolveId {
|
|
|
37
47
|
interface ViteNodeServerOptions {
|
|
38
48
|
/**
|
|
39
49
|
* Inject inline sourcemap to modules
|
|
40
|
-
* @default
|
|
50
|
+
* @default 'inline'
|
|
41
51
|
*/
|
|
42
|
-
sourcemap?: boolean;
|
|
52
|
+
sourcemap?: 'inline' | boolean;
|
|
43
53
|
/**
|
|
44
54
|
* Deps handling
|
|
45
55
|
*/
|
|
@@ -53,4 +63,4 @@ interface ViteNodeServerOptions {
|
|
|
53
63
|
};
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
export { DepsHandlingOptions, FetchFunction, FetchResult, ModuleCache,
|
|
66
|
+
export { DepsHandlingOptions, FetchFunction, FetchResult, ModuleCache, RawSourceMap, StartOfSourceMap, ViteNodeResolveId, ViteNodeRunnerOptions, ViteNodeServerOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Vite as Node.js runtime",
|
|
5
5
|
"homepage": "https://github.com/vitest-dev/vitest#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"kolorist": "^1.5.1",
|
|
53
53
|
"minimist": "^1.2.5",
|
|
54
|
-
"mlly": "^0.
|
|
54
|
+
"mlly": "^0.4.1",
|
|
55
55
|
"pathe": "^0.2.0",
|
|
56
56
|
"vite": "^2.7.13"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/minimist": "^1.2.2",
|
|
60
|
-
"rollup": "^2.
|
|
60
|
+
"rollup": "^2.67.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=14.14.0"
|
package/server.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { ViteDevServer, TransformResult } from 'vite';
|
|
2
2
|
|
|
3
|
-
interface FetchResult {
|
|
4
|
-
code?: string;
|
|
5
|
-
externalize?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
interface DepsHandlingOptions {
|
|
9
4
|
external?: (string | RegExp)[];
|
|
10
5
|
inline?: (string | RegExp)[];
|
|
@@ -14,6 +9,22 @@ interface DepsHandlingOptions {
|
|
|
14
9
|
*/
|
|
15
10
|
fallbackCJS?: boolean;
|
|
16
11
|
}
|
|
12
|
+
interface StartOfSourceMap {
|
|
13
|
+
file?: string;
|
|
14
|
+
sourceRoot?: string;
|
|
15
|
+
}
|
|
16
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
17
|
+
version: string;
|
|
18
|
+
sources: string[];
|
|
19
|
+
names: string[];
|
|
20
|
+
sourcesContent?: string[];
|
|
21
|
+
mappings: string;
|
|
22
|
+
}
|
|
23
|
+
interface FetchResult {
|
|
24
|
+
code?: string;
|
|
25
|
+
externalize?: string;
|
|
26
|
+
map?: RawSourceMap;
|
|
27
|
+
}
|
|
17
28
|
interface ViteNodeResolveId {
|
|
18
29
|
external?: boolean | 'absolute' | 'relative';
|
|
19
30
|
id: string;
|
|
@@ -24,9 +35,9 @@ interface ViteNodeResolveId {
|
|
|
24
35
|
interface ViteNodeServerOptions {
|
|
25
36
|
/**
|
|
26
37
|
* Inject inline sourcemap to modules
|
|
27
|
-
* @default
|
|
38
|
+
* @default 'inline'
|
|
28
39
|
*/
|
|
29
|
-
sourcemap?: boolean;
|
|
40
|
+
sourcemap?: 'inline' | boolean;
|
|
30
41
|
/**
|
|
31
42
|
* Deps handling
|
|
32
43
|
*/
|
|
@@ -48,7 +59,10 @@ declare class ViteNodeServer {
|
|
|
48
59
|
options: ViteNodeServerOptions;
|
|
49
60
|
private fetchPromiseMap;
|
|
50
61
|
private transformPromiseMap;
|
|
51
|
-
|
|
62
|
+
fetchCache: Map<string, {
|
|
63
|
+
timestamp: number;
|
|
64
|
+
result: FetchResult;
|
|
65
|
+
}>;
|
|
52
66
|
constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
|
|
53
67
|
shouldExternalize(id: string): Promise<string | false>;
|
|
54
68
|
resolveId(id: string, importer?: string): Promise<ViteNodeResolveId | null>;
|