// This rollup config uses the pluginsdk config as a base but this is not a plugin

import angularJsTemplateLoader from './rollup-plugin-angularjs-template-loader';
const basePluginConfig = require('@spinnaker/pluginsdk/pluginconfig/rollup.config');

basePluginConfig.plugins = basePluginConfig.plugins.filter((x) => x.name !== 'rollup-plugin-external-globals');
basePluginConfig.plugins.push(angularJsTemplateLoader({ sourceMap: true }));

const external = [
  'angular',
  '@spinnaker/core',
  '@uirouter/react',
  '@uirouter/core',
  'formik',
  'lodash',
  'luxon',
  'prop-types',
  'react',
  'react-dom',
  'rxjs',
  'rxjs/Observable',
  'semiotic',
];

basePluginConfig.input = 'src/index.ts';
basePluginConfig.external = external;

export default basePluginConfig;

// This rollup config uses the pluginsdk config as a base but this is not a plugin

import angularJsTemplateLoader from './rollup-plugin-angularjs-template-loader';
const basePluginConfig = require('@spinnaker/pluginsdk/pluginconfig/rollup.config');

basePluginConfig.plugins = basePluginConfig.plugins.filter((x) => x.name !== 'rollup-plugin-external-globals');
basePluginConfig.plugins.push(angularJsTemplateLoader({ sourceMap: true }));

const externals = [
  'angular',
  '@spinnaker/core',
  '@uirouter/react',
  '@uirouter/core',
  'formik',
  'lodash',
  'luxon',
  'prop-types',
  'react',
  'react-dom',
  'rxjs',
  'semiotic',
];

basePluginConfig.input = 'src/index.ts';
basePluginConfig.external = function (id) {
  return externals.includes(id) || id.startsWith('rxjs/');
};

export default basePluginConfig;

make all rxjs/* imports externals