1 | "use strict";
|
2 | exports.__esModule = true;
|
3 | exports.isIvyEnabled = void 0;
|
4 | var core_1 = require("@angular-devkit/core");
|
5 | var json_utilts_1 = require("./json-utilts");
|
6 |
|
7 | function isIvyEnabled(tree, tsConfigPath) {
|
8 |
|
9 |
|
10 | var buffer = tree.read(tsConfigPath);
|
11 | if (!buffer) {
|
12 | return true;
|
13 | }
|
14 | var tsCfgAst = core_1.parseJsonAst(buffer.toString(), core_1.JsonParseMode.Loose);
|
15 | if (tsCfgAst.kind !== 'object') {
|
16 | return true;
|
17 | }
|
18 | var ngCompilerOptions = json_utilts_1.findPropertyInAstObject(tsCfgAst, 'angularCompilerOptions');
|
19 | if (ngCompilerOptions && ngCompilerOptions.kind === 'object') {
|
20 | var enableIvy = json_utilts_1.findPropertyInAstObject(ngCompilerOptions, 'enableIvy');
|
21 | if (enableIvy) {
|
22 | return !!enableIvy.value;
|
23 | }
|
24 | }
|
25 | var configExtends = json_utilts_1.findPropertyInAstObject(tsCfgAst, 'extends');
|
26 | if (configExtends && configExtends.kind === 'string') {
|
27 | var extendedTsConfigPath = core_1.resolve(core_1.dirname(core_1.normalize(tsConfigPath)), core_1.normalize(configExtends.value));
|
28 | return isIvyEnabled(tree, extendedTsConfigPath);
|
29 | }
|
30 | return true;
|
31 | }
|
32 | exports.isIvyEnabled = isIvyEnabled;
|
33 |
|
\ | No newline at end of file |