vite-node 0.32.0 → 0.32.2
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 +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/client.cjs +9 -20
- package/dist/client.mjs +9 -20
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -24,7 +24,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
24
24
|
var cac__default = /*#__PURE__*/_interopDefaultLegacy(cac);
|
|
25
25
|
var c__default = /*#__PURE__*/_interopDefaultLegacy(c);
|
|
26
26
|
|
|
27
|
-
var version = "0.32.
|
|
27
|
+
var version = "0.32.2";
|
|
28
28
|
|
|
29
29
|
const cli = cac__default["default"]("vite-node");
|
|
30
30
|
cli.version(version).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").help();
|
package/dist/cli.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import 'node:path';
|
|
|
17
17
|
import 'node:vm';
|
|
18
18
|
import 'node:events';
|
|
19
19
|
|
|
20
|
-
var version = "0.32.
|
|
20
|
+
var version = "0.32.2";
|
|
21
21
|
|
|
22
22
|
const cli = cac("vite-node");
|
|
23
23
|
cli.version(version).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").help();
|
package/dist/client.cjs
CHANGED
|
@@ -227,25 +227,14 @@ ${getStack()}`), 2e3);
|
|
|
227
227
|
async _resolveUrl(id, importer) {
|
|
228
228
|
if (importer && id.startsWith(utils.VALID_ID_PREFIX))
|
|
229
229
|
importer = void 0;
|
|
230
|
-
|
|
231
|
-
if (!this.shouldResolveId(
|
|
232
|
-
return [
|
|
233
|
-
const { path, exists } = utils.toFilePath(
|
|
230
|
+
const dep = utils.normalizeRequestId(id, this.options.base);
|
|
231
|
+
if (!this.shouldResolveId(dep))
|
|
232
|
+
return [dep, dep];
|
|
233
|
+
const { path, exists } = utils.toFilePath(dep, this.root);
|
|
234
234
|
if (!this.options.resolveId || exists)
|
|
235
|
-
return [
|
|
236
|
-
const resolved = await this.options.resolveId(
|
|
237
|
-
|
|
238
|
-
const error = new Error(
|
|
239
|
-
`Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}.
|
|
240
|
-
|
|
241
|
-
- If you rely on tsconfig.json to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
|
|
242
|
-
- Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`
|
|
243
|
-
);
|
|
244
|
-
Object.defineProperty(error, "code", { value: "ERR_MODULE_NOT_FOUND", enumerable: true });
|
|
245
|
-
Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), { value: { id, importer }, enumerable: false });
|
|
246
|
-
throw error;
|
|
247
|
-
}
|
|
248
|
-
const resolvedId = utils.normalizeRequestId(resolved.id, this.options.base);
|
|
235
|
+
return [dep, path];
|
|
236
|
+
const resolved = await this.options.resolveId(dep, importer);
|
|
237
|
+
const resolvedId = resolved ? utils.normalizeRequestId(resolved.id, this.options.base) : dep;
|
|
249
238
|
return [resolvedId, resolvedId];
|
|
250
239
|
}
|
|
251
240
|
async resolveUrl(id, importee) {
|
|
@@ -267,7 +256,7 @@ ${getStack()}`), 2e3);
|
|
|
267
256
|
const callstack = [..._callstack, moduleId];
|
|
268
257
|
const mod = this.moduleCache.getByModuleId(moduleId);
|
|
269
258
|
const request = async (dep) => {
|
|
270
|
-
const [id2, depFsPath] = await this.resolveUrl(
|
|
259
|
+
const [id2, depFsPath] = await this.resolveUrl(String(dep), fsPath);
|
|
271
260
|
const depMod = this.moduleCache.getByModuleId(depFsPath);
|
|
272
261
|
depMod.importers.add(moduleId);
|
|
273
262
|
mod.imports.add(depFsPath);
|
|
@@ -302,7 +291,7 @@ ${getStack()}`), 2e3);
|
|
|
302
291
|
},
|
|
303
292
|
getPrototypeOf: () => Object.prototype,
|
|
304
293
|
set: (_, p, value) => {
|
|
305
|
-
if (p === "default" && this.shouldInterop(modulePath, { default: value })) {
|
|
294
|
+
if (p === "default" && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
|
|
306
295
|
exportAll(cjsExports, value);
|
|
307
296
|
exports.default = value;
|
|
308
297
|
return true;
|
package/dist/client.mjs
CHANGED
|
@@ -200,25 +200,14 @@ ${getStack()}`), 2e3);
|
|
|
200
200
|
async _resolveUrl(id, importer) {
|
|
201
201
|
if (importer && id.startsWith(VALID_ID_PREFIX))
|
|
202
202
|
importer = void 0;
|
|
203
|
-
|
|
204
|
-
if (!this.shouldResolveId(
|
|
205
|
-
return [
|
|
206
|
-
const { path, exists } = toFilePath(
|
|
203
|
+
const dep = normalizeRequestId(id, this.options.base);
|
|
204
|
+
if (!this.shouldResolveId(dep))
|
|
205
|
+
return [dep, dep];
|
|
206
|
+
const { path, exists } = toFilePath(dep, this.root);
|
|
207
207
|
if (!this.options.resolveId || exists)
|
|
208
|
-
return [
|
|
209
|
-
const resolved = await this.options.resolveId(
|
|
210
|
-
|
|
211
|
-
const error = new Error(
|
|
212
|
-
`Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}.
|
|
213
|
-
|
|
214
|
-
- If you rely on tsconfig.json to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
|
|
215
|
-
- Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`
|
|
216
|
-
);
|
|
217
|
-
Object.defineProperty(error, "code", { value: "ERR_MODULE_NOT_FOUND", enumerable: true });
|
|
218
|
-
Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), { value: { id, importer }, enumerable: false });
|
|
219
|
-
throw error;
|
|
220
|
-
}
|
|
221
|
-
const resolvedId = normalizeRequestId(resolved.id, this.options.base);
|
|
208
|
+
return [dep, path];
|
|
209
|
+
const resolved = await this.options.resolveId(dep, importer);
|
|
210
|
+
const resolvedId = resolved ? normalizeRequestId(resolved.id, this.options.base) : dep;
|
|
222
211
|
return [resolvedId, resolvedId];
|
|
223
212
|
}
|
|
224
213
|
async resolveUrl(id, importee) {
|
|
@@ -240,7 +229,7 @@ ${getStack()}`), 2e3);
|
|
|
240
229
|
const callstack = [..._callstack, moduleId];
|
|
241
230
|
const mod = this.moduleCache.getByModuleId(moduleId);
|
|
242
231
|
const request = async (dep) => {
|
|
243
|
-
const [id2, depFsPath] = await this.resolveUrl(
|
|
232
|
+
const [id2, depFsPath] = await this.resolveUrl(String(dep), fsPath);
|
|
244
233
|
const depMod = this.moduleCache.getByModuleId(depFsPath);
|
|
245
234
|
depMod.importers.add(moduleId);
|
|
246
235
|
mod.imports.add(depFsPath);
|
|
@@ -275,7 +264,7 @@ ${getStack()}`), 2e3);
|
|
|
275
264
|
},
|
|
276
265
|
getPrototypeOf: () => Object.prototype,
|
|
277
266
|
set: (_, p, value) => {
|
|
278
|
-
if (p === "default" && this.shouldInterop(modulePath, { default: value })) {
|
|
267
|
+
if (p === "default" && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
|
|
279
268
|
exportAll(cjsExports, value);
|
|
280
269
|
exports.default = value;
|
|
281
270
|
return true;
|