@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.2

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/dev.cjs +40 -11
  3. package/dist/dev.js +39 -12
  4. package/dist/server.cjs +419 -69
  5. package/dist/server.js +411 -73
  6. package/dist/web.cjs +37 -11
  7. package/dist/web.js +36 -12
  8. package/frames/dist/client.cjs +94 -8
  9. package/frames/dist/client.dev.cjs +97 -8
  10. package/frames/dist/client.dev.js +98 -9
  11. package/frames/dist/client.js +95 -9
  12. package/frames/dist/server.cjs +266 -56
  13. package/frames/dist/server.js +267 -57
  14. package/package.json +4 -3
  15. package/serialization/dist/decode.cjs +32 -3
  16. package/serialization/dist/decode.js +33 -4
  17. package/serialization/dist/serialization.cjs +32 -3
  18. package/serialization/dist/serialization.js +33 -4
  19. package/server-functions/dist/client.cjs +196 -8
  20. package/server-functions/dist/client.js +195 -9
  21. package/server-functions/dist/server.cjs +201 -36
  22. package/server-functions/dist/server.dev.cjs +201 -36
  23. package/server-functions/dist/server.dev.js +199 -37
  24. package/server-functions/dist/server.js +199 -37
  25. package/types/core.d.ts +3 -0
  26. package/types/frames/frame-client.d.ts +18 -0
  27. package/types/index.d.ts +16 -2
  28. package/types/jsx.d.ts +9 -0
  29. package/types/server-functions/client.d.ts +61 -0
  30. package/types/server-functions/server.d.ts +94 -1
  31. package/types/server-mock.d.ts +11 -2
  32. package/types/server.d.ts +23 -2
  33. package/types-cjs/core.d.cts +3 -0
  34. package/types-cjs/frames/frame-client.d.cts +18 -0
  35. package/types-cjs/index.d.cts +16 -2
  36. package/types-cjs/jsx.d.cts +9 -0
  37. package/types-cjs/server-functions/client.d.cts +61 -0
  38. package/types-cjs/server-functions/server.d.cts +94 -1
  39. package/types-cjs/server-mock.d.cts +11 -2
  40. package/types-cjs/server.d.cts +23 -2
package/dist/server.cjs CHANGED
@@ -72,6 +72,9 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
72
72
  function setContainerTraceResolver(fn) {
73
73
  state.resolveTrace = fn;
74
74
  }
75
+ function setContainerTraceStreamMint(fn) {
76
+ state.streamOf = fn;
77
+ }
75
78
  const TRACE = Symbol.for("dom-expressions.container-trace");
76
79
  function materialize(marker) {
77
80
  let value = state.materialized.get(marker.$tr);
@@ -84,9 +87,10 @@ function materialize(marker) {
84
87
  }
85
88
  function parseTrace(value, ctx) {
86
89
  const trace = value[TRACE];
90
+ const sub = trace.subscribe();
87
91
  return {
88
92
  a: trace.array ? 1 : 0,
89
- i: ctx.parse(trace.subscribe())
93
+ i: ctx.parse(state.streamOf ? state.streamOf(sub) : sub)
90
94
  };
91
95
  }
92
96
  const ContainerTracePlugin = {
@@ -100,9 +104,10 @@ const ContainerTracePlugin = {
100
104
  },
101
105
  async async(value, ctx) {
102
106
  const trace = value[TRACE];
107
+ const sub = trace.subscribe();
103
108
  return {
104
109
  a: trace.array ? 1 : 0,
105
- i: await ctx.parse(trace.subscribe())
110
+ i: await ctx.parse(state.streamOf ? state.streamOf(sub) : sub)
106
111
  };
107
112
  },
108
113
  stream: parseTrace
@@ -120,6 +125,18 @@ const ContainerTracePlugin = {
120
125
  }
121
126
  };
122
127
 
128
+ setContainerTraceStreamMint(iterable => {
129
+ const stream = seroval.createStream();
130
+ (async () => {
131
+ try {
132
+ for await (const value of iterable) stream.next(value);
133
+ stream.return(undefined);
134
+ } catch (error) {
135
+ stream.throw(error);
136
+ }
137
+ })();
138
+ return stream;
139
+ });
123
140
  const DEFAULT_WEB_PLUGINS = Object.freeze([web.AbortSignalPlugin,
124
141
  web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
125
142
  web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin,
@@ -442,6 +459,7 @@ function registerEntryAssets(manifest) {
442
459
  const assets = resolveAssets(key, manifest);
443
460
  if (assets) {
444
461
  for (let i = 0; i < assets.css.length; i++) ctx.registerAsset("style", assets.css[i]);
462
+ for (let i = 1; i < assets.js.length; i++) ctx.registerAsset("module", assets.js[i]);
445
463
  }
446
464
  return;
447
465
  }
@@ -701,7 +719,7 @@ function emitHeadResource(registry, context, tracking, emitResource, nonce, desc
701
719
  if (!styles) tracking.boundaryStyles.set(tracking.currentBoundaryId, styles = new Set());
702
720
  styles.add(entry);
703
721
  }
704
- const markup = `<link${attrHtml}>`;
722
+ const markup = `<link${attrHtml}${nonceAttr(nonce, "style")}>`;
705
723
  if (emitResource) emitResource(markup, entry);else {
706
724
  registry.eagerHtml += markup;
707
725
  entry.emitted = true;
@@ -799,7 +817,7 @@ function headGroupSignature(winner) {
799
817
  }
800
818
  return sig;
801
819
  }
802
- function renderShellHead(registry, nonce, isPendingFragment) {
820
+ function renderShellHead(registry, nonce, isPendingFragment, noScripts) {
803
821
  commitHeadBoundary(registry, "", isPendingFragment);
804
822
  registry.shellFlushed = true;
805
823
  const winners = resolveHead(registry.committed);
@@ -809,8 +827,14 @@ function renderShellHead(registry, nonce, isPendingFragment) {
809
827
  let metas = "";
810
828
  let others = "";
811
829
  let scripts = "";
830
+ let title = null;
812
831
  for (const [identity, winner] of winners) {
813
832
  registry.flushed.set(identity, headGroupSignature(winner));
833
+ if (identity === "title") {
834
+ const children = winner.tags[0].props.children;
835
+ title = children == null ? "" : String(children);
836
+ continue;
837
+ }
814
838
  for (let i = 0; i < winner.tags.length; i++) {
815
839
  const t = winner.tags[i];
816
840
  const markup = renderHeadTagMarkup(t.tag, t.props, identity, nonce);
@@ -819,10 +843,12 @@ function renderShellHead(registry, nonce, isPendingFragment) {
819
843
  }
820
844
  return {
821
845
  prelude,
822
- html: registry.eagerHtml + links + metas + others + scripts
846
+ html: registry.eagerHtml + links + metas + others + scripts,
847
+ title,
848
+ noScripts
823
849
  };
824
850
  }
825
- function flushHeadFragment(registry, boundary) {
851
+ function flushHeadFragment(registry, boundary, nonce) {
826
852
  const groups = commitHeadBoundary(registry, boundary);
827
853
  if (!groups.length) return null;
828
854
  const winners = resolveHead(registry.committed);
@@ -853,12 +879,87 @@ function flushHeadFragment(registry, boundary) {
853
879
  if (v == null || v === false) continue;
854
880
  attrs[name] = v === true ? "" : String(v);
855
881
  }
882
+ if (nonce && !hasNonceProp(t.props)) {
883
+ const destination = nonceDestination(t.tag, t.props);
884
+ const value = destination && nonce[destination];
885
+ if (value) attrs.nonce = String(value);
886
+ }
856
887
  const children = t.props.children;
857
888
  ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
858
889
  }
859
890
  }
860
891
  return ops.length ? ops : null;
861
892
  }
893
+ function normalizeNonce(nonce) {
894
+ if (nonce == null) return undefined;
895
+ if (typeof nonce === "string") {
896
+ const attr = nonce ? ` nonce="${escape(nonce, true)}"` : "";
897
+ return {
898
+ script: nonce,
899
+ style: nonce,
900
+ scriptAttr: attr,
901
+ styleAttr: attr
902
+ };
903
+ }
904
+ const script = nonce.script;
905
+ const style = nonce.style;
906
+ if (!script && !style) return undefined;
907
+ return {
908
+ script,
909
+ style,
910
+ scriptAttr: typeof script === "string" && script ? ` nonce="${escape(script, true)}"` : "",
911
+ styleAttr: typeof style === "string" && style ? ` nonce="${escape(style, true)}"` : ""
912
+ };
913
+ }
914
+ function destinationNonce(nonce, destination) {
915
+ if (nonce == null) return undefined;
916
+ if (typeof nonce === "string") return nonce || undefined;
917
+ const value = nonce[destination];
918
+ return typeof value === "string" && value ? value : undefined;
919
+ }
920
+ function scriptNonce(nonce) {
921
+ return destinationNonce(nonce, "script");
922
+ }
923
+ function styleNonce(nonce) {
924
+ return destinationNonce(nonce, "style");
925
+ }
926
+ function asciiLowerCase(value) {
927
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
928
+ }
929
+ function hasNonceProp(props) {
930
+ for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
931
+ return false;
932
+ }
933
+ function nonceDestination(tag, props) {
934
+ if (tag === "script") return "script";
935
+ if (tag === "style") return "style";
936
+ if (tag !== "link") return null;
937
+ const rel = props.rel;
938
+ if (typeof rel !== "string") return null;
939
+ const rels = asciiLowerCase(rel).split(/[\t\n\f\r ]+/);
940
+ if (rels.includes("stylesheet")) return "style";
941
+ const isModulePreload = rels.includes("modulepreload");
942
+ if (!isModulePreload && !rels.includes("preload")) return null;
943
+ const as = typeof props.as === "string" ? asciiLowerCase(props.as) : "";
944
+ if (as === "style") return "style";
945
+ if (as === "script") return "script";
946
+ if (!isModulePreload) return null;
947
+ switch (as) {
948
+ case "fetch":
949
+ case "font":
950
+ case "image":
951
+ case "json":
952
+ case "text":
953
+ case "track":
954
+ return null;
955
+ default:
956
+ return "script";
957
+ }
958
+ }
959
+ function nonceAttr(nonce, destination) {
960
+ if (!nonce || !destination) return "";
961
+ return destination === "script" ? nonce.scriptAttr : nonce.styleAttr;
962
+ }
862
963
  function renderHeadAttrHtml(props) {
863
964
  let attrs = "";
864
965
  for (const name in props) {
@@ -887,7 +988,7 @@ function headAttrRecord(props, skipRelHref) {
887
988
  function renderHeadTagMarkup(tag, props, identity, nonce) {
888
989
  let attrs = renderHeadAttrHtml(props);
889
990
  if (identity != null) attrs += ` data-dh="${escape(identity, true)}"`;
890
- if (nonce && (tag === "script" || tag === "style")) attrs += ` nonce="${nonce}"`;
991
+ if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
891
992
  if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
892
993
  let body = props.children == null ? "" : String(props.children);
893
994
  if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
@@ -902,15 +1003,15 @@ function useHead(tags) {
902
1003
  }
903
1004
  const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
904
1005
  const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,o.replaceWith(n.content),n.remove(),(_$HY.v=_$HY.v||{})[e]=1,_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
905
- const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))||(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
1006
+ const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
906
1007
  function renderToString(code, options = {}) {
907
1008
  const {
908
1009
  renderId = "",
909
- nonce,
910
1010
  noScripts,
911
1011
  manifest,
912
1012
  onHead
913
1013
  } = options;
1014
+ const nonce = normalizeNonce(options.nonce);
914
1015
  let scripts = "";
915
1016
  const serializer = createHydrationSerializer({
916
1017
  scopeId: renderId,
@@ -927,7 +1028,7 @@ function renderToString(code, options = {}) {
927
1028
  const tracking = createAssetTracking();
928
1029
  const headRegistry = createHeadRegistry();
929
1030
  solidJs.sharedConfig.context = {
930
- nonce,
1031
+ nonce: options.nonce,
931
1032
  escape: escape,
932
1033
  resolve: resolveSSRNode,
933
1034
  ssr: ssr,
@@ -968,12 +1069,11 @@ function renderToString(code, options = {}) {
968
1069
  serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context, renderId);
969
1070
  solidJs.sharedConfig.context.noHydrate = true;
970
1071
  serializer.close();
971
- const head = renderShellHead(headRegistry, nonce, null);
972
- return assembleDocument(html, tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
1072
+ const head = renderShellHead(headRegistry, nonce, null, noScripts);
1073
+ return assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
973
1074
  }
974
1075
  function renderToStream(code, options = {}) {
975
1076
  let {
976
- nonce,
977
1077
  onCompleteShell,
978
1078
  onCompleteAll,
979
1079
  renderId = "",
@@ -981,6 +1081,7 @@ function renderToStream(code, options = {}) {
981
1081
  manifest,
982
1082
  onHead
983
1083
  } = options;
1084
+ const nonce = normalizeNonce(options.nonce);
984
1085
  let dispose;
985
1086
  let dead = false;
986
1087
  const abandon = () => {
@@ -1005,6 +1106,32 @@ function renderToStream(code, options = {}) {
1005
1106
  } catch (_) {}
1006
1107
  abandon();
1007
1108
  };
1109
+ const coalesceWrites = (writeRaw, endRaw) => {
1110
+ let buf = "";
1111
+ let scheduled = false;
1112
+ const flush = () => {
1113
+ scheduled = false;
1114
+ if (!buf) return;
1115
+ const out = buf;
1116
+ buf = "";
1117
+ writeRaw(out);
1118
+ };
1119
+ return {
1120
+ write(payload) {
1121
+ buf += payload;
1122
+ if (buf.length >= 16384) return flush();
1123
+ if (!scheduled) {
1124
+ scheduled = true;
1125
+ deferFlush(flush);
1126
+ }
1127
+ },
1128
+ flush,
1129
+ end() {
1130
+ flush();
1131
+ endRaw();
1132
+ }
1133
+ };
1134
+ };
1008
1135
  const guardSink = w => ({
1009
1136
  write(payload) {
1010
1137
  if (dead) return;
@@ -1024,6 +1151,23 @@ function renderToStream(code, options = {}) {
1024
1151
  }
1025
1152
  });
1026
1153
  const blockingPromises = new Set();
1154
+ const canBatchStubs = !options.serializer && !options.sink;
1155
+ let stubBatch = null;
1156
+ const STUB_BATCH_KEY = "$B";
1157
+ const flushStubBatch = () => {
1158
+ if (!stubBatch) return;
1159
+ const batch = stubBatch;
1160
+ stubBatch = null;
1161
+ if (batch.size === 1) {
1162
+ const [id, p] = batch.entries().next().value;
1163
+ serializer.write(id, p);
1164
+ return;
1165
+ }
1166
+ const obj = {};
1167
+ for (const [id, p] of batch) obj[id] = p;
1168
+ serializer.write(STUB_BATCH_KEY, obj);
1169
+ pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
1170
+ };
1027
1171
  let headerEmitted = false;
1028
1172
  const pushTask = task => {
1029
1173
  if (noScripts) return;
@@ -1060,10 +1204,11 @@ function renderToStream(code, options = {}) {
1060
1204
  buffer.write(renderInlineStyle(styles.inline[i], nonce));
1061
1205
  }
1062
1206
  if (styles.links.length) {
1207
+ const styleAttr = nonceAttr(nonce, "style");
1063
1208
  emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
1064
1209
  writeTasks();
1065
1210
  for (const entry of styles.links) {
1066
- buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}" onload="$dfc('${key}')" onerror="$dfc('${key}')">` : `<link${entry.attrHtml} onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
1211
+ buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} onload="$dfc('${key}')" onerror="$dfc('${key}')">` : `<link${entry.attrHtml}${styleAttr} onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
1067
1212
  }
1068
1213
  buffer.write(`<template id="${key}">${value}</template>`);
1069
1214
  } else {
@@ -1078,7 +1223,7 @@ function renderToStream(code, options = {}) {
1078
1223
  },
1079
1224
  asset(type, value) {
1080
1225
  if (type === "module") {
1081
- buffer.write(`<link rel="modulepreload" href="${value}">`);
1226
+ buffer.write(`<link rel="modulepreload" href="${value}"${nonceAttr(nonce, "script")}>`);
1082
1227
  } else if (type === "inline-style") {
1083
1228
  buffer.write(renderInlineStyle(value, nonce));
1084
1229
  } else if (type === "head-tag") {
@@ -1113,6 +1258,7 @@ function renderToStream(code, options = {}) {
1113
1258
  context.live.end = null;
1114
1259
  end();
1115
1260
  }
1261
+ flushStubBatch();
1116
1262
  serializer.flush();
1117
1263
  }));
1118
1264
  }
@@ -1120,7 +1266,7 @@ function renderToStream(code, options = {}) {
1120
1266
  const registry = new Map();
1121
1267
  const writeTasks = () => {
1122
1268
  if (tasks.length && !completed && firstFlushed) {
1123
- buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
1269
+ buffer.write(`<script${nonceAttr(nonce, "script")}>${tasks}</script>`);
1124
1270
  tasks = "";
1125
1271
  }
1126
1272
  timer = null;
@@ -1174,7 +1320,7 @@ function renderToStream(code, options = {}) {
1174
1320
  };
1175
1321
  solidJs.sharedConfig.context = context = {
1176
1322
  async: true,
1177
- nonce,
1323
+ nonce: options.nonce,
1178
1324
  live: {},
1179
1325
  registerHeadTags(tags) {
1180
1326
  registerHeadTags(headRegistry, context, tracking,
@@ -1232,10 +1378,18 @@ function renderToStream(code, options = {}) {
1232
1378
  },
1233
1379
  serialize(id, p, deferStream) {
1234
1380
  if (solidJs.sharedConfig.context.noHydrate) return;
1235
- if (!firstFlushed && deferStream && typeof p === "object" && "then" in p) {
1236
- blockingPromises.add(p);
1237
- p.then(d => serializer.write(id, d)).catch(e => serializer.write(id, e));
1238
- } else serializer.write(id, p);
1381
+ if (!firstFlushed && p && typeof p === "object" && "then" in p) {
1382
+ if (deferStream) {
1383
+ blockingPromises.add(p);
1384
+ p.then(d => serializer.write(id, d)).catch(e => serializer.write(id, e));
1385
+ return;
1386
+ }
1387
+ if (canBatchStubs && !shellCompleted) {
1388
+ (stubBatch ||= new Map()).set(id, p);
1389
+ return;
1390
+ }
1391
+ }
1392
+ serializer.write(id, p);
1239
1393
  },
1240
1394
  escape: escape,
1241
1395
  resolve: resolveSSRNode,
@@ -1269,7 +1423,7 @@ function renderToStream(code, options = {}) {
1269
1423
  queue(flushEnd);
1270
1424
  }))
1271
1425
  });
1272
- serializer.write(key + "_fr", p);
1426
+ if (canBatchStubs && !shellCompleted) (stubBatch ||= new Map()).set(key + "_fr", p);else serializer.write(key + "_fr", p);
1273
1427
  }
1274
1428
  return (value, error) => {
1275
1429
  if (registry.has(key)) {
@@ -1300,9 +1454,9 @@ function renderToStream(code, options = {}) {
1300
1454
  } else {
1301
1455
  serializeFragmentAssets(key, tracking.boundaryModules, context);
1302
1456
  const styles = collectStreamStyles(key, tracking, headStyles);
1303
- const headOps = error ? null : flushHeadFragment(headRegistry, key);
1457
+ const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
1304
1458
  if (headOps) emitHeadOps(key, headOps);
1305
- sink.fragment(key, value !== undefined ? value : " ", {
1459
+ sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
1306
1460
  styles,
1307
1461
  revealGroup,
1308
1462
  error
@@ -1386,15 +1540,18 @@ function renderToStream(code, options = {}) {
1386
1540
  function doShell() {
1387
1541
  if (shellCompleted) return;
1388
1542
  solidJs.sharedConfig.context = context;
1543
+ const blockersBefore = blockingPromises.size;
1389
1544
  if (!resolveRootHoles()) return;
1545
+ if (blockingPromises.size !== blockersBefore) return;
1390
1546
  if (!headShellReady(headRegistry, p => blockingPromises.add(p))) return;
1391
1547
  headStyles = new Set();
1392
1548
  for (const url of tracking.emittedAssets) {
1393
1549
  if (isCssUrl(url)) headStyles.add(url);
1394
1550
  }
1395
1551
  serializeRootAssets();
1396
- const head = renderShellHead(headRegistry, nonce, k => registry.has(k));
1397
- sink.shell(html, {
1552
+ flushStubBatch();
1553
+ const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts);
1554
+ sink.shell(resolveSSRSelectValues(html), {
1398
1555
  preloads: tracking.emittedAssets,
1399
1556
  inlineStyles: tracking.inlineStyles,
1400
1557
  tasks,
@@ -1414,6 +1571,7 @@ function renderToStream(code, options = {}) {
1414
1571
  let drainTurn = 0;
1415
1572
  const scheduleFlush = fn => {
1416
1573
  const attempt = () => {
1574
+ flushStubBatch();
1417
1575
  if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
1418
1576
  if (registry.size !== lastRegistrySize) drainTurn = 0;
1419
1577
  lastRegistrySize = registry.size;
@@ -1461,22 +1619,18 @@ function renderToStream(code, options = {}) {
1461
1619
  }
1462
1620
  };
1463
1621
  writer.closed && writer.closed.catch(failed);
1464
- writable = {
1465
- end() {
1466
- pendingWrites.then(() => {
1467
- ended = true;
1468
- writer.releaseLock();
1469
- w.close().catch(() => {});
1470
- resolve();
1471
- });
1472
- }
1473
- };
1474
- buffer = {
1475
- write(payload) {
1476
- pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(failed);
1477
- }
1478
- };
1622
+ buffer = writable = coalesceWrites(payload => {
1623
+ pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(failed);
1624
+ }, () => {
1625
+ pendingWrites.then(() => {
1626
+ ended = true;
1627
+ writer.releaseLock();
1628
+ w.close().catch(() => {});
1629
+ resolve();
1630
+ });
1631
+ });
1479
1632
  buffer.write(tmp);
1633
+ buffer.flush();
1480
1634
  firstFlushed = true;
1481
1635
  if (completed) {
1482
1636
  dispose();
@@ -1506,7 +1660,8 @@ function renderToStream(code, options = {}) {
1506
1660
  allSettled(blockingPromises).then(() => {
1507
1661
  scheduleFlush(() => {
1508
1662
  try {
1509
- if (!resolveRootHoles() || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1663
+ const blockersBefore = blockingPromises.size;
1664
+ if (!resolveRootHoles() || blockingPromises.size !== blockersBefore || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1510
1665
  } catch (err) {
1511
1666
  failRender(err);
1512
1667
  return resolve(tmp);
@@ -1535,8 +1690,10 @@ function renderToStream(code, options = {}) {
1535
1690
  return;
1536
1691
  }
1537
1692
  if (!shellCompleted) return flush();
1538
- buffer = writable = guardSink(w);
1693
+ const sink = guardSink(w);
1694
+ buffer = writable = coalesceWrites(sink.write, sink.end);
1539
1695
  buffer.write(tmp);
1696
+ buffer.flush();
1540
1697
  firstFlushed = true;
1541
1698
  if (completed) {
1542
1699
  dispose();
@@ -1563,9 +1720,7 @@ function renderToStream(code, options = {}) {
1563
1720
  };
1564
1721
  }
1565
1722
  function HydrationScript(props) {
1566
- const {
1567
- nonce
1568
- } = solidJs.sharedConfig.context;
1723
+ const nonce = scriptNonce(solidJs.sharedConfig.context && solidJs.sharedConfig.context.nonce);
1569
1724
  return ssr(generateHydrationScript({
1570
1725
  nonce,
1571
1726
  ...props
@@ -2279,6 +2434,137 @@ function ssrHydrationKey() {
2279
2434
  const hk = getHydrationKey();
2280
2435
  return hk ? ` _hk=${hk}` : "";
2281
2436
  }
2437
+ const CLAIM_PROP = /*#__PURE__*/Symbol.for("dom-expressions.claim-prop");
2438
+ const CLAIMS_STREAM = 1;
2439
+ const CLAIMS_DOCUMENT = 2;
2440
+ const CLAIM_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
2441
+ function encodeClaimKey(key) {
2442
+ return String(key).replace(CLAIM_UNSAFE, c => encodeURIComponent(c));
2443
+ }
2444
+ function ssrClaim(map) {
2445
+ const mode = solidJs.sharedConfig.context && solidJs.sharedConfig.context.claims;
2446
+ if (!mode || mode === CLAIMS_DOCUMENT && !(typeof solidJs.inServerComponentScope === "function" && solidJs.inServerComponentScope())) {
2447
+ return "";
2448
+ }
2449
+ let out = "";
2450
+ for (const pos in map) {
2451
+ const value = map[pos];
2452
+ const list = Array.isArray(value) ? value : [value];
2453
+ for (const fn of list) {
2454
+ const prop = typeof fn === "function" && fn[CLAIM_PROP] || undefined;
2455
+ if (prop === undefined) {
2456
+ continue;
2457
+ }
2458
+ out += `${out ? "," : ""}${pos}=${encodeClaimKey(prop)}`;
2459
+ }
2460
+ }
2461
+ return out ? ` _bnd="${out}"` : "";
2462
+ }
2463
+ function decodeSSREntities(s) {
2464
+ return s.indexOf("&") < 0 ? s : s.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&amp;/g, "&");
2465
+ }
2466
+ const SELECT_VALUE_ATTR = /\svalue="([^"]*)"/;
2467
+ function tagEnd(html, i) {
2468
+ for (let j = i + 1; j < html.length; j++) {
2469
+ const c = html.charCodeAt(j);
2470
+ if (c === 34) {
2471
+ j = html.indexOf('"', j + 1);
2472
+ if (j < 0) return -1;
2473
+ } else if (c === 62) return j;
2474
+ }
2475
+ return -1;
2476
+ }
2477
+ function optionText(html, from) {
2478
+ let t = "";
2479
+ let i = from;
2480
+ for (;;) {
2481
+ const lt = html.indexOf("<", i);
2482
+ if (lt < 0) return t + html.slice(i);
2483
+ t += html.slice(i, lt);
2484
+ if (!html.startsWith("<!--", lt)) return t;
2485
+ const ce = html.indexOf("-->", lt);
2486
+ if (ce < 0) return t;
2487
+ i = ce + 3;
2488
+ }
2489
+ }
2490
+ function tagIs(html, i, name) {
2491
+ if (!html.startsWith(name, i + 1)) return false;
2492
+ const c = html.charCodeAt(i + 1 + name.length);
2493
+ return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
2494
+ }
2495
+ let selectValuesActive = false;
2496
+ function ssrSelectValues() {
2497
+ selectValuesActive = true;
2498
+ }
2499
+ function resolveSSRSelectValues(html) {
2500
+ if (!selectValuesActive) return html;
2501
+ let cand = html.indexOf("<select");
2502
+ if (cand < 0) return html;
2503
+ let out = "";
2504
+ let idx = 0;
2505
+ while (cand >= 0) {
2506
+ if (!tagIs(html, cand, "select")) {
2507
+ cand = html.indexOf("<select", cand + 7);
2508
+ continue;
2509
+ }
2510
+ const e0 = tagEnd(html, cand);
2511
+ if (e0 < 0) break;
2512
+ const open = html.slice(cand, e0 + 1);
2513
+ const m = SELECT_VALUE_ATTR.exec(open);
2514
+ if (!m) {
2515
+ cand = html.indexOf("<select", e0 + 1);
2516
+ continue;
2517
+ }
2518
+ const bound = decodeSSREntities(m[1]);
2519
+ const sel = {
2520
+ values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
2521
+ strip: cand + m.index,
2522
+ stripEnd: cand + m.index + m[0].length,
2523
+ body: e0 + 1,
2524
+ marks: [],
2525
+ defaulted: false
2526
+ };
2527
+ let committed = false;
2528
+ let i = html.indexOf("<", e0 + 1);
2529
+ while (i >= 0) {
2530
+ let e;
2531
+ if (html.charCodeAt(i + 1) === 33) {
2532
+ e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
2533
+ if (e < 0) break;
2534
+ if (html.charCodeAt(i + 2) === 45) e += 2;
2535
+ } else {
2536
+ e = tagEnd(html, i);
2537
+ if (e < 0) break;
2538
+ if (html.startsWith("</select>", i)) {
2539
+ out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
2540
+ let seg = sel.body;
2541
+ if (!sel.defaulted) {
2542
+ for (let k = 0; k < sel.marks.length; k++) {
2543
+ out += html.slice(seg, sel.marks[k]) + " selected";
2544
+ seg = sel.marks[k];
2545
+ }
2546
+ }
2547
+ out += html.slice(seg, i);
2548
+ idx = i;
2549
+ committed = true;
2550
+ break;
2551
+ } else if (tagIs(html, i, "option")) {
2552
+ const attrs = html.slice(i + 7, e);
2553
+ if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
2554
+ const vm = SELECT_VALUE_ATTR.exec(attrs);
2555
+ const value = vm ? decodeSSREntities(vm[1]) : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
2556
+ if (sel.values.includes(value)) sel.marks.push(e);
2557
+ }
2558
+ }
2559
+ }
2560
+ i = html.indexOf("<", e + 1);
2561
+ }
2562
+ if (!committed) break;
2563
+ cand = html.indexOf("<select", idx);
2564
+ }
2565
+ if (idx === 0) return html;
2566
+ return out + html.slice(idx);
2567
+ }
2282
2568
  function escape(s, attr) {
2283
2569
  const t = typeof s;
2284
2570
  if (t !== "string") {
@@ -2300,22 +2586,20 @@ function escape(s, attr) {
2300
2586
  return escapeSlow(s, attr, i);
2301
2587
  }
2302
2588
  const ESCAPE_CONTENT = /[&<]/;
2303
- const ESCAPE_ATTR = /[&"]/;
2589
+ const ESCAPE_ATTR = /[&"<]/;
2304
2590
  function escapeSlow(s, attr, start) {
2305
- const delim = attr ? '"' : "<";
2306
- const delimCode = attr ? 34 : 60;
2307
- const escDelim = attr ? "&quot;" : "&lt;";
2591
+ if (attr) return escapeAttrSlow(s, start);
2308
2592
  const c0 = s.charCodeAt(start);
2309
- let iDelim = c0 === delimCode ? start : s.indexOf(delim, start);
2593
+ let iDelim = c0 === 60 ? start : s.indexOf("<", start);
2310
2594
  let iAmp = c0 === 38 ? start : s.indexOf("&", start);
2311
2595
  let left = 0,
2312
2596
  out = "";
2313
2597
  while (iDelim >= 0 && iAmp >= 0) {
2314
2598
  if (iDelim < iAmp) {
2315
2599
  if (left < iDelim) out += s.substring(left, iDelim);
2316
- out += escDelim;
2600
+ out += "&lt;";
2317
2601
  left = iDelim + 1;
2318
- iDelim = s.indexOf(delim, left);
2602
+ iDelim = s.indexOf("<", left);
2319
2603
  } else {
2320
2604
  if (left < iAmp) out += s.substring(left, iAmp);
2321
2605
  out += "&amp;";
@@ -2326,9 +2610,9 @@ function escapeSlow(s, attr, start) {
2326
2610
  if (iDelim >= 0) {
2327
2611
  do {
2328
2612
  if (left < iDelim) out += s.substring(left, iDelim);
2329
- out += escDelim;
2613
+ out += "&lt;";
2330
2614
  left = iDelim + 1;
2331
- iDelim = s.indexOf(delim, left);
2615
+ iDelim = s.indexOf("<", left);
2332
2616
  } while (iDelim >= 0);
2333
2617
  } else while (iAmp >= 0) {
2334
2618
  if (left < iAmp) out += s.substring(left, iAmp);
@@ -2338,6 +2622,36 @@ function escapeSlow(s, attr, start) {
2338
2622
  }
2339
2623
  return left < s.length ? out + s.substring(left) : out;
2340
2624
  }
2625
+ function escapeAttrSlow(s, start) {
2626
+ const c0 = s.charCodeAt(start);
2627
+ let iQuot = c0 === 34 ? start : s.indexOf('"', start);
2628
+ let iAmp = c0 === 38 ? start : s.indexOf("&", start);
2629
+ let iLt = c0 === 60 ? start : s.indexOf("<", start);
2630
+ let left = 0,
2631
+ out = "";
2632
+ for (;;) {
2633
+ let i = -1,
2634
+ ent;
2635
+ if (iQuot >= 0) {
2636
+ i = iQuot;
2637
+ ent = "&quot;";
2638
+ }
2639
+ if (iAmp >= 0 && (i < 0 || iAmp < i)) {
2640
+ i = iAmp;
2641
+ ent = "&amp;";
2642
+ }
2643
+ if (iLt >= 0 && (i < 0 || iLt < i)) {
2644
+ i = iLt;
2645
+ ent = "&lt;";
2646
+ }
2647
+ if (i < 0) break;
2648
+ if (left < i) out += s.substring(left, i);
2649
+ out += ent;
2650
+ left = i + 1;
2651
+ if (i === iQuot) iQuot = s.indexOf('"', left);else if (i === iAmp) iAmp = s.indexOf("&", left);else iLt = s.indexOf("<", left);
2652
+ }
2653
+ return left < s.length ? out + s.substring(left) : out;
2654
+ }
2341
2655
  function tryJoinPlainSSRArray(nodes) {
2342
2656
  if (nodes.length === 0) return undefined;
2343
2657
  let out = "";
@@ -2361,11 +2675,12 @@ function generateHydrationScript({
2361
2675
  eventNames = ["click", "input"],
2362
2676
  nonce
2363
2677
  } = {}) {
2364
- return `<script${nonce ? ` nonce="${nonce}"` : ""}>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:{},fe(){}});</script><!--xs-->`;
2678
+ 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:{},fe(){}});</script><!--xs-->`;
2365
2679
  }
2366
2680
  function queue(fn) {
2367
2681
  return Promise.resolve().then(fn);
2368
2682
  }
2683
+ const deferFlush = typeof setImmediate === "function" ? setImmediate : fn => setTimeout(fn, 0);
2369
2684
  function allSettled(promises) {
2370
2685
  let size = promises.size;
2371
2686
  return Promise.allSettled(promises).then(() => {
@@ -2374,10 +2689,11 @@ function allSettled(promises) {
2374
2689
  });
2375
2690
  }
2376
2691
  function assembleDocument(html, emittedAssets, inlineStyles, scripts, nonce, headTags, onHead) {
2377
- const scriptTag = scripts ? `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>` : "";
2378
- const headTagsHtml = headTags ? headTags.html : "";
2692
+ const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
2693
+ const title = headTags ? headTags.title : null;
2694
+ let headTagsHtml = headTags ? headTags.html : "";
2379
2695
  const headPrelude = headTags ? headTags.prelude : "";
2380
- if (!onHead && !headTagsHtml && !headPrelude && !(emittedAssets && emittedAssets.size) && !(inlineStyles && inlineStyles.size)) {
2696
+ if (!onHead && title == null && !headTagsHtml && !headPrelude && !(emittedAssets && emittedAssets.size) && !(inlineStyles && inlineStyles.size)) {
2381
2697
  if (!scriptTag) return html;
2382
2698
  const xs = html.indexOf("<!--xs-->");
2383
2699
  return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
@@ -2389,15 +2705,33 @@ function assembleDocument(html, emittedAssets, inlineStyles, scripts, nonce, hea
2389
2705
  html = html.slice(0, at) + headPrelude + html.slice(at);
2390
2706
  }
2391
2707
  }
2392
- const headIdx = html.indexOf("</head>");
2708
+ let headIdx = html.indexOf("</head>");
2393
2709
  if (headIdx === -1) {
2394
2710
  if (onHead) {
2395
- onHead(headPrelude + headTagsHtml + renderHeadAssets(emittedAssets, inlineStyles, nonce));
2711
+ let titleHtml = "";
2712
+ if (title != null) {
2713
+ titleHtml = headTags.noScripts ? `<title data-dh="title">${escape(title)}</title>` : `<script${nonceAttr(nonce, "script")}>(function(x,t){(t=document.querySelector("title"))?(t.hasAttribute("data-dh")||t.setAttribute("data-dhf",t.textContent),t.textContent=x):(document.title=x,t=document.querySelector("title"));t&&t.setAttribute("data-dh","title")})(${JSON.stringify(title).replace(/</g, "\\u003C")})</script>`;
2714
+ }
2715
+ onHead(headPrelude + headTagsHtml + titleHtml + renderHeadAssets(emittedAssets, inlineStyles, nonce));
2396
2716
  }
2397
2717
  if (!scriptTag) return html;
2398
2718
  const xs = html.indexOf("<!--xs-->");
2399
2719
  return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
2400
2720
  }
2721
+ if (title != null) {
2722
+ const winner = escape(title);
2723
+ const open = html.match(/<head(?:\s[^>]*)?>/);
2724
+ const from = open ? open.index + open[0].length : 0;
2725
+ const m = /<title(\s[^>]*)?>([\s\S]*?)<\/title>/.exec(html.slice(from, headIdx));
2726
+ if (m) {
2727
+ const at = from + m.index;
2728
+ const stash = m[2].replace(/"/g, "&quot;");
2729
+ html = html.slice(0, at) + `<title${m[1] || ""} data-dh="title" data-dhf="${stash}">${winner}</title>` + html.slice(at + m[0].length);
2730
+ headIdx = html.indexOf("</head>");
2731
+ } else {
2732
+ headTagsHtml = `<title data-dh="title">${winner}</title>` + headTagsHtml;
2733
+ }
2734
+ }
2401
2735
  const head = headTagsHtml + renderHeadAssets(emittedAssets, inlineStyles, nonce);
2402
2736
  if (!scriptTag) return html.slice(0, headIdx) + head + html.slice(headIdx);
2403
2737
  const xsIdx = html.indexOf("<!--xs-->");
@@ -2406,9 +2740,11 @@ function assembleDocument(html, emittedAssets, inlineStyles, scripts, nonce, hea
2406
2740
  }
2407
2741
  function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
2408
2742
  let head = "";
2743
+ const styleAttr = nonceAttr(nonce, "style");
2744
+ const scriptAttr = nonceAttr(nonce, "script");
2409
2745
  if (emittedAssets && emittedAssets.size) {
2410
2746
  for (const url of emittedAssets) {
2411
- head += isCssUrl(url) ? `<link rel="stylesheet" href="${url}">` : `<link rel="modulepreload" href="${url}">`;
2747
+ head += isCssUrl(url) ? `<link rel="stylesheet" href="${url}"${styleAttr}>` : `<link rel="modulepreload" href="${url}"${scriptAttr}>`;
2412
2748
  }
2413
2749
  }
2414
2750
  if (inlineStyles && inlineStyles.size) {
@@ -2423,7 +2759,9 @@ function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
2423
2759
  function serializeFragmentAssets(key, boundaryModules, context, name = key) {
2424
2760
  const map = boundaryModules.get(key);
2425
2761
  if (!map || !Object.keys(map).length) return;
2426
- context.serialize(name + "_assets", map);
2762
+ context.serialize(name + "_assets", {
2763
+ ...map
2764
+ });
2427
2765
  }
2428
2766
  function propagateBoundaryStyles(childKey, parentKey, tracking) {
2429
2767
  const childStyles = tracking.getBoundaryStyles(childKey);
@@ -2468,12 +2806,15 @@ function escapeStyleContent(content) {
2468
2806
  }
2469
2807
  function renderInlineStyle(entry, nonce) {
2470
2808
  let attrs = "";
2809
+ let hasNonce = false;
2471
2810
  if (entry.attrs) {
2472
2811
  for (const name in entry.attrs) {
2812
+ if (name.length === 5 && asciiLowerCase(name) === "nonce") hasNonce = true;
2473
2813
  attrs += ` ${name}="${escape(String(entry.attrs[name]), true)}"`;
2474
2814
  }
2475
2815
  }
2476
- return `<style${nonce ? ` nonce="${nonce}"` : ""} data-asset="${escape(entry.id, true)}"${attrs}>${escapeStyleContent(entry.content)}</style>`;
2816
+ const nonceHtml = hasNonce ? "" : nonceAttr(nonce, "style");
2817
+ return `<style${nonceHtml} data-asset="${escape(entry.id, true)}"${attrs}>${escapeStyleContent(entry.content)}</style>`;
2477
2818
  }
2478
2819
  function waitForFragments(registry, key) {
2479
2820
  for (const k of [...registry.keys()].reverse()) {
@@ -2715,16 +3056,13 @@ function deriveHead(stub, responseInit = {}) {
2715
3056
  headers
2716
3057
  };
2717
3058
  }
2718
- function escapeAttribute(value) {
2719
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
2720
- }
2721
3059
  function createSSRResponse(result, event, options = {}) {
2722
3060
  const stub = event && event.response;
2723
3061
  const {
2724
3062
  responseInit,
2725
- nonce,
2726
3063
  transformChunk
2727
3064
  } = options;
3065
+ const nonce = normalizeNonce(options.nonce);
2728
3066
  if (typeof result === "string") {
2729
3067
  if (stub) commitResponseStub(stub);
2730
3068
  const head = deriveHead(stub, responseInit);
@@ -2794,7 +3132,7 @@ function createSSRResponse(result, event, options = {}) {
2794
3132
  if (closed || !controller) return;
2795
3133
  const location = stub && stub.headers.get("Location");
2796
3134
  if (location) {
2797
- const attr = nonce ? ` nonce="${escapeAttribute(nonce)}"` : "";
3135
+ const attr = nonceAttr(nonce, "script");
2798
3136
  enqueue(`<script${attr}>window.location=${JSON.stringify(location).replace(/</g, "\\u003c")}</script>`);
2799
3137
  }
2800
3138
  closed = true;
@@ -3031,10 +3369,17 @@ Object.defineProperty(exports, "scope", {
3031
3369
  enumerable: true,
3032
3370
  get: function () { return solidJs.ssrScope; }
3033
3371
  });
3372
+ Object.defineProperty(exports, "sharedConfig", {
3373
+ enumerable: true,
3374
+ get: function () { return solidJs.sharedConfig; }
3375
+ });
3034
3376
  Object.defineProperty(exports, "untrack", {
3035
3377
  enumerable: true,
3036
3378
  get: function () { return solidJs.untrack; }
3037
3379
  });
3380
+ exports.CLAIMS_DOCUMENT = CLAIMS_DOCUMENT;
3381
+ exports.CLAIMS_STREAM = CLAIMS_STREAM;
3382
+ exports.CLAIM_PROP = CLAIM_PROP;
3038
3383
  exports.ChildProperties = ChildProperties;
3039
3384
  exports.DOMElements = DOMElements;
3040
3385
  exports.DOMWithState = DOMWithState;
@@ -3106,8 +3451,10 @@ exports.reload = reload;
3106
3451
  exports.render = notSup;
3107
3452
  exports.renderToStream = renderToStream;
3108
3453
  exports.renderToString = renderToString;
3454
+ exports.resolveSSRSelectValues = resolveSSRSelectValues;
3109
3455
  exports.respond = respond;
3110
3456
  exports.runHydrationEvents = notSup;
3457
+ exports.scriptNonce = scriptNonce;
3111
3458
  exports.serializeCookie = serializeCookie;
3112
3459
  exports.setAttribute = notSup;
3113
3460
  exports.setAttributeNS = notSup;
@@ -3116,13 +3463,16 @@ exports.setStyleProperty = notSup;
3116
3463
  exports.spread = notSup;
3117
3464
  exports.ssr = ssr;
3118
3465
  exports.ssrAttribute = ssrAttribute;
3466
+ exports.ssrClaim = ssrClaim;
3119
3467
  exports.ssrClassName = ssrClassName;
3120
3468
  exports.ssrElement = ssrElement;
3121
3469
  exports.ssrGroup = ssrGroup;
3122
3470
  exports.ssrHydrationKey = ssrHydrationKey;
3471
+ exports.ssrSelectValues = ssrSelectValues;
3123
3472
  exports.ssrStyle = ssrStyle;
3124
3473
  exports.ssrStyleProperty = ssrStyleProperty;
3125
3474
  exports.style = notSup;
3475
+ exports.styleNonce = styleNonce;
3126
3476
  exports.template = notSup;
3127
3477
  exports.unregisterDelegatedContainer = notSup;
3128
3478
  exports.unregisterDelegatedRoot = notSup;