fumadocs-openapi 6.0.2 → 6.0.3

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 (63) hide show
  1. package/dist/build-routes.d.ts +3 -3
  2. package/dist/generate-file.d.ts +1 -1
  3. package/dist/generate-file.js +2 -2
  4. package/dist/generate.d.ts +5 -5
  5. package/dist/generate.js +4 -4
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +3 -3
  8. package/dist/render/codeblock.d.ts +1 -1
  9. package/dist/render/heading.d.ts +1 -1
  10. package/dist/render/operation.d.ts +2 -2
  11. package/dist/render/operation.js +14 -14
  12. package/dist/render/playground.d.ts +2 -2
  13. package/dist/render/playground.js +3 -3
  14. package/dist/render/renderer.d.ts +2 -2
  15. package/dist/render/renderer.js +3 -3
  16. package/dist/render/schema.d.ts +2 -2
  17. package/dist/render/schema.js +3 -3
  18. package/dist/requests/curl.d.ts +1 -1
  19. package/dist/requests/curl.js +1 -1
  20. package/dist/requests/go.d.ts +1 -1
  21. package/dist/requests/go.js +1 -1
  22. package/dist/requests/javascript.d.ts +1 -1
  23. package/dist/requests/javascript.js +1 -1
  24. package/dist/requests/python.d.ts +1 -1
  25. package/dist/requests/python.js +1 -1
  26. package/dist/scalar/client.js +1 -1
  27. package/dist/scalar/index.d.ts +1 -1
  28. package/dist/scalar/index.js +1 -1
  29. package/dist/server/api-page.d.ts +3 -3
  30. package/dist/server/api-page.js +5 -5
  31. package/dist/server/create-method.d.ts +2 -2
  32. package/dist/server/create.d.ts +3 -3
  33. package/dist/server/create.js +2 -2
  34. package/dist/server/index.d.ts +2 -2
  35. package/dist/server/index.js +2 -2
  36. package/dist/server/source-api.js +1 -1
  37. package/dist/types.d.ts +5 -5
  38. package/dist/ui/client.d.ts +10 -10
  39. package/dist/ui/client.js +3 -3
  40. package/dist/ui/contexts/api.d.ts +1 -1
  41. package/dist/ui/contexts/schema.d.ts +1 -1
  42. package/dist/ui/index.d.ts +2 -2
  43. package/dist/ui/index.js +2 -2
  44. package/dist/ui/playground/fetcher.d.ts +2 -2
  45. package/dist/ui/playground/fetcher.js +1 -1
  46. package/dist/ui/playground/get-default-values.d.ts +1 -1
  47. package/dist/ui/playground/get-default-values.js +1 -1
  48. package/dist/ui/playground/index.d.ts +2 -2
  49. package/dist/ui/playground/index.js +10 -10
  50. package/dist/ui/playground/inputs.d.ts +1 -1
  51. package/dist/ui/playground/inputs.js +5 -5
  52. package/dist/ui/playground/resolve.d.ts +1 -1
  53. package/dist/ui/server-select.js +3 -3
  54. package/dist/utils/combine-schema.d.ts +1 -1
  55. package/dist/utils/generate-document.d.ts +4 -4
  56. package/dist/utils/generate-document.js +1 -1
  57. package/dist/utils/generate-sample.d.ts +2 -2
  58. package/dist/utils/generate-sample.js +2 -2
  59. package/dist/utils/get-security.d.ts +2 -2
  60. package/dist/utils/get-typescript-schema.d.ts +2 -2
  61. package/dist/utils/process-document.d.ts +2 -2
  62. package/dist/utils/schema.d.ts +1 -1
  63. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
- import { type Document } from './types';
2
- import type { NoReference } from './utils/schema';
3
- import type { OperationItem, WebhookItem } from './server/api-page';
1
+ import { type Document } from './types.js';
2
+ import type { NoReference } from './utils/schema.js';
3
+ import type { OperationItem, WebhookItem } from './server/api-page.js';
4
4
  export declare const methodKeys: readonly ["get", "post", "patch", "delete", "head", "put"];
5
5
  type Result = {
6
6
  webhooks: (WebhookItem & {
@@ -1,4 +1,4 @@
1
- import { type GenerateOptions } from './generate';
1
+ import { type GenerateOptions } from './generate.js';
2
2
  export interface Config extends GenerateOptions {
3
3
  /**
4
4
  * Schema files
@@ -1,8 +1,8 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join, parse } from 'node:path';
3
3
  import fg from 'fast-glob';
4
- import { generatePages, } from './generate';
5
- import { generateAll, generateTags } from './generate';
4
+ import { generatePages, } from './generate.js';
5
+ import { generateAll, generateTags } from './generate.js';
6
6
  export async function generateFiles(options) {
7
7
  const { input, output, name: nameFn, per = 'operation', groupBy = 'none', cwd = process.cwd(), } = options;
8
8
  const outputDir = join(cwd, output);
@@ -1,8 +1,8 @@
1
- import { type DocumentContext } from './utils/generate-document';
2
- import type { OperationObject, PathItemObject } from './types';
3
- import type { NoReference } from './utils/schema';
4
- import type { OperationItem, WebhookItem } from './server/api-page';
5
- import { type DocumentInput } from './utils/process-document';
1
+ import { type DocumentContext } from './utils/generate-document.js';
2
+ import type { OperationObject, PathItemObject } from './types.js';
3
+ import type { NoReference } from './utils/schema.js';
4
+ import type { OperationItem, WebhookItem } from './server/api-page.js';
5
+ import { type DocumentInput } from './utils/process-document.js';
6
6
  export interface GenerateOptions {
7
7
  /**
8
8
  * Additional imports of your MDX components.
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { resolve } from 'node:path';
2
- import { getAPIPageItems } from './build-routes';
3
- import { generateDocument, } from './utils/generate-document';
4
- import { idToTitle } from './utils/id-to-title';
5
- import { processDocument } from './utils/process-document';
2
+ import { getAPIPageItems } from './build-routes.js';
3
+ import { generateDocument, } from './utils/generate-document.js';
4
+ import { idToTitle } from './utils/id-to-title.js';
5
+ import { processDocument } from './utils/process-document.js';
6
6
  async function dereference(pathOrDocument, options) {
7
7
  return await processDocument(
8
8
  // resolve paths
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './generate';
2
- export * from './generate-file';
3
- export * from './types';
1
+ export * from './generate.js';
2
+ export * from './generate-file.js';
3
+ export * from './types.js';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './generate';
2
- export * from './generate-file';
3
- export * from './types';
1
+ export * from './generate.js';
2
+ export * from './generate-file.js';
3
+ export * from './types.js';
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes } from 'react';
2
- import type { RenderContext } from '../types';
2
+ import type { RenderContext } from '../types.js';
3
3
  export type CodeBlockProps = HTMLAttributes<HTMLPreElement> & {
4
4
  code: string;
5
5
  lang: string;
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { RenderContext } from '../types';
2
+ import type { RenderContext } from '../types.js';
3
3
  export declare function heading(depth: number, child: string, ctx: RenderContext): ReactNode;
4
4
  //# sourceMappingURL=heading.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { type ReactElement } from 'react';
2
- import { type EndpointSample } from '../utils/generate-sample';
3
- import type { MethodInformation, RenderContext } from '../types';
2
+ import { type EndpointSample } from '../utils/generate-sample.js';
3
+ import type { MethodInformation, RenderContext } from '../types.js';
4
4
  export interface CodeSample {
5
5
  lang: string;
6
6
  label: string;
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment } from 'react';
3
- import { generateSample } from '../utils/generate-sample';
4
- import * as CURL from '../requests/curl';
5
- import * as JS from '../requests/javascript';
6
- import * as Go from '../requests/go';
7
- import * as Python from '../requests/python';
8
- import { getPreferredType } from '../utils/schema';
9
- import { getTypescriptSchema } from '../utils/get-typescript-schema';
10
- import { getSecurities, getSecurityPrefix } from '../utils/get-security';
11
- import { idToTitle } from '../utils/id-to-title';
12
- import { Markdown } from './markdown';
13
- import { heading } from './heading';
14
- import { Schema } from './schema';
15
- import { createMethod } from '../server/create-method';
16
- import { methodKeys } from '../build-routes';
3
+ import { generateSample } from '../utils/generate-sample.js';
4
+ import * as CURL from '../requests/curl.js';
5
+ import * as JS from '../requests/javascript.js';
6
+ import * as Go from '../requests/go.js';
7
+ import * as Python from '../requests/python.js';
8
+ import { getPreferredType } from '../utils/schema.js';
9
+ import { getTypescriptSchema } from '../utils/get-typescript-schema.js';
10
+ import { getSecurities, getSecurityPrefix } from '../utils/get-security.js';
11
+ import { idToTitle } from '../utils/id-to-title.js';
12
+ import { Markdown } from './markdown.js';
13
+ import { heading } from './heading.js';
14
+ import { Schema } from './schema.js';
15
+ import { createMethod } from '../server/create-method.js';
16
+ import { methodKeys } from '../build-routes.js';
17
17
  export function Operation({ type = 'operation', path, method, ctx, hasHead, headingLevel = 2, }) {
18
18
  const body = method.requestBody;
19
19
  const security = method.security ?? ctx.schema.document.security;
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { MethodInformation, RenderContext } from '../types';
3
- import { type Security } from '../utils/get-security';
2
+ import type { MethodInformation, RenderContext } from '../types.js';
3
+ import { type Security } from '../utils/get-security.js';
4
4
  interface BaseRequestField {
5
5
  name: string;
6
6
  description?: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getPreferredType, } from '../utils/schema';
3
- import { getSecurities } from '../utils/get-security';
4
- import { APIPlayground } from '../ui';
2
+ import { getPreferredType, } from '../utils/schema.js';
3
+ import { getSecurities } from '../utils/get-security.js';
4
+ import { APIPlayground } from '../ui/index.js';
5
5
  export function Playground({ path, method, ctx, }) {
6
6
  let currentId = 0;
7
7
  const bodyContent = method.requestBody?.content;
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType, ReactNode } from 'react';
2
- import type { MethodInformation, RenderContext, ServerObject } from '../types';
2
+ import type { MethodInformation, RenderContext, ServerObject } from '../types.js';
3
3
  export interface ResponsesProps {
4
4
  items: string[];
5
5
  children: ReactNode;
@@ -71,6 +71,6 @@ export interface Renderer {
71
71
  ctx: RenderContext;
72
72
  }>;
73
73
  }
74
- export type { APIPlaygroundProps, RequestSchema, PrimitiveRequestField, ReferenceSchema, } from '../render/playground';
74
+ export type { APIPlaygroundProps, RequestSchema, PrimitiveRequestField, ReferenceSchema, } from '../render/playground.js';
75
75
  export declare function createRenders(shikiOptions: RenderContext['shikiOptions']): Renderer;
76
76
  //# sourceMappingURL=renderer.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
3
3
  import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
4
- import { CodeBlock } from '../render/codeblock';
5
- import { API, Root, APIInfo, APIExample, Property, ObjectCollapsible, } from '../ui';
6
- import { Playground } from '../render/playground';
4
+ import { CodeBlock } from '../render/codeblock.js';
5
+ import { API, Root, APIInfo, APIExample, Property, ObjectCollapsible, } from '../ui/index.js';
6
+ import { Playground } from '../render/playground.js';
7
7
  export function createRenders(shikiOptions) {
8
8
  return {
9
9
  Root: (props) => (_jsx(Root, { shikiOptions: shikiOptions, ...props, children: props.children })),
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
- import { NoReference, type ParsedSchema } from '../utils/schema';
3
- import type { RenderContext } from '../types';
2
+ import { NoReference, type ParsedSchema } from '../utils/schema.js';
3
+ import type { RenderContext } from '../types.js';
4
4
  interface Context {
5
5
  readOnly: boolean;
6
6
  writeOnly: boolean;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { isNullable } from '../utils/schema';
3
- import { combineSchema } from '../utils/combine-schema';
4
- import { Markdown } from './markdown';
2
+ import { isNullable } from '../utils/schema.js';
3
+ import { combineSchema } from '../utils/combine-schema.js';
4
+ import { Markdown } from './markdown.js';
5
5
  const keys = {
6
6
  default: 'Default',
7
7
  minimum: 'Minimum',
@@ -1,3 +1,3 @@
1
- import { type EndpointSample } from '../utils/generate-sample';
1
+ import { type EndpointSample } from '../utils/generate-sample.js';
2
2
  export declare function getSampleRequest(endpoint: EndpointSample): string;
3
3
  //# sourceMappingURL=curl.d.ts.map
@@ -1,4 +1,4 @@
1
- import { inputToString } from '../utils/input-to-string';
1
+ import { inputToString } from '../utils/input-to-string.js';
2
2
  export function getSampleRequest(endpoint) {
3
3
  const s = [];
4
4
  s.push(`curl -X ${endpoint.method} "${endpoint.url}"`);
@@ -1,3 +1,3 @@
1
- import { type EndpointSample } from '../utils/generate-sample';
1
+ import { type EndpointSample } from '../utils/generate-sample.js';
2
2
  export declare function getSampleRequest(endpoint: EndpointSample): string;
3
3
  //# sourceMappingURL=go.d.ts.map
@@ -1,4 +1,4 @@
1
- import { inputToString } from '../utils/input-to-string';
1
+ import { inputToString } from '../utils/input-to-string.js';
2
2
  export function getSampleRequest(endpoint) {
3
3
  const imports = ['fmt', 'net/http', 'io/ioutil'];
4
4
  const headers = new Map();
@@ -1,3 +1,3 @@
1
- import { type EndpointSample } from '../utils/generate-sample';
1
+ import { type EndpointSample } from '../utils/generate-sample.js';
2
2
  export declare function getSampleRequest(endpoint: EndpointSample): string;
3
3
  //# sourceMappingURL=javascript.d.ts.map
@@ -1,4 +1,4 @@
1
- import { inputToString } from '../utils/input-to-string';
1
+ import { inputToString } from '../utils/input-to-string.js';
2
2
  export function getSampleRequest(endpoint) {
3
3
  const s = [];
4
4
  const options = new Map();
@@ -1,3 +1,3 @@
1
- import { type EndpointSample } from '../utils/generate-sample';
1
+ import { type EndpointSample } from '../utils/generate-sample.js';
2
2
  export declare function getSampleRequest(endpoint: EndpointSample): string;
3
3
  //# sourceMappingURL=python.d.ts.map
@@ -1,4 +1,4 @@
1
- import { inputToString } from '../utils/input-to-string';
1
+ import { inputToString } from '../utils/input-to-string.js';
2
2
  export function getSampleRequest(endpoint) {
3
3
  const headers = new Map();
4
4
  const cookies = new Map();
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from 'fumadocs-ui/components/api';
4
4
  import { buttonVariants } from 'fumadocs-ui/components/ui/button';
5
5
  import { ApiClientModalProvider, useApiClientModal, } from '@scalar/api-client-react';
6
- import { MethodLabel } from '../ui/components/method-label';
6
+ import { MethodLabel } from '../ui/components/method-label.js';
7
7
  import { useTheme } from 'next-themes';
8
8
  import { useEffect, useState } from 'react';
9
9
  export default function ScalarPlayground({ path, method, spec, }) {
@@ -1,4 +1,4 @@
1
- import type { MethodInformation, RenderContext } from '../types';
1
+ import type { MethodInformation, RenderContext } from '../types.js';
2
2
  export declare function APIPlayground({ path, method, ctx, }: {
3
3
  path: string;
4
4
  method: MethodInformation;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import dynamic from 'next/dynamic';
3
- const Client = dynamic(() => import('./client'));
3
+ const Client = dynamic(() => import('./client.js'));
4
4
  export function APIPlayground({ path, method, ctx, }) {
5
5
  return (_jsx(Client, { method: method.method, path: path, spec: ctx.schema.downloaded }));
6
6
  }
@@ -1,7 +1,7 @@
1
- import type { RenderContext } from '../types';
2
- import { type Renderer } from '../render/renderer';
1
+ import type { RenderContext } from '../types.js';
2
+ import { type Renderer } from '../render/renderer.js';
3
3
  import type { OpenAPIV3_1 } from 'openapi-types';
4
- import { type DocumentInput, type ProcessedDocument } from '../utils/process-document';
4
+ import { type DocumentInput, type ProcessedDocument } from '../utils/process-document.js';
5
5
  type ApiPageContextProps = Pick<Partial<RenderContext>, 'shikiOptions' | 'generateTypeScriptSchema' | 'generateCodeSamples' | 'proxyUrl' | 'showResponseSchema'>;
6
6
  export interface ApiPageProps extends ApiPageContextProps {
7
7
  document: DocumentInput;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Slugger from 'github-slugger';
3
- import { Operation } from '../render/operation';
4
- import { createMethod } from '../server/create-method';
5
- import { createRenders } from '../render/renderer';
6
- import { processDocument, } from '../utils/process-document';
7
- import { getUrl } from '../utils/server-url';
3
+ import { Operation } from '../render/operation.js';
4
+ import { createMethod } from '../server/create-method.js';
5
+ import { createRenders } from '../render/renderer.js';
6
+ import { processDocument, } from '../utils/process-document.js';
7
+ import { getUrl } from '../utils/server-url.js';
8
8
  export async function APIPage(props) {
9
9
  const { operations, hasHead = true, webhooks, disableCache = process.env.NODE_ENV === 'development', } = props;
10
10
  const processed = await processDocument(props.document, disableCache);
@@ -1,5 +1,5 @@
1
- import type { MethodInformation, OperationObject, PathItemObject } from '../types';
2
- import type { NoReference } from '../utils/schema';
1
+ import type { MethodInformation, OperationObject, PathItemObject } from '../types.js';
2
+ import type { NoReference } from '../utils/schema.js';
3
3
  /**
4
4
  * Summarize method endpoint information
5
5
  */
@@ -1,7 +1,7 @@
1
1
  import { type FC } from 'react';
2
- import { type ApiPageProps } from '../server/api-page';
3
- import type { DocumentInput } from '../utils/process-document';
4
- import { createProxy } from '../server/proxy';
2
+ import { type ApiPageProps } from '../server/api-page.js';
3
+ import type { DocumentInput } from '../utils/process-document.js';
4
+ import { createProxy } from '../server/proxy.js';
5
5
  export interface OpenAPIOptions extends Omit<Partial<ApiPageProps>, 'document'> {
6
6
  /**
7
7
  * @deprecated Pass document to `APIPage` instead
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { APIPage } from '../server/api-page';
3
- import { createProxy } from '../server/proxy';
2
+ import { APIPage } from '../server/api-page.js';
3
+ import { createProxy } from '../server/proxy.js';
4
4
  export function createOpenAPI(options = {}) {
5
5
  return {
6
6
  createProxy,
@@ -1,3 +1,3 @@
1
- export * from './create';
2
- export * from './source-api';
1
+ export * from './create.js';
2
+ export * from './source-api.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './create';
2
- export * from './source-api';
1
+ export * from './create.js';
2
+ export * from './source-api.js';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cva } from 'class-variance-authority';
3
- import { getBadgeColor } from '../ui/components/variants';
3
+ import { getBadgeColor } from '../ui/components/variants.js';
4
4
  /**
5
5
  * Source API Integration
6
6
  *
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { OpenAPIV3_1 as V3_1 } from 'openapi-types';
2
2
  import type { default as Slugger } from 'github-slugger';
3
- import { type Renderer } from './render/renderer';
4
- import type { EndpointSample } from './utils/generate-sample';
5
- import type { CodeSample } from './render/operation';
3
+ import { type Renderer } from './render/renderer.js';
4
+ import type { EndpointSample } from './utils/generate-sample.js';
5
+ import type { CodeSample } from './render/operation.js';
6
6
  import type { BuiltinTheme, CodeOptionsThemes, CodeToHastOptionsCommon } from 'shiki';
7
- import type { NoReference } from './utils/schema';
8
- import type { ProcessedDocument } from './utils/process-document';
7
+ import type { NoReference } from './utils/schema.js';
8
+ import type { ProcessedDocument } from './utils/process-document.js';
9
9
  export type Document = V3_1.Document;
10
10
  export type OperationObject = V3_1.OperationObject;
11
11
  export type ParameterObject = V3_1.ParameterObject;
@@ -1,22 +1,22 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type RootProps } from '../render/renderer';
3
- import type { RenderContext } from '../types';
4
- export declare const APIPlayground: import("react").ComponentType<import("../render/renderer").APIPlaygroundProps & {
2
+ import { type RootProps } from '../render/renderer.js';
3
+ import type { RenderContext } from '../types.js';
4
+ export declare const APIPlayground: import("react").ComponentType<import("../render/renderer.js").APIPlaygroundProps & {
5
5
  fields?: {
6
- auth?: import("./playground").CustomField<"authorization", import("../render/renderer").RequestSchema>;
7
- path?: import("./playground").CustomField<`path.${string}`, import("../render/renderer").PrimitiveRequestField>;
8
- query?: import("./playground").CustomField<`query.${string}`, import("../render/renderer").PrimitiveRequestField>;
9
- header?: import("./playground").CustomField<`header.${string}`, import("../render/renderer").PrimitiveRequestField>;
10
- body?: import("./playground").CustomField<"body", import("../render/renderer").RequestSchema>;
6
+ auth?: import("./playground/index.js").CustomField<"authorization", import("../render/renderer.js").RequestSchema>;
7
+ path?: import("./playground/index.js").CustomField<`path.${string}`, import("../render/renderer.js").PrimitiveRequestField>;
8
+ query?: import("./playground/index.js").CustomField<`query.${string}`, import("../render/renderer.js").PrimitiveRequestField>;
9
+ header?: import("./playground/index.js").CustomField<`header.${string}`, import("../render/renderer.js").PrimitiveRequestField>;
10
+ body?: import("./playground/index.js").CustomField<"body", import("../render/renderer.js").RequestSchema>;
11
11
  };
12
12
  components?: Partial<{
13
13
  ResultDisplay: import("react").FC<{
14
- data: import("./playground/fetcher").FetchResult;
14
+ data: import("./playground/fetcher.js").FetchResult;
15
15
  }>;
16
16
  }>;
17
17
  } & HTMLAttributes<HTMLFormElement>>;
18
18
  export declare function Root({ children, baseUrl, className, shikiOptions, servers, ...props }: RootProps & {
19
19
  shikiOptions: RenderContext['shikiOptions'];
20
20
  } & HTMLAttributes<HTMLDivElement>): ReactNode;
21
- export { useSchemaContext } from './contexts/schema';
21
+ export { useSchemaContext } from './contexts/schema.js';
22
22
  //# sourceMappingURL=client.d.ts.map
package/dist/ui/client.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cn } from 'fumadocs-ui/components/api';
4
4
  import dynamic from 'next/dynamic';
5
- import { ApiProvider } from '../ui/contexts/api';
6
- export const APIPlayground = dynamic(() => import('./playground').then((mod) => mod.APIPlayground));
5
+ import { ApiProvider } from '../ui/contexts/api.js';
6
+ export const APIPlayground = dynamic(() => import('./playground/index.js').then((mod) => mod.APIPlayground));
7
7
  export function Root({ children, baseUrl, className, shikiOptions, servers, ...props }) {
8
8
  return (_jsx("div", { className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className), ...props, children: _jsx(ApiProvider, { servers: servers, shikiOptions: shikiOptions, defaultBaseUrl: baseUrl, children: children }) }));
9
9
  }
10
- export { useSchemaContext } from './contexts/schema';
10
+ export { useSchemaContext } from './contexts/schema.js';
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode, type RefObject } from 'react';
2
- import type { RenderContext, ServerObject } from '../../types';
2
+ import type { RenderContext, ServerObject } from '../../types.js';
3
3
  export interface ApiProviderProps {
4
4
  /**
5
5
  * Base URL for API requests
@@ -1,5 +1,5 @@
1
1
  import { type RefObject } from 'react';
2
- import { type ReferenceSchema, type RequestSchema } from '../../render/playground';
2
+ import { type ReferenceSchema, type RequestSchema } from '../../render/playground.js';
3
3
  interface SchemaContextType {
4
4
  references: Record<string, RequestSchema>;
5
5
  dynamic: RefObject<Map<string, DynamicField>>;
@@ -1,6 +1,6 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import type { PropertyProps } from '../render/renderer';
3
- export { Root, useSchemaContext, APIPlayground } from './client';
2
+ import type { PropertyProps } from '../render/renderer.js';
3
+ export { Root, useSchemaContext, APIPlayground } from './client.js';
4
4
  export declare function APIInfo({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
5
5
  export declare function API({ children, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
6
6
  export declare function Property({ name, type, required, deprecated, children, }: PropertyProps): import("react/jsx-runtime").JSX.Element;
package/dist/ui/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { buttonVariants, cn } from 'fumadocs-ui/components/api';
3
- import { badgeVariants } from '../ui/components/variants';
3
+ import { badgeVariants } from '../ui/components/variants.js';
4
4
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
5
5
  import { ChevronDown } from 'lucide-react';
6
- export { Root, useSchemaContext, APIPlayground } from './client';
6
+ export { Root, useSchemaContext, APIPlayground } from './client.js';
7
7
  export function APIInfo({ className, ...props }) {
8
8
  return (_jsx("div", { className: cn('min-w-0 flex-1', className), ...props, children: props.children }));
9
9
  }
@@ -1,5 +1,5 @@
1
- import { type RequestSchema } from '../../render/playground';
2
- import { type DynamicField } from '../../ui/contexts/schema';
1
+ import { type RequestSchema } from '../../render/playground.js';
2
+ import { type DynamicField } from '../../ui/contexts/schema.js';
3
3
  export interface FetchOptions {
4
4
  url: string;
5
5
  method: string;
@@ -1,4 +1,4 @@
1
- import { resolve } from '../../ui/playground/resolve';
1
+ import { resolve } from '../../ui/playground/resolve.js';
2
2
  /**
3
3
  * @param bodySchema - schema of body
4
4
  * @param references - defined references of schemas, needed for resolve cyclic references
@@ -1,4 +1,4 @@
1
- import type { PrimitiveRequestField, RequestSchema } from '../../render/playground';
1
+ import type { PrimitiveRequestField, RequestSchema } from '../../render/playground.js';
2
2
  export declare function getDefaultValue(item: RequestSchema, references: Record<string, RequestSchema>): unknown;
3
3
  export declare function getDefaultValues(field: PrimitiveRequestField[], context: Record<string, RequestSchema>): Record<string, unknown>;
4
4
  //# sourceMappingURL=get-default-values.d.ts.map
@@ -1,4 +1,4 @@
1
- import { resolve } from '../../ui/playground/resolve';
1
+ import { resolve } from '../../ui/playground/resolve.js';
2
2
  export function getDefaultValue(item, references) {
3
3
  if (item.type === 'object')
4
4
  return Object.fromEntries(Object.entries(item.properties).map(([key, prop]) => [
@@ -1,7 +1,7 @@
1
1
  import { type ReactElement, type HTMLAttributes, type FC, type ReactNode } from 'react';
2
2
  import type { FieldPath, UseFormStateReturn, ControllerFieldState, ControllerRenderProps } from 'react-hook-form';
3
- import type { FetchResult } from '../../ui/playground/fetcher';
4
- import type { APIPlaygroundProps, PrimitiveRequestField, RequestSchema } from '../../render/playground';
3
+ import type { FetchResult } from '../../ui/playground/fetcher.js';
4
+ import type { APIPlaygroundProps, PrimitiveRequestField, RequestSchema } from '../../render/playground.js';
5
5
  interface FormValues {
6
6
  authorization: string | {
7
7
  username: string;
@@ -3,16 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useRef, useEffect, Fragment, } from 'react';
4
4
  import { Controller, FormProvider, useForm } from 'react-hook-form';
5
5
  import { cn, buttonVariants } from 'fumadocs-ui/components/api';
6
- import { useApiContext } from '../../ui/contexts/api';
7
- import { getDefaultValue, getDefaultValues, } from '../../ui/playground/get-default-values';
8
- import { FieldSet, ObjectInput } from '../../ui/playground/inputs';
9
- import { SchemaContext } from '../contexts/schema';
10
- import { getStatusInfo } from '../../ui/playground/status-info';
11
- import { getUrl } from '../../utils/server-url';
6
+ import { useApiContext } from '../../ui/contexts/api.js';
7
+ import { getDefaultValue, getDefaultValues, } from '../../ui/playground/get-default-values.js';
8
+ import { FieldSet, ObjectInput } from '../../ui/playground/inputs.js';
9
+ import { SchemaContext } from '../contexts/schema.js';
10
+ import { getStatusInfo } from '../../ui/playground/status-info.js';
11
+ import { getUrl } from '../../utils/server-url.js';
12
12
  import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';
13
- import { MethodLabel } from '../../ui/components/method-label';
14
- import { useQuery } from '../../utils/use-query';
15
- import ServerSelect from '../../ui/server-select';
13
+ import { MethodLabel } from '../../ui/components/method-label.js';
14
+ import { useQuery } from '../../utils/use-query.js';
15
+ import ServerSelect from '../../ui/server-select.js';
16
16
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
17
17
  import { ChevronDown } from 'lucide-react';
18
18
  function defaultAuthValue(auth) {
@@ -39,7 +39,7 @@ export function APIPlayground({ route, method = 'GET', authorization, path = [],
39
39
  },
40
40
  });
41
41
  const testQuery = useQuery(async (input) => {
42
- const fetcher = await import('./fetcher').then((mod) => mod.createBrowserFetcher(body, schemas));
42
+ const fetcher = await import('./fetcher.js').then((mod) => mod.createBrowserFetcher(body, schemas));
43
43
  const query = { ...input.query };
44
44
  const header = { ...input.header };
45
45
  if (input.authorization && authorization) {
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import type { RequestSchema } from '../../render/playground';
2
+ import type { RequestSchema } from '../../render/playground.js';
3
3
  type FieldOfType<Type> = Extract<RequestSchema, {
4
4
  type: Type;
5
5
  }>;
@@ -3,11 +3,11 @@ import { useState, } from 'react';
3
3
  import { Plus, Trash2 } from 'lucide-react';
4
4
  import { Controller, useFieldArray, useFormContext } from 'react-hook-form';
5
5
  import { cn, buttonVariants } from 'fumadocs-ui/components/api';
6
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../../ui/components/select';
7
- import { resolve } from '../../ui/playground/resolve';
8
- import { Input, labelVariants } from '../../ui/components/input';
9
- import { getDefaultValue } from '../../ui/playground/get-default-values';
10
- import { useSchemaContext } from '../../ui/contexts/schema';
6
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../../ui/components/select.js';
7
+ import { resolve } from '../../ui/playground/resolve.js';
8
+ import { Input, labelVariants } from '../../ui/components/input.js';
9
+ import { getDefaultValue } from '../../ui/playground/get-default-values.js';
10
+ import { useSchemaContext } from '../../ui/contexts/schema.js';
11
11
  function FieldHeader({ name, required = false, type, ...props }) {
12
12
  return (_jsxs("label", { ...props, className: cn('w-full inline-flex items-center gap-1', props.className), children: [_jsx("span", { className: cn(labelVariants()), children: name }), required ? _jsx("span", { className: "text-red-500", children: "*" }) : null, _jsx("div", { className: "flex-1" }), type ? (_jsx("code", { className: "text-xs text-fd-muted-foreground", children: type })) : null, props.children] }));
13
13
  }
@@ -1,4 +1,4 @@
1
- import { type ReferenceSchema, type RequestSchema } from '../../render/playground';
1
+ import { type ReferenceSchema, type RequestSchema } from '../../render/playground.js';
2
2
  /**
3
3
  * Resolve reference
4
4
  */
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useApiContext, useServerSelectContext } from '../ui/contexts/api';
4
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select';
5
- import { Input, labelVariants } from '../ui/components/input';
3
+ import { useApiContext, useServerSelectContext } from '../ui/contexts/api.js';
4
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select.js';
5
+ import { Input, labelVariants } from '../ui/components/input.js';
6
6
  import { cn } from 'fumadocs-ui/components/api';
7
7
  export default function ServerSelect(props) {
8
8
  const { servers } = useApiContext();
@@ -1,4 +1,4 @@
1
- import { type ParsedSchema } from '../utils/schema';
1
+ import { type ParsedSchema } from '../utils/schema.js';
2
2
  /**
3
3
  * Combine multiple object schemas into one
4
4
  */
@@ -1,7 +1,7 @@
1
- import type { ApiPageProps } from '../server/api-page';
2
- import type { GenerateOptions } from '../generate';
3
- import type { Document, TagObject } from '../types';
4
- import type { NoReference } from '../utils/schema';
1
+ import type { ApiPageProps } from '../server/api-page.js';
2
+ import type { GenerateOptions } from '../generate.js';
3
+ import type { Document, TagObject } from '../types.js';
4
+ import type { NoReference } from '../utils/schema.js';
5
5
  export type DocumentContext = {
6
6
  type: 'tag';
7
7
  tag: TagObject | undefined;
@@ -1,6 +1,6 @@
1
1
  import { dump } from 'js-yaml';
2
2
  import Slugger from 'github-slugger';
3
- import { idToTitle } from '../utils/id-to-title';
3
+ import { idToTitle } from '../utils/id-to-title.js';
4
4
  export function generateDocument(options) {
5
5
  const { frontmatter, includeDescription = false } = options;
6
6
  const out = [];
@@ -1,5 +1,5 @@
1
- import type { MethodInformation, RenderContext } from '../types';
2
- import { type ParsedSchema } from '../utils/schema';
1
+ import type { MethodInformation, RenderContext } from '../types.js';
2
+ import { type ParsedSchema } from '../utils/schema.js';
3
3
  /**
4
4
  * Sample info of endpoint
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import { sample } from 'openapi-sampler';
2
- import { getPreferredType, } from '../utils/schema';
3
- import { getSecurities, getSecurityPrefix } from '../utils/get-security';
2
+ import { getPreferredType, } from '../utils/schema.js';
3
+ import { getSecurities, getSecurityPrefix } from '../utils/get-security.js';
4
4
  export function generateSample(path, method, { baseUrl, schema: { document } }) {
5
5
  const params = [];
6
6
  const responses = {};
@@ -1,5 +1,5 @@
1
- import type { Document, SecurityRequirementObject, SecuritySchemeObject } from '../types';
2
- import { type NoReference } from '../utils/schema';
1
+ import type { Document, SecurityRequirementObject, SecuritySchemeObject } from '../types.js';
2
+ import { type NoReference } from '../utils/schema.js';
3
3
  export type Security = SecuritySchemeObject & {
4
4
  scopes: string[];
5
5
  };
@@ -1,4 +1,4 @@
1
- import type { EndpointSample } from '../utils/generate-sample';
2
- import { DereferenceMap } from '../types';
1
+ import type { EndpointSample } from '../utils/generate-sample.js';
2
+ import { DereferenceMap } from '../types.js';
3
3
  export declare function getTypescriptSchema(endpoint: EndpointSample, code: string, dereferenceMap: DereferenceMap): Promise<string | undefined>;
4
4
  //# sourceMappingURL=get-typescript-schema.d.ts.map
@@ -1,5 +1,5 @@
1
- import type { DereferenceMap, Document } from '../types';
2
- import type { NoReference } from '../utils/schema';
1
+ import type { DereferenceMap, Document } from '../types.js';
2
+ import type { NoReference } from '../utils/schema.js';
3
3
  import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
4
4
  export type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
5
5
  export type ProcessedDocument = {
@@ -1,4 +1,4 @@
1
- import type { ReferenceObject } from '../types';
1
+ import type { ReferenceObject } from '../types.js';
2
2
  import type { OpenAPIV3_1 } from 'openapi-types';
3
3
  export type NoReference<T> = T extends (infer I)[] ? NoReference<I>[] : T extends ReferenceObject ? Exclude<T, ReferenceObject> : T extends object ? {
4
4
  [K in keyof T]: NoReference<T[K]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -44,8 +44,8 @@
44
44
  "fast-glob": "^3.3.3",
45
45
  "github-slugger": "^2.0.0",
46
46
  "hast-util-to-jsx-runtime": "^2.3.2",
47
- "lucide-react": "^0.474.0",
48
47
  "js-yaml": "^4.1.0",
48
+ "lucide-react": "^0.474.0",
49
49
  "next-themes": "^0.4.4",
50
50
  "openapi-sampler": "^1.6.1",
51
51
  "react-hook-form": "^7.54.2",
@@ -53,8 +53,8 @@
53
53
  "remark-rehype": "^11.1.1",
54
54
  "shiki": "^2.2.0",
55
55
  "xml-js": "^1.6.11",
56
- "fumadocs-core": "15.0.1",
57
- "fumadocs-ui": "15.0.1"
56
+ "fumadocs-core": "15.0.2",
57
+ "fumadocs-ui": "15.0.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@scalar/api-client-react": "^1.1.22",
@@ -64,7 +64,7 @@
64
64
  "@types/react": "^19.0.8",
65
65
  "next": "15.1.6",
66
66
  "openapi-types": "^12.1.3",
67
- "tailwindcss": "^4.0.2",
67
+ "tailwindcss": "^4.0.3",
68
68
  "tsc-alias": "^1.8.10",
69
69
  "eslint-config-custom": "0.0.0",
70
70
  "tsconfig": "0.0.0"