<commit_before>import keys from 'lodash/keys'
import each from 'lodash/each'

import events from './store/module/events'
import Store from './store'
import Locale from './locale'
import Router, { routeParser } from './router'
import Component from './component'

/**
 * Install components
 * It will install all components listed in the component index file.
 * All components will be already available in the application without needs
 * to imports
 * @param  {Vue} Vue
 */
const installComponents = (Vue) => {
  const components = Component(Vue)
  each(keys(components), name => {
    Vue.component(name, components[name])
  })
}

/**
 * Initialize plugin
 * @param  {Store} store
 * @param  {Object} config - plugin configuration options
 * @return {Promise}
 */
const initializePlugin = (Vue, { store, router, config }) => {
  return async function () {
    Store(store)
    Locale(Vue, router, store)
    installComponents(Vue)

    await store.dispatch(events.UPDATE_CONFIGURATION, config)
    await store.dispatch(events.SET_LANGUAGE, store.getters.defaultCode)

    Router(Vue, router, store)
  }
}

/**
 * Expose the install function to let Vue install the plugin
 * @param  {Vue} Vue
 * @param  {Object} [options={}] - plugin options
 */
export default function install (Vue, options = {}) {
  Vue.initI18nManager = initializePlugin(Vue, options)
}

/**
 * Export helpers
 */
export { routeParser, events }<commit_msg>refactor(initialization): add possibility to boot the application even though the plugin is processing data<commit_after>import keys from 'lodash/keys'
import each from 'lodash/each'

import events from './store/module/events'
import Store from './store'
import Locale from './locale'
import Router, { routeParser } from './router'
import Component from './component'

/**
 * Install components
 * It will install all components listed in the component index file.
 * All components will be already available in the application without needs
 * to imports
 * @param  {Vue} Vue
 */
const installComponents = (Vue) => {
  const components = Component(Vue)
  each(keys(components), name => {
    Vue.component(name, components[name])
  })
}

/**
 * Initialize plugin
 * @param  {Store} store
 * @param  {Object} config - plugin configuration options
 * @return {Promise}
 */
const initializePlugin = (Vue, { store, router, config }) => {
  return async function () {
    await store.dispatch(events.UPDATE_CONFIGURATION, config)
    await store.dispatch(events.SET_LANGUAGE, store.getters.defaultCode)

    Router(Vue, router, store)
  }
}

/**
 * Expose the install function to let Vue install the plugin
 * @param  {Vue} Vue
 * @param  {Object} [options={}] - plugin options
 */
export default function install (Vue, options = {}) {
  const { router, store } = options

  Store(store)
  Locale(Vue, router, store)
  installComponents(Vue)

  Vue.initI18nManager = initializePlugin(Vue, options)
}

/**
 * Export helpers
 */
export { routeParser, events }
{'fraction_non_alphanumeric': 0.11908755451190875, 'fraction_numerical': 0.0013418316001341832, 'mean_word_length': 4.054237288135593, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4064651', 'n_tokens_mistral': 878, 'n_tokens_neox': 866, 'n_words': 289}