/*jshint esversion: 6 */ import commonjs from 'rollup-plugin-commonjs'; import resolve from 'rollup-plugin-node-resolve'; import lodash from 'lodash'; /** * Add here external dependencies that actually you use. * * Angular dependencies * - '@angular/animations' => 'ng.animations' * - '@angular/animations/browser': 'ng.animations.browser' * - '@angular/common' => 'ng.common' * - '@angular/compiler' => 'ng.compiler' * - '@angular/core' => 'ng.core' * - '@angular/forms' => 'ng.forms' * - '@angular/common/http' => 'ng.common.http' * - '@angular/platform-browser-dynamic' => 'ng.platformBrowserDynamic' * - '@angular/platform-browser' => 'ng.platformBrowser' * - '@angular/platform-browser/animations' => 'ng.platformBrowser.animations' * - '@angular/platform-server' => 'ng.platformServer' * - '@angular/router' => 'ng.router' * * RxJS dependencies * From RxJS v6 you need only 'rxjs' and 'rxjs.operators'. * * Other dependencies * - Angular libraries: refer to their global namespace * - TypeScript/JavaScript libraries: * e.g. lodash: 'lodash' => 'lodash' * * Also, if the dependency uses CommonJS modules, such as lodash, * you should also use a plugin like rollup-plugin-commonjs, * to explicitly specify unresolvable "named exports". * */ const angularglobals = { '@angular/core': 'ng.core', '@angular/http': 'ng.http', '@angular/forms': 'ng.forms', '@angular/common': 'ng.common', '@angular/router': 'ng.router', '@angular/compiler': 'ng.compiler', '@angular/elements': 'ng.elements', '@angular/animations': 'ng.animations', '@angular/animations/browser': 'ng.animations.browser', '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic', '@angular/platform-browser/animations': 'ng.platformBrowser.animations', }; const rxjsGlobals = { 'rxjs': 'rxjs', 'rxjs/Subject': 'rxjs', 'rxjs/Observer': 'rxjs', 'rxjs/Observable': 'rxjs', 'rxjs/Subscription': 'rxjs', 'rxjs/ReplaySubject': 'rxjs', 'rxjs/BehaviorSubject': 'rxjs', 'rxjs/operators': 'rxjs.operators', 'rxjs/observable': 'rxjs.observable', 'rxjs/observable/of': 'rxjs.observable', 'rxjs/observable/empty': 'rxjs.observable', 'rxjs/observable/from': 'rxjs.observable', 'rxjs/observable/fromEvent': 'rxjs.observable', 'rxjs/observable/fromPromise': 'rxjs.observable', 'rxjs/observable/interval': 'rxjs.observable', 'rxjs/observable/merge': 'rxjs.observable', 'rxjs/operators/filter': 'rxjs.operators', 'rxjs/operators/merge': 'rxjs.operators', 'rxjs/operators/scan': 'rxjs.operators', 'rxjs/operators/takeWhile': 'rxjs.operators', 'rxjs/operators/partition': 'rxjs.operators', 'rxjs/operators/concatMap': 'rxjs.operators', 'rxjs/operators/startWith': 'rxjs.operators', 'rxjs/operators/takeUntil': 'rxjs.operators', 'rxjs/operators/switchMap': 'rxjs.operators', 'rxjs/operators/switchMapTo': 'rxjs.operators', 'rxjs/operators/catchError': 'rxjs.operators', 'rxjs/operators/skipWhile': 'rxjs.operators', 'rxjs/observable/combineLatest': 'rxjs.operators', 'rxjs/operators/skip': 'rxjs.operators', 'rxjs/operators/map': 'rxjs.operators', 'rxjs/operators/tap': 'rxjs.operators', 'rxjs/operators/take': 'rxjs.operators', 'rxjs/operators/auditTime': 'rxjs.operators', 'rxjs/operators/distinctUntilChanged': 'rxjs.operators', 'rxjs/operators/throttleTime': 'rxjs.operators', 'rxjs/observable/zip': 'rxjs.operators', 'rxjs/operators/delay': 'rxjs.operators', 'rxjs/operators/debounceTime': 'rxjs.operators', 'rxjs/operators/bufferCount': 'rxjs.operators', 'rxjs/scheduler/animationFrame': 'rxjs.scheduler' } const otherGlobals = { 'lodash': 'lodash', 'util': 'util' }; const maggioliGlobals = { '@maggioli/cmn-ng': 'maggioli.cmnNg', '@maggioli/ctl-dt': 'maggioli.ctlDt', '@maggioli/grd-dt': 'maggioli.grdDt', }; const globals = { ...angularglobals, ...rxjsGlobals, ...otherGlobals, ...maggioliGlobals }; const format = `umd` const sourcemap = false const name = `maggioli.lytDt` const exports = `named` const output = { format, name, globals, sourcemap, exports } const external = lodash.keys(globals) export default { external, plugins: [ resolve({ mainFields: ['module', 'main', 'jsnext', 'browser'], extensions: ['.js'], }), commonjs({ include: [ 'node_modules/**', ], namedExports: { 'rxjs/symbol/iterator': ['iterator'], }, }), // sourcemaps() ], output };