ts-lit-plugin
Version:
Typescript plugin that adds type checking and code completion to lit-html
48 lines (47 loc) • 1.95 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var lit_analyzer_1 = require("lit-analyzer");
var logger_1 = require("../logger");
var LitPluginContext = /** @class */ (function (_super) {
__extends(LitPluginContext, _super);
function LitPluginContext() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.logger = logger_1.logger;
return _this;
}
LitPluginContext.prototype.updateConfig = function (config) {
var hasChangedLogging = this.config.logging !== config.logging || this.config.cwd !== config.cwd;
// Setup logging
this.logger.cwd = config.cwd;
this.logger.level = (function () {
switch (config.logging) {
case "off":
return logger_1.LoggingLevel.OFF;
case "verbose":
return logger_1.LoggingLevel.VERBOSE;
default:
return logger_1.LoggingLevel.OFF;
}
})();
if (hasChangedLogging) {
this.logger.resetLogs();
}
_super.prototype.updateConfig.call(this, config);
logger_1.logger.debug("Updating the config", config);
};
return LitPluginContext;
}(lit_analyzer_1.DefaultLitAnalyzerContext));
exports.LitPluginContext = LitPluginContext;