@trpc-panel/core 1.0.4 → 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 +15 -3
- package/lib/index.mjs +15 -3
- package/lib/react-app/bundle.js +100 -100
- package/lib/react-app/index.css +2 -2
- package/package.json +1 -1
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,29 +19104,35 @@ 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
|
};
|
|
19115
|
+
function safeStringify(value) {
|
|
19116
|
+
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\//g, "\\u002f").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
19117
|
+
}
|
|
19106
19118
|
function renderTrpcPanel(router, options) {
|
|
19107
19119
|
if (options.cache === true && cache.val)
|
|
19108
19120
|
return cache.val;
|
|
19109
19121
|
const bundleInjectionParams = [
|
|
19110
19122
|
{
|
|
19111
19123
|
searchFor: routerReplaceSymbol,
|
|
19112
|
-
injectString:
|
|
19124
|
+
injectString: safeStringify(parseRouterWithOptions(router, {
|
|
19113
19125
|
...defaultParseRouterOptions,
|
|
19114
19126
|
...options
|
|
19115
19127
|
}))
|
|
19116
19128
|
},
|
|
19117
19129
|
{
|
|
19118
19130
|
searchFor: optionsReplaceSymbol,
|
|
19119
|
-
injectString:
|
|
19131
|
+
injectString: safeStringify(options)
|
|
19120
19132
|
}
|
|
19121
19133
|
];
|
|
19122
19134
|
const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
|
|
19123
|
-
const script = `<script type="module">${bundleInjected}</script>`;
|
|
19135
|
+
const script = `<script type="module">${bundleInjected.replace(/<\/script>/g, "<\\/script>")}</script>`;
|
|
19124
19136
|
const css = `<style>${indexCss}</style>`;
|
|
19125
19137
|
const htmlReplaceParams = [
|
|
19126
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,29 +19066,35 @@ 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
|
};
|
|
19077
|
+
function safeStringify(value) {
|
|
19078
|
+
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\//g, "\\u002f").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
19079
|
+
}
|
|
19068
19080
|
function renderTrpcPanel(router, options) {
|
|
19069
19081
|
if (options.cache === true && cache.val)
|
|
19070
19082
|
return cache.val;
|
|
19071
19083
|
const bundleInjectionParams = [
|
|
19072
19084
|
{
|
|
19073
19085
|
searchFor: routerReplaceSymbol,
|
|
19074
|
-
injectString:
|
|
19086
|
+
injectString: safeStringify(parseRouterWithOptions(router, {
|
|
19075
19087
|
...defaultParseRouterOptions,
|
|
19076
19088
|
...options
|
|
19077
19089
|
}))
|
|
19078
19090
|
},
|
|
19079
19091
|
{
|
|
19080
19092
|
searchFor: optionsReplaceSymbol,
|
|
19081
|
-
injectString:
|
|
19093
|
+
injectString: safeStringify(options)
|
|
19082
19094
|
}
|
|
19083
19095
|
];
|
|
19084
19096
|
const bundleInjected = injectParams(bundleJs, bundleInjectionParams);
|
|
19085
|
-
const script = `<script type="module">${bundleInjected}</script>`;
|
|
19097
|
+
const script = `<script type="module">${bundleInjected.replace(/<\/script>/g, "<\\/script>")}</script>`;
|
|
19086
19098
|
const css = `<style>${indexCss}</style>`;
|
|
19087
19099
|
const htmlReplaceParams = [
|
|
19088
19100
|
{
|