<commit_before>import {FrameworkConfiguration} from 'aurelia-framework';
import {AureliaConfiguration} from './aurelia-configuration';

export function configure(aurelia: FrameworkConfiguration, configCallback?: (config: AureliaConfiguration) => Promise<any>) {
    let instance = aurelia.container.get(AureliaConfiguration);
    let promise: Promise<any> | any = null;

    // Do we have a callback function?
    if (configCallback !== undefined && typeof(configCallback) === 'function') {
        promise = Promise.resolve(configCallback(instance));
    }

    // Don't load the config until the configCallback has completed.
    return promise
        .then(function () {
            return instance.loadConfig();
        })
        .catch(function () {
            throw new Error('Configuration file could not be loaded');
        });
}

export {AureliaConfiguration};
<commit_msg>fix(plugin): promise needs to return a resolved promise if no callback<commit_after>import {FrameworkConfiguration} from 'aurelia-framework';
import {AureliaConfiguration} from './aurelia-configuration';

export function configure(aurelia: FrameworkConfiguration, configCallback?: (config: AureliaConfiguration) => Promise<any>) {
    let instance = aurelia.container.get(AureliaConfiguration);
    let promise: Promise<any> | any = null;

    // Do we have a callback function?
    if (configCallback !== undefined && typeof(configCallback) === 'function') {
        promise = Promise.resolve(configCallback(instance));
    } else {
        promise = Promise.resolve();
    }

    // Don't load the config until the configCallback has completed.
    return promise
        .then(function () {
            return instance.loadConfig();
        })
        .catch(function () {
            throw new Error('Configuration file could not be loaded');
        });
}

export {AureliaConfiguration};

{'fraction_non_alphanumeric': 0.11282597126130921, 'fraction_numerical': 0.0, 'mean_word_length': 3.519230769230769, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6364107', 'n_tokens_mistral': 471, 'n_tokens_neox': 465, 'n_words': 137}