plugin-loader.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. // TODO: Add tests for browser @plugin
  3. /* global window */
  4. var __extends = (this && this.__extends) || (function () {
  5. var extendStatics = function (d, b) {
  6. extendStatics = Object.setPrototypeOf ||
  7. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9. return extendStatics(d, b);
  10. };
  11. return function (d, b) {
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var __importDefault = (this && this.__importDefault) || function (mod) {
  18. return (mod && mod.__esModule) ? mod : { "default": mod };
  19. };
  20. Object.defineProperty(exports, "__esModule", { value: true });
  21. var abstract_plugin_loader_js_1 = __importDefault(require("../less/environment/abstract-plugin-loader.js"));
  22. /**
  23. * Browser Plugin Loader
  24. */
  25. var PluginLoader = /** @class */ (function (_super) {
  26. __extends(PluginLoader, _super);
  27. function PluginLoader(less) {
  28. var _this = _super.call(this) || this;
  29. _this.less = less;
  30. return _this;
  31. // Should we shim this.require for browser? Probably not?
  32. }
  33. PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) {
  34. return new Promise(function (fulfill, reject) {
  35. fileManager.loadFile(filename, basePath, context, environment)
  36. .then(fulfill).catch(reject);
  37. });
  38. };
  39. return PluginLoader;
  40. }(abstract_plugin_loader_js_1.default));
  41. exports.default = PluginLoader;
  42. //# sourceMappingURL=plugin-loader.js.map