@nisli/core 0.54.1 → 0.56.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/README.md +119 -4
- package/dist/component.js +146 -5
- package/dist/component.js.map +1 -1
- package/dist/diagnostics.d.ts +48 -0
- package/dist/diagnostics.js +118 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/disposable.d.ts +14 -0
- package/dist/disposable.js +8 -0
- package/dist/disposable.js.map +1 -0
- package/dist/emitter.d.ts +2 -1
- package/dist/emitter.js +2 -1
- package/dist/emitter.js.map +1 -1
- package/dist/hmr/registry.js +8 -1
- package/dist/hmr/registry.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/injector.d.ts +9 -2
- package/dist/injector.js +18 -0
- package/dist/injector.js.map +1 -1
- package/dist/lifecycle.d.ts +9 -0
- package/dist/lifecycle.js +17 -7
- package/dist/lifecycle.js.map +1 -1
- package/dist/projection.js +24 -5
- package/dist/projection.js.map +1 -1
- package/dist/query.d.ts +134 -55
- package/dist/query.js +379 -188
- package/dist/query.js.map +1 -1
- package/dist/resource.d.ts +2 -1
- package/dist/resource.js +21 -4
- package/dist/resource.js.map +1 -1
- package/dist/settle.d.ts +61 -0
- package/dist/settle.js +106 -0
- package/dist/settle.js.map +1 -0
- package/dist/signal.d.ts +42 -7
- package/dist/signal.js +248 -68
- package/dist/signal.js.map +1 -1
- package/dist/template-audit.d.ts +64 -0
- package/dist/template-audit.js +246 -0
- package/dist/template-audit.js.map +1 -0
- package/dist/template.d.ts +69 -12
- package/dist/template.js +349 -66
- package/dist/template.js.map +1 -1
- package/dist/view-transition.d.ts +70 -0
- package/dist/view-transition.js +98 -0
- package/dist/view-transition.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,12 +93,13 @@ query caching or invalidation policy. Only the synchronous source function is
|
|
|
93
93
|
tracked; stale work is aborted and cannot overwrite a newer result.
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
|
-
import { component, html, resource } from '@nisli/core';
|
|
96
|
+
import { component, html, resource, sanitized } from '@nisli/core';
|
|
97
97
|
|
|
98
98
|
const Markdown = component<{ content: string }>('x-markdown', (props) => {
|
|
99
99
|
const rendered = resource(
|
|
100
100
|
() => props.content.value || undefined,
|
|
101
|
-
|
|
101
|
+
// Rendered markdown is untrusted markup — brand it for the sanitizer.
|
|
102
|
+
async (content, signal) => sanitized(await renderMarkdown(content, { signal })),
|
|
102
103
|
);
|
|
103
104
|
|
|
104
105
|
return html`<article html:inner=${rendered.data}></article>`;
|
|
@@ -110,6 +111,118 @@ current source; component teardown disposes automatically, while standalone
|
|
|
110
111
|
callers can use `dispose()`. Returning `undefined` from the source disables the
|
|
111
112
|
resource and clears its current state.
|
|
112
113
|
|
|
114
|
+
## Trusted and untrusted HTML
|
|
115
|
+
|
|
116
|
+
`html:inner` never takes a bare string. The brand is where the trust decision
|
|
117
|
+
is made, and it picks the sink:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { html, raw, sanitized, setSanitizerFallback } from '@nisli/core';
|
|
121
|
+
|
|
122
|
+
html`<article html:inner=${raw(ownMarkup)}></article>`; // → innerHTML
|
|
123
|
+
html`<article html:inner=${sanitized(userMarkup)}></article>`; // → sanitizer
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`raw()` is the author asserting the markup is already trustworthy; it is
|
|
127
|
+
written straight to `innerHTML`. Never wrap user-generated input in it. A
|
|
128
|
+
native `TrustedHTML` object (from a Trusted Types policy) is accepted on the
|
|
129
|
+
same path and passed through unwrapped, so apps under
|
|
130
|
+
`require-trusted-types-for 'script'` can assign policy output directly.
|
|
131
|
+
|
|
132
|
+
`sanitized()` is the opposite assertion — untrusted markup — and is written
|
|
133
|
+
with the platform's `Element.setHTML()` and its XSS-safe default sanitizer
|
|
134
|
+
where the engine has one (Chrome 146+, Firefox 148+). Where it does not
|
|
135
|
+
(Safari today), register a sanitizer once at startup:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
setSanitizerFallback((el, markup) => {
|
|
139
|
+
el.innerHTML = DOMPurify.sanitize(markup);
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
With no native `setHTML()` and no registered hook, the binding throws `N107`.
|
|
144
|
+
It fails closed by design: nisli never silently downgrades untrusted markup to
|
|
145
|
+
`innerHTML`, and never bundles a sanitizer of its own.
|
|
146
|
+
|
|
147
|
+
## Diagnostics
|
|
148
|
+
|
|
149
|
+
Development-only problems are reported as stable coded lines — `[nisli N107] …`
|
|
150
|
+
— and the gate that enables them is probed once at load (Vite's `import.meta.env`,
|
|
151
|
+
`NODE_ENV`, and loud by default in buildless ESM). Production builds are silent.
|
|
152
|
+
|
|
153
|
+
Override the probe when the probe cannot know: `setDevMode(true)` in a test that
|
|
154
|
+
asserts a diagnostic, `setDevMode(false)` on a buildless page you deploy to
|
|
155
|
+
production, `setDevMode(null)` to restore it.
|
|
156
|
+
|
|
157
|
+
## Explicit resource management
|
|
158
|
+
|
|
159
|
+
Standalone Nisli disposables support `using` on runtimes with native explicit
|
|
160
|
+
resource management:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
{
|
|
164
|
+
using stop = effect(() => console.log(count.value));
|
|
165
|
+
using tasks = query(() => ['tasks'], fetchTasks);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This applies to `effect()`, signal/computed `subscribe()`, `Emitter.on()`,
|
|
170
|
+
`resource()`, and `query()`. Existing callable disposers and `.dispose()`
|
|
171
|
+
methods are unchanged. Nisli only attaches the guarded `Symbol.dispose` alias;
|
|
172
|
+
it never polyfills the platform. Apps that downlevel `using` for older runtimes
|
|
173
|
+
must provide their own `Symbol.dispose` polyfill.
|
|
174
|
+
|
|
175
|
+
## View transitions
|
|
176
|
+
|
|
177
|
+
`viewTransition()` wraps a state update in a native View Transition. It calls
|
|
178
|
+
`flush()` inside the browser's update callback, so the DOM mutation captured
|
|
179
|
+
between the old and new frames is Nisli's own synchronous flush rather than the
|
|
180
|
+
next microtask:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
viewTransition(() => { items.value = sorted; }, { types: ['reorder'] });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
It is opt-in and progressively enhanced. Without
|
|
187
|
+
`document.startViewTransition` the update still applies — synchronously,
|
|
188
|
+
flushed, unanimated — and the call returns `null` instead of a `ViewTransition`
|
|
189
|
+
handle. Engines that predate transition types get the plain callback form, so
|
|
190
|
+
the transition still runs and only type-scoped CSS goes unmatched. No polyfill,
|
|
191
|
+
no UA sniffing, and nothing in your bundle unless you import it.
|
|
192
|
+
|
|
193
|
+
Nisli ships no stylesheet. The root crossfade is the browser default; tune it,
|
|
194
|
+
and answer `prefers-reduced-motion` in CSS so the swap stays atomic and typed
|
|
195
|
+
styles stay active while the motion is cut:
|
|
196
|
+
|
|
197
|
+
```css
|
|
198
|
+
::view-transition-old(root),
|
|
199
|
+
::view-transition-new(root) { animation-duration: 200ms; }
|
|
200
|
+
|
|
201
|
+
@media (prefers-reduced-motion: reduce) {
|
|
202
|
+
::view-transition-group(*),
|
|
203
|
+
::view-transition-old(*),
|
|
204
|
+
::view-transition-new(*) { animation: none !important; }
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Keep async work outside the callback — the page is frozen during capture — and
|
|
209
|
+
use the returned handle (`finished`, `ready`, `skipTransition()`) for hard
|
|
210
|
+
opt-outs and for superseding an in-flight transition.
|
|
211
|
+
|
|
212
|
+
Animating a keyed `each()` list needs one thing spelled out: the
|
|
213
|
+
`<each-item>` wrapper is `display: contents`, and a box-less element cannot be
|
|
214
|
+
captured, so `view-transition-name` must sit on the item's painted child — the
|
|
215
|
+
element your item template actually renders. Put it there and `each()`'s stable
|
|
216
|
+
per-key DOM identity does the rest, with no generated names:
|
|
217
|
+
|
|
218
|
+
```css
|
|
219
|
+
.card {
|
|
220
|
+
view-transition-name: match-element; /* identity-keyed, nothing to bookkeep */
|
|
221
|
+
view-transition-class: card; /* styles every card as one group */
|
|
222
|
+
}
|
|
223
|
+
::view-transition-group(.card) { animation-duration: 200ms; }
|
|
224
|
+
```
|
|
225
|
+
|
|
113
226
|
## Core capabilities
|
|
114
227
|
|
|
115
228
|
- Fine-grained reactivity: `signal`, `computed`, `effect`, `untrack`, `flush`,
|
|
@@ -117,9 +230,11 @@ resource and clears its current state.
|
|
|
117
230
|
- Typed web components: composition-style synchronous setup, signal-backed
|
|
118
231
|
props, typed factories, and live attribute declarations.
|
|
119
232
|
- Safe light-DOM templates: signal bindings, typed events and modifiers,
|
|
120
|
-
`class:*`,
|
|
233
|
+
`class:*`, branded `html:inner` (trusted or sanitizer-routed), refs, and
|
|
234
|
+
dynamic HTML tags through `el()`.
|
|
121
235
|
- Stable control flow: lazy `when()` branches and keyed `each()` lists that
|
|
122
|
-
preserve focus, scroll position, and component state
|
|
236
|
+
preserve focus, scroll position, and component state, moved atomically with
|
|
237
|
+
`moveBefore()` where the engine has it.
|
|
123
238
|
- Two scopes of dependency injection: app-wide singleton services with
|
|
124
239
|
`inject`/`provide`, and portal-safe subtree state with `createContext`.
|
|
125
240
|
- Lifecycle and resilience: `onMount`, `onCleanup`, `useHostEvent`, automatic
|
package/dist/component.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { signal, effect, setContextHook, isSignal, untrack } from './signal.js';
|
|
14
14
|
import { runWithContext, hasContext, getCurrentComponent } from './context.js';
|
|
15
15
|
import { runMountCallbacks } from './lifecycle.js';
|
|
16
|
+
import { diag, formatDiag, isDev } from './diagnostics.js';
|
|
16
17
|
// Wire up effect auto-disposal: when effect() is called during component setup,
|
|
17
18
|
// auto-register the dispose function with the component host.
|
|
18
19
|
setContextHook(() => {
|
|
@@ -83,6 +84,14 @@ class ComponentHostImpl {
|
|
|
83
84
|
*/
|
|
84
85
|
function createPropsProxy() {
|
|
85
86
|
const signals = new Map();
|
|
87
|
+
// Keys the component has READ through the proxy, accumulated over the
|
|
88
|
+
// COMPONENT LIFETIME (the proxy is constructor-owned and survives
|
|
89
|
+
// remounts/HMR swaps, so a re-setup never false-positives). This is the
|
|
90
|
+
// truth source for the unknown-prop echo (N202, ADR 0030.2): a post-mount
|
|
91
|
+
// write to a never-read key is attribution noise, not state. A component
|
|
92
|
+
// that stashes `props` and reads a key dynamically AFTER such a write gets
|
|
93
|
+
// one stale echo — accepted; the echo is attribution-only.
|
|
94
|
+
const readKeys = new Set();
|
|
86
95
|
const getOrCreate = (key, initialValue) => {
|
|
87
96
|
let s = signals.get(key);
|
|
88
97
|
if (!s) {
|
|
@@ -93,6 +102,10 @@ function createPropsProxy() {
|
|
|
93
102
|
};
|
|
94
103
|
const props = new Proxy({}, {
|
|
95
104
|
get(_target, key) {
|
|
105
|
+
// Symbol probes (well-known symbols, thenable checks) are not props.
|
|
106
|
+
if (typeof key !== 'string')
|
|
107
|
+
return undefined;
|
|
108
|
+
readKeys.add(key);
|
|
96
109
|
return getOrCreate(key);
|
|
97
110
|
},
|
|
98
111
|
});
|
|
@@ -100,7 +113,31 @@ function createPropsProxy() {
|
|
|
100
113
|
const s = getOrCreate(key, value);
|
|
101
114
|
s.value = value;
|
|
102
115
|
};
|
|
103
|
-
return { props, setProperty };
|
|
116
|
+
return { props, setProperty, readKeys };
|
|
117
|
+
}
|
|
118
|
+
// ── Duplicate-define attribution (N201, dev only) ───────────────────
|
|
119
|
+
/** First definition site per tag, captured in dev for N201 attribution. */
|
|
120
|
+
const firstDefineSites = new Map();
|
|
121
|
+
/**
|
|
122
|
+
* Best-effort caller frame for N201: the first stack line that is neither the
|
|
123
|
+
* Error header nor a frame inside this module. Dev-only; a user file that is
|
|
124
|
+
* itself named `component.ts` gets skipped too (best-effort attribution, never
|
|
125
|
+
* behavior).
|
|
126
|
+
*/
|
|
127
|
+
function captureDefineSite() {
|
|
128
|
+
const stack = new Error().stack;
|
|
129
|
+
if (!stack)
|
|
130
|
+
return '(site unavailable)';
|
|
131
|
+
const lines = stack.split('\n');
|
|
132
|
+
for (let i = 1; i < lines.length; i++) {
|
|
133
|
+
const line = lines[i].trim();
|
|
134
|
+
if (!line)
|
|
135
|
+
continue;
|
|
136
|
+
if (line.includes('captureDefineSite') || /[/\\]component\.(?:ts|js)\b/.test(line))
|
|
137
|
+
continue;
|
|
138
|
+
return line;
|
|
139
|
+
}
|
|
140
|
+
return '(site unavailable)';
|
|
104
141
|
}
|
|
105
142
|
// ── component() — the main entry point ──────────────────────────────
|
|
106
143
|
/**
|
|
@@ -154,6 +191,13 @@ export function component(tagName, setup,
|
|
|
154
191
|
_templateResult = null;
|
|
155
192
|
_errorTemplateResult = null;
|
|
156
193
|
_teardownScheduled = false;
|
|
194
|
+
// True once a setup cycle completed (template mounted, onMount ran).
|
|
195
|
+
// Gates the unknown-prop echo (N202): factory writes BEFORE connect are
|
|
196
|
+
// the normal seeding path, never noise.
|
|
197
|
+
_setupDone = false;
|
|
198
|
+
// N202 keys already echoed for this element — one echo per key per
|
|
199
|
+
// element lifetime keeps a reactive binding from spamming the console.
|
|
200
|
+
_echoed = null;
|
|
157
201
|
// Props explicitly set via _setProp (factory / direct assignment) are
|
|
158
202
|
// "pinned": an explicit prop wins, so attribute writes no longer overwrite
|
|
159
203
|
// it. (Precedence ruling: prop-pins.)
|
|
@@ -232,6 +276,11 @@ export function component(tagName, setup,
|
|
|
232
276
|
this.__capturedChildren =
|
|
233
277
|
Array.from(this.childNodes);
|
|
234
278
|
}
|
|
279
|
+
// Phase attribution for the SHARED containment boundary (ADR 0030.2
|
|
280
|
+
// T6): 'setup' (N401) until the template is committed, 'mount' (N402)
|
|
281
|
+
// once onMount callbacks begin. Both phases route through the ONE
|
|
282
|
+
// catch below — runMountCallbacks no longer swallows (lifecycle.ts).
|
|
283
|
+
let phase = 'setup';
|
|
235
284
|
try {
|
|
236
285
|
// CONTEXT is established by runWithContext(host, …) below; setup then
|
|
237
286
|
// runs with seed + capture already in place.
|
|
@@ -244,16 +293,45 @@ export function component(tagName, setup,
|
|
|
244
293
|
if (this._templateResult) {
|
|
245
294
|
mountTemplate(this, this._templateResult, host);
|
|
246
295
|
}
|
|
296
|
+
// PROJECTION PHASE (ADR 0030.2 §3): if setup called children(), run
|
|
297
|
+
// its late-children sweep scheduling NOW — after the template
|
|
298
|
+
// committed, BEFORE any onMount callback. The rendered-roots
|
|
299
|
+
// snapshot therefore never depends on where children() sat relative
|
|
300
|
+
// to onMount() registrations (the 0025 batch-3B ordering trap), and
|
|
301
|
+
// the rule becomes universal: any host child appearing after this
|
|
302
|
+
// point — late parser/innerHTML content OR an onMount host-append —
|
|
303
|
+
// classifies as projected content.
|
|
304
|
+
const sweepHost = this;
|
|
305
|
+
if (sweepHost.__nisliProjectionSweep) {
|
|
306
|
+
const sweep = sweepHost.__nisliProjectionSweep;
|
|
307
|
+
sweepHost.__nisliProjectionSweep = undefined; // consumed once per cycle
|
|
308
|
+
sweep();
|
|
309
|
+
}
|
|
247
310
|
// Run onMount() callbacks — DOM is now committed
|
|
311
|
+
phase = 'mount';
|
|
248
312
|
runMountCallbacks(host);
|
|
313
|
+
this._setupDone = true;
|
|
314
|
+
// T6: a SUCCESSFUL (re-)setup — including _remount(), the documented
|
|
315
|
+
// boundary reset — removes the failure stamp.
|
|
316
|
+
this.removeAttribute('data-nisli-error');
|
|
249
317
|
}
|
|
250
318
|
catch (err) {
|
|
251
319
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
252
|
-
|
|
320
|
+
const code = phase === 'setup' ? 'N401' : 'N402';
|
|
321
|
+
diag(code, `<${tagName}> ${phase} failed: ${error.message}`, {
|
|
322
|
+
tag: tagName,
|
|
323
|
+
phase,
|
|
324
|
+
error,
|
|
325
|
+
});
|
|
253
326
|
// Setup may already have registered effects/lifecycle cleanup, or
|
|
254
327
|
// mountTemplate() may have partially installed bindings before
|
|
255
|
-
// throwing
|
|
256
|
-
//
|
|
328
|
+
// throwing — and a mount-phase throw arrives with the whole scope
|
|
329
|
+
// live. Tear the partial scope down BEFORE mounting the error
|
|
330
|
+
// fallback so no hidden work survives behind it (issue 0010; the
|
|
331
|
+
// onMount phase now shares these exact semantics per T6). An
|
|
332
|
+
// unconsumed projection sweep hook is part of that partial scope.
|
|
333
|
+
this.__nisliProjectionSweep =
|
|
334
|
+
undefined;
|
|
257
335
|
if (this._templateResult?.dispose) {
|
|
258
336
|
this._templateResult.dispose();
|
|
259
337
|
}
|
|
@@ -261,6 +339,11 @@ export function component(tagName, setup,
|
|
|
261
339
|
host.dispose();
|
|
262
340
|
this._host = null;
|
|
263
341
|
this.replaceChildren();
|
|
342
|
+
// T6 — failure is a DOM fact. The attribute is the DURABLE channel:
|
|
343
|
+
// `querySelectorAll('[data-nisli-error]')` answers "which component
|
|
344
|
+
// failed" long after the fact, with no listener installed in
|
|
345
|
+
// advance. Client-runtime only — SSG failures stay build failures.
|
|
346
|
+
this.setAttribute('data-nisli-error', code);
|
|
264
347
|
if (options?.onError) {
|
|
265
348
|
try {
|
|
266
349
|
const fallback = options.onError(error, this);
|
|
@@ -283,6 +366,18 @@ export function component(tagName, setup,
|
|
|
283
366
|
else {
|
|
284
367
|
this.innerHTML = `<div style="color:red;padding:4px">Error in <${tagName}></div>`;
|
|
285
368
|
}
|
|
369
|
+
// T6 — the EVENT is the live channel: one document-level listener
|
|
370
|
+
// observes every contained failure as it happens. Dispatched LAST so
|
|
371
|
+
// listeners see the settled DOM (stamp + fallback). Bubbling is a
|
|
372
|
+
// DOM-tree walk, so CSS (display:contents transparent hosts) never
|
|
373
|
+
// affects delivery — but a component mounted into a DETACHED
|
|
374
|
+
// fragment has no path to document and the event is swallowed; the
|
|
375
|
+
// attribute above is the durable record for those (ADR 0030.2 §8).
|
|
376
|
+
this.dispatchEvent(new CustomEvent('nisli-error', {
|
|
377
|
+
bubbles: true,
|
|
378
|
+
composed: true,
|
|
379
|
+
detail: { code, tag: tagName, phase, message: error.message },
|
|
380
|
+
}));
|
|
286
381
|
}
|
|
287
382
|
});
|
|
288
383
|
}
|
|
@@ -306,6 +401,12 @@ export function component(tagName, setup,
|
|
|
306
401
|
this._teardownNow();
|
|
307
402
|
});
|
|
308
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* Atomic DOM moves preserve this component's position-independent state,
|
|
406
|
+
* so the platform-level lifecycle is a no-op. ADR 0023's deferred
|
|
407
|
+
* disconnect teardown remains the fallback for append-based moves.
|
|
408
|
+
*/
|
|
409
|
+
connectedMoveCallback() { }
|
|
309
410
|
/**
|
|
310
411
|
* Synchronously dispose the current component scope and restore any
|
|
311
412
|
* projected light-DOM children as direct host children. Normal disconnect
|
|
@@ -314,6 +415,7 @@ export function component(tagName, setup,
|
|
|
314
415
|
*/
|
|
315
416
|
_teardownNow() {
|
|
316
417
|
this._mounted = false;
|
|
418
|
+
this._setupDone = false;
|
|
317
419
|
if (this._templateResult?.dispose) {
|
|
318
420
|
this._templateResult.dispose();
|
|
319
421
|
}
|
|
@@ -354,6 +456,26 @@ export function component(tagName, setup,
|
|
|
354
456
|
* non-undefined.
|
|
355
457
|
*/
|
|
356
458
|
_setProp(key, value) {
|
|
459
|
+
// Unknown-prop echo (N202, dev, ADR 0030.2): post-mount, a DEFINED write
|
|
460
|
+
// to a key setup() never read is attribution noise — a misspelled prop
|
|
461
|
+
// (`varian=`) arriving through the factory or the template
|
|
462
|
+
// auto-resolution path (both funnel through _setProp). `undefined`
|
|
463
|
+
// writes are exempt BY CONTRACT: a factory spreading unset optional
|
|
464
|
+
// props fires _setProp(key, undefined) per the Object.entries walk (see
|
|
465
|
+
// the pinning doc above). Attribution-only — the write still lands
|
|
466
|
+
// exactly as before; deduped per key per element.
|
|
467
|
+
if (this._setupDone
|
|
468
|
+
&& value !== undefined
|
|
469
|
+
&& isDev()
|
|
470
|
+
// A declared attrs key is contract, not a typo — 'forward' especially,
|
|
471
|
+
// where CORE owns the read and setup() never touches the prop. Gate
|
|
472
|
+
// ruling on ADR 0030.2 §8 T6 Q3: declared keys are exempt.
|
|
473
|
+
&& !attrEntriesByKey.has(key)
|
|
474
|
+
&& !this._propsProxy.readKeys.has(key)
|
|
475
|
+
&& !(this._echoed ??= new Set()).has(key)) {
|
|
476
|
+
this._echoed.add(key);
|
|
477
|
+
diag('N202', `<${tagName}> prop '${key}' was set but setup() never read it — misspelled or unsupported prop?`, { tag: tagName, key });
|
|
478
|
+
}
|
|
357
479
|
if (value === undefined) {
|
|
358
480
|
this._pinned.delete(key);
|
|
359
481
|
const entry = attrEntriesByKey.get(key);
|
|
@@ -400,9 +522,28 @@ export function component(tagName, setup,
|
|
|
400
522
|
return this._pinned.has(key);
|
|
401
523
|
}
|
|
402
524
|
}
|
|
403
|
-
// Register the custom element
|
|
525
|
+
// Register the custom element. A DUPLICATE definition is a coded dev error
|
|
526
|
+
// (N201, ADR 0030.2 §3/§8): first-wins-silently rendered the WRONG component
|
|
527
|
+
// while the second factory typechecked against the wrong props. The error
|
|
528
|
+
// names both definition sites and is thrown to the SECOND definer; the
|
|
529
|
+
// first definition stays live (first-wins preserved). Exemptions:
|
|
530
|
+
// - HMR re-evaluations arrive with the registry's marked indirection thunk
|
|
531
|
+
// (hmr/registry.ts __register) — the live thunk already swapped setup, so
|
|
532
|
+
// re-registration is the mechanism working, not a collision.
|
|
533
|
+
// - Production keeps the historical SILENT first-wins: a name clash must
|
|
534
|
+
// not take down a live page (redefine-as-swap stays HMR/dev-only because
|
|
535
|
+
// the copy-in registry model makes genuine duplicate tags structural).
|
|
404
536
|
if (!customElements.get(tagName)) {
|
|
405
537
|
customElements.define(tagName, FrameworkComponent);
|
|
538
|
+
if (isDev())
|
|
539
|
+
firstDefineSites.set(tagName, captureDefineSite());
|
|
540
|
+
}
|
|
541
|
+
else if (isDev() && !setup.__nisliHmr) {
|
|
542
|
+
const first = firstDefineSites.get(tagName)
|
|
543
|
+
?? '(unknown site — defined outside component(), or before dev mode was enabled)';
|
|
544
|
+
throw new Error(formatDiag('N201', `duplicate define for <${tagName}>. First defined ${first}; the second `
|
|
545
|
+
+ `definition site is this error's own stack. The first definition stays `
|
|
546
|
+
+ `live (first-wins) — rename one of the components.`));
|
|
406
547
|
}
|
|
407
548
|
// Return the typed factory function
|
|
408
549
|
const factory = (props, hostAttrs) => {
|
package/dist/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAoC,MAAM,aAAa,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,gFAAgF;AAChF,8DAA8D;AAC9D,cAAc,CAAC,GAAG,EAAE;IAClB,IAAI,UAAU,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,mBAAmB,EAAE,CAAC;QACnC,OAAO,CAAC,QAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAsLH,MAAM,YAAY,GAAG,CAAC,CAAS,EAAU,EAAE,CACzC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAEpD,MAAM,QAAQ,GAAG,CAAC,IAAc,EAA+C,EAAE,CAC/E,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAE9C,iFAAiF;AACjF,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,IAAc,EAAU,EAAE,CAC3D,OAAO,IAAI,KAAK,QAAQ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C;IACxD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diagnostics.ts — coded diagnostics leaf + the dev-mode gate (ADR 0030.2, Wave 1)
|
|
3
|
+
*
|
|
4
|
+
* The shared foundation every core layer reports through. Two rules keep it a
|
|
5
|
+
* LEAF (ADR 0030.2 §7): zero imports from other core modules (so signal.ts,
|
|
6
|
+
* template.ts, component.ts, injector.ts can all use it without cycles), and
|
|
7
|
+
* codes + a minimal payload emitter only — no docs prose.
|
|
8
|
+
*
|
|
9
|
+
* Contract:
|
|
10
|
+
* - Every diagnostic carries a stable machine code `N<range><nn>` and renders
|
|
11
|
+
* as ONE console.error line: `[nisli CODE] message` (+ structured detail as
|
|
12
|
+
* the second console argument when given). Thrown coded errors reuse the
|
|
13
|
+
* same `[nisli CODE]` prefix via {@link formatDiag} so `grep '\[nisli '`
|
|
14
|
+
* finds every framework-reported failure, logged or thrown.
|
|
15
|
+
* - `diag()` itself is NOT dev-gated: gating is the CALL SITE's policy. Some
|
|
16
|
+
* diagnostics are production facts (T6 containment N401/N402 — parity with
|
|
17
|
+
* the pre-T6 unconditional console.error); others are dev-only attribution
|
|
18
|
+
* (N201/N202/N501) and their callers guard with {@link isDev}.
|
|
19
|
+
*
|
|
20
|
+
* The dev gate (a named Wave-1 deliverable — core had NO dev/prod mechanism):
|
|
21
|
+
* a runtime probe, layered for the three environments core must serve without
|
|
22
|
+
* a bundler assumption (ADR 0019):
|
|
23
|
+
* 1. `import.meta.env.DEV` / `.PROD` when an injector (Vite serve/build,
|
|
24
|
+
* vitest) provides them — statically replaced in Vite builds, so a prod
|
|
25
|
+
* build resolves prod even in the browser where `process` is absent.
|
|
26
|
+
* 2. `globalThis.process?.env?.NODE_ENV` — Node scripts, test runners, SSG.
|
|
27
|
+
* 3. Neither present (raw buildless ESM in a browser): DEV — loud by
|
|
28
|
+
* default, matching the framework's no-build posture; `setDevMode(false)`
|
|
29
|
+
* is the explicit opt-out for buildless production pages.
|
|
30
|
+
* The probe runs once at module load; `setDevMode()` overrides it (tests,
|
|
31
|
+
* bundler-less prod), `setDevMode(null)` restores the probed default.
|
|
32
|
+
*/
|
|
33
|
+
export declare const codes: Record<string, string>;
|
|
34
|
+
/** Whether dev-only diagnostics are active. See the module doc for the probe. */
|
|
35
|
+
export declare function isDev(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Override the probed dev mode (`true`/`false`), or restore the probed
|
|
38
|
+
* default (`null`). For tests and for buildless pages deployed to production.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setDevMode(on: boolean | null): void;
|
|
41
|
+
/** The shared `[nisli CODE] message` line, for both logged and thrown paths. */
|
|
42
|
+
export declare function formatDiag(code: string, message: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Emit one coded diagnostic: a single console.error line
|
|
45
|
+
* `[nisli CODE] message`, with `detail` attached as structured payload.
|
|
46
|
+
* NOT dev-gated here — the caller owns the policy (see module doc).
|
|
47
|
+
*/
|
|
48
|
+
export declare function diag(code: string, message: string, detail?: Record<string, unknown>): void;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diagnostics.ts — coded diagnostics leaf + the dev-mode gate (ADR 0030.2, Wave 1)
|
|
3
|
+
*
|
|
4
|
+
* The shared foundation every core layer reports through. Two rules keep it a
|
|
5
|
+
* LEAF (ADR 0030.2 §7): zero imports from other core modules (so signal.ts,
|
|
6
|
+
* template.ts, component.ts, injector.ts can all use it without cycles), and
|
|
7
|
+
* codes + a minimal payload emitter only — no docs prose.
|
|
8
|
+
*
|
|
9
|
+
* Contract:
|
|
10
|
+
* - Every diagnostic carries a stable machine code `N<range><nn>` and renders
|
|
11
|
+
* as ONE console.error line: `[nisli CODE] message` (+ structured detail as
|
|
12
|
+
* the second console argument when given). Thrown coded errors reuse the
|
|
13
|
+
* same `[nisli CODE]` prefix via {@link formatDiag} so `grep '\[nisli '`
|
|
14
|
+
* finds every framework-reported failure, logged or thrown.
|
|
15
|
+
* - `diag()` itself is NOT dev-gated: gating is the CALL SITE's policy. Some
|
|
16
|
+
* diagnostics are production facts (T6 containment N401/N402 — parity with
|
|
17
|
+
* the pre-T6 unconditional console.error); others are dev-only attribution
|
|
18
|
+
* (N201/N202/N501) and their callers guard with {@link isDev}.
|
|
19
|
+
*
|
|
20
|
+
* The dev gate (a named Wave-1 deliverable — core had NO dev/prod mechanism):
|
|
21
|
+
* a runtime probe, layered for the three environments core must serve without
|
|
22
|
+
* a bundler assumption (ADR 0019):
|
|
23
|
+
* 1. `import.meta.env.DEV` / `.PROD` when an injector (Vite serve/build,
|
|
24
|
+
* vitest) provides them — statically replaced in Vite builds, so a prod
|
|
25
|
+
* build resolves prod even in the browser where `process` is absent.
|
|
26
|
+
* 2. `globalThis.process?.env?.NODE_ENV` — Node scripts, test runners, SSG.
|
|
27
|
+
* 3. Neither present (raw buildless ESM in a browser): DEV — loud by
|
|
28
|
+
* default, matching the framework's no-build posture; `setDevMode(false)`
|
|
29
|
+
* is the explicit opt-out for buildless production pages.
|
|
30
|
+
* The probe runs once at module load; `setDevMode()` overrides it (tests,
|
|
31
|
+
* bundler-less prod), `setDevMode(null)` restores the probed default.
|
|
32
|
+
*/
|
|
33
|
+
// ── Code registry ───────────────────────────────────────────────────
|
|
34
|
+
//
|
|
35
|
+
// The minimal central code table (0030.1 B2, landed as part of T6 per §8).
|
|
36
|
+
// `Nxyz` = concrete code; `Nxxx` range keys document ownership so parallel
|
|
37
|
+
// waves allocate without collision. Ranges owned by other Wave-1 worktrees
|
|
38
|
+
// (template, reactivity, async) are seeded here as placeholders only — their
|
|
39
|
+
// concrete codes land with their waves.
|
|
40
|
+
export const codes = {
|
|
41
|
+
// Range placeholders — owner module in parentheses.
|
|
42
|
+
N1xx: 'template: parse/static-audit diagnostics (template.ts — template wave)',
|
|
43
|
+
N2xx: 'define/props: registration and prop-contract diagnostics (component.ts)',
|
|
44
|
+
N3xx: 'reactivity: scheduler/purity diagnostics (signal.ts — scheduler wave)',
|
|
45
|
+
N4xx: 'lifecycle: setup/mount containment (component.ts, lifecycle.ts)',
|
|
46
|
+
N5xx: 'dependency injection (injector.ts)',
|
|
47
|
+
N6xx: 'async: query/resource/settle diagnostics (query.ts, resource.ts — async wave)',
|
|
48
|
+
// Assigned codes.
|
|
49
|
+
N201: 'duplicate component definition — tag already defined; first definition stays live',
|
|
50
|
+
N202: 'unknown-prop echo — prop written after mount but never read by setup()',
|
|
51
|
+
N401: 'setup failed — scope contained, host stamped data-nisli-error="N401"',
|
|
52
|
+
N402: 'onMount failed — scope contained, host stamped data-nisli-error="N402"',
|
|
53
|
+
N501: 'provide() after the token was already instantiated — resetInjector() first',
|
|
54
|
+
N101: 'template audit — dash-tag never defined (misspelled or unimported component?)',
|
|
55
|
+
N102: 'template audit — unknown @event name',
|
|
56
|
+
N103: 'template audit — unknown event modifier',
|
|
57
|
+
N104: 'template audit — undeclared attribute on a component with declared attrs',
|
|
58
|
+
N105: 'template — remounting a live bound TemplateResult (shared-binding corruption)',
|
|
59
|
+
N106: 'template — html:inner requires a branded value: raw(), sanitized(), or TrustedHTML',
|
|
60
|
+
N107: 'template — html:inner sanitized() has no sink: no native Element.setHTML() and no setSanitizerFallback() hook',
|
|
61
|
+
N301: 'reactivity — effect exceeded the consecutive re-schedule cap (loop); disposed',
|
|
62
|
+
N302: 'reactivity — effect wrote a signal in its own dependency set (attribution)',
|
|
63
|
+
N303: 'reactivity — flush()/tick() iteration cap reached before quiescence',
|
|
64
|
+
N310: 'reactivity — effect callback returned a Promise; use resource() for async',
|
|
65
|
+
N602: 'query — invalid key element (flat primitives only; null is the optional sentinel)',
|
|
66
|
+
N603: 'settle() — no quiescence within the iteration cap; returning anyway',
|
|
67
|
+
// N601 (mixed QueryClients) was retired before release: N501 makes that
|
|
68
|
+
// state unrepresentable at its cause. The number is not reused.
|
|
69
|
+
};
|
|
70
|
+
// ── Dev gate ────────────────────────────────────────────────────────
|
|
71
|
+
function probeDevMode() {
|
|
72
|
+
// 1) import.meta.env injectors (Vite, vitest). Read the OBJECT (not the
|
|
73
|
+
// dotted key) so Vite's define replacement works through the optional
|
|
74
|
+
// access, and a missing env is just `undefined` in Node/raw ESM.
|
|
75
|
+
const env = import.meta.env;
|
|
76
|
+
if (env && typeof env.DEV === 'boolean')
|
|
77
|
+
return env.DEV;
|
|
78
|
+
if (env && typeof env.PROD === 'boolean')
|
|
79
|
+
return !env.PROD;
|
|
80
|
+
// 2) Node / test runners / bundlers that define process.env.NODE_ENV.
|
|
81
|
+
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
82
|
+
if (typeof nodeEnv === 'string')
|
|
83
|
+
return nodeEnv !== 'production';
|
|
84
|
+
// 3) No signal at all (raw buildless ESM): loud by default.
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
const probed = probeDevMode();
|
|
88
|
+
let override = null;
|
|
89
|
+
/** Whether dev-only diagnostics are active. See the module doc for the probe. */
|
|
90
|
+
export function isDev() {
|
|
91
|
+
return override ?? probed;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Override the probed dev mode (`true`/`false`), or restore the probed
|
|
95
|
+
* default (`null`). For tests and for buildless pages deployed to production.
|
|
96
|
+
*/
|
|
97
|
+
export function setDevMode(on) {
|
|
98
|
+
override = on;
|
|
99
|
+
}
|
|
100
|
+
// ── Emission ────────────────────────────────────────────────────────
|
|
101
|
+
/** The shared `[nisli CODE] message` line, for both logged and thrown paths. */
|
|
102
|
+
export function formatDiag(code, message) {
|
|
103
|
+
return `[nisli ${code}] ${message}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Emit one coded diagnostic: a single console.error line
|
|
107
|
+
* `[nisli CODE] message`, with `detail` attached as structured payload.
|
|
108
|
+
* NOT dev-gated here — the caller owns the policy (see module doc).
|
|
109
|
+
*/
|
|
110
|
+
export function diag(code, message, detail) {
|
|
111
|
+
if (detail === undefined) {
|
|
112
|
+
console.error(formatDiag(code, message));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
console.error(formatDiag(code, message), detail);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,uEAAuE;AACvE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,wCAAwC;AACxC,MAAM,CAAC,MAAM,KAAK,GAA2B;IAC3C,oDAAoD;IACpD,IAAI,EAAE,wEAAwE;IAC9E,IAAI,EAAE,yEAAyE;IAC/E,IAAI,EAAE,uEAAuE;IAC7E,IAAI,EAAE,iEAAiE;IACvE,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,+EAA+E;IACrF,kBAAkB;IAClB,IAAI,EAAE,mFAAmF;IACzF,IAAI,EAAE,wEAAwE;IAC9E,IAAI,EAAE,sEAAsE;IAC5E,IAAI,EAAE,wEAAwE;IAC9E,IAAI,EAAE,4EAA4E;IAClF,IAAI,EAAE,+EAA+E;IACrF,IAAI,EAAE,sCAAsC;IAC5C,IAAI,EAAE,yCAAyC;IAC/C,IAAI,EAAE,0EAA0E;IAChF,IAAI,EAAE,+EAA+E;IACrF,IAAI,EAAE,oFAAoF;IAC1F,IAAI,EAAE,+GAA+G;IACrH,IAAI,EAAE,+EAA+E;IACrF,IAAI,EAAE,4EAA4E;IAClF,IAAI,EAAE,qEAAqE;IAC3E,IAAI,EAAE,2EAA2E;IACjF,IAAI,EAAE,mFAAmF;IACzF,IAAI,EAAE,qEAAqE;IAC3E,wEAAwE;IACxE,gEAAgE;CACjE,CAAC;AAEF,uEAAuE;AAEvE,SAAS,YAAY;IACnB,wEAAwE;IACxE,sEAAsE;IACtE,iEAAiE;IACjE,MAAM,GAAG,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disposal surface that exposes ERM when the consumer's lib supports it. */
|
|
2
|
+
type DisposeSymbol = typeof Symbol extends {
|
|
3
|
+
readonly dispose: infer Key extends symbol;
|
|
4
|
+
} ? Key : never;
|
|
5
|
+
export type DisposableResource = {
|
|
6
|
+
[Key in DisposeSymbol]: () => void;
|
|
7
|
+
};
|
|
8
|
+
/** Callable disposer returned by effects, subscriptions, and emitter handles. */
|
|
9
|
+
export interface Disposer extends DisposableResource {
|
|
10
|
+
(): void;
|
|
11
|
+
}
|
|
12
|
+
/** Attach a guarded Symbol.dispose alias without polyfilling the platform. */
|
|
13
|
+
export declare function disposable<T extends object>(value: T, dispose: () => void): T & DisposableResource;
|
|
14
|
+
export {};
|