Skip to content

Commit f77783f

Browse files
authored
Merge pull request #2461 from hey-api/docs/fix-version
docs: fix versioned clients and plugins
2 parents ebce298 + e7b9122 commit f77783f

File tree

8 files changed

+331
-30
lines changed

8 files changed

+331
-30
lines changed

docs/.vitepress/config/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
import path from 'node:path';
2-
31
import { defineConfig } from 'vitepress';
42

5-
import en from './en';
6-
import shared from './shared';
3+
import en from './en.js';
4+
import shared from './shared.js';
75

86
export default defineConfig({
97
...shared,
108
locales: {
119
...shared.locales,
1210
root: { label: 'English', ...en },
1311
},
14-
vite: {
15-
...shared.vite,
16-
resolve: {
17-
...shared.vite?.resolve,
18-
alias: {
19-
...shared.vite?.resolve?.alias,
20-
'@components': path.resolve(__dirname, '..', 'theme', 'components'),
21-
'@data': path.resolve(__dirname, '..', '..', 'data'),
22-
'@versions': path.resolve(__dirname, '..', 'theme', 'versions'),
23-
},
24-
preserveSymlinks: true,
25-
},
26-
},
2712
});

docs/.vitepress/config/shared.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'node:path';
2+
13
import { defineConfig, type HeadConfig } from 'vitepress';
24
import llmstxt from 'vitepress-plugin-llms';
35

@@ -115,5 +117,22 @@ export default defineConfig({
115117
},
116118
}),
117119
],
120+
resolve: {
121+
alias: [
122+
{
123+
find: '@components',
124+
replacement: path.resolve(__dirname, '..', 'theme', 'components'),
125+
},
126+
{
127+
find: '@data',
128+
replacement: path.resolve(__dirname, '..', '..', 'data'),
129+
},
130+
{
131+
find: '@versions',
132+
replacement: path.resolve(__dirname, '..', 'theme', 'versions'),
133+
},
134+
],
135+
preserveSymlinks: true,
136+
},
118137
},
119138
});
File renamed without changes.

docs/.vitepress/theme/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,11 @@ footer.VPDocFooter > .edit-info > .last-updated {
415415
/* don't render last updated date */
416416
display: none;
417417
}
418+
419+
.DocSearch-Modal {
420+
display: flex;
421+
}
422+
423+
.DocSearch-Footer {
424+
position: initial;
425+
}

docs/.vitepress/theme/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import DefaultTheme from 'vitepress/theme';
55
// custom CSS must be imported after default theme to correctly apply styles
66
import './custom.css';
77

8-
import Layout from './Layout.vue';
8+
import Layout from './components/Layout.vue';
99

1010
export default {
1111
Layout,

docs/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"baseUrl": ".",
44
"esModuleInterop": true,
5+
"module": "nodenext",
56
"paths": {
67
"@components/*": ["./.vitepress/theme/components/*"],
78
"@data": ["./data/*"],

patches/vitepress.patch

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
diff --git a/dist/client/shared.js b/dist/client/shared.js
2+
index f65eb22fe2b0dfeb9bd823c00c737f5035f2c891..16a45edcf11b71881b31f1203add291a2c447d22 100644
3+
--- a/dist/client/shared.js
4+
+++ b/dist/client/shared.js
5+
@@ -16,6 +16,7 @@ export const notFoundPageData = {
6+
lastUpdated: 0,
7+
isNotFound: true
8+
};
9+
+const versionedPaths = ['clients', 'plugins'];
10+
export function isActive(currentPath, matchPath, asRegex = false) {
11+
if (matchPath === undefined) {
12+
return false;
13+
@@ -24,8 +25,19 @@ export function isActive(currentPath, matchPath, asRegex = false) {
14+
if (asRegex) {
15+
return new RegExp(matchPath).test(currentPath);
16+
}
17+
- if (normalize(matchPath) !== currentPath) {
18+
- return false;
19+
+ const normalizedMatchPath = normalize(matchPath);
20+
+ if (normalizedMatchPath !== currentPath) {
21+
+ const currentPathParts = currentPath.split('/');
22+
+ if (currentPathParts.length > 3 &&
23+
+ versionedPaths.some((entry) => entry === currentPathParts[2])) {
24+
+ currentPath = currentPathParts.slice(0, 4).join('/');
25+
+ if (normalizedMatchPath !== currentPath) {
26+
+ return false;
27+
+ }
28+
+ }
29+
+ else {
30+
+ return false;
31+
+ }
32+
}
33+
const hashMatch = matchPath.match(HASH_RE);
34+
if (hashMatch) {
35+
diff --git a/dist/node/chunk-CwUP9ZhX.js b/dist/node/chunk-CwUP9ZhX.js
36+
index e8b4954d00f247fb852096bb1f8f077fcfc1f93f..8db594d1bdaac76359656a95ac96cd98161b1062 100644
37+
--- a/dist/node/chunk-CwUP9ZhX.js
38+
+++ b/dist/node/chunk-CwUP9ZhX.js
39+
@@ -2053,7 +2053,7 @@ function requireBrowser () {
40+
} catch (error) {
41+
return '[UnexpectedJSONParseError]: ' + error.message;
42+
}
43+
- };
44+
+ };
45+
} (browser, browser.exports));
46+
return browser.exports;
47+
}
48+
@@ -2328,7 +2328,7 @@ function requireNode () {
49+
formatters.O = function (v) {
50+
this.inspectOpts.colors = this.useColors;
51+
return util.inspect(v, this.inspectOpts);
52+
- };
53+
+ };
54+
} (node, node.exports));
55+
return node.exports;
56+
}
57+
@@ -3522,7 +3522,7 @@ function requireFs () {
58+
'fs.realpath.native is not a function. Is fs being monkey-patched?',
59+
'Warning', 'fs-extra-WARN0003'
60+
);
61+
- }
62+
+ }
63+
} (fs$1));
64+
return fs$1;
65+
}
66+
@@ -6185,7 +6185,7 @@ class AST {
67+
const aps = addPatternStart;
68+
// check if we have a possibility of matching . or ..,
69+
// and prevent that.
70+
- const needNoTrav =
71+
+ const needNoTrav =
72+
// dots are allowed, and the pattern starts with [ or .
73+
(dot && aps.has(src.charAt(0))) ||
74+
// the pattern starts with \., and then [ or .
75+
@@ -8616,11 +8616,11 @@ class LRUCache {
76+
b.__abortController instanceof AC);
77+
}
78+
async fetch(k, fetchOptions = {}) {
79+
- const {
80+
+ const {
81+
// get options
82+
- allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
83+
+ allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
84+
// set options
85+
- ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
86+
+ ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
87+
// fetch exclusive options
88+
noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;
89+
if (!this.#hasFetchMethod) {
90+
@@ -14468,7 +14468,7 @@ function requireUtils$4 () {
91+
}
92+
93+
return last;
94+
- };
95+
+ };
96+
} (utils$5));
97+
return utils$5;
98+
}
99+
@@ -17226,7 +17226,7 @@ function requireDist$1 () {
100+
exports.fdir = void 0;
101+
const builder_1 = requireBuilder();
102+
Object.defineProperty(exports, "fdir", { enumerable: true, get: function () { return builder_1.Builder; } });
103+
- __exportStar(requireTypes$1(), exports);
104+
+ __exportStar(requireTypes$1(), exports);
105+
} (dist$1));
106+
return dist$1;
107+
}
108+
@@ -18267,6 +18267,7 @@ const notFoundPageData = {
109+
lastUpdated: 0,
110+
isNotFound: true
111+
};
112+
+const versionedPaths = ["clients", "plugins"];
113+
function isActive(currentPath, matchPath, asRegex = false) {
114+
if (matchPath === void 0) {
115+
return false;
116+
@@ -18275,8 +18276,17 @@ function isActive(currentPath, matchPath, asRegex = false) {
117+
if (asRegex) {
118+
return new RegExp(matchPath).test(currentPath);
119+
}
120+
- if (normalize$1(matchPath) !== currentPath) {
121+
- return false;
122+
+ const normalizedMatchPath = normalize$1(matchPath);
123+
+ if (normalizedMatchPath !== currentPath) {
124+
+ const currentPathParts = currentPath.split("/");
125+
+ if (currentPathParts.length > 3 && versionedPaths.some((entry) => entry === currentPathParts[2])) {
126+
+ currentPath = currentPathParts.slice(0, 4).join("/");
127+
+ if (normalizedMatchPath !== currentPath) {
128+
+ return false;
129+
+ }
130+
+ } else {
131+
+ return false;
132+
+ }
133+
}
134+
const hashMatch = matchPath.match(HASH_RE);
135+
if (hashMatch) {
136+
@@ -23631,7 +23641,7 @@ function requireEngines () {
137+
stringify: function() {
138+
throw new Error('stringifying JavaScript is not supported');
139+
}
140+
- };
141+
+ };
142+
} (engines));
143+
return engines.exports;
144+
}
145+
@@ -23731,7 +23741,7 @@ function requireUtils$2 () {
146+
exports.startsWith = function(str, substr, len) {
147+
if (typeof len !== 'number') len = substr.length;
148+
return str.slice(0, len) === substr;
149+
- };
150+
+ };
151+
} (utils$3));
152+
return utils$3;
153+
}
154+
@@ -25043,7 +25053,7 @@ const decodeMap = new Map([
155+
/**
156+
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
157+
*/
158+
-const fromCodePoint$1 =
159+
+const fromCodePoint$1 =
160+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
161+
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
162+
let output = "";
163+
@@ -25135,7 +25145,7 @@ var DecodingMode;
164+
class EntityDecoder {
165+
constructor(
166+
/** The tree used to decode entities. */
167+
- decodeTree,
168+
+ decodeTree,
169+
/**
170+
* The function that is called when a codepoint is decoded.
171+
*
172+
@@ -25145,7 +25155,7 @@ class EntityDecoder {
173+
* @param codepoint The decoded codepoint.
174+
* @param consumed The number of bytes consumed by the decoder.
175+
*/
176+
- emitCodePoint,
177+
+ emitCodePoint,
178+
/** An object that is used to produce errors. */
179+
errors) {
180+
this.decodeTree = decodeTree;
181+
@@ -25458,7 +25468,7 @@ function getDecoder(decodeTree) {
182+
while ((offset = str.indexOf("&", offset)) >= 0) {
183+
ret += str.slice(lastIndex, offset);
184+
decoder.startEntity(decodeMode);
185+
- const len = decoder.write(str,
186+
+ const len = decoder.write(str,
187+
// Skip the "&"
188+
offset + 1);
189+
if (len < 0) {
190+
@@ -38931,7 +38941,7 @@ class SignalExit extends SignalExitBase {
191+
const process$1 = globalThis.process;
192+
// wrap so that we call the method on the actual handler, without
193+
// exporting it directly.
194+
-const {
195+
+const {
196+
/**
197+
* Called when the process is exiting, whether via signal, explicit
198+
* exit, or running out of stuff to do.
199+
@@ -41070,7 +41080,7 @@ function requireEastasianwidth () {
200+
eawLen += charLen;
201+
}
202+
return result;
203+
- };
204+
+ };
205+
} (eastasianwidth));
206+
return eastasianwidth.exports;
207+
}
208+
@@ -42826,7 +42836,7 @@ function requireTypes () {
209+
IndexTagNames["sitemapindex"] = "sitemapindex";
210+
IndexTagNames["loc"] = "loc";
211+
IndexTagNames["lastmod"] = "lastmod";
212+
- })(exports.IndexTagNames || (exports.IndexTagNames = {}));
213+
+ })(exports.IndexTagNames || (exports.IndexTagNames = {}));
214+
} (types));
215+
return types;
216+
}
217+
@@ -42840,7 +42850,7 @@ function requireSitemapXml () {
218+
hasRequiredSitemapXml = 1;
219+
Object.defineProperty(sitemapXml, "__esModule", { value: true });
220+
sitemapXml.element = sitemapXml.ctag = sitemapXml.otag = sitemapXml.text = void 0;
221+
- const invalidXMLUnicodeRegex =
222+
+ const invalidXMLUnicodeRegex =
223+
// eslint-disable-next-line no-control-regex
224+
/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u0084\u0086-\u009F\uD800-\uDFFF\uFDD0-\uFDDF\u{1FFFE}-\u{1FFFF}\u{2FFFE}-\u{2FFFF}\u{3FFFE}-\u{3FFFF}\u{4FFFE}-\u{4FFFF}\u{5FFFE}-\u{5FFFF}\u{6FFFE}-\u{6FFFF}\u{7FFFE}-\u{7FFFF}\u{8FFFE}-\u{8FFFF}\u{9FFFE}-\u{9FFFF}\u{AFFFE}-\u{AFFFF}\u{BFFFE}-\u{BFFFF}\u{CFFFE}-\u{CFFFF}\u{DFFFE}-\u{DFFFF}\u{EFFFE}-\u{EFFFF}\u{FFFFE}-\u{FFFFF}\u{10FFFE}-\u{10FFFF}]/gu;
225+
const amp = /&/g;
226+
@@ -43586,7 +43596,7 @@ function requireSitemapStream () {
227+
});
228+
});
229+
}
230+
- exports.streamToPromise = streamToPromise;
231+
+ exports.streamToPromise = streamToPromise;
232+
} (sitemapStream));
233+
return sitemapStream;
234+
}
235+
@@ -43809,7 +43819,7 @@ function requireSitemapIndexStream () {
236+
});
237+
}
238+
}
239+
- exports.SitemapAndIndexStream = SitemapAndIndexStream;
240+
+ exports.SitemapAndIndexStream = SitemapAndIndexStream;
241+
} (sitemapIndexStream));
242+
return sitemapIndexStream;
243+
}
244+
@@ -45470,7 +45480,7 @@ function requireSax () {
245+
}
246+
}());
247+
}
248+
- })(exports);
249+
+ })(exports);
250+
} (sax));
251+
return sax;
252+
}
253+
@@ -46277,7 +46287,7 @@ function requireSitemapSimple () {
254+
}
255+
};
256+
exports.simpleSitemapAndIndex = simpleSitemapAndIndex;
257+
- exports.default = exports.simpleSitemapAndIndex;
258+
+ exports.default = exports.simpleSitemapAndIndex;
259+
} (sitemapSimple));
260+
return sitemapSimple;
261+
}
262+
@@ -46333,7 +46343,7 @@ function requireDist () {
263+
Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } });
264+
Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } });
265+
var sitemap_simple_1 = requireSitemapSimple();
266+
- Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
267+
+ Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
268+
} (dist));
269+
return dist;
270+
}
271+
@@ -48930,7 +48940,7 @@ function requireLodash_template () {
272+
return false;
273+
}
274+
275+
- module.exports = template;
276+
+ module.exports = template;
277+
} (lodash_template, lodash_template.exports));
278+
return lodash_template.exports;
279+
}
280+
@@ -49165,7 +49175,7 @@ function requirePostcssPrefixSelector () {
281+
282+
return {
283+
postcssPlugin: 'postcss-prefix-selector',
284+
- prepare(result) {
285+
+ prepare(result) {
286+
const root = result.root;
287+
const file = root.source.input.file;
288+

0 commit comments

Comments
 (0)