solid-js 1.9.9 → 1.9.11

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 CHANGED
@@ -1412,8 +1412,9 @@ function mergeProps(...sources) {
1412
1412
  return target;
1413
1413
  }
1414
1414
  function splitProps(props, ...keys) {
1415
+ const len = keys.length;
1415
1416
  if (SUPPORTS_PROXY && $PROXY in props) {
1416
- const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1417
+ const blocked = len > 1 ? keys.flat() : keys[0];
1417
1418
  const res = keys.map(k => {
1418
1419
  return new Proxy({
1419
1420
  get(property) {
@@ -1429,36 +1430,34 @@ function splitProps(props, ...keys) {
1429
1430
  });
1430
1431
  res.push(new Proxy({
1431
1432
  get(property) {
1432
- return blocked.has(property) ? undefined : props[property];
1433
+ return blocked.includes(property) ? undefined : props[property];
1433
1434
  },
1434
1435
  has(property) {
1435
- return blocked.has(property) ? false : property in props;
1436
+ return blocked.includes(property) ? false : property in props;
1436
1437
  },
1437
1438
  keys() {
1438
- return Object.keys(props).filter(k => !blocked.has(k));
1439
+ return Object.keys(props).filter(k => !blocked.includes(k));
1439
1440
  }
1440
1441
  }, propTraps));
1441
1442
  return res;
1442
1443
  }
1443
- const otherObject = {};
1444
- const objects = keys.map(() => ({}));
1444
+ const objects = [];
1445
+ for (let i = 0; i <= len; i++) {
1446
+ objects[i] = {};
1447
+ }
1445
1448
  for (const propName of Object.getOwnPropertyNames(props)) {
1446
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1447
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1448
- let blocked = false;
1449
- let objectIndex = 0;
1450
- for (const k of keys) {
1451
- if (k.includes(propName)) {
1452
- blocked = true;
1453
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1449
+ let keyIndex = len;
1450
+ for (let i = 0; i < keys.length; i++) {
1451
+ if (keys[i].includes(propName)) {
1452
+ keyIndex = i;
1453
+ break;
1454
1454
  }
1455
- ++objectIndex;
1456
- }
1457
- if (!blocked) {
1458
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1459
1455
  }
1456
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
1457
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1458
+ isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
1460
1459
  }
1461
- return [...objects, otherObject];
1460
+ return objects;
1462
1461
  }
1463
1462
  function lazy(fn) {
1464
1463
  let comp;
package/dist/dev.js CHANGED
@@ -1410,8 +1410,9 @@ function mergeProps(...sources) {
1410
1410
  return target;
1411
1411
  }
1412
1412
  function splitProps(props, ...keys) {
1413
+ const len = keys.length;
1413
1414
  if (SUPPORTS_PROXY && $PROXY in props) {
1414
- const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1415
+ const blocked = len > 1 ? keys.flat() : keys[0];
1415
1416
  const res = keys.map(k => {
1416
1417
  return new Proxy({
1417
1418
  get(property) {
@@ -1427,36 +1428,34 @@ function splitProps(props, ...keys) {
1427
1428
  });
1428
1429
  res.push(new Proxy({
1429
1430
  get(property) {
1430
- return blocked.has(property) ? undefined : props[property];
1431
+ return blocked.includes(property) ? undefined : props[property];
1431
1432
  },
1432
1433
  has(property) {
1433
- return blocked.has(property) ? false : property in props;
1434
+ return blocked.includes(property) ? false : property in props;
1434
1435
  },
1435
1436
  keys() {
1436
- return Object.keys(props).filter(k => !blocked.has(k));
1437
+ return Object.keys(props).filter(k => !blocked.includes(k));
1437
1438
  }
1438
1439
  }, propTraps));
1439
1440
  return res;
1440
1441
  }
1441
- const otherObject = {};
1442
- const objects = keys.map(() => ({}));
1442
+ const objects = [];
1443
+ for (let i = 0; i <= len; i++) {
1444
+ objects[i] = {};
1445
+ }
1443
1446
  for (const propName of Object.getOwnPropertyNames(props)) {
1444
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1445
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1446
- let blocked = false;
1447
- let objectIndex = 0;
1448
- for (const k of keys) {
1449
- if (k.includes(propName)) {
1450
- blocked = true;
1451
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1447
+ let keyIndex = len;
1448
+ for (let i = 0; i < keys.length; i++) {
1449
+ if (keys[i].includes(propName)) {
1450
+ keyIndex = i;
1451
+ break;
1452
1452
  }
1453
- ++objectIndex;
1454
- }
1455
- if (!blocked) {
1456
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1457
1453
  }
1454
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
1455
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1456
+ isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
1458
1457
  }
1459
- return [...objects, otherObject];
1458
+ return objects;
1460
1459
  }
1461
1460
  function lazy(fn) {
1462
1461
  let comp;
package/dist/server.cjs CHANGED
@@ -529,34 +529,48 @@ function createResource(source, fetcher, options = {}) {
529
529
  if (sharedConfig.context.async && options.ssrLoadFrom !== "initial") {
530
530
  resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
531
531
  if (resource.ref) {
532
- if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
532
+ if (!resource.data && !resource.ref[0]._loading && !resource.ref[0].error) resource.ref[1].refetch();
533
533
  return resource.ref;
534
534
  }
535
535
  }
536
- const read = () => {
536
+ const prepareResource = () => {
537
537
  if (error) throw error;
538
538
  const resolved = options.ssrLoadFrom !== "initial" && sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
539
539
  if (!resolved && resourceContext) resourceContext.push(id);
540
- if (!resolved && read.loading) {
540
+ if (!resolved && read._loading) {
541
541
  const ctx = useContext(SuspenseContext);
542
542
  if (ctx) {
543
543
  ctx.resources.set(id, read);
544
544
  contexts.add(ctx);
545
545
  }
546
546
  }
547
- return resolved ? sharedConfig.context.resources[id].data : value;
547
+ return resolved;
548
+ };
549
+ const read = () => {
550
+ return prepareResource() ? sharedConfig.context.resources[id].data : value;
551
+ };
552
+ const loading = () => {
553
+ prepareResource();
554
+ return read._loading;
548
555
  };
549
- read.loading = false;
556
+ read._loading = false;
550
557
  read.error = undefined;
551
558
  read.state = "initialValue" in options ? "ready" : "unresolved";
552
- Object.defineProperty(read, "latest", {
553
- get() {
554
- return read();
559
+ Object.defineProperties(read, {
560
+ latest: {
561
+ get() {
562
+ return read();
563
+ }
564
+ },
565
+ loading: {
566
+ get() {
567
+ return loading();
568
+ }
555
569
  }
556
570
  });
557
571
  function load() {
558
572
  const ctx = sharedConfig.context;
559
- if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
573
+ if (!ctx.async) return read._loading = !!(typeof source === "function" ? source() : source);
560
574
  if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
561
575
  value = ctx.resources[id].data;
562
576
  return;
@@ -576,17 +590,17 @@ function createResource(source, fetcher, options = {}) {
576
590
  });
577
591
  }
578
592
  if (p != undefined && typeof p === "object" && "then" in p) {
579
- read.loading = true;
593
+ read._loading = true;
580
594
  read.state = "pending";
581
595
  p = p.then(res => {
582
- read.loading = false;
596
+ read._loading = false;
583
597
  read.state = "ready";
584
598
  ctx.resources[id].data = res;
585
599
  p = null;
586
600
  notifySuspense(contexts);
587
601
  return res;
588
602
  }).catch(err => {
589
- read.loading = false;
603
+ read._loading = false;
590
604
  read.state = "errored";
591
605
  read.error = error = castError(err);
592
606
  p = null;
@@ -627,7 +641,7 @@ function lazy(fn) {
627
641
  if (p.resolved) return p.resolved(props);
628
642
  const ctx = useContext(SuspenseContext);
629
643
  const track = {
630
- loading: true,
644
+ _loading: true,
631
645
  error: undefined
632
646
  };
633
647
  if (ctx) {
@@ -636,7 +650,7 @@ function lazy(fn) {
636
650
  }
637
651
  if (sharedConfig.context.async) {
638
652
  sharedConfig.context.block(p.then(() => {
639
- track.loading = false;
653
+ track._loading = false;
640
654
  notifySuspense(contexts);
641
655
  }));
642
656
  }
@@ -647,7 +661,7 @@ function lazy(fn) {
647
661
  }
648
662
  function suspenseComplete(c) {
649
663
  for (const r of c.resources.values()) {
650
- if (r.loading) return false;
664
+ if (r._loading) return false;
651
665
  }
652
666
  return true;
653
667
  }
package/dist/server.js CHANGED
@@ -527,34 +527,48 @@ function createResource(source, fetcher, options = {}) {
527
527
  if (sharedConfig.context.async && options.ssrLoadFrom !== "initial") {
528
528
  resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
529
529
  if (resource.ref) {
530
- if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
530
+ if (!resource.data && !resource.ref[0]._loading && !resource.ref[0].error) resource.ref[1].refetch();
531
531
  return resource.ref;
532
532
  }
533
533
  }
534
- const read = () => {
534
+ const prepareResource = () => {
535
535
  if (error) throw error;
536
536
  const resolved = options.ssrLoadFrom !== "initial" && sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
537
537
  if (!resolved && resourceContext) resourceContext.push(id);
538
- if (!resolved && read.loading) {
538
+ if (!resolved && read._loading) {
539
539
  const ctx = useContext(SuspenseContext);
540
540
  if (ctx) {
541
541
  ctx.resources.set(id, read);
542
542
  contexts.add(ctx);
543
543
  }
544
544
  }
545
- return resolved ? sharedConfig.context.resources[id].data : value;
545
+ return resolved;
546
+ };
547
+ const read = () => {
548
+ return prepareResource() ? sharedConfig.context.resources[id].data : value;
549
+ };
550
+ const loading = () => {
551
+ prepareResource();
552
+ return read._loading;
546
553
  };
547
- read.loading = false;
554
+ read._loading = false;
548
555
  read.error = undefined;
549
556
  read.state = "initialValue" in options ? "ready" : "unresolved";
550
- Object.defineProperty(read, "latest", {
551
- get() {
552
- return read();
557
+ Object.defineProperties(read, {
558
+ latest: {
559
+ get() {
560
+ return read();
561
+ }
562
+ },
563
+ loading: {
564
+ get() {
565
+ return loading();
566
+ }
553
567
  }
554
568
  });
555
569
  function load() {
556
570
  const ctx = sharedConfig.context;
557
- if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
571
+ if (!ctx.async) return read._loading = !!(typeof source === "function" ? source() : source);
558
572
  if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
559
573
  value = ctx.resources[id].data;
560
574
  return;
@@ -574,17 +588,17 @@ function createResource(source, fetcher, options = {}) {
574
588
  });
575
589
  }
576
590
  if (p != undefined && typeof p === "object" && "then" in p) {
577
- read.loading = true;
591
+ read._loading = true;
578
592
  read.state = "pending";
579
593
  p = p.then(res => {
580
- read.loading = false;
594
+ read._loading = false;
581
595
  read.state = "ready";
582
596
  ctx.resources[id].data = res;
583
597
  p = null;
584
598
  notifySuspense(contexts);
585
599
  return res;
586
600
  }).catch(err => {
587
- read.loading = false;
601
+ read._loading = false;
588
602
  read.state = "errored";
589
603
  read.error = error = castError(err);
590
604
  p = null;
@@ -625,7 +639,7 @@ function lazy(fn) {
625
639
  if (p.resolved) return p.resolved(props);
626
640
  const ctx = useContext(SuspenseContext);
627
641
  const track = {
628
- loading: true,
642
+ _loading: true,
629
643
  error: undefined
630
644
  };
631
645
  if (ctx) {
@@ -634,7 +648,7 @@ function lazy(fn) {
634
648
  }
635
649
  if (sharedConfig.context.async) {
636
650
  sharedConfig.context.block(p.then(() => {
637
- track.loading = false;
651
+ track._loading = false;
638
652
  notifySuspense(contexts);
639
653
  }));
640
654
  }
@@ -645,7 +659,7 @@ function lazy(fn) {
645
659
  }
646
660
  function suspenseComplete(c) {
647
661
  for (const r of c.resources.values()) {
648
- if (r.loading) return false;
662
+ if (r._loading) return false;
649
663
  }
650
664
  return true;
651
665
  }
package/dist/solid.cjs CHANGED
@@ -1358,8 +1358,9 @@ function mergeProps(...sources) {
1358
1358
  return target;
1359
1359
  }
1360
1360
  function splitProps(props, ...keys) {
1361
+ const len = keys.length;
1361
1362
  if (SUPPORTS_PROXY && $PROXY in props) {
1362
- const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1363
+ const blocked = len > 1 ? keys.flat() : keys[0];
1363
1364
  const res = keys.map(k => {
1364
1365
  return new Proxy({
1365
1366
  get(property) {
@@ -1375,36 +1376,34 @@ function splitProps(props, ...keys) {
1375
1376
  });
1376
1377
  res.push(new Proxy({
1377
1378
  get(property) {
1378
- return blocked.has(property) ? undefined : props[property];
1379
+ return blocked.includes(property) ? undefined : props[property];
1379
1380
  },
1380
1381
  has(property) {
1381
- return blocked.has(property) ? false : property in props;
1382
+ return blocked.includes(property) ? false : property in props;
1382
1383
  },
1383
1384
  keys() {
1384
- return Object.keys(props).filter(k => !blocked.has(k));
1385
+ return Object.keys(props).filter(k => !blocked.includes(k));
1385
1386
  }
1386
1387
  }, propTraps));
1387
1388
  return res;
1388
1389
  }
1389
- const otherObject = {};
1390
- const objects = keys.map(() => ({}));
1390
+ const objects = [];
1391
+ for (let i = 0; i <= len; i++) {
1392
+ objects[i] = {};
1393
+ }
1391
1394
  for (const propName of Object.getOwnPropertyNames(props)) {
1392
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1393
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1394
- let blocked = false;
1395
- let objectIndex = 0;
1396
- for (const k of keys) {
1397
- if (k.includes(propName)) {
1398
- blocked = true;
1399
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1395
+ let keyIndex = len;
1396
+ for (let i = 0; i < keys.length; i++) {
1397
+ if (keys[i].includes(propName)) {
1398
+ keyIndex = i;
1399
+ break;
1400
1400
  }
1401
- ++objectIndex;
1402
- }
1403
- if (!blocked) {
1404
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1405
1401
  }
1402
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
1403
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1404
+ isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
1406
1405
  }
1407
- return [...objects, otherObject];
1406
+ return objects;
1408
1407
  }
1409
1408
  function lazy(fn) {
1410
1409
  let comp;
package/dist/solid.js CHANGED
@@ -1356,8 +1356,9 @@ function mergeProps(...sources) {
1356
1356
  return target;
1357
1357
  }
1358
1358
  function splitProps(props, ...keys) {
1359
+ const len = keys.length;
1359
1360
  if (SUPPORTS_PROXY && $PROXY in props) {
1360
- const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1361
+ const blocked = len > 1 ? keys.flat() : keys[0];
1361
1362
  const res = keys.map(k => {
1362
1363
  return new Proxy({
1363
1364
  get(property) {
@@ -1373,36 +1374,34 @@ function splitProps(props, ...keys) {
1373
1374
  });
1374
1375
  res.push(new Proxy({
1375
1376
  get(property) {
1376
- return blocked.has(property) ? undefined : props[property];
1377
+ return blocked.includes(property) ? undefined : props[property];
1377
1378
  },
1378
1379
  has(property) {
1379
- return blocked.has(property) ? false : property in props;
1380
+ return blocked.includes(property) ? false : property in props;
1380
1381
  },
1381
1382
  keys() {
1382
- return Object.keys(props).filter(k => !blocked.has(k));
1383
+ return Object.keys(props).filter(k => !blocked.includes(k));
1383
1384
  }
1384
1385
  }, propTraps));
1385
1386
  return res;
1386
1387
  }
1387
- const otherObject = {};
1388
- const objects = keys.map(() => ({}));
1388
+ const objects = [];
1389
+ for (let i = 0; i <= len; i++) {
1390
+ objects[i] = {};
1391
+ }
1389
1392
  for (const propName of Object.getOwnPropertyNames(props)) {
1390
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1391
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1392
- let blocked = false;
1393
- let objectIndex = 0;
1394
- for (const k of keys) {
1395
- if (k.includes(propName)) {
1396
- blocked = true;
1397
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1393
+ let keyIndex = len;
1394
+ for (let i = 0; i < keys.length; i++) {
1395
+ if (keys[i].includes(propName)) {
1396
+ keyIndex = i;
1397
+ break;
1398
1398
  }
1399
- ++objectIndex;
1400
- }
1401
- if (!blocked) {
1402
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1403
1399
  }
1400
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
1401
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1402
+ isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
1404
1403
  }
1405
- return [...objects, otherObject];
1404
+ return objects;
1406
1405
  }
1407
1406
  function lazy(fn) {
1408
1407
  let comp;
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.9.9",
4
+ "version": "1.9.11",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -215,15 +215,15 @@
215
215
  ],
216
216
  "dependencies": {
217
217
  "csstype": "^3.1.0",
218
- "seroval": "~1.3.0",
219
- "seroval-plugins": "~1.3.0"
218
+ "seroval": "~1.5.0",
219
+ "seroval-plugins": "~1.5.0"
220
220
  },
221
221
  "scripts": {
222
222
  "build": "npm-run-all -nl build:*",
223
- "build:clean": "rimraf dist/ coverage/ store/dist/ web/dist/ h/dist/ h/jsx-runtime/dist html/dist/",
223
+ "build:clean": "rimraf dist/ coverage/ store/dist/ web/dist/ web/storage/dist h/dist/ h/jsx-runtime/dist html/dist/ universal/dist/",
224
224
  "build:js": "rollup -c",
225
225
  "types": "npm-run-all -nl types:*",
226
- "types:clean": "rimraf types/ store/types/ web/types/ h/types/ h/jsx-runtime/types html/types/",
226
+ "types:clean": "rimraf types/ store/types/ web/types/ web/storage/types/ h/types/ h/jsx-runtime/types html/types/ universal/types/ src/jsx.d.ts h/jsx-runtime/src/jsx.d.ts",
227
227
  "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/src/jsx.d.ts",
228
228
  "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
229
229
  "types:web": "tsc --project ./web/tsconfig.build.json",
@@ -428,7 +428,7 @@ export interface OnOptions {
428
428
  * });
429
429
  * ```
430
430
  *
431
- * @description https://docs.solidjs.com/reference/reactive-utilities/on
431
+ * @description https://docs.solidjs.com/reference/reactive-utilities/on-util
432
432
  */
433
433
  export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options?: OnOptions & {
434
434
  defer?: false;
@@ -571,7 +571,7 @@ export declare function writeSignal(node: SignalState<any> | Memo<any>, value: a
571
571
  *
572
572
  * * If the error is thrown again inside the error handler, it will trigger the next available parent handler
573
573
  *
574
- * @description https://www.solidjs.com/docs/latest/api#onerror | https://docs.solidjs.com/reference/reactive-utilities/catch-error
574
+ * @description https://docs.solidjs.com/reference/reactive-utilities/catch-error
575
575
  */
576
576
  export declare function onError(fn: (err: Error) => void): void;
577
577
  export {};
@@ -29,7 +29,7 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
29
29
  * ```
30
30
  * If you have a list with changing indices, better use `<For>`.
31
31
  *
32
- * @description https://docs.solidjs.com/reference/components/index
32
+ * @description https://docs.solidjs.com/reference/components/index-component
33
33
  */
34
34
  export declare function Index<T extends readonly any[], U extends JSX.Element>(props: {
35
35
  each: T | undefined | null | false;
@@ -85,7 +85,7 @@ export interface Resource<T> {
85
85
  }
86
86
  type SuspenseContextType = {
87
87
  resources: Map<string, {
88
- loading: boolean;
88
+ _loading: boolean;
89
89
  error: any;
90
90
  }>;
91
91
  completed: () => void;
@@ -143,13 +143,16 @@ function createSerializer({
143
143
  onData,
144
144
  onDone,
145
145
  scopeId,
146
- onError
146
+ onError,
147
+ plugins: customPlugins
147
148
  }) {
149
+ const defaultPlugins = [web.AbortSignalPlugin,
150
+ web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
151
+ web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin];
152
+ const allPlugins = customPlugins ? [...customPlugins, ...defaultPlugins] : defaultPlugins;
148
153
  return new seroval.Serializer({
149
154
  scopeId,
150
- plugins: [web.AbortSignalPlugin,
151
- web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
152
- web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin],
155
+ plugins: allPlugins,
153
156
  globalIdentifier: GLOBAL_IDENTIFIER,
154
157
  disabledFeatures: ES2017FLAG,
155
158
  onData,
@@ -170,6 +173,7 @@ function renderToString(code, options = {}) {
170
173
  let scripts = "";
171
174
  const serializer = createSerializer({
172
175
  scopeId: renderId,
176
+ plugins: options.plugins,
173
177
  onData(script) {
174
178
  if (!scripts) {
175
179
  scripts = getLocalHeaderScript(renderId);
@@ -250,6 +254,7 @@ function renderToStream(code, options = {}) {
250
254
  };
251
255
  const serializer = createSerializer({
252
256
  scopeId: options.renderId,
257
+ plugins: options.plugins,
253
258
  onData: pushTask,
254
259
  onDone,
255
260
  onError: options.onError
@@ -535,7 +540,7 @@ function ssrAttribute(key, value, isBoolean) {
535
540
  }
536
541
  function ssrHydrationKey() {
537
542
  const hk = getHydrationKey();
538
- return hk ? ` data-hk=${hk}` : "";
543
+ return hk ? ` data-hk="${hk}"` : "";
539
544
  }
540
545
  function escape(s, attr) {
541
546
  const t = typeof s;
@@ -142,13 +142,16 @@ function createSerializer({
142
142
  onData,
143
143
  onDone,
144
144
  scopeId,
145
- onError
145
+ onError,
146
+ plugins: customPlugins
146
147
  }) {
148
+ const defaultPlugins = [AbortSignalPlugin,
149
+ CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
150
+ FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin];
151
+ const allPlugins = customPlugins ? [...customPlugins, ...defaultPlugins] : defaultPlugins;
147
152
  return new Serializer({
148
153
  scopeId,
149
- plugins: [AbortSignalPlugin,
150
- CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
151
- FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin],
154
+ plugins: allPlugins,
152
155
  globalIdentifier: GLOBAL_IDENTIFIER,
153
156
  disabledFeatures: ES2017FLAG,
154
157
  onData,
@@ -169,6 +172,7 @@ function renderToString(code, options = {}) {
169
172
  let scripts = "";
170
173
  const serializer = createSerializer({
171
174
  scopeId: renderId,
175
+ plugins: options.plugins,
172
176
  onData(script) {
173
177
  if (!scripts) {
174
178
  scripts = getLocalHeaderScript(renderId);
@@ -249,6 +253,7 @@ function renderToStream(code, options = {}) {
249
253
  };
250
254
  const serializer = createSerializer({
251
255
  scopeId: options.renderId,
256
+ plugins: options.plugins,
252
257
  onData: pushTask,
253
258
  onDone,
254
259
  onError: options.onError
@@ -534,7 +539,7 @@ function ssrAttribute(key, value, isBoolean) {
534
539
  }
535
540
  function ssrHydrationKey() {
536
541
  const hk = getHydrationKey();
537
- return hk ? ` data-hk=${hk}` : "";
542
+ return hk ? ` data-hk="${hk}"` : "";
538
543
  }
539
544
  function escape(s, attr) {
540
545
  const t = typeof s;