Skip to content

Commit

Permalink
fix(build): add __esModule flag
Browse files Browse the repository at this point in the history
fixes #417
  • Loading branch information
jdanyow committed Feb 21, 2017
1 parent f831bee commit 0f20d7c
Showing 1 changed file with 84 additions and 79 deletions.
163 changes: 84 additions & 79 deletions src/aurelia-validation.ts
Original file line number Diff line number Diff line change
@@ -1,79 +1,84 @@
// Exports

export * from './controller-validate-result';
export * from './property-info';
export * from './validate-binding-behavior';
export * from './validate-instruction';
export * from './validate-result';
export * from './validate-trigger';
export * from './validation-controller';
export * from './validation-controller-factory';
export * from './validation-errors-custom-attribute';
export * from './validation-renderer-custom-attribute';
export * from './validation-renderer';
export * from './validator';

export * from './implementation/rule';
export * from './implementation/rules';
export * from './implementation/standard-validator';
export * from './implementation/validation-messages';
export * from './implementation/validation-parser';
export * from './implementation/validation-rules';

// Configuration

import { Container } from 'aurelia-dependency-injection';
import { Validator } from './validator';
import { StandardValidator } from './implementation/standard-validator';
import { ValidationParser } from './implementation/validation-parser';
import { ValidationRules } from './implementation/validation-rules';

/**
* Aurelia Validation Configuration API
*/
export class AureliaValidationConfiguration {
private validatorType: { new (...args: any[]): Validator } = StandardValidator;

/**
* Use a custom Validator implementation.
*/
public customValidator(type: { new (...args: any[]): Validator }) {
this.validatorType = type;
}

/**
* Applies the configuration.
*/
public apply(container: Container) {
const validator = container.get(this.validatorType);
container.registerInstance(Validator, validator);
}
}

/**
* Configures the plugin.
*/
export function configure(
frameworkConfig: { container: Container, globalResources?: (...resources: string[]) => any },
callback?: (config: AureliaValidationConfiguration) => void
) {
// the fluent rule definition API needs the parser to translate messages
// to interpolation expressions.
const parser = frameworkConfig.container.get(ValidationParser);
ValidationRules.initialize(parser);

// configure...
const config = new AureliaValidationConfiguration();
if (callback instanceof Function) {
callback(config);
}
config.apply(frameworkConfig.container);

// globalize the behaviors.
if (frameworkConfig.globalResources) {
frameworkConfig.globalResources(
'./validate-binding-behavior',
'./validation-errors-custom-attribute',
'./validation-renderer-custom-attribute');
}
}
// Exports

export * from './controller-validate-result';
export * from './property-info';
export * from './validate-binding-behavior';
export * from './validate-instruction';
export * from './validate-result';
export * from './validate-trigger';
export * from './validation-controller';
export * from './validation-controller-factory';
export * from './validation-errors-custom-attribute';
export * from './validation-renderer-custom-attribute';
export * from './validation-renderer';
export * from './validator';

export * from './implementation/rule';
export * from './implementation/rules';
export * from './implementation/standard-validator';
export * from './implementation/validation-messages';
export * from './implementation/validation-parser';
export * from './implementation/validation-rules';

/* tslint:disable:variable-name */
/** @internal */
export const __esModule = true;
/* tslint:enable:variable-name */

// Configuration

import { Container } from 'aurelia-dependency-injection';
import { Validator } from './validator';
import { StandardValidator } from './implementation/standard-validator';
import { ValidationParser } from './implementation/validation-parser';
import { ValidationRules } from './implementation/validation-rules';

/**
* Aurelia Validation Configuration API
*/
export class AureliaValidationConfiguration {
private validatorType: { new (...args: any[]): Validator } = StandardValidator;

/**
* Use a custom Validator implementation.
*/
public customValidator(type: { new (...args: any[]): Validator }) {
this.validatorType = type;
}

/**
* Applies the configuration.
*/
public apply(container: Container) {
const validator = container.get(this.validatorType);
container.registerInstance(Validator, validator);
}
}

/**
* Configures the plugin.
*/
export function configure(
frameworkConfig: { container: Container, globalResources?: (...resources: string[]) => any },
callback?: (config: AureliaValidationConfiguration) => void
) {
// the fluent rule definition API needs the parser to translate messages
// to interpolation expressions.
const parser = frameworkConfig.container.get(ValidationParser);
ValidationRules.initialize(parser);

// configure...
const config = new AureliaValidationConfiguration();
if (callback instanceof Function) {
callback(config);
}
config.apply(frameworkConfig.container);

// globalize the behaviors.
if (frameworkConfig.globalResources) {
frameworkConfig.globalResources(
'./validate-binding-behavior',
'./validation-errors-custom-attribute',
'./validation-renderer-custom-attribute');
}
}

0 comments on commit 0f20d7c

Please sign in to comment.