polen 0.10.0-next.18 → 0.10.0-next.20
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 +2 -2
- package/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/builder/builder.d.ts +8 -2
- package/build/api/builder/builder.d.ts.map +1 -1
- package/build/api/builder/builder.js +5 -18
- package/build/api/builder/builder.js.map +1 -1
- package/build/api/config/configurator.d.ts +31 -8
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +9 -10
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/merge.d.ts.map +1 -1
- package/build/api/config/merge.js +9 -16
- package/build/api/config/merge.js.map +1 -1
- package/build/api/project/index.d.ts +2 -0
- package/build/api/project/index.d.ts.map +1 -0
- package/build/api/project/index.js +2 -0
- package/build/api/project/index.js.map +1 -0
- package/build/api/project/validate.d.ts +11 -0
- package/build/api/project/validate.d.ts.map +1 -0
- package/build/api/project/validate.js +30 -0
- package/build/api/project/validate.js.map +1 -0
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +1 -0
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +12 -0
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.js +1 -1
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/cli/_/parameters.d.ts +6 -0
- package/build/cli/_/parameters.d.ts.map +1 -0
- package/build/cli/_/parameters.js +9 -0
- package/build/cli/_/parameters.js.map +1 -0
- package/build/cli/commands/build.js +17 -10
- package/build/cli/commands/build.js.map +1 -1
- package/build/cli/commands/config/create.js +12 -1
- package/build/cli/commands/config/create.js.map +1 -1
- package/build/cli/commands/create.js +3 -5
- package/build/cli/commands/create.js.map +1 -1
- package/build/cli/commands/dev.js +14 -4
- package/build/cli/commands/dev.js.map +1 -1
- package/build/exports/mdx.d.ts +2 -0
- package/build/exports/mdx.d.ts.map +1 -0
- package/build/exports/mdx.js +2 -0
- package/build/exports/mdx.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +2 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +4 -2
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/lib/kit-temp.d.ts +33 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +48 -0
- package/build/lib/kit-temp.js.map +1 -1
- package/build/project-data.d.ts +1 -0
- package/build/project-data.d.ts.map +1 -1
- package/build/template/components/CodeBlock.d.ts +6 -3
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +19 -2
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/CodeHikePre.d.ts +16 -0
- package/build/template/components/CodeHikePre.d.ts.map +1 -0
- package/build/template/components/CodeHikePre.js +37 -0
- package/build/template/components/CodeHikePre.js.map +1 -0
- package/build/template/layouts/SidebarLayout.d.ts.map +1 -0
- package/build/template/{components/layouts → layouts}/SidebarLayout.js +3 -3
- package/build/template/layouts/SidebarLayout.js.map +1 -0
- package/build/template/layouts/index.d.ts.map +1 -0
- package/build/template/layouts/index.js.map +1 -0
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +1 -2
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +64 -7
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/main.js +2 -1
- package/build/template/server/main.js.map +1 -1
- package/package.json +7 -6
- package/src/api/api.ts +1 -0
- package/src/api/builder/builder.ts +12 -21
- package/src/api/config/configurator.ts +41 -19
- package/src/api/config/merge.ts +13 -16
- package/src/api/project/index.ts +1 -0
- package/src/api/project/validate.ts +41 -0
- package/src/api/vite/plugins/core.ts +1 -0
- package/src/api/vite/plugins/pages.ts +13 -0
- package/src/api/vite/plugins/serve.ts +1 -1
- package/src/cli/_/parameters.ts +10 -0
- package/src/cli/commands/build.ts +25 -10
- package/src/cli/commands/config/create.ts +18 -1
- package/src/cli/commands/create.ts +4 -4
- package/src/cli/commands/dev.ts +19 -5
- package/src/exports/mdx.ts +1 -0
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +12 -3
- package/src/lib/kit-temp.test.ts +85 -1
- package/src/lib/kit-temp.ts +51 -0
- package/src/project-data.ts +1 -0
- package/src/template/components/CodeBlock.tsx +29 -13
- package/src/template/components/CodeHikePre.tsx +51 -0
- package/src/template/{components/layouts → layouts}/SidebarLayout.tsx +3 -3
- package/src/template/routes/reference.tsx +1 -2
- package/src/template/routes/root.tsx +99 -8
- package/src/template/server/main.ts +2 -1
- package/build/exports/components.d.ts +0 -5
- package/build/exports/components.d.ts.map +0 -1
- package/build/exports/components.js +0 -5
- package/build/exports/components.js.map +0 -1
- package/build/template/components/MDXComponents.d.ts +0 -10
- package/build/template/components/MDXComponents.d.ts.map +0 -1
- package/build/template/components/MDXComponents.js +0 -12
- package/build/template/components/MDXComponents.js.map +0 -1
- package/build/template/components/TestComponent.d.ts +0 -5
- package/build/template/components/TestComponent.d.ts.map +0 -1
- package/build/template/components/TestComponent.js +0 -7
- package/build/template/components/TestComponent.js.map +0 -1
- package/build/template/components/layouts/SidebarLayout.d.ts.map +0 -1
- package/build/template/components/layouts/SidebarLayout.js.map +0 -1
- package/build/template/components/layouts/index.d.ts.map +0 -1
- package/build/template/components/layouts/index.js.map +0 -1
- package/src/exports/components.ts +0 -4
- package/src/template/components/MDXComponents.tsx +0 -17
- package/src/template/components/TestComponent.tsx +0 -6
- /package/build/template/{components/layouts → layouts}/SidebarLayout.d.ts +0 -0
- /package/build/template/{components/layouts → layouts}/index.d.ts +0 -0
- /package/build/template/{components/layouts → layouts}/index.js +0 -0
- /package/src/template/{components/layouts → layouts}/index.ts +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SidebarLayout.js","sourceRoot":"","sources":["../../../src/template/layouts/SidebarLayout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA;AAO1D,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IACnF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3D,oCAAoC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEvB,MAAM,aAAa,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;IAEnD,OAAO,CACL,MAAC,IAAI,IACH,KAAK,EAAE;YACL,OAAO,EAAE,WAAW;YACpB,EAAE,EAAE,WAAW;YACf,EAAE,EAAE,6DAA6D;SAClE,EACD,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAC5D,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,aAGvC,aAAa,IAAI,CAChB,KAAC,GAAG,IAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAC,GAAG,YACpD,KAAC,aAAa,IACZ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,GAAG,EAAE;wBACb,iBAAiB,CAAC,CAAC,cAAc,CAAC,CAAA;oBACpC,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;wBACZ,iBAAiB,CAAC,KAAK,CAAC,CAAA;oBAC1B,CAAC,EACD,WAAW,EAAE,OAAO,GACpB,GACE,CACP,EAGA,aAAa,IAAI,CAChB,KAAC,GAAG,IACF,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EACjE,UAAU,EAAC,OAAO,EAClB,OAAO,EAAC,UAAU,YAElB,KAAC,OAAO,IAAC,IAAI,EAAE,OAAO,GAAI,GACtB,CACP,EAED,KAAC,GAAG,IAAC,QAAQ,EAAC,8BAA8B,YACzC,QAAQ,GACL,IACD,CACR,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/template/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAkDnD,eAAO,MAAM,SAAS;;;;;;;;;;CAKpB,CAAA"}
|
@@ -2,11 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { GrafaidOld } from '#lib/grafaid-old/index';
|
3
3
|
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
4
4
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
|
-
import { Box } from '@radix-ui/themes';
|
6
5
|
import { Outlet } from 'react-router';
|
7
6
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
8
|
-
import { SidebarLayout } from '../components/layouts/index.js';
|
9
7
|
import { MissingSchema } from '../components/MissingSchema.js';
|
8
|
+
import { SidebarLayout } from '../layouts/index.js';
|
10
9
|
import { reference$type } from './reference.$type.js';
|
11
10
|
const loader = createLoader(() => {
|
12
11
|
const latestSchemaVersion = PROJECT_DATA.schema?.versions[0].after ?? null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,EAAE,aAA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AAa,IAAI,CAAC,IAAI,EAAE;aAClC,CAAC,CAAC;SACJ,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,CACL,KAAC,aAAa,IAAC,OAAO,EAAE,YAAY,YAClC,KAAC,MAAM,KAAG,GACI,CACjB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;IACnC,IAAI,EAAE,WAAW;IACjB,MAAM;IACN,SAAS;IACT,QAAQ,EAAE,CAAC,cAAc,CAAC;CAC3B,CAAC,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;
|
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;AA4C1D,eAAO,MAAM,SAAS,+CAkBrB,CAAA;AAmKD,eAAO,MAAM,IAAI;;;;CAIf,CAAA"}
|
@@ -1,15 +1,19 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { Link
|
3
|
+
import { SidebarLayout } from '#template/layouts/index';
|
4
|
+
import { MDXProvider } from '@mdx-js/react';
|
5
|
+
import { Badge, Box, Button, Callout, Card, Code, DataList, Em, Flex, Heading, Link, Quote, Separator, Strong, Table, Tabs, Text, Theme, Tooltip, } from '@radix-ui/themes';
|
6
|
+
import { Link as LinkReactRouter, useLocation } from 'react-router';
|
6
7
|
import { Outlet, ScrollRestoration } from 'react-router';
|
7
8
|
import logoSrc from 'virtual:polen/project/assets/logo.svg';
|
8
9
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
10
|
+
import PROJECT_DATA_PAGES_CATALOG from 'virtual:polen/project/data/pages-catalog.jsonsuper';
|
9
11
|
import { routes } from 'virtual:polen/project/routes.jsx';
|
10
12
|
import { templateVariables } from 'virtual:polen/template/variables';
|
11
13
|
import { GraphQLSchemaProvider } from '../../lib/graphql-document/schema-context.js';
|
12
|
-
import {
|
14
|
+
import { CodeBlock } from '../components/CodeBlock.js';
|
15
|
+
import { Pre } from '../components/CodeHikePre.js';
|
16
|
+
import { Link as PolenLink } from '../components/Link.js';
|
13
17
|
import { Logo } from '../components/Logo.js';
|
14
18
|
import { NotFound } from '../components/NotFound.js';
|
15
19
|
import { ThemeToggle } from '../components/ThemeToggle.js';
|
@@ -30,12 +34,65 @@ const Layout = () => {
|
|
30
34
|
const { appearance } = useTheme();
|
31
35
|
const header = (_jsxs(Flex, { align: 'center', gap: { initial: `4`, md: `8` }, pb: '4', mb: { initial: `4`, md: `8` }, style: {
|
32
36
|
borderBottom: `1px solid var(--gray-3)`,
|
33
|
-
}, children: [_jsx(LinkReactRouter, { to: '/', style: { color: `inherit`, textDecoration: `none` }, children: _jsx(Box, { display: { initial: `block`, md: `block` }, children: _jsx(Logo, { src: logoSrc, title: templateVariables.title, height: 30, showTitle: true }) }) }), _jsx(Flex, { direction: 'row', gap: '4', style: { flex: 1 }, children: PROJECT_DATA.navbar.map((item, key) => (_jsx(
|
34
|
-
return (_jsx(Theme, { asChild: true, appearance: appearance, children: _jsxs(Box, { width: { initial: `100%`, sm: `100%`, md: `var(--container-4)` }, maxWidth: '100vw', my: { initial: `0`, sm: `0`, md: `8` }, mx: 'auto', px: { initial: `4`, sm: `4`, md: `0` }, py: { initial: `4`, sm: `4`, md: `0` }, children: [header, _jsx(
|
37
|
+
}, children: [_jsx(LinkReactRouter, { to: '/', style: { color: `inherit`, textDecoration: `none` }, children: _jsx(Box, { display: { initial: `block`, md: `block` }, children: _jsx(Logo, { src: logoSrc, title: templateVariables.title, height: 30, showTitle: true }) }) }), _jsx(Flex, { direction: 'row', gap: '4', style: { flex: 1 }, children: PROJECT_DATA.navbar.map((item, key) => (_jsx(PolenLink, { color: 'gray', to: item.pathExp, children: item.title }, key))) }), _jsx(ThemeToggle, {})] }));
|
38
|
+
return (_jsx(Theme, { asChild: true, appearance: appearance, children: _jsxs(Box, { width: { initial: `100%`, sm: `100%`, md: `var(--container-4)` }, maxWidth: '100vw', my: { initial: `0`, sm: `0`, md: `8` }, mx: 'auto', px: { initial: `4`, sm: `4`, md: `0` }, py: { initial: `4`, sm: `4`, md: `0` }, children: [header, _jsx(MDXProvider, { components: {
|
39
|
+
// Map markdown elements to Radix with spacing
|
40
|
+
p: (props) => _jsx(Text, { as: 'p', mb: '4', ...props }),
|
41
|
+
h1: (props) => _jsx(Heading, { size: '8', mt: '6', mb: '4', ...props }),
|
42
|
+
h2: (props) => _jsx(Heading, { size: '7', mt: '6', mb: '3', ...props }),
|
43
|
+
h3: (props) => _jsx(Heading, { size: '6', mt: '5', mb: '3', ...props }),
|
44
|
+
h4: (props) => _jsx(Heading, { size: '5', mt: '5', mb: '2', ...props }),
|
45
|
+
h5: (props) => _jsx(Heading, { size: '4', mt: '4', mb: '2', ...props }),
|
46
|
+
h6: (props) => _jsx(Heading, { size: '3', mt: '4', mb: '2', ...props }),
|
47
|
+
strong: Strong,
|
48
|
+
em: Em,
|
49
|
+
code: Code,
|
50
|
+
blockquote: (props) => _jsx(Quote, { my: '4', ...props }),
|
51
|
+
a: Link,
|
52
|
+
hr: (props) => _jsx(Separator, { my: '6', ...props }),
|
53
|
+
pre: Pre,
|
54
|
+
table: Table.Root,
|
55
|
+
thead: Table.Header,
|
56
|
+
tbody: Table.Body,
|
57
|
+
tr: Table.Row,
|
58
|
+
th: Table.ColumnHeaderCell,
|
59
|
+
td: Table.Cell,
|
60
|
+
// Lists need spacing too
|
61
|
+
ul: (props) => _jsx(Box, { as: 'ul', mb: '4', style: { paddingLeft: '1.5rem' }, ...props }),
|
62
|
+
ol: (props) => _jsx(Box, { as: 'ol', mb: '4', style: { paddingLeft: '1.5rem' }, ...props }),
|
63
|
+
li: (props) => _jsx(Box, { as: 'li', mb: '2', ...props }),
|
64
|
+
// Direct Radix components for MDX
|
65
|
+
Badge,
|
66
|
+
Button,
|
67
|
+
// @ts-expect-error
|
68
|
+
Callout,
|
69
|
+
Card,
|
70
|
+
// @ts-expect-error
|
71
|
+
DataList,
|
72
|
+
// @ts-expect-error
|
73
|
+
Tabs,
|
74
|
+
Tooltip,
|
75
|
+
// Code Hike component
|
76
|
+
CodeBlock,
|
77
|
+
}, children: _jsx(Outlet, {}) })] }) }));
|
78
|
+
};
|
79
|
+
const PagesLayout = () => {
|
80
|
+
const location = useLocation(); // Add this line
|
81
|
+
// Build sidebar from pages catalog
|
82
|
+
// Get the top-level path segment (e.g., '/guide/foo' -> '/guide')
|
83
|
+
const pathSegments = location.pathname.split('/').filter(Boolean);
|
84
|
+
const topLevelPath = pathSegments[0] ? `/${pathSegments[0]}` : '/';
|
85
|
+
// Get the sidebar for this section
|
86
|
+
const sidebar = PROJECT_DATA_PAGES_CATALOG.sidebarIndex[topLevelPath]?.items || [];
|
87
|
+
return (_jsx(SidebarLayout, { sidebar: sidebar, children: _jsx(Outlet, {}) }));
|
35
88
|
};
|
36
89
|
const children = [
|
37
90
|
index,
|
38
|
-
|
91
|
+
{
|
92
|
+
// Pathless layout route - doesn't affect URL paths
|
93
|
+
Component: PagesLayout,
|
94
|
+
children: [...routes], // All MDX page routes go here
|
95
|
+
},
|
39
96
|
];
|
40
97
|
//
|
41
98
|
//
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW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} from '@wollybeard/kit/language';
|
3
|
+
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
3
4
|
import { createApp } from './app.js';
|
4
5
|
import { generate } from './ssg/generate.js';
|
5
6
|
import { view } from './view.js';
|
@@ -9,7 +10,7 @@ if (__BUILDING__) {
|
|
9
10
|
await generate(view);
|
10
11
|
break;
|
11
12
|
case `ssr`:
|
12
|
-
const port = process.env[`PORT`] ? parseInt(process.env[`PORT`]) :
|
13
|
+
const port = process.env[`PORT`] ? parseInt(process.env[`PORT`]) : PROJECT_DATA.server.port;
|
13
14
|
const app = createApp();
|
14
15
|
serve({ fetch: app.fetch, port });
|
15
16
|
break;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/template/server/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA,CAAC,oCAAoC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,IAAI,YAAY,EAAE,CAAC;IACjB,QAAQ,sBAAsB,EAAE,CAAC;QAC/B,KAAK,KAAK;YACR,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;YACpB,MAAK;QACP,KAAK,KAAK;YACR,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/template/server/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA,CAAC,oCAAoC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,IAAI,YAAY,EAAE,CAAC;IACjB,QAAQ,sBAAsB,EAAE,CAAC;QAC/B,KAAK,KAAK;YACR,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;YACpB,MAAK;QACP,KAAK,KAAK;YACR,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAA;YAC3F,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;YACvB,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YACjC,MAAK;QACP,KAAK,KAAK;YACR,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACxD;YACE,SAAS,CAAC,sBAAsB,CAAC,CAAA;IACrC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.10.0-next.
|
3
|
+
"version": "0.10.0-next.20",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -76,16 +76,15 @@
|
|
76
76
|
".": {
|
77
77
|
"default": "./build/exports/index.js"
|
78
78
|
},
|
79
|
-
"./components": {
|
80
|
-
"import": "./build/exports/components.js",
|
81
|
-
"default": "./build/exports/components.js"
|
82
|
-
},
|
83
79
|
"./polen": {
|
84
80
|
"default": "./build/exports/polen.js"
|
85
81
|
},
|
86
82
|
"./react": {
|
87
83
|
"default": "./build/exports/react.js"
|
88
84
|
},
|
85
|
+
"./mdx": {
|
86
|
+
"default": "./build/exports/mdx.js"
|
87
|
+
},
|
89
88
|
"./react-dom/server": {
|
90
89
|
"default": "./build/exports/react-dom/server.js"
|
91
90
|
},
|
@@ -122,6 +121,7 @@
|
|
122
121
|
"@wollybeard/projector": "^0.2.0",
|
123
122
|
"ansis": "^4.1.0",
|
124
123
|
"clean-stack": "^5.2.0",
|
124
|
+
"codehike": "^1.0.7",
|
125
125
|
"consola": "^3.4.2",
|
126
126
|
"defu": "^6.1.4",
|
127
127
|
"es-toolkit": "^1.39.6",
|
@@ -156,7 +156,8 @@
|
|
156
156
|
"vite-plugin-inspect": "^11.3.0",
|
157
157
|
"vite-plugin-restart": "^0.4.2",
|
158
158
|
"youch-core": "^0.3.3",
|
159
|
-
"zx": "8.6.1"
|
159
|
+
"zx": "8.6.1",
|
160
|
+
"@mdx-js/react": "^3.1.0"
|
160
161
|
},
|
161
162
|
"devDependencies": {
|
162
163
|
"@actions/core": "^1.11.1",
|
package/src/api/api.ts
CHANGED
@@ -4,37 +4,28 @@ import { Vite } from '#dep/vite/index'
|
|
4
4
|
import { Fs } from '@wollybeard/kit'
|
5
5
|
import consola from 'consola'
|
6
6
|
|
7
|
-
const buildDefaults = {
|
8
|
-
debug: false,
|
9
|
-
architecture: Config.BuildArchitecture.enum.ssg,
|
10
|
-
}
|
11
|
-
|
12
7
|
interface BuildConfigInput {
|
13
|
-
|
8
|
+
dir: string
|
14
9
|
architecture?: Config.BuildArchitecture
|
15
10
|
base?: string
|
11
|
+
server?: {
|
12
|
+
port?: number
|
13
|
+
}
|
14
|
+
advanced?: {
|
15
|
+
debug?: boolean
|
16
|
+
}
|
16
17
|
}
|
17
18
|
|
18
|
-
export const build = async (
|
19
|
-
const buildConfig = { ...buildDefaults, ...buildConfigInput }
|
20
|
-
|
19
|
+
export const build = async (input: BuildConfigInput) => {
|
21
20
|
const viteUserConfig = await ConfigResolver.fromFile({
|
22
|
-
dir:
|
23
|
-
overrides:
|
24
|
-
build: {
|
25
|
-
architecture: buildConfig.architecture,
|
26
|
-
...(buildConfig.base ? { base: buildConfig.base } : {}),
|
27
|
-
},
|
28
|
-
advanced: {
|
29
|
-
debug: buildConfig.debug,
|
30
|
-
},
|
31
|
-
},
|
21
|
+
dir: input.dir,
|
22
|
+
overrides: input,
|
32
23
|
})
|
33
24
|
|
34
25
|
const builder = await Vite.createBuilder(viteUserConfig)
|
35
26
|
await builder.buildApp()
|
36
27
|
|
37
|
-
if (
|
28
|
+
if (input.architecture === `ssg`) {
|
38
29
|
consola.info(`Generating static site...`)
|
39
30
|
await import(viteUserConfig._polen.paths.project.absolute.build.serverEntrypoint)
|
40
31
|
// Clean up server file which should now be done being used for SSG geneation.
|
@@ -42,7 +33,7 @@ export const build = async (buildConfigInput: BuildConfigInput) => {
|
|
42
33
|
// todo: there is also some kind of prompt js asset that we probably need to clean up or review...
|
43
34
|
consola.success(`Done`)
|
44
35
|
consola.info(`try it: npx serve ${viteUserConfig._polen.paths.project.relative.build.root} -p 4000`)
|
45
|
-
} else if (
|
36
|
+
} else if (input.architecture === `ssr`) {
|
46
37
|
consola.info(`try it: node ${viteUserConfig._polen.paths.project.relative.build.root}/app.js`)
|
47
38
|
// todo: no hardcoded port
|
48
39
|
consola.info(`Then visit http://localhost:3001`)
|
@@ -24,14 +24,6 @@ type SchemaConfigInput = Omit<Schema.Config, `projectRoot`>
|
|
24
24
|
* All options are optional. Polen provides sensible defaults for a great developer experience out of the box.
|
25
25
|
*/
|
26
26
|
export interface ConfigInput {
|
27
|
-
/**
|
28
|
-
* Path to the root directory of your project.
|
29
|
-
*
|
30
|
-
* Relative paths will be resolved relative to this config file.
|
31
|
-
*
|
32
|
-
* @default The directory where the config file is located.
|
33
|
-
*/
|
34
|
-
root?: string
|
35
27
|
/**
|
36
28
|
* Configuration for how Polen loads your GraphQL schema.
|
37
29
|
*
|
@@ -139,6 +131,34 @@ export interface ConfigInput {
|
|
139
131
|
*/
|
140
132
|
base?: string
|
141
133
|
}
|
134
|
+
/**
|
135
|
+
* Server configuration for development and production.
|
136
|
+
*/
|
137
|
+
server?: {
|
138
|
+
/**
|
139
|
+
* Port for the server to listen on.
|
140
|
+
*
|
141
|
+
* - In development: The port for the Vite dev server
|
142
|
+
* - In production SSR: The default port for the Node.js server
|
143
|
+
*
|
144
|
+
* For production SSR builds, this can be overridden at runtime
|
145
|
+
* using the PORT environment variable.
|
146
|
+
*
|
147
|
+
* @default 3000
|
148
|
+
* @example
|
149
|
+
* ```ts
|
150
|
+
* // Use a specific port
|
151
|
+
* server: {
|
152
|
+
* port: 4000
|
153
|
+
* }
|
154
|
+
*
|
155
|
+
* // Or via CLI flags:
|
156
|
+
* // polen dev --port 4000
|
157
|
+
* // polen build --port 4000
|
158
|
+
* ```
|
159
|
+
*/
|
160
|
+
port?: number
|
161
|
+
}
|
142
162
|
/**
|
143
163
|
* Advanced configuration options.
|
144
164
|
*
|
@@ -263,6 +283,9 @@ export interface Config {
|
|
263
283
|
architecture: BuildArchitecture
|
264
284
|
base: string
|
265
285
|
}
|
286
|
+
server: {
|
287
|
+
port: number
|
288
|
+
}
|
266
289
|
watch: {
|
267
290
|
also: string[]
|
268
291
|
}
|
@@ -325,6 +348,9 @@ const configInputDefaults: Config = {
|
|
325
348
|
architecture: BuildArchitecture.enum.ssg,
|
326
349
|
base: `/`,
|
327
350
|
},
|
351
|
+
server: {
|
352
|
+
port: 3000,
|
353
|
+
},
|
328
354
|
schema: null,
|
329
355
|
ssr: {
|
330
356
|
enabled: true,
|
@@ -377,17 +403,9 @@ export const normalizeInput = async (
|
|
377
403
|
config.advanced.debug = configInput.advanced.debug
|
378
404
|
}
|
379
405
|
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
`Root path must be absolute or baseRootPath must be provided to resolve relative root paths. Provided: ${configInput.root}`,
|
384
|
-
)
|
385
|
-
}
|
386
|
-
const root = Path.ensureAbsolute(configInput.root, baseRootDirPath)
|
387
|
-
config.paths = buildPaths(root)
|
388
|
-
} else if (baseRootDirPath) {
|
389
|
-
config.paths = buildPaths(baseRootDirPath)
|
390
|
-
}
|
406
|
+
// Always use the baseRootDirPath as the project root
|
407
|
+
// This is either the --project directory or the config file directory
|
408
|
+
config.paths = buildPaths(baseRootDirPath)
|
391
409
|
|
392
410
|
// Try to read package.json name as fallback for title
|
393
411
|
if (!configInput?.templateVariables?.title) {
|
@@ -429,5 +447,9 @@ export const normalizeInput = async (
|
|
429
447
|
config.watch.also = configInput.advanced.watch.also
|
430
448
|
}
|
431
449
|
|
450
|
+
if (configInput?.server?.port !== undefined) {
|
451
|
+
config.server.port = configInput.server.port
|
452
|
+
}
|
453
|
+
|
432
454
|
return config
|
433
455
|
}
|
package/src/api/config/merge.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Vite } from '#dep/vite/index'
|
2
|
+
import { spreadShallow } from '#lib/kit-temp'
|
2
3
|
import type { ConfigInput } from './configurator.js'
|
3
4
|
|
4
5
|
/**
|
@@ -13,10 +14,7 @@ export const mergeInputs = (
|
|
13
14
|
return base
|
14
15
|
}
|
15
16
|
|
16
|
-
const merged: ConfigInput =
|
17
|
-
...base,
|
18
|
-
...overrides,
|
19
|
-
}
|
17
|
+
const merged: ConfigInput = spreadShallow(base, overrides)
|
20
18
|
|
21
19
|
// Merge schema if both have it
|
22
20
|
if (base.schema || overrides.schema) {
|
@@ -25,25 +23,24 @@ export const mergeInputs = (
|
|
25
23
|
|
26
24
|
// Merge build config
|
27
25
|
if (base.build || overrides.build) {
|
28
|
-
merged.build =
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
merged.build = spreadShallow(base.build, overrides.build)
|
27
|
+
}
|
28
|
+
|
29
|
+
// Merge server config
|
30
|
+
if (base.server || overrides.server) {
|
31
|
+
merged.server = spreadShallow(base.server, overrides.server)
|
32
32
|
}
|
33
33
|
|
34
34
|
// Merge advanced config
|
35
35
|
if (base.advanced || overrides.advanced) {
|
36
|
-
merged.advanced =
|
37
|
-
...base.advanced,
|
38
|
-
...overrides.advanced,
|
39
|
-
}
|
36
|
+
merged.advanced = spreadShallow(base.advanced, overrides.advanced)
|
40
37
|
|
41
38
|
// Merge advanced.watch config
|
42
39
|
if (base.advanced?.watch || overrides.advanced?.watch) {
|
43
|
-
merged.advanced.watch =
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
merged.advanced.watch = spreadShallow(
|
41
|
+
base.advanced?.watch,
|
42
|
+
overrides.advanced?.watch,
|
43
|
+
)
|
47
44
|
|
48
45
|
// Merge watch.also arrays
|
49
46
|
if (base.advanced?.watch?.also || overrides.advanced?.watch?.also) {
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './validate.js'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { Fs } from '@wollybeard/kit'
|
2
|
+
import consola from 'consola'
|
3
|
+
|
4
|
+
export interface ValidateProjectOptions {
|
5
|
+
mustExist?: boolean
|
6
|
+
mustBeEmpty?: boolean
|
7
|
+
silent?: boolean
|
8
|
+
}
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Validate a project directory for Polen operations.
|
12
|
+
* Used by CLI commands to ensure valid project paths.
|
13
|
+
*/
|
14
|
+
export async function validateProjectDirectory(
|
15
|
+
dir: string,
|
16
|
+
options: ValidateProjectOptions = {},
|
17
|
+
): Promise<boolean> {
|
18
|
+
const { mustExist = true, mustBeEmpty = false, silent = false } = options
|
19
|
+
|
20
|
+
const stat = await Fs.stat(dir)
|
21
|
+
|
22
|
+
if (Fs.isNotFoundError(stat)) {
|
23
|
+
if (mustExist) {
|
24
|
+
if (!silent) consola.error(`Project directory does not exist: ${dir}`)
|
25
|
+
return false
|
26
|
+
}
|
27
|
+
return true
|
28
|
+
}
|
29
|
+
|
30
|
+
if (!stat.isDirectory()) {
|
31
|
+
if (!silent) consola.error(`Project path is not a directory: ${dir}`)
|
32
|
+
return false
|
33
|
+
}
|
34
|
+
|
35
|
+
if (mustBeEmpty && !(await Fs.isEmptyDir(dir))) {
|
36
|
+
if (!silent) consola.error(`Project directory is not empty: ${dir}`)
|
37
|
+
return false
|
38
|
+
}
|
39
|
+
|
40
|
+
return true
|
41
|
+
}
|
@@ -209,6 +209,7 @@ export const Core = (config: Config.Config): Vite.PluginOption[] => {
|
|
209
209
|
paths: config.paths.project,
|
210
210
|
navbar, // Complete navbar with schema and pages
|
211
211
|
server: {
|
212
|
+
port: config.server.port,
|
212
213
|
static: {
|
213
214
|
// todo
|
214
215
|
// relative from CWD of process that boots n1ode server
|
@@ -8,6 +8,7 @@ import { debugPolen } from '#singletons/debug'
|
|
8
8
|
import { superjson } from '#singletons/superjson'
|
9
9
|
import mdx from '@mdx-js/rollup'
|
10
10
|
import { Arr, Cache, Path, Str } from '@wollybeard/kit'
|
11
|
+
import { recmaCodeHike, remarkCodeHike } from 'codehike/mdx'
|
11
12
|
import remarkFrontmatter from 'remark-frontmatter'
|
12
13
|
import remarkGfm from 'remark-gfm'
|
13
14
|
import { viProjectData } from './core.js'
|
@@ -93,16 +94,28 @@ export const Pages = ({
|
|
93
94
|
return s.render()
|
94
95
|
}
|
95
96
|
|
97
|
+
const chConfig = {
|
98
|
+
components: { code: 'CodeBlock' },
|
99
|
+
syntaxHighlighting: {
|
100
|
+
theme: `github-light`,
|
101
|
+
},
|
102
|
+
}
|
103
|
+
|
96
104
|
return [
|
97
105
|
// Plugin 1: MDX Processing
|
98
106
|
{
|
99
107
|
enforce: `pre`,
|
100
108
|
...mdx({
|
101
109
|
jsxImportSource: `polen/react`,
|
110
|
+
providerImportSource: `polen/mdx`,
|
102
111
|
remarkPlugins: [
|
103
112
|
// Parse frontmatter blocks so they're removed from content
|
104
113
|
remarkFrontmatter,
|
105
114
|
remarkGfm,
|
115
|
+
[remarkCodeHike, chConfig],
|
116
|
+
],
|
117
|
+
recmaPlugins: [
|
118
|
+
[recmaCodeHike, chConfig],
|
106
119
|
],
|
107
120
|
rehypePlugins: [],
|
108
121
|
}),
|
@@ -1,11 +1,16 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
import { Api } from '#api/index'
|
3
|
-
import {
|
3
|
+
import { projectParameter } from '#cli/_/parameters'
|
4
|
+
import { ensureOptionalAbsoluteWithCwd } from '#lib/kit-temp'
|
4
5
|
import { Command } from '@molt/command'
|
5
6
|
import { z } from 'zod'
|
6
7
|
|
7
8
|
const args = Command.create()
|
8
9
|
.parameter(`--debug -d`, z.boolean().default(false))
|
10
|
+
.parameter(
|
11
|
+
`--project -p`,
|
12
|
+
projectParameter,
|
13
|
+
)
|
9
14
|
.parameter(
|
10
15
|
`--architecture -a`,
|
11
16
|
Api.Config.BuildArchitecture.default('ssg').describe('Which kind of application architecture to output.'),
|
@@ -14,6 +19,10 @@ const args = Command.create()
|
|
14
19
|
`--base -b`,
|
15
20
|
z.string().optional().describe('Base public path for deployment (e.g., /my-project/)'),
|
16
21
|
)
|
22
|
+
.parameter(
|
23
|
+
`--port`,
|
24
|
+
z.number().optional().describe('Default port for the SSR application'),
|
25
|
+
)
|
17
26
|
.settings({
|
18
27
|
parameters: {
|
19
28
|
environment: {
|
@@ -27,14 +36,20 @@ const args = Command.create()
|
|
27
36
|
})
|
28
37
|
.parse()
|
29
38
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
39
|
+
const dir = ensureOptionalAbsoluteWithCwd(args.project)
|
40
|
+
|
41
|
+
if (!await Api.Project.validateProjectDirectory(dir)) {
|
42
|
+
process.exit(1)
|
43
|
+
}
|
44
|
+
|
36
45
|
await Api.Builder.build({
|
37
|
-
|
38
|
-
|
39
|
-
|
46
|
+
dir,
|
47
|
+
architecture: args.architecture,
|
48
|
+
base: args.base,
|
49
|
+
server: {
|
50
|
+
port: args.port,
|
51
|
+
},
|
52
|
+
advanced: {
|
53
|
+
debug: args.debug,
|
54
|
+
},
|
40
55
|
})
|