diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec1..00000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index 72e16c61..00000000 --- a/.husky/commit-msg +++ /dev/null @@ -1 +0,0 @@ -npx --no -- commitlint --edit diff --git a/commands/make/controller.ts b/commands/make/controller.ts index 920e5d12..5968988a 100644 --- a/commands/make/controller.ts +++ b/commands/make/controller.ts @@ -10,6 +10,7 @@ import string from '@poppinss/utils/string' import { stubsRoot } from '../../stubs/main.js' import { args, flags, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * The make controller command to create an HTTP controller @@ -18,6 +19,10 @@ export default class MakeController extends BaseCommand { static commandName = 'make:controller' static description = 'Create a new HTTP controller class' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'The name of the controller' }) declare name: string diff --git a/commands/make/event.ts b/commands/make/event.ts index 8a2055f1..82dc97dd 100644 --- a/commands/make/event.ts +++ b/commands/make/event.ts @@ -9,6 +9,7 @@ import { stubsRoot } from '../../stubs/main.js' import { args, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * The make event command to create a class based event @@ -17,6 +18,10 @@ export default class MakeEvent extends BaseCommand { static commandName = 'make:event' static description = 'Create a new event class' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the event' }) declare name: string diff --git a/commands/make/exception.ts b/commands/make/exception.ts index 838c1587..dfa006c5 100644 --- a/commands/make/exception.ts +++ b/commands/make/exception.ts @@ -9,6 +9,7 @@ import { stubsRoot } from '../../stubs/main.js' import { args, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * Make a new exception class @@ -17,6 +18,10 @@ export default class MakeException extends BaseCommand { static commandName = 'make:exception' static description = 'Create a new custom exception class' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the exception' }) declare name: string diff --git a/commands/make/listener.ts b/commands/make/listener.ts index 47a4665e..fb8de2ab 100644 --- a/commands/make/listener.ts +++ b/commands/make/listener.ts @@ -9,6 +9,7 @@ import { stubsRoot } from '../../stubs/main.js' import { args, flags, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * The make listener command to create a class based event @@ -18,6 +19,10 @@ export default class MakeListener extends BaseCommand { static commandName = 'make:listener' static description = 'Create a new event listener class' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the event listener' }) declare name: string diff --git a/commands/make/middleware.ts b/commands/make/middleware.ts index 20f0497b..a51676e7 100644 --- a/commands/make/middleware.ts +++ b/commands/make/middleware.ts @@ -13,6 +13,7 @@ import { basename, extname, relative } from 'node:path' import { stubsRoot } from '../../stubs/main.js' import { args, BaseCommand, flags } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * The make middleware command to create a new middleware @@ -22,6 +23,10 @@ export default class MakeMiddleware extends BaseCommand { static commandName = 'make:middleware' static description = 'Create a new middleware class for HTTP requests' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the middleware' }) declare name: string diff --git a/commands/make/service.ts b/commands/make/service.ts index 4cdbb909..e730c5d0 100644 --- a/commands/make/service.ts +++ b/commands/make/service.ts @@ -9,6 +9,7 @@ import { stubsRoot } from '../../stubs/main.js' import { args, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * Make a new service class @@ -17,6 +18,10 @@ export default class MakeService extends BaseCommand { static commandName = 'make:service' static description = 'Create a new service class' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the service' }) declare name: string diff --git a/commands/make/validator.ts b/commands/make/validator.ts index be40eaa0..30a0c47f 100644 --- a/commands/make/validator.ts +++ b/commands/make/validator.ts @@ -9,6 +9,7 @@ import { stubsRoot } from '../../stubs/main.js' import { args, flags, BaseCommand } from '../../modules/ace/main.js' +import { CommandOptions } from '../../types/ace.js' /** * Make a new VineJS validator @@ -17,6 +18,10 @@ export default class MakeValidator extends BaseCommand { static commandName = 'make:validator' static description = 'Create a new file to define VineJS validators' + static options: CommandOptions = { + allowUnknownFlags: true, + } + @args.string({ description: 'Name of the validator file' }) declare name: string diff --git a/modules/http/request_validator.ts b/modules/http/request_validator.ts index abdad6a8..2b004040 100644 --- a/modules/http/request_validator.ts +++ b/modules/http/request_validator.ts @@ -16,6 +16,8 @@ import type { } from '@vinejs/vine/types' import type { HttpContext } from './main.js' +import type { FeatureFlags } from '../app.js' +import type { ExperimentalFlagsList } from '../../types/app.js' import type { RequestValidationOptions } from '../../types/http.js' /** @@ -25,9 +27,11 @@ import type { RequestValidationOptions } from '../../types/http.js' */ export class RequestValidator { #ctx: HttpContext + #experimentalFlags?: FeatureFlags - constructor(ctx: HttpContext) { + constructor(ctx: HttpContext, experimentalFlags?: FeatureFlags) { this.#ctx = ctx + this.#experimentalFlags = experimentalFlags } /** @@ -75,12 +79,18 @@ export class RequestValidator { validatorOptions.messagesProvider = RequestValidator.messagesProvider(this.#ctx) } + const requestBody = this.#experimentalFlags?.enabled('mergeMultipartFieldsAndFiles') + ? this.#ctx.request.all() + : { + ...this.#ctx.request.all(), + ...this.#ctx.request.allFiles(), + } + /** * Data to validate */ const data = validatorOptions.data || { - ...this.#ctx.request.all(), - ...this.#ctx.request.allFiles(), + ...requestBody, params: this.#ctx.request.params(), headers: this.#ctx.request.headers(), cookies: this.#ctx.request.cookiesList(), diff --git a/package.json b/package.json index 51556c67..3ed02f92 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@adonisjs/core", "description": "Core of AdonisJS", - "version": "6.17.2", + "version": "6.18.0", "engines": { "node": ">=20.6.0" }, @@ -67,7 +67,6 @@ "clean": "del-cli build", "copy:templates": "copyfiles \"stubs/**/**/*.stub\" build", "precompile": "npm run lint", - "prepare": "husky", "compile": "npm run clean && tsc", "postcompile": "npm run copy:templates && npm run index:commands", "build": "npm run compile", @@ -84,64 +83,60 @@ "devDependencies": { "@adonisjs/assembler": "^7.8.2", "@adonisjs/eslint-config": "^2.0.0", - "@adonisjs/prettier-config": "^1.4.0", + "@adonisjs/prettier-config": "^1.4.4", "@adonisjs/tsconfig": "^1.4.0", - "@commitlint/cli": "^19.7.1", - "@commitlint/config-conventional": "^19.7.1", "@japa/assert": "^4.0.1", "@japa/expect-type": "^2.0.3", "@japa/file-system": "^2.3.2", "@japa/runner": "^4.2.0", "@japa/snapshot": "^2.0.8", - "@release-it/conventional-changelog": "^10.0.0", + "@release-it/conventional-changelog": "^10.0.1", "@swc/core": "1.10.7", - "@types/node": "^22.13.2", + "@types/node": "^22.15.18", "@types/pretty-hrtime": "^1.0.3", - "@types/sinon": "^17.0.3", - "@types/supertest": "^6.0.2", + "@types/sinon": "^17.0.4", + "@types/supertest": "^6.0.3", "@types/test-console": "^2.0.3", - "@vinejs/vine": "^3.0.0", - "argon2": "^0.41.1", - "bcrypt": "^5.1.1", + "@vinejs/vine": "^3.0.1", + "argon2": "^0.43.0", + "bcrypt": "^6.0.0", "c8": "^10.1.3", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", "del-cli": "^6.0.0", "edge.js": "^6.2.1", - "eslint": "^9.20.1", - "execa": "^9.5.2", + "eslint": "^9.26.0", + "execa": "^9.5.3", "get-port": "^7.1.0", - "github-label-sync": "^2.3.1", - "husky": "^9.1.7", - "prettier": "^3.5.0", - "release-it": "^18.1.2", - "sinon": "^19.0.2", - "supertest": "^7.0.0", + "prettier": "^3.5.3", + "release-it": "^19.0.2", + "sinon": "^20.0.0", + "supertest": "^7.1.1", "test-console": "^2.0.0", "timekeeper": "^2.3.1", "ts-node-maintained": "^10.9.5", - "typescript": "^5.7.3" + "typescript": "^5.8.3" }, "dependencies": { "@adonisjs/ace": "^13.3.0", - "@adonisjs/application": "^8.3.1", - "@adonisjs/bodyparser": "^10.0.3", + "@adonisjs/application": "^8.4.1", + "@adonisjs/bodyparser": "^10.1.0", "@adonisjs/config": "^5.0.2", "@adonisjs/encryption": "^6.0.2", - "@adonisjs/env": "^6.1.1", + "@adonisjs/env": "^6.2.0", "@adonisjs/events": "^9.0.2", "@adonisjs/fold": "^10.1.3", - "@adonisjs/hash": "^9.0.5", + "@adonisjs/hash": "^9.1.1", "@adonisjs/health": "^2.0.0", - "@adonisjs/http-server": "^7.4.0", - "@adonisjs/logger": "^6.0.5", + "@adonisjs/http-server": "^7.6.1", + "@adonisjs/logger": "^6.0.6", "@adonisjs/repl": "^4.1.0", - "@antfu/install-pkg": "^1.0.0", + "@antfu/install-pkg": "^1.1.0", "@paralleldrive/cuid2": "^2.2.2", "@poppinss/colors": "^4.1.4", - "@poppinss/dumper": "^0.6.2", + "@poppinss/dumper": "^0.6.3", "@poppinss/macroable": "^1.0.4", - "@poppinss/utils": "^6.9.2", + "@poppinss/utils": "^6.9.3", "@sindresorhus/is": "^7.0.1", "@types/he": "^1.2.3", "error-stack-parser-es": "^1.0.5", @@ -155,8 +150,8 @@ "peerDependencies": { "@adonisjs/assembler": "^7.8.0", "@vinejs/vine": "^2.1.0 || ^3.0.0", - "argon2": "^0.31.2 || ^0.41.0", - "bcrypt": "^5.1.1", + "argon2": "^0.31.2 || ^0.41.0 || ^0.43.0", + "bcrypt": "^5.1.1 || ^6.0.0", "edge.js": "^6.2.0" }, "peerDependenciesMeta": { diff --git a/providers/app_provider.ts b/providers/app_provider.ts index 59275942..656085cb 100644 --- a/providers/app_provider.ts +++ b/providers/app_provider.ts @@ -135,7 +135,7 @@ export default class AppServiceProvider { protected registerBodyParserMiddleware() { this.app.container.bind(BodyParserMiddleware, () => { const config = this.app.config.get('bodyparser') - return new BodyParserMiddleware(config) + return new BodyParserMiddleware(config, this.app.experimentalFlags) }) } diff --git a/providers/vinejs_provider.ts b/providers/vinejs_provider.ts index 4ca0e881..f1200f32 100644 --- a/providers/vinejs_provider.ts +++ b/providers/vinejs_provider.ts @@ -129,6 +129,8 @@ export default class VineJSServiceProvider { } boot() { + const experimentalFlags = this.app.experimentalFlags + /** * The file method is used to validate a field to be a valid * multipart file. @@ -142,7 +144,7 @@ export default class VineJSServiceProvider { * data for the current request using VineJS validators */ Request.macro('validateUsing', function (this: Request, ...args) { - return new RequestValidator(this.ctx!).validateUsing(...args) + return new RequestValidator(this.ctx!, experimentalFlags).validateUsing(...args) }) } }