@valaxyjs/devtools 1.0.0-rc.9 → 1.0.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.
Files changed (110) hide show
  1. package/README.md +151 -12
  2. package/dist/client/assets/FeedbackEmptyState-6lTUwFgn.js +1 -0
  3. package/dist/client/assets/LayoutCard-ZKe9PNVY.js +1 -0
  4. package/dist/client/assets/Teleport-qWljvtqZ.js +3 -0
  5. package/dist/client/assets/VDCheckbox-7mDdABjI.js +1 -0
  6. package/dist/client/assets/VDCodeBlock-C3pmQBwJ.css +1 -0
  7. package/dist/client/assets/VDCodeBlock-DhkPq65r.js +1 -0
  8. package/dist/client/assets/VDNumberField-CaKmb2V5.js +1 -0
  9. package/dist/client/assets/VDPostListItem-Brv0DUbv.js +1 -0
  10. package/dist/client/assets/VDPostPanel-CFfkiijD.css +1 -0
  11. package/dist/client/assets/VDPostPanel-CrXpNq7c.js +1 -0
  12. package/dist/client/assets/VDSelect-CyeugdZ6.js +1 -0
  13. package/dist/client/assets/VDToggleGroup-BzEoQtyw.js +1 -0
  14. package/dist/client/assets/addons-CJtLvLk8.js +1 -0
  15. package/dist/client/assets/addons-D7_qAb67.css +1 -0
  16. package/dist/client/assets/app-djZMc7np.js +3 -0
  17. package/dist/client/assets/archives-BsJLm_8n.js +1 -0
  18. package/dist/client/assets/batch-edit-ClN1hWOH.js +1 -0
  19. package/dist/client/assets/batch-edit-UNPFWmV7.css +1 -0
  20. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DFmWwqXS.js +1 -0
  21. package/dist/client/assets/categories-CHNrwy6z.js +1 -0
  22. package/dist/client/assets/collections-CMorBXJi.js +1 -0
  23. package/dist/client/assets/colors-CdKJdJxa.js +1 -0
  24. package/dist/client/assets/config-B2sT3Mep.js +1 -0
  25. package/dist/client/assets/debug-ChMxlL38.js +1 -0
  26. package/dist/client/assets/editor-D54vvz-8.js +1 -0
  27. package/dist/client/assets/index-B089l86K.css +1 -0
  28. package/dist/client/assets/index-Min1IbcR.js +4 -0
  29. package/dist/client/assets/nanoid-Cya-tyvy.js +1 -0
  30. package/dist/client/assets/pages-BrkjA4th.js +1 -0
  31. package/dist/client/assets/posts-B6FJlERU.js +1 -0
  32. package/dist/client/assets/rpc-DLTo-XVM.js +4 -0
  33. package/dist/client/assets/runtime-dom.esm-bundler-COvr_-s-.js +2 -0
  34. package/dist/client/assets/settings-KjcaeAUC.js +1 -0
  35. package/dist/client/assets/splitpanes.esm-CnpdH7BM.js +1 -0
  36. package/dist/client/assets/tags-D8N7EOLY.js +1 -0
  37. package/dist/client/assets/virtual_intlify-i18n-0-BOFXizJp.js +1 -0
  38. package/dist/client/assets/virtual_intlify-i18n-1-CPnPqlXp.js +1 -0
  39. package/{LICENSE → dist/client/icons/LICENSE} +1 -1
  40. package/dist/client/icons/README.md +2 -0
  41. package/dist/client/icons/archive.svg +1 -0
  42. package/dist/client/icons/article.svg +1 -0
  43. package/dist/client/icons/books.svg +1 -0
  44. package/dist/client/icons/bug.svg +1 -0
  45. package/dist/client/icons/folders.svg +1 -0
  46. package/dist/client/icons/gear-six.svg +1 -0
  47. package/dist/client/icons/hash.svg +1 -0
  48. package/dist/client/icons/pencil-simple.svg +1 -0
  49. package/dist/client/icons/puzzle-piece.svg +1 -0
  50. package/dist/client/icons/sliders-horizontal.svg +1 -0
  51. package/dist/client/icons/squares-four.svg +1 -0
  52. package/dist/client/index.html +10 -5
  53. package/dist/client-api.d.mts +19 -0
  54. package/dist/client-api.d.ts +19 -0
  55. package/dist/client-api.mjs +52 -0
  56. package/dist/index.d.mts +12 -9
  57. package/dist/index.d.ts +12 -9
  58. package/dist/index.mjs +151 -626
  59. package/dist/node/definition.d.mts +10 -0
  60. package/dist/node/definition.d.ts +10 -0
  61. package/dist/node/definition.mjs +1196 -0
  62. package/dist/node/mcp.d.mts +26 -0
  63. package/dist/node/mcp.d.ts +26 -0
  64. package/dist/node/mcp.mjs +250 -0
  65. package/dist/page.d.mts +12 -0
  66. package/dist/page.d.ts +12 -0
  67. package/dist/page.mjs +29 -0
  68. package/dist/plugin.d.mts +49 -0
  69. package/dist/plugin.d.ts +49 -0
  70. package/dist/plugin.mjs +5 -0
  71. package/dist/shared/devtools.BkRFLW7i.d.mts +58 -0
  72. package/dist/shared/devtools.BzWtXMed.mjs +3 -0
  73. package/dist/shared/devtools.CBhjeyeH.mjs +16 -0
  74. package/dist/shared/devtools.CY2Osfc0.d.ts +181 -0
  75. package/dist/shared/devtools.Drj3Ivl5.mjs +46 -0
  76. package/dist/shared/devtools.O-VZ9RtQ.d.mts +30 -0
  77. package/dist/shared/devtools.O-VZ9RtQ.d.ts +30 -0
  78. package/dist/shared/devtools.cHv3kjQy.d.mts +181 -0
  79. package/dist/shared/devtools.qCbHUUKc.d.ts +58 -0
  80. package/dist/shared/rpc.d.mts +169 -0
  81. package/dist/shared/rpc.d.ts +169 -0
  82. package/dist/shared/rpc.mjs +1 -0
  83. package/package.json +57 -27
  84. package/rpc.d.ts +1 -100
  85. package/dist/client/assets/VDButton-BxA3M5c6.js +0 -1
  86. package/dist/client/assets/VDCheckbox-Rk3U6nn0.js +0 -1
  87. package/dist/client/assets/VDInput-BtxYqBt3.css +0 -1
  88. package/dist/client/assets/VDInput-t2XwvZ-t.js +0 -1
  89. package/dist/client/assets/VDNumberField-CSQG8D_v.js +0 -1
  90. package/dist/client/assets/VDPostListItem-BqrGZkwk.js +0 -1
  91. package/dist/client/assets/VDPostPanel-BGOxndtw.js +0 -1
  92. package/dist/client/assets/VDPostPanel-Bkkd-Lkf.css +0 -1
  93. package/dist/client/assets/VDSelect-CajFUhEr.js +0 -1
  94. package/dist/client/assets/VDToggleGroup-Ra7IPGG-.js +0 -1
  95. package/dist/client/assets/archives-nKpic1Px.js +0 -1
  96. package/dist/client/assets/batch-edit-BYL9g3v4.css +0 -1
  97. package/dist/client/assets/batch-edit-xca92IQn.js +0 -1
  98. package/dist/client/assets/categories-CnW0TeGq.js +0 -1
  99. package/dist/client/assets/collections-COHpPV6B.js +0 -1
  100. package/dist/client/assets/config-CiZ--Bsz.js +0 -1
  101. package/dist/client/assets/index-BTPQPImj.js +0 -6
  102. package/dist/client/assets/index-BwVVFe6k.css +0 -1
  103. package/dist/client/assets/pages-B79cXnzi.js +0 -1
  104. package/dist/client/assets/posts-CnfPAEov.js +0 -1
  105. package/dist/client/assets/settings-CukGBvgo.js +0 -1
  106. package/dist/client/assets/splitpanes.esm-B-DN0qHF.js +0 -1
  107. package/dist/client/assets/tags-BVU3BSid.js +0 -1
  108. package/dist/client/assets/virtual_intlify-i18n-0-C_fbdMlw.js +0 -1
  109. package/dist/client/assets/virtual_intlify-i18n-1-CjutLn3A.js +0 -1
  110. package/dist/client/assets/vue.runtime.esm-bundler-DqDZGG6R.js +0 -4
@@ -0,0 +1,181 @@
1
+ import { ValaxyDevtoolsPlugin } from '../plugin.js';
2
+ import { ServerFunctions, ClientOptions, ClientPostList, ClientCollectionData, ConfigData } from './rpc.js';
3
+ import * as devframe_rpc from 'devframe/rpc';
4
+ import { RpcDefinitionsToFunctionsWithNamespace } from 'devframe/rpc';
5
+ import * as devframe from 'devframe';
6
+ import { a as ValaxyDevtoolsManifest, V as ValaxyDevtoolsData } from './devtools.qCbHUUKc.js';
7
+ import * as v from 'valibot';
8
+
9
+ interface InstalledAddon {
10
+ name: string;
11
+ version?: string;
12
+ specifier?: string;
13
+ description?: string;
14
+ /** Enabled in the running Valaxy configuration, including theme addons. */
15
+ enabled: boolean;
16
+ /** Only direct dependencies of this project may be removed. */
17
+ direct: boolean;
18
+ }
19
+ interface AddonPackageDetails {
20
+ name: string;
21
+ version: string;
22
+ description: string;
23
+ homepage?: string;
24
+ repository?: string;
25
+ license?: string;
26
+ peerDependencies: Record<string, string>;
27
+ }
28
+ interface AddonOperationPlan {
29
+ id: string;
30
+ action: 'install' | 'remove';
31
+ name: string;
32
+ version?: string;
33
+ command: string;
34
+ configFile?: string;
35
+ configBefore?: string;
36
+ configAfter?: string;
37
+ }
38
+ interface AddonOperation extends AddonOperationPlan {
39
+ status: 'running' | 'succeeded' | 'failed';
40
+ log: string;
41
+ error?: string;
42
+ }
43
+ interface AddonInventory {
44
+ installed: InstalledAddon[];
45
+ /** Null means package management is unavailable; browsing remains usable. */
46
+ packageManager: 'pnpm' | null;
47
+ managementError?: string;
48
+ configFile?: string;
49
+ operation?: AddonOperation;
50
+ }
51
+
52
+ interface ValaxyDevtoolsOptions {
53
+ userRoot?: string;
54
+ /** Lazy loaders run only when the development tools start. */
55
+ plugins?: (ValaxyDevtoolsPlugin | (() => Promise<ValaxyDevtoolsPlugin | {
56
+ default: ValaxyDevtoolsPlugin;
57
+ }>))[];
58
+ base?: string;
59
+ /** Actual site URL, resolved after the Vite server starts listening. */
60
+ siteUrl?: () => string;
61
+ /** All enabled addons, including those without a DevTools extension. */
62
+ getAddons?: () => Pick<InstalledAddon, 'name' | 'version'>[];
63
+ }
64
+
65
+ interface ManagerDependencies {
66
+ fetchPackage?: (name: string) => Promise<AddonPackageDetails>;
67
+ run?: (root: string, args: string[], onLog: (text: string) => void) => Promise<void>;
68
+ }
69
+ declare function createAddonManager(options: ValaxyDevtoolsOptions, dependencies?: ManagerDependencies): {
70
+ inventory: () => Promise<AddonInventory>;
71
+ prepare: (action: "install" | "remove", name: string) => Promise<AddonOperationPlan>;
72
+ apply: (id: string) => Promise<AddonOperation>;
73
+ details: (name: string) => Promise<AddonPackageDetails>;
74
+ };
75
+
76
+ declare function createManifest(plugins: ValaxyDevtoolsPlugin[], base?: string): ValaxyDevtoolsManifest;
77
+
78
+ declare function createRpcFunctions(functions: ServerFunctions): readonly [devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-post-content", "query", readonly [v.StringSchema<undefined>], v.ObjectSchema<{
79
+ readonly content: v.StringSchema<undefined>;
80
+ readonly revision: v.StringSchema<undefined>;
81
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-post-content", "action", readonly [v.ObjectSchema<{
82
+ readonly filePath: v.StringSchema<undefined>;
83
+ readonly content: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000000, undefined>]>;
84
+ readonly revision: v.StringSchema<undefined>;
85
+ }, undefined>], v.ObjectSchema<{
86
+ readonly content: v.StringSchema<undefined>;
87
+ readonly revision: v.StringSchema<undefined>;
88
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-options", "query", [], Promise<ClientOptions>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-post-list", "query", [], Promise<ClientPostList>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-page-data", "query", readonly [v.StringSchema<undefined>], v.ObjectSchema<{
89
+ readonly routePath: v.StringSchema<undefined>;
90
+ readonly filePath: v.StringSchema<undefined>;
91
+ readonly frontmatter: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
92
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-collection-list", "query", [], Promise<ClientCollectionData[]>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-config", "query", [], Promise<ConfigData>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"create-post", "action", readonly [v.ObjectSchema<{
93
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
94
+ readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
+ readonly tags: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
96
+ readonly categories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
97
+ }, undefined>], v.ObjectSchema<{
98
+ readonly success: v.BooleanSchema<undefined>;
99
+ readonly filePath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
101
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-frontmatter", "action", readonly [v.ObjectSchema<{
102
+ readonly filePath: v.StringSchema<undefined>;
103
+ readonly frontmatter: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
104
+ }, undefined>], v.ObjectSchema<{
105
+ readonly success: v.BooleanSchema<undefined>;
106
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"batch-update-frontmatter", "action", readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
107
+ readonly type: v.LiteralSchema<"set", undefined>;
108
+ readonly key: v.StringSchema<undefined>;
109
+ readonly value: v.UnknownSchema;
110
+ }, undefined>, v.ObjectSchema<{
111
+ readonly type: v.LiteralSchema<"delete", undefined>;
112
+ readonly key: v.StringSchema<undefined>;
113
+ }, undefined>, v.ObjectSchema<{
114
+ readonly type: v.LiteralSchema<"rename", undefined>;
115
+ readonly key: v.StringSchema<undefined>;
116
+ readonly newKey: v.StringSchema<undefined>;
117
+ }, undefined>], undefined>, undefined>], v.ObjectSchema<{
118
+ readonly total: v.NumberSchema<undefined>;
119
+ readonly updated: v.NumberSchema<undefined>;
120
+ readonly errors: v.ArraySchema<v.ObjectSchema<{
121
+ readonly filePath: v.StringSchema<undefined>;
122
+ readonly error: v.StringSchema<undefined>;
123
+ }, undefined>, undefined>;
124
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-config-field", "action", readonly [v.PicklistSchema<["site", "valaxy", "theme"], undefined>, v.StringSchema<undefined>, v.UnknownSchema], v.ObjectSchema<{
125
+ readonly success: v.BooleanSchema<undefined>;
126
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
127
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"run-migration", "action", readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>], v.ObjectSchema<{
128
+ readonly success: v.BooleanSchema<undefined>;
129
+ }, undefined>, devframe.DevframeNodeContext>];
130
+ declare function createValaxyDevframe(options?: ValaxyDevtoolsOptions): devframe.DevframeDefinition & {
131
+ dispose: () => Promise<void>;
132
+ };
133
+ declare function createAddonRpc(manager: ReturnType<typeof createAddonManager>): readonly [devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-addons", "query", [], Promise<AddonInventory>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-addon-package", "query", readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 214, undefined>, v.RegexAction<string, undefined>]>], v.ObjectSchema<{
134
+ readonly name: v.StringSchema<undefined>;
135
+ readonly version: v.StringSchema<undefined>;
136
+ readonly description: v.StringSchema<undefined>;
137
+ readonly homepage: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
138
+ readonly repository: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
139
+ readonly license: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
140
+ readonly peerDependencies: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
141
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"prepare-addon-operation", "action", readonly [v.PicklistSchema<["install", "remove"], undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 214, undefined>, v.RegexAction<string, undefined>]>], v.ObjectSchema<{
142
+ readonly id: v.StringSchema<undefined>;
143
+ readonly action: v.PicklistSchema<["install", "remove"], undefined>;
144
+ readonly name: v.StringSchema<undefined>;
145
+ readonly version: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
146
+ readonly command: v.StringSchema<undefined>;
147
+ readonly configFile: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
148
+ readonly configBefore: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
149
+ readonly configAfter: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
150
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"apply-addon-operation", "action", readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>], v.ObjectSchema<{
151
+ readonly status: v.PicklistSchema<["running", "succeeded", "failed"], undefined>;
152
+ readonly log: v.StringSchema<undefined>;
153
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
154
+ readonly id: v.StringSchema<undefined>;
155
+ readonly action: v.PicklistSchema<["install", "remove"], undefined>;
156
+ readonly name: v.StringSchema<undefined>;
157
+ readonly version: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
158
+ readonly command: v.StringSchema<undefined>;
159
+ readonly configFile: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
160
+ readonly configBefore: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
161
+ readonly configAfter: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
162
+ }, undefined>, devframe.DevframeNodeContext>];
163
+ declare function createExtensionRpc(manifest: ReturnType<typeof createManifest>, plugins: ValaxyDevtoolsPlugin[], data: ValaxyDevtoolsData): readonly [devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-extensions", "query", [], ValaxyDevtoolsManifest, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"run-editor-action", "query", readonly [v.StringSchema<undefined>, v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>], v.ObjectSchema<{
164
+ readonly message: v.StringSchema<undefined>;
165
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["success", "warn", "error", "info"], undefined>, undefined>;
166
+ }, undefined>, devframe.DevframeNodeContext>];
167
+ declare module 'devframe' {
168
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createRpcFunctions>> {
169
+ }
170
+ }
171
+ declare module 'devframe' {
172
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createAddonRpc>> {
173
+ }
174
+ }
175
+ declare module 'devframe' {
176
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createExtensionRpc>> {
177
+ }
178
+ }
179
+
180
+ export { createRpcFunctions as a, createValaxyDevframe as c };
181
+ export type { ValaxyDevtoolsOptions as V };
@@ -0,0 +1,46 @@
1
+ import fs from 'fs-extra';
2
+ import pathe from 'pathe';
3
+
4
+ const name = "@valaxyjs/devtools";
5
+ const version = "1.0.1";
6
+ const description = "DevTools for Valaxy";
7
+ const repository = {
8
+ url: "git+https://github.com/YunYouJun/valaxy.git"};
9
+ const pkg = {
10
+ name: name,
11
+ version: version,
12
+ description: description,
13
+ repository: repository};
14
+
15
+ function assertInside(root, file) {
16
+ const relative = pathe.relative(root, file);
17
+ if (relative === ".." || relative.startsWith("../") || pathe.isAbsolute(relative))
18
+ throw new Error("Invalid file path: outside the allowed directory");
19
+ }
20
+ async function resolveInsideRoot(root, file) {
21
+ const resolvedRoot = pathe.resolve(root);
22
+ const resolved = pathe.resolve(resolvedRoot, file);
23
+ assertInside(resolvedRoot, resolved);
24
+ let existing = resolved;
25
+ while (!await fs.lstat(existing).catch((error) => {
26
+ if (error.code === "ENOENT")
27
+ return void 0;
28
+ throw error;
29
+ })) {
30
+ const parent = pathe.dirname(existing);
31
+ if (parent === existing)
32
+ throw new Error("Allowed directory does not exist");
33
+ existing = parent;
34
+ }
35
+ assertInside(await fs.realpath(resolvedRoot), await fs.realpath(existing));
36
+ return resolved;
37
+ }
38
+ async function resolvePageFile(userRoot, file) {
39
+ const resolved = await resolveInsideRoot(userRoot, file);
40
+ assertInside(pathe.resolve(userRoot, "pages"), resolved);
41
+ if (!resolved.endsWith(".md"))
42
+ throw new Error("Invalid file path: expected a Markdown file");
43
+ return resolved;
44
+ }
45
+
46
+ export { resolveInsideRoot as a, pkg as p, resolvePageFile as r };
@@ -0,0 +1,30 @@
1
+ /** Browser-local diagnostics, separate from the server's source-file config. */
2
+ interface ValaxyPageDebug {
3
+ route: {
4
+ path: string;
5
+ fullPath: string;
6
+ name?: string;
7
+ layout: string;
8
+ query: Record<string, unknown>;
9
+ params: Record<string, unknown>;
10
+ };
11
+ viewport: {
12
+ width: number;
13
+ height: number;
14
+ breakpoints: {
15
+ label: string;
16
+ active: boolean;
17
+ }[];
18
+ };
19
+ config: {
20
+ theme: string;
21
+ site: {
22
+ lang?: string;
23
+ title?: string;
24
+ url?: string;
25
+ };
26
+ themeConfig: Record<string, unknown>;
27
+ };
28
+ }
29
+
30
+ export type { ValaxyPageDebug as V };
@@ -0,0 +1,30 @@
1
+ /** Browser-local diagnostics, separate from the server's source-file config. */
2
+ interface ValaxyPageDebug {
3
+ route: {
4
+ path: string;
5
+ fullPath: string;
6
+ name?: string;
7
+ layout: string;
8
+ query: Record<string, unknown>;
9
+ params: Record<string, unknown>;
10
+ };
11
+ viewport: {
12
+ width: number;
13
+ height: number;
14
+ breakpoints: {
15
+ label: string;
16
+ active: boolean;
17
+ }[];
18
+ };
19
+ config: {
20
+ theme: string;
21
+ site: {
22
+ lang?: string;
23
+ title?: string;
24
+ url?: string;
25
+ };
26
+ themeConfig: Record<string, unknown>;
27
+ };
28
+ }
29
+
30
+ export type { ValaxyPageDebug as V };
@@ -0,0 +1,181 @@
1
+ import { ValaxyDevtoolsPlugin } from '../plugin.mjs';
2
+ import { ServerFunctions, ClientOptions, ClientPostList, ClientCollectionData, ConfigData } from './rpc.mjs';
3
+ import * as devframe_rpc from 'devframe/rpc';
4
+ import { RpcDefinitionsToFunctionsWithNamespace } from 'devframe/rpc';
5
+ import * as devframe from 'devframe';
6
+ import { a as ValaxyDevtoolsManifest, V as ValaxyDevtoolsData } from './devtools.BkRFLW7i.mjs';
7
+ import * as v from 'valibot';
8
+
9
+ interface InstalledAddon {
10
+ name: string;
11
+ version?: string;
12
+ specifier?: string;
13
+ description?: string;
14
+ /** Enabled in the running Valaxy configuration, including theme addons. */
15
+ enabled: boolean;
16
+ /** Only direct dependencies of this project may be removed. */
17
+ direct: boolean;
18
+ }
19
+ interface AddonPackageDetails {
20
+ name: string;
21
+ version: string;
22
+ description: string;
23
+ homepage?: string;
24
+ repository?: string;
25
+ license?: string;
26
+ peerDependencies: Record<string, string>;
27
+ }
28
+ interface AddonOperationPlan {
29
+ id: string;
30
+ action: 'install' | 'remove';
31
+ name: string;
32
+ version?: string;
33
+ command: string;
34
+ configFile?: string;
35
+ configBefore?: string;
36
+ configAfter?: string;
37
+ }
38
+ interface AddonOperation extends AddonOperationPlan {
39
+ status: 'running' | 'succeeded' | 'failed';
40
+ log: string;
41
+ error?: string;
42
+ }
43
+ interface AddonInventory {
44
+ installed: InstalledAddon[];
45
+ /** Null means package management is unavailable; browsing remains usable. */
46
+ packageManager: 'pnpm' | null;
47
+ managementError?: string;
48
+ configFile?: string;
49
+ operation?: AddonOperation;
50
+ }
51
+
52
+ interface ValaxyDevtoolsOptions {
53
+ userRoot?: string;
54
+ /** Lazy loaders run only when the development tools start. */
55
+ plugins?: (ValaxyDevtoolsPlugin | (() => Promise<ValaxyDevtoolsPlugin | {
56
+ default: ValaxyDevtoolsPlugin;
57
+ }>))[];
58
+ base?: string;
59
+ /** Actual site URL, resolved after the Vite server starts listening. */
60
+ siteUrl?: () => string;
61
+ /** All enabled addons, including those without a DevTools extension. */
62
+ getAddons?: () => Pick<InstalledAddon, 'name' | 'version'>[];
63
+ }
64
+
65
+ interface ManagerDependencies {
66
+ fetchPackage?: (name: string) => Promise<AddonPackageDetails>;
67
+ run?: (root: string, args: string[], onLog: (text: string) => void) => Promise<void>;
68
+ }
69
+ declare function createAddonManager(options: ValaxyDevtoolsOptions, dependencies?: ManagerDependencies): {
70
+ inventory: () => Promise<AddonInventory>;
71
+ prepare: (action: "install" | "remove", name: string) => Promise<AddonOperationPlan>;
72
+ apply: (id: string) => Promise<AddonOperation>;
73
+ details: (name: string) => Promise<AddonPackageDetails>;
74
+ };
75
+
76
+ declare function createManifest(plugins: ValaxyDevtoolsPlugin[], base?: string): ValaxyDevtoolsManifest;
77
+
78
+ declare function createRpcFunctions(functions: ServerFunctions): readonly [devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-post-content", "query", readonly [v.StringSchema<undefined>], v.ObjectSchema<{
79
+ readonly content: v.StringSchema<undefined>;
80
+ readonly revision: v.StringSchema<undefined>;
81
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-post-content", "action", readonly [v.ObjectSchema<{
82
+ readonly filePath: v.StringSchema<undefined>;
83
+ readonly content: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000000, undefined>]>;
84
+ readonly revision: v.StringSchema<undefined>;
85
+ }, undefined>], v.ObjectSchema<{
86
+ readonly content: v.StringSchema<undefined>;
87
+ readonly revision: v.StringSchema<undefined>;
88
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-options", "query", [], Promise<ClientOptions>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-post-list", "query", [], Promise<ClientPostList>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-page-data", "query", readonly [v.StringSchema<undefined>], v.ObjectSchema<{
89
+ readonly routePath: v.StringSchema<undefined>;
90
+ readonly filePath: v.StringSchema<undefined>;
91
+ readonly frontmatter: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
92
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-collection-list", "query", [], Promise<ClientCollectionData[]>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-config", "query", [], Promise<ConfigData>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"create-post", "action", readonly [v.ObjectSchema<{
93
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
94
+ readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
+ readonly tags: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
96
+ readonly categories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
97
+ }, undefined>], v.ObjectSchema<{
98
+ readonly success: v.BooleanSchema<undefined>;
99
+ readonly filePath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
101
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-frontmatter", "action", readonly [v.ObjectSchema<{
102
+ readonly filePath: v.StringSchema<undefined>;
103
+ readonly frontmatter: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
104
+ }, undefined>], v.ObjectSchema<{
105
+ readonly success: v.BooleanSchema<undefined>;
106
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"batch-update-frontmatter", "action", readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
107
+ readonly type: v.LiteralSchema<"set", undefined>;
108
+ readonly key: v.StringSchema<undefined>;
109
+ readonly value: v.UnknownSchema;
110
+ }, undefined>, v.ObjectSchema<{
111
+ readonly type: v.LiteralSchema<"delete", undefined>;
112
+ readonly key: v.StringSchema<undefined>;
113
+ }, undefined>, v.ObjectSchema<{
114
+ readonly type: v.LiteralSchema<"rename", undefined>;
115
+ readonly key: v.StringSchema<undefined>;
116
+ readonly newKey: v.StringSchema<undefined>;
117
+ }, undefined>], undefined>, undefined>], v.ObjectSchema<{
118
+ readonly total: v.NumberSchema<undefined>;
119
+ readonly updated: v.NumberSchema<undefined>;
120
+ readonly errors: v.ArraySchema<v.ObjectSchema<{
121
+ readonly filePath: v.StringSchema<undefined>;
122
+ readonly error: v.StringSchema<undefined>;
123
+ }, undefined>, undefined>;
124
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"update-config-field", "action", readonly [v.PicklistSchema<["site", "valaxy", "theme"], undefined>, v.StringSchema<undefined>, v.UnknownSchema], v.ObjectSchema<{
125
+ readonly success: v.BooleanSchema<undefined>;
126
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
127
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"run-migration", "action", readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>], v.ObjectSchema<{
128
+ readonly success: v.BooleanSchema<undefined>;
129
+ }, undefined>, devframe.DevframeNodeContext>];
130
+ declare function createValaxyDevframe(options?: ValaxyDevtoolsOptions): devframe.DevframeDefinition & {
131
+ dispose: () => Promise<void>;
132
+ };
133
+ declare function createAddonRpc(manager: ReturnType<typeof createAddonManager>): readonly [devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-addons", "query", [], Promise<AddonInventory>, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"get-addon-package", "query", readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 214, undefined>, v.RegexAction<string, undefined>]>], v.ObjectSchema<{
134
+ readonly name: v.StringSchema<undefined>;
135
+ readonly version: v.StringSchema<undefined>;
136
+ readonly description: v.StringSchema<undefined>;
137
+ readonly homepage: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
138
+ readonly repository: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
139
+ readonly license: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
140
+ readonly peerDependencies: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
141
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"prepare-addon-operation", "action", readonly [v.PicklistSchema<["install", "remove"], undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 214, undefined>, v.RegexAction<string, undefined>]>], v.ObjectSchema<{
142
+ readonly id: v.StringSchema<undefined>;
143
+ readonly action: v.PicklistSchema<["install", "remove"], undefined>;
144
+ readonly name: v.StringSchema<undefined>;
145
+ readonly version: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
146
+ readonly command: v.StringSchema<undefined>;
147
+ readonly configFile: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
148
+ readonly configBefore: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
149
+ readonly configAfter: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
150
+ }, undefined>, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"apply-addon-operation", "action", readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>], v.ObjectSchema<{
151
+ readonly status: v.PicklistSchema<["running", "succeeded", "failed"], undefined>;
152
+ readonly log: v.StringSchema<undefined>;
153
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
154
+ readonly id: v.StringSchema<undefined>;
155
+ readonly action: v.PicklistSchema<["install", "remove"], undefined>;
156
+ readonly name: v.StringSchema<undefined>;
157
+ readonly version: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
158
+ readonly command: v.StringSchema<undefined>;
159
+ readonly configFile: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
160
+ readonly configBefore: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
161
+ readonly configAfter: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
162
+ }, undefined>, devframe.DevframeNodeContext>];
163
+ declare function createExtensionRpc(manifest: ReturnType<typeof createManifest>, plugins: ValaxyDevtoolsPlugin[], data: ValaxyDevtoolsData): readonly [devframe_rpc.RpcFunctionDefinitionWithoutSchemas<"get-extensions", "query", [], ValaxyDevtoolsManifest, undefined, undefined, devframe.DevframeNodeContext>, devframe_rpc.RpcFunctionDefinitionWithSchemas<"run-editor-action", "query", readonly [v.StringSchema<undefined>, v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>], v.ObjectSchema<{
164
+ readonly message: v.StringSchema<undefined>;
165
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["success", "warn", "error", "info"], undefined>, undefined>;
166
+ }, undefined>, devframe.DevframeNodeContext>];
167
+ declare module 'devframe' {
168
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createRpcFunctions>> {
169
+ }
170
+ }
171
+ declare module 'devframe' {
172
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createAddonRpc>> {
173
+ }
174
+ }
175
+ declare module 'devframe' {
176
+ interface DevframeRpcServerFunctions extends RpcDefinitionsToFunctionsWithNamespace<'valaxy', ReturnType<typeof createExtensionRpc>> {
177
+ }
178
+ }
179
+
180
+ export { createRpcFunctions as a, createValaxyDevframe as c };
181
+ export type { ValaxyDevtoolsOptions as V };
@@ -0,0 +1,58 @@
1
+ import { ClientPageData, ServerFunctions } from './rpc.js';
2
+
3
+ /** Version 1: read-only content access, shared by Node extensions and panels. */
4
+ type ValaxyDevtoolsData = Pick<ServerFunctions, 'getOptions' | 'getPostList' | 'getPageData' | 'getCollectionList' | 'getConfig'> & {
5
+ onChanged: (listener: () => void) => Promise<() => void>;
6
+ };
7
+ interface EditorFieldBase {
8
+ key: string;
9
+ label: string;
10
+ description?: string;
11
+ }
12
+ type ValaxyEditorField = EditorFieldBase & ({
13
+ type: 'text' | 'textarea';
14
+ maxLength?: number;
15
+ } | {
16
+ type: 'boolean';
17
+ } | {
18
+ type: 'number';
19
+ min?: number;
20
+ max?: number;
21
+ step?: number;
22
+ } | {
23
+ type: 'select';
24
+ options: {
25
+ label: string;
26
+ value: string;
27
+ }[];
28
+ });
29
+ interface ValaxyEditorActionResult {
30
+ message: string;
31
+ severity?: 'success' | 'warn' | 'error' | 'info';
32
+ }
33
+ interface ValaxyDevtoolsManifest {
34
+ apiVersion: 1;
35
+ plugins: {
36
+ id: string;
37
+ name: string;
38
+ panels: {
39
+ id: string;
40
+ title: string;
41
+ icon: string;
42
+ url: string;
43
+ }[];
44
+ fields: ValaxyEditorField[];
45
+ actions: {
46
+ id: string;
47
+ label: string;
48
+ }[];
49
+ }[];
50
+ }
51
+ interface ValaxyEditorContext {
52
+ /** The saved page; draft holds the current, unsaved frontmatter. */
53
+ page: ClientPageData;
54
+ draft: Record<string, unknown>;
55
+ data: ValaxyDevtoolsData;
56
+ }
57
+
58
+ export type { ValaxyDevtoolsData as V, ValaxyDevtoolsManifest as a, ValaxyEditorActionResult as b, ValaxyEditorContext as c, ValaxyEditorField as d };