vite-node 0.34.3 → 0.34.5
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/README.md +3 -3
- package/dist/cli.cjs +6 -11
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.cjs +4 -29
- package/dist/client.d.ts +2 -2
- package/dist/constants.cjs +0 -2
- package/dist/hmr.cjs +240 -14
- package/dist/hmr.d.ts +2 -2
- package/dist/hmr.mjs +237 -5
- package/dist/{types-2dc895bd.d.ts → index-6fb787b2.d.ts} +14 -2
- package/dist/index.d.ts +2 -2
- package/dist/server.cjs +5 -12
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +3 -3
- package/dist/source-map.cjs +18 -20
- package/dist/source-map.d.ts +1 -1
- package/dist/source-map.mjs +13 -8
- package/dist/trace-mapping.d-e677e8f4.d.ts +54 -0
- package/dist/types.d.ts +2 -2
- package/dist/utils.cjs +9 -5
- package/dist/utils.d.ts +4 -3
- package/dist/utils.mjs +9 -4
- package/package.json +4 -4
- package/dist/chunk-hmr.cjs +0 -250
- package/dist/chunk-hmr.mjs +0 -237
- package/dist/types.d-7442d07f.d.ts +0 -23
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ npx vite-node -h
|
|
|
40
40
|
|
|
41
41
|
### Options via CLI
|
|
42
42
|
|
|
43
|
-
[All `ViteNodeServer` options](https://github.com/vitest-dev/vitest/blob/main/packages/vite-node/src/types.ts#
|
|
43
|
+
[All `ViteNodeServer` options](https://github.com/vitest-dev/vitest/blob/main/packages/vite-node/src/types.ts#L92-L111) are supported by the CLI. They may be defined through the dot syntax, as shown below:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
46
|
npx vite-node --options.deps.inline="module-name" --options.deps.external="/module-regexp/" index.ts
|
|
@@ -130,7 +130,7 @@ await server.close()
|
|
|
130
130
|
|
|
131
131
|
Sometimes you might want to inspect the transformed code to investigate issues. You can set environment variable `VITE_NODE_DEBUG_DUMP=true` to let vite-node write the transformed result of each module under `.vite-node/dump`.
|
|
132
132
|
|
|
133
|
-
If you want to debug by modifying the dumped code, you can change the value of `VITE_NODE_DEBUG_DUMP` to `load` and search for the
|
|
133
|
+
If you want to debug by modifying the dumped code, you can change the value of `VITE_NODE_DEBUG_DUMP` to `load` and search for the dumped files and use them for executing.
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
136
|
VITE_NODE_DEBUG_DUMP=load vite-node example.ts
|
|
@@ -151,7 +151,7 @@ const server = new ViteNodeServer(viteServer, {
|
|
|
151
151
|
|
|
152
152
|
### Debug Execution
|
|
153
153
|
|
|
154
|
-
If the process
|
|
154
|
+
If the process gets stuck, it might be because there are unresolvable circular dependencies. You can set `VITE_NODE_DEBUG_RUNNER=true` for vite-node to warn about this.
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
157
|
VITE_NODE_DEBUG_RUNNER=true vite-node example.ts
|
package/dist/cli.cjs
CHANGED
|
@@ -7,27 +7,22 @@ var server = require('./server.cjs');
|
|
|
7
7
|
var client = require('./client.cjs');
|
|
8
8
|
var utils = require('./utils.cjs');
|
|
9
9
|
var sourceMap = require('./source-map.cjs');
|
|
10
|
-
var hmr = require('./
|
|
10
|
+
var hmr = require('./hmr.cjs');
|
|
11
11
|
require('perf_hooks');
|
|
12
12
|
require('fs');
|
|
13
13
|
require('pathe');
|
|
14
14
|
require('debug');
|
|
15
15
|
require('mlly');
|
|
16
16
|
require('./constants.cjs');
|
|
17
|
-
require('node:url');
|
|
18
17
|
require('module');
|
|
19
18
|
require('path');
|
|
19
|
+
require('node:url');
|
|
20
20
|
require('node:vm');
|
|
21
21
|
require('node:events');
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var cac__default = /*#__PURE__*/_interopDefaultLegacy(cac);
|
|
26
|
-
var c__default = /*#__PURE__*/_interopDefaultLegacy(c);
|
|
27
|
-
|
|
28
|
-
var version = "0.34.3";
|
|
23
|
+
var version = "0.34.5";
|
|
29
24
|
|
|
30
|
-
const cli =
|
|
25
|
+
const cli = cac("vite-node");
|
|
31
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");
|
|
32
27
|
cli.command("[...files]").allowUnknownOptions().action(run);
|
|
33
28
|
cli.parse(process.argv, { run: false });
|
|
@@ -58,7 +53,7 @@ async function run(files, options = {}) {
|
|
|
58
53
|
process.exit(0);
|
|
59
54
|
}
|
|
60
55
|
if (!files.length) {
|
|
61
|
-
console.error(
|
|
56
|
+
console.error(c.red("No files specified."));
|
|
62
57
|
cli.version(version).outputHelp();
|
|
63
58
|
process.exit(1);
|
|
64
59
|
}
|
|
@@ -103,7 +98,7 @@ async function run(files, options = {}) {
|
|
|
103
98
|
});
|
|
104
99
|
if (options.watch) {
|
|
105
100
|
process.on("uncaughtException", (err) => {
|
|
106
|
-
console.error(
|
|
101
|
+
console.error(c.red("[vite-node] Failed to execute file: \n"), err);
|
|
107
102
|
});
|
|
108
103
|
}
|
|
109
104
|
}
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -5,20 +5,20 @@ import { ViteNodeServer } from './server.mjs';
|
|
|
5
5
|
import { ViteNodeRunner } from './client.mjs';
|
|
6
6
|
import { toArray } from './utils.mjs';
|
|
7
7
|
import { installSourcemapsSupport } from './source-map.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { viteNodeHmrPlugin, createHotContext, handleMessage } from './hmr.mjs';
|
|
9
9
|
import 'node:perf_hooks';
|
|
10
10
|
import 'node:fs';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'debug';
|
|
13
13
|
import 'mlly';
|
|
14
14
|
import './constants.mjs';
|
|
15
|
-
import 'node:url';
|
|
16
15
|
import 'node:module';
|
|
17
16
|
import 'node:path';
|
|
17
|
+
import 'node:url';
|
|
18
18
|
import 'node:vm';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
|
|
21
|
-
var version = "0.34.
|
|
21
|
+
var version = "0.34.5";
|
|
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/client.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var module$1 = require('module');
|
|
6
4
|
var path = require('path');
|
|
7
5
|
var node_url = require('node:url');
|
|
@@ -12,32 +10,9 @@ var utils = require('./utils.cjs');
|
|
|
12
10
|
var sourceMap = require('./source-map.cjs');
|
|
13
11
|
require('fs');
|
|
14
12
|
|
|
15
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule) return e;
|
|
19
|
-
var n = Object.create(null);
|
|
20
|
-
if (e) {
|
|
21
|
-
Object.keys(e).forEach(function (k) {
|
|
22
|
-
if (k !== 'default') {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return e[k]; }
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
n["default"] = e;
|
|
32
|
-
return Object.freeze(n);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var vm__default = /*#__PURE__*/_interopDefaultLegacy(vm);
|
|
36
|
-
var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
|
|
37
|
-
|
|
38
13
|
const { setTimeout, clearTimeout } = globalThis;
|
|
39
|
-
const debugExecute =
|
|
40
|
-
const debugNative =
|
|
14
|
+
const debugExecute = createDebug("vite-node:client:execute");
|
|
15
|
+
const debugNative = createDebug("vite-node:client:native");
|
|
41
16
|
const clientStub = {
|
|
42
17
|
injectQuery: (id) => id,
|
|
43
18
|
createHotContext: () => {
|
|
@@ -365,7 +340,7 @@ ${getStack()}`), 2e3);
|
|
|
365
340
|
lineOffset: 0,
|
|
366
341
|
columnOffset: -codeDefinition.length
|
|
367
342
|
};
|
|
368
|
-
const fn =
|
|
343
|
+
const fn = vm.runInThisContext(code, options);
|
|
369
344
|
await fn(...Object.values(context));
|
|
370
345
|
}
|
|
371
346
|
prepareContext(context) {
|
|
@@ -381,7 +356,7 @@ ${getStack()}`), 2e3);
|
|
|
381
356
|
return !path.endsWith(".mjs") && "default" in mod;
|
|
382
357
|
}
|
|
383
358
|
importExternalModule(path) {
|
|
384
|
-
return (
|
|
359
|
+
return import(path);
|
|
385
360
|
}
|
|
386
361
|
/**
|
|
387
362
|
* Import a module and interop it
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
2
|
-
export {
|
|
1
|
+
import './trace-mapping.d-e677e8f4.js';
|
|
2
|
+
export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-6fb787b2.js';
|
package/dist/constants.cjs
CHANGED
package/dist/hmr.cjs
CHANGED
|
@@ -1,23 +1,249 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
require('
|
|
7
|
-
require('picocolors');
|
|
8
|
-
require('debug');
|
|
9
|
-
require('./utils.cjs');
|
|
3
|
+
var node_events = require('node:events');
|
|
4
|
+
var c = require('picocolors');
|
|
5
|
+
var createDebug = require('debug');
|
|
6
|
+
var utils = require('./utils.cjs');
|
|
10
7
|
require('node:url');
|
|
11
8
|
require('module');
|
|
12
9
|
require('fs');
|
|
13
10
|
require('pathe');
|
|
14
11
|
|
|
12
|
+
function createHmrEmitter() {
|
|
13
|
+
const emitter = new node_events.EventEmitter();
|
|
14
|
+
return emitter;
|
|
15
|
+
}
|
|
16
|
+
function viteNodeHmrPlugin() {
|
|
17
|
+
const emitter = createHmrEmitter();
|
|
18
|
+
return {
|
|
19
|
+
name: "vite-node:hmr",
|
|
20
|
+
config() {
|
|
21
|
+
if (process.platform === "darwin" && process.env.VITE_TEST_WATCHER_DEBUG) {
|
|
22
|
+
return {
|
|
23
|
+
server: {
|
|
24
|
+
watch: {
|
|
25
|
+
useFsEvents: false,
|
|
26
|
+
usePolling: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
configureServer(server) {
|
|
33
|
+
const _send = server.ws.send;
|
|
34
|
+
server.emitter = emitter;
|
|
35
|
+
server.ws.send = function(payload) {
|
|
36
|
+
_send(payload);
|
|
37
|
+
emitter.emit("message", payload);
|
|
38
|
+
};
|
|
39
|
+
if (process.env.VITE_TEST_WATCHER_DEBUG) {
|
|
40
|
+
server.watcher.on("ready", () => {
|
|
41
|
+
console.log("[debug] watcher is ready");
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
15
47
|
|
|
48
|
+
const debugHmr = createDebug("vite-node:hmr");
|
|
49
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
50
|
+
function getCache(runner) {
|
|
51
|
+
if (!cache.has(runner)) {
|
|
52
|
+
cache.set(runner, {
|
|
53
|
+
hotModulesMap: /* @__PURE__ */ new Map(),
|
|
54
|
+
dataMap: /* @__PURE__ */ new Map(),
|
|
55
|
+
disposeMap: /* @__PURE__ */ new Map(),
|
|
56
|
+
pruneMap: /* @__PURE__ */ new Map(),
|
|
57
|
+
customListenersMap: /* @__PURE__ */ new Map(),
|
|
58
|
+
ctxToListenersMap: /* @__PURE__ */ new Map(),
|
|
59
|
+
messageBuffer: [],
|
|
60
|
+
isFirstUpdate: false,
|
|
61
|
+
pending: false,
|
|
62
|
+
queued: []
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return cache.get(runner);
|
|
66
|
+
}
|
|
67
|
+
function sendMessageBuffer(runner, emitter) {
|
|
68
|
+
const maps = getCache(runner);
|
|
69
|
+
maps.messageBuffer.forEach((msg) => emitter.emit("custom", msg));
|
|
70
|
+
maps.messageBuffer.length = 0;
|
|
71
|
+
}
|
|
72
|
+
async function reload(runner, files) {
|
|
73
|
+
Array.from(runner.moduleCache.keys()).forEach((fsPath) => {
|
|
74
|
+
if (!fsPath.includes("node_modules"))
|
|
75
|
+
runner.moduleCache.delete(fsPath);
|
|
76
|
+
});
|
|
77
|
+
return Promise.all(files.map((file) => runner.executeId(file)));
|
|
78
|
+
}
|
|
79
|
+
async function notifyListeners(runner, event, data) {
|
|
80
|
+
const maps = getCache(runner);
|
|
81
|
+
const cbs = maps.customListenersMap.get(event);
|
|
82
|
+
if (cbs)
|
|
83
|
+
await Promise.all(cbs.map((cb) => cb(data)));
|
|
84
|
+
}
|
|
85
|
+
async function queueUpdate(runner, p) {
|
|
86
|
+
const maps = getCache(runner);
|
|
87
|
+
maps.queued.push(p);
|
|
88
|
+
if (!maps.pending) {
|
|
89
|
+
maps.pending = true;
|
|
90
|
+
await Promise.resolve();
|
|
91
|
+
maps.pending = false;
|
|
92
|
+
const loading = [...maps.queued];
|
|
93
|
+
maps.queued = [];
|
|
94
|
+
(await Promise.all(loading)).forEach((fn) => fn && fn());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
98
|
+
path = utils.normalizeRequestId(path);
|
|
99
|
+
acceptedPath = utils.normalizeRequestId(acceptedPath);
|
|
100
|
+
const maps = getCache(runner);
|
|
101
|
+
const mod = maps.hotModulesMap.get(path);
|
|
102
|
+
if (!mod) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const isSelfUpdate = path === acceptedPath;
|
|
106
|
+
let fetchedModule;
|
|
107
|
+
const qualifiedCallbacks = mod.callbacks.filter(
|
|
108
|
+
({ deps }) => deps.includes(acceptedPath)
|
|
109
|
+
);
|
|
110
|
+
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
|
111
|
+
const disposer = maps.disposeMap.get(acceptedPath);
|
|
112
|
+
if (disposer)
|
|
113
|
+
await disposer(maps.dataMap.get(acceptedPath));
|
|
114
|
+
try {
|
|
115
|
+
[fetchedModule] = await reload(runner, [acceptedPath]);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
warnFailedFetch(e, acceptedPath);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return () => {
|
|
121
|
+
for (const { deps, fn } of qualifiedCallbacks)
|
|
122
|
+
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
|
|
123
|
+
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
124
|
+
console.log(`${c.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function warnFailedFetch(err, path) {
|
|
128
|
+
if (!err.message.match("fetch"))
|
|
129
|
+
console.error(err);
|
|
130
|
+
console.error(
|
|
131
|
+
`[hmr] Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
async function handleMessage(runner, emitter, files, payload) {
|
|
135
|
+
const maps = getCache(runner);
|
|
136
|
+
switch (payload.type) {
|
|
137
|
+
case "connected":
|
|
138
|
+
sendMessageBuffer(runner, emitter);
|
|
139
|
+
break;
|
|
140
|
+
case "update":
|
|
141
|
+
await notifyListeners(runner, "vite:beforeUpdate", payload);
|
|
142
|
+
await Promise.all(payload.updates.map((update) => {
|
|
143
|
+
if (update.type === "js-update")
|
|
144
|
+
return queueUpdate(runner, fetchUpdate(runner, update));
|
|
145
|
+
console.error(`${c.cyan("[vite-node]")} no support css hmr.}`);
|
|
146
|
+
return null;
|
|
147
|
+
}));
|
|
148
|
+
await notifyListeners(runner, "vite:afterUpdate", payload);
|
|
149
|
+
break;
|
|
150
|
+
case "full-reload":
|
|
151
|
+
await notifyListeners(runner, "vite:beforeFullReload", payload);
|
|
152
|
+
maps.customListenersMap.delete("vite:beforeFullReload");
|
|
153
|
+
await reload(runner, files);
|
|
154
|
+
break;
|
|
155
|
+
case "custom":
|
|
156
|
+
await notifyListeners(runner, payload.event, payload.data);
|
|
157
|
+
break;
|
|
158
|
+
case "prune":
|
|
159
|
+
await notifyListeners(runner, "vite:beforePrune", payload);
|
|
160
|
+
payload.paths.forEach((path) => {
|
|
161
|
+
const fn = maps.pruneMap.get(path);
|
|
162
|
+
if (fn)
|
|
163
|
+
fn(maps.dataMap.get(path));
|
|
164
|
+
});
|
|
165
|
+
break;
|
|
166
|
+
case "error": {
|
|
167
|
+
await notifyListeners(runner, "vite:error", payload);
|
|
168
|
+
const err = payload.err;
|
|
169
|
+
console.error(`${c.cyan("[vite-node]")} Internal Server Error
|
|
170
|
+
${err.message}
|
|
171
|
+
${err.stack}`);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function createHotContext(runner, emitter, files, ownerPath) {
|
|
177
|
+
debugHmr("createHotContext", ownerPath);
|
|
178
|
+
const maps = getCache(runner);
|
|
179
|
+
if (!maps.dataMap.has(ownerPath))
|
|
180
|
+
maps.dataMap.set(ownerPath, {});
|
|
181
|
+
const mod = maps.hotModulesMap.get(ownerPath);
|
|
182
|
+
if (mod)
|
|
183
|
+
mod.callbacks = [];
|
|
184
|
+
const newListeners = /* @__PURE__ */ new Map();
|
|
185
|
+
maps.ctxToListenersMap.set(ownerPath, newListeners);
|
|
186
|
+
function acceptDeps(deps, callback = () => {
|
|
187
|
+
}) {
|
|
188
|
+
const mod2 = maps.hotModulesMap.get(ownerPath) || {
|
|
189
|
+
id: ownerPath,
|
|
190
|
+
callbacks: []
|
|
191
|
+
};
|
|
192
|
+
mod2.callbacks.push({
|
|
193
|
+
deps,
|
|
194
|
+
fn: callback
|
|
195
|
+
});
|
|
196
|
+
maps.hotModulesMap.set(ownerPath, mod2);
|
|
197
|
+
}
|
|
198
|
+
const hot = {
|
|
199
|
+
get data() {
|
|
200
|
+
return maps.dataMap.get(ownerPath);
|
|
201
|
+
},
|
|
202
|
+
acceptExports(_, callback) {
|
|
203
|
+
acceptDeps([ownerPath], callback && (([mod2]) => callback(mod2)));
|
|
204
|
+
},
|
|
205
|
+
accept(deps, callback) {
|
|
206
|
+
if (typeof deps === "function" || !deps) {
|
|
207
|
+
acceptDeps([ownerPath], ([mod2]) => deps && deps(mod2));
|
|
208
|
+
} else if (typeof deps === "string") {
|
|
209
|
+
acceptDeps([deps], ([mod2]) => callback && callback(mod2));
|
|
210
|
+
} else if (Array.isArray(deps)) {
|
|
211
|
+
acceptDeps(deps, callback);
|
|
212
|
+
} else {
|
|
213
|
+
throw new TypeError("invalid hot.accept() usage.");
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
dispose(cb) {
|
|
217
|
+
maps.disposeMap.set(ownerPath, cb);
|
|
218
|
+
},
|
|
219
|
+
prune(cb) {
|
|
220
|
+
maps.pruneMap.set(ownerPath, cb);
|
|
221
|
+
},
|
|
222
|
+
invalidate() {
|
|
223
|
+
notifyListeners(runner, "vite:invalidate", { path: ownerPath, message: void 0 });
|
|
224
|
+
return reload(runner, files);
|
|
225
|
+
},
|
|
226
|
+
on(event, cb) {
|
|
227
|
+
const addToMap = (map) => {
|
|
228
|
+
const existing = map.get(event) || [];
|
|
229
|
+
existing.push(cb);
|
|
230
|
+
map.set(event, existing);
|
|
231
|
+
};
|
|
232
|
+
addToMap(maps.customListenersMap);
|
|
233
|
+
addToMap(newListeners);
|
|
234
|
+
},
|
|
235
|
+
send(event, data) {
|
|
236
|
+
maps.messageBuffer.push(JSON.stringify({ type: "custom", event, data }));
|
|
237
|
+
sendMessageBuffer(runner, emitter);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
return hot;
|
|
241
|
+
}
|
|
16
242
|
|
|
17
|
-
exports.createHmrEmitter =
|
|
18
|
-
exports.createHotContext =
|
|
19
|
-
exports.getCache =
|
|
20
|
-
exports.handleMessage =
|
|
21
|
-
exports.reload =
|
|
22
|
-
exports.sendMessageBuffer =
|
|
23
|
-
exports.viteNodeHmrPlugin =
|
|
243
|
+
exports.createHmrEmitter = createHmrEmitter;
|
|
244
|
+
exports.createHotContext = createHotContext;
|
|
245
|
+
exports.getCache = getCache;
|
|
246
|
+
exports.handleMessage = handleMessage;
|
|
247
|
+
exports.reload = reload;
|
|
248
|
+
exports.sendMessageBuffer = sendMessageBuffer;
|
|
249
|
+
exports.viteNodeHmrPlugin = viteNodeHmrPlugin;
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { HMRPayload, Plugin } from 'vite';
|
|
3
|
-
import {
|
|
4
|
-
import './
|
|
3
|
+
import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-6fb787b2.js';
|
|
4
|
+
import './trace-mapping.d-e677e8f4.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
7
7
|
type Handler<T = unknown> = (event: T) => void;
|