"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.angularCompilerCliPromise = exports.angularCompilerPromise = void 0;
function loadEsmModule(modulePath) {
    return __awaiter(this, void 0, void 0, function* () {
        const namespaceObject = yield new Function('modulePath', `return import(modulePath);`)(modulePath);
        // If it is not ESM then the values needed will be stored in the `default` property.
        // TODO_ESM: This can be removed once `@angular/*` packages are ESM only.
        if (namespaceObject.default) {
            return namespaceObject.default;
        }
        else {
            return namespaceObject;
        }
    });
}
exports.angularCompilerPromise = loadEsmModule('@angular/compiler');
exports.angularCompilerCliPromise = loadEsmModule('@angular/compiler-cli');
