|
| 1 | +import {getSecondaryEntryPointsForPackage} from './secondary-entry-points'; |
| 2 | + |
| 3 | +/** Method that converts dash-case strings to a camel-based string. */ |
| 4 | +const dashCaseToCamelCase = (str: string) => str.replace(/-([a-z])/g, (g) => g[1].toUpperCase()); |
| 5 | + |
| 6 | +/** List of available secondary entry-points for the CDK package. */ |
| 7 | +const cdkSecondaryEntryPoints = getSecondaryEntryPointsForPackage('cdk'); |
| 8 | + |
| 9 | +/** Object with all CDK entry points in the format of Rollup globals. */ |
| 10 | +const rollupCdkEntryPoints = cdkSecondaryEntryPoints.reduce((globals: any, entryPoint: string) => { |
| 11 | + globals[`@angular/cdk/${entryPoint}`] = `ng.cdk.${dashCaseToCamelCase(entryPoint)}`; |
| 12 | + return globals; |
| 13 | +}, {}); |
| 14 | + |
| 15 | +/** Map of globals that are used inside of the different packages. */ |
| 16 | +export const rollupGlobals = { |
| 17 | + 'tslib': 'tslib', |
| 18 | + |
| 19 | + '@angular/animations': 'ng.animations', |
| 20 | + '@angular/core': 'ng.core', |
| 21 | + '@angular/common': 'ng.common', |
| 22 | + '@angular/forms': 'ng.forms', |
| 23 | + '@angular/http': 'ng.http', |
| 24 | + '@angular/router': 'ng.router', |
| 25 | + '@angular/platform-browser': 'ng.platformBrowser', |
| 26 | + '@angular/platform-server': 'ng.platformServer', |
| 27 | + '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic', |
| 28 | + '@angular/platform-browser/animations': 'ng.platformBrowser.animations', |
| 29 | + '@angular/core/testing': 'ng.core.testing', |
| 30 | + '@angular/common/testing': 'ng.common.testing', |
| 31 | + '@angular/http/testing': 'ng.http.testing', |
| 32 | + |
| 33 | + |
| 34 | + '@angular/material': 'ng.material', |
| 35 | + '@angular/cdk': 'ng.cdk', |
| 36 | + |
| 37 | + // Include secondary entry-points of the CDK package |
| 38 | + ...rollupCdkEntryPoints, |
| 39 | + |
| 40 | + // Some packages are not really needed for the UMD bundles, but for the missingRollupGlobals rule. |
| 41 | + // TODO(devversion): remove by adding minimatch and better globbing to rules |
| 42 | + '@angular/cdk/testing': 'ng.cdk.testing', |
| 43 | + '@angular/material-examples': 'ng.materialExamples', |
| 44 | + |
| 45 | + 'rxjs/BehaviorSubject': 'Rx', |
| 46 | + 'rxjs/Observable': 'Rx', |
| 47 | + 'rxjs/Subject': 'Rx', |
| 48 | + 'rxjs/Subscription': 'Rx', |
| 49 | + 'rxjs/Observer': 'Rx', |
| 50 | + 'rxjs/Scheduler': 'Rx', |
| 51 | + 'rxjs/observable/combineLatest': 'Rx.Observable', |
| 52 | + 'rxjs/observable/forkJoin': 'Rx.Observable', |
| 53 | + 'rxjs/observable/fromEvent': 'Rx.Observable', |
| 54 | + 'rxjs/observable/merge': 'Rx.Observable', |
| 55 | + 'rxjs/observable/of': 'Rx.Observable', |
| 56 | + 'rxjs/observable/throw': 'Rx.Observable', |
| 57 | + 'rxjs/operator/auditTime': 'Rx.Observable.prototype', |
| 58 | + 'rxjs/operator/catch': 'Rx.Observable.prototype', |
| 59 | + 'rxjs/operator/debounceTime': 'Rx.Observable.prototype', |
| 60 | + 'rxjs/operator/do': 'Rx.Observable.prototype', |
| 61 | + 'rxjs/operator/filter': 'Rx.Observable.prototype', |
| 62 | + 'rxjs/operator/finally': 'Rx.Observable.prototype', |
| 63 | + 'rxjs/operator/first': 'Rx.Observable.prototype', |
| 64 | + 'rxjs/operator/let': 'Rx.Observable.prototype', |
| 65 | + 'rxjs/operator/map': 'Rx.Observable.prototype', |
| 66 | + 'rxjs/operator/share': 'Rx.Observable.prototype', |
| 67 | + 'rxjs/operator/startWith': 'Rx.Observable.prototype', |
| 68 | + 'rxjs/operator/switchMap': 'Rx.Observable.prototype', |
| 69 | + 'rxjs/operator/takeUntil': 'Rx.Observable.prototype', |
| 70 | + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', |
| 71 | + |
| 72 | + 'rxjs/add/observable/merge': 'Rx.Observable', |
| 73 | + 'rxjs/add/observable/fromEvent': 'Rx.Observable', |
| 74 | + 'rxjs/add/observable/of': 'Rx.Observable', |
| 75 | + 'rxjs/add/observable/interval': 'Rx.Observable', |
| 76 | + 'rxjs/add/operator/startWith': 'Rx.Observable.prototype', |
| 77 | + 'rxjs/add/operator/map': 'Rx.Observable.prototype', |
| 78 | + 'rxjs/add/operator/debounceTime': 'Rx.Observable.prototype', |
| 79 | + 'rxjs/add/operator/distinctUntilChanged': 'Rx.Observable.prototype', |
| 80 | + 'rxjs/add/operator/first': 'Rx.Observable.prototype', |
| 81 | + 'rxjs/add/operator/catch': 'Rx.Observable.prototype', |
| 82 | + 'rxjs/add/operator/switchMap': 'Rx.Observable.prototype' |
| 83 | +}; |
0 commit comments