@boost/common
Advanced tools
Comparing version 1.9.0 to 2.0.0-alpha.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MODULE_NAME_PATTERN = exports.MODULE_NAME_PART = void 0; | ||
// https://github.com/npm/validate-npm-package-name | ||
exports.MODULE_NAME_PART = /[a-z0-9]{1}[-a-z0-9_.]*/u; | ||
// eslint-disable-next-line security/detect-non-literal-regexp | ||
exports.MODULE_NAME_PATTERN = new RegExp(`^(?:@(${exports.MODULE_NAME_PART.source})/)?(${exports.MODULE_NAME_PART.source})$`, 'u'); |
@@ -16,4 +16,4 @@ import { Blueprint, Predicates } from 'optimal'; | ||
*/ | ||
abstract blueprint(predicates: Predicates): Blueprint<T>; | ||
abstract blueprint(predicates: Predicates): Blueprint<object>; | ||
} | ||
//# sourceMappingURL=Contract.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -24,4 +36,4 @@ }; | ||
// so it's read only, but we still want to modify it with this function. | ||
// @ts-ignore | ||
this.options = Object.freeze(optimal_1.default(Object.assign(Object.assign({}, this.options), nextOptions), this.blueprint(optimal_1.predicates), { | ||
// @ts-expect-error | ||
this.options = Object.freeze(optimal_1.default({ ...this.options, ...nextOptions }, this.blueprint(optimal_1.predicates), { | ||
name: this.constructor.name, | ||
@@ -28,0 +40,0 @@ })); |
@@ -11,4 +11,4 @@ "use strict"; | ||
} | ||
return pretty_ms_1.default(ms, Object.assign({ keepDecimalsOnWholeSeconds: true }, options)); | ||
return pretty_ms_1.default(ms, { keepDecimalsOnWholeSeconds: true, ...options }); | ||
} | ||
exports.default = formatMs; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var createBlueprint_1 = require("./createBlueprint"); | ||
exports.createBlueprint = createBlueprint_1.default; | ||
Object.defineProperty(exports, "createBlueprint", { enumerable: true, get: function () { return createBlueprint_1.default; } }); | ||
var deepFreeze_1 = require("./deepFreeze"); | ||
exports.deepFreeze = deepFreeze_1.default; | ||
Object.defineProperty(exports, "deepFreeze", { enumerable: true, get: function () { return deepFreeze_1.default; } }); | ||
var formatMs_1 = require("./formatMs"); | ||
exports.formatMs = formatMs_1.default; | ||
Object.defineProperty(exports, "formatMs", { enumerable: true, get: function () { return formatMs_1.default; } }); | ||
var instanceOf_1 = require("./instanceOf"); | ||
exports.instanceOf = instanceOf_1.default; | ||
Object.defineProperty(exports, "instanceOf", { enumerable: true, get: function () { return instanceOf_1.default; } }); | ||
var isEmpty_1 = require("./isEmpty"); | ||
exports.isEmpty = isEmpty_1.default; | ||
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return isEmpty_1.default; } }); | ||
var isFilePath_1 = require("./isFilePath"); | ||
exports.isFilePath = isFilePath_1.default; | ||
Object.defineProperty(exports, "isFilePath", { enumerable: true, get: function () { return isFilePath_1.default; } }); | ||
var isModuleName_1 = require("./isModuleName"); | ||
exports.isModuleName = isModuleName_1.default; | ||
Object.defineProperty(exports, "isModuleName", { enumerable: true, get: function () { return isModuleName_1.default; } }); | ||
var isObject_1 = require("./isObject"); | ||
exports.isObject = isObject_1.default; | ||
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return isObject_1.default; } }); | ||
var parseFile_1 = require("./parseFile"); | ||
exports.parseFile = parseFile_1.default; | ||
Object.defineProperty(exports, "parseFile", { enumerable: true, get: function () { return parseFile_1.default; } }); | ||
var requireModule_1 = require("./requireModule"); | ||
exports.requireModule = requireModule_1.default; | ||
Object.defineProperty(exports, "requireModule", { enumerable: true, get: function () { return requireModule_1.default; } }); | ||
var toArray_1 = require("./toArray"); | ||
exports.toArray = toArray_1.default; | ||
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_1.default; } }); |
@@ -28,2 +28,3 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
current = Object.getPrototypeOf(current); | ||
@@ -30,0 +31,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
const fs_1 = __importDefault(require("fs")); | ||
const internal_1 = require("@boost/internal"); | ||
const CommonError_1 = __importDefault(require("../CommonError")); | ||
const Path_1 = __importDefault(require("../Path")); | ||
@@ -16,3 +16,3 @@ const requireModule_1 = __importDefault(require("./requireModule")); | ||
if (!path.isAbsolute()) { | ||
throw new internal_1.RuntimeError('common', 'CM_REQ_ABS_PATH'); | ||
throw new CommonError_1.default('PATH_REQUIRE_ABSOLUTE'); | ||
} | ||
@@ -30,5 +30,5 @@ switch (path.ext()) { | ||
default: | ||
throw new internal_1.RuntimeError('common', 'CM_PARSE_INVALID_EXT', [path.name()]); | ||
throw new CommonError_1.default('PARSE_INVALID_EXT', [path.name()]); | ||
} | ||
} | ||
exports.default = parseFile; |
@@ -7,4 +7,3 @@ "use strict"; | ||
// Support Babel compiled files | ||
// eslint-disable-next-line no-underscore-dangle | ||
if (value && value.__esModule) { | ||
if (value === null || value === void 0 ? void 0 : value.__esModule) { | ||
value = value.default; | ||
@@ -11,0 +10,0 @@ } |
/** | ||
* @copyright 2017-2019, Miles Johnson | ||
* @copyright 2020, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
*/ | ||
import optimal, { predicates, Blueprint, Predicates } from 'optimal'; | ||
import CommonError, { CommonErrorCode } from './CommonError'; | ||
import Contract from './Contract'; | ||
import Path from './Path'; | ||
import PathResolver from './PathResolver'; | ||
import Project from './Project'; | ||
import * as json from './serializers/json'; | ||
@@ -14,3 +16,3 @@ import * as yaml from './serializers/yaml'; | ||
export * from './types'; | ||
export { Contract, Blueprint, Path, PathResolver, Predicates, optimal, predicates, json, yaml }; | ||
export { CommonError, CommonErrorCode, Contract, Blueprint, Path, PathResolver, Predicates, Project, optimal, predicates, json, yaml, }; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
/** | ||
* @copyright 2017-2019, Miles Johnson | ||
* @copyright 2020, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
*/ | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -20,5 +32,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.yaml = exports.json = exports.predicates = exports.optimal = exports.Project = exports.PathResolver = exports.Path = exports.Contract = exports.CommonError = void 0; | ||
const optimal_1 = __importStar(require("optimal")); | ||
exports.optimal = optimal_1.default; | ||
exports.predicates = optimal_1.predicates; | ||
Object.defineProperty(exports, "predicates", { enumerable: true, get: function () { return optimal_1.predicates; } }); | ||
const CommonError_1 = __importDefault(require("./CommonError")); | ||
exports.CommonError = CommonError_1.default; | ||
const Contract_1 = __importDefault(require("./Contract")); | ||
@@ -30,2 +45,4 @@ exports.Contract = Contract_1.default; | ||
exports.PathResolver = PathResolver_1.default; | ||
const Project_1 = __importDefault(require("./Project")); | ||
exports.Project = Project_1.default; | ||
const json = __importStar(require("./serializers/json")); | ||
@@ -35,4 +52,4 @@ exports.json = json; | ||
exports.yaml = yaml; | ||
__export(require("./constants")); | ||
__export(require("./helpers")); | ||
__export(require("./types")); | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./helpers"), exports); | ||
__exportStar(require("./types"), exports); |
@@ -79,4 +79,3 @@ import { FilePath, PortablePath } from './types'; | ||
toString(): FilePath; | ||
private stat; | ||
} | ||
//# sourceMappingURL=Path.d.ts.map |
@@ -64,3 +64,3 @@ "use strict"; | ||
isDirectory() { | ||
return this.stat().isDirectory(); | ||
return fs_1.default.statSync(this.internalPath).isDirectory(); | ||
} | ||
@@ -71,3 +71,3 @@ /** | ||
isFile() { | ||
return this.stat().isFile(); | ||
return fs_1.default.statSync(this.internalPath).isFile(); | ||
} | ||
@@ -108,22 +108,3 @@ /** | ||
realPath() { | ||
const filePath = this.path(); | ||
if (typeof fs_1.default.realpathSync.native === 'function') { | ||
try { | ||
return fs_1.default.realpathSync.native(filePath); | ||
} | ||
catch (_a) { | ||
// Skip | ||
} | ||
} | ||
// @ts-ignore | ||
const fsBinding = process.binding('fs'); | ||
if (fsBinding.realpath) { | ||
try { | ||
return fsBinding.realpath(filePath, 'utf8'); | ||
} | ||
catch (_b) { | ||
// Skip | ||
} | ||
} | ||
return fs_1.default.realpathSync(filePath); | ||
return fs_1.default.realpathSync.native(this.path()); | ||
} | ||
@@ -150,8 +131,2 @@ /** | ||
} | ||
stat() { | ||
if (!this.stats) { | ||
this.stats = fs_1.default.statSync(this.internalPath); | ||
} | ||
return this.stats; | ||
} | ||
} | ||
@@ -158,0 +133,0 @@ exports.default = Path; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const internal_1 = require("@boost/internal"); | ||
const CommonError_1 = __importDefault(require("./CommonError")); | ||
const types_1 = require("./types"); | ||
@@ -18,3 +18,3 @@ const Path_1 = __importDefault(require("./Path")); | ||
getLookupPaths() { | ||
return this.lookups.map(lookup => lookup.path.path()); | ||
return this.lookups.map((lookup) => lookup.path.path()); | ||
} | ||
@@ -53,3 +53,3 @@ /** | ||
let resolvedLookup; | ||
this.lookups.some(lookup => { | ||
this.lookups.some((lookup) => { | ||
// Check that the file exists on the file system. | ||
@@ -79,4 +79,4 @@ if (lookup.type === types_1.LookupType.FILE_SYSTEM) { | ||
if (!resolvedPath || !resolvedLookup) { | ||
throw new internal_1.RuntimeError('common', 'CM_PATH_RESOLVE_LOOKUPS', [ | ||
this.lookups.map(lookup => ` - ${lookup.path} (${lookup.type})`).join('\n'), | ||
throw new CommonError_1.default('PATH_RESOLVE_LOOKUPS', [ | ||
this.lookups.map((lookup) => ` - ${lookup.path} (${lookup.type})`).join('\n'), | ||
]); | ||
@@ -83,0 +83,0 @@ } |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringify = exports.parse = void 0; | ||
const json5_1 = __importDefault(require("json5")); | ||
@@ -8,0 +9,0 @@ function parse(content, reviver) { |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringify = exports.parse = void 0; | ||
const yaml_1 = __importDefault(require("yaml")); | ||
@@ -8,0 +9,0 @@ function parse(content, options) { |
@@ -23,3 +23,3 @@ import { Blueprint, Predicates } from 'optimal'; | ||
readonly options: Required<T>; | ||
blueprint: BlueprintFactory<T>; | ||
blueprint: BlueprintFactory<object>; | ||
} | ||
@@ -100,2 +100,13 @@ export interface Toolable { | ||
} | ||
export interface WorkspaceMetadata { | ||
jsonPath: string; | ||
packagePath: string; | ||
packageName: string; | ||
workspacePath: string; | ||
workspaceName: string; | ||
} | ||
export interface WorkspacePackage<T extends PackageStructure> { | ||
metadata: WorkspaceMetadata; | ||
package: T; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LookupType = void 0; | ||
var LookupType; | ||
@@ -4,0 +5,0 @@ (function (LookupType) { |
{ | ||
"name": "@boost/common", | ||
"version": "1.9.0", | ||
"description": "Common utilities for Boost applications.", | ||
"version": "2.0.0-alpha.1", | ||
"release": "1592788092197", | ||
"description": "Common utilities.", | ||
"keywords": [ | ||
@@ -13,5 +14,4 @@ "boost", | ||
"types": "./lib/index.d.ts", | ||
"nonce": "1579986563745", | ||
"engines": { | ||
"node": ">=8.9.0" | ||
"node": ">=10.17.0" | ||
}, | ||
@@ -24,10 +24,11 @@ "repository": "https://github.com/milesj/boost/tree/master/packages/common", | ||
"dependencies": { | ||
"@boost/internal": "^1.2.0", | ||
"@boost/internal": "^2.0.0-alpha.1", | ||
"fast-glob": "^3.2.4", | ||
"json5": "^2.1.3", | ||
"optimal": "^4.2.0", | ||
"pretty-ms": "^5.1.0", | ||
"yaml": "^1.9.2" | ||
"pretty-ms": "^7.0.0", | ||
"yaml": "^1.10.0" | ||
}, | ||
"devDependencies": { | ||
"@boost/test-utils": "^1.4.1" | ||
"@boost/test-utils": "^2.0.0-alpha.0" | ||
}, | ||
@@ -38,3 +39,3 @@ "funding": { | ||
}, | ||
"gitHead": "257f5a0a342a014f3ce9cf8c288879a73b36ef76" | ||
"gitHead": "3fffbcf3231b86592d2083902b8c39a2ed1b2e4c" | ||
} |
@@ -1,2 +0,2 @@ | ||
# Boost Common | ||
# Common utilities - Boost | ||
@@ -7,3 +7,3 @@ [![Build Status](https://github.com/milesj/boost/workflows/Build/badge.svg)](https://github.com/milesj/boost/actions?query=branch%3Amaster) | ||
A collection of common utilities and helpers for general purpose or Boost powered applications. | ||
A collection of common utilities and helpers for general purpose or Boost packages. | ||
@@ -10,0 +10,0 @@ ## Installation |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
60946
70
1020
6
2
+ Addedfast-glob@^3.2.4
+ Added@boost/internal@2.2.3(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpretty-ms@7.0.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removed@boost/internal@1.2.0(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedchalk@3.0.0(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedpretty-ms@5.1.0(transitive)
- Removedsupports-color@7.2.0(transitive)
Updatedpretty-ms@^7.0.0
Updatedyaml@^1.10.0