@openpkg-ts/sdk 0.36.0 → 0.37.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/browser.d.ts CHANGED
@@ -381,19 +381,19 @@ interface DocsInstance {
381
381
  getDeprecated(): SpecExport3[];
382
382
  /** Get exports grouped by kind */
383
383
  groupByKind(): Record<SpecExportKind4, SpecExport3[]>;
384
- /** Render spec or single to MDX */
384
+ /** Render spec or single to an MDX string */
385
385
  toMarkdown(options?: ExportMarkdownOptions): string;
386
- /** Render spec or single to HTML */
386
+ /** Render spec or single to an HTML string */
387
387
  toHTML(options?: HTMLOptions): string;
388
- /** Render spec or single to JSON structure */
388
+ /** Render spec or single to a simplified JSON structure */
389
389
  toJSON(options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
390
- /** Generate navigation structure */
390
+ /** Generate navigation data structure (JSON object, not a component) */
391
391
  toNavigation(options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
392
- /** Generate search index */
392
+ /** Generate search index data */
393
393
  toSearchIndex(options?: SearchOptions): SearchIndex;
394
- /** Generate Pagefind-compatible records */
394
+ /** Generate Pagefind-compatible record objects */
395
395
  toPagefindRecords(options?: SearchOptions): PagefindRecord[];
396
- /** Generate Algolia-compatible records */
396
+ /** Generate Algolia-compatible record objects */
397
397
  toAlgoliaRecords(options?: SearchOptions): AlgoliaRecord[];
398
398
  }
399
399
  import { OpenPkg as OpenPkg8, SpecExport as SpecExport4, SpecMember as SpecMember2, SpecSchema, SpecSignature, SpecType as SpecType2, SpecTypeParameter } from "@openpkg-ts/spec";
package/dist/browser.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  toPagefindRecords,
26
26
  toSearchIndex,
27
27
  toSearchIndexJSON
28
- } from "./shared/chunk-hnajr1tb.js";
28
+ } from "./shared/chunk-zrx9s0n4.js";
29
29
  // src/core/spec-converters.ts
30
30
  function getLangForHighlight(lang) {
31
31
  const langMap = {
package/dist/index.d.ts CHANGED
@@ -229,9 +229,12 @@ interface HTMLOptions {
229
229
  /**
230
230
  * Render spec to standalone HTML page.
231
231
  *
232
+ * Returns an HTML string — not a React component. Write the result to an
233
+ * `.html` file or embed it in a template.
234
+ *
232
235
  * @param spec - The OpenPkg spec to render
233
236
  * @param options - HTML rendering options
234
- * @returns Complete HTML document or fragment
237
+ * @returns Complete HTML document string or HTML fragment string
235
238
  *
236
239
  * @example
237
240
  * ```ts
@@ -403,6 +406,9 @@ declare function exportToMarkdown(exp: SpecExport2, options?: MarkdownOptions):
403
406
  /**
404
407
  * Render entire spec to MDX.
405
408
  *
409
+ * Returns an MDX-formatted string — not a React component. Write the result to
410
+ * a `.mdx` file or pass it to your docs framework's content pipeline.
411
+ *
406
412
  * @param spec - The OpenPkg spec to render
407
413
  * @param options - Markdown options, optionally with name for single mode
408
414
  * @returns MDX string
@@ -499,6 +505,8 @@ declare function toNavigation2(spec: OpenPkg6, options?: NavOptions): GenericNav
499
505
  /**
500
506
  * Generate Fumadocs meta.json file content.
501
507
  *
508
+ * Returns a JSON string suitable for writing to a meta.json file — not a React component.
509
+ *
502
510
  * @param spec - The OpenPkg spec
503
511
  * @param options - Navigation options (format is forced to fumadocs)
504
512
  * @returns JSON string for meta.json file
@@ -513,6 +521,8 @@ declare function toFumadocsMetaJSON(spec: OpenPkg6, options?: Omit<NavOptions, "
513
521
  /**
514
522
  * Generate Docusaurus sidebar config.
515
523
  *
524
+ * Returns a JavaScript module.exports string suitable for writing to a sidebars.js file — not a React component.
525
+ *
516
526
  * @param spec - The OpenPkg spec
517
527
  * @param options - Navigation options (format is forced to docusaurus)
518
528
  * @returns JavaScript module.exports string for sidebars.js
@@ -691,19 +701,19 @@ interface DocsInstance {
691
701
  getDeprecated(): SpecExport3[];
692
702
  /** Get exports grouped by kind */
693
703
  groupByKind(): Record<SpecExportKind4, SpecExport3[]>;
694
- /** Render spec or single to MDX */
704
+ /** Render spec or single to an MDX string */
695
705
  toMarkdown(options?: ExportMarkdownOptions): string;
696
- /** Render spec or single to HTML */
706
+ /** Render spec or single to an HTML string */
697
707
  toHTML(options?: HTMLOptions): string;
698
- /** Render spec or single to JSON structure */
708
+ /** Render spec or single to a simplified JSON structure */
699
709
  toJSON(options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
700
- /** Generate navigation structure */
710
+ /** Generate navigation data structure (JSON object, not a component) */
701
711
  toNavigation(options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
702
- /** Generate search index */
712
+ /** Generate search index data */
703
713
  toSearchIndex(options?: SearchOptions): SearchIndex;
704
- /** Generate Pagefind-compatible records */
714
+ /** Generate Pagefind-compatible record objects */
705
715
  toPagefindRecords(options?: SearchOptions): PagefindRecord[];
706
- /** Generate Algolia-compatible records */
716
+ /** Generate Algolia-compatible record objects */
707
717
  toAlgoliaRecords(options?: SearchOptions): AlgoliaRecord[];
708
718
  }
709
719
  /**
@@ -722,6 +732,10 @@ declare function loadSpec(spec: OpenPkg8): DocsInstance;
722
732
  /**
723
733
  * Creates a docs instance for querying and rendering API documentation.
724
734
  *
735
+ * Render methods (toMarkdown, toHTML, toJSON, toNavigation) return strings or
736
+ * plain data objects — not React components. For React UI components, see the
737
+ * `@openpkg-ts/registry` package.
738
+ *
725
739
  * @example
726
740
  * ```ts
727
741
  * import { createDocs } from '@openpkg-ts/sdk'
@@ -1125,7 +1139,7 @@ interface ExportItem {
1125
1139
  /** Export name */
1126
1140
  name: string;
1127
1141
  /** Export kind */
1128
- kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "namespace";
1142
+ kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "namespace" | "external";
1129
1143
  /** Source file path */
1130
1144
  file: string;
1131
1145
  /** Line number (1-indexed) */
@@ -1207,9 +1221,14 @@ declare class TypeRegistry {
1207
1221
  */
1208
1222
  private isSelfRef;
1209
1223
  /**
1224
+ * Resolve a self-referential $ref to the actual type structure.
1225
+ * Handles unions (string literal → enum), enums (numeric → enum), and objects.
1226
+ */
1227
+ private resolveSelRefSchema;
1228
+ /**
1210
1229
  * Build object schema from type properties (for interfaces/classes)
1211
1230
  */
1212
- private buildObjectSchemaFromType;
1231
+ private buildObjectSchemaFromProperties;
1213
1232
  }
1214
1233
  import ts3 from "typescript";
1215
1234
  /**
@@ -1618,7 +1637,7 @@ import ts9 from "typescript";
1618
1637
  declare function serializeEnum(node: ts9.EnumDeclaration, ctx: SerializerContext): SpecExport10 | null;
1619
1638
  import { SpecExport as SpecExport11 } from "@openpkg-ts/spec";
1620
1639
  import ts10 from "typescript";
1621
- declare function serializeFunctionExport(node: ts10.FunctionDeclaration | ts10.ArrowFunction, ctx: SerializerContext, nameOverride?: string): SpecExport11 | null;
1640
+ declare function serializeFunctionExport(node: ts10.FunctionDeclaration | ts10.ArrowFunction | ts10.FunctionExpression, ctx: SerializerContext, nameOverride?: string): SpecExport11 | null;
1622
1641
  import { SpecExport as SpecExport12 } from "@openpkg-ts/spec";
1623
1642
  import ts11 from "typescript";
1624
1643
  declare function serializeInterface(node: ts11.InterfaceDeclaration, ctx: SerializerContext): SpecExport12 | null;
@@ -1645,6 +1664,8 @@ import ts15 from "typescript";
1645
1664
  declare const BUILTIN_TYPE_SCHEMAS: Record<string, SpecSchema2>;
1646
1665
  declare const PRIMITIVES: Set<string>;
1647
1666
  declare const ARRAY_PROTOTYPE_METHODS: Set<string>;
1667
+ declare const STRING_PROTOTYPE_METHODS: Set<string>;
1668
+ declare const NUMBER_PROTOTYPE_METHODS: Set<string>;
1648
1669
  /**
1649
1670
  * Check if a name is a primitive type
1650
1671
  */
@@ -1770,4 +1791,4 @@ declare function normalizeMembers(members: SpecMember3[], options?: NormalizeOpt
1770
1791
  import ts16 from "typescript";
1771
1792
  declare function isExported(node: ts16.Node): boolean;
1772
1793
  declare function getNodeName(node: ts16.Node): string | undefined;
1773
- export { zodAdapter, withDescription2 as withDescription, valibotAdapter, typeboxAdapter, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toReactString, toReact, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, sortByName, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, registerReferencedTypes, registerAdapter, recommendSemverBump, query, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExportKind, getExport2 as getExport, getDeprecationMessage, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, buildSignatureString, buildSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaExtractionResult, SchemaAdapter, ReactLayoutOptions, QueryBuilder, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, PRIMITIVES, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractionWarningCode, ExtractionWarning, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CategorizedBreaking, CacheManagerOptions, CacheManager, CONFIG_FILENAME, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };
1794
+ export { zodAdapter, withDescription2 as withDescription, valibotAdapter, typeboxAdapter, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toReactString, toReact, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, sortByName, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, registerReferencedTypes, registerAdapter, recommendSemverBump, query, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExportKind, getExport2 as getExport, getDeprecationMessage, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, buildSignatureString, buildSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaExtractionResult, SchemaAdapter, STRING_PROTOTYPE_METHODS, ReactLayoutOptions, QueryBuilder, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, PRIMITIVES, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, NUMBER_PROTOTYPE_METHODS, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractionWarningCode, ExtractionWarning, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CategorizedBreaking, CacheManagerOptions, CacheManager, CONFIG_FILENAME, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };