@umami/shiso 0.55.0 → 0.61.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.
- package/CHANGELOG.md +12 -0
- package/README.md +9 -49
- package/bin/shiso.mjs +132 -0
- package/docs.schema.json +835 -0
- package/mdx.config.ts +143 -0
- package/package.json +73 -83
- package/scripts/check-package.mjs +18 -0
- package/scripts/generate-icon-registry.mjs +196 -0
- package/scripts/generate-last-modified.mjs +128 -0
- package/scripts/generate-search-index.mjs +252 -0
- package/scripts/load-docs-config.mjs +244 -0
- package/scripts/prerender.mjs +187 -0
- package/scripts/validate-config.mjs +104 -0
- package/scripts/vite-docs-config.mjs +60 -0
- package/src/App.tsx +39 -0
- package/src/components/Banner.tsx +69 -0
- package/src/components/CodeBlock.tsx +46 -0
- package/src/components/ConfiguredIcon.tsx +15 -0
- package/src/components/ContextualMenu.tsx +93 -0
- package/src/components/DocContent.tsx +100 -0
- package/src/components/Docs.tsx +126 -0
- package/src/components/Footer.tsx +84 -0
- package/src/components/Header.tsx +72 -0
- package/src/components/Layout.tsx +16 -0
- package/src/components/PageLinks.tsx +71 -0
- package/src/components/Search.tsx +208 -0
- package/src/components/SideNav.tsx +347 -0
- package/src/components/SocialIcon.tsx +88 -0
- package/src/components/ThemeToggle.tsx +34 -0
- package/src/components/TopNav.tsx +127 -0
- package/src/components/docs/Accordion.tsx +68 -0
- package/src/components/docs/Badge.tsx +171 -0
- package/src/components/docs/Callout.tsx +73 -0
- package/src/components/docs/Card.tsx +158 -0
- package/src/components/docs/CodeGroup.tsx +73 -0
- package/src/components/docs/Columns.tsx +20 -0
- package/src/components/docs/Expandable.tsx +28 -0
- package/src/components/docs/Frame.tsx +56 -0
- package/src/components/docs/Icon.tsx +30 -0
- package/src/components/docs/ParamField.tsx +45 -0
- package/src/components/docs/PropertiesTable.tsx +84 -0
- package/src/components/docs/ResponseField.tsx +36 -0
- package/src/components/docs/Steps.tsx +47 -0
- package/src/components/docs/Tabs.tsx +116 -0
- package/src/components/docs/Tooltip.tsx +21 -0
- package/src/components/docs/index.ts +15 -0
- package/src/components/docs/styles.ts +82 -0
- package/src/components/docs/utils.ts +118 -0
- package/src/components/icons/index.ts +17 -0
- package/src/components/ui/accordion.tsx +69 -0
- package/src/components/ui/alert.tsx +69 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +88 -0
- package/src/components/ui/collapsible.tsx +15 -0
- package/src/components/ui/command.tsx +173 -0
- package/src/components/ui/dialog.tsx +137 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/scroll-area.tsx +71 -0
- package/src/components/ui/sheet.tsx +124 -0
- package/src/components/ui/tabs.tsx +73 -0
- package/src/components/ui/tooltip.tsx +52 -0
- package/src/declarations.d.ts +9 -0
- package/src/entry-client.tsx +17 -0
- package/src/entry-server.tsx +77 -0
- package/src/generated/last-modified.ts +2 -0
- package/src/lib/content.ts +44 -0
- package/src/lib/docs-config.ts +682 -0
- package/src/lib/head.ts +220 -0
- package/src/lib/icon-registry.generated.ts +4 -0
- package/src/lib/icons.ts +29 -0
- package/src/lib/inline-markdown.tsx +86 -0
- package/src/lib/mdast.ts +56 -0
- package/src/lib/paths.ts +86 -0
- package/src/lib/remark-toc.ts +71 -0
- package/src/lib/search/config.ts +43 -0
- package/src/lib/search/provider.ts +80 -0
- package/src/lib/search/providers/local.ts +15 -0
- package/src/lib/search-index.generated.ts +4 -0
- package/src/lib/search.ts +100 -0
- package/src/lib/site-config.ts +104 -0
- package/src/lib/site-model.ts +221 -0
- package/src/lib/slug.ts +38 -0
- package/src/lib/types.ts +478 -0
- package/src/lib/utils.ts +6 -0
- package/src/pages/DocPage.tsx +33 -0
- package/src/styles/global.css +268 -0
- package/src/styles/tokens.css +114 -0
- package/types/client.d.ts +3 -0
- package/types/search.d.ts +17 -0
- package/vite.config.ts +342 -0
- package/LICENSE +0 -21
- package/dist/index.css +0 -189
- package/dist/index.d.ts +0 -57
- package/dist/index.js +0 -464
- package/dist/index.mjs +0 -437
- package/server/index.d.ts +0 -30
- package/server/index.js +0 -189
- package/styles.css +0 -4766
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@umami/shiso` are documented here. This project follows
|
|
4
|
+
[Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## 0.61.0 - 2026-08-13
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- Initial package release of the upgradeable Shiso framework.
|
|
11
|
+
- Framework-owned development, validation, build, preview, and prerender commands.
|
|
12
|
+
- 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
|
-
|
|
3
|
+
Shiso is an open-source documentation framework for Markdown and MDX sites.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Create a project with `pnpm create shiso-app@latest`, then use the framework
|
|
6
|
+
commands from that project:
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
+
});
|