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/core/schematics/migrations/relative-link-resolution/util", ["require", "exports", "typescript", "@angular/core/schematics/utils/typescript/imports"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.isExtraOptions = exports.isRouterModuleForRoot = void 0;
|
---|
20 | const ts = require("typescript");
|
---|
21 | const imports_1 = require("@angular/core/schematics/utils/typescript/imports");
|
---|
22 | /** Determine whether a node is a ModuleWithProviders type reference node without a generic type */
|
---|
23 | function isRouterModuleForRoot(typeChecker, node) {
|
---|
24 | if (!ts.isCallExpression(node) || !ts.isPropertyAccessExpression(node.expression) ||
|
---|
25 | !ts.isIdentifier(node.expression.expression) || node.expression.name.text !== 'forRoot') {
|
---|
26 | return false;
|
---|
27 | }
|
---|
28 | const imp = imports_1.getImportOfIdentifier(typeChecker, node.expression.expression);
|
---|
29 | return !!imp && imp.name === 'RouterModule' && imp.importModule === '@angular/router' &&
|
---|
30 | !node.typeArguments;
|
---|
31 | }
|
---|
32 | exports.isRouterModuleForRoot = isRouterModuleForRoot;
|
---|
33 | function isExtraOptions(typeChecker, node) {
|
---|
34 | if (!ts.isTypeReferenceNode(node) || !ts.isIdentifier(node.typeName)) {
|
---|
35 | return false;
|
---|
36 | }
|
---|
37 | const imp = imports_1.getImportOfIdentifier(typeChecker, node.typeName);
|
---|
38 | return imp !== null && imp.name === 'ExtraOptions' && imp.importModule === '@angular/router' &&
|
---|
39 | !node.typeArguments;
|
---|
40 | }
|
---|
41 | exports.isExtraOptions = isExtraOptions;
|
---|
42 | });
|
---|
43 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvc2NoZW1hdGljcy9taWdyYXRpb25zL3JlbGF0aXZlLWxpbmstcmVzb2x1dGlvbi91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7OztJQUVILGlDQUFpQztJQUNqQywrRUFBcUU7SUFFckUsbUdBQW1HO0lBQ25HLFNBQWdCLHFCQUFxQixDQUNqQyxXQUEyQixFQUFFLElBQWE7UUFDNUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQywwQkFBMEIsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDO1lBQzdFLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLFVBQVUsQ0FBQyxJQUFJLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLElBQUksS0FBSyxTQUFTLEVBQUU7WUFDM0YsT0FBTyxLQUFLLENBQUM7U0FDZDtRQUNELE1BQU0sR0FBRyxHQUFHLCtCQUFxQixDQUFDLFdBQVcsRUFBRSxJQUFJLENBQUMsVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBQzNFLE9BQU8sQ0FBQyxDQUFDLEdBQUcsSUFBSSxHQUFHLENBQUMsSUFBSSxLQUFLLGNBQWMsSUFBSSxHQUFHLENBQUMsWUFBWSxLQUFLLGlCQUFpQjtZQUNqRixDQUFDLElBQUksQ0FBQyxhQU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