Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/mithotyn

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/mithotyn - npm Package Compare versions

Comparing version 0.24.0-dev.20210218 to 0.24.0-dev.20210219

31

index.js

@@ -28,7 +28,7 @@ "use strict";

const lsPlugin = r('@fimbul/wotan/language-service');
if (lsPlugin.version !== '1') // in case we need to make breaking changes to the plugin API
if (lsPlugin.version !== '1' && lsPlugin.version !== '2') // in case we need to make breaking changes to the API
throw new Error(`Unsupported version of '@fimbul/wotan'. Consider updating '${config.name}'.`);
log('setting up plugin');
plugin = new lsPlugin.LanguageServiceInterceptor(config, project, serverHost, languageService, r, log);
const proxy = createProxy(languageService, plugin, log);
const proxy = createProxy(languageService, plugin, log, lsPlugin.version);
if (!('getSupportedCodeFixes' in languageService) && typeof plugin.getSupportedCodeFixes === 'function') {

@@ -56,16 +56,21 @@ // TODO avoid monkey-patching: https://github.com/Microsoft/TypeScript/issues/28966#issuecomment-446729292

};
function createProxy(ls, interceptor, log) {
function createProxy(ls, interceptor, log, version) {
const proxy = Object.create(null);
for (const method of Object.keys(ls)) {
if (typeof interceptor[method] === 'function') {
proxy[method] = (...args) => {
const prev = ls[method](...args);
try {
return interceptor[method](prev, ...args);
}
catch (e) {
log(`interceptor for '${method}' failed: ${e && e.message}`);
return prev;
}
};
if (version === '1') {
proxy[method] = (...args) => {
const prev = ls[method](...args);
try {
return interceptor[method](prev, ...args);
}
catch (e) {
log(`interceptor for '${method}' failed: ${e === null || e === void 0 ? void 0 : e.message}`);
return prev;
}
};
}
else {
proxy[method] = interceptor[method].bind(interceptor);
}
}

@@ -72,0 +77,0 @@ else {

{
"name": "@fimbul/mithotyn",
"version": "0.24.0-dev.20210218",
"version": "0.24.0-dev.20210219",
"description": "TypeScript LanguageService plugin for the Fimbullinter project",

@@ -5,0 +5,0 @@ "main": "index",

@@ -57,3 +57,3 @@ # Mithotyn

* `displayErrorsAsWarnings: boolean`: Report findings with severity `error` as warning to make them distinguishable from real type errors (e.g. green instead of red squiggles in VS Code)
* `displayErrorsAsWarnings: boolean`: Report findings with severity `error` as warning to make them distinguishable from real type errors (e.g. yellow instead of red squiggles in VS Code)

@@ -99,3 +99,2 @@ Example:

* Currently only works with TypeScript installed in your workspace, see [Usage in VS Code](#usage-in-vs-code)
* doesn't provide code fixes for findings
* doesn't validate `.wotanrc.yaml` and `.fimbullinter.yaml` files

@@ -102,0 +101,0 @@ * doesn't refresh lint findings if configuration changes; you need to reopen or change the file

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc