@raystack/chronicle 0.1.0-canary.c5d277e → 0.1.0-canary.cb102e9
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/cli/index.js +481 -42
- package/package.json +1 -1
- package/src/cli/commands/build.ts +30 -2
- package/src/components/ui/search.tsx +10 -6
- package/src/server/adapters/vercel.ts +133 -0
- package/src/server/build-search-index.ts +107 -0
- package/src/server/dev.ts +5 -3
- package/src/server/entry-prod.ts +21 -50
- package/src/server/entry-vercel.ts +28 -0
- package/src/server/handlers/apis-proxy.ts +5 -0
- package/src/server/handlers/search.ts +46 -14
- package/src/server/request-handler.ts +64 -0
- package/src/server/utils/safe-path.ts +14 -0
- package/src/server/vite-config.ts +1 -1
- package/src/themes/default/Page.module.css +8 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a URL path within a base directory, preventing path traversal.
|
|
5
|
+
* Returns null if the resolved path escapes the base directory.
|
|
6
|
+
*/
|
|
7
|
+
export function safePath(baseDir: string, urlPath: string): string | null {
|
|
8
|
+
const decoded = decodeURIComponent(urlPath.split('?')[0])
|
|
9
|
+
const resolved = path.resolve(baseDir, '.' + decoded)
|
|
10
|
+
if (!resolved.startsWith(path.resolve(baseDir) + path.sep) && resolved !== path.resolve(baseDir)) {
|
|
11
|
+
return null
|
|
12
|
+
}
|
|
13
|
+
return resolved
|
|
14
|
+
}
|
|
@@ -41,7 +41,7 @@ export async function createViteConfig(options: ViteConfigOptions): Promise<Inli
|
|
|
41
41
|
remarkDirective,
|
|
42
42
|
],
|
|
43
43
|
rehypePlugins: [
|
|
44
|
-
[rehypeShiki, { themes: { light: 'github-light', dark: 'github-dark' } }],
|
|
44
|
+
[rehypeShiki, { themes: { light: 'github-light', dark: 'github-dark' }, defaultColor: false }],
|
|
45
45
|
],
|
|
46
46
|
mdExtensions: ['.md'],
|
|
47
47
|
mdxExtensions: ['.mdx'],
|
|
@@ -38,18 +38,22 @@
|
|
|
38
38
|
margin-bottom: var(--rs-space-3);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.content :global(pre
|
|
42
|
-
color: var(--shiki-light);
|
|
41
|
+
.content :global(pre) {
|
|
42
|
+
background-color: var(--shiki-light-bg, #fff);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
color: var(--shiki-
|
|
45
|
+
.content :global(pre code span) {
|
|
46
|
+
color: var(--shiki-light);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
:global([data-theme="dark"]) .content :global(pre) {
|
|
50
50
|
background-color: var(--shiki-dark-bg, #24292e);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
:global([data-theme="dark"]) .content :global(pre code span) {
|
|
54
|
+
color: var(--shiki-dark);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
.content img {
|
|
54
58
|
max-width: 100%;
|
|
55
59
|
height: auto;
|