forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
62 lines (54 loc) · 1.28 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const {nodeResolve} = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
/** Removed license banners from input files. */
const stripBannerPlugin = {
name: 'strip-license-banner',
transform(code, _filePath) {
const banner = /(\/\**\s+\*\s@license.*?\*\/)/s.exec(code);
if (!banner) {
return;
}
const [bannerContent] = banner;
const pos = code.indexOf(bannerContent);
if (pos !== -1) {
const result = code.slice(0, pos) + code.slice(pos + bannerContent.length);
return {
code: result.trimStart(),
map: null,
};
}
return {
code: code,
map: null,
};
},
};
const banner = `'use strict';
/**
* @license Angular v0.0.0-PLACEHOLDER
* (c) 2010-2024 Google LLC. https://angular.io/
* License: MIT
*/`;
const plugins = [
nodeResolve({
jail: process.cwd(),
}),
stripBannerPlugin,
commonjs(),
];
const config = {
plugins,
external: ['typescript', 'tslib', /@angular-devkit\/.+/],
output: {
exports: 'auto',
banner,
},
};
module.exports = config;