vite-node 0.26.1 → 0.26.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
@@ -634,7 +634,7 @@ class CAC extends events.EventEmitter {
634
634
 
635
635
  const cac = (name = "") => new CAC(name);
636
636
 
637
- var version = "0.26.1";
637
+ var version = "0.26.2";
638
638
 
639
639
  const cli = cac("vite-node");
640
640
  cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { e as ViteNodeServerOptions } from './types-57a192bf.js';
1
+ import { e as ViteNodeServerOptions } from './types-6a15e0b9.js';
2
2
 
3
3
  interface CliOptions {
4
4
  root?: string;
package/dist/cli.mjs CHANGED
@@ -632,7 +632,7 @@ class CAC extends EventEmitter {
632
632
 
633
633
  const cac = (name = "") => new CAC(name);
634
634
 
635
- var version = "0.26.1";
635
+ var version = "0.26.2";
636
636
 
637
637
  const cli = cac("vite-node");
638
638
  cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
package/dist/client.cjs CHANGED
@@ -39,40 +39,42 @@ var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
39
39
 
40
40
  const debugExecute = createDebug__default["default"]("vite-node:client:execute");
41
41
  const debugNative = createDebug__default["default"]("vite-node:client:native");
42
- const DEFAULT_REQUEST_STUBS = {
43
- "/@vite/client": {
44
- injectQuery: (id) => id,
45
- createHotContext() {
46
- return {
47
- accept: () => {
48
- },
49
- prune: () => {
50
- },
51
- dispose: () => {
52
- },
53
- decline: () => {
54
- },
55
- invalidate: () => {
56
- },
57
- on: () => {
58
- }
59
- };
60
- },
61
- updateStyle(id, css) {
62
- if (typeof document === "undefined")
63
- return;
64
- const element = document.getElementById(id);
65
- if (element)
66
- element.remove();
67
- const head = document.querySelector("head");
68
- const style = document.createElement("style");
69
- style.setAttribute("type", "text/css");
70
- style.id = id;
71
- style.innerHTML = css;
72
- head == null ? void 0 : head.appendChild(style);
73
- }
42
+ const clientStub = {
43
+ injectQuery: (id) => id,
44
+ createHotContext() {
45
+ return {
46
+ accept: () => {
47
+ },
48
+ prune: () => {
49
+ },
50
+ dispose: () => {
51
+ },
52
+ decline: () => {
53
+ },
54
+ invalidate: () => {
55
+ },
56
+ on: () => {
57
+ }
58
+ };
59
+ },
60
+ updateStyle(id, css) {
61
+ if (typeof document === "undefined")
62
+ return;
63
+ const element = document.getElementById(id);
64
+ if (element)
65
+ element.remove();
66
+ const head = document.querySelector("head");
67
+ const style = document.createElement("style");
68
+ style.setAttribute("type", "text/css");
69
+ style.id = id;
70
+ style.innerHTML = css;
71
+ head == null ? void 0 : head.appendChild(style);
74
72
  }
75
73
  };
74
+ const DEFAULT_REQUEST_STUBS = {
75
+ "/@vite/client": clientStub,
76
+ "@vite/client": clientStub
77
+ };
76
78
  class ModuleCacheMap extends Map {
77
79
  normalizePath(fsPath) {
78
80
  return utils.normalizeModuleId(fsPath);
package/dist/client.d.ts CHANGED
@@ -1 +1 @@
1
- export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-57a192bf.js';
1
+ export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-6a15e0b9.js';
package/dist/client.mjs CHANGED
@@ -12,40 +12,42 @@ import 'source-map-support';
12
12
 
13
13
  const debugExecute = createDebug("vite-node:client:execute");
14
14
  const debugNative = createDebug("vite-node:client:native");
15
- const DEFAULT_REQUEST_STUBS = {
16
- "/@vite/client": {
17
- injectQuery: (id) => id,
18
- createHotContext() {
19
- return {
20
- accept: () => {
21
- },
22
- prune: () => {
23
- },
24
- dispose: () => {
25
- },
26
- decline: () => {
27
- },
28
- invalidate: () => {
29
- },
30
- on: () => {
31
- }
32
- };
33
- },
34
- updateStyle(id, css) {
35
- if (typeof document === "undefined")
36
- return;
37
- const element = document.getElementById(id);
38
- if (element)
39
- element.remove();
40
- const head = document.querySelector("head");
41
- const style = document.createElement("style");
42
- style.setAttribute("type", "text/css");
43
- style.id = id;
44
- style.innerHTML = css;
45
- head == null ? void 0 : head.appendChild(style);
46
- }
15
+ const clientStub = {
16
+ injectQuery: (id) => id,
17
+ createHotContext() {
18
+ return {
19
+ accept: () => {
20
+ },
21
+ prune: () => {
22
+ },
23
+ dispose: () => {
24
+ },
25
+ decline: () => {
26
+ },
27
+ invalidate: () => {
28
+ },
29
+ on: () => {
30
+ }
31
+ };
32
+ },
33
+ updateStyle(id, css) {
34
+ if (typeof document === "undefined")
35
+ return;
36
+ const element = document.getElementById(id);
37
+ if (element)
38
+ element.remove();
39
+ const head = document.querySelector("head");
40
+ const style = document.createElement("style");
41
+ style.setAttribute("type", "text/css");
42
+ style.id = id;
43
+ style.innerHTML = css;
44
+ head == null ? void 0 : head.appendChild(style);
47
45
  }
48
46
  };
47
+ const DEFAULT_REQUEST_STUBS = {
48
+ "/@vite/client": clientStub,
49
+ "@vite/client": clientStub
50
+ };
49
51
  class ModuleCacheMap extends Map {
50
52
  normalizePath(fsPath) {
51
53
  return normalizeModuleId(fsPath);
package/dist/hmr.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { HMRPayload, Plugin } from 'vite';
3
- import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-57a192bf.js';
3
+ import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-6a15e0b9.js';
4
4
 
5
5
  type EventType = string | symbol;
6
6
  type Handler<T = unknown> = (event: T) => void;
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-57a192bf.js';
1
+ export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-6a15e0b9.js';
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
- import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-57a192bf.js';
2
+ import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-6a15e0b9.js';
3
3
 
4
4
  declare class Debugger {
5
5
  options: DebuggerOptions;
@@ -1,5 +1,5 @@
1
1
  import { TransformResult } from 'vite';
2
- import { R as RawSourceMap } from './types-57a192bf.js';
2
+ import { R as RawSourceMap } from './types-6a15e0b9.js';
3
3
 
4
4
  interface InstallSourceMapSupportOptions {
5
5
  getSourceMap: (source: string) => RawSourceMap | null | undefined;
@@ -121,6 +121,18 @@ declare const DEFAULT_REQUEST_STUBS: {
121
121
  };
122
122
  updateStyle(id: string, css: string): void;
123
123
  };
124
+ '@vite/client': {
125
+ injectQuery: (id: string) => string;
126
+ createHotContext(): {
127
+ accept: () => void;
128
+ prune: () => void;
129
+ dispose: () => void;
130
+ decline: () => void;
131
+ invalidate: () => void;
132
+ on: () => void;
133
+ };
134
+ updateStyle(id: string, css: string): void;
135
+ };
124
136
  };
125
137
  declare class ModuleCacheMap extends Map<string, ModuleCache> {
126
138
  normalizePath(fsPath: string): string;
package/dist/types.d.ts CHANGED
@@ -1 +1 @@
1
- export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-57a192bf.js';
1
+ export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-6a15e0b9.js';
package/dist/utils.cjs CHANGED
@@ -22,8 +22,13 @@ function normalizeRequestId(id, base) {
22
22
  const queryRE = /\?.*$/s;
23
23
  const hashRE = /#.*$/s;
24
24
  const cleanUrl = (url) => url.replace(hashRE, "").replace(queryRE, "");
25
+ const internalRequests = [
26
+ "@vite/client",
27
+ "@vite/env"
28
+ ];
29
+ const internalRequestRegexp = new RegExp(`^/?(${internalRequests.join("|")})$`);
25
30
  const isInternalRequest = (id) => {
26
- return id.startsWith("/@vite/");
31
+ return internalRequestRegexp.test(id);
27
32
  };
28
33
  function normalizeModuleId(id) {
29
34
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as Nullable, A as Arrayable } from './types-57a192bf.js';
1
+ import { N as Nullable, A as Arrayable } from './types-6a15e0b9.js';
2
2
 
3
3
  declare const isWindows: boolean;
4
4
  declare function slash(str: string): string;
package/dist/utils.mjs CHANGED
@@ -18,8 +18,13 @@ function normalizeRequestId(id, base) {
18
18
  const queryRE = /\?.*$/s;
19
19
  const hashRE = /#.*$/s;
20
20
  const cleanUrl = (url) => url.replace(hashRE, "").replace(queryRE, "");
21
+ const internalRequests = [
22
+ "@vite/client",
23
+ "@vite/env"
24
+ ];
25
+ const internalRequestRegexp = new RegExp(`^/?(${internalRequests.join("|")})$`);
21
26
  const isInternalRequest = (id) => {
22
- return id.startsWith("/@vite/");
27
+ return internalRequestRegexp.test(id);
23
28
  };
24
29
  function normalizeModuleId(id) {
25
30
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Vite as Node.js runtime",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",