thunderous 2.1.0 → 2.1.1

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/index.cjs CHANGED
@@ -193,21 +193,27 @@ var getServerRenderArgs = (tagName, registry) => ({
193
193
  get elementRef() {
194
194
  return new Proxy({}, {
195
195
  get: () => {
196
- throw new Error("The `elementRef` property is not available on the server.");
196
+ const error = new Error("The `elementRef` property is not available on the server.");
197
+ console.error(error);
198
+ throw error;
197
199
  }
198
200
  });
199
201
  },
200
202
  get root() {
201
203
  return new Proxy({}, {
202
204
  get: () => {
203
- throw new Error("The `root` property is not available on the server.");
205
+ const error = new Error("The `root` property is not available on the server.");
206
+ console.error(error);
207
+ throw error;
204
208
  }
205
209
  });
206
210
  },
207
211
  get internals() {
208
212
  return new Proxy({}, {
209
213
  get: () => {
210
- throw new Error("The `internals` property is not available on the server.");
214
+ const error = new Error("The `internals` property is not available on the server.");
215
+ console.error(error);
216
+ throw error;
211
217
  }
212
218
  });
213
219
  },
@@ -399,9 +405,11 @@ var evaluateBindings = (element, fragment) => {
399
405
  const result = signal();
400
406
  const nextNode = createNewNode(result, element, uniqueKey);
401
407
  if (nextNode instanceof Text) {
402
- throw new TypeError(
408
+ const error = new TypeError(
403
409
  "Signal mismatch: expected DocumentFragment or Array<DocumentFragment>, but got Text"
404
410
  );
411
+ console.error(error);
412
+ throw error;
405
413
  }
406
414
  for (const child2 of element.children) {
407
415
  const key = child2.getAttribute("key");
@@ -616,7 +624,9 @@ var customElement = (render, options) => {
616
624
  return this;
617
625
  },
618
626
  eject() {
619
- throw new Error("Cannot eject a custom element on the server.");
627
+ const error = new Error("Cannot eject a custom element on the server.");
628
+ console.error(error);
629
+ throw error;
620
630
  }
621
631
  };
622
632
  }
@@ -714,15 +724,15 @@ var customElement = (render, options) => {
714
724
  };
715
725
  const getter = () => {
716
726
  const value = _getter();
717
- if (value === void 0)
718
- throw new Error(
719
- `
720
-
721
- Property: ${prop}
722
-
727
+ if (value === void 0) {
728
+ const error = new Error(
729
+ `Error accessing property: "${prop}"
723
730
  You must set an initial value before calling a property signal's getter.
724
731
  `
725
732
  );
733
+ console.error(error);
734
+ throw error;
735
+ }
726
736
  return value;
727
737
  };
728
738
  getter.getter = true;
@@ -788,7 +798,16 @@ You must set an initial value before calling a property signal's getter.
788
798
  return observedAttributes;
789
799
  }
790
800
  constructor() {
791
- super();
801
+ try {
802
+ super();
803
+ } catch (error) {
804
+ const _error = new Error(
805
+ "Error instantiating element:\nThis usually occurs if you have errors in the function body of your component. Check prior logs for possible causes.\n",
806
+ { cause: error }
807
+ );
808
+ console.error(_error);
809
+ throw _error;
810
+ }
792
811
  if (!Object.prototype.hasOwnProperty.call(this, "__customCallbackFns")) {
793
812
  this.__customCallbackFns = /* @__PURE__ */ new Map();
794
813
  }
@@ -970,7 +989,9 @@ var createRegistry = (args) => {
970
989
  getAllTagNames: () => Array.from(customElementTags),
971
990
  eject: () => {
972
991
  if (nativeRegistry === void 0) {
973
- throw new Error("Cannot eject a registry on the server.");
992
+ const error = new Error("Cannot eject a registry on the server.");
993
+ console.error(error);
994
+ throw error;
974
995
  }
975
996
  return nativeRegistry;
976
997
  },
package/dist/index.js CHANGED
@@ -158,21 +158,27 @@ var getServerRenderArgs = (tagName, registry) => ({
158
158
  get elementRef() {
159
159
  return new Proxy({}, {
160
160
  get: () => {
161
- throw new Error("The `elementRef` property is not available on the server.");
161
+ const error = new Error("The `elementRef` property is not available on the server.");
162
+ console.error(error);
163
+ throw error;
162
164
  }
163
165
  });
164
166
  },
165
167
  get root() {
166
168
  return new Proxy({}, {
167
169
  get: () => {
168
- throw new Error("The `root` property is not available on the server.");
170
+ const error = new Error("The `root` property is not available on the server.");
171
+ console.error(error);
172
+ throw error;
169
173
  }
170
174
  });
171
175
  },
172
176
  get internals() {
173
177
  return new Proxy({}, {
174
178
  get: () => {
175
- throw new Error("The `internals` property is not available on the server.");
179
+ const error = new Error("The `internals` property is not available on the server.");
180
+ console.error(error);
181
+ throw error;
176
182
  }
177
183
  });
178
184
  },
@@ -364,9 +370,11 @@ var evaluateBindings = (element, fragment) => {
364
370
  const result = signal();
365
371
  const nextNode = createNewNode(result, element, uniqueKey);
366
372
  if (nextNode instanceof Text) {
367
- throw new TypeError(
373
+ const error = new TypeError(
368
374
  "Signal mismatch: expected DocumentFragment or Array<DocumentFragment>, but got Text"
369
375
  );
376
+ console.error(error);
377
+ throw error;
370
378
  }
371
379
  for (const child2 of element.children) {
372
380
  const key = child2.getAttribute("key");
@@ -581,7 +589,9 @@ var customElement = (render, options) => {
581
589
  return this;
582
590
  },
583
591
  eject() {
584
- throw new Error("Cannot eject a custom element on the server.");
592
+ const error = new Error("Cannot eject a custom element on the server.");
593
+ console.error(error);
594
+ throw error;
585
595
  }
586
596
  };
587
597
  }
@@ -679,15 +689,15 @@ var customElement = (render, options) => {
679
689
  };
680
690
  const getter = () => {
681
691
  const value = _getter();
682
- if (value === void 0)
683
- throw new Error(
684
- `
685
-
686
- Property: ${prop}
687
-
692
+ if (value === void 0) {
693
+ const error = new Error(
694
+ `Error accessing property: "${prop}"
688
695
  You must set an initial value before calling a property signal's getter.
689
696
  `
690
697
  );
698
+ console.error(error);
699
+ throw error;
700
+ }
691
701
  return value;
692
702
  };
693
703
  getter.getter = true;
@@ -753,7 +763,16 @@ You must set an initial value before calling a property signal's getter.
753
763
  return observedAttributes;
754
764
  }
755
765
  constructor() {
756
- super();
766
+ try {
767
+ super();
768
+ } catch (error) {
769
+ const _error = new Error(
770
+ "Error instantiating element:\nThis usually occurs if you have errors in the function body of your component. Check prior logs for possible causes.\n",
771
+ { cause: error }
772
+ );
773
+ console.error(_error);
774
+ throw _error;
775
+ }
757
776
  if (!Object.prototype.hasOwnProperty.call(this, "__customCallbackFns")) {
758
777
  this.__customCallbackFns = /* @__PURE__ */ new Map();
759
778
  }
@@ -935,7 +954,9 @@ var createRegistry = (args) => {
935
954
  getAllTagNames: () => Array.from(customElementTags),
936
955
  eject: () => {
937
956
  if (nativeRegistry === void 0) {
938
- throw new Error("Cannot eject a registry on the server.");
957
+ const error = new Error("Cannot eject a registry on the server.");
958
+ console.error(error);
959
+ throw error;
939
960
  }
940
961
  return nativeRegistry;
941
962
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thunderous",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",