Socket
Socket
Sign inDemoInstall

tshy

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tshy - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

36

dist/esm/self-dep.js
// link the package folder into ./target/node_modules/<pkgname>
import { symlinkSync } from 'fs';
import { readlinkSync, symlinkSync } from 'fs';
import { mkdirpSync } from 'mkdirp';
import { dirname, relative, resolve } from 'path';
import { dirname, relative, resolve, sep } from 'path';
import { rimrafSync } from 'rimraf';
import { walkUp } from 'walk-up-path';
const dirsMade = new Map();
// if the cwd is in already linked to or living within node_modules,
// then skip the linking, because it's already done.
// This is typically the case in a workspaces setup, and
// creating yet *another* symlink to ourselves in src/node_modules
// will break nx's change detection logic with an ELOOP error.
let inNM = undefined;
const linkedAlready = (pkg) => {
if (inNM !== undefined) {
return inNM;
}
const cwd = process.cwd();
const p = `${sep}node_modules${sep}${pkg.name}`.toLowerCase();
if (cwd.toLowerCase().endsWith(p)) {
return (inNM = true);
}
for (const p of walkUp(cwd)) {
const link = resolve(p, 'node_modules', pkg.name);
try {
const target = resolve(dirname(link), readlinkSync(link));
if (relative(target, cwd) === '') {
return (inNM = true);
}
}
catch { }
}
return (inNM = false);
};
export const link = (pkg, where) => {
if (!pkg.name)
if (!pkg.name || linkedAlready(pkg))
return;

@@ -19,3 +47,3 @@ const dest = resolve(where, 'node_modules', pkg.name);

export const unlink = (pkg, where) => {
if (!pkg.name)
if (!pkg.name || linkedAlready(pkg))
return;

@@ -22,0 +50,0 @@ const dest = resolve(where, 'node_modules', pkg.name);

5

package.json
{
"name": "tshy",
"version": "1.1.0",
"version": "1.1.1",
"description": "TypeScript HYbridizer - Hybrid (CommonJS/ESM) TypeScript node package builder",

@@ -19,3 +19,4 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",

"sync-content": "^1.0.2",
"typescript": "5.2"
"typescript": "5.2",
"walk-up-path": "^3.0.1"
},

@@ -22,0 +23,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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