vitepress-openapi 0.1.18 → 0.1.19
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/README.md +19 -0
- package/dist/types/src/client.d.ts +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/lib/utils/minifyHtml.d.ts +5 -0
- package/dist/{useOpenapi-DUT_WkQ8.js → useOpenapi-B4Uu-BLL.js} +111 -104
- package/dist/{useOpenapi-CKx0hILD.cjs → useOpenapi-CcNxVvye.cjs} +53 -51
- package/dist/vitepress-openapi.client.cjs.js +21 -21
- package/dist/vitepress-openapi.client.es.js +3 -2
- package/dist/vitepress-openapi.node.cjs.js +1 -1
- package/dist/vitepress-openapi.node.es.js +6 -5
- package/package.json +1 -1
- package/src/client.ts +1 -0
- package/src/composables/useSidebar.ts +5 -2
- package/src/index.ts +1 -0
- package/src/lib/sidebar/ensureGroupTextSlashPrefix.ts +1 -1
- package/src/lib/utils/minifyHtml.ts +9 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ks from "vue";
|
|
2
2
|
import { inject as Zu, ref as Ge, computed as me, openBlock as I, createBlock as _e, unref as S, createElementBlock as ge, createTextVNode as rn, toDisplayString as Ve, createElementVNode as Oe, defineComponent as qe, normalizeClass as Jn, renderSlot as ze, Fragment as Bt, renderList as yn, withCtx as ie, createCommentVNode as $e, useSlots as nl, resolveDynamicComponent as Am, createStaticVNode as OL, withAsyncContext as _j, provide as Em, Suspense as TL, createVNode as je, withModifiers as na, watch as er, nextTick as ci, getCurrentInstance as Om, toHandlerKey as PL, camelize as B5, watchEffect as Si, toValue as df, onUpdated as $L, triggerRef as ML, toRef as RL, onUnmounted as Tm, onMounted as Fi, toRefs as Yl, h as Ba, Comment as DL, mergeProps as $n, cloneVNode as IL, normalizeStyle as m1, reactive as F5, Teleport as z5, markRaw as NL, watchPostEffect as O_, shallowRef as q5, getCurrentScope as LL, onScopeDispose as BL, shallowReadonly as Od, mergeDefaults as FL, withKeys as Pf, normalizeProps as _r, guardReactiveProps as Cr, onBeforeUnmount as g1, toHandlers as zL, withDirectives as Vw, isRef as $c, vModelText as qL, vModelDynamic as Cj, resolveComponent as UL, createSlots as id } from "vue";
|
|
3
|
-
import { u as jr, a as VL, p as HL, c as WL, O as U5, i as GL, b as V5, g as H5, t as KL, d as YL, e as rh, f as Sj, h as $v, j as sd, r as W5, k as JL, l as QL, m as XL, n as Ms, o as ZL, q as eB, s as tB, v as nB, w as G5, x as K5, y as up, z as rB, A as oB, B as Y5, C as J5, D as iB, E as sB, F as aB, G as lB, H as Q5, I as jj, J as uB } from "./useOpenapi-
|
|
4
|
-
import { K as n4e, L as r4e, M as o4e, N as i4e } from "./useOpenapi-
|
|
3
|
+
import { u as jr, a as VL, p as HL, c as WL, O as U5, i as GL, b as V5, g as H5, t as KL, d as YL, e as rh, f as Sj, h as $v, j as sd, r as W5, k as JL, l as QL, m as XL, n as Ms, o as ZL, q as eB, s as tB, v as nB, w as G5, x as K5, y as up, z as rB, A as oB, B as Y5, C as J5, D as iB, E as sB, F as aB, G as lB, H as Q5, I as jj, J as uB } from "./useOpenapi-B4Uu-BLL.js";
|
|
4
|
+
import { K as n4e, L as r4e, M as o4e, N as i4e, P as s4e } from "./useOpenapi-B4Uu-BLL.js";
|
|
5
5
|
function Hw({
|
|
6
6
|
chain: t,
|
|
7
7
|
messages: e,
|
|
@@ -72303,6 +72303,7 @@ export {
|
|
|
72303
72303
|
WL as createOpenApiSpec,
|
|
72304
72304
|
o4e as generateCodeSample,
|
|
72305
72305
|
i4e as locales,
|
|
72306
|
+
s4e as minifyHtml,
|
|
72306
72307
|
ZAe as theme,
|
|
72307
72308
|
VL as useOpenapi,
|
|
72308
72309
|
Nm as usePlayground,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useOpenapi-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useOpenapi-CcNxVvye.cjs");exports.OpenApi=e.OpenApi;exports.createOpenApiSpec=e.createOpenApiSpec;exports.getGlobalOpenapi=e.getGlobalOpenapi;exports.httpVerbs=e.httpVerbs;exports.injectOpenapi=e.injectOpenapi;exports.literalTypes=e.literalTypes;exports.minifyHtml=e.minifyHtml;exports.parseSpec=e.parseSpec;exports.useOpenapi=e.useOpenapi;exports.usePaths=e.usePaths;exports.useSidebar=e.useSidebar;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as s, c as p, g as i, R as t, b as n, S as r, P as c, T as l, a as O, U as b, V as S } from "./useOpenapi-B4Uu-BLL.js";
|
|
2
2
|
export {
|
|
3
3
|
s as OpenApi,
|
|
4
4
|
p as createOpenApiSpec,
|
|
5
5
|
i as getGlobalOpenapi,
|
|
6
6
|
t as httpVerbs,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
c as
|
|
7
|
+
n as injectOpenapi,
|
|
8
|
+
r as literalTypes,
|
|
9
|
+
c as minifyHtml,
|
|
10
|
+
l as parseSpec,
|
|
10
11
|
O as useOpenapi,
|
|
11
12
|
b as usePaths,
|
|
12
|
-
|
|
13
|
+
S as useSidebar
|
|
13
14
|
};
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -55,4 +55,5 @@ export { useTheme } from './composables/useTheme'
|
|
|
55
55
|
export { generateCodeSample } from './lib/codeSamples/generateCodeSample'
|
|
56
56
|
export { OARequest } from './lib/codeSamples/request'
|
|
57
57
|
export { createOpenApiSpec } from './lib/spec/createOpenApiSpec'
|
|
58
|
+
export { minifyHtml } from './lib/utils/minifyHtml'
|
|
58
59
|
export { locales } from './locales'
|
|
@@ -6,6 +6,7 @@ import { parseOpenapi } from '../lib/parser/parseOpenapi'
|
|
|
6
6
|
import { cleanSidebarItems } from '../lib/sidebar/cleanSidebarItems'
|
|
7
7
|
import { generateSidebarItemsByPaths } from '../lib/sidebar/generateSidebarItemsByPaths'
|
|
8
8
|
import { createOpenApiSpec } from '../lib/spec/createOpenApiSpec'
|
|
9
|
+
import { minifyHtml } from '../lib/utils/minifyHtml'
|
|
9
10
|
|
|
10
11
|
type MethodAliases = Record<string, string>
|
|
11
12
|
|
|
@@ -111,10 +112,12 @@ export function useSidebar({
|
|
|
111
112
|
const _globalItemTemplate: SidebarItemTemplateFn = sidebarItemTemplate || (({ method, path, title }) => {
|
|
112
113
|
const resolvedMethod = methodAliases[method] || method.toUpperCase()
|
|
113
114
|
const displayText = title || path
|
|
114
|
-
return
|
|
115
|
+
return minifyHtml(`
|
|
116
|
+
<span class="OASidebarItem group/oaOperationLink">
|
|
115
117
|
<span class="OASidebarItem-badge OAMethodBadge--${method.toLowerCase()}">${resolvedMethod}</span>
|
|
116
118
|
<span class="OASidebarItem-text text">${displayText}</span>
|
|
117
|
-
</span
|
|
119
|
+
</span>
|
|
120
|
+
`)
|
|
118
121
|
})
|
|
119
122
|
|
|
120
123
|
const _globalGroupTemplate: SidebarGroupTemplateFn = sidebarGroupTemplate || defaultGroupTemplate
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export {
|
|
|
9
9
|
export { usePaths } from './composables/usePaths'
|
|
10
10
|
export { useSidebar } from './composables/useSidebar'
|
|
11
11
|
export { createOpenApiSpec, type OpenApiSpecInstance } from './lib/spec/createOpenApiSpec'
|
|
12
|
+
export { minifyHtml } from './lib/utils/minifyHtml'
|
|
12
13
|
export { parseSpec } from './lib/utils/parseSpec'
|
|
13
14
|
|
|
14
15
|
export const httpVerbs: readonly OpenAPIV3.HttpMethods[] = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'] as const
|
|
@@ -9,7 +9,7 @@ export function ensureGroupTextSlashPrefix(items: OASidebarItem[]): OASidebarIte
|
|
|
9
9
|
item.items = ensureGroupTextSlashPrefix(item.items)
|
|
10
10
|
|
|
11
11
|
item.text = item.text?.startsWith('/') ? item.text : `/${item.text}`
|
|
12
|
-
} else if (item.text && !item.isOperation && !item.text.startsWith('/') && !item.text.includes('<
|
|
12
|
+
} else if (item.text && !item.isOperation && !item.text.startsWith('/') && !item.text.includes('<')) {
|
|
13
13
|
item.text = `/${item.text}`
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const WHITESPACE_REGEX = /\s+/g
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minifies a string of HTML by replacing multiple whitespace characters with a single space
|
|
5
|
+
* and trimming the result. This helps prevent hydration mismatches in VitePress.
|
|
6
|
+
*/
|
|
7
|
+
export function minifyHtml(html: string): string {
|
|
8
|
+
return html.replace(WHITESPACE_REGEX, ' ').trim()
|
|
9
|
+
}
|