vitepress-plugin-field 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ const _hoisted_6 = {
19
19
  key: 1,
20
20
  class: "description"
21
21
  };
22
- const _sfc_main = /* @__PURE__ */ defineComponent({
22
+ const _sfc_main = /*@__PURE__*/ defineComponent({
23
23
  __name: "VPField",
24
24
  props: {
25
25
  name: {},
@@ -1,7 +1,7 @@
1
1
  import { computed, defineComponent, mergeProps, useSSRContext } from "vue";
2
2
  import { ssrInterpolate, ssrRenderAttrs, ssrRenderClass, ssrRenderSlot } from "vue/server-renderer";
3
3
  //#region src/client/VPField.vue
4
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ const _sfc_main = /*@__PURE__*/ defineComponent({
5
5
  __name: "VPField",
6
6
  __ssrInlineRender: true,
7
7
  props: {
@@ -1,91 +1,9 @@
1
1
  import { PluginSimple } from "markdown-it";
2
2
 
3
- //#region src/node/fieldPlugin.d.ts
4
- /**
5
- * Parsed result from a `::: field` container block.
6
- *
7
- * 字段对象 — 解析自 `::: field` 容器块的结构化结果
8
- */
9
- interface FieldObject {
10
- /**
11
- * Field name — defaults to `info`, overridable via `@name`
12
- *
13
- * 字段名称 — 默认从 `info` 中获取,可通过 `@name` 覆盖
14
- */
15
- name: string;
16
- /**
17
- * `@type` value, undefined if not set
18
- *
19
- * 类型注解 — 如果未设置则为 `undefined`
20
- */
21
- type?: string;
22
- /**
23
- * `@default` value, preserved as-is
24
- *
25
- * 默认值 — 保持原样
26
- */
27
- default?: string;
28
- /**
29
- * Whether `@required` is present
30
- *
31
- * 是否为必填项 — 是否在 `@required` 标签中
32
- */
33
- required?: boolean;
34
- /**
35
- * Whether `@deprecated` is present
36
- *
37
- * 是否为已弃用项 — 是否在 `@deprecated` 标签中
38
- */
39
- deprecated?: boolean;
40
- /**
41
- * Whether `@optional` is present
42
- *
43
- * 是否为可选项 — 是否在 `@optional` 标签中
44
- */
45
- optional?: boolean;
46
- /**
47
- * Description text, may span multiple lines joined by `\n`
48
- *
49
- * 描述文本 — 可跨多行,以 `\n` 连接
50
- */
51
- description?: string;
52
- }
53
- /**
54
- * Parse the body of a `::: field` container into a structured `FieldObject`.
55
- *
56
- * Supports a JSDoc-style tag syntax:
57
- * - `@name` — override the field name (derived from `info` by default)
58
- * - `@type` — type annotation
59
- * - `@default` — default value
60
- * - `@required` — mark as required (boolean flag)
61
- * - `@deprecated` — mark as deprecated (boolean flag)
62
- * - `@optional` — mark as optional (boolean flag)
63
- * - `@description` — explicit description; any non-tag line also feeds into description
64
- *
65
- * Unknown `@`-prefixed tags are treated as description text.
66
- * Empty lines are ignored and never interrupt a description paragraph.
67
- *
68
- * 将 `::: field` 容器的正文解析为结构化的 `FieldObject`。
69
- *
70
- * 支持类 JSDoc 的标签语法:
71
- * - `@name` — 覆盖字段名称(默认从 `info` 派生)
72
- * - `@type` — 类型注解
73
- * - `@default` — 默认值
74
- * - `@required` — 标记为必需(布尔标志)
75
- * - `@deprecated` — 标记为已弃用(布尔标志)
76
- * - `@optional` — 标记为可选(布尔标志)
77
- * - `@description` — 显式描述;任何非标签行也会被纳入描述
78
- *
79
- * 未知的以 `@` 开头的标签将被视为描述文本。
80
- * 空行会被忽略,且不会中断描述段落。
81
- *
82
- * @param content Raw text inside the `:::` container
83
- * @param info Text after `::: field` on the opening line (the field name)
84
- */
85
- declare function parseFieldContent(content: string, info: string): FieldObject;
86
- declare const fieldMarkdownPlugin: PluginSimple;
3
+ //#region src/node/plugin.d.ts
4
+ declare const field: (options?: unknown) => import("vitepress-tuck").VitepressPlugin;
87
5
  //#endregion
88
- //#region src/node/index.d.ts
89
- declare const _default: (option?: unknown) => import("vitepress-tuck").VitepressPlugin;
6
+ //#region src/node/markdown.d.ts
7
+ declare const fieldMarkdownPlugin: PluginSimple;
90
8
  //#endregion
91
- export { type FieldObject, _default as default, fieldMarkdownPlugin, parseFieldContent };
9
+ export { field as default, field, fieldMarkdownPlugin };
@@ -1,7 +1,7 @@
1
1
  import { definePlugin } from "vitepress-tuck";
2
2
  import { isUndefined } from "@pengzhanbo/utils";
3
3
  import { createContainerPlugin, createContainerSyntaxPlugin, stringifyAttrs } from "vitepress-plugin-toolkit";
4
- //#region src/node/fieldPlugin.ts
4
+ //#region src/node/parseFieldContent.ts
5
5
  /** Tags that carry structured meaning; everything else is description text. */
6
6
  const KNOWN_TAGS = new Set([
7
7
  "name",
@@ -103,6 +103,8 @@ function parseFieldContent(content, info) {
103
103
  result.description = descriptions.join("\n");
104
104
  return result;
105
105
  }
106
+ //#endregion
107
+ //#region src/node/markdown.ts
106
108
  const fieldMarkdownPlugin = (md) => {
107
109
  createContainerPlugin(md, "field-group", { before: () => "<div class=\"vp-field-group\">" });
108
110
  createContainerSyntaxPlugin(md, "field", (tokens, idx, _, env) => {
@@ -112,8 +114,8 @@ const fieldMarkdownPlugin = (md) => {
112
114
  });
113
115
  };
114
116
  //#endregion
115
- //#region src/node/index.ts
116
- var node_default = definePlugin(() => ({
117
+ //#region src/node/plugin.ts
118
+ const field = definePlugin(() => ({
117
119
  name: "vitepress-plugin-field",
118
120
  client: { enhance: "enhanceAppWithField" },
119
121
  markdown: { config(md) {
@@ -121,4 +123,7 @@ var node_default = definePlugin(() => ({
121
123
  } }
122
124
  }));
123
125
  //#endregion
124
- export { node_default as default, fieldMarkdownPlugin, parseFieldContent };
126
+ //#region src/node/index.ts
127
+ var node_default = field;
128
+ //#endregion
129
+ export { node_default as default, field, fieldMarkdownPlugin };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vitepress-plugin-field",
3
3
  "type": "module",
4
- "version": "0.1.1",
5
- "description": "Render file tree structure in your VitePress site.",
4
+ "version": "0.3.0",
5
+ "description": "Render structured API fields and properties documentation in your VitePress site.",
6
6
  "author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo/)",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -34,11 +34,12 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@pengzhanbo/utils": "^3.7.3",
37
- "vitepress-plugin-toolkit": "0.1.1",
38
- "vitepress-tuck": "0.1.1"
37
+ "vitepress-plugin-toolkit": "0.3.0",
38
+ "vitepress-tuck": "0.3.0"
39
39
  },
40
40
  "publishConfig": {
41
- "access": "public"
41
+ "access": "public",
42
+ "provenance": true
42
43
  },
43
44
  "scripts": {
44
45
  "clean": "rimraf --glob ./dist",