vite-node 5.0.0-beta.2 → 5.1.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/cli.d.ts CHANGED
@@ -7,6 +7,8 @@ interface CliOptions {
7
7
  "config"?: string;
8
8
  "mode"?: string;
9
9
  "watch"?: boolean;
10
+ "inspect"?: boolean;
11
+ "inspectAddr"?: string;
10
12
  "options"?: ViteNodeServerOptionsCLI;
11
13
  "version"?: boolean;
12
14
  "help"?: boolean;
package/dist/cli.js CHANGED
@@ -21,10 +21,10 @@ import 'es-module-lexer';
21
21
  import './constants.js';
22
22
  import 'node:events';
23
23
 
24
- var version = "5.0.0-beta.2";
24
+ var version = "5.1.0";
25
25
 
26
26
  const cli = cac("vite-node");
27
- 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");
27
+ 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("--inspect", "Enable Node.js inspector").option("--inspect-addr [host:port]", "Enable Node.js inspector with specified address").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");
28
28
  cli.command("[...files]").allowUnknownOptions().action(run);
29
29
  cli.parse(process.argv, { run: false });
30
30
  if (cli.args.length === 0) cli.runMatchedCommand();
@@ -40,6 +40,12 @@ else {
40
40
  }
41
41
  async function run(files, options = {}) {
42
42
  var _server$emitter;
43
+ if (options.inspect || options.inspectAddr) {
44
+ var _options$inspectAddr;
45
+ const { open } = await import('node:inspector');
46
+ const [host, port] = ((_options$inspectAddr = options.inspectAddr) === null || _options$inspectAddr === void 0 ? void 0 : _options$inspectAddr.split(":")) || ["127.0.0.1", "9229"];
47
+ open(Number(port), host, false);
48
+ }
43
49
  if (options.script) {
44
50
  files = [files[0]];
45
51
  options = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.2",
4
+ "version": "5.1.0",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",