UNPKG

ngc-webpack

Version:

A wrapper for the @ngtools/webpack with hooks into the compilation process

38 lines 1.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function hasHook(options, name) { if (Array.isArray(name)) { return name.map(function (n) { return typeof options[n] === 'function'; }); } else { return typeof options[name] === 'function'; } } exports.hasHook = hasHook; function isValidAngularCompilerPlugin(instance) { return validators.every(function (m) { return m(instance); }); } exports.isValidAngularCompilerPlugin = isValidAngularCompilerPlugin; var validators = [ function (instance) { return Array.isArray(instance._transformers); }, function (instance) { return !!instance._compilerHost; }, function (instance) { return !!instance._compilerHost._resourceLoader; }, function (instance) { return typeof instance._compilerHost._resourceLoader.get === 'function'; } ]; function promiseWrapper() { var wrapper = {}; wrapper.promise = new Promise(function (res, rej) { wrapper.resolve = res; wrapper.reject = rej; }); return wrapper; } exports.promiseWrapper = promiseWrapper; function promisify(f, thisContext) { return function () { var args = Array.prototype.slice.call(arguments); return new Promise(function (resolve, reject) { args.push(function (err, result) { return err !== null ? reject(err) : resolve(result); }); f.apply(thisContext, args); }); }; } exports.promisify = promisify; //# sourceMappingURL=utils.js.map