Socket
Socket
Sign inDemoInstall

unimported

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unimported - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

1

dist/index.d.ts
export interface Context {
version: string;
cwd: string;

@@ -3,0 +4,0 @@ entry: string[];

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

const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("./fs");
const spinner = ora_1.default('initializing').start();

@@ -39,3 +40,5 @@ function main() {

]);
const packageJson = yield fs_1.readJson('../package.json', __dirname);
const context = {
version: packageJson.version,
cwd,

@@ -42,0 +45,0 @@ aliases,

2

dist/print.js

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

const lines = [
`${space} ${caption}`,
`${space} ${caption} ${chalk_1.default.grey('unimported v' + context.version)}`,
divider,

@@ -41,0 +41,0 @@ ...records.reduce((acc, [label, value]) => {

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

const resolve_1 = __importDefault(require("resolve"));
const chalk_1 = __importDefault(require("chalk"));
function getDependencyName(path, context) {

@@ -179,4 +180,12 @@ if (context.type === 'meteor' && path.startsWith('meteor/')) {

}
const parseResult = yield parse(path, context);
result.files.set(path, parseResult);
let parseResult;
try {
parseResult = yield parse(path, context);
result.files.set(path, parseResult);
}
catch (e) {
console.log(chalk_1.default.redBright(`\nFailed parsing ${path}`));
console.log(e);
process.exit(1);
}
for (const file of parseResult.imports) {

@@ -183,0 +192,0 @@ switch (file.type) {

{
"name": "unimported",
"version": "1.0.3",
"version": "1.0.4",
"description": "Scans your nodejs project folder and shows obsolete files and modules",

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

@@ -9,4 +9,6 @@ import * as fs from './fs';

import chalk from 'chalk';
import { readJson } from './fs';
export interface Context {
version: string;
cwd: string;

@@ -22,2 +24,3 @@ entry: string[];

const spinner = ora('initializing').start();
async function main() {

@@ -32,3 +35,6 @@ const cwd = process.cwd();

const packageJson = await readJson('../package.json', __dirname);
const context: Context = {
version: packageJson.version,
cwd,

@@ -57,2 +63,3 @@ aliases,

}
// traverse all source files and get import data

@@ -59,0 +66,0 @@ context.entry = await meta.getEntry(cwd, context);

@@ -49,3 +49,5 @@ import termSize from 'term-size';

const lines = [
`${space} ${caption}`,
`${space} ${caption} ${chalk.grey(
'unimported v' + context.version,
)}`,
divider,

@@ -52,0 +54,0 @@ ...records.reduce<string[]>((acc, [label, value]) => {

@@ -15,2 +15,3 @@ import { dirname, extname } from 'path';

import resolve from 'resolve';
import chalk from 'chalk';

@@ -227,4 +228,11 @@ export interface FileStats {

const parseResult = await parse(path, context);
result.files.set(path, parseResult);
let parseResult;
try {
parseResult = await parse(path, context);
result.files.set(path, parseResult);
} catch (e) {
console.log(chalk.redBright(`\nFailed parsing ${path}`));
console.log(e);
process.exit(1);
}

@@ -231,0 +239,0 @@ for (const file of parseResult.imports) {

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