@callstack/rspress-preset 0.6.0 → 0.6.2
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/index.cjs +13 -15
- package/dist/index.js +9 -11
- package/dist/options.d.ts +5 -59
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return
|
|
3
|
+
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -25,7 +25,7 @@ var __webpack_require__ = {};
|
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
27
|
__webpack_require__.r = (exports1)=>{
|
|
28
|
-
if (
|
|
28
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
29
29
|
value: 'Module'
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -71,12 +71,12 @@ const presetOptionsSchema = external_zod_namespaceObject.z.object({
|
|
|
71
71
|
rootUrl: external_zod_namespaceObject.z.string().trim().url({
|
|
72
72
|
message: 'must be a valid URL'
|
|
73
73
|
}).describe('Absolute public site origin (e.g. https://example.com)'),
|
|
74
|
-
socials: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string().url()).optional().describe('Map of social icon name to profile URL')
|
|
74
|
+
socials: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.url()).optional().describe('Map of social icon name to profile URL')
|
|
75
75
|
}),
|
|
76
76
|
theme: external_zod_namespaceObject.z.unknown().optional(),
|
|
77
77
|
vercelAnalytics: external_zod_namespaceObject.z.union([
|
|
78
78
|
external_zod_namespaceObject.z.boolean(),
|
|
79
|
-
external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.unknown())
|
|
79
|
+
external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.unknown())
|
|
80
80
|
]).optional().describe('Enable/disable Vercel Analytics or pass its config (overrides auto-detect)')
|
|
81
81
|
});
|
|
82
82
|
function error(...message) {
|
|
@@ -86,7 +86,6 @@ function validatePresetOptions(options) {
|
|
|
86
86
|
const result = presetOptionsSchema.safeParse(options);
|
|
87
87
|
if (!result.success) {
|
|
88
88
|
const bullets = result.error.issues.map((issue)=>{
|
|
89
|
-
var _current__def;
|
|
90
89
|
const pathSegments = issue.path;
|
|
91
90
|
const pathLabel = pathSegments.length > 0 ? pathSegments.join('.') : 'root';
|
|
92
91
|
let current = presetOptionsSchema;
|
|
@@ -94,11 +93,11 @@ function validatePresetOptions(options) {
|
|
|
94
93
|
const objectSchema = current;
|
|
95
94
|
const shape = objectSchema.shape;
|
|
96
95
|
current = shape[String(segment)];
|
|
97
|
-
} else if (current instanceof external_zod_namespaceObject.z.ZodRecord) current = current.
|
|
96
|
+
} else if (current instanceof external_zod_namespaceObject.z.ZodRecord) current = current.def.valueType;
|
|
98
97
|
else break;
|
|
99
|
-
const description =
|
|
98
|
+
const description = current?._def?.description;
|
|
100
99
|
const received = issue.received;
|
|
101
|
-
const details = received ? `${issue.message}
|
|
100
|
+
const details = received ? `${issue.message} — received ${received}` : issue.message;
|
|
102
101
|
const withDesc = description ? `${details} (${description})` : details;
|
|
103
102
|
return `- ${pathLabel}: ${withDesc}`;
|
|
104
103
|
}).join('\n');
|
|
@@ -141,7 +140,6 @@ function getGlobalStyles(context) {
|
|
|
141
140
|
return external_node_fs_default().existsSync(stylesPath) ? stylesPath : void 0;
|
|
142
141
|
}
|
|
143
142
|
const createPreset = (config)=>{
|
|
144
|
-
var _config_theme, _docs_socials, _docs_socials1;
|
|
145
143
|
const { context, docs, vercelAnalytics } = config;
|
|
146
144
|
const rootDir = external_node_path_default().join(context, docs.rootDir ?? 'docs');
|
|
147
145
|
const enableVercel = void 0 === vercelAnalytics ? external_node_fs_default().existsSync(external_node_path_default().join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
@@ -156,7 +154,7 @@ const createPreset = (config)=>{
|
|
|
156
154
|
...config.theme,
|
|
157
155
|
links: {
|
|
158
156
|
...defaultLinks,
|
|
159
|
-
...
|
|
157
|
+
...config.theme?.links
|
|
160
158
|
}
|
|
161
159
|
};
|
|
162
160
|
return (0, core_namespaceObject.defineConfig)({
|
|
@@ -195,7 +193,7 @@ const createPreset = (config)=>{
|
|
|
195
193
|
enableContentAnimation: true,
|
|
196
194
|
enableScrollToTop: false,
|
|
197
195
|
footer: {
|
|
198
|
-
message: `Copyright
|
|
196
|
+
message: `Copyright © ${new Date().getFullYear()} Callstack`
|
|
199
197
|
},
|
|
200
198
|
editLink: {
|
|
201
199
|
docRepoBaseUrl: docs.editUrl
|
|
@@ -210,8 +208,8 @@ const createPreset = (config)=>{
|
|
|
210
208
|
url: docs.rootUrl,
|
|
211
209
|
image: docs.rootUrl + docs.ogImage,
|
|
212
210
|
description: docs.description,
|
|
213
|
-
twitter:
|
|
214
|
-
site: extractXHandle(
|
|
211
|
+
twitter: docs.socials?.X ? {
|
|
212
|
+
site: extractXHandle(docs.socials?.X),
|
|
215
213
|
card: 'summary_large_image'
|
|
216
214
|
} : void 0
|
|
217
215
|
})
|
|
@@ -230,9 +228,9 @@ function withCallstackPreset(options, userConfig) {
|
|
|
230
228
|
return (0, core_namespaceObject.mergeDocConfig)(createPreset(parsed), userConfig);
|
|
231
229
|
}
|
|
232
230
|
exports.withCallstackPreset = __webpack_exports__.withCallstackPreset;
|
|
233
|
-
for(var
|
|
231
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
234
232
|
"withCallstackPreset"
|
|
235
|
-
].indexOf(
|
|
233
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
236
234
|
Object.defineProperty(exports, '__esModule', {
|
|
237
235
|
value: true
|
|
238
236
|
});
|
package/dist/index.js
CHANGED
|
@@ -28,12 +28,12 @@ const presetOptionsSchema = z.object({
|
|
|
28
28
|
rootUrl: z.string().trim().url({
|
|
29
29
|
message: 'must be a valid URL'
|
|
30
30
|
}).describe('Absolute public site origin (e.g. https://example.com)'),
|
|
31
|
-
socials: z.record(z.string().url()).optional().describe('Map of social icon name to profile URL')
|
|
31
|
+
socials: z.record(z.string(), z.url()).optional().describe('Map of social icon name to profile URL')
|
|
32
32
|
}),
|
|
33
33
|
theme: z.unknown().optional(),
|
|
34
34
|
vercelAnalytics: z.union([
|
|
35
35
|
z.boolean(),
|
|
36
|
-
z.record(z.unknown())
|
|
36
|
+
z.record(z.string(), z.unknown())
|
|
37
37
|
]).optional().describe('Enable/disable Vercel Analytics or pass its config (overrides auto-detect)')
|
|
38
38
|
});
|
|
39
39
|
function error(...message) {
|
|
@@ -43,7 +43,6 @@ function validatePresetOptions(options) {
|
|
|
43
43
|
const result = presetOptionsSchema.safeParse(options);
|
|
44
44
|
if (!result.success) {
|
|
45
45
|
const bullets = result.error.issues.map((issue)=>{
|
|
46
|
-
var _current__def;
|
|
47
46
|
const pathSegments = issue.path;
|
|
48
47
|
const pathLabel = pathSegments.length > 0 ? pathSegments.join('.') : 'root';
|
|
49
48
|
let current = presetOptionsSchema;
|
|
@@ -51,11 +50,11 @@ function validatePresetOptions(options) {
|
|
|
51
50
|
const objectSchema = current;
|
|
52
51
|
const shape = objectSchema.shape;
|
|
53
52
|
current = shape[String(segment)];
|
|
54
|
-
} else if (current instanceof z.ZodRecord) current = current.
|
|
53
|
+
} else if (current instanceof z.ZodRecord) current = current.def.valueType;
|
|
55
54
|
else break;
|
|
56
|
-
const description =
|
|
55
|
+
const description = current?._def?.description;
|
|
57
56
|
const received = issue.received;
|
|
58
|
-
const details = received ? `${issue.message}
|
|
57
|
+
const details = received ? `${issue.message} — received ${received}` : issue.message;
|
|
59
58
|
const withDesc = description ? `${details} (${description})` : details;
|
|
60
59
|
return `- ${pathLabel}: ${withDesc}`;
|
|
61
60
|
}).join('\n');
|
|
@@ -98,7 +97,6 @@ function getGlobalStyles(context) {
|
|
|
98
97
|
return node_fs.existsSync(stylesPath) ? stylesPath : void 0;
|
|
99
98
|
}
|
|
100
99
|
const createPreset = (config)=>{
|
|
101
|
-
var _config_theme, _docs_socials, _docs_socials1;
|
|
102
100
|
const { context, docs, vercelAnalytics } = config;
|
|
103
101
|
const rootDir = node_path.join(context, docs.rootDir ?? 'docs');
|
|
104
102
|
const enableVercel = void 0 === vercelAnalytics ? node_fs.existsSync(node_path.join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
@@ -113,7 +111,7 @@ const createPreset = (config)=>{
|
|
|
113
111
|
...config.theme,
|
|
114
112
|
links: {
|
|
115
113
|
...defaultLinks,
|
|
116
|
-
...
|
|
114
|
+
...config.theme?.links
|
|
117
115
|
}
|
|
118
116
|
};
|
|
119
117
|
return defineConfig({
|
|
@@ -152,7 +150,7 @@ const createPreset = (config)=>{
|
|
|
152
150
|
enableContentAnimation: true,
|
|
153
151
|
enableScrollToTop: false,
|
|
154
152
|
footer: {
|
|
155
|
-
message: `Copyright
|
|
153
|
+
message: `Copyright © ${new Date().getFullYear()} Callstack`
|
|
156
154
|
},
|
|
157
155
|
editLink: {
|
|
158
156
|
docRepoBaseUrl: docs.editUrl
|
|
@@ -167,8 +165,8 @@ const createPreset = (config)=>{
|
|
|
167
165
|
url: docs.rootUrl,
|
|
168
166
|
image: docs.rootUrl + docs.ogImage,
|
|
169
167
|
description: docs.description,
|
|
170
|
-
twitter:
|
|
171
|
-
site: extractXHandle(
|
|
168
|
+
twitter: docs.socials?.X ? {
|
|
169
|
+
site: extractXHandle(docs.socials?.X),
|
|
172
170
|
card: 'summary_large_image'
|
|
173
171
|
} : void 0
|
|
174
172
|
})
|
package/dist/options.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';
|
|
|
2
2
|
import type { AnalyticsProps } from '@vercel/analytics';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export declare const presetOptionsSchema: z.ZodObject<{
|
|
5
|
-
context: z.
|
|
5
|
+
context: z.ZodString;
|
|
6
6
|
docs: z.ZodObject<{
|
|
7
7
|
title: z.ZodString;
|
|
8
8
|
description: z.ZodString;
|
|
@@ -13,65 +13,11 @@ export declare const presetOptionsSchema: z.ZodObject<{
|
|
|
13
13
|
ogImage: z.ZodOptional<z.ZodString>;
|
|
14
14
|
rootDir: z.ZodOptional<z.ZodString>;
|
|
15
15
|
rootUrl: z.ZodString;
|
|
16
|
-
socials: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
17
|
-
},
|
|
18
|
-
title: string;
|
|
19
|
-
description: string;
|
|
20
|
-
editUrl: string;
|
|
21
|
-
rootUrl: string;
|
|
22
|
-
logoLight?: string | undefined;
|
|
23
|
-
logoDark?: string | undefined;
|
|
24
|
-
icon?: string | undefined;
|
|
25
|
-
ogImage?: string | undefined;
|
|
26
|
-
rootDir?: string | undefined;
|
|
27
|
-
socials?: Record<string, string> | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
editUrl: string;
|
|
32
|
-
rootUrl: string;
|
|
33
|
-
logoLight?: string | undefined;
|
|
34
|
-
logoDark?: string | undefined;
|
|
35
|
-
icon?: string | undefined;
|
|
36
|
-
ogImage?: string | undefined;
|
|
37
|
-
rootDir?: string | undefined;
|
|
38
|
-
socials?: Record<string, string> | undefined;
|
|
39
|
-
}>;
|
|
16
|
+
socials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodURL>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
40
18
|
theme: z.ZodOptional<z.ZodUnknown>;
|
|
41
|
-
vercelAnalytics: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
42
|
-
},
|
|
43
|
-
context: string;
|
|
44
|
-
docs: {
|
|
45
|
-
title: string;
|
|
46
|
-
description: string;
|
|
47
|
-
editUrl: string;
|
|
48
|
-
rootUrl: string;
|
|
49
|
-
logoLight?: string | undefined;
|
|
50
|
-
logoDark?: string | undefined;
|
|
51
|
-
icon?: string | undefined;
|
|
52
|
-
ogImage?: string | undefined;
|
|
53
|
-
rootDir?: string | undefined;
|
|
54
|
-
socials?: Record<string, string> | undefined;
|
|
55
|
-
};
|
|
56
|
-
theme?: unknown;
|
|
57
|
-
vercelAnalytics?: boolean | Record<string, unknown> | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
context: string;
|
|
60
|
-
docs: {
|
|
61
|
-
title: string;
|
|
62
|
-
description: string;
|
|
63
|
-
editUrl: string;
|
|
64
|
-
rootUrl: string;
|
|
65
|
-
logoLight?: string | undefined;
|
|
66
|
-
logoDark?: string | undefined;
|
|
67
|
-
icon?: string | undefined;
|
|
68
|
-
ogImage?: string | undefined;
|
|
69
|
-
rootDir?: string | undefined;
|
|
70
|
-
socials?: Record<string, string> | undefined;
|
|
71
|
-
};
|
|
72
|
-
theme?: unknown;
|
|
73
|
-
vercelAnalytics?: boolean | Record<string, unknown> | undefined;
|
|
74
|
-
}>;
|
|
19
|
+
vercelAnalytics: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
75
21
|
type ThemeConfig = Parameters<typeof pluginCallstackTheme>[0];
|
|
76
22
|
type PresetSchema = z.infer<typeof presetOptionsSchema>;
|
|
77
23
|
export type PresetConfig = Omit<PresetSchema, 'theme' | 'vercelAnalytics'> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/rspress-preset",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Callstack preset for Rspress docs",
|
|
5
5
|
"author": "Jakub Romańczyk <jakub.romanczyk@callstack.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,21 +39,21 @@
|
|
|
39
39
|
"typescript"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rspress/plugin-sitemap": "^2.0.
|
|
43
|
-
"@vercel/analytics": "^
|
|
44
|
-
"rsbuild-plugin-open-graph": "^1.
|
|
45
|
-
"zod": "^3.
|
|
46
|
-
"@callstack/rspress-theme": "0.6.
|
|
42
|
+
"@rspress/plugin-sitemap": "^2.0.8",
|
|
43
|
+
"@vercel/analytics": "^2.0.1",
|
|
44
|
+
"rsbuild-plugin-open-graph": "^1.1.2",
|
|
45
|
+
"zod": "^4.3.6",
|
|
46
|
+
"@callstack/rspress-theme": "0.6.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@rspress/core": "^2.0.
|
|
49
|
+
"@rspress/core": "^2.0.8"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@microsoft/api-extractor": "^7.
|
|
53
|
-
"@rslib/core": "^0.
|
|
54
|
-
"@rspress/core": "^2.0.
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"typescript": "^
|
|
52
|
+
"@microsoft/api-extractor": "^7.58.1",
|
|
53
|
+
"@rslib/core": "^0.20.3",
|
|
54
|
+
"@rspress/core": "^2.0.8",
|
|
55
|
+
"@types/node": "^25.5.2",
|
|
56
|
+
"typescript": "^6.0.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "rslib build",
|