polen 0.10.0 → 0.11.0-next.2
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/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/config/configurator.d.ts +20 -22
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +27 -9
- 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 +0 -11
- package/build/api/config/merge.js.map +1 -1
- package/build/api/content/metadata.d.ts +8 -2
- package/build/api/content/metadata.d.ts.map +1 -1
- package/build/api/content/metadata.js +1 -1
- package/build/api/content/metadata.js.map +1 -1
- package/build/api/schema/data-sources/memory/memory.d.ts +2 -2
- package/build/api/schema/data-sources/memory/memory.d.ts.map +1 -1
- package/build/api/schema/data-sources/memory/memory.js +1 -3
- package/build/api/schema/data-sources/memory/memory.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts +7 -3
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js +15 -11
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts +16 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +26 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts +7 -2
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.js +13 -5
- package/build/api/schema/data-sources/schema-file/schema-file.js.map +1 -1
- package/build/api/schema/metadata.d.ts +16 -0
- package/build/api/schema/metadata.d.ts.map +1 -0
- package/build/api/schema/metadata.js +19 -0
- package/build/api/schema/metadata.js.map +1 -0
- package/build/api/schema/read.d.ts +3 -3
- package/build/api/schema/read.d.ts.map +1 -1
- package/build/api/schema/read.js.map +1 -1
- package/build/api/schema/schema.d.ts +33 -2
- package/build/api/schema/schema.d.ts.map +1 -1
- package/build/api/schema/schema.js +42 -0
- package/build/api/schema/schema.js.map +1 -1
- package/build/api/schema-source/index.d.ts +2 -0
- package/build/api/schema-source/index.d.ts.map +1 -0
- package/build/api/schema-source/index.js +2 -0
- package/build/api/schema-source/index.js.map +1 -0
- package/build/api/schema-source/schema-source.d.ts +33 -0
- package/build/api/schema-source/schema-source.d.ts.map +1 -0
- package/build/api/schema-source/schema-source.js +137 -0
- package/build/api/schema-source/schema-source.js.map +1 -0
- package/build/api/static/manifest.d.ts +1 -2
- package/build/api/static/manifest.d.ts.map +1 -1
- package/build/api/static/manifest.js +1 -1
- package/build/api/static/manifest.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts +1 -0
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +21 -18
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +1 -8
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/schema-assets.d.ts +22 -0
- package/build/api/vite/plugins/schema-assets.d.ts.map +1 -0
- package/build/api/vite/plugins/schema-assets.js +269 -0
- package/build/api/vite/plugins/schema-assets.js.map +1 -0
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +11 -0
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/graphql-change/change-groups.d.ts +2 -0
- package/build/lib/graphql-change/change-groups.d.ts.map +1 -1
- package/build/lib/graphql-change/change-groups.js +54 -0
- package/build/lib/graphql-change/change-groups.js.map +1 -1
- package/build/lib/kit-temp.d.ts +9 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +12 -0
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/path-map/path-map.d.ts.map +1 -1
- package/build/lib/path-map/path-map.js +3 -1
- package/build/lib/path-map/path-map.js.map +1 -1
- package/build/project-data.d.ts +3 -11
- package/build/project-data.d.ts.map +1 -1
- package/build/template/components/Changelog.d.ts +3 -3
- package/build/template/components/Changelog.d.ts.map +1 -1
- package/build/template/components/Changelog.js +8 -84
- package/build/template/components/Changelog.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts +2 -0
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +1 -4
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/ComponentDispatch.d.ts +34 -0
- package/build/template/components/ComponentDispatch.d.ts.map +1 -0
- package/build/template/components/ComponentDispatch.js +33 -0
- package/build/template/components/ComponentDispatch.js.map +1 -0
- package/build/template/components/ReferenceLink.d.ts +19 -0
- package/build/template/components/ReferenceLink.d.ts.map +1 -0
- package/build/template/components/ReferenceLink.js +19 -0
- package/build/template/components/ReferenceLink.js.map +1 -0
- package/build/template/components/TypeAnnotation.d.ts.map +1 -1
- package/build/template/components/TypeAnnotation.js +3 -3
- package/build/template/components/TypeAnnotation.js.map +1 -1
- package/build/template/components/TypeFieldsLinkList.d.ts.map +1 -1
- package/build/template/components/TypeFieldsLinkList.js +4 -4
- package/build/template/components/TypeFieldsLinkList.js.map +1 -1
- package/build/template/components/TypeIndex.js +2 -2
- package/build/template/components/TypeIndex.js.map +1 -1
- package/build/template/components/VersionSelector.d.ts +7 -0
- package/build/template/components/VersionSelector.d.ts.map +1 -0
- package/build/template/components/VersionSelector.js +30 -0
- package/build/template/components/VersionSelector.js.map +1 -0
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +2 -2
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/build/template/hooks/useVersionPath.d.ts +6 -0
- package/build/template/hooks/useVersionPath.d.ts.map +1 -0
- package/build/template/hooks/useVersionPath.js +10 -0
- package/build/template/hooks/useVersionPath.js.map +1 -0
- package/build/template/layouts/ChangelogLayout.d.ts.map +1 -0
- package/build/template/{components → layouts}/ChangelogLayout.js +1 -1
- package/build/template/layouts/ChangelogLayout.js.map +1 -0
- package/build/template/layouts/index.d.ts +1 -0
- package/build/template/layouts/index.d.ts.map +1 -1
- package/build/template/layouts/index.js +1 -0
- package/build/template/layouts/index.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +8 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -0
- package/build/template/lib/fetch-text.js +14 -0
- package/build/template/lib/fetch-text.js.map +1 -0
- package/build/template/lib/polen-url.d.ts +14 -0
- package/build/template/lib/polen-url.d.ts.map +1 -1
- package/build/template/lib/polen-url.js +16 -0
- package/build/template/lib/polen-url.js.map +1 -1
- package/build/template/lib/schema-utils/constants.d.ts +5 -0
- package/build/template/lib/schema-utils/constants.d.ts.map +1 -0
- package/build/template/lib/schema-utils/constants.js +5 -0
- package/build/template/lib/schema-utils/constants.js.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts +15 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.js +37 -0
- package/build/template/lib/schema-utils/schema-utils.js.map +1 -0
- package/build/template/routes/changelog.d.ts +4 -3
- package/build/template/routes/changelog.d.ts.map +1 -1
- package/build/template/routes/changelog.js +13 -7
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/pages.d.ts +10 -0
- package/build/template/routes/pages.d.ts.map +1 -0
- package/build/template/routes/pages.js +76 -0
- package/build/template/routes/pages.js.map +1 -0
- package/build/template/routes/reference.$type.$field.js +1 -1
- package/build/template/routes/reference.$type.$field.js.map +1 -1
- package/build/template/routes/reference.$type.d.ts +4 -0
- package/build/template/routes/reference.$type.d.ts.map +1 -1
- package/build/template/routes/reference.$type.js +2 -0
- package/build/template/routes/reference.$type.js.map +1 -1
- package/build/template/routes/reference.d.ts +9 -3
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +30 -8
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/reference.version.$version.$type.$field.d.ts +6 -0
- package/build/template/routes/reference.version.$version.$type.$field.d.ts.map +1 -0
- package/build/template/routes/reference.version.$version.$type.$field.js +32 -0
- package/build/template/routes/reference.version.$version.$type.$field.js.map +1 -0
- package/build/template/routes/reference.version.$version.$type.d.ts +11 -0
- package/build/template/routes/reference.version.$version.$type.d.ts.map +1 -0
- package/build/template/routes/reference.version.$version.$type.js +26 -0
- package/build/template/routes/reference.version.$version.$type.js.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +8 -72
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +22 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +19 -9
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/main.js +9 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/ssg/generate.js +2 -2
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +51 -27
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/sources/schema-source.d.ts +15 -0
- package/build/template/sources/schema-source.d.ts.map +1 -0
- package/build/template/sources/schema-source.js +63 -0
- package/build/template/sources/schema-source.js.map +1 -0
- package/package.json +16 -17
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +51 -32
- package/src/api/config/merge.ts +0 -16
- package/src/api/content/metadata.ts +1 -1
- package/src/api/schema/data-sources/memory/memory.ts +3 -5
- package/src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts +29 -13
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +56 -16
- package/src/api/schema/data-sources/schema-file/schema-file.ts +16 -7
- package/src/api/schema/metadata.ts +23 -0
- package/src/api/schema/read.ts +3 -3
- package/src/api/schema/schema.ts +62 -2
- package/src/api/schema-source/index.ts +1 -0
- package/src/api/schema-source/schema-source.ts +189 -0
- package/src/api/static/manifest.ts +1 -1
- package/src/api/vite/plugins/core.ts +23 -18
- package/src/api/vite/plugins/main.ts +1 -9
- package/src/api/vite/plugins/schema-assets.ts +317 -0
- package/src/api/vite/plugins/serve.ts +15 -8
- package/src/lib/graphql-change/change-groups.ts +57 -0
- package/src/lib/kit-temp.ts +13 -0
- package/src/lib/path-map/$.test.ts +22 -19
- package/src/lib/path-map/path-map.ts +3 -1
- package/src/project-data.ts +3 -11
- package/src/template/components/Changelog.tsx +16 -67
- package/src/template/components/CodeBlock.tsx +3 -5
- package/src/template/components/ComponentDispatch.tsx +42 -0
- package/src/template/components/ReferenceLink.tsx +34 -0
- package/src/template/components/TypeAnnotation.tsx +5 -7
- package/src/template/components/TypeFieldsLinkList.tsx +20 -23
- package/src/template/components/TypeIndex.tsx +10 -12
- package/src/template/components/VersionSelector.tsx +50 -0
- package/src/template/components/graphql/type-link.tsx +4 -3
- package/src/template/hooks/useVersionPath.ts +10 -0
- package/src/template/{components → layouts}/ChangelogLayout.tsx +1 -1
- package/src/template/layouts/index.ts +1 -0
- package/src/template/lib/fetch-text.ts +13 -0
- package/src/template/lib/polen-url.ts +20 -0
- package/src/template/lib/schema-utils/constants.ts +4 -0
- package/src/template/lib/schema-utils/schema-utils.ts +42 -0
- package/src/template/routes/changelog.tsx +17 -8
- package/src/template/routes/pages.tsx +109 -0
- package/src/template/routes/reference.$type.$field.tsx +1 -1
- package/src/template/routes/reference.$type.tsx +2 -0
- package/src/template/routes/reference.tsx +38 -6
- package/src/template/routes/reference.version.$version.$type.$field.tsx +35 -0
- package/src/template/routes/reference.version.$version.$type.tsx +30 -0
- package/src/template/routes/root.tsx +8 -109
- package/src/template/server/app.ts +47 -14
- package/src/template/server/main.ts +9 -1
- package/src/template/server/ssg/generate.ts +2 -2
- package/src/template/server/ssg/get-route-paths.ts +53 -27
- package/src/template/sources/schema-source.ts +68 -0
- package/build/lib/graphql-document/$$.d.ts +0 -5
- package/build/lib/graphql-document/$$.d.ts.map +0 -1
- package/build/lib/graphql-document/$$.js +0 -5
- package/build/lib/graphql-document/$$.js.map +0 -1
- package/build/lib/graphql-document/$.d.ts +0 -2
- package/build/lib/graphql-document/$.d.ts.map +0 -1
- package/build/lib/graphql-document/$.js +0 -2
- package/build/lib/graphql-document/$.js.map +0 -1
- package/build/lib/graphql-document/analysis.d.ts +0 -44
- package/build/lib/graphql-document/analysis.d.ts.map +0 -1
- package/build/lib/graphql-document/analysis.js +0 -361
- package/build/lib/graphql-document/analysis.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -38
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +0 -151
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +0 -7
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +0 -27
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +0 -33
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +0 -50
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +0 -39
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.js +0 -75
- package/build/lib/graphql-document/components/IdentifierLink.js.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts +0 -5
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.js +0 -144
- package/build/lib/graphql-document/components/graphql-document-styles.js.map +0 -1
- package/build/lib/graphql-document/components/index.d.ts +0 -5
- package/build/lib/graphql-document/components/index.d.ts.map +0 -1
- package/build/lib/graphql-document/components/index.js +0 -5
- package/build/lib/graphql-document/components/index.js.map +0 -1
- package/build/lib/graphql-document/example.d.ts +0 -25
- package/build/lib/graphql-document/example.d.ts.map +0 -1
- package/build/lib/graphql-document/example.js +0 -140
- package/build/lib/graphql-document/example.js.map +0 -1
- package/build/lib/graphql-document/graphql-document.d.ts +0 -35
- package/build/lib/graphql-document/graphql-document.d.ts.map +0 -1
- package/build/lib/graphql-document/graphql-document.js +0 -36
- package/build/lib/graphql-document/graphql-document.js.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +0 -43
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.js +0 -132
- package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +0 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -63
- package/build/lib/graphql-document/positioning-simple.d.ts.map +0 -1
- package/build/lib/graphql-document/positioning-simple.js +0 -185
- package/build/lib/graphql-document/positioning-simple.js.map +0 -1
- package/build/lib/graphql-document/schema-context.d.ts +0 -8
- package/build/lib/graphql-document/schema-context.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-context.js +0 -11
- package/build/lib/graphql-document/schema-context.js.map +0 -1
- package/build/lib/graphql-document/schema-integration.d.ts +0 -135
- package/build/lib/graphql-document/schema-integration.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-integration.js +0 -328
- package/build/lib/graphql-document/schema-integration.js.map +0 -1
- package/build/lib/graphql-document/types.d.ts +0 -117
- package/build/lib/graphql-document/types.d.ts.map +0 -1
- package/build/lib/graphql-document/types.js +0 -2
- package/build/lib/graphql-document/types.js.map +0 -1
- package/build/template/components/ChangelogLayout.d.ts.map +0 -1
- package/build/template/components/ChangelogLayout.js.map +0 -1
- package/build/template/components/CodeHikePre.d.ts +0 -16
- package/build/template/components/CodeHikePre.d.ts.map +0 -1
- package/build/template/components/CodeHikePre.js +0 -37
- package/build/template/components/CodeHikePre.js.map +0 -1
- package/src/lib/graphql-document/$$.ts +0 -4
- package/src/lib/graphql-document/$.test.ts +0 -132
- package/src/lib/graphql-document/$.ts +0 -1
- package/src/lib/graphql-document/README.md +0 -102
- package/src/lib/graphql-document/analysis.ts +0 -415
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +0 -265
- package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +0 -188
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +0 -46
- package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +0 -199
- package/src/lib/graphql-document/components/IdentifierLink.tsx +0 -160
- package/src/lib/graphql-document/components/graphql-document-styles.ts +0 -144
- package/src/lib/graphql-document/components/index.ts +0 -4
- package/src/lib/graphql-document/demo.md +0 -155
- package/src/lib/graphql-document/example.ts +0 -163
- package/src/lib/graphql-document/graphql-document.ts +0 -37
- package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +0 -76
- package/src/lib/graphql-document/hooks/use-tooltip-state.ts +0 -191
- package/src/lib/graphql-document/positioning-simple.test.ts +0 -248
- package/src/lib/graphql-document/positioning-simple.ts +0 -260
- package/src/lib/graphql-document/schema-context.tsx +0 -20
- package/src/lib/graphql-document/schema-integration.test.ts +0 -365
- package/src/lib/graphql-document/schema-integration.ts +0 -488
- package/src/lib/graphql-document/types.ts +0 -129
- package/src/template/components/CodeHikePre.tsx +0 -51
- /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
+
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
|
+
import { useParams } from 'react-router';
|
5
|
+
import { MissingSchema } from '../components/MissingSchema.js';
|
6
|
+
import { NamedType } from '../components/NamedType.js';
|
7
|
+
import { referenceVersion$version$type$field } from './reference.version.$version.$type.$field.js';
|
8
|
+
const Component = () => {
|
9
|
+
const params = useParams();
|
10
|
+
const data = useLoaderData(`reference`);
|
11
|
+
if (!data.schema) {
|
12
|
+
return _jsx(MissingSchema, {});
|
13
|
+
}
|
14
|
+
const type = data.schema.getType(params.type);
|
15
|
+
if (!type) {
|
16
|
+
return _jsxs("div", { children: ["Type not found: ", params.type] });
|
17
|
+
}
|
18
|
+
return _jsx(NamedType, { data: type });
|
19
|
+
};
|
20
|
+
export const referenceVersion$version$type = createRoute({
|
21
|
+
id: `reference-version-type`,
|
22
|
+
path: `:type`,
|
23
|
+
Component,
|
24
|
+
children: [referenceVersion$version$type$field],
|
25
|
+
});
|
26
|
+
//# sourceMappingURL=reference.version.$version.$type.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reference.version.$version.$type.js","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAA;AAElG,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAuC,CAAA;IAE/D,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,8CAAsB,MAAM,CAAC,IAAI,IAAO,CAAA;IACjD,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,OAAO;IACb,SAAS;IACT,QAAQ,EAAE,CAAC,mCAAmC,CAAC;CAChD,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;AAmB1D,eAAO,MAAM,SAAS,+CASrB,CAAA;AAgGD,eAAO,MAAM,IAAI;;;;CAIf,CAAA"}
|
@@ -1,18 +1,12 @@
|
|
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 { 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';
|
3
|
+
import { Box, Flex, Theme } from '@radix-ui/themes';
|
4
|
+
import { Link as LinkReactRouter } from 'react-router';
|
7
5
|
import { Outlet, ScrollRestoration } from 'react-router';
|
8
6
|
import logoSrc from 'virtual:polen/project/assets/logo.svg';
|
9
7
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
10
|
-
import
|
11
|
-
import { routes } from 'virtual:polen/project/routes.jsx';
|
8
|
+
import PROJECT_SCHEMA from 'virtual:polen/project/schema.jsonsuper';
|
12
9
|
import { templateVariables } from 'virtual:polen/template/variables';
|
13
|
-
import { GraphQLSchemaProvider } from '../../lib/graphql-document/schema-context.js';
|
14
|
-
import { CodeBlock } from '../components/CodeBlock.js';
|
15
|
-
import { Pre } from '../components/CodeHikePre.js';
|
16
10
|
import { Link as PolenLink } from '../components/Link.js';
|
17
11
|
import { Logo } from '../components/Logo.js';
|
18
12
|
import { NotFound } from '../components/NotFound.js';
|
@@ -20,79 +14,21 @@ import { ThemeToggle } from '../components/ThemeToggle.js';
|
|
20
14
|
import { ThemeProvider, useTheme } from '../contexts/ThemeContext.js';
|
21
15
|
import { changelog } from './changelog.js';
|
22
16
|
import { index } from './index.js';
|
17
|
+
import { pages } from './pages.js';
|
23
18
|
import { reference } from './reference.js';
|
24
19
|
export const Component = () => {
|
25
|
-
|
26
|
-
// Make schema available globally for MDX components
|
27
|
-
if (typeof window !== `undefined` && schema) {
|
28
|
-
;
|
29
|
-
window.__POLEN_GRAPHQL_SCHEMA__ = schema;
|
30
|
-
}
|
31
|
-
return (_jsxs(_Fragment, { children: [_jsx(ThemeProvider, { children: _jsx(GraphQLSchemaProvider, { schema: schema, children: _jsx(Layout, {}) }) }), _jsx(ScrollRestoration, {})] }));
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(ThemeProvider, { children: _jsx(Layout, {}) }), _jsx(ScrollRestoration, {})] }));
|
32
21
|
};
|
33
22
|
const Layout = () => {
|
34
23
|
const { appearance } = useTheme();
|
35
24
|
const header = (_jsxs(Flex, { align: 'center', gap: { initial: `4`, md: `8` }, pb: '4', mb: { initial: `4`, md: `8` }, style: {
|
36
25
|
borderBottom: `1px solid var(--gray-3)`,
|
37
26
|
}, 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(
|
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, {}) }));
|
27
|
+
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(Outlet, {})] }) }));
|
88
28
|
};
|
89
29
|
const children = [
|
90
30
|
index,
|
91
|
-
|
92
|
-
// Pathless layout route - doesn't affect URL paths
|
93
|
-
Component: PagesLayout,
|
94
|
-
children: [...routes], // All MDX page routes go here
|
95
|
-
},
|
31
|
+
pages,
|
96
32
|
];
|
97
33
|
//
|
98
34
|
//
|
@@ -102,7 +38,7 @@ const children = [
|
|
102
38
|
//
|
103
39
|
//
|
104
40
|
//
|
105
|
-
if (
|
41
|
+
if (PROJECT_SCHEMA) {
|
106
42
|
children.push(changelog);
|
107
43
|
children.push(reference);
|
108
44
|
}
|
@@ -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,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,OAAO,MAAM,uCAAuC,CAAA;AAC3D,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,aAA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;AACF,EAAE;AACF,EAAE;AAEF,MAAM,aAAa,GAAG,WAAW,CAAC;IAChC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,QAAQ;IACnB,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"}
|
@@ -1,10 +1,31 @@
|
|
1
1
|
import { Hono } from '#dep/hono/index';
|
2
2
|
import { type HtmlTransformer } from '#lib/html-utils/html-transformer';
|
3
|
+
export type App = Hono.Hono;
|
3
4
|
export interface AppHooks {
|
4
5
|
transformHtml?: HtmlTransformer[];
|
5
6
|
}
|
6
7
|
export interface AppOptions {
|
7
8
|
hooks?: AppHooks;
|
9
|
+
paths: {
|
10
|
+
base: string;
|
11
|
+
assets: {
|
12
|
+
/**
|
13
|
+
* Directory path for serving static assets.
|
14
|
+
* MUST be a relative path from process.cwd() due to @hono/node-server constraints.
|
15
|
+
* Absolute paths are NOT supported by the serveStatic middleware.
|
16
|
+
*
|
17
|
+
* @example './node_modules/.vite/polen-assets'
|
18
|
+
* @example '../../../polen/node_modules/.vite/polen-assets'
|
19
|
+
* @example './dist/assets'
|
20
|
+
*/
|
21
|
+
directory: string;
|
22
|
+
/**
|
23
|
+
* URL route prefix for serving assets
|
24
|
+
* @example '/assets'
|
25
|
+
*/
|
26
|
+
route: string;
|
27
|
+
};
|
28
|
+
};
|
8
29
|
}
|
9
|
-
export declare const createApp: (options
|
30
|
+
export declare const createApp: (options: AppOptions) => import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema, string>;
|
10
31
|
//# sourceMappingURL=app.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,kCAAkC,CAAA;
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAS9F,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAA;AAE3B,MAAM,WAAW,QAAQ;IACvB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE;YACN;;;;;;;;eAQG;YACH,SAAS,EAAE,MAAM,CAAA;YACjB;;;eAGG;YACH,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;KACF,CAAA;CACF;AAED,eAAO,MAAM,SAAS,GAAI,SAAS,UAAU,+GA4C5C,CAAA"}
|
@@ -1,15 +1,30 @@
|
|
1
1
|
import { Hono } from '#dep/hono/index';
|
2
2
|
import { createHtmlTransformer } from '#lib/html-utils/html-transformer';
|
3
3
|
import { serveStatic } from '@hono/node-server/serve-static';
|
4
|
-
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
5
4
|
import viteClientAssetManifest from 'virtual:polen/vite/client/manifest';
|
6
5
|
import { injectManifestIntoHtml } from './manifest.js';
|
7
6
|
import { PageMiddleware } from './middleware/page.js';
|
8
7
|
import { UnsupportedAssetsMiddleware } from './middleware/unsupported-assets.js';
|
9
8
|
import { createPolenDataInjector } from './transformers/inject-polen-data.js';
|
10
9
|
import { createThemeInitInjector } from './transformers/inject-theme-init.js';
|
11
|
-
export const createApp = (options
|
12
|
-
const app = new Hono.Hono();
|
10
|
+
export const createApp = (options) => {
|
11
|
+
const app = new Hono.Hono().basePath(options.paths.base);
|
12
|
+
// Static file serving
|
13
|
+
app.use(`*`, UnsupportedAssetsMiddleware());
|
14
|
+
const assetsRoutePattern = `${options.paths.assets.route}/*`;
|
15
|
+
app.use(assetsRoutePattern, serveStatic({
|
16
|
+
root: options.paths.assets.directory,
|
17
|
+
rewriteRequestPath: (path) => {
|
18
|
+
// When basePath is set, the full path including base is passed here
|
19
|
+
// We need to strip both the base path and the assets route
|
20
|
+
const basePath = options.paths.base === '/' ? '' : options.paths.base;
|
21
|
+
const fullPrefix = `${basePath}${options.paths.assets.route}`;
|
22
|
+
return path.replace(new RegExp(`^${fullPrefix}`), '');
|
23
|
+
},
|
24
|
+
onNotFound(path) {
|
25
|
+
console.log('not found', path);
|
26
|
+
},
|
27
|
+
}));
|
13
28
|
// Collect all HTML transformers
|
14
29
|
const htmlTransformers = [
|
15
30
|
// Always inject Polen global data (both dev and prod)
|
@@ -18,16 +33,11 @@ export const createApp = (options = {}) => {
|
|
18
33
|
createThemeInitInjector(),
|
19
34
|
...(options.hooks?.transformHtml || []),
|
20
35
|
];
|
21
|
-
// Core middleware
|
22
|
-
app.use(`*`, UnsupportedAssetsMiddleware());
|
23
|
-
// Production-specific setup
|
24
36
|
if (__BUILDING__) {
|
25
37
|
// Add manifest transformer
|
26
38
|
htmlTransformers.push(createHtmlTransformer((html, ___ctx) => {
|
27
|
-
return injectManifestIntoHtml(html, viteClientAssetManifest,
|
39
|
+
return injectManifestIntoHtml(html, viteClientAssetManifest, options.paths.base);
|
28
40
|
}));
|
29
|
-
// Static file serving
|
30
|
-
app.use(PROJECT_DATA.server.static.route, serveStatic({ root: PROJECT_DATA.server.static.directory }));
|
31
41
|
}
|
32
42
|
app.all(`*`, PageMiddleware(htmlTransformers));
|
33
43
|
return app;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,kCAAkC,CAAA;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,kCAAkC,CAAA;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAgC7E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAmB,EAAE,EAAE;IAC/C,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAExD,sBAAsB;IACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,2BAA2B,EAAE,CAAC,CAAA;IAE3C,MAAM,kBAAkB,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IAE5D,GAAG,CAAC,GAAG,CACL,kBAAkB,EAClB,WAAW,CAAC;QACV,IAAI,EAAE,OA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`ssr`:
|
13
13
|
const port = process.env[`PORT`] ? parseInt(process.env[`PORT`]) : PROJECT_DATA.server.port;
|
14
|
-
const app = createApp(
|
14
|
+
const app = createApp({
|
15
|
+
paths: {
|
16
|
+
assets: {
|
17
|
+
directory: PROJECT_DATA.paths.project.relative.build.relative.assets.root,
|
18
|
+
route: PROJECT_DATA.server.routes.assets,
|
19
|
+
},
|
20
|
+
base: PROJECT_DATA.basePath,
|
21
|
+
},
|
22
|
+
});
|
15
23
|
serve({ fetch: app.fetch, port });
|
16
24
|
break;
|
17
25
|
case `spa`:
|
@@ -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,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;
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/template/server/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,K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|
|
11
11
|
import { getRoutesPaths } from './get-route-paths.js';
|
12
12
|
export const generate = async (view) => {
|
13
13
|
const debug = debugPolen.sub(`ssg`);
|
14
|
-
const routePaths = getRoutesPaths();
|
14
|
+
const routePaths = await getRoutesPaths();
|
15
15
|
const totalPaths = routePaths.length;
|
16
16
|
debug(`start`, { totalPaths });
|
17
17
|
// Process routes in batches using the new utilities
|
@@ -59,7 +59,7 @@ export const generate = async (view) => {
|
|
59
59
|
});
|
60
60
|
const ssgResult = await Hono.SSG.toSSG(batchApp, NodeFs, {
|
61
61
|
concurrency: 5, // Reduced concurrency for memory efficiency
|
62
|
-
dir: PROJECT_DATA.paths.relative.build.root,
|
62
|
+
dir: PROJECT_DATA.paths.project.relative.build.root,
|
63
63
|
});
|
64
64
|
if (!ssgResult.success) {
|
65
65
|
throw new Error(`Failed to generate static site at batch ${batchIndex + 1}`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/template/server/ssg/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAA;AAC1C,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,CAAC,MAAM,QAAQ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,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACvE,CAAC;IAED,KAAK,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const getRoutesPaths: () => string[]
|
1
|
+
export declare const getRoutesPaths: () => Promise<string[]>;
|
2
2
|
//# sourceMappingURL=get-route-paths.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"get-route-paths.d.ts","sourceRoot":"","sources":["../../../../src/template/server/ssg/get-route-paths.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"get-route-paths.d.ts","sourceRoot":"","sources":["../../../../src/template/server/ssg/get-route-paths.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,MAAM,EAAE,CA+DvD,CAAA"}
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import { visit } from 'graphql';
|
3
|
-
// Or your specific import path for this type
|
1
|
+
import { Api } from '#api/index';
|
4
2
|
import { ReactRouterAid } from '#lib/react-router-aid/index';
|
3
|
+
import { visit } from 'graphql';
|
4
|
+
import * as NodeFs from 'node:fs/promises';
|
5
|
+
import * as NodePath from 'node:path';
|
5
6
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
6
7
|
import { routes } from '../../routes.js';
|
7
8
|
// todo: Frameworks tend to colocate ssg data loaders with routes to solve the following
|
@@ -9,35 +10,58 @@ import { routes } from '../../routes.js';
|
|
9
10
|
// Maybe we can figure something out too.
|
10
11
|
const knownParameterizedRouteExpressions = {
|
11
12
|
reference_type: `/reference/:type`,
|
13
|
+
reference_versioned_type: `/reference/version/:version/:type`,
|
12
14
|
};
|
13
|
-
export const getRoutesPaths = () => {
|
15
|
+
export const getRoutesPaths = async () => {
|
14
16
|
const paths = new Set();
|
15
17
|
const routeExpressions = ReactRouterAid.getRouteExpressions(routes);
|
18
|
+
// Helper function to load schema from filesystem and add type paths
|
19
|
+
const addTypePathsForVersion = async (version, pathPrefix) => {
|
20
|
+
try {
|
21
|
+
const schemaFilePath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, `${version}.json`);
|
22
|
+
const schemaContent = await NodeFs.readFile(schemaFilePath, 'utf-8');
|
23
|
+
const schemaAst = JSON.parse(schemaContent);
|
24
|
+
visit(schemaAst, {
|
25
|
+
ObjectTypeDefinition(node) {
|
26
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
27
|
+
},
|
28
|
+
InterfaceTypeDefinition(node) {
|
29
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
30
|
+
},
|
31
|
+
EnumTypeDefinition(node) {
|
32
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
33
|
+
},
|
34
|
+
InputObjectTypeDefinition(node) {
|
35
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
36
|
+
},
|
37
|
+
UnionTypeDefinition(node) {
|
38
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
39
|
+
},
|
40
|
+
ScalarTypeDefinition(node) {
|
41
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
42
|
+
},
|
43
|
+
});
|
44
|
+
}
|
45
|
+
catch (error) {
|
46
|
+
throw new Error(`SSG failed to load schema for version ${version}. Ensure schema assets are built. ${error}`);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
const schemaMetadataPath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, 'metadata.json');
|
50
|
+
const schemaMetadata = await Api.Schema.getMetadata(schemaMetadataPath);
|
51
|
+
const { hasSchema, versions: availableVersions } = schemaMetadata;
|
16
52
|
for (const exp of routeExpressions) {
|
17
53
|
if (exp === knownParameterizedRouteExpressions.reference_type) {
|
18
|
-
if (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
paths.add(`/reference/${node.name.value}`);
|
30
|
-
},
|
31
|
-
InputObjectTypeDefinition(node) {
|
32
|
-
paths.add(`/reference/${node.name.value}`);
|
33
|
-
},
|
34
|
-
UnionTypeDefinition(node) {
|
35
|
-
paths.add(`/reference/${node.name.value}`);
|
36
|
-
},
|
37
|
-
ScalarTypeDefinition(node) {
|
38
|
-
paths.add(`/reference/${node.name.value}`);
|
39
|
-
},
|
40
|
-
});
|
54
|
+
if (hasSchema) {
|
55
|
+
// Add paths for latest version (no version in URL)
|
56
|
+
await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
else if (exp === knownParameterizedRouteExpressions.reference_versioned_type) {
|
60
|
+
if (hasSchema) {
|
61
|
+
// Add paths for all versions using new route structure
|
62
|
+
for (const version of availableVersions) {
|
63
|
+
await addTypePathsForVersion(version, `/reference/version/${version}`);
|
64
|
+
}
|
41
65
|
}
|
42
66
|
}
|
43
67
|
else if (ReactRouterAid.isParameterizedPath(exp)) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"get-route-paths.js","sourceRoot":"","sources":["../../../../src/template/server/ssg/get-route-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"get-route-paths.js","sourceRoot":"","sources":["../../../../src/template/server/ssg/get-route-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAA;AACrC,OAAO,YAAY,MA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AC;YAC/E,IAAI,SAAS,EAAE,CAAC;gBACd,uDAAuD;gBACvD,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;oBACxC,MAAM,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,OAAO,EAAE,CAAC,CAAA;gBACxE,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,cAAc,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAA;QACzD,CAAC;aAAM,CAAC;YACN,cAAc;YACd,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA,CAAC,gCAAgC;AAClE,CAAC,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare const schemaSource: {
|
2
|
+
versions: string[];
|
3
|
+
isEmpty: boolean;
|
4
|
+
get: (version: string) => Promise<import("graphql").GraphQLSchema>;
|
5
|
+
getChangelog: (version: string) => Promise<import("../../api/schema/schema.js").ChangelogData>;
|
6
|
+
getAllChangesets: () => Promise<import("../../lib/graphql-changeset/graphql-changeset.js").ChangeSet[]>;
|
7
|
+
clearCache: () => void;
|
8
|
+
writeSchema: (version: string, schema: import("graphql").GraphQLSchema) => Promise<void>;
|
9
|
+
writeChangelog: (version: string, changelog: import("../../api/schema/schema.js").ChangelogData) => Promise<void>;
|
10
|
+
clearAllAssets: () => Promise<void>;
|
11
|
+
removeAsset: (version: string) => Promise<void>;
|
12
|
+
writeMetadata: (metadata: import("../../api/schema/metadata.js").SchemaMetadata) => Promise<void>;
|
13
|
+
writeAllAssets: (schemaData: Awaited<ReturnType<typeof import("../../api/schema/read.js").readOrThrow>>, metadata: import("../../api/schema/metadata.js").SchemaMetadata) => Promise<void>;
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=schema-source.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-source.d.ts","sourceRoot":"","sources":["../../../src/template/sources/schema-source.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAIvB,CAAA"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
2
|
+
import PROJECT_SCHEMA_METADATA from 'virtual:polen/project/schema-metadata';
|
3
|
+
import { createSchemaSource } from '../../api/schema-source/index.js';
|
4
|
+
import { polenUrlPathAssets } from '../lib/polen-url.js';
|
5
|
+
// Environment-specific IO implementation
|
6
|
+
const io = import.meta.env.SSR
|
7
|
+
? {
|
8
|
+
// Server-side: Read from filesystem
|
9
|
+
read: async (path) => {
|
10
|
+
// Dynamic import to keep fs out of client bundle
|
11
|
+
const { readFile } = await import('node:fs/promises');
|
12
|
+
// Extract the path after the assets route
|
13
|
+
// e.g., "/assets/schemas/latest.json" -> "schemas/latest.json"
|
14
|
+
const assetsRoute = PROJECT_DATA.server.routes.assets;
|
15
|
+
const routePattern = new RegExp(`^${assetsRoute}/(.+)$`);
|
16
|
+
const match = path.match(routePattern);
|
17
|
+
const assetPath = match ? match[1] : path;
|
18
|
+
// In SSR, we need to read from the correct location
|
19
|
+
// During dev, assets are served from Polen's node_modules
|
20
|
+
// In production, they're in the build output directory
|
21
|
+
let fullPath;
|
22
|
+
if (import.meta.env.DEV) {
|
23
|
+
// Development: Read from Polen's Vite cache
|
24
|
+
fullPath = `${PROJECT_DATA.paths.framework.devAssets.absolute}/${assetPath}`;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
// Production: Read from build output
|
28
|
+
// The server runs from the project root, and assets are in build/assets/
|
29
|
+
fullPath =
|
30
|
+
`${PROJECT_DATA.paths.project.relative.build.root}/${PROJECT_DATA.paths.project.relative.build.relative.assets.root}/${assetPath}`;
|
31
|
+
}
|
32
|
+
return readFile(fullPath, 'utf-8');
|
33
|
+
},
|
34
|
+
}
|
35
|
+
: {
|
36
|
+
// Client-side: Fetch from HTTP
|
37
|
+
read: async (path) => {
|
38
|
+
const response = await fetch(path);
|
39
|
+
if (!response.ok) {
|
40
|
+
throw new Error(`Failed to fetch: ${path} (${response.status} ${response.statusText})`);
|
41
|
+
}
|
42
|
+
return response.text();
|
43
|
+
},
|
44
|
+
};
|
45
|
+
// Create and export the source object directly
|
46
|
+
export const schemaSource = createSchemaSource({
|
47
|
+
io,
|
48
|
+
versions: PROJECT_SCHEMA_METADATA.versions,
|
49
|
+
assetsPath: polenUrlPathAssets(),
|
50
|
+
});
|
51
|
+
// HMR cache invalidation for development
|
52
|
+
if (import.meta.hot) {
|
53
|
+
import.meta.hot.on('polen:schema-invalidate', () => {
|
54
|
+
console.log('[HMR] Schema cache invalidated');
|
55
|
+
schemaSource.clearCache();
|
56
|
+
// Brute force approach: reload the page to ensure fresh data
|
57
|
+
// This guarantees all components see the updated schema immediately
|
58
|
+
// TODO: When we have reactive data fetching, remove this reload
|
59
|
+
// and let the reactive system handle updates gracefully
|
60
|
+
window.location.reload();
|
61
|
+
});
|
62
|
+
}
|
63
|
+
//# sourceMappingURL=schema-source.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-source.js","sourceRoot":"","sources":["../../../src/template/sources/schema-source.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,uBAAuB,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,yCAAyC;AACzC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;IAC5B,CAAC,CAAC;QACA,oCAAoC;QACpC,IAAI,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE;YAC3B,iDAAiD;YACjD,MAAM,EAAE,QAAQ,EAA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