veslx 0.1.14 → 0.1.15
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/README.md +262 -55
- package/bin/lib/build.ts +65 -13
- package/bin/lib/import-config.ts +10 -9
- package/bin/lib/init.ts +21 -22
- package/bin/lib/serve.ts +66 -12
- package/bin/veslx.ts +2 -2
- package/dist/client/App.js +3 -9
- package/dist/client/App.js.map +1 -1
- package/dist/client/components/front-matter.js +11 -25
- package/dist/client/components/front-matter.js.map +1 -1
- package/dist/client/components/gallery/components/figure-caption.js +6 -4
- package/dist/client/components/gallery/components/figure-caption.js.map +1 -1
- package/dist/client/components/gallery/components/figure-header.js +3 -3
- package/dist/client/components/gallery/components/figure-header.js.map +1 -1
- package/dist/client/components/gallery/components/lightbox.js +13 -13
- package/dist/client/components/gallery/components/lightbox.js.map +1 -1
- package/dist/client/components/gallery/components/loading-image.js +11 -10
- package/dist/client/components/gallery/components/loading-image.js.map +1 -1
- package/dist/client/components/gallery/hooks/use-gallery-images.js +31 -7
- package/dist/client/components/gallery/hooks/use-gallery-images.js.map +1 -1
- package/dist/client/components/gallery/index.js +22 -15
- package/dist/client/components/gallery/index.js.map +1 -1
- package/dist/client/components/header.js +5 -3
- package/dist/client/components/header.js.map +1 -1
- package/dist/client/components/mdx-components.js +42 -8
- package/dist/client/components/mdx-components.js.map +1 -1
- package/dist/client/components/post-list.js +97 -90
- package/dist/client/components/post-list.js.map +1 -1
- package/dist/client/components/running-bar.js +1 -1
- package/dist/client/components/running-bar.js.map +1 -1
- package/dist/client/components/slide.js +18 -0
- package/dist/client/components/slide.js.map +1 -0
- package/dist/client/components/slides-renderer.js +7 -71
- package/dist/client/components/slides-renderer.js.map +1 -1
- package/dist/client/hooks/use-mdx-content.js +55 -9
- package/dist/client/hooks/use-mdx-content.js.map +1 -1
- package/dist/client/main.js +1 -0
- package/dist/client/main.js.map +1 -1
- package/dist/client/pages/content-router.js +19 -0
- package/dist/client/pages/content-router.js.map +1 -0
- package/dist/client/pages/home.js +11 -7
- package/dist/client/pages/home.js.map +1 -1
- package/dist/client/pages/post.js +8 -20
- package/dist/client/pages/post.js.map +1 -1
- package/dist/client/pages/slides.js +62 -86
- package/dist/client/pages/slides.js.map +1 -1
- package/dist/client/plugin/src/client.js +58 -96
- package/dist/client/plugin/src/client.js.map +1 -1
- package/dist/client/plugin/src/directory-tree.js +111 -0
- package/dist/client/plugin/src/directory-tree.js.map +1 -0
- package/index.html +1 -1
- package/package.json +27 -15
- package/plugin/src/client.tsx +64 -116
- package/plugin/src/directory-tree.ts +171 -0
- package/plugin/src/lib.ts +6 -249
- package/plugin/src/plugin.ts +93 -50
- package/plugin/src/remark-slides.ts +100 -0
- package/plugin/src/types.ts +22 -0
- package/src/App.tsx +3 -6
- package/src/components/front-matter.tsx +14 -29
- package/src/components/gallery/components/figure-caption.tsx +15 -7
- package/src/components/gallery/components/figure-header.tsx +3 -3
- package/src/components/gallery/components/lightbox.tsx +15 -13
- package/src/components/gallery/components/loading-image.tsx +15 -12
- package/src/components/gallery/hooks/use-gallery-images.ts +51 -10
- package/src/components/gallery/index.tsx +32 -26
- package/src/components/header.tsx +14 -9
- package/src/components/mdx-components.tsx +61 -8
- package/src/components/post-list.tsx +149 -115
- package/src/components/running-bar.tsx +1 -1
- package/src/components/slide.tsx +22 -5
- package/src/components/slides-renderer.tsx +7 -115
- package/src/components/welcome.tsx +11 -14
- package/src/hooks/use-mdx-content.ts +94 -9
- package/src/index.css +159 -0
- package/src/main.tsx +1 -0
- package/src/pages/content-router.tsx +27 -0
- package/src/pages/home.tsx +16 -2
- package/src/pages/post.tsx +10 -13
- package/src/pages/slides.tsx +75 -88
- package/src/vite-env.d.ts +7 -17
- package/vite.config.ts +25 -6
package/vite.config.ts
CHANGED
|
@@ -7,6 +7,7 @@ import rehypeKatex from 'rehype-katex'
|
|
|
7
7
|
import remarkFrontmatter from 'remark-frontmatter'
|
|
8
8
|
import remarkGfm from 'remark-gfm'
|
|
9
9
|
import remarkMdxFrontmatter from 'remark-mdx-frontmatter'
|
|
10
|
+
import { remarkSlides } from './plugin/src/remark-slides'
|
|
10
11
|
import { fileURLToPath } from 'url'
|
|
11
12
|
import path from 'path'
|
|
12
13
|
import fs from 'fs'
|
|
@@ -17,10 +18,19 @@ const distClientPath = path.join(__dirname, 'dist/client')
|
|
|
17
18
|
const srcPath = path.join(__dirname, 'src')
|
|
18
19
|
const hasPrebuilt = fs.existsSync(path.join(distClientPath, 'main.js'))
|
|
19
20
|
|
|
21
|
+
// Common remark plugins
|
|
22
|
+
const commonRemarkPlugins = [
|
|
23
|
+
remarkGfm,
|
|
24
|
+
remarkMath,
|
|
25
|
+
remarkFrontmatter,
|
|
26
|
+
[remarkMdxFrontmatter, { name: 'frontmatter' }],
|
|
27
|
+
]
|
|
28
|
+
|
|
20
29
|
export default defineConfig(({ command }) => {
|
|
21
30
|
// Only use pre-built files for dev server, not production build
|
|
22
31
|
// Pre-built files have externalized React which breaks production bundles
|
|
23
|
-
|
|
32
|
+
// VESLX_DEV=1 forces using src for live reload during development
|
|
33
|
+
const usePrebuilt = command === 'serve' && hasPrebuilt && !process.env.VESLX_DEV
|
|
24
34
|
const clientPath = usePrebuilt ? distClientPath : srcPath
|
|
25
35
|
|
|
26
36
|
return {
|
|
@@ -29,20 +39,29 @@ export default defineConfig(({ command }) => {
|
|
|
29
39
|
publicDir: path.join(__dirname, 'public'),
|
|
30
40
|
plugins: [
|
|
31
41
|
tailwindcss(),
|
|
32
|
-
// MDX
|
|
42
|
+
// MDX for slides - splits at --- into <Slide> components
|
|
33
43
|
{
|
|
34
44
|
enforce: 'pre',
|
|
35
45
|
...mdx({
|
|
46
|
+
include: /SLIDES\.mdx$/,
|
|
36
47
|
remarkPlugins: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
remarkFrontmatter,
|
|
40
|
-
[remarkMdxFrontmatter, { name: 'frontmatter' }],
|
|
48
|
+
...commonRemarkPlugins,
|
|
49
|
+
remarkSlides, // Transform --- into <Slide> wrappers
|
|
41
50
|
],
|
|
42
51
|
rehypePlugins: [rehypeKatex],
|
|
43
52
|
providerImportSource: '@mdx-js/react',
|
|
44
53
|
}),
|
|
45
54
|
},
|
|
55
|
+
// MDX for regular posts
|
|
56
|
+
{
|
|
57
|
+
enforce: 'pre',
|
|
58
|
+
...mdx({
|
|
59
|
+
exclude: /SLIDES\.mdx$/,
|
|
60
|
+
remarkPlugins: commonRemarkPlugins,
|
|
61
|
+
rehypePlugins: [rehypeKatex],
|
|
62
|
+
providerImportSource: '@mdx-js/react',
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
46
65
|
react({ include: /\.(jsx|js|mdx|md|tsx|ts)$/ }),
|
|
47
66
|
],
|
|
48
67
|
resolve: {
|