import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import css from 'rollup-plugin-css-only';

// const production = !process.env.ROLLUP_WATCH;
const production = false; // Keep runtime checks for the moment.

// Note: ui/lite/Settings.svelte belongs to the base plugin (not present in this Pro-only repo).
// The base plugin's compiled output (assets/js/settings.js) is committed directly.
// This config only builds the Pro-specific entry point.

export default [{
	input: 'ui/pro/Settings.svelte',
	output: {
		sourcemap: true,
		format: 'umd',
		name: 'AS3CFPro_Settings',
		file: 'assets/js/pro/settings.js'
	},
	plugins: [
		svelte( {
			compilerOptions: {
				// enable run-time checks when not in production
				dev: !production
			}
		} ),
		// we'll extract any component CSS out into
		// a separate file - better for performance
		css( { output: 'settings.css' } ),

		// If you have external dependencies installed from
		// npm, you'll most likely need these plugins. In
		// some cases you'll need additional configuration -
		// consult the documentation for details:
		// https://github.com/rollup/plugins/tree/master/packages/commonjs
		resolve( {
			browser: true,
			dedupe: ['svelte']
		} ),
		commonjs()
	],
	watch: {
		clearScreen: false
	}
}];
