kapi-ui 0.2.1 → 0.2.2

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.
@@ -12,9 +12,12 @@ export default defineNuxtModule({
12
12
  // Nuxt renders HTML through Nitro, not Vite's transformIndexHtml, so the
13
13
  // overlay script has to be injected via unhead instead of the vite plugin.
14
14
  addVitePlugin(kapiVitePlugin());
15
+ // Nuxt mounts Vite's dev middleware under app.buildAssetsDir (e.g. /_nuxt/),
16
+ // not at the site root, so the script has to be requested from under that
17
+ // prefix or Nitro's page renderer intercepts it before Vite ever sees it.
15
18
  (_a = nuxt.options.app.head).script || (_a.script = []);
16
19
  nuxt.options.app.head.script.push({
17
- src: '/@kapi-ui/overlay',
20
+ src: `${nuxt.options.app.buildAssetsDir}@kapi-ui/overlay`,
18
21
  type: 'module',
19
22
  });
20
23
  },
package/dist/server.js CHANGED
@@ -91,7 +91,11 @@ function processComments(prompt, socket) {
91
91
  send(socket, { type: "comments:done" });
92
92
  });
93
93
  }
94
+ let serverStarted = false;
94
95
  export function startServer(portNumber) {
96
+ if (serverStarted)
97
+ return;
98
+ serverStarted = true;
95
99
  const server = http.createServer((req, res) => {
96
100
  res.writeHead(200, { "Content-Type": "text/plain" });
97
101
  res.end("I love capybaras");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kapi-ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Visually prompt your UI",
5
5
  "scripts": {
6
6
  "build": "tsc",