@omniviewdev/vite-plugin 0.7.0 → 0.7.1

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/dist/index.cjs CHANGED
@@ -338,6 +338,36 @@ function attachManagedViteFeedback(server, raw = process.env.OMNIVIEW_VITE_FEEDB
338
338
  };
339
339
  }
340
340
  server.middlewares.use((request, response, next) => {
341
+ if (request.url === "/__omniview_development_status") {
342
+ let fd;
343
+ try {
344
+ fd = (0, import_node_fs2.openSync)(import_node_path2.default.join(context.workspaceRoot, ".local", "launch-status.json"), import_node_fs2.constants.O_RDONLY | import_node_fs2.constants.O_NOFOLLOW);
345
+ const stat = (0, import_node_fs2.fstatSync)(fd);
346
+ if (!stat.isFile() || stat.size > 1024 * 1024 || process.platform !== "win32" && ((stat.mode & 63) !== 0 || typeof process.getuid === "function" && stat.uid !== process.getuid())) {
347
+ throw new Error("Development status ownership changed");
348
+ }
349
+ const bytes = Buffer.alloc(stat.size);
350
+ (0, import_node_fs2.readSync)(fd, bytes, 0, bytes.length, 0);
351
+ const status = JSON.parse(bytes.toString("utf8"));
352
+ if (status.generation !== context.generation || status.manifest?.workspaceID !== context.workspaceID) {
353
+ throw new Error("Development status identity changed");
354
+ }
355
+ response.setHeader("Cache-Control", "no-store");
356
+ response.setHeader("Content-Type", "application/json");
357
+ response.end(JSON.stringify({
358
+ phase: status.launchPhase,
359
+ failedStage: status.failedStage,
360
+ recoveryCommand: `omniview-dev workspace refresh ${context.workspaceID}`
361
+ }));
362
+ } catch {
363
+ response.writeHead(503).end();
364
+ } finally {
365
+ if (fd !== void 0) {
366
+ (0, import_node_fs2.closeSync)(fd);
367
+ }
368
+ }
369
+ return;
370
+ }
341
371
  if (request.headers.accept !== "text/x-vite-ping") {
342
372
  next();
343
373
  return;
@@ -407,6 +437,35 @@ function managedViteFeedback() {
407
437
  name: "omniview-managed-vite-feedback",
408
438
  apply: "serve",
409
439
  enforce: "pre",
440
+ transformIndexHtml() {
441
+ if (!process.env.OMNIVIEW_VITE_FEEDBACK) {
442
+ return [];
443
+ }
444
+ return [{
445
+ tag: "script",
446
+ attrs: { type: "module" },
447
+ injectTo: "body",
448
+ children: `
449
+ const banner = document.createElement('div');
450
+ banner.id = 'omniview-development-banner';
451
+ banner.setAttribute('role', 'status');
452
+ banner.style.cssText = 'position:fixed;bottom:0;left:0;right:0;z-index:2147483647;padding:6px 12px;background:#172554;color:#fff;font:12px monospace;white-space:pre-wrap';
453
+ document.body.append(banner);
454
+ async function refreshDevelopmentStatus() {
455
+ try {
456
+ const response = await fetch('/__omniview_development_status', { cache: 'no-store' });
457
+ if (!response.ok) throw new Error('status unavailable');
458
+ const status = await response.json();
459
+ banner.textContent = 'DEVELOPMENT \u2014 ' + status.phase + (status.failedStage ? ' \u2014 failed stage: ' + status.failedStage + ' \u2014 recover: ' + status.recoveryCommand : '');
460
+ } catch {
461
+ banner.textContent = 'DEVELOPMENT \u2014 supervisor status unavailable; inspect workspace status before trusting served source';
462
+ }
463
+ }
464
+ refreshDevelopmentStatus();
465
+ setInterval(refreshDevelopmentStatus, 1500);
466
+ `
467
+ }];
468
+ },
410
469
  configureServer(server) {
411
470
  attachManagedViteFeedback(server);
412
471
  }
package/dist/index.d.cts CHANGED
@@ -71,6 +71,14 @@ declare function managedViteFeedback(): {
71
71
  name: string;
72
72
  apply: "serve";
73
73
  enforce: "pre";
74
+ transformIndexHtml(): {
75
+ tag: string;
76
+ attrs: {
77
+ type: string;
78
+ };
79
+ injectTo: "body";
80
+ children: string;
81
+ }[];
74
82
  configureServer(server: ManagedFeedbackServer): void;
75
83
  };
76
84
 
package/dist/index.d.ts CHANGED
@@ -71,6 +71,14 @@ declare function managedViteFeedback(): {
71
71
  name: string;
72
72
  apply: "serve";
73
73
  enforce: "pre";
74
+ transformIndexHtml(): {
75
+ tag: string;
76
+ attrs: {
77
+ type: string;
78
+ };
79
+ injectTo: "body";
80
+ children: string;
81
+ }[];
74
82
  configureServer(server: ManagedFeedbackServer): void;
75
83
  };
76
84
 
package/dist/index.js CHANGED
@@ -310,6 +310,36 @@ function attachManagedViteFeedback(server, raw = process.env.OMNIVIEW_VITE_FEEDB
310
310
  };
311
311
  }
312
312
  server.middlewares.use((request, response, next) => {
313
+ if (request.url === "/__omniview_development_status") {
314
+ let fd;
315
+ try {
316
+ fd = openSync(path2.join(context.workspaceRoot, ".local", "launch-status.json"), constants.O_RDONLY | constants.O_NOFOLLOW);
317
+ const stat = fstatSync(fd);
318
+ if (!stat.isFile() || stat.size > 1024 * 1024 || process.platform !== "win32" && ((stat.mode & 63) !== 0 || typeof process.getuid === "function" && stat.uid !== process.getuid())) {
319
+ throw new Error("Development status ownership changed");
320
+ }
321
+ const bytes = Buffer.alloc(stat.size);
322
+ readSync(fd, bytes, 0, bytes.length, 0);
323
+ const status = JSON.parse(bytes.toString("utf8"));
324
+ if (status.generation !== context.generation || status.manifest?.workspaceID !== context.workspaceID) {
325
+ throw new Error("Development status identity changed");
326
+ }
327
+ response.setHeader("Cache-Control", "no-store");
328
+ response.setHeader("Content-Type", "application/json");
329
+ response.end(JSON.stringify({
330
+ phase: status.launchPhase,
331
+ failedStage: status.failedStage,
332
+ recoveryCommand: `omniview-dev workspace refresh ${context.workspaceID}`
333
+ }));
334
+ } catch {
335
+ response.writeHead(503).end();
336
+ } finally {
337
+ if (fd !== void 0) {
338
+ closeSync(fd);
339
+ }
340
+ }
341
+ return;
342
+ }
313
343
  if (request.headers.accept !== "text/x-vite-ping") {
314
344
  next();
315
345
  return;
@@ -379,6 +409,35 @@ function managedViteFeedback() {
379
409
  name: "omniview-managed-vite-feedback",
380
410
  apply: "serve",
381
411
  enforce: "pre",
412
+ transformIndexHtml() {
413
+ if (!process.env.OMNIVIEW_VITE_FEEDBACK) {
414
+ return [];
415
+ }
416
+ return [{
417
+ tag: "script",
418
+ attrs: { type: "module" },
419
+ injectTo: "body",
420
+ children: `
421
+ const banner = document.createElement('div');
422
+ banner.id = 'omniview-development-banner';
423
+ banner.setAttribute('role', 'status');
424
+ banner.style.cssText = 'position:fixed;bottom:0;left:0;right:0;z-index:2147483647;padding:6px 12px;background:#172554;color:#fff;font:12px monospace;white-space:pre-wrap';
425
+ document.body.append(banner);
426
+ async function refreshDevelopmentStatus() {
427
+ try {
428
+ const response = await fetch('/__omniview_development_status', { cache: 'no-store' });
429
+ if (!response.ok) throw new Error('status unavailable');
430
+ const status = await response.json();
431
+ banner.textContent = 'DEVELOPMENT \u2014 ' + status.phase + (status.failedStage ? ' \u2014 failed stage: ' + status.failedStage + ' \u2014 recover: ' + status.recoveryCommand : '');
432
+ } catch {
433
+ banner.textContent = 'DEVELOPMENT \u2014 supervisor status unavailable; inspect workspace status before trusting served source';
434
+ }
435
+ }
436
+ refreshDevelopmentStatus();
437
+ setInterval(refreshDevelopmentStatus, 1500);
438
+ `
439
+ }];
440
+ },
382
441
  configureServer(server) {
383
442
  attachManagedViteFeedback(server);
384
443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniviewdev/vite-plugin",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Vite plugin for Omniview plugin development. Redirects shared dependency imports to the host app's singleton instances via window.__OMNIVIEW_SHARED__.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Omniview",