@dev-to/react-loader 0.2.0 → 0.3.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ReactLoader.d.ts","sourceRoot":"","sources":["../src/ReactLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAGd,OAAO,EAML,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAA;AAkD7B;;GAEG;AAEH,eAAO,MAAM,yBAAyB,iCAA6B,CAAA;AACnE,eAAO,MAAM,qBAAqB,6BAAyB,CAAA;AA2C3D,kCAAkC;AAClC,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,wBAAwB,CAAC,CAyBnC;AAED,yCAAyC;AACzC,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,wBAAwB,iBAcxF;AAED;;GAEG;AAEH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,IAAI,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,CAAA;QACpD,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,UAAU,CAAC,EAAE;YACX,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,EAAE,CAAA;SAChB,CAAA;KACF,CAAA;CACF;AAED,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG,yBAAyB,CAAA;AAEzF;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EAC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CAAA;IACvC,sBAAsB;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,gBAAgB,KAAK,SAAS,CAAA;CAC7D;AA2mBD;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrF,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,2CAqD3B"}
package/dist/index.js CHANGED
@@ -34,8 +34,7 @@ function isBridgeContract(value) {
34
34
  const paths = value['paths'];
35
35
  const events = value['events'];
36
36
  if (!isRecord(paths) || 'string' != typeof paths['reactRuntime']) return false;
37
- if (!isRecord(events) || 'string' != typeof events['fullReload']) return false;
38
- return true;
37
+ return !(!isRecord(events) || 'string' != typeof events['fullReload']);
39
38
  }
40
39
  function resolveContract(initModule) {
41
40
  const moduleRecord = isRecord(initModule) ? initModule : {};
package/dist/index.umd.js CHANGED
@@ -1,4 +1,3 @@
1
- /*! For license information please see index.umd.js.LICENSE.txt */
2
1
  (function(root, factory) {
3
2
  if ('object' == typeof exports && 'object' == typeof module) module.exports = factory(require("React"));
4
3
  else if ('function' == typeof define && define.amd) define([
@@ -9,44 +8,6 @@
9
8
  })(globalThis, (__rspack_external_react)=>(()=>{
10
9
  "use strict";
11
10
  var __webpack_modules__ = {
12
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js" (__unused_rspack_module, exports1, __webpack_require__) {
13
- /**
14
- * @license React
15
- * react-jsx-runtime.production.min.js
16
- *
17
- * Copyright (c) Facebook, Inc. and its affiliates.
18
- *
19
- * This source code is licensed under the MIT license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- */ var f = __webpack_require__("react"), k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = {
22
- key: !0,
23
- ref: !0,
24
- __self: !0,
25
- __source: !0
26
- };
27
- function q(c, a, g) {
28
- var b, d = {}, e = null, h = null;
29
- void 0 !== g && (e = "" + g);
30
- void 0 !== a.key && (e = "" + a.key);
31
- void 0 !== a.ref && (h = a.ref);
32
- for(b in a)m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
33
- if (c && c.defaultProps) for(b in a = c.defaultProps)void 0 === d[b] && (d[b] = a[b]);
34
- return {
35
- $$typeof: k,
36
- type: c,
37
- key: e,
38
- ref: h,
39
- props: d,
40
- _owner: n.current
41
- };
42
- }
43
- exports1.Fragment = l;
44
- exports1.jsx = q;
45
- exports1.jsxs = q;
46
- },
47
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js" (module1, __unused_rspack_exports, __webpack_require__) {
48
- module1.exports = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js");
49
- },
50
11
  react (module1) {
51
12
  module1.exports = __rspack_external_react;
52
13
  }
@@ -61,6 +22,15 @@
61
22
  __webpack_modules__[moduleId](module1, module1.exports, __webpack_require__);
62
23
  return module1.exports;
63
24
  }
25
+ (()=>{
26
+ __webpack_require__.n = (module1)=>{
27
+ var getter = module1 && module1.__esModule ? ()=>module1['default'] : ()=>module1;
28
+ __webpack_require__.d(getter, {
29
+ a: getter
30
+ });
31
+ return getter;
32
+ };
33
+ })();
64
34
  (()=>{
65
35
  __webpack_require__.d = (exports1, definition)=>{
66
36
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -94,8 +64,8 @@
94
64
  DEFAULT_INIT_ENDPOINT: ()=>DEFAULT_INIT_ENDPOINT,
95
65
  resolveReactEntryForLoader: ()=>resolveReactEntryForLoader
96
66
  });
97
- var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js");
98
67
  var external_React_ = __webpack_require__("react");
68
+ var external_React_default = /*#__PURE__*/ __webpack_require__.n(external_React_);
99
69
  const DEV_TO_REACT_NAMESPACE = 'dev_to_react';
100
70
  const DEV_TO_REACT_BASE_PATH = `/__${DEV_TO_REACT_NAMESPACE}__`;
101
71
  const DEV_TO_REACT_CONTRACT_PATH = `${DEV_TO_REACT_BASE_PATH}/contract.js`;
@@ -134,8 +104,7 @@
134
104
  const paths = value['paths'];
135
105
  const events = value['events'];
136
106
  if (!isRecord(paths) || 'string' != typeof paths['reactRuntime']) return false;
137
- if (!isRecord(events) || 'string' != typeof events['fullReload']) return false;
138
- return true;
107
+ return !(!isRecord(events) || 'string' != typeof events['fullReload']);
139
108
  }
140
109
  function resolveContract(initModule) {
141
110
  const moduleRecord = isRecord(initModule) ? initModule : {};
@@ -602,310 +571,141 @@
602
571
  };
603
572
  const debugPanelUrl = `${currentOrigin}${DEV_TO_REACT_DEBUG_HTML_PATH}`;
604
573
  const componentNameLabel = componentName || '';
605
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
574
+ return /*#__PURE__*/ external_React_default().createElement("div", {
606
575
  className: "vdev-container",
607
- style: styles.container,
608
- children: [
609
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
610
- className: "vdev-header",
611
- style: styles.header,
612
- children: [
613
- /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
614
- className: "vdev-icon",
615
- style: styles.icon,
616
- children: '\u26A0\uFE0F'
617
- }),
618
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
619
- className: "vdev-title",
620
- style: styles.title,
621
- children: [
622
- /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
623
- className: "vdev-type-tag",
624
- style: styles.typeTag,
625
- children: typeLabel
626
- }),
627
- title
628
- ]
629
- })
630
- ]
631
- }),
632
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
633
- className: "vdev-content",
634
- style: styles.content,
635
- children: [
636
- /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
637
- className: "vdev-message",
638
- style: styles.message,
639
- children: errorMessage
640
- }),
641
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
642
- className: "vdev-info",
643
- style: styles.info,
644
- children: [
645
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
646
- className: "vdev-info-row",
647
- style: styles.infoRow,
648
- children: [
649
- /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
650
- className: "vdev-label",
651
- style: styles.label,
652
- children: "Server Address:"
653
- }),
654
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
655
- className: "vdev-value",
656
- style: styles.value,
657
- children: currentOrigin
658
- })
659
- ]
660
- }),
661
- componentNameLabel ? /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
662
- className: "vdev-info-row",
663
- style: styles.infoRow,
664
- children: [
665
- /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
666
- className: "vdev-label",
667
- style: styles.label,
668
- children: "Component Name:"
669
- }),
670
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
671
- className: "vdev-value",
672
- style: styles.value,
673
- children: componentNameLabel
674
- })
675
- ]
676
- }) : null
677
- ]
678
- }),
679
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
680
- className: "vdev-tips",
681
- style: styles.tips,
682
- children: [
683
- /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
684
- className: "vdev-tips-title",
685
- style: styles.tipsTitle,
686
- children: "Next Steps:"
687
- }),
688
- setupGuide ? /*#__PURE__*/ (0, jsx_runtime.jsx)("pre", {
689
- className: "vdev-code-block",
690
- style: styles.codeBlock,
691
- children: setupGuide.steps.map((step, idx)=>{
692
- const stepKey = `step-${idx}`;
693
- const commentIdx = step.indexOf('//');
694
- if (-1 === commentIdx) return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
695
- children: step || ' '
696
- }, stepKey);
697
- const codePart = step.substring(0, commentIdx);
698
- const commentPart = step.substring(commentIdx);
699
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
700
- children: [
701
- /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
702
- children: codePart
703
- }),
704
- /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
705
- className: "vdev-code-comment",
706
- style: styles.codeComment,
707
- children: commentPart
708
- })
709
- ]
710
- }, stepKey);
711
- })
712
- }) : /*#__PURE__*/ (0, jsx_runtime.jsxs)("ul", {
713
- className: "vdev-list",
714
- style: styles.list,
715
- children: [
716
- isModuleFetchError ? /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
717
- children: [
718
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
719
- className: "vdev-li",
720
- style: styles.li,
721
- children: [
722
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
723
- children: "Verify Path"
724
- }),
725
- ": check the entry mapping for",
726
- ' ',
727
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
728
- className: "vdev-code",
729
- style: styles.code,
730
- children: componentNameLabel || 'this component'
731
- }),
732
- ' ',
733
- "in",
734
- ' ',
735
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
736
- className: "vdev-code",
737
- style: styles.code,
738
- children: "vite.config.ts"
739
- }),
740
- "."
741
- ]
742
- }),
743
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
744
- className: "vdev-li",
745
- style: styles.li,
746
- children: [
747
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
748
- children: "Check Terminal"
749
- }),
750
- ": look at the terminal where",
751
- ' ',
752
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
753
- className: "vdev-code",
754
- style: styles.code,
755
- children: currentOrigin
756
- }),
757
- ' ',
758
- "is running for build errors."
759
- ]
760
- }),
761
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
762
- className: "vdev-li",
763
- style: styles.li,
764
- children: [
765
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
766
- children: "Check Export"
767
- }),
768
- ": ensure the entry module exports a React component (default export recommended)."
769
- ]
770
- })
771
- ]
772
- }) : null,
773
- isComponentNotFound ? /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
774
- children: [
775
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
776
- className: "vdev-li",
777
- style: styles.li,
778
- children: [
779
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
780
- children: "Update Config"
781
- }),
782
- ": map",
783
- ' ',
784
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
785
- className: "vdev-code",
786
- style: styles.code,
787
- children: componentNameLabel
788
- }),
789
- ' ',
790
- "in",
791
- ' ',
792
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
793
- className: "vdev-code",
794
- style: styles.code,
795
- children: "devComponentMap"
796
- }),
797
- "."
798
- ]
799
- }),
800
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
801
- className: "vdev-li",
802
- style: styles.li,
803
- children: [
804
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
805
- children: "Wildcard Fallback"
806
- }),
807
- ": add",
808
- ' ',
809
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
810
- className: "vdev-code",
811
- style: styles.code,
812
- children: "'*': '/'"
813
- }),
814
- ' ',
815
- "to map all components to the default entry."
816
- ]
817
- })
818
- ]
819
- }) : null,
820
- isContractError ? /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
821
- children: [
822
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
823
- className: "vdev-li",
824
- style: styles.li,
825
- children: [
826
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
827
- children: "Check Server"
828
- }),
829
- ": ensure your Vite server is running at",
830
- ' ',
831
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
832
- className: "vdev-code",
833
- style: styles.code,
834
- children: currentOrigin
835
- }),
836
- "."
837
- ]
838
- }),
839
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
840
- className: "vdev-li",
841
- style: styles.li,
842
- children: [
843
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
844
- children: "Verify Origin"
845
- }),
846
- ": confirm localStorage key",
847
- ' ',
848
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
849
- className: "vdev-code",
850
- style: styles.code,
851
- children: "VITE_DEV_SERVER_ORIGIN"
852
- }),
853
- ' ',
854
- "is set to",
855
- ' ',
856
- /*#__PURE__*/ (0, jsx_runtime.jsx)("code", {
857
- className: "vdev-code",
858
- style: styles.code,
859
- children: currentOrigin
860
- }),
861
- "."
862
- ]
863
- }),
864
- /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
865
- className: "vdev-li",
866
- style: styles.li,
867
- children: [
868
- /*#__PURE__*/ (0, jsx_runtime.jsx)("b", {
869
- children: "Open Debug Panel"
870
- }),
871
- ":",
872
- ' ',
873
- /*#__PURE__*/ (0, jsx_runtime.jsx)("a", {
874
- className: "vdev-link",
875
- style: styles.link,
876
- href: debugPanelUrl,
877
- target: "_blank",
878
- rel: "noreferrer",
879
- children: debugPanelUrl
880
- })
881
- ]
882
- })
883
- ]
884
- }) : null,
885
- isModuleFetchError || isComponentNotFound || isContractError ? null : /*#__PURE__*/ (0, jsx_runtime.jsxs)("li", {
886
- className: "vdev-li",
887
- style: styles.li,
888
- children: [
889
- "Open Debug Panel:",
890
- ' ',
891
- /*#__PURE__*/ (0, jsx_runtime.jsx)("a", {
892
- className: "vdev-link",
893
- style: styles.link,
894
- href: debugPanelUrl,
895
- target: "_blank",
896
- rel: "noreferrer",
897
- children: debugPanelUrl
898
- })
899
- ]
900
- })
901
- ]
902
- })
903
- ]
904
- })
905
- ]
906
- })
907
- ]
908
- });
576
+ style: styles.container
577
+ }, /*#__PURE__*/ external_React_default().createElement("div", {
578
+ className: "vdev-header",
579
+ style: styles.header
580
+ }, /*#__PURE__*/ external_React_default().createElement("div", {
581
+ className: "vdev-icon",
582
+ style: styles.icon
583
+ }, '\u26A0\uFE0F'), /*#__PURE__*/ external_React_default().createElement("div", {
584
+ className: "vdev-title",
585
+ style: styles.title
586
+ }, /*#__PURE__*/ external_React_default().createElement("span", {
587
+ className: "vdev-type-tag",
588
+ style: styles.typeTag
589
+ }, typeLabel), title)), /*#__PURE__*/ external_React_default().createElement("div", {
590
+ className: "vdev-content",
591
+ style: styles.content
592
+ }, /*#__PURE__*/ external_React_default().createElement("div", {
593
+ className: "vdev-message",
594
+ style: styles.message
595
+ }, errorMessage), /*#__PURE__*/ external_React_default().createElement("div", {
596
+ className: "vdev-info",
597
+ style: styles.info
598
+ }, /*#__PURE__*/ external_React_default().createElement("div", {
599
+ className: "vdev-info-row",
600
+ style: styles.infoRow
601
+ }, /*#__PURE__*/ external_React_default().createElement("span", {
602
+ className: "vdev-label",
603
+ style: styles.label
604
+ }, "Server Address:"), /*#__PURE__*/ external_React_default().createElement("code", {
605
+ className: "vdev-value",
606
+ style: styles.value
607
+ }, currentOrigin)), componentNameLabel ? /*#__PURE__*/ external_React_default().createElement("div", {
608
+ className: "vdev-info-row",
609
+ style: styles.infoRow
610
+ }, /*#__PURE__*/ external_React_default().createElement("span", {
611
+ className: "vdev-label",
612
+ style: styles.label
613
+ }, "Component Name:"), /*#__PURE__*/ external_React_default().createElement("code", {
614
+ className: "vdev-value",
615
+ style: styles.value
616
+ }, componentNameLabel)) : null), /*#__PURE__*/ external_React_default().createElement("div", {
617
+ className: "vdev-tips",
618
+ style: styles.tips
619
+ }, /*#__PURE__*/ external_React_default().createElement("div", {
620
+ className: "vdev-tips-title",
621
+ style: styles.tipsTitle
622
+ }, "Next Steps:"), setupGuide ? /*#__PURE__*/ external_React_default().createElement("pre", {
623
+ className: "vdev-code-block",
624
+ style: styles.codeBlock
625
+ }, setupGuide.steps.map((step, idx)=>{
626
+ const stepKey = `step-${idx}`;
627
+ const commentIdx = step.indexOf('//');
628
+ if (-1 === commentIdx) return /*#__PURE__*/ external_React_default().createElement("div", {
629
+ key: stepKey
630
+ }, step || ' ');
631
+ const codePart = step.substring(0, commentIdx);
632
+ const commentPart = step.substring(commentIdx);
633
+ return /*#__PURE__*/ external_React_default().createElement("div", {
634
+ key: stepKey
635
+ }, /*#__PURE__*/ external_React_default().createElement("span", null, codePart), /*#__PURE__*/ external_React_default().createElement("span", {
636
+ className: "vdev-code-comment",
637
+ style: styles.codeComment
638
+ }, commentPart));
639
+ })) : /*#__PURE__*/ external_React_default().createElement("ul", {
640
+ className: "vdev-list",
641
+ style: styles.list
642
+ }, isModuleFetchError ? /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, /*#__PURE__*/ external_React_default().createElement("li", {
643
+ className: "vdev-li",
644
+ style: styles.li
645
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Verify Path"), ": check the entry mapping for", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
646
+ className: "vdev-code",
647
+ style: styles.code
648
+ }, componentNameLabel || 'this component'), ' ', "in", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
649
+ className: "vdev-code",
650
+ style: styles.code
651
+ }, "vite.config.ts"), "."), /*#__PURE__*/ external_React_default().createElement("li", {
652
+ className: "vdev-li",
653
+ style: styles.li
654
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Check Terminal"), ": look at the terminal where", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
655
+ className: "vdev-code",
656
+ style: styles.code
657
+ }, currentOrigin), ' ', "is running for build errors."), /*#__PURE__*/ external_React_default().createElement("li", {
658
+ className: "vdev-li",
659
+ style: styles.li
660
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Check Export"), ": ensure the entry module exports a React component (default export recommended).")) : null, isComponentNotFound ? /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, /*#__PURE__*/ external_React_default().createElement("li", {
661
+ className: "vdev-li",
662
+ style: styles.li
663
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Update Config"), ": map", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
664
+ className: "vdev-code",
665
+ style: styles.code
666
+ }, componentNameLabel), ' ', "in", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
667
+ className: "vdev-code",
668
+ style: styles.code
669
+ }, "devComponentMap"), "."), /*#__PURE__*/ external_React_default().createElement("li", {
670
+ className: "vdev-li",
671
+ style: styles.li
672
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Wildcard Fallback"), ": add", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
673
+ className: "vdev-code",
674
+ style: styles.code
675
+ }, "'*': '/'"), ' ', "to map all components to the default entry.")) : null, isContractError ? /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, /*#__PURE__*/ external_React_default().createElement("li", {
676
+ className: "vdev-li",
677
+ style: styles.li
678
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Check Server"), ": ensure your Vite server is running at", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
679
+ className: "vdev-code",
680
+ style: styles.code
681
+ }, currentOrigin), "."), /*#__PURE__*/ external_React_default().createElement("li", {
682
+ className: "vdev-li",
683
+ style: styles.li
684
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Verify Origin"), ": confirm localStorage key", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
685
+ className: "vdev-code",
686
+ style: styles.code
687
+ }, "VITE_DEV_SERVER_ORIGIN"), ' ', "is set to", ' ', /*#__PURE__*/ external_React_default().createElement("code", {
688
+ className: "vdev-code",
689
+ style: styles.code
690
+ }, currentOrigin), "."), /*#__PURE__*/ external_React_default().createElement("li", {
691
+ className: "vdev-li",
692
+ style: styles.li
693
+ }, /*#__PURE__*/ external_React_default().createElement("b", null, "Open Debug Panel"), ":", ' ', /*#__PURE__*/ external_React_default().createElement("a", {
694
+ className: "vdev-link",
695
+ style: styles.link,
696
+ href: debugPanelUrl,
697
+ target: "_blank",
698
+ rel: "noreferrer"
699
+ }, debugPanelUrl))) : null, isModuleFetchError || isComponentNotFound || isContractError ? null : /*#__PURE__*/ external_React_default().createElement("li", {
700
+ className: "vdev-li",
701
+ style: styles.li
702
+ }, "Open Debug Panel:", ' ', /*#__PURE__*/ external_React_default().createElement("a", {
703
+ className: "vdev-link",
704
+ style: styles.link,
705
+ href: debugPanelUrl,
706
+ target: "_blank",
707
+ rel: "noreferrer"
708
+ }, debugPanelUrl))))));
909
709
  }
910
710
  function ReactLoader(props) {
911
711
  const { url, origin, name, componentProps, contractEndpoint, loading, renderError, externalError } = props;
@@ -916,9 +716,7 @@
916
716
  componentProps,
917
717
  contractEndpoint
918
718
  });
919
- const defaultLoading = /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
920
- children: "Loading..."
921
- });
719
+ const defaultLoading = /*#__PURE__*/ external_React_default().createElement("div", null, "Loading...");
922
720
  const renderErrorNode = (0, external_React_.useCallback)((err)=>{
923
721
  if (renderError) return renderError(err);
924
722
  const isLoaderErrorObject = !(err instanceof Error);
@@ -927,7 +725,7 @@
927
725
  const componentName = (isLoaderErrorObject ? err.componentName : void 0) || name;
928
726
  const setupGuide = isLoaderErrorObject ? err.setupGuide : void 0;
929
727
  const statusCode = isLoaderErrorObject ? err.statusCode : err.statusCode;
930
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(InlineViteErrorView, {
728
+ return /*#__PURE__*/ external_React_default().createElement(InlineViteErrorView, {
931
729
  errorMessage: errorMessage,
932
730
  currentOrigin: currentOrigin,
933
731
  componentName: componentName,
@@ -940,22 +738,13 @@
940
738
  origin,
941
739
  url
942
740
  ]);
943
- if (externalError) return /*#__PURE__*/ (0, jsx_runtime.jsx)(jsx_runtime.Fragment, {
944
- children: renderErrorNode(externalError)
945
- });
946
- if (state.error) return /*#__PURE__*/ (0, jsx_runtime.jsx)(jsx_runtime.Fragment, {
947
- children: renderErrorNode(state.error)
948
- });
949
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
950
- children: [
951
- /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
952
- ref: state.containerRef,
953
- className: "vdev-loader-container",
954
- "data-is": "ReactLoader"
955
- }),
956
- state.isReady ? null : loading ?? defaultLoading
957
- ]
958
- });
741
+ if (externalError) return /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, renderErrorNode(externalError));
742
+ if (state.error) return /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, renderErrorNode(state.error));
743
+ return /*#__PURE__*/ external_React_default().createElement(external_React_default().Fragment, null, /*#__PURE__*/ external_React_default().createElement("div", {
744
+ ref: state.containerRef,
745
+ className: "vdev-loader-container",
746
+ "data-is": "ReactLoader"
747
+ }), state.isReady ? null : loading ?? defaultLoading);
959
748
  }
960
749
  })();
961
750
  return __webpack_exports__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-to/react-loader",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@dev-to/react-shared": "0.1.1"
32
+ "@dev-to/react-shared": "0.1.2"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rslib build",
@@ -1,9 +0,0 @@
1
- /**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */