@valaxyjs/devtools 1.0.0-rc.11 → 1.0.0-rc.13

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-Rn3Nqhbz.js +3 -0
  5. package/dist/client/assets/VDCheckbox-daRKoTGK.js +1 -0
  6. package/dist/client/assets/VDCodeBlock-BtPCxwvt.js +1 -0
  7. package/dist/client/assets/VDCodeBlock-C3pmQBwJ.css +1 -0
  8. package/dist/client/assets/VDNumberField-ko0BYjUy.js +1 -0
  9. package/dist/client/assets/VDPostListItem-CHPpKGrl.js +1 -0
  10. package/dist/client/assets/VDPostPanel-CbCth8UW.css +1 -0
  11. package/dist/client/assets/VDPostPanel-TTV6v3vH.js +1 -0
  12. package/dist/client/assets/VDSelect-Cu_aXlTc.js +1 -0
  13. package/dist/client/assets/VDToggleGroup-DQu5ibPP.js +1 -0
  14. package/dist/client/assets/addons-BeZTS6wo.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-DyxjvxXC.js +1 -0
  18. package/dist/client/assets/batch-edit-UNPFWmV7.css +1 -0
  19. package/dist/client/assets/batch-edit-e_0tefQi.js +1 -0
  20. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DKEQfrSa.js +1 -0
  21. package/dist/client/assets/categories-D8m60Fso.js +1 -0
  22. package/dist/client/assets/collections-Boilukwl.js +1 -0
  23. package/dist/client/assets/colors-CdKJdJxa.js +1 -0
  24. package/dist/client/assets/config-DoNtHUjQ.js +1 -0
  25. package/dist/client/assets/debug-x5mwtm5I.js +1 -0
  26. package/dist/client/assets/editor-CHXt0bEP.js +1 -0
  27. package/dist/client/assets/index-BkcKXtGA.js +4 -0
  28. package/dist/client/assets/index-D2Bg3cBy.css +1 -0
  29. package/dist/client/assets/nanoid-Cya-tyvy.js +1 -0
  30. package/dist/client/assets/pages-C0Hm1R05.js +1 -0
  31. package/dist/client/assets/posts-BjJqEMcb.js +1 -0
  32. package/dist/client/assets/rpc-_85YyBhb.js +4 -0
  33. package/dist/client/assets/runtime-dom.esm-bundler-COvr_-s-.js +2 -0
  34. package/dist/client/assets/settings-D1-tIv7g.js +1 -0
  35. package/dist/client/assets/splitpanes.esm-CnpdH7BM.js +1 -0
  36. package/dist/client/assets/tags-DiOGZThc.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 +11 -8
  57. package/dist/index.d.ts +11 -8
  58. package/dist/index.mjs +145 -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.BEU7Q82S.d.mts +181 -0
  72. package/dist/shared/devtools.BOLo8y6t.d.mts +58 -0
  73. package/dist/shared/devtools.BzWtXMed.mjs +3 -0
  74. package/dist/shared/devtools.CBhjeyeH.mjs +16 -0
  75. package/dist/shared/devtools.CNAj6Cjx.d.ts +58 -0
  76. package/dist/shared/devtools.D4CJIUQe.d.ts +181 -0
  77. package/dist/shared/devtools.O-VZ9RtQ.d.mts +30 -0
  78. package/dist/shared/devtools.O-VZ9RtQ.d.ts +30 -0
  79. package/dist/shared/devtools.mygDTMGI.mjs +46 -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 -26
  84. package/rpc.d.ts +1 -100
  85. package/dist/client/assets/VDButton-BxA3M5c6.js +0 -1
  86. package/dist/client/assets/VDCheckbox-BsLMqi9S.js +0 -1
  87. package/dist/client/assets/VDInput-B27GE15-.js +0 -1
  88. package/dist/client/assets/VDInput-BtxYqBt3.css +0 -1
  89. package/dist/client/assets/VDNumberField-YjWV-ued.js +0 -1
  90. package/dist/client/assets/VDPostListItem-DF0Kvz0k.js +0 -1
  91. package/dist/client/assets/VDPostPanel-Bkkd-Lkf.css +0 -1
  92. package/dist/client/assets/VDPostPanel-Dci0SDJM.js +0 -1
  93. package/dist/client/assets/VDSelect-C-luq5qS.js +0 -1
  94. package/dist/client/assets/VDToggleGroup-epojOkcK.js +0 -1
  95. package/dist/client/assets/archives-DSGEfYQX.js +0 -1
  96. package/dist/client/assets/batch-edit-BYL9g3v4.css +0 -1
  97. package/dist/client/assets/batch-edit-DUNlYX2Q.js +0 -1
  98. package/dist/client/assets/categories-O8ONgJl6.js +0 -1
  99. package/dist/client/assets/collections-Rf9R5xIW.js +0 -1
  100. package/dist/client/assets/config-B6eJg8re.js +0 -1
  101. package/dist/client/assets/index-BjYrNlmK.js +0 -6
  102. package/dist/client/assets/index-wVxzDvm5.css +0 -1
  103. package/dist/client/assets/pages-CHon8Zex.js +0 -1
  104. package/dist/client/assets/posts-B80Fz55d.js +0 -1
  105. package/dist/client/assets/settings-B9Vkun7j.js +0 -1
  106. package/dist/client/assets/splitpanes.esm-B-DN0qHF.js +0 -1
  107. package/dist/client/assets/tags-B_Je2XwK.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,58 @@
1
+ import { ClientPageData, ServerFunctions } from './rpc.mjs';
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 { ValaxyDevtoolsManifest as V, ValaxyDevtoolsData as a, ValaxyEditorField as b, ValaxyEditorContext as c, ValaxyEditorActionResult as d };
@@ -0,0 +1,3 @@
1
+ const PAGE_CHANNEL = "valaxy:page";
2
+
3
+ export { PAGE_CHANNEL as P };
@@ -0,0 +1,16 @@
1
+ const DEVTOOLS_ID = "valaxy";
2
+ const DEVTOOLS_PATH = "__valaxy_devtools__/";
3
+ const DEVTOOLS_FRAME_ID = "valaxy:main";
4
+ function resolveDevtoolsBase(base = "/") {
5
+ return `${base.replace(/\/$/, "")}/${DEVTOOLS_PATH}`;
6
+ }
7
+ function resolveDevtoolsLogo(base = "/") {
8
+ return `${resolveDevtoolsBase(base)}favicon.svg`;
9
+ }
10
+ function resolveAddonBase(base = "/") {
11
+ return `${base.replace(/\/$/, "")}/__valaxy_addons__/`;
12
+ }
13
+
14
+ const RESOURCES_STATE = "valaxy:resources";
15
+
16
+ export { DEVTOOLS_PATH as D, RESOURCES_STATE as R, DEVTOOLS_FRAME_ID as a, resolveDevtoolsLogo as b, resolveAddonBase as c, DEVTOOLS_ID as d, resolveDevtoolsBase as r };
@@ -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 { ValaxyDevtoolsManifest as V, ValaxyDevtoolsData as a, ValaxyEditorField as b, ValaxyEditorContext as c, ValaxyEditorActionResult as d };
@@ -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 { V as ValaxyDevtoolsManifest, a as ValaxyDevtoolsData } from './devtools.CNAj6Cjx.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,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,46 @@
1
+ import fs from 'fs-extra';
2
+ import pathe from 'pathe';
3
+
4
+ const name = "@valaxyjs/devtools";
5
+ const version = "1.0.0-rc.13";
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,169 @@
1
+ import { KnownEditor } from 'devframe/utils/launch-editor';
2
+ import { Post } from 'valaxy';
3
+ import { V as ValaxyPageDebug } from './devtools.O-VZ9RtQ.mjs';
4
+
5
+ interface BlogWindow {
6
+ $frontmatter: any;
7
+ }
8
+ interface ClientOptions {
9
+ userRoot: string;
10
+ siteUrl?: string;
11
+ editor?: KnownEditor;
12
+ editors?: KnownEditor[];
13
+ }
14
+ interface ClientPostList {
15
+ posts: ClientPageData[];
16
+ }
17
+ interface ClientPageData {
18
+ /** Present only in live browser snapshots; never loaded from article files. */
19
+ debug?: ValaxyPageDebug;
20
+ frontmatter: Post;
21
+ /**
22
+ * route.path
23
+ */
24
+ routePath: string;
25
+ /**
26
+ * 绝对路径
27
+ */
28
+ filePath: string;
29
+ }
30
+ interface ClientCollectionItem {
31
+ title: string;
32
+ key: string;
33
+ link?: string;
34
+ filePath: string;
35
+ frontmatter: Record<string, any>;
36
+ }
37
+ interface ClientCollectionData {
38
+ key: string;
39
+ title: string;
40
+ cover: string;
41
+ description: string;
42
+ collapse: boolean;
43
+ dirPath: string;
44
+ items: ClientCollectionItem[];
45
+ }
46
+ type BatchFrontmatterOperation = {
47
+ /**
48
+ * 操作类型
49
+ * - set: 设置/更新字段值
50
+ * - delete: 删除字段
51
+ * - rename: 重命名字段(oldKey -> newKey)
52
+ */
53
+ type: 'set';
54
+ key: string;
55
+ value: unknown;
56
+ } | {
57
+ type: 'delete';
58
+ key: string;
59
+ } | {
60
+ type: 'rename';
61
+ key: string;
62
+ newKey: string;
63
+ };
64
+ interface BatchUpdateResult {
65
+ total: number;
66
+ updated: number;
67
+ errors: {
68
+ filePath: string;
69
+ error: string;
70
+ }[];
71
+ }
72
+ interface ConfigData {
73
+ siteConfig: Record<string, any>;
74
+ valaxyConfig: Record<string, any>;
75
+ themeConfig: Record<string, any>;
76
+ siteConfigExists: boolean;
77
+ valaxyConfigExists: boolean;
78
+ siteConfigPath: string;
79
+ valaxyConfigPath: string;
80
+ }
81
+ interface ConfigUpdateRequest {
82
+ configType: 'site' | 'valaxy' | 'theme';
83
+ fieldPath: string;
84
+ value: any;
85
+ }
86
+ interface CreatePostOptions {
87
+ /** 文章标题 */
88
+ title: string;
89
+ /** 文件路径(相对于 pages/posts/),如 'my-post.md' 或 'sub/my-post.md' */
90
+ path?: string;
91
+ /** 标签 */
92
+ tags?: string[];
93
+ /** 分类 */
94
+ categories?: string[];
95
+ }
96
+ interface UpdateFrontmatterRequest {
97
+ filePath: string;
98
+ frontmatter: Record<string, any>;
99
+ }
100
+ /** Markdown body and its optimistic concurrency token. */
101
+ interface PostContent {
102
+ content: string;
103
+ revision: string;
104
+ }
105
+ interface ServerFunctions {
106
+ /** Read an article body within the project's pages directory. */
107
+ getPostContent: (filePath: string) => Promise<PostContent>;
108
+ /** Save the body while preserving current frontmatter and rejecting stale edits. */
109
+ updatePostContent: (req: {
110
+ filePath: string;
111
+ content: string;
112
+ revision: string;
113
+ }) => Promise<PostContent>;
114
+ /**
115
+ * 获取基础配置
116
+ */
117
+ getOptions: () => Promise<ClientOptions>;
118
+ /**
119
+ * 获取文章列表
120
+ */
121
+ getPostList: () => Promise<ClientPostList>;
122
+ /**
123
+ * 获取页面 pageData
124
+ */
125
+ getPageData: (pagePath: string) => Promise<ClientPageData>;
126
+ /**
127
+ * 获取合集列表
128
+ */
129
+ getCollectionList: () => Promise<ClientCollectionData[]>;
130
+ /**
131
+ * 更新单个页面的 frontmatter(整体覆盖)
132
+ */
133
+ updateFrontmatter: (req: UpdateFrontmatterRequest) => Promise<{
134
+ success: boolean;
135
+ }>;
136
+ /**
137
+ * 批量修改文章的 frontmatter
138
+ */
139
+ batchUpdateFrontmatter: (filePaths: string[], operations: BatchFrontmatterOperation[]) => Promise<BatchUpdateResult>;
140
+ /**
141
+ * 获取配置数据
142
+ */
143
+ getConfig: () => Promise<ConfigData>;
144
+ /**
145
+ * 更新配置字段
146
+ */
147
+ updateConfigField: (configType: 'site' | 'valaxy' | 'theme', fieldPath: string, value: any) => Promise<{
148
+ success: boolean;
149
+ error?: string;
150
+ }>;
151
+ /**
152
+ * 运行 frontmatter 迁移
153
+ */
154
+ runMigration: (filePaths: string[], frontmatter: Record<string, any>) => Promise<{
155
+ success: boolean;
156
+ }>;
157
+ /**
158
+ * 创建新文章
159
+ */
160
+ createPost: (options: CreatePostOptions) => Promise<{
161
+ success: boolean;
162
+ filePath?: string;
163
+ error?: string;
164
+ }>;
165
+ }
166
+ interface ClientFunctions {
167
+ }
168
+
169
+ export type { BatchFrontmatterOperation, BatchUpdateResult, BlogWindow, ClientCollectionData, ClientCollectionItem, ClientFunctions, ClientOptions, ClientPageData, ClientPostList, ConfigData, ConfigUpdateRequest, CreatePostOptions, PostContent, ServerFunctions, UpdateFrontmatterRequest };