1 | /**
|
2 | * @license
|
3 | * Copyright Google Inc. 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-cli/src/ngtools_api", ["require", "exports", "tslib", "@angular/compiler-cli/src/transformers/compiler_host", "@angular/compiler-cli/src/transformers/entry_points"], factory);
|
15 | }
|
16 | })(function (require, exports) {
|
17 | ;
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | var tslib_1 = require("tslib");
|
20 | var compiler_host_1 = require("@angular/compiler-cli/src/transformers/compiler_host");
|
21 | var entry_points_1 = require("@angular/compiler-cli/src/transformers/entry_points");
|
22 | /**
|
23 | * @internal
|
24 | * @deprecatd Use ngtools_api2 instead!
|
25 | */
|
26 | var NgTools_InternalApi_NG_2 = /** @class */ (function () {
|
27 | function NgTools_InternalApi_NG_2() {
|
28 | }
|
29 | /**
|
30 | * @internal
|
31 | */
|
32 | NgTools_InternalApi_NG_2.codeGen = function (options) {
|
33 | throw throwNotSupportedError();
|
34 | };
|
35 | /**
|
36 | * @internal
|
37 | */
|
38 | NgTools_InternalApi_NG_2.listLazyRoutes = function (options) {
|
39 | var e_1, _a;
|
40 | // TODO(tbosch): Also throwNotSupportedError once Angular CLI 1.5.1 ships,
|
41 | // as we only needed this to support Angular CLI 1.5.0 rc.*
|
42 | var ngProgram = entry_points_1.createProgram({
|
43 | rootNames: options.program.getRootFileNames(),
|
44 | options: tslib_1.__assign({}, options.angularCompilerOptions, { collectAllErrors: true }),
|
45 | host: options.host
|
46 | });
|
47 | var lazyRoutes = ngProgram.listLazyRoutes(options.entryModule);
|
48 | try {
|
49 | // reset the referencedFiles that the ng.Program added to the SourceFiles
|
50 | // as the host might be caching the source files!
|
51 | for (var _b = tslib_1.__values(options.program.getSourceFiles()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
52 | var sourceFile = _c.value;
|
53 | var originalReferences = compiler_host_1.getOriginalReferences(sourceFile);
|
54 | if (originalReferences) {
|
55 | sourceFile.referencedFiles = originalReferences;
|
56 | }
|
57 | }
|
58 | }
|
59 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
60 | finally {
|
61 | try {
|
62 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
63 | }
|
64 | finally { if (e_1) throw e_1.error; }
|
65 | }
|
66 | var result = {};
|
67 | lazyRoutes.forEach(function (lazyRoute) {
|
68 | var route = lazyRoute.route;
|
69 | var referencedFilePath = lazyRoute.referencedModule.filePath;
|
70 | if (result[route] && result[route] != referencedFilePath) {
|
71 | throw new Error("Duplicated path in loadChildren detected: \"" + route + "\" is used in 2 loadChildren, " +
|
72 | ("but they point to different modules \"(" + result[route] + " and ") +
|
73 | ("\"" + referencedFilePath + "\"). Webpack cannot distinguish on context and would fail to ") +
|
74 | 'load the proper one.');
|
75 | }
|
76 | result[route] = referencedFilePath;
|
77 | });
|
78 | return result;
|
79 | };
|
80 | /**
|
81 | * @internal
|
82 | */
|
83 | NgTools_InternalApi_NG_2.extractI18n = function (options) {
|
84 | throw throwNotSupportedError();
|
85 | };
|
86 | return NgTools_InternalApi_NG_2;
|
87 | }());
|
88 | exports.NgTools_InternalApi_NG_2 = NgTools_InternalApi_NG_2;
|
89 | function throwNotSupportedError() {
|
90 | throw new Error("Please update @angular/cli. Angular 5+ requires at least Angular CLI 1.5+");
|
91 | }
|
92 | });
|
93 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd0b29sc19hcGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci1jbGkvc3JjL25ndG9vbHNfYXBpLnRzIl0sIm5hbW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