vite-node 0.20.2 → 0.21.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
@@ -629,7 +629,7 @@ class CAC extends events.EventEmitter {
629
629
 
630
630
  const cac = (name = "") => new CAC(name);
631
631
 
632
- var version = "0.20.2";
632
+ var version = "0.21.1";
633
633
 
634
634
  const cli = cac("vite-node");
635
635
  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-4f4de592.js';
1
+ import { e as ViteNodeServerOptions } from './types-b9c999e6.js';
2
2
 
3
3
  interface CliOptions {
4
4
  root?: string;
package/dist/cli.mjs CHANGED
@@ -627,7 +627,7 @@ class CAC extends EventEmitter {
627
627
 
628
628
  const cac = (name = "") => new CAC(name);
629
629
 
630
- var version = "0.20.2";
630
+ var version = "0.21.1";
631
631
 
632
632
  const cli = cac("vite-node");
633
633
  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
@@ -169,7 +169,11 @@ ${getStack()}`), 2e3);
169
169
  const url$1 = url.pathToFileURL(fsPath).href;
170
170
  const meta = { url: url$1 };
171
171
  const exports = /* @__PURE__ */ Object.create(null);
172
- exports[Symbol.toStringTag] = "Module";
172
+ Object.defineProperty(exports, Symbol.toStringTag, {
173
+ value: "Module",
174
+ enumerable: false,
175
+ configurable: false
176
+ });
173
177
  this.moduleCache.set(fsPath, { code: transformed, exports });
174
178
  const __filename = url.fileURLToPath(url$1);
175
179
  const moduleProxy = {
package/dist/client.d.ts CHANGED
@@ -1 +1 @@
1
- export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-4f4de592.js';
1
+ export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-b9c999e6.js';
package/dist/client.mjs CHANGED
@@ -142,7 +142,11 @@ ${getStack()}`), 2e3);
142
142
  const url = pathToFileURL(fsPath).href;
143
143
  const meta = { url };
144
144
  const exports = /* @__PURE__ */ Object.create(null);
145
- exports[Symbol.toStringTag] = "Module";
145
+ Object.defineProperty(exports, Symbol.toStringTag, {
146
+ value: "Module",
147
+ enumerable: false,
148
+ configurable: false
149
+ });
146
150
  this.moduleCache.set(fsPath, { code: transformed, exports });
147
151
  const __filename = fileURLToPath(url);
148
152
  const moduleProxy = {
package/dist/hmr.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { HMRPayload, Plugin } from 'vite';
3
- import { U as UpdatePayload, P as PrunePayload, g as FullReloadPayload, E as ErrorPayload, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-4f4de592.js';
3
+ import { U as UpdatePayload, P as PrunePayload, g as FullReloadPayload, E as ErrorPayload, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-b9c999e6.js';
4
4
 
5
5
  declare type EventType = string | symbol;
6
6
  declare 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-4f4de592.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-b9c999e6.js';
package/dist/server.cjs CHANGED
@@ -135,7 +135,7 @@ class ViteNodeServer {
135
135
  }
136
136
  async resolveId(id, importer) {
137
137
  if (importer && !importer.startsWith(this.server.config.root))
138
- importer = pathe.join(this.server.config.root, importer);
138
+ importer = pathe.resolve(this.server.config.root, importer);
139
139
  const mode = importer && this.getTransformMode(importer) || "ssr";
140
140
  return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
141
141
  }
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 } from './types-4f4de592.js';
2
+ import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-b9c999e6.js';
3
3
 
4
4
  declare class Debugger {
5
5
  options: DebuggerOptions;
package/dist/server.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { join } from 'pathe';
1
+ import { resolve } from 'pathe';
2
2
  import createDebug from 'debug';
3
3
  import { existsSync } from 'fs';
4
4
  import { isNodeBuiltin, isValidNodeImport } from 'mlly';
@@ -127,7 +127,7 @@ class ViteNodeServer {
127
127
  }
128
128
  async resolveId(id, importer) {
129
129
  if (importer && !importer.startsWith(this.server.config.root))
130
- importer = join(this.server.config.root, importer);
130
+ importer = resolve(this.server.config.root, importer);
131
131
  const mode = importer && this.getTransformMode(importer) || "ssr";
132
132
  return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
133
133
  }
@@ -66,18 +66,26 @@ interface CustomEventMap {
66
66
  type InferCustomEventPayload<T extends string> =
67
67
  T extends keyof CustomEventMap ? CustomEventMap[T] : any
68
68
 
69
+ type ModuleNamespace = Record<string, any> & {
70
+ [Symbol.toStringTag]: 'Module'
71
+ }
72
+
69
73
  interface ViteHotContext {
70
74
  readonly data: any
71
75
 
72
76
  accept(): void
73
- accept(cb: (mod: any) => void): void
74
- accept(dep: string, cb: (mod: any) => void): void
75
- accept(deps: readonly string[], cb: (mods: any[]) => void): void
76
-
77
- /**
78
- * @deprecated
79
- */
80
- acceptDeps(): never
77
+ accept(cb: (mod: ModuleNamespace | undefined) => void): void
78
+ accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
79
+ accept(
80
+ deps: readonly string[],
81
+ cb: (mods: Array<ModuleNamespace | undefined>) => void
82
+ ): void
83
+
84
+ acceptExports(exportNames: string | readonly string[]): void
85
+ acceptExports(
86
+ exportNames: string | readonly string[],
87
+ cb: (mod: ModuleNamespace | undefined) => void
88
+ ): void
81
89
 
82
90
  dispose(cb: (data: any) => void): void
83
91
  decline(): void
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-4f4de592.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-b9c999e6.js';
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformResult } from 'vite';
2
- import { N as Nullable, A as Arrayable } from './types-4f4de592.js';
2
+ import { N as Nullable, A as Arrayable } from './types-b9c999e6.js';
3
3
 
4
4
  declare const isWindows: boolean;
5
5
  declare function slash(str: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.20.2",
3
+ "version": "0.21.1",
4
4
  "description": "Vite as Node.js runtime",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "debug": "^4.3.4",
68
- "mlly": "^0.5.4",
68
+ "mlly": "^0.5.7",
69
69
  "pathe": "^0.2.0",
70
70
  "vite": "^2.9.12 || ^3.0.0-0"
71
71
  },
@@ -73,7 +73,7 @@
73
73
  "@types/debug": "^4.1.7",
74
74
  "cac": "^6.7.12",
75
75
  "picocolors": "^1.0.0",
76
- "rollup": "^2.77.0"
76
+ "rollup": "^2.77.2"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "rimraf dist && rollup -c",