Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
3.5 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
10 | exports.findMainModuleExpression = void 0;
|
---|
11 | const ts = require("typescript");
|
---|
12 | /**
|
---|
13 | * Finds the main Angular module within the specified source file. The first module
|
---|
14 | * that is part of the "bootstrapModule" expression is returned.
|
---|
15 | */
|
---|
16 | function findMainModuleExpression(mainSourceFile) {
|
---|
17 | let foundModule = null;
|
---|
18 | const visitNode = (node) => {
|
---|
19 | if (ts.isCallExpression(node) && node.arguments.length &&
|
---|
20 | ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) &&
|
---|
21 | node.expression.name.text === 'bootstrapModule') {
|
---|
22 | foundModule = node.arguments[0];
|
---|
23 | }
|
---|
24 | else {
|
---|
25 | ts.forEachChild(node, visitNode);
|
---|
26 | }
|
---|
27 | };
|
---|
28 | ts.forEachChild(mainSourceFile, visitNode);
|
---|
29 | return foundModule;
|
---|
30 | }
|
---|
31 | exports.findMainModuleExpression = findMainModuleExpression;
|
---|
32 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmluZC1tYWluLW1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9zY2hlbWF0aWNzL25nLXVwZGF0ZS9taWdyYXRpb25zL2hhbW1lci1nZXN0dXJlcy12OS9maW5kLW1haW4tbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiO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xuICByZXR1cm4gZm91bmRNb2R1bGU7XG59XG4iXX0= |
---|
Note:
See
TracBrowser
for help on using the repository browser.