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

@fimbul/wotan

Package Overview
Dependencies
Maintainers
2
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/wotan - npm Package Compare versions

Comparing version 0.2.0-dev.20180220 to 0.2.0-dev.20180221

src/services/default/cache-factory.d.ts

2

index.d.ts

@@ -6,3 +6,3 @@ import 'reflect-metadata';

export * from './src/di/default.module';
export * from './src/services/default/cache-manager';
export * from './src/services/default/cache-factory';
export * from './src/services/default/deprecation-handler';

@@ -9,0 +9,0 @@ export * from './src/services/default/directory-service';

@@ -9,3 +9,3 @@ "use strict";

tslib_1.__exportStar(require("./src/di/default.module"), exports);
tslib_1.__exportStar(require("./src/services/default/cache-manager"), exports);
tslib_1.__exportStar(require("./src/services/default/cache-factory"), exports);
tslib_1.__exportStar(require("./src/services/default/deprecation-handler"), exports);

@@ -12,0 +12,0 @@ tslib_1.__exportStar(require("./src/services/default/directory-service"), exports);

{
"name": "@fimbul/wotan",
"version": "0.2.0-dev.20180220",
"version": "0.2.0-dev.20180221",
"description": "Pluggable TypeScript and JavaScript linter",

@@ -5,0 +5,0 @@ "bin": "bin/main.js",

@@ -129,2 +129,3 @@ "use strict";

let format;
let config;
outer: for (let i = 0; i < args.length; ++i) {

@@ -137,2 +138,6 @@ const arg = args[i];

break;
case '-c':
case '--config':
config = expectStringArgument(args, ++i, arg);
break;
case '-m':

@@ -158,2 +163,3 @@ case '--module':

modules,
config,
command: "show",

@@ -160,0 +166,0 @@ file: files[0],

@@ -30,4 +30,5 @@ import 'reflect-metadata';

format: Format | undefined;
config: string | undefined;
}
export declare type Command = LintCommand | ShowCommand | ValidateCommand | TestCommand;
export declare function runCommand(command: Command, diContainer?: Container): Promise<boolean>;

@@ -134,3 +134,5 @@ "use strict";

run(options) {
const config = this.configManager.find(options.file);
const config = options.config === undefined
? this.configManager.find(options.file)
: this.configManager.loadLocalOrResolved(options.config);
if (config === undefined)

@@ -137,0 +139,0 @@ throw new error_1.ConfigurationError(`Could not find configuration for '${options.file}'.`);

@@ -8,3 +8,3 @@ "use strict";

const resolver_1 = require("../services/default/resolver");
const cache_manager_1 = require("../services/default/cache-manager");
const cache_factory_1 = require("../services/default/cache-factory");
const file_system_1 = require("../services/default/file-system");

@@ -23,4 +23,4 @@ const message_handler_1 = require("../services/default/message-handler");

bind(types_1.Resolver).to(resolver_1.NodeResolver);
if (!isBound(types_1.CacheManager))
bind(types_1.CacheManager).to(cache_manager_1.DefaultCacheManager);
if (!isBound(types_1.CacheFactory))
bind(types_1.CacheFactory).to(cache_factory_1.DefaultCacheFactory);
if (!isBound(types_1.FileSystem))

@@ -27,0 +27,0 @@ bind(types_1.FileSystem).to(file_system_1.NodeFileSystem);

@@ -10,3 +10,3 @@ import { AbstractFormatter, FileSummary } from '../types';

format(fileName: string, summary: FileSummary): undefined;
flush(): string;
flush(): string | undefined;
}

@@ -76,5 +76,5 @@ "use strict";

}
return lines
.slice(1)
.join('\n');
return lines.length === 0
? undefined
: lines.slice(1).join('\n');
}

@@ -81,0 +81,0 @@ }

@@ -61,3 +61,3 @@ "use strict";

return this.scannerFallback(signature, typeParameters, node);
const { typeArguments } = this.checker.signatureToSignatureDeclaration(signature, ts.SyntaxKind.CallExpression, undefined, ts.NodeBuilderFlags.WriteTypeArgumentsOfSignature);
const { typeArguments } = this.checker.signatureToSignatureDeclaration(signature, ts.SyntaxKind.CallExpression, undefined, ts.NodeBuilderFlags.WriteTypeArgumentsOfSignature | ts.NodeBuilderFlags.IgnoreErrors);
if (typeArguments === undefined)

@@ -64,0 +64,0 @@ return;

@@ -25,3 +25,2 @@ import { Linter } from './linter';

private lintFiles(options, config);
private resolveConfig(pathOrName);
private getFilesAndProgram(project, patterns, exclude, host);

@@ -28,0 +27,0 @@ private checkConfigDirectory(fileOrDirName);

@@ -27,3 +27,3 @@ "use strict";

lintCollection(options) {
const config = options.config !== undefined ? this.resolveConfig(options.config) : undefined;
const config = options.config !== undefined ? this.configManager.loadLocalOrResolved(options.config) : undefined;
if (options.project === undefined && options.files.length !== 0)

@@ -124,9 +124,2 @@ return this.lintFiles(options, config);

}
resolveConfig(pathOrName) {
const absolute = path.resolve(this.directories.getCurrentDirectory(), pathOrName);
const resolved = this.fs.isFile(absolute)
? absolute
: this.configManager.resolve(pathOrName, this.directories.getCurrentDirectory());
return this.configManager.load(resolved);
}
getFilesAndProgram(project, patterns, exclude, host) {

@@ -133,0 +126,0 @@ const cwd = this.directories.getCurrentDirectory();

@@ -1,2 +0,2 @@

import { FileSystem, CacheManager } from '../types';
import { FileSystem, CacheFactory } from '../types';
export declare const enum FileKind {

@@ -12,3 +12,3 @@ NonExistent = 0,

private realpathCache;
constructor(fs: FileSystem, cache: CacheManager);
constructor(fs: FileSystem, cache: CacheFactory);
isFile(file: string): boolean;

@@ -15,0 +15,0 @@ isDirectory(dir: string): boolean;

@@ -9,4 +9,2 @@ "use strict";

const path = require("path");
const fileKind = new types_1.CacheIdentifier('fileKind');
const realpathCache = new types_1.CacheIdentifier('realpath');
let CachedFileSystem = class CachedFileSystem {

@@ -18,4 +16,4 @@ constructor(fs, cache) {

};
this.fileKindCache = cache.create(fileKind);
this.realpathCache = cache.create(realpathCache);
this.fileKindCache = cache.create();
this.realpathCache = cache.create();
}

@@ -91,5 +89,5 @@ isFile(file) {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.FileSystem, types_1.CacheManager])
tslib_1.__metadata("design:paramtypes", [types_1.FileSystem, types_1.CacheFactory])
], CachedFileSystem);
exports.CachedFileSystem = CachedFileSystem;
//# sourceMappingURL=cached-file-system.js.map

@@ -1,9 +0,12 @@

import { Configuration, CacheManager, ReducedConfiguration, GlobalSettings, DirectoryService, ConfigurationProvider } from '../types';
import { Configuration, CacheFactory, ReducedConfiguration, GlobalSettings, DirectoryService, ConfigurationProvider } from '../types';
import { CachedFileSystem } from './cached-file-system';
export declare class ConfigurationManager {
private directories;
private configProvider;
private fs;
private configCache;
constructor(directories: DirectoryService, configProvider: ConfigurationProvider, cache: CacheManager);
constructor(directories: DirectoryService, configProvider: ConfigurationProvider, fs: CachedFileSystem, cache: CacheFactory);
findPath(file: string): string | undefined;
find(file: string): Configuration | undefined;
loadLocalOrResolved(pathOrName: string): Configuration;
resolve(name: string, basedir: string): string;

@@ -10,0 +13,0 @@ reduce(config: Configuration, file: string): ReducedConfiguration | undefined;

@@ -11,8 +11,9 @@ "use strict";

const isNegated = require("is-negated-glob");
const configCache = new types_1.CacheIdentifier('configuration');
const cached_file_system_1 = require("./cached-file-system");
let ConfigurationManager = class ConfigurationManager {
constructor(directories, configProvider, cache) {
constructor(directories, configProvider, fs, cache) {
this.directories = directories;
this.configProvider = configProvider;
this.configCache = cache.create(configCache);
this.fs = fs;
this.configCache = cache.create();
}

@@ -32,2 +33,6 @@ findPath(file) {

}
loadLocalOrResolved(pathOrName) {
const absolute = path.resolve(this.directories.getCurrentDirectory(), pathOrName);
return this.load(this.fs.isFile(absolute) ? absolute : this.resolve(pathOrName, this.directories.getCurrentDirectory()));
}
resolve(name, basedir) {

@@ -76,3 +81,4 @@ try {

types_1.ConfigurationProvider,
types_1.CacheManager])
cached_file_system_1.CachedFileSystem,
types_1.CacheFactory])
], ConfigurationManager);

@@ -79,0 +85,0 @@ exports.ConfigurationManager = ConfigurationManager;

@@ -1,2 +0,2 @@

import { ConfigurationProvider, Resolver, LoadConfigurationContext, Configuration, CacheManager } from '../../types';
import { ConfigurationProvider, Resolver, LoadConfigurationContext, Configuration, CacheFactory } from '../../types';
import { CachedFileSystem } from '../cached-file-system';

@@ -51,3 +51,3 @@ export interface RawConfiguration {

private cache;
constructor(fs: CachedFileSystem, resolver: Resolver, cache: CacheManager);
constructor(fs: CachedFileSystem, resolver: Resolver, cache: CacheFactory);
find(fileToLint: string): string | undefined;

@@ -54,0 +54,0 @@ private findConfigForDirectory(dir);

@@ -14,3 +14,2 @@ "use strict";

exports.CONFIG_FILENAMES = exports.CONFIG_EXTENSIONS.map((ext) => '.wotanrc' + ext);
const cacheId = new types_1.CacheIdentifier('configPath');
let DefaultConfigurationProvider = class DefaultConfigurationProvider {

@@ -20,3 +19,3 @@ constructor(fs, resolver, cache) {

this.resolver = resolver;
this.cache = cache.create(cacheId);
this.cache = cache.create();
}

@@ -125,3 +124,3 @@ find(fileToLint) {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [cached_file_system_1.CachedFileSystem, types_1.Resolver, types_1.CacheManager])
tslib_1.__metadata("design:paramtypes", [cached_file_system_1.CachedFileSystem, types_1.Resolver, types_1.CacheFactory])
], DefaultConfigurationProvider);

@@ -128,0 +127,0 @@ exports.DefaultConfigurationProvider = DefaultConfigurationProvider;

@@ -1,8 +0,8 @@

import { ProcessorConstructor, Resolver, CacheManager } from '../types';
import { ProcessorConstructor, Resolver, CacheFactory } from '../types';
export declare class ProcessorLoader {
private resolver;
private cache;
constructor(resolver: Resolver, cache: CacheManager);
constructor(resolver: Resolver, cache: CacheFactory);
loadProcessor(path: string): ProcessorConstructor;
private requireProcessor(path);
}

@@ -9,7 +9,6 @@ "use strict";

const error_1 = require("../error");
const cacheId = new types_1.CacheIdentifier('processor');
let ProcessorLoader = class ProcessorLoader {
constructor(resolver, cache) {
this.resolver = resolver;
this.cache = cache.create(cacheId);
this.cache = cache.create();
}

@@ -41,5 +40,5 @@ loadProcessor(path) {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.Resolver, types_1.CacheManager])
tslib_1.__metadata("design:paramtypes", [types_1.Resolver, types_1.CacheFactory])
], ProcessorLoader);
exports.ProcessorLoader = ProcessorLoader;
//# sourceMappingURL=processor-loader.js.map

@@ -1,2 +0,2 @@

import { RuleLoaderHost, RuleConstructor, MessageHandler, CacheManager } from '../types';
import { RuleLoaderHost, RuleConstructor, MessageHandler, CacheFactory } from '../types';
export declare class RuleLoader {

@@ -6,3 +6,3 @@ private host;

private cache;
constructor(host: RuleLoaderHost, logger: MessageHandler, cache: CacheManager);
constructor(host: RuleLoaderHost, logger: MessageHandler, cache: CacheFactory);
loadRule(name: string, directories: ReadonlyArray<string> | undefined): RuleConstructor | undefined;

@@ -9,0 +9,0 @@ private loadCoreRule(name);

@@ -9,3 +9,2 @@ "use strict";

const utils_1 = require("../utils");
const cacheId = new types_1.CacheIdentifier('rules');
const log = debug('wotan:ruleLoader');

@@ -16,3 +15,3 @@ let RuleLoader = class RuleLoader {

this.logger = logger;
this.cache = cache.create(cacheId);
this.cache = cache.create();
}

@@ -58,5 +57,5 @@ loadRule(name, directories) {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.RuleLoaderHost, types_1.MessageHandler, types_1.CacheManager])
tslib_1.__metadata("design:paramtypes", [types_1.RuleLoaderHost, types_1.MessageHandler, types_1.CacheFactory])
], RuleLoader);
exports.RuleLoader = RuleLoader;
//# sourceMappingURL=rule-loader.js.map

@@ -241,7 +241,7 @@ import * as ts from 'typescript';

}
export interface CacheManager {
get<K, V>(id: CacheIdentifier<K, V>): Cache<K, V> | undefined;
create<K, V>(id: CacheIdentifier<K, V>): Cache<K, V>;
export interface CacheFactory {
create<K extends object, V = any>(weak: true): Cache<K, V>;
create<K = any, V = any>(weak?: false): Cache<K, V>;
}
export declare abstract class CacheManager {
export declare abstract class CacheFactory {
}

@@ -255,12 +255,2 @@ export interface Cache<K, V> {

}
export declare class CacheIdentifier<K, V> {
description: string;
readonly weak: boolean;
protected key: K;
protected value: V;
constructor(description: string);
}
export declare class WeakCacheIdentifier<K extends object, V> extends CacheIdentifier<K, V> {
readonly weak: boolean;
}
export interface Resolver {

@@ -267,0 +257,0 @@ resolve(id: string, basedir: string, extensions: string[], paths?: string[]): string;

@@ -118,19 +118,5 @@ "use strict";

exports.FormatterLoaderHost = FormatterLoaderHost;
class CacheManager {
class CacheFactory {
}
exports.CacheManager = CacheManager;
class CacheIdentifier {
constructor(description) {
this.description = description;
this.weak = false;
}
}
exports.CacheIdentifier = CacheIdentifier;
class WeakCacheIdentifier extends CacheIdentifier {
constructor() {
super(...arguments);
this.weak = true;
}
}
exports.WeakCacheIdentifier = WeakCacheIdentifier;
exports.CacheFactory = CacheFactory;
class Resolver {

@@ -137,0 +123,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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