@webjsdev/server 0.8.54 → 0.8.55
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/package.json +1 -1
- package/src/component-elision.js +21 -20
package/package.json
CHANGED
package/src/component-elision.js
CHANGED
|
@@ -118,16 +118,14 @@ export const CLIENT_LIFECYCLE_HOOKS = [
|
|
|
118
118
|
];
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* Method calls that only make sense on the client. `addController`
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* which need the client slot runtime to apply. Any of these implies the
|
|
126
|
-
* component is not inert.
|
|
121
|
+
* Method calls that only make sense on the client. `addController` registers a
|
|
122
|
+
* ReactiveController (client lifecycle); `requestUpdate` schedules a re-render.
|
|
123
|
+
* Any of these implies the component is not inert. (The dynamic slot read
|
|
124
|
+
* surface lives in `SLOT_DYNAMIC_RE`, not here.)
|
|
127
125
|
*
|
|
128
126
|
* @type {readonly string[]}
|
|
129
127
|
*/
|
|
130
|
-
export const CLIENT_METHOD_CALLS = ['addController', 'removeController', 'requestUpdate'
|
|
128
|
+
export const CLIENT_METHOD_CALLS = ['addController', 'removeController', 'requestUpdate'];
|
|
131
129
|
|
|
132
130
|
/**
|
|
133
131
|
* Static class fields whose declaration (to a non-`false` value) marks a
|
|
@@ -215,17 +213,21 @@ const EVENT_BINDING_RE = new RegExp(
|
|
|
215
213
|
const EVENT_PROP_RE = /\.on[a-z]+\s*=\s*\$\{/;
|
|
216
214
|
|
|
217
215
|
/**
|
|
218
|
-
* Narrow dynamic-slot signals (#1015
|
|
219
|
-
*
|
|
220
|
-
* SSR output already carries the placed children,
|
|
221
|
-
* wrapper is byte-identical with or without its JS
|
|
222
|
-
* genuinely needs the client slot runtime is the
|
|
223
|
-
* `slotchange` listener
|
|
224
|
-
*
|
|
225
|
-
* (
|
|
226
|
-
*
|
|
216
|
+
* Narrow dynamic-slot signals (#1015, retained under #1021's native-parity
|
|
217
|
+
* record model). The old blanket rule shipped ANY component that merely
|
|
218
|
+
* RENDERS a `<slot>`, but the SSR output already carries the placed children,
|
|
219
|
+
* so a display-only slotted wrapper is byte-identical with or without its JS
|
|
220
|
+
* and is elidable. What genuinely needs the client slot runtime is the
|
|
221
|
+
* DYNAMIC READ surface: a `slotchange` listener or an `assignedNodes` /
|
|
222
|
+
* `assignedElements` / `assignedSlot` read. Native WRITE liveness
|
|
223
|
+
* (appendChild, slot= flips) is consumer-driven and usually forces the ship
|
|
224
|
+
* through the consumer's own signals (a shipping component that renders the
|
|
225
|
+
* tag, or an observation form); the remaining carve-out, a shipped script
|
|
226
|
+
* reaching an elided host only via document.querySelector, is inert by
|
|
227
|
+
* design with the `static interactive = true` escape hatch (see the
|
|
228
|
+
* slot.js banner).
|
|
227
229
|
*/
|
|
228
|
-
const SLOT_DYNAMIC_RE = /\bslotchange\b|\bassignedNodes\s*\(|\bassignedElements\s*\(|\bassignedSlot\b
|
|
230
|
+
const SLOT_DYNAMIC_RE = /\bslotchange\b|\bassignedNodes\s*\(|\bassignedElements\s*\(|\bassignedSlot\b/;
|
|
229
231
|
|
|
230
232
|
/** A `.server.{js,ts,mjs,mts}` file: a stub on the client, inert there. */
|
|
231
233
|
const SERVER_FILE_RE = /\.server\.m?[jt]s$/;
|
|
@@ -544,10 +546,9 @@ export function analyzeComponentSource(src) {
|
|
|
544
546
|
// ships: the SSR output carries the placed children, and with no
|
|
545
547
|
// observers in the runtime a display-only slotted wrapper is
|
|
546
548
|
// byte-identical with or without its JS. Only the dynamic slot surface
|
|
547
|
-
// (slotchange, the assigned* reads
|
|
548
|
-
// hasSlot) needs the client runtime.
|
|
549
|
+
// (slotchange, the assigned* reads) needs the client runtime.
|
|
549
550
|
if (SLOT_DYNAMIC_RE.test(src)) {
|
|
550
|
-
return { interactive: true, reason: '
|
|
551
|
+
return { interactive: true, reason: 'reads the dynamic slot surface (slotchange / assignedNodes / assignedElements / assignedSlot)' };
|
|
551
552
|
}
|
|
552
553
|
|
|
553
554
|
// Top-level client work the render/lifecycle checks would miss: a
|