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

@microsoft/package-deps-hash

Package Overview
Dependencies
Maintainers
2
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/package-deps-hash - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

config/api-extractor.json

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "2.0.0",
"tag": "@microsoft/package-deps-hash_v2.0.0",
"date": "Mon, 30 Jan 2017 21:37:27 GMT",
"comments": {
"major": [
{
"comment": "Update package-deps-hash to not be asynchronous, and fixes a bug where not all changes were reported."
}
]
}
},
{
"version": "1.0.1",

@@ -7,0 +19,0 @@ "tag": "@microsoft/package-deps-hash_v1.0.1",

9

CHANGELOG.md
# Change Log - @microsoft/package-deps-hash
This log was last generated on Fri, 13 Jan 2017 06:46:05 GMT and should not be manually modified.
This log was last generated on Mon, 30 Jan 2017 21:37:27 GMT and should not be manually modified.
## 2.0.0
Mon, 30 Jan 2017 21:37:27 GMT
### Breaking changes
- Update package-deps-hash to not be asynchronous, and fixes a bug where not all changes were reported.
## 1.0.1

@@ -6,0 +13,0 @@ Fri, 13 Jan 2017 06:46:05 GMT

3

lib/getPackageDeps.d.ts

@@ -1,3 +0,2 @@

/// <reference types="es6-promise" />
import { IPackageDeps } from './IPackageDeps';
export declare function getPackageDeps(packagePath?: string, excludedPaths?: string[]): Promise<IPackageDeps>;
export declare function getPackageDeps(packagePath?: string, excludedPaths?: string[]): IPackageDeps;

@@ -10,52 +10,59 @@ "use strict";

}
return new Promise(function (complete) {
child_process.exec("git ls-tree HEAD -r && echo " + PROCESS_OUTPUT_DELIMITER + " && git status -s -u .", { cwd: packagePath }, function (error, stdout) {
var changes = {
files: {}
};
var processOutputBlocks = stdout.split(PROCESS_OUTPUT_DELIMITER);
// Note: The output of git ls-tree uses \n newlines regardless of OS.
processOutputBlocks[0].split('\n').forEach(function (line) {
if (line) {
var parts = line.substr(line.indexOf('blob ') + 5).split('\t');
if (!excludedHashes[parts[1]]) {
changes.files[parts[1]] = parts[0];
}
var stdout = child_process.execSync("git ls-tree HEAD -r && echo " + PROCESS_OUTPUT_DELIMITER + " && git status -s -u .", { cwd: packagePath }).toString();
var changes = {
files: {}
};
var processOutputBlocks = stdout.split(PROCESS_OUTPUT_DELIMITER);
// Note: The output of git ls-tree uses \n newlines regardless of OS.
processOutputBlocks[0].split('\n').forEach(function (line) {
// A line is expected to look like:
// 100644 blob 3451bccdc831cb43d7a70ed8e628dcf9c7f888c8 src/typings/tsd.d.ts
if (line) {
// Take everything after the "100644 blob", which is just the hash and filename
var _a = line.substr(line.indexOf('blob ') + 5).split('\t'), hash = _a[0], filename = _a[1];
if (!excludedHashes[filename]) {
changes.files[filename] = hash;
}
}
});
// If there was an issue with `git ls-tree`, or there are no current changes, processOutputBlocks[1]
// will be empty or undefined
if (processOutputBlocks[1]) {
var filesToHash_1 = [];
/*
* Typically, processOutputBlocks[1] will look something like:
* M temp_modules/rush-package-deps-hash/package.json
* D package-deps-hash/src/index.ts
*/
// Note: The output of git hash-object uses \n newlines regardless of OS.
processOutputBlocks[1]
.trim()
.split('\n')
.forEach(function (line) {
var _a = line.trim().split(' '), changeType = _a[0], filename = _a[1];
/*
* changeType == 'D' or 'M' or 'A'
* filename == path to the file
*/
if (changeType && filename) {
// If the file is currently deleted, then it will have a 'D'
if (changeType === 'D') {
delete changes.files[filename];
}
});
if (processOutputBlocks[1]) {
var filesToHash_1 = [];
// Note: The output of git hash-object uses \n newlines regardless of OS.
processOutputBlocks[1]
.trim()
.split('\n')
.forEach(function (line) {
var parts = line.trim().split(' ');
if (parts.length === 2) {
if (parts[0] === 'D') {
delete changes.files[parts[1]];
}
else {
if (!excludedHashes[parts[1]]) {
filesToHash_1.push(parts[1]);
}
}
else {
// Otherwise the file was changed or added and we should get the current hash
if (!excludedHashes[filename]) {
filesToHash_1.push(filename);
}
});
if (filesToHash_1.length) {
child_process.exec('git hash-object ' + filesToHash_1.join(' '), { cwd: packagePath }, function (hashError, hashStdout) {
var hashes = hashStdout.split('\n');
filesToHash_1.forEach(function (filename, i) { return changes.files[filename] = hashes[i]; });
complete(changes);
});
}
else {
complete(changes);
}
}
else {
complete(changes);
}
});
});
if (filesToHash_1.length) {
var hashStdout = child_process.execSync('git hash-object ' + filesToHash_1.join(' '), { cwd: packagePath }).toString();
// The result of hashStdout will be a list of file hashes delimited by newlines
var hashes_1 = hashStdout.split('\n');
filesToHash_1.forEach(function (filename, i) { return changes.files[filename] = hashes_1[i]; });
}
}
return changes;
}

@@ -62,0 +69,0 @@ exports.getPackageDeps = getPackageDeps;

{
"files": {
".npmignore": "191789b76f101b722c8bf5da3f0924735c850f82",
".vscode/launch.json": "dd860278658b8d99e229ac8182b4a7add33dd85c",
".vscode/settings.json": "0782987d4c1c72bb826977c95de8b08c26f36f13",
"LICENSE": "5382acebd26fe280fcb2184abd313b3e743458c6",
"CHANGELOG.json": "d3f323bc2625e1695cb1da2ef11eae532a4aa804",
"CHANGELOG.md": "e341e2ff7dee82cfe19159218d78a475bd889f4e",
"LICENSE": "5dca3a9198ca242b90937c9744a1e0cc33823808",
"README.md": "d97446d6eebeb248d65102e22c4e58d2e5602dce",
"config/api-extractor.json": "f74acb7ab9b58f148dd39043916594e4de892c5a",
"gulpfile.js": "0169efbaf4f78c36ebd1c4f41f44326d6849489a",
"package.json": "e8f8f808ecfa2686df76aab52ddd5c3db296f821",
"package.json": "105614c8e4bb8ca006fe1c3f766aa6f5a49b93de",
"src/IPackageDeps.ts": "56686143bf1825acae730c9d53337274f41861c1",
"src/getPackageDeps.ts": "a2bc359aa3b36f540f88a2ec9ab915190f887a7d",
"src/getPackageDeps.ts": "719c05717ae026d00d8b11fcc9f93eebf8f44694",
"src/index.ts": "265b9348ff61feb96e78db100534c10eb873b6aa",
"src/tests/getPackageDeps.test.ts": "630e6298d38e3602f817dd6575c10d09986e6d71",
"src/tests/getPackageDeps.test.ts": "5467d7ba522b01e52691fc123cce399d1b674be2",
"src/tests/nestedTestProject/package.json": "33703d582243a41bdebff8ee7dd046a01fc054b9",

@@ -18,4 +19,4 @@ "src/tests/nestedTestProject/src/file 1.txt": "c7b2f707ac99ca522f965210a7b6b0b109863f34",

"src/tests/testProject/package.json": "33703d582243a41bdebff8ee7dd046a01fc054b9",
"tsconfig.json": "ea2005158750b752221bff983f658199db6b8380"
"tsconfig.json": "a07aa5ec02693b46019cc67d6c00c42c7e045a97"
}
}
{
"name": "@microsoft/package-deps-hash",
"version": "1.0.1",
"version": "2.0.0",
"description": "",

@@ -18,3 +18,3 @@ "main": "lib/index.js",

"devDependencies": {
"@microsoft/node-library-build": ">=2.1.0 <3.0.0",
"@microsoft/node-library-build": ">=2.2.0 <3.0.0",
"chai": "~3.5.0",

@@ -24,3 +24,2 @@ "gulp": "~3.9.1",

"@types/chai": "^3.4.34",
"@types/es6-promise": "0.0.32",
"@types/mocha": "^2.2.32",

@@ -27,0 +26,0 @@ "@types/node": "^6.0.46"

@@ -9,3 +9,2 @@ {

"types": [
"es6-promise",
"node",

@@ -12,0 +11,0 @@ "mocha"

Sorry, the diff of this file is not supported yet

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