@xyd-js/cli 0.1.0-xyd.21 → 0.1.0-xyd.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 (83) hide show
  1. package/.cli/dist/index.js +12417 -0
  2. package/.cli/host/.react-router/types/app/+types/root.ts +40 -0
  3. package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js +81 -0
  4. package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js.map +7 -0
  5. package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js +4003 -0
  6. package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js.map +7 -0
  7. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js +7531 -0
  8. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js.map +7 -0
  9. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js +917 -0
  10. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +7 -0
  11. package/.cli/host/node_modules/.vite/deps/_metadata.json +157 -0
  12. package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js +46 -0
  13. package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js.map +7 -0
  14. package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js +3461 -0
  15. package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js.map +7 -0
  16. package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js +23875 -0
  17. package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js.map +7 -0
  18. package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js +27 -0
  19. package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js.map +7 -0
  20. package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js +1906 -0
  21. package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js.map +7 -0
  22. package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js +21 -0
  23. package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js.map +7 -0
  24. package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js +894 -0
  25. package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js.map +7 -0
  26. package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js +928 -0
  27. package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js.map +7 -0
  28. package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js +10609 -0
  29. package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js.map +7 -0
  30. package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js +205 -0
  31. package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js.map +7 -0
  32. package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js +894 -0
  33. package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js.map +7 -0
  34. package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js +21628 -0
  35. package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js.map +7 -0
  36. package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js +12 -0
  37. package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js.map +7 -0
  38. package/.cli/host/node_modules/.vite/deps/gray-matter.js +3492 -0
  39. package/.cli/host/node_modules/.vite/deps/gray-matter.js.map +7 -0
  40. package/.cli/host/node_modules/.vite/deps/lucide-react.js +34742 -0
  41. package/.cli/host/node_modules/.vite/deps/lucide-react.js.map +7 -0
  42. package/.cli/host/node_modules/.vite/deps/package.json +3 -0
  43. package/.cli/host/node_modules/.vite/deps/react-dom.js +7 -0
  44. package/.cli/host/node_modules/.vite/deps/react-dom.js.map +7 -0
  45. package/.cli/host/node_modules/.vite/deps/react-dom_client.js +39 -0
  46. package/.cli/host/node_modules/.vite/deps/react-dom_client.js.map +7 -0
  47. package/.cli/host/node_modules/.vite/deps/react-router.js +243 -0
  48. package/.cli/host/node_modules/.vite/deps/react-router.js.map +7 -0
  49. package/.cli/host/node_modules/.vite/deps/react-router_dom.js +212 -0
  50. package/.cli/host/node_modules/.vite/deps/react-router_dom.js.map +7 -0
  51. package/.cli/host/node_modules/.vite/deps/react.js +6 -0
  52. package/.cli/host/node_modules/.vite/deps/react.js.map +7 -0
  53. package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js +913 -0
  54. package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
  55. package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js +7 -0
  56. package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
  57. package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js +428 -0
  58. package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js.map +7 -0
  59. package/.cli/host/node_modules/.vite/deps/remark-gfm.js +3122 -0
  60. package/.cli/host/node_modules/.vite/deps/remark-gfm.js.map +7 -0
  61. package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js +10482 -0
  62. package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js.map +7 -0
  63. package/.cli/host/node_modules/.vite/deps/unist-util-visit.js +14 -0
  64. package/.cli/host/node_modules/.vite/deps/unist-util-visit.js.map +7 -0
  65. package/.cli/host/node_modules/.vite/deps/vfile.js +8 -0
  66. package/.cli/host/node_modules/.vite/deps/vfile.js.map +7 -0
  67. package/.cli/host/package.json +43 -0
  68. package/.cli/plugins/xyd-plugin-zero/src/pages/api-reference.tsx +202 -79
  69. package/.cli/plugins/xyd-plugin-zero/src/pages/docs.tsx +3 -12
  70. package/bin.js +3 -0
  71. package/package.json +18 -15
  72. package/.cli/bin.js +0 -3
  73. package/.cli/index.js +0 -24939
  74. package/.cli/package-lock.json +0 -7943
  75. package/.cli/package.json +0 -37
  76. package/postinstall.js +0 -15
  77. /package/.cli/{index.d.ts → dist/index.d.ts} +0 -0
  78. /package/.cli/{app → host/app}/root.tsx +0 -0
  79. /package/.cli/{app → host/app}/routes.ts +0 -0
  80. /package/.cli/{postcss.config.cjs → host/postcss.config.cjs} +0 -0
  81. /package/.cli/{react-router.config.ts → host/react-router.config.ts} +0 -0
  82. /package/.cli/{tsconfig.json → host/tsconfig.json} +0 -0
  83. /package/.cli/{vite.config.ts → host/vite.config.ts} +0 -0
@@ -0,0 +1,14 @@
1
+ import {
2
+ CONTINUE,
3
+ EXIT,
4
+ SKIP,
5
+ visit
6
+ } from "./chunk-OUN4SSIE.js";
7
+ import "./chunk-2TUXWMP5.js";
8
+ export {
9
+ CONTINUE,
10
+ EXIT,
11
+ SKIP,
12
+ visit
13
+ };
14
+ //# sourceMappingURL=unist-util-visit.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import {
2
+ VFile
3
+ } from "./chunk-TKNG6GUJ.js";
4
+ import "./chunk-2TUXWMP5.js";
5
+ export {
6
+ VFile
7
+ };
8
+ //# sourceMappingURL=vfile.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "private": true,
3
+ "name": "@xyd-js/documan-host",
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {},
7
+ "dependencies": {
8
+ "@xyd-js/atlas": "workspace:*",
9
+ "@xyd-js/core": "workspace:*",
10
+ "@xyd-js/content": "workspace:*",
11
+ "@xyd-js/framework": "workspace:*",
12
+ "@xyd-js/gql": "workspace:*",
13
+ "@xyd-js/openapi": "workspace:*",
14
+ "@xyd-js/uniform": "workspace:*",
15
+ "@xyd-js/theme-gusto": "workspace:*",
16
+ "@react-router/node": "^7.1.1",
17
+ "@react-router/serve": "^7.1.1",
18
+ "codehike": "^1.0.3",
19
+ "express": "^4.21.1",
20
+ "isbot": "^5.1.17",
21
+ "react": "^18.3.1",
22
+ "react-dom": "^18.3.1",
23
+ "react-router": "^7.1.1",
24
+ "remark-frontmatter": "^5.0.0",
25
+ "remark-gfm": "^4.0.0",
26
+ "remark-mdx-frontmatter": "^5.0.0",
27
+ "typescript": "^5.6.3",
28
+ "vfile": "^6.0.3",
29
+ "yaml": "^2.6.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.7.5",
33
+ "@types/react-dom": "^18.3.1",
34
+ "@mdx-js/rollup": "^3.1.0",
35
+ "@types/react": "^18.3.9",
36
+ "@vitejs/plugin-react": "^4.3.2",
37
+ "autoprefixer": "^10.4.20",
38
+ "postcss": "^8.4.47",
39
+ "typescript": "^5.6.2",
40
+ "vite": "^5.4.9",
41
+ "vite-tsconfig-paths": "^5.0.1"
42
+ }
43
+ }
@@ -1,8 +1,8 @@
1
1
  import path from "path";
2
2
  import {promises as fs} from "fs";
3
3
 
4
- import React, {} from "react";
5
- import {redirect} from "react-router";
4
+ import React, {useContext} from "react";
5
+ import {redirect, UNSAFE_DataRouterStateContext} from "react-router";
6
6
  import remarkFrontmatter from "remark-frontmatter";
7
7
  import remarkMdxFrontmatter from "remark-mdx-frontmatter";
8
8
  import remarkGfm from "remark-gfm";
@@ -12,11 +12,14 @@ import {recmaCodeHike, remarkCodeHike} from "codehike/mdx";
12
12
  import {compile as mdxCompile} from "@mdx-js/mdx";
13
13
 
14
14
  import {PageFrontMatter} from "@xyd-js/core";
15
+ import {renderoll} from "@xyd-js/foo/renderoll";
16
+ import {
17
+ AtlasLazy
18
+ } from "@xyd-js/atlas";
15
19
  import getContentComponents from "@xyd-js/components/content";
16
20
  import {mapSettingsToProps} from "@xyd-js/framework/hydration";
17
- import {Framework, type FwSidebarGroupProps} from "@xyd-js/framework/react";
18
- import {AtlasLazy} from "@xyd-js/atlas";
19
- import type {IBreadcrumb, INavLinks} from "@xyd-js/ui";
21
+ import {Framework} from "@xyd-js/framework/react";
22
+ import type {FwSidebarGroupProps} from "@xyd-js/framework/react";
20
23
 
21
24
  import Theme from "virtual:xyd-theme" // TODO: for some reasons this cannot be hydrated by react-router
22
25
  import settings from 'virtual:xyd-settings';
@@ -24,15 +27,6 @@ import settings from 'virtual:xyd-settings';
24
27
  import "virtual:xyd-theme/index.css"
25
28
  import "virtual:xyd-theme-override/index.css"
26
29
 
27
- interface loaderData {
28
- sidebarGroups: FwSidebarGroupProps[]
29
- breadcrumbs: IBreadcrumb[],
30
- navlinks?: INavLinks,
31
- toc: PageFrontMatter
32
- slug: string
33
- code: string
34
- }
35
-
36
30
  const contentComponents = getContentComponents()
37
31
  const ComponentContent = contentComponents.Content
38
32
 
@@ -73,14 +67,8 @@ const codeHikeOptions = {
73
67
  // },
74
68
  };
75
69
 
76
- const compiledBySlug = {}
77
-
78
70
  // TODO: map every file and merge them or load via client-side ?
79
71
  async function compileBySlug(slug: string) {
80
- if (compiledBySlug[slug]) {
81
- return compiledBySlug[slug]
82
- }
83
- console.time("api-reference compileBySlug")
84
72
  // TODO: cwd ?
85
73
  let filePath = path.join(process.cwd(), `${slug}.md`)
86
74
 
@@ -92,37 +80,23 @@ async function compileBySlug(slug: string) {
92
80
  await fs.access(filePath)
93
81
  }
94
82
 
95
- console.time("api-reference readFile")
96
83
  const content = await fs.readFile(filePath, "utf-8");
97
- console.timeEnd("api-reference readFile")
98
-
99
- console.time("api-reference compile")
100
- const resp = await compile(content)
101
- console.timeEnd("api-reference compile")
102
84
 
103
- console.timeEnd("api-reference compileBySlug")
104
- compiledBySlug[slug] = resp
105
- return resp
85
+ return await compile(content)
106
86
  }
107
87
 
108
88
  async function compile(content: string): Promise<string> {
109
89
  const compiled = await mdxCompile(content, {
110
90
  remarkPlugins: [
111
91
  normalizeCustomHeadings,
112
- [
113
- remarkCodeHike,
114
- codeHikeOptions
115
- ],
92
+ [remarkCodeHike, codeHikeOptions],
116
93
  remarkFrontmatter,
117
94
  remarkMdxFrontmatter,
118
95
  remarkGfm
119
96
  ],
120
97
  rehypePlugins: [],
121
98
  recmaPlugins: [
122
- [
123
- recmaCodeHike,
124
- codeHikeOptions
125
- ]
99
+ [recmaCodeHike, codeHikeOptions]
126
100
  ],
127
101
  outputFormat: 'function-body',
128
102
  development: false,
@@ -162,61 +136,42 @@ function findFirstUrl(items: any): string {
162
136
  return "";
163
137
  }
164
138
 
165
- interface data {
166
- groups: FwSidebarGroupProps[],
167
- breadcrumbs: IBreadcrumb[]
168
- navlinks?: INavLinks
169
- }
170
-
171
- const mapSettingsToPropsMap: { [key: string]: data } = {}
172
-
173
139
  // TODO: fix any
174
140
  export async function loader({request}: { request: any }) {
175
- console.time("api-reference loader")
176
- const slug = getPathname(request.url);
141
+ const slug = getPathname(request.url)
177
142
 
178
- let code = "";
179
- let error: any;
143
+ let code = ""
144
+ let error: any
180
145
 
181
146
  try {
182
- code = await compileBySlug(slug);
147
+ code = await compileBySlug(slug)
183
148
  } catch (e) {
184
- error = e;
185
- }
186
- let data: data
187
-
188
- if (!mapSettingsToPropsMap[slug]) {
189
- data = await mapSettingsToProps(
190
- settings,
191
- slug
192
- );
193
- mapSettingsToPropsMap[slug] = data
194
- } else {
195
- data = mapSettingsToPropsMap[slug]
149
+ error = e
196
150
  }
197
151
 
198
- const {groups: sidebarGroups, breadcrumbs, navlinks} = data;
152
+ const {groups: sidebarGroups} = await mapSettingsToProps(
153
+ settings,
154
+ slug
155
+ )
199
156
 
157
+ // TODO: dry with docs.tsx - resolver?
200
158
  if (error) {
201
159
  if (sidebarGroups && error.code === "ENOENT") {
202
- const firstItem = findFirstUrl(sidebarGroups?.[0]?.items);
160
+ const firstItem = findFirstUrl(sidebarGroups?.[0]?.items)
203
161
 
204
162
  if (firstItem) {
205
- return redirect(firstItem);
163
+ return redirect(firstItem)
206
164
  }
207
165
  }
208
166
 
209
- console.error(error);
167
+ console.error(error)
210
168
  }
211
169
 
212
- console.timeEnd("api-reference loader")
213
170
  return {
214
171
  sidebarGroups,
215
- breadcrumbs,
216
- navlinks,
217
172
  slug,
218
- code,
219
- } as loaderData;
173
+ code
174
+ } as loaderData
220
175
  }
221
176
 
222
177
  function mdxExport(code: string) {
@@ -230,6 +185,157 @@ function mdxExport(code: string) {
230
185
  return fn(scope)
231
186
  }
232
187
 
188
+ function renderollAsyncClient(routeId: string, slug: string) {
189
+ return async () => {
190
+ let mod;
191
+ let urlPrefix;
192
+ let data;
193
+
194
+ // TODO: fix any
195
+ function moduleData(mods: any, id: string) {
196
+ mod = mods.default[id]
197
+ if (!mod) {
198
+ throw new Error(`Unknown openapi id: ${id}`)
199
+ }
200
+ urlPrefix = mod.urlPrefix
201
+ data = mod.data
202
+ }
203
+
204
+ switch (routeId) {
205
+ case "xyd-plugin-zero/graphql": {
206
+ // @ts-ignore
207
+ mod = await import("virtual:xyd-plugin-zero/graphql");
208
+ urlPrefix = "/docs/api/graphql" // TODO: dynamic urlPreifx
209
+ data = mod.default.data
210
+ break;
211
+ }
212
+ case "xyd-plugin-zero/openapi": {
213
+ // @ts-ignore
214
+ mod = await import("virtual:xyd-plugin-zero/openapi");
215
+ urlPrefix = "/docs/api/openapi" // TODO: dynamic urlPrefix
216
+ data = mod.default.data
217
+ break;
218
+ }
219
+ default: {
220
+ if (routeId.includes("xyd-plugin-zero/openapi")) {
221
+ const [_, id] = routeId.split("xyd-plugin-zero/openapi-")
222
+ // @ts-ignore
223
+ const mods = await import("virtual:xyd-plugin-zero/openapi")
224
+ moduleData(mods, id)
225
+ break;
226
+ }
227
+ if (routeId.includes("xyd-plugin-zero/graphql")) {
228
+ const [_, id] = routeId.split("xyd-plugin-zero/graphql-")
229
+ // @ts-ignore
230
+ const mods = await import("virtual:xyd-plugin-zero/graphql")
231
+ moduleData(mods, id)
232
+ break;
233
+ }
234
+
235
+ throw new Error(`Unknown routeId: ${routeId}`);
236
+ }
237
+ }
238
+
239
+ if (!Array.isArray(data)) {
240
+ console.warn(`mod.default is not an array, current type is: ${typeof mod.default}`)
241
+
242
+ return
243
+ }
244
+
245
+ // TODO: in the future custom position
246
+ const prevRefs = []
247
+ const nextRefs = []
248
+ const mdxComponentsPrev: any[] = []
249
+ const mdxComponentsNext: any[] = []
250
+
251
+ let pos = 0;
252
+
253
+ for (const chunk of data) {
254
+ if (!chunk) {
255
+ continue
256
+ }
257
+
258
+ if (chunk.slug === slug) {
259
+ pos = 1
260
+ continue
261
+ }
262
+
263
+ const references = pos === 0 ? prevRefs : nextRefs
264
+
265
+ const code = await compile(chunk.content) // TODO: do we need real path?
266
+ const mdx = mdxExport(code)
267
+ const Content = mdx.default
268
+ const content = Content ? parse(Content, {
269
+ components: contentComponents
270
+ }) : null
271
+
272
+ // TODO: support non-fererence pages
273
+ if (content.references) {
274
+ references.push(...(content?.references || []) as [])
275
+ } else {
276
+ const mdxComponents = pos === 0 ? mdxComponentsPrev : mdxComponentsNext
277
+
278
+ mdxComponents.push(<div data-slug={`/${chunk.slug}`}>
279
+ <ComponentContent>
280
+ {content}
281
+ </ComponentContent>
282
+ </div>)
283
+ }
284
+ }
285
+
286
+ return [
287
+ ({onLoaded}) => <>
288
+ <ComponentContent>
289
+ {mdxComponentsPrev}
290
+ </ComponentContent>
291
+
292
+ {
293
+ prevRefs.length ? <div>
294
+ <AtlasLazy
295
+ references={prevRefs}
296
+ urlPrefix={urlPrefix}
297
+ slug={slug}
298
+ onLoaded={onLoaded}
299
+ />
300
+ </div> : null
301
+ }
302
+ </>,
303
+
304
+ ({onLoaded}) => <>
305
+ <ComponentContent>
306
+ {mdxComponentsNext}
307
+ </ComponentContent>
308
+
309
+ {
310
+ nextRefs.length ? <div>
311
+ <AtlasLazy
312
+ references={nextRefs}
313
+ urlPrefix={urlPrefix}
314
+ slug={slug}
315
+ onLoaded={onLoaded}
316
+ />
317
+ </div> : null
318
+ }
319
+ </>
320
+ ]
321
+ }
322
+ }
323
+
324
+ function getRouteId() {
325
+ const routerState = useContext(UNSAFE_DataRouterStateContext)
326
+ let routeId: string = ""
327
+
328
+ routerState?.matches?.forEach(match => {
329
+ const loader = routerState?.loaderData[match?.route?.id]
330
+
331
+ if (loader) {
332
+ routeId = match?.route?.id
333
+ }
334
+ })
335
+
336
+ return routeId
337
+ }
338
+
233
339
  function MemoMDXComponent(codeComponent: any) {
234
340
  return React.useMemo(
235
341
  () => codeComponent ? codeComponent : null,
@@ -258,11 +364,30 @@ export default function APIReference({loaderData}: { loaderData: loaderData }) {
258
364
 
259
365
  const memoizedServerComponent = MemoMDXComponent(serverComponent)
260
366
 
367
+ const serverAtlasOrMDX = memoizedServerComponent?.references ?
368
+ <AtlasLazy
369
+ references={memoizedServerComponent?.references || []}
370
+ slug={loaderData.slug.startsWith("/") ? loaderData.slug : `/${loaderData.slug}`}
371
+ urlPrefix="/"
372
+ /> :
373
+ <ComponentContent>
374
+ {memoizedServerComponent}
375
+ </ComponentContent>
376
+
377
+ const routeId = getRouteId()
378
+
379
+ const RenderollContent = renderoll(
380
+ renderollAsyncClient(routeId, loaderData.slug),
381
+ {
382
+ decorator: ({children}) => <ComponentContent>
383
+ {children}
384
+ </ComponentContent>
385
+ }
386
+ )
387
+
261
388
  return <Framework
262
389
  settings={settings}
263
- sidebarGroups={loaderData.sidebarGroups || []}
264
- breadcrumbs={loaderData.breadcrumbs || []}
265
- navlinks={loaderData.navlinks}
390
+ sidebarGroups={loaderData.sidebarGroups}
266
391
  >
267
392
  <Theme
268
393
  themeSettings={{
@@ -273,11 +398,9 @@ export default function APIReference({loaderData}: { loaderData: loaderData }) {
273
398
  }
274
399
  }}
275
400
  >
276
- <AtlasLazy
277
- references={memoizedServerComponent?.references || []}
278
- slug={loaderData.slug.startsWith("/") ? loaderData.slug : `/${loaderData.slug}`}
279
- urlPrefix="/"
280
- />
401
+ <RenderollContent>
402
+ {serverAtlasOrMDX}
403
+ </RenderollContent>
281
404
  </Theme>
282
405
  </Framework>
283
406
  }
@@ -5,11 +5,12 @@ import {redirect} from "react-router";
5
5
 
6
6
  import {PageFrontMatter} from "@xyd-js/core"
7
7
  import {compileBySlug} from "@xyd-js/content"
8
- import {mapSettingsToProps} from "@xyd-js/framework/hydration";
9
- import {Framework, FwNav, type FwSidebarGroupProps} from "@xyd-js/framework/react";
10
8
  import getContentComponents from "@xyd-js/components/content";
11
9
  import {HomePage} from "@xyd-js/components/pages";
12
10
  import type {IBreadcrumb, INavLinks} from "@xyd-js/ui";
11
+ import {mapSettingsToProps} from "@xyd-js/framework/hydration";
12
+ import {Framework, FwNav} from "@xyd-js/framework/react";
13
+ import type {FwSidebarGroupProps} from "@xyd-js/framework/react";
13
14
 
14
15
  import settings from 'virtual:xyd-settings';
15
16
  import Theme from "virtual:xyd-theme";
@@ -47,15 +48,6 @@ export async function loader({request}: { request: any }) {
47
48
  return {}
48
49
  }
49
50
 
50
- // TODO: in the future map instead of arr
51
- if (settings.redirects && settings.redirects.length) {
52
- for (const item of settings.redirects) {
53
- if (item.source === getPathname(request.url)) {
54
- return redirect(item.destination)
55
- }
56
- }
57
- }
58
-
59
51
  let code = ""
60
52
  let error: any
61
53
 
@@ -95,7 +87,6 @@ export async function loader({request}: { request: any }) {
95
87
  console.error(error)
96
88
  }
97
89
 
98
- console.timeEnd("docs loader")
99
90
  return {
100
91
  sidebarGroups,
101
92
  breadcrumbs,
package/bin.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import './.cli/dist/index.js';
package/package.json CHANGED
@@ -1,22 +1,19 @@
1
1
  {
2
2
  "name": "@xyd-js/cli",
3
- "version": "0.1.0-xyd.21",
3
+ "version": "0.1.0-xyd.3",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "description": "",
7
7
  "type": "module",
8
- "main": ".cli/index.js",
8
+ "main": "./.cli/dist/index.js",
9
9
  "bin": {
10
- "xyd": ".cli/bin.js"
10
+ "xyd": "bin.js"
11
11
  },
12
12
  "files": [
13
- ".cli",
14
- "postinstall.js"
13
+ ".cli/",
14
+ "bin.js",
15
+ "README.md"
15
16
  ],
16
- "scripts": {
17
- "build": "tsup",
18
- "postinstall": "node postinstall.js"
19
- },
20
17
  "dependencies": {
21
18
  "@xyd-js/react-router-dev": "7.1.1-xyd.3",
22
19
  "arg": "^5.0.2",
@@ -25,8 +22,8 @@
25
22
  "codehike": "^1.0.3",
26
23
  "express": "^4.21.1",
27
24
  "isbot": "^5.1.17",
28
- "react": "^19.0.0",
29
- "react-dom": "^19.0.0",
25
+ "react": "^18.3.1",
26
+ "react-dom": "^18.3.1",
30
27
  "react-router": "^7.1.1",
31
28
  "remark-frontmatter": "^5.0.0",
32
29
  "remark-gfm": "^4.0.0",
@@ -58,14 +55,20 @@
58
55
  "lightningcss": "^1.27.0",
59
56
  "morgan": "^1.10.0",
60
57
  "source-map-support": "^0.5.21",
61
- "vite-tsconfig-paths": "^5.1.4"
58
+ "@xyd-js/content": "0.1.0-xyd.3",
59
+ "@xyd-js/components": "0.1.0-xyd.0",
60
+ "@xyd-js/framework": "0.1.0-xyd.3",
61
+ "@xyd-js/theme-poetry": "0.1.0-xyd.2",
62
+ "@xyd-js/atlas": "0.1.0-xyd.4"
62
63
  },
63
64
  "devDependencies": {
64
- "@xyd-js/documan": "workspace:*",
65
- "tsup": "^8.3.0",
66
65
  "arg": "^5.0.2",
67
66
  "colors": "^1.4.0",
68
67
  "semver": "^7.6.3",
69
- "vite-tsconfig-paths": "^5.1.4"
68
+ "vite-tsconfig-paths": "^5.1.4",
69
+ "@xyd-js/documan": "0.1.0-xyd.2"
70
+ },
71
+ "scripts": {
72
+ "build": "tsup"
70
73
  }
71
74
  }
package/.cli/bin.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import './index.js';