vite-plugin-agentation-vue 0.0.2
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 +27 -0
- package/README.md +116 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +28 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +155 -0
- package/dist/plugin.js.map +1 -0
- package/dist/runtime/bootstrap.d.ts +27 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +462 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/entry.d.ts +13 -0
- package/dist/runtime/entry.d.ts.map +1 -0
- package/dist/runtime/entry.js +110 -0
- package/dist/runtime/entry.js.map +1 -0
- package/dist/runtime/resolver/index.d.ts +4 -0
- package/dist/runtime/resolver/index.d.ts.map +1 -0
- package/dist/runtime/resolver/index.js +4 -0
- package/dist/runtime/resolver/index.js.map +1 -0
- package/dist/runtime/resolver/resolve-source.d.ts +21 -0
- package/dist/runtime/resolver/resolve-source.d.ts.map +1 -0
- package/dist/runtime/resolver/resolve-source.js +46 -0
- package/dist/runtime/resolver/resolve-source.js.map +1 -0
- package/dist/runtime/resolver/tracer-adapter.d.ts +9 -0
- package/dist/runtime/resolver/tracer-adapter.d.ts.map +1 -0
- package/dist/runtime/resolver/tracer-adapter.js +84 -0
- package/dist/runtime/resolver/tracer-adapter.js.map +1 -0
- package/dist/runtime/resolver/vue-internal.d.ts +12 -0
- package/dist/runtime/resolver/vue-internal.d.ts.map +1 -0
- package/dist/runtime/resolver/vue-internal.js +95 -0
- package/dist/runtime/resolver/vue-internal.js.map +1 -0
- package/dist/runtime/sync.d.ts +12 -0
- package/dist/runtime/sync.d.ts.map +1 -0
- package/dist/runtime/sync.js +168 -0
- package/dist/runtime/sync.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/virtual.d.ts +37 -0
- package/dist/virtual.d.ts.map +1 -0
- package/dist/virtual.js +96 -0
- package/dist/virtual.js.map +1 -0
- package/package.json +50 -0
- package/src/client.d.ts +4 -0
- package/src/runtime/bootstrap.ts +578 -0
- package/src/runtime/entry.ts +146 -0
- package/src/runtime/resolver/index.ts +3 -0
- package/src/runtime/resolver/resolve-source.ts +51 -0
- package/src/runtime/resolver/tracer-adapter.ts +92 -0
- package/src/runtime/resolver/vue-internal.ts +113 -0
- package/src/runtime/sync.ts +192 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
PolyForm Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Benji Taylor
|
|
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 use,
|
|
7
|
+
copy, modify, and distribute the Software, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
1. You may not use the Software to provide a product or service that competes
|
|
10
|
+
with the Software or any product or service offered by the Licensor that
|
|
11
|
+
includes the Software.
|
|
12
|
+
|
|
13
|
+
2. You may not remove or obscure any licensing, copyright, or other notices
|
|
14
|
+
included in the Software.
|
|
15
|
+
|
|
16
|
+
3. If you distribute the Software or any derivative works, you must include a
|
|
17
|
+
copy of this license.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
For more information, see https://polyformproject.org/licenses/shield/1.0.0
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# vite-plugin-agentation-vue
|
|
2
|
+
|
|
3
|
+
Vite plugin for one-line setup of `agentation-vue`.
|
|
4
|
+
|
|
5
|
+
It injects the Vue annotation overlay in dev mode and wires source resolution
|
|
6
|
+
through `vite-plugin-vue-tracer` so exported feedback can include component
|
|
7
|
+
file and line information.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add -D vite-plugin-agentation-vue
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import vue from "@vitejs/plugin-vue"
|
|
20
|
+
import { agentation } from "vite-plugin-agentation-vue"
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [
|
|
24
|
+
vue(),
|
|
25
|
+
agentation(), // Must come after vue()
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The plugin automatically injects the annotation overlay in dev mode. It's disabled during production builds.
|
|
31
|
+
|
|
32
|
+
## Options
|
|
33
|
+
|
|
34
|
+
| Option | Type | Default | Description |
|
|
35
|
+
|--------|------|---------|-------------|
|
|
36
|
+
| `enabled` | `boolean` | `true` in dev | Enable/disable the plugin |
|
|
37
|
+
| `locale` | `"en" \| "zh-CN"` | `"en"` | Default UI locale |
|
|
38
|
+
| `storagePrefix` | `string` | `"agentation-vue-"` | localStorage key prefix |
|
|
39
|
+
| `outputDetail` | `"compact" \| "standard" \| "detailed" \| "forensic"` | `"standard"` | Level of detail in export output |
|
|
40
|
+
| `sync` | `{ endpoint: string, autoSync?: boolean, debounceMs?: number } \| false` | `false` | MCP server sync configuration |
|
|
41
|
+
| `inspector` | `"tracer"` | `"tracer"` | Source resolution strategy |
|
|
42
|
+
|
|
43
|
+
## Sync Configuration
|
|
44
|
+
|
|
45
|
+
To sync annotations to an MCP server:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
agentation({
|
|
49
|
+
sync: {
|
|
50
|
+
endpoint: "http://localhost:4747",
|
|
51
|
+
autoSync: true, // default
|
|
52
|
+
debounceMs: 400, // default
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Nuxt Setup
|
|
58
|
+
|
|
59
|
+
Nuxt also needs a client-only bootstrap plugin:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
// plugins/agentation.client.ts
|
|
63
|
+
export default defineNuxtPlugin(() => {
|
|
64
|
+
onNuxtReady(async () => {
|
|
65
|
+
await import("virtual:agentation")
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See `playgrounds/nuxt-demo` in the repository for a complete example.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// nuxt.config.ts
|
|
74
|
+
import { agentation } from "vite-plugin-agentation-vue"
|
|
75
|
+
|
|
76
|
+
export default defineNuxtConfig({
|
|
77
|
+
vite: {
|
|
78
|
+
plugins: [agentation()],
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## CSS Variables
|
|
84
|
+
|
|
85
|
+
The overlay uses CSS custom properties that can be customized:
|
|
86
|
+
|
|
87
|
+
| Variable | Dark Mode | Light Mode | Description |
|
|
88
|
+
|----------|-----------|------------|-------------|
|
|
89
|
+
| `--ag-bg` | `#1e293b` | `#ffffff` | Base background |
|
|
90
|
+
| `--ag-bg-surface` | `rgba(30,41,59,0.96)` | `rgba(255,255,255,0.96)` | Surface background |
|
|
91
|
+
| `--ag-bg-elevated` | `rgba(15,23,42,0.72)` | `rgba(241,245,249,0.72)` | Elevated background |
|
|
92
|
+
| `--ag-text` | `#e2e8f0` | `#1e293b` | Text color |
|
|
93
|
+
| `--ag-muted` | `#94a3b8` | `#64748b` | Muted text |
|
|
94
|
+
| `--ag-border` | `rgba(148,163,184,0.24)` | `rgba(148,163,184,0.3)` | Border color |
|
|
95
|
+
| `--ag-accent` | `#3b82f6` | `#3b82f6` | Accent (blue) |
|
|
96
|
+
| `--ag-selected` | `#f59e0b` | `#f59e0b` | Selection (amber) |
|
|
97
|
+
|
|
98
|
+
## Keyboard Shortcuts
|
|
99
|
+
|
|
100
|
+
| Shortcut | Action |
|
|
101
|
+
|----------|--------|
|
|
102
|
+
| `Cmd/Ctrl+Shift+F` | Toggle annotation mode |
|
|
103
|
+
| `P` | Pause or resume animations |
|
|
104
|
+
| `H` | Hide or show markers |
|
|
105
|
+
| `C` | Copy Markdown |
|
|
106
|
+
| `X` | Clear all annotations |
|
|
107
|
+
| `Escape` | Dismiss popover / deselect / disable annotation mode |
|
|
108
|
+
|
|
109
|
+
## Release Flow
|
|
110
|
+
|
|
111
|
+
Workspace versions are managed from the repository root with `bumpp`.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
PolyForm Shield 1.0.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-agentation-vue
|
|
3
|
+
*
|
|
4
|
+
* One-line Vite plugin for Vue 3 page annotation in dev mode.
|
|
5
|
+
* Internally composes vite-plugin-vue-tracer for source position recording.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // vite.config.ts
|
|
10
|
+
* import vue from '@vitejs/plugin-vue'
|
|
11
|
+
* import agentation from 'vite-plugin-agentation-vue'
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* plugins: [vue(), agentation()]
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export { agentation, agentationVue } from "./plugin.js";
|
|
19
|
+
export { agentation as default } from "./plugin.js";
|
|
20
|
+
export type { AgentationVueOptions, AgentationVuePluginOptions, AgentationVueSyncOptions, ResolvedAgentationVueOptions, } from "./types.js";
|
|
21
|
+
export { resolveElementSource, bindTracer } from "./runtime/resolver/index.js";
|
|
22
|
+
export type { SourceLocation, FrameworkKind } from "@liuovo/agentation-vue-core";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA;AAGnD,YAAY,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC9E,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-agentation-vue
|
|
3
|
+
*
|
|
4
|
+
* One-line Vite plugin for Vue 3 page annotation in dev mode.
|
|
5
|
+
* Internally composes vite-plugin-vue-tracer for source position recording.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // vite.config.ts
|
|
10
|
+
* import vue from '@vitejs/plugin-vue'
|
|
11
|
+
* import agentation from 'vite-plugin-agentation-vue'
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* plugins: [vue(), agentation()]
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
// Plugin factory (primary export)
|
|
19
|
+
export { agentation, agentationVue } from "./plugin.js";
|
|
20
|
+
export { agentation as default } from "./plugin.js";
|
|
21
|
+
// Resolver API β usable independently of the full plugin
|
|
22
|
+
export { resolveElementSource, bindTracer } from "./runtime/resolver/index.js";
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,kCAAkC;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA;AAUnD,yDAAyD;AACzD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import { type AgentationVueOptions } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Agentation-Vue plugin factory.
|
|
5
|
+
*
|
|
6
|
+
* Returns an array of Vite plugins:
|
|
7
|
+
* 1. The agentation shell plugin (virtual module + runtime injection)
|
|
8
|
+
* 2. The `vite-plugin-vue-tracer` plugin (source position recording)
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```ts
|
|
12
|
+
* // vite.config.ts
|
|
13
|
+
* import vue from '@vitejs/plugin-vue'
|
|
14
|
+
* import agentation from 'vite-plugin-agentation-vue'
|
|
15
|
+
*
|
|
16
|
+
* export default defineConfig({
|
|
17
|
+
* plugins: [vue(), agentation()]
|
|
18
|
+
* })
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* **Important:** `agentation()` must be registered after `vue()` so that
|
|
22
|
+
* tracer transforms run after Vue SFC compilation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function agentation(options?: AgentationVueOptions): Plugin[];
|
|
25
|
+
/** @deprecated Use {@link agentation} instead */
|
|
26
|
+
export declare const agentationVue: typeof agentation;
|
|
27
|
+
export default agentation;
|
|
28
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AA0ItE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,EAAE,CAYvE;AAED,iDAAiD;AACjD,eAAO,MAAM,aAAa,mBAAa,CAAA;AAEvC,eAAe,UAAU,CAAA"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import VueTracer from "vite-plugin-vue-tracer";
|
|
2
|
+
import { resolveOptions } from "./types.js";
|
|
3
|
+
import { INIT_SCRIPT_PATH, createInitModuleSource, createInjectionTag, loadVirtualModule, resolveVirtualId, } from "./virtual.js";
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Terminal logging (ANSI colors + ASCII art)
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
const c = {
|
|
8
|
+
reset: "\x1b[0m",
|
|
9
|
+
bold: "\x1b[1m",
|
|
10
|
+
dim: "\x1b[2m",
|
|
11
|
+
green: "\x1b[32m",
|
|
12
|
+
yellow: "\x1b[33m",
|
|
13
|
+
cyan: "\x1b[36m",
|
|
14
|
+
magenta: "\x1b[35m",
|
|
15
|
+
};
|
|
16
|
+
const PREFIX = `${c.bold}${c.cyan}π° agentation${c.reset}`;
|
|
17
|
+
function printBanner(options) {
|
|
18
|
+
const status = options.enabled === false
|
|
19
|
+
? `${c.bold}${c.yellow}DISABLED${c.reset}`
|
|
20
|
+
: `${c.bold}${c.green}AUTO${c.reset} ${c.dim}(active in serve mode)${c.reset}`;
|
|
21
|
+
console.log([
|
|
22
|
+
"",
|
|
23
|
+
`${c.magenta} βββββββββββββββββββββββββββββββββ${c.reset}`,
|
|
24
|
+
`${c.magenta} β${c.reset} ${c.bold}${c.cyan}π° agentation-vue${c.reset} ${c.magenta}β${c.reset}`,
|
|
25
|
+
`${c.magenta} β${c.reset} ${c.dim}vite plugin loaded${c.reset} ${c.magenta}β${c.reset}`,
|
|
26
|
+
`${c.magenta} βββββββββββββββββββββββββββββββββ${c.reset}`,
|
|
27
|
+
` ${c.dim}status:${c.reset} ${status} β¨`,
|
|
28
|
+
"",
|
|
29
|
+
].join("\n"));
|
|
30
|
+
}
|
|
31
|
+
function logTerm(message, detail) {
|
|
32
|
+
const d = detail ? ` ${c.dim}(${detail})${c.reset}` : "";
|
|
33
|
+
console.log(` ${PREFIX} ${c.green}${message}${c.reset}${d}`);
|
|
34
|
+
}
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Internal helpers
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
/**
|
|
39
|
+
* Recursively flattens a Vite plugin value (single plugin, array, or falsy)
|
|
40
|
+
* into a flat array of Plugin objects.
|
|
41
|
+
*/
|
|
42
|
+
function flattenPlugins(input) {
|
|
43
|
+
if (Array.isArray(input))
|
|
44
|
+
return input.flatMap(flattenPlugins);
|
|
45
|
+
if (input && typeof input === "object" && "name" in input)
|
|
46
|
+
return [input];
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Wraps a plugin so it only runs during `serve` (dev mode).
|
|
51
|
+
* This ensures the internally-composed VueTracer plugin never activates in build.
|
|
52
|
+
*/
|
|
53
|
+
function serveOnly(plugin) {
|
|
54
|
+
return {
|
|
55
|
+
...plugin,
|
|
56
|
+
apply(config, env) {
|
|
57
|
+
if (env.command !== "serve")
|
|
58
|
+
return false;
|
|
59
|
+
const original = plugin.apply;
|
|
60
|
+
if (original == null || original === "serve")
|
|
61
|
+
return true;
|
|
62
|
+
if (original === "build")
|
|
63
|
+
return false;
|
|
64
|
+
return original(config, env);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Plugin factory
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
/**
|
|
72
|
+
* Creates the main agentation Vite plugin.
|
|
73
|
+
*
|
|
74
|
+
* Responsibilities:
|
|
75
|
+
* - Resolves & serves the `virtual:agentation` module
|
|
76
|
+
* - Injects the runtime bootstrap `<script>` into the HTML
|
|
77
|
+
* - Only active during `vite dev` (command === "serve")
|
|
78
|
+
*/
|
|
79
|
+
function createShellPlugin(options) {
|
|
80
|
+
let resolved = resolveOptions(options, "build");
|
|
81
|
+
return {
|
|
82
|
+
name: "vite-plugin-agentation-vue",
|
|
83
|
+
enforce: "pre",
|
|
84
|
+
apply: "serve",
|
|
85
|
+
configResolved(config) {
|
|
86
|
+
resolved = resolveOptions(options, config.command);
|
|
87
|
+
logTerm(resolved.enabled ? "configResolved β
" : "configResolved βΈοΈ plugin disabled", `command=${config.command}`);
|
|
88
|
+
},
|
|
89
|
+
configureServer(server) {
|
|
90
|
+
server.middlewares.use((req, res, next) => {
|
|
91
|
+
if (!resolved.enabled)
|
|
92
|
+
return next();
|
|
93
|
+
const url = req.url?.split("?", 1)[0];
|
|
94
|
+
if (url !== INIT_SCRIPT_PATH)
|
|
95
|
+
return next();
|
|
96
|
+
logTerm("init module served π", INIT_SCRIPT_PATH);
|
|
97
|
+
res.statusCode = 200;
|
|
98
|
+
res.setHeader("Content-Type", "text/javascript; charset=utf-8");
|
|
99
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
100
|
+
res.end(createInitModuleSource(resolved));
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
resolveId(id) {
|
|
104
|
+
if (!resolved.enabled)
|
|
105
|
+
return;
|
|
106
|
+
return resolveVirtualId(id);
|
|
107
|
+
},
|
|
108
|
+
load(id) {
|
|
109
|
+
if (!resolved.enabled)
|
|
110
|
+
return;
|
|
111
|
+
return loadVirtualModule(id, resolved);
|
|
112
|
+
},
|
|
113
|
+
transformIndexHtml() {
|
|
114
|
+
if (!resolved.enabled)
|
|
115
|
+
return;
|
|
116
|
+
logTerm("transformIndexHtml π§©", "injecting runtime <script src> into HTML");
|
|
117
|
+
return [createInjectionTag()];
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Agentation-Vue plugin factory.
|
|
123
|
+
*
|
|
124
|
+
* Returns an array of Vite plugins:
|
|
125
|
+
* 1. The agentation shell plugin (virtual module + runtime injection)
|
|
126
|
+
* 2. The `vite-plugin-vue-tracer` plugin (source position recording)
|
|
127
|
+
*
|
|
128
|
+
* Usage:
|
|
129
|
+
* ```ts
|
|
130
|
+
* // vite.config.ts
|
|
131
|
+
* import vue from '@vitejs/plugin-vue'
|
|
132
|
+
* import agentation from 'vite-plugin-agentation-vue'
|
|
133
|
+
*
|
|
134
|
+
* export default defineConfig({
|
|
135
|
+
* plugins: [vue(), agentation()]
|
|
136
|
+
* })
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* **Important:** `agentation()` must be registered after `vue()` so that
|
|
140
|
+
* tracer transforms run after Vue SFC compilation.
|
|
141
|
+
*/
|
|
142
|
+
export function agentation(options = {}) {
|
|
143
|
+
printBanner(options);
|
|
144
|
+
const shell = createShellPlugin(options);
|
|
145
|
+
// When explicitly disabled, return only the shell (which is a no-op)
|
|
146
|
+
if (options.enabled === false)
|
|
147
|
+
return [shell];
|
|
148
|
+
// Compose vue-tracer plugins, restricting them to dev mode only
|
|
149
|
+
const tracerPlugins = flattenPlugins(VueTracer()).map(serveOnly);
|
|
150
|
+
return [shell, ...tracerPlugins];
|
|
151
|
+
}
|
|
152
|
+
/** @deprecated Use {@link agentation} instead */
|
|
153
|
+
export const agentationVue = agentation;
|
|
154
|
+
export default agentation;
|
|
155
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAA6B,MAAM,YAAY,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAErB,8EAA8E;AAC9E,6CAA6C;AAC7C,8EAA8E;AAE9E,MAAM,CAAC,GAAG;IACR,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;CACX,CAAA;AAEV,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAA;AAE3D,SAAS,WAAW,CAAC,OAA6B;IAChD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,KAAK;QACtC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,WAAW,CAAC,CAAC,KAAK,EAAE;QAC1C,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC,KAAK,EAAE,CAAA;IAEhF,OAAO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7C,gEAAgE;IAChE,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAEhE,OAAO,CAAC,KAAK,EAAE,GAAG,aAAa,CAAC,CAAA;AAClC,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAA;AAEvC,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SourceLocation } from "@liuovo/agentation-vue-core";
|
|
2
|
+
import type { AnnotationsStore, AreaSelectionState, SelectionState, SettingsState, UiNotification } from "@liuovo/agentation-vue-ui";
|
|
3
|
+
import type { AgentationStorageBridge } from "../types.js";
|
|
4
|
+
export interface RuntimeInfrastructure {
|
|
5
|
+
appRoot: HTMLDivElement;
|
|
6
|
+
overlayRoot: HTMLDivElement;
|
|
7
|
+
storage: AgentationStorageBridge;
|
|
8
|
+
resolveSource(el: HTMLElement): SourceLocation | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates the DOM containers and storage bridge.
|
|
12
|
+
* Does NOT register event listeners β that's done in `attachListeners()`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setupInfrastructure(storagePrefix: string): RuntimeInfrastructure;
|
|
15
|
+
export interface ListenerCleanup {
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Registers pointer/click event listeners that drive Vue selection state.
|
|
20
|
+
*
|
|
21
|
+
* Handles:
|
|
22
|
+
* - Single-click element selection
|
|
23
|
+
* - Drag-to-select area selection (like React's multi-select)
|
|
24
|
+
* - `blockInteractions` setting for click interception
|
|
25
|
+
*/
|
|
26
|
+
export declare function attachListeners(store: AnnotationsStore, selection: SelectionState, areaSelection: AreaSelectionState, settings: SettingsState, resolveSource: (el: HTMLElement) => SourceLocation | null, notify?: (notification: UiNotification) => void): ListenerCleanup;
|
|
27
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAGhB,kBAAkB,EAElB,cAAc,EACd,aAAa,EACb,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AA8B1D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAA;IACvB,WAAW,EAAE,cAAc,CAAA;IAC3B,OAAO,EAAE,uBAAuB,CAAA;IAChC,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,GACpB,qBAAqB,CAcvB;AAMD,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,cAAc,EACzB,aAAa,EAAE,kBAAkB,EACjC,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,cAAc,GAAG,IAAI,EACzD,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,cAAc,KAAK,IAAI,GAC9C,eAAe,CAuOjB"}
|