what-core 0.14.0 → 0.15.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/LICENSE +21 -0
- package/README.md +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
package/src/hot.js
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// What Framework - Hot replacement in the dev server
|
|
2
|
+
//
|
|
3
|
+
// what-compiler's Vite plugin, in development, adds calls to this module to
|
|
4
|
+
// each module of the app it compiles for the browser (what-compiler
|
|
5
|
+
// src/hot.js writes them), and nothing else imports it: a production build,
|
|
6
|
+
// a server render and a page without the dev server never load it.
|
|
7
|
+
//
|
|
8
|
+
// import { _$hot } from 'what-framework/hot';
|
|
9
|
+
// const _$h = _$hot(import.meta.hot, 1, 'src/Counter.jsx');
|
|
10
|
+
// import.meta.hot.accept(_$h.accept);
|
|
11
|
+
// _$h.component('Counter', Counter, 'k3x9a', () => [increment]);
|
|
12
|
+
// const count = _$h.keep('count', 'p1q2b', () => [], () => signal(0, 'count'));
|
|
13
|
+
// _$h.done(['count']);
|
|
14
|
+
//
|
|
15
|
+
// A module's state between its versions is in `import.meta.hot.data`:
|
|
16
|
+
//
|
|
17
|
+
// - Each component it declares has a record, which every version of the
|
|
18
|
+
// function points to. A component renders through its record (render.js
|
|
19
|
+
// hotInstance), so a parent that holds an older version renders the current
|
|
20
|
+
// code. A new version whose source, or the source of the module's functions
|
|
21
|
+
// it calls, or an import or a kept value it reads, differs from the running
|
|
22
|
+
// one's builds each live instance again in place (render.js _hotSwap), once
|
|
23
|
+
// every module of the update has run. The others keep running the code
|
|
24
|
+
// they have, and their state.
|
|
25
|
+
// - An instance's state (each `signal()`, `useState()`, `useSignal()` and
|
|
26
|
+
// `useReducer()` call in its body and in the module's custom hooks it
|
|
27
|
+
// calls, which the compiler wraps as `_$h.state(site, () => call)`) goes
|
|
28
|
+
// to the instance its new version builds while the component's state
|
|
29
|
+
// signature (the source of those calls, in order) is unchanged, as React
|
|
30
|
+
// keeps hook state (render.js _hotState).
|
|
31
|
+
// - A module-scope value that is not a function (`const count = signal(0)`,
|
|
32
|
+
// `createStore(...)`, `new Map()`) is kept: the new version gets the old
|
|
33
|
+
// value while its initializer's source and what it reads are unchanged, so
|
|
34
|
+
// editing an action does not lose the state it acts on.
|
|
35
|
+
// - An export the new version changed, other than a component (an action
|
|
36
|
+
// whose code changed, a value made again), cannot reach the modules that
|
|
37
|
+
// imported the old one, so the update goes to them (`hot.invalidate()`),
|
|
38
|
+
// and up to the entry, where Vite reloads the page.
|
|
39
|
+
//
|
|
40
|
+
// The plugin reloads the page for a module that runs statements at its top
|
|
41
|
+
// level (a mount(), an effect, a listener): running it again would run them
|
|
42
|
+
// twice. A failed update (a compile error, a throw while the new code runs)
|
|
43
|
+
// shows in Vite's overlay and in the diagnostics (ERR_HOT_UPDATE_FAILED), and
|
|
44
|
+
// the page keeps the code it had.
|
|
45
|
+
|
|
46
|
+
import { __DEV__, __devtools } from './reactive.js';
|
|
47
|
+
import { _installHot, _hotSwap, _hotState } from './render.js';
|
|
48
|
+
import { report, recordObservation } from './diagnostics.js';
|
|
49
|
+
|
|
50
|
+
const HOT = Symbol('what.hot');
|
|
51
|
+
|
|
52
|
+
// Records whose code changed, waiting for the end of the update.
|
|
53
|
+
/** @type {Set<any>} */
|
|
54
|
+
const changed = new Set();
|
|
55
|
+
// The files whose new versions ran in the update now in flight.
|
|
56
|
+
/** @type {Set<string>} */
|
|
57
|
+
const updated = new Set();
|
|
58
|
+
// The payloads of each event already handled: every module's context listens.
|
|
59
|
+
/** @type {Map<string, WeakSet<object>>} */
|
|
60
|
+
const seen = new Map();
|
|
61
|
+
let installed = false;
|
|
62
|
+
|
|
63
|
+
function recordOf(Component) {
|
|
64
|
+
return Component[HOT];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// What another runtime knows a component it refreshes by, across that
|
|
68
|
+
// component's versions (_hotIdentity), or undefined.
|
|
69
|
+
/** @type {((fn: Function) => unknown) | null} */
|
|
70
|
+
let identityOf = null;
|
|
71
|
+
|
|
72
|
+
// A dependency as a version compares it: a component by its record, or by
|
|
73
|
+
// what the runtime that refreshes it knows it by.
|
|
74
|
+
function stable(value) {
|
|
75
|
+
if (typeof value !== 'function') return value;
|
|
76
|
+
if (value[HOT] !== undefined) return value[HOT];
|
|
77
|
+
const known = identityOf !== null ? identityOf(value) : undefined;
|
|
78
|
+
return known === undefined ? value : known;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @internal what-react's Fast Refresh (refresh.js): what a React component
|
|
83
|
+
* is known by across its versions (its family), or undefined. A native
|
|
84
|
+
* component that renders one (a React island in a native file) does not
|
|
85
|
+
* change when only the React component's version does: Fast Refresh
|
|
86
|
+
* renders the component's instances again in place, so the native one, and
|
|
87
|
+
* the other islands it holds, keep their state.
|
|
88
|
+
* @param {(fn: Function) => unknown} of
|
|
89
|
+
*/
|
|
90
|
+
export function _hotIdentity(of) {
|
|
91
|
+
if (__DEV__) identityOf = of;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function sameDeps(a, b) {
|
|
95
|
+
if (a === null || b === null || a.length !== b.length) return false;
|
|
96
|
+
for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function readDeps(deps) {
|
|
101
|
+
try {
|
|
102
|
+
return deps().map(stable);
|
|
103
|
+
} catch {
|
|
104
|
+
// A binding not initialized yet (an import cycle): compare as changed.
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// A page served without Vite's hot updates: the module runs as written.
|
|
110
|
+
const INERT = {
|
|
111
|
+
accept() {},
|
|
112
|
+
component: (_name, fn) => fn,
|
|
113
|
+
state: (_site, init) => init(),
|
|
114
|
+
fn() {},
|
|
115
|
+
keep: (_name, _sig, _deps, init) => init(),
|
|
116
|
+
done() {},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @internal A module's hot context: what-compiler writes the calls, from
|
|
121
|
+
* the module's own source, in the dev server.
|
|
122
|
+
* @param {any} hot the module's `import.meta.hot`
|
|
123
|
+
* @param {number} accepts 1 for a module that replaces itself (it accepts its own updates), else 0
|
|
124
|
+
* @param {string} file the module's path from the project root, for reports
|
|
125
|
+
*/
|
|
126
|
+
export function _$hot(hot, accepts, file) {
|
|
127
|
+
return __DEV__ && hot != null ? hotModule(hot, accepts, file) : INERT;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function hotModule(hot, accepts, file) {
|
|
131
|
+
if (!installed) {
|
|
132
|
+
installed = true;
|
|
133
|
+
_installHot(recordOf);
|
|
134
|
+
}
|
|
135
|
+
const listen = (event, fn) => {
|
|
136
|
+
if (!seen.has(event)) seen.set(event, new WeakSet());
|
|
137
|
+
const handled = /** @type {WeakSet<object>} */ (seen.get(event));
|
|
138
|
+
hot.on(event, (payload) => {
|
|
139
|
+
if (payload !== null && typeof payload === 'object') {
|
|
140
|
+
if (handled.has(payload)) return;
|
|
141
|
+
handled.add(payload);
|
|
142
|
+
}
|
|
143
|
+
fn(payload);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
// Every context listens, and the first to hear an event handles it: Vite
|
|
147
|
+
// drops a module's listeners when its next version starts.
|
|
148
|
+
listen('vite:beforeUpdate', () => updated.clear());
|
|
149
|
+
listen('vite:afterUpdate', flush);
|
|
150
|
+
listen('vite:error', (payload) => compileFailed(payload && payload.err));
|
|
151
|
+
/** @type {any} */
|
|
152
|
+
const prev = hot.data.what;
|
|
153
|
+
const next = { records: new Map(), values: new Map(), fns: new Map(), verdict: 'accept' };
|
|
154
|
+
/** @type {Array<{ record: any, fn: Function, sig: string | null, deps: () => any[], state: string | null }>} */
|
|
155
|
+
const registered = [];
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
/** The callback of `import.meta.hot.accept()`: the verdict of the version that ran. */
|
|
159
|
+
accept(module) {
|
|
160
|
+
if (module === undefined) return;
|
|
161
|
+
const verdict = hot.data.what ? hot.data.what.verdict : 'accept';
|
|
162
|
+
if (verdict === 'invalidate') hot.invalidate('an export changed; its importers update');
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* `key`: the name it is exported under, else its own. `state`: its state
|
|
167
|
+
* signature; null (or left out) keeps none.
|
|
168
|
+
*/
|
|
169
|
+
component(key, fn, sig, deps, state = null) {
|
|
170
|
+
let record = prev ? prev.records.get(key) : undefined;
|
|
171
|
+
if (record === undefined) record = { name: fn.name || key, file, impl: fn, sig, deps: null, state, slots: new Set() };
|
|
172
|
+
try {
|
|
173
|
+
Object.defineProperty(fn, HOT, { value: record, configurable: true });
|
|
174
|
+
} catch { /* a frozen function renders as it is */ }
|
|
175
|
+
if (fn.name === '') Object.defineProperty(fn, 'name', { value: key, configurable: true });
|
|
176
|
+
next.records.set(key, record);
|
|
177
|
+
registered.push({ record, fn, sig, deps, state });
|
|
178
|
+
return fn;
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
state: _hotState,
|
|
182
|
+
|
|
183
|
+
fn(name, sig, deps) {
|
|
184
|
+
next.fns.set(name, { sig, deps, read: /** @type {any[] | null} */ (null) });
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
keep(name, sig, deps, init) {
|
|
188
|
+
const was = prev ? prev.values.get(name) : undefined;
|
|
189
|
+
const read = readDeps(deps);
|
|
190
|
+
if (was !== undefined && sig !== null && was.sig === sig && read !== null && sameDeps(was.deps, read)) {
|
|
191
|
+
next.values.set(name, { sig, deps: read, value: was.value, same: true });
|
|
192
|
+
return was.value;
|
|
193
|
+
}
|
|
194
|
+
let value;
|
|
195
|
+
try {
|
|
196
|
+
value = init();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
runFailed(error, file, `running ${name}'s initializer`);
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
// A value no earlier version had is not held by an importer either.
|
|
202
|
+
next.values.set(name, { sig, deps: read, value, same: was === undefined });
|
|
203
|
+
return value;
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The module ran to its end: decide each component's update, and what
|
|
208
|
+
* the old version's accept callback does. `exported` names the module's
|
|
209
|
+
* own exports that are not components.
|
|
210
|
+
* @param {string[]} exported
|
|
211
|
+
*/
|
|
212
|
+
done(exported) {
|
|
213
|
+
for (const { record, fn, sig, deps, state } of registered) {
|
|
214
|
+
const read = readDeps(deps);
|
|
215
|
+
if (record.impl === fn) {
|
|
216
|
+
record.deps = read;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (sig !== null && sig === record.sig && read !== null && sameDeps(read, record.deps)) continue;
|
|
220
|
+
// What the record goes back to when its instances cannot take the new code (flush).
|
|
221
|
+
record.was = { impl: record.impl, name: record.name, sig: record.sig, deps: record.deps, state: record.state };
|
|
222
|
+
record.impl = fn;
|
|
223
|
+
record.name = fn.name;
|
|
224
|
+
record.sig = sig;
|
|
225
|
+
record.deps = read;
|
|
226
|
+
record.state = state;
|
|
227
|
+
changed.add(record);
|
|
228
|
+
}
|
|
229
|
+
for (const entry of next.fns.values()) entry.read = readDeps(entry.deps);
|
|
230
|
+
if (prev) {
|
|
231
|
+
for (const name of exported) {
|
|
232
|
+
const value = next.values.get(name);
|
|
233
|
+
if (value !== undefined ? !value.same : fnChanged(prev.fns.get(name), next.fns.get(name))) next.verdict = 'invalidate';
|
|
234
|
+
}
|
|
235
|
+
if (!accepts) next.verdict = 'invalidate';
|
|
236
|
+
}
|
|
237
|
+
hot.data.what = next;
|
|
238
|
+
updated.add(file);
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Whether an exported function's new version differs from the one its
|
|
244
|
+
// importers hold: its source, or what it reads.
|
|
245
|
+
function fnChanged(was, now) {
|
|
246
|
+
if (was === undefined) return false;
|
|
247
|
+
if (now === undefined || now.sig === null || was.sig !== now.sig) return true;
|
|
248
|
+
return was.read === null || now.read === null || !sameDeps(was.read, now.read);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// The update is in: build the changed components' instances again.
|
|
252
|
+
function flush(payload) {
|
|
253
|
+
if (changed.size === 0 && updated.size === 0) return;
|
|
254
|
+
const records = [...changed];
|
|
255
|
+
changed.clear();
|
|
256
|
+
const files = payload && Array.isArray(payload.updates) ? payload.updates.map((u) => u.path) : [...updated];
|
|
257
|
+
updated.clear();
|
|
258
|
+
const started = performance.now();
|
|
259
|
+
const { swapped, kept, failed } = _hotSwap(records);
|
|
260
|
+
const ms = Math.round((performance.now() - started) * 10) / 10;
|
|
261
|
+
for (const { record, error } of failed) {
|
|
262
|
+
// No instance took the new code, so none made later does either.
|
|
263
|
+
Object.assign(record, record.was);
|
|
264
|
+
runFailed(error, record.file, `rendering <${record.name}>`);
|
|
265
|
+
}
|
|
266
|
+
if (__devtools) {
|
|
267
|
+
recordObservation(__devtools, 'hmr:update', null, {
|
|
268
|
+
files,
|
|
269
|
+
components: records.map((r) => r.name),
|
|
270
|
+
instances: swapped,
|
|
271
|
+
kept,
|
|
272
|
+
ms,
|
|
273
|
+
...(failed.length ? { failed: failed.map(({ record, error }) => ({ component: record.name, message: messageOf(error) })) } : {}),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @internal what-react's Fast Refresh (refresh.js): a refresh of React files
|
|
280
|
+
* it applied, recorded as a hot update is (`hmr:update`, read with
|
|
281
|
+
* what_events { types: ["hmr"] }): `files`, the components that rendered
|
|
282
|
+
* again with their state and those `remounted` fresh, the `instances` either
|
|
283
|
+
* touched, `ms`, and what `failed`.
|
|
284
|
+
* @param {{ files: string[], components: string[], remounted: string[], instances: number, ms: number, failed?: Array<{ component: string, message: string }> }} record
|
|
285
|
+
*/
|
|
286
|
+
export function _hotUpdated(record) {
|
|
287
|
+
if (__DEV__ && __devtools) recordObservation(__devtools, 'hmr:update', null, { kind: 'refresh', ...record });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function messageOf(error) {
|
|
291
|
+
return error instanceof Error ? error.message : String(error);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// The new code threw while it ran: the overlay shows it, the diagnostics
|
|
295
|
+
// record it, and the page keeps the code it had.
|
|
296
|
+
function runFailed(error, file, phase) {
|
|
297
|
+
report('ERR_HOT_UPDATE_FAILED', { data: { file, phase, message: messageOf(error) }, subject: { kind: 'module', name: file, id: file } });
|
|
298
|
+
console.error(`[what] The edit to ${file} was not applied: ${phase} threw.`, error);
|
|
299
|
+
const Overlay = typeof customElements !== 'undefined' ? customElements.get('vite-error-overlay') : undefined;
|
|
300
|
+
if (Overlay === undefined) return;
|
|
301
|
+
for (const open of document.querySelectorAll('vite-error-overlay')) /** @type {any} */ (open).close();
|
|
302
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
303
|
+
document.body.appendChild(new Overlay({
|
|
304
|
+
message: `${phase} threw: ${err.message}\nThe page keeps running the code it had. Save a fix to apply it in place.`,
|
|
305
|
+
stack: err.stack || '',
|
|
306
|
+
id: file,
|
|
307
|
+
plugin: 'what-hot',
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// A compile error: Vite's overlay shows it already.
|
|
312
|
+
function compileFailed(err) {
|
|
313
|
+
if (err == null) return;
|
|
314
|
+
const file = err.id || err.loc?.file || '';
|
|
315
|
+
report('ERR_HOT_UPDATE_FAILED', { data: { file, phase: 'compiling it', message: String(err.message || '').split('\n')[0] }, subject: { kind: 'module', name: file, id: file } });
|
|
316
|
+
}
|