source: trip-planner-front/node_modules/@angular/compiler/src/aot/lazy_routes.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 9.0 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 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/aot/lazy_routes", ["require", "exports", "tslib", "@angular/compiler/src/compile_metadata"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.parseLazyRoute = exports.listLazyRoutes = void 0;
20 var tslib_1 = require("tslib");
21 var compile_metadata_1 = require("@angular/compiler/src/compile_metadata");
22 function listLazyRoutes(moduleMeta, reflector) {
23 var e_1, _a, e_2, _b;
24 var allLazyRoutes = [];
25 try {
26 for (var _c = tslib_1.__values(moduleMeta.transitiveModule.providers), _d = _c.next(); !_d.done; _d = _c.next()) {
27 var _e = _d.value, provider = _e.provider, module = _e.module;
28 if (compile_metadata_1.tokenReference(provider.token) === reflector.ROUTES) {
29 var loadChildren = _collectLoadChildren(provider.useValue);
30 try {
31 for (var loadChildren_1 = (e_2 = void 0, tslib_1.__values(loadChildren)), loadChildren_1_1 = loadChildren_1.next(); !loadChildren_1_1.done; loadChildren_1_1 = loadChildren_1.next()) {
32 var route = loadChildren_1_1.value;
33 allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference));
34 }
35 }
36 catch (e_2_1) { e_2 = { error: e_2_1 }; }
37 finally {
38 try {
39 if (loadChildren_1_1 && !loadChildren_1_1.done && (_b = loadChildren_1.return)) _b.call(loadChildren_1);
40 }
41 finally { if (e_2) throw e_2.error; }
42 }
43 }
44 }
45 }
46 catch (e_1_1) { e_1 = { error: e_1_1 }; }
47 finally {
48 try {
49 if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
50 }
51 finally { if (e_1) throw e_1.error; }
52 }
53 return allLazyRoutes;
54 }
55 exports.listLazyRoutes = listLazyRoutes;
56 function _collectLoadChildren(routes, target) {
57 var e_3, _a;
58 if (target === void 0) { target = []; }
59 if (typeof routes === 'string') {
60 target.push(routes);
61 }
62 else if (Array.isArray(routes)) {
63 try {
64 for (var routes_1 = tslib_1.__values(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
65 var route = routes_1_1.value;
66 _collectLoadChildren(route, target);
67 }
68 }
69 catch (e_3_1) { e_3 = { error: e_3_1 }; }
70 finally {
71 try {
72 if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
73 }
74 finally { if (e_3) throw e_3.error; }
75 }
76 }
77 else if (routes.loadChildren) {
78 _collectLoadChildren(routes.loadChildren, target);
79 }
80 else if (routes.children) {
81 _collectLoadChildren(routes.children, target);
82 }
83 return target;
84 }
85 function parseLazyRoute(route, reflector, module) {
86 var _a = tslib_1.__read(route.split('#'), 2), routePath = _a[0], routeName = _a[1];
87 var referencedModule = reflector.resolveExternalReference({
88 moduleName: routePath,
89 name: routeName,
90 }, module ? module.filePath : undefined);
91 return { route: route, module: module || referencedModule, referencedModule: referencedModule };
92 }
93 exports.parseLazyRoute = parseLazyRoute;
94});
95//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eV9yb3V0ZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvYW90L2xhenlfcm91dGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFFSCwyRUFBNEU7SUFZNUUsU0FBZ0Is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