polen 0.10.0 → 0.11.0-next.1
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 -3
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +27 -3
- package/build/api/config/configurator.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 +8 -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/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/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 +1 -1
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +51 -6
- 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/vite/plugins/core.ts +23 -18
- 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
@@ -1,7 +1,38 @@
|
|
1
1
|
import type { GraphqlChangeset } from '#lib/graphql-changeset/index';
|
2
2
|
export * as DataSources from './data-sources/data-sources.js';
|
3
3
|
export * from './read.js';
|
4
|
-
export
|
5
|
-
|
4
|
+
export * from './metadata.js';
|
5
|
+
export type ChangeSets = GraphqlChangeset.ChangeSet[];
|
6
|
+
export type NonEmptyChangeSets = [GraphqlChangeset.ChangeSet, ...GraphqlChangeset.ChangeSet[]];
|
7
|
+
/**
|
8
|
+
* Changelog data structure for JSON serialization
|
9
|
+
*/
|
10
|
+
export interface ChangelogData {
|
11
|
+
changes: GraphqlChangeset.ChangeSet['changes'];
|
12
|
+
date: string;
|
6
13
|
}
|
14
|
+
/**
|
15
|
+
* Constants for schema versioning
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* The version identifier for the latest schema
|
19
|
+
*/
|
20
|
+
export declare const VERSION_LATEST = "latest";
|
21
|
+
/**
|
22
|
+
* Fallback version name when date parsing fails
|
23
|
+
*/
|
24
|
+
export declare const VERSION_UNKNOWN_FALLBACK = "unknown";
|
25
|
+
/**
|
26
|
+
* Convert a date to a version string in YYYY-MM-DD format
|
27
|
+
*/
|
28
|
+
export declare const dateToVersionString: (date: Date) => string;
|
29
|
+
/**
|
30
|
+
* Determine if a version at the given index should have a changelog file.
|
31
|
+
* Only non-oldest versions get changelog files.
|
32
|
+
*/
|
33
|
+
export declare const shouldVersionHaveChangelog: (versionIndex: number, totalVersions: number) => boolean;
|
34
|
+
/**
|
35
|
+
* Convert a version string back to a Date
|
36
|
+
*/
|
37
|
+
export declare const versionStringToDate: (version: string) => Date;
|
7
38
|
//# sourceMappingURL=schema.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,cAAc,eAAe,CAAA;AAE7B,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAA;AAErD,MAAM,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAA;AAE9F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9C,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,WAAW,CAAA;AAEtC;;GAEG;AACH,eAAO,MAAM,wBAAwB,YAAY,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,KAAG,MAEhD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,cAAc,MAAM,EAAE,eAAe,MAAM,KAAG,OAExF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,IAgBrD,CAAA"}
|
@@ -1,3 +1,45 @@
|
|
1
1
|
export * as DataSources from './data-sources/data-sources.js';
|
2
2
|
export * from './read.js';
|
3
|
+
export * from './metadata.js';
|
4
|
+
/**
|
5
|
+
* Constants for schema versioning
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* The version identifier for the latest schema
|
9
|
+
*/
|
10
|
+
export const VERSION_LATEST = `latest`;
|
11
|
+
/**
|
12
|
+
* Fallback version name when date parsing fails
|
13
|
+
*/
|
14
|
+
export const VERSION_UNKNOWN_FALLBACK = `unknown`;
|
15
|
+
/**
|
16
|
+
* Convert a date to a version string in YYYY-MM-DD format
|
17
|
+
*/
|
18
|
+
export const dateToVersionString = (date) => {
|
19
|
+
return date.toLocaleDateString('en-CA');
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* Determine if a version at the given index should have a changelog file.
|
23
|
+
* Only non-oldest versions get changelog files.
|
24
|
+
*/
|
25
|
+
export const shouldVersionHaveChangelog = (versionIndex, totalVersions) => {
|
26
|
+
return versionIndex < totalVersions - 1;
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* Convert a version string back to a Date
|
30
|
+
*/
|
31
|
+
export const versionStringToDate = (version) => {
|
32
|
+
if (version === VERSION_LATEST) {
|
33
|
+
return new Date();
|
34
|
+
}
|
35
|
+
// Use modern date parsing - the version string should be in YYYY-MM-DD format
|
36
|
+
// which is ISO 8601 compatible
|
37
|
+
const parsedDate = new Date(version + 'T00:00:00Z');
|
38
|
+
// Check if the date is valid
|
39
|
+
if (!isNaN(parsedDate.getTime())) {
|
40
|
+
return parsedDate;
|
41
|
+
}
|
42
|
+
// Throw error for invalid dates instead of silently defaulting
|
43
|
+
throw new Error(`Invalid version string: ${version}`);
|
44
|
+
};
|
3
45
|
//# sourceMappingURL=schema.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA"}
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,cAAc,eAAe,CAAA;AAc7B;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAU,EAAE;IACxD,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,YAAoB,EAAE,aAAqB,EAAW,EAAE;IACjG,OAAO,YAAY,GAAG,aAAa,GAAG,CAAC,CAAA;AACzC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAQ,EAAE;IAC3D,IAAI,OAAO,KAAK,cAAc,EAAE,CAAC;QAC/B,OAAO,IAAI,IAAI,EAAE,CAAA;IACnB,CAAC;IAED,8EAA8E;IAC9E,+BAA+B;IAC/B,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,CAAA;IAEnD,6BAA6B;IAC7B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,+DAA+D;IAC/D,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/schema-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/schema-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { Schema } from '#api/schema/index';
|
2
|
+
import type { GraphqlChangeset } from '#lib/graphql-changeset/index';
|
3
|
+
import type { GraphQLSchema } from 'graphql';
|
4
|
+
type WriteFile = (path: string, content: string) => Promise<void>;
|
5
|
+
type ReadFile = (locator: string) => Promise<string>;
|
6
|
+
type ClearDirectory = (path: string) => Promise<void>;
|
7
|
+
type RemoveFile = (path: string) => Promise<void>;
|
8
|
+
interface SchemaSourceConfig {
|
9
|
+
io: {
|
10
|
+
read: ReadFile;
|
11
|
+
write?: WriteFile;
|
12
|
+
clearDirectory?: ClearDirectory;
|
13
|
+
removeFile?: RemoveFile;
|
14
|
+
};
|
15
|
+
versions: string[];
|
16
|
+
assetsPath: string;
|
17
|
+
}
|
18
|
+
export declare const createSchemaSource: (config: SchemaSourceConfig) => {
|
19
|
+
versions: string[];
|
20
|
+
isEmpty: boolean;
|
21
|
+
get: (version: string) => Promise<GraphQLSchema>;
|
22
|
+
getChangelog: (version: string) => Promise<Schema.ChangelogData>;
|
23
|
+
getAllChangesets: () => Promise<GraphqlChangeset.ChangeSet[]>;
|
24
|
+
clearCache: () => void;
|
25
|
+
writeSchema: (version: string, schema: GraphQLSchema) => Promise<void>;
|
26
|
+
writeChangelog: (version: string, changelog: Schema.ChangelogData) => Promise<void>;
|
27
|
+
clearAllAssets: () => Promise<void>;
|
28
|
+
removeAsset: (version: string) => Promise<void>;
|
29
|
+
writeMetadata: (metadata: Schema.SchemaMetadata) => Promise<void>;
|
30
|
+
writeAllAssets: (schemaData: Awaited<ReturnType<typeof Schema.readOrThrow>>, metadata: Schema.SchemaMetadata) => Promise<void>;
|
31
|
+
};
|
32
|
+
export {};
|
33
|
+
//# sourceMappingURL=schema-source.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-source.d.ts","sourceRoot":"","sources":["../../../src/api/schema-source/schema-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAEjE,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAEpD,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAErD,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAcjD,UAAU,kBAAkB;IAC1B,EAAE,EAAE;QACF,IAAI,EAAE,QAAQ,CAAA;QACd,KAAK,CAAC,EAAE,SAAS,CAAA;QACjB,cAAc,CAAC,EAAE,cAAc,CAAA;QAC/B,UAAU,CAAC,EAAE,UAAU,CAAA;KACxB,CAAA;IACD,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,GAAI,QAAQ,kBAAkB;;;mBAgB/B,MAAM,KAAG,OAAO,CAAC,aAAa,CAAC;4BAOtB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;4BAKxC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;;2BA4DzC,MAAM,UAAU,aAAa;8BAK1B,MAAM,aAAa,MAAM,CAAC,aAAa;;2BAS1C,MAAM;8BAcH,MAAM,CAAC,cAAc;iCAKvC,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,YAChD,MAAM,CAAC,cAAc;CA4BpC,CAAA"}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import { Schema } from '#api/schema/index';
|
2
|
+
import { Grafaid } from '#lib/grafaid/index';
|
3
|
+
import { astToSchema } from '#template/lib/schema-utils/schema-utils';
|
4
|
+
import { Cache } from '@wollybeard/kit';
|
5
|
+
const NoImplementationWriteFile = async (path, content) => {
|
6
|
+
throw new Error('Write operations not supported in this environment');
|
7
|
+
};
|
8
|
+
const NoImplementationClearDirectory = async (path) => {
|
9
|
+
throw new Error('Directory operations not supported in this environment');
|
10
|
+
};
|
11
|
+
const NoImplementationRemoveFile = async (path) => {
|
12
|
+
throw new Error('File removal operations not supported in this environment');
|
13
|
+
};
|
14
|
+
export const createSchemaSource = (config) => {
|
15
|
+
const getSchemaPath = (version) => `${config.assetsPath}/schemas/${version}.json`;
|
16
|
+
const getChangelogPath = (version) => `${config.assetsPath}/schemas/${version}.changelog.json`;
|
17
|
+
const getSchemasDirectory = () => `${config.assetsPath}/schemas`;
|
18
|
+
const getMetadataPath = () => `${config.assetsPath}/schemas/metadata.json`;
|
19
|
+
const ioWrite = config.io.write || NoImplementationWriteFile;
|
20
|
+
const ioClearDirectory = config.io.clearDirectory || NoImplementationClearDirectory;
|
21
|
+
const ioRemoveFile = config.io.removeFile || NoImplementationRemoveFile;
|
22
|
+
// Memoize only the base IO read operation
|
23
|
+
const ioReadMemoized = Cache.memoize(config.io.read);
|
24
|
+
const get = async (version) => {
|
25
|
+
const content = await ioReadMemoized(getSchemaPath(version));
|
26
|
+
const schemaAst = JSON.parse(content);
|
27
|
+
const schema = astToSchema(schemaAst);
|
28
|
+
return schema;
|
29
|
+
};
|
30
|
+
const getChangelog = async (version) => {
|
31
|
+
const content = await ioReadMemoized(getChangelogPath(version));
|
32
|
+
return JSON.parse(content);
|
33
|
+
};
|
34
|
+
const getAllChangesets = async () => {
|
35
|
+
const changesets = [];
|
36
|
+
for (let i = 0; i < config.versions.length; i++) {
|
37
|
+
const version = config.versions[i];
|
38
|
+
if (!version)
|
39
|
+
continue;
|
40
|
+
const schema = await get(version);
|
41
|
+
if (!schema)
|
42
|
+
continue;
|
43
|
+
// Only try to read changelog for non-oldest versions (matching writeDevAssets logic)
|
44
|
+
let changelogData = null;
|
45
|
+
if (i < config.versions.length - 1) {
|
46
|
+
changelogData = await getChangelog(version);
|
47
|
+
}
|
48
|
+
if (changelogData) {
|
49
|
+
const prevVersion = config.versions[i + 1];
|
50
|
+
const prevSchema = prevVersion ? await get(prevVersion) : null;
|
51
|
+
if (prevSchema) {
|
52
|
+
changesets.push({
|
53
|
+
after: schema,
|
54
|
+
before: prevSchema,
|
55
|
+
changes: changelogData.changes,
|
56
|
+
date: new Date(changelogData.date),
|
57
|
+
});
|
58
|
+
}
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
// Oldest version - no changelog, use existing utility
|
62
|
+
changesets.push({
|
63
|
+
after: schema,
|
64
|
+
before: Grafaid.Schema.empty,
|
65
|
+
changes: [],
|
66
|
+
date: Schema.versionStringToDate(version),
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return changesets;
|
71
|
+
};
|
72
|
+
return {
|
73
|
+
//
|
74
|
+
// Properties
|
75
|
+
//
|
76
|
+
versions: config.versions,
|
77
|
+
isEmpty: config.versions.length === 0,
|
78
|
+
//
|
79
|
+
// Methods
|
80
|
+
//
|
81
|
+
get,
|
82
|
+
getChangelog,
|
83
|
+
getAllChangesets,
|
84
|
+
// Expose the memoized reader's clear method
|
85
|
+
clearCache: ioReadMemoized.clear,
|
86
|
+
// Write operations (use the writer, which throws if not provided)
|
87
|
+
writeSchema: async (version, schema) => {
|
88
|
+
const ast = Grafaid.Schema.AST.parse(Grafaid.Schema.print(schema));
|
89
|
+
await ioWrite(getSchemaPath(version), JSON.stringify(ast));
|
90
|
+
},
|
91
|
+
writeChangelog: async (version, changelog) => {
|
92
|
+
await ioWrite(getChangelogPath(version), JSON.stringify(changelog));
|
93
|
+
},
|
94
|
+
// Directory operations
|
95
|
+
clearAllAssets: async () => {
|
96
|
+
await ioClearDirectory(getSchemasDirectory());
|
97
|
+
},
|
98
|
+
removeAsset: async (version) => {
|
99
|
+
try {
|
100
|
+
await ioRemoveFile(getSchemaPath(version));
|
101
|
+
}
|
102
|
+
catch (error) {
|
103
|
+
// Swallow errors for file removal as requested
|
104
|
+
}
|
105
|
+
try {
|
106
|
+
await ioRemoveFile(getChangelogPath(version));
|
107
|
+
}
|
108
|
+
catch (error) {
|
109
|
+
// Swallow errors for file removal as requested
|
110
|
+
}
|
111
|
+
},
|
112
|
+
writeMetadata: async (metadata) => {
|
113
|
+
await ioWrite(getMetadataPath(), JSON.stringify(metadata, null, 2));
|
114
|
+
},
|
115
|
+
writeAllAssets: async (schemaData, metadata) => {
|
116
|
+
if (!schemaData)
|
117
|
+
return;
|
118
|
+
// Write schema and changelog files
|
119
|
+
for (const [index, version] of schemaData.entries()) {
|
120
|
+
const versionName = index === 0 ? Schema.VERSION_LATEST : Schema.dateToVersionString(version.date);
|
121
|
+
// Write schema file
|
122
|
+
await ioWrite(getSchemaPath(versionName), JSON.stringify(Grafaid.Schema.AST.parse(Grafaid.Schema.print(version.after))));
|
123
|
+
// Write changelog file (except for the oldest/last version)
|
124
|
+
if (Schema.shouldVersionHaveChangelog(index, schemaData.length)) {
|
125
|
+
const changelogData = {
|
126
|
+
changes: version.changes,
|
127
|
+
date: version.date.toISOString(),
|
128
|
+
};
|
129
|
+
await ioWrite(getChangelogPath(versionName), JSON.stringify(changelogData));
|
130
|
+
}
|
131
|
+
}
|
132
|
+
// Write metadata file
|
133
|
+
await ioWrite(getMetadataPath(), JSON.stringify(metadata, null, 2));
|
134
|
+
},
|
135
|
+
};
|
136
|
+
};
|
137
|
+
//# sourceMappingURL=schema-source.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-source.js","sourceRoot":"","sources":["../../../src/api/schema-source/schema-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAWvC,MAAM,yBAAyB,GAAc,KAAK,EAAE,IAAY,EAAE,OAAe,EAAE,EAAE;IACnF,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;AACvE,CAAC,CAAA;AAED,MAAM,8BAA8B,GAAmB,KAAK,EAAE,IAAY,EAAE,EAAE;IAC5E,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC3E,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAe,KAAK,EAAE,IAAY,EAAE,EAAE;IACpE,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,CAAC,CAAA;AAaD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAA0B,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,YAAY,OAAO,OAAO,CAAA;IAEzF,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,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;QACrE,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
@@ -3,6 +3,7 @@ import type { ReactRouter } from '#dep/react-router/index';
|
|
3
3
|
import type { Vite } from '#dep/vite/index';
|
4
4
|
import { ViteVirtual } from '#lib/vite-virtual/index';
|
5
5
|
export declare const viProjectData: ViteVirtual.Identifier.Identifier;
|
6
|
+
export declare const viProjectSchema: ViteVirtual.Identifier.Identifier;
|
6
7
|
export interface ProjectRoutesModule {
|
7
8
|
routes: ReactRouter.RouteObject[];
|
8
9
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/api/vite/plugins/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/api/vite/plugins/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAiBrD,eAAO,MAAM,aAAa,mCAA+E,CAAA;AACzG,eAAO,MAAM,eAAe,mCAAiF,CAAA;AAE7G,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;CAClC;AAED,eAAO,MAAM,IAAI,GAAI,QAAQ,MAAM,CAAC,MAAM,KAAG,IAAI,CAAC,YAAY,EA6M7D,CAAA"}
|
@@ -1,19 +1,25 @@
|
|
1
1
|
import { Content } from '#api/content/$';
|
2
2
|
import { createNavbar } from '#api/content/navbar';
|
3
3
|
import { VitePluginSelfContainedMode } from '#cli/_/self-contained-mode';
|
4
|
+
import { Hono } from '#dep/hono/index';
|
4
5
|
import { VitePluginJson } from '#lib/vite-plugin-json/index';
|
5
6
|
import { ViteVirtual } from '#lib/vite-virtual/index';
|
6
7
|
import { debugPolen } from '#singletons/debug';
|
7
8
|
import { superjson } from '#singletons/superjson';
|
9
|
+
import * as HonoNodeServer from '@hono/node-server';
|
10
|
+
import { serveStatic } from '@hono/node-server/serve-static';
|
8
11
|
import { Json, Str } from '@wollybeard/kit';
|
12
|
+
import * as NodePath from 'node:path';
|
9
13
|
import { SchemaAugmentation } from '../../schema-augmentation/index.js';
|
10
14
|
import { Schema } from '../../schema/index.js';
|
11
15
|
import { createLogger } from '../logger.js';
|
12
16
|
import { polenVirtual } from '../vi.js';
|
13
17
|
import { Pages } from './pages.js';
|
18
|
+
import { SchemaAssets } from './schema-assets.js';
|
14
19
|
const viTemplateVariables = polenVirtual([`template`, `variables`]);
|
15
20
|
const viTemplateSchemaAugmentations = polenVirtual([`template`, `schema-augmentations`]);
|
16
21
|
export const viProjectData = polenVirtual([`project`, `data.jsonsuper`], { allowPluginProcessing: true });
|
22
|
+
export const viProjectSchema = polenVirtual([`project`, `schema.jsonsuper`], { allowPluginProcessing: true });
|
17
23
|
export const Core = (config) => {
|
18
24
|
let schemaCache = null;
|
19
25
|
const readSchema = async () => {
|
@@ -23,7 +29,7 @@ export const Core = (config) => {
|
|
23
29
|
projectRoot: config.paths.project.rootDir,
|
24
30
|
});
|
25
31
|
// todo: augmentations scoped to a version
|
26
|
-
schema?.
|
32
|
+
schema?.forEach(version => {
|
27
33
|
SchemaAugmentation.apply(version.after, config.schemaAugmentations);
|
28
34
|
});
|
29
35
|
schemaCache = schema;
|
@@ -53,6 +59,7 @@ export const Core = (config) => {
|
|
53
59
|
});
|
54
60
|
return [
|
55
61
|
...plugins,
|
62
|
+
SchemaAssets(config),
|
56
63
|
/**
|
57
64
|
* If a `polen*` import is encountered from the user's project, resolve it to the currently
|
58
65
|
* running source code of Polen rather than the user's node_modules.
|
@@ -111,11 +118,11 @@ export const Core = (config) => {
|
|
111
118
|
__BUILD_ARCHITECTURE_SSG__: Json.encode(config.build.architecture === `ssg`),
|
112
119
|
'process.env.NODE_ENV': Json.encode(config.advanced.debug ? 'development' : 'production'),
|
113
120
|
},
|
114
|
-
customLogger: createLogger(config),
|
121
|
+
// customLogger: createLogger(config),
|
115
122
|
esbuild: false,
|
116
123
|
build: {
|
117
124
|
target: `esnext`,
|
118
|
-
assetsDir: config.paths.project.relative.build.relative.assets,
|
125
|
+
assetsDir: config.paths.project.relative.build.relative.assets.root,
|
119
126
|
rollupOptions: {
|
120
127
|
treeshake: {
|
121
128
|
// Aggressive tree-shaking for smallest bundles
|
@@ -131,6 +138,14 @@ export const Core = (config) => {
|
|
131
138
|
};
|
132
139
|
},
|
133
140
|
...ViteVirtual.IdentifiedLoader.toHooks({
|
141
|
+
identifier: viProjectSchema,
|
142
|
+
async loader() {
|
143
|
+
const debug = debugPolen.sub(`module-project-schema`);
|
144
|
+
debug(`load`, { id: viProjectSchema.id });
|
145
|
+
const schema = await readSchema();
|
146
|
+
return superjson.stringify(schema);
|
147
|
+
},
|
148
|
+
}, {
|
134
149
|
identifier: viTemplateVariables,
|
135
150
|
loader() {
|
136
151
|
const s = `export const templateVariables = ${JSON.stringify(config.templateVariables)}`;
|
@@ -156,7 +171,7 @@ export const Core = (config) => {
|
|
156
171
|
// hydration mismatches between SSR (where base path is prepended) and client
|
157
172
|
// (where basename is configured). This ensures consistent behavior.
|
158
173
|
navbar.push({ pathExp: `/reference`, title: `Reference` });
|
159
|
-
if (schema.
|
174
|
+
if (schema.length > 1) {
|
160
175
|
navbar.push({ pathExp: `/changelog`, title: `Changelog` });
|
161
176
|
}
|
162
177
|
}
|
@@ -171,22 +186,10 @@ export const Core = (config) => {
|
|
171
186
|
// ━━ Put It All together
|
172
187
|
//
|
173
188
|
const projectData = {
|
174
|
-
schema,
|
175
189
|
basePath: config.build.base,
|
176
|
-
paths: config.paths
|
190
|
+
paths: config.paths,
|
177
191
|
navbar, // Complete navbar with schema and pages
|
178
|
-
server:
|
179
|
-
port: config.server.port,
|
180
|
-
static: {
|
181
|
-
// todo
|
182
|
-
// relative from CWD of process that boots n1ode server
|
183
|
-
// can easily break! Use path relative in server??
|
184
|
-
directory: `./` + config.paths.project.relative.build.root,
|
185
|
-
// Uses Hono route syntax - includes base path
|
186
|
-
route: config.build.base.slice(0, -1) + `/` + config.paths.project.relative.build.relative.assets
|
187
|
-
+ `/*`,
|
188
|
-
},
|
189
|
-
},
|
192
|
+
server: config.server,
|
190
193
|
warnings: config.warnings,
|
191
194
|
};
|
192
195
|
// Return just the JSON string - let the JSON plugin handle the transformation
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/api/vite/plugins/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/api/vite/plugins/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE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,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;oBAC1C,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;oBAEpB,EAAE;oBACF,yBAAyB;oBACzB,EAAE;oBAEF,MAAM,WAAW,GAAgB;wBAC/B,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI;wBAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,MAAM,EAAE,wCAAwC;wBAChD,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B,CAAA;oBAED,8EAA8E;oBAC9E,OAAO,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;gBACzC,CAAC;aACF,CACF;SACF;KACF,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { Config } from '#api/config/index';
|
2
|
+
import type { Vite } from '#dep/vite/index';
|
3
|
+
import { ViteVirtual } from '#lib/vite-virtual/index';
|
4
|
+
export declare const viProjectSchemaMetadata: ViteVirtual.Identifier.Identifier;
|
5
|
+
/**
|
6
|
+
* Vite plugin that generates JSON assets for GraphQL schemas at build time.
|
7
|
+
*
|
8
|
+
* This plugin:
|
9
|
+
* - Reads GraphQL schema files from the project
|
10
|
+
* - Applies schema augmentations
|
11
|
+
* - Converts schemas to AST format and emits as JSON assets
|
12
|
+
* - Creates a metadata file with available versions
|
13
|
+
* - Provides a virtual module for accessing schema metadata
|
14
|
+
*
|
15
|
+
* The generated assets enable client-side loading of different schema versions
|
16
|
+
* without requiring all schemas to be bundled into the main JavaScript bundle.
|
17
|
+
*
|
18
|
+
* @param config - Polen configuration object
|
19
|
+
* @returns Vite plugin instance
|
20
|
+
*/
|
21
|
+
export declare const SchemaAssets: (config: Config.Config) => Vite.Plugin;
|
22
|
+
//# sourceMappingURL=schema-assets.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-assets.d.ts","sourceRoot":"","sources":["../../../../src/api/vite/plugins/schema-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAOrD,eAAO,MAAM,uBAAuB,mCAA+C,CAAA;AAEnF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,CAAC,MAAM,KAAG,IAAI,CAAC,MA6RzD,CAAA"}
|