@openpkg-ts/adapters 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,44 @@
1
- import { DocsInstance as DocsInstance2, LoadOptions, AlgoliaRecord, PagefindRecord, SearchIndex, SearchOptions } from "@openpkg-ts/sdk";
2
- import { createDocs, loadSpec, buildSignatureString, formatParameters, formatReturnType, formatSchema, formatTypeParameters, getMethods, getProperties, groupByVisibility, isMethod, isProperty, resolveTypeRef, sortByName, toAlgoliaRecords, toPagefindRecords, toSearchIndex, toSearchIndexJSON, toHTML, toJSON, toJSONString, toMarkdown, toNavigation, toDocusaurusSidebarJS, toFumadocsMetaJSON, exportToMarkdown } from "@openpkg-ts/sdk";
1
+ import { AlgoliaRecord, DocsInstance as DocsInstance2, LoadOptions, PagefindRecord, SearchIndex, SearchOptions } from "@openpkg-ts/sdk";
2
+ import { buildSignatureString, createDocs, exportToMarkdown, formatParameters, formatReturnType, formatSchema, formatTypeParameters, getMethods, getProperties, groupByVisibility, isMethod, isProperty, loadSpec, resolveTypeRef, sortByName, toAlgoliaRecords, toDocusaurusSidebarJS, toFumadocsMetaJSON, toHTML, toJSON, toJSONString, toMarkdown, toNavigation, toPagefindRecords, toSearchIndex, toSearchIndexJSON } from "@openpkg-ts/sdk";
3
3
  import { OpenPkg as OpenPkg2, SpecExample, SpecExport as SpecExport2, SpecExportKind as SpecExportKind2, SpecMember, SpecSchema, SpecSignature, SpecSignatureParameter, SpecTag, SpecType, SpecTypeKind, SpecTypeParameter } from "@openpkg-ts/spec";
4
- import { OpenPkg, SpecExport } from "@openpkg-ts/spec";
4
+ import { SpecExportKind } from "@openpkg-ts/spec";
5
+ import { ReactNode } from "react";
6
+ interface SidebarKindBadgeProps {
7
+ kind: SpecExportKind;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Sidebar badge component for fumadocs page tree.
12
+ * Wraps @openpkg-ts/ui KindBadge with size="sm" for sidebar use.
13
+ *
14
+ * Uses createElement instead of JSX for compatibility with
15
+ * fumadocs transformPageTree server context.
16
+ */
17
+ declare function SidebarKindBadge({ kind, className }: SidebarKindBadgeProps): ReactNode;
18
+ import { LoaderPlugin } from "fumadocs-core/source";
19
+ interface OpenpkgPluginOptions {
20
+ /** Show kind badges in sidebar (default: true) */
21
+ showBadges?: boolean;
22
+ }
23
+ /**
24
+ * Fumadocs loader plugin that enhances page tree nodes with kind badges.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { loader } from 'fumadocs-core/source';
29
+ * import { openpkgSource, openpkgPlugin } from '@openpkg-ts/adapters/fumadocs';
30
+ * import spec from './openpkg.json';
31
+ *
32
+ * const source = loader({
33
+ * baseUrl: '/docs/api',
34
+ * source: openpkgSource({ spec }),
35
+ * plugins: [openpkgPlugin()],
36
+ * });
37
+ * ```
38
+ */
39
+ declare function openpkgPlugin(options?: OpenpkgPluginOptions): LoaderPlugin;
5
40
  import { DocsInstance } from "@openpkg-ts/sdk";
41
+ import { OpenPkg, SpecExport } from "@openpkg-ts/spec";
6
42
  import { Source } from "fumadocs-core/source";
7
43
  interface OpenPkgSourceOptions {
8
44
  /** OpenPkg spec or DocsInstance */
@@ -79,40 +115,4 @@ declare function openpkgSource(options: OpenPkgSourceOptions): Source<{
79
115
  pageData: OpenPkgPageData | OpenPkgIndexPageData | OpenPkgSinglePageData;
80
116
  metaData: OpenPkgMetaData;
81
117
  }>;
82
- import { LoaderPlugin } from "fumadocs-core/source";
83
- import { SpecExportKind } from "@openpkg-ts/spec";
84
- import { ReactNode } from "react";
85
- interface SidebarKindBadgeProps {
86
- kind: SpecExportKind;
87
- className?: string;
88
- }
89
- /**
90
- * Sidebar badge component for fumadocs page tree.
91
- * Wraps @openpkg-ts/ui KindBadge with size="sm" for sidebar use.
92
- *
93
- * Uses createElement instead of JSX for compatibility with
94
- * fumadocs transformPageTree server context.
95
- */
96
- declare function SidebarKindBadge({ kind, className }: SidebarKindBadgeProps): ReactNode;
97
- interface OpenpkgPluginOptions {
98
- /** Show kind badges in sidebar (default: true) */
99
- showBadges?: boolean;
100
- }
101
- /**
102
- * Fumadocs loader plugin that enhances page tree nodes with kind badges.
103
- *
104
- * @example
105
- * ```ts
106
- * import { loader } from 'fumadocs-core/source';
107
- * import { openpkgSource, openpkgPlugin } from '@openpkg-ts/adapters/fumadocs';
108
- * import spec from './openpkg.json';
109
- *
110
- * const source = loader({
111
- * baseUrl: '/docs/api',
112
- * source: openpkgSource({ spec }),
113
- * plugins: [openpkgPlugin()],
114
- * });
115
- * ```
116
- */
117
- declare function openpkgPlugin(options?: OpenpkgPluginOptions): LoaderPlugin;
118
118
  export { toSearchIndexJSON, toSearchIndex, toPagefindRecords, toNavigation, toMarkdown, toJSONString, toJSON, toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords, sortByName, resolveTypeRef, openpkgSource, openpkgPlugin, loadSpec, isProperty, isMethod, groupByVisibility, getProperties, getMethods, formatTypeParameters, formatSchema, formatReturnType, formatParameters, exportToMarkdown, createDocs, buildSignatureString, SpecTypeParameter, SpecTypeKind, SpecType, SpecTag, SpecSignatureParameter, SpecSignature, SpecSchema, SpecMember, SpecExportKind2 as SpecExportKind, SpecExport2 as SpecExport, SpecExample, SidebarKindBadgeProps, SidebarKindBadge, SearchOptions, SearchIndex, PagefindRecord, OpenpkgPluginOptions, OpenPkgSourceOptions, OpenPkgSinglePageData, OpenPkgPageData, OpenPkgMetaData, OpenPkgIndexPageData, OpenPkg2 as OpenPkg, LoadOptions, SidebarKindBadgeProps as KindBadgeProps, SidebarKindBadge as KindBadge, DocsInstance2 as DocsInstance, AlgoliaRecord };
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
 
5
5
  // src/fumadocs/index.ts
6
6
  import {
7
- createDocs as createDocs2,
8
- loadSpec,
9
7
  buildSignatureString,
8
+ createDocs as createDocs2,
9
+ exportToMarkdown,
10
10
  formatParameters,
11
11
  formatReturnType,
12
12
  formatSchema,
@@ -16,22 +16,57 @@ import {
16
16
  groupByVisibility,
17
17
  isMethod,
18
18
  isProperty,
19
+ loadSpec,
19
20
  resolveTypeRef,
20
21
  sortByName,
21
22
  toAlgoliaRecords,
22
- toPagefindRecords,
23
- toSearchIndex,
24
- toSearchIndexJSON,
23
+ toDocusaurusSidebarJS,
24
+ toFumadocsMetaJSON,
25
25
  toHTML,
26
26
  toJSON,
27
27
  toJSONString,
28
28
  toMarkdown,
29
29
  toNavigation,
30
- toDocusaurusSidebarJS,
31
- toFumadocsMetaJSON,
32
- exportToMarkdown
30
+ toPagefindRecords,
31
+ toSearchIndex,
32
+ toSearchIndexJSON
33
33
  } from "@openpkg-ts/sdk";
34
34
 
35
+ // src/fumadocs/plugin.ts
36
+ import { createElement } from "react";
37
+ var SUPPORTED_KINDS = new Set([
38
+ "function",
39
+ "class",
40
+ "interface",
41
+ "type",
42
+ "enum",
43
+ "variable",
44
+ "namespace",
45
+ "module",
46
+ "reference",
47
+ "external"
48
+ ]);
49
+ function openpkgPlugin(options = {}) {
50
+ const { showBadges = true } = options;
51
+ return {
52
+ name: "openpkg",
53
+ transformPageTree: {
54
+ file(node, filePath) {
55
+ if (!showBadges || !filePath)
56
+ return node;
57
+ const file = this.storage.read(filePath);
58
+ if (!file || file.format !== "page")
59
+ return node;
60
+ const pageData = file.data;
61
+ const kind = pageData.export?.kind;
62
+ if (!kind || !SUPPORTED_KINDS.has(kind))
63
+ return node;
64
+ const badge = createElement(SidebarKindBadge, { kind });
65
+ return { ...node, icon: badge };
66
+ }
67
+ }
68
+ };
69
+ }
35
70
  // src/fumadocs/source.ts
36
71
  import { createDocs } from "@openpkg-ts/sdk";
37
72
  var KIND_ORDER = ["function", "class", "interface", "type", "enum", "variable"];
@@ -163,41 +198,6 @@ function openpkgSource(options) {
163
198
  }
164
199
  return { files };
165
200
  }
166
- // src/fumadocs/plugin.ts
167
- import { createElement } from "react";
168
- var SUPPORTED_KINDS = new Set([
169
- "function",
170
- "class",
171
- "interface",
172
- "type",
173
- "enum",
174
- "variable",
175
- "namespace",
176
- "module",
177
- "reference",
178
- "external"
179
- ]);
180
- function openpkgPlugin(options = {}) {
181
- const { showBadges = true } = options;
182
- return {
183
- name: "openpkg",
184
- transformPageTree: {
185
- file(node, filePath) {
186
- if (!showBadges || !filePath)
187
- return node;
188
- const file = this.storage.read(filePath);
189
- if (!file || file.format !== "page")
190
- return node;
191
- const pageData = file.data;
192
- const kind = pageData.export?.kind;
193
- if (!kind || !SUPPORTED_KINDS.has(kind))
194
- return node;
195
- const badge = createElement(SidebarKindBadge, { kind });
196
- return { ...node, icon: badge };
197
- }
198
- }
199
- };
200
- }
201
201
  export {
202
202
  toSearchIndexJSON,
203
203
  toSearchIndex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/adapters",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Framework adapters for OpenPkg - Fumadocs, Docusaurus, Mintlify, etc.",
5
5
  "keywords": [
6
6
  "openpkg",
@@ -41,9 +41,9 @@
41
41
  "typecheck": "tsc --noEmit"
42
42
  },
43
43
  "dependencies": {
44
- "@openpkg-ts/sdk": "workspace:*",
45
- "@openpkg-ts/spec": "workspace:*",
46
- "@openpkg-ts/ui": "workspace:*"
44
+ "@openpkg-ts/sdk": "^0.30.1",
45
+ "@openpkg-ts/spec": "^0.27.1",
46
+ "@openpkg-ts/ui": "^0.1.2"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "fumadocs-core": "^16.0.0",