@adonisjs/core 7.0.1 → 7.1.0

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 (161) hide show
  1. package/build/ace-DBm6EcQ-.js +37 -0
  2. package/build/app-BCcG_oDd.js +7 -0
  3. package/build/app-CAuSGb2P.js +15 -0
  4. package/build/bodyparser_middleware-H5FArWkI.js +9 -0
  5. package/build/{chunk-iKc69rpz.js → chunk-Do49iUES.js} +3 -0
  6. package/build/commands/add.d.ts +1 -0
  7. package/build/commands/add.js +64 -10
  8. package/build/commands/build.js +41 -3
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +70 -4
  11. package/build/commands/eject.js +30 -4
  12. package/build/commands/env/add.js +62 -4
  13. package/build/commands/generate_key.js +23 -3
  14. package/build/commands/inspect_rcfile.js +26 -2
  15. package/build/commands/list/routes.d.ts +5 -0
  16. package/build/commands/list/routes.js +242 -3
  17. package/build/commands/make/command.js +33 -4
  18. package/build/commands/make/controller.js +46 -4
  19. package/build/commands/make/event.js +36 -4
  20. package/build/commands/make/exception.js +36 -4
  21. package/build/commands/make/listener.js +44 -4
  22. package/build/commands/make/middleware.js +53 -5
  23. package/build/commands/make/preload.js +55 -5
  24. package/build/commands/make/provider.js +54 -5
  25. package/build/commands/make/service.js +29 -4
  26. package/build/commands/make/test.js +63 -4
  27. package/build/commands/make/transformer.js +37 -4
  28. package/build/commands/make/validator.js +44 -4
  29. package/build/commands/make/view.js +33 -4
  30. package/build/commands/repl.js +31 -2
  31. package/build/commands/serve.js +54 -4
  32. package/build/commands/test.js +69 -4
  33. package/build/config-Coti2q6R.js +7 -0
  34. package/build/config_provider-Do9af1ze.js +35 -0
  35. package/build/container-CGfEwWof.js +7 -0
  36. package/build/{core-IpCOCkUL.js → core-XjMm_ipu.js} +51 -2
  37. package/build/create_kernel-BV3swyCg.js +4 -0
  38. package/build/{create_kernel-B7ILNhuP.js → create_kernel-D38-0Zbt.js} +41 -1
  39. package/build/debug-DWofTfIX.js +20 -0
  40. package/build/{decorate-DmrZA614.js → decorate-B9Uz0anB.js} +2 -0
  41. package/build/{define_config-0oHaj43l.js → define_config--5euEdi8.js} +54 -3
  42. package/build/dumper-3R77st8F.js +353 -0
  43. package/build/edge-BG5ZYp6Z.js +57 -0
  44. package/build/{errors-CrCO-k44.js → errors-BScZTzBu.js} +9 -1
  45. package/build/events-DlKX1ZdL.js +7 -0
  46. package/build/exceptions-B2MzIlHY.js +2 -0
  47. package/build/factories/app.js +1 -0
  48. package/build/factories/bodyparser.js +1 -0
  49. package/build/factories/core/ace.js +16 -22
  50. package/build/factories/core/ignitor.js +13 -73
  51. package/build/factories/core/main.js +25 -17
  52. package/build/factories/core/test_utils.js +22 -19
  53. package/build/factories/encryption.js +1 -0
  54. package/build/factories/events.js +1 -0
  55. package/build/factories/hash.js +1 -0
  56. package/build/factories/http.js +1 -0
  57. package/build/factories/logger.js +1 -0
  58. package/build/factories/stubs.js +75 -7
  59. package/build/ignitor-Kym3gR-I.js +169 -0
  60. package/build/index.js +11 -8
  61. package/build/logger-DIdZPHCe.js +43 -0
  62. package/build/main-B50zECAi.js +121 -0
  63. package/build/main-CRnMnrH7.js +184 -0
  64. package/build/{main-kn40V-hF.js → main-CfTiGsiS.js} +2 -0
  65. package/build/main-Ck0GqLx4.js +117 -0
  66. package/build/main-CoZI4Ezs.js +2 -0
  67. package/build/main-D1MSq4Uu.js +435 -0
  68. package/build/{main--nXd7T-C.js → main-bRYXIHgD.js} +75 -3
  69. package/build/main-zxNP7iRl.js +7 -0
  70. package/build/modules/ace/codemods.js +301 -2
  71. package/build/modules/ace/commands.d.ts +5 -0
  72. package/build/modules/ace/main.js +2 -1
  73. package/build/modules/app.js +3 -5
  74. package/build/modules/bodyparser/bodyparser_middleware.js +2 -2
  75. package/build/modules/bodyparser/main.js +3 -5
  76. package/build/modules/config.js +3 -5
  77. package/build/modules/container.js +3 -5
  78. package/build/modules/dumper/main.js +29 -2
  79. package/build/modules/dumper/plugins/edge.js +2 -46
  80. package/build/modules/encryption/drivers/aes_256_cbc.js +1 -0
  81. package/build/modules/encryption/drivers/aes_256_gcm.js +1 -0
  82. package/build/modules/encryption/drivers/aes_siv.js +1 -0
  83. package/build/modules/encryption/drivers/chacha20_poly1305.js +1 -0
  84. package/build/modules/encryption/drivers/legacy.js +46 -1
  85. package/build/modules/encryption/main.js +7 -5
  86. package/build/modules/env/editor.js +1 -0
  87. package/build/modules/env/main.js +1 -0
  88. package/build/modules/events.js +3 -5
  89. package/build/modules/hash/drivers/argon.js +1 -0
  90. package/build/modules/hash/drivers/bcrypt.js +1 -0
  91. package/build/modules/hash/drivers/scrypt.js +1 -0
  92. package/build/modules/hash/main.js +4 -4
  93. package/build/modules/hash/phc_formatter.js +1 -0
  94. package/build/modules/health.js +1 -0
  95. package/build/modules/http/helpers.js +1 -0
  96. package/build/modules/http/main.js +2 -2
  97. package/build/modules/http/url_builder_client.js +1 -0
  98. package/build/modules/logger.js +3 -13
  99. package/build/modules/repl.js +3 -5
  100. package/build/modules/transformers/main.js +1 -0
  101. package/build/providers/app_provider.js +214 -15
  102. package/build/providers/edge_provider.js +90 -3
  103. package/build/providers/hash_provider.js +59 -4
  104. package/build/providers/repl_provider.js +64 -2
  105. package/build/providers/vinejs_provider.js +44 -3
  106. package/build/repl-C02Re0Yd.js +7 -0
  107. package/build/services/ace.js +11 -1
  108. package/build/services/app.js +2 -4
  109. package/build/services/config.js +7 -1
  110. package/build/services/dumper.js +13 -1
  111. package/build/services/emitter.js +8 -1
  112. package/build/services/encryption.js +8 -1
  113. package/build/services/hash.js +8 -1
  114. package/build/services/logger.js +8 -1
  115. package/build/services/repl.js +8 -1
  116. package/build/services/router.js +8 -1
  117. package/build/services/server.js +8 -1
  118. package/build/services/test_utils.js +11 -1
  119. package/build/services/url_builder.js +8 -1
  120. package/build/src/cli_formatters/routes_list.d.ts +7 -0
  121. package/build/src/exceptions.js +2 -1
  122. package/build/src/helpers/assert.js +1 -0
  123. package/build/src/helpers/http.js +1 -0
  124. package/build/src/helpers/is.js +24 -0
  125. package/build/src/helpers/main.js +2 -1
  126. package/build/src/helpers/string.js +2 -27
  127. package/build/src/helpers/types.js +18 -0
  128. package/build/src/helpers/verification_token.js +2 -45
  129. package/build/src/test_utils/main.js +9 -7
  130. package/build/src/types.js +1 -0
  131. package/build/src/vine.js +2 -32
  132. package/build/string-8_8He-HH.js +46 -0
  133. package/build/test_utils-DbJS_uEu.js +32 -0
  134. package/build/toolkit/main.js +13 -1
  135. package/build/types/ace.js +1 -0
  136. package/build/types/app.js +1 -0
  137. package/build/types/bodyparser.js +1 -0
  138. package/build/types/common.js +1 -0
  139. package/build/types/container.js +1 -0
  140. package/build/types/encryption.js +1 -0
  141. package/build/types/events.js +1 -0
  142. package/build/types/hash.js +1 -0
  143. package/build/types/health.js +1 -0
  144. package/build/types/helpers.js +1 -0
  145. package/build/types/http.js +1 -0
  146. package/build/types/logger.js +1 -0
  147. package/build/types/repl.js +1 -0
  148. package/build/types/transformers.js +1 -0
  149. package/build/utils-CKwka7OL.js +105 -0
  150. package/build/verification_token-WCrZtUgZ.js +108 -0
  151. package/build/vine-DkIupA3Z.js +97 -0
  152. package/package.json +12 -12
  153. package/build/config_provider-FIAUgvae.js +0 -13
  154. package/build/create_kernel-BD0Iqi8e.js +0 -3
  155. package/build/debug-CGQmxzGt.js +0 -3
  156. package/build/dumper-BBgqFX5a.js +0 -147
  157. package/build/main-Cxz0TyIw.js +0 -173
  158. package/build/main-DN2qEEg5.js +0 -41
  159. package/build/main-DkNgvceD.js +0 -52
  160. package/build/main-MBAMnmJb.js +0 -81
  161. package/build/utils-rRkbAPnP.js +0 -42
@@ -1,9 +1,51 @@
1
- import { t as debug_default } from "./debug-CGQmxzGt.js";
2
- import { t as configProvider } from "./config_provider-FIAUgvae.js";
3
- import { InvalidArgumentsException } from "./src/exceptions.js";
1
+ import { t as debug_default } from "./debug-DWofTfIX.js";
2
+ import { t as configProvider } from "./config_provider-Do9af1ze.js";
3
+ import { n as InvalidArgumentsException } from "./exceptions-B2MzIlHY.js";
4
+ //#region modules/encryption/define_config.ts
5
+ /**
6
+ * Defines the encryption configuration for the application.
7
+ *
8
+ * This function creates a configuration provider that lazily resolves
9
+ * encryption drivers. It validates that the default encryptor (if specified)
10
+ * exists in the list and resolves any ConfigProvider instances to their
11
+ * concrete values.
12
+ *
13
+ * @template KnownEncryptors - Record of encryptor names to their configurations
14
+ *
15
+ * @param config - The encryption configuration object
16
+ * @param config.default - Optional default encryptor name
17
+ * @param config.list - Map of encryptor names to their configurations or providers
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const encryptionConfig = defineConfig({
22
+ * default: 'app',
23
+ * list: {
24
+ * app: drivers.aes256gcm({
25
+ * id: 'app',
26
+ * keys: [env.get('APP_KEY')]
27
+ * }),
28
+ * backup: drivers.chacha20({
29
+ * id: 'backup',
30
+ * keys: [env.get('BACKUP_KEY')]
31
+ * })
32
+ * }
33
+ * })
34
+ * ```
35
+ */
4
36
  function defineConfig(config) {
37
+ /**
38
+ * Encryption list should always be provided
39
+ */
5
40
  if (!config.list) throw new InvalidArgumentsException("Missing \"list\" property in encryption config");
41
+ /**
42
+ * The default encryption should be mentioned in the list
43
+ */
6
44
  if (config.default && !config.list[config.default]) throw new InvalidArgumentsException(`Missing "list.${String(config.default)}" in encryption config. It is referenced by the "default" property`);
45
+ /**
46
+ * Config provider to lazily import drivers as they are used inside
47
+ * the user application
48
+ */
7
49
  return configProvider.create(async (app) => {
8
50
  debug_default("resolving encryption config");
9
51
  const encryptorsList = Object.keys(config.list);
@@ -19,6 +61,14 @@ function defineConfig(config) {
19
61
  };
20
62
  });
21
63
  }
64
+ /**
65
+ * Collection of encryption driver factory functions.
66
+ *
67
+ * Each driver factory creates a ConfigProvider that lazily imports
68
+ * and configures the corresponding encryption driver. This allows
69
+ * for efficient code splitting and on-demand loading of encryption
70
+ * algorithms.
71
+ */
22
72
  const drivers = {
23
73
  chacha20: (config) => {
24
74
  return configProvider.create(async () => {
@@ -83,4 +133,5 @@ const drivers = {
83
133
  });
84
134
  }
85
135
  };
136
+ //#endregion
86
137
  export { drivers as n, defineConfig as t };
@@ -0,0 +1,353 @@
1
+ import { t as __exportAll } from "./chunk-Do49iUES.js";
2
+ import { inspect } from "node:util";
3
+ import { Exception } from "@poppinss/utils/exception";
4
+ import useColors from "@poppinss/colors";
5
+ import { dump } from "@poppinss/dumper/console";
6
+ import { createScript, createStyleSheet, dump as dump$1 } from "@poppinss/dumper/html";
7
+ import { parse } from "error-stack-parser-es";
8
+ //#region modules/dumper/errors.ts
9
+ var errors_exports = /* @__PURE__ */ __exportAll({ E_DUMP_DIE_EXCEPTION: () => E_DUMP_DIE_EXCEPTION });
10
+ /**
11
+ * DumpDie exception raised by the "dd" (dump and die) function.
12
+ * This special exception terminates execution while dumping the provided
13
+ * value as HTML (during HTTP requests) or ANSI (in console/CLI).
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // This will dump the user object and terminate
18
+ * dumper.dd(user)
19
+ *
20
+ * // In HTTP context: sends HTML dump to browser
21
+ * // In CLI context: prints ANSI dump to console
22
+ * ```
23
+ */
24
+ var DumpDieException = class extends Exception {
25
+ static status = 500;
26
+ static code = "E_DUMP_DIE_EXCEPTION";
27
+ #dumper;
28
+ #traceSourceIndex = 1;
29
+ value;
30
+ constructor(value, dumper) {
31
+ super("Dump and Die exception");
32
+ this.#dumper = dumper;
33
+ this.value = value;
34
+ }
35
+ /**
36
+ * Returns the source file and line number location for the error
37
+ */
38
+ #getErrorSource() {
39
+ if (this.fileName && this.lineNumber) return {
40
+ location: this.fileName,
41
+ line: this.lineNumber
42
+ };
43
+ const source = parse(this)[this.#traceSourceIndex];
44
+ if (!source.fileName || !source.lineNumber) return;
45
+ return {
46
+ location: source.fileName,
47
+ line: source.lineNumber
48
+ };
49
+ }
50
+ /**
51
+ * Set the stack trace index for determining the source location.
52
+ * This is useful when building nested helpers on top of dump/die functionality.
53
+ *
54
+ * @param index - Stack trace index (0 = current function, 1 = caller, etc.)
55
+ */
56
+ setTraceSourceIndex(index) {
57
+ this.#traceSourceIndex = index;
58
+ return this;
59
+ }
60
+ /**
61
+ * Preventing itself from getting reported by the
62
+ * AdonisJS exception reporter
63
+ */
64
+ report() {}
65
+ /**
66
+ * HTTP exception handler that renders the dump as HTML output.
67
+ * This method is called automatically by AdonisJS when a DumpDieException
68
+ * is thrown during an HTTP request.
69
+ *
70
+ * @param error - The DumpDieException instance
71
+ * @param ctx - HTTP context for the current request
72
+ */
73
+ async handle(error, ctx) {
74
+ const source = this.#getErrorSource();
75
+ /**
76
+ * Comes from the shield package
77
+ */
78
+ const cspNonce = "nonce" in ctx.response ? ctx.response.nonce : void 0;
79
+ ctx.response.status(500).send(`<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">${this.#dumper.getHeadElements(cspNonce)}</head><body>${this.#dumper.dumpToHtml(error.value, {
80
+ cspNonce,
81
+ source,
82
+ title: "DUMP DIE"
83
+ })}</body></html>`);
84
+ }
85
+ /**
86
+ * Ace command exception handler that renders the dump as ANSI output.
87
+ * This method is called automatically by the Ace kernel when a DumpDieException
88
+ * is thrown during command execution.
89
+ *
90
+ * @param error - The DumpDieException instance
91
+ * @param kernel - Ace kernel instance
92
+ */
93
+ async render(error, kernel) {
94
+ const source = this.#getErrorSource();
95
+ kernel.ui.logger.log(this.#dumper.dumpToAnsi(error.value, {
96
+ source,
97
+ title: "DUMP DIE"
98
+ }));
99
+ }
100
+ /**
101
+ * Custom output for the Node.js util inspect
102
+ */
103
+ [inspect.custom]() {
104
+ const source = this.#getErrorSource();
105
+ return this.#dumper.dumpToAnsi(this.value, {
106
+ source,
107
+ title: "DUMP DIE"
108
+ });
109
+ }
110
+ };
111
+ const E_DUMP_DIE_EXCEPTION = DumpDieException;
112
+ //#endregion
113
+ //#region modules/dumper/dumper.ts
114
+ const colors = useColors.ansi();
115
+ const DUMP_TITLE_STYLES = `
116
+ .adonisjs-dump-header {
117
+ font-family: JetBrains Mono, monaspace argon, Menlo, Monaco, Consolas, monospace;
118
+ background: #ff1639;
119
+ border-radius: 4px;
120
+ color: #fff;
121
+ border-bottom-left-radius: 0;
122
+ border-bottom-right-radius: 0;
123
+ padding: 0.4rem 1.2rem;
124
+ font-size: 1em;
125
+ display: flex;
126
+ justify-content: space-between;
127
+ }
128
+ .adonisjs-dump-header .adonisjs-dump-header-title {
129
+ font-weight: bold;
130
+ text-transform: uppercase;
131
+ }
132
+ .adonisjs-dump-header .adonisjs-dump-header-source {
133
+ font-weight: bold;
134
+ color: inherit;
135
+ text-decoration: underline;
136
+ }
137
+ .dumper-dump pre {
138
+ border-radius: 4px;
139
+ border-top-left-radius: 0;
140
+ border-top-right-radius: 0;
141
+ }`;
142
+ const IDE = process.env.ADONIS_IDE ?? process.env.EDITOR ?? "";
143
+ /**
144
+ * Dumper exposes the API to dump or die/dump values in your
145
+ * AdonisJS application. An singleton instance of the Dumper
146
+ * is shared as a service and may use it follows.
147
+ *
148
+ * ```ts
149
+ * const dumper = container.make('dumper')
150
+ *
151
+ * dumper.configureHtmlOutput({
152
+ * // parser + html formatter config
153
+ * })
154
+ *
155
+ * dumper.configureAnsiOutput({
156
+ * // parser + console formatter config
157
+ * })
158
+ *
159
+ * const html = dumper.dumpToHtml(value)
160
+ * const ansi = dumper.dumpToAnsi(value)
161
+ *
162
+ * // Returns style and script tags that must be
163
+ * // injeted to the head of the HTML document
164
+ *
165
+ * const head = dumper.getHeadElements()
166
+ * ```
167
+ */
168
+ var Dumper = class {
169
+ #app;
170
+ /**
171
+ * Configuration for the HTML formatter
172
+ */
173
+ #htmlConfig = {};
174
+ /**
175
+ * Configuration for the Console formatter
176
+ */
177
+ #consoleConfig = { collapse: ["DateTime", "Date"] };
178
+ /**
179
+ * A collections of known editors to create URLs to open
180
+ * them
181
+ */
182
+ #editors = {
183
+ textmate: "txmt://open?url=file://%f&line=%l",
184
+ macvim: "mvim://open?url=file://%f&line=%l",
185
+ emacs: "emacs://open?url=file://%f&line=%l",
186
+ sublime: "subl://open?url=file://%f&line=%l",
187
+ phpstorm: "phpstorm://open?file=%f&line=%l",
188
+ atom: "atom://core/open/file?filename=%f&line=%l",
189
+ vscode: "vscode://file/%f:%l"
190
+ };
191
+ /**
192
+ * Creates a new Dumper instance
193
+ *
194
+ * @param app - The AdonisJS application instance
195
+ */
196
+ constructor(app) {
197
+ this.#app = app;
198
+ }
199
+ /**
200
+ * Returns the link to open the file using dd inside one
201
+ * of the known code editors. Constructs a URL that can be used
202
+ * to open the file at a specific line in supported editors.
203
+ *
204
+ * @param source - Optional source file information
205
+ * @param source.location - The file path to open
206
+ * @param source.line - The line number to jump to
207
+ */
208
+ #getEditorLink(source) {
209
+ const editorURL = this.#editors[IDE] || IDE;
210
+ if (!editorURL || !source) return;
211
+ return {
212
+ href: editorURL.replace("%f", source.location).replace("%l", String(source.line)),
213
+ text: `${this.#app.relativePath(source.location)}:${source.line}`
214
+ };
215
+ }
216
+ /**
217
+ * Configure the HTML formatter output options
218
+ *
219
+ * @param config - Configuration options for HTML dump formatting
220
+ *
221
+ * @example
222
+ * ```ts
223
+ * dumper.configureHtmlOutput({
224
+ * showHidden: true,
225
+ * depth: 5,
226
+ * colors: false
227
+ * })
228
+ * ```
229
+ */
230
+ configureHtmlOutput(config) {
231
+ this.#htmlConfig = config;
232
+ return this;
233
+ }
234
+ /**
235
+ * Configure the ANSI formatter output options for console display
236
+ *
237
+ * @param config - Configuration options for ANSI console formatting
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * dumper.configureAnsiOutput({
242
+ * showHidden: true,
243
+ * depth: 3,
244
+ * collapse: ['Date', 'DateTime']
245
+ * })
246
+ * ```
247
+ */
248
+ configureAnsiOutput(config) {
249
+ this.#consoleConfig = config;
250
+ return this;
251
+ }
252
+ /**
253
+ * Returns the style and script elements that need to be injected into
254
+ * the HTML document head for proper dump visualization
255
+ *
256
+ * @param cspNonce - Optional Content Security Policy nonce for inline scripts
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * const headElements = dumper.getHeadElements('abc123')
261
+ * // Insert into your HTML head section
262
+ * ```
263
+ */
264
+ getHeadElements(cspNonce) {
265
+ return `<style id="dumper-styles">` + createStyleSheet() + DUMP_TITLE_STYLES + `</style><script id="dumper-script"${cspNonce ? ` nonce="${cspNonce}"` : ""}>` + createScript() + "<\/script>";
266
+ }
267
+ /**
268
+ * Dump a value to formatted HTML output
269
+ *
270
+ * @param value - The value to dump and inspect
271
+ * @param options - Options for HTML output formatting
272
+ * @param options.cspNonce - Optional Content Security Policy nonce
273
+ * @param options.title - Optional title to display in the dump header
274
+ * @param options.source - Optional source file information for editor links
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * const htmlOutput = dumper.dumpToHtml(user, {
279
+ * title: 'User Object',
280
+ * source: { location: '/app/controllers/user.ts', line: 42 }
281
+ * })
282
+ * ```
283
+ */
284
+ dumpToHtml(value, options = {}) {
285
+ const link = this.#getEditorLink(options.source) ?? null;
286
+ return `<div class="adonisjs-dump-header"><span class="adonisjs-dump-header-title">${options.title || "DUMP"}</span>` + (link ? `<a href="${link.href}" class="adonisjs-dump-header-source">${link.text}</a>` : "") + "</div>" + dump$1(value, {
287
+ cspNonce: options.cspNonce,
288
+ ...this.#htmlConfig
289
+ });
290
+ }
291
+ /**
292
+ * Dump a value to formatted ANSI output for console display
293
+ *
294
+ * @param value - The value to dump and inspect
295
+ * @param options - Options for ANSI output formatting
296
+ * @param options.title - Optional title to display in the dump header
297
+ * @param options.source - Optional source file information for editor links
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * const ansiOutput = dumper.dumpToAnsi(user, {
302
+ * title: 'User Debug',
303
+ * source: { location: '/app/controllers/user.ts', line: 42 }
304
+ * })
305
+ * console.log(ansiOutput)
306
+ * ```
307
+ */
308
+ dumpToAnsi(value, options = {}) {
309
+ const columns = process.stdout.columns;
310
+ /**
311
+ * Link to the source file
312
+ */
313
+ const link = `${this.#getEditorLink(options.source)?.text ?? ""} `;
314
+ /**
315
+ * Dump title
316
+ */
317
+ const title = ` ${options.title || "DUMP"}`;
318
+ /**
319
+ * Whitespace between the title and the link to align them
320
+ * on each side of x axis
321
+ */
322
+ const whiteSpaceLength = columns ? columns - link.length - title.length - 4 : 2;
323
+ const whiteSpace = new Array(whiteSpaceLength <= 0 ? 2 : whiteSpaceLength).join(" ");
324
+ return `${colors.bgRed().bold(`${title}${whiteSpace}${link}`)}\n${dump(value, this.#consoleConfig)}`;
325
+ }
326
+ /**
327
+ * Dump values and die. This method dumps the provided value and then
328
+ * terminates the application. The output format is automatically chosen
329
+ * based on the execution context.
330
+ *
331
+ * - During an HTTP request, HTML output will be sent to the browser
332
+ * - Otherwise the value will be logged to the console in ANSI format
333
+ *
334
+ * @param value - The value to dump before terminating
335
+ * @param traceSourceIndex - Stack trace index for source location (default: 1)
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * // This will dump the user object and terminate the application
340
+ * dumper.dd(user)
341
+ *
342
+ * // This will never execute
343
+ * console.log('This line will not run')
344
+ * ```
345
+ */
346
+ dd(value, traceSourceIndex = 1) {
347
+ const error = new E_DUMP_DIE_EXCEPTION(value, this);
348
+ error.setTraceSourceIndex(traceSourceIndex);
349
+ throw error;
350
+ }
351
+ };
352
+ //#endregion
353
+ export { errors_exports as n, Dumper as t };
@@ -0,0 +1,57 @@
1
+ import { Template } from "edge.js";
2
+ //#region modules/dumper/plugins/edge.ts
3
+ /**
4
+ * Returns an edge plugin that integrates with a given
5
+ * dumper instance
6
+ */
7
+ function pluginEdgeDumper(dumper) {
8
+ Template.macro("dumper", dumper);
9
+ return (edge) => {
10
+ edge.registerTag({
11
+ tagName: "dump",
12
+ block: false,
13
+ seekable: true,
14
+ noNewLine: true,
15
+ compile(parser, buffer, token) {
16
+ const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
17
+ buffer.writeExpression(`template.stacks.pushOnceTo('dumper', 'dumper_globals', template.dumper.getHeadElements(state.cspNonce))`, token.filename, token.loc.start.line);
18
+ buffer.outputExpression(`template.dumper.dumpToHtml(${parser.utils.stringify(parsed)}, { cspNonce: state.cspNonce, source: { location: $filename, line: $lineNumber } })`, token.filename, token.loc.start.line, true);
19
+ }
20
+ });
21
+ edge.registerTag({
22
+ tagName: "dd",
23
+ block: false,
24
+ seekable: true,
25
+ noNewLine: true,
26
+ compile(parser, buffer, token) {
27
+ const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
28
+ /**
29
+ * Dump/Die statement to catch error and convert it into
30
+ * an Edge error
31
+ */
32
+ const ddStatement = [
33
+ "try {",
34
+ ` template.dumper.dd(${parser.utils.stringify(parsed)})`,
35
+ "} catch (error) {",
36
+ ` if (error.code === 'E_DUMP_DIE_EXCEPTION') {`,
37
+ " const edgeError = template.createError(error.message, $filename, $lineNumber)",
38
+ " error.fileName = $filename",
39
+ " error.lineNumber = $lineNumber",
40
+ " edgeError.handle = function (_, ctx) {",
41
+ " return error.handle(error, ctx)",
42
+ " }",
43
+ " edgeError.report = function () {",
44
+ " return error.report(error)",
45
+ " }",
46
+ " throw edgeError",
47
+ " }",
48
+ " throw error",
49
+ "}"
50
+ ].join("\n");
51
+ buffer.writeStatement(ddStatement, token.filename, token.loc.start.line);
52
+ }
53
+ });
54
+ };
55
+ }
56
+ //#endregion
57
+ export { pluginEdgeDumper as t };
@@ -1,8 +1,16 @@
1
- import { createError } from "./src/exceptions.js";
1
+ import { i as createError } from "./exceptions-B2MzIlHY.js";
2
2
  import { errors } from "@boringnode/encryption";
3
+ //#region modules/encryption/errors.ts
4
+ /**
5
+ * Raised when attempting to compute blind indexes using the legacy driver.
6
+ */
3
7
  const E_BLIND_INDEX_NOT_SUPPORTED = createError("Blind indexes are not supported by the \"%s\" encryption driver", "E_BLIND_INDEX_NOT_SUPPORTED");
8
+ /**
9
+ * Encryption errors exposed by this package.
10
+ */
4
11
  const errors$1 = {
5
12
  ...errors,
6
13
  E_BLIND_INDEX_NOT_SUPPORTED
7
14
  };
15
+ //#endregion
8
16
  export { errors$1 as n, E_BLIND_INDEX_NOT_SUPPORTED as t };
@@ -0,0 +1,7 @@
1
+ import { n as __reExport, t as __exportAll } from "./chunk-Do49iUES.js";
2
+ //#region modules/events.ts
3
+ var events_exports = /* @__PURE__ */ __exportAll({});
4
+ import * as import__adonisjs_events from "@adonisjs/events";
5
+ __reExport(events_exports, import__adonisjs_events);
6
+ //#endregion
7
+ export { events_exports as t };
@@ -0,0 +1,2 @@
1
+ import { Exception as Exception$1, InvalidArgumentsException as InvalidArgumentsException$1, RuntimeException as RuntimeException$1, createError } from "@poppinss/utils/exception";
2
+ export { createError as i, InvalidArgumentsException$1 as n, RuntimeException$1 as r, Exception$1 as t };
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/application/factories";
2
3
  export {};
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/bodyparser/factories";
2
3
  export {};
@@ -1,23 +1,17 @@
1
- import "../../chunk-iKc69rpz.js";
2
- import "../../debug-CGQmxzGt.js";
3
- import { t as Ignitor } from "../../main-Cxz0TyIw.js";
4
- import "../../config_provider-FIAUgvae.js";
5
- import "../../main-MBAMnmJb.js";
6
- import "../../main-DN2qEEg5.js";
7
- import "../../define_config-0oHaj43l.js";
8
- import "../../main-DkNgvceD.js";
9
- import { IgnitorFactory } from "./ignitor.js";
10
- import { t as createAceKernel } from "../../create_kernel-B7ILNhuP.js";
11
- var AceFactory = class {
12
- async make(ignitorOrAppRoot, options) {
13
- if (ignitorOrAppRoot instanceof Ignitor) {
14
- const app = ignitorOrAppRoot.createApp("console");
15
- await app.init();
16
- return createAceKernel(app);
17
- }
18
- const app = new IgnitorFactory().withCoreConfig().withCoreProviders().create(ignitorOrAppRoot, options).createApp("console");
19
- await app.init();
20
- return createAceKernel(app);
21
- }
22
- };
1
+ import "../../chunk-Do49iUES.js";
2
+ import "../../debug-DWofTfIX.js";
3
+ import "../../main-D1MSq4Uu.js";
4
+ import "../../app-CAuSGb2P.js";
5
+ import "../../app-BCcG_oDd.js";
6
+ import "../../config_provider-Do9af1ze.js";
7
+ import "../../main-CRnMnrH7.js";
8
+ import "../../logger-DIdZPHCe.js";
9
+ import "../../exceptions-B2MzIlHY.js";
10
+ import "../../main-Ck0GqLx4.js";
11
+ import "../../define_config--5euEdi8.js";
12
+ import "../../main-B50zECAi.js";
13
+ import "../../main-zxNP7iRl.js";
14
+ import "../../ignitor-Kym3gR-I.js";
15
+ import "../../create_kernel-D38-0Zbt.js";
16
+ import { t as AceFactory } from "../../ace-DBm6EcQ-.js";
23
17
  export { AceFactory };
@@ -1,74 +1,14 @@
1
- import "../../chunk-iKc69rpz.js";
2
- import "../../debug-CGQmxzGt.js";
3
- import { t as Ignitor } from "../../main-Cxz0TyIw.js";
4
- import "../../config_provider-FIAUgvae.js";
5
- import { t as logger_exports } from "../../modules/logger.js";
6
- import { t as main_exports } from "../../main-DN2qEEg5.js";
7
- import { n as drivers, t as defineConfig } from "../../define_config-0oHaj43l.js";
8
- import { n as defineConfig$1, r as drivers$1 } from "../../main-DkNgvceD.js";
9
- import { t as main_exports$1 } from "../../modules/bodyparser/main.js";
10
- var IgnitorFactory = class {
11
- #preloadActions = [];
12
- #parameters = {};
13
- #loadCoreProviders = false;
14
- preload(action) {
15
- this.#preloadActions.push(action);
16
- return this;
17
- }
18
- #mergeCoreProviders(providers) {
19
- return [
20
- () => import("@adonisjs/core/providers/app_provider"),
21
- () => import("@adonisjs/core/providers/hash_provider"),
22
- () => import("@adonisjs/core/providers/repl_provider")
23
- ].concat(providers || []);
24
- }
25
- merge(params) {
26
- if (params.config) this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
27
- if (params.rcFileContents) this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
28
- return this;
29
- }
30
- withCoreProviders() {
31
- this.#loadCoreProviders = true;
32
- return this;
33
- }
34
- withCoreConfig() {
35
- this.merge({ config: {
36
- app: {
37
- appUrl: "http://localhost:3333",
38
- http: (0, main_exports.defineConfig)({})
39
- },
40
- validator: {},
41
- encryption: defineConfig({
42
- default: "gcm",
43
- list: { gcm: drivers.aes256gcm({
44
- id: "gcm",
45
- keys: ["averylongrandomsecretkey"]
46
- }) }
47
- }),
48
- bodyparser: (0, main_exports$1.defineConfig)({}),
49
- hash: defineConfig$1({
50
- default: "scrypt",
51
- list: { scrypt: drivers$1.scrypt({}) }
52
- }),
53
- logger: (0, logger_exports.defineConfig)({
54
- default: "app",
55
- loggers: { app: {} }
56
- })
57
- } });
58
- return this;
59
- }
60
- create(appRoot, options) {
61
- return new Ignitor(appRoot, options).tap((app) => {
62
- app.booted(async () => {
63
- for (let action of this.#preloadActions) await action(app);
64
- });
65
- if (this.#loadCoreProviders) {
66
- this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
67
- this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
68
- }
69
- this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
70
- this.#parameters.config && app.useConfig(this.#parameters.config);
71
- });
72
- }
73
- };
1
+ import "../../chunk-Do49iUES.js";
2
+ import "../../debug-DWofTfIX.js";
3
+ import "../../main-D1MSq4Uu.js";
4
+ import "../../app-CAuSGb2P.js";
5
+ import "../../app-BCcG_oDd.js";
6
+ import "../../config_provider-Do9af1ze.js";
7
+ import "../../logger-DIdZPHCe.js";
8
+ import "../../exceptions-B2MzIlHY.js";
9
+ import "../../main-Ck0GqLx4.js";
10
+ import "../../define_config--5euEdi8.js";
11
+ import "../../main-B50zECAi.js";
12
+ import "../../main-zxNP7iRl.js";
13
+ import { t as IgnitorFactory } from "../../ignitor-Kym3gR-I.js";
74
14
  export { IgnitorFactory };