Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@boll/core

Package Overview
Dependencies
Maintainers
3
Versions
1225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boll/core - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

32

CHANGELOG.json

@@ -5,6 +5,36 @@ {

{
"date": "Tue, 17 Nov 2020 19:28:28 GMT",
"date": "Fri, 20 Nov 2020 22:00:01 GMT",
"tag": "@boll/core_v1.5.1",
"version": "1.5.1",
"comments": {
"patch": [
{
"comment": "Fixing broken UTs (git was ignoring directories) and refactor ignore.ts code and deps to speed up performance",
"author": "email not defined",
"commit": "3b49b3757845efe888e2e3f0a17bb6c449cdb502",
"package": "@boll/core"
}
]
}
},
{
"date": "Tue, 17 Nov 2020 20:16:43 GMT",
"tag": "@boll/core_v1.5.0",
"version": "1.5.0",
"comments": {
"none": [
{
"comment": ".",
"author": "jdh@microsoft.com",
"commit": "91d6a97b6510e123f926fe3a05493603bff55bb2",
"package": "@boll/core"
}
]
}
},
{
"date": "Tue, 17 Nov 2020 19:29:14 GMT",
"tag": "@boll/core_v1.5.0",
"version": "1.5.0",
"comments": {
"minor": [

@@ -11,0 +41,0 @@ {

# Change Log - @boll/core
This log was last generated on Tue, 17 Nov 2020 19:28:28 GMT and should not be manually modified.
This log was last generated on Fri, 20 Nov 2020 22:00:01 GMT and should not be manually modified.
<!-- Start content -->
## 1.5.1
Fri, 20 Nov 2020 22:00:01 GMT
### Patches
- Fixing broken UTs (git was ignoring directories) and refactor ignore.ts code and deps to speed up performance (email not defined)
## 1.5.0
Tue, 17 Nov 2020 19:28:28 GMT
Tue, 17 Nov 2020 19:29:14 GMT

@@ -11,0 +19,0 @@ ### Minor changes

12

dist/git-utils.js

@@ -38,9 +38,10 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIgnoreFiles = exports.getRepoRoot = void 0;
var child_process_1 = require("child_process");
var glob_1 = require("glob");
var fast_glob_1 = __importDefault(require("fast-glob"));
var path_1 = require("path");
var util_1 = require("util");
var globAsync = util_1.promisify(glob_1.glob);
var defaultIgnoreFileName = ".gitignore";

@@ -79,4 +80,5 @@ var repoRoot = undefined;

_b = ignoreFileNameOrDefault;
return [4 /*yield*/, globAsync("./{!(node_modules)/**/" + ignoreFileNameOrDefault + "," + ignoreFileNameOrDefault + "}", {
cwd: cwdOrDefault
return [4 /*yield*/, fast_glob_1.default("./**/" + ignoreFileNameOrDefault, {
cwd: cwdOrDefault,
ignore: ["./**/node_modules/**"]
})];

@@ -83,0 +85,0 @@ case 1:

@@ -38,2 +38,9 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -44,6 +51,21 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

exports.PackageJsonGlob = exports.TypescriptSourceGlob = void 0;
var glob_1 = __importDefault(require("glob"));
var fast_glob_1 = __importDefault(require("fast-glob"));
var boll_file_1 = require("./boll-file");
var util_1 = require("util");
var globAsync = util_1.promisify(glob_1.default);
function findFiles(pattern, include, exclude) {
return __awaiter(this, void 0, void 0, function () {
var paths, inclusions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fast_glob_1.default(pattern, { ignore: __spreadArrays(exclude, ["./**/node_modules/**"]) })];
case 1:
paths = _a.sent();
return [4 /*yield*/, fast_glob_1.default(include)];
case 2:
inclusions = _a.sent();
paths.push.apply(paths, inclusions.filter(function (i) { return !paths.includes(i); }));
return [2 /*return*/, paths.map(boll_file_1.asBollFile)];
}
});
});
}
var TypescriptSourceGlob = /** @class */ (function () {

@@ -63,53 +85,6 @@ function TypescriptSourceGlob(options) {

return __awaiter(this, void 0, void 0, function () {
var paths, _loop_1, _i, _a, excludeGlob, _b, _c, includeGlob, inclusions;
return __generator(this, function (_d) {
switch (_d.label) {
case 0: return [4 /*yield*/, globAsync("./{,!(node_modules)/**}/*.ts?(x)")];
case 1:
paths = _d.sent();
paths = paths.filter(function (path) { return !path.includes("node_modules") && !path.endsWith(".d.ts"); });
_loop_1 = function (excludeGlob) {
var exclusions, filteredPaths;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, globAsync(excludeGlob)];
case 1:
exclusions = _a.sent();
filteredPaths = paths.filter(function (p) { return !exclusions.includes(p); });
paths = filteredPaths;
return [2 /*return*/];
}
});
};
_i = 0, _a = this.exclude;
_d.label = 2;
case 2:
if (!(_i < _a.length)) return [3 /*break*/, 5];
excludeGlob = _a[_i];
return [5 /*yield**/, _loop_1(excludeGlob)];
case 3:
_d.sent();
_d.label = 4;
case 4:
_i++;
return [3 /*break*/, 2];
case 5:
_b = 0, _c = this.include;
_d.label = 6;
case 6:
if (!(_b < _c.length)) return [3 /*break*/, 9];
includeGlob = _c[_b];
return [4 /*yield*/, globAsync(includeGlob)];
case 7:
inclusions = _d.sent();
inclusions.forEach(function (i) {
if (!paths.includes(i)) {
paths.push(i);
}
});
_d.label = 8;
case 8:
_b++;
return [3 /*break*/, 6];
case 9: return [2 /*return*/, paths.map(boll_file_1.asBollFile)];
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, findFiles("./**/*.ts?(x)", this.include, __spreadArrays(this.exclude, ["./**/*.d.ts"]))];
case 1: return [2 /*return*/, _a.sent()];
}

@@ -136,53 +111,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var paths, _loop_2, _i, _a, excludeGlob, _b, _c, includeGlob, inclusions;
return __generator(this, function (_d) {
switch (_d.label) {
case 0: return [4 /*yield*/, globAsync("./package.json")];
case 1:
paths = _d.sent();
paths = paths.filter(function (path) { return !path.includes("node_modules"); });
_loop_2 = function (excludeGlob) {
var exclusions, filteredPaths;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, globAsync(excludeGlob)];
case 1:
exclusions = _a.sent();
filteredPaths = paths.filter(function (p) { return !exclusions.includes(p); });
paths = filteredPaths;
return [2 /*return*/];
}
});
};
_i = 0, _a = this.exclude;
_d.label = 2;
case 2:
if (!(_i < _a.length)) return [3 /*break*/, 5];
excludeGlob = _a[_i];
return [5 /*yield**/, _loop_2(excludeGlob)];
case 3:
_d.sent();
_d.label = 4;
case 4:
_i++;
return [3 /*break*/, 2];
case 5:
_b = 0, _c = this.include;
_d.label = 6;
case 6:
if (!(_b < _c.length)) return [3 /*break*/, 9];
includeGlob = _c[_b];
return [4 /*yield*/, globAsync(includeGlob)];
case 7:
inclusions = _d.sent();
inclusions.forEach(function (i) {
if (!paths.includes(i)) {
paths.push(i);
}
});
_d.label = 8;
case 8:
_b++;
return [3 /*break*/, 6];
case 9: return [2 /*return*/, paths.map(boll_file_1.asBollFile)];
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, findFiles("./package.json", this.include, this.exclude)];
case 1: return [2 /*return*/, _a.sent()];
}

@@ -189,0 +117,0 @@ });

@@ -64,8 +64,6 @@ "use strict";

var path = __importStar(require("path"));
var glob_1 = require("glob");
var fast_glob_1 = __importDefault(require("fast-glob"));
var parse_gitignore_1 = __importDefault(require("parse-gitignore"));
var util_1 = require("util");
var boll_file_1 = require("./boll-file");
var git_utils_1 = require("./git-utils");
var globAsync = util_1.promisify(glob_1.glob);
var IgnoredFiles = /** @class */ (function () {

@@ -83,3 +81,3 @@ function IgnoredFiles(options) {

return __awaiter(this, void 0, void 0, function () {
var ignoreFiles, ignoreFileToIgnorePatterns, ignoreFileToGlobs, ignoredFiles, _i, _a, ignoreFiles_1, _loop_1, _b, _c, globsForIgnoreFile;
var ignoreFiles, ignoreFileToIgnorePatterns, ignoreFileToGlobs, ignoredFiles, ignoredFilesPromises, _i, _a, ignoreFiles_1, _loop_1, _b, _c, globsForIgnoreFile;
return __generator(this, function (_d) {

@@ -96,47 +94,30 @@ switch (_d.label) {

ignoredFiles = [];
_i = 0, _a = Object.keys(ignoreFileToGlobs);
_d.label = 2;
ignoredFilesPromises = [];
for (_i = 0, _a = Object.keys(ignoreFileToGlobs); _i < _a.length; _i++) {
ignoreFiles_1 = _a[_i];
_loop_1 = function (globsForIgnoreFile) {
var ignore = process.cwd().startsWith(globsForIgnoreFile.cwd) && process.cwd().length !== globsForIgnoreFile.cwd.length
? process
.cwd()
.substring(globsForIgnoreFile.cwd.length + 1)
.split(path.sep)
.map(function (v, i, a) { return "./" + a.slice(0, i).join("/") + (i > 0 ? "/" : "") + "!(" + v + ")/**"; })
: [];
for (var _i = 0, _a = globsForIgnoreFile.globs; _i < _a.length; _i++) {
var glob = _a[_i];
ignoredFilesPromises.push(fast_glob_1.default(glob, { dot: true, cwd: globsForIgnoreFile.cwd, ignore: ignore }).then(function (files) {
var filesAsBollFiles = files.map(function (f) { return boll_file_1.asBollFile(path.resolve(globsForIgnoreFile.cwd, f)); });
ignoredFiles.push.apply(ignoredFiles, filesAsBollFiles);
}));
}
};
for (_b = 0, _c = ignoreFileToGlobs[ignoreFiles_1]; _b < _c.length; _b++) {
globsForIgnoreFile = _c[_b];
_loop_1(globsForIgnoreFile);
}
}
return [4 /*yield*/, Promise.all(ignoredFilesPromises)];
case 2:
if (!(_i < _a.length)) return [3 /*break*/, 7];
ignoreFiles_1 = _a[_i];
_loop_1 = function (globsForIgnoreFile) {
var _i, _a, glob_2, files, filesAsBollFiles, filesInCwd;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_i = 0, _a = globsForIgnoreFile.globs;
_b.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
glob_2 = _a[_i];
return [4 /*yield*/, globAsync(glob_2, { dot: true, nodir: true, cwd: globsForIgnoreFile.cwd })];
case 2:
files = _b.sent();
filesAsBollFiles = files.map(function (f) { return boll_file_1.asBollFile(path.resolve(globsForIgnoreFile.cwd, f)); });
filesInCwd = filesAsBollFiles.filter(function (f) { return path.dirname(f).startsWith(process.cwd()); });
ignoredFiles.push.apply(ignoredFiles, filesInCwd);
_b.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/];
}
});
};
_b = 0, _c = ignoreFileToGlobs[ignoreFiles_1];
_d.label = 3;
case 3:
if (!(_b < _c.length)) return [3 /*break*/, 6];
globsForIgnoreFile = _c[_b];
return [5 /*yield**/, _loop_1(globsForIgnoreFile)];
case 4:
_d.sent();
_d.label = 5;
case 5:
_b++;
return [3 /*break*/, 3];
case 6:
_i++;
return [3 /*break*/, 2];
case 7: return [2 /*return*/, Array.from(new Set(ignoredFiles))];
return [2 /*return*/, Array.from(new Set(ignoredFiles))];
}

@@ -143,0 +124,0 @@ });

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var test_internal_1 = require("@boll/test-internal");
var config_test_1 = require("./config.test");

@@ -45,29 +10,2 @@ var format_test_1 = require("./format.test");

var pragma_test_1 = require("./pragma.test");
function suite() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, config_test_1.test.run()];
case 1:
_a.sent();
return [4 /*yield*/, format_test_1.test.run()];
case 2:
_a.sent();
return [4 /*yield*/, git_utils_test_1.test.run()];
case 3:
_a.sent();
return [4 /*yield*/, glob_test_1.test.run()];
case 4:
_a.sent();
return [4 /*yield*/, ignore_test_1.test.run()];
case 5:
_a.sent();
return [4 /*yield*/, pragma_test_1.test.run()];
case 6:
_a.sent();
return [2 /*return*/];
}
});
});
}
suite();
test_internal_1.suite(config_test_1.test, format_test_1.test, git_utils_test_1.test, glob_test_1.test, ignore_test_1.test, pragma_test_1.test);

@@ -62,2 +62,3 @@ "use strict";

exports.test = void 0;
var test_internal_1 = require("@boll/test-internal");
var assert = __importStar(require("assert"));

@@ -77,1 +78,40 @@ var baretest_1 = __importDefault(require("baretest"));

}); });
exports.test("Should correctly find specified ignore file", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, test_internal_1.inFixtureDir("git-utils", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () {
var sut, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
sut = git_utils_1.getIgnoreFiles;
return [4 /*yield*/, sut(process.cwd(), ".ignore")];
case 1:
result = _a.sent();
assert.deepStrictEqual(result.sort(), [
"./.ignore",
"./a/.ignore",
"./a/a/.ignore",
"./a/b/.ignore",
"./a/c/.ignore",
"./b/.ignore",
"./b/a/.ignore",
"./b/b/.ignore",
"./b/c/.ignore",
"./c/.ignore",
"./c/a/.ignore",
"./c/b/.ignore",
"./c/c/.ignore"
]
.map(function (p) { return path.resolve(p); })
.sort());
return [2 /*return*/];
}
});
}); })];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });

@@ -149,3 +149,3 @@ "use strict";

results = _a.sent();
assert.deepStrictEqual(results, [boll_file_1.asBollFile("a/a.ts")]);
assert.deepStrictEqual(results.sort(), [boll_file_1.asBollFile("a/a.ts")].sort());
return [2 /*return*/];

@@ -173,3 +173,3 @@ }

results = _a.sent();
assert.deepStrictEqual(results, [boll_file_1.asBollFile("a/a.ts"), boll_file_1.asBollFile("b/b.ts"), boll_file_1.asBollFile("c/c.someextension")]);
assert.deepStrictEqual(results.sort(), [boll_file_1.asBollFile("a/a.ts"), boll_file_1.asBollFile("b/b.ts"), boll_file_1.asBollFile("c/c.someextension")].sort());
return [2 /*return*/];

@@ -176,0 +176,0 @@ }

@@ -7,3 +7,3 @@ {

"dependencies": {
"glob": "^7.1.6",
"fast-glob": "^3.2.4",
"graceful-fs": "4.2.4",

@@ -49,3 +49,3 @@ "parse-gitignore": "^1.0.1",

},
"version": "1.5.0"
"version": "1.5.1"
}

Sorry, the diff of this file is too big to display

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