@solidjs/web 2.0.0-beta.17 → 2.0.0-beta.19
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 +138 -48
- package/dist/dev.js +134 -50
- package/dist/server.cjs +108 -23
- package/dist/server.js +105 -25
- package/dist/web.cjs +138 -48
- package/dist/web.js +134 -50
- package/package.json +100 -11
- package/serialization/dist/serialization.cjs +83 -0
- package/serialization/dist/serialization.js +75 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +139 -0
- package/serialization/types-cjs/index.d.cts +139 -0
- package/serialization/types-cjs/package.json +3 -0
- package/server-functions/dist/client.cjs +370 -0
- package/server-functions/dist/client.js +363 -0
- package/server-functions/dist/server.cjs +542 -0
- package/server-functions/dist/server.js +531 -0
- package/server-functions/package.json +30 -0
- package/storage/types/index.d.ts +28 -0
- package/storage/types-cjs/index.d.cts +28 -0
- package/types/index.d.ts +8 -1
- package/types/response.d.ts +93 -0
- package/types/serializer.d.ts +139 -0
- package/types/server-functions/client.d.ts +63 -0
- package/types/server-functions/server.d.ts +188 -0
- package/types/server-functions/shared.d.ts +171 -0
- package/types/server.d.ts +70 -15
- package/types-cjs/index.d.cts +8 -1
- package/types-cjs/response.d.cts +93 -0
- package/types-cjs/serializer.d.cts +139 -0
- package/types-cjs/server-functions/client.d.cts +63 -0
- package/types-cjs/server-functions/server.d.cts +188 -0
- package/types-cjs/server-functions/shared.d.cts +171 -0
- package/types-cjs/server.d.cts +70 -15
- package/storage/types/src/client.d.ts +0 -1
- package/storage/types/src/index.d.ts +0 -171
- package/storage/types/src/server-mock.d.ts +0 -161
- package/storage/types/storage/src/index.d.ts +0 -2
- package/storage/types-cjs/src/client.d.cts +0 -1
- package/storage/types-cjs/src/index.d.cts +0 -171
- package/storage/types-cjs/src/server-mock.d.cts +0 -161
- package/storage/types-cjs/storage/src/index.d.cts +0 -2
package/dist/server.cjs
CHANGED
|
@@ -48,9 +48,7 @@ const Namespaces = {
|
|
|
48
48
|
};
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
|
-
const DOMElements = /*#__PURE__*/new Set(
|
|
52
|
-
"webview",
|
|
53
|
-
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
51
|
+
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
54
52
|
|
|
55
53
|
const transparentOptions = {
|
|
56
54
|
transparent: true,
|
|
@@ -66,25 +64,32 @@ const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectF
|
|
|
66
64
|
} : transparentOptions);
|
|
67
65
|
const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
|
|
68
66
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
67
|
+
const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
|
|
68
|
+
const HYDRATION_GLOBAL = "_$HY.r";
|
|
69
|
+
const DEFAULT_WEB_PLUGINS = Object.freeze([web.AbortSignalPlugin,
|
|
70
|
+
web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
|
|
71
|
+
web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin]);
|
|
72
|
+
function resolveSerializerPlugins(customPlugins) {
|
|
73
|
+
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
74
|
+
}
|
|
75
|
+
function createSerializer(options) {
|
|
76
|
+
return new seroval.Serializer({
|
|
77
|
+
...options,
|
|
78
|
+
plugins: resolveSerializerPlugins(options.plugins),
|
|
79
|
+
disabledFeatures: options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function createHydrationSerializer({
|
|
73
83
|
onData,
|
|
74
84
|
onDone,
|
|
75
85
|
scopeId,
|
|
76
86
|
onError,
|
|
77
|
-
plugins
|
|
87
|
+
plugins
|
|
78
88
|
}) {
|
|
79
|
-
|
|
80
|
-
web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
|
|
81
|
-
web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin];
|
|
82
|
-
const allPlugins = customPlugins ? [...customPlugins, ...defaultPlugins] : defaultPlugins;
|
|
83
|
-
return new seroval.Serializer({
|
|
89
|
+
return createSerializer({
|
|
84
90
|
scopeId,
|
|
85
|
-
plugins
|
|
86
|
-
globalIdentifier:
|
|
87
|
-
disabledFeatures: ES2017FLAG,
|
|
91
|
+
plugins,
|
|
92
|
+
globalIdentifier: HYDRATION_GLOBAL,
|
|
88
93
|
onData,
|
|
89
94
|
onDone,
|
|
90
95
|
onError
|
|
@@ -93,6 +98,7 @@ function createSerializer({
|
|
|
93
98
|
function getLocalHeaderScript(id) {
|
|
94
99
|
return seroval.getCrossReferenceHeader(id) + ";";
|
|
95
100
|
}
|
|
101
|
+
seroval.Feature.RegExp;
|
|
96
102
|
|
|
97
103
|
function joinAssetPath(base, file) {
|
|
98
104
|
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(file)) return file;
|
|
@@ -124,7 +130,7 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
124
130
|
};
|
|
125
131
|
}
|
|
126
132
|
function registerEntryAssets(manifest) {
|
|
127
|
-
if (!manifest) return;
|
|
133
|
+
if (!manifest || typeof manifest === "function" || typeof manifest.resolve === "function") return;
|
|
128
134
|
const ctx = solidJs.sharedConfig.context;
|
|
129
135
|
if (!ctx?.registerAsset) return;
|
|
130
136
|
for (const key in manifest) {
|
|
@@ -205,10 +211,21 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
205
211
|
});
|
|
206
212
|
context.registerModule = tracking.registerModule;
|
|
207
213
|
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
208
|
-
if (manifest
|
|
214
|
+
if (typeof manifest === "function") {
|
|
215
|
+
context.resolveAssets = manifest;
|
|
216
|
+
} else if (manifest && typeof manifest.resolve === "function") {
|
|
217
|
+
context.resolveAssets = key => manifest.resolve(key);
|
|
218
|
+
if (typeof manifest.resolveSync === "function") {
|
|
219
|
+
context.resolveAssetsSync = key => manifest.resolveSync(key);
|
|
220
|
+
}
|
|
221
|
+
} else if (manifest) {
|
|
222
|
+
const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
223
|
+
context.resolveAssets = resolve;
|
|
224
|
+
context.resolveAssetsSync = resolve;
|
|
225
|
+
}
|
|
209
226
|
}
|
|
210
227
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
211
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))
|
|
228
|
+
const REPLACE_SCRIPT = `function $df(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;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(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])}`;
|
|
212
229
|
function renderToString(code, options = {}) {
|
|
213
230
|
const {
|
|
214
231
|
renderId = "",
|
|
@@ -217,7 +234,7 @@ function renderToString(code, options = {}) {
|
|
|
217
234
|
manifest
|
|
218
235
|
} = options;
|
|
219
236
|
let scripts = "";
|
|
220
|
-
const serializer =
|
|
237
|
+
const serializer = createHydrationSerializer({
|
|
221
238
|
scopeId: renderId,
|
|
222
239
|
plugins: options.plugins,
|
|
223
240
|
onData(script) {
|
|
@@ -311,7 +328,7 @@ function renderToStream(code, options = {}) {
|
|
|
311
328
|
completed = true;
|
|
312
329
|
if (firstFlushed) dispose();
|
|
313
330
|
};
|
|
314
|
-
const serializer =
|
|
331
|
+
const serializer = createHydrationSerializer({
|
|
315
332
|
scopeId: options.renderId,
|
|
316
333
|
plugins: options.plugins,
|
|
317
334
|
onData: pushTask,
|
|
@@ -1248,7 +1265,7 @@ function resolveSSRSync(node) {
|
|
|
1248
1265
|
if (!res.h.length) return res.t[0];
|
|
1249
1266
|
throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
|
|
1250
1267
|
}
|
|
1251
|
-
const RequestContext = Symbol();
|
|
1268
|
+
const RequestContext = Symbol.for("solid.RequestContext");
|
|
1252
1269
|
function getRequestEvent() {
|
|
1253
1270
|
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
|
|
1254
1271
|
}
|
|
@@ -1259,6 +1276,67 @@ function notSup() {
|
|
|
1259
1276
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1260
1277
|
}
|
|
1261
1278
|
|
|
1279
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1280
|
+
class ResponseEnvelope {
|
|
1281
|
+
constructor(response, value) {
|
|
1282
|
+
this.response = response;
|
|
1283
|
+
this.value = value;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1287
|
+
function isResponseEnvelope(value) {
|
|
1288
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1289
|
+
}
|
|
1290
|
+
function initWithRevalidate(init) {
|
|
1291
|
+
const {
|
|
1292
|
+
revalidate,
|
|
1293
|
+
...responseInit
|
|
1294
|
+
} = init;
|
|
1295
|
+
const headers = new Headers(responseInit.headers);
|
|
1296
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1297
|
+
return {
|
|
1298
|
+
responseInit,
|
|
1299
|
+
headers
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function redirect(url, init = 302) {
|
|
1303
|
+
const {
|
|
1304
|
+
responseInit,
|
|
1305
|
+
headers
|
|
1306
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1307
|
+
status: init
|
|
1308
|
+
} : init);
|
|
1309
|
+
if (responseInit.status === undefined) {
|
|
1310
|
+
responseInit.status = 302;
|
|
1311
|
+
}
|
|
1312
|
+
headers.set("Location", url);
|
|
1313
|
+
return new Response(null, {
|
|
1314
|
+
...responseInit,
|
|
1315
|
+
headers
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
function reload(init = {}) {
|
|
1319
|
+
const {
|
|
1320
|
+
responseInit,
|
|
1321
|
+
headers
|
|
1322
|
+
} = initWithRevalidate(init);
|
|
1323
|
+
return new Response(null, {
|
|
1324
|
+
...responseInit,
|
|
1325
|
+
headers
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
function respond(value, init = {}) {
|
|
1329
|
+
const {
|
|
1330
|
+
responseInit,
|
|
1331
|
+
headers
|
|
1332
|
+
} = initWithRevalidate(init);
|
|
1333
|
+
headers.set("Content-Type", "application/json");
|
|
1334
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1335
|
+
...responseInit,
|
|
1336
|
+
headers
|
|
1337
|
+
}), value);
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1262
1340
|
const isServer = true;
|
|
1263
1341
|
const isDev = false;
|
|
1264
1342
|
function dynamic(source) {
|
|
@@ -1305,7 +1383,9 @@ function Dynamic(props) {
|
|
|
1305
1383
|
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
1306
1384
|
}
|
|
1307
1385
|
function Portal(props) {
|
|
1308
|
-
|
|
1386
|
+
const o = solidJs.getOwner();
|
|
1387
|
+
if (o?.id != null) solidJs.getNextChildId(o);
|
|
1388
|
+
return undefined;
|
|
1309
1389
|
}
|
|
1310
1390
|
|
|
1311
1391
|
Object.defineProperty(exports, "Errored", {
|
|
@@ -1380,6 +1460,7 @@ exports.Namespaces = Namespaces;
|
|
|
1380
1460
|
exports.Portal = Portal;
|
|
1381
1461
|
exports.RawTextElements = RawTextElements;
|
|
1382
1462
|
exports.RequestContext = RequestContext;
|
|
1463
|
+
exports.ResponseEnvelope = ResponseEnvelope;
|
|
1383
1464
|
exports.SVGElements = SVGElements;
|
|
1384
1465
|
exports.VoidElements = VoidElements;
|
|
1385
1466
|
exports.acquireAsset = notSup;
|
|
@@ -1403,15 +1484,19 @@ exports.getRequestEvent = getRequestEvent;
|
|
|
1403
1484
|
exports.hydrate = notSup;
|
|
1404
1485
|
exports.insert = notSup;
|
|
1405
1486
|
exports.isDev = isDev;
|
|
1487
|
+
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1406
1488
|
exports.isServer = isServer;
|
|
1407
1489
|
exports.memo = memo;
|
|
1490
|
+
exports.redirect = redirect;
|
|
1408
1491
|
exports.ref = notSup;
|
|
1409
1492
|
exports.registerDelegatedContainer = notSup;
|
|
1410
1493
|
exports.registerDelegatedRoot = notSup;
|
|
1494
|
+
exports.reload = reload;
|
|
1411
1495
|
exports.render = notSup;
|
|
1412
1496
|
exports.renderToStream = renderToStream;
|
|
1413
1497
|
exports.renderToString = renderToString;
|
|
1414
1498
|
exports.renderToStringAsync = renderToStringAsync;
|
|
1499
|
+
exports.respond = respond;
|
|
1415
1500
|
exports.runHydrationEvents = notSup;
|
|
1416
1501
|
exports.setAttribute = notSup;
|
|
1417
1502
|
exports.setAttributeNS = notSup;
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId, NotReadyError } 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
|
-
import { Serializer,
|
|
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';
|
|
5
5
|
|
|
6
6
|
const DOMWithState = {
|
|
@@ -47,9 +47,7 @@ const Namespaces = {
|
|
|
47
47
|
};
|
|
48
48
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
49
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
|
-
const DOMElements = /*#__PURE__*/new Set(
|
|
51
|
-
"webview",
|
|
52
|
-
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
50
|
+
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
53
51
|
|
|
54
52
|
const transparentOptions = {
|
|
55
53
|
transparent: true,
|
|
@@ -65,25 +63,32 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
|
|
|
65
63
|
} : transparentOptions);
|
|
66
64
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
67
65
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
66
|
+
const DEFAULT_DISABLED_FEATURES = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
67
|
+
const HYDRATION_GLOBAL = "_$HY.r";
|
|
68
|
+
const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
|
|
69
|
+
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
70
|
+
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin]);
|
|
71
|
+
function resolveSerializerPlugins(customPlugins) {
|
|
72
|
+
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
73
|
+
}
|
|
74
|
+
function createSerializer(options) {
|
|
75
|
+
return new Serializer({
|
|
76
|
+
...options,
|
|
77
|
+
plugins: resolveSerializerPlugins(options.plugins),
|
|
78
|
+
disabledFeatures: options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function createHydrationSerializer({
|
|
72
82
|
onData,
|
|
73
83
|
onDone,
|
|
74
84
|
scopeId,
|
|
75
85
|
onError,
|
|
76
|
-
plugins
|
|
86
|
+
plugins
|
|
77
87
|
}) {
|
|
78
|
-
|
|
79
|
-
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
80
|
-
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin];
|
|
81
|
-
const allPlugins = customPlugins ? [...customPlugins, ...defaultPlugins] : defaultPlugins;
|
|
82
|
-
return new Serializer({
|
|
88
|
+
return createSerializer({
|
|
83
89
|
scopeId,
|
|
84
|
-
plugins
|
|
85
|
-
globalIdentifier:
|
|
86
|
-
disabledFeatures: ES2017FLAG,
|
|
90
|
+
plugins,
|
|
91
|
+
globalIdentifier: HYDRATION_GLOBAL,
|
|
87
92
|
onData,
|
|
88
93
|
onDone,
|
|
89
94
|
onError
|
|
@@ -92,6 +97,7 @@ function createSerializer({
|
|
|
92
97
|
function getLocalHeaderScript(id) {
|
|
93
98
|
return getCrossReferenceHeader(id) + ";";
|
|
94
99
|
}
|
|
100
|
+
Feature.RegExp;
|
|
95
101
|
|
|
96
102
|
function joinAssetPath(base, file) {
|
|
97
103
|
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(file)) return file;
|
|
@@ -123,7 +129,7 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
function registerEntryAssets(manifest) {
|
|
126
|
-
if (!manifest) return;
|
|
132
|
+
if (!manifest || typeof manifest === "function" || typeof manifest.resolve === "function") return;
|
|
127
133
|
const ctx = sharedConfig.context;
|
|
128
134
|
if (!ctx?.registerAsset) return;
|
|
129
135
|
for (const key in manifest) {
|
|
@@ -204,10 +210,21 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
204
210
|
});
|
|
205
211
|
context.registerModule = tracking.registerModule;
|
|
206
212
|
context.getBoundaryModules = tracking.getBoundaryModules;
|
|
207
|
-
if (manifest
|
|
213
|
+
if (typeof manifest === "function") {
|
|
214
|
+
context.resolveAssets = manifest;
|
|
215
|
+
} else if (manifest && typeof manifest.resolve === "function") {
|
|
216
|
+
context.resolveAssets = key => manifest.resolve(key);
|
|
217
|
+
if (typeof manifest.resolveSync === "function") {
|
|
218
|
+
context.resolveAssetsSync = key => manifest.resolveSync(key);
|
|
219
|
+
}
|
|
220
|
+
} else if (manifest) {
|
|
221
|
+
const resolve = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
222
|
+
context.resolveAssets = resolve;
|
|
223
|
+
context.resolveAssetsSync = resolve;
|
|
224
|
+
}
|
|
208
225
|
}
|
|
209
226
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
210
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))
|
|
227
|
+
const REPLACE_SCRIPT = `function $df(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;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(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])}`;
|
|
211
228
|
function renderToString(code, options = {}) {
|
|
212
229
|
const {
|
|
213
230
|
renderId = "",
|
|
@@ -216,7 +233,7 @@ function renderToString(code, options = {}) {
|
|
|
216
233
|
manifest
|
|
217
234
|
} = options;
|
|
218
235
|
let scripts = "";
|
|
219
|
-
const serializer =
|
|
236
|
+
const serializer = createHydrationSerializer({
|
|
220
237
|
scopeId: renderId,
|
|
221
238
|
plugins: options.plugins,
|
|
222
239
|
onData(script) {
|
|
@@ -310,7 +327,7 @@ function renderToStream(code, options = {}) {
|
|
|
310
327
|
completed = true;
|
|
311
328
|
if (firstFlushed) dispose();
|
|
312
329
|
};
|
|
313
|
-
const serializer =
|
|
330
|
+
const serializer = createHydrationSerializer({
|
|
314
331
|
scopeId: options.renderId,
|
|
315
332
|
plugins: options.plugins,
|
|
316
333
|
onData: pushTask,
|
|
@@ -1247,7 +1264,7 @@ function resolveSSRSync(node) {
|
|
|
1247
1264
|
if (!res.h.length) return res.t[0];
|
|
1248
1265
|
throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
|
|
1249
1266
|
}
|
|
1250
|
-
const RequestContext = Symbol();
|
|
1267
|
+
const RequestContext = Symbol.for("solid.RequestContext");
|
|
1251
1268
|
function getRequestEvent() {
|
|
1252
1269
|
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
|
|
1253
1270
|
}
|
|
@@ -1258,6 +1275,67 @@ function notSup() {
|
|
|
1258
1275
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1259
1276
|
}
|
|
1260
1277
|
|
|
1278
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1279
|
+
class ResponseEnvelope {
|
|
1280
|
+
constructor(response, value) {
|
|
1281
|
+
this.response = response;
|
|
1282
|
+
this.value = value;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1286
|
+
function isResponseEnvelope(value) {
|
|
1287
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1288
|
+
}
|
|
1289
|
+
function initWithRevalidate(init) {
|
|
1290
|
+
const {
|
|
1291
|
+
revalidate,
|
|
1292
|
+
...responseInit
|
|
1293
|
+
} = init;
|
|
1294
|
+
const headers = new Headers(responseInit.headers);
|
|
1295
|
+
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
|
|
1296
|
+
return {
|
|
1297
|
+
responseInit,
|
|
1298
|
+
headers
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
function redirect(url, init = 302) {
|
|
1302
|
+
const {
|
|
1303
|
+
responseInit,
|
|
1304
|
+
headers
|
|
1305
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1306
|
+
status: init
|
|
1307
|
+
} : init);
|
|
1308
|
+
if (responseInit.status === undefined) {
|
|
1309
|
+
responseInit.status = 302;
|
|
1310
|
+
}
|
|
1311
|
+
headers.set("Location", url);
|
|
1312
|
+
return new Response(null, {
|
|
1313
|
+
...responseInit,
|
|
1314
|
+
headers
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
function reload(init = {}) {
|
|
1318
|
+
const {
|
|
1319
|
+
responseInit,
|
|
1320
|
+
headers
|
|
1321
|
+
} = initWithRevalidate(init);
|
|
1322
|
+
return new Response(null, {
|
|
1323
|
+
...responseInit,
|
|
1324
|
+
headers
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
function respond(value, init = {}) {
|
|
1328
|
+
const {
|
|
1329
|
+
responseInit,
|
|
1330
|
+
headers
|
|
1331
|
+
} = initWithRevalidate(init);
|
|
1332
|
+
headers.set("Content-Type", "application/json");
|
|
1333
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1334
|
+
...responseInit,
|
|
1335
|
+
headers
|
|
1336
|
+
}), value);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1261
1339
|
const isServer = true;
|
|
1262
1340
|
const isDev = false;
|
|
1263
1341
|
function dynamic(source) {
|
|
@@ -1304,7 +1382,9 @@ function Dynamic(props) {
|
|
|
1304
1382
|
return createComponent(Comp, omit(props, "component"));
|
|
1305
1383
|
}
|
|
1306
1384
|
function Portal(props) {
|
|
1307
|
-
|
|
1385
|
+
const o = getOwner();
|
|
1386
|
+
if (o?.id != null) getNextChildId(o);
|
|
1387
|
+
return undefined;
|
|
1308
1388
|
}
|
|
1309
1389
|
|
|
1310
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, 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, isServer, memo, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, notSup as render, renderToStream, renderToString, renderToStringAsync, 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 };
|
|
1390
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, 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, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, 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 };
|