New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ts-unused-exports

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-unused-exports - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

spec/data/index-dir/index.ts

17

lib/parser.js

@@ -151,2 +151,17 @@ "use strict";

};
var resolvePath = function (rootDir) { return function (path) {
var tsPath = path + ".ts";
if (fs_1.existsSync(path_1.resolve(rootDir, tsPath)))
return tsPath;
var tsxPath = path + ".tsx";
if (fs_1.existsSync(path_1.resolve(rootDir, tsxPath)))
return tsxPath;
var tsIndexPath = path + "/index.ts";
if (fs_1.existsSync(path_1.resolve(rootDir, tsIndexPath)))
return tsIndexPath;
var tsxIndexPath = path + "/index.tsx";
if (fs_1.existsSync(path_1.resolve(rootDir, tsxIndexPath)))
return tsxIndexPath;
throw "Cannot find module '" + path + "'.\n I've tried the following paths and none of them works:\n - " + tsPath + "\n - " + tsxPath + "\n - " + tsIndexPath + "\n - " + tsxIndexPath + "\n ";
}; };
var parsePaths = function (rootDir, paths, baseUrl, otherFiles) {

@@ -159,3 +174,3 @@ var files = otherFiles.concat(paths

var missingImports = (_a = []).concat.apply(_a, files.map(function (f) { return Object.keys(f.imports); })).filter(function (i) { return !found[i]; })
.map(function (i) { return i + ".ts"; });
.map(resolvePath(rootDir));
return missingImports.length

@@ -162,0 +177,0 @@ ? parsePaths(rootDir, missingImports, baseUrl, files)

2

package.json
{
"name": "ts-unused-exports",
"version": "2.0.3",
"version": "2.0.4",
"description": "ts-unused-exports finds unused exported symbols in your Typescript project",

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

@@ -34,2 +34,7 @@ const { join } = require('path');

it('handles import from directory index', () => {
const result = testWith(['./index-dir/index.ts']);
expect(result).toEqual({});
});
describe('indexed modules', () => {

@@ -36,0 +41,0 @@ const testIndex = (paths, expected) => expect(

@@ -183,2 +183,24 @@ import { existsSync, readFileSync } from 'fs';

const resolvePath = (rootDir:string) => (path:string):string => {
const tsPath = `${path}.ts`;
if (existsSync(resolve(rootDir, tsPath))) return tsPath;
const tsxPath = `${path}.tsx`;
if (existsSync(resolve(rootDir, tsxPath))) return tsxPath;
const tsIndexPath = `${path}/index.ts`;
if (existsSync(resolve(rootDir, tsIndexPath))) return tsIndexPath;
const tsxIndexPath = `${path}/index.tsx`;
if (existsSync(resolve(rootDir, tsxIndexPath))) return tsxIndexPath;
throw `Cannot find module '${path}'.
I've tried the following paths and none of them works:
- ${tsPath}
- ${tsxPath}
- ${tsIndexPath}
- ${tsxIndexPath}
`;
};
const parsePaths = (

@@ -202,3 +224,3 @@ rootDir:string,

.filter(i => !found[i])
.map(i => `${i}.ts`);
.map(resolvePath(rootDir));

@@ -205,0 +227,0 @@ return missingImports.length

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