@raystack/chronicle 0.3.0 → 0.4.0

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/dist/cli/index.js +289 -9931
  2. package/package.json +20 -12
  3. package/src/cli/commands/build.ts +28 -31
  4. package/src/cli/commands/dev.ts +24 -31
  5. package/src/cli/commands/init.ts +38 -132
  6. package/src/cli/commands/serve.ts +36 -55
  7. package/src/cli/commands/start.ts +20 -31
  8. package/src/cli/index.ts +14 -14
  9. package/src/cli/utils/config.ts +25 -26
  10. package/src/cli/utils/index.ts +3 -3
  11. package/src/cli/utils/resolve.ts +7 -3
  12. package/src/cli/utils/scaffold.ts +11 -130
  13. package/src/components/mdx/code.tsx +10 -1
  14. package/src/components/mdx/details.module.css +1 -26
  15. package/src/components/mdx/details.tsx +2 -3
  16. package/src/components/mdx/image.tsx +5 -34
  17. package/src/components/mdx/index.tsx +15 -1
  18. package/src/components/mdx/link.tsx +18 -15
  19. package/src/components/ui/breadcrumbs.tsx +8 -42
  20. package/src/components/ui/search.tsx +63 -51
  21. package/src/lib/api-routes.ts +6 -8
  22. package/src/lib/config.ts +12 -36
  23. package/src/lib/head.tsx +49 -0
  24. package/src/lib/openapi.ts +8 -8
  25. package/src/lib/page-context.tsx +111 -0
  26. package/src/lib/remark-strip-md-extensions.ts +14 -0
  27. package/src/lib/source.ts +139 -63
  28. package/src/pages/ApiLayout.tsx +33 -0
  29. package/src/pages/ApiPage.tsx +73 -0
  30. package/src/pages/DocsLayout.tsx +18 -0
  31. package/src/pages/DocsPage.tsx +43 -0
  32. package/src/pages/NotFound.tsx +17 -0
  33. package/src/server/App.tsx +72 -0
  34. package/src/server/api/apis-proxy.ts +69 -0
  35. package/src/server/api/health.ts +5 -0
  36. package/src/server/api/page/[...slug].ts +18 -0
  37. package/src/server/api/search.ts +118 -0
  38. package/src/server/api/specs.ts +9 -0
  39. package/src/server/build-search-index.ts +117 -0
  40. package/src/server/entry-client.tsx +88 -0
  41. package/src/server/entry-server.tsx +102 -0
  42. package/src/server/routes/llms.txt.ts +21 -0
  43. package/src/server/routes/og.tsx +75 -0
  44. package/src/server/routes/robots.txt.ts +11 -0
  45. package/src/server/routes/sitemap.xml.ts +40 -0
  46. package/src/server/utils/safe-path.ts +17 -0
  47. package/src/server/vite-config.ts +129 -0
  48. package/src/themes/default/Layout.tsx +78 -48
  49. package/src/themes/default/Page.module.css +44 -0
  50. package/src/themes/default/Page.tsx +9 -11
  51. package/src/themes/default/Toc.tsx +25 -39
  52. package/src/themes/default/index.ts +7 -9
  53. package/src/themes/paper/ChapterNav.tsx +64 -45
  54. package/src/themes/paper/Layout.module.css +1 -1
  55. package/src/themes/paper/Layout.tsx +24 -12
  56. package/src/themes/paper/Page.module.css +16 -4
  57. package/src/themes/paper/Page.tsx +56 -63
  58. package/src/themes/paper/ReadingProgress.tsx +160 -139
  59. package/src/themes/paper/index.ts +5 -5
  60. package/src/themes/registry.ts +14 -7
  61. package/src/types/content.ts +5 -21
  62. package/src/types/globals.d.ts +4 -0
  63. package/src/types/theme.ts +4 -3
  64. package/tsconfig.json +2 -3
  65. package/next.config.mjs +0 -10
  66. package/source.config.ts +0 -51
  67. package/src/app/[[...slug]]/layout.tsx +0 -15
  68. package/src/app/[[...slug]]/page.tsx +0 -106
  69. package/src/app/api/apis-proxy/route.ts +0 -59
  70. package/src/app/api/health/route.ts +0 -3
  71. package/src/app/api/search/route.ts +0 -90
  72. package/src/app/apis/[[...slug]]/layout.tsx +0 -26
  73. package/src/app/apis/[[...slug]]/page.tsx +0 -117
  74. package/src/app/layout.tsx +0 -57
  75. package/src/app/llms-full.txt/route.ts +0 -18
  76. package/src/app/llms.txt/route.ts +0 -15
  77. package/src/app/og/route.tsx +0 -62
  78. package/src/app/providers.tsx +0 -8
  79. package/src/app/robots.ts +0 -10
  80. package/src/app/sitemap.ts +0 -29
  81. package/src/cli/utils/process.ts +0 -7
  82. package/src/themes/default/font.ts +0 -6
  83. /package/src/{app/apis/[[...slug]]/layout.module.css → pages/ApiLayout.module.css} +0 -0
@@ -1,62 +0,0 @@
1
- import { ImageResponse } from 'next/og'
2
- import type { NextRequest } from 'next/server'
3
- import { loadConfig } from '@/lib/config'
4
-
5
- export async function GET(request: NextRequest) {
6
- const { searchParams } = request.nextUrl
7
- const title = searchParams.get('title') ?? loadConfig().title
8
- const description = searchParams.get('description') ?? ''
9
- const siteName = loadConfig().title
10
-
11
- return new ImageResponse(
12
- (
13
- <div
14
- style={{
15
- height: '100%',
16
- width: '100%',
17
- display: 'flex',
18
- flexDirection: 'column',
19
- justifyContent: 'center',
20
- padding: '60px 80px',
21
- backgroundColor: '#0a0a0a',
22
- color: '#fafafa',
23
- }}
24
- >
25
- <div
26
- style={{
27
- fontSize: 24,
28
- color: '#888',
29
- marginBottom: 16,
30
- }}
31
- >
32
- {siteName}
33
- </div>
34
- <div
35
- style={{
36
- fontSize: 56,
37
- fontWeight: 700,
38
- lineHeight: 1.2,
39
- marginBottom: 24,
40
- }}
41
- >
42
- {title}
43
- </div>
44
- {description && (
45
- <div
46
- style={{
47
- fontSize: 24,
48
- color: '#999',
49
- lineHeight: 1.4,
50
- }}
51
- >
52
- {description}
53
- </div>
54
- )}
55
- </div>
56
- ),
57
- {
58
- width: 1200,
59
- height: 630,
60
- }
61
- )
62
- }
@@ -1,8 +0,0 @@
1
- 'use client'
2
-
3
- import { ThemeProvider } from '@raystack/apsara'
4
- import type { ReactNode } from 'react'
5
-
6
- export function Providers({ children }: { children: ReactNode }) {
7
- return <ThemeProvider enableSystem>{children}</ThemeProvider>
8
- }
package/src/app/robots.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { MetadataRoute } from 'next'
2
- import { loadConfig } from '@/lib/config'
3
-
4
- export default function robots(): MetadataRoute.Robots {
5
- const config = loadConfig()
6
- return {
7
- rules: { userAgent: '*', allow: '/' },
8
- ...(config.url && { sitemap: `${config.url}/sitemap.xml` }),
9
- }
10
- }
@@ -1,29 +0,0 @@
1
- import type { MetadataRoute } from 'next'
2
- import { loadConfig } from '@/lib/config'
3
- import { source } from '@/lib/source'
4
- import { loadApiSpecs } from '@/lib/openapi'
5
- import { buildApiRoutes } from '@/lib/api-routes'
6
-
7
- export default function sitemap(): MetadataRoute.Sitemap {
8
- const config = loadConfig()
9
- if (!config.url) return []
10
-
11
- const baseUrl = config.url.replace(/\/$/, '')
12
-
13
- const docPages = source.getPages().map((page) => ({
14
- url: `${baseUrl}/${page.slugs.join('/')}`,
15
- ...(page.data.lastModified && { lastModified: new Date(page.data.lastModified) }),
16
- }))
17
-
18
- const apiPages = config.api?.length
19
- ? buildApiRoutes(loadApiSpecs(config.api)).map((route) => ({
20
- url: `${baseUrl}/apis/${route.slug.join('/')}`,
21
- }))
22
- : []
23
-
24
- return [
25
- { url: baseUrl },
26
- ...docPages,
27
- ...apiPages,
28
- ]
29
- }
@@ -1,7 +0,0 @@
1
- import type { ChildProcess } from 'child_process'
2
-
3
- export function attachLifecycleHandlers(child: ChildProcess) {
4
- child.on('close', (code) => process.exit(code ?? 0))
5
- process.on('SIGINT', () => child.kill('SIGINT'))
6
- process.on('SIGTERM', () => child.kill('SIGTERM'))
7
- }
@@ -1,6 +0,0 @@
1
- import { Inter } from 'next/font/google'
2
-
3
- export const inter = Inter({
4
- subsets: ['latin'],
5
- display: 'swap',
6
- })