vite-plugin-opencode-assistant 1.1.21 → 1.1.22

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
@@ -220,7 +220,28 @@ function createOpenCodePlugin(options = {}) {
220
220
  projectRoot,
221
221
  verbose: config.verbose
222
222
  });
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>`;
223
+ const titleInject = `<script>
224
+ (function () {
225
+ var KEY = "_opencode_pk";
226
+ var prefix = sessionStorage.getItem(KEY);
227
+ if (!prefix) {
228
+ prefix = "[" + Math.random().toString(36).slice(2, 5) + "]";
229
+ sessionStorage.setItem(KEY, prefix);
230
+ }
231
+ var applied = false;
232
+ function apply() {
233
+ if (applied) return;
234
+ var title = document.title;
235
+ if (title.indexOf(prefix) === 0) return;
236
+ applied = true;
237
+ document.title = prefix + title.replace(prefix, "");
238
+ applied = false;
239
+ }
240
+ apply();
241
+ var target = document.querySelector("title") || document.head;
242
+ new MutationObserver(apply).observe(target, { childList: true });
243
+ })();
244
+ </script>`;
224
245
  timer.end();
225
246
  return html.replace("</body>", `${titleInject}
226
247
  ${widget}</body>`);
package/lib/index.cjs CHANGED
@@ -245,7 +245,28 @@ function createOpenCodePlugin(options = {}) {
245
245
  projectRoot,
246
246
  verbose: config.verbose
247
247
  });
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>`;
248
+ const titleInject = `<script>
249
+ (function () {
250
+ var KEY = "_opencode_pk";
251
+ var prefix = sessionStorage.getItem(KEY);
252
+ if (!prefix) {
253
+ prefix = "[" + Math.random().toString(36).slice(2, 5) + "]";
254
+ sessionStorage.setItem(KEY, prefix);
255
+ }
256
+ var applied = false;
257
+ function apply() {
258
+ if (applied) return;
259
+ var title = document.title;
260
+ if (title.indexOf(prefix) === 0) return;
261
+ applied = true;
262
+ document.title = prefix + title.replace(prefix, "");
263
+ applied = false;
264
+ }
265
+ apply();
266
+ var target = document.querySelector("title") || document.head;
267
+ new MutationObserver(apply).observe(target, { childList: true });
268
+ })();
269
+ </script>`;
249
270
  timer.end();
250
271
  return html.replace("</body>", `${titleInject}
251
272
  ${widget}</body>`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-opencode-assistant",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
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.21",
41
- "@vite-plugin-opencode-assistant/shared": "1.1.21",
42
- "@vite-plugin-opencode-assistant/components": "1.1.21"
40
+ "@vite-plugin-opencode-assistant/opencode": "1.1.22",
41
+ "@vite-plugin-opencode-assistant/shared": "1.1.22",
42
+ "@vite-plugin-opencode-assistant/components": "1.1.22"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vite": ">=5.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@vite-plugin-opencode-assistant/client": "1.1.21"
48
+ "@vite-plugin-opencode-assistant/client": "1.1.22"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "pagoda-cli build && vite build -c vite.client.config.ts",