@kosmojs/dev 0.0.10 → 0.0.20

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 (193) hide show
  1. package/package.json +9 -42
  2. package/pkg/base-plugin/worker.js +252 -102
  3. package/pkg/base-plugin/worker.js.map +4 -4
  4. package/pkg/index.js +540 -206
  5. package/pkg/index.js.map +4 -4
  6. package/pkg/src/{base-plugin/ast.d.ts → ast.d.ts} +3 -3
  7. package/pkg/src/base-plugin/api-handler.d.ts +1 -1
  8. package/pkg/src/base-plugin/index.d.ts +1 -1
  9. package/pkg/src/base-plugin/worker.d.ts +1 -1
  10. package/pkg/src/{base-plugin/cache.d.ts → cache.d.ts} +2 -2
  11. package/pkg/src/defaults.d.ts +13 -0
  12. package/pkg/src/fs.d.ts +1 -0
  13. package/pkg/src/index.d.ts +6 -3
  14. package/pkg/src/paths.d.ts +13 -0
  15. package/pkg/src/render.d.ts +28 -0
  16. package/pkg/src/routes-factory/base.d.ts +17 -0
  17. package/pkg/src/routes-factory/index.d.ts +8 -0
  18. package/pkg/src/routes-factory/nesting.d.ts +3 -0
  19. package/pkg/src/{base-plugin/routes → routes-factory}/resolve.d.ts +3 -3
  20. package/pkg/src/stub-generator/index.d.ts +1 -1
  21. package/pkg/src/typebox.d.ts +2 -0
  22. package/pkg/src/types.d.ts +288 -0
  23. package/pkg/stub-generator/index.js +166 -24
  24. package/pkg/stub-generator/index.js.map +4 -4
  25. package/pkg/test/routes/{base.d.ts → index.d.ts} +2 -2
  26. package/pkg/base-plugin/routes.js +0 -819
  27. package/pkg/base-plugin/routes.js.map +0 -7
  28. package/pkg/cli/cli.js +0 -582
  29. package/pkg/cli/cli.js.map +0 -7
  30. package/pkg/cli/index.js +0 -422
  31. package/pkg/cli/index.js.map +0 -7
  32. package/pkg/cli/templates/.env +0 -1
  33. package/pkg/cli/templates/@src/api/app.hbs +0 -32
  34. package/pkg/cli/templates/@src/api/router.hbs +0 -11
  35. package/pkg/cli/templates/@src/api/server.hbs +0 -4
  36. package/pkg/cli/templates/@src/api/use.hbs +0 -6
  37. package/pkg/cli/templates/@src/config/index.hbs +0 -2
  38. package/pkg/cli/templates/@src/index.html +0 -4
  39. package/pkg/cli/templates/@src/vite.config.hbs +0 -29
  40. package/pkg/cli/templates/core/api/app.ts +0 -6
  41. package/pkg/cli/templates/core/api/env.d.ts +0 -4
  42. package/pkg/cli/templates/core/api/router.ts +0 -6
  43. package/pkg/cli/templates/core/api/server.ts +0 -49
  44. package/pkg/cli/templates/core/api/use.ts +0 -21
  45. package/pkg/cli/templates/vite.base.hbs +0 -44
  46. package/pkg/src/base-plugin/routes/nesting.d.ts +0 -5
  47. package/pkg/src/base-plugin/routes.d.ts +0 -9
  48. package/pkg/src/cli/base.d.ts +0 -30
  49. package/pkg/src/cli/cli.d.ts +0 -2
  50. package/pkg/src/cli/factory.d.ts +0 -12
  51. package/pkg/src/cli/index.d.ts +0 -2
  52. package/pkg/src/cli/templates/core/api/app.d.ts +0 -3
  53. package/pkg/src/cli/templates/core/api/router.d.ts +0 -3
  54. package/pkg/src/cli/templates/core/api/server.d.ts +0 -3
  55. package/pkg/src/cli/templates/core/api/use.d.ts +0 -2
  56. package/pkg/test/setup.d.ts +0 -1
  57. /package/pkg/test/@fixtures/app/{@src → src/test}/api/articles/[...path]/index.d.ts +0 -0
  58. /package/pkg/test/@fixtures/app/{@src → src/test}/api/books/[category]/[[author]]/index.d.ts +0 -0
  59. /package/pkg/test/@fixtures/app/{@src → src/test}/api/books/[category]/index.d.ts +0 -0
  60. /package/pkg/test/@fixtures/app/{@src → src/test}/api/books/index.d.ts +0 -0
  61. /package/pkg/test/@fixtures/app/{@src → src/test}/api/files/[[folder]]/[[id]].json/index.d.ts +0 -0
  62. /package/pkg/test/@fixtures/app/{@src → src/test}/api/files/[[folder]]/index.d.ts +0 -0
  63. /package/pkg/test/@fixtures/app/{@src → src/test}/api/index/index.d.ts +0 -0
  64. /package/pkg/test/@fixtures/app/{@src → src/test}/api/pages/[...path].html/index.d.ts +0 -0
  65. /package/pkg/test/@fixtures/app/{@src → src/test}/api/users/[id].json/index.d.ts +0 -0
  66. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/about/careers/[jobId]/index.d.ts +0 -0
  67. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/about/careers/layout.d.ts +0 -0
  68. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/about/index.d.ts +0 -0
  69. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/about/layout.d.ts +0 -0
  70. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/about/team/index.d.ts +0 -0
  71. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/account/layout.d.ts +0 -0
  72. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/account/profile/index.d.ts +0 -0
  73. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/index.d.ts +0 -0
  74. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/resources/[[type]]/[...path]/index.d.ts +0 -0
  75. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/resources/[[type]]/index.d.ts +0 -0
  76. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/resources/[[type]]/layout.d.ts +0 -0
  77. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/resources/index.d.ts +0 -0
  78. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/resources/layout.d.ts +0 -0
  79. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/settings/general/index.d.ts +0 -0
  80. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/settings/index.d.ts +0 -0
  81. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/settings/layout.d.ts +0 -0
  82. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/settings/permissions/index.d.ts +0 -0
  83. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/users/[userId]/index.d.ts +0 -0
  84. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/users/index.d.ts +0 -0
  85. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/[tenant]/users/layout.d.ts +0 -0
  86. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/index.d.ts +0 -0
  87. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/admin/layout.d.ts +0 -0
  88. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/[[category]]/[[tag]]/index.d.ts +0 -0
  89. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/[[category]]/index.d.ts +0 -0
  90. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/index.d.ts +0 -0
  91. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/layout.d.ts +0 -0
  92. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/post/[slug]/index.d.ts +0 -0
  93. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/blog/post/[slug]/layout.d.ts +0 -0
  94. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/contact/index.d.ts +0 -0
  95. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/contact/layout.d.ts +0 -0
  96. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/courses/[courseId]/layout.d.ts +0 -0
  97. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/courses/[courseId]/lessons/[[lessonId]]/assignments/[...assignmentPath]/index.d.ts +0 -0
  98. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/[view]/index.d.ts +0 -0
  99. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/analytics/index.d.ts +0 -0
  100. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/index.d.ts +0 -0
  101. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/layout.d.ts +0 -0
  102. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/billing/index.d.ts +0 -0
  103. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/index.d.ts +0 -0
  104. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/layout.d.ts +0 -0
  105. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/notifications/index.d.ts +0 -0
  106. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/profile/index.d.ts +0 -0
  107. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/security/index.d.ts +0 -0
  108. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/dashboard/settings/security/layout.d.ts +0 -0
  109. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/docs/[...path]/index.d.ts +0 -0
  110. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/docs/index.d.ts +0 -0
  111. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/docs/layout.d.ts +0 -0
  112. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/files/[...filePath]/index.d.ts +0 -0
  113. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/files/[...filePath]/layout.d.ts +0 -0
  114. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/legal/layout.d.ts +0 -0
  115. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/legal/privacy/index.d.ts +0 -0
  116. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/legal/terms/index.d.ts +0 -0
  117. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/news/[category]/articles/[...articlePath]/index.d.ts +0 -0
  118. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/news/[category]/layout.d.ts +0 -0
  119. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/[clientId]/layout.d.ts +0 -0
  120. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/[clientId]/reports/[reportType]/data/[dataView]/index.d.ts +0 -0
  121. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/[clientId]/reports/[reportType]/data/[dataView]/layout.d.ts +0 -0
  122. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/[clientId]/reports/[reportType]/layout.d.ts +0 -0
  123. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/[clientId]/reports/layout.d.ts +0 -0
  124. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/portal/layout.d.ts +0 -0
  125. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/products/[id]/index.d.ts +0 -0
  126. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/products/index.d.ts +0 -0
  127. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/profile/[username]/layout.d.ts +0 -0
  128. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/profile/[username]/posts/[postId]/comments/[...thread]/index.d.ts +0 -0
  129. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/profile/[username]/posts/[postId]/layout.d.ts +0 -0
  130. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/files/[...path]/index.d.ts +0 -0
  131. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/files/index.d.ts +0 -0
  132. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/files/layout.d.ts +0 -0
  133. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/index.d.ts +0 -0
  134. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/layout.d.ts +0 -0
  135. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/[taskId]/comments/[commentId]/index.d.ts +0 -0
  136. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/[taskId]/comments/index.d.ts +0 -0
  137. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/[taskId]/comments/layout.d.ts +0 -0
  138. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/[taskId]/index.d.ts +0 -0
  139. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/[taskId]/layout.d.ts +0 -0
  140. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/index.d.ts +0 -0
  141. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/tasks/layout.d.ts +0 -0
  142. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/team/[userId]/index.d.ts +0 -0
  143. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/team/index.d.ts +0 -0
  144. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/[projectId]/team/layout.d.ts +0 -0
  145. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/index.d.ts +0 -0
  146. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/projects/layout.d.ts +0 -0
  147. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/properties/[[city]]/filters/[...filters]/index.d.ts +0 -0
  148. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/properties/filters/index.d.ts +0 -0
  149. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/properties/layout.d.ts +0 -0
  150. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/search/[[query]]/[[page]]/index.d.ts +0 -0
  151. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/search/[[query]]/layout.d.ts +0 -0
  152. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/search/index.d.ts +0 -0
  153. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/[category]/[productId]/index.d.ts +0 -0
  154. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/[category]/[productId]/layout.d.ts +0 -0
  155. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/cart/index.d.ts +0 -0
  156. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/checkout/confirm/index.d.ts +0 -0
  157. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/checkout/layout.d.ts +0 -0
  158. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/checkout/payment/index.d.ts +0 -0
  159. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/checkout/shipping/index.d.ts +0 -0
  160. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/checkout/shipping/layout.d.ts +0 -0
  161. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/index.d.ts +0 -0
  162. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/layout.d.ts +0 -0
  163. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/orders/[orderId]/index.d.ts +0 -0
  164. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/orders/index.d.ts +0 -0
  165. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/orders/layout.d.ts +0 -0
  166. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/product/[id]/index.d.ts +0 -0
  167. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/product/[id]/layout.d.ts +0 -0
  168. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/product/[id]/reviews/index.d.ts +0 -0
  169. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/products/[[category]]/index.d.ts +0 -0
  170. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/products/index.d.ts +0 -0
  171. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/shop/products/layout.d.ts +0 -0
  172. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/signup/index.d.ts +0 -0
  173. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/store/[category]/filters/[...filters]/index.d.ts +0 -0
  174. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/store/[category]/sort/[sortBy]/index.d.ts +0 -0
  175. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/store/[category]/sort/layout.d.ts +0 -0
  176. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/store/layout.d.ts +0 -0
  177. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/followers/index.d.ts +0 -0
  178. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/following/index.d.ts +0 -0
  179. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/index.d.ts +0 -0
  180. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/layout.d.ts +0 -0
  181. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/posts/[postId]/index.d.ts +0 -0
  182. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/posts/[postId]/layout.d.ts +0 -0
  183. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/posts/index.d.ts +0 -0
  184. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/[username]/posts/layout.d.ts +0 -0
  185. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/index.d.ts +0 -0
  186. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/users/layout.d.ts +0 -0
  187. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/analytics/[range]/index.d.ts +0 -0
  188. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/analytics/[range]/layout.d.ts +0 -0
  189. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/analytics/index.d.ts +0 -0
  190. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/analytics/layout.d.ts +0 -0
  191. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/team/[memberId]/permissions/[...permissionPath]/index.d.ts +0 -0
  192. /package/pkg/test/@fixtures/app/{@src → src/test}/pages/workspace/[workspaceId]/team/layout.d.ts +0 -0
  193. /package/pkg/test/{cli/create.test.d.ts → routes/routes.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { type PluginOptionsResolved, type ResolvedEntry, type RouteEntry } from "@kosmojs/devlib";
1
+ import type { PluginOptionsResolved, ResolvedEntry, RouteEntry } from "../types";
2
2
  export type ResolverSignature = {
3
3
  name: string;
4
4
  handler: (updatedFile?: string) => Promise<ResolvedEntry>;
@@ -12,12 +12,12 @@ export declare const PAGE_INDEX_PATTERN = "index.{tsx,vue}";
12
12
  export declare const PAGE_LAYOUT_BASENAME = "layout";
13
13
  export declare const PAGE_LAYOUT_PATTERN = "layout.{tsx,vue}";
14
14
  export declare const scanRoutes: ({ appRoot, sourceFolder, }: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">) => Promise<string[]>;
15
- export declare const isRouteFile: (file: string, { appRoot, sourceFolder, }: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">) => [folder: string, file: string] | undefined;
15
+ export declare const isRouteFile: (file: string, { appRoot, sourceFolder, }: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">) => [folder: string, file: string] | false;
16
16
  export declare const isApiRoute: (file: string) => boolean;
17
17
  export declare const isApiUse: (file: string) => boolean;
18
18
  export declare const isPageRoute: (file: string) => boolean;
19
19
  export declare const isPageLayout: (file: string) => boolean;
20
- export declare const createRouteEntry: (_file: string, { appRoot, sourceFolder, }: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">) => RouteEntry | undefined;
20
+ export declare const createRouteEntry: (fileFullpath: string, { appRoot, sourceFolder, }: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">) => RouteEntry | undefined;
21
21
  type ResolverFactory = (pluginOptions: PluginOptionsResolved) => (entry: RouteEntry) => ResolverSignature;
22
22
  export declare const pageLayoutResolverFactory: ResolverFactory;
23
23
  export declare const pageRouteResolverFactory: ResolverFactory;
@@ -1,4 +1,4 @@
1
- import { type GeneratorConstructor } from "@kosmojs/devlib";
1
+ import type { GeneratorConstructor } from "../types";
2
2
  /**
3
3
  * Generates stub files required by various generators.
4
4
  * Ensures cross-generator dependencies remain resolvable
@@ -0,0 +1,2 @@
1
+ import type { PluginOptionsResolved } from "./types";
2
+ export declare const typeboxLiteralText: (text: string, options: Pick<PluginOptionsResolved, "refineTypeName">) => string;
@@ -0,0 +1,288 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import type { ResolvedType } from "tfusion";
3
+ import type { ResolvedConfig } from "vite";
4
+ export type PluginOptions = {
5
+ generators?: Array<GeneratorConstructor>;
6
+ formatters?: Array<FormatterConstructor>;
7
+ /**
8
+ * Name to use for custom runtime validation refinements.
9
+ * @default "TRefine"
10
+ * */
11
+ refineTypeName?: string;
12
+ };
13
+ export type PluginOptionsResolved = {
14
+ baseurl: string;
15
+ apiurl: string;
16
+ appRoot: string;
17
+ sourceFolder: string;
18
+ outDir: string;
19
+ command: ResolvedConfig["command"];
20
+ generators: Array<GeneratorConstructor>;
21
+ formatters: Array<Formatter>;
22
+ refineTypeName: string;
23
+ watcher: {
24
+ delay: number;
25
+ options?: import("vite").WatchOptions;
26
+ };
27
+ } & Omit<PluginOptions, "generators" | "formatters" | "refineTypeName">;
28
+ export type PathToken = {
29
+ orig: string;
30
+ base: string;
31
+ path: string;
32
+ ext: string;
33
+ param?: {
34
+ name: string;
35
+ const: string;
36
+ isRequired?: boolean;
37
+ isOptional?: boolean;
38
+ isRest?: boolean;
39
+ };
40
+ };
41
+ /**
42
+ * route entry as found in file-system, before any processing
43
+ * */
44
+ export type RouteEntry = {
45
+ id: string;
46
+ name: string;
47
+ folder: string;
48
+ file: string;
49
+ fileFullpath: string;
50
+ pathTokens: Array<PathToken>;
51
+ };
52
+ export type NestedRouteEntry = {
53
+ index: Omit<RouteEntry, "fileFullpath"> | undefined;
54
+ layout: Omit<RouteEntry, "fileFullpath"> | undefined;
55
+ parent: string | undefined;
56
+ children: Array<NestedRouteEntry>;
57
+ };
58
+ export type ApiRoute = RouteEntry & {
59
+ params: {
60
+ id: string;
61
+ schema: Array<Required<PathToken>["param"]>;
62
+ resolvedType: ResolvedType | undefined;
63
+ };
64
+ numericParams: Array<string>;
65
+ optionalParams: boolean;
66
+ methods: Array<string>;
67
+ typeDeclarations: Array<TypeDeclaration>;
68
+ payloadTypes: Array<PayloadType>;
69
+ responseTypes: Array<ResponseType>;
70
+ referencedFiles: Array<string>;
71
+ };
72
+ export type ApiUse = RouteEntry;
73
+ export type PageRoute = RouteEntry & {
74
+ params: {
75
+ schema: Array<Required<PathToken>["param"]>;
76
+ };
77
+ };
78
+ export type PageLayout = RouteEntry;
79
+ export type ResolvedEntry = {
80
+ kind: "apiRoute";
81
+ entry: ApiRoute;
82
+ } | {
83
+ kind: "apiUse";
84
+ entry: ApiUse;
85
+ } | {
86
+ kind: "pageRoute";
87
+ entry: PageRoute;
88
+ } | {
89
+ kind: "pageLayout";
90
+ entry: PageLayout;
91
+ };
92
+ export type PayloadType = {
93
+ id: string;
94
+ responseTypeId?: string | undefined;
95
+ method: string;
96
+ skipValidation: boolean;
97
+ isOptional: boolean;
98
+ resolvedType: ResolvedType | undefined;
99
+ };
100
+ export type ResponseType = {
101
+ id: string;
102
+ method: string;
103
+ skipValidation: boolean;
104
+ resolvedType: ResolvedType | undefined;
105
+ };
106
+ export type TypeDeclaration = {
107
+ text: string;
108
+ importDeclaration?: {
109
+ name: string;
110
+ alias?: string | undefined;
111
+ path: string;
112
+ };
113
+ exportDeclaration?: {
114
+ name: string;
115
+ alias?: string | undefined;
116
+ path?: string | undefined;
117
+ };
118
+ typeAliasDeclaration?: {
119
+ name: string;
120
+ };
121
+ interfaceDeclaration?: {
122
+ name: string;
123
+ };
124
+ enumDeclaration?: {
125
+ name: string;
126
+ };
127
+ };
128
+ export type PathParams = {
129
+ text: string;
130
+ properties: Array<{
131
+ name: string;
132
+ type: string;
133
+ }>;
134
+ };
135
+ export type WatcherEvent = {
136
+ kind: "create" | "update" | "delete";
137
+ file: string;
138
+ };
139
+ export type WatchHandler = (entries: Array<ResolvedEntry>, event?: WatcherEvent) => Promise<void>;
140
+ type GeneratorFactoryReturn = {
141
+ watch: WatchHandler;
142
+ build: (entries: Array<ResolvedEntry>) => Promise<void>;
143
+ };
144
+ export type GeneratorFactory<T = undefined> = T extends undefined ? (options: PluginOptionsResolved) => Promise<GeneratorFactoryReturn> : (options: PluginOptionsResolved, extra: T) => Promise<GeneratorFactoryReturn>;
145
+ export type GeneratorConstructor = {
146
+ kind?: "api" | "fetch" | "ssr";
147
+ name: string;
148
+ /**
149
+ * Specifies the module import path and provided config for worker thread imports.
150
+ *
151
+ * In development mode, generators run inside a worker thread.
152
+ * Since functions cannot be directly passed to worker threads,
153
+ * this provides the module assets for the worker to dynamically import the generator.
154
+ * */
155
+ moduleImport: string;
156
+ moduleConfig: unknown;
157
+ factory: GeneratorFactory;
158
+ options?: {
159
+ /**
160
+ * Enables type resolution for generators that require fully resolved type information.
161
+ *
162
+ * When `true`, types are resolved to their flattened representations before
163
+ * generator execution, making complete type data available.
164
+ * */
165
+ resolveTypes?: boolean;
166
+ };
167
+ };
168
+ export type Formatter = (text: string, filePath: string) => string;
169
+ export type FormatterConstructor<ModuleConfig extends object | undefined = undefined> = {
170
+ moduleImport: string;
171
+ moduleConfig: ModuleConfig;
172
+ formatter: Formatter;
173
+ };
174
+ type RouterSetup<R> = {
175
+ clientRouter: () => R | Promise<R>;
176
+ serverRouter: (ssrOpts: {
177
+ url: URL;
178
+ }) => R | Promise<R>;
179
+ };
180
+ export type RouterFactory<AppT, RouteT, RouterT> = (factory: (app: AppT, routes: Array<RouteT>) => RouterSetup<RouterT> | Promise<RouterSetup<RouterT>>) => (app: AppT, routes: Array<RouteT>, ssrOpts?: {
181
+ url: URL;
182
+ }) => RouterT | Promise<RouterT>;
183
+ type RenderSetup = {
184
+ clientRender: () => void | Promise<void>;
185
+ serverRender: () => void | Promise<void>;
186
+ };
187
+ export type RenderFactory = (factory: () => RenderSetup | Promise<RenderSetup>) => void | Promise<void>;
188
+ /**
189
+ * Minimal shape of Vite's manifest.json entries.
190
+ * */
191
+ export type SSRManifestEntry = {
192
+ file: string;
193
+ src?: string;
194
+ isEntry?: boolean;
195
+ isDynamicEntry?: boolean;
196
+ css?: string[];
197
+ assets?: string[];
198
+ imports?: string[];
199
+ dynamicImports?: string[];
200
+ };
201
+ /**
202
+ * SSR environment options passed to user-defined
203
+ * renderToString / renderToStream functions.
204
+ * */
205
+ export type SSROptions = {
206
+ template: string;
207
+ manifest: Record<string, SSRManifestEntry>;
208
+ criticalCss: Array<{
209
+ text: string;
210
+ path: string;
211
+ }>;
212
+ request: IncomingMessage;
213
+ response: ServerResponse;
214
+ };
215
+ /**
216
+ * Return type for string-based SSR rendering.
217
+ *
218
+ * - `head` is optional, user may choose to:
219
+ * - insert the provided critical CSS (opt.criticalCss),
220
+ * - override it (e.g. remove some styles),
221
+ * - or supply additional <meta>/<link>/<style> tags.
222
+ *
223
+ * - `html` is the main server-rendered body markup for hydration.
224
+ * */
225
+ export type SSRStringReturn = {
226
+ head?: string;
227
+ html: string;
228
+ };
229
+ /**
230
+ * SSR string mode
231
+ *
232
+ * Returns head + html, synchronously or async.
233
+ *
234
+ * The server will:
235
+ * - insert returned `head` into the HTML template
236
+ * - place returned `html` into the body placeholder
237
+ * */
238
+ export type SSRString = (url: URL, opt: SSROptions) => SSRStringReturn | Promise<SSRStringReturn>;
239
+ /**
240
+ * SSR stream mode
241
+ *
242
+ * Writes directly to the HTTP response.
243
+ *
244
+ * Responsibility of the user/render function:
245
+ * - insert head + critical CSS at the correct time (before first flush)
246
+ * - manage partial flushing, suspense boundaries, etc.
247
+ *
248
+ * The server will NOT modify the response body in this mode,
249
+ * thus the renderer **must call `response.end()`** when streaming is finished,
250
+ * otherwise the HTTP request will remain open and the client will hang.
251
+ * */
252
+ export type SSRStream = (url: URL, opt: SSROptions) => void | Promise<void>;
253
+ /**
254
+ * Default exported object from the SSR entry module (e.g. entry/server.ts).
255
+ * */
256
+ export type SSRSetup = {
257
+ /**
258
+ * The server calls render functions with current request URL and SSROptions.
259
+ *
260
+ * If both are provided, `renderToStream` takes precedence since streaming
261
+ * enables earlier flushing and improved Time-to-First-Byte (TTFB).
262
+ * `renderToString` will only be used if a streaming renderer is not available.
263
+ * */
264
+ renderToString?: SSRString;
265
+ renderToStream?: SSRStream;
266
+ /**
267
+ * Controls whether the SSR server should handle static asset requests (JS, CSS, images, fonts, etc.)
268
+ *
269
+ * true (default)
270
+ * → All built client assets are served directly from memory by SSR server.
271
+ * → Easiest setup - no external file server required.
272
+ *
273
+ * false
274
+ * → A reverse proxy/CDN *must* serve all static files.
275
+ * → Otherwise any asset URL requested from browser (JS/CSS/img) will return `404`.
276
+ *
277
+ * Notes:
278
+ * - `criticalCss.text` can still be inlined regardless of this setting.
279
+ * - `criticalCss.url` remains provided for `<link>` usage,
280
+ * but loading that URL is the responsibility of the external static server.
281
+ *
282
+ * This option enables deployments where SSR and static delivery
283
+ * are cleanly separated (e.g., Node behind nginx / cloud static hosting).
284
+ * */
285
+ serveStaticAssets?: boolean;
286
+ };
287
+ export type SSRFactory = (factory: () => SSRSetup | Promise<SSRSetup>) => SSRSetup | Promise<SSRSetup>;
288
+ export {};
@@ -1,9 +1,149 @@
1
1
  // src/stub-generator/index.ts
2
- import { dirname } from "node:path";
3
- import {
4
- pathResolver,
5
- renderToFile
6
- } from "@kosmojs/devlib";
2
+ import { dirname as dirname2 } from "node:path";
3
+
4
+ // src/paths.ts
5
+ import { join } from "node:path";
6
+
7
+ // src/defaults.ts
8
+ var defaults = {
9
+ appPrefix: "~",
10
+ srcPrefix: "@",
11
+ libPrefix: "_",
12
+ coreDir: "core",
13
+ srcDir: "src",
14
+ libDir: "lib",
15
+ configDir: "config",
16
+ apiDir: "api",
17
+ pagesDir: "pages",
18
+ entryDir: "entry",
19
+ fetchDir: "fetch"
20
+ };
21
+
22
+ // src/paths.ts
23
+ var pathResolver = ({
24
+ appRoot,
25
+ sourceFolder
26
+ }) => {
27
+ const createPath = (...a) => {
28
+ return appRoot ? join(appRoot, ...a) : join(...a);
29
+ };
30
+ const createImport = {
31
+ coreApi(...a) {
32
+ return join(defaults.appPrefix, defaults.coreDir, defaults.apiDir, ...a);
33
+ },
34
+ src(...a) {
35
+ return join(defaults.srcPrefix, sourceFolder, ...a);
36
+ },
37
+ config(...a) {
38
+ return this.src(defaults.configDir, ...a);
39
+ },
40
+ api(...a) {
41
+ return this.src(defaults.apiDir, ...a);
42
+ },
43
+ pages(...a) {
44
+ return this.src(defaults.pagesDir, ...a);
45
+ },
46
+ lib(...a) {
47
+ return join(defaults.libPrefix, sourceFolder, ...a);
48
+ },
49
+ libApi(...a) {
50
+ return this.lib(defaults.apiDir, ...a);
51
+ },
52
+ libEntry(...a) {
53
+ return this.lib(defaults.entryDir, ...a);
54
+ },
55
+ fetch(...a) {
56
+ return this.lib(defaults.fetchDir, ...a);
57
+ }
58
+ };
59
+ return {
60
+ createPath: {
61
+ coreApi(...a) {
62
+ return createPath(defaults.coreDir, defaults.apiDir, ...a);
63
+ },
64
+ src(...a) {
65
+ return createPath(defaults.srcDir, sourceFolder, ...a);
66
+ },
67
+ api(...a) {
68
+ return this.src(defaults.apiDir, ...a);
69
+ },
70
+ pages(...a) {
71
+ return this.src(defaults.pagesDir, ...a);
72
+ },
73
+ config(...a) {
74
+ return this.src(defaults.configDir, ...a);
75
+ },
76
+ entry(...a) {
77
+ return this.src(defaults.entryDir, ...a);
78
+ },
79
+ lib(...a) {
80
+ return createPath(defaults.libDir, defaults.srcDir, sourceFolder, ...a);
81
+ },
82
+ libApi(...a) {
83
+ return this.lib(defaults.apiDir, ...a);
84
+ },
85
+ libEntry(...a) {
86
+ return this.lib(defaults.entryDir, ...a);
87
+ },
88
+ libPages(...a) {
89
+ return this.lib(defaults.pagesDir, ...a);
90
+ },
91
+ fetch(...a) {
92
+ return this.lib(defaults.fetchDir, ...a);
93
+ }
94
+ },
95
+ createImport,
96
+ createImportHelper: (key, ...a) => {
97
+ return createImport[key](...a.slice(0, -1));
98
+ }
99
+ };
100
+ };
101
+
102
+ // src/render.ts
103
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
104
+ import { dirname, join as join2 } from "node:path";
105
+ import crc from "crc/crc32";
106
+ import handlebars from "handlebars";
107
+
108
+ // src/fs.ts
109
+ import { access, constants } from "node:fs/promises";
110
+ var pathExists = async (path) => {
111
+ try {
112
+ await access(path, constants.F_OK);
113
+ return true;
114
+ } catch {
115
+ return false;
116
+ }
117
+ };
118
+
119
+ // src/render.ts
120
+ var render = (template, context, options) => {
121
+ const { noEscape = true, renderer = handlebars } = { ...options };
122
+ return renderer.compile(template, { noEscape })(context);
123
+ };
124
+ var renderAsFile = (file, template, context, options) => {
125
+ const { formatters, ...renderOpts } = { ...options };
126
+ const content = render(template, context, renderOpts);
127
+ return Array.isArray(formatters) ? formatters.reduce((c, f) => f(c, file), content) : content;
128
+ };
129
+ var renderToFile = async (file, template, context, options) => {
130
+ const content = renderAsFile(file, template, context, options);
131
+ if (await pathExists(file)) {
132
+ const { overwrite = true } = { ...options };
133
+ if (overwrite === false) {
134
+ return;
135
+ }
136
+ const fileContent = await readFile(file, "utf8");
137
+ if (typeof overwrite === "function" && !overwrite(fileContent)) {
138
+ return;
139
+ }
140
+ if (crc(content) === crc(fileContent)) {
141
+ return;
142
+ }
143
+ }
144
+ await mkdir(dirname(file), { recursive: true });
145
+ await writeFile(file, content, "utf8");
146
+ };
7
147
 
8
148
  // load-as-text:/volumes/studio/OpenSource/KosmoJS/Kosmo/packages/core/dev/src/stub-generator/templates/env.d.ts
9
149
  var env_d_default = '/**\n * Enhances base TypeScript types with JSON Schema validation constraints.\n * Allows declaring refined types that carry validation metadata for runtime\n * schema validation while maintaining full TypeScript type safety.\n *\n * Useful for generating validation schemas and ensuring\n * data conforms to specific business rules beyond basic type checking.\n * */\nexport declare global {\n type TRefine<\n T extends unknown[] | number | string | object,\n _ extends T extends unknown[]\n ? TArrayOptions\n : T extends number\n ? TNumberOptions\n : T extends string\n ? TStringOptions\n : TObjectOptions,\n > = T;\n}\n\n/**\n * Type definitions inspired by and gently adapted from TypeBox.\n * Original TypeBox created by sinclairzx81: https://github.com/sinclairzx81/typebox\n * TypeBox is licensed under MIT: https://github.com/sinclairzx81/typebox/blob/main/license\n *\n * These types provide JSON Schema compatible type refinements for TypeScript.\n * */\ninterface TSchema {}\n\n// ------------------------------------------------------------------\n// ObjectOptions\n// ------------------------------------------------------------------\ninterface TObjectOptions {\n /**\n * Defines whether additional properties are allowed beyond those explicitly defined in `properties`.\n */\n additionalProperties?: TSchema | boolean;\n /**\n * The minimum number of properties required in the object.\n */\n minProperties?: number;\n /**\n * The maximum number of properties allowed in the object.\n */\n maxProperties?: number;\n /**\n * Defines conditional requirements for properties.\n */\n dependencies?: Record<string, boolean | TSchema | string[]>;\n /**\n * Specifies properties that *must* be present if a given property is present.\n */\n dependentRequired?: Record<string, string[]>;\n /**\n * Defines schemas that apply if a specific property is present.\n */\n dependentSchemas?: Record<string, TSchema>;\n /**\n * Maps regular expressions to schemas properties matching a pattern must validate against the schema.\n */\n patternProperties?: Record<string, TSchema>;\n /**\n * A schema that all property names within the object must validate against.\n */\n propertyNames?: TSchema;\n}\n\n// ------------------------------------------------------------------\n// ArrayOptions\n// ------------------------------------------------------------------\ninterface TArrayOptions {\n /**\n * The minimum number of items allowed in the array.\n */\n minItems?: number;\n /**\n * The maximum number of items allowed in the array.\n */\n maxItems?: number;\n /**\n * A schema that at least one item in the array must validate against.\n */\n contains?: TSchema;\n /**\n * The minimum number of array items that must validate against the `contains` schema.\n */\n minContains?: number;\n /**\n * The maximum number of array items that may validate against the `contains` schema.\n */\n maxContains?: number;\n /**\n * An array of schemas, where each schema in `prefixItems` validates against items at corresponding positions from the beginning of the array.\n */\n prefixItems?: TSchema[];\n /**\n * If `true`, all items in the array must be unique.\n */\n uniqueItems?: boolean;\n}\n\n// ------------------------------------------------------------------\n// NumberOptions\n// ------------------------------------------------------------------\ninterface TNumberOptions {\n /**\n * Specifies an exclusive upper limit for the number (number must be less than this value).\n */\n exclusiveMaximum?: number | bigint;\n /**\n * Specifies an exclusive lower limit for the number (number must be greater than this value).\n */\n exclusiveMinimum?: number | bigint;\n /**\n * Specifies an inclusive upper limit for the number (number must be less than or equal to this value).\n */\n maximum?: number | bigint;\n /**\n * Specifies an inclusive lower limit for the number (number must be greater than or equal to this value).\n */\n minimum?: number | bigint;\n /**\n * Specifies that the number must be a multiple of this value.\n */\n multipleOf?: number | bigint;\n}\n\n// ------------------------------------------------------------------\n// StringOptions\n// ------------------------------------------------------------------\ntype TFormat =\n | "date-time"\n | "date"\n | "duration"\n | "email"\n | "hostname"\n | "idn-email"\n | "idn-hostname"\n | "ipv4"\n | "ipv6"\n | "iri-reference"\n | "iri"\n | "json-pointer-uri-fragment"\n | "json-pointer"\n | "json-string"\n | "regex"\n | "relative-json-pointer"\n | "time"\n | "uri-reference"\n | "uri-template"\n | "url"\n | "uuid";\n\ninterface TStringOptions {\n /**\n * Specifies the expected string format.\n *\n * Common values include:\n * - `base64` \u2013 Base64-encoded string.\n * - `date-time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time format.\n * - `date` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (YYYY-MM-DD).\n * - `duration` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format.\n * - `email` \u2013 RFC 5321/5322 compliant email address.\n * - `hostname` \u2013 RFC 1034/1035 compliant host name.\n * - `idn-email` \u2013 Internationalized email address.\n * - `idn-hostname` \u2013 Internationalized host name.\n * - `ipv4` \u2013 IPv4 address.\n * - `ipv6` \u2013 IPv6 address.\n * - `iri` / `iri-reference` \u2013 Internationalized Resource Identifier.\n * - `json-pointer` / `json-pointer-uri-fragment` \u2013 JSON Pointer format.\n * - `json-string` \u2013 String containing valid JSON.\n * - `regex` \u2013 Regular expression syntax.\n * - `relative-json-pointer` \u2013 Relative JSON Pointer format.\n * - `time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time (HH:MM:SS).\n * - `uri-reference` / `uri-template` \u2013 URI reference or template.\n * - `url` \u2013 Web URL format.\n * - `uuid` \u2013 RFC 4122 UUID string.\n *\n * May also be a custom format string.\n */\n format?: TFormat;\n /**\n * Specifies the minimum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n minLength?: number;\n /**\n * Specifies the maximum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n maxLength?: number;\n /**\n * Specifies a regular expression pattern that the string value must match.\n * Can be provided as a string (ECMA-262 regex syntax) or a `RegExp` object.\n */\n pattern?: string | RegExp;\n}\n';
@@ -21,28 +161,30 @@ var stub_generator_default = () => {
21
161
  moduleImport: import.meta.filename,
22
162
  moduleConfig: void 0,
23
163
  async factory({ appRoot, sourceFolder }) {
24
- return {
25
- async watchHandler(entries) {
26
- const { resolve } = pathResolver({ appRoot, sourceFolder });
27
- await renderToFile(resolve("libDir", "env.d.ts"), env_d_default, {});
28
- await renderToFile(
29
- resolve("libDir", ".gitignore"),
30
- gitignore_default,
31
- {},
32
- { overwrite: false }
33
- );
34
- for (const { kind, entry } of entries) {
35
- if (kind === "apiRoute") {
36
- await renderToFile(
37
- resolve("apiLibDir", dirname(entry.file), "schemas.ts"),
38
- schemas_default,
39
- { route: entry },
40
- { overwrite: false }
41
- );
42
- }
164
+ const generateLibFiles = async (entries) => {
165
+ const { createPath } = pathResolver({ appRoot, sourceFolder });
166
+ await renderToFile(createPath.lib("../env.d.ts"), env_d_default, {});
167
+ await renderToFile(
168
+ createPath.lib("../.gitignore"),
169
+ gitignore_default,
170
+ {},
171
+ { overwrite: false }
172
+ );
173
+ for (const { kind, entry } of entries) {
174
+ if (kind === "apiRoute") {
175
+ await renderToFile(
176
+ createPath.libApi(dirname2(entry.file), "schemas.ts"),
177
+ schemas_default,
178
+ { route: entry },
179
+ { overwrite: false }
180
+ );
43
181
  }
44
182
  }
45
183
  };
184
+ return {
185
+ watch: generateLibFiles,
186
+ build: generateLibFiles
187
+ };
46
188
  }
47
189
  };
48
190
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/stub-generator/index.ts", "load-as-text:/volumes/studio/OpenSource/KosmoJS/Kosmo/packages/core/dev/src/stub-generator/templates/env.d.ts", "../../src/stub-generator/templates/gitignore.hbs", "../../src/stub-generator/templates/schemas.hbs"],
4
- "sourcesContent": ["import { dirname } from \"node:path\";\n\nimport {\n type GeneratorConstructor,\n pathResolver,\n renderToFile,\n} from \"@kosmojs/devlib\";\n\nimport envTpl from \"./templates/env.d.ts?as=text\";\nimport gitignoreTpl from \"./templates/gitignore.hbs\";\nimport schemasTpl from \"./templates/schemas.hbs\";\n\n/**\n * Generates stub files required by various generators.\n * Ensures cross-generator dependencies remain resolvable\n * even if specialized generators supposed to generate these files are not installed.\n * */\nexport default (): GeneratorConstructor => {\n return {\n name: \"Stub\",\n moduleImport: import.meta.filename,\n moduleConfig: undefined,\n async factory({ appRoot, sourceFolder }) {\n return {\n async watchHandler(entries) {\n const { resolve } = pathResolver({ appRoot, sourceFolder });\n\n /**\n * expose TRefine as a global type.\n * not supposed to be overriden by generators.\n * */\n await renderToFile(resolve(\"libDir\", \"env.d.ts\"), envTpl, {});\n\n /**\n * deploy a default gitignore file that ignore everything,\n * except cache.json files; if file exists, do not override.\n * */\n await renderToFile(\n resolve(\"libDir\", \".gitignore\"),\n gitignoreTpl,\n {},\n { overwrite: false },\n );\n\n for (const { kind, entry } of entries) {\n if (kind === \"apiRoute\") {\n // Generating stub schemas file.\n // It is required by various generators, e.g. api-generator, fetch-generator.\n // Specialized generators (e.g. typebox-generator) may override this later.\n await renderToFile(\n resolve(\"apiLibDir\", dirname(entry.file), \"schemas.ts\"),\n schemasTpl,\n { route: entry },\n { overwrite: false },\n );\n }\n }\n },\n };\n },\n };\n};\n", "/**\n * Enhances base TypeScript types with JSON Schema validation constraints.\n * Allows declaring refined types that carry validation metadata for runtime\n * schema validation while maintaining full TypeScript type safety.\n *\n * Useful for generating validation schemas and ensuring\n * data conforms to specific business rules beyond basic type checking.\n * */\nexport declare global {\n type TRefine<\n T extends unknown[] | number | string | object,\n _ extends T extends unknown[]\n ? TArrayOptions\n : T extends number\n ? TNumberOptions\n : T extends string\n ? TStringOptions\n : TObjectOptions,\n > = T;\n}\n\n/**\n * Type definitions inspired by and gently adapted from TypeBox.\n * Original TypeBox created by sinclairzx81: https://github.com/sinclairzx81/typebox\n * TypeBox is licensed under MIT: https://github.com/sinclairzx81/typebox/blob/main/license\n *\n * These types provide JSON Schema compatible type refinements for TypeScript.\n * */\ninterface TSchema {}\n\n// ------------------------------------------------------------------\n// ObjectOptions\n// ------------------------------------------------------------------\ninterface TObjectOptions {\n /**\n * Defines whether additional properties are allowed beyond those explicitly defined in `properties`.\n */\n additionalProperties?: TSchema | boolean;\n /**\n * The minimum number of properties required in the object.\n */\n minProperties?: number;\n /**\n * The maximum number of properties allowed in the object.\n */\n maxProperties?: number;\n /**\n * Defines conditional requirements for properties.\n */\n dependencies?: Record<string, boolean | TSchema | string[]>;\n /**\n * Specifies properties that *must* be present if a given property is present.\n */\n dependentRequired?: Record<string, string[]>;\n /**\n * Defines schemas that apply if a specific property is present.\n */\n dependentSchemas?: Record<string, TSchema>;\n /**\n * Maps regular expressions to schemas properties matching a pattern must validate against the schema.\n */\n patternProperties?: Record<string, TSchema>;\n /**\n * A schema that all property names within the object must validate against.\n */\n propertyNames?: TSchema;\n}\n\n// ------------------------------------------------------------------\n// ArrayOptions\n// ------------------------------------------------------------------\ninterface TArrayOptions {\n /**\n * The minimum number of items allowed in the array.\n */\n minItems?: number;\n /**\n * The maximum number of items allowed in the array.\n */\n maxItems?: number;\n /**\n * A schema that at least one item in the array must validate against.\n */\n contains?: TSchema;\n /**\n * The minimum number of array items that must validate against the `contains` schema.\n */\n minContains?: number;\n /**\n * The maximum number of array items that may validate against the `contains` schema.\n */\n maxContains?: number;\n /**\n * An array of schemas, where each schema in `prefixItems` validates against items at corresponding positions from the beginning of the array.\n */\n prefixItems?: TSchema[];\n /**\n * If `true`, all items in the array must be unique.\n */\n uniqueItems?: boolean;\n}\n\n// ------------------------------------------------------------------\n// NumberOptions\n// ------------------------------------------------------------------\ninterface TNumberOptions {\n /**\n * Specifies an exclusive upper limit for the number (number must be less than this value).\n */\n exclusiveMaximum?: number | bigint;\n /**\n * Specifies an exclusive lower limit for the number (number must be greater than this value).\n */\n exclusiveMinimum?: number | bigint;\n /**\n * Specifies an inclusive upper limit for the number (number must be less than or equal to this value).\n */\n maximum?: number | bigint;\n /**\n * Specifies an inclusive lower limit for the number (number must be greater than or equal to this value).\n */\n minimum?: number | bigint;\n /**\n * Specifies that the number must be a multiple of this value.\n */\n multipleOf?: number | bigint;\n}\n\n// ------------------------------------------------------------------\n// StringOptions\n// ------------------------------------------------------------------\ntype TFormat =\n | \"date-time\"\n | \"date\"\n | \"duration\"\n | \"email\"\n | \"hostname\"\n | \"idn-email\"\n | \"idn-hostname\"\n | \"ipv4\"\n | \"ipv6\"\n | \"iri-reference\"\n | \"iri\"\n | \"json-pointer-uri-fragment\"\n | \"json-pointer\"\n | \"json-string\"\n | \"regex\"\n | \"relative-json-pointer\"\n | \"time\"\n | \"uri-reference\"\n | \"uri-template\"\n | \"url\"\n | \"uuid\";\n\ninterface TStringOptions {\n /**\n * Specifies the expected string format.\n *\n * Common values include:\n * - `base64` \u2013 Base64-encoded string.\n * - `date-time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time format.\n * - `date` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (YYYY-MM-DD).\n * - `duration` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format.\n * - `email` \u2013 RFC 5321/5322 compliant email address.\n * - `hostname` \u2013 RFC 1034/1035 compliant host name.\n * - `idn-email` \u2013 Internationalized email address.\n * - `idn-hostname` \u2013 Internationalized host name.\n * - `ipv4` \u2013 IPv4 address.\n * - `ipv6` \u2013 IPv6 address.\n * - `iri` / `iri-reference` \u2013 Internationalized Resource Identifier.\n * - `json-pointer` / `json-pointer-uri-fragment` \u2013 JSON Pointer format.\n * - `json-string` \u2013 String containing valid JSON.\n * - `regex` \u2013 Regular expression syntax.\n * - `relative-json-pointer` \u2013 Relative JSON Pointer format.\n * - `time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time (HH:MM:SS).\n * - `uri-reference` / `uri-template` \u2013 URI reference or template.\n * - `url` \u2013 Web URL format.\n * - `uuid` \u2013 RFC 4122 UUID string.\n *\n * May also be a custom format string.\n */\n format?: TFormat;\n /**\n * Specifies the minimum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n minLength?: number;\n /**\n * Specifies the maximum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n maxLength?: number;\n /**\n * Specifies a regular expression pattern that the string value must match.\n * Can be provided as a string (ECMA-262 regex syntax) or a `RegExp` object.\n */\n pattern?: string | RegExp;\n}\n", "# Ignore all files\n*\n\n# But don't ignore directories (so Git can traverse them)\n!*/\n\n# And don't ignore these files at any depth\n!cache.json\n!types.ts\n", "// stub schemas, specialized generators supposed to overwrite this file\nimport type { ValidationSchemas } from \"@kosmojs/api\";\nexport type { ValidationSchemas };\nexport const validationSchemas: ValidationSchemas = {};\n"],
5
- "mappings": ";AAAA,SAAS,eAAe;AAExB;AAAA,EAEE;AAAA,EACA;AAAA,OACK;;;ACNP;;;ACAA;;;ACAA;;;AHiBA,IAAO,yBAAQ,MAA4B;AACzC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,YAAY;AAAA,IAC1B,cAAc;AAAA,IACd,MAAM,QAAQ,EAAE,SAAS,aAAa,GAAG;AACvC,aAAO;AAAA,QACL,MAAM,aAAa,SAAS;AAC1B,gBAAM,EAAE,QAAQ,IAAI,aAAa,EAAE,SAAS,aAAa,CAAC;AAM1D,gBAAM,aAAa,QAAQ,UAAU,UAAU,GAAG,eAAQ,CAAC,CAAC;AAM5D,gBAAM;AAAA,YACJ,QAAQ,UAAU,YAAY;AAAA,YAC9B;AAAA,YACA,CAAC;AAAA,YACD,EAAE,WAAW,MAAM;AAAA,UACrB;AAEA,qBAAW,EAAE,MAAM,MAAM,KAAK,SAAS;AACrC,gBAAI,SAAS,YAAY;AAIvB,oBAAM;AAAA,gBACJ,QAAQ,aAAa,QAAQ,MAAM,IAAI,GAAG,YAAY;AAAA,gBACtD;AAAA,gBACA,EAAE,OAAO,MAAM;AAAA,gBACf,EAAE,WAAW,MAAM;AAAA,cACrB;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": []
3
+ "sources": ["../../src/stub-generator/index.ts", "../../src/paths.ts", "../../src/defaults.ts", "../../src/render.ts", "../../src/fs.ts", "load-as-text:/volumes/studio/OpenSource/KosmoJS/Kosmo/packages/core/dev/src/stub-generator/templates/env.d.ts", "../../src/stub-generator/templates/gitignore.hbs", "../../src/stub-generator/templates/schemas.hbs"],
4
+ "sourcesContent": ["import { dirname } from \"node:path\";\n\nimport { pathResolver } from \"@/paths\";\nimport { renderToFile } from \"@/render\";\nimport type { GeneratorConstructor, ResolvedEntry } from \"@/types\";\n\nimport envTpl from \"./templates/env.d.ts?as=text\";\nimport gitignoreTpl from \"./templates/gitignore.hbs\";\nimport schemasTpl from \"./templates/schemas.hbs\";\n\n/**\n * Generates stub files required by various generators.\n * Ensures cross-generator dependencies remain resolvable\n * even if specialized generators supposed to generate these files are not installed.\n * */\nexport default (): GeneratorConstructor => {\n return {\n name: \"Stub\",\n moduleImport: import.meta.filename,\n moduleConfig: undefined,\n async factory({ appRoot, sourceFolder }) {\n const generateLibFiles = async (entries: Array<ResolvedEntry>) => {\n const { createPath } = pathResolver({ appRoot, sourceFolder });\n\n /**\n * expose TRefine as a global type.\n * not supposed to be overriden by generators.\n * */\n await renderToFile(createPath.lib(\"../env.d.ts\"), envTpl, {});\n\n /**\n * deploy a default gitignore file that ignore everything,\n * except cache.json files; if file exists, do not override.\n * */\n await renderToFile(\n createPath.lib(\"../.gitignore\"),\n gitignoreTpl,\n {},\n { overwrite: false },\n );\n\n for (const { kind, entry } of entries) {\n if (kind === \"apiRoute\") {\n // Generating stub schemas file.\n // It is required by various generators, e.g. api-generator, fetch-generator.\n // Specialized generators (e.g. typebox-generator) may override this later.\n await renderToFile(\n createPath.libApi(dirname(entry.file), \"schemas.ts\"),\n schemasTpl,\n { route: entry },\n { overwrite: false },\n );\n }\n }\n };\n\n return {\n watch: generateLibFiles,\n build: generateLibFiles,\n };\n },\n };\n};\n", "import { join } from \"node:path\";\n\nimport { defaults } from \"./defaults\";\n\ntype CreateImport = Record<\n | \"coreApi\"\n | \"src\"\n | \"config\"\n | \"api\"\n | \"pages\"\n | \"fetch\"\n | \"lib\"\n | \"libApi\"\n | \"libEntry\",\n (...a: Array<string>) => string\n>;\n\nexport const createTsconfigPaths = (prefix: string) => {\n return {\n [`${defaults.appPrefix}/*`]: [`${prefix}/*`],\n [`${defaults.srcPrefix}/*`]: [`${prefix}/${defaults.srcDir}/*`],\n [`${defaults.libPrefix}/*`]: [\n `${prefix}/${defaults.libDir}/${defaults.srcDir}/*`,\n ],\n };\n};\n\nexport const pathResolver = ({\n appRoot,\n sourceFolder,\n}: {\n appRoot?: string;\n sourceFolder: string;\n}): {\n createPath: Record<\n | \"coreApi\"\n | \"src\"\n | \"config\"\n | \"api\"\n | \"pages\"\n | \"entry\"\n | \"fetch\"\n | \"lib\"\n | \"libApi\"\n | \"libEntry\"\n | \"libPages\",\n (...a: Array<string>) => string\n >;\n createImport: CreateImport;\n createImportHelper: (k: keyof CreateImport, ...a: Array<string>) => string;\n} => {\n const createPath = (...a: Array<string>) => {\n return appRoot ? join(appRoot, ...a) : join(...a);\n };\n\n const createImport: CreateImport = {\n coreApi(...a) {\n return join(defaults.appPrefix, defaults.coreDir, defaults.apiDir, ...a);\n },\n src(...a) {\n return join(defaults.srcPrefix, sourceFolder, ...a);\n },\n config(...a) {\n return this.src(defaults.configDir, ...a);\n },\n api(...a) {\n return this.src(defaults.apiDir, ...a);\n },\n pages(...a) {\n return this.src(defaults.pagesDir, ...a);\n },\n lib(...a) {\n return join(defaults.libPrefix, sourceFolder, ...a);\n },\n libApi(...a) {\n return this.lib(defaults.apiDir, ...a);\n },\n libEntry(...a) {\n return this.lib(defaults.entryDir, ...a);\n },\n fetch(...a) {\n return this.lib(defaults.fetchDir, ...a);\n },\n };\n\n return {\n createPath: {\n coreApi(...a) {\n return createPath(defaults.coreDir, defaults.apiDir, ...a);\n },\n src(...a) {\n return createPath(defaults.srcDir, sourceFolder, ...a);\n },\n api(...a) {\n return this.src(defaults.apiDir, ...a);\n },\n pages(...a) {\n return this.src(defaults.pagesDir, ...a);\n },\n config(...a) {\n return this.src(defaults.configDir, ...a);\n },\n entry(...a) {\n return this.src(defaults.entryDir, ...a);\n },\n lib(...a) {\n return createPath(defaults.libDir, defaults.srcDir, sourceFolder, ...a);\n },\n libApi(...a) {\n return this.lib(defaults.apiDir, ...a);\n },\n libEntry(...a) {\n return this.lib(defaults.entryDir, ...a);\n },\n libPages(...a) {\n return this.lib(defaults.pagesDir, ...a);\n },\n fetch(...a) {\n return this.lib(defaults.fetchDir, ...a);\n },\n },\n createImport,\n createImportHelper: (key, ...a) => {\n // Handlebars always appends an options object as the last argument,\n // slice it off before passing args to createImport\n return createImport[key](...a.slice(0, -1));\n },\n };\n};\n", "export const defaults = {\n appPrefix: \"~\",\n srcPrefix: \"@\",\n libPrefix: \"_\",\n\n coreDir: \"core\",\n srcDir: \"src\",\n libDir: \"lib\",\n\n configDir: \"config\",\n apiDir: \"api\",\n pagesDir: \"pages\",\n entryDir: \"entry\",\n fetchDir: \"fetch\",\n};\n", "import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport crc from \"crc/crc32\";\nimport handlebars from \"handlebars\";\n\nimport { pathExists } from \"./fs\";\n\nexport type RenderOptions = {\n noEscape?: boolean;\n // handlebars instance\n renderer?: typeof handlebars;\n};\n\nexport type FactoryOptions = RenderOptions & {\n /**\n * Controls whether to overwrite an existing file.\n * - `false`: skip writing if the file already exists\n * - `true` (default): always overwrite\n * - function: custom logic to decide whether to overwrite, based on current file content\n */\n overwrite?: boolean | ((fileContent: string) => boolean);\n formatters?: Array<Formatter>;\n};\n\ntype Formatter = (content: string, file: string) => string;\n\nexport const render = <Context = object>(\n template: string,\n context: Context,\n options?: RenderOptions,\n): string => {\n const { noEscape = true, renderer = handlebars } = { ...options };\n return renderer.compile(template, { noEscape })(context);\n};\n\nexport const renderAsFile = <Context = object>(\n file: string,\n template: string,\n context: Context,\n options?: Omit<FactoryOptions, \"overwrite\">,\n): string => {\n const { formatters, ...renderOpts } = { ...options };\n const content = render(template, context, renderOpts);\n return Array.isArray(formatters)\n ? formatters.reduce((c, f) => f(c, file), content)\n : content;\n};\n\nexport const renderToFile = async <Context = object>(\n file: string,\n template: string,\n context: Context,\n options?: FactoryOptions,\n): Promise<void> => {\n const content = renderAsFile(file, template, context, options);\n\n /**\n * Two fs calls (exists + read) are worth it to avoid touching the file\n * and triggering watchers unnecessarily.\n * */\n if (await pathExists(file)) {\n const { overwrite = true } = { ...options };\n if (overwrite === false) {\n return;\n }\n const fileContent = await readFile(file, \"utf8\");\n if (typeof overwrite === \"function\" && !overwrite(fileContent)) {\n return;\n }\n if (crc(content) === crc(fileContent)) {\n return;\n }\n }\n\n await mkdir(dirname(file), { recursive: true });\n await writeFile(file, content, \"utf8\");\n};\n\nexport const renderFactory = (\n options?: FactoryOptions & {\n outdir?: string;\n partials?: Record<string, string>;\n helpers?: Record<string, (...a: Array<never>) => unknown>;\n },\n) => {\n const renderer = handlebars.create();\n if (options?.partials) {\n renderer.registerPartial(options.partials as never);\n }\n if (options?.helpers) {\n renderer.registerHelper(options.helpers as never);\n }\n return {\n render<Context = object>(\n template: string,\n context: Context,\n selfOoptions?: FactoryOptions,\n ) {\n return render(template, context, {\n renderer,\n ...options,\n ...selfOoptions,\n });\n },\n async renderToFile<Context = object>(\n file: string,\n template: string,\n context: Context,\n selfOoptions?: FactoryOptions,\n ) {\n return renderToFile(\n options?.outdir ? join(options.outdir, file) : file,\n template,\n context,\n { renderer, ...options, ...selfOoptions },\n );\n },\n };\n};\n", "import { access, constants } from \"node:fs/promises\";\n\nexport const pathExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n", "/**\n * Enhances base TypeScript types with JSON Schema validation constraints.\n * Allows declaring refined types that carry validation metadata for runtime\n * schema validation while maintaining full TypeScript type safety.\n *\n * Useful for generating validation schemas and ensuring\n * data conforms to specific business rules beyond basic type checking.\n * */\nexport declare global {\n type TRefine<\n T extends unknown[] | number | string | object,\n _ extends T extends unknown[]\n ? TArrayOptions\n : T extends number\n ? TNumberOptions\n : T extends string\n ? TStringOptions\n : TObjectOptions,\n > = T;\n}\n\n/**\n * Type definitions inspired by and gently adapted from TypeBox.\n * Original TypeBox created by sinclairzx81: https://github.com/sinclairzx81/typebox\n * TypeBox is licensed under MIT: https://github.com/sinclairzx81/typebox/blob/main/license\n *\n * These types provide JSON Schema compatible type refinements for TypeScript.\n * */\ninterface TSchema {}\n\n// ------------------------------------------------------------------\n// ObjectOptions\n// ------------------------------------------------------------------\ninterface TObjectOptions {\n /**\n * Defines whether additional properties are allowed beyond those explicitly defined in `properties`.\n */\n additionalProperties?: TSchema | boolean;\n /**\n * The minimum number of properties required in the object.\n */\n minProperties?: number;\n /**\n * The maximum number of properties allowed in the object.\n */\n maxProperties?: number;\n /**\n * Defines conditional requirements for properties.\n */\n dependencies?: Record<string, boolean | TSchema | string[]>;\n /**\n * Specifies properties that *must* be present if a given property is present.\n */\n dependentRequired?: Record<string, string[]>;\n /**\n * Defines schemas that apply if a specific property is present.\n */\n dependentSchemas?: Record<string, TSchema>;\n /**\n * Maps regular expressions to schemas properties matching a pattern must validate against the schema.\n */\n patternProperties?: Record<string, TSchema>;\n /**\n * A schema that all property names within the object must validate against.\n */\n propertyNames?: TSchema;\n}\n\n// ------------------------------------------------------------------\n// ArrayOptions\n// ------------------------------------------------------------------\ninterface TArrayOptions {\n /**\n * The minimum number of items allowed in the array.\n */\n minItems?: number;\n /**\n * The maximum number of items allowed in the array.\n */\n maxItems?: number;\n /**\n * A schema that at least one item in the array must validate against.\n */\n contains?: TSchema;\n /**\n * The minimum number of array items that must validate against the `contains` schema.\n */\n minContains?: number;\n /**\n * The maximum number of array items that may validate against the `contains` schema.\n */\n maxContains?: number;\n /**\n * An array of schemas, where each schema in `prefixItems` validates against items at corresponding positions from the beginning of the array.\n */\n prefixItems?: TSchema[];\n /**\n * If `true`, all items in the array must be unique.\n */\n uniqueItems?: boolean;\n}\n\n// ------------------------------------------------------------------\n// NumberOptions\n// ------------------------------------------------------------------\ninterface TNumberOptions {\n /**\n * Specifies an exclusive upper limit for the number (number must be less than this value).\n */\n exclusiveMaximum?: number | bigint;\n /**\n * Specifies an exclusive lower limit for the number (number must be greater than this value).\n */\n exclusiveMinimum?: number | bigint;\n /**\n * Specifies an inclusive upper limit for the number (number must be less than or equal to this value).\n */\n maximum?: number | bigint;\n /**\n * Specifies an inclusive lower limit for the number (number must be greater than or equal to this value).\n */\n minimum?: number | bigint;\n /**\n * Specifies that the number must be a multiple of this value.\n */\n multipleOf?: number | bigint;\n}\n\n// ------------------------------------------------------------------\n// StringOptions\n// ------------------------------------------------------------------\ntype TFormat =\n | \"date-time\"\n | \"date\"\n | \"duration\"\n | \"email\"\n | \"hostname\"\n | \"idn-email\"\n | \"idn-hostname\"\n | \"ipv4\"\n | \"ipv6\"\n | \"iri-reference\"\n | \"iri\"\n | \"json-pointer-uri-fragment\"\n | \"json-pointer\"\n | \"json-string\"\n | \"regex\"\n | \"relative-json-pointer\"\n | \"time\"\n | \"uri-reference\"\n | \"uri-template\"\n | \"url\"\n | \"uuid\";\n\ninterface TStringOptions {\n /**\n * Specifies the expected string format.\n *\n * Common values include:\n * - `base64` \u2013 Base64-encoded string.\n * - `date-time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time format.\n * - `date` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (YYYY-MM-DD).\n * - `duration` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format.\n * - `email` \u2013 RFC 5321/5322 compliant email address.\n * - `hostname` \u2013 RFC 1034/1035 compliant host name.\n * - `idn-email` \u2013 Internationalized email address.\n * - `idn-hostname` \u2013 Internationalized host name.\n * - `ipv4` \u2013 IPv4 address.\n * - `ipv6` \u2013 IPv6 address.\n * - `iri` / `iri-reference` \u2013 Internationalized Resource Identifier.\n * - `json-pointer` / `json-pointer-uri-fragment` \u2013 JSON Pointer format.\n * - `json-string` \u2013 String containing valid JSON.\n * - `regex` \u2013 Regular expression syntax.\n * - `relative-json-pointer` \u2013 Relative JSON Pointer format.\n * - `time` \u2013 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time (HH:MM:SS).\n * - `uri-reference` / `uri-template` \u2013 URI reference or template.\n * - `url` \u2013 Web URL format.\n * - `uuid` \u2013 RFC 4122 UUID string.\n *\n * May also be a custom format string.\n */\n format?: TFormat;\n /**\n * Specifies the minimum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n minLength?: number;\n /**\n * Specifies the maximum number of characters allowed in the string.\n * Must be a non-negative integer.\n */\n maxLength?: number;\n /**\n * Specifies a regular expression pattern that the string value must match.\n * Can be provided as a string (ECMA-262 regex syntax) or a `RegExp` object.\n */\n pattern?: string | RegExp;\n}\n", "# Ignore all files\n*\n\n# But don't ignore directories (so Git can traverse them)\n!*/\n\n# And don't ignore these files at any depth\n!cache.json\n!types.ts\n", "// stub schemas, specialized generators supposed to overwrite this file\nimport type { ValidationSchemas } from \"@kosmojs/api\";\nexport type { ValidationSchemas };\nexport const validationSchemas: ValidationSchemas = {};\n"],
5
+ "mappings": "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",
6
+ "names": ["dirname", "join", "dirname"]
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { PluginOptionsResolved } from "@kosmojs/devlib";
1
+ import type { PluginOptionsResolved } from "../../src/types";
2
2
  export declare const appRoot: string;
3
- export declare const sourceFolder = "@src";
3
+ export declare const sourceFolder = "test";
4
4
  export declare const pluginOptions: Pick<PluginOptionsResolved, "appRoot" | "sourceFolder">;