@redocly/openapi-docs 3.15.0-next.7 → 3.15.0-next.8
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/redocly-openapi-docs.min.js +2005 -2047
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.d.ts +2 -2
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +1 -1
- package/lib/components/RedoclyOpenAPIDocs/types.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/tests/SchemaCatalogLink.test.js +1 -1
- package/lib/hooks/useRouter.js +1 -1
- package/lib/standalone.d.ts +0 -1
- package/lib/standalone.js +1 -1
- package/lib/utils/loadAndBundleSpec.js +1 -1
- package/package.json +5 -3
- package/lib/components/RedoclyOpenAPIDocs/Error.d.ts +0 -3
- package/lib/components/RedoclyOpenAPIDocs/Error.js +0 -25
|
@@ -4,5 +4,5 @@ import type { OpenAPIDefinition } from '../../types/index.js';
|
|
|
4
4
|
import type { RedocConfig } from '@redocly/config';
|
|
5
5
|
export declare function loadSingle(spec: any, specUrl: any, options?: RedocConfig): Promise<OpenAPIDefinition>;
|
|
6
6
|
export declare function loadAndBundleSpecOrMd(url: string, title?: string): Promise<OpenAPIDefinition>;
|
|
7
|
-
export declare const AppProvider: ({ options, definitionUrl,
|
|
8
|
-
export declare function RedoclyOpenAPIDocsStandalone({ definition, definitionUrl,
|
|
7
|
+
export declare const AppProvider: ({ options, definitionUrl, definition, activeSampleLanguage, children, }: PropsWithChildren<AppProviderProps>) => ReactElement | null;
|
|
8
|
+
export declare function RedoclyOpenAPIDocsStandalone({ definition, definitionUrl, options, activeItemId, activeSampleLanguage, activeDeepLink, router, }: RedoclyOpenAPIDocsStandaloneProps): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as u}from"react/jsx-runtime";import{cloneElement as w,isValidElement as x,useEffect as g,useMemo as A,useState as a}from"react";import{Loading as D}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as L,fixSpec as O}from"./utils.js";import{argValueToBoolean as B}from"../../utils/index.js";import{RedoclyOpenAPIDocs as E}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as p,loadOpenapiConfig as C}from"../../utils/loadAndBundleSpec.js";async function I(e,o,t){let n;if(t?.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');n=e}else n=await p(e||o);try{O(n)}catch{}return n}function T(e,o){return e.endsWith(".md")?p({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):p(e)}const k=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[s,l]=a(),[h,f]=a(!0),[d,y]=a(null),[m,S]=a(e||{});g(()=>{async function v(){f(!0);try{const c=await C();S({...e,...c}),y(await I(t,o,e))}catch(c){l(c.message)}}v()},[t,o,e]);const i=A(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},L([d,o,m]));return g(()=>{i&&f(!1)},[i]),s||!i?null:h?B(e?.hideLoading,!1)?null:u(D,{color:"--loading-spinner-color"}):x(r)?w(r,{store:i}):null};function W({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:s,router:l}){return u(k,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:s,children:u(E,{withCommonStyles:!0,router:l||"hash"})})}export{k as AppProvider,W as RedoclyOpenAPIDocsStandalone,T as loadAndBundleSpecOrMd,I as loadSingle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{render as s}from"@testing-library/react";import*as o from"jotai";import{SchemaCatalogLink as a}from"../SchemaCatalogLink";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn()})),describe("SchemaCatalogLink",()=>{it("should render correctly",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should not render if x-schema-catalog-link is not defined",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()})});
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{render as s,fireEvent as l}from"@testing-library/react";import*as o from"jotai";import{SchemaCatalogLink as a}from"../SchemaCatalogLink";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn()})),jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:!0})),describe("SchemaCatalogLink",()=>{beforeEach(()=>{jest.clearAllMocks(),jest.useFakeTimers(),Object.defineProperty(global,"navigator",{value:{clipboard:{writeText:jest.fn()}},writable:!0})}),afterEach(()=>{jest.useRealTimers()}),it("should render correctly",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should not render if x-schema-catalog-link is not defined",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should render correctly on server",()=>{jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:jest.fn().mockReturnValue(!1)})),jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should copy link to clipboard when copy button is clicked",async()=>{jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:jest.fn().mockReturnValue(!0)})),jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const{getByRole:e,findByText:n}=s(t(a,{schemaRef:"#/components/schemas/test"})),c=e("button");l.click(c),expect(await n("Copied!")).toBeDefined()})});
|
package/lib/hooks/useRouter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BrowserRouter as s,HashRouter as
|
|
1
|
+
import{BrowserRouter as s,HashRouter as a,MemoryRouter as n}from"react-router-dom";const m={history:s,memory:n,hash:a},R=(e,o)=>{const r=m[e],t={...e!=="memory"&&{basename:o,feature:{v7_startTransition:!1,v7_relativeSplatPath:!1}}};return{Router:r,routerProps:t}};export{R as useRouter};
|
package/lib/standalone.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { setParameterValue } from './utils/parameters.js';
|
|
|
6
6
|
export declare function hydrate(store: StoreProviderProps, element?: Element | null): void;
|
|
7
7
|
export declare function init(definitionOrDefinitionUrl: string | OpenAPIDefinition, options?: RedocConfig & {
|
|
8
8
|
router?: 'hash' | 'history';
|
|
9
|
-
disableTelemetry?: boolean;
|
|
10
9
|
}, element?: Element | null): void;
|
|
11
10
|
export declare const version: string;
|
|
12
11
|
export declare const revision: string;
|
package/lib/standalone.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as P,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function d(t){const e={},o=t.attributes;for(let r=0;r<o.length;r++){const n=o[r];e[n.name]=n.value}return e}function E(t){const e=d(t),o={};for(const r in e){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());o[n]=e[r]}return o}function A(t,e=document.querySelector("redoc")){m(e,i(l,{store:t}),{onRecoverableError:(o,r)=>{o.message.includes("Minified React error #418")||console.error(o.message,r)}})}function _(t,e={},o=a("redoc")){if(o===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}={...e,...E(o)};let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(o).render(p(f,{definition:s,definitionUrl:c,options:n,router:r??"hash"},["Loading..."]))}const N=__REDOCLY_API_REFERENCE_VERSION__,v=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const e=t.getAttribute("spec-url");e&&_(e,{},t)}R();export{A as hydrate,_ as init,v as revision,D as setParameterValue,P as setSecurityDetails,V as setSecurityDetailsVariants,N as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bundleOas as r,createEmptyRedoclyConfig as i}from"@redocly/openapi-core/lib/bundle-oas";import{convertSwagger2OpenAPI as c}from"./convertSwagger2OpenAPI.js";import{IS_BROWSER as a}from"./dom.js";async function l(){try{return(await i())?.resolvedConfig.openapi||{}}catch{return{}}}async function p(o){const t=await i(),e={config:t,base:a?window.location.origin:typeof globalThis.process<"u"?globalThis.process.cwd():""};a&&(t.resolve.http.customFetch=globalThis.fetch),typeof o=="object"&&o!==null?e.doc=s(o):e.ref=o;const{bundle:{parsed:n}}=await r(e);return n.swagger!==void 0?c(n):n}function s(o){return{source:{absoluteRef:""},parsed:o}}export{p as loadAndBundleDefinition,l as loadOpenapiConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.15.0-next.
|
|
3
|
+
"version": "3.15.0-next.8",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"util": "~0.12.5",
|
|
38
38
|
"web-vitals": "3.3.1",
|
|
39
39
|
"@redocly/config": "0.36.1",
|
|
40
|
-
"@redocly/replay": "0.18.0-next.
|
|
40
|
+
"@redocly/replay": "0.18.0-next.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "29.5.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.9.3",
|
|
76
76
|
"url": "~0.11.0",
|
|
77
77
|
"vite": "7.1.9",
|
|
78
|
-
"@redocly/theme": "0.59.0-next.
|
|
78
|
+
"@redocly/theme": "0.59.0-next.7"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"start": "npm run copy-highlight-hook && vite",
|
|
@@ -85,7 +85,9 @@
|
|
|
85
85
|
"prepare:community-source": "npx tsx scripts/prepare-community-source.ts --",
|
|
86
86
|
"prepare:community-source-only": "npm run prepare:community-source --ignore /src/* private-readme.md",
|
|
87
87
|
"prepare:community-dependencies": "npx tsx scripts/prepare-community-dependencies.ts",
|
|
88
|
+
"apply:community-source": "npx tsx scripts/apply-changes-from-community-source.ts",
|
|
88
89
|
"test": "npm run prepare:community-source && cd redoc && npm install && npm run lint && npm run unit && cd ../ && jest -w 2",
|
|
90
|
+
"unit": "jest -w 2",
|
|
89
91
|
"test:update": "jest -u",
|
|
90
92
|
"test:watch": "jest --watch",
|
|
91
93
|
"test:coverage": "jest --coverage",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as i}from"react/jsx-runtime";import t from"styled-components";import{GlobalStyle as a}from"@redocly/theme/core/openapi";function f({description:o}){return console.error(o),r(i,{children:[e(a,{}),r(n,{children:[e(s,{children:";("}),e(l,{children:"Something went wrong..."}),r(g,{children:["Please check the console to get more error details. You can troubleshoot your setup by visiting our"," ",e("a",{target:"_blank",rel:"noopener noreferrer",href:"https://redocly.com/docs/redoc",children:"documentation"}),"."]})]})]})}const n=t.div`
|
|
2
|
-
height: 100vh;
|
|
3
|
-
max-width: var(--page-404-max-width);
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
margin: var(--page-404-margin-vertical) var(--page-404-margin-horizontal);
|
|
8
|
-
font-family: var(--page-404-font-family);
|
|
9
|
-
gap: var(--page-404-gap);
|
|
10
|
-
`,s=t.div`
|
|
11
|
-
color: var(--page-404-status-text-color);
|
|
12
|
-
font-size: var(--page-404-status-font-size);
|
|
13
|
-
line-height: var(--page-404-status-line-height);
|
|
14
|
-
font-weight: var(--page-404-status-font-weight);
|
|
15
|
-
`,l=t.div`
|
|
16
|
-
color: var(--page-404-title-text-color);
|
|
17
|
-
font-size: var(--page-404-title-font-size);
|
|
18
|
-
line-height: var(--page-404-title-line-height);
|
|
19
|
-
font-weight: var(--page-404-title-font-weight);
|
|
20
|
-
`,g=t.div`
|
|
21
|
-
color: var(--page-404-description-text-color);
|
|
22
|
-
font-size: var(--page-404-description-font-size);
|
|
23
|
-
line-height: var(--page-404-description-line-height);
|
|
24
|
-
font-weight: var(--page-404-description-font-weight);
|
|
25
|
-
`;export{f as ErrorPage};
|