polen 0.10.0 → 0.11.0-next.10
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 +55 -26
- 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/data-sources.d.ts +1 -0
- package/build/api/schema/data-sources/data-sources.d.ts.map +1 -1
- package/build/api/schema/data-sources/data-sources.js +1 -0
- package/build/api/schema/data-sources/data-sources.js.map +1 -1
- package/build/api/schema/data-sources/introspection/introspection.d.ts +83 -0
- package/build/api/schema/data-sources/introspection/introspection.d.ts.map +1 -0
- package/build/api/schema/data-sources/introspection/introspection.js +110 -0
- package/build/api/schema/data-sources/introspection/introspection.js.map +1 -0
- 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 +85 -11
- package/build/api/schema/read.d.ts.map +1 -1
- package/build/api/schema/read.js +15 -6
- 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/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +3 -0
- package/build/api/vite/plugins/build.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 +25 -22
- 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 +310 -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/cli/commands/open.js +1 -1
- package/build/cli/commands/open.js.map +1 -1
- package/build/lib/grafaid/schema/schema.d.ts +1 -1
- package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
- package/build/lib/grafaid/schema/schema.js +1 -1
- package/build/lib/grafaid/schema/schema.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 +14 -2
- 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/lib/react-router-aid/react-router-aid.d.ts +5 -3
- package/build/lib/react-router-aid/react-router-aid.d.ts.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.js +7 -4
- package/build/lib/react-router-aid/react-router-aid.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 +15 -9
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/index.js +2 -2
- package/build/template/routes/index.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.d.ts +35 -6
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +97 -14
- 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 +11 -75
- 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 +90 -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 +64 -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 +86 -36
- package/src/api/config/merge.ts +0 -16
- package/src/api/content/metadata.ts +1 -1
- package/src/api/schema/data-sources/data-sources.ts +1 -0
- package/src/api/schema/data-sources/introspection/introspection.ts +213 -0
- 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 +109 -18
- 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/build.ts +3 -0
- package/src/api/vite/plugins/core.ts +27 -22
- package/src/api/vite/plugins/main.ts +1 -9
- package/src/api/vite/plugins/schema-assets.ts +364 -0
- package/src/api/vite/plugins/serve.ts +15 -8
- package/src/cli/commands/open.ts +1 -1
- package/src/lib/grafaid/schema/schema.ts +1 -0
- package/src/lib/graphql-change/change-groups.ts +57 -0
- package/src/lib/kit-temp.ts +15 -2
- package/src/lib/mask/$.test.ts +3 -3
- package/src/lib/path-map/$.test.ts +22 -19
- package/src/lib/path-map/path-map.ts +3 -1
- package/src/lib/react-router-aid/react-router-aid.ts +12 -6
- 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 +19 -10
- package/src/template/routes/index.tsx +2 -2
- package/src/template/routes/pages.tsx +109 -0
- package/src/template/routes/reference.tsx +112 -12
- package/src/template/routes/root.tsx +11 -112
- 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.test.ts +132 -0
- package/src/template/server/ssg/get-route-paths.ts +91 -27
- package/src/template/sources/schema-source.ts +69 -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/build/template/routes/reference.$type.$field.d.ts +0 -5
- package/build/template/routes/reference.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.$type.$field.js +0 -31
- package/build/template/routes/reference.$type.$field.js.map +0 -1
- package/build/template/routes/reference.$type.d.ts +0 -5
- package/build/template/routes/reference.$type.d.ts.map +0 -1
- package/build/template/routes/reference.$type.js +0 -23
- package/build/template/routes/reference.$type.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/src/template/routes/reference.$type.$field.tsx +0 -34
- package/src/template/routes/reference.$type.tsx +0 -27
- /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -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,97 @@ 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_type_field: `/reference/:type/:field`,
|
14
|
+
reference_version: `/reference/version/:version`,
|
15
|
+
reference_versioned_type: `/reference/version/:version/:type`,
|
16
|
+
reference_versioned_type_field: `/reference/version/:version/:type/:field`,
|
12
17
|
};
|
13
|
-
export const getRoutesPaths = () => {
|
18
|
+
export const getRoutesPaths = async () => {
|
14
19
|
const paths = new Set();
|
15
20
|
const routeExpressions = ReactRouterAid.getRouteExpressions(routes);
|
21
|
+
// Helper function to load schema from filesystem and add type paths
|
22
|
+
const addTypePathsForVersion = async (version, pathPrefix, includeFields = false) => {
|
23
|
+
try {
|
24
|
+
const schemaFilePath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, `${version}.json`);
|
25
|
+
const schemaContent = await NodeFs.readFile(schemaFilePath, 'utf-8');
|
26
|
+
const schemaAst = JSON.parse(schemaContent);
|
27
|
+
visit(schemaAst, {
|
28
|
+
ObjectTypeDefinition(node) {
|
29
|
+
const typePath = `${pathPrefix}/${node.name.value}`;
|
30
|
+
paths.add(typePath);
|
31
|
+
// Add field paths if requested
|
32
|
+
if (includeFields && node.fields) {
|
33
|
+
for (const field of node.fields) {
|
34
|
+
paths.add(`${typePath}/${field.name.value}`);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
InterfaceTypeDefinition(node) {
|
39
|
+
const typePath = `${pathPrefix}/${node.name.value}`;
|
40
|
+
paths.add(typePath);
|
41
|
+
// Add field paths if requested
|
42
|
+
if (includeFields && node.fields) {
|
43
|
+
for (const field of node.fields) {
|
44
|
+
paths.add(`${typePath}/${field.name.value}`);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
},
|
48
|
+
EnumTypeDefinition(node) {
|
49
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
50
|
+
},
|
51
|
+
InputObjectTypeDefinition(node) {
|
52
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
53
|
+
},
|
54
|
+
UnionTypeDefinition(node) {
|
55
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
56
|
+
},
|
57
|
+
ScalarTypeDefinition(node) {
|
58
|
+
paths.add(`${pathPrefix}/${node.name.value}`);
|
59
|
+
},
|
60
|
+
});
|
61
|
+
}
|
62
|
+
catch (error) {
|
63
|
+
throw new Error(`SSG failed to load schema for version ${version}. Ensure schema assets are built. ${error}`);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
const schemaMetadataPath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, 'metadata.json');
|
67
|
+
const schemaMetadata = await Api.Schema.getMetadata(schemaMetadataPath);
|
68
|
+
const { hasSchema, versions: availableVersions } = schemaMetadata;
|
16
69
|
for (const exp of routeExpressions) {
|
17
70
|
if (exp === knownParameterizedRouteExpressions.reference_type) {
|
18
|
-
if (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
71
|
+
if (hasSchema) {
|
72
|
+
// Add paths for latest version (no version in URL)
|
73
|
+
await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else if (exp === knownParameterizedRouteExpressions.reference_version) {
|
77
|
+
if (hasSchema) {
|
78
|
+
// Add paths for version pages themselves (without type)
|
79
|
+
for (const version of availableVersions) {
|
80
|
+
paths.add(`/reference/version/${version}`);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
else if (exp === knownParameterizedRouteExpressions.reference_type_field) {
|
85
|
+
if (hasSchema) {
|
86
|
+
// Add paths for latest version fields
|
87
|
+
await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`, true);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
else if (exp === knownParameterizedRouteExpressions.reference_versioned_type) {
|
91
|
+
if (hasSchema) {
|
92
|
+
// Add paths for all versions using new route structure
|
93
|
+
for (const version of availableVersions) {
|
94
|
+
await addTypePathsForVersion(version, `/reference/version/${version}`);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
else if (exp === knownParameterizedRouteExpressions.reference_versioned_type_field) {
|
99
|
+
if (hasSchema) {
|
100
|
+
// Add paths for all versions with fields
|
101
|
+
for (const version of availableVersions) {
|
102
|
+
await addTypePathsForVersion(version, `/reference/version/${version}`, true);
|
103
|
+
}
|
41
104
|
}
|
42
105
|
}
|
43
106
|
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,MAAM,sCAAsC,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,wFAAwF;AACxF,uEAAuE;AACvE,yCAAyC;AACzC,MAAM,kCAAkC,GAAG;IACzC,cAAc,EAAE,kBAAkB;IAClC,oBAAoB,EAAE,yBAAyB;IAC/C,iBAAiB,EAAE,6BAA6B;IAChD,wBAAwB,EAAE,mCAAmC;IAC7D,8BAA8B,EAAE,0CAA0C;CAC3E,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAAuB,EAAE;IAC1D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,MAAM,gBAA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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>>["data"], 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":"AAkDA,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAIvB,CAAA"}
|
@@ -0,0 +1,64 @@
|
|
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
|
+
// e.g., "/demos/pokemon/assets/schemas/latest.json" -> "schemas/latest.json"
|
15
|
+
const assetsRoute = PROJECT_DATA.server.routes.assets;
|
16
|
+
const routePattern = new RegExp(`${assetsRoute}/(.+)$`);
|
17
|
+
const match = path.match(routePattern);
|
18
|
+
const assetPath = match ? match[1] : path;
|
19
|
+
// In SSR, we need to read from the correct location
|
20
|
+
// During dev, assets are served from Polen's node_modules
|
21
|
+
// In production, they're in the build output directory
|
22
|
+
let fullPath;
|
23
|
+
if (import.meta.env.DEV) {
|
24
|
+
// Development: Read from Polen's Vite cache
|
25
|
+
fullPath = `${PROJECT_DATA.paths.framework.devAssets.absolute}/${assetPath}`;
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
// Production: Read from build output
|
29
|
+
// The server runs from the project root, and assets are in build/assets/
|
30
|
+
fullPath =
|
31
|
+
`${PROJECT_DATA.paths.project.relative.build.root}/${PROJECT_DATA.paths.project.relative.build.relative.assets.root}/${assetPath}`;
|
32
|
+
}
|
33
|
+
return readFile(fullPath, 'utf-8');
|
34
|
+
},
|
35
|
+
}
|
36
|
+
: {
|
37
|
+
// Client-side: Fetch from HTTP
|
38
|
+
read: async (path) => {
|
39
|
+
const response = await fetch(path);
|
40
|
+
if (!response.ok) {
|
41
|
+
throw new Error(`Failed to fetch: ${path} (${response.status} ${response.statusText})`);
|
42
|
+
}
|
43
|
+
return response.text();
|
44
|
+
},
|
45
|
+
};
|
46
|
+
// Create and export the source object directly
|
47
|
+
export const schemaSource = createSchemaSource({
|
48
|
+
io,
|
49
|
+
versions: PROJECT_SCHEMA_METADATA.versions,
|
50
|
+
assetsPath: polenUrlPathAssets(),
|
51
|
+
});
|
52
|
+
// HMR cache invalidation for development
|
53
|
+
if (import.meta.hot) {
|
54
|
+
import.meta.hot.on('polen:schema-invalidate', () => {
|
55
|
+
console.log('[HMR] Schema cache invalidated');
|
56
|
+
schemaSource.clearCache();
|
57
|
+
// Brute force approach: reload the page to ensure fresh data
|
58
|
+
// This guarantees all components see the updated schema immediately
|
59
|
+
// TODO: When we have reactive data fetching, remove this reload
|
60
|
+
// and let the reactive system handle updates gracefully
|
61
|
+
window.location.reload();
|
62
|
+
});
|
63
|
+
}
|
64
|
+
//# 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,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAErD,0CAA0C;YAC1C,+DAA+D;YAC/D,6EAA6E;YAC7E,MAAM,WAAW,GAAG,YAAY,CAAC,M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AC,IAAI,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;IAC7C,EAAE;IACF,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;IAC1C,UAAU,EAAE,kBAAkB,EAAE;CACjC,CAAC,CAAA;AAEF,yCAAyC;AACzC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjD,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC7C,YAAY,CAAC,UAAU,EAAE,CAAA;QAEzB,6DAA6D;QAC7D,oEAAoE;QACpE,gEAAgE;QAChE,8DAA8D;QAC9D,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.11.0-next.10",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -87,18 +87,18 @@
|
|
87
87
|
"@graphql-inspector/core": "^6.2.1",
|
88
88
|
"@graphql-tools/load": "^8.1.0",
|
89
89
|
"@hiogawa/vite-plugin-ssr-css": "^0.0.1",
|
90
|
-
"@hono/node-server": "^1.
|
90
|
+
"@hono/node-server": "^1.16.0",
|
91
91
|
"@mdx-js/mdx": "^3.1.0",
|
92
92
|
"@mdx-js/react": "^3.1.0",
|
93
93
|
"@mdx-js/rollup": "^3.1.0",
|
94
94
|
"@radix-ui/react-icons": "^1.3.2",
|
95
95
|
"@radix-ui/themes": "^3.2.1",
|
96
|
-
"@rolldown/pluginutils": "1.0.0-beta.
|
96
|
+
"@rolldown/pluginutils": "1.0.0-beta.27",
|
97
97
|
"@rollup/pluginutils": "^5.2.0",
|
98
98
|
"@types/jsesc": "^3.0.3",
|
99
99
|
"@vitejs/plugin-react": "^4.6.0",
|
100
100
|
"@vitejs/plugin-react-oxc": "^0.2.3",
|
101
|
-
"@vltpkg/semver": "0.0.0-
|
101
|
+
"@vltpkg/semver": "0.0.0-17",
|
102
102
|
"@vue/reactivity": "^3.5.17",
|
103
103
|
"@wollybeard/kit": "^0.41.0",
|
104
104
|
"@wollybeard/projector": "^0.3.0",
|
@@ -107,12 +107,12 @@
|
|
107
107
|
"codehike": "^1.0.7",
|
108
108
|
"consola": "^3.4.2",
|
109
109
|
"defu": "^6.1.4",
|
110
|
-
"es-toolkit": "^1.39.
|
110
|
+
"es-toolkit": "^1.39.7",
|
111
111
|
"fuse.js": "^7.1.0",
|
112
112
|
"graffle": "8.0.0-next.163",
|
113
113
|
"graphql": "^16.11.0",
|
114
114
|
"gray-matter": "^4.0.3",
|
115
|
-
"hono": "^4.8.
|
115
|
+
"hono": "^4.8.5",
|
116
116
|
"jsesc": "^3.1.0",
|
117
117
|
"jsonc-parser": "^3.3.1",
|
118
118
|
"react": "^19.1.0",
|
@@ -126,22 +126,21 @@
|
|
126
126
|
"remark-parse": "^11.0.0",
|
127
127
|
"remark-rehype": "^11.1.2",
|
128
128
|
"resolve.imports": "^2.0.3",
|
129
|
-
"rolldown": "1.0.0-beta.
|
129
|
+
"rolldown": "1.0.0-beta.27",
|
130
130
|
"simple-git": "^3.28.0",
|
131
131
|
"source-map": "^0.7.4",
|
132
132
|
"superjson": "^2.2.2",
|
133
133
|
"tinyglobby": "^0.2.14",
|
134
|
-
"tree-sitter-graphql-grammar-wasm": "^1.
|
134
|
+
"tree-sitter-graphql-grammar-wasm": "^1.1.0",
|
135
135
|
"tsx": "^4.20.3",
|
136
136
|
"typescript": "^5.8.3",
|
137
137
|
"unified": "^11.0.5",
|
138
138
|
"vfile": "^6.0.3",
|
139
|
-
"vite": "npm:rolldown-vite@^7.0.
|
139
|
+
"vite": "npm:rolldown-vite@^7.0.9",
|
140
140
|
"vite-plugin-inspect": "^11.3.0",
|
141
|
-
"
|
142
|
-
"web-tree-sitter": "^0.25.6",
|
141
|
+
"web-tree-sitter": "^0.25.8",
|
143
142
|
"youch-core": "^0.3.3",
|
144
|
-
"zx": "8.
|
143
|
+
"zx": "8.7.1"
|
145
144
|
},
|
146
145
|
"devDependencies": {
|
147
146
|
"@actions/core": "^1.11.1",
|
@@ -151,15 +150,15 @@
|
|
151
150
|
"@actions/io": "^1.1.3",
|
152
151
|
"@changesets/cli": "^2.29.5",
|
153
152
|
"@molt/command": "^0.9.0",
|
154
|
-
"@octokit/core": "^7.0.
|
153
|
+
"@octokit/core": "^7.0.3",
|
155
154
|
"@octokit/types": "^14.1.0",
|
156
|
-
"@playwright/browser-chromium": "^1.
|
155
|
+
"@playwright/browser-chromium": "^1.54.1",
|
157
156
|
"@testing-library/react": "^16.3.0",
|
158
157
|
"@tsconfig/node-lts": "^22.0.2",
|
159
158
|
"@tsconfig/node22": "^22.0.2",
|
160
159
|
"@tsconfig/strictest": "^2.0.5",
|
161
160
|
"@types/jsdom": "^21.1.7",
|
162
|
-
"@types/node": "^24.0.
|
161
|
+
"@types/node": "^24.0.14",
|
163
162
|
"@types/react": "^19.1.8",
|
164
163
|
"@types/react-dom": "^19.1.6",
|
165
164
|
"@types/semver": "^7.7.0",
|
@@ -167,10 +166,10 @@
|
|
167
166
|
"dripip": "^0.10.0",
|
168
167
|
"fast-check": "^4.2.0",
|
169
168
|
"fs-jetpack": "^5.1.0",
|
170
|
-
"get-port-please": "^3.
|
169
|
+
"get-port-please": "^3.2.0",
|
171
170
|
"globals": "^16.3.0",
|
172
171
|
"jsdom": "^26.1.0",
|
173
|
-
"playwright": "1.
|
172
|
+
"playwright": "1.54.1",
|
174
173
|
"publint": "^0.3.12",
|
175
174
|
"semver": "^7.7.2",
|
176
175
|
"strip-ansi": "^7.1.0",
|
package/src/api/api.ts
CHANGED
@@ -31,25 +31,56 @@ export interface ConfigInput {
|
|
31
31
|
* - `file` - Load from a single SDL file (default: schema.graphql)
|
32
32
|
* - `directory` - Load multiple SDL files with date prefixes (enables changelog)
|
33
33
|
* - `memory` - Define schemas programmatically in configuration
|
34
|
+
* - `introspection` - Fetch schema from a GraphQL endpoint
|
35
|
+
* - `data` - Use pre-built schema objects
|
34
36
|
*
|
35
37
|
* @example
|
36
38
|
* ```ts
|
37
|
-
* //
|
39
|
+
* // Default: looks for schema.graphql
|
40
|
+
* schema: {}
|
41
|
+
*
|
42
|
+
* // Load via introspection
|
38
43
|
* schema: {
|
39
|
-
* useDataSources: 'file',
|
40
44
|
* dataSources: {
|
41
|
-
*
|
45
|
+
* introspection: {
|
46
|
+
* url: 'https://api.example.com/graphql',
|
47
|
+
* headers: { 'Authorization': `Bearer ${process.env.API_TOKEN}` }
|
48
|
+
* }
|
42
49
|
* }
|
43
50
|
* }
|
44
51
|
*
|
45
52
|
* // Multiple versions for changelog
|
46
53
|
* schema: {
|
47
|
-
* useDataSources: 'directory',
|
48
54
|
* dataSources: {
|
49
55
|
* directory: { path: './schema' }
|
50
56
|
* }
|
51
57
|
* }
|
58
|
+
*
|
59
|
+
* // Custom source order
|
60
|
+
* schema: {
|
61
|
+
* useDataSources: ['introspection', 'file'],
|
62
|
+
* dataSources: {
|
63
|
+
* introspection: { url: 'https://api.example.com/graphql' },
|
64
|
+
* file: { path: './fallback.graphql' }
|
65
|
+
* }
|
66
|
+
* }
|
52
67
|
* ```
|
68
|
+
*
|
69
|
+
* **Two introspection features**:
|
70
|
+
* 1. **File Convention**: Polen auto-detects `schema.introspection.json` files
|
71
|
+
* 2. **Config-driven**: Polen fetches and caches introspection for you
|
72
|
+
*
|
73
|
+
* **Interoperability**: The `schema.introspection.json` file uses the standard
|
74
|
+
* GraphQL introspection format, compatible with GraphQL Codegen, Apollo CLI, etc.
|
75
|
+
*
|
76
|
+
* **Lifecycle**:
|
77
|
+
* - First run: Fetches from endpoint, saves to `schema.introspection.json`
|
78
|
+
* - Subsequent runs: Loads from JSON file (no network request)
|
79
|
+
* - To refresh: Delete the JSON file
|
80
|
+
* - Runs during `polen dev` and `polen build`, never at runtime
|
81
|
+
*
|
82
|
+
* **Query details**: Uses the standard introspection query from the GraphQL spec
|
83
|
+
* @see https://spec.graphql.org/draft/#sec-Introspection
|
53
84
|
*/
|
54
85
|
schema?: SchemaConfigInput
|
55
86
|
/**
|
@@ -240,22 +271,6 @@ export interface ConfigInput {
|
|
240
271
|
* @default false
|
241
272
|
*/
|
242
273
|
isSelfContainedMode?: boolean
|
243
|
-
/**
|
244
|
-
* Tweak the watch behavior.
|
245
|
-
*/
|
246
|
-
watch?: {
|
247
|
-
/**
|
248
|
-
* Restart the development server when some arbitrary files change.
|
249
|
-
*
|
250
|
-
* Use this to restart when files that are not already watched by vite change.
|
251
|
-
*
|
252
|
-
* @see https://github.com/antfu/vite-plugin-restart
|
253
|
-
*/
|
254
|
-
/**
|
255
|
-
* File paths to watch and restart the development server when they change.
|
256
|
-
*/
|
257
|
-
also?: string[]
|
258
|
-
}
|
259
274
|
/**
|
260
275
|
* Whether to enable debug mode.
|
261
276
|
*
|
@@ -289,6 +304,13 @@ const buildPaths = (rootDir: string): Config[`paths`] => {
|
|
289
304
|
|
290
305
|
const publicAbsolutePath = rootAbsolute(`public`)
|
291
306
|
const publicAbsolute = Path.ensureAbsoluteWith(publicAbsolutePath)
|
307
|
+
|
308
|
+
const assetsAbsolute = Path.ensureAbsoluteWith(buildAbsolute(`assets`))
|
309
|
+
|
310
|
+
// Dev assets paths
|
311
|
+
const devAssetsRelative = 'node_modules/.vite/polen-assets'
|
312
|
+
const devAssetsAbsolute = Path.join(packagePaths.rootDir, devAssetsRelative)
|
313
|
+
|
292
314
|
return {
|
293
315
|
project: {
|
294
316
|
rootDir,
|
@@ -297,7 +319,12 @@ const buildPaths = (rootDir: string): Config[`paths`] => {
|
|
297
319
|
root: `build`,
|
298
320
|
relative: {
|
299
321
|
serverEntrypoint: `app.js`,
|
300
|
-
assets:
|
322
|
+
assets: {
|
323
|
+
root: `assets`,
|
324
|
+
relative: {
|
325
|
+
schemas: `schemas`,
|
326
|
+
},
|
327
|
+
},
|
301
328
|
},
|
302
329
|
},
|
303
330
|
pages: `pages`,
|
@@ -311,7 +338,10 @@ const buildPaths = (rootDir: string): Config[`paths`] => {
|
|
311
338
|
build: {
|
312
339
|
root: buildAbsolute(`.`),
|
313
340
|
serverEntrypoint: buildAbsolute(`app.js`),
|
314
|
-
assets:
|
341
|
+
assets: {
|
342
|
+
root: buildAbsolute(`assets`),
|
343
|
+
schemas: assetsAbsolute(`schemas`),
|
344
|
+
},
|
315
345
|
},
|
316
346
|
public: {
|
317
347
|
root: publicAbsolute(`.`),
|
@@ -319,7 +349,14 @@ const buildPaths = (rootDir: string): Config[`paths`] => {
|
|
319
349
|
},
|
320
350
|
},
|
321
351
|
},
|
322
|
-
framework:
|
352
|
+
framework: {
|
353
|
+
...packagePaths,
|
354
|
+
devAssets: {
|
355
|
+
relative: devAssetsRelative,
|
356
|
+
absolute: devAssetsAbsolute,
|
357
|
+
schemas: Path.join(devAssetsAbsolute, 'schemas'),
|
358
|
+
},
|
359
|
+
},
|
323
360
|
}
|
324
361
|
}
|
325
362
|
|
@@ -331,9 +368,9 @@ export interface Config {
|
|
331
368
|
}
|
332
369
|
server: {
|
333
370
|
port: number
|
334
|
-
|
335
|
-
|
336
|
-
|
371
|
+
routes: {
|
372
|
+
assets: string
|
373
|
+
}
|
337
374
|
}
|
338
375
|
templateVariables: TemplateVariables
|
339
376
|
schemaAugmentations: SchemaAugmentation.Augmentation[]
|
@@ -353,7 +390,12 @@ export interface Config {
|
|
353
390
|
build: {
|
354
391
|
root: string
|
355
392
|
relative: {
|
356
|
-
assets:
|
393
|
+
assets: {
|
394
|
+
root: string
|
395
|
+
relative: {
|
396
|
+
schemas: string
|
397
|
+
}
|
398
|
+
}
|
357
399
|
serverEntrypoint: string
|
358
400
|
}
|
359
401
|
}
|
@@ -366,7 +408,10 @@ export interface Config {
|
|
366
408
|
absolute: {
|
367
409
|
build: {
|
368
410
|
root: string
|
369
|
-
assets:
|
411
|
+
assets: {
|
412
|
+
root: string
|
413
|
+
schemas: string
|
414
|
+
}
|
370
415
|
serverEntrypoint: string
|
371
416
|
}
|
372
417
|
pages: string
|
@@ -376,7 +421,13 @@ export interface Config {
|
|
376
421
|
}
|
377
422
|
}
|
378
423
|
}
|
379
|
-
framework: PackagePaths
|
424
|
+
framework: PackagePaths & {
|
425
|
+
devAssets: {
|
426
|
+
relative: string
|
427
|
+
absolute: string
|
428
|
+
schemas: string
|
429
|
+
}
|
430
|
+
}
|
380
431
|
}
|
381
432
|
advanced: {
|
382
433
|
isSelfContainedMode: boolean
|
@@ -392,15 +443,15 @@ const configInputDefaults: Config = {
|
|
392
443
|
title: `My Developer Portal`,
|
393
444
|
},
|
394
445
|
schemaAugmentations: [],
|
395
|
-
watch: {
|
396
|
-
also: [],
|
397
|
-
},
|
398
446
|
build: {
|
399
447
|
architecture: BuildArchitecture.enum.ssg,
|
400
448
|
base: `/`,
|
401
449
|
},
|
402
450
|
server: {
|
403
451
|
port: 3000,
|
452
|
+
routes: {
|
453
|
+
assets: '/assets',
|
454
|
+
},
|
404
455
|
},
|
405
456
|
schema: null,
|
406
457
|
ssr: {
|
@@ -499,14 +550,13 @@ export const normalizeInput = async (
|
|
499
550
|
config.advanced.explorer = configInput.advanced.explorer
|
500
551
|
}
|
501
552
|
|
502
|
-
if (configInput?.advanced?.watch?.also) {
|
503
|
-
config.watch.also = configInput.advanced.watch.also
|
504
|
-
}
|
505
|
-
|
506
553
|
if (configInput?.server?.port !== undefined) {
|
507
554
|
config.server.port = configInput.server.port
|
508
555
|
}
|
509
556
|
|
557
|
+
// Server routes are not configurable by users yet, use defaults
|
558
|
+
// config.server.routes is already set from defaultConfig
|
559
|
+
|
510
560
|
// Process warnings configuration
|
511
561
|
if (configInput?.warnings?.interactiveWithoutSchema?.enabled !== undefined) {
|
512
562
|
config.warnings.interactiveWithoutSchema.enabled = configInput.warnings.interactiveWithoutSchema.enabled
|
package/src/api/config/merge.ts
CHANGED
@@ -48,22 +48,6 @@ export const mergeInputs = (
|
|
48
48
|
if (base.advanced ?? overrides.advanced) {
|
49
49
|
merged.advanced = spreadShallow(base.advanced, overrides.advanced)
|
50
50
|
|
51
|
-
// Merge advanced.watch config
|
52
|
-
if (base.advanced?.watch ?? overrides.advanced?.watch) {
|
53
|
-
merged.advanced.watch = spreadShallow(
|
54
|
-
base.advanced?.watch,
|
55
|
-
overrides.advanced?.watch,
|
56
|
-
)
|
57
|
-
|
58
|
-
// Merge watch.also arrays
|
59
|
-
if (base.advanced?.watch?.also ?? overrides.advanced?.watch?.also) {
|
60
|
-
merged.advanced.watch.also = [
|
61
|
-
...(base.advanced?.watch?.also ?? []),
|
62
|
-
...(overrides.advanced?.watch?.also ?? []),
|
63
|
-
]
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
51
|
// Merge Vite configs if present
|
68
52
|
if (base.advanced?.vite ?? overrides.advanced?.vite) {
|
69
53
|
merged.advanced.vite = Vite.mergeConfig(
|