dependency-cruiser
Advanced tools
Comparing version 1.15.1 to 1.15.2
{ | ||
"name": "dependency-cruiser", | ||
"version": "1.15.1", | ||
"version": "1.15.2", | ||
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -11,2 +11,6 @@ "use strict"; | ||
/* OS pipe buffer size in bytes - which is what ulimit -a tells me on OSX */ | ||
const PIPE_BUFFER_SIZE = 512; | ||
function writeToFile(pOutputTo, pDependencyString) { | ||
@@ -24,5 +28,28 @@ try { | ||
/** | ||
* Writes the string pString to stdout in chunks of pBufferSize size. | ||
* | ||
* When writing to a pipe, it's possible that pipe's buffer is full. | ||
* To prevent this problem from happening we should take the value at which | ||
* the OS guarantees atomic writes to pipes - which on my OSX machine is | ||
* 512 bytes. That seems pretty low (I've seen reports of 4k on the internet) | ||
* so it looks like a safe limit. | ||
* | ||
* @param {string} pString The string to write | ||
* @param {number} pBufferSize The size of the buffer to use. | ||
* @returns {void} nothing | ||
*/ | ||
function writeToStdOut(pString, pBufferSize) { | ||
const lNumberOfChunks = Math.ceil(pString.length / pBufferSize); | ||
let i = 0; | ||
for (i = 0; i < lNumberOfChunks; i++) { | ||
process.stdout.write(pString.substr(i * pBufferSize, pBufferSize)); | ||
} | ||
} | ||
function write(pOutputTo, pContent) { | ||
if ("-" === pOutputTo) { | ||
process.stdout.write(pContent); | ||
writeToStdOut(pContent, PIPE_BUFFER_SIZE); | ||
} else { | ||
@@ -64,2 +91,2 @@ writeToFile(pOutputTo, pContent); | ||
/* eslint no-process-exit: 0 */ | ||
/* eslint no-process-exit: 0 no-plusplus: 0*/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121482
2089