@runic-artifex/vite-plugin-runic 0.12.1 → 0.14.0

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.
@@ -0,0 +1,69 @@
1
+ import { sanitizeDiagnosticSummary } from "./diagnostics.js";
2
+ const defaultTimelineLimit = 200;
3
+ const maximumTimelineLimit = 500;
4
+ export function createDevelopmentTimeline(initial, maxTimelineEntries, changed) {
5
+ let state = initial;
6
+ let nextSequence = 1;
7
+ return {
8
+ get state() { return state; },
9
+ configure(update) { state = update(state); },
10
+ appendDiagnostic(candidate, defaultSource) {
11
+ const summary = sanitizeDiagnosticSummary(candidate, defaultSource);
12
+ if (!summary)
13
+ return undefined;
14
+ const entry = {
15
+ ...summary,
16
+ id: `diagnostic-${nextSequence}`,
17
+ timestamp: new Date().toISOString(),
18
+ };
19
+ nextSequence += 1;
20
+ state = { ...state, timeline: [...state.timeline, entry].slice(-maxTimelineEntries) };
21
+ changed(state);
22
+ return entry;
23
+ },
24
+ applyConnection(candidate) {
25
+ const next = connectionState(isRecord(candidate) ? candidate.state : undefined);
26
+ if (next === state.connection.state)
27
+ return false;
28
+ state = { ...state, connection: { state: next } };
29
+ changed(state);
30
+ return true;
31
+ },
32
+ };
33
+ }
34
+ export function initialDevelopmentState(contract, vite = { command: "serve", mode: "development", root: "" }) {
35
+ return {
36
+ contract: {
37
+ identity: cleanString(contract?.identity),
38
+ version: cleanString(contract?.version),
39
+ fingerprint: cleanString(contract?.fingerprint),
40
+ },
41
+ vite,
42
+ connection: { state: "unknown" },
43
+ timeline: [],
44
+ };
45
+ }
46
+ // Failures keep file paths and stacks for local display only (the dock, the development server's terminal). The
47
+ // state endpoint and the copied state stay path-free.
48
+ export function withoutFailures(current) {
49
+ return {
50
+ ...current,
51
+ timeline: current.timeline.map(({ failure: _failure, ...entry }) => entry),
52
+ };
53
+ }
54
+ export function timelineLimit(value) {
55
+ if (typeof value !== "number" || !Number.isFinite(value))
56
+ return defaultTimelineLimit;
57
+ return Math.min(maximumTimelineLimit, Math.max(1, Math.floor(value)));
58
+ }
59
+ function connectionState(value) {
60
+ return value === "connecting" || value === "connected" || value === "reconnecting" || value === "lost"
61
+ ? value
62
+ : "unknown";
63
+ }
64
+ function cleanString(value) {
65
+ return typeof value === "string" ? value.slice(0, 512) : "";
66
+ }
67
+ function isRecord(value) {
68
+ return typeof value === "object" && value !== null && !Array.isArray(value);
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runic-artifex/vite-plugin-runic",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "Vite 8 development and DevTools integration for Runic applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -61,7 +61,7 @@
61
61
  "url": "git+https://github.com/Runic-Artifex/runic-sdk.git",
62
62
  "directory": "packages/web/vite-plugin-runic"
63
63
  },
64
- "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.12.1/packages/web/vite-plugin-runic#readme",
64
+ "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/vite-plugin-runic#readme",
65
65
  "bugs": {
66
66
  "url": "https://github.com/Runic-Artifex/runic-sdk/issues"
67
67
  },
@@ -72,5 +72,5 @@
72
72
  "vite-plugin",
73
73
  "devtools"
74
74
  ],
75
- "gitHead": "124a532e5861cff03e77d2ef0c5d4f081ee99a47"
75
+ "gitHead": "11dc038ea80315c4d2b7e15cbd03dfe175ed6124"
76
76
  }