UNPKG

adonis-responsive-attachment

Version:

Generate and persist optimised and responsive breakpoint images on the fly in your AdonisJS application.

49 lines (48 loc) 1.86 kB
"use strict"; /* * adonis-responsive-attachment * * (c) Ndianabasi Udonkang <ndianabasi@furnish.ng> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); class ResponsiveAttachmentProvider { constructor(application) { this.application = application; } /** * Extends the validator by defining validation rules */ defineValidationRules() { /** * Do not register validation rules in the "repl" environment */ if (this.application.environment === 'repl') { return; } this.application.container.withBindings(['Adonis/Core/Validator', 'Adonis/Core/Logger'], (Validator, Logger) => { const { extendValidator } = require('../src/Bindings/Validator'); extendValidator(Validator.validator, Logger); }); } register() { this.application.container.bind('Adonis/Addons/ResponsiveAttachment', () => { const { ResponsiveAttachment } = require('../src/Attachment'); const { responsiveAttachment } = require('../src/Attachment/decorator'); return { ResponsiveAttachment: ResponsiveAttachment, responsiveAttachment: responsiveAttachment, }; }); } boot() { this.application.container.withBindings(['Adonis/Addons/ResponsiveAttachment', 'Adonis/Core/Drive', 'Adonis/Core/Logger'], (ResponsiveAttachmentAddon, Drive, Logger) => { ResponsiveAttachmentAddon.ResponsiveAttachment.setDrive(Drive); ResponsiveAttachmentAddon.ResponsiveAttachment.setLogger(Logger); }); this.defineValidationRules(); } } exports.default = ResponsiveAttachmentProvider;