/**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration($this->getAlias());
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('twigjs.yml');
     $container->setParameter($this->getAlias() . '.' . 'auto_dump', $config['auto_dump']);
     $container->setParameter($this->getAlias() . '.' . 'use_symlinks', $config['use_symlinks']);
     $container->setParameter($this->getAlias() . '.' . 'json_file', $config['json_file']);
     $globalLibs = [];
     foreach ($config['base_libs'] as $type => $path) {
         $globalLibs[] = ['type' => $type, 'path' => Util::getRealPath($path, $container), 'exportName' => ''];
     }
     if (count($globalLibs)) {
         $container->setParameter($this->getAlias() . '.' . JsmodelProviderPass::JS_CONFIG_POSTFIX, $globalLibs);
     }
     $container->setParameter($this->getAlias(), $config);
     $container->setParameter($this->getAlias() . '.base_dir', $config['base_dir']);
     $configurationBuilder = $container->getDefinition($this->getAlias() . '.configuration_builder');
     foreach ($config['options'] as $option => $settings) {
         $configurationBuilder->addMethodCall('addOption', [$option, $settings['value']]);
     }
 }
 /**
  * Configure a mapping from a filesystem path to a RequireJS namespace.
  *
  * @param string           $location
  * @param string           $path
  * @param                  $type
  * @param ContainerBuilder $container
  * @param boolean          $generateAssets
  */
 protected function addNamespaceMapping($location, $path, $type, ContainerBuilder $container, $generateAssets = true)
 {
     $location = Util::getRealPath($location, $container);
     // Register the namespace with the configuration
     $mapping = $container->getDefinition(static::EXT_NAME . '.namespace_mapping');
     $mapping->addMethodCall('registerNamespace', [$path, $location, $type]);
     $config = $container->getDefinition(static::EXT_NAME . '.configuration_builder');
     $config->addMethodCall('setPath', [$path, $location, $type]);
     //        if ($path && $container->hasDefinition(static::EXT_NAME . '.optimizer_filter')) {
     //            $filter = $container->getDefinition(static::EXT_NAME . '.optimizer_filter');
     //            $filter->addMethodCall('addPath', [$path, preg_replace('~\.js$~', '', $location)]);
     //        }
     //        if ($generateAssets) {
     //            $resource = new DefinitionDecorator(static::EXT_NAME . '.filenames_resource');
     //            $resource->setArguments([$location]);
     //            $resource->addTag('assetic.formula_resource', ['loader' => 'require_js']);
     //            $container->addDefinitions([
     //                static::EXT_NAME . '.filenames_resource.' . md5($location) => $resource,
     //            ]);
     //        }
 }