@trpc-panel/core 1.0.5 → 1.0.6

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/lib/index.js CHANGED
@@ -19086,6 +19086,12 @@ var optionsReplaceSymbol = '"{{options}}"';
19086
19086
  var bundlePath = __dirname2 + "/react-app/bundle.js";
19087
19087
  var indexPath = __dirname2 + "/react-app/index.html";
19088
19088
  var cssPath = __dirname2 + "/react-app/index.css";
19089
+ console.log("trpc-panel debug:", {
19090
+ __dirname: __dirname2,
19091
+ bundlePath,
19092
+ indexPath,
19093
+ cssPath
19094
+ });
19089
19095
  var bundleJs = import_fs.default.readFileSync(bundlePath).toString();
19090
19096
  var indexHtml = import_fs.default.readFileSync(indexPath).toString();
19091
19097
  var indexCss = import_fs.default.readFileSync(cssPath).toString();
@@ -19098,13 +19104,16 @@ function injectParams(string5, injectionParams) {
19098
19104
  }
19099
19105
  function injectInString(searchFor, string5, injectString) {
19100
19106
  const startIndex = string5.indexOf(searchFor);
19107
+ if (startIndex === -1) {
19108
+ throw new Error(`trpc-panel: Failed to find placeholder ${searchFor} in bundle`);
19109
+ }
19101
19110
  return string5.slice(0, startIndex) + injectString + string5.slice(startIndex + searchFor.length);
19102
19111
  }
19103
19112
  var cache = {
19104
19113
  val: null
19105
19114
  };
19106
19115
  function safeStringify(value) {
19107
- return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19116
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\//g, "\\u002f").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19108
19117
  }
19109
19118
  function renderTrpcPanel(router, options) {
19110
19119
  if (options.cache === true && cache.val)
@@ -19123,7 +19132,7 @@ function renderTrpcPanel(router, options) {
19123
19132
  }
19124
19133
  ];
19125
19134
  const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
19126
- const script = `<script type="module">${bundleInjected}</script>`;
19135
+ const script = `<script type="module">${bundleInjected.replace(/<\/script>/g, "<\\/script>")}</script>`;
19127
19136
  const css = `<style>${indexCss}</style>`;
19128
19137
  const htmlReplaceParams = [
19129
19138
  {
package/lib/index.mjs CHANGED
@@ -19048,6 +19048,12 @@ var optionsReplaceSymbol = '"{{options}}"';
19048
19048
  var bundlePath = __dirname2 + "/react-app/bundle.js";
19049
19049
  var indexPath = __dirname2 + "/react-app/index.html";
19050
19050
  var cssPath = __dirname2 + "/react-app/index.css";
19051
+ console.log("trpc-panel debug:", {
19052
+ __dirname: __dirname2,
19053
+ bundlePath,
19054
+ indexPath,
19055
+ cssPath
19056
+ });
19051
19057
  var bundleJs = fs.readFileSync(bundlePath).toString();
19052
19058
  var indexHtml = fs.readFileSync(indexPath).toString();
19053
19059
  var indexCss = fs.readFileSync(cssPath).toString();
@@ -19060,13 +19066,16 @@ function injectParams(string5, injectionParams) {
19060
19066
  }
19061
19067
  function injectInString(searchFor, string5, injectString) {
19062
19068
  const startIndex = string5.indexOf(searchFor);
19069
+ if (startIndex === -1) {
19070
+ throw new Error(`trpc-panel: Failed to find placeholder ${searchFor} in bundle`);
19071
+ }
19063
19072
  return string5.slice(0, startIndex) + injectString + string5.slice(startIndex + searchFor.length);
19064
19073
  }
19065
19074
  var cache = {
19066
19075
  val: null
19067
19076
  };
19068
19077
  function safeStringify(value) {
19069
- return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19078
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\//g, "\\u002f").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19070
19079
  }
19071
19080
  function renderTrpcPanel(router, options) {
19072
19081
  if (options.cache === true && cache.val)
@@ -19085,7 +19094,7 @@ function renderTrpcPanel(router, options) {
19085
19094
  }
19086
19095
  ];
19087
19096
  const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
19088
- const script = `<script type="module">${bundleInjected}</script>`;
19097
+ const script = `<script type="module">${bundleInjected.replace(/<\/script>/g, "<\\/script>")}</script>`;
19089
19098
  const css = `<style>${indexCss}</style>`;
19090
19099
  const htmlReplaceParams = [
19091
19100
  {