@h3ravel/foundation 2.0.1 → 2.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.
- package/dist/index.d.ts +47 -3
- package/dist/index.js +76 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1771,6 +1771,50 @@ declare class BuildCommand extends Command {
|
|
|
1771
1771
|
}>>;
|
|
1772
1772
|
}
|
|
1773
1773
|
//#endregion
|
|
1774
|
+
//#region src/Console/Commands/DevCommand.d.ts
|
|
1775
|
+
declare class DevCommand extends Command {
|
|
1776
|
+
/**
|
|
1777
|
+
* The name and signature of the console command.
|
|
1778
|
+
*
|
|
1779
|
+
* @var string
|
|
1780
|
+
*/
|
|
1781
|
+
protected signature: string;
|
|
1782
|
+
/**
|
|
1783
|
+
* The console command description.
|
|
1784
|
+
*
|
|
1785
|
+
* @var string
|
|
1786
|
+
*/
|
|
1787
|
+
protected description: string;
|
|
1788
|
+
handle(): Promise<void>;
|
|
1789
|
+
/**
|
|
1790
|
+
* Build output for developement
|
|
1791
|
+
*
|
|
1792
|
+
* @param param0
|
|
1793
|
+
* @returns
|
|
1794
|
+
*/
|
|
1795
|
+
static dev({
|
|
1796
|
+
debug,
|
|
1797
|
+
minify,
|
|
1798
|
+
verbosity
|
|
1799
|
+
}?: {
|
|
1800
|
+
debug: boolean;
|
|
1801
|
+
minify: boolean;
|
|
1802
|
+
verbosity: number;
|
|
1803
|
+
}): Promise<import("execa").Result<{
|
|
1804
|
+
stdout: "inherit";
|
|
1805
|
+
stderr: "inherit";
|
|
1806
|
+
cwd: any;
|
|
1807
|
+
env: NodeJS.ProcessEnv & {
|
|
1808
|
+
EXTENDED_DEBUG: string;
|
|
1809
|
+
CLI_BUILD: string;
|
|
1810
|
+
NODE_ENV: string;
|
|
1811
|
+
DIST_DIR: string;
|
|
1812
|
+
DIST_MINIFY: boolean;
|
|
1813
|
+
LOG_LEVEL: string;
|
|
1814
|
+
};
|
|
1815
|
+
}>>;
|
|
1816
|
+
}
|
|
1817
|
+
//#endregion
|
|
1774
1818
|
//#region src/Console/Commands/KeyGenerateCommand.d.ts
|
|
1775
1819
|
declare class KeyGenerateCommand extends Command {
|
|
1776
1820
|
/**
|
|
@@ -1898,7 +1942,7 @@ declare abstract class Handler extends IExceptionHandler {
|
|
|
1898
1942
|
/**
|
|
1899
1943
|
* A map of exceptions with their corresponding custom log levels.
|
|
1900
1944
|
*/
|
|
1901
|
-
protected levels: Map<string | Error, "
|
|
1945
|
+
protected levels: Map<string | Error, "debug" | "info" | "warn" | "error" | "log">;
|
|
1902
1946
|
/**
|
|
1903
1947
|
* Internal exceptions that are not reported by default. Subclasses may expand.
|
|
1904
1948
|
*/
|
|
@@ -2298,7 +2342,7 @@ declare class HttpException extends Error {
|
|
|
2298
2342
|
protected headers: Record<string, string>;
|
|
2299
2343
|
code: number;
|
|
2300
2344
|
constructor(statusCode: number, message?: string, previous?: Error | undefined, headers?: Record<string, string>, code?: number);
|
|
2301
|
-
static fromStatusCode(statusCode: number, message?: string, previous?: Error, headers?: Record<string, string>, code?: number):
|
|
2345
|
+
static fromStatusCode(statusCode: number, message?: string, previous?: Error, headers?: Record<string, string>, code?: number): GoneHttpException | AccessDeniedHttpException | BadRequestHttpException | ConflictHttpException | UnsupportedMediaTypeHttpException | NotFoundHttpException | PreconditionFailedHttpException | NotAcceptableHttpException | LockedHttpException | LengthRequiredHttpException | ServiceUnavailableHttpException | PreconditionRequiredHttpException | TooManyRequestsHttpException | HttpException | UnprocessableEntityHttpException;
|
|
2302
2346
|
getStatusCode(): number;
|
|
2303
2347
|
getHeaders(): Record<string, string>;
|
|
2304
2348
|
setHeaders(headers: Record<string, string>): void;
|
|
@@ -2339,4 +2383,4 @@ declare class RequestHandled {
|
|
|
2339
2383
|
constructor(request: IRequest, response?: IResponse);
|
|
2340
2384
|
}
|
|
2341
2385
|
//#endregion
|
|
2342
|
-
export { AccessDeniedHttpException, AppBuilder, BadRequestHttpException, BindingResolutionException, BootProviders, BuildCommand, CommandNotFoundException, ConfigException, ConflictHttpException, ConsoleKernel, CustomDiskConfig, CustomDiskDriverRegistry, DiskConfig, DriverConfig, ExceptionHandler, Exceptions, FileLike, FilesystemConfig, FtpDiskDriverConfig, GcsDiskDriverConfig, GoneHttpException, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Handler, Helpers, HttpException, HttpExceptionFactory, IFilesystemDriver, IFilesystemManager, IFtpDiskDriver, InMemoryRateLimiter, Inject, Injectable, Kernel, KeyGenerateCommand, KnownDisks, LengthRequiredHttpException, LocalDiskDriverConfig, LockedHttpException, LogicException, MakeCommand, Middleware, MiddlewareHandler, ModelNotFoundException, NotAcceptableHttpException, NotFoundHttpException, PostinstallCommand, PreconditionFailedHttpException, PreconditionRequiredHttpException, RecordNotFoundException, RecordsNotFoundException, RegisterFacades, RequestException, RequestHandled, ResponseCodes, RouteNotFoundException, S3DiskDriverConfig, ServiceUnavailableHttpException, Terminating, TestApplication, TestClient, TooManyRequestsHttpException, TsDownConfig, UnprocessableEntityHttpException, UnsupportedMediaTypeHttpException, UrlGenerationException, altLogo, logo, statusTexts, testApp };
|
|
2386
|
+
export { AccessDeniedHttpException, AppBuilder, BadRequestHttpException, BindingResolutionException, BootProviders, BuildCommand, CommandNotFoundException, ConfigException, ConflictHttpException, ConsoleKernel, CustomDiskConfig, CustomDiskDriverRegistry, DevCommand, DiskConfig, DriverConfig, ExceptionHandler, Exceptions, FileLike, FilesystemConfig, FtpDiskDriverConfig, GcsDiskDriverConfig, GoneHttpException, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Handler, Helpers, HttpException, HttpExceptionFactory, IFilesystemDriver, IFilesystemManager, IFtpDiskDriver, InMemoryRateLimiter, Inject, Injectable, Kernel, KeyGenerateCommand, KnownDisks, LengthRequiredHttpException, LocalDiskDriverConfig, LockedHttpException, LogicException, MakeCommand, Middleware, MiddlewareHandler, ModelNotFoundException, NotAcceptableHttpException, NotFoundHttpException, PostinstallCommand, PreconditionFailedHttpException, PreconditionRequiredHttpException, RecordNotFoundException, RecordsNotFoundException, RegisterFacades, RequestException, RequestHandled, ResponseCodes, RouteNotFoundException, S3DiskDriverConfig, ServiceUnavailableHttpException, Terminating, TestApplication, TestClient, TooManyRequestsHttpException, TsDownConfig, UnprocessableEntityHttpException, UnsupportedMediaTypeHttpException, UrlGenerationException, altLogo, logo, statusTexts, testApp };
|
package/dist/index.js
CHANGED
|
@@ -937,6 +937,80 @@ var BuildCommand = class BuildCommand extends Command {
|
|
|
937
937
|
}
|
|
938
938
|
};
|
|
939
939
|
//#endregion
|
|
940
|
+
//#region src/Console/Commands/DevCommand.ts
|
|
941
|
+
var DevCommand = class DevCommand extends Command {
|
|
942
|
+
/**
|
|
943
|
+
* The name and signature of the console command.
|
|
944
|
+
*
|
|
945
|
+
* @var string
|
|
946
|
+
*/
|
|
947
|
+
signature = `dev
|
|
948
|
+
{--m|minify : Minify your bundle output}
|
|
949
|
+
`;
|
|
950
|
+
/**
|
|
951
|
+
* The console command description.
|
|
952
|
+
*
|
|
953
|
+
* @var string
|
|
954
|
+
*/
|
|
955
|
+
description = "Build the app for production";
|
|
956
|
+
async handle() {
|
|
957
|
+
const minify = this.option("minify");
|
|
958
|
+
const verbosity = this.getVerbosity();
|
|
959
|
+
const debug = verbosity > 0;
|
|
960
|
+
try {
|
|
961
|
+
this.newLine();
|
|
962
|
+
await DevCommand.dev({
|
|
963
|
+
minify,
|
|
964
|
+
verbosity,
|
|
965
|
+
debug
|
|
966
|
+
});
|
|
967
|
+
this.newLine();
|
|
968
|
+
} catch (e) {
|
|
969
|
+
Logger.error(e);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Build output for developement
|
|
974
|
+
*
|
|
975
|
+
* @param param0
|
|
976
|
+
* @returns
|
|
977
|
+
*/
|
|
978
|
+
static async dev({ debug, minify, verbosity } = {
|
|
979
|
+
debug: false,
|
|
980
|
+
minify: false,
|
|
981
|
+
verbosity: 0
|
|
982
|
+
}) {
|
|
983
|
+
const pm = (await preferredPM(base_path()))?.name ?? "pnpm";
|
|
984
|
+
const ENV_VARS = {
|
|
985
|
+
EXTENDED_DEBUG: debug ? "true" : "false",
|
|
986
|
+
CLI_BUILD: "false",
|
|
987
|
+
NODE_ENV: "development",
|
|
988
|
+
DIST_DIR: ".h3ravel/serve",
|
|
989
|
+
DIST_MINIFY: minify,
|
|
990
|
+
LOG_LEVEL: [
|
|
991
|
+
"silent",
|
|
992
|
+
"silent",
|
|
993
|
+
"info",
|
|
994
|
+
"warn",
|
|
995
|
+
"error"
|
|
996
|
+
][verbosity]
|
|
997
|
+
};
|
|
998
|
+
return await execa(pm, [
|
|
999
|
+
"tsdown",
|
|
1000
|
+
...ENV_VARS.LOG_LEVEL === "silent" ? ["--log-level", "silent"] : [],
|
|
1001
|
+
"--config-loader",
|
|
1002
|
+
"native",
|
|
1003
|
+
"-c",
|
|
1004
|
+
"tsdown.default.config.ts"
|
|
1005
|
+
].filter((e) => e !== null), {
|
|
1006
|
+
stdout: "inherit",
|
|
1007
|
+
stderr: "inherit",
|
|
1008
|
+
cwd: base_path(),
|
|
1009
|
+
env: Object.assign({}, process.env, ENV_VARS)
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
//#endregion
|
|
940
1014
|
//#region src/Console/Commands/KeyGenerateCommand.ts
|
|
941
1015
|
var KeyGenerateCommand = class extends Command {
|
|
942
1016
|
/**
|
|
@@ -1417,6 +1491,7 @@ let ConsoleKernel = _ConsoleKernel = class ConsoleKernel extends CKernel {
|
|
|
1417
1491
|
if (this.console == null) {
|
|
1418
1492
|
const baseCommands = [
|
|
1419
1493
|
BuildCommand,
|
|
1494
|
+
DevCommand,
|
|
1420
1495
|
MakeCommand,
|
|
1421
1496
|
PostinstallCommand,
|
|
1422
1497
|
KeyGenerateCommand
|
|
@@ -3326,4 +3401,4 @@ var LogicException = class extends Error {
|
|
|
3326
3401
|
}
|
|
3327
3402
|
};
|
|
3328
3403
|
//#endregion
|
|
3329
|
-
export { AccessDeniedHttpException, AppBuilder, BadRequestHttpException, BindingResolutionException, BootProviders, BuildCommand, CommandNotFoundException, ConfigException, ConflictHttpException, ConsoleKernel, ExceptionHandler, Exceptions, GoneHttpException, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Handler, Helpers, HttpException, HttpExceptionFactory, IFilesystemDriver, IFilesystemManager, IFtpDiskDriver, InMemoryRateLimiter, Inject, Injectable, Kernel, KeyGenerateCommand, LengthRequiredHttpException, LockedHttpException, LogicException, MakeCommand, Middleware, MiddlewareHandler, ModelNotFoundException, NotAcceptableHttpException, NotFoundHttpException, PostinstallCommand, PreconditionFailedHttpException, PreconditionRequiredHttpException, RecordNotFoundException, RecordsNotFoundException, RegisterFacades, RequestException, RequestHandled, ResponseCodes, RouteNotFoundException, ServiceUnavailableHttpException, Terminating, TestApplication, TestClient, TooManyRequestsHttpException, TsDownConfig, UnprocessableEntityHttpException, UnsupportedMediaTypeHttpException, UrlGenerationException, altLogo, logo, statusTexts, testApp };
|
|
3404
|
+
export { AccessDeniedHttpException, AppBuilder, BadRequestHttpException, BindingResolutionException, BootProviders, BuildCommand, CommandNotFoundException, ConfigException, ConflictHttpException, ConsoleKernel, DevCommand, ExceptionHandler, Exceptions, GoneHttpException, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Handler, Helpers, HttpException, HttpExceptionFactory, IFilesystemDriver, IFilesystemManager, IFtpDiskDriver, InMemoryRateLimiter, Inject, Injectable, Kernel, KeyGenerateCommand, LengthRequiredHttpException, LockedHttpException, LogicException, MakeCommand, Middleware, MiddlewareHandler, ModelNotFoundException, NotAcceptableHttpException, NotFoundHttpException, PostinstallCommand, PreconditionFailedHttpException, PreconditionRequiredHttpException, RecordNotFoundException, RecordsNotFoundException, RegisterFacades, RequestException, RequestHandled, ResponseCodes, RouteNotFoundException, ServiceUnavailableHttpException, Terminating, TestApplication, TestClient, TooManyRequestsHttpException, TsDownConfig, UnprocessableEntityHttpException, UnsupportedMediaTypeHttpException, UrlGenerationException, altLogo, logo, statusTexts, testApp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/foundation",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "H3ravel Foundation for shared and reuseable services.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@h3ravel/contracts": "^2.0
|
|
56
|
+
"@h3ravel/contracts": "^2.1.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@h3ravel/musket": "^1.29.0-alpha.15",
|
|
60
|
-
"@h3ravel/shared": "^2.0
|
|
61
|
-
"@h3ravel/support": "^2.0
|
|
60
|
+
"@h3ravel/shared": "^2.1.0",
|
|
61
|
+
"@h3ravel/support": "^2.1.0",
|
|
62
62
|
"h3": "2.0.1-rc.5",
|
|
63
63
|
"parasito": "^0.2.5"
|
|
64
64
|
},
|