UNPKG

18.4 kBJavaScriptView Raw
1import resolve from 'rollup-plugin-node-resolve';
2import typescript from 'rollup-plugin-typescript2';
3import nodeResolve from 'rollup-plugin-node-resolve';
4import sourcemaps from 'rollup-plugin-sourcemaps';
5import CleanCSS from 'clean-css';
6import { minify as minifyHtml } from 'html-minifier';
7import angular from 'rollup-plugin-angular';
8import sass from 'node-sass';
9
10/**
11 * Add here external dependencies that actually you use.
12 *
13 * About RxJS
14 * Each RxJS functionality that you use in the library must be added as external dependency.
15 * - For main classes use 'Rx':
16 * e.g. import { Observable } from 'rxjs/Observable'; => 'rxjs/Observable': 'Rx'
17 * - For observable methods use 'Rx.Observable':
18 * e.g. import 'rxjs/add/observable/merge'; => 'rxjs/add/observable/merge': 'Rx.Observable'
19 * or for lettable operators:
20 * e.g. import { merge } from 'rxjs/observable/merge'; => 'rxjs/observable/merge': 'Rx.Observable'
21 * - For operators use 'Rx.Observable.prototype':
22 * e.g. import 'rxjs/add/operator/map'; => 'rxjs/add/operator/map': 'Rx.Observable.prototype'
23 * or for lettable operators:
24 * e.g. import { map } from 'rxjs/operators'; => 'rxjs/operators': 'Rx.Observable.prototype'
25 */
26const globals = {
27 '@x/common': 'ng.xCommon',
28 '@x/theme': 'ng.xTheme',
29 '@x/tests': 'ng.xTests',
30 '@angular/core': 'ng.core',
31 '@angular/common': 'ng.common',
32
33 '@angular/animations': 'ng.animations',
34 '@angular/forms': 'ng.forms',
35 '@angular/http': 'ng.http',
36 '@angular/platform-browser': 'ng.platformBrowser',
37 '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
38 '@angular/platform-browser/animations': 'ng.platformBrowser.animations',
39 '@angular/router': 'ng.router',
40
41 'rxjs/AnonymousSubject': 'Rx',
42 'rxjs/AsyncSubject': 'Rx',
43 'rxjs/BehaviorSubject': 'Rx',
44 'rxjs/Notifiction': 'Rx',
45 'rxjs/ObservableInput': 'Rx',
46 'rxjs/Observable': 'Rx',
47 'rxjs/Observer': 'Rx',
48 'rxjs/ReplaySubject': 'Rx',
49 'rxjs/Scheduler': 'Rx',
50 'rxjs/Subject': 'Rx',
51 'rxjs/SubjectSubscriber': 'Rx',
52 'rxjs/SubscribableOrPromise': 'Rx',
53 'rxjs/Subscriber': 'Rx',
54 'rxjs/Subscription': 'Rx',
55 'rxjs/TeardownLogic': 'Rx',
56 'rxjs/add/observable/bindCallback': 'Rx.Observable',
57 'rxjs/add/observable/bindNodeCallback': 'Rx.Observable',
58 'rxjs/add/observable/combineLatest': 'Rx.Observable',
59 'rxjs/add/observable/concat': 'Rx.Observable',
60 'rxjs/add/observable/create': 'Rx.Observable',
61 'rxjs/add/observable/defer': 'Rx.Observable',
62 'rxjs/add/observable/empty': 'Rx.Observable',
63 'rxjs/add/observable/forkJoin': 'Rx.Observable',
64 'rxjs/add/observable/from': 'Rx.Observable',
65 'rxjs/add/observable/fromEvent': 'Rx.Observable',
66 'rxjs/add/observable/fromEventPattern': 'Rx.Observable',
67 'rxjs/add/observable/fromPromise': 'Rx.Observable',
68 'rxjs/add/observable/interval': 'Rx.Observable',
69 'rxjs/add/observable/merge': 'Rx.Observable',
70 'rxjs/add/observable/never': 'Rx.Observable',
71 'rxjs/add/observable/of': 'Rx.Observable',
72 'rxjs/add/observable/range': 'Rx.Observable',
73 'rxjs/add/observable/throw': 'Rx.Observable',
74 'rxjs/add/observable/timer': 'Rx.Observable',
75 'rxjs/add/observable/webSocket': 'Rx.Observable',
76 'rxjs/add/observable/zip': 'Rx.Observable',
77 'rxjs/add/operator/audit': 'Rx.Observable.prototype',
78 'rxjs/add/operator/auditTime': 'Rx.Observable.prototype',
79 'rxjs/add/operator/buffer': 'Rx.Observable.prototype',
80 'rxjs/add/operator/bufferCount': 'Rx.Observable.prototype',
81 'rxjs/add/operator/bufferTime': 'Rx.Observable.prototype',
82 'rxjs/add/operator/bufferToggle': 'Rx.Observable.prototype',
83 'rxjs/add/operator/bufferWhen': 'Rx.Observable.prototype',
84 'rxjs/add/operator/catch': 'Rx.Observable.prototype',
85 'rxjs/add/operator/combineAll': 'Rx.Observable.prototype',
86 'rxjs/add/operator/combineLatest': 'Rx.Observable.prototype',
87 'rxjs/add/operator/concat': 'Rx.Observable.prototype',
88 'rxjs/add/operator/concatAll': 'Rx.Observable.prototype',
89 'rxjs/add/operator/concatMap': 'Rx.Observable.prototype',
90 'rxjs/add/operator/concatMapTo': 'Rx.Observable.prototype',
91 'rxjs/add/operator/count': 'Rx.Observable.prototype',
92 'rxjs/add/operator/debounce': 'Rx.Observable.prototype',
93 'rxjs/add/operator/debounceTime': 'Rx.Observable.prototype',
94 'rxjs/add/operator/defaultIfEmpty': 'Rx.Observable.prototype',
95 'rxjs/add/operator/delay': 'Rx.Observable.prototype',
96 'rxjs/add/operator/delayWhen': 'Rx.Observable.prototype',
97 'rxjs/add/operator/dematerialize': 'Rx.Observable.prototype',
98 'rxjs/add/operator/distinct': 'Rx.Observable.prototype',
99 'rxjs/add/operator/distinctUntilChanged': 'Rx.Observable.prototype',
100 'rxjs/add/operator/distinctUntilKeyChanged': 'Rx.Observable.prototype',
101 'rxjs/add/operator/do': 'Rx.Observable.prototype',
102 'rxjs/add/operator/elementAt': 'Rx.Observable.prototype',
103 'rxjs/add/operator/every': 'Rx.Observable.prototype',
104 'rxjs/add/operator/exhaust': 'Rx.Observable.prototype',
105 'rxjs/add/operator/exhaustMap': 'Rx.Observable.prototype',
106 'rxjs/add/operator/expand': 'Rx.Observable.prototype',
107 'rxjs/add/operator/filter': 'Rx.Observable.prototype',
108 'rxjs/add/operator/finally': 'Rx.Observable.prototype',
109 'rxjs/add/operator/find': 'Rx.Observable.prototype',
110 'rxjs/add/operator/findIndex': 'Rx.Observable.prototype',
111 'rxjs/add/operator/first': 'Rx.Observable.prototype',
112 'rxjs/add/operator/forEach': 'Rx.Observable.prototype',
113 'rxjs/add/operator/groupBy': 'Rx.Observable.prototype',
114 'rxjs/add/operator/ignoreElements': 'Rx.Observable.prototype',
115 'rxjs/add/operator/isEmpty': 'Rx.Observable.prototype',
116 'rxjs/add/operator/last': 'Rx.Observable.prototype',
117 'rxjs/add/operator/letProto': 'Rx.Observable.prototype',
118 'rxjs/add/operator/lift': 'Rx.Observable.prototype',
119 'rxjs/add/operator/map': 'Rx.Observable.prototype',
120 'rxjs/add/operator/materialize': 'Rx.Observable.prototype',
121 'rxjs/add/operator/max': 'Rx.Observable.prototype',
122 'rxjs/add/operator/merge': 'Rx.Observable.prototype',
123 'rxjs/add/operator/mergeAll': 'Rx.Observable.prototype',
124 'rxjs/add/operator/mergeMap': 'Rx.Observable.prototype',
125 'rxjs/add/operator/mergeMapTo': 'Rx.Observable.prototype',
126 'rxjs/add/operator/mergeScan': 'Rx.Observable.prototype',
127 'rxjs/add/operator/min': 'Rx.Observable.prototype',
128 'rxjs/add/operator/multicast': 'Rx.Observable.prototype',
129 'rxjs/add/operator/observeOn': 'Rx.Observable.prototype',
130 'rxjs/add/operator/pairwise': 'Rx.Observable.prototype',
131 'rxjs/add/operator/partition': 'Rx.Observable.prototype',
132 'rxjs/add/operator/pluck': 'Rx.Observable.prototype',
133 'rxjs/add/operator/publish': 'Rx.Observable.prototype',
134 'rxjs/add/operator/publishBehavior':'Rx.Observable.prototype',
135 'rxjs/add/operator/publishLast': 'Rx.Observable.prototype',
136 'rxjs/add/operator/publishReplay': 'Rx.Observable.prototype',
137 'rxjs/add/operator/race': 'Rx.Observable.prototype',
138 'rxjs/add/operator/reduce': 'Rx.Observable.prototype',
139 'rxjs/add/operator/repeat': 'Rx.Observable.prototype',
140 'rxjs/add/operator/repeatWhen': 'Rx.Observable.prototype',
141 'rxjs/add/operator/retry': 'Rx.Observable.prototype',
142 'rxjs/add/operator/retryWhen': 'Rx.Observable.prototype',
143 'rxjs/add/operator/sample': 'Rx.Observable.prototype',
144 'rxjs/add/operator/sampleTime': 'Rx.Observable.prototype',
145 'rxjs/add/operator/scan': 'Rx.Observable.prototype',
146 'rxjs/add/operator/sequenceEqual': 'Rx.Observable.prototype',
147 'rxjs/add/operator/share': 'Rx.Observable.prototype',
148 'rxjs/add/operator/single': 'Rx.Observable.prototype',
149 'rxjs/add/operator/skip': 'Rx.Observable.prototype',
150 'rxjs/add/operator/skipUntil': 'Rx.Observable.prototype',
151 'rxjs/add/operator/skipWhile': 'Rx.Observable.prototype',
152 'rxjs/add/operator/startWith': 'Rx.Observable.prototype',
153 'rxjs/add/operator/subscribeOn': 'Rx.Observable.prototype',
154 'rxjs/add/operator/switch': 'Rx.Observable.prototype',
155 'rxjs/add/operator/switchMap': 'Rx.Observable.prototype',
156 'rxjs/add/operator/switchMapTo': 'Rx.Observable.prototype',
157 'rxjs/add/operator/take': 'Rx.Observable.prototype',
158 'rxjs/add/operator/takeLast': 'Rx.Observable.prototype',
159 'rxjs/add/operator/takeUntil': 'Rx.Observable.prototype',
160 'rxjs/add/operator/takeWhile': 'Rx.Observable.prototype',
161 'rxjs/add/operator/throttle': 'Rx.Observable.prototype',
162 'rxjs/add/operator/throttleTime': 'Rx.Observable.prototype',
163 'rxjs/add/operator/timeInterval': 'Rx.Observable.prototype',
164 'rxjs/add/operator/timeout': 'Rx.Observable.prototype',
165 'rxjs/add/operator/timeoutWith': 'Rx.Observable.prototype',
166 'rxjs/add/operator/timestamp': 'Rx.Observable.prototype',
167 'rxjs/add/operator/toArray': 'Rx.Observable.prototype',
168 'rxjs/add/operator/toPromise': 'Rx.Observable.prototype',
169 'rxjs/add/operator/window': 'Rx.Observable.prototype',
170 'rxjs/add/operator/windowCount': 'Rx.Observable.prototype',
171 'rxjs/add/operator/windowToggle': 'Rx.Observable.prototype',
172 'rxjs/add/operator/windowWhen': 'Rx.Observable.prototype',
173 'rxjs/add/operator/withLatestFrom': 'Rx.Observable.prototype',
174 'rxjs/add/operator/zipAll': 'Rx.Observable.prototype',
175 'rxjs/add/operator/zipProto': 'Rx.Observable.prototype',
176 'rxjs/observable/bindCallback': 'Rx.Observable',
177 'rxjs/observable/bindNodeCallback': 'Rx.Observable',
178 'rxjs/observable/combineLatest': 'Rx.Observable',
179 'rxjs/observable/concat': 'Rx.Observable',
180 'rxjs/observable/defer': 'Rx.Observable',
181 'rxjs/observable/empty': 'Rx.Observable',
182 'rxjs/observable/forkJoin': 'Rx.Observable',
183 'rxjs/observable/from': 'Rx.Observable',
184 'rxjs/observable/fromEvent': 'Rx.Observable',
185 'rxjs/observable/fromEventPattern': 'Rx.Observable',
186 'rxjs/observable/fromPromise': 'Rx.Observable',
187 'rxjs/observable/if': 'Rx.Observable',
188 'rxjs/observable/interval': 'Rx.Observable',
189 'rxjs/observable/merge': 'Rx.Observable',
190 'rxjs/observable/never': 'Rx.Observable',
191 'rxjs/observable/of': 'Rx.Observable',
192 'rxjs/observable/pairs': 'Rx.Observable',
193 'rxjs/observable/range': 'Rx.Observable',
194 'rxjs/observable/throw': 'Rx.Observable',
195 'rxjs/observable/timer': 'Rx.Observable',
196 'rxjs/observable/using': 'Rx.Observable',
197 'rxjs/observable/zip': 'Rx.Observable',
198 'rxjs/operator/audit': 'Rx.Observable.prototype',
199 'rxjs/operator/auditTime': 'Rx.Observable.prototype',
200 'rxjs/operator/buffer': 'Rx.Observable.prototype',
201 'rxjs/operator/bufferCount': 'Rx.Observable.prototype',
202 'rxjs/operator/bufferTime': 'Rx.Observable.prototype',
203 'rxjs/operator/bufferToggle': 'Rx.Observable.prototype',
204 'rxjs/operator/bufferWhen': 'Rx.Observable.prototype',
205 'rxjs/operator/catch': 'Rx.Observable.prototype',
206 'rxjs/operator/combineAll': 'Rx.Observable.prototype',
207 'rxjs/operator/combineLatest': 'Rx.Observable.prototype',
208 'rxjs/operator/concat': 'Rx.Observable.prototype',
209 'rxjs/operator/concatAll': 'Rx.Observable.prototype',
210 'rxjs/operator/concatMap': 'Rx.Observable.prototype',
211 'rxjs/operator/concatMapTo': 'Rx.Observable.prototype',
212 'rxjs/operator/count': 'Rx.Observable.prototype',
213 'rxjs/operator/debounce': 'Rx.Observable.prototype',
214 'rxjs/operator/debounceTime': 'Rx.Observable.prototype',
215 'rxjs/operator/defaultIfEmpty': 'Rx.Observable.prototype',
216 'rxjs/operator/delay': 'Rx.Observable.prototype',
217 'rxjs/operator/delayWhen': 'Rx.Observable.prototype',
218 'rxjs/operator/dematerialize': 'Rx.Observable.prototype',
219 'rxjs/operator/distinct': 'Rx.Observable.prototype',
220 'rxjs/operator/distinctUntilChanged': 'Rx.Observable.prototype',
221 'rxjs/operator/distinctUntilKeyChanged': 'Rx.Observable.prototype',
222 'rxjs/operator/do': 'Rx.Observable.prototype',
223 'rxjs/operator/elementAt': 'Rx.Observable.prototype',
224 'rxjs/operator/every': 'Rx.Observable.prototype',
225 'rxjs/operator/exhaust': 'Rx.Observable.prototype',
226 'rxjs/operator/exhaustMap': 'Rx.Observable.prototype',
227 'rxjs/operator/expand': 'Rx.Observable.prototype',
228 'rxjs/operator/filter': 'Rx.Observable.prototype',
229 'rxjs/operator/finally': 'Rx.Observable.prototype',
230 'rxjs/operator/find': 'Rx.Observable.prototype',
231 'rxjs/operator/findIndex': 'Rx.Observable.prototype',
232 'rxjs/operator/first': 'Rx.Observable.prototype',
233 'rxjs/operator/forEach': 'Rx.Observable.prototype',
234 'rxjs/operator/groupBy': 'Rx.Observable.prototype',
235 'rxjs/operator/ignoreElements': 'Rx.Observable.prototype',
236 'rxjs/operator/isEmpty': 'Rx.Observable.prototype',
237 'rxjs/operator/last': 'Rx.Observable.prototype',
238 'rxjs/operator/letProto': 'Rx.Observable.prototype',
239 'rxjs/operator/lift': 'Rx.Observable.prototype',
240 'rxjs/operator/map': 'Rx.Observable.prototype',
241 'rxjs/operator/materialize': 'Rx.Observable.prototype',
242 'rxjs/operator/max': 'Rx.Observable.prototype',
243 'rxjs/operator/merge': 'Rx.Observable.prototype',
244 'rxjs/operator/mergeAll': 'Rx.Observable.prototype',
245 'rxjs/operator/mergeMap': 'Rx.Observable.prototype',
246 'rxjs/operator/mergeMapTo': 'Rx.Observable.prototype',
247 'rxjs/operator/mergeScan': 'Rx.Observable.prototype',
248 'rxjs/operator/min': 'Rx.Observable.prototype',
249 'rxjs/operator/multicast': 'Rx.Observable.prototype',
250 'rxjs/operator/observeOn': 'Rx.Observable.prototype',
251 'rxjs/operator/pairwise': 'Rx.Observable.prototype',
252 'rxjs/operator/partition': 'Rx.Observable.prototype',
253 'rxjs/operator/pluck': 'Rx.Observable.prototype',
254 'rxjs/operator/publish': 'Rx.Observable.prototype',
255 'rxjs/operator/publishBehavior':'Rx.Observable.prototype',
256 'rxjs/operator/publishLast': 'Rx.Observable.prototype',
257 'rxjs/operator/publishReplay': 'Rx.Observable.prototype',
258 'rxjs/operator/race': 'Rx.Observable.prototype',
259 'rxjs/operator/reduce': 'Rx.Observable.prototype',
260 'rxjs/operator/repeat': 'Rx.Observable.prototype',
261 'rxjs/operator/repeatWhen': 'Rx.Observable.prototype',
262 'rxjs/operator/retry': 'Rx.Observable.prototype',
263 'rxjs/operator/retryWhen': 'Rx.Observable.prototype',
264 'rxjs/operator/sample': 'Rx.Observable.prototype',
265 'rxjs/operator/sampleTime': 'Rx.Observable.prototype',
266 'rxjs/operator/scan': 'Rx.Observable.prototype',
267 'rxjs/operator/sequenceEqual': 'Rx.Observable.prototype',
268 'rxjs/operator/share': 'Rx.Observable.prototype',
269 'rxjs/operator/single': 'Rx.Observable.prototype',
270 'rxjs/operator/skip': 'Rx.Observable.prototype',
271 'rxjs/operator/skipUntil': 'Rx.Observable.prototype',
272 'rxjs/operator/skipWhile': 'Rx.Observable.prototype',
273 'rxjs/operator/startWith': 'Rx.Observable.prototype',
274 'rxjs/operator/subscribeOn': 'Rx.Observable.prototype',
275 'rxjs/operator/switch': 'Rx.Observable.prototype',
276 'rxjs/operator/switchMap': 'Rx.Observable.prototype',
277 'rxjs/operator/switchMapTo': 'Rx.Observable.prototype',
278 'rxjs/operator/take': 'Rx.Observable.prototype',
279 'rxjs/operator/takeLast': 'Rx.Observable.prototype',
280 'rxjs/operator/takeUntil': 'Rx.Observable.prototype',
281 'rxjs/operator/takeWhile': 'Rx.Observable.prototype',
282 'rxjs/operator/throttle': 'Rx.Observable.prototype',
283 'rxjs/operator/throttleTime': 'Rx.Observable.prototype',
284 'rxjs/operator/timeInterval': 'Rx.Observable.prototype',
285 'rxjs/operator/timeout': 'Rx.Observable.prototype',
286 'rxjs/operator/timeoutWith': 'Rx.Observable.prototype',
287 'rxjs/operator/timestamp': 'Rx.Observable.prototype',
288 'rxjs/operator/toArray': 'Rx.Observable.prototype',
289 'rxjs/operator/toPromise': 'Rx.Observable.prototype',
290 'rxjs/operator/window': 'Rx.Observable.prototype',
291 'rxjs/operator/windowCount': 'Rx.Observable.prototype',
292 'rxjs/operator/windowToggle': 'Rx.Observable.prototype',
293 'rxjs/operator/windowWhen': 'Rx.Observable.prototype',
294 'rxjs/operator/withLatestFrom': 'Rx.Observable.prototype',
295 'rxjs/operator/zipAll': 'Rx.Observable.prototype',
296 'rxjs/operator/zipProto': 'Rx.Observable.prototype',
297 'rxjs/symbol/iterator': 'Rx.Symbol',
298 'rxjs/symbol/observable': 'Rx.Symbol',
299 'rxjs/symbol/rxSubscriber': 'Rx.Symbol',
300};
301
302const cssmin = new CleanCSS();
303const htmlminOpts = {
304 caseSensitive: true,
305 collapseWhitespace: true,
306 removeComments: true,
307};
308
309export default {
310 input: 'public_api.ts',
311 output: {
312 format: 'umd',
313 file: 'bundles/x-components.umd.js'
314 },
315 external: Object.keys(globals),
316 plugins: [resolve(), sourcemaps(),
317 angular({
318 // additional replace `templateUrl` and `stylesUrls` in every `.js` file
319 // default: true
320 replace: false,
321 preprocessors: {
322 template: template => minifyHtml(template, htmlminOpts),
323 style: scss => {
324 const css = sass.renderSync({ data: scss }).css;
325 return cssmin.minify(css).styles;
326 }
327}
328}),
329typescript({ useTsconfigDeclarationDir: true }),
330 nodeResolve({ jsnext: true, main: true })],
331 onwarn: () => { return },
332 output: {
333 format: 'umd',
334 name: 'ng.caComponents',
335 globals: globals,
336 sourcemap: true,
337 exports: 'named'
338 }
339}