CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
rollup.config.mjs131 linesDownload Raw Back to cytoscape
1import nodeResolve from '@rollup/plugin-node-resolve';2import commonjs from '@rollup/plugin-commonjs';3import babel from '@rollup/plugin-babel';4import replace from '@rollup/plugin-replace';5import terser from '@rollup/plugin-terser';6import license from 'rollup-plugin-license';7import path from 'path';8 9import { fileURLToPath } from 'url';10import { dirname } from 'path';11 12const __filename = fileURLToPath(import.meta.url);13const __dirname = dirname(__filename);14 15const VERSION = process.env.VERSION || 'snapshot'; // default snapshot16const FILE = process.env.FILE;17const SOURCEMAPS = process.env.SOURCEMAPS === 'true'; // default false18const BABEL = process.env.BABEL !== 'false'; // default true19const NODE_ENV = process.env.NODE_ENV === 'development' ? 'development' : 'production'; // default prod20 21const input = './src/index.mjs';22 23const name = 'cytoscape';24 25const envVariables = {26  'process.env.VERSION': JSON.stringify(VERSION),27  'process.env.NODE_ENV': JSON.stringify(NODE_ENV)28};29 30const replaceOptions = {31  values: envVariables,32  preventAssignment: true33};34 35const getBabelOptions = () => ({36  exclude: '**/node_modules/**',37  babelHelpers: 'bundled'38});39 40// Ignore all node_modules dependencies41const isExternal = id => !id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/');42 43const licenseHeaderOptions = {44  sourcemap: true,45  banner: {46    content: {47      file: path.join(__dirname, 'LICENSE')48    }49  }50};51 52const configs = [53  {54    input,55    output: {56      file: 'build/cytoscape.umd.js',57      format: 'umd',58      name,59      sourcemap: SOURCEMAPS ? 'inline' : false60    },61    plugins: [62      nodeResolve(),63      commonjs({ include: '**/node_modules/**' }),64      BABEL ? babel(getBabelOptions()) : {},65      replace(replaceOptions),66      license(licenseHeaderOptions)67    ]68  },69 70  {71    input,72    output: {73      file: 'build/cytoscape.min.js',74      format: 'umd',75      name76    },77    plugins: [78      nodeResolve(),79      commonjs({ include: '**/node_modules/**' }),80      BABEL ? babel(getBabelOptions()) : {},81      replace(replaceOptions),82      terser(),83      license(licenseHeaderOptions)84    ]85  },86 87  {88    input,89    output: {90      file: 'build/cytoscape.esm.min.mjs',91      format: 'es'92    },93    plugins: [94      nodeResolve(),95      commonjs({ include: '**/node_modules/**' }),96      BABEL ? babel(getBabelOptions()) : {},97      replace(replaceOptions),98      license(licenseHeaderOptions),99      terser()100    ]101  },102 103  {104    input,105    output: { file: 'build/cytoscape.cjs.js', format: 'cjs' },106    plugins: [107      nodeResolve(),108      commonjs({ include: '**/node_modules/**' }),109      BABEL ? babel(getBabelOptions()) : {},110      replace(replaceOptions),111      license(licenseHeaderOptions)112    ]113  },114 115  {116    input,117    output: { file: 'build/cytoscape.esm.mjs', format: 'es' },118    plugins: [119      nodeResolve(),120      commonjs({ include: '**/node_modules/**' }),121      BABEL ? babel(getBabelOptions()) : {},122      replace(replaceOptions),123      license(licenseHeaderOptions)124    ]125  }126];127 128export default FILE129  ? configs.filter(config => config.output.file.endsWith(FILE + '.js') || config.output.file.endsWith(FILE + '.mjs'))130  : configs;131 
basant307/AI_Governance_Project · CoolFace