@solidjs/web 2.0.0-rc.14 → 2.0.0-rc.15

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.
@@ -1,6 +1,6 @@
1
- import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId, untrack, NotReadyError } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
- import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
1
+ import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
+ import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
4
4
  export { ssrScope as scope, sharedConfig } from 'solid-js/internal';
5
5
  import { createStream, Serializer, getCrossReferenceHeader, Feature } from 'seroval';
6
6
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
@@ -34,6 +34,7 @@ const DOMWithState = {
34
34
  }
35
35
  };
36
36
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
37
+ const LinkAttributes = /*#__PURE__*/new Set(["href", "target", "rel", "download", "link", "aria-current"]);
37
38
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
38
39
  const SVGElements = /*#__PURE__*/new Set([
39
40
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
@@ -457,9 +458,7 @@ function toBorderForm(value, envelopeContainers) {
457
458
  }
458
459
  function isShareableIterable(value) {
459
460
  try {
460
- if (value.__SEROVAL_STREAM__ === true) return false;
461
- if (typeof ReadableStream !== "undefined" && value instanceof ReadableStream) return false;
462
- return typeof value[Symbol.asyncIterator] === "function";
461
+ return typeof value[Symbol.asyncIterator] === "function" && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
463
462
  } catch {
464
463
  return false;
465
464
  }
@@ -564,17 +563,24 @@ function getLocalHeaderScript(id) {
564
563
  }
565
564
 
566
565
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
567
- // PURE-annotated factory (same convention as solid's MockPromise): the brand
568
- const ResponseEnvelope = /* @__PURE__ */(() => {
569
- class ResponseEnvelope {
570
- constructor(response, value) {
571
- this.response = response;
572
- this.value = value;
573
- }
566
+ let EnvelopeClass;
567
+ const ResponseEnvelope = function ResponseEnvelope(response, value) {
568
+ if (!EnvelopeClass) {
569
+ EnvelopeClass = class extends Response {
570
+ constructor(response, value) {
571
+ super(response ? response.body : null, response && {
572
+ status: response.status,
573
+ statusText: response.statusText,
574
+ headers: copyHeaders(response.headers)
575
+ });
576
+ this.response = response ? this : undefined;
577
+ this.value = value;
578
+ }
579
+ };
580
+ EnvelopeClass.prototype[ENVELOPE] = true;
574
581
  }
575
- ResponseEnvelope.prototype[ENVELOPE] = true;
576
- return ResponseEnvelope;
577
- })();
582
+ return new EnvelopeClass(response, value);
583
+ };
578
584
  function isResponseEnvelope(value) {
579
585
  return !!(value && typeof value === "object" && value[ENVELOPE]);
580
586
  }
@@ -599,6 +605,16 @@ function isSafeError(value) {
599
605
  const REVALIDATE_HEADER = "X-Revalidate";
600
606
  const REVALIDATE_ALL = "*";
601
607
  const RESPONSE_HEADER_VALUE_LIMIT = 4096;
608
+ function copyHeaders(init) {
609
+ const source = init;
610
+ if (!source || !source.getSetCookie) return new Headers(init);
611
+ const headers = new Headers();
612
+ source.forEach((value, key) => {
613
+ if (key !== "set-cookie") headers.append(key, value);
614
+ });
615
+ for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
616
+ return headers;
617
+ }
602
618
  function initWithRevalidate(init = {}) {
603
619
  const resolved = typeof init === "number" ? {
604
620
  status: init
@@ -607,18 +623,7 @@ function initWithRevalidate(init = {}) {
607
623
  revalidate,
608
624
  ...responseInit
609
625
  } = resolved;
610
- let headers;
611
- if (responseInit.headers && responseInit.headers.getSetCookie) {
612
- headers = new Headers();
613
- responseInit.headers.forEach((value, key) => {
614
- if (key !== "set-cookie") headers.append(key, value);
615
- });
616
- for (const cookie of responseInit.headers.getSetCookie()) {
617
- headers.append("Set-Cookie", cookie);
618
- }
619
- } else {
620
- headers = new Headers(responseInit.headers);
621
- }
626
+ const headers = copyHeaders(responseInit.headers);
622
627
  if (revalidate !== undefined) {
623
628
  const list = Array.isArray(revalidate) ? revalidate : [revalidate];
624
629
  if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
@@ -807,6 +812,10 @@ function qualifierValue(name, value) {
807
812
  function asciiLowerCase(value) {
808
813
  return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
809
814
  }
815
+ const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
816
+ function headBodyText(tag, props, text) {
817
+ return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
818
+ }
810
819
  function resourceIdentity(tag, props) {
811
820
  const url = String(props.href || props.src || "");
812
821
  let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
@@ -1391,6 +1400,7 @@ function renderShellHead(registry, nonce, isPendingFragment, noScripts, traceMet
1391
1400
  noScripts
1392
1401
  };
1393
1402
  }
1403
+ let headBodyHook;
1394
1404
  function flushHeadFragment(registry, boundary, nonce) {
1395
1405
  const groups = commitHeadBoundary(registry, boundary);
1396
1406
  if (!groups.length) return null;
@@ -1428,7 +1438,7 @@ function flushHeadFragment(registry, boundary, nonce) {
1428
1438
  if (value) attrs.nonce = String(value);
1429
1439
  }
1430
1440
  const children = t.props.children;
1431
- ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
1441
+ ops.push(["a", identity, t.tag, attrs, children == null ? null : headBodyHook ? headBodyHook(t.tag, t.props, String(children)) : String(children)]);
1432
1442
  }
1433
1443
  }
1434
1444
  return ops.length ? ops : null;
@@ -1456,8 +1466,7 @@ function normalizeNonce(nonce) {
1456
1466
  }
1457
1467
  function destinationNonce(nonce, destination) {
1458
1468
  if (nonce == null) return undefined;
1459
- if (typeof nonce === "string") return nonce || undefined;
1460
- const value = nonce[destination];
1469
+ const value = typeof nonce === "string" ? nonce : nonce[destination];
1461
1470
  return typeof value === "string" && value ? value : undefined;
1462
1471
  }
1463
1472
  function scriptNonce(nonce) {
@@ -1531,6 +1540,7 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
1531
1540
  if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
1532
1541
  if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
1533
1542
  let body = props.children == null ? "" : String(props.children);
1543
+ if (headBodyHook) body = headBodyHook(tag, props, body);
1534
1544
  if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
1535
1545
  return `<${tag}${attrs}>${body}</${tag}>`;
1536
1546
  }
@@ -1539,6 +1549,7 @@ function useHead(tags) {
1539
1549
  if (!ctx || !ctx.registerHeadTags) {
1540
1550
  return;
1541
1551
  }
1552
+ headBodyHook = headBodyText;
1542
1553
  ctx.registerHeadTags(tags);
1543
1554
  }
1544
1555
  const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
@@ -1549,12 +1560,27 @@ function tagInfo(tag) {
1549
1560
  let info = tagInfos.get(tag);
1550
1561
  if (info === undefined) {
1551
1562
  if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
1563
+ let formDefaults, formAttributes;
1564
+ if (tag === "input" || tag === "option") {
1565
+ formDefaults = Object.create(null);
1566
+ formAttributes = Object.create(null);
1567
+ const state = DOMWithState[tag.toUpperCase()];
1568
+ for (const prop in state) {
1569
+ if (state[prop] === 2) {
1570
+ const attr = prop.slice(7).toLowerCase();
1571
+ formDefaults[attr] = prop;
1572
+ formAttributes[prop] = attr;
1573
+ }
1574
+ }
1575
+ }
1552
1576
  info = {
1553
1577
  open: "<" + tag,
1554
1578
  close: "</" + tag + ">",
1555
1579
  isVoid: VOID_ELEMENTS.test(tag),
1556
1580
  textarea: tag === "textarea",
1557
- raw: tag === "script" || tag === "style"
1581
+ raw: tag === "script" || tag === "style",
1582
+ formDefaults,
1583
+ formAttributes
1558
1584
  };
1559
1585
  if (tagInfos.size < 512) tagInfos.set(tag, info);
1560
1586
  }
@@ -1653,7 +1679,7 @@ function renderToString(code, options = {}) {
1653
1679
  closed = true;
1654
1680
  serializer.close();
1655
1681
  const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
1656
- const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
1682
+ const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead) + shellEndMarker(context, renderId, nonce, noScripts);
1657
1683
  if (render) render.shell();
1658
1684
  if (requestEvent && requestEvent.response) {
1659
1685
  commitResponseStub(requestEvent.response, {
@@ -1915,7 +1941,7 @@ function renderToStream(code, options = {}) {
1915
1941
  }
1916
1942
  },
1917
1943
  shell(shellHtml, meta) {
1918
- buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
1944
+ buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead) + shellEndMarker(context, renderId, nonce, noScripts));
1919
1945
  },
1920
1946
  ...options.sink
1921
1947
  };
@@ -2567,11 +2593,15 @@ function renderToStream(code, options = {}) {
2567
2593
  };
2568
2594
  }
2569
2595
  function HydrationScript(props) {
2570
- const nonce = scriptNonce(sharedConfig.context && sharedConfig.context.nonce);
2571
- return ssr(generateHydrationScript({
2572
- nonce,
2596
+ if (sharedConfig.context) sharedConfig.context.bootstrap = true;
2597
+ const {
2598
+ eventNames,
2599
+ nonce
2600
+ } = {
2601
+ nonce: sharedConfig.context && sharedConfig.context.nonce,
2573
2602
  ...props
2574
- }));
2603
+ };
2604
+ return ssr(hydrationBootstrap(eventNames, scriptNonce(nonce), true));
2575
2605
  }
2576
2606
  function ssrGroup(fn, n) {
2577
2607
  fn.$g = n;
@@ -2727,7 +2757,7 @@ function createLiveHoles(sink, scoped) {
2727
2757
  let nextId = 0;
2728
2758
  const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
2729
2759
  const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
2730
- const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
2760
+ const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"/g, "");
2731
2761
  const swept = (owner, ctx, fn) => {
2732
2762
  const prev = sharedConfig.context;
2733
2763
  sharedConfig.context = ctx;
@@ -3281,6 +3311,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3281
3311
  let ownerIndex = null;
3282
3312
  const ctx = renderConfig.context;
3283
3313
  const slots = ctx !== undefined && ctx.claims !== undefined;
3314
+ const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
3284
3315
  if (Array.isArray(props)) {
3285
3316
  if (slots && props.$slot === true) props = slotSpreadSource();else {
3286
3317
  let i = 0;
@@ -3321,7 +3352,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3321
3352
  const keys = owners !== null ? viewKeys : keysOf !== null ? keysOf[s] : proxy ? Reflect.ownKeys(props) : Object.keys(props);
3322
3353
  if (sources !== null) props = sources[s];
3323
3354
  nextKey: for (let i = 0; i < keys.length; i++) {
3324
- const prop = keys[i];
3355
+ let prop = keys[i];
3325
3356
  if (typeof prop !== "string" || skip !== undefined && skip(prop)) continue;
3326
3357
  if (owners !== null) props = owners[i];
3327
3358
  for (let j = s + 1; j <= last; j++) {
@@ -3338,7 +3369,12 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3338
3369
  }
3339
3370
  continue;
3340
3371
  }
3341
- const value = props[prop];
3372
+ const key = prop;
3373
+ if (info.formAttributes !== undefined) {
3374
+ prop = spreadFormAttribute(prop, info, keys, keysOf, skip);
3375
+ if (prop === undefined) continue;
3376
+ }
3377
+ const value = props[key];
3342
3378
  if (value == undefined) {
3343
3379
  if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
3344
3380
  continue;
@@ -3350,6 +3386,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3350
3386
  if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
3351
3387
  continue;
3352
3388
  }
3389
+ if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
3353
3390
  if (slots && typeof value === "object") {
3354
3391
  result += spreadObjectAttribute(prop, value);
3355
3392
  } else if (prop === "style") {
@@ -3365,6 +3402,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3365
3402
  }
3366
3403
  if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
3367
3404
  if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
3405
+ if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
3368
3406
  if (skipChildren) return {
3369
3407
  t: result + " />"
3370
3408
  };
@@ -3382,6 +3420,19 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
3382
3420
  };
3383
3421
  return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
3384
3422
  }
3423
+ function spreadFormAttribute(prop, info, keys, keysOf, skip) {
3424
+ const defaultProp = info.formDefaults[prop];
3425
+ if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
3426
+ if (keysOf !== null) {
3427
+ for (let j = 0; j < keysOf.length; j++) {
3428
+ if (keysOf[j].includes(defaultProp)) return;
3429
+ }
3430
+ } else if (keys.includes(defaultProp)) return;
3431
+ }
3432
+ const attr = info.formAttributes[prop];
3433
+ if (attr !== undefined && skip !== undefined && skip(attr)) return;
3434
+ return attr === undefined ? prop : attr;
3435
+ }
3385
3436
  function ssrElementAttribute(key, value) {
3386
3437
  if (value == undefined) return "";
3387
3438
  if (key === "style" || key === "class") {
@@ -3630,6 +3681,11 @@ function claimEntries(pos, value, mode) {
3630
3681
  }
3631
3682
  return "";
3632
3683
  }
3684
+ function ssrLinkClaim(attrs) {
3685
+ const ctx = renderConfig.context;
3686
+ if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
3687
+ return ctx.linkClaim(attrs);
3688
+ }
3633
3689
  function decodeSSREntities(s) {
3634
3690
  return s.indexOf("&") < 0 ? s : s.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&amp;/g, "&");
3635
3691
  }
@@ -3855,10 +3911,13 @@ function applyRef(r, element) {
3855
3911
  Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
3856
3912
  }
3857
3913
  function generateHydrationScript({
3858
- eventNames = ["click", "input"],
3914
+ eventNames,
3859
3915
  nonce
3860
3916
  } = {}) {
3861
- return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),fe(){}});</script><!--xs-->`;
3917
+ return hydrationBootstrap(eventNames, scriptNonce(nonce), false);
3918
+ }
3919
+ function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
3920
+ return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),${ledger ? "s:{}," : ""}fe(){}});</script><!--xs-->`;
3862
3921
  }
3863
3922
  function queue(fn) {
3864
3923
  return Promise.resolve().then(fn);
@@ -3871,6 +3930,11 @@ function allSettled(promises) {
3871
3930
  return size;
3872
3931
  });
3873
3932
  }
3933
+ function shellEndMarker(context, renderId, nonce, noScripts) {
3934
+ if (noScripts || !context || !context.bootstrap) return "";
3935
+ const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
3936
+ return `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
3937
+ }
3874
3938
  function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
3875
3939
  const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
3876
3940
  const title = headTags ? headTags.title : null;
@@ -4223,13 +4287,30 @@ function createHydrationWriter(context, isOpen) {
4223
4287
  };
4224
4288
  }
4225
4289
  function getHydrationWriter() {
4290
+ const ctx = currentRenderContext();
4291
+ return ctx && ctx.writer;
4292
+ }
4293
+ function currentRenderContext() {
4226
4294
  let ctx = renderContextOf(getOwner());
4227
4295
  if (!ctx) {
4228
4296
  const event = peekRequestEvent();
4229
4297
  const renders = event && eventRenders.get(event);
4230
4298
  if (renders && renders.size === 1) for (const c of renders) ctx = c;
4231
4299
  }
4232
- return ctx && ctx.writer;
4300
+ return ctx;
4301
+ }
4302
+ const LINK_STATE_RECORD = "links";
4303
+ function setLinkClaim(handler) {
4304
+ const ctx = currentRenderContext();
4305
+ if (!ctx) {
4306
+ return false;
4307
+ }
4308
+ ctx.linkClaim = handler;
4309
+ if (handler !== undefined) ctx.writer.write(LINK_STATE_RECORD, 1);
4310
+ return true;
4311
+ }
4312
+ function hasServerLinkState() {
4313
+ return false;
4233
4314
  }
4234
4315
  function takeHydrationValue(_key) {
4235
4316
  return undefined;
@@ -4550,86 +4631,10 @@ setContainerTraceResolver(getProjectionTrace);
4550
4631
  setAsyncIterableSharer(shareAsyncIterable);
4551
4632
  const isServer = true;
4552
4633
  const isDev = false;
4634
+ const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
4553
4635
  function dynamic(source, options) {
4554
4636
  return dynamicCore(source, options, ssrTag);
4555
4637
  }
4556
- function dynamicComponent(source, options) {
4557
- return dynamicCore(source, options);
4558
- }
4559
- const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
4560
- function dynamicCore(source, options, tagArm) {
4561
- if (options?.static) {
4562
- const component = untrack(source);
4563
- if (typeof component === "function") return props => component(props);
4564
- if (typeof component === "string" && tagArm) return props => tagArm(component, props);
4565
- return () => undefined;
4566
- }
4567
- const cached = createMemo(() => {
4568
- const next = source();
4569
- if (!next || typeof next.then !== "function") return next;
4570
- return {
4571
- [FLIGHT]: next
4572
- };
4573
- });
4574
- const deferStream = !!options?.deferStream;
4575
- return props => {
4576
- const ctx = sharedConfig.context;
4577
- let gated = !deferStream || !ctx?.async;
4578
- const value = createMemo(() => {
4579
- let c;
4580
- try {
4581
- c = cached();
4582
- } catch (err) {
4583
- if (!gated && err instanceof NotReadyError && !err.source?.$clientHole) {
4584
- gated = true;
4585
- ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
4586
- }
4587
- throw err;
4588
- }
4589
- if (!c || !c[FLIGHT]) return c;
4590
- const next = c[FLIGHT];
4591
- return {
4592
- then: (onFulfilled, onRejected) => next.then(resolved => {
4593
- let landed;
4594
- try {
4595
- landed = classifyLanding(resolved);
4596
- } catch (err) {
4597
- if (onRejected) return onRejected(err);
4598
- throw err;
4599
- }
4600
- return onFulfilled ? onFulfilled(landed) : landed;
4601
- }, onRejected)
4602
- };
4603
- }, {
4604
- deferStream
4605
- });
4606
- return createMemo(() => {
4607
- const c = value();
4608
- if (c) {
4609
- if (typeof c === "function") return c(props);
4610
- if (typeof c === "string" && tagArm) return tagArm(c, props);
4611
- }
4612
- }, {
4613
- sync: true
4614
- });
4615
- };
4616
- }
4617
- const FLIGHT = Symbol("solid.dynamic-flight");
4618
- const SERVER_COMPONENT = Symbol.for("solid.server-component");
4619
- function classifyLanding(resolved) {
4620
- if (typeof resolved !== "function" || SERVER_COMPONENT in resolved) return resolved;
4621
- const message = "[DYNAMIC_ASYNC_COMPONENT] An async dynamic() source resolved to a client component function";
4622
- recordFinding({
4623
- code: "DYNAMIC_ASYNC_COMPONENT",
4624
- kind: "ssr",
4625
- severity: "error",
4626
- message,
4627
- data: {
4628
- component: resolved.name || undefined
4629
- }
4630
- }, null);
4631
- throw new Error(message);
4632
- }
4633
4638
  function Dynamic(props) {
4634
4639
  const Comp = dynamic(() => props.component);
4635
4640
  return createComponent(Comp, omit(props, "component"));
@@ -4758,4 +4763,4 @@ function httpHeader(name, value, options) {
4758
4763
  }
4759
4764
  }
4760
4765
 
4761
- export { CLAIMS_DOCUMENT, CLAIMS_STREAM, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, dynamicComponent, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, isSlotValue, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, slotValue, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
4766
+ export { CLAIMS_DOCUMENT, CLAIMS_STREAM, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, isSlotValue, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, slotValue, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };