vite-plugin-opencode-assistant 1.1.20 → 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 +22 -2
- package/lib/index.cjs +22 -2
- package/package.json +5 -5
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,28 @@ function createOpenCodePlugin(options = {}) {
|
|
|
221
220
|
projectRoot,
|
|
222
221
|
verbose: config.verbose
|
|
223
222
|
});
|
|
224
|
-
const titleInject = `<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>`;
|
|
225
245
|
timer.end();
|
|
226
246
|
return html.replace("</body>", `${titleInject}
|
|
227
247
|
${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,28 @@ function createOpenCodePlugin(options = {}) {
|
|
|
246
245
|
projectRoot,
|
|
247
246
|
verbose: config.verbose
|
|
248
247
|
});
|
|
249
|
-
const titleInject = `<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>`;
|
|
250
270
|
timer.end();
|
|
251
271
|
return html.replace("</body>", `${titleInject}
|
|
252
272
|
${widget}</body>`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-opencode-assistant",
|
|
3
|
-
"version": "1.1.
|
|
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.
|
|
41
|
-
"@vite-plugin-opencode-assistant/
|
|
42
|
-
"@vite-plugin-opencode-assistant/
|
|
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.
|
|
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",
|