vite-node 1.1.1 → 1.1.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 CHANGED
@@ -20,7 +20,7 @@ require('node:url');
20
20
  require('node:vm');
21
21
  require('node:events');
22
22
 
23
- var version = "1.1.1";
23
+ var version = "1.1.2";
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");
package/dist/cli.mjs CHANGED
@@ -18,7 +18,7 @@ import 'node:url';
18
18
  import 'node:vm';
19
19
  import 'node:events';
20
20
 
21
- var version = "1.1.1";
21
+ var version = "1.1.2";
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");
package/dist/server.cjs CHANGED
@@ -345,10 +345,10 @@ class ViteNodeServer {
345
345
  clearTimeout(timeout);
346
346
  }
347
347
  const { path: filePath } = utils.toFilePath(id, this.server.config.root);
348
- const module = this.server.moduleGraph.getModuleById(id);
349
- const timestamp = module ? module.lastHMRTimestamp : null;
348
+ const moduleNode = this.server.moduleGraph.getModuleById(id) || this.server.moduleGraph.getModuleById(filePath);
350
349
  const cache = this.fetchCaches[transformMode].get(filePath);
351
- if (timestamp && cache && cache.timestamp >= timestamp)
350
+ const timestamp = moduleNode ? Math.max(moduleNode.lastHMRTimestamp, moduleNode.lastInvalidationTimestamp) : 0;
351
+ if (cache && (timestamp === 0 || cache.timestamp >= timestamp))
352
352
  return cache.result;
353
353
  const time = Date.now();
354
354
  const externalize = await this.shouldExternalize(filePath);
package/dist/server.mjs CHANGED
@@ -343,10 +343,10 @@ class ViteNodeServer {
343
343
  clearTimeout(timeout);
344
344
  }
345
345
  const { path: filePath } = toFilePath(id, this.server.config.root);
346
- const module = this.server.moduleGraph.getModuleById(id);
347
- const timestamp = module ? module.lastHMRTimestamp : null;
346
+ const moduleNode = this.server.moduleGraph.getModuleById(id) || this.server.moduleGraph.getModuleById(filePath);
348
347
  const cache = this.fetchCaches[transformMode].get(filePath);
349
- if (timestamp && cache && cache.timestamp >= timestamp)
348
+ const timestamp = moduleNode ? Math.max(moduleNode.lastHMRTimestamp, moduleNode.lastInvalidationTimestamp) : 0;
349
+ if (cache && (timestamp === 0 || cache.timestamp >= timestamp))
350
350
  return cache.result;
351
351
  const time = Date.now();
352
352
  const externalize = await this.shouldExternalize(filePath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.2",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",