solid-js 1.3.0-beta.7 → 1.3.0-beta.8
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 +6 -13
- package/dist/dev.js +6 -13
- package/dist/solid.cjs +6 -13
- package/dist/solid.js +6 -13
- package/package.json +2 -2
- package/types/reactive/signal.d.ts +1 -1
- package/web/dist/server.cjs +4 -3
- package/web/dist/server.js +4 -3
package/dist/dev.cjs
CHANGED
|
@@ -247,13 +247,12 @@ function createResource(source, fetcher, options) {
|
|
|
247
247
|
pr = null,
|
|
248
248
|
initP = null,
|
|
249
249
|
id = null,
|
|
250
|
-
ctx,
|
|
251
250
|
loadedUnderTransition = false,
|
|
252
251
|
dynamic = typeof source === "function";
|
|
253
252
|
if (sharedConfig.context) {
|
|
254
253
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
255
|
-
|
|
256
|
-
};
|
|
254
|
+
({ ...sharedConfig.context
|
|
255
|
+
});
|
|
257
256
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
258
257
|
}
|
|
259
258
|
function loadEnd(p, v, e) {
|
|
@@ -271,14 +270,7 @@ function createResource(source, fetcher, options) {
|
|
|
271
270
|
}
|
|
272
271
|
completeLoad(v);
|
|
273
272
|
}, false);
|
|
274
|
-
} else
|
|
275
|
-
if (p === initP) setHydrateContext(ctx);
|
|
276
|
-
completeLoad(v);
|
|
277
|
-
if (p === initP) {
|
|
278
|
-
initP = null;
|
|
279
|
-
setHydrateContext();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
273
|
+
} else completeLoad(v);
|
|
282
274
|
}
|
|
283
275
|
return v;
|
|
284
276
|
}
|
|
@@ -316,7 +308,8 @@ function createResource(source, fetcher, options) {
|
|
|
316
308
|
return;
|
|
317
309
|
}
|
|
318
310
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
319
|
-
const p =
|
|
311
|
+
const p = initP || untrack(() => fetcher(lookup, s));
|
|
312
|
+
initP = null;
|
|
320
313
|
if (typeof p !== "object" || !("then" in p)) {
|
|
321
314
|
loadEnd(pr, p);
|
|
322
315
|
return;
|
|
@@ -1488,7 +1481,7 @@ function Suspense(props) {
|
|
|
1488
1481
|
waitingHydration = true;
|
|
1489
1482
|
setHydrateContext(ctx);
|
|
1490
1483
|
set();
|
|
1491
|
-
setHydrateContext(
|
|
1484
|
+
setHydrateContext();
|
|
1492
1485
|
waitingHydration = false;
|
|
1493
1486
|
});
|
|
1494
1487
|
}
|
package/dist/dev.js
CHANGED
|
@@ -243,13 +243,12 @@ function createResource(source, fetcher, options) {
|
|
|
243
243
|
pr = null,
|
|
244
244
|
initP = null,
|
|
245
245
|
id = null,
|
|
246
|
-
ctx,
|
|
247
246
|
loadedUnderTransition = false,
|
|
248
247
|
dynamic = typeof source === "function";
|
|
249
248
|
if (sharedConfig.context) {
|
|
250
249
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
251
|
-
|
|
252
|
-
};
|
|
250
|
+
({ ...sharedConfig.context
|
|
251
|
+
});
|
|
253
252
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
254
253
|
}
|
|
255
254
|
function loadEnd(p, v, e) {
|
|
@@ -267,14 +266,7 @@ function createResource(source, fetcher, options) {
|
|
|
267
266
|
}
|
|
268
267
|
completeLoad(v);
|
|
269
268
|
}, false);
|
|
270
|
-
} else
|
|
271
|
-
if (p === initP) setHydrateContext(ctx);
|
|
272
|
-
completeLoad(v);
|
|
273
|
-
if (p === initP) {
|
|
274
|
-
initP = null;
|
|
275
|
-
setHydrateContext();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
269
|
+
} else completeLoad(v);
|
|
278
270
|
}
|
|
279
271
|
return v;
|
|
280
272
|
}
|
|
@@ -312,7 +304,8 @@ function createResource(source, fetcher, options) {
|
|
|
312
304
|
return;
|
|
313
305
|
}
|
|
314
306
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
315
|
-
const p =
|
|
307
|
+
const p = initP || untrack(() => fetcher(lookup, s));
|
|
308
|
+
initP = null;
|
|
316
309
|
if (typeof p !== "object" || !("then" in p)) {
|
|
317
310
|
loadEnd(pr, p);
|
|
318
311
|
return;
|
|
@@ -1484,7 +1477,7 @@ function Suspense(props) {
|
|
|
1484
1477
|
waitingHydration = true;
|
|
1485
1478
|
setHydrateContext(ctx);
|
|
1486
1479
|
set();
|
|
1487
|
-
setHydrateContext(
|
|
1480
|
+
setHydrateContext();
|
|
1488
1481
|
waitingHydration = false;
|
|
1489
1482
|
});
|
|
1490
1483
|
}
|
package/dist/solid.cjs
CHANGED
|
@@ -244,13 +244,12 @@ function createResource(source, fetcher, options) {
|
|
|
244
244
|
pr = null,
|
|
245
245
|
initP = null,
|
|
246
246
|
id = null,
|
|
247
|
-
ctx,
|
|
248
247
|
loadedUnderTransition = false,
|
|
249
248
|
dynamic = typeof source === "function";
|
|
250
249
|
if (sharedConfig.context) {
|
|
251
250
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
252
|
-
|
|
253
|
-
};
|
|
251
|
+
({ ...sharedConfig.context
|
|
252
|
+
});
|
|
254
253
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
255
254
|
}
|
|
256
255
|
function loadEnd(p, v, e) {
|
|
@@ -268,14 +267,7 @@ function createResource(source, fetcher, options) {
|
|
|
268
267
|
}
|
|
269
268
|
completeLoad(v);
|
|
270
269
|
}, false);
|
|
271
|
-
} else
|
|
272
|
-
if (p === initP) setHydrateContext(ctx);
|
|
273
|
-
completeLoad(v);
|
|
274
|
-
if (p === initP) {
|
|
275
|
-
initP = null;
|
|
276
|
-
setHydrateContext();
|
|
277
|
-
}
|
|
278
|
-
}
|
|
270
|
+
} else completeLoad(v);
|
|
279
271
|
}
|
|
280
272
|
return v;
|
|
281
273
|
}
|
|
@@ -313,7 +305,8 @@ function createResource(source, fetcher, options) {
|
|
|
313
305
|
return;
|
|
314
306
|
}
|
|
315
307
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
316
|
-
const p =
|
|
308
|
+
const p = initP || untrack(() => fetcher(lookup, s));
|
|
309
|
+
initP = null;
|
|
317
310
|
if (typeof p !== "object" || !("then" in p)) {
|
|
318
311
|
loadEnd(pr, p);
|
|
319
312
|
return;
|
|
@@ -1412,7 +1405,7 @@ function Suspense(props) {
|
|
|
1412
1405
|
waitingHydration = true;
|
|
1413
1406
|
setHydrateContext(ctx);
|
|
1414
1407
|
set();
|
|
1415
|
-
setHydrateContext(
|
|
1408
|
+
setHydrateContext();
|
|
1416
1409
|
waitingHydration = false;
|
|
1417
1410
|
});
|
|
1418
1411
|
}
|
package/dist/solid.js
CHANGED
|
@@ -240,13 +240,12 @@ function createResource(source, fetcher, options) {
|
|
|
240
240
|
pr = null,
|
|
241
241
|
initP = null,
|
|
242
242
|
id = null,
|
|
243
|
-
ctx,
|
|
244
243
|
loadedUnderTransition = false,
|
|
245
244
|
dynamic = typeof source === "function";
|
|
246
245
|
if (sharedConfig.context) {
|
|
247
246
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
248
|
-
|
|
249
|
-
};
|
|
247
|
+
({ ...sharedConfig.context
|
|
248
|
+
});
|
|
250
249
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
251
250
|
}
|
|
252
251
|
function loadEnd(p, v, e) {
|
|
@@ -264,14 +263,7 @@ function createResource(source, fetcher, options) {
|
|
|
264
263
|
}
|
|
265
264
|
completeLoad(v);
|
|
266
265
|
}, false);
|
|
267
|
-
} else
|
|
268
|
-
if (p === initP) setHydrateContext(ctx);
|
|
269
|
-
completeLoad(v);
|
|
270
|
-
if (p === initP) {
|
|
271
|
-
initP = null;
|
|
272
|
-
setHydrateContext();
|
|
273
|
-
}
|
|
274
|
-
}
|
|
266
|
+
} else completeLoad(v);
|
|
275
267
|
}
|
|
276
268
|
return v;
|
|
277
269
|
}
|
|
@@ -309,7 +301,8 @@ function createResource(source, fetcher, options) {
|
|
|
309
301
|
return;
|
|
310
302
|
}
|
|
311
303
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
312
|
-
const p =
|
|
304
|
+
const p = initP || untrack(() => fetcher(lookup, s));
|
|
305
|
+
initP = null;
|
|
313
306
|
if (typeof p !== "object" || !("then" in p)) {
|
|
314
307
|
loadEnd(pr, p);
|
|
315
308
|
return;
|
|
@@ -1408,7 +1401,7 @@ function Suspense(props) {
|
|
|
1408
1401
|
waitingHydration = true;
|
|
1409
1402
|
setHydrateContext(ctx);
|
|
1410
1403
|
set();
|
|
1411
|
-
setHydrateContext(
|
|
1404
|
+
setHydrateContext();
|
|
1412
1405
|
waitingHydration = false;
|
|
1413
1406
|
});
|
|
1414
1407
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.3.0-beta.
|
|
4
|
+
"version": "1.3.0-beta.8",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "d63c43c95c224cb4c4dc4f5c8681b9be3c62f1c9"
|
|
148
148
|
}
|
|
@@ -200,7 +200,7 @@ export declare type ResourceOptions<T> = T extends undefined ? {
|
|
|
200
200
|
/**
|
|
201
201
|
* Creates a resource that wraps a repeated promise in a reactive pattern:
|
|
202
202
|
* ```typescript
|
|
203
|
-
* const [resource, { mutate, refetch }] =
|
|
203
|
+
* const [resource, { mutate, refetch }] = createResource(source, fetcher, options);
|
|
204
204
|
* ```
|
|
205
205
|
* @param source - reactive data function to toggle the request, optional
|
|
206
206
|
* @param fetcher - function that receives the source (or true) and an accessor for the last or initial value and returns a value or a Promise with the value:
|
package/web/dist/server.cjs
CHANGED
|
@@ -358,8 +358,8 @@ function renderToStream(code, options = {}) {
|
|
|
358
358
|
tasks.push(`_$HY.init("${id}")`);
|
|
359
359
|
p.then(d => {
|
|
360
360
|
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", ${devalue(d)})</script>`);
|
|
361
|
-
}).catch(
|
|
362
|
-
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", null)</script>`);
|
|
361
|
+
}).catch(err => {
|
|
362
|
+
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", null, ${serializeError(err)})</script>`);
|
|
363
363
|
});
|
|
364
364
|
},
|
|
365
365
|
registerFragment(key) {
|
|
@@ -404,6 +404,7 @@ function renderToStream(code, options = {}) {
|
|
|
404
404
|
const writer = w.getWriter();
|
|
405
405
|
writable = {
|
|
406
406
|
end() {
|
|
407
|
+
writer.releaseLock();
|
|
407
408
|
w.close();
|
|
408
409
|
}
|
|
409
410
|
};
|
|
@@ -573,7 +574,7 @@ function generateHydrationScript({
|
|
|
573
574
|
eventNames = ["click", "input"],
|
|
574
575
|
nonce
|
|
575
576
|
}) {
|
|
576
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>((e,t,o={})=>{t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let
|
|
577
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>((e,t,o={})=>{t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,n=t(s);n&&!e.completed.has(n)&&e.events.push([n,o])})))),e.init=(e,t,s)=>{o[e]=[new Promise(((e,o)=>(t=e,s=o))),t,s]},e.set=(e,t,s,n)=>{(n=o[e])&&(s?n[2](s):n[1](t)),o[e]=[t]},e.unset=e=>{delete o[e]},e.load=(e,t)=>{if(t=o[e])return t[0]}})(window._$HY||(_$HY={events:[],completed:new WeakSet}))</script><!xs>`;
|
|
577
578
|
}
|
|
578
579
|
function injectAssets(assets, html) {
|
|
579
580
|
for (let i = 0; i < assets.length; i++) {
|
package/web/dist/server.js
CHANGED
|
@@ -355,8 +355,8 @@ function renderToStream(code, options = {}) {
|
|
|
355
355
|
tasks.push(`_$HY.init("${id}")`);
|
|
356
356
|
p.then(d => {
|
|
357
357
|
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", ${devalue(d)})</script>`);
|
|
358
|
-
}).catch(
|
|
359
|
-
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", null)</script>`);
|
|
358
|
+
}).catch(err => {
|
|
359
|
+
!completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", null, ${serializeError(err)})</script>`);
|
|
360
360
|
});
|
|
361
361
|
},
|
|
362
362
|
registerFragment(key) {
|
|
@@ -401,6 +401,7 @@ function renderToStream(code, options = {}) {
|
|
|
401
401
|
const writer = w.getWriter();
|
|
402
402
|
writable = {
|
|
403
403
|
end() {
|
|
404
|
+
writer.releaseLock();
|
|
404
405
|
w.close();
|
|
405
406
|
}
|
|
406
407
|
};
|
|
@@ -570,7 +571,7 @@ function generateHydrationScript({
|
|
|
570
571
|
eventNames = ["click", "input"],
|
|
571
572
|
nonce
|
|
572
573
|
}) {
|
|
573
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>((e,t,o={})=>{t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let
|
|
574
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>((e,t,o={})=>{t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,n=t(s);n&&!e.completed.has(n)&&e.events.push([n,o])})))),e.init=(e,t,s)=>{o[e]=[new Promise(((e,o)=>(t=e,s=o))),t,s]},e.set=(e,t,s,n)=>{(n=o[e])&&(s?n[2](s):n[1](t)),o[e]=[t]},e.unset=e=>{delete o[e]},e.load=(e,t)=>{if(t=o[e])return t[0]}})(window._$HY||(_$HY={events:[],completed:new WeakSet}))</script><!xs>`;
|
|
574
575
|
}
|
|
575
576
|
function injectAssets(assets, html) {
|
|
576
577
|
for (let i = 0; i < assets.length; i++) {
|