@umami/shiso 0.55.0 → 1.0.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 (104) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +9 -49
  3. package/bin/shiso.mjs +132 -0
  4. package/docs.schema.json +896 -0
  5. package/mdx.config.ts +143 -0
  6. package/package.json +74 -83
  7. package/scripts/check-package.mjs +54 -0
  8. package/scripts/generate-icon-registry.mjs +196 -0
  9. package/scripts/generate-last-modified.mjs +128 -0
  10. package/scripts/generate-search-index.mjs +298 -0
  11. package/scripts/lib/mdast.mjs +23 -0
  12. package/scripts/lib/slug.mjs +21 -0
  13. package/scripts/load-docs-config.mjs +244 -0
  14. package/scripts/prerender.mjs +194 -0
  15. package/scripts/validate-config.mjs +104 -0
  16. package/scripts/vite-docs-config.mjs +60 -0
  17. package/src/App.tsx +38 -0
  18. package/src/components/Banner.tsx +69 -0
  19. package/src/components/CodeBlock.tsx +46 -0
  20. package/src/components/ConfiguredIcon.tsx +15 -0
  21. package/src/components/ContextualMenu.tsx +93 -0
  22. package/src/components/DocContent.tsx +105 -0
  23. package/src/components/Docs.tsx +134 -0
  24. package/src/components/Footer.tsx +81 -0
  25. package/src/components/Header.tsx +82 -0
  26. package/src/components/LanguageSwitcher.tsx +59 -0
  27. package/src/components/Layout.tsx +24 -0
  28. package/src/components/PageLinks.tsx +71 -0
  29. package/src/components/Search.tsx +217 -0
  30. package/src/components/SideNav.tsx +347 -0
  31. package/src/components/SocialIcon.tsx +88 -0
  32. package/src/components/ThemeToggle.tsx +34 -0
  33. package/src/components/TopNav.tsx +127 -0
  34. package/src/components/VersionSwitcher.tsx +60 -0
  35. package/src/components/docs/Accordion.tsx +68 -0
  36. package/src/components/docs/Badge.tsx +171 -0
  37. package/src/components/docs/Callout.tsx +73 -0
  38. package/src/components/docs/Card.tsx +158 -0
  39. package/src/components/docs/CodeGroup.tsx +73 -0
  40. package/src/components/docs/Columns.tsx +20 -0
  41. package/src/components/docs/Expandable.tsx +28 -0
  42. package/src/components/docs/Frame.tsx +56 -0
  43. package/src/components/docs/Icon.tsx +30 -0
  44. package/src/components/docs/ParamField.tsx +45 -0
  45. package/src/components/docs/PropertiesTable.tsx +84 -0
  46. package/src/components/docs/ResponseField.tsx +36 -0
  47. package/src/components/docs/Steps.tsx +47 -0
  48. package/src/components/docs/Tabs.tsx +116 -0
  49. package/src/components/docs/Tooltip.tsx +21 -0
  50. package/src/components/docs/index.ts +15 -0
  51. package/src/components/docs/styles.ts +82 -0
  52. package/src/components/docs/utils.ts +118 -0
  53. package/src/components/icons/index.ts +17 -0
  54. package/src/components/ui/accordion.tsx +69 -0
  55. package/src/components/ui/alert.tsx +69 -0
  56. package/src/components/ui/badge.tsx +49 -0
  57. package/src/components/ui/button.tsx +58 -0
  58. package/src/components/ui/card.tsx +88 -0
  59. package/src/components/ui/collapsible.tsx +15 -0
  60. package/src/components/ui/command.tsx +173 -0
  61. package/src/components/ui/dialog.tsx +137 -0
  62. package/src/components/ui/dropdown-menu.tsx +257 -0
  63. package/src/components/ui/scroll-area.tsx +71 -0
  64. package/src/components/ui/sheet.tsx +124 -0
  65. package/src/components/ui/tabs.tsx +73 -0
  66. package/src/components/ui/tooltip.tsx +52 -0
  67. package/src/declarations.d.ts +9 -0
  68. package/src/entry-client.tsx +17 -0
  69. package/src/entry-server.tsx +89 -0
  70. package/src/generated/last-modified.ts +2 -0
  71. package/src/lib/content.ts +44 -0
  72. package/src/lib/docs-config.ts +986 -0
  73. package/src/lib/head.ts +231 -0
  74. package/src/lib/icon-registry.generated.ts +4 -0
  75. package/src/lib/icons.ts +29 -0
  76. package/src/lib/inline-markdown.tsx +86 -0
  77. package/src/lib/locale.ts +39 -0
  78. package/src/lib/mdast.ts +56 -0
  79. package/src/lib/paths.ts +86 -0
  80. package/src/lib/remark-toc.ts +71 -0
  81. package/src/lib/search/config.ts +43 -0
  82. package/src/lib/search/provider.ts +85 -0
  83. package/src/lib/search/providers/local.ts +15 -0
  84. package/src/lib/search-index.generated.ts +4 -0
  85. package/src/lib/search.ts +128 -0
  86. package/src/lib/site-config.ts +117 -0
  87. package/src/lib/site-model.ts +221 -0
  88. package/src/lib/slug.ts +38 -0
  89. package/src/lib/types.ts +515 -0
  90. package/src/lib/utils.ts +6 -0
  91. package/src/pages/DocPage.tsx +33 -0
  92. package/src/styles/global.css +268 -0
  93. package/src/styles/tokens.css +114 -0
  94. package/types/client.d.ts +3 -0
  95. package/types/search.d.ts +27 -0
  96. package/vite.config.ts +342 -0
  97. package/LICENSE +0 -21
  98. package/dist/index.css +0 -189
  99. package/dist/index.d.ts +0 -57
  100. package/dist/index.js +0 -464
  101. package/dist/index.mjs +0 -437
  102. package/server/index.d.ts +0 -30
  103. package/server/index.js +0 -189
  104. package/styles.css +0 -4766
package/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@umami/shiso` are documented here. This project follows
4
+ [Semantic Versioning](https://semver.org/).
5
+
6
+ ## 1.0.0 - 2026-08-15
7
+
8
+ ### Added
9
+
10
+ - Full multi-version and multi-language navigation, including versions nested
11
+ inside languages and responsive header selectors.
12
+ - Per-scope prerendering, Markdown export, sitemap metadata, document locale,
13
+ text direction, and local search results.
14
+ - A multi-scope integration fixture covering visible and hidden pages,
15
+ versions, languages, redirects, search, and sitemap output.
16
+ - Public exports for the bundled `docs.json` schema.
17
+
18
+ ### Changed
19
+
20
+ - Navigation containers now require exactly one non-empty navigation mode, and
21
+ default to the first visible version or language when none is marked.
22
+ - Hidden versions and languages remain buildable and directly reachable while
23
+ staying out of selectors and search.
24
+ - Redirect sources are exact paths; wildcard and parameter patterns are
25
+ rejected during configuration validation.
26
+ - Supported Node.js versions now match Vite: `^20.19.0 || >=22.12.0`.
27
+
28
+ ### Fixed
29
+
30
+ - Client-side navigation now updates page metadata, document language, and
31
+ left-to-right or right-to-left text direction.
32
+
33
+ ## 0.61.0 - 2026-08-13
34
+
35
+ ### Added
36
+
37
+ - Initial package release of the upgradeable Shiso framework.
38
+ - Framework-owned development, validation, build, preview, and prerender commands.
39
+ - Project-local generated caches for search, icons, and last-modified metadata.
package/README.md CHANGED
@@ -1,55 +1,15 @@
1
1
  # Shiso
2
2
 
3
- A content layer for [Next.js](https://nextjs.org/).
3
+ Shiso is an open-source documentation framework for Markdown and MDX sites.
4
4
 
5
- [Learn more](https://shiso.umami.is)
5
+ Create a project with `pnpm create shiso-app@latest`, then use the framework
6
+ commands from that project:
6
7
 
7
- ## Usage
8
-
9
- ### 1. Install the package
10
-
11
- ```shell
12
- npm install @umami/shiso
13
- ```
14
-
15
- ### 2. Create page
16
-
17
- In your `app` folder, create a folder for the content section you wish to add. In this case we are creating a section for `docs`.
18
-
19
- ```text
20
- src
21
- ├── app
22
- │ └── docs
23
- │ └── [[...slug]]
24
- │ └── page.jsx
25
- ```
26
-
27
- In the `page.jsx` file, add the following code:
28
-
29
- ```javascript
30
- import { Shiso } from '@umami/shiso';
31
- import { getContent, getContentIds } from '@@umami/shiso/server';
32
- import config from 'path/to/shiso.config.json';
33
-
34
- export async function generateStaticParams() {
35
- const ids = await getContentIds('./src/content/docs');
36
-
37
- return ids.map((id: string) => ({
38
- id: id.split('/')
39
- }));
40
- }
41
-
42
- export default async function Page({ params }: { params: Promise<{ id: string[] }> }) {
43
- const content = await getContent(await params, './src/content/docs');
44
-
45
- return <Shiso type="docs" content={content} config={config} />;
46
- }
8
+ ```bash
9
+ pnpm dev
10
+ pnpm build
11
+ pnpm preview
12
+ pnpm check
47
13
  ```
48
14
 
49
- ### 3. Write content
50
-
51
- In the folder you specified, start adding `.mdx` files.
52
-
53
- ## License
54
-
55
- MIT
15
+ Upgrade an existing project with `pnpm update @umami/shiso`.
package/bin/shiso.mjs ADDED
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+ import fs from 'node:fs/promises';
5
+ import path from 'node:path';
6
+ import process from 'node:process';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { validateProject } from '../scripts/validate-config.mjs';
9
+
10
+ const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
11
+ const VITE_CONFIG = path.join(PACKAGE_ROOT, 'vite.config.ts');
12
+ const VITE_BIN = path.join(
13
+ path.dirname(fileURLToPath(import.meta.resolve('vite/package.json'))),
14
+ 'bin/vite.js',
15
+ );
16
+ const SSR_ENTRY = path.join(PACKAGE_ROOT, 'src/entry-server.tsx');
17
+
18
+ const HELP = `
19
+ Usage: shiso <command> [options]
20
+
21
+ Commands:
22
+ dev Start the development server
23
+ build Validate and build the static site
24
+ preview Preview the production build
25
+ check Validate docs.json
26
+
27
+ Options after dev, build, or preview are passed to Vite.
28
+ `;
29
+
30
+ function run(command, args, cwd) {
31
+ const result = spawnSync(command, args, {
32
+ cwd,
33
+ env: process.env,
34
+ stdio: 'inherit',
35
+ });
36
+
37
+ if (result.error) {
38
+ throw result.error;
39
+ }
40
+
41
+ if (result.status !== 0) {
42
+ process.exit(result.status ?? 1);
43
+ }
44
+ }
45
+
46
+ async function check(projectRoot) {
47
+ const result = await validateProject({ root: projectRoot });
48
+
49
+ if (!result.valid) {
50
+ console.error('docs.json failed schema validation:\n');
51
+ for (const error of result.errors) {
52
+ console.error(` ${error}`);
53
+ }
54
+ process.exit(1);
55
+ }
56
+
57
+ console.log('docs.json is valid.');
58
+ }
59
+
60
+ async function main() {
61
+ const [command, ...options] = process.argv.slice(2);
62
+ const projectRoot = process.cwd();
63
+
64
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
65
+ console.log(HELP.trim());
66
+ return;
67
+ }
68
+
69
+ if (command === '--version' || command === '-v') {
70
+ const metadata = JSON.parse(await fs.readFile(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
71
+ console.log(metadata.version);
72
+ return;
73
+ }
74
+
75
+ if (command === 'check') {
76
+ await check(projectRoot);
77
+ return;
78
+ }
79
+
80
+ if (!['dev', 'build', 'preview'].includes(command)) {
81
+ throw new Error(`Unknown command "${command}". Run shiso --help for usage.`);
82
+ }
83
+
84
+ if (command === 'build') {
85
+ await check(projectRoot);
86
+ run(
87
+ process.execPath,
88
+ [
89
+ VITE_BIN,
90
+ 'build',
91
+ projectRoot,
92
+ '--config',
93
+ VITE_CONFIG,
94
+ ...options,
95
+ '--outDir',
96
+ 'dist/client',
97
+ '--emptyOutDir',
98
+ ],
99
+ projectRoot,
100
+ );
101
+ run(
102
+ process.execPath,
103
+ [
104
+ VITE_BIN,
105
+ 'build',
106
+ projectRoot,
107
+ '--config',
108
+ VITE_CONFIG,
109
+ ...options,
110
+ '--ssr',
111
+ SSR_ENTRY,
112
+ '--outDir',
113
+ 'dist/server',
114
+ '--emptyOutDir',
115
+ ],
116
+ projectRoot,
117
+ );
118
+ run(process.execPath, [path.join(PACKAGE_ROOT, 'scripts/prerender.mjs')], projectRoot);
119
+ return;
120
+ }
121
+
122
+ run(
123
+ process.execPath,
124
+ [VITE_BIN, command, projectRoot, '--config', VITE_CONFIG, ...options],
125
+ projectRoot,
126
+ );
127
+ }
128
+
129
+ main().catch(error => {
130
+ console.error(`\nError: ${error.message}\n`);
131
+ process.exitCode = 1;
132
+ });