@solidjs/web 2.0.0-beta.27 → 2.0.0-beta.29
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/dist/dev.cjs +40 -2
- package/dist/dev.js +39 -4
- package/dist/server.cjs +113 -37
- package/dist/server.js +112 -39
- package/dist/web.cjs +40 -2
- package/dist/web.js +39 -4
- package/frames/dist/client.cjs +370 -209
- package/frames/dist/client.dev.cjs +370 -210
- package/frames/dist/client.dev.js +371 -211
- package/frames/dist/client.js +371 -210
- package/frames/dist/server.cjs +373 -74
- package/frames/dist/server.js +373 -75
- package/package.json +3 -3
- package/server-functions/dist/client.cjs +100 -3
- package/server-functions/dist/client.js +92 -4
- package/server-functions/dist/server.cjs +85 -17
- package/server-functions/dist/server.js +83 -17
- package/types/client.d.ts +15 -0
- package/types/core.d.ts +1 -1
- package/types/frames/client.d.ts +8 -5
- package/types/frames/frame-client.d.ts +17 -0
- package/types/frames/frame-sink.d.ts +29 -6
- package/types/frames/frame-transport.d.ts +76 -12
- package/types/frames/server.d.ts +29 -1
- package/types/index.d.ts +74 -0
- package/types/server-functions/client.d.ts +25 -0
- package/types/server-functions/server.d.ts +105 -18
- package/types/server-functions/shared.d.ts +22 -0
- package/types/server-mock.d.ts +6 -2
- package/types/server.d.ts +39 -1
- package/types-cjs/client.d.cts +15 -0
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/frames/client.d.cts +8 -5
- package/types-cjs/frames/frame-client.d.cts +17 -0
- package/types-cjs/frames/frame-sink.d.cts +29 -6
- package/types-cjs/frames/frame-transport.d.cts +76 -12
- package/types-cjs/frames/server.d.cts +29 -1
- package/types-cjs/index.d.cts +74 -0
- package/types-cjs/server-functions/client.d.cts +25 -0
- package/types-cjs/server-functions/server.d.cts +105 -18
- package/types-cjs/server-functions/shared.d.cts +22 -0
- package/types-cjs/server-mock.d.cts +6 -2
- package/types-cjs/server.d.cts +39 -1
package/dist/dev.cjs
CHANGED
|
@@ -885,7 +885,15 @@ function runHydrationEvents() {
|
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
887
|
function isHydrating(node) {
|
|
888
|
-
|
|
888
|
+
if (!solidJs.sharedConfig.hydrating) return false;
|
|
889
|
+
if (!node || node.isConnected) return true;
|
|
890
|
+
const roots = solidJs.sharedConfig.claimRoots;
|
|
891
|
+
if (roots) {
|
|
892
|
+
for (let i = 0; i < roots.length; i++) {
|
|
893
|
+
if (roots[i].contains(node)) return true;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return false;
|
|
889
897
|
}
|
|
890
898
|
function classListToObject(classList) {
|
|
891
899
|
if (Array.isArray(classList)) {
|
|
@@ -934,7 +942,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
934
942
|
}
|
|
935
943
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
936
944
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
937
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
945
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
946
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
938
947
|
} else {
|
|
939
948
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
940
949
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1331,6 +1340,32 @@ function createElement(tagName, is = undefined) {
|
|
|
1331
1340
|
is
|
|
1332
1341
|
});
|
|
1333
1342
|
}
|
|
1343
|
+
function loadClientOnly(fn, setComp) {
|
|
1344
|
+
fn().then(m => setComp(() => m.default));
|
|
1345
|
+
}
|
|
1346
|
+
function clientOnly(fn, options = {}) {
|
|
1347
|
+
const [comp, setComp] = solidJs.createSignal();
|
|
1348
|
+
let started = !options.lazy;
|
|
1349
|
+
started && loadClientOnly(fn, setComp);
|
|
1350
|
+
return props => {
|
|
1351
|
+
let Comp;
|
|
1352
|
+
let m;
|
|
1353
|
+
const rest = solidJs.omit(props, "fallback");
|
|
1354
|
+
if (!started) {
|
|
1355
|
+
started = true;
|
|
1356
|
+
loadClientOnly(fn, setComp);
|
|
1357
|
+
}
|
|
1358
|
+
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1359
|
+
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1360
|
+
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1361
|
+
solidJs.onSettled(() => {
|
|
1362
|
+
setMounted(true);
|
|
1363
|
+
});
|
|
1364
|
+
return gate;
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function httpStatus(_code, _text) {}
|
|
1368
|
+
function httpHeader(_name, _value, _options) {}
|
|
1334
1369
|
|
|
1335
1370
|
Object.defineProperty(exports, "Errored", {
|
|
1336
1371
|
enumerable: true,
|
|
@@ -1408,6 +1443,7 @@ exports.assign = assign;
|
|
|
1408
1443
|
exports.claimElement = claimElement;
|
|
1409
1444
|
exports.claimElementTree = claimElementTree;
|
|
1410
1445
|
exports.className = className;
|
|
1446
|
+
exports.clientOnly = clientOnly;
|
|
1411
1447
|
exports.delegateEvents = delegateEvents;
|
|
1412
1448
|
exports.dynamic = dynamic;
|
|
1413
1449
|
exports.dynamicProperty = dynamicProperty;
|
|
@@ -1423,6 +1459,8 @@ exports.getNextMarker = getNextMarker;
|
|
|
1423
1459
|
exports.getNextMatch = getNextMatch;
|
|
1424
1460
|
exports.getNextSibling = getNextSibling;
|
|
1425
1461
|
exports.getRequestEvent = voidFn;
|
|
1462
|
+
exports.httpHeader = httpHeader;
|
|
1463
|
+
exports.httpStatus = httpStatus;
|
|
1426
1464
|
exports.hydrate = hydrate;
|
|
1427
1465
|
exports.insert = insert;
|
|
1428
1466
|
exports.installHydrationRuntime = installHydrationRuntime;
|
package/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onSettled, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const DOMWithState = {
|
|
@@ -884,7 +884,15 @@ function runHydrationEvents() {
|
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
function isHydrating(node) {
|
|
887
|
-
|
|
887
|
+
if (!sharedConfig.hydrating) return false;
|
|
888
|
+
if (!node || node.isConnected) return true;
|
|
889
|
+
const roots = sharedConfig.claimRoots;
|
|
890
|
+
if (roots) {
|
|
891
|
+
for (let i = 0; i < roots.length; i++) {
|
|
892
|
+
if (roots[i].contains(node)) return true;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return false;
|
|
888
896
|
}
|
|
889
897
|
function classListToObject(classList) {
|
|
890
898
|
if (Array.isArray(classList)) {
|
|
@@ -933,7 +941,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
933
941
|
}
|
|
934
942
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
935
943
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
936
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
944
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
945
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
937
946
|
} else {
|
|
938
947
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
939
948
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1330,5 +1339,31 @@ function createElement(tagName, is = undefined) {
|
|
|
1330
1339
|
is
|
|
1331
1340
|
});
|
|
1332
1341
|
}
|
|
1342
|
+
function loadClientOnly(fn, setComp) {
|
|
1343
|
+
fn().then(m => setComp(() => m.default));
|
|
1344
|
+
}
|
|
1345
|
+
function clientOnly(fn, options = {}) {
|
|
1346
|
+
const [comp, setComp] = createSignal();
|
|
1347
|
+
let started = !options.lazy;
|
|
1348
|
+
started && loadClientOnly(fn, setComp);
|
|
1349
|
+
return props => {
|
|
1350
|
+
let Comp;
|
|
1351
|
+
let m;
|
|
1352
|
+
const rest = omit(props, "fallback");
|
|
1353
|
+
if (!started) {
|
|
1354
|
+
started = true;
|
|
1355
|
+
loadClientOnly(fn, setComp);
|
|
1356
|
+
}
|
|
1357
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1358
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1359
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1360
|
+
onSettled(() => {
|
|
1361
|
+
setMounted(true);
|
|
1362
|
+
});
|
|
1363
|
+
return gate;
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function httpStatus(_code, _text) {}
|
|
1367
|
+
function httpHeader(_name, _value, _options) {}
|
|
1333
1368
|
|
|
1334
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1369
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clientOnly, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -199,7 +199,24 @@ function createAssetTracking() {
|
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function warnUnresolvedModuleAssets(moduleUrl, warned) {
|
|
203
|
+
if (warned.has(moduleUrl)) return;
|
|
204
|
+
warned.add(moduleUrl);
|
|
205
|
+
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
|
|
206
|
+
}
|
|
207
|
+
function guardResolvedAssets(moduleUrl, result, warned) {
|
|
208
|
+
if (result && typeof result.then === "function") {
|
|
209
|
+
return result.then(assets => {
|
|
210
|
+
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
211
|
+
return assets;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
function applyAssetTracking(context, tracking, manifest, noScripts) {
|
|
218
|
+
const warned = new Set();
|
|
219
|
+
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
|
|
203
220
|
Object.defineProperty(context, "_currentBoundaryId", {
|
|
204
221
|
get() {
|
|
205
222
|
return tracking.currentBoundaryId;
|
|
@@ -213,15 +230,15 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
213
230
|
context.registerModule = tracking.registerModule;
|
|
214
231
|
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
215
232
|
if (typeof manifest === "function") {
|
|
216
|
-
context.resolveAssets = manifest;
|
|
233
|
+
context.resolveAssets = guard(manifest);
|
|
217
234
|
} else if (manifest && typeof manifest.resolve === "function") {
|
|
218
|
-
context.resolveAssets = key => manifest.resolve(key);
|
|
235
|
+
context.resolveAssets = guard(key => manifest.resolve(key));
|
|
219
236
|
if (typeof manifest.resolveSync === "function") {
|
|
220
237
|
context.resolveAssetsSync = key => manifest.resolveSync(key);
|
|
221
238
|
}
|
|
222
239
|
} else if (manifest) {
|
|
223
240
|
const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
224
|
-
context.resolveAssets = resolve;
|
|
241
|
+
context.resolveAssets = guard(resolve);
|
|
225
242
|
context.resolveAssetsSync = resolve;
|
|
226
243
|
}
|
|
227
244
|
}
|
|
@@ -277,7 +294,7 @@ function renderToString(code, options = {}) {
|
|
|
277
294
|
tracking.emittedAssets.add(value);
|
|
278
295
|
}
|
|
279
296
|
};
|
|
280
|
-
applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest);
|
|
297
|
+
applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest, noScripts);
|
|
281
298
|
registerEntryAssets(manifest);
|
|
282
299
|
let html = solidJs.createRoot(d => {
|
|
283
300
|
setTimeout(d);
|
|
@@ -565,7 +582,7 @@ function renderToStream(code, options = {}) {
|
|
|
565
582
|
});
|
|
566
583
|
}
|
|
567
584
|
};
|
|
568
|
-
applyAssetTracking(context, tracking, manifest);
|
|
585
|
+
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
569
586
|
registerEntryAssets(manifest);
|
|
570
587
|
let html = solidJs.createRoot(d => {
|
|
571
588
|
dispose = d;
|
|
@@ -662,6 +679,51 @@ function renderToStream(code, options = {}) {
|
|
|
662
679
|
drainTurn = 0;
|
|
663
680
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
664
681
|
};
|
|
682
|
+
let cachedReadable;
|
|
683
|
+
let consumer;
|
|
684
|
+
const claimConsumer = name => {
|
|
685
|
+
if (consumer && consumer !== name) {
|
|
686
|
+
throw new Error(`renderToStream result was already consumed via \`${consumer}\`; cannot also consume it via \`${name}\`. Use exactly one of \`pipe\`, \`pipeTo\`, or \`readable\`.`);
|
|
687
|
+
}
|
|
688
|
+
consumer = name;
|
|
689
|
+
};
|
|
690
|
+
const pipeToImpl = w => {
|
|
691
|
+
let resolve;
|
|
692
|
+
const p = new Promise(r => resolve = r);
|
|
693
|
+
function flush() {
|
|
694
|
+
allSettled(blockingPromises).then(() => {
|
|
695
|
+
scheduleFlush(() => {
|
|
696
|
+
doShell();
|
|
697
|
+
if (!shellCompleted) return flush();
|
|
698
|
+
const encoder = new TextEncoder();
|
|
699
|
+
const writer = w.getWriter();
|
|
700
|
+
let pendingWrites = Promise.resolve();
|
|
701
|
+
writable = {
|
|
702
|
+
end() {
|
|
703
|
+
pendingWrites.then(() => {
|
|
704
|
+
writer.releaseLock();
|
|
705
|
+
w.close().catch(() => {});
|
|
706
|
+
resolve();
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
buffer = {
|
|
711
|
+
write(payload) {
|
|
712
|
+
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(() => {});
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
buffer.write(tmp);
|
|
716
|
+
firstFlushed = true;
|
|
717
|
+
if (completed) {
|
|
718
|
+
dispose();
|
|
719
|
+
writable.end();
|
|
720
|
+
} else flushEnd();
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
flush();
|
|
725
|
+
return p;
|
|
726
|
+
};
|
|
665
727
|
return {
|
|
666
728
|
then(fn) {
|
|
667
729
|
function complete() {
|
|
@@ -686,6 +748,7 @@ function renderToStream(code, options = {}) {
|
|
|
686
748
|
flush();
|
|
687
749
|
},
|
|
688
750
|
pipe(w) {
|
|
751
|
+
claimConsumer("pipe");
|
|
689
752
|
function flush() {
|
|
690
753
|
allSettled(blockingPromises).then(() => {
|
|
691
754
|
scheduleFlush(() => {
|
|
@@ -704,38 +767,17 @@ function renderToStream(code, options = {}) {
|
|
|
704
767
|
flush();
|
|
705
768
|
},
|
|
706
769
|
pipeTo(w) {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
writable = {
|
|
717
|
-
end() {
|
|
718
|
-
writer.releaseLock();
|
|
719
|
-
w.close().catch(() => {});
|
|
720
|
-
resolve();
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
buffer = {
|
|
724
|
-
write(payload) {
|
|
725
|
-
writer.write(encoder.encode(payload)).catch(() => {});
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
buffer.write(tmp);
|
|
729
|
-
firstFlushed = true;
|
|
730
|
-
if (completed) {
|
|
731
|
-
dispose();
|
|
732
|
-
writable.end();
|
|
733
|
-
} else flushEnd();
|
|
734
|
-
});
|
|
735
|
-
});
|
|
770
|
+
claimConsumer("pipeTo");
|
|
771
|
+
return pipeToImpl(w);
|
|
772
|
+
},
|
|
773
|
+
get readable() {
|
|
774
|
+
claimConsumer("readable");
|
|
775
|
+
if (!cachedReadable) {
|
|
776
|
+
const t = new TransformStream();
|
|
777
|
+
pipeToImpl(t.writable);
|
|
778
|
+
cachedReadable = t.readable;
|
|
736
779
|
}
|
|
737
|
-
|
|
738
|
-
return p;
|
|
780
|
+
return cachedReadable;
|
|
739
781
|
}
|
|
740
782
|
};
|
|
741
783
|
}
|
|
@@ -1426,6 +1468,37 @@ function Portal(props) {
|
|
|
1426
1468
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
1427
1469
|
return undefined;
|
|
1428
1470
|
}
|
|
1471
|
+
function clientOnly(_fn, _options = {}) {
|
|
1472
|
+
return props => solidJs.createMemo(() => props.fallback);
|
|
1473
|
+
}
|
|
1474
|
+
function httpStatus(code, text) {
|
|
1475
|
+
const event = getRequestEvent();
|
|
1476
|
+
const response = event && event.response;
|
|
1477
|
+
if (response && !response.committed) {
|
|
1478
|
+
const prevStatus = response.status;
|
|
1479
|
+
const prevStatusText = response.statusText;
|
|
1480
|
+
response.status = code;
|
|
1481
|
+
response.statusText = text;
|
|
1482
|
+
solidJs.onCleanup(() => {
|
|
1483
|
+
if (response.committed) return;
|
|
1484
|
+
response.status = prevStatus;
|
|
1485
|
+
response.statusText = prevStatusText;
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
function httpHeader(name, value, options) {
|
|
1490
|
+
const event = getRequestEvent();
|
|
1491
|
+
const response = event && event.response;
|
|
1492
|
+
if (response && !response.committed) {
|
|
1493
|
+
const headers = response.headers;
|
|
1494
|
+
const prev = headers.get(name);
|
|
1495
|
+
if (options && options.append) headers.append(name, value);else headers.set(name, value);
|
|
1496
|
+
solidJs.onCleanup(() => {
|
|
1497
|
+
if (response.committed) return;
|
|
1498
|
+
if (prev === null) headers.delete(name);else headers.set(name, prev);
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1429
1502
|
|
|
1430
1503
|
Object.defineProperty(exports, "Errored", {
|
|
1431
1504
|
enumerable: true,
|
|
@@ -1511,6 +1584,7 @@ exports.assign = notSup;
|
|
|
1511
1584
|
exports.claimElement = claimElement;
|
|
1512
1585
|
exports.claimElementTree = claimElementTree;
|
|
1513
1586
|
exports.className = notSup;
|
|
1587
|
+
exports.clientOnly = clientOnly;
|
|
1514
1588
|
exports.delegateEvents = notSup;
|
|
1515
1589
|
exports.dynamic = dynamic;
|
|
1516
1590
|
exports.dynamicProperty = notSup;
|
|
@@ -1524,6 +1598,8 @@ exports.getNextElement = notSup;
|
|
|
1524
1598
|
exports.getNextMarker = notSup;
|
|
1525
1599
|
exports.getNextMatch = notSup;
|
|
1526
1600
|
exports.getRequestEvent = getRequestEvent;
|
|
1601
|
+
exports.httpHeader = httpHeader;
|
|
1602
|
+
exports.httpStatus = httpStatus;
|
|
1527
1603
|
exports.hydrate = notSup;
|
|
1528
1604
|
exports.insert = notSup;
|
|
1529
1605
|
exports.isDev = isDev;
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId, onCleanup } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, ssrScope as scope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
@@ -198,7 +198,24 @@ function createAssetTracking() {
|
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function warnUnresolvedModuleAssets(moduleUrl, warned) {
|
|
202
|
+
if (warned.has(moduleUrl)) return;
|
|
203
|
+
warned.add(moduleUrl);
|
|
204
|
+
console.error(`Asset manifest returned no client assets for module "${moduleUrl}". ` + "If this module is a server-rendered lazy() component, its entry will be missing from " + "the serialized hydration asset map, the client will be unable to preload it, and " + "hydration will fail with 'lazy() module \"…\" was not preloaded before hydration'. " + "This means the integration's asset resolver (dev manifest bridge or build client " + "manifest) failed to answer for this module — check the integration's server logs, " + "restart the dev server, or verify the module is included in the client build.");
|
|
205
|
+
}
|
|
206
|
+
function guardResolvedAssets(moduleUrl, result, warned) {
|
|
207
|
+
if (result && typeof result.then === "function") {
|
|
208
|
+
return result.then(assets => {
|
|
209
|
+
if (!assets || !assets.js || !assets.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
210
|
+
return assets;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (!result || !result.js || !result.js.length) warnUnresolvedModuleAssets(moduleUrl, warned);
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
function applyAssetTracking(context, tracking, manifest, noScripts) {
|
|
217
|
+
const warned = new Set();
|
|
218
|
+
const guard = noScripts ? resolve => resolve : resolve => moduleUrl => guardResolvedAssets(moduleUrl, resolve(moduleUrl), warned);
|
|
202
219
|
Object.defineProperty(context, "_currentBoundaryId", {
|
|
203
220
|
get() {
|
|
204
221
|
return tracking.currentBoundaryId;
|
|
@@ -212,15 +229,15 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
212
229
|
context.registerModule = tracking.registerModule;
|
|
213
230
|
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
214
231
|
if (typeof manifest === "function") {
|
|
215
|
-
context.resolveAssets = manifest;
|
|
232
|
+
context.resolveAssets = guard(manifest);
|
|
216
233
|
} else if (manifest && typeof manifest.resolve === "function") {
|
|
217
|
-
context.resolveAssets = key => manifest.resolve(key);
|
|
234
|
+
context.resolveAssets = guard(key => manifest.resolve(key));
|
|
218
235
|
if (typeof manifest.resolveSync === "function") {
|
|
219
236
|
context.resolveAssetsSync = key => manifest.resolveSync(key);
|
|
220
237
|
}
|
|
221
238
|
} else if (manifest) {
|
|
222
239
|
const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
223
|
-
context.resolveAssets = resolve;
|
|
240
|
+
context.resolveAssets = guard(resolve);
|
|
224
241
|
context.resolveAssetsSync = resolve;
|
|
225
242
|
}
|
|
226
243
|
}
|
|
@@ -276,7 +293,7 @@ function renderToString(code, options = {}) {
|
|
|
276
293
|
tracking.emittedAssets.add(value);
|
|
277
294
|
}
|
|
278
295
|
};
|
|
279
|
-
applyAssetTracking(sharedConfig.context, tracking, manifest);
|
|
296
|
+
applyAssetTracking(sharedConfig.context, tracking, manifest, noScripts);
|
|
280
297
|
registerEntryAssets(manifest);
|
|
281
298
|
let html = createRoot(d => {
|
|
282
299
|
setTimeout(d);
|
|
@@ -564,7 +581,7 @@ function renderToStream(code, options = {}) {
|
|
|
564
581
|
});
|
|
565
582
|
}
|
|
566
583
|
};
|
|
567
|
-
applyAssetTracking(context, tracking, manifest);
|
|
584
|
+
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
568
585
|
registerEntryAssets(manifest);
|
|
569
586
|
let html = createRoot(d => {
|
|
570
587
|
dispose = d;
|
|
@@ -661,6 +678,51 @@ function renderToStream(code, options = {}) {
|
|
|
661
678
|
drainTurn = 0;
|
|
662
679
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
663
680
|
};
|
|
681
|
+
let cachedReadable;
|
|
682
|
+
let consumer;
|
|
683
|
+
const claimConsumer = name => {
|
|
684
|
+
if (consumer && consumer !== name) {
|
|
685
|
+
throw new Error(`renderToStream result was already consumed via \`${consumer}\`; cannot also consume it via \`${name}\`. Use exactly one of \`pipe\`, \`pipeTo\`, or \`readable\`.`);
|
|
686
|
+
}
|
|
687
|
+
consumer = name;
|
|
688
|
+
};
|
|
689
|
+
const pipeToImpl = w => {
|
|
690
|
+
let resolve;
|
|
691
|
+
const p = new Promise(r => resolve = r);
|
|
692
|
+
function flush() {
|
|
693
|
+
allSettled(blockingPromises).then(() => {
|
|
694
|
+
scheduleFlush(() => {
|
|
695
|
+
doShell();
|
|
696
|
+
if (!shellCompleted) return flush();
|
|
697
|
+
const encoder = new TextEncoder();
|
|
698
|
+
const writer = w.getWriter();
|
|
699
|
+
let pendingWrites = Promise.resolve();
|
|
700
|
+
writable = {
|
|
701
|
+
end() {
|
|
702
|
+
pendingWrites.then(() => {
|
|
703
|
+
writer.releaseLock();
|
|
704
|
+
w.close().catch(() => {});
|
|
705
|
+
resolve();
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
buffer = {
|
|
710
|
+
write(payload) {
|
|
711
|
+
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(() => {});
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
buffer.write(tmp);
|
|
715
|
+
firstFlushed = true;
|
|
716
|
+
if (completed) {
|
|
717
|
+
dispose();
|
|
718
|
+
writable.end();
|
|
719
|
+
} else flushEnd();
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
flush();
|
|
724
|
+
return p;
|
|
725
|
+
};
|
|
664
726
|
return {
|
|
665
727
|
then(fn) {
|
|
666
728
|
function complete() {
|
|
@@ -685,6 +747,7 @@ function renderToStream(code, options = {}) {
|
|
|
685
747
|
flush();
|
|
686
748
|
},
|
|
687
749
|
pipe(w) {
|
|
750
|
+
claimConsumer("pipe");
|
|
688
751
|
function flush() {
|
|
689
752
|
allSettled(blockingPromises).then(() => {
|
|
690
753
|
scheduleFlush(() => {
|
|
@@ -703,38 +766,17 @@ function renderToStream(code, options = {}) {
|
|
|
703
766
|
flush();
|
|
704
767
|
},
|
|
705
768
|
pipeTo(w) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
writable = {
|
|
716
|
-
end() {
|
|
717
|
-
writer.releaseLock();
|
|
718
|
-
w.close().catch(() => {});
|
|
719
|
-
resolve();
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
buffer = {
|
|
723
|
-
write(payload) {
|
|
724
|
-
writer.write(encoder.encode(payload)).catch(() => {});
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
buffer.write(tmp);
|
|
728
|
-
firstFlushed = true;
|
|
729
|
-
if (completed) {
|
|
730
|
-
dispose();
|
|
731
|
-
writable.end();
|
|
732
|
-
} else flushEnd();
|
|
733
|
-
});
|
|
734
|
-
});
|
|
769
|
+
claimConsumer("pipeTo");
|
|
770
|
+
return pipeToImpl(w);
|
|
771
|
+
},
|
|
772
|
+
get readable() {
|
|
773
|
+
claimConsumer("readable");
|
|
774
|
+
if (!cachedReadable) {
|
|
775
|
+
const t = new TransformStream();
|
|
776
|
+
pipeToImpl(t.writable);
|
|
777
|
+
cachedReadable = t.readable;
|
|
735
778
|
}
|
|
736
|
-
|
|
737
|
-
return p;
|
|
779
|
+
return cachedReadable;
|
|
738
780
|
}
|
|
739
781
|
};
|
|
740
782
|
}
|
|
@@ -1425,5 +1467,36 @@ function Portal(props) {
|
|
|
1425
1467
|
if (o?.id != null) getNextChildId(o);
|
|
1426
1468
|
return undefined;
|
|
1427
1469
|
}
|
|
1470
|
+
function clientOnly(_fn, _options = {}) {
|
|
1471
|
+
return props => createMemo(() => props.fallback);
|
|
1472
|
+
}
|
|
1473
|
+
function httpStatus(code, text) {
|
|
1474
|
+
const event = getRequestEvent();
|
|
1475
|
+
const response = event && event.response;
|
|
1476
|
+
if (response && !response.committed) {
|
|
1477
|
+
const prevStatus = response.status;
|
|
1478
|
+
const prevStatusText = response.statusText;
|
|
1479
|
+
response.status = code;
|
|
1480
|
+
response.statusText = text;
|
|
1481
|
+
onCleanup(() => {
|
|
1482
|
+
if (response.committed) return;
|
|
1483
|
+
response.status = prevStatus;
|
|
1484
|
+
response.statusText = prevStatusText;
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
function httpHeader(name, value, options) {
|
|
1489
|
+
const event = getRequestEvent();
|
|
1490
|
+
const response = event && event.response;
|
|
1491
|
+
if (response && !response.committed) {
|
|
1492
|
+
const headers = response.headers;
|
|
1493
|
+
const prev = headers.get(name);
|
|
1494
|
+
if (options && options.append) headers.append(name, value);else headers.set(name, value);
|
|
1495
|
+
onCleanup(() => {
|
|
1496
|
+
if (response.committed) return;
|
|
1497
|
+
if (prev === null) headers.delete(name);else headers.set(name, prev);
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1428
1501
|
|
|
1429
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
|
1502
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clientOnly, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -828,7 +828,15 @@ function runHydrationEvents() {
|
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
function isHydrating(node) {
|
|
831
|
-
|
|
831
|
+
if (!solidJs.sharedConfig.hydrating) return false;
|
|
832
|
+
if (!node || node.isConnected) return true;
|
|
833
|
+
const roots = solidJs.sharedConfig.claimRoots;
|
|
834
|
+
if (roots) {
|
|
835
|
+
for (let i = 0; i < roots.length; i++) {
|
|
836
|
+
if (roots[i].contains(node)) return true;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return false;
|
|
832
840
|
}
|
|
833
841
|
function classListToObject(classList) {
|
|
834
842
|
if (Array.isArray(classList)) {
|
|
@@ -877,7 +885,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
877
885
|
}
|
|
878
886
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
879
887
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
880
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
888
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
889
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
881
890
|
} else {
|
|
882
891
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
883
892
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1269,6 +1278,32 @@ function createElement(tagName, is = undefined) {
|
|
|
1269
1278
|
is
|
|
1270
1279
|
});
|
|
1271
1280
|
}
|
|
1281
|
+
function loadClientOnly(fn, setComp) {
|
|
1282
|
+
fn().then(m => setComp(() => m.default));
|
|
1283
|
+
}
|
|
1284
|
+
function clientOnly(fn, options = {}) {
|
|
1285
|
+
const [comp, setComp] = solidJs.createSignal();
|
|
1286
|
+
let started = !options.lazy;
|
|
1287
|
+
started && loadClientOnly(fn, setComp);
|
|
1288
|
+
return props => {
|
|
1289
|
+
let Comp;
|
|
1290
|
+
let m;
|
|
1291
|
+
const rest = solidJs.omit(props, "fallback");
|
|
1292
|
+
if (!started) {
|
|
1293
|
+
started = true;
|
|
1294
|
+
loadClientOnly(fn, setComp);
|
|
1295
|
+
}
|
|
1296
|
+
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1297
|
+
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1298
|
+
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1299
|
+
solidJs.onSettled(() => {
|
|
1300
|
+
setMounted(true);
|
|
1301
|
+
});
|
|
1302
|
+
return gate;
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
function httpStatus(_code, _text) {}
|
|
1306
|
+
function httpHeader(_name, _value, _options) {}
|
|
1272
1307
|
|
|
1273
1308
|
Object.defineProperty(exports, "Errored", {
|
|
1274
1309
|
enumerable: true,
|
|
@@ -1346,6 +1381,7 @@ exports.assign = assign;
|
|
|
1346
1381
|
exports.claimElement = claimElement;
|
|
1347
1382
|
exports.claimElementTree = claimElementTree;
|
|
1348
1383
|
exports.className = className;
|
|
1384
|
+
exports.clientOnly = clientOnly;
|
|
1349
1385
|
exports.delegateEvents = delegateEvents;
|
|
1350
1386
|
exports.dynamic = dynamic;
|
|
1351
1387
|
exports.dynamicProperty = dynamicProperty;
|
|
@@ -1361,6 +1397,8 @@ exports.getNextMarker = getNextMarker;
|
|
|
1361
1397
|
exports.getNextMatch = getNextMatch;
|
|
1362
1398
|
exports.getNextSibling = getNextSibling;
|
|
1363
1399
|
exports.getRequestEvent = voidFn;
|
|
1400
|
+
exports.httpHeader = httpHeader;
|
|
1401
|
+
exports.httpStatus = httpStatus;
|
|
1364
1402
|
exports.hydrate = hydrate;
|
|
1365
1403
|
exports.insert = insert;
|
|
1366
1404
|
exports.installHydrationRuntime = installHydrationRuntime;
|