source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/aot/util.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 8.2 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8const STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
9const GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./;
10const JIT_SUMMARY_FILE = /\.ngsummary\./;
11const JIT_SUMMARY_NAME = /NgSummary$/;
12export function ngfactoryFilePath(filePath, forceSourceFile = false) {
13 const urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile);
14 return `${urlWithSuffix[0]}.ngfactory${normalizeGenFileSuffix(urlWithSuffix[1])}`;
15}
16export function stripGeneratedFileSuffix(filePath) {
17 return filePath.replace(GENERATED_FILE, '.');
18}
19export function isGeneratedFile(filePath) {
20 return GENERATED_FILE.test(filePath);
21}
22export function splitTypescriptSuffix(path, forceSourceFile = false) {
23 if (path.endsWith('.d.ts')) {
24 return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts'];
25 }
26 const lastDot = path.lastIndexOf('.');
27 if (lastDot !== -1) {
28 return [path.substring(0, lastDot), path.substring(lastDot)];
29 }
30 return [path, ''];
31}
32export function normalizeGenFileSuffix(srcFileSuffix) {
33 return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix;
34}
35export function summaryFileName(fileName) {
36 const fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, '');
37 return `${fileNameWithoutSuffix}.ngsummary.json`;
38}
39export function summaryForJitFileName(fileName, forceSourceFile = false) {
40 const urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile);
41 return `${urlWithSuffix[0]}.ngsummary${urlWithSuffix[1]}`;
42}
43export function stripSummaryForJitFileSuffix(filePath) {
44 return filePath.replace(JIT_SUMMARY_FILE, '.');
45}
46export function summaryForJitName(symbolName) {
47 return `${symbolName}NgSummary`;
48}
49export function stripSummaryForJitNameSuffix(symbolName) {
50 return symbolName.replace(JIT_SUMMARY_NAME, '');
51}
52const LOWERED_SYMBOL = /\u0275\d+/;
53export function isLoweredSymbol(name) {
54 return LOWERED_SYMBOL.test(name);
55}
56export function createLoweredSymbol(id) {
57 return `\u0275${id}`;
58}
59//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9hb3QvdXRpbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxNQUFNLHVCQUF1QixHQUFHLGtDQUFrQyxDQUFDO0FBQ25FLE1BQU0sY0FBYyxHQUFHLDZCQUE2QixDQUFDO0FBQ3JELE1BQU0sZ0JBQWdCLEdBQUcsZUFBZSxDQUFDO0FBQ3pDLE1BQU0sZ0JBQWdCLEdBQUcsWUFBWSxDQUFDO0FBRXRDLE1BQU0sVUFBVSxpQkFBaUIsQ0FBQyxRQUFnQixFQUFFLGVBQWUsR0FBRyxLQUFLO0lBQ3pFLE1BQU0sYUFBYSxHQUFHLHFCQUFxQixDQUFDLFFBQVEsRUFBRSxlQUFlLENBQUMsQ0FBQztJQUN2RSxPQUFPLEdBQUcsYUFBYSxDQUFDLENBQUMsQ0FBQyxhQUFhLHNCQUFzQixDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7QUFDcEYsQ0FBQztBQUVELE1BQU0sVUFBVSx3QkFBd0IsQ0FBQyxRQUFnQjtJQUN2RCxPQUFPLFFBQVEsQ0FBQyxPQUFPLENBQUM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