Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function readConfig (filename: string, loader: WebPackLoader, TS: typeof ts) {
const config = filename ? tsconfig.readFileSync(filename) : {
files: [],
compilerOptions: {}
}
// Merge all possible compiler options together.
config.compilerOptions = extend({
target: 'es5',
module: 'commonjs'
}, config.compilerOptions, {
sourceMap: loader.sourceMap,
inlineSourceMap: false,
inlineSources: false,
declaration: false
})
return TS.parseConfigFile(config, TS.sys, filename)
import commonjs from 'rollup-plugin-commonjs';
import license from 'rollup-plugin-license';
import visualizer from 'rollup-plugin-visualizer';
import typescript from 'rollup-plugin-typescript2';
import vueTemplateCompiler from 'rollup-plugin-vue-template-compiler';
import replace from 'rollup-plugin-replace';
import json from 'rollup-plugin-json';
import { isString } from 'util';
import moment from 'moment';
import _ from 'lodash';
import { readFileSync } from 'tsconfig';
// eslint-disable-next-line no-undef
const pkg = require( './package.json' );
const tsconfig = readFileSync( './tsconfig.json' );
const env = process.env.BUILD || 'development';
// The module name
const pkgName = pkg.name;
const globalName = 'VuejsDatatable';
const allContributors = [ pkg.author ].concat( pkg.contributors );
const userToString = p => {
if ( isString( p ) ){
return p;
}
return p.name + ( p.email ? `<${ p.email }>` : '' ) + ( p.url ? ` (${ p.url })` : '' );
};
const allContributorsString = allContributors.map( userToString ).join( ', ' );
// Plugins used for build
export const getPlugins = (iife, environment) => {
const tsconfigOverride = {
log('Using inline tsconfig');
config = JSON.parse(JSON.stringify(opts.project));
config.compilerOptions = config.compilerOptions || {};
extend(config.compilerOptions, opts);
} else {
if (fileExists(opts.project)) {
configFile = opts.project;
} else {
configFile = ts.findConfigFile(
ts.normalizeSlashes(opts.project || bopts.basedir || currentDirectory),
fileExists
);
}
if (configFile) {
log('Using tsconfig file at %s', configFile);
config = tsconfig.readFileSync(configFile);
config.compilerOptions = config.compilerOptions || {};
extend(config.compilerOptions, opts);
} else {
config = {
files: [],
compilerOptions: opts
};
}
}
// Note that subarg parses command line arrays in its own peculiar way:
// https://github.com/substack/subarg
if (opts.exclude) {
config.exclude = opts.exclude._ || opts.exclude;
}
private readConfigFile(fileName) {
try {
return tsconfig.readFileSync(fileName);
} catch (err) {
IDE.console.error(`Error reading config file ${fileName}`);
}
}