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

@digitak/esrun

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digitak/esrun - npm Package Compare versions

Comparing version 1.2.19 to 2.0.1

2

library/main.js

@@ -12,3 +12,3 @@ import Runner from "./runners/Runner.js";

}
return new (watch ? Watcher : Runner)(inputFile, args, watch, inspect).run();
return new (watch ? Watcher : Runner)(inputFile, { args, watch, inspect }).run();
}

@@ -9,12 +9,20 @@ /// <reference types="node" />

export default class Runner {
inputFile: string;
output: string;
stdout: string;
stderr: string;
outputCode: string;
args: string[];
protected watch: boolean | string[];
protected inspect: boolean;
inputFile: string;
output: string;
outputCode: string;
protected interProcessCommunication: boolean;
protected buildOutput: BuildOutput;
protected dependencies: string[];
protected childProcess?: ChildProcess;
constructor(inputFile: string, args?: string[], watch?: boolean | string[], inspect?: boolean);
constructor(inputFile: string, options?: {
args?: string[];
watch?: boolean | string[];
inspect?: boolean;
interProcessCommunication?: boolean;
});
run(): Promise<void>;

@@ -21,0 +29,0 @@ build(buildOptions?: BuildOptions): Promise<void>;

@@ -7,11 +7,18 @@ import { build } from "esbuild/lib/main.js";

export default class Runner {
constructor(inputFile, args = [], watch = false, inspect = false) {
this.args = args;
this.watch = watch;
this.inspect = inspect;
constructor(inputFile, options) {
this.output = "";
this.stdout = "";
this.stderr = "";
this.outputCode = "";
this.args = [];
this.watch = false;
this.inspect = false;
this.interProcessCommunication = false;
this.buildOutput = null;
this.dependencies = [];
this.inputFile = findInputFile(inputFile);
this.args = options?.args ?? [];
this.watch = options?.watch ?? false;
this.inspect = options?.inspect ?? false;
this.interProcessCommunication = options?.interProcessCommunication ?? false;
}

@@ -73,3 +80,3 @@ async run() {

async execute() {
this.output = "";
this.output = this.stdout = this.stderr = "";
if (!this.buildOutput)

@@ -86,5 +93,17 @@ return 1;

this.childProcess = spawn("node", commandArgs, {
stdio: "inherit",
stdio: this.interProcessCommunication
? ["pipe", "pipe", "pipe", "ipc"]
: "inherit",
});
this.childProcess?.stdout?.on("data", data => (this.output += data));
if (this.interProcessCommunication) {
this.childProcess?.on("message", message => {
this.output += message.toString();
});
this.childProcess?.stdout?.on("data", data => {
this.stdout += data.toString();
});
this.childProcess?.stderr?.on("data", data => {
this.stderr += data.toString();
});
}
return new Promise(resolve => {

@@ -91,0 +110,0 @@ this.childProcess?.on("close", code => resolve(code || 0));

import Runner from "./Runner.js";
import type { FSWatcher } from "chokidar/index.js";
export default class Watcher extends Runner {
args: string[];
protected watcher: FSWatcher | null;
protected watch: string[];
protected inspect: boolean;
protected watcher: FSWatcher | null;
constructor(input: string, args?: string[], watch?: string[], inspect?: boolean);
constructor(input: string, options?: {
args?: string[];
watch?: string[];
inspect?: boolean;
interProcessCommunication?: boolean;
});
run(): Promise<void>;

@@ -10,0 +13,0 @@ rerun(): Promise<void>;

@@ -16,9 +16,8 @@ import Runner from "./Runner.js";

export default class Watcher extends Runner {
constructor(input, args = [], watch = [], inspect = false) {
super(input, args);
this.args = args;
this.watch = watch;
this.inspect = inspect;
constructor(input, options) {
super(input, options);
this.watcher = null;
this.watch = watch instanceof Array ? this.watch.map(glob => path.resolve(glob)) : [];
this.watch = [];
this.watch =
options?.watch instanceof Array ? options.watch.map(glob => path.resolve(glob)) : [];
}

@@ -25,0 +24,0 @@ async run() {

{
"name": "@digitak/esrun",
"version": "1.2.19",
"version": "2.0.1",
"type": "module",

@@ -21,3 +21,4 @@ "description": "Execute directly your Typescript files using Esbuild",

"test:watch:inspect": "./library/bin.js --watch --inspect test --watch coco",
"test:server": "./library/bin.js --watch test/server"
"test:server": "./library/bin.js --watch test/server",
"test:ipc": "./library/bin.js test/ipc"
},

@@ -24,0 +25,0 @@ "engines": {

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