vite-plugin-opencode-assistant 1.1.20 → 1.1.21

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 CHANGED
@@ -73,7 +73,6 @@ function createOpenCodePlugin(options = {}) {
73
73
  const DEFAULT_TAB = "default";
74
74
  const pageContexts = /* @__PURE__ */ new Map([[DEFAULT_TAB, pageContext]]);
75
75
  let activeTabId = DEFAULT_TAB;
76
- const pageKey = Math.random().toString(36).slice(2, 5);
77
76
  const serviceInstanceId = crypto.randomUUID();
78
77
  const sseClients = /* @__PURE__ */ new Set();
79
78
  const api = new OpenCodeAPI(
@@ -221,7 +220,7 @@ function createOpenCodePlugin(options = {}) {
221
220
  projectRoot,
222
221
  verbose: config.verbose
223
222
  });
224
- const titleInject = `<script>(function(){var k="[${pageKey}]",d=document,p=!1,f=function(){if(p)return;var t=d.title;if(t.indexOf(k)===0)return;p=!0;d.title=k+t.replace(k,"");p=!1};f();new MutationObserver(f).observe(d.querySelector("title")||d.head,{childList:!0})})();</script>`;
223
+ const titleInject = `<script>(function(){var K="_opencode_pk",s=sessionStorage,k=s.getItem(K)||(function(){var v=Math.random().toString(36).slice(2,5);s.setItem(K,v);return v})(),d=document,p=!1,f=function(){if(p)return;var t=d.title;if(t.indexOf(k)===0)return;p=!0;d.title=k+t.replace(k,"");p=!1};f();new MutationObserver(f).observe(d.querySelector("title")||d.head,{childList:!0})})();</script>`;
225
224
  timer.end();
226
225
  return html.replace("</body>", `${titleInject}
227
226
  ${widget}</body>`);
package/lib/index.cjs CHANGED
@@ -98,7 +98,6 @@ function createOpenCodePlugin(options = {}) {
98
98
  const DEFAULT_TAB = "default";
99
99
  const pageContexts = /* @__PURE__ */ new Map([[DEFAULT_TAB, pageContext]]);
100
100
  let activeTabId = DEFAULT_TAB;
101
- const pageKey = Math.random().toString(36).slice(2, 5);
102
101
  const serviceInstanceId = import_crypto.default.randomUUID();
103
102
  const sseClients = /* @__PURE__ */ new Set();
104
103
  const api = new import_api.OpenCodeAPI(
@@ -246,7 +245,7 @@ function createOpenCodePlugin(options = {}) {
246
245
  projectRoot,
247
246
  verbose: config.verbose
248
247
  });
249
- const titleInject = `<script>(function(){var k="[${pageKey}]",d=document,p=!1,f=function(){if(p)return;var t=d.title;if(t.indexOf(k)===0)return;p=!0;d.title=k+t.replace(k,"");p=!1};f();new MutationObserver(f).observe(d.querySelector("title")||d.head,{childList:!0})})();</script>`;
248
+ const titleInject = `<script>(function(){var K="_opencode_pk",s=sessionStorage,k=s.getItem(K)||(function(){var v=Math.random().toString(36).slice(2,5);s.setItem(K,v);return v})(),d=document,p=!1,f=function(){if(p)return;var t=d.title;if(t.indexOf(k)===0)return;p=!0;d.title=k+t.replace(k,"");p=!1};f();new MutationObserver(f).observe(d.querySelector("title")||d.head,{childList:!0})})();</script>`;
250
249
  timer.end();
251
250
  return html.replace("</body>", `${titleInject}
252
251
  ${widget}</body>`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-opencode-assistant",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "Embed OpenCode Web UI in your Vite dev server for real-time code modification and preview",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",
@@ -37,15 +37,15 @@
37
37
  "dependencies": {
38
38
  "unplugin-vue-inspector": "^3.0.0",
39
39
  "execa": "^9.6.1",
40
- "@vite-plugin-opencode-assistant/opencode": "1.1.20",
41
- "@vite-plugin-opencode-assistant/components": "1.1.20",
42
- "@vite-plugin-opencode-assistant/shared": "1.1.20"
40
+ "@vite-plugin-opencode-assistant/opencode": "1.1.21",
41
+ "@vite-plugin-opencode-assistant/shared": "1.1.21",
42
+ "@vite-plugin-opencode-assistant/components": "1.1.21"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vite": ">=5.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@vite-plugin-opencode-assistant/client": "1.1.20"
48
+ "@vite-plugin-opencode-assistant/client": "1.1.21"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "pagoda-cli build && vite build -c vite.client.config.ts",