polen 0.8.2-next.1 → 0.9.0-next.3
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/build/api/vite/logger.d.ts +2 -1
- package/build/api/vite/logger.d.ts.map +1 -1
- package/build/api/vite/logger.js +23 -19
- package/build/api/vite/logger.js.map +1 -1
- package/build/api/vite/plugins/core.js +4 -4
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/{pages-tree.d.ts → pages.d.ts} +2 -2
- package/build/api/vite/plugins/pages.d.ts.map +1 -0
- package/build/api/vite/plugins/{pages-tree.js → pages.js} +6 -5
- package/build/api/vite/plugins/pages.js.map +1 -0
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +40 -7
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts.map +1 -1
- package/build/lib/file-router/sidebar/sidebar-tree.js +13 -13
- package/build/lib/file-router/sidebar/sidebar-tree.js.map +1 -1
- package/build/lib/file-router/sidebar/types.d.ts +2 -2
- package/build/lib/file-router/sidebar/types.d.ts.map +1 -1
- package/build/lib/kit-temp.d.ts +6 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +30 -0
- package/build/lib/kit-temp.js.map +1 -1
- package/build/template/components/Link.d.ts +7 -1
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.jsx +33 -5
- package/build/template/components/Link.jsx.map +1 -1
- package/build/template/components/Texts/MinorHeading.d.ts +4 -0
- package/build/template/components/Texts/MinorHeading.d.ts.map +1 -0
- package/build/template/components/Texts/MinorHeading.jsx +11 -0
- package/build/template/components/Texts/MinorHeading.jsx.map +1 -0
- package/build/template/components/Texts/index.d.ts +2 -0
- package/build/template/components/Texts/index.d.ts.map +1 -0
- package/build/template/components/Texts/index.js +2 -0
- package/build/template/components/Texts/index.js.map +1 -0
- package/build/template/components/Texts/texts.d.ts +2 -0
- package/build/template/components/Texts/texts.d.ts.map +1 -0
- package/build/template/components/Texts/texts.js +2 -0
- package/build/template/components/Texts/texts.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -0
- package/build/template/components/sidebar/Sidebar.jsx +15 -0
- package/build/template/components/sidebar/Sidebar.jsx.map +1 -0
- package/build/template/components/sidebar/SidebarItem.d.ts +9 -0
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -0
- package/build/template/components/sidebar/SidebarItem.jsx +94 -0
- package/build/template/components/sidebar/SidebarItem.jsx.map +1 -0
- package/build/template/components/sidebar/ToggleButton.d.ts +5 -0
- package/build/template/components/sidebar/ToggleButton.d.ts.map +1 -0
- package/build/template/components/sidebar/ToggleButton.jsx +6 -0
- package/build/template/components/sidebar/ToggleButton.jsx.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.jsx +1 -1
- package/build/template/routes/root.jsx.map +1 -1
- package/package.json +16 -1
- package/src/api/vite/logger.ts +26 -21
- package/src/api/vite/plugins/core.ts +4 -4
- package/src/api/vite/plugins/{pages-tree.ts → pages.ts} +5 -4
- package/src/api/vite/plugins/serve.ts +42 -9
- package/src/lib/file-router/sidebar/sidebar-tree.test.ts +6 -6
- package/src/lib/file-router/sidebar/sidebar-tree.ts +14 -14
- package/src/lib/file-router/sidebar/types.ts +2 -2
- package/src/lib/kit-temp.ts +36 -0
- package/src/template/components/Link.tsx +53 -6
- package/src/template/components/Texts/MinorHeading.tsx +18 -0
- package/src/template/components/Texts/index.ts +1 -0
- package/src/template/components/Texts/texts.ts +1 -0
- package/src/template/components/sidebar/Sidebar.tsx +26 -0
- package/src/template/components/sidebar/SidebarItem.tsx +156 -0
- package/src/template/components/sidebar/ToggleButton.tsx +12 -0
- package/src/template/routes/root.tsx +1 -2
- package/build/api/vite/plugins/pages-tree.d.ts.map +0 -1
- package/build/api/vite/plugins/pages-tree.js.map +0 -1
- package/build/template/components/Sidebar.d.ts.map +0 -1
- package/build/template/components/Sidebar.jsx +0 -115
- package/build/template/components/Sidebar.jsx.map +0 -1
- package/src/template/components/Sidebar.tsx +0 -194
- /package/build/template/components/{Sidebar.d.ts → sidebar/Sidebar.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/template/components/Texts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"texts.d.ts","sourceRoot":"","sources":["../../../../src/template/components/Texts/texts.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"texts.js","sourceRoot":"","sources":["../../../../src/template/components/Texts/texts.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/template/components/sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD,UAAU,YAAY;IACpB,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;CACjC;AAED,eAAO,MAAM,OAAO,GAAI,WAAW,YAAY,gCAiB9C,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Box } from '@radix-ui/themes';
|
2
|
+
import { Items } from "./SidebarItem.jsx";
|
3
|
+
export const Sidebar = ({ items }) => {
|
4
|
+
return (<Box data-testid='sidebar' role='Sidebar' flexShrink='0'>
|
5
|
+
<style>
|
6
|
+
{`
|
7
|
+
div[role="Sidebar"] a:not([data-active]):hover {
|
8
|
+
background-color: var(--iris-2) !important;
|
9
|
+
}
|
10
|
+
`}
|
11
|
+
</style>
|
12
|
+
<Items items={items}/>
|
13
|
+
</Box>);
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=Sidebar.jsx.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sidebar.jsx","sourceRoot":"","sources":["../../../../src/template/components/sidebar/Sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAMzC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,KAAK,EAAgB,EAAE,EAAE;IACjD,OAAO,CACL,CAAC,GAAG,CACF,WAAW,CAAC,SAAS,CACrB,IAAI,CAAC,SAAS,CACd,UAAU,CAAC,GAAG,CAEd;MAAA,CAAC,KAAK,CACJ;QAAA,CAAC;;;;SAIA,CACH;MAAA,EAAE,KAAK,CACP;MAAA,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EACtB;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { React } from '#dep/react/index';
|
2
|
+
import type { FileRouter } from '#lib/file-router/index';
|
3
|
+
export declare const Items: React.FC<{
|
4
|
+
items: FileRouter.Sidebar.Item[];
|
5
|
+
}>;
|
6
|
+
export declare const Item: React.FC<{
|
7
|
+
item: FileRouter.Sidebar.Item;
|
8
|
+
}>;
|
9
|
+
//# sourceMappingURL=SidebarItem.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SidebarItem.d.ts","sourceRoot":"","sources":["../../../../src/template/components/sidebar/SidebarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAMxD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;CAAE,CAWhE,CAAA;AAUD,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAA;CAAE,CAU5D,CAAA"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import { Texts } from '#template/components/Texts/index';
|
2
|
+
import { Box, Flex, Text } from '@radix-ui/themes';
|
3
|
+
import { useLocation } from 'react-router';
|
4
|
+
import { getPathActiveReport, Link } from "../Link.jsx";
|
5
|
+
export const Items = ({ items }) => {
|
6
|
+
return (<Flex direction='column' gap='2px'>
|
7
|
+
{items.map((item) => (<Item key={item.pathExp} item={item}/>))}
|
8
|
+
</Flex>);
|
9
|
+
};
|
10
|
+
//
|
11
|
+
//
|
12
|
+
//
|
13
|
+
//
|
14
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • SidebarItem
|
15
|
+
//
|
16
|
+
//
|
17
|
+
export const Item = ({ item }) => {
|
18
|
+
if (item.type === `ItemLink`) {
|
19
|
+
return <SBLink link={item}/>;
|
20
|
+
}
|
21
|
+
if (item.type === 'ItemSection' && item.isLinkToo) {
|
22
|
+
return <LinkedSection section={item}/>;
|
23
|
+
}
|
24
|
+
return <Section section={item}/>;
|
25
|
+
};
|
26
|
+
//
|
27
|
+
//
|
28
|
+
//
|
29
|
+
//
|
30
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • SidebarItemLink
|
31
|
+
//
|
32
|
+
//
|
33
|
+
const SBLink = ({ link }) => {
|
34
|
+
const location = useLocation();
|
35
|
+
const currentPathExp = location.pathname;
|
36
|
+
const active = getPathActiveReport(link.pathExp, currentPathExp);
|
37
|
+
return (<Link role='Sidebar Link' color={active.is ? `iris` : `gray`} data-testid={`sidebar-link-${link.pathExp}`} to={`/${link.pathExp}`} style={{
|
38
|
+
display: `block`,
|
39
|
+
textDecoration: `none`,
|
40
|
+
color: active.is ? `var(--accent-12)` : undefined,
|
41
|
+
backgroundColor: active.isDirect ? `var(--accent-2)` : active.isdescendant ? `var(--accent-1)` : `transparent`,
|
42
|
+
borderRadius: `var(--radius-2)`,
|
43
|
+
}}>
|
44
|
+
<Box py='2' px='4'>{link.title}</Box>
|
45
|
+
</Link>);
|
46
|
+
};
|
47
|
+
//
|
48
|
+
//
|
49
|
+
//
|
50
|
+
//
|
51
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Section
|
52
|
+
//
|
53
|
+
//
|
54
|
+
const Section = ({ section }) => {
|
55
|
+
return (<Box mt='8'>
|
56
|
+
<Box ml='4' mb='2'>
|
57
|
+
<Texts.MinorHeading color='gray'>
|
58
|
+
{section.title}
|
59
|
+
</Texts.MinorHeading>
|
60
|
+
</Box>
|
61
|
+
<Items items={section.links}/>
|
62
|
+
</Box>);
|
63
|
+
};
|
64
|
+
//
|
65
|
+
//
|
66
|
+
//
|
67
|
+
//
|
68
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • LinkedSection
|
69
|
+
//
|
70
|
+
//
|
71
|
+
const LinkedSection = ({ section }) => {
|
72
|
+
return (<Box>
|
73
|
+
<SBLink link={section}/>
|
74
|
+
{<Flex direction='column' gap='2' id={`section-${section.pathExp.replace(/\//g, '-')}`} role='group' ml='5' py='2px' style={{
|
75
|
+
borderLeft: `1px solid var(--gray-5)`,
|
76
|
+
}}>
|
77
|
+
{section.links.map((link) => (<SectionLink key={link.pathExp} link={link}/>))}
|
78
|
+
</Flex>}
|
79
|
+
</Box>);
|
80
|
+
};
|
81
|
+
const SectionLink = ({ link }) => {
|
82
|
+
const location = useLocation();
|
83
|
+
const active = getPathActiveReport(link.pathExp, location.pathname);
|
84
|
+
return (<Link role='Sidebar Link' to={'/' + link.pathExp} color={active.is ? `iris` : `gray`} style={{
|
85
|
+
textDecoration: `none`,
|
86
|
+
color: active.is ? `var(--accent-12)` : undefined,
|
87
|
+
backgroundColor: active.isDirect ? `var(--accent-2)` : active.isdescendant ? `var(--accent-1)` : `transparent`,
|
88
|
+
borderBottomRightRadius: `var(--radius-2)`,
|
89
|
+
borderTopRightRadius: `var(--radius-2)`,
|
90
|
+
}}>
|
91
|
+
<Box py='2' px='4'>{link.title}</Box>
|
92
|
+
</Link>);
|
93
|
+
};
|
94
|
+
//# sourceMappingURL=SidebarItem.jsx.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SidebarItem.jsx","sourceRoot":"","sources":["../../../../src/template/components/sidebar/SidebarItem.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,CAAC,MAAM,KAAK,GAAmD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChC;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,CAAC,IAAI,CACH,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAClB,IAAI,CAAC,CAAC,IAAI,CAAC,EACX,CACH,CAAC,CACJ;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,EAAE;AAEF,MAAM,CAAC,MAAM,IAAI,GAAgD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5E,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;Q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AAC,EAAE,GAAG,CACtC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ToggleButton.d.ts","sourceRoot":"","sources":["../../../../src/template/components/sidebar/ToggleButton.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,gCAAgC;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,IAAI,CAAA;CAAE,gCAQ/G,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { ChevronDownIcon, ChevronRightIcon } from '@radix-ui/react-icons';
|
2
|
+
import { Button } from '@radix-ui/themes';
|
3
|
+
export const ToggleButton = ({ isExpanded, toggleExpanded }) => (<Button variant='ghost' onClick={toggleExpanded} aria-expanded={isExpanded}>
|
4
|
+
{isExpanded ? <ChevronDownIcon /> : <ChevronRightIcon />}
|
5
|
+
</Button>);
|
6
|
+
//# sourceMappingURL=ToggleButton.jsx.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ToggleButton.jsx","sourceRoot":"","sources":["../../../../src/template/components/sidebar/ToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,UAAU,EAAE,cAAc,EAAuD,EAAE,EAAE,CAAC,CACnH,CAAC,MAAM,CACL,OAAO,CAAC,OAAO,CACf,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,aAAa,CAAC,CAAC,UAAU,CAAC,CAE1B;IAAA,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,AAAD,EAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,AAAD,EAAG,CAC1D;EAAA,EAAE,MAAM,CAAC,CACV,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AA4B1D,eAAO,MAAM,SAAS,mCA6BrB,CAAA;
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AA4B1D,eAAO,MAAM,SAAS,mCA6BrB,CAAA;AA4ID,eAAO,MAAM,IAAI;;;;CAIf,CAAA"}
|
@@ -10,7 +10,7 @@ import { PROJECT_DATA } from 'virtual:polen/project/data';
|
|
10
10
|
import { pages } from 'virtual:polen/project/pages.jsx';
|
11
11
|
import { templateVariables } from 'virtual:polen/template/variables';
|
12
12
|
import { Link } from '../components/Link.jsx';
|
13
|
-
import { Sidebar } from
|
13
|
+
import { Sidebar } from "../components/sidebar/Sidebar.jsx";
|
14
14
|
import entryClientUrl from '../entry.client.jsx?url';
|
15
15
|
import { changelog } from './changelog.jsx';
|
16
16
|
import { index } from './index.jsx';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"root.jsx","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MA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CAChD;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CACzB;;QACF,EAAE,IAAI,CACR;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CACX;QAAA,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,CACrB;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAC7B;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,eAAe,CACjB;QAAA,CAAC,eAAe,CAAC,EAAE,CAAC,YAAY,CAC9B;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAChC;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,eAAe,CACnB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,WAAW,CAAC;IAChC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE;QACN,UAAU,EAAE,GAAG;KAChB;CACF,CAAC,CAAA;AACF,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAE5B,EAAE;AACF,EAAE;AACF,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,EAAE;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,GAAG;IACT,SAAS;IACT,QAAQ;CACT,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.0-next.3",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -24,6 +24,18 @@
|
|
24
24
|
"type": "git",
|
25
25
|
"url": "git+https://github.com/the-guild-org/polen.git"
|
26
26
|
},
|
27
|
+
"devEngines": {
|
28
|
+
"runtime": {
|
29
|
+
"name": "node",
|
30
|
+
"version": ">=24.0.0",
|
31
|
+
"onFail": "error"
|
32
|
+
},
|
33
|
+
"packageManager": {
|
34
|
+
"name": "pnpm",
|
35
|
+
"version": ">=10.0.0",
|
36
|
+
"onFail": "error"
|
37
|
+
}
|
38
|
+
},
|
27
39
|
"imports": {
|
28
40
|
"#*": {
|
29
41
|
"source": "./src/*.ts",
|
@@ -79,6 +91,7 @@
|
|
79
91
|
"@wollybeard/kit": "^0.35.0",
|
80
92
|
"@wollybeard/projector": "^0.2.0",
|
81
93
|
"ansis": "^4.1.0",
|
94
|
+
"clean-stack": "^5.2.0",
|
82
95
|
"consola": "^3.4.2",
|
83
96
|
"defu": "^6.1.4",
|
84
97
|
"es-toolkit": "^1.39.3",
|
@@ -105,6 +118,7 @@
|
|
105
118
|
"vite": "npm:rolldown-vite@~6.3.18",
|
106
119
|
"vite-plugin-inspect": "^11.1.0",
|
107
120
|
"vite-plugin-restart": "^0.4.2",
|
121
|
+
"youch-core": "^0.3.2",
|
108
122
|
"zx": "8.5.5"
|
109
123
|
},
|
110
124
|
"devDependencies": {
|
@@ -154,6 +168,7 @@
|
|
154
168
|
"test:integration": "playwright test --config 'tests/playwright.config.ts' --project=integration",
|
155
169
|
"test:unit": "vitest",
|
156
170
|
"dev": "pnpm build:watch:emit",
|
171
|
+
"dev:pokemon": "pnpm polen dev --project examples/pokemon",
|
157
172
|
"build:clean": "pnpm tsc --build tsconfig.build.json --clean && rm -rf build",
|
158
173
|
"build": "tsc --build tsconfig.build.json",
|
159
174
|
"build:watch": "tsc --build tsconfig.build.json --watch",
|
package/src/api/vite/logger.ts
CHANGED
@@ -1,28 +1,33 @@
|
|
1
|
+
import type { Config } from '#api/api'
|
1
2
|
import { Vite } from '#dep/vite/index'
|
2
3
|
import { Err, Str } from '@wollybeard/kit'
|
3
4
|
import { stripAnsi } from 'consola/utils'
|
4
5
|
|
5
6
|
const baseLogger = Vite.createLogger(undefined)
|
6
7
|
|
7
|
-
export const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
8
|
+
export const createLogger = (config: Config.Config): Vite.Logger => {
|
9
|
+
return {
|
10
|
+
...baseLogger,
|
11
|
+
info(msg, options) {
|
12
|
+
// Filter out optimization-related messages
|
13
|
+
const msgString = typeof msg === 'string' ? msg : String(msg)
|
14
|
+
if (
|
15
|
+
msgString.includes('new dependencies optimized')
|
16
|
+
|| msgString.includes('optimized dependencies changed')
|
17
|
+
|| msgString.includes('Re-optimizing dependencies')
|
18
|
+
|| msgString.includes('Forced re-optimization')
|
19
|
+
) {
|
20
|
+
return
|
21
|
+
}
|
22
|
+
baseLogger.info(msg, options)
|
23
|
+
},
|
24
|
+
error(msg, options) {
|
25
|
+
if (config.advanced.debug) {
|
26
|
+
const firstLine = stripAnsi(Str.lines(msg)[0] ?? `<no message>`)
|
27
|
+
const cause = options?.error
|
28
|
+
const error = new Error(firstLine, { cause })
|
29
|
+
Err.log(error)
|
30
|
+
}
|
31
|
+
},
|
32
|
+
}
|
28
33
|
}
|
@@ -13,9 +13,9 @@ import type { ProjectData, SidebarIndex, SiteNavigationItem } from '../../../pro
|
|
13
13
|
import { superjson } from '../../../singletons/superjson.ts'
|
14
14
|
import { SchemaAugmentation } from '../../schema-augmentation/index.ts'
|
15
15
|
import { Schema } from '../../schema/index.ts'
|
16
|
-
import {
|
16
|
+
import { createLogger } from '../logger.ts'
|
17
17
|
import { polenVirtual } from '../vi.ts'
|
18
|
-
import {
|
18
|
+
import { createPagesPlugin, getRouteTree } from './pages.ts'
|
19
19
|
|
20
20
|
const _debug = debug.sub(`vite-plugin-core`)
|
21
21
|
|
@@ -68,7 +68,7 @@ export const Core = (config: Config.Config): Vite.PluginOption[] => {
|
|
68
68
|
...plugins,
|
69
69
|
|
70
70
|
// Self-contained pages plugin
|
71
|
-
...
|
71
|
+
...createPagesPlugin({
|
72
72
|
config,
|
73
73
|
onPagesChange: (pages) => {
|
74
74
|
currentPagesData = pages
|
@@ -149,7 +149,7 @@ export const Core = (config: Config.Config): Vite.PluginOption[] => {
|
|
149
149
|
__BUILD_ARCHITECTURE__: Json.encode(config.build.architecture),
|
150
150
|
__BUILD_ARCHITECTURE_SSG__: Json.encode(config.build.architecture === `ssg`),
|
151
151
|
},
|
152
|
-
customLogger:
|
152
|
+
customLogger: createLogger(config),
|
153
153
|
esbuild: false,
|
154
154
|
build: {
|
155
155
|
target: `esnext`,
|
@@ -9,7 +9,7 @@ import mdx from '@mdx-js/rollup'
|
|
9
9
|
import { Path, Str } from '@wollybeard/kit'
|
10
10
|
import remarkGfm from 'remark-gfm'
|
11
11
|
|
12
|
-
const _debug = debug.sub(`vite-plugin-pages
|
12
|
+
const _debug = debug.sub(`vite-plugin-pages`)
|
13
13
|
|
14
14
|
export const viProjectPages = polenVirtual([`project`, `pages.jsx`], { allowPluginProcessing: true })
|
15
15
|
|
@@ -22,7 +22,7 @@ export interface PagesTreePluginOptions {
|
|
22
22
|
/**
|
23
23
|
* Pages plugin with tree support
|
24
24
|
*/
|
25
|
-
export const
|
25
|
+
export const createPagesPlugin = (
|
26
26
|
{ config, onPagesChange, onTreeChange }: PagesTreePluginOptions,
|
27
27
|
): Vite.Plugin[] => {
|
28
28
|
// State management
|
@@ -109,17 +109,18 @@ export const createPagesTreePlugin = (
|
|
109
109
|
|
110
110
|
// Plugin 2: Pages Management
|
111
111
|
{
|
112
|
-
name: `polen:pages
|
112
|
+
name: `polen:pages`,
|
113
113
|
|
114
114
|
// Dev server configuration
|
115
115
|
configureServer(server) {
|
116
116
|
// Add pages directory to watcher
|
117
|
-
_debug(`
|
117
|
+
_debug(`configureServer: watch pages directory`, config.paths.project.absolute.pages)
|
118
118
|
server.watcher.add(config.paths.project.absolute.pages)
|
119
119
|
},
|
120
120
|
|
121
121
|
// Hot update handling
|
122
122
|
async handleHotUpdate({ file, server }) {
|
123
|
+
_debug(`handleHotUpdate`, file)
|
123
124
|
if (!isPageFile(file)) return
|
124
125
|
|
125
126
|
_debug(`Page file changed:`, file)
|
@@ -3,7 +3,9 @@ import type { Hono } from '#dep/hono/index'
|
|
3
3
|
import type { Vite } from '#dep/vite/index'
|
4
4
|
import { debug } from '#singletons/debug'
|
5
5
|
import * as HonoNodeServer from '@hono/node-server'
|
6
|
-
import { Err } from '@wollybeard/kit'
|
6
|
+
import { Err, Http } from '@wollybeard/kit'
|
7
|
+
import cleanStack from 'clean-stack'
|
8
|
+
import { ErrorParser } from 'youch-core'
|
7
9
|
|
8
10
|
type App = Hono.Hono
|
9
11
|
|
@@ -14,18 +16,40 @@ interface AppServerModule {
|
|
14
16
|
export const Serve = (
|
15
17
|
config: Config.Config,
|
16
18
|
): Vite.PluginOption => {
|
17
|
-
|
19
|
+
const _debug = debug.sub(`serve`)
|
20
|
+
let appPromise: Promise<App | Error>
|
18
21
|
|
19
|
-
const reloadApp = async ({ server }: { server: Vite.ViteDevServer }): Promise<App> => {
|
20
|
-
|
21
|
-
return
|
22
|
+
const reloadApp = async ({ server }: { server: Vite.ViteDevServer }): Promise<App | Error> => {
|
23
|
+
_debug('reloadApp')
|
24
|
+
return server.ssrLoadModule(config.paths.framework.template.server.app)
|
22
25
|
.then(module => module as AppServerModule)
|
23
26
|
.then(module => module.app)
|
24
|
-
.catch(
|
25
|
-
if (Err.is(
|
26
|
-
|
27
|
+
.catch(async (error) => {
|
28
|
+
if (Err.is(error)) {
|
29
|
+
// ━ Clean Stack Trace
|
30
|
+
server.ssrFixStacktrace(error)
|
31
|
+
const stack = cleanStack(error.stack, {
|
32
|
+
pathFilter: (path) => {
|
33
|
+
return !path.match(/.*rolldown-vite.*/)
|
34
|
+
},
|
35
|
+
basePath: config.paths.project.rootDir,
|
36
|
+
// pretty: true,
|
37
|
+
})
|
38
|
+
error.stack = stack
|
39
|
+
// ━ Log Error
|
40
|
+
Err.log(error)
|
41
|
+
const parser = new ErrorParser()
|
42
|
+
const parsedError = await parser.parse(error)
|
43
|
+
const snippet = parsedError.frames[0]?.source?.map(line => {
|
44
|
+
return line.lineNumber.toString().padStart(4, ' ') + `: ` + line.chunk
|
45
|
+
}).join(`\n`)
|
46
|
+
if (snippet) {
|
47
|
+
console.log('-----------------------------')
|
48
|
+
console.log(snippet)
|
49
|
+
}
|
50
|
+
return error
|
27
51
|
}
|
28
|
-
throw
|
52
|
+
throw error
|
29
53
|
})
|
30
54
|
}
|
31
55
|
|
@@ -49,10 +73,12 @@ export const Serve = (
|
|
49
73
|
}
|
50
74
|
},
|
51
75
|
handleHotUpdate({ server }) {
|
76
|
+
_debug('handleHotUpdate')
|
52
77
|
// Reload app server immediately in the background
|
53
78
|
appPromise = reloadApp({ server })
|
54
79
|
},
|
55
80
|
async configureServer(server) {
|
81
|
+
_debug('configureServer')
|
56
82
|
// Initial load
|
57
83
|
appPromise = reloadApp({ server })
|
58
84
|
|
@@ -69,6 +95,13 @@ export const Serve = (
|
|
69
95
|
void HonoNodeServer.getRequestListener(async request => {
|
70
96
|
// Always await the current app promise
|
71
97
|
const app = await appPromise
|
98
|
+
if (Err.is(app)) {
|
99
|
+
// Err.log(app)
|
100
|
+
return new Response(null, {
|
101
|
+
status: Http.Status.InternalServerError.code,
|
102
|
+
statusText: Http.Status.InternalServerError.description,
|
103
|
+
})
|
104
|
+
}
|
72
105
|
const response = await app.fetch(request, { viteDevServer: server })
|
73
106
|
return response
|
74
107
|
})(req, res)
|
@@ -48,9 +48,9 @@ describe('sidebar-tree', () => {
|
|
48
48
|
type: 'ItemSection',
|
49
49
|
title: 'Guide',
|
50
50
|
pathExp: 'guide',
|
51
|
-
|
51
|
+
isLinkToo: false,
|
52
52
|
})
|
53
|
-
expect(section!.
|
53
|
+
expect(section!.links).toHaveLength(2)
|
54
54
|
}
|
55
55
|
})
|
56
56
|
|
@@ -73,9 +73,9 @@ describe('sidebar-tree', () => {
|
|
73
73
|
type: 'ItemSection',
|
74
74
|
title: 'Guide',
|
75
75
|
pathExp: 'guide',
|
76
|
-
|
76
|
+
isLinkToo: true, // Should be true because of index file
|
77
77
|
})
|
78
|
-
expect(section!.
|
78
|
+
expect(section!.links).toHaveLength(1) // Only introduction, not index
|
79
79
|
}
|
80
80
|
})
|
81
81
|
|
@@ -112,9 +112,9 @@ describe('sidebar-tree', () => {
|
|
112
112
|
expect(guideSection).toBeDefined()
|
113
113
|
expect(guideSection!.type).toBe('ItemSection')
|
114
114
|
if (guideSection!.type === 'ItemSection') {
|
115
|
-
expect(guideSection!.
|
115
|
+
expect(guideSection!.links).toHaveLength(3) // intro + 2 from advanced subdirectory
|
116
116
|
|
117
|
-
const navTitles = guideSection!.
|
117
|
+
const navTitles = guideSection!.links.map(nav => nav.title)
|
118
118
|
expect(navTitles).toContain('Intro')
|
119
119
|
expect(navTitles).toContain('Performance')
|
120
120
|
expect(navTitles).toContain('Optimization')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Tree } from '#lib/tree/index'
|
2
2
|
import { Str } from '@wollybeard/kit'
|
3
3
|
import * as FileRouter from '../file-router.ts'
|
4
|
-
import type { RouteTreeNode
|
4
|
+
import type { RouteTreeNode } from '../scan-tree.ts'
|
5
5
|
import type { ItemLink, ItemSection, Sidebar } from './types.ts'
|
6
6
|
|
7
7
|
export * from './types.ts'
|
@@ -10,15 +10,15 @@ export * from './types.ts'
|
|
10
10
|
* Build sidebar from tree structure
|
11
11
|
*/
|
12
12
|
export const buildFromTree = (routeTree: RouteTreeNode, basePath: FileRouter.Path): Sidebar => {
|
13
|
-
const
|
13
|
+
const links: ItemLink[] = []
|
14
14
|
const sections: ItemSection[] = []
|
15
15
|
|
16
16
|
// Process only the children of the root node
|
17
17
|
for (const child of routeTree.children) {
|
18
|
-
processNode(child, basePath, [],
|
18
|
+
processNode(child, basePath, [], links, sections)
|
19
19
|
}
|
20
20
|
|
21
|
-
const items = [...
|
21
|
+
const items = [...links, ...sections]
|
22
22
|
|
23
23
|
return {
|
24
24
|
items,
|
@@ -29,7 +29,7 @@ const processNode = (
|
|
29
29
|
node: RouteTreeNode,
|
30
30
|
basePath: FileRouter.Path,
|
31
31
|
parentPath: string[],
|
32
|
-
|
32
|
+
links: ItemLink[],
|
33
33
|
sections: ItemSection[],
|
34
34
|
): void => {
|
35
35
|
const currentPath = [...parentPath, node.value.name]
|
@@ -44,27 +44,27 @@ const processNode = (
|
|
44
44
|
type: `ItemSection`,
|
45
45
|
title: sectionTitle,
|
46
46
|
pathExp: sectionPathExp.startsWith('/') ? sectionPathExp.slice(1) : sectionPathExp,
|
47
|
-
|
48
|
-
|
47
|
+
isLinkToo: false,
|
48
|
+
links: [],
|
49
49
|
}
|
50
50
|
|
51
51
|
// Check if this directory has an index file
|
52
52
|
const indexChild = node.children.find(child => child.value.type === 'file' && child.value.name === 'index')
|
53
53
|
if (indexChild) {
|
54
|
-
section.
|
54
|
+
section.isLinkToo = true
|
55
55
|
}
|
56
56
|
|
57
|
-
// Process all non-index children as
|
57
|
+
// Process all non-index children as links for this section
|
58
58
|
for (const child of node.children) {
|
59
59
|
if (child.value.type === 'file' && child.value.name !== 'index' && child.value.route) {
|
60
60
|
// Pass the parent path of the route, not the section path
|
61
61
|
const routeParentPath = child.value.route.logical.path.slice(0, -1)
|
62
|
-
section.
|
62
|
+
section.links.push(routeToItemLink(child.value.route, routeParentPath))
|
63
63
|
} else if (child.value.type === 'directory') {
|
64
64
|
// Recursively process subdirectories
|
65
65
|
// Note: This creates nested sections which the original implementation doesn't support
|
66
66
|
// For now, we'll just add the files from subdirectories to the parent section
|
67
|
-
collectFilesFromDirectory(child, child.value.route?.logical.path || [], section.
|
67
|
+
collectFilesFromDirectory(child, child.value.route?.logical.path || [], section.links)
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
@@ -72,7 +72,7 @@ const processNode = (
|
|
72
72
|
} else if (node.value.type === 'file' && node.value.route) {
|
73
73
|
// This is a top-level file - add as nav
|
74
74
|
if (node.value.name !== 'index') {
|
75
|
-
|
75
|
+
links.push(routeToItemLink(node.value.route, basePath))
|
76
76
|
}
|
77
77
|
}
|
78
78
|
}
|
@@ -80,13 +80,13 @@ const processNode = (
|
|
80
80
|
const collectFilesFromDirectory = (
|
81
81
|
node: RouteTreeNode,
|
82
82
|
basePath: FileRouter.Path,
|
83
|
-
|
83
|
+
links: ItemLink[],
|
84
84
|
): void => {
|
85
85
|
Tree.visit(node, (n) => {
|
86
86
|
if (n.value.type === 'file' && n.value.route && n.value.name !== 'index') {
|
87
87
|
// Use the route's parent path for relative title generation
|
88
88
|
const routeParentPath = n.value.route.logical.path.slice(0, -1)
|
89
|
-
|
89
|
+
links.push(routeToItemLink(n.value.route, routeParentPath))
|
90
90
|
}
|
91
91
|
})
|
92
92
|
}
|