polen 0.0.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.
Files changed (123) hide show
  1. package/build/_exports.d.ts +1 -0
  2. package/build/_exports.js +1 -0
  3. package/build/_namespace.d.ts +1 -0
  4. package/build/_namespace.js +1 -0
  5. package/build/app-template/components/ArgumentAnnotation.d.ts +9 -0
  6. package/build/app-template/components/ArgumentAnnotation.jsx +15 -0
  7. package/build/app-template/components/ArgumentList.d.ts +6 -0
  8. package/build/app-template/components/ArgumentList.jsx +15 -0
  9. package/build/app-template/components/ArgumentListAnnotation.d.ts +6 -0
  10. package/build/app-template/components/ArgumentListAnnotation.jsx +22 -0
  11. package/build/app-template/components/ColumnView.d.ts +6 -0
  12. package/build/app-template/components/ColumnView.jsx +26 -0
  13. package/build/app-template/components/DeprecationReason.d.ts +5 -0
  14. package/build/app-template/components/DeprecationReason.jsx +9 -0
  15. package/build/app-template/components/Description.d.ts +6 -0
  16. package/build/app-template/components/Description.jsx +9 -0
  17. package/build/app-template/components/Field.d.ts +7 -0
  18. package/build/app-template/components/Field.jsx +19 -0
  19. package/build/app-template/components/FieldList.d.ts +6 -0
  20. package/build/app-template/components/FieldList.jsx +13 -0
  21. package/build/app-template/components/FieldListSection.d.ts +6 -0
  22. package/build/app-template/components/FieldListSection.jsx +14 -0
  23. package/build/app-template/components/Link.d.ts +3 -0
  24. package/build/app-template/components/Link.jsx +5 -0
  25. package/build/app-template/components/Markdown.d.ts +4 -0
  26. package/build/app-template/components/Markdown.jsx +13 -0
  27. package/build/app-template/components/NamedType.d.ts +6 -0
  28. package/build/app-template/components/NamedType.jsx +15 -0
  29. package/build/app-template/components/RadixLink.d.ts +1 -0
  30. package/build/app-template/components/RadixLink.jsx +1 -0
  31. package/build/app-template/components/TypeAnnotation.d.ts +9 -0
  32. package/build/app-template/components/TypeAnnotation.jsx +42 -0
  33. package/build/app-template/components/TypeFieldsLinkList.d.ts +6 -0
  34. package/build/app-template/components/TypeFieldsLinkList.jsx +16 -0
  35. package/build/app-template/entry.client.d.ts +1 -0
  36. package/build/app-template/entry.client.jsx +22 -0
  37. package/build/app-template/entry.server.d.ts +3 -0
  38. package/build/app-template/entry.server.jsx +96 -0
  39. package/build/app-template/routes/index.d.ts +1 -0
  40. package/build/app-template/routes/index.jsx +6 -0
  41. package/build/app-template/routes/reference.$type.$field.d.ts +4 -0
  42. package/build/app-template/routes/reference.$type.$field.jsx +24 -0
  43. package/build/app-template/routes/reference.$type.d.ts +4 -0
  44. package/build/app-template/routes/reference.$type.jsx +18 -0
  45. package/build/app-template/routes/reference.d.ts +12 -0
  46. package/build/app-template/routes/reference.jsx +34 -0
  47. package/build/app-template/routes/root.d.ts +17 -0
  48. package/build/app-template/routes/root.jsx +33 -0
  49. package/build/app-template/routes.d.ts +2 -0
  50. package/build/app-template/routes.jsx +4 -0
  51. package/build/lib/code-builder/_exports.d.ts +7 -0
  52. package/build/lib/code-builder/_exports.js +11 -0
  53. package/build/lib/code-builder/_namespace.d.ts +1 -0
  54. package/build/lib/code-builder/_namespace.js +1 -0
  55. package/build/lib/debug/_namespace.d.ts +1 -0
  56. package/build/lib/debug/_namespace.js +1 -0
  57. package/build/lib/debug/debug.d.ts +4 -0
  58. package/build/lib/debug/debug.js +37 -0
  59. package/build/lib/fs/_namespace.d.ts +1 -0
  60. package/build/lib/fs/_namespace.js +1 -0
  61. package/build/lib/fs/main.d.ts +3 -0
  62. package/build/lib/fs/main.js +17 -0
  63. package/build/lib/grafaid/helpers.d.ts +62 -0
  64. package/build/lib/grafaid/helpers.js +140 -0
  65. package/build/lib/grafaid/index.d.ts +7 -0
  66. package/build/lib/grafaid/index.js +9 -0
  67. package/build/lib/h3/_namespace.d.ts +1 -0
  68. package/build/lib/h3/_namespace.js +1 -0
  69. package/build/lib/hono/_exports.d.ts +2 -0
  70. package/build/lib/hono/_exports.js +2 -0
  71. package/build/lib/hono/_namespace.d.ts +1 -0
  72. package/build/lib/hono/_namespace.js +1 -0
  73. package/build/lib/hono/ssg.d.ts +1 -0
  74. package/build/lib/hono/ssg.js +1 -0
  75. package/build/lib/nitro/_namespace.d.ts +2 -0
  76. package/build/lib/nitro/_namespace.js +1 -0
  77. package/build/lib/path/_namespace.d.ts +1 -0
  78. package/build/lib/path/_namespace.js +1 -0
  79. package/build/lib/path/main.d.ts +9 -0
  80. package/build/lib/path/main.js +14 -0
  81. package/build/lib/prelude/main.d.ts +3 -0
  82. package/build/lib/prelude/main.js +3 -0
  83. package/build/lib/react/_namespace.d.ts +2 -0
  84. package/build/lib/react/_namespace.js +2 -0
  85. package/build/lib/react-dom-client/_namespace.d.ts +2 -0
  86. package/build/lib/react-dom-client/_namespace.js +2 -0
  87. package/build/lib/react-dom-server/_namespace.d.ts +2 -0
  88. package/build/lib/react-dom-server/_namespace.js +2 -0
  89. package/build/lib/react-router/_namespace.d.ts +1 -0
  90. package/build/lib/react-router/_namespace.js +1 -0
  91. package/build/lib/react-router-helpers.d.ts +4 -0
  92. package/build/lib/react-router-helpers.js +13 -0
  93. package/build/lib/rollup/_namespace.d.ts +1 -0
  94. package/build/lib/rollup/_namespace.js +1 -0
  95. package/build/lib/tan-stack-router-vite.d.ts +1 -0
  96. package/build/lib/tan-stack-router-vite.js +1 -0
  97. package/build/lib/vite/_exports.d.ts +21 -0
  98. package/build/lib/vite/_exports.js +18 -0
  99. package/build/lib/vite/_namespace.d.ts +1 -0
  100. package/build/lib/vite/_namespace.js +1 -0
  101. package/build/lib/vite/virtual-identifier.d.ts +21 -0
  102. package/build/lib/vite/virtual-identifier.js +94 -0
  103. package/build/lib/vite-plugins/_exports.d.ts +2 -0
  104. package/build/lib/vite-plugins/_exports.js +2 -0
  105. package/build/lib/vite-plugins/_namespace.d.ts +4 -0
  106. package/build/lib/vite-plugins/_namespace.js +4 -0
  107. package/build/lib/vite-plugins/build-logger.d.ts +2 -0
  108. package/build/lib/vite-plugins/build-logger.js +30 -0
  109. package/build/lib/vite-plugins/output-logger.d.ts +2 -0
  110. package/build/lib/vite-plugins/output-logger.js +12 -0
  111. package/build/vite-plugin/_exports.d.ts +3 -0
  112. package/build/vite-plugin/_exports.js +81 -0
  113. package/build/vite-plugin/build.d.ts +5 -0
  114. package/build/vite-plugin/build.js +144 -0
  115. package/build/vite-plugin/configurator/_namespace.d.ts +1 -0
  116. package/build/vite-plugin/configurator/_namespace.js +1 -0
  117. package/build/vite-plugin/configurator/main.d.ts +35 -0
  118. package/build/vite-plugin/configurator/main.js +36 -0
  119. package/build/vite-plugin/helpers.d.ts +2 -0
  120. package/build/vite-plugin/helpers.js +2 -0
  121. package/build/vite-plugin/renderer.d.ts +2 -0
  122. package/build/vite-plugin/renderer.js +3 -0
  123. package/package.json +77 -0
@@ -0,0 +1,94 @@
1
+ import { Debug } from '../debug/_namespace.js';
2
+ // TODO: use async hooks in debug to get namespace
3
+ const debug = Debug.create(`polen:vite:build`);
4
+ export const idPrefix = `virtual:`;
5
+ export const resolvedPrefix = `\0`;
6
+ const createResolved = (id) => `${resolvedPrefix}${id}`;
7
+ const createId = (id) => `${idPrefix}${id}`;
8
+ const normalizeId = (parameters) => {
9
+ if (!parameters.separator)
10
+ return parameters.id;
11
+ return parameters.id.replace(new RegExp(`^${parameters.separator}`), ``);
12
+ };
13
+ export const createNamespaceFactory = (namespace, separator = `/`) => {
14
+ return idOrIdSegments => {
15
+ const id = Array.isArray(idOrIdSegments)
16
+ ? idOrIdSegments.join(separator)
17
+ : idOrIdSegments;
18
+ return create({
19
+ id,
20
+ namespace,
21
+ separator,
22
+ });
23
+ };
24
+ };
25
+ const create = (parameters) => {
26
+ const separator = parameters.separator ?? `/`;
27
+ const idNormalized = normalizeId({ id: parameters.id, separator });
28
+ const idNamespaced = parameters.namespace
29
+ ? `${parameters.namespace}${separator}${idNormalized}`
30
+ : idNormalized;
31
+ const id = createId(idNamespaced);
32
+ const resolved = createResolved(id);
33
+ return {
34
+ id,
35
+ resolved,
36
+ separator,
37
+ namespace: parameters.namespace ?? null,
38
+ };
39
+ };
40
+ // Transformers
41
+ export const toHookResolveId = (virtualIdentifier) => {
42
+ return id => {
43
+ if (id === virtualIdentifier.id) {
44
+ return virtualIdentifier.resolved;
45
+ }
46
+ return undefined;
47
+ };
48
+ };
49
+ export const toHookLoad = (virtualIdentifier, loader) => {
50
+ return async (...args) => {
51
+ // debug(`load candidate`, { virtualIdentifier, args })
52
+ if (args[0] === virtualIdentifier.resolved) {
53
+ debug(`will load`, { virtualIdentifier });
54
+ const result = await loader(...args);
55
+ debug(`did load`, { virtualIdentifier, result });
56
+ return result;
57
+ }
58
+ return undefined;
59
+ };
60
+ };
61
+ export const toHooks = (virtualIdentifier, loader) => {
62
+ return {
63
+ resolveId: toHookResolveId(virtualIdentifier),
64
+ load: toHookLoad(virtualIdentifier, loader),
65
+ };
66
+ };
67
+ export const toHookLoad$FromMap = (virtualIdentifierToLoaderMap) => {
68
+ const loaderStack = [...virtualIdentifierToLoaderMap.entries()].map(([vi, loader]) => toHookLoad(vi, loader));
69
+ return async (...args) => {
70
+ for (const loader of loaderStack) {
71
+ const result = await loader(...args);
72
+ if (result !== undefined)
73
+ return result;
74
+ }
75
+ return undefined;
76
+ };
77
+ };
78
+ export const toHookResolveId$FromMap = (virtualIdentifierToLoaderMap) => {
79
+ return async (...args) => {
80
+ const resolversStack = [...virtualIdentifierToLoaderMap.keys()].map(toHookResolveId);
81
+ for (const resolver of resolversStack) {
82
+ const result = await resolver(...args);
83
+ if (result !== undefined)
84
+ return result;
85
+ }
86
+ return undefined;
87
+ };
88
+ };
89
+ export const toHooks$FromMap = (virtualIdentifierToLoaderMap) => {
90
+ return {
91
+ resolveId: toHookResolveId$FromMap(virtualIdentifierToLoaderMap),
92
+ load: toHookLoad$FromMap(virtualIdentifierToLoaderMap),
93
+ };
94
+ };
@@ -0,0 +1,2 @@
1
+ export * from './build-logger.js';
2
+ export * from './output-logger.js';
@@ -0,0 +1,2 @@
1
+ export * from './build-logger.js';
2
+ export * from './output-logger.js';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Export unified VitePlugins namespace
3
+ */
4
+ export * as Plugins from './_exports.js';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Export unified VitePlugins namespace
3
+ */
4
+ export * as Plugins from './_exports.js';
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare const BuildLogger: Plugin;
@@ -0,0 +1,30 @@
1
+ export const BuildLogger = {
2
+ // https://rollupjs.org/plugin-development/#build-hooks
3
+ name: `build-logger`,
4
+ buildStart(...args) {
5
+ console.log(`buildStart`, args);
6
+ },
7
+ resolveId(...args) {
8
+ console.log(`resolveId`, args);
9
+ },
10
+ load(...args) {
11
+ console.log(`load`, JSON.stringify(args));
12
+ },
13
+ shouldTransformCachedModule(...args) {
14
+ console.log(`shouldTransformCachedModule`, args);
15
+ },
16
+ transform(...args) {
17
+ // console.log(`transform`)
18
+ console.log(`transform`, args);
19
+ return args[0];
20
+ },
21
+ moduleParsed(...args) {
22
+ console.log(`\nmoduleParsed`, args);
23
+ },
24
+ resolveDynamicImport(...args) {
25
+ console.log(`resolveDynamicImport`, args);
26
+ },
27
+ buildEnd(...args) {
28
+ console.log(`buildEnd`, args);
29
+ },
30
+ };
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare const OutputLogger: Plugin;
@@ -0,0 +1,12 @@
1
+ export const OutputLogger = {
2
+ name: `output-logger`,
3
+ outputOptions(...args) {
4
+ console.log(`outputOptions`, args);
5
+ },
6
+ renderStart(...args) {
7
+ console.log(`renderStart`, args);
8
+ },
9
+ renderDynamicImport(...args) {
10
+ console.log(`renderDynamicImport`, args);
11
+ },
12
+ };
@@ -0,0 +1,3 @@
1
+ import { Configurator } from './configurator/_namespace.js';
2
+ import { Vite } from '../lib/vite/_namespace.js';
3
+ export declare const VitePlugin: (polenConfigInput?: Configurator.ConfigInput) => Vite.PluginOption[];
@@ -0,0 +1,81 @@
1
+ import { Configurator } from './configurator/_namespace.js';
2
+ import { Vite } from '../lib/vite/_namespace.js';
3
+ import ReactVite from '@vitejs/plugin-react';
4
+ import { Fs } from '../lib/fs/_namespace.js';
5
+ import { virtualIdentifier } from './helpers.js';
6
+ import { Build } from './build.js';
7
+ import { nodeAdapter as HonoDevServerNodeAdapter } from '@hono/vite-dev-server/node';
8
+ import HonoDevServer from '@hono/vite-dev-server';
9
+ const virtualIdentifierAssetGraphqlSchema = virtualIdentifier([`assets`, `graphql-schema`]);
10
+ const codes = {
11
+ MODULE_LEVEL_DIRECTIVE: `MODULE_LEVEL_DIRECTIVE`,
12
+ CIRCULAR_DEPENDENCY: `CIRCULAR_DEPENDENCY`,
13
+ };
14
+ export const VitePlugin = (polenConfigInput) => {
15
+ const polenConfig = Configurator.normalizeInput(polenConfigInput);
16
+ const debug = true;
17
+ return [
18
+ HonoDevServer({
19
+ entry: polenConfig.paths.appTemplate.entryServer,
20
+ adapter: HonoDevServerNodeAdapter,
21
+ }),
22
+ ReactVite(),
23
+ {
24
+ name: `polen-virtual-graphql-schema`,
25
+ ...Vite.VirtualIdentifier.toHooks(virtualIdentifierAssetGraphqlSchema, async () => {
26
+ const schema = await Fs.readFile(polenConfig.schema.path, `utf-8`);
27
+ const moduleContent = `export default ${JSON.stringify(schema)}`;
28
+ return moduleContent;
29
+ }),
30
+ },
31
+ {
32
+ name: `polen-build-client`,
33
+ apply: `build`,
34
+ applyToEnvironment: Vite.isEnvironmentClient,
35
+ // HACK: For some reason the ?url import doesn't lead to a rewrite in the build.
36
+ // Furthermore we need to rely on the manifest to get its final name because it is
37
+ // generated by the client build before the server build.
38
+ // However, we still need the asset in development.
39
+ // But we cannot exclude the import in build.
40
+ // So this does that for us but it is really hacky.
41
+ // FIXME
42
+ // 1. Raise issue about having ?url lead to expected build path rewrite?
43
+ // 2. And: Move asset generation to server build?
44
+ // 3. And/or: Use Vite Environments API?
45
+ generateBundle(_, bundle, isWrite) {
46
+ if (isWrite) {
47
+ for (const chunkOrAsset of Object.values(bundle)) {
48
+ if (chunkOrAsset.type === `asset` && chunkOrAsset.names.includes(`entry.client.jsx`)) {
49
+ // eslint-disable-next-line
50
+ delete bundle[chunkOrAsset.fileName];
51
+ }
52
+ }
53
+ }
54
+ },
55
+ onLog(level, message) {
56
+ if (level === `warn` && message.code === codes.MODULE_LEVEL_DIRECTIVE &&
57
+ message.id?.includes(`@radix-ui`))
58
+ return;
59
+ },
60
+ config() {
61
+ return {
62
+ environments: {
63
+ client: {
64
+ build: {
65
+ minify: !debug,
66
+ manifest: true,
67
+ rollupOptions: {
68
+ input: [polenConfig.paths.appTemplate.entryClient],
69
+ },
70
+ },
71
+ },
72
+ },
73
+ };
74
+ },
75
+ },
76
+ Build({
77
+ entryServerPath: polenConfig.paths.appTemplate.entryServer,
78
+ debug: debug,
79
+ }),
80
+ ];
81
+ };
@@ -0,0 +1,5 @@
1
+ import { Vite } from '../lib/vite/_namespace.js';
2
+ export declare const Build: (parameters: {
3
+ entryServerPath: string;
4
+ debug?: boolean;
5
+ }) => Vite.Plugin[];
@@ -0,0 +1,144 @@
1
+ import { CodeBuilder } from '../lib/code-builder/_namespace.js';
2
+ import { Fs } from '../lib/fs/_namespace.js';
3
+ import { Path } from '../lib/path/_namespace.js';
4
+ import { Vite } from '../lib/vite/_namespace.js';
5
+ import { virtualIdentifier } from './helpers.js';
6
+ import { defu } from 'defu';
7
+ const viServerEntry = virtualIdentifier([`server`, `entry`]);
8
+ export const Build = (parameters) => {
9
+ const config = defu(parameters, { debug: false });
10
+ let viteConfigResolved;
11
+ return [Manifest(), {
12
+ name: `polen-ssr-build`,
13
+ apply: `build`,
14
+ applyToEnvironment: Vite.isEnvironmentSsr,
15
+ configResolved(config) {
16
+ viteConfigResolved = config;
17
+ },
18
+ ...Vite.VirtualIdentifier.toHooks$FromMap(new Map([
19
+ [viServerEntry, () => {
20
+ const serverPort = viteConfigResolved.server.port + 1;
21
+ const entryServerPath = Path.absolutify(config.entryServerPath, viteConfigResolved.root);
22
+ const entrServeryViteGlobPath = `/` +
23
+ Path.relative(viteConfigResolved.root, entryServerPath);
24
+ const staticServingPaths = {
25
+ // todo
26
+ // relative from CWD of process that boots node server
27
+ // can easily break! Use path relative in server??
28
+ dirPath: `./dist`,
29
+ routePath: `/${viteConfigResolved.build.assetsDir}/*`,
30
+ };
31
+ const code = CodeBuilder.create();
32
+ const _ = {
33
+ app: `app`,
34
+ entry: `entry`,
35
+ entries: `entries`,
36
+ };
37
+ code(`import { Hono } from 'hono'`);
38
+ code(``);
39
+ code(`const ${_.app} = new Hono()`);
40
+ code(``);
41
+ code(``);
42
+ code(`// Static Files`);
43
+ code(``);
44
+ code(`import { serveStatic } from '@hono/node-server/serve-static'`);
45
+ code(``);
46
+ code(`${_.app}.use(
47
+ '${staticServingPaths.routePath}',
48
+ serveStatic({ root: '${staticServingPaths.dirPath}' })
49
+ )`);
50
+ code(``);
51
+ code(``);
52
+ code(`// Entries`);
53
+ code(``);
54
+ code(`const ${_.entries} = import.meta.glob(
55
+ ['${entrServeryViteGlobPath}'],
56
+ { import: 'default', eager: true }
57
+ )`);
58
+ code(``);
59
+ code(`/** @see https://github.com/honojs/hono/issues/4051 */`);
60
+ code(`const delegate = (app1, method, path, app2) => {
61
+ app1.on(method, path, (c) => {
62
+ // Throws if executionCtx is not available
63
+ // https://hono.dev/docs/api/context#executionctx
64
+ let maybeExecutionContext
65
+ try { maybeExecutionContext = c.executionCtx }
66
+ catch {}
67
+ return app2.fetch(c.req.raw, c.env, maybeExecutionContext)
68
+ })
69
+ }`);
70
+ code(`for (const ${_.entry} of Object.values(${_.entries})) {
71
+ delegate(${_.app}, 'all', '*', ${_.entry})
72
+ }`);
73
+ code(``);
74
+ code(``);
75
+ code(`// Start Server`);
76
+ code(``);
77
+ code(`import { serve } from '@hono/node-server'`);
78
+ code(`serve({ fetch: ${_.app}.fetch, port: ${serverPort.toString()} })`);
79
+ return code.render();
80
+ }],
81
+ ])),
82
+ config() {
83
+ return {
84
+ environments: {
85
+ ssr: {
86
+ build: {
87
+ emptyOutDir: false,
88
+ minify: !config.debug,
89
+ rollupOptions: {
90
+ input: viServerEntry.id,
91
+ },
92
+ },
93
+ },
94
+ },
95
+ };
96
+ },
97
+ // generateBundle(_, bundle, isWrite) {
98
+ // if (isWrite) {
99
+ // for (const chunkOrAsset of Object.values(bundle)) {
100
+ // console.log(chunkOrAsset)
101
+ // if (chunkOrAsset.type === `chunk`) {
102
+ // if (chunkOrAsset.facadeModuleId === viClientManifest.resolved) {
103
+ // // eslint-disable-next-line
104
+ // delete bundle[chunkOrAsset.fileName]
105
+ // }
106
+ // }
107
+ // }
108
+ // }
109
+ // },
110
+ async closeBundle() {
111
+ /**
112
+ * clean up the manifest. Was generated by client. For server build. Not needed after (unless debugging).
113
+ */
114
+ if (!config.debug) {
115
+ await Fs.rmDirIfExists(Path.join(viteConfigResolved.root, viteConfigResolved.build.outDir, `.vite`));
116
+ }
117
+ },
118
+ }];
119
+ };
120
+ const viClientManifest = virtualIdentifier([`vite`, `client`, `manifest`]);
121
+ const Manifest = () => {
122
+ let configEnv;
123
+ let viteConfigResolved;
124
+ return {
125
+ name: `polen-manifest`,
126
+ config(_, configEnv_) {
127
+ configEnv = configEnv_;
128
+ },
129
+ configResolved(config) {
130
+ viteConfigResolved = config;
131
+ },
132
+ ...Vite.VirtualIdentifier.toHooks$FromMap(new Map([
133
+ [viClientManifest, async () => {
134
+ // In development or client build just return an empty manifest
135
+ if (configEnv.mode === Vite.ModeName.dev) {
136
+ return `export default {}`;
137
+ }
138
+ const manifestPath = Path.join(viteConfigResolved.root, viteConfigResolved.build.outDir, `.vite`, `manifest.json`);
139
+ const module = await import(manifestPath, { with: { type: `json` } });
140
+ return `export default ${JSON.stringify(module.default)}`;
141
+ }],
142
+ ])),
143
+ };
144
+ };
@@ -0,0 +1 @@
1
+ export * as Configurator from './main.js';
@@ -0,0 +1 @@
1
+ export * as Configurator from './main.js';
@@ -0,0 +1,35 @@
1
+ export interface ConfigInput {
2
+ /**
3
+ * Path to the GraphQL schema file
4
+ */
5
+ schemaPath?: string;
6
+ /**
7
+ * Whether to enable SSR
8
+ *
9
+ * @defaultValue true
10
+ */
11
+ ssr?: boolean;
12
+ }
13
+ export interface Config {
14
+ mode: string;
15
+ schema: {
16
+ path: string;
17
+ };
18
+ ssr: {
19
+ enabled: boolean;
20
+ };
21
+ aliases: {
22
+ entryServer: string;
23
+ };
24
+ paths: {
25
+ workspaceDir: string;
26
+ appTemplate: {
27
+ dir: string;
28
+ entryClient: string;
29
+ entryServer: string;
30
+ };
31
+ outDir: string;
32
+ outViteDir: string;
33
+ };
34
+ }
35
+ export declare const normalizeInput: (configInput?: ConfigInput) => Config;
@@ -0,0 +1,36 @@
1
+ import { Path } from '../../lib/path/_namespace.js';
2
+ const pathAppTemplateDir = Path.join(import.meta.dirname, `../../app-template`);
3
+ const workspaceDir = process.cwd();
4
+ const outDir = Path.join(workspaceDir, `dist`);
5
+ const configInputDefaults = {
6
+ mode: `client`,
7
+ schema: {
8
+ path: Path.join(workspaceDir, `schema.graphql`),
9
+ },
10
+ ssr: {
11
+ enabled: true,
12
+ },
13
+ aliases: {
14
+ entryServer: `#polen/server/entry`,
15
+ },
16
+ paths: {
17
+ appTemplate: {
18
+ dir: pathAppTemplateDir,
19
+ entryServer: Path.join(pathAppTemplateDir, `entry.server.jsx`),
20
+ entryClient: Path.join(pathAppTemplateDir, `entry.client.jsx`),
21
+ },
22
+ workspaceDir,
23
+ outDir: Path.join(workspaceDir, `build`),
24
+ outViteDir: Path.join(outDir),
25
+ },
26
+ };
27
+ export const normalizeInput = (configInput) => {
28
+ const config = structuredClone(configInputDefaults);
29
+ if (configInput?.ssr !== undefined) {
30
+ config.ssr.enabled = configInput.ssr;
31
+ }
32
+ if (configInput?.schemaPath !== undefined) {
33
+ config.schema.path = Path.absolutify(configInput.schemaPath, config.paths.workspaceDir);
34
+ }
35
+ return config;
36
+ };
@@ -0,0 +1,2 @@
1
+ import { Vite } from '../lib/vite/_namespace.js';
2
+ export declare const virtualIdentifier: (idOrIdSegments: string | string[]) => Vite.VirtualIdentifier.VirtualIdentifier;
@@ -0,0 +1,2 @@
1
+ import { Vite } from '../lib/vite/_namespace.js';
2
+ export const virtualIdentifier = Vite.VirtualIdentifier.createNamespaceFactory(`polen`);
@@ -0,0 +1,2 @@
1
+ import serverEntryHandler from '#pollen/server/entry';
2
+ export default serverEntryHandler;
@@ -0,0 +1,3 @@
1
+ // @ts-expect-error
2
+ import serverEntryHandler from '#pollen/server/entry';
3
+ export default serverEntryHandler;
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "polen",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./build/_namespace.js",
7
+ "./exports": "./build/_exports.js"
8
+ },
9
+ "files": [
10
+ "build"
11
+ ],
12
+ "dependencies": {
13
+ "@hono/node-server": "^1.14.0",
14
+ "@hono/vite-build": "^1.5.0",
15
+ "@hono/vite-dev-server": "^0.19.0",
16
+ "@radix-ui/themes": "^3.2.1",
17
+ "consola": "^3.4.2",
18
+ "defu": "^6.1.4",
19
+ "es-toolkit": "^1.34.1",
20
+ "fuse.js": "^7.1.0",
21
+ "get-port-please": "^3.1.2",
22
+ "graphql": "^16.10.0",
23
+ "hono": "^4.7.5",
24
+ "marked": "^15.0.7",
25
+ "react": "^19.1.0",
26
+ "react-dom": "^19.1.0",
27
+ "react-helmet-async": "^2.0.5",
28
+ "react-markdown": "^10.1.0",
29
+ "react-router": "^7.5.0",
30
+ "rollup": "^4.39.0",
31
+ "tsx": "^4.19.3",
32
+ "zod": "^3.24.2"
33
+ },
34
+ "devDependencies": {
35
+ "@changesets/cli": "^2.28.1",
36
+ "@eslint/js": "^9.24.0",
37
+ "@stylistic/eslint-plugin": "^4.2.0",
38
+ "@tsconfig/strictest": "^2.0.5",
39
+ "@types/node": "^22.14.0",
40
+ "@types/react": "^19.1.0",
41
+ "@types/react-dom": "^19.1.1",
42
+ "@typescript-eslint/eslint-plugin": "^8.29.0",
43
+ "@typescript-eslint/parser": "^8.29.0",
44
+ "@vitejs/plugin-react": "^4.3.4",
45
+ "eslint": "^9.24.0",
46
+ "eslint-plugin-deprecation": "^3.0.0",
47
+ "eslint-plugin-only-warn": "^1.1.0",
48
+ "eslint-plugin-react-hooks": "^5.2.0",
49
+ "eslint-plugin-react-refresh": "^0.4.19",
50
+ "eslint-plugin-tsdoc": "^0.4.0",
51
+ "eslint-plugin-unused-imports": "^4.1.4",
52
+ "globals": "^16.0.0",
53
+ "publint": "^0.3.10",
54
+ "typescript": "^5.8.3",
55
+ "typescript-eslint": "^8.29.0",
56
+ "vite": "^6.2.5",
57
+ "vite-tsconfig-paths": "^5.1.4",
58
+ "vitest": "^3.1.1"
59
+ },
60
+ "peerDependencies": {
61
+ "vite": "^6.2.5"
62
+ },
63
+ "scripts": {
64
+ "build": "tsc",
65
+ "build:watch": "tsc --watch",
66
+ "build:watch:emit": "tsc --watch --nocheck",
67
+ "build:emit": "tsc --noCheck",
68
+ "fix": "pnpm fix:lint && pnpm fix:format",
69
+ "fix:lint": "eslint . --fix",
70
+ "fix:format": "dprint fmt",
71
+ "check": "pnpm check:format && pnpm check:lint && pnpm check:types && pnpm check:publint",
72
+ "check:format": "dprint check",
73
+ "check:lint": "eslint . --max-warnings 0",
74
+ "check:types": "tsc --noEmit",
75
+ "check:publint": "publint run --strict"
76
+ }
77
+ }