vite-plugin-aipanel 1.2.12 → 1.2.13
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/es/index.mjs +6 -0
- package/lib/client.js +1766 -1766
- package/lib/index.cjs +6 -0
- package/package.json +5 -5
package/es/index.mjs
CHANGED
|
@@ -78,6 +78,9 @@ function aipanelPlugin(options = {}) {
|
|
|
78
78
|
plugins.push(createAIPanelPlugin(options));
|
|
79
79
|
return plugins;
|
|
80
80
|
}
|
|
81
|
+
function normalizeViteHost(host, fallback) {
|
|
82
|
+
return typeof host === "string" && host && host !== "0.0.0.0" && host !== "::" && host !== "::1" ? host : fallback;
|
|
83
|
+
}
|
|
81
84
|
function createAIPanelPlugin(options = {}) {
|
|
82
85
|
const config = resolvePluginConfig(options);
|
|
83
86
|
setVerbose(config.verbose);
|
|
@@ -87,6 +90,7 @@ function createAIPanelPlugin(options = {}) {
|
|
|
87
90
|
let actualProxyPort = config.proxyPort ?? DEFAULT_PROXY_PORT;
|
|
88
91
|
let projectRoot = "";
|
|
89
92
|
let vueDevtoolsApiUrl = "";
|
|
93
|
+
let viteServerHost = "localhost";
|
|
90
94
|
const pageContext = { url: "", title: "" };
|
|
91
95
|
const DEFAULT_TAB = "default";
|
|
92
96
|
const pageContexts = /* @__PURE__ */ new Map([[DEFAULT_TAB, pageContext]]);
|
|
@@ -135,6 +139,7 @@ function createAIPanelPlugin(options = {}) {
|
|
|
135
139
|
async configureServer(server) {
|
|
136
140
|
const timer = log.timer("configureServer");
|
|
137
141
|
projectRoot = server.config.root;
|
|
142
|
+
viteServerHost = normalizeViteHost(server.config.server.host, config.hostname);
|
|
138
143
|
let viteOrigin = "";
|
|
139
144
|
setupMiddlewares(
|
|
140
145
|
server,
|
|
@@ -350,6 +355,7 @@ ${SILENT_CONTEXT_SCRIPT}</body>`),
|
|
|
350
355
|
hotkey: config.hotkey,
|
|
351
356
|
proxyPort: actualProxyPort,
|
|
352
357
|
proxyHost: config.hostname,
|
|
358
|
+
viteHost: viteServerHost,
|
|
353
359
|
displayMode: config.displayMode === "extension" ? "extension-selector" : config.displayMode,
|
|
354
360
|
splitMode: config.splitMode,
|
|
355
361
|
serviceInstanceId,
|