@adonisjs/core 6.11.0 → 6.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { CommandOptions } from '../types/ace.js';
2
2
  import { BaseCommand } from '../modules/ace/main.js';
3
+ declare const KNOWN_PACKAGE_MANAGERS: readonly ["npm", "pnpm", "bun", "yarn", "yarn@berry", "pnpm@6"];
3
4
  /**
4
5
  * The install command is used to `npm install` and `node ace configure` a new package
5
6
  * in one go.
@@ -11,7 +12,7 @@ export default class Add extends BaseCommand {
11
12
  static options: CommandOptions;
12
13
  name: string;
13
14
  verbose?: boolean;
14
- packageManager?: 'npm' | 'pnpm' | 'yarn' | 'yarn@berry';
15
+ packageManager?: (typeof KNOWN_PACKAGE_MANAGERS)[number];
15
16
  dev?: boolean;
16
17
  force?: boolean;
17
18
  /**
@@ -19,3 +20,4 @@ export default class Add extends BaseCommand {
19
20
  */
20
21
  run(): Promise<void>;
21
22
  }
23
+ export {};
@@ -14,6 +14,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
14
14
  };
15
15
  import { detectPackageManager, installPackage } from '@antfu/install-pkg';
16
16
  import { args, BaseCommand, flags } from '../modules/ace/main.js';
17
+ const KNOWN_PACKAGE_MANAGERS = ['npm', 'pnpm', 'bun', 'yarn', 'yarn@berry', 'pnpm@6'];
17
18
  /**
18
19
  * The install command is used to `npm install` and `node ace configure` a new package
19
20
  * in one go.
@@ -29,10 +30,10 @@ export default class Add extends BaseCommand {
29
30
  */
30
31
  async #getPackageManager() {
31
32
  const pkgManager = this.packageManager || (await detectPackageManager(this.app.makePath())) || 'npm';
32
- if (['npm', 'pnpm', 'yarn', 'yarn@berry'].includes(pkgManager)) {
33
+ if (KNOWN_PACKAGE_MANAGERS.includes(pkgManager)) {
33
34
  return pkgManager;
34
35
  }
35
- throw new Error('Invalid package manager. Must be one of npm, pnpm or yarn');
36
+ throw new Error('Invalid package manager. Must be one of npm, pnpm, bun or yarn');
36
37
  }
37
38
  /**
38
39
  * Configure the package by delegating the work to the `node ace configure` command
@@ -79,6 +79,10 @@ export default class Configure extends BaseCommand {
79
79
  flags: this.parsed.flags,
80
80
  entity: this.app.generators.createEntity('health'),
81
81
  });
82
+ await codemods.makeUsingStub(stubsRoot, 'make/health/controller.stub', {
83
+ flags: this.parsed.flags,
84
+ entity: this.app.generators.createEntity('health_checks'),
85
+ });
82
86
  }
83
87
  /**
84
88
  * Creates codemods as per configure command options
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { Ignitor } from '../../src/ignitor/main.js';
3
2
  import type { IgnitorOptions } from '../../src/types.js';
4
3
  import type { Kernel } from '../../modules/ace/kernel.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { Ignitor } from '../../src/ignitor/main.js';
3
2
  import type { ApplicationService, IgnitorOptions } from '../../src/types.js';
4
3
  type FactoryParameters = {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { Ignitor } from '../../index.js';
3
2
  import type { IgnitorOptions } from '../../src/types.js';
4
3
  import { TestUtils } from '../../src/test_utils/main.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { EventEmitter } from 'node:events';
3
2
  import type { UIPrimitives } from '@adonisjs/ace/types';
4
3
  import type { CodeTransformer } from '@adonisjs/assembler/code_transformer';
@@ -57,7 +57,7 @@ export declare class RoutesListFormatter {
57
57
  */
58
58
  formatAsAnsiTable(): Promise<{
59
59
  heading: string;
60
- table: ReturnType<UIPrimitives['table']>;
60
+ table: ReturnType<UIPrimitives["table"]>;
61
61
  }[]>;
62
62
  }
63
63
  export {};
@@ -4,6 +4,6 @@ import { ApplicationService, ConfigProvider } from './types.js';
4
4
  * them
5
5
  */
6
6
  export declare const configProvider: {
7
- create<T>(resolver: ConfigProvider<T>['resolver']): ConfigProvider<T>;
8
- resolve<T_1>(app: ApplicationService, provider: unknown): Promise<T_1 | null>;
7
+ create<T>(resolver: ConfigProvider<T>["resolver"]): ConfigProvider<T>;
8
+ resolve<T>(app: ApplicationService, provider: unknown): Promise<T | null>;
9
9
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  declare const _default: import("util").DebugLogger;
3
2
  export default _default;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import type { Server as NodeHttpsServer } from 'node:https';
4
2
  import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
5
3
  import { Ignitor } from './main.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { AceProcess } from './ace.js';
3
2
  import { TestRunnerProcess } from './test.js';
4
3
  import { HttpServerProcess } from './http.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import type { TestUtils } from './main.js';
4
2
  import type { Server as NodeHttpsServer } from 'node:https';
5
3
  import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import Macroable from '@poppinss/macroable';
3
2
  import { IncomingMessage, ServerResponse } from 'node:http';
4
3
  import { HttpServerUtils } from './http.js';
@@ -0,0 +1,21 @@
1
+ {{#var controllerName = generators.controllerName(entity.name, false)}}
2
+ {{#var controllerFileName = generators.controllerFileName(entity.name, false)}}
3
+ {{{
4
+ exports({
5
+ to: app.httpControllersPath(entity.path, controllerFileName)
6
+ })
7
+ }}}
8
+ import { healthChecks } from '#start/health'
9
+ import type { HttpContext } from '@adonisjs/core/http'
10
+
11
+ export default class {{ controllerName }} {
12
+ async handle({ response }: HttpContext) {
13
+ const report = await healthChecks.run()
14
+
15
+ if (report.isHealthy) {
16
+ return response.ok(report)
17
+ }
18
+
19
+ return response.serviceUnavailable(report)
20
+ }
21
+ }
@@ -4,13 +4,9 @@
4
4
  to: app.startPath(entity.path, preloadFileName)
5
5
  })
6
6
  }}}
7
- import {
8
- HealthChecks,
9
- DiskSpaceHealthCheck,
10
- MemoryHeapHealthCheck,
11
- } from '@adonisjs/core/health'
7
+ import { HealthChecks, DiskSpaceCheck, MemoryHeapCheck } from '@adonisjs/core/health'
12
8
 
13
9
  export const healthChecks = new HealthChecks().register([
14
- new DiskSpaceHealthCheck(),
15
- new MemoryHeapHealthCheck(),
10
+ new DiskSpaceCheck(),
11
+ new MemoryHeapCheck(),
16
12
  ])
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/core",
3
3
  "description": "Core of AdonisJS",
4
- "version": "6.11.0",
4
+ "version": "6.12.1",
5
5
  "engines": {
6
6
  "node": ">=20.6.0"
7
7
  },
@@ -91,8 +91,8 @@
91
91
  "@japa/expect-type": "^2.0.2",
92
92
  "@japa/file-system": "^2.3.0",
93
93
  "@japa/runner": "^3.1.4",
94
- "@swc/core": "^1.6.0",
95
- "@types/node": "^20.14.2",
94
+ "@swc/core": "^1.6.5",
95
+ "@types/node": "^20.14.7",
96
96
  "@types/pretty-hrtime": "^1.0.3",
97
97
  "@types/sinon": "^17.0.3",
98
98
  "@types/supertest": "^6.0.2",
@@ -106,20 +106,20 @@
106
106
  "del-cli": "^5.1.0",
107
107
  "edge.js": "^6.0.2",
108
108
  "eslint": "^8.57.0",
109
- "execa": "^9.2.0",
109
+ "execa": "^9.3.0",
110
110
  "get-port": "^7.1.0",
111
111
  "github-label-sync": "^2.3.1",
112
112
  "husky": "^9.0.11",
113
113
  "prettier": "^3.3.2",
114
- "release-it": "^17.3.0",
114
+ "release-it": "^17.4.0",
115
115
  "sinon": "^18.0.0",
116
116
  "supertest": "^7.0.0",
117
117
  "test-console": "^2.0.0",
118
118
  "ts-node": "^10.9.2",
119
- "typescript": "^5.4.5"
119
+ "typescript": "^5.5.2"
120
120
  },
121
121
  "dependencies": {
122
- "@adonisjs/ace": "^13.0.1",
122
+ "@adonisjs/ace": "^13.1.0",
123
123
  "@adonisjs/application": "^8.3.1",
124
124
  "@adonisjs/bodyparser": "^10.0.2",
125
125
  "@adonisjs/config": "^5.0.2",
@@ -128,7 +128,7 @@
128
128
  "@adonisjs/events": "^9.0.2",
129
129
  "@adonisjs/fold": "^10.1.2",
130
130
  "@adonisjs/hash": "^9.0.3",
131
- "@adonisjs/health": "^1.1.0",
131
+ "@adonisjs/health": "^2.0.0",
132
132
  "@adonisjs/http-server": "^7.2.3",
133
133
  "@adonisjs/logger": "^6.0.3",
134
134
  "@adonisjs/repl": "^4.0.1",
@@ -203,6 +203,9 @@
203
203
  "tagAnnotation": "v${version}",
204
204
  "tagName": "v${version}"
205
205
  },
206
+ "hooks": {
207
+ "after:init": "npm test"
208
+ },
206
209
  "github": {
207
210
  "release": true,
208
211
  "releaseName": "v${version}",