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

type-coverage

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-coverage - npm Package Compare versions

Comparing version 1.3.0-alpha.1 to 1.3.0-alpha.2

8

dist/core.js

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

async function lint(project, detail, debug) {
const { configFilePath, basename } = tsconfig_1.getTsConfigFilePath(project);
const config = tsconfig_1.getTsConfig(configFilePath, basename);
const { options: compilerOptions, errors } = typescript_1.default.convertCompilerOptionsFromJson(config.compilerOptions, basename);
const { configFilePath, dirname } = tsconfig_1.getTsConfigFilePath(project);
const config = tsconfig_1.getTsConfig(configFilePath, dirname);
const { options: compilerOptions, errors } = typescript_1.default.convertCompilerOptionsFromJson(config.compilerOptions, dirname);
if (errors && errors.length > 0) {
throw errors;
}
const rootNames = await tsconfig_1.getRootNames(config, basename);
const rootNames = await tsconfig_1.getRootNames(config, dirname);
const program = typescript_1.default.createProgram(rootNames, compilerOptions);

@@ -18,0 +18,0 @@ const checker = program.getTypeChecker();

export declare function getTsConfigFilePath(project: string): {
configFilePath: string;
basename: string;
dirname: string;
};

@@ -14,4 +14,4 @@ declare type JsonConfig = {

};
export declare function getTsConfig(configFilePath: string, basename: string): JsonConfig;
export declare function getRootNames(config: JsonConfig, basename: string): Promise<string[]>;
export declare function getTsConfig(configFilePath: string, dirname: string): JsonConfig;
export declare function getRootNames(config: JsonConfig, dirname: string): Promise<string[]>;
export {};

@@ -10,11 +10,11 @@ "use strict";

let configFilePath;
let basename;
let dirname;
const projectStats = fs.statSync(project);
if (projectStats.isDirectory()) {
configFilePath = path.resolve(project, 'tsconfig.json');
basename = project;
dirname = project;
}
else if (projectStats.isFile()) {
configFilePath = project;
basename = path.basename(project);
dirname = path.dirname(project);
}

@@ -24,6 +24,6 @@ else {

}
return { configFilePath, basename };
return { configFilePath, dirname };
}
exports.getTsConfigFilePath = getTsConfigFilePath;
function getTsConfig(configFilePath, basename) {
function getTsConfig(configFilePath, dirname) {
const configResult = typescript_1.default.readConfigFile(configFilePath, p => fs.readFileSync(p).toString());

@@ -35,4 +35,4 @@ if (configResult.error) {

if (config.extends) {
const project = path.resolve(basename, config.extends);
const { configFilePath, basename: extendsBasename } = getTsConfigFilePath(project);
const project = path.resolve(dirname, config.extends);
const { configFilePath, dirname: extendsBasename } = getTsConfigFilePath(project);
const extendsConfig = getTsConfig(configFilePath, extendsBasename);

@@ -45,7 +45,7 @@ config.compilerOptions = { ...extendsConfig.compilerOptions, ...config.compilerOptions };

// tslint:disable-next-line:cognitive-complexity
async function getRootNames(config, basename) {
async function getRootNames(config, dirname) {
const include = config.include;
const exclude = config.exclude || ['./node_modules/**'];
if (config.files) {
return config.files.map(f => path.relative(process.cwd(), path.resolve(basename, f)));
return config.files.map(f => path.relative(process.cwd(), path.resolve(dirname, f)));
}

@@ -55,3 +55,3 @@ if (include && Array.isArray(include) && include.length > 0) {

for (const file of include) {
const currentPath = path.resolve(basename, file);
const currentPath = path.resolve(dirname, file);
const stats = await statAsync(currentPath);

@@ -70,3 +70,3 @@ if (stats === undefined) {

}
return globAsync(`${basename}/**/*.{ts,tsx}`, exclude);
return globAsync(`${dirname}/**/*.{ts,tsx}`, exclude);
}

@@ -73,0 +73,0 @@ exports.getRootNames = getRootNames;

{
"name": "type-coverage",
"version": "1.3.0-alpha.1",
"version": "1.3.0-alpha.2",
"description": "A CLI tool to check type coverage for typescript code",

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

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