Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adonisjs/core

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/core - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

build/src/Contracts/Logger/index.d.ts

1

build/index.d.ts

@@ -5,1 +5,2 @@ export { Ignitor } from './src/Ignitor';

export { HelpersContract } from './src/Contracts/Helpers';
export { LoggerContract, LoggerConfig } from './src/Contracts/Logger';

10

build/providers/AppProvider.d.ts

@@ -0,10 +1,16 @@

import { IocContract } from '@adonisjs/fold';
export default class AppProvider {
app: any;
constructor(app: any);
app: IocContract;
constructor(app: IocContract);
private _registerEnv;
private _registerConfig;
private _registerHttpMiddleware;
private _registerRequest;
private _registerResponse;
private _registerRoute;
private _registerLogger;
private _registerServer;
private _registerBodyParserMiddleware;
register(): void;
boot(): void;
}

@@ -7,4 +7,7 @@ "use strict";

const response_1 = require("@adonisjs/response");
const bodyparser_1 = require("@adonisjs/bodyparser");
const Config_1 = require("../src/Config");
const Env_1 = require("../src/Env");
const Logger_1 = require("../src/Logger");
const logger_1 = require("../config/logger");
class AppProvider {

@@ -34,2 +37,12 @@ constructor(app) {

}
_registerRequest() {
this.app.singleton('Adonis/Src/Request', () => {
return request_1.Request;
});
}
_registerResponse() {
this.app.singleton('Adonis/Src/Response', () => {
return response_1.Response;
});
}
_registerRoute() {

@@ -41,11 +54,26 @@ this.app.singleton('Adonis/Src/Route', (app) => {

}
_registerLogger() {
this.app.singleton('Adonis/Src/Logger', (app) => {
const loggerConfig = app.use('Adonis/Src/Config').get('app.logger', {});
return new Logger_1.Logger(loggerConfig);
});
this.app.alias('Adonis/Src/Logger', 'Logger');
}
_registerServer() {
this.app.singleton('Adonis/Src/Server', (app) => {
const Route = app.use('Adonis/Src/Route');
const HttpRequest = app.use('Adonis/Src/Request');
const HttpResponse = app.use('Adonis/Src/Response');
const HttpMiddleware = app.use('Adonis/Src/HttpMiddleware');
const httpConfig = app.use('Adonis/Src/Config').get('app.http', {});
return new server_1.Server(request_1.Request, response_1.Response, Route, HttpMiddleware, httpConfig);
return new server_1.Server(HttpRequest, HttpResponse, Route, HttpMiddleware, httpConfig);
});
this.app.alias('Adonis/Src/Server', 'Server');
}
_registerBodyParserMiddleware() {
this.app.bind('Adonis/Middleware/BodyParser', (app) => {
const config = app.use('Adonis/Src/Config').get('bodyparser', {});
return new bodyparser_1.BodyParserMiddleware(config);
});
}
register() {

@@ -55,6 +83,17 @@ this._registerEnv();

this._registerRoute();
this._registerRequest();
this._registerResponse();
this._registerLogger();
this._registerServer();
this._registerHttpMiddleware();
this._registerBodyParserMiddleware();
}
boot() {
this.app.with(['Adonis/Src/Config'], (Config) => {
Config.defaults('app.http', Object.assign({}, request_1.requestConfig, response_1.responseConfig));
Config.defaults('app.logger', logger_1.loggerConfig);
Config.defaults('bodyparser', bodyparser_1.bodyParserConfig);
});
}
}
exports.default = AppProvider;

@@ -10,3 +10,4 @@ import { ConfigContract } from '../Contracts/Config';

merge(key: string, defaultValues: object, customizer?: Function): any;
defaults(key: string, value: any): void;
set(key: string, value: any): void;
}

@@ -32,2 +32,11 @@ "use strict";

}
defaults(key, value) {
const existingValue = this.get(key);
if (!existingValue) {
this.set(key, value);
}
else {
lodash_1.mergeWith(this.get(key), value);
}
}
set(key, value) {

@@ -34,0 +43,0 @@ lodash_1.set(this._configCache, key, value);

@@ -5,3 +5,4 @@ export interface ConfigContract {

set(key: string, value: any): void;
defaults(key: string, value: any): void;
sync(): void;
}

@@ -35,3 +35,3 @@ import { Ioc } from '@adonisjs/fold';

private _bootstrap;
private _createHttp;
private _createHttpServer;
private _listen;

@@ -38,0 +38,0 @@ onProfile(callback: ProfilerSubscriber): void;

@@ -121,3 +121,3 @@ "use strict";

}
_createHttp(serverCallback) {
_createHttpServer(serverCallback) {
const server = this.ioc.use('Adonis/Src/Server');

@@ -132,7 +132,11 @@ const router = this.ioc.use('Adonis/Src/Route');

const handler = server.handle.bind(server);
this.server = serverCallback ? serverCallback(handler) : http_1.createServer(server.handle.bind(server));
this.server = serverCallback ? serverCallback(handler) : http_1.createServer(handler);
}
_listen(port, host) {
_listen() {
return new Promise((resolve, reject) => {
const startServerAction = this._bootstrapper.profile('server:listen');
const Env = this.ioc.use('Adonis/Src/Env');
const Logger = this.ioc.use('Adonis/Src/Logger');
const host = Env.get('HOST', '0.0.0.0');
const port = Env.get('PORT', '3333');
this.server.listen(port, host, (error) => {

@@ -144,2 +148,3 @@ startServerAction.end();

else {
Logger.info('started server on %s:%s', host, port);
resolve();

@@ -157,6 +162,6 @@ }

await this._bootstrap();
this._createHttp(serverCallback);
const Env = this.ioc.use('Adonis/Src/Env');
await this._listen(Env.get('PORT'), Env.get('HOST'));
this._createHttpServer(serverCallback);
await this._listen();
this._bootstrapper = null;
this.preloads = [];
}

@@ -163,0 +168,0 @@ catch (error) {

@@ -6,2 +6,15 @@ # Change Log

# [1.4.0](https://github.com/adonisjs/adonis-framework/tree/master/packages/core/compare/@adonisjs/core@1.3.1...@adonisjs/core@1.4.0) (2019-02-22)
### Features
* **config:** allow merging defaults with user config ([6173839](https://github.com/adonisjs/adonis-framework/tree/master/packages/core/commit/6173839))
* **logger:** add logger ([054b64c](https://github.com/adonisjs/adonis-framework/tree/master/packages/core/commit/054b64c))
* **logger:** bind logger to the container ([bc79103](https://github.com/adonisjs/adonis-framework/tree/master/packages/core/commit/bc79103))
## [1.3.1](https://github.com/adonisjs/adonis-framework/tree/master/packages/core/compare/@adonisjs/core@1.3.0...@adonisjs/core@1.3.1) (2019-02-20)

@@ -8,0 +21,0 @@

{
"name": "@adonisjs/core",
"version": "1.3.1",
"version": "1.4.0",
"description": "AdonisJs core package",

@@ -49,11 +49,13 @@ "main": "build/index.js",

"dependencies": {
"@adonisjs/fold": "^5.0.3",
"@adonisjs/profiler": "^1.1.2",
"@adonisjs/request": "^1.1.8",
"@adonisjs/response": "^1.1.9",
"@adonisjs/router": "^1.5.2",
"@adonisjs/server": "^1.2.3",
"@adonisjs/utils": "^1.3.2",
"@adonisjs/bodyparser": "^2.1.1",
"@adonisjs/fold": "^5.0.4",
"@adonisjs/profiler": "^1.1.3",
"@adonisjs/request": "^1.1.9",
"@adonisjs/response": "^1.1.10",
"@adonisjs/router": "^1.5.3",
"@adonisjs/server": "^1.2.4",
"@adonisjs/utils": "^1.3.3",
"dotenv": "^6.2.0",
"lodash": "^4.17.11",
"pino": "^5.11.1",
"require-all": "^3.0.0"

@@ -64,5 +66,6 @@ },

"fs-extra": "^7.0.1",
"split2": "^3.1.0",
"supertest": "^3.4.2"
},
"gitHead": "58d893639760310fd95f676c8489ea1cf959deb3"
"gitHead": "6015ab0919495593206e7317d78a3e7ff0b97afc"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc