polen 0.11.0-next.10 → 0.11.0-next.11

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.
Files changed (105) hide show
  1. package/build/api/api.d.ts +2 -1
  2. package/build/api/api.d.ts.map +1 -1
  3. package/build/api/api.js +5 -1
  4. package/build/api/api.js.map +1 -1
  5. package/build/api/iso/$$.d.ts +2 -0
  6. package/build/api/iso/$$.d.ts.map +1 -0
  7. package/build/api/iso/$$.js +2 -0
  8. package/build/api/iso/$$.js.map +1 -0
  9. package/build/api/iso/$.d.ts +2 -0
  10. package/build/api/iso/$.d.ts.map +1 -0
  11. package/build/api/iso/$.js +2 -0
  12. package/build/api/iso/$.js.map +1 -0
  13. package/build/api/iso/schema/$$.d.ts +4 -0
  14. package/build/api/iso/schema/$$.d.ts.map +1 -0
  15. package/build/api/iso/schema/$$.js +3 -0
  16. package/build/api/iso/schema/$$.js.map +1 -0
  17. package/build/api/iso/schema/$.d.ts +2 -0
  18. package/build/api/iso/schema/$.d.ts.map +1 -0
  19. package/build/api/iso/schema/$.js +2 -0
  20. package/build/api/iso/schema/$.js.map +1 -0
  21. package/build/api/iso/schema/constants.d.ts +25 -0
  22. package/build/api/iso/schema/constants.d.ts.map +1 -0
  23. package/build/api/iso/schema/constants.js +42 -0
  24. package/build/api/iso/schema/constants.js.map +1 -0
  25. package/build/api/iso/schema/routing.d.ts +22 -0
  26. package/build/api/iso/schema/routing.d.ts.map +1 -0
  27. package/build/api/iso/schema/routing.js +39 -0
  28. package/build/api/iso/schema/routing.js.map +1 -0
  29. package/build/api/iso.d.ts +2 -0
  30. package/build/api/iso.d.ts.map +1 -0
  31. package/build/api/iso.js +2 -0
  32. package/build/api/iso.js.map +1 -0
  33. package/build/api/schema/schema.d.ts +3 -25
  34. package/build/api/schema/schema.d.ts.map +1 -1
  35. package/build/api/schema/schema.js +5 -42
  36. package/build/api/schema/schema.js.map +1 -1
  37. package/build/api/vite/plugins/core.d.ts.map +1 -1
  38. package/build/api/vite/plugins/core.js +3 -6
  39. package/build/api/vite/plugins/core.js.map +1 -1
  40. package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
  41. package/build/template/components/GraphQLInteractive/lib/parser.js +32 -10
  42. package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
  43. package/build/template/components/HamburgerMenu.d.ts +1 -0
  44. package/build/template/components/HamburgerMenu.d.ts.map +1 -1
  45. package/build/template/components/HamburgerMenu.js +2 -2
  46. package/build/template/components/HamburgerMenu.js.map +1 -1
  47. package/build/template/components/ReferenceLink.d.ts.map +1 -1
  48. package/build/template/components/ReferenceLink.js +2 -4
  49. package/build/template/components/ReferenceLink.js.map +1 -1
  50. package/build/template/components/VersionSelector.d.ts +3 -2
  51. package/build/template/components/VersionSelector.d.ts.map +1 -1
  52. package/build/template/components/VersionSelector.js +7 -15
  53. package/build/template/components/VersionSelector.js.map +1 -1
  54. package/build/template/components/sidebar/Sidebar.d.ts +3 -2
  55. package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
  56. package/build/template/components/sidebar/Sidebar.js +7 -6
  57. package/build/template/components/sidebar/Sidebar.js.map +1 -1
  58. package/build/template/components/sidebar/SidebarContext.d.ts +6 -0
  59. package/build/template/components/sidebar/SidebarContext.d.ts.map +1 -0
  60. package/build/template/components/sidebar/SidebarContext.js +3 -0
  61. package/build/template/components/sidebar/SidebarContext.js.map +1 -0
  62. package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
  63. package/build/template/components/sidebar/SidebarItem.js +11 -4
  64. package/build/template/components/sidebar/SidebarItem.js.map +1 -1
  65. package/build/template/hooks/useVersionPath.d.ts.map +1 -1
  66. package/build/template/hooks/useVersionPath.js +3 -1
  67. package/build/template/hooks/useVersionPath.js.map +1 -1
  68. package/build/template/layouts/SidebarLayout.d.ts +3 -2
  69. package/build/template/layouts/SidebarLayout.d.ts.map +1 -1
  70. package/build/template/layouts/SidebarLayout.js +2 -2
  71. package/build/template/layouts/SidebarLayout.js.map +1 -1
  72. package/build/template/routes/reference.d.ts.map +1 -1
  73. package/build/template/routes/reference.js +6 -9
  74. package/build/template/routes/reference.js.map +1 -1
  75. package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
  76. package/build/template/server/ssg/get-route-paths.js +47 -14
  77. package/build/template/server/ssg/get-route-paths.js.map +1 -1
  78. package/package.json +4 -1
  79. package/src/api/api.ts +7 -1
  80. package/src/api/iso/$$.ts +1 -0
  81. package/src/api/iso/$.ts +1 -0
  82. package/src/api/iso/schema/$$.ts +5 -0
  83. package/src/api/iso/schema/$.ts +1 -0
  84. package/src/api/iso/schema/constants.ts +49 -0
  85. package/src/api/iso/schema/routing.ts +53 -0
  86. package/src/api/iso.ts +1 -0
  87. package/src/api/schema/schema.ts +6 -53
  88. package/src/api/vite/plugins/core.ts +3 -6
  89. package/src/template/components/GraphQLInteractive/lib/parser.ts +32 -16
  90. package/src/template/components/HamburgerMenu.tsx +3 -1
  91. package/src/template/components/ReferenceLink.tsx +7 -4
  92. package/src/template/components/VersionSelector.tsx +10 -18
  93. package/src/template/components/sidebar/Sidebar.tsx +20 -16
  94. package/src/template/components/sidebar/SidebarContext.tsx +7 -0
  95. package/src/template/components/sidebar/SidebarItem.tsx +11 -4
  96. package/src/template/hooks/useVersionPath.ts +3 -1
  97. package/src/template/layouts/SidebarLayout.tsx +5 -3
  98. package/src/template/routes/reference.tsx +7 -10
  99. package/src/template/server/ssg/get-route-paths.test.ts +13 -0
  100. package/src/template/server/ssg/get-route-paths.ts +47 -14
  101. package/build/template/lib/schema-utils/constants.d.ts +0 -5
  102. package/build/template/lib/schema-utils/constants.d.ts.map +0 -1
  103. package/build/template/lib/schema-utils/constants.js +0 -5
  104. package/build/template/lib/schema-utils/constants.js.map +0 -1
  105. package/src/template/lib/schema-utils/constants.ts +0 -4
@@ -19,43 +19,75 @@ export const getRoutesPaths = async () => {
19
19
  const paths = new Set();
20
20
  const routeExpressions = ReactRouterAid.getRouteExpressions(routes);
21
21
  // Helper function to load schema from filesystem and add type paths
22
- const addTypePathsForVersion = async (version, pathPrefix, includeFields = false) => {
22
+ const addTypePathsForVersion = async (version, includeFields = false) => {
23
23
  try {
24
24
  const schemaFilePath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, `${version}.json`);
25
25
  const schemaContent = await NodeFs.readFile(schemaFilePath, 'utf-8');
26
26
  const schemaAst = JSON.parse(schemaContent);
27
27
  visit(schemaAst, {
28
28
  ObjectTypeDefinition(node) {
29
- const typePath = `${pathPrefix}/${node.name.value}`;
29
+ const typePath = Api.Schema.Routing.createReferencePath({
30
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
31
+ type: node.name.value,
32
+ });
30
33
  paths.add(typePath);
31
34
  // Add field paths if requested
32
35
  if (includeFields && node.fields) {
33
36
  for (const field of node.fields) {
34
- paths.add(`${typePath}/${field.name.value}`);
37
+ const fieldPath = Api.Schema.Routing.createReferencePath({
38
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
39
+ type: node.name.value,
40
+ field: field.name.value,
41
+ });
42
+ paths.add(fieldPath);
35
43
  }
36
44
  }
37
45
  },
38
46
  InterfaceTypeDefinition(node) {
39
- const typePath = `${pathPrefix}/${node.name.value}`;
47
+ const typePath = Api.Schema.Routing.createReferencePath({
48
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
49
+ type: node.name.value,
50
+ });
40
51
  paths.add(typePath);
41
52
  // Add field paths if requested
42
53
  if (includeFields && node.fields) {
43
54
  for (const field of node.fields) {
44
- paths.add(`${typePath}/${field.name.value}`);
55
+ const fieldPath = Api.Schema.Routing.createReferencePath({
56
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
57
+ type: node.name.value,
58
+ field: field.name.value,
59
+ });
60
+ paths.add(fieldPath);
45
61
  }
46
62
  }
47
63
  },
48
64
  EnumTypeDefinition(node) {
49
- paths.add(`${pathPrefix}/${node.name.value}`);
65
+ const typePath = Api.Schema.Routing.createReferencePath({
66
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
67
+ type: node.name.value,
68
+ });
69
+ paths.add(typePath);
50
70
  },
51
71
  InputObjectTypeDefinition(node) {
52
- paths.add(`${pathPrefix}/${node.name.value}`);
72
+ const typePath = Api.Schema.Routing.createReferencePath({
73
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
74
+ type: node.name.value,
75
+ });
76
+ paths.add(typePath);
53
77
  },
54
78
  UnionTypeDefinition(node) {
55
- paths.add(`${pathPrefix}/${node.name.value}`);
79
+ const typePath = Api.Schema.Routing.createReferencePath({
80
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
81
+ type: node.name.value,
82
+ });
83
+ paths.add(typePath);
56
84
  },
57
85
  ScalarTypeDefinition(node) {
58
- paths.add(`${pathPrefix}/${node.name.value}`);
86
+ const typePath = Api.Schema.Routing.createReferencePath({
87
+ version: version === Api.Schema.VERSION_LATEST ? undefined : version,
88
+ type: node.name.value,
89
+ });
90
+ paths.add(typePath);
59
91
  },
60
92
  });
61
93
  }
@@ -70,28 +102,29 @@ export const getRoutesPaths = async () => {
70
102
  if (exp === knownParameterizedRouteExpressions.reference_type) {
71
103
  if (hasSchema) {
72
104
  // Add paths for latest version (no version in URL)
73
- await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`);
105
+ await addTypePathsForVersion(Api.Schema.VERSION_LATEST);
74
106
  }
75
107
  }
76
108
  else if (exp === knownParameterizedRouteExpressions.reference_version) {
77
109
  if (hasSchema) {
78
110
  // Add paths for version pages themselves (without type)
79
111
  for (const version of availableVersions) {
80
- paths.add(`/reference/version/${version}`);
112
+ const versionPath = Api.Schema.Routing.createReferenceBasePath(version);
113
+ paths.add(versionPath);
81
114
  }
82
115
  }
83
116
  }
84
117
  else if (exp === knownParameterizedRouteExpressions.reference_type_field) {
85
118
  if (hasSchema) {
86
119
  // Add paths for latest version fields
87
- await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`, true);
120
+ await addTypePathsForVersion(Api.Schema.VERSION_LATEST, true);
88
121
  }
89
122
  }
90
123
  else if (exp === knownParameterizedRouteExpressions.reference_versioned_type) {
91
124
  if (hasSchema) {
92
125
  // Add paths for all versions using new route structure
93
126
  for (const version of availableVersions) {
94
- await addTypePathsForVersion(version, `/reference/version/${version}`);
127
+ await addTypePathsForVersion(version);
95
128
  }
96
129
  }
97
130
  }
@@ -99,7 +132,7 @@ export const getRoutesPaths = async () => {
99
132
  if (hasSchema) {
100
133
  // Add paths for all versions with fields
101
134
  for (const version of availableVersions) {
102
- await addTypePathsForVersion(version, `/reference/version/${version}`, true);
135
+ await addTypePathsForVersion(version, true);
103
136
  }
104
137
  }
105
138
  }
@@ -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,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,gBAAgB,GAAG,cAAc,CAAC,mBAAmB,CA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A;gBACvC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,GAAG,KAAK,kCAAkC,CAAC,8BAA8B,EAAE,CAAC;YACrF,IAAI,SAAS,EAAE,CAAC;gBACd,yCAAyC;gBACzC,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;oBACxC,MAAM,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBAC7C,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polen",
3
- "version": "0.11.0-next.10",
3
+ "version": "0.11.0-next.11",
4
4
  "type": "module",
5
5
  "description": "A framework for delightful GraphQL developer portals",
6
6
  "author": {
@@ -35,6 +35,9 @@
35
35
  "#*": {
36
36
  "default": "./build/*.js"
37
37
  },
38
+ "#api/iso": {
39
+ "default": "./build/api/iso/$.js"
40
+ },
38
41
  "#lib/mask": {
39
42
  "default": "./build/lib/mask/$.js"
40
43
  },
package/src/api/api.ts CHANGED
@@ -1,6 +1,12 @@
1
+ // Re-export everything from isomorphic layer
2
+ export * from './iso/$$.js'
3
+
4
+ // Server-only exports
1
5
  export * from './builder/index.js'
2
6
  export * from './config-resolver/index.js'
3
7
  export * from './config/index.js'
4
8
  export * as Project from './project/index.js'
5
- export * from './schema/index.js'
6
9
  export * from './static/index.js'
10
+
11
+ // Re-export schema with server-only extensions
12
+ export { Schema } from './schema/index.js'
@@ -0,0 +1 @@
1
+ export * from './schema/$.js'
@@ -0,0 +1 @@
1
+ export * as Api from './$$.js'
@@ -0,0 +1,5 @@
1
+ export * from './constants.js'
2
+ export * as Routing from './routing.js'
3
+
4
+ // Re-export types from server layer that are needed in template
5
+ export type { ChangelogData, ChangeSets, NonEmptyChangeSets } from '../../schema/schema.js'
@@ -0,0 +1 @@
1
+ export * as Schema from './$$.js'
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Constants for schema versioning
3
+ */
4
+
5
+ /**
6
+ * The version identifier for the latest schema
7
+ */
8
+ export const VERSION_LATEST = `latest`
9
+
10
+ /**
11
+ * Fallback version name when date parsing fails
12
+ */
13
+ export const VERSION_UNKNOWN_FALLBACK = `unknown`
14
+
15
+ /**
16
+ * Convert a date to a version string in YYYY-MM-DD format
17
+ */
18
+ export const dateToVersionString = (date: Date): string => {
19
+ return date.toLocaleDateString('en-CA')
20
+ }
21
+
22
+ /**
23
+ * Convert a version string back to a Date
24
+ */
25
+ export const versionStringToDate = (version: string): Date => {
26
+ if (version === VERSION_LATEST) {
27
+ return new Date()
28
+ }
29
+
30
+ // Use modern date parsing - the version string should be in YYYY-MM-DD format
31
+ // which is ISO 8601 compatible
32
+ const parsedDate = new Date(version + 'T00:00:00Z')
33
+
34
+ // Check if the date is valid
35
+ if (!isNaN(parsedDate.getTime())) {
36
+ return parsedDate
37
+ }
38
+
39
+ // Throw error for invalid dates instead of silently defaulting
40
+ throw new Error(`Invalid version string: ${version}`)
41
+ }
42
+
43
+ /**
44
+ * Determine if a version at the given index should have a changelog file.
45
+ * Only non-oldest versions get changelog files.
46
+ */
47
+ export const shouldVersionHaveChangelog = (versionIndex: number, totalVersions: number): boolean => {
48
+ return versionIndex < totalVersions - 1
49
+ }
@@ -0,0 +1,53 @@
1
+ import { VERSION_LATEST } from './constants.js'
2
+
3
+ export interface ReferencePathParts {
4
+ version?: string
5
+ type?: string
6
+ field?: string
7
+ }
8
+
9
+ export const createReferencePath = (parts: ReferencePathParts): string => {
10
+ const basePath = createReferenceBasePath(parts.version)
11
+ return joinSegmentsAndPaths(basePath, parts.type, parts.field)
12
+ }
13
+
14
+ /**
15
+ * Create a base path for reference pages based on the current version
16
+ * Used for sidebar navigation and other UI components that need version-aware paths
17
+ */
18
+ export const createReferenceBasePath = (version?: string): string => {
19
+ return joinSegmentsAndPaths(segmentLiterals.reference, createReferenceVersionPath(version))
20
+ }
21
+
22
+ export const segmentLiterals = {
23
+ reference: 'reference',
24
+ version: 'version',
25
+ }
26
+
27
+ /**
28
+ * Create a base path for reference pages based on the current version
29
+ * Used for sidebar navigation and other UI components that need version-aware paths
30
+ */
31
+ export const createReferenceVersionPath = (version?: string): string => {
32
+ if (version === undefined) return ''
33
+ return version === VERSION_LATEST
34
+ ? ``
35
+ : `/${segmentLiterals.version}/${version}`
36
+ }
37
+
38
+ export const joinSegmentsAndPaths = (
39
+ ...segmentsOrPaths: (string | undefined | null | (string | null | undefined)[])[]
40
+ ): string => {
41
+ const path = '/' + segmentsOrPaths
42
+ .flat()
43
+ .filter((_): _ is string => _ !== undefined && _ !== null)
44
+ .map(chunkUnformatted =>
45
+ chunkUnformatted
46
+ .replace(/^\//, '')
47
+ .replace(/\/$/, '')
48
+ )
49
+ .filter(Boolean)
50
+ .join('/')
51
+
52
+ return path
53
+ }
package/src/api/iso.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './iso/$.js'
@@ -1,10 +1,13 @@
1
1
  import type { GraphqlChangeset } from '#lib/graphql-changeset/index'
2
2
 
3
- export * as DataSources from './data-sources/data-sources.js'
4
-
5
- export * from './read.js'
3
+ // Re-export everything from isomorphic layer
4
+ export * from '../iso/schema/constants.js'
5
+ export * as Routing from '../iso/schema/routing.js'
6
6
 
7
+ // Server-only exports
8
+ export * as DataSources from './data-sources/data-sources.js'
7
9
  export * from './metadata.js'
10
+ export * from './read.js'
8
11
 
9
12
  export type ChangeSets = GraphqlChangeset.ChangeSet[]
10
13
 
@@ -17,53 +20,3 @@ export interface ChangelogData {
17
20
  changes: GraphqlChangeset.ChangeSet['changes']
18
21
  date: string
19
22
  }
20
-
21
- /**
22
- * Constants for schema versioning
23
- */
24
-
25
- /**
26
- * The version identifier for the latest schema
27
- */
28
- export const VERSION_LATEST = `latest`
29
-
30
- /**
31
- * Fallback version name when date parsing fails
32
- */
33
- export const VERSION_UNKNOWN_FALLBACK = `unknown`
34
-
35
- /**
36
- * Convert a date to a version string in YYYY-MM-DD format
37
- */
38
- export const dateToVersionString = (date: Date): string => {
39
- return date.toLocaleDateString('en-CA')
40
- }
41
-
42
- /**
43
- * Determine if a version at the given index should have a changelog file.
44
- * Only non-oldest versions get changelog files.
45
- */
46
- export const shouldVersionHaveChangelog = (versionIndex: number, totalVersions: number): boolean => {
47
- return versionIndex < totalVersions - 1
48
- }
49
-
50
- /**
51
- * Convert a version string back to a Date
52
- */
53
- export const versionStringToDate = (version: string): Date => {
54
- if (version === VERSION_LATEST) {
55
- return new Date()
56
- }
57
-
58
- // Use modern date parsing - the version string should be in YYYY-MM-DD format
59
- // which is ISO 8601 compatible
60
- const parsedDate = new Date(version + 'T00:00:00Z')
61
-
62
- // Check if the date is valid
63
- if (!isNaN(parsedDate.getTime())) {
64
- return parsedDate
65
- }
66
-
67
- // Throw error for invalid dates instead of silently defaulting
68
- throw new Error(`Invalid version string: ${version}`)
69
- }
@@ -1,22 +1,18 @@
1
1
  import type { Config } from '#api/config/index'
2
2
  import { Content } from '#api/content/$'
3
3
  import { createNavbar } from '#api/content/navbar'
4
+ import { Api } from '#api/index'
4
5
  import { VitePluginSelfContainedMode } from '#cli/_/self-contained-mode'
5
- import { Hono } from '#dep/hono/index'
6
6
  import type { ReactRouter } from '#dep/react-router/index'
7
7
  import type { Vite } from '#dep/vite/index'
8
8
  import { VitePluginJson } from '#lib/vite-plugin-json/index'
9
9
  import { ViteVirtual } from '#lib/vite-virtual/index'
10
10
  import { debugPolen } from '#singletons/debug'
11
11
  import { superjson } from '#singletons/superjson'
12
- import * as HonoNodeServer from '@hono/node-server'
13
- import { serveStatic } from '@hono/node-server/serve-static'
14
12
  import { Json, Str } from '@wollybeard/kit'
15
- import * as NodePath from 'node:path'
16
13
  import type { ProjectData } from '../../../project-data.js'
17
14
  import { SchemaAugmentation } from '../../schema-augmentation/index.js'
18
15
  import { Schema } from '../../schema/index.js'
19
- import { createLogger } from '../logger.js'
20
16
  import { polenVirtual } from '../vi.js'
21
17
  import { Pages } from './pages.js'
22
18
  import { SchemaAssets } from './schema-assets.js'
@@ -201,7 +197,8 @@ export const Core = (config: Config.Config): Vite.PluginOption[] => {
201
197
  // Without the leading slash, React Router treats paths as relative, which causes
202
198
  // hydration mismatches between SSR (where base path is prepended) and client
203
199
  // (where basename is configured). This ensures consistent behavior.
204
- navbar.push({ pathExp: `/reference`, title: `Reference` })
200
+ const referencePath = Api.Schema.Routing.createReferenceBasePath()
201
+ navbar.push({ pathExp: referencePath, title: `Reference` })
205
202
  if (schemaResult.data.length > 1) {
206
203
  navbar.push({ pathExp: `/changelog`, title: `Changelog` })
207
204
  }
@@ -5,6 +5,7 @@
5
5
  * analysis to create unified tokens for interactive code blocks.
6
6
  */
7
7
 
8
+ import { Api } from '#api/iso'
8
9
  import type { CodeAnnotation } from 'codehike/code'
9
10
  import {
10
11
  getNamedType,
@@ -14,7 +15,6 @@ import {
14
15
  GraphQLInputObjectType,
15
16
  GraphQLInterfaceType,
16
17
  GraphQLObjectType,
17
- type GraphQLOutputType,
18
18
  GraphQLScalarType,
19
19
  type GraphQLSchema,
20
20
  GraphQLUnionType,
@@ -24,12 +24,7 @@ import {
24
24
  import graphqlWasmUrl from 'tree-sitter-graphql-grammar-wasm/grammar.wasm?url'
25
25
  import * as WebTreeSitter from 'web-tree-sitter'
26
26
  import treeSitterWasmUrl from 'web-tree-sitter/tree-sitter.wasm?url'
27
- import {
28
- isKeywordNodeType,
29
- isLiteralNodeType,
30
- isPunctuationNodeType,
31
- type TreeSitterGraphQLNodeType,
32
- } from './graphql-node-types.js'
27
+ import { isKeywordNodeType, isPunctuationNodeType, type TreeSitterGraphQLNodeType } from './graphql-node-types.js'
33
28
  import type { SemanticNode } from './semantic-nodes.js'
34
29
  import {
35
30
  isArgument,
@@ -263,42 +258,63 @@ class UnifiedToken implements GraphQLToken {
263
258
 
264
259
  // Arguments - use #<field>__<argument> pattern
265
260
  if (isArgument(this.semantic)) {
266
- return `/reference/${this.semantic.parentType.name}#${this.semantic.parentField.name}__${this.semantic.argumentDef.name}`
261
+ const basePath = Api.Schema.Routing.createReferencePath({
262
+ type: this.semantic.parentType.name,
263
+ })
264
+ return `${basePath}#${this.semantic.parentField.name}__${this.semantic.argumentDef.name}`
267
265
  }
268
266
 
269
267
  // Output fields - use hash links since field routes aren't connected yet
270
268
  if (isOutputField(this.semantic)) {
271
- return `/reference/${this.semantic.parentType.name}#${this.semantic.fieldDef.name}`
269
+ const basePath = Api.Schema.Routing.createReferencePath({
270
+ type: this.semantic.parentType.name,
271
+ })
272
+ return `${basePath}#${this.semantic.fieldDef.name}`
272
273
  }
273
274
 
274
275
  // Input fields - use hash links since field routes aren't connected yet
275
276
  if (isInputField(this.semantic)) {
276
- return `/reference/${this.semantic.parentType.name}#${this.semantic.fieldDef.name}`
277
+ const basePath = Api.Schema.Routing.createReferencePath({
278
+ type: this.semantic.parentType.name,
279
+ })
280
+ return `${basePath}#${this.semantic.fieldDef.name}`
277
281
  }
278
282
 
279
283
  // Type references - use :type pattern
280
284
  if (this.semantic instanceof GraphQLObjectType) {
281
- return `/reference/${this.semantic.name}`
285
+ return Api.Schema.Routing.createReferencePath({
286
+ type: this.semantic.name,
287
+ })
282
288
  }
283
289
 
284
290
  if (this.semantic instanceof GraphQLScalarType) {
285
- return `/reference/${this.semantic.name}`
291
+ return Api.Schema.Routing.createReferencePath({
292
+ type: this.semantic.name,
293
+ })
286
294
  }
287
295
 
288
296
  if (this.semantic instanceof GraphQLInterfaceType) {
289
- return `/reference/${this.semantic.name}`
297
+ return Api.Schema.Routing.createReferencePath({
298
+ type: this.semantic.name,
299
+ })
290
300
  }
291
301
 
292
302
  if (this.semantic instanceof GraphQLUnionType) {
293
- return `/reference/${this.semantic.name}`
303
+ return Api.Schema.Routing.createReferencePath({
304
+ type: this.semantic.name,
305
+ })
294
306
  }
295
307
 
296
308
  if (this.semantic instanceof GraphQLEnumType) {
297
- return `/reference/${this.semantic.name}`
309
+ return Api.Schema.Routing.createReferencePath({
310
+ type: this.semantic.name,
311
+ })
298
312
  }
299
313
 
300
314
  if (this.semantic instanceof GraphQLInputObjectType) {
301
- return `/reference/${this.semantic.name}`
315
+ return Api.Schema.Routing.createReferencePath({
316
+ type: this.semantic.name,
317
+ })
302
318
  }
303
319
 
304
320
  return null
@@ -9,6 +9,7 @@ export interface HamburgerMenuProps {
9
9
  onToggle: () => void
10
10
  onClose: () => void
11
11
  sidebarData: Content.Item[]
12
+ basePath?: string
12
13
  }
13
14
 
14
15
  export const HamburgerMenu: React.FC<HamburgerMenuProps> = ({
@@ -16,6 +17,7 @@ export const HamburgerMenu: React.FC<HamburgerMenuProps> = ({
16
17
  onToggle,
17
18
  onClose,
18
19
  sidebarData,
20
+ basePath,
19
21
  }) => {
20
22
  // Prevent body scroll when mobile menu is open
21
23
  useEffect(() => {
@@ -87,7 +89,7 @@ export const HamburgerMenu: React.FC<HamburgerMenuProps> = ({
87
89
  <Cross2Icon width='18' height='18' />
88
90
  </IconButton>
89
91
  </Flex>
90
- <Sidebar data={sidebarData} />
92
+ <Sidebar data={sidebarData} basePath={basePath} />
91
93
  </Box>
92
94
  </>
93
95
  )}
@@ -1,3 +1,4 @@
1
+ import { Api } from '#api/iso'
1
2
  import type { ReactNode } from 'react'
2
3
  import { useVersionPath } from '../hooks/useVersionPath.js'
3
4
  import { Link } from './Link.js'
@@ -21,10 +22,12 @@ interface Props {
21
22
  export const ReferenceLink = ({ type, field, children }: Props) => {
22
23
  const versionPath = useVersionPath()
23
24
 
24
- let path = `/reference/${versionPath}${type}`
25
- if (field) {
26
- path += `/${field}`
27
- }
25
+ const path = Api.Schema.Routing.joinSegmentsAndPaths(
26
+ Api.Schema.Routing.segmentLiterals.reference,
27
+ versionPath,
28
+ type,
29
+ field,
30
+ )
28
31
 
29
32
  return (
30
33
  <Link to={path}>
@@ -1,13 +1,14 @@
1
+ import { Api } from '#api/iso'
2
+ import type { React } from '#dep/react/index'
1
3
  import { Select } from '@radix-ui/themes'
2
4
  import { useNavigate, useParams } from 'react-router'
3
- import { VERSION_LATEST } from '../lib/schema-utils/constants.js'
4
5
 
5
- interface VersionSelectorProps {
6
+ interface Props {
6
7
  availableVersions: string[]
7
8
  currentVersion: string
8
9
  }
9
10
 
10
- export const VersionSelector = ({ availableVersions, currentVersion }: VersionSelectorProps) => {
11
+ export const VersionSelector: React.FC<Props> = ({ availableVersions, currentVersion }) => {
11
12
  const navigate = useNavigate()
12
13
  const params = useParams()
13
14
 
@@ -17,20 +18,11 @@ export const VersionSelector = ({ availableVersions, currentVersion }: VersionSe
17
18
  }
18
19
 
19
20
  const handleVersionChange = (newVersion: string) => {
20
- // Build new path preserving the current type/field if any
21
- const currentType = params[`type`]
22
- const currentField = params[`field`]
23
-
24
- let newPath = `/reference`
25
- if (newVersion !== VERSION_LATEST) {
26
- newPath += `/version/${newVersion}`
27
- }
28
- if (currentType) {
29
- newPath += `/${currentType}`
30
- if (currentField) {
31
- newPath += `/${currentField}`
32
- }
33
- }
21
+ const newPath = Api.Schema.Routing.createReferencePath({
22
+ version: newVersion,
23
+ type: params[`type`],
24
+ field: params[`field`],
25
+ })
34
26
 
35
27
  navigate(newPath)
36
28
  }
@@ -41,7 +33,7 @@ export const VersionSelector = ({ availableVersions, currentVersion }: VersionSe
41
33
  <Select.Content>
42
34
  {availableVersions.map(version => (
43
35
  <Select.Item key={version} value={version}>
44
- {version === VERSION_LATEST ? `Latest` : version}
36
+ {version === Api.Schema.VERSION_LATEST ? `Latest` : version}
45
37
  </Select.Item>
46
38
  ))}
47
39
  </Select.Content>