@runic-artifex/vite-plugin-runic 0.2.0-preview.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/LICENSE +22 -0
- package/README.md +202 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +64 -0
- package/dist/client.js.map +1 -0
- package/dist/diagnostics.d.ts +33 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +104 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +438 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
- package/virtual.d.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Runic Artifex contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Runic Vite
|
|
4
|
+
|
|
5
|
+
Develop Runic browser and desktop applications with Vite: retain
|
|
6
|
+
long-lived resources through HMR, surface Application Bridge diagnostics, and
|
|
7
|
+
use the official Vite DevTools dock when you want it.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -D @runic-artifex/vite-plugin-runic@preview @runic-artifex/application-bridge-tooling@preview vite@^8
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package is a public npm preview. The `preview` tag selects the current
|
|
16
|
+
preview release; check the [package catalog and release status](https://docs.runic-artifex.eu/packages)
|
|
17
|
+
before upgrading. It requires Node.js `>=24.18.0` and Vite `^8.0.0`.
|
|
18
|
+
|
|
19
|
+
For the optional diagnostics dock, also install Vite DevTools:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install -D @vitejs/devtools
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Choose this plugin for a Runic application built with Vite. It is the
|
|
26
|
+
development integration, not an Application Bridge runtime or a SvelteKit
|
|
27
|
+
adapter; see the [Application Bridge guide](https://docs.runic-artifex.eu/application-bridge)
|
|
28
|
+
or [`@runic-artifex/sveltekit`](https://www.npmjs.com/package/@runic-artifex/sveltekit)
|
|
29
|
+
when those are what your application needs.
|
|
30
|
+
|
|
31
|
+
## Configure Vite
|
|
32
|
+
|
|
33
|
+
Add the plugin to `vite.config.ts`. `DevTools` is optional; remove it (or set
|
|
34
|
+
`devtools: false`) if your project does not use `@vitejs/devtools`.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { DevTools } from "@vitejs/devtools";
|
|
38
|
+
import { runic } from "@runic-artifex/vite-plugin-runic";
|
|
39
|
+
import { defineConfig } from "vite";
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
plugins: [
|
|
43
|
+
DevTools({ embeddedVisibility: "passive" }),
|
|
44
|
+
runic({
|
|
45
|
+
desktop: true,
|
|
46
|
+
applicationBridge: true,
|
|
47
|
+
contract: {
|
|
48
|
+
identity: "example.desktop-app",
|
|
49
|
+
version: "1",
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then import the virtual client once from your browser entry (for example,
|
|
57
|
+
`src/main.ts`). This import is required, including for native or backend-hosted
|
|
58
|
+
HTML, because it connects the browser-side helpers to the Vite integration.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { createRunicDevtoolsObserver } from "virtual:runic/client";
|
|
62
|
+
|
|
63
|
+
const observer = createRunicDevtoolsObserver();
|
|
64
|
+
|
|
65
|
+
observer.state({
|
|
66
|
+
connection: { state: "connecting", transport: "cs-webui" },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
observer.trace({ kind: "connection", label: "Application Bridge connecting" });
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Pass `observer` to the code that owns bridge state and events. A resource
|
|
73
|
+
retained with `preserveRunicHmrResource` is reused across HMR updates; call
|
|
74
|
+
`disposeRunicHmrResource` when it should be released explicitly.
|
|
75
|
+
|
|
76
|
+
If TypeScript cannot resolve the virtual module, include its declaration in a
|
|
77
|
+
project declaration file such as `src/vite-env.d.ts`:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
/// <reference types="@runic-artifex/vite-plugin-runic/virtual" />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Options and virtual client
|
|
84
|
+
|
|
85
|
+
`runic(options)` accepts the following options:
|
|
86
|
+
|
|
87
|
+
| Option | Default | Purpose |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| `contract` | none | Initial diagnostic contract metadata: `identity`, `version`, and `fingerprint`. |
|
|
90
|
+
| `applicationBridge` | `false` | Generates Bridge IR and the fingerprint facade at startup/build and watches imported contract modules. Pass `{ source, ir, facade }` for non-conventional paths. |
|
|
91
|
+
| `devtools` | `"auto"` | Registers the Runic dock when `DevTools()` is configured. Set `false` to disable the Runic dock; `true` requires the DevTools plugin during development. |
|
|
92
|
+
| `maxTimelineEntries` | `200` | Maximum retained diagnostic timeline entries (clamped to `1`–`500`). |
|
|
93
|
+
| `desktop` | `false` | Injects `./runic-desktop.js` and emits relocatable production assets; pass an absolute Desktop bootstrap URL when Vite owns the development page origin. |
|
|
94
|
+
|
|
95
|
+
The plugin provides one virtual module, `virtual:runic/client`, with
|
|
96
|
+
these browser helpers:
|
|
97
|
+
|
|
98
|
+
| Export | Use |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `createRunicDevtoolsObserver()` | Creates `state` and `trace` functions for Application Bridge diagnostics. |
|
|
101
|
+
| `createRunicDiagnosticReporter(source)` | Creates a browser reporter for `"application-bridge"`, `"assets"`, or `"translations"`. |
|
|
102
|
+
| `reportRunicDiagnostic(entry)` | Sends one source-tagged diagnostic summary directly. |
|
|
103
|
+
| `reportRunicState(state)` / `traceRunicEvent(entry)` | Sends state or a timeline entry directly. |
|
|
104
|
+
| `preserveRunicHmrResource(key, create)` | Keeps a resource alive across HMR updates. |
|
|
105
|
+
| `disposeRunicHmrResource(key, dispose?)` | Releases a retained resource; by default, calls its `dispose()` method when present. |
|
|
106
|
+
|
|
107
|
+
During development, the optional dock shows contract, connection, operation,
|
|
108
|
+
and recent timeline state. Diagnostic data is bounded and removes detail fields
|
|
109
|
+
named for secrets, credentials, capabilities, passwords, paths, URLs, frames,
|
|
110
|
+
or stacks before it is displayed.
|
|
111
|
+
|
|
112
|
+
Browser and server reporters accept only a bounded summary: primitive detail
|
|
113
|
+
values (`string`, `number`, `boolean`, or `null`) and a short label. Sensitive
|
|
114
|
+
or path-like text is redacted before browser HMR transport and sanitized again
|
|
115
|
+
by the server. The server assigns timeline IDs and timestamps; callers should
|
|
116
|
+
not rely on supplied IDs or timestamps being retained.
|
|
117
|
+
|
|
118
|
+
Companion Vite integrations can report server-side summaries through the
|
|
119
|
+
plugin's `diagnostics` seam. It is intentionally summary-only: Application
|
|
120
|
+
Bridge, Assets, and Translations remain the authority for their own contracts,
|
|
121
|
+
artifacts, and diagnostic models.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
const plugin = runic();
|
|
125
|
+
|
|
126
|
+
export default defineConfig({
|
|
127
|
+
plugins: [plugin],
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Pass this to a companion integration; it can only submit summaries.
|
|
131
|
+
runic.diagnostics.report({
|
|
132
|
+
source: "assets",
|
|
133
|
+
kind: "event",
|
|
134
|
+
label: "Assets refreshed",
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Development and production behavior
|
|
139
|
+
|
|
140
|
+
The DevTools client is injected only for `vite serve` when DevTools is
|
|
141
|
+
available. It is not included in production builds. The virtual-client imports
|
|
142
|
+
remain safe in production: without Vite HMR, reporting functions are no-ops.
|
|
143
|
+
|
|
144
|
+
With `applicationBridge` enabled, generation failures fail production builds and
|
|
145
|
+
appear in the development overlay while the last good IR and facade remain in
|
|
146
|
+
place. A successful wire change triggers a full reload instead of ordinary HMR.
|
|
147
|
+
|
|
148
|
+
Runic Desktop can coexist with Vite's own development server and HMR socket:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
runic({
|
|
152
|
+
desktop: {
|
|
153
|
+
bootstrapUrl: "http://127.0.0.1:43123/runic-desktop.js",
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The Desktop surface must admit the Vite origin through its typed security
|
|
159
|
+
policy. The plugin injects only the bootstrap script; Vite retains development
|
|
160
|
+
server, module graph, build, proxy, and HMR ownership. For production content
|
|
161
|
+
served by the Desktop surface itself, `desktop: true` injects the relative
|
|
162
|
+
bootstrap URL.
|
|
163
|
+
|
|
164
|
+
## v0.2 migration
|
|
165
|
+
|
|
166
|
+
`@runic-artifex/vite-plugin-runic-toolkit` was replaced by
|
|
167
|
+
`@runic-artifex/vite-plugin-runic`; it is not a forwarding package. Replace the
|
|
168
|
+
package install, `runicToolkit()` import and call with `runic()`, and every
|
|
169
|
+
`virtual:runic-toolkit/client` import with `virtual:runic/client`. The new
|
|
170
|
+
plugin deliberately rejects the former virtual module with
|
|
171
|
+
`RUNICP001` and this exact remediation.
|
|
172
|
+
|
|
173
|
+
For a working SvelteKit integration, see the [reference application](https://github.com/Runic-Artifex/runic-sdk/tree/main/apps/translations-editor/Frontend).
|
|
174
|
+
|
|
175
|
+
## Troubleshooting
|
|
176
|
+
|
|
177
|
+
- **Cannot resolve `virtual:runic/client`:** register `runic()`
|
|
178
|
+
in the Vite configuration used by the active command, then restart Vite.
|
|
179
|
+
- **TypeScript cannot find the virtual module:** add the triple-slash reference
|
|
180
|
+
shown above and ensure your project includes that declaration file.
|
|
181
|
+
- **No Runic dock:** install `@vitejs/devtools`, add `DevTools(...)`,
|
|
182
|
+
and do not set `devtools: false`. The plugin works without the dock.
|
|
183
|
+
- **The dock has no application activity:** import the virtual client in the
|
|
184
|
+
browser entry and report state or trace events from the code that owns your
|
|
185
|
+
Application Bridge.
|
|
186
|
+
|
|
187
|
+
## Support and license
|
|
188
|
+
|
|
189
|
+
- [Runic Application documentation](https://docs.runic-artifex.eu/products/runic-application)
|
|
190
|
+
- [npm package](https://www.npmjs.com/package/@runic-artifex/vite-plugin-runic)
|
|
191
|
+
- [Issues and support](https://github.com/Runic-Artifex/runic-sdk/issues)
|
|
192
|
+
- [MIT License](https://github.com/Runic-Artifex/runic-sdk/blob/main/LICENSE)
|
|
193
|
+
|
|
194
|
+
### Bun runtime
|
|
195
|
+
|
|
196
|
+
Run repository scripts with `bun run --bun`. Build, HMR, bridge generation,
|
|
197
|
+
core diagnostics and the optional Vite DevTools dock support Bun 1.4.2 and Node 24.
|
|
198
|
+
DevTools 0.5 owns its HTML injection. Configure visibility on
|
|
199
|
+
`DevTools({ embeddedVisibility: "passive" })`; the old Runic
|
|
200
|
+
`devtoolsVisibility` option and manual `@vitejs/devtools/client/inject*` imports
|
|
201
|
+
are removed. Core diagnostics remain available without DevTools installed.
|
|
202
|
+
Both Bun and Node run the installed package consumer check.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type RunicDiagnosticEntry, type RunicDiagnosticSource, type RunicTraceEntry } from "./diagnostics.js";
|
|
2
|
+
export type { RunicDiagnosticDetail, RunicDiagnosticDetailValue, RunicDiagnosticEntry, RunicDiagnosticSource, RunicTraceEntry, RunicTraceKind, } from "./diagnostics.js";
|
|
3
|
+
export interface RunicRuntimeState {
|
|
4
|
+
readonly contract?: Readonly<{
|
|
5
|
+
identity?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
fingerprint?: string;
|
|
8
|
+
}>;
|
|
9
|
+
readonly connection?: Readonly<{
|
|
10
|
+
state?: "connecting" | "connected" | "disconnected" | "closed";
|
|
11
|
+
transport?: string;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
revision?: number;
|
|
14
|
+
sequence?: number;
|
|
15
|
+
}>;
|
|
16
|
+
readonly operations?: readonly Readonly<{
|
|
17
|
+
id: string;
|
|
18
|
+
state: string;
|
|
19
|
+
completed?: number;
|
|
20
|
+
total?: number;
|
|
21
|
+
}>[];
|
|
22
|
+
}
|
|
23
|
+
export interface RunicDevtoolsObserver {
|
|
24
|
+
readonly state: (state: RunicRuntimeState) => void;
|
|
25
|
+
readonly trace: (entry: RunicTraceEntry) => void;
|
|
26
|
+
readonly diagnostic?: (entry: Omit<RunicDiagnosticEntry, "source">) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface RunicDiagnosticReporter {
|
|
29
|
+
readonly report: (entry: Omit<RunicDiagnosticEntry, "source">) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function reportRunicState(state: RunicRuntimeState): void;
|
|
32
|
+
export declare function traceRunicEvent(entry: RunicTraceEntry): void;
|
|
33
|
+
/**
|
|
34
|
+
* Reports a display-safe summary from an authoritative Runic subsystem.
|
|
35
|
+
* This intentionally accepts no subsystem state or artifact model.
|
|
36
|
+
*/
|
|
37
|
+
export declare function reportRunicDiagnostic(entry: RunicDiagnosticEntry): void;
|
|
38
|
+
export declare function createRunicDiagnosticReporter(source: RunicDiagnosticSource): RunicDiagnosticReporter;
|
|
39
|
+
export declare function createRunicDevtoolsObserver(): RunicDevtoolsObserver;
|
|
40
|
+
export declare function preserveRunicHmrResource<T>(key: string, create: () => T): T;
|
|
41
|
+
export declare function disposeRunicHmrResource(key: string, dispose?: (resource: unknown) => void | Promise<void>): Promise<void>;
|
|
42
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC;QAC7B,KAAK,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,QAAQ,CAAC;QAC/D,SAAS,C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3E;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAkB,GACpE,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { sanitizeDiagnosticSummary, } from "./diagnostics.js";
|
|
2
|
+
const hot = import.meta.hot;
|
|
3
|
+
const resourcesKey = "runic:resources";
|
|
4
|
+
const diagnosticEvent = "runic:diagnostic";
|
|
5
|
+
const resources = hot?.data[resourcesKey] ?? new Map();
|
|
6
|
+
if (hot)
|
|
7
|
+
hot.data[resourcesKey] = resources;
|
|
8
|
+
export function reportRunicState(state) {
|
|
9
|
+
hot?.send("runic:state", state);
|
|
10
|
+
}
|
|
11
|
+
export function traceRunicEvent(entry) {
|
|
12
|
+
sendDiagnostic({ ...entry, source: "application-bridge" });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reports a display-safe summary from an authoritative Runic subsystem.
|
|
16
|
+
* This intentionally accepts no subsystem state or artifact model.
|
|
17
|
+
*/
|
|
18
|
+
export function reportRunicDiagnostic(entry) {
|
|
19
|
+
sendDiagnostic(entry);
|
|
20
|
+
}
|
|
21
|
+
function sendDiagnostic(candidate) {
|
|
22
|
+
const summary = sanitizeDiagnosticSummary(candidate);
|
|
23
|
+
if (summary)
|
|
24
|
+
hot?.send(diagnosticEvent, summary);
|
|
25
|
+
}
|
|
26
|
+
export function createRunicDiagnosticReporter(source) {
|
|
27
|
+
return {
|
|
28
|
+
report: (entry) => reportRunicDiagnostic({ ...entry, source }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function createRunicDevtoolsObserver() {
|
|
32
|
+
return {
|
|
33
|
+
state: reportRunicState,
|
|
34
|
+
trace: traceRunicEvent,
|
|
35
|
+
diagnostic: createRunicDiagnosticReporter("application-bridge").report,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function preserveRunicHmrResource(key, create) {
|
|
39
|
+
if (resources.has(key))
|
|
40
|
+
return resources.get(key);
|
|
41
|
+
const resource = create();
|
|
42
|
+
resources.set(key, resource);
|
|
43
|
+
return resource;
|
|
44
|
+
}
|
|
45
|
+
export async function disposeRunicHmrResource(key, dispose = defaultDispose) {
|
|
46
|
+
const resource = resources.get(key);
|
|
47
|
+
if (resource === undefined)
|
|
48
|
+
return;
|
|
49
|
+
resources.delete(key);
|
|
50
|
+
await dispose(resource);
|
|
51
|
+
}
|
|
52
|
+
async function defaultDispose(resource) {
|
|
53
|
+
if (typeof resource !== "object" || resource === null || !("dispose" in resource))
|
|
54
|
+
return;
|
|
55
|
+
const dispose = resource.dispose;
|
|
56
|
+
if (typeof dispose === "function")
|
|
57
|
+
await dispose.call(resource);
|
|
58
|
+
}
|
|
59
|
+
hot?.on("runic:state", () => undefined);
|
|
60
|
+
hot?.prune(async () => {
|
|
61
|
+
for (const key of [...resources.keys()])
|
|
62
|
+
await disposeRunicHmrResource(key);
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAI1B,MAAM,kBAAkB,CAAC;AAqD1B,MAAM,GAAG,GAAI,MAAM,CAAC,IAA0B,CAAC,GAAG,CAAC;AACnD,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAC3C,MAAM,SAAS,GAAI,GAAG,EAAE,IAAI,CAAC,YAAY,CAAsC,IAAI,IAAI,GAAG,EAAmB,CAAC;AAC9G,IAAI,GAAG;IAAE,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,KAAwB;IACvD,GAAG,EAAE,IAA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AC,CAAC;IACpC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO;IACnC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,QAAiB;IAC7C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC;QAAE,OAAO;IAC1F,MAAM,OAAO,GAAI,QAAkC,CAAC,OAAO,CAAC;IAC5D,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,GAAG,EAAE,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AACxC,GAAG,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;IACpB,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAAE,MAAM,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAC9E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type RunicTraceKind = "command" | "receipt" | "event" | "operation" | "connection" | "error";
|
|
2
|
+
export type RunicDiagnosticSource = "application-bridge" | "assets" | "translations";
|
|
3
|
+
export type RunicDiagnosticDetailValue = string | number | boolean | null;
|
|
4
|
+
export type RunicDiagnosticDetail = Readonly<Record<string, RunicDiagnosticDetailValue>>;
|
|
5
|
+
export interface RunicDiagnosticEntry {
|
|
6
|
+
readonly source: RunicDiagnosticSource;
|
|
7
|
+
readonly id?: string;
|
|
8
|
+
readonly timestamp?: string;
|
|
9
|
+
readonly kind: RunicTraceKind;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly detail?: RunicDiagnosticDetail;
|
|
12
|
+
}
|
|
13
|
+
export interface RunicTraceEntry {
|
|
14
|
+
readonly id?: string;
|
|
15
|
+
readonly timestamp?: string;
|
|
16
|
+
readonly kind: RunicTraceKind;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** Legacy bridge input; it is reduced to DiagnosticDetail before transport. */
|
|
19
|
+
readonly detail?: Readonly<Record<string, unknown>>;
|
|
20
|
+
}
|
|
21
|
+
export interface RunicDiagnosticSummary {
|
|
22
|
+
readonly source: RunicDiagnosticSource;
|
|
23
|
+
readonly kind: RunicTraceKind;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly detail: RunicDiagnosticDetail;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Converts an arbitrary diagnostic candidate into the only shape that may be
|
|
29
|
+
* transported or displayed. The caller still owns identifier and timestamp.
|
|
30
|
+
*/
|
|
31
|
+
export declare function sanitizeDiagnosticSummary(candidate: unknown, forcedSource?: RunicDiagnosticSource): RunicDiagnosticSummary | undefined;
|
|
32
|
+
export declare function diagnosticSource(value: unknown): RunicDiagnosticSource | undefined;
|
|
33
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,SAAS,GACT,OAAO,GACP,WAAW,GACX,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,QAAQ,GACR,cAAc,CAAC;AAEnB,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAEzF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC;AAkBD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,OAAO,EAClB,YAAY,CAAC,EAAE,qBAAqB,GACnC,sBAAsB,GAAG,SAAS,CAgBpC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,GAAG,SAAS,CAIlF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const allowedKinds = new Set([
|
|
2
|
+
"command", "receipt", "event", "operation", "connection", "error",
|
|
3
|
+
]);
|
|
4
|
+
const maximumDetailEntries = 12;
|
|
5
|
+
const maximumDetailCandidates = 24;
|
|
6
|
+
const maximumDetailKeyLength = 40;
|
|
7
|
+
const maximumDetailStringLength = 96;
|
|
8
|
+
const maximumLabelLength = 160;
|
|
9
|
+
// Leaves room for the server-owned id and timestamp in the public entry.
|
|
10
|
+
const maximumSerializedSummaryLength = 1_800;
|
|
11
|
+
const redacted = "[redacted]";
|
|
12
|
+
const sensitiveKey = /token|secret|capability|password|path|file(?:name)?|directory|cwd|frame|stack|authorization|cookie|credential|query|uri|url|api[-_]?key/iu;
|
|
13
|
+
const sensitiveContent = /(?:bearer\s+\S+|(?:token|secret|password|authorization|cookie|credential|api[-_]?key)\s*[:=]\s*\S+)/iu;
|
|
14
|
+
const pathLikeContent = /(?:\b[a-z][a-z0-9+.-]*:(?:\/\/|[\\/])|(?:^|[\s"'(=:])(?:~?\/|\.{1,2}[\\/]|[A-Za-z]:[\\/]|\\\\|[^\s/\\]+[\\/][^\s/\\]+))/iu;
|
|
15
|
+
const controlCharacters = /[\u0000-\u001F\u007F]/u;
|
|
16
|
+
/**
|
|
17
|
+
* Converts an arbitrary diagnostic candidate into the only shape that may be
|
|
18
|
+
* transported or displayed. The caller still owns identifier and timestamp.
|
|
19
|
+
*/
|
|
20
|
+
export function sanitizeDiagnosticSummary(candidate, forcedSource) {
|
|
21
|
+
if (!isRecord(candidate))
|
|
22
|
+
return undefined;
|
|
23
|
+
const source = forcedSource ?? diagnosticSource(candidate.source);
|
|
24
|
+
const kind = typeof candidate.kind === "string" && allowedKinds.has(candidate.kind)
|
|
25
|
+
? candidate.kind
|
|
26
|
+
: undefined;
|
|
27
|
+
const label = sanitizeText(candidate.label, maximumLabelLength);
|
|
28
|
+
if (!source || !kind || !label)
|
|
29
|
+
return undefined;
|
|
30
|
+
const summary = {
|
|
31
|
+
source,
|
|
32
|
+
kind,
|
|
33
|
+
label,
|
|
34
|
+
detail: sanitizeDetail(candidate.detail),
|
|
35
|
+
};
|
|
36
|
+
return fitSummary(summary);
|
|
37
|
+
}
|
|
38
|
+
export function diagnosticSource(value) {
|
|
39
|
+
return value === "application-bridge" || value === "assets" || value === "translations"
|
|
40
|
+
? value
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
function sanitizeDetail(candidate) {
|
|
44
|
+
if (!isRecord(candidate))
|
|
45
|
+
return {};
|
|
46
|
+
const output = {};
|
|
47
|
+
let count = 0;
|
|
48
|
+
let inspected = 0;
|
|
49
|
+
for (const key in candidate) {
|
|
50
|
+
if (!Object.prototype.hasOwnProperty.call(candidate, key))
|
|
51
|
+
continue;
|
|
52
|
+
if (inspected >= maximumDetailCandidates)
|
|
53
|
+
break;
|
|
54
|
+
inspected += 1;
|
|
55
|
+
if (count >= maximumDetailEntries)
|
|
56
|
+
break;
|
|
57
|
+
const cleanKey = sanitizeKey(key);
|
|
58
|
+
if (!cleanKey || sensitiveKey.test(cleanKey))
|
|
59
|
+
continue;
|
|
60
|
+
const value = candidate[key];
|
|
61
|
+
if (typeof value === "string") {
|
|
62
|
+
output[cleanKey] = sanitizeText(value, maximumDetailStringLength) ?? redacted;
|
|
63
|
+
}
|
|
64
|
+
else if (typeof value === "number" && Number.isFinite(value)) {
|
|
65
|
+
output[cleanKey] = value;
|
|
66
|
+
}
|
|
67
|
+
else if (typeof value === "boolean" || value === null) {
|
|
68
|
+
output[cleanKey] = value;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
count += 1;
|
|
74
|
+
}
|
|
75
|
+
return output;
|
|
76
|
+
}
|
|
77
|
+
function fitSummary(summary) {
|
|
78
|
+
const detail = { ...summary.detail };
|
|
79
|
+
while (JSON.stringify({ ...summary, detail }).length > maximumSerializedSummaryLength) {
|
|
80
|
+
const key = Object.keys(detail).at(-1);
|
|
81
|
+
if (key === undefined)
|
|
82
|
+
return { ...summary, detail: {} };
|
|
83
|
+
delete detail[key];
|
|
84
|
+
}
|
|
85
|
+
return { ...summary, detail };
|
|
86
|
+
}
|
|
87
|
+
function sanitizeKey(value) {
|
|
88
|
+
if (value.length === 0 || value.length > maximumDetailKeyLength || controlCharacters.test(value))
|
|
89
|
+
return undefined;
|
|
90
|
+
if (value === "__proto__" || value === "constructor" || value === "prototype")
|
|
91
|
+
return undefined;
|
|
92
|
+
return pathLikeContent.test(value) ? undefined : value;
|
|
93
|
+
}
|
|
94
|
+
function sanitizeText(value, maximumLength) {
|
|
95
|
+
if (typeof value !== "string" || value.length === 0 || value.length > maximumLength)
|
|
96
|
+
return undefined;
|
|
97
|
+
if (controlCharacters.test(value))
|
|
98
|
+
return undefined;
|
|
99
|
+
return sensitiveContent.test(value) || pathLikeContent.test(value) ? redacted : value;
|
|
100
|
+
}
|
|
101
|
+
function isRecord(value) {
|
|
102
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAyCA,MAAM,YAAY,GAAG,IAAI,GAAG,CAAiB;IAC3C,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO;CAClE,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,yEAAyE;AACzE,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAC7C,MAAM,QAAQ,GAAG,YAAY,CAAC;AAC9B,MAAM,YAAY,GAAG,2IAA2I,CAAC;AACjK,MAAM,gBAAgB,GAAG,uGAAuG,CAAC;AACjI,MAAM,eAAe,GAAG,2HAA2H,CAAC;AACpJ,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEnD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAkB,EAClB,YAAoC;IAEpC,IAAI,CAAC,QAAQ,CAAC,SAAS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ry } from "./client.js";
|
|
3
|
+
export type { RunicDevtoolsObserver, RunicDiagnosticDetail, RunicDiagnosticDetailValue, RunicDiagnosticEntry, RunicDiagnosticReporter, RunicDiagnosticSource, RunicRuntimeState, RunicTraceEntry, RunicTraceKind, } from "./client.js";
|
|
4
|
+
export interface RunicVitePlugin extends Plugin {
|
|
5
|
+
/** Server-side input for display-safe companion diagnostics. */
|
|
6
|
+
readonly diagnostics: Readonly<{
|
|
7
|
+
report(entry: RunicDiagnosticEntry): void;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface RunicViteOptions {
|
|
11
|
+
/** Selects one authority for the complete Application Bridge contract. */
|
|
12
|
+
readonly applicationBridge?: boolean | (Readonly<{
|
|
13
|
+
ir?: string;
|
|
14
|
+
facade?: string;
|
|
15
|
+
}> & (Readonly<{
|
|
16
|
+
authority: "csharp";
|
|
17
|
+
project?: string;
|
|
18
|
+
source?: never;
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
authority: "effect";
|
|
21
|
+
source: string;
|
|
22
|
+
project?: never;
|
|
23
|
+
}>));
|
|
24
|
+
readonly contract?: Readonly<{
|
|
25
|
+
identity?: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
fingerprint?: string;
|
|
28
|
+
}>;
|
|
29
|
+
readonly devtools?: boolean | "auto";
|
|
30
|
+
readonly maxTimelineEntries?: number;
|
|
31
|
+
/** Injects the Runic Desktop bootstrap without taking ownership of Vite or HMR. */
|
|
32
|
+
readonly desktop?: boolean | Readonly<{
|
|
33
|
+
/** Absolute development bootstrap URL; production uses the surface-relative default. */
|
|
34
|
+
bootstrapUrl?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export interface RunicDevelopmentState {
|
|
38
|
+
readonly contract: Readonly<{
|
|
39
|
+
identity: string;
|
|
40
|
+
version: string;
|
|
41
|
+
fingerprint: string;
|
|
42
|
+
}>;
|
|
43
|
+
readonly vite: Readonly<{
|
|
44
|
+
command: string;
|
|
45
|
+
mode: string;
|
|
46
|
+
root: string;
|
|
47
|
+
}>;
|
|
48
|
+
readonly connection: Readonly<{
|
|
49
|
+
state: string;
|
|
50
|
+
transport: string;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
revision: number;
|
|
53
|
+
sequence: number;
|
|
54
|
+
}>;
|
|
55
|
+
readonly operations: readonly Readonly<{
|
|
56
|
+
id: string;
|
|
57
|
+
state: string;
|
|
58
|
+
completed: number;
|
|
59
|
+
total: number;
|
|
60
|
+
}>[];
|
|
61
|
+
readonly timeline: readonly Readonly<Required<Pick<RunicTraceEntry, "id" | "timestamp" | "kind" | "label">> & {
|
|
62
|
+
source?: RunicDiagnosticSource;
|
|
63
|
+
detail: RunicDiagnosticDetail;
|
|
64
|
+
}>[];
|
|
65
|
+
}
|
|
66
|
+
export declare function runic(options?: RunicViteOptions): RunicVitePlugin;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAMlE,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAErB,eAAe,EAChB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAC;AAYrB,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;QAC7B,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;KAC3C,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,iBAAi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AC;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC;QACrC,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,EAAE,CAAC;IACL,QAAQ,CAAC,QAAQ,EAAE,SAAS,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG;QAC5G,MAAM,CAAC,EAAE,qBAAqB,CAAC;QAC/B,MAAM,EAAE,qBAAqB,CAAC;KAC/B,CAAC,EAAE,CAAC;CACN;AAED,wBAAgB,KAAK,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CA4RrE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/// <reference types="@vitejs/devtools-kit" />
|
|
2
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve, extname, sep } from "node:path";
|
|
4
|
+
import { sanitizeDiagnosticSummary } from "./diagnostics.js";
|
|
5
|
+
const virtualClientId = "virtual:runic/client";
|
|
6
|
+
const resolvedVirtualClientId = `\0${virtualClientId}`;
|
|
7
|
+
const legacyVirtualClientId = "virtual:runic-toolkit/client";
|
|
8
|
+
const stateEvent = "runic:state";
|
|
9
|
+
const diagnosticEvent = "runic:diagnostic";
|
|
10
|
+
const traceEvent = "runic:trace";
|
|
11
|
+
const stateKey = "runic:state";
|
|
12
|
+
const defaultTimelineLimit = 200;
|
|
13
|
+
const maximumTimelineLimit = 500;
|
|
14
|
+
export function runic(options = {}) {
|
|
15
|
+
const maxTimelineEntries = timelineLimit(options.maxTimelineEntries);
|
|
16
|
+
let server;
|
|
17
|
+
let sharedState;
|
|
18
|
+
let jsonRenderer;
|
|
19
|
+
let state = initialState(options);
|
|
20
|
+
let nextDiagnosticSequence = 1;
|
|
21
|
+
let resolvedRoot = process.cwd();
|
|
22
|
+
let bridgeDependencies = new Set();
|
|
23
|
+
let bridgeGeneration = Promise.resolve(undefined);
|
|
24
|
+
const desktopBootstrapUrl = resolveDesktopBootstrapUrl(options.desktop);
|
|
25
|
+
const bridgeHostReadyPath = process.env.RUNIC_APPLICATION_BRIDGE_HOST_READY;
|
|
26
|
+
const bridgeOptions = async () => {
|
|
27
|
+
if (options.applicationBridge === undefined || options.applicationBridge === false)
|
|
28
|
+
return undefined;
|
|
29
|
+
const overrides = options.applicationBridge === true ? { authority: "csharp" } : options.applicationBridge;
|
|
30
|
+
if (overrides.authority === "effect")
|
|
31
|
+
return { root: resolvedRoot, ...overrides };
|
|
32
|
+
let project = overrides.project;
|
|
33
|
+
if (project === undefined) {
|
|
34
|
+
const directory = dirname(resolvedRoot);
|
|
35
|
+
const projects = (await readdir(directory)).filter(file => file.endsWith(".csproj"));
|
|
36
|
+
if (projects.length !== 1)
|
|
37
|
+
throw new Error("C# Application Bridge requires a project path when the frontend parent does not contain exactly one .csproj.");
|
|
38
|
+
project = resolve(directory, projects[0]);
|
|
39
|
+
}
|
|
40
|
+
return { root: resolvedRoot, ...overrides, project };
|
|
41
|
+
};
|
|
42
|
+
let lastReloadedFingerprint;
|
|
43
|
+
let bridgeReloadGeneration = 0;
|
|
44
|
+
let bridgeTimer;
|
|
45
|
+
const isCSharp = options.applicationBridge === true || (typeof options.applicationBridge === "object" && options.applicationBridge.authority === "csharp");
|
|
46
|
+
const csharpRoots = new Set();
|
|
47
|
+
const generateBridge = async (reportToOverlay) => {
|
|
48
|
+
const compilerOptions = await bridgeOptions();
|
|
49
|
+
if (compilerOptions === undefined)
|
|
50
|
+
return Promise.resolve(undefined);
|
|
51
|
+
bridgeGeneration = bridgeGeneration.catch(() => undefined).then(async () => {
|
|
52
|
+
try {
|
|
53
|
+
const tooling = await import("@runic-artifex/application-bridge-tooling").catch((error) => {
|
|
54
|
+
throw new Error("applicationBridge requires @runic-artifex/application-bridge-tooling to be installed.", { cause: error });
|
|
55
|
+
});
|
|
56
|
+
const result = await tooling.generateApplicationBridge(compilerOptions);
|
|
57
|
+
bridgeDependencies = new Set(result.dependencies);
|
|
58
|
+
server?.watcher.add(result.dependencies);
|
|
59
|
+
if (isCSharp) {
|
|
60
|
+
for (const file of result.dependencies)
|
|
61
|
+
if (file.endsWith(".csproj"))
|
|
62
|
+
csharpRoots.add(dirname(file));
|
|
63
|
+
server?.watcher.add([...csharpRoots]);
|
|
64
|
+
}
|
|
65
|
+
state = {
|
|
66
|
+
...state,
|
|
67
|
+
contract: {
|
|
68
|
+
identity: result.ir.wire.protocol.identity,
|
|
69
|
+
version: String(result.ir.wire.protocol.version),
|
|
70
|
+
fingerprint: result.ir.fingerprint.value,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
appendDiagnostic({
|
|
74
|
+
source: "application-bridge",
|
|
75
|
+
kind: "event",
|
|
76
|
+
label: result.changed ? "Application bridge contract generated" : "Application bridge contract is current",
|
|
77
|
+
detail: { status: result.changed ? "generated" : "current" },
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
83
|
+
appendDiagnostic({
|
|
84
|
+
source: "application-bridge",
|
|
85
|
+
kind: "error",
|
|
86
|
+
label: "Application bridge contract generation failed",
|
|
87
|
+
detail: { errorMessage: failure.message },
|
|
88
|
+
});
|
|
89
|
+
if (reportToOverlay && server !== undefined) {
|
|
90
|
+
server.ws.send({
|
|
91
|
+
type: "error",
|
|
92
|
+
err: { message: failure.message, stack: failure.stack ?? failure.message },
|
|
93
|
+
});
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
throw failure;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return bridgeGeneration;
|
|
100
|
+
};
|
|
101
|
+
const reloadBridge = async () => {
|
|
102
|
+
const result = await generateBridge(true);
|
|
103
|
+
if (result?.changed && result.ir.fingerprint.value !== lastReloadedFingerprint) {
|
|
104
|
+
const generation = ++bridgeReloadGeneration;
|
|
105
|
+
if (bridgeHostReadyPath === undefined) {
|
|
106
|
+
appendDiagnostic({
|
|
107
|
+
source: "application-bridge",
|
|
108
|
+
kind: "event",
|
|
109
|
+
label: "Application bridge host rebuild required",
|
|
110
|
+
detail: { status: "fingerprint-mismatch" },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
appendDiagnostic({
|
|
115
|
+
source: "application-bridge",
|
|
116
|
+
kind: "event",
|
|
117
|
+
label: "Waiting for the matching application host",
|
|
118
|
+
detail: { status: "waiting-for-host" },
|
|
119
|
+
});
|
|
120
|
+
try {
|
|
121
|
+
await waitForMatchingBridgeHost(bridgeHostReadyPath, result.ir.fingerprint.value);
|
|
122
|
+
if (generation !== bridgeReloadGeneration)
|
|
123
|
+
return [];
|
|
124
|
+
appendDiagnostic({
|
|
125
|
+
source: "application-bridge",
|
|
126
|
+
kind: "event",
|
|
127
|
+
label: "Matching application host is ready",
|
|
128
|
+
detail: { status: "host-ready" },
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (generation !== bridgeReloadGeneration)
|
|
133
|
+
return [];
|
|
134
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
135
|
+
appendDiagnostic({
|
|
136
|
+
source: "application-bridge",
|
|
137
|
+
kind: "error",
|
|
138
|
+
label: "Application bridge host did not reach the generated fingerprint",
|
|
139
|
+
detail: { errorMessage: failure.message },
|
|
140
|
+
});
|
|
141
|
+
server?.ws.send({ type: "error", err: { message: failure.message, stack: failure.stack ?? failure.message } });
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (result.ir.fingerprint.value !== lastReloadedFingerprint) {
|
|
146
|
+
lastReloadedFingerprint = result.ir.fingerprint.value;
|
|
147
|
+
server?.ws.send({ type: "full-reload" });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const onCSharpChange = (file) => {
|
|
152
|
+
if (!isCSharp || ![".cs", ".csproj", ".props", ".targets"].includes(extname(file)) || file.split(sep).some(part => part === "obj" || part === "bin") || ![...csharpRoots].some(root => file.startsWith(root + sep)))
|
|
153
|
+
return;
|
|
154
|
+
if (bridgeTimer !== undefined)
|
|
155
|
+
clearTimeout(bridgeTimer);
|
|
156
|
+
bridgeTimer = setTimeout(() => { void reloadBridge(); }, 80);
|
|
157
|
+
};
|
|
158
|
+
const publish = () => {
|
|
159
|
+
sharedState?.mutate((draft) => Object.assign(draft, structuredClone(state)));
|
|
160
|
+
void jsonRenderer?.updateSpec(createDevtoolsSpec(state));
|
|
161
|
+
server?.ws.send({ type: "custom", event: stateEvent, data: state });
|
|
162
|
+
};
|
|
163
|
+
const applyRuntimeState = (candidate) => {
|
|
164
|
+
const update = sanitizeRuntimeState(candidate);
|
|
165
|
+
state = {
|
|
166
|
+
...state,
|
|
167
|
+
...(update.contract ? { contract: { ...state.contract, ...update.contract } } : {}),
|
|
168
|
+
...(update.connection ? { connection: { ...state.connection, ...update.connection } } : {}),
|
|
169
|
+
...(update.operations ? {
|
|
170
|
+
operations: update.operations.map((operation) => ({
|
|
171
|
+
id: operation.id,
|
|
172
|
+
state: operation.state,
|
|
173
|
+
completed: operation.completed ?? 0,
|
|
174
|
+
total: operation.total ?? 0,
|
|
175
|
+
})),
|
|
176
|
+
} : {}),
|
|
177
|
+
};
|
|
178
|
+
publish();
|
|
179
|
+
};
|
|
180
|
+
const appendDiagnostic = (candidate, defaultSource) => {
|
|
181
|
+
const summary = sanitizeDiagnosticSummary(candidate, defaultSource);
|
|
182
|
+
if (!summary)
|
|
183
|
+
return;
|
|
184
|
+
const entry = {
|
|
185
|
+
...summary,
|
|
186
|
+
id: `diagnostic-${nextDiagnosticSequence}`,
|
|
187
|
+
timestamp: new Date().toISOString(),
|
|
188
|
+
};
|
|
189
|
+
nextDiagnosticSequence += 1;
|
|
190
|
+
state = {
|
|
191
|
+
...state,
|
|
192
|
+
timeline: [...state.timeline, entry].slice(-maxTimelineEntries),
|
|
193
|
+
};
|
|
194
|
+
publish();
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
name: "runic",
|
|
198
|
+
enforce: "pre",
|
|
199
|
+
config(config, environment) {
|
|
200
|
+
if (environment.command !== "build" || desktopBootstrapUrl === undefined) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
if (config.base !== undefined && config.base !== "./") {
|
|
204
|
+
throw new TypeError("desktop: true requires Vite base to be './' for relocatable surface output.");
|
|
205
|
+
}
|
|
206
|
+
return { base: "./" };
|
|
207
|
+
},
|
|
208
|
+
...(desktopBootstrapUrl === undefined ? {} : {
|
|
209
|
+
transformIndexHtml: {
|
|
210
|
+
order: "post",
|
|
211
|
+
handler: () => [{
|
|
212
|
+
tag: "script",
|
|
213
|
+
attrs: {
|
|
214
|
+
src: state.vite.command === "build" ? "./runic-desktop.js" : desktopBootstrapUrl,
|
|
215
|
+
},
|
|
216
|
+
injectTo: "head-prepend",
|
|
217
|
+
}],
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
diagnostics: { report: (entry) => appendDiagnostic(entry) },
|
|
221
|
+
configResolved(resolved) {
|
|
222
|
+
if (resolved.command === "build" && desktopBootstrapUrl !== undefined && resolved.base !== "./") {
|
|
223
|
+
throw new TypeError("desktop: true requires the resolved Vite base to be './' for relocatable surface output.");
|
|
224
|
+
}
|
|
225
|
+
if (resolved.command === "serve" && options.devtools === true &&
|
|
226
|
+
!resolved.plugins.some((plugin) => plugin.name === "vite:devtools:server")) {
|
|
227
|
+
throw new Error('RUNICP007: devtools: true requires DevTools() from @vitejs/devtools in the Vite plugins array.');
|
|
228
|
+
}
|
|
229
|
+
resolvedRoot = resolved.root;
|
|
230
|
+
state = {
|
|
231
|
+
...state,
|
|
232
|
+
vite: { command: resolved.command, mode: resolved.mode, root: resolved.root },
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
async configureServer(viteServer) {
|
|
236
|
+
server = viteServer;
|
|
237
|
+
viteServer.ws.on(stateEvent, (payload) => applyRuntimeState(payload));
|
|
238
|
+
viteServer.ws.on(diagnosticEvent, (payload) => appendDiagnostic(payload));
|
|
239
|
+
// Compatibility for the bridge-only event emitted by preview clients.
|
|
240
|
+
viteServer.ws.on(traceEvent, (payload) => appendDiagnostic(payload, "application-bridge"));
|
|
241
|
+
viteServer.middlewares.use("/__runic/state", (_request, response) => {
|
|
242
|
+
response.statusCode = 200;
|
|
243
|
+
response.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
244
|
+
response.setHeader("Cache-Control", "no-store");
|
|
245
|
+
response.end(JSON.stringify(state));
|
|
246
|
+
});
|
|
247
|
+
viteServer.httpServer?.once("close", () => {
|
|
248
|
+
if (bridgeTimer !== undefined)
|
|
249
|
+
clearTimeout(bridgeTimer);
|
|
250
|
+
if (isCSharp)
|
|
251
|
+
viteServer.watcher.off("add", onCSharpChange).off("change", onCSharpChange).off("unlink", onCSharpChange);
|
|
252
|
+
server = undefined;
|
|
253
|
+
});
|
|
254
|
+
if (isCSharp)
|
|
255
|
+
viteServer.watcher.on("add", onCSharpChange).on("change", onCSharpChange).on("unlink", onCSharpChange);
|
|
256
|
+
const initialBridge = await generateBridge(true);
|
|
257
|
+
lastReloadedFingerprint = initialBridge?.ir.fingerprint.value;
|
|
258
|
+
},
|
|
259
|
+
async buildStart() {
|
|
260
|
+
await generateBridge(false);
|
|
261
|
+
},
|
|
262
|
+
async handleHotUpdate(context) {
|
|
263
|
+
if (isCSharp || !bridgeDependencies.has(context.file))
|
|
264
|
+
return;
|
|
265
|
+
await reloadBridge();
|
|
266
|
+
return [];
|
|
267
|
+
},
|
|
268
|
+
resolveId(id) {
|
|
269
|
+
if (id === legacyVirtualClientId) {
|
|
270
|
+
throw new Error('RUNICP001: "virtual:runic-toolkit/client" was removed in v0.2. Import "virtual:runic/client" instead.');
|
|
271
|
+
}
|
|
272
|
+
return id === virtualClientId ? resolvedVirtualClientId : undefined;
|
|
273
|
+
},
|
|
274
|
+
load(id) {
|
|
275
|
+
if (id !== resolvedVirtualClientId)
|
|
276
|
+
return undefined;
|
|
277
|
+
return `export * from ${JSON.stringify("@runic-artifex/vite-plugin-runic/client")};`;
|
|
278
|
+
},
|
|
279
|
+
devtools: {
|
|
280
|
+
async setup(context) {
|
|
281
|
+
if (options.devtools === false)
|
|
282
|
+
return;
|
|
283
|
+
sharedState = await context.rpc.sharedState.get(stateKey, { initialValue: state });
|
|
284
|
+
const renderer = context.createJsonRenderer(createDevtoolsSpec(state));
|
|
285
|
+
jsonRenderer = renderer;
|
|
286
|
+
context.docks.register({
|
|
287
|
+
id: "runic:overview",
|
|
288
|
+
title: "Runic",
|
|
289
|
+
icon: "ph:diamond-duotone",
|
|
290
|
+
type: "json-render",
|
|
291
|
+
view: renderer.view,
|
|
292
|
+
});
|
|
293
|
+
context.commands.register({
|
|
294
|
+
id: "runic:copy-diagnostic-state",
|
|
295
|
+
title: "Runic: Copy sanitized diagnostic state",
|
|
296
|
+
handler: () => JSON.stringify(state, null, 2),
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
async function waitForMatchingBridgeHost(path, fingerprint) {
|
|
303
|
+
const deadline = Date.now() + 30_000;
|
|
304
|
+
while (Date.now() < deadline) {
|
|
305
|
+
const current = await readFile(path, "utf8").catch(() => "");
|
|
306
|
+
if (current.trim() === fingerprint)
|
|
307
|
+
return;
|
|
308
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
309
|
+
}
|
|
310
|
+
throw new Error("Timed out waiting for the .NET host to load the generated Application Bridge fingerprint.");
|
|
311
|
+
}
|
|
312
|
+
function resolveDesktopBootstrapUrl(options) {
|
|
313
|
+
if (options === undefined || options === false)
|
|
314
|
+
return undefined;
|
|
315
|
+
const candidate = options === true ? "./runic-desktop.js" : options.bootstrapUrl ?? "./runic-desktop.js";
|
|
316
|
+
if (candidate === "./runic-desktop.js")
|
|
317
|
+
return candidate;
|
|
318
|
+
let url;
|
|
319
|
+
try {
|
|
320
|
+
url = new URL(candidate);
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
throw new TypeError("desktop.bootstrapUrl must be ./runic-desktop.js or an absolute HTTP(S) URL.");
|
|
324
|
+
}
|
|
325
|
+
if ((url.protocol !== "http:" && url.protocol !== "https:") ||
|
|
326
|
+
url.username !== "" || url.password !== "" || url.pathname !== "/runic-desktop.js" ||
|
|
327
|
+
url.search !== "" || url.hash !== "") {
|
|
328
|
+
throw new TypeError("desktop.bootstrapUrl must be ./runic-desktop.js or an absolute HTTP(S) URL.");
|
|
329
|
+
}
|
|
330
|
+
return url.href;
|
|
331
|
+
}
|
|
332
|
+
function initialState(options) {
|
|
333
|
+
return {
|
|
334
|
+
contract: {
|
|
335
|
+
identity: cleanString(options.contract?.identity),
|
|
336
|
+
version: cleanString(options.contract?.version),
|
|
337
|
+
fingerprint: cleanString(options.contract?.fingerprint),
|
|
338
|
+
},
|
|
339
|
+
vite: { command: "serve", mode: "development", root: "" },
|
|
340
|
+
connection: {
|
|
341
|
+
state: "disconnected",
|
|
342
|
+
transport: "unknown",
|
|
343
|
+
sessionId: "",
|
|
344
|
+
revision: 0,
|
|
345
|
+
sequence: 0,
|
|
346
|
+
},
|
|
347
|
+
operations: [],
|
|
348
|
+
timeline: [],
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function sanitizeRuntimeState(candidate) {
|
|
352
|
+
if (!isRecord(candidate))
|
|
353
|
+
return {};
|
|
354
|
+
const contract = isRecord(candidate.contract) ? {
|
|
355
|
+
identity: cleanString(candidate.contract.identity),
|
|
356
|
+
version: cleanString(candidate.contract.version),
|
|
357
|
+
fingerprint: cleanString(candidate.contract.fingerprint),
|
|
358
|
+
} : undefined;
|
|
359
|
+
const connection = isRecord(candidate.connection) ? {
|
|
360
|
+
state: connectionState(candidate.connection.state),
|
|
361
|
+
transport: cleanString(candidate.connection.transport),
|
|
362
|
+
sessionId: cleanString(candidate.connection.sessionId),
|
|
363
|
+
revision: finiteNumber(candidate.connection.revision),
|
|
364
|
+
sequence: finiteNumber(candidate.connection.sequence),
|
|
365
|
+
} : undefined;
|
|
366
|
+
const operations = Array.isArray(candidate.operations)
|
|
367
|
+
? candidate.operations.slice(0, 64).flatMap((operation) => isRecord(operation) ? [{
|
|
368
|
+
id: cleanString(operation.id),
|
|
369
|
+
state: cleanString(operation.state),
|
|
370
|
+
completed: finiteNumber(operation.completed),
|
|
371
|
+
total: finiteNumber(operation.total),
|
|
372
|
+
}] : [])
|
|
373
|
+
: undefined;
|
|
374
|
+
return {
|
|
375
|
+
...(contract ? { contract } : {}),
|
|
376
|
+
...(connection ? { connection } : {}),
|
|
377
|
+
...(operations ? { operations } : {}),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function createDevtoolsSpec(current) {
|
|
381
|
+
const section = (id, title, data) => ({
|
|
382
|
+
[id]: { type: "Card", props: { title }, children: [`${id}-data`] },
|
|
383
|
+
[`${id}-data`]: { type: "KeyValueTable", props: { data } },
|
|
384
|
+
});
|
|
385
|
+
return {
|
|
386
|
+
root: "root",
|
|
387
|
+
elements: {
|
|
388
|
+
root: {
|
|
389
|
+
type: "Stack",
|
|
390
|
+
props: { direction: "column", gap: 12 },
|
|
391
|
+
children: ["heading", "connection", "contract", "operations", "timeline"],
|
|
392
|
+
},
|
|
393
|
+
heading: { type: "Text", props: { text: "Runic", variant: "heading" } },
|
|
394
|
+
...section("connection", "Application Bridge", {
|
|
395
|
+
State: current.connection.state,
|
|
396
|
+
Transport: current.connection.transport,
|
|
397
|
+
Session: current.connection.sessionId || "not initialized",
|
|
398
|
+
Revision: String(current.connection.revision),
|
|
399
|
+
Sequence: String(current.connection.sequence),
|
|
400
|
+
}),
|
|
401
|
+
...section("contract", "Contract", {
|
|
402
|
+
Identity: current.contract.identity || "not reported",
|
|
403
|
+
Version: current.contract.version || "not reported",
|
|
404
|
+
Fingerprint: current.contract.fingerprint || "not reported",
|
|
405
|
+
}),
|
|
406
|
+
...section("operations", `Operations (${current.operations.length})`, current.operations.length === 0
|
|
407
|
+
? { Active: "none" }
|
|
408
|
+
: Object.fromEntries(current.operations.map((operation) => [
|
|
409
|
+
operation.id, `${operation.state} ${operation.completed}/${operation.total}`,
|
|
410
|
+
]))),
|
|
411
|
+
...section("timeline", "Recent timeline", current.timeline.length === 0
|
|
412
|
+
? { Events: "none" }
|
|
413
|
+
: Object.fromEntries(current.timeline.slice(-12).reverse().map((entry) => [
|
|
414
|
+
`${entry.id} · ${entry.source} · ${entry.kind} · ${entry.timestamp}`, entry.label,
|
|
415
|
+
]))),
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function connectionState(value) {
|
|
420
|
+
return value === "connecting" || value === "connected" || value === "closed"
|
|
421
|
+
? value
|
|
422
|
+
: "disconnected";
|
|
423
|
+
}
|
|
424
|
+
function timelineLimit(value) {
|
|
425
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
426
|
+
return defaultTimelineLimit;
|
|
427
|
+
return Math.min(maximumTimelineLimit, Math.max(1, Math.floor(value)));
|
|
428
|
+
}
|
|
429
|
+
function cleanString(value) {
|
|
430
|
+
return typeof value === "string" ? value.slice(0, 512) : "";
|
|
431
|
+
}
|
|
432
|
+
function finiteNumber(value) {
|
|
433
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
434
|
+
}
|
|
435
|
+
function isRecord(value) {
|
|
436
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
437
|
+
}
|
|
438
|
+
//# sourceMapp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AAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@runic-artifex/vite-plugin-runic",
|
|
3
|
+
"version": "0.2.0-preview.1",
|
|
4
|
+
"description": "Vite 8 development and DevTools integration for Runic applications",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"packageManager": "bun@1.4.2",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"virtual.d.ts",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./client": {
|
|
22
|
+
"types": "./dist/client.d.ts",
|
|
23
|
+
"import": "./dist/client.js"
|
|
24
|
+
},
|
|
25
|
+
"./virtual": "./virtual.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"clean": "bun -e \"import('node:fs').then(({rmSync}) => rmSync('dist', { recursive: true, force: true }))\"",
|
|
29
|
+
"build": "bun run --bun clean && tsc -p tsconfig.build.json",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
+
"test": "bun run --bun build && bun test --timeout 120000 test/*.test.mjs",
|
|
32
|
+
"verify": "bun run --bun typecheck && bun run --bun test && bun pm pack --dry-run",
|
|
33
|
+
"pack:preview": "bun pm pack"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@runic-artifex/application-bridge-tooling": "0.2.0-preview.1",
|
|
37
|
+
"@vitejs/devtools": "^0.5.2",
|
|
38
|
+
"vite": "^8.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"@runic-artifex/application-bridge-tooling": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"@vitejs/devtools": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "24.13.3",
|
|
50
|
+
"@vitejs/devtools": "0.5.2",
|
|
51
|
+
"@vitejs/devtools-kit": "0.5.2",
|
|
52
|
+
"typescript": "6.0.3",
|
|
53
|
+
"vite": "8.2.2",
|
|
54
|
+
"@runic-artifex/application-bridge-tooling": "0.2.0-preview.1"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=24.18.0 <25"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public",
|
|
61
|
+
"tag": "preview"
|
|
62
|
+
},
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "git+https://github.com/Runic-Artifex/runic-sdk.git",
|
|
66
|
+
"directory": "packages/web/vite-plugin-runic"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/main/packages/web/vite-plugin-runic#readme",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/Runic-Artifex/runic-sdk/issues"
|
|
71
|
+
},
|
|
72
|
+
"keywords": [
|
|
73
|
+
"runic-artifex",
|
|
74
|
+
"runic",
|
|
75
|
+
"vite",
|
|
76
|
+
"vite-plugin",
|
|
77
|
+
"devtools"
|
|
78
|
+
],
|
|
79
|
+
"gitHead": "c9d444a218cc3fdda190c02af41e91d6c53b2641"
|
|
80
|
+
}
|
package/virtual.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare module "virtual:runic/client" {
|
|
2
|
+
export {
|
|
3
|
+
createRunicDevtoolsObserver,
|
|
4
|
+
createRunicDiagnosticReporter,
|
|
5
|
+
disposeRunicHmrResource,
|
|
6
|
+
preserveRunicHmrResource,
|
|
7
|
+
reportRunicDiagnostic,
|
|
8
|
+
reportRunicState,
|
|
9
|
+
traceRunicEvent,
|
|
10
|
+
type RunicDevtoolsObserver,
|
|
11
|
+
type RunicDiagnosticDetail,
|
|
12
|
+
type RunicDiagnosticDetailValue,
|
|
13
|
+
type RunicDiagnosticEntry,
|
|
14
|
+
type RunicDiagnosticReporter,
|
|
15
|
+
type RunicDiagnosticSource,
|
|
16
|
+
type RunicRuntimeState,
|
|
17
|
+
type RunicTraceEntry,
|
|
18
|
+
type RunicTraceKind,
|
|
19
|
+
} from "@runic-artifex/vite-plugin-runic/client";
|
|
20
|
+
}
|