"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var rollup_plugin_node_resolve_1 = require("rollup-plugin-node-resolve");
var rollup_plugin_commonjs_1 = require("rollup-plugin-commonjs");
var rollup_plugin_sourcemaps_1 = require("rollup-plugin-sourcemaps");
var rollup_plugin_typescript2_1 = require("rollup-plugin-typescript2");
var rollup_plugin_replace_1 = require("rollup-plugin-replace");
var rollup_plugin_json_1 = require("rollup-plugin-json");
var package_json_1 = require("./package.json");
var libraryName = 'builder-react-native';
var resolvePlugin = rollup_plugin_node_resolve_1.default();
var externalDependencies = Object.keys(package_json_1.default.dependencies)
    // TODO: go back to using peerDependencies once fix rollup iife issue
    // .concat(Object.keys(pkg.peerDependencies || {}))
    .filter(function (name) { return !name.startsWith('lodash-es'); });
var options = {
    input: "src/" + libraryName + ".ts",
    watch: {
        include: 'src/**',
    },
    plugins: [
        rollup_plugin_typescript2_1.default({
            tsconfigOverride: {
                compilerOptions: {
                    // No need to type check and gen over and over, we do once at beggingn of builder with `tsc`
                    declaration: false,
                    // check: false,
                    allowJs: true,
                },
            },
        }),
        rollup_plugin_replace_1.default({
            'process.env.NODE_ENV': JSON.stringify('production'),
        }),
        // Allow json resolution
        rollup_plugin_json_1.default(),
        // Compile TypeScript files
        // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
        rollup_plugin_commonjs_1.default({}),
        // Allow node_modules resolution, so you can use 'external' to control
        // which external modules to include in the bundle
        // https://github.com/rollup/rollup-plugin-node-resolve#usage
        // resolve({}),
        resolvePlugin,
        // Resolve source maps to the original source
        rollup_plugin_sourcemaps_1.default(),
    ],
};
exports.default = [
    __assign(__assign({}, options), { output: [
            { file: package_json_1.default.module, format: 'es', sourcemap: true },
            { file: package_json_1.default.main, format: 'cjs', sourcemap: true },
        ], external: externalDependencies, plugins: options.plugins
            .filter(function (plugin) { return plugin !== resolvePlugin; })
            .concat([
            rollup_plugin_node_resolve_1.default({
                only: [/^\.{0,2}\//, /lodash\-es/],
            }),
        ]) }),
];
//# sourceMappingURL=rollup.config.js.map