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

@line/ts-remove-unused

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@line/ts-remove-unused - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

59

dist/cli.js

@@ -411,4 +411,12 @@ #!/usr/bin/env node

// lib/util/memoize.ts
var memoize = (fn2, { key }) => {
import { parentPort } from "node:worker_threads";
var memoize = (fn2, { key, name }) => {
const cache = /* @__PURE__ */ new Map();
if (parentPort) {
parentPort.on("message", (message) => {
if ("broadcast" in message && message.broadcast.name === name) {
cache.set(message.broadcast.key, message.broadcast.value);
}
});
}
return (...args) => {

@@ -421,2 +429,11 @@ const k = key(...args);

cache.set(k, result);
if (parentPort) {
parentPort.postMessage({
broadcast: {
name,
key: k,
value: result
}
});
}
return result;

@@ -705,3 +722,4 @@ };

options: arg.options
})
}),
name: "parseFile"
});

@@ -1487,5 +1505,9 @@

import { ${name} } from '${url}';
parentPort.on('message', async (arg) => {
parentPort.on('message', async (message) => {
if (!('arg' in message)) {
return;
}
try {
const result = await ${name}(arg);
const result = await ${name}(message.arg);
parentPort.postMessage({ result });

@@ -1529,3 +1551,3 @@ } catch (error) {

this.#working.push(worker);
worker.postMessage(arg);
worker.postMessage({ arg });
});

@@ -1557,3 +1579,3 @@ }

};
worker.postMessage(arg);
worker.postMessage({ arg });
this.#working.push(worker);

@@ -1576,9 +1598,22 @@ }

}
if ("error" in message) {
worker.current.reject(message.error);
} else {
worker.current.resolve(message.result);
switch (true) {
case "broadcast" in message: {
[...this.#working, ...this.#idle].forEach(
(w) => w !== worker && w.postMessage(message)
);
return;
}
case "error" in message: {
worker.current.reject(message.error);
this.#free(worker);
this.#assignTask();
return;
}
case "result" in message: {
worker.current.resolve(message.result);
this.#free(worker);
this.#assignTask();
return;
}
}
this.#free(worker);
this.#assignTask();
});

@@ -1585,0 +1620,0 @@ worker.on("error", (error) => {

@@ -406,4 +406,12 @@ // lib/remove.ts

// lib/util/memoize.ts
var memoize = (fn2, { key }) => {
import { parentPort } from "node:worker_threads";
var memoize = (fn2, { key, name }) => {
const cache = /* @__PURE__ */ new Map();
if (parentPort) {
parentPort.on("message", (message) => {
if ("broadcast" in message && message.broadcast.name === name) {
cache.set(message.broadcast.key, message.broadcast.value);
}
});
}
return (...args) => {

@@ -416,2 +424,11 @@ const k = key(...args);

cache.set(k, result);
if (parentPort) {
parentPort.postMessage({
broadcast: {
name,
key: k,
value: result
}
});
}
return result;

@@ -700,3 +717,4 @@ };

options: arg.options
})
}),
name: "parseFile"
});

@@ -1482,5 +1500,9 @@

import { ${name} } from '${url}';
parentPort.on('message', async (arg) => {
parentPort.on('message', async (message) => {
if (!('arg' in message)) {
return;
}
try {
const result = await ${name}(arg);
const result = await ${name}(message.arg);
parentPort.postMessage({ result });

@@ -1524,3 +1546,3 @@ } catch (error) {

this.#working.push(worker);
worker.postMessage(arg);
worker.postMessage({ arg });
});

@@ -1552,3 +1574,3 @@ }

};
worker.postMessage(arg);
worker.postMessage({ arg });
this.#working.push(worker);

@@ -1571,9 +1593,22 @@ }

}
if ("error" in message) {
worker.current.reject(message.error);
} else {
worker.current.resolve(message.result);
switch (true) {
case "broadcast" in message: {
[...this.#working, ...this.#idle].forEach(
(w) => w !== worker && w.postMessage(message)
);
return;
}
case "error" in message: {
worker.current.reject(message.error);
this.#free(worker);
this.#assignTask();
return;
}
case "result" in message: {
worker.current.resolve(message.result);
this.#free(worker);
this.#assignTask();
return;
}
}
this.#free(worker);
this.#assignTask();
});

@@ -1580,0 +1615,0 @@ worker.on("error", (error) => {

@@ -1,3 +0,4 @@

export declare const memoize: <T extends (...args: any[]) => any>(fn: T, { key }: {
export declare const memoize: <T extends (...args: any[]) => any>(fn: T, { key, name }: {
key: (...args: Parameters<T>) => string;
name: string;
}) => (...args: Parameters<T>) => ReturnType<T>;

@@ -142,4 +142,12 @@ // lib/util/removeUnusedExport.ts

// lib/util/memoize.ts
var memoize = (fn2, { key }) => {
import { parentPort } from "node:worker_threads";
var memoize = (fn2, { key, name }) => {
const cache = /* @__PURE__ */ new Map();
if (parentPort) {
parentPort.on("message", (message) => {
if ("broadcast" in message && message.broadcast.name === name) {
cache.set(message.broadcast.key, message.broadcast.value);
}
});
}
return (...args) => {

@@ -152,2 +160,11 @@ const k = key(...args);

cache.set(k, result);
if (parentPort) {
parentPort.postMessage({
broadcast: {
name,
key: k,
value: result
}
});
}
return result;

@@ -436,3 +453,4 @@ };

options: arg.options
})
}),
name: "parseFile"
});

@@ -439,0 +457,0 @@

@@ -27,3 +27,3 @@ {

"devDependencies": {
"@eslint/js": "^9.10.0",
"@eslint/js": "^9.15.0",
"@types/node": "^22.5.5",

@@ -36,3 +36,3 @@ "esbuild": "^0.23.1",

"tsx": "^4.19.1",
"typescript-eslint": "^8.5.0"
"typescript-eslint": "^8.14.0"
},

@@ -46,3 +46,3 @@ "dependencies": {

},
"version": "0.7.0"
"version": "0.8.0"
}
<h1 align="center">ts-remove-unused</h1>
<div align="center">
<img width="480" src="./media/screenshot.png" />
<p>Remove unused code from your TypeScript Project</p>
<p>Remove unused code from your TypeScript Project – It's like tree shaking, but for source files</p>
</div>

@@ -6,0 +6,0 @@

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