polen 0.8.0-next.7 → 0.8.0-next.9

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 (171) hide show
  1. package/build/api/api.d.ts +4 -0
  2. package/build/api/api.d.ts.map +1 -0
  3. package/build/api/api.js +4 -0
  4. package/build/api/api.js.map +1 -0
  5. package/build/api/{build/build.d.ts → builder/builder.d.ts} +3 -3
  6. package/build/api/builder/builder.d.ts.map +1 -0
  7. package/build/api/{build/build.js → builder/builder.js} +11 -14
  8. package/build/api/builder/builder.js.map +1 -0
  9. package/build/api/builder/index.d.ts +2 -0
  10. package/build/api/builder/index.d.ts.map +1 -0
  11. package/build/api/builder/index.js +2 -0
  12. package/build/api/builder/index.js.map +1 -0
  13. package/build/api/config/config.d.ts +5 -0
  14. package/build/api/config/config.d.ts.map +1 -0
  15. package/build/api/config/config.js +5 -0
  16. package/build/api/config/config.js.map +1 -0
  17. package/build/api/{configurator → config}/configurator.d.ts +13 -3
  18. package/build/api/config/configurator.d.ts.map +1 -0
  19. package/build/api/{configurator → config}/configurator.js +52 -28
  20. package/build/api/config/configurator.js.map +1 -0
  21. package/build/api/config/define.d.ts +7 -0
  22. package/build/api/config/define.d.ts.map +1 -0
  23. package/build/api/config/define.js +7 -0
  24. package/build/api/config/define.js.map +1 -0
  25. package/build/api/config/index.d.ts +2 -0
  26. package/build/api/config/index.d.ts.map +1 -0
  27. package/build/api/config/index.js +2 -0
  28. package/build/api/config/index.js.map +1 -0
  29. package/build/api/config/load.d.ts +11 -0
  30. package/build/api/config/load.d.ts.map +1 -0
  31. package/build/api/config/load.js +36 -0
  32. package/build/api/config/load.js.map +1 -0
  33. package/build/api/config/merge.d.ts +7 -0
  34. package/build/api/config/merge.d.ts.map +1 -0
  35. package/build/api/config/merge.js +54 -0
  36. package/build/api/config/merge.js.map +1 -0
  37. package/build/api/config-resolver/config-resolver.d.ts +3 -0
  38. package/build/api/config-resolver/config-resolver.d.ts.map +1 -0
  39. package/build/api/config-resolver/config-resolver.js +3 -0
  40. package/build/api/config-resolver/config-resolver.js.map +1 -0
  41. package/build/api/config-resolver/index.d.ts +2 -0
  42. package/build/api/config-resolver/index.d.ts.map +1 -0
  43. package/build/api/config-resolver/index.js +2 -0
  44. package/build/api/config-resolver/index.js.map +1 -0
  45. package/build/api/config-resolver/resolve.d.ts +16 -0
  46. package/build/api/config-resolver/resolve.d.ts.map +1 -0
  47. package/build/api/config-resolver/resolve.js +21 -0
  48. package/build/api/config-resolver/resolve.js.map +1 -0
  49. package/build/api/config-resolver/vite.d.ts +10 -0
  50. package/build/api/config-resolver/vite.d.ts.map +1 -0
  51. package/build/api/config-resolver/vite.js +18 -0
  52. package/build/api/config-resolver/vite.js.map +1 -0
  53. package/build/api/index.d.ts +2 -0
  54. package/build/api/index.d.ts.map +1 -0
  55. package/build/api/index.js +2 -0
  56. package/build/api/index.js.map +1 -0
  57. package/build/api/vite/plugins/build.d.ts +2 -2
  58. package/build/api/vite/plugins/build.d.ts.map +1 -1
  59. package/build/api/vite/plugins/build.js.map +1 -1
  60. package/build/api/vite/plugins/core.d.ts +2 -2
  61. package/build/api/vite/plugins/core.d.ts.map +1 -1
  62. package/build/api/vite/plugins/core.js +20 -8
  63. package/build/api/vite/plugins/core.js.map +1 -1
  64. package/build/api/vite/plugins/main.d.ts +2 -2
  65. package/build/api/vite/plugins/main.d.ts.map +1 -1
  66. package/build/api/vite/plugins/main.js +19 -18
  67. package/build/api/vite/plugins/main.js.map +1 -1
  68. package/build/api/vite/plugins/serve.d.ts +2 -2
  69. package/build/api/vite/plugins/serve.d.ts.map +1 -1
  70. package/build/api/vite/plugins/serve.js.map +1 -1
  71. package/build/cli/commands/$default.js +1 -1
  72. package/build/cli/commands/$default.js.map +1 -1
  73. package/build/cli/commands/build.js +3 -5
  74. package/build/cli/commands/build.js.map +1 -1
  75. package/build/cli/commands/dev.js +8 -15
  76. package/build/cli/commands/dev.js.map +1 -1
  77. package/build/cli/commands/open.js +2 -2
  78. package/build/cli/commands/open.js.map +1 -1
  79. package/build/cli/index.js +6 -0
  80. package/build/cli/index.js.map +1 -1
  81. package/build/exports/polen.d.ts +3 -3
  82. package/build/exports/polen.d.ts.map +1 -1
  83. package/build/exports/polen.js +3 -3
  84. package/build/exports/polen.js.map +1 -1
  85. package/build/lib/file-router/linter.js +2 -2
  86. package/build/lib/file-router/linter.js.map +1 -1
  87. package/build/lib/kit-temp.d.ts +5 -0
  88. package/build/lib/kit-temp.d.ts.map +1 -1
  89. package/build/lib/kit-temp.js +29 -0
  90. package/build/lib/kit-temp.js.map +1 -1
  91. package/build/lib/vite-plugin-mdx/index.d.ts +2 -0
  92. package/build/lib/vite-plugin-mdx/index.d.ts.map +1 -0
  93. package/build/lib/vite-plugin-mdx/index.js +4 -0
  94. package/build/lib/vite-plugin-mdx/index.js.map +1 -0
  95. package/build/lib/vite-plugin-mdx/vite-plugin-mdx.d.ts +2 -0
  96. package/build/lib/vite-plugin-mdx/vite-plugin-mdx.d.ts.map +1 -0
  97. package/build/lib/vite-plugin-mdx/vite-plugin-mdx.js +74 -0
  98. package/build/lib/vite-plugin-mdx/vite-plugin-mdx.js.map +1 -0
  99. package/build/lib/vite-plugins/vite-plugins.d.ts +0 -1
  100. package/build/lib/vite-plugins/vite-plugins.d.ts.map +1 -1
  101. package/build/lib/vite-plugins/vite-plugins.js +0 -1
  102. package/build/lib/vite-plugins/vite-plugins.js.map +1 -1
  103. package/build/lib/vite-virtual/identified-loader.d.ts.map +1 -1
  104. package/build/lib/vite-virtual/identified-loader.js +4 -0
  105. package/build/lib/vite-virtual/identified-loader.js.map +1 -1
  106. package/build/project-data.d.ts +2 -2
  107. package/build/project-data.d.ts.map +1 -1
  108. package/build/template/server/render-page.jsx +1 -1
  109. package/build/template/server/render-page.jsx.map +1 -1
  110. package/package.json +11 -6
  111. package/src/api/api.ts +3 -0
  112. package/src/api/{build/build.ts → builder/builder.ts} +11 -14
  113. package/src/api/builder/index.ts +1 -0
  114. package/src/api/config/config.ts +4 -0
  115. package/src/api/{configurator → config}/configurator.ts +61 -42
  116. package/src/api/config/define.ts +8 -0
  117. package/src/api/config/index.ts +1 -0
  118. package/src/api/config/load.ts +52 -0
  119. package/src/api/config/merge.ts +68 -0
  120. package/src/api/config-resolver/config-resolver.ts +2 -0
  121. package/src/api/config-resolver/index.ts +1 -0
  122. package/src/api/config-resolver/resolve.ts +28 -0
  123. package/src/api/config-resolver/vite.ts +27 -0
  124. package/src/api/index.ts +1 -0
  125. package/src/api/vite/plugins/build.ts +3 -3
  126. package/src/api/vite/plugins/core.ts +22 -10
  127. package/src/api/vite/plugins/main.ts +21 -20
  128. package/src/api/vite/plugins/serve.ts +2 -2
  129. package/src/cli/commands/$default.ts +1 -1
  130. package/src/cli/commands/build.ts +3 -5
  131. package/src/cli/commands/dev.ts +8 -15
  132. package/src/cli/commands/open.ts +2 -2
  133. package/src/cli/index.ts +7 -0
  134. package/src/exports/polen.ts +3 -3
  135. package/src/lib/file-router/linter.ts +2 -2
  136. package/src/lib/kit-temp.ts +30 -0
  137. package/src/lib/vite-plugin-mdx/index.ts +2 -0
  138. package/src/lib/vite-plugin-mdx/vite-plugin-mdx.ts +81 -0
  139. package/src/lib/vite-plugins/vite-plugins.ts +0 -1
  140. package/src/lib/vite-virtual/identified-loader.ts +4 -0
  141. package/src/project-data.ts +2 -2
  142. package/src/template/server/render-page.tsx +1 -1
  143. package/build/api/build/build.d.ts.map +0 -1
  144. package/build/api/build/build.js.map +0 -1
  145. package/build/api/configurator/configurator.d.ts.map +0 -1
  146. package/build/api/configurator/configurator.js.map +0 -1
  147. package/build/api/configurator/index.d.ts +0 -2
  148. package/build/api/configurator/index.d.ts.map +0 -1
  149. package/build/api/configurator/index.js +0 -2
  150. package/build/api/configurator/index.js.map +0 -1
  151. package/build/api/define-config.d.ts +0 -13
  152. package/build/api/define-config.d.ts.map +0 -1
  153. package/build/api/define-config.js +0 -23
  154. package/build/api/define-config.js.map +0 -1
  155. package/build/api/load-config.d.ts +0 -9
  156. package/build/api/load-config.d.ts.map +0 -1
  157. package/build/api/load-config.js +0 -39
  158. package/build/api/load-config.js.map +0 -1
  159. package/build/api/vite/vite-plugin-delete.d.ts +0 -2
  160. package/build/api/vite/vite-plugin-delete.d.ts.map +0 -1
  161. package/build/api/vite/vite-plugin-delete.js +0 -11
  162. package/build/api/vite/vite-plugin-delete.js.map +0 -1
  163. package/build/lib/vite-plugins/output-logger.d.ts +0 -3
  164. package/build/lib/vite-plugins/output-logger.d.ts.map +0 -1
  165. package/build/lib/vite-plugins/output-logger.js +0 -13
  166. package/build/lib/vite-plugins/output-logger.js.map +0 -1
  167. package/src/api/configurator/index.ts +0 -1
  168. package/src/api/define-config.ts +0 -35
  169. package/src/api/load-config.ts +0 -54
  170. package/src/api/vite/vite-plugin-delete.ts +0 -10
  171. package/src/lib/vite-plugins/output-logger.ts +0 -14
@@ -0,0 +1,27 @@
1
+ import { Main } from '#api/vite/plugins/main.js'
2
+ import { Vite } from '#dep/vite/index.js'
3
+ import type { Config } from '../config/configurator.js'
4
+
5
+ /**
6
+ * Transform Polen config input into a Vite configuration.
7
+ */
8
+ export const toViteUserConfig = (
9
+ config: Config,
10
+ ): ViteUserConfigWithPolen => {
11
+ const viteUserConfigFromPolen: Vite.UserConfig = {
12
+ plugins: [Main(config)],
13
+ }
14
+
15
+ const viteUserConfigMerged = config.advanced.vite
16
+ ? Vite.mergeConfig(viteUserConfigFromPolen, config.advanced.vite)
17
+ : viteUserConfigFromPolen
18
+
19
+ return {
20
+ ...viteUserConfigMerged,
21
+ _polen: config,
22
+ }
23
+ }
24
+
25
+ export interface ViteUserConfigWithPolen extends Vite.UserConfig {
26
+ _polen: Config
27
+ }
@@ -0,0 +1 @@
1
+ export * as Api from './api.js'
@@ -1,11 +1,11 @@
1
+ import type { Config } from '#api/config/index.js'
1
2
  import { Vite } from '#dep/vite/index.js'
2
3
  import { ViteVirtual } from '#lib/vite-virtual/index.js'
3
4
  import { Fs, Path } from '@wollybeard/kit'
4
- import type { Configurator } from '../../configurator/index.js'
5
5
  import { isKitUnusedExternalImport, isRadixModuleLevelDirective } from '../log-filters.js'
6
6
  import { vi } from '../vi.js'
7
7
 
8
- export const Build = (config: Configurator.Config): Vite.Plugin[] => {
8
+ export const Build = (config: Config.Config): Vite.Plugin[] => {
9
9
  // let viteConfigResolved: Vite.ResolvedConfig
10
10
 
11
11
  // const outDir = Path.join(config.paths.project.rootDir, `dist`)
@@ -116,7 +116,7 @@ export const Build = (config: Configurator.Config): Vite.Plugin[] => {
116
116
 
117
117
  const viClientManifest = vi([`vite`, `client`, `manifest`])
118
118
 
119
- const Manifest = (config: Configurator.Config): Vite.Plugin => {
119
+ const Manifest = (config: Config.Config): Vite.Plugin => {
120
120
  let configEnv: Vite.ConfigEnv
121
121
 
122
122
  return {
@@ -1,3 +1,4 @@
1
+ import type { Config } from '#api/config/index.js'
1
2
  import type { ReactRouter } from '#dep/react-router/index.js'
2
3
  import type { Vite } from '#dep/vite/index.js'
3
4
  import { FileRouter } from '#lib/file-router/index.js'
@@ -15,7 +16,6 @@ import type {
15
16
  SiteNavigationItem,
16
17
  } from '../../../project-data.js'
17
18
  import { superjson } from '../../../singletons/superjson.js'
18
- import type { Configurator } from '../../configurator/index.js'
19
19
  import { SchemaAugmentation } from '../../schema-augmentation/index.js'
20
20
  import { Schema } from '../../schema/index.js'
21
21
  import { logger } from '../logger.js'
@@ -30,7 +30,7 @@ export interface ProjectPagesModule {
30
30
  pages: ReactRouter.RouteObject[]
31
31
  }
32
32
 
33
- export const Core = (config: Configurator.Config): Vite.PluginOption[] => {
33
+ export const Core = (config: Config.Config): Vite.PluginOption[] => {
34
34
  const scanPageRoutes = Cache.memoize(async () =>
35
35
  await FileRouter.scan({
36
36
  dir: config.paths.project.absolute.pages,
@@ -53,7 +53,10 @@ export const Core = (config: Configurator.Config): Vite.PluginOption[] => {
53
53
  // @see https://mdxjs.com/docs/getting-started/#vite
54
54
  {
55
55
  enforce: `pre`,
56
+ // TODO: Use inline vite-plugin-mdx once transform hooks can change module type
57
+ // @see https://github.com/rolldown/rolldown/issues/4004
56
58
  ...mdx({
59
+ jsxImportSource: `polen/react`,
57
60
  remarkPlugins: [
58
61
  remarkGfm,
59
62
  ],
@@ -114,11 +117,23 @@ export const Core = (config: Configurator.Config): Vite.PluginOption[] => {
114
117
  port: 3000,
115
118
  },
116
119
  customLogger: logger,
120
+ esbuild: false,
121
+ // oxc: {
122
+ // jsx: {
123
+ // runtime: 'automatic',
124
+ // importSource: 'react',
125
+ // },
126
+ // },
117
127
  build: {
118
128
  target: `esnext`,
119
129
  assetsDir: config.paths.project.relative.build.relative.assets,
120
130
  rollupOptions: {
121
- treeshake: `smallest`,
131
+ treeshake: {
132
+ // Aggressive tree-shaking for smallest bundles
133
+ moduleSideEffects: false, // Only include code if an export is actually used
134
+ annotations: true, // Respect @__PURE__ annotations for better dead code elimination
135
+ unknownGlobalSideEffects: false, // Assume global functions don't have side effects
136
+ },
122
137
  },
123
138
  minify: !config.advanced.debug,
124
139
  outDir: config.paths.project.absolute.build.root,
@@ -273,7 +288,7 @@ export const Core = (config: Configurator.Config): Vite.PluginOption[] => {
273
288
  */
274
289
  const buildSidebar = (pages: FileRouter.Route[], basePath: FileRouter.Path): Sidebar => {
275
290
  const navs: SidebarNav[] = []
276
- const sections = Idx.create<SidebarSection, string>({ toKey: (item) => item.pathExp })
291
+ const sections = Idx.create<SidebarSection, string>({ key: (item) => item.pathExp })
277
292
 
278
293
  // Items
279
294
  for (const page of pages) {
@@ -290,7 +305,7 @@ const buildSidebar = (pages: FileRouter.Route[], basePath: FileRouter.Path): Sid
290
305
  const sectionPathExp = FileRouter.pathToExpression(sectionPath)
291
306
 
292
307
  let section: SidebarSection | undefined
293
- section = sections.getKey(sectionPathExp)
308
+ section = sections.getAt(sectionPathExp)
294
309
 
295
310
  if (!section) {
296
311
  const sectionTitle = Str.titlizeSlug(FileRouter.pathToExpression(pageRelative.logical.path))
@@ -320,7 +335,7 @@ const buildSidebar = (pages: FileRouter.Route[], basePath: FileRouter.Path): Sid
320
335
  const sectionPathExp = FileRouter.pathToExpression(sectionPath)
321
336
 
322
337
  let section: SidebarSection | undefined
323
- section = sections.getKey(sectionPathExp)
338
+ section = sections.getAt(sectionPathExp)
324
339
 
325
340
  if (!section) {
326
341
  const sectionTitle = Str.titlizeSlug(FileRouter.pathToExpression(sectionRelativePath))
@@ -337,16 +352,13 @@ const buildSidebar = (pages: FileRouter.Route[], basePath: FileRouter.Path): Sid
337
352
  }
338
353
  }
339
354
 
340
- const items = [...navs, ...sections.data.array]
355
+ const items = [...navs, ...sections.toArray()]
341
356
 
342
357
  return {
343
358
  items,
344
359
  }
345
360
  }
346
361
 
347
- /**
348
- * Helper function to build sidebar items recursively
349
- */
350
362
  const pageToSidebarNav = (page: FileRouter.Route, basePath: FileRouter.Path): SidebarNav => {
351
363
  const pagePathExp = FileRouter.routeToPathExpression(page)
352
364
  const pageRelative = FileRouter.makeRelativeUnsafe(page, basePath)
@@ -1,35 +1,36 @@
1
+ import type { Config } from '#api/config/index.js'
1
2
  import type { Vite } from '#dep/vite/index.js'
2
- import ViteReact from '@vitejs/plugin-react'
3
- import { Arr, Path } from '@wollybeard/kit'
4
- import Inspect from 'vite-plugin-inspect'
5
- import Restart from 'vite-plugin-restart'
6
- import type { Configurator } from '../../configurator/index.js'
3
+ import ViteReact from '@vitejs/plugin-react-oxc'
4
+ // import { Arr, Path } from '@wollybeard/kit'
5
+ // import Inspect from 'vite-plugin-inspect'
6
+ // import Restart from 'vite-plugin-restart'
7
7
  import { Build } from './build.js'
8
8
  import { Core } from './core.js'
9
9
  import { Serve } from './serve.js'
10
10
 
11
11
  export const Main = (
12
- config: Configurator.Config,
12
+ config: Config.Config,
13
13
  ): Vite.PluginOption => {
14
14
  const plugins: Vite.PluginOption = []
15
15
 
16
16
  // Optional Plugins based on config
17
+ // TODO: Re-enable when compatible with Rolldown
17
18
 
18
- if (config.advanced.explorer) {
19
- const outputDir = Path.join(config.paths.project.rootDir, `.bundle-explorer`)
20
- const plugin = Inspect({
21
- build: true,
22
- outputDir,
23
- })
24
- plugins.push(plugin)
25
- }
19
+ // if (config.advanced.explorer) {
20
+ // const outputDir = Path.join(config.paths.project.rootDir, `.bundle-explorer`)
21
+ // const plugin = Inspect({
22
+ // build: true,
23
+ // outputDir,
24
+ // })
25
+ // plugins.push(plugin)
26
+ // }
26
27
 
27
- if (Arr.isntEmpty(config.watch.also)) {
28
- const plugin = Restart({
29
- restart: config.watch.also,
30
- })
31
- plugins.push(plugin)
32
- }
28
+ // if (Arr.isntEmpty(config.watch.also)) {
29
+ // const plugin = Restart({
30
+ // restart: config.watch.also,
31
+ // })
32
+ // plugins.push(plugin)
33
+ // }
33
34
 
34
35
  plugins.push(
35
36
  ViteReact(),
@@ -1,10 +1,10 @@
1
+ import type { Config } from '#api/config/index.js'
1
2
  import type { Hono } from '#dep/hono/index.js'
2
3
  import type { Vite } from '#dep/vite/index.js'
3
4
  import * as HonoNodeServer from '@hono/node-server'
4
- import type { Configurator } from '../../configurator/index.js'
5
5
 
6
6
  export const Serve = (
7
- config: Configurator.Config,
7
+ config: Config.Config,
8
8
  ): Vite.PluginOption => {
9
9
  return {
10
10
  name: `polen:serve`,
@@ -44,7 +44,7 @@ const commands = allCommands.filter(_ => _.name !== thisModuleName)
44
44
 
45
45
  s``
46
46
  s``
47
- s`${$.bold.redBright`POLEN 🌺`}`
47
+ s`${$.bold.redBright`POLEN 🌺`} ${$.dim(`v${manifest.version}`)}`
48
48
  s`${$.whiteBright(manifest.description)}.`
49
49
  s``
50
50
  s``
@@ -1,17 +1,15 @@
1
1
  /* eslint-disable */
2
2
  // @ts-nocheck
3
- import { build } from '#api/build/build.js'
4
- import { Configurator } from '#api/configurator/index.js'
3
+ import { Api } from '#api/index.js'
5
4
  import { Vite } from '#dep/vite/index.js'
6
5
  import { Command } from '@molt/command'
7
6
  import { z } from 'zod'
8
- import { loadConfig } from '../../api/load-config.js'
9
7
 
10
8
  const args = Command.create()
11
9
  .parameter(`--debug -d`, z.boolean().default(false))
12
10
  .parameter(
13
11
  `--architecture -a`,
14
- Configurator.BuildArchitecture.default('ssg').describe('Which kind of application architecture to output.'),
12
+ Api.Config.BuildArchitecture.default('ssg').describe('Which kind of application architecture to output.'),
15
13
  )
16
14
  .settings({
17
15
  parameters: {
@@ -32,7 +30,7 @@ const args = Command.create()
32
30
  // we don't want cli defaults to override explicit inputs in the config file either
33
31
  // we need something like setset and/or an ability in molt to show a default but then have undefined internally etc.
34
32
  // and now if user passes --no-debug/ --debug false it has no effect which is wrong since its not via default anymore, ... ugh
35
- await build({
33
+ await Api.Builder.build({
36
34
  ...(args.debug === false ? {} : { debug: args.debug }),
37
35
  ...(args.architecture === 'ssg' ? {} : { architecture: args.architecture }),
38
36
  })
@@ -1,10 +1,12 @@
1
1
  /* eslint-disable */
2
2
  // @ts-nocheck
3
+ import { Api } from '#api/index.js'
3
4
  import { Vite } from '#dep/vite/index.js'
5
+ import { ensureOptionalAbsolute, ensureOptionalAbsoluteWithCwd } from '#lib/kit-temp.js'
4
6
  import { Command } from '@molt/command'
5
- import { Err } from '@wollybeard/kit'
7
+ import { Err, Path } from '@wollybeard/kit'
6
8
  import { z } from 'zod'
7
- import { loadConfig } from '../../api/load-config.js'
9
+ // import { loadConfig } from '../../api/load-config.js'
8
10
 
9
11
  const args = Command.create()
10
12
  .parameter(
@@ -25,23 +27,14 @@ const args = Command.create()
25
27
  })
26
28
  .parse()
27
29
 
28
- const dir = args.project as string
30
+ const dir = ensureOptionalAbsoluteWithCwd(args.project) as string
29
31
 
30
- const config = await loadConfig({
31
- env: {
32
- command: `serve`,
33
- mode: `development`,
34
- },
35
- dir,
36
- overrides: {
37
- root: dir,
38
- },
39
- })
32
+ const viteUserConfig = await Api.ConfigResolver.fromFile({ dir })
40
33
 
41
- const viteDevServer = await Err.tryCatch(() => Vite.createServer(config))
34
+ const viteDevServer = await Err.tryCatch(() => Vite.createServer(viteUserConfig))
42
35
 
43
36
  if (Err.is(viteDevServer)) {
44
- // Err.log(viteDevServer)
37
+ Err.log(viteDevServer)
45
38
  process.exit(1)
46
39
  }
47
40
 
@@ -8,6 +8,7 @@
8
8
  * polen open --sdl https://docs.github.com/public/fpt/schema.docs.graphql
9
9
  */
10
10
 
11
+ import { Api } from '#api/index.js'
11
12
  import { Vite } from '#dep/vite/index.js'
12
13
  import { Grafaid } from '#lib/grafaid/index.js'
13
14
  import { GraphqlSchemaLoader } from '#lib/graphql-schema-loader/index.js'
@@ -16,7 +17,6 @@ import type { Fn } from '@wollybeard/kit'
16
17
  import { Err, Fs, Json, Path, Rec } from '@wollybeard/kit'
17
18
  import { homedir } from 'node:os'
18
19
  import { z } from 'zod'
19
- import { defineConfig } from '../../api/define-config.js'
20
20
 
21
21
  const args = Command.create()
22
22
  .parameter(
@@ -156,7 +156,7 @@ const schema = await load(
156
156
  },
157
157
  )
158
158
 
159
- const config = await defineConfig({
159
+ const config = await Api.ConfigResolver.fromMemory({
160
160
  root: await Fs.makeTemporaryDirectory(),
161
161
  schema: {
162
162
  dataSources: {
package/src/cli/index.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { Cli, Path } from '@wollybeard/kit'
4
+ import manifest from '../../package.json' with { type: 'json' }
5
+
6
+ // Handle --version flag
7
+ if (process.argv.includes(`--version`) || process.argv.includes(`-v`)) {
8
+ console.log(manifest.version)
9
+ process.exit(0)
10
+ }
4
11
 
5
12
  const commandsDir = Path.join(import.meta.dirname, `commands`)
6
13
  await Cli.dispatch(commandsDir)
@@ -1,3 +1,3 @@
1
- export { type ConfigInput } from '../api/configurator/configurator.js'
2
- export { defineConfig } from '../api/define-config.js'
3
- export { Main as VitePlugin } from '../api/vite/plugins/main.js'
1
+ export { defineConfig } from '#api/config/config.js'
2
+ export { type ConfigInput } from '#api/config/configurator.js'
3
+ export { Main as VitePlugin } from '#api/vite/plugins/main.js'
@@ -21,7 +21,7 @@ export interface LintResult {
21
21
  export const lint = (routes: Route[]): LintResult => {
22
22
  const diagnostics: Diagnostic[] = []
23
23
 
24
- const seen = Idx.create({ toKey: routeToPathExpression })
24
+ const seen = Idx.create({ key: routeToPathExpression })
25
25
 
26
26
  // ━ Check for conflict between index and literal.
27
27
  // Note: There is no other way for paths to conflict so we safely assuming the cause is index+literal.
@@ -58,6 +58,6 @@ export const lint = (routes: Route[]): LintResult => {
58
58
 
59
59
  return {
60
60
  diagnostics,
61
- routes: seen.data.array,
61
+ routes: seen.toArray(),
62
62
  }
63
63
  }
@@ -12,6 +12,8 @@
12
12
  //
13
13
  //
14
14
 
15
+ import { Fs, Path, Undefined } from '@wollybeard/kit'
16
+
15
17
  export const arrayEquals = (a: any[], b: any[]) => {
16
18
  if (a.length !== b.length) return false
17
19
  for (let i = 0; i < a.length; i++) {
@@ -19,3 +21,31 @@ export const arrayEquals = (a: any[], b: any[]) => {
19
21
  }
20
22
  return true
21
23
  }
24
+
25
+ export const ensureOptionalAbsoluteWithCwd = (pathExp: string | undefined): string => {
26
+ if (Undefined.is(pathExp)) return process.cwd()
27
+ return Path.ensureAbsolute(pathExp, process.cwd())
28
+ }
29
+
30
+ export const ensureOptionalAbsolute = (pathExp: string | undefined, basePathExp: string): string => {
31
+ assertPathAbsolute(basePathExp)
32
+ if (Undefined.is(pathExp)) return basePathExp
33
+ return Path.ensureAbsolute(pathExp, basePathExp)
34
+ }
35
+
36
+ export const assertPathAbsolute = (pathExpression: string): void => {
37
+ if (Path.isAbsolute(pathExpression)) return
38
+ throw new Error(`Path must be absolute: ${pathExpression}`)
39
+ }
40
+
41
+ export const assertOptionalPathAbsolute = (pathExpression: string | undefined, message?: string): void => {
42
+ if (Undefined.is(pathExpression)) return
43
+ if (Path.isAbsolute(pathExpression)) return
44
+ const message_ = message ?? `Path must be absolute: ${pathExpression}`
45
+ throw new Error(message_)
46
+ }
47
+
48
+ export const pickFirstPathExisting = async (paths: string[]): Promise<string | undefined> => {
49
+ const checks = await Promise.all(paths.map(path => Fs.exists(path).then(exists => exists ? path : undefined)))
50
+ return checks.find(maybePath => maybePath !== undefined)
51
+ }
@@ -0,0 +1,2 @@
1
+ // export { VitePluginMdx as mdxRolldown } from './vite-plugin-mdx.js'
2
+ // export type { Options as MdxOptions } from './vite-plugin-mdx.js'
@@ -0,0 +1,81 @@
1
+ // TODO: use this or similar once transform hook can change module type and have result re-processed
2
+ // @see https://github.com/rolldown/rolldown/issues/4004
3
+
4
+ // import type { CompileOptions } from '@mdx-js/mdx'
5
+ // import {
6
+ // createFormatAwareProcessors,
7
+ // type FormatAwareProcessors,
8
+ // } from '@mdx-js/mdx/internal-create-format-aware-processors'
9
+ // import { createFilter, type FilterPattern } from '@rollup/pluginutils'
10
+ // import type { SourceDescription } from 'rolldown'
11
+ // import { SourceMapGenerator } from 'source-map'
12
+ // import { VFile } from 'vfile'
13
+ // import type { Plugin } from 'vite'
14
+
15
+ // type ApplicableOptions = Omit<CompileOptions, `SourceMapGenerator`>
16
+
17
+ // interface ExtraOptions {
18
+ // /**
19
+ // * Picomatch patterns to exclude (optional).
20
+ // */
21
+ // exclude?: FilterPattern | null | undefined
22
+ // /**
23
+ // * Picomatch patterns to include (optional).
24
+ // */
25
+ // include?: FilterPattern | null | undefined
26
+ // }
27
+
28
+ // export type Options = ApplicableOptions & ExtraOptions
29
+
30
+ // /**
31
+ // * Plugin to compile MDX w/ rolldown.
32
+ // */
33
+ // export function VitePluginMdx(options?: Readonly<Options> | null): Plugin {
34
+ // const {
35
+ // exclude,
36
+ // include = /\.mdx?$/, // Default to .md and .mdx files
37
+ // ...rest
38
+ // } = options ?? {}
39
+ // let formatAwareProcessors: FormatAwareProcessors
40
+ // const filter = createFilter(include, exclude)
41
+
42
+ // return {
43
+ // name: `@mdx-js/rolldown`,
44
+ // enforce: `pre`, // Run before other transforms
45
+ // config(config, env) {
46
+ // // Initialize processors with Vite environment info
47
+ // formatAwareProcessors = createFormatAwareProcessors({
48
+ // SourceMapGenerator,
49
+ // development: env.mode === `development`,
50
+ // ...rest,
51
+ // })
52
+ // },
53
+ // async transform(value: string, id: string): Promise<SourceDescription | undefined> {
54
+ // // Ensure processors are initialized
55
+ // // if (!formatAwareProcessors) {
56
+ // // formatAwareProcessors = createFormatAwareProcessors({
57
+ // // SourceMapGenerator,
58
+ // // ...rest,
59
+ // // })
60
+ // // }
61
+
62
+ // const file = new VFile({ path: id, value })
63
+
64
+ // if (
65
+ // file.extname
66
+ // && filter(file.path)
67
+ // && formatAwareProcessors.extnames.includes(file.extname)
68
+ // ) {
69
+ // const compiled = await formatAwareProcessors.process(file)
70
+ // const code = String(compiled.value)
71
+ // const result: SourceDescription = {
72
+ // code,
73
+ // // When MDX compiles to JS (not JSX), we don't need to set moduleType
74
+ // map: compiled.map,
75
+ // }
76
+
77
+ // return result
78
+ // }
79
+ // },
80
+ // }
81
+ // }
@@ -1,2 +1 @@
1
1
  export * from './build-logger.js'
2
- export * from './output-logger.js'
@@ -18,6 +18,10 @@ export const toHookLoad = (
18
18
  debug(`will load`, { identifier: identifiedLoader.identifier })
19
19
  const result = await identifiedLoader.loader(...args)
20
20
  debug(`did load`, { identifier: identifiedLoader.identifier, result })
21
+ // Add moduleType for Rolldown compatibility
22
+ if (result && typeof result === `string`) {
23
+ return { code: result, moduleType: `js` }
24
+ }
21
25
  return result
22
26
  }
23
27
  return undefined
@@ -1,5 +1,5 @@
1
+ import type { Config } from '#api/config/index.js'
1
2
  import type { FileRouter } from '#lib/file-router/index.js'
2
- import type { Configurator } from './api/configurator/index.js'
3
3
  import type { Schema } from './api/schema/index.js'
4
4
 
5
5
  export interface ProjectData {
@@ -7,7 +7,7 @@ export interface ProjectData {
7
7
  siteNavigationItems: SiteNavigationItem[]
8
8
  sidebarIndex: SidebarIndex
9
9
  faviconPath: string
10
- paths: Configurator.Config[`paths`][`project`]
10
+ paths: Config.Config[`paths`][`project`]
11
11
  pagesScanResult: FileRouter.ScanResult
12
12
  server: {
13
13
  static: {
@@ -57,7 +57,7 @@ const getStatusCode = (
57
57
  }
58
58
 
59
59
  // Then check for custom status in route handle
60
- const handle = Arr.last(context.matches)?.route.handle as undefined | ReactRouterAid.RouteHandle
60
+ const handle = Arr.getLast(context.matches)?.route.handle as undefined | ReactRouterAid.RouteHandle
61
61
  if (handle?.statusCode) {
62
62
  return handle.statusCode
63
63
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/api/build/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAWzD,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAA;CAC9C;AAED,eAAO,MAAM,KAAK,GAAU,kBAAkB,gBAAgB,kBAkC7D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/api/build/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,KAAK;IACZ,YAAY,EAAE,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG;CACtD,CAAA;AAOD,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,gBAAkC,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAE7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC;QAC9B,GAAG,EAAE;YACH,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,YAAY;SACnB;QACD,SAAS,EAAE;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;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE;QACL,YAAY,EAAE,iBAAiB,CAAA;KAChC,CAAA;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,EAAE,CAAA;KACf,CAAA;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,mBAAmB,EAAE,kBAAkB,CAAC,YAAY,EAAE,CAAA;IACtD,MAAM,EAAE,IAAI,GAAG,iBAAiB,CAAA;IAChC,GAAG,EAAE;QACH,OAAO,EAAE,OAAO,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAA;YACf,QAAQ,EAAE;gBACR,KAAK,EAAE;oBACL,IAAI,EAAE,MAAM,CAAA;oBACZ,QAAQ,EAAE;wBACR,MAAM,EAAE,MAAM,CAAA;wBACd,gBAAgB,EAAE,MAAM,CAAA;qBACzB,CAAA;iBACF,CAAA;gBACD,KAAK,EAAE,MAAM,CAAA;aACd,CAAA;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE;oBACL,IAAI,EAAE,MAAM,CAAA;oBACZ,MAAM,EAAE,MAAM,CAAA;oBACd,gBAAgB,EAAE,MAAM,CAAA;iBACzB,CAAA;gBACD,KAAK,EAAE,MAAM,CAAA;aACd,CAAA;SACF,CAAA;QACD,SAAS,EAAE,YAAY,CAAA;KACxB,CAAA;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,OAAO,CAAA;QACjB,KAAK,EAAE,OAAO,CAAA;QACd,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAA;KACvB,CAAA;CACF;AA+CD,eAAO,MAAM,cAAc,GACzB,cAAc,WAAW,KAExB,OAAO,CAAC,MAAM,CAsDhB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configurator.js","sourceRoot":"","sources":["../../../src/api/configurator/configurator.ts"],"names":[],"mappings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7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAC5B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CACpC,CAAA;IACH,CAAC;IAED,IAAI,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAChC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAA;IAClD,CAAC;IAED,IAAI,WAAW,EAAE,mBAAmB,EAAE,CAAC;QACrC,MAAM,CAAC,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAA;IAC9D,CAAC;IAED,MAAM,CAAC,iBAAiB,GAAG;QACzB,GAAG,MAAM,CAAC,iBAAiB;QAC3B,GAAG,WAAW,EAAE,iBAAiB;KAClC,CAAA;IAED,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;QACxB,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;IACpC,CAAC;IAED,IAAI,WAAW,EAAE,QAAQ,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;QAClD,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAA;IAC1D,CAAC;IAED,IAAI,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAA;IACrD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export * as Configurator from './configurator.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/configurator/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * as Configurator from './configurator.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/configurator/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA"}
@@ -1,13 +0,0 @@
1
- import { Vite } from '#dep/vite/index.js';
2
- import { Configurator } from './configurator/index.js';
3
- export interface ViteUserConfigWithPolen extends Vite.UserConfig {
4
- _polen: {
5
- input: undefined | Configurator.ConfigInput;
6
- normalized: Configurator.Config;
7
- };
8
- }
9
- /**
10
- * Create a Vite configuration. Thin wrapper around {@link Vite.defineConfig}.
11
- */
12
- export declare const defineConfig: (configInput?: Configurator.ConfigInput) => Promise<ViteUserConfigWithPolen>;
13
- //# sourceMappingURL=define-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../src/api/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAGtD,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,UAAU;IAC9D,MAAM,EAAE;QACN,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC,WAAW,CAAA;QAC3C,UAAU,EAAE,YAAY,CAAC,MAAM,CAAA;KAChC,CAAA;CACF;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,cAAc,YAAY,CAAC,WAAW,KACrC,OAAO,CAAC,uBAAuB,CAkBjC,CAAA"}
@@ -1,23 +0,0 @@
1
- import { Vite } from '#dep/vite/index.js';
2
- import { Configurator } from './configurator/index.js';
3
- import { Main } from './vite/plugins/main.js';
4
- /**
5
- * Create a Vite configuration. Thin wrapper around {@link Vite.defineConfig}.
6
- */
7
- export const defineConfig = async (configInput) => {
8
- const polenConfig = await Configurator.normalizeInput(configInput);
9
- const viteConfigFromPolen = {
10
- plugins: [Main(polenConfig)],
11
- };
12
- const viteConfigMerged = configInput?.advanced?.vite
13
- ? Vite.mergeConfig(viteConfigFromPolen, configInput.advanced.vite)
14
- : viteConfigFromPolen;
15
- return {
16
- ...viteConfigMerged,
17
- _polen: {
18
- input: configInput,
19
- normalized: polenConfig,
20
- },
21
- };
22
- };
23
- //# sourceMappingURL=define-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-config.js","sourceRoot":"","sources":["../../src/api/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAS7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,WAAsC,EACJ,EAAE;IACpC,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;IAElE,MAAM,mBAAmB,GAAoB;QAC3C,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KAC7B,CAAA;IAED,MAAM,gBAAgB,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI;QAClD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClE,CAAC,CAAC,mBAAmB,CAAA;IAEvB,OAAO;QACL,GAAG,gBAAgB;QACnB,MAAM,EAAE;YACN,KAAK,EAAE,WAAW;YAClB,UAAU,EAAE,WAAW;SACxB;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -1,9 +0,0 @@
1
- import { Vite } from '#dep/vite/index.js';
2
- import type { Configurator } from './configurator/index.js';
3
- import { type ViteUserConfigWithPolen } from './define-config.js';
4
- export declare const loadConfig: (args: {
5
- env: Vite.ConfigEnv;
6
- dir?: string;
7
- overrides?: Configurator.ConfigInput;
8
- }) => Promise<ViteUserConfigWithPolen>;
9
- //# sourceMappingURL=load-config.d.ts.map