-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathnormalize-source-maps.ts
32 lines (28 loc) · 1 KB
/
normalize-source-maps.ts
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
/**
* @license
* Copyright Google Inc. 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.io/license
*/
import { SourceMapOptions } from '../browser/schema';
export interface NormalizedSourceMaps {
sourceMap: boolean;
scriptsSourceMap: boolean;
stylesSourceMap: boolean;
hiddenSourceMap: boolean;
vendorSourceMap: boolean;
}
export function normalizeSourceMaps(sourceMap: SourceMapOptions): NormalizedSourceMaps {
const scriptsSourceMap = !!(typeof sourceMap === 'object' ? sourceMap.scripts : sourceMap);
const stylesSourceMap = !!(typeof sourceMap === 'object' ? sourceMap.styles : sourceMap);
const hiddenSourceMap = typeof sourceMap === 'object' && !!sourceMap.hidden;
const vendorSourceMap = typeof sourceMap === 'object' && !!sourceMap.vendor;
return {
sourceMap: stylesSourceMap || scriptsSourceMap,
vendorSourceMap,
hiddenSourceMap,
scriptsSourceMap,
stylesSourceMap,
};
}