raiton 6.6.0-beta.14 → 6.7.0-beta.15

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 (155) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -9
  3. package/build/bin/index.mjs +8170 -3997
  4. package/deno.json +4 -1
  5. package/docs/contributors/framework/README.md +2 -0
  6. package/docs/contributors/framework/cache/README.md +55 -0
  7. package/docs/contributors/framework/cache/cache.md +86 -0
  8. package/docs/contributors/framework/cache/etag.md +82 -0
  9. package/docs/contributors/framework/decorators/README.md +1 -0
  10. package/docs/contributors/framework/runtime.md +13 -3
  11. package/docs/user-guide/README.md +1 -0
  12. package/docs/user-guide/cache.md +79 -0
  13. package/docs/user-guide/cli.md +35 -3
  14. package/docs/user-guide/decorators/README.md +1 -0
  15. package/docs/user-guide/decorators/cache.md +79 -0
  16. package/docs/user-guide/runtime.md +2 -1
  17. package/package.json +8 -3
  18. package/source/bin/bootstrapper.ts +4 -4
  19. package/source/bin/cli-tools.ts +27 -3
  20. package/source/bin/cli.ts +2 -2
  21. package/source/bin/commands.registry.ts +17 -0
  22. package/source/bin/constants.ts +1 -0
  23. package/source/bin/index.ts +2 -2
  24. package/source/commands/artifact.command.ts +2 -2
  25. package/source/commands/build.command.ts +2 -2
  26. package/source/commands/develop.command.ts +4 -5
  27. package/source/commands/grafts.command.ts +1 -1
  28. package/source/commands/start.command.ts +2 -2
  29. package/source/core/application.ts +10 -10
  30. package/source/core/artifacts/artifact.ts +1 -1
  31. package/source/core/artifacts/index.ts +1 -1
  32. package/source/core/builder.ts +69 -15
  33. package/source/core/bytes.util.ts +1 -1
  34. package/source/core/commands.ts +24 -14
  35. package/source/core/config/config.ts +2 -2
  36. package/source/core/config/define.ts +2 -2
  37. package/source/core/config/index.ts +2 -2
  38. package/source/core/context.ts +1 -1
  39. package/source/core/controller/builder.ts +9 -9
  40. package/source/core/controller/compiler.ts +6 -6
  41. package/source/core/controller/index.ts +4 -4
  42. package/source/core/controller/metadata.ts +2 -2
  43. package/source/core/controller/tracker.ts +1 -1
  44. package/source/core/directories.ts +3 -2
  45. package/source/core/guards.ts +1 -1
  46. package/source/core/helpers/index.ts +1 -1
  47. package/source/core/hooks.ts +1 -1
  48. package/source/core/index.ts +16 -16
  49. package/source/core/injection/index.ts +1 -1
  50. package/source/core/injection/injection.ts +3 -3
  51. package/source/core/mcp/builder.ts +8 -8
  52. package/source/core/mcp/index.ts +3 -3
  53. package/source/core/mcp/metadata.ts +2 -2
  54. package/source/core/mcp/tracker.ts +1 -1
  55. package/source/core/middleware/compose.ts +2 -2
  56. package/source/core/middleware/index.ts +2 -2
  57. package/source/core/middleware/pipeline.ts +2 -2
  58. package/source/core/plugins/index.ts +2 -2
  59. package/source/core/plugins/plugin.ts +1 -1
  60. package/source/core/plugins/scope.ts +4 -4
  61. package/source/core/raiton.ts +1 -1
  62. package/source/core/router/handler.ts +30 -6
  63. package/source/core/router/handler.utils.ts +3 -3
  64. package/source/core/router/index.ts +4 -4
  65. package/source/core/router/matcher.ts +1 -1
  66. package/source/core/router/route.ts +1 -1
  67. package/source/core/router/router.ts +4 -4
  68. package/source/core/server.ts +1 -1
  69. package/source/core/socket/builder.ts +2 -2
  70. package/source/core/socket/index.ts +2 -2
  71. package/source/core/socket/metadata.ts +2 -2
  72. package/source/core/thread.ts +51 -22
  73. package/source/framework/artifacts.ts +5 -5
  74. package/source/framework/cache/cache.decorator.ts +35 -0
  75. package/source/framework/cache/cache.ts +197 -0
  76. package/source/framework/cache/etag.ts +174 -0
  77. package/source/framework/cache/index.ts +4 -0
  78. package/source/framework/cache/types.ts +111 -0
  79. package/source/framework/constants/decorators.constant.ts +2 -0
  80. package/source/framework/constants/index.ts +2 -2
  81. package/source/framework/decorators/access-guard.decorator.ts +2 -2
  82. package/source/framework/decorators/api-response.decorator.ts +1 -1
  83. package/source/framework/decorators/api.decorator.ts +1 -1
  84. package/source/framework/decorators/controllable.decorator.ts +3 -3
  85. package/source/framework/decorators/csrf-guard.decorator.ts +4 -4
  86. package/source/framework/decorators/csrf-token.decorator.ts +1 -1
  87. package/source/framework/decorators/guard.decorator.ts +4 -4
  88. package/source/framework/decorators/health-check.decorator.ts +3 -3
  89. package/source/framework/decorators/index.ts +14 -14
  90. package/source/framework/decorators/injection.decorator.ts +3 -3
  91. package/source/framework/decorators/mcp.decorator.ts +4 -4
  92. package/source/framework/decorators/middleware.decorator.ts +2 -2
  93. package/source/framework/decorators/parametrable.decorator.ts +2 -2
  94. package/source/framework/decorators/routable.decorator.ts +3 -3
  95. package/source/framework/decorators/route-interaction.decorator.ts +4 -4
  96. package/source/framework/decorators/socket.decorator.ts +3 -3
  97. package/source/framework/encryption.ts +2 -2
  98. package/source/framework/enums/index.ts +8 -8
  99. package/source/framework/enums/runtime.enum.ts +1 -2
  100. package/source/framework/env.ts +2 -2
  101. package/source/framework/exceptions/http-exception.ts +3 -3
  102. package/source/framework/exceptions/index.ts +2 -2
  103. package/source/framework/health-check.ts +4 -4
  104. package/source/framework/index.ts +18 -17
  105. package/source/framework/mcp/handler.ts +3 -3
  106. package/source/framework/mcp/index.ts +3 -3
  107. package/source/framework/mcp/protocol.ts +1 -1
  108. package/source/framework/mcp/streamable-http.ts +3 -3
  109. package/source/framework/parameter-bag.ts +2 -2
  110. package/source/framework/plugins/body-parser.plugin.ts +3 -3
  111. package/source/framework/plugins/index.ts +4 -4
  112. package/source/framework/plugins/mcp.plugin.ts +5 -5
  113. package/source/framework/plugins/openapi.plugin.ts +4 -4
  114. package/source/framework/plugins/security/body-limit.ts +3 -3
  115. package/source/framework/plugins/security/cors.ts +2 -2
  116. package/source/framework/plugins/security/csrf.ts +6 -6
  117. package/source/framework/plugins/security/headers.ts +2 -2
  118. package/source/framework/plugins/security/index.ts +6 -6
  119. package/source/framework/plugins/security/method-guard.ts +3 -3
  120. package/source/framework/plugins/security/rate-limit.ts +3 -3
  121. package/source/framework/repositories.ts +1 -1
  122. package/source/framework/responses/error.ts +2 -2
  123. package/source/framework/responses/helpers.ts +3 -3
  124. package/source/framework/responses/http-throwable.ts +3 -3
  125. package/source/framework/responses/http.ts +3 -3
  126. package/source/framework/responses/index.ts +4 -4
  127. package/source/framework/runtime/bun/server.ts +5 -5
  128. package/source/framework/runtime/deno/server.ts +156 -96
  129. package/source/framework/runtime/index.ts +11 -17
  130. package/source/framework/runtime/node/reply.ts +1 -1
  131. package/source/framework/runtime/node/request.ts +2 -2
  132. package/source/framework/runtime/node/server.ts +3 -3
  133. package/source/framework/runtime/web/server.ts +2 -2
  134. package/source/framework/services.ts +1 -1
  135. package/source/framework/utilities/csrf.util.ts +1 -1
  136. package/source/framework/utilities/index.ts +10 -10
  137. package/source/framework/utilities/openapi.utils.ts +7 -7
  138. package/source/framework/utilities/utilities.util.ts +1 -1
  139. package/source/types/application.ts +2 -2
  140. package/source/types/builder.ts +1 -1
  141. package/source/types/config.ts +1 -1
  142. package/source/types/controller.ts +3 -3
  143. package/source/types/core.ts +1 -1
  144. package/source/types/csrf.ts +1 -1
  145. package/source/types/guard.ts +1 -1
  146. package/source/types/http-responses.ts +1 -1
  147. package/source/types/index.ts +26 -26
  148. package/source/types/injection.ts +1 -1
  149. package/source/types/middleware.ts +1 -1
  150. package/source/types/plugin.ts +1 -1
  151. package/source/types/raiton.ts +1 -1
  152. package/source/types/responses.ts +2 -2
  153. package/source/types/router.ts +2 -2
  154. package/source/types/runtime.ts +3 -5
  155. package/source/types/thread.ts +4 -4
@@ -0,0 +1,17 @@
1
+ import ArtifactCommand from "../commands/artifact.command.ts";
2
+ import BuildCommand from "../commands/build.command.ts";
3
+ import DevelopCommand from "../commands/develop.command.ts";
4
+ import GraftsCommand from "../commands/grafts.command.ts";
5
+ import StartCommand from "../commands/start.command.ts";
6
+ import type {Command} from "commander";
7
+ import type {RaitonCommand} from "../core/index.ts";
8
+
9
+ export type RaitonCommandConstructor = new (cli: Command, workdir: string, appdir: string) => RaitonCommand;
10
+
11
+ export const RaitonCommandsRegistry: RaitonCommandConstructor[] = [
12
+ ArtifactCommand,
13
+ BuildCommand,
14
+ DevelopCommand,
15
+ GraftsCommand,
16
+ StartCommand,
17
+ ];
@@ -1,5 +1,6 @@
1
1
  export const isBunUsed = typeof (globalThis as any).Bun !== "undefined";
2
2
  export const isDenoUsed = typeof (globalThis as any).Deno !== "undefined";
3
+ export const isNodeUsed = !isBunUsed && !isDenoUsed;
3
4
 
4
5
  declare const Bun: any;
5
6
  declare const Deno: any;
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import "reflect-metadata"
3
- import CLI from "./cli";
4
- import bootstrapper from "./bootstrapper";
3
+ import CLI from "./cli.ts";
4
+ import bootstrapper from "./bootstrapper.ts";
5
5
 
6
6
  bootstrapper(CLI)
@@ -1,6 +1,6 @@
1
- import {RaitonCommand, RaitonBuilder} from "../core";
1
+ import {RaitonCommand, RaitonBuilder} from "../core/index.ts";
2
2
  import {Logger} from "@protorians/logger";
3
- import type {BuildCommandOptionsInterface} from "../types";
3
+ import type {BuildCommandOptionsInterface} from "../types/index.ts";
4
4
 
5
5
 
6
6
  export default class ArtifactCommand extends RaitonCommand {
@@ -1,6 +1,6 @@
1
- import {RaitonCommand, RaitonBuilder} from "../core";
1
+ import {RaitonCommand, RaitonBuilder} from "../core/index.ts";
2
2
  import {LBadge, Logger} from "@protorians/logger";
3
- import type {BuildCommandOptionsInterface} from "../types";
3
+ import type {BuildCommandOptionsInterface} from "../types/index.ts";
4
4
 
5
5
 
6
6
  export default class BuildCommand extends RaitonCommand {
@@ -1,10 +1,9 @@
1
1
  /// <reference types="deno" />
2
- import {Raiton, RaitonCommand} from "../core";
2
+ import {Raiton, RaitonCommand} from "../core/index.ts";
3
3
  import {ChildProcess, ChildProcessWithoutNullStreams} from 'node:child_process';
4
4
  import {Logger} from "@protorians/logger";
5
- import {EventMessageEnum} from "../framework";
6
- import {CliTools} from "../bin/cli-tools";
7
- import path from "node:path";
5
+ import {EventMessageEnum} from "../framework/index.ts";
6
+ import {CliTools} from "../bin/cli-tools.ts";
8
7
 
9
8
  export default class DevelopCommand extends RaitonCommand {
10
9
  public readonly name: string = 'develop';
@@ -32,7 +31,7 @@ export default class DevelopCommand extends RaitonCommand {
32
31
  protected async run(): Promise<void> {
33
32
  // Logger.info('Workdir', this.workdir);
34
33
 
35
- const entryPoint = path.join(this.appdir, 'bin/index.ts');
34
+ const entryPoint = CliTools.cliEntry(this.appdir);
36
35
  this.child = CliTools.spawn(entryPoint, ['build', '-d'], {
37
36
  stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
38
37
  cwd: this.workdir
@@ -1,4 +1,4 @@
1
- import {RaitonCommand} from "../core";
1
+ import {RaitonCommand} from "../core/index.ts";
2
2
 
3
3
 
4
4
  export default class GraftsCommand extends RaitonCommand {
@@ -1,8 +1,8 @@
1
1
  /// <reference types="deno" />
2
- import {RaitonBuilder, RaitonCommand} from "../core";
2
+ import {RaitonBuilder, RaitonCommand} from "../core/index.ts";
3
3
  import {ChildProcess} from 'node:child_process';
4
4
  import {LBadge, Logger} from "@protorians/logger";
5
- import {StartCommandOptionsInterface} from "../types";
5
+ import {StartCommandOptionsInterface} from "../types/index.ts";
6
6
 
7
7
  export default class StartCommand extends RaitonCommand {
8
8
  public readonly name: string = 'start';
@@ -1,14 +1,14 @@
1
- import {Security, bodyParserPlugin} from "../framework/plugins";
2
- import {PluginScope} from './plugins/scope'
3
- import {RequestContext} from './context'
4
- import {ApplicationConfigInterface, ApplicationInterface} from "../types/application";
5
- import {HttpException, HttpMethod, ThrowableResponse, RaitonResponses, HttpStatus} from "../framework";
6
- import {RouteHandlerCallable} from "../types";
1
+ import {Security, bodyParserPlugin} from "../framework/plugins/index.ts";
2
+ import {PluginScope} from './plugins/scope.ts'
3
+ import {RequestContext} from './context.ts'
4
+ import {ApplicationConfigInterface, ApplicationInterface} from "../types/application.ts";
5
+ import {HttpException, HttpMethod, ThrowableResponse, RaitonResponses, HttpStatus} from "../framework/index.ts";
6
+ import {RouteHandlerCallable} from "../types/index.ts";
7
7
  import {Logger} from "@protorians/logger";
8
- import {RaitonConfig} from "./config";
9
- import {Artifacts} from "../framework/artifacts";
10
- import {Injection} from "./injection";
11
- import {HttpsConfigInterface, resolveHttpsConfig} from "../framework/utilities/https.util";
8
+ import {RaitonConfig} from "./config/index.ts";
9
+ import {Artifacts} from "../framework/artifacts.ts";
10
+ import {Injection} from "./injection/index.ts";
11
+ import {HttpsConfigInterface, resolveHttpsConfig} from "../framework/utilities/https.util.ts";
12
12
 
13
13
  export class Application implements ApplicationInterface {
14
14
  private root: PluginScope
@@ -1,4 +1,4 @@
1
- import {RaitonConfig} from "../config/config";
1
+ import {RaitonConfig} from "../config/config.ts";
2
2
 
3
3
  export class Artifact {
4
4
 
@@ -1 +1 @@
1
- export * from "./artifact";
1
+ export * from "./artifact.ts";
@@ -1,17 +1,18 @@
1
- import {RaitonConfig} from "./config";
1
+ import {RaitonConfig} from "./config/index.ts";
2
2
  import path from "node:path";
3
- import {RaitonDirectories} from "./directories";
3
+ import {RaitonDirectories} from "./directories.ts";
4
4
  import fs, {WatchEventType} from "node:fs";
5
- import type {BuilderConfigInterface, BuilderInterface, ThreadInterface,} from "../types";
6
- import {RaitonThread} from "./thread";
7
- import {Raiton} from "./raiton";
8
- import {ControllerBuilder} from "./controller";
5
+ import type {BuilderConfigInterface, BuilderInterface, ThreadInterface,} from "../types/index.ts";
6
+ import {RaitonThread} from "./thread.ts";
7
+ import {Raiton} from "./raiton.ts";
8
+ import {ControllerBuilder} from "./controller/index.ts";
9
9
  import {watch} from "fs";
10
10
  import {LBadge, Logger} from "@protorians/logger";
11
- import {Throwable} from "../framework/exceptions";
12
- import {Artifacts, HMR_CHANNELS, HmrChannel} from "../framework/artifacts";
11
+ import {Throwable} from "../framework/exceptions/index.ts";
12
+ import {Artifacts, HMR_CHANNELS, HmrChannel} from "../framework/artifacts.ts";
13
13
  import {build} from "esbuild";
14
14
  import {execSync, spawn, spawnSync} from "node:child_process";
15
+ import {isNodeUsed} from "../bin/constants.ts";
15
16
 
16
17
  export class RaitonBuilder implements BuilderInterface {
17
18
  protected _source: string | null = null;
@@ -55,6 +56,14 @@ export class RaitonBuilder implements BuilderInterface {
55
56
  const classification = Artifacts.classify(filename)
56
57
  if (!classification) return
57
58
 
59
+ // Sur Node, le rechargement d'artefacts TypeScript en mémoire n'est pas
60
+ // possible (import() natif des fichiers .ts). On bascule alors sur le
61
+ // redémarrage de processus via IPC RESTART géré par la commande `develop`.
62
+ if (isNodeUsed) {
63
+ Raiton.thread?.restart()
64
+ return
65
+ }
66
+
58
67
  const payload = {
59
68
  filename,
60
69
  timestamp: Date.now(),
@@ -102,7 +111,7 @@ export class RaitonBuilder implements BuilderInterface {
102
111
 
103
112
 
104
113
  this._bootstrapper = path.join(this._source, RaitonDirectories.bootstrapFile)
105
- this._bootstrapperFile = path.join(RaitonDirectories.server('./'), RaitonDirectories.bootstrapFile)
114
+ this._bootstrapperFile = path.join(RaitonDirectories.server(this.workdir), RaitonDirectories.compiledBootstrapFile)
106
115
 
107
116
  return this;
108
117
 
@@ -198,24 +207,69 @@ export class RaitonBuilder implements BuilderInterface {
198
207
 
199
208
  const source = path.relative(this.workdir, this._source)
200
209
  const output = path.relative(this.workdir, this._out)
201
- const tsconfig = 'tsconfig.json'
202
- // const tsconfig = path.join(path.relative(this._source, this.workdir), 'tsconfig.json')
203
210
 
204
211
  Logger.log(LBadge.notice('Building'), 'application');
205
212
  Logger.log(LBadge.info('Source'), source);
206
213
  Logger.log(LBadge.info('Output'), output);
207
214
 
208
- execSync(`cd ${this.workdir} && npx tsc -p ${tsconfig} --outDir ${output} --noEmit`, {stdio: 'inherit'})
215
+ await this.typecheck()
216
+ await this.compile()
217
+
218
+ return this;
219
+ }
220
+
221
+ protected async typecheck(): Promise<this> {
222
+ const tsconfigPath = path.join(this.workdir, 'tsconfig.json')
223
+ if (!fs.existsSync(tsconfigPath)) return this
224
+
225
+ try {
226
+ execSync(`cd ${this.workdir} && npx tsc -p tsconfig.json --noEmit`, {stdio: 'inherit'})
227
+ } catch (e: any) {
228
+ Logger.warn('TypeScript check reported errors', e?.message ?? e)
229
+ }
230
+
231
+ return this;
232
+ }
233
+
234
+ protected async compile(): Promise<this> {
235
+ if (!this._source) throw new Error('Application source not found');
236
+ if (!this._out) throw new Error('Application output not found');
237
+ if (!this.bootstrapper) throw new Error('Bootstrapper not found')
238
+
239
+ const outfile = this.bootstrapperFile
240
+ if (!outfile) throw new Error('Bootstrapper file not found')
241
+
242
+ await build({
243
+ entryPoints: [this.bootstrapper],
244
+ bundle: true,
245
+ platform: 'node',
246
+ format: 'esm',
247
+ target: 'node20',
248
+ outfile,
249
+ sourcemap: true,
250
+ packages: 'external',
251
+ external: ['@protorians/*', 'argon2', 'bcrypt'],
252
+ })
209
253
 
210
254
  return this;
211
255
  }
212
256
 
213
257
  public async boot(): Promise<any> {
214
258
  if (!this.bootstrapper) throw new Error('Bootstrapper not found')
215
- if (!fs.existsSync(this.bootstrapper))
216
- throw new Error(`Bootstrapper file "${this.bootstrapper}" does not exists`)
217
259
 
218
- const bootstrapper = await import(this.bootstrapper);
260
+ let entry = this.bootstrapper
261
+
262
+ if (isNodeUsed) {
263
+ const compiled = this.bootstrapperFile
264
+ if (!compiled) throw new Error('Bootstrapper file not found')
265
+ if (!fs.existsSync(compiled)) await this.compile()
266
+ entry = compiled
267
+ }
268
+
269
+ if (!fs.existsSync(entry))
270
+ throw new Error(`Bootstrapper file "${entry}" does not exists`)
271
+
272
+ const bootstrapper = await import(entry);
219
273
  if (!('default' in bootstrapper))
220
274
  throw new Error('Bootstrapper not supported! Please export to "default"')
221
275
 
@@ -1,4 +1,4 @@
1
- import {FileSizeFormatedInterface} from "../types";
1
+ import {FileSizeFormatedInterface} from "../types/index.ts";
2
2
 
3
3
  export function parseBytes(bytes: number, decimals = 2): FileSizeFormatedInterface {
4
4
  if (bytes === 0) return {size: 0, unit: "o"};
@@ -1,5 +1,5 @@
1
1
  import {Command} from "commander";
2
- import {RaitonCommand} from "./command";
2
+ import {RaitonCommand} from "./command.ts";
3
3
  import fs from 'node:fs';
4
4
  import path from "node:path";
5
5
  import {Logger} from "@protorians/logger";
@@ -17,28 +17,38 @@ export class RaitonCommands {
17
17
 
18
18
  public async harvest(): Promise<void> {
19
19
  const dir = path.join(this.appdir, 'commands');
20
-
21
- if (!fs.existsSync(dir)) {
22
- return;
23
- }
24
20
 
25
- const files = fs.readdirSync(dir);
21
+ if (fs.existsSync(dir)) {
22
+ const files = fs.readdirSync(dir);
23
+
24
+ for (const file of files) {
25
+ if (file.startsWith('~')) continue;
26
+ if (file.endsWith('.d.ts')) continue;
27
+ if (!file.includes('.command.')) continue;
28
+
29
+ const filepath = path.join(dir, file);
30
+ const mod = await import(filepath);
31
+
32
+ const capability = new mod.default(this.cli, this.workdir, this.appdir)
26
33
 
27
- for (const file of files) {
28
- if (file.startsWith('~')) continue;
29
- if (file.endsWith('.d.ts')) continue;
30
- if (!file.includes('.command.')) continue;
34
+ if (!(capability instanceof RaitonCommand)) continue;
31
35
 
32
- const filepath = path.join(dir, file);
33
- const mod = await import(filepath);
36
+ capability.register();
37
+ this.stack.add(capability);
38
+ }
34
39
 
35
- const capability = new mod.default(this.cli, this.workdir, this.appdir)
40
+ return;
41
+ }
42
+
43
+ const {RaitonCommandsRegistry} = await import("../bin/commands.registry.ts");
44
+
45
+ for (const constructor of RaitonCommandsRegistry) {
46
+ const capability = new constructor(this.cli, this.workdir, this.appdir)
36
47
 
37
48
  if (!(capability instanceof RaitonCommand)) continue;
38
49
 
39
50
  capability.register();
40
51
  this.stack.add(capability);
41
52
  }
42
-
43
53
  }
44
54
  }
@@ -1,8 +1,8 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
- import {ConfigurableInterface} from "../../types";
3
+ import {ConfigurableInterface} from "../../types/index.ts";
4
4
  import {Logger} from "@protorians/logger";
5
- import {Raiton} from "../raiton";
5
+ import {Raiton} from "../raiton.ts";
6
6
 
7
7
  export class RaitonConfig {
8
8
  static readonly current: Map<keyof ConfigurableInterface, ConfigurableInterface[keyof ConfigurableInterface]> = new Map();
@@ -1,5 +1,5 @@
1
- import {ConfigurableInterface} from "../../types/config";
2
- import {JsonUtil} from "../../framework/utilities";
1
+ import {ConfigurableInterface} from "../../types/config.ts";
2
+ import {JsonUtil} from "../../framework/utilities/index.ts";
3
3
 
4
4
  export async function defineConfig(config?: ConfigurableInterface) {
5
5
  const workdir = process.cwd();
@@ -1,2 +1,2 @@
1
- export * from "./config"
2
- export * from "./define"
1
+ export * from "./config.ts"
2
+ export * from "./define.ts"
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  RuntimeRequestInterface,
3
3
  RuntimeReplyInterface
4
- } from '../types'
4
+ } from '../types/index.ts'
5
5
 
6
6
  export class RequestContext {
7
7
  public state: Record<string, any> = {}
@@ -1,15 +1,15 @@
1
1
  import fs from "node:fs";
2
- import {BuilderHMRDeclarationInterface} from "../../types";
2
+ import {BuilderHMRDeclarationInterface} from "../../types/index.ts";
3
3
  import {LBadge, Logger} from "@protorians/logger";
4
- import {compileController} from "./compiler";
5
- import {compileSocket} from "../socket/builder";
6
- import {compileMcp} from "../mcp/builder";
7
- import {RaitonThread} from "../thread";
8
- import {Injection} from "../injection";
9
- import {isControllerArtifact, isSocketArtifact, isMcpArtifact} from "../../framework";
10
- import {Artifacts} from "../../framework/artifacts";
4
+ import {compileController} from "./compiler.ts";
5
+ import {compileSocket} from "../socket/builder.ts";
6
+ import {compileMcp} from "../mcp/builder.ts";
7
+ import {RaitonThread} from "../thread.ts";
8
+ import {Injection} from "../injection/index.ts";
9
+ import {isControllerArtifact, isSocketArtifact, isMcpArtifact} from "../../framework/index.ts";
10
+ import {Artifacts} from "../../framework/artifacts.ts";
11
11
  import path from "node:path";
12
- import {ControllerRouteTracker} from "./tracker";
12
+ import {ControllerRouteTracker} from "./tracker.ts";
13
13
 
14
14
  export class ControllerBuilder {
15
15
 
@@ -1,9 +1,9 @@
1
- import {ApplicationInterface} from "../../types/application";
2
- import {getControllerMetadata} from "..";
3
- import {createHandler} from "../router";
4
- import {Injection} from "../injection";
5
- import {ControllerMetaInterface} from "../../types";
6
- import {ControllerRouteTracker} from "./tracker";
1
+ import {ApplicationInterface} from "../../types/application.ts";
2
+ import {getControllerMetadata} from "../index.ts";
3
+ import {createHandler} from "../router/index.ts";
4
+ import {Injection} from "../injection/index.ts";
5
+ import {ControllerMetaInterface} from "../../types/index.ts";
6
+ import {ControllerRouteTracker} from "./tracker.ts";
7
7
 
8
8
  export function compileController(
9
9
  ControllerClass: any,
@@ -1,4 +1,4 @@
1
- export * from "./metadata"
2
- export * from "./compiler"
3
- export * from "./builder"
4
- export * from "./tracker"
1
+ export * from "./metadata.ts"
2
+ export * from "./compiler.ts"
3
+ export * from "./builder.ts"
4
+ export * from "./tracker.ts"
@@ -1,5 +1,5 @@
1
- import {ControllerMetaInterface} from "../../types";
2
- import {METADATA_KEYS} from "../../framework";
1
+ import {ControllerMetaInterface} from "../../types/index.ts";
2
+ import {METADATA_KEYS} from "../../framework/index.ts";
3
3
  import "reflect-metadata";
4
4
 
5
5
  export function getControllerMetadata(target: any): ControllerMetaInterface {
@@ -1,4 +1,4 @@
1
- import {Route} from "../router"
1
+ import {Route} from "../router/index.ts"
2
2
 
3
3
  const controllerRouteMap = new Map<string, Route[]>()
4
4
 
@@ -1,11 +1,12 @@
1
1
  import path from "node:path";
2
- import {RaitonConfig} from "./config";
3
- import {Raiton} from "./raiton";
2
+ import {RaitonConfig} from "./config/index.ts";
3
+ import {Raiton} from "./raiton.ts";
4
4
 
5
5
 
6
6
  export class RaitonDirectories {
7
7
  public static readonly index = `.${Raiton.identifier}`;
8
8
  public static readonly bootstrapFile = 'main.ts';
9
+ public static readonly compiledBootstrapFile = 'main.mjs';
9
10
  // public static readonly bootstrapFile = 'main.js';
10
11
 
11
12
  public static caches(workdir: string): string {
@@ -1,4 +1,4 @@
1
- import {GuardDeclaration} from "../types";
1
+ import {GuardDeclaration} from "../types/index.ts";
2
2
  import {Logger} from "@protorians/logger";
3
3
 
4
4
  export class RaitonGuards {
@@ -1 +1 @@
1
- export * from './raiton';
1
+ export * from './raiton.ts';
@@ -1,4 +1,4 @@
1
- import {HookNameType, HookHandlerCallable} from '../types'
1
+ import {HookNameType, HookHandlerCallable} from '../types/index.ts'
2
2
 
3
3
  export class HookStore {
4
4
  private hooks = new Map<HookNameType, HookHandlerCallable[]>()
@@ -1,16 +1,16 @@
1
- export * from "./config";
2
- export * from "./process.util";
3
- export * from "./builder";
4
- export * from "./bytes.util";
5
- export * from "./commands";
6
- export * from "./command";
7
- export * from "./directories";
8
- export * from "./raiton";
9
- export * from "./thread";
10
- export * from "./application";
11
- export * from "./controller";
12
- export * from "./socket";
13
- export * from "./mcp";
14
- export * from "./plugins";
15
- export * from "./middleware";
16
- export * from "./router";
1
+ export * from "./config/index.ts";
2
+ export * from "./process.util.ts";
3
+ export * from "./builder.ts";
4
+ export * from "./bytes.util.ts";
5
+ export * from "./commands.ts";
6
+ export * from "./command.ts";
7
+ export * from "./directories.ts";
8
+ export * from "./raiton.ts";
9
+ export * from "./thread.ts";
10
+ export * from "./application.ts";
11
+ export * from "./controller/index.ts";
12
+ export * from "./socket/index.ts";
13
+ export * from "./mcp/index.ts";
14
+ export * from "./plugins/index.ts";
15
+ export * from "./middleware/index.ts";
16
+ export * from "./router/index.ts";
@@ -1 +1 @@
1
- export * from './injection';
1
+ export * from './injection.ts';
@@ -1,9 +1,9 @@
1
1
  import "reflect-metadata";
2
- import type {ConstructorType, ContainerDefinitionInterface} from "../../types";
2
+ import type {ConstructorType, ContainerDefinitionInterface} from "../../types/index.ts";
3
3
  import {LifetimeEnum, TextUtility} from "@protorians/core";
4
4
  import {Logger} from "@protorians/logger";
5
- import {METADATA_KEYS} from "../../framework/constants";
6
- import {Throwable} from "../../framework/exceptions";
5
+ import {METADATA_KEYS} from "../../framework/constants/index.ts";
6
+ import {Throwable} from "../../framework/exceptions/index.ts";
7
7
 
8
8
  const camelCase = TextUtility.camelCase;
9
9
 
@@ -1,11 +1,11 @@
1
- import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "./metadata";
2
- import {Injection} from "../injection";
3
- import {McpServerRegistrationInterface} from "../../types";
4
- import {McpRouteTracker} from "./tracker";
5
- import {RaitonThread} from "../thread";
6
- import {HttpMethod} from "../../framework/enums";
7
- import {mcpHandleGet, mcpHandlePost, isMcpJsonRpc, SESSION_HEADER} from "../../framework/mcp/streamable-http";
8
- import type {ContextInterface} from "../../types/core";
1
+ import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "./metadata.ts";
2
+ import {Injection} from "../injection/index.ts";
3
+ import {McpServerRegistrationInterface} from "../../types/index.ts";
4
+ import {McpRouteTracker} from "./tracker.ts";
5
+ import {RaitonThread} from "../thread.ts";
6
+ import {HttpMethod} from "../../framework/enums/index.ts";
7
+ import {mcpHandleGet, mcpHandlePost, isMcpJsonRpc, SESSION_HEADER} from "../../framework/mcp/streamable-http.ts";
8
+ import type {ContextInterface} from "../../types/core.ts";
9
9
 
10
10
  export function compileMcp(McpServerClass: any): McpServerRegistrationInterface | undefined {
11
11
  const metadata = getMcpServerMetadata(McpServerClass.prototype || McpServerClass)
@@ -1,3 +1,3 @@
1
- export * from "./metadata"
2
- export * from "./builder"
3
- export * from "./tracker"
1
+ export * from "./metadata.ts"
2
+ export * from "./builder.ts"
3
+ export * from "./tracker.ts"
@@ -1,5 +1,5 @@
1
- import {McpServerMetaInterface, McpServerRegistrationInterface} from "../../types";
2
- import {METADATA_KEYS} from "../../framework/constants";
1
+ import {McpServerMetaInterface, McpServerRegistrationInterface} from "../../types/index.ts";
2
+ import {METADATA_KEYS} from "../../framework/constants/index.ts";
3
3
  import "reflect-metadata";
4
4
 
5
5
  const registry = new Map<string, McpServerRegistrationInterface>();
@@ -1,4 +1,4 @@
1
- import {Route} from "../router"
1
+ import {Route} from "../router/index.ts"
2
2
 
3
3
  const mcpRouteMap = new Map<string, Route[]>()
4
4
 
@@ -1,5 +1,5 @@
1
- import {MiddlewareType} from '../../types'
2
- import {Throwable} from "../../framework/exceptions";
1
+ import {MiddlewareType} from '../../types/index.ts'
2
+ import {Throwable} from "../../framework/exceptions/index.ts";
3
3
 
4
4
  export function middlewareCompose(middlewares: MiddlewareType[]) {
5
5
  return function (request: any) {
@@ -1,2 +1,2 @@
1
- export * from "./compose"
2
- export * from "./pipeline"
1
+ export * from "./compose.ts"
2
+ export * from "./pipeline.ts"
@@ -1,5 +1,5 @@
1
- import { MiddlewareType } from '../../types'
2
- import { middlewareCompose } from '..'
1
+ import { MiddlewareType } from '../../types/index.ts'
2
+ import { middlewareCompose } from '../index.ts'
3
3
 
4
4
  export class MiddlewarePipeline {
5
5
  private stack: MiddlewareType[] = []
@@ -1,2 +1,2 @@
1
- export * from "./scope"
2
- export * from "./plugin"
1
+ export * from "./scope.ts"
2
+ export * from "./plugin.ts"
@@ -1,4 +1,4 @@
1
- import { PluginInterface, PluginCallable } from '../../types'
1
+ import { PluginInterface, PluginCallable } from '../../types/index.ts'
2
2
 
3
3
  export function definePlugin(
4
4
  setup: PluginCallable,
@@ -1,7 +1,7 @@
1
- import {HookStore} from '../hooks'
2
- import {MiddlewarePipeline} from '../middleware'
3
- import {Route, Router} from '../router'
4
- import {HttpMethod} from "../../framework/enums";
1
+ import {HookStore} from '../hooks.ts'
2
+ import {MiddlewarePipeline} from '../middleware/index.ts'
3
+ import {Route, Router} from '../router/index.ts'
4
+ import {HttpMethod} from "../../framework/enums/index.ts";
5
5
 
6
6
  export class PluginScope {
7
7
  public hooks: HookStore
@@ -1,4 +1,4 @@
1
- import {RaitonSignalMapInterface, ThreadInterface} from "../types";
1
+ import {RaitonSignalMapInterface, ThreadInterface} from "../types/index.ts";
2
2
  import {ISignalStack, Signal} from "@protorians/core";
3
3
 
4
4