@trpc-panel/core 1.0.4 → 1.0.5

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
@@ -19103,20 +19103,23 @@ function injectInString(searchFor, string5, injectString) {
19103
19103
  var cache = {
19104
19104
  val: null
19105
19105
  };
19106
+ function safeStringify(value) {
19107
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19108
+ }
19106
19109
  function renderTrpcPanel(router, options) {
19107
19110
  if (options.cache === true && cache.val)
19108
19111
  return cache.val;
19109
19112
  const bundleInjectionParams = [
19110
19113
  {
19111
19114
  searchFor: routerReplaceSymbol,
19112
- injectString: JSON.stringify(parseRouterWithOptions(router, {
19115
+ injectString: safeStringify(parseRouterWithOptions(router, {
19113
19116
  ...defaultParseRouterOptions,
19114
19117
  ...options
19115
19118
  }))
19116
19119
  },
19117
19120
  {
19118
19121
  searchFor: optionsReplaceSymbol,
19119
- injectString: JSON.stringify(options)
19122
+ injectString: safeStringify(options)
19120
19123
  }
19121
19124
  ];
19122
19125
  const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
package/lib/index.mjs CHANGED
@@ -19065,20 +19065,23 @@ function injectInString(searchFor, string5, injectString) {
19065
19065
  var cache = {
19066
19066
  val: null
19067
19067
  };
19068
+ function safeStringify(value) {
19069
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
19070
+ }
19068
19071
  function renderTrpcPanel(router, options) {
19069
19072
  if (options.cache === true && cache.val)
19070
19073
  return cache.val;
19071
19074
  const bundleInjectionParams = [
19072
19075
  {
19073
19076
  searchFor: routerReplaceSymbol,
19074
- injectString: JSON.stringify(parseRouterWithOptions(router, {
19077
+ injectString: safeStringify(parseRouterWithOptions(router, {
19075
19078
  ...defaultParseRouterOptions,
19076
19079
  ...options
19077
19080
  }))
19078
19081
  },
19079
19082
  {
19080
19083
  searchFor: optionsReplaceSymbol,
19081
- injectString: JSON.stringify(options)
19084
+ injectString: safeStringify(options)
19082
19085
  }
19083
19086
  ];
19084
19087
  const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc-panel/core",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "UI for testing tRPC backends",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",