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

@boost/common

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/common - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

16

CHANGELOG.md

@@ -6,2 +6,18 @@ # Change Log

### 2.5.1 - 2021-02-08
#### 📦 Dependencies
- **[json5]** Updated to v2.2. ([e029b73](https://github.com/milesj/boost/commit/e029b73))
#### 🛠 Internals
- Sort type hints and aliases. ([1c49e33](https://github.com/milesj/boost/commit/1c49e33))
**Note:** Version bump only for package @boost/common
## 2.5.0 - 2021-01-16

@@ -8,0 +24,0 @@

2

dts/PackageGraph.d.ts

@@ -68,5 +68,5 @@ import { PackageGraphTree, PackageStructure } from './types';

*/
protected sortByDependedOn(nodes: Set<Node> | Node[]): Node[];
protected sortByDependedOn(nodes: Node[] | Set<Node>): Node[];
}
export {};
//# sourceMappingURL=PackageGraph.d.ts.map

@@ -1,7 +0,6 @@

export declare type JSONReplacer = (key: string, value: unknown) => unknown | (number | string)[] | null;
export declare type JSONReviver = (key: string, value: unknown) => unknown;
export interface JSONStringifyOptions {
space?: number | string;
quote?: string;
replacer?: JSONReplacer;
space?: number | string | null;
quote?: string | null;
replacer?: (number | string)[] | ((key: string, value: unknown) => unknown) | null;
}

@@ -8,0 +7,0 @@ export declare function parse<T = object>(content: string, reviver?: JSONReviver): T;

@@ -47,10 +47,10 @@ import { Blueprint, Predicates } from 'optimal';

export interface PackageStructure {
author?: string | PeopleSetting;
bin?: string | SettingMap;
author?: PeopleSetting | string;
bin?: SettingMap | string;
browser?: string;
browserslist?: string[];
bugs?: string | BugSetting;
bugs?: BugSetting | string;
bundledDependencies?: string[];
config?: SettingMap;
contributors?: string[] | PeopleSetting[];
contributors?: PeopleSetting[] | string[];
cpu?: string[];

@@ -62,11 +62,11 @@ dependencies?: DependencyMap;

engines?: SettingMap;
exports?: string | Record<string, string | string[] | SettingMap>;
exports?: Record<string, SettingMap | string[] | string> | string;
files?: string[];
funding?: string | TypeSetting | (string | TypeSetting)[];
funding?: (TypeSetting | string)[] | TypeSetting | string;
homepage?: string;
imports?: Record<string, SettingMap>;
keywords?: string[];
license?: string | TypeSetting | TypeSetting[];
license?: TypeSetting | TypeSetting[] | string;
main?: string;
man?: string | string[];
man?: string[] | string;
name: string;

@@ -82,3 +82,3 @@ optionalDependencies?: DependencyMap;

};
repository?: string | RepositorySetting;
repository?: RepositorySetting | string;
scripts?: SettingMap;

@@ -91,3 +91,3 @@ type?: 'commonjs' | 'module';

module?: string;
sideEffects?: boolean | string[];
sideEffects?: string[] | boolean;
workspaces?: string[] | {

@@ -94,0 +94,0 @@ packages?: string[];

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

// Generated with Packemon: https://packemon.dev
// Platform: node, Support: stable, Format: lib
'use strict';

@@ -33,15 +35,15 @@

var optimal__default = _interopDefaultLegacy(optimal);
var optimal__default = /*#__PURE__*/_interopDefaultLegacy(optimal);
var fs__default = _interopDefaultLegacy(fs);
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
var path__default = _interopDefaultLegacy(path);
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
var glob__default = _interopDefaultLegacy(glob);
var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
var JSON__default = _interopDefaultLegacy(JSON);
var JSON__default = /*#__PURE__*/_interopDefaultLegacy(JSON);
var YAML__default = _interopDefaultLegacy(YAML);
var YAML__default = /*#__PURE__*/_interopDefaultLegacy(YAML);
var prettyMs__default = _interopDefaultLegacy(prettyMs);
var prettyMs__default = /*#__PURE__*/_interopDefaultLegacy(prettyMs);

@@ -61,5 +63,14 @@ const errors = {

}
/**
* Set an options object by merging the new partial and existing options
* with the defined blueprint, while running all validation checks.
* Freeze and return the options object.
*/
configure(options) {
const nextOptions = typeof options === 'function' ? options(this.options) : options;
const nextOptions = typeof options === 'function' ? options(this.options) : options; // We don't want the options property to be modified directly,
// so it's read only, but we still want to modify it with this function.
// @ts-expect-error
this.options = Object.freeze(optimal__default['default']({ ...this.options,

@@ -72,3 +83,8 @@ ...nextOptions

}
/**
* Define an optimal blueprint in which to validate and build the
* options object passed to the constructor, or when manual setting.
*/
}

@@ -85,3 +101,5 @@

}
/* eslint-disable max-classes-per-file */
class Node {

@@ -104,13 +122,25 @@ constructor(name) {

}
/**
* Add a package by name with an associated `package.json` object.
* Will map a dependency between the package and its dependees
* found in `dependencies` and `peerDependencies`.
*/
addPackage(pkg) {
if (this.mapped) {
this.resetNodes();
}
} // Cache package data for later use
this.packages.set(pkg.name, pkg);
this.packages.set(pkg.name, pkg); // Add node to the graph
this.addNode(pkg.name);
return this;
}
/**
* Add multiple packages.
*/
addPackages(packages = []) {

@@ -122,3 +152,8 @@ packages.forEach(pkg => {

}
/**
* Resolve the dependency graph and return a list of all
* `package.json` objects in the order they are depended on.
*/
resolveList() {

@@ -130,3 +165,8 @@ return this.resolveBatchList().reduce((flatList, batchList) => {

}
/**
* Resolve the dependency graph and return a tree of nodes for all
* `package.json` objects and their dependency mappings.
*/
resolveTree() {

@@ -139,4 +179,5 @@ this.mapDependencies();

return;
}
} // Only include nodes that have package data
const pkg = this.packages.get(node.name);

@@ -158,2 +199,3 @@

} else {
// eslint-disable-next-line no-param-reassign
tree.nodes = [branch];

@@ -171,3 +213,3 @@ }

resolve(node, trunk);
});
}); // Some nodes are missing, so they must be a cycle

@@ -180,3 +222,8 @@ if (seen.size !== this.nodes.size) {

}
/**
* Resolve the dependency graph and return a list of batched
* `package.json` objects in the order they are depended on.
*/
resolveBatchList() {

@@ -188,3 +235,3 @@ this.mapDependencies();

const addBatch = () => {
const nextBatch = Array.from(this.nodes.values()).filter(node => !seen.has(node) && (node.requirements.size === 0 || Array.from(node.requirements.values()).filter(dep => !seen.has(dep)).length === 0));
const nextBatch = Array.from(this.nodes.values()).filter(node => !seen.has(node) && (node.requirements.size === 0 || Array.from(node.requirements.values()).filter(dep => !seen.has(dep)).length === 0)); // Some nodes are missing, so they must be a cycle

@@ -206,7 +253,16 @@ if (nextBatch.length === 0) {

}
/**
* Add a node for the defined package name.
*/
addNode(name) {
// Cache node for constant lookups
this.nodes.set(name, new Node(name));
}
/**
* Dig through all nodes and attempt to find a circular dependency cycle.
*/
detectCycle() {

@@ -229,3 +285,8 @@ const dig = (node, cycle) => {

}
/**
* Return all nodes that can be considered "root",
* as determined by having no requirements.
*/
getRootNodes() {

@@ -237,3 +298,3 @@ const rootNodes = [];

}
});
}); // If no root nodes are found, but nodes exist, then we have a cycle

@@ -246,3 +307,7 @@ if (rootNodes.length === 0 && this.nodes.size !== 0) {

}
/**
* Map dependencies between all currently registered packages.
*/
mapDependencies() {

@@ -262,3 +327,9 @@ if (this.mapped) {

}
/**
* Map a dependency link for a dependent (child) depending on a requirement (parent).
* Will link the parent and child accordingly, and will remove the child
* from the root if it exists.
*/
mapDependency(dependentName, requirementName) {

@@ -270,8 +341,14 @@ const requirement = this.nodes.get(requirementName);

return;
}
} // Child depends on parent
dependent.requirements.add(requirement);
dependent.requirements.add(requirement); // Parent is a dependee of child
requirement.dependents.add(dependent);
}
/**
* Remove all current nodes in the graph and add new root nodes for each package.
*/
resetNodes() {

@@ -284,3 +361,7 @@ this.mapped = false;

}
/**
* Sort a set of nodes by most depended on, fall back to alpha sort as tie breaker
*/
sortByDependedOn(nodes) {

@@ -302,22 +383,45 @@ return Array.from(nodes).sort((a, b) => {

constructor(...parts) {
this.internalPath = '';
this.internalPath = ''; // Always use forward slashes for better interop
this.internalPath = path__default['default'].normalize(path__default['default'].join(...parts.map(String))).replace(/\\/gu, Path.SEP);
}
/**
* Create and return a new `Path` instance if a string.
* If already a `Path`, return as is.
*/
static create(filePath) {
return filePath instanceof Path ? filePath : new Path(filePath);
}
/**
* Like `create()` but also resolves the path against CWD.
*/
static resolve(filePath, cwd) {
return Path.create(filePath).resolve(cwd);
}
/**
* Append path parts to the end of the current path
* and return a new `Path` instance.
*/
append(...parts) {
return new Path(this.internalPath, ...parts);
}
/**
* Returns true if both paths are equal using strict equality.
*/
equals(filePath) {
return this.path() === Path.create(filePath).path();
}
/**
* Return the extension (if applicable) with or without leading period.
*/
ext(withoutPeriod = false) {

@@ -327,19 +431,39 @@ const ext = path__default['default'].extname(this.internalPath);

}
/**
* Return true if the current path exists.
*/
exists() {
return fs__default['default'].existsSync(this.internalPath);
}
/**
* Return true if the current path is absolute.
*/
isAbsolute() {
return path__default['default'].isAbsolute(this.internalPath);
}
/**
* Return true if the current path is a folder.
*/
isDirectory() {
return fs__default['default'].statSync(this.internalPath).isDirectory();
}
/**
* Return true if the current path is a file.
*/
isFile() {
return fs__default['default'].statSync(this.internalPath).isFile();
}
/**
* Return the file name (with optional extension) or folder name.
*/
name(withoutExtension = false) {

@@ -354,23 +478,51 @@ let name = path__default['default'].basename(this.internalPath);

}
/**
* Return the parent folder as a new `Path` instance.
*/
parent() {
return new Path(path__default['default'].dirname(this.internalPath));
}
/**
* Return the current path as a normalized string.
*/
path() {
return this.internalPath;
}
/**
* Prepend path parts to the beginning of the current path
* and return a new `Path` instance.
*/
prepend(...parts) {
return new Path(...parts, this.internalPath);
}
/**
* Returns a canonical path by resolving directories and symlinks.
*/
// istanbul ignore next
realPath() {
return fs__default['default'].realpathSync.native(this.path());
}
/**
* Return a new relative `Path` instance from the current
* "from" path to the defined "to" path.
*/
relativeTo(to) {
return new Path(path__default['default'].relative(this.path(), String(to)));
}
/**
* Return a new `Path` instance where the current path is accurately
* resolved against the defined current working directory.
*/
resolve(cwd) {

@@ -391,3 +543,3 @@ return new Path(path__default['default'].resolve(String(cwd || process.cwd()), this.internalPath));

Path.DELIMITER = path__default['default'].delimiter;
Path.SEP = '/';
Path.SEP = '/'; // NODE

@@ -403,7 +555,16 @@ (function (LookupType) {

}
/**
* Return a list of all lookup paths.
*/
getLookupPaths() {
return this.lookups.map(lookup => lookup.path.path());
}
/**
* Add a file system path to look for, resolved against the defined current
* working directory (or `process.cwd()` otherwise).
*/
lookupFilePath(filePath, cwd) {

@@ -417,3 +578,7 @@ this.lookups.push({

}
/**
* Add a Node.js module, either by name or relative path, to look for.
*/
lookupNodeModule(modulePath) {

@@ -428,3 +593,9 @@ const path = Path.create(modulePath);

}
/**
* Given a list of lookups, attempt to find the first real/existing path and
* return a resolved absolute path. If a file system path, will check using `fs.exists`.
* If a node module path, will check using `require.resolve`.
*/
resolve() {

@@ -434,2 +605,3 @@ let resolvedPath = '';

this.lookups.some(lookup => {
// Check that the file exists on the file system.
if (lookup.type === exports.LookupType.FILE_SYSTEM) {

@@ -441,3 +613,5 @@ if (lookup.path.exists()) {

return false;
}
} // Check that the module path exists using Node's module resolution.
// The `require.resolve` function will throw an error if not found.
} else if (lookup.type === exports.LookupType.NODE_MODULE) {

@@ -465,3 +639,7 @@ try {

}
/**
* Like `resolve()` but only returns the resolved path.
*/
resolvePath() {

@@ -506,7 +684,7 @@ return this.resolve().resolvedPath;

function stringify(content, options) {
function stringify(content, options = {}) {
return JSON__default['default'].stringify(content, options);
}
var json = Object.freeze({
var json = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -525,3 +703,3 @@ parse: parse,

var yaml = Object.freeze({
var yaml = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -535,4 +713,7 @@ parse: parse$1,

let value = require(String(path));
// eslint-disable-next-line
let value = require(String(path)); // Support Babel compiled files
// eslint-disable-next-line no-underscore-dangle
if ((_value = value) != null && _value.__esModule) {

@@ -577,3 +758,7 @@ value = value.default;

}
/**
* Create a workspace metadata object composed of absolute file paths.
*/
createWorkspaceMetadata(jsonPath) {

@@ -591,3 +776,7 @@ const metadata = {};

}
/**
* Return the contents of the root `package.json`.
*/
getPackage() {

@@ -602,3 +791,9 @@ const pkgPath = this.root.append('package.json');

}
/**
* Return a list of all workspace globs as they are configured
* in `package.json` or `lerna.json`.
*/
// eslint-disable-next-line complexity
getWorkspaceGlobs(options = {}) {

@@ -608,3 +803,3 @@ const pkgPath = this.root.append('package.json');

const pnpmPath = this.root.append('pnpm-workspace.yaml');
const workspacePaths = [];
const workspacePaths = []; // Yarn

@@ -621,4 +816,5 @@ if (pkgPath.exists()) {

}
}
} // Lerna
if (workspacePaths.length === 0 && lernaPath.exists()) {

@@ -630,4 +826,5 @@ const lerna = parseFile(lernaPath);

}
}
} // PNPM
if (workspacePaths.length === 0 && pnpmPath.exists()) {

@@ -647,3 +844,8 @@ const pnpm = parseFile(pnpmPath);

}
/**
* Return all `package.json`s across all workspaces and their packages.
* Once loaded, append workspace path metadata.
*/
getWorkspacePackages() {

@@ -664,3 +866,7 @@ return glob__default['default'].sync(this.getWorkspaceGlobs({

}
/**
* Return a list of all workspace package paths, resolved against the file system.
*/
getWorkspacePackagePaths(options = {}) {

@@ -677,4 +883,6 @@ return glob__default['default'].sync(this.getWorkspaceGlobs({

}, _temp), (_applyDecoratedDescriptor(_class.prototype, "getWorkspaceGlobs", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspaceGlobs"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "getWorkspacePackages", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspacePackages"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "getWorkspacePackagePaths", [_dec3], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspacePackagePaths"), _class.prototype)), _class));
const MODULE_NAME_PART = /[a-z0-9]{1}[-a-z0-9_.]*/u;
}, _temp), (_applyDecoratedDescriptor(_class.prototype, "getWorkspaceGlobs", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspaceGlobs"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "getWorkspacePackages", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspacePackages"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "getWorkspacePackagePaths", [_dec3], Object.getOwnPropertyDescriptor(_class.prototype, "getWorkspacePackagePaths"), _class.prototype)), _class)); // https://github.com/npm/validate-npm-package-name
const MODULE_NAME_PART = /[a-z0-9]{1}[-a-z0-9_.]*/u; // eslint-disable-next-line security/detect-non-literal-regexp
const MODULE_NAME_PATTERN = new RegExp(`^(?:@(${MODULE_NAME_PART.source})/)?(${MODULE_NAME_PART.source})$`, 'u');

@@ -697,2 +905,3 @@

Object.entries(obj).forEach(([key, value]) => {
// Only freeze plain objects
if (isObject(value) && value.constructor === Object) {

@@ -744,3 +953,9 @@ nextObj[key] = deepFreeze(value);

}
/**
* Native `instanceof` checks are problematic, as cross realm checks fail.
* They will also fail when comparing against source and built files.
* So emulate an `instanceof` check by comparing constructor names.
*/
function instanceOf(object, declaration, loose = true) {

@@ -766,6 +981,8 @@ if (!object || typeof object !== 'object') {

if (current.constructor.name === declaration.name || current instanceof Error && current.name === declaration.name) {
if (current.constructor.name === declaration.name || // istanbul ignore next
current instanceof Error && current.name === declaration.name) {
return true;
}
} // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
current = Object.getPrototypeOf(current);

@@ -789,4 +1006,5 @@ }

return false;
}
} // istanbul ignore next
if (process.platform === 'win32') {

@@ -793,0 +1011,0 @@ return WIN_START.test(filePath) || filePath.includes('/') || filePath.includes('\\');

{
"name": "@boost/common",
"version": "2.5.0",
"version": "2.5.1",
"release": "1594765247526",

@@ -29,6 +29,6 @@ "description": "A collection of common utilities, classes, and helpers.",

"dependencies": {
"@boost/decorators": "^2.1.0",
"@boost/internal": "^2.2.0",
"@boost/decorators": "^2.1.1",
"@boost/internal": "^2.2.1",
"fast-glob": "^3.2.4",
"json5": "^2.1.3",
"json5": "^2.2.0",
"optimal": "^4.2.0",

@@ -48,3 +48,3 @@ "pretty-ms": "^7.0.1",

},
"gitHead": "e2c452ee0c15aa7db91d1945e23ac6951028e672"
"gitHead": "3aa9bda270786e931a90e927375c33dddffed14d"
}

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