New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

xtsr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xtsr - npm Package Compare versions

Comparing version
0.2.1
to
0.2.2
+2
-2
bin/clear.js
const { remove } = require('fs-extra')
const { outfile } = require('./utils')
const { runnerFilePath } = require('./utils')
remove(outfile)
remove(runnerFilePath)

@@ -7,11 +7,11 @@ #!/usr/bin/env node

const { existsSync } = require('fs')
const { outfile } = require('./utils')
const { runnerFilePath } = require('./utils')
const execute = () => spawnSync(
process.execPath,
[`${outfile}`].concat(process.argv.slice(2)),
[`${runnerFilePath}`].concat(process.argv.slice(2)),
{ stdio: 'inherit', detached: true }
)
if (existsSync(outfile)) {
if (existsSync(runnerFilePath)) {
execute()

@@ -21,3 +21,3 @@ } else {

entryPoints: [join(__dirname, '..', 'src', 'index.ts')],
outfile,
outfile: runnerFilePath,
bundle: true,

@@ -24,0 +24,0 @@ platform: 'node',

const { join } = require('path')
module.exports = {
outfile: join(__dirname, '..', '.cache', 'runner.js')
runnerFilePath: join(__dirname, '..', '.cache', 'runner.js')
}
{
"name": "xtsr",
"version": "0.2.1",
"version": "0.2.2",
"description": "A CLI program that runs your Typescript file directly in Nodejs. IMMEDIATLY ⚡️",

@@ -5,0 +5,0 @@ "bin": {

import { Command } from 'commander'
import { join, resolve } from 'path'
import { join, parse, resolve } from 'path'
import esbuild from 'esbuild'

@@ -11,7 +11,10 @@ import nodeExternalsPlugin from 'esbuild-node-externals'

program.on('command:*', () => {
const [tsFile, ...restOptions] = program.args
const absoluteTsFilePath = resolve(tsFile)
if (!existsSync(absoluteTsFilePath)) {
console.error(`Error: Could not resolve ${absoluteTsFilePath}`)
const fullPath = resolve(tsFile)
const { dir: dirname } = parse(fullPath)
if (!existsSync(fullPath)) {
console.error(`Error: Could not resolve ${fullPath}`)
process.exit(1)

@@ -21,4 +24,9 @@ }

const outfile = join(cacheDir, 'out', 'program.js')
const injectJs = `
process.argv[1] = '${fullPath}'
var __dirname = '${dirname}'
var __filename = '${fullPath}'
`
esbuild.build({
entryPoints: [absoluteTsFilePath],
entryPoints: [fullPath],
outfile,

@@ -30,3 +38,3 @@ bundle: true,

banner: {
js: `process.argv[1] = '${absoluteTsFilePath}'`
js: injectJs
},

@@ -33,0 +41,0 @@ plugins: [nodeExternalsPlugin()]