vite-node 1.0.4 → 1.1.1

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 CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var path = require('node:path');
3
4
  var cac = require('cac');
4
5
  var c = require('picocolors');
5
6
  var vite = require('vite');
@@ -15,12 +16,11 @@ require('pathe');
15
16
  require('debug');
16
17
  require('./constants.cjs');
17
18
  require('node:module');
18
- require('node:path');
19
19
  require('node:url');
20
20
  require('node:vm');
21
21
  require('node:events');
22
22
 
23
- var version = "1.0.4";
23
+ var version = "1.1.1";
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");
@@ -39,7 +39,7 @@ async function run(files, options = {}) {
39
39
  if (options.script) {
40
40
  files = [files[0]];
41
41
  options = {};
42
- process.argv = [process.argv[0], files[0], ...process.argv.slice(2).filter((arg) => arg !== "--script" && arg !== files[0])];
42
+ process.argv = [process.argv[0], path.resolve(files[0]), ...process.argv.slice(2).filter((arg) => arg !== "--script" && arg !== files[0])];
43
43
  } else {
44
44
  process.argv = [...process.argv.slice(0, 2), ...options["--"] || []];
45
45
  }
package/dist/cli.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { resolve } from 'node:path';
1
2
  import cac from 'cac';
2
3
  import c from 'picocolors';
3
4
  import { createServer } from 'vite';
@@ -13,12 +14,11 @@ import 'pathe';
13
14
  import 'debug';
14
15
  import './constants.mjs';
15
16
  import 'node:module';
16
- import 'node:path';
17
17
  import 'node:url';
18
18
  import 'node:vm';
19
19
  import 'node:events';
20
20
 
21
- var version = "1.0.4";
21
+ var version = "1.1.1";
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");
@@ -37,7 +37,7 @@ async function run(files, options = {}) {
37
37
  if (options.script) {
38
38
  files = [files[0]];
39
39
  options = {};
40
- process.argv = [process.argv[0], files[0], ...process.argv.slice(2).filter((arg) => arg !== "--script" && arg !== files[0])];
40
+ process.argv = [process.argv[0], resolve(files[0]), ...process.argv.slice(2).filter((arg) => arg !== "--script" && arg !== files[0])];
41
41
  } else {
42
42
  process.argv = [...process.argv.slice(0, 2), ...options["--"] || []];
43
43
  }
package/dist/client.cjs CHANGED
@@ -268,6 +268,8 @@ ${getStack()}`), 2e3);
268
268
  enumerable: false,
269
269
  configurable: false
270
270
  });
271
+ const SYMBOL_NOT_DEFINED = Symbol2("not defined");
272
+ let moduleExports = SYMBOL_NOT_DEFINED;
271
273
  const cjsExports = new Proxy(exports, {
272
274
  get: (target, p, receiver) => {
273
275
  if (Reflect2.has(target, p))
@@ -283,11 +285,12 @@ ${getStack()}`), 2e3);
283
285
  }
284
286
  if (!Reflect2.has(exports, "default"))
285
287
  exports.default = {};
286
- if (utils.isPrimitive(exports.default)) {
288
+ if (moduleExports !== SYMBOL_NOT_DEFINED && utils.isPrimitive(moduleExports)) {
287
289
  defineExport(exports, p, () => void 0);
288
290
  return true;
289
291
  }
290
- exports.default[p] = value;
292
+ if (!utils.isPrimitive(exports.default))
293
+ exports.default[p] = value;
291
294
  if (p !== "default")
292
295
  defineExport(exports, p, () => value);
293
296
  return true;
@@ -299,6 +302,7 @@ ${getStack()}`), 2e3);
299
302
  set exports(value) {
300
303
  exportAll(cjsExports, value);
301
304
  exports.default = value;
305
+ moduleExports = value;
302
306
  },
303
307
  get exports() {
304
308
  return cjsExports;
package/dist/client.mjs CHANGED
@@ -266,6 +266,8 @@ ${getStack()}`), 2e3);
266
266
  enumerable: false,
267
267
  configurable: false
268
268
  });
269
+ const SYMBOL_NOT_DEFINED = Symbol2("not defined");
270
+ let moduleExports = SYMBOL_NOT_DEFINED;
269
271
  const cjsExports = new Proxy(exports, {
270
272
  get: (target, p, receiver) => {
271
273
  if (Reflect2.has(target, p))
@@ -281,11 +283,12 @@ ${getStack()}`), 2e3);
281
283
  }
282
284
  if (!Reflect2.has(exports, "default"))
283
285
  exports.default = {};
284
- if (isPrimitive(exports.default)) {
286
+ if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
285
287
  defineExport(exports, p, () => void 0);
286
288
  return true;
287
289
  }
288
- exports.default[p] = value;
290
+ if (!isPrimitive(exports.default))
291
+ exports.default[p] = value;
289
292
  if (p !== "default")
290
293
  defineExport(exports, p, () => value);
291
294
  return true;
@@ -297,6 +300,7 @@ ${getStack()}`), 2e3);
297
300
  set exports(value) {
298
301
  exportAll(cjsExports, value);
299
302
  exports.default = value;
303
+ moduleExports = value;
300
304
  },
301
305
  get exports() {
302
306
  return cjsExports;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.1.1",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",