🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@boost/internal

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/internal - npm Package Compare versions

Comparing version

to
2.1.0

esm/index.js

14

CHANGELOG.md

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

## 2.1.0 - 2020-08-17
#### 🚀 Updates
- Add `__DEV__` conditionals for a smaller filesize. ([b04d389](https://github.com/milesj/boost/commit/b04d389))
- Build packages with Rollup to support web and node targets. ([38cdad9](https://github.com/milesj/boost/commit/38cdad9))
- **[web]** Rework errors to not rely on Node.js utils. ([7752e7f](https://github.com/milesj/boost/commit/7752e7f))
**Note:** Version bump only for package @boost/internal
# 2.0.0 - 2020-07-14

@@ -8,0 +22,0 @@

20

lib/color.d.ts

@@ -1,12 +0,16 @@

import chalk from 'chalk';
export interface ColorFormatter {
(message: string | {
toString: () => string;
}): string;
}
declare const _default: {
fail: chalk.Chalk;
mute: chalk.Chalk;
pass: chalk.Chalk;
filePath: chalk.Chalk;
moduleName: chalk.Chalk;
projectName: chalk.Chalk;
symbol: chalk.Chalk;
fail: ColorFormatter;
mute: ColorFormatter;
pass: ColorFormatter;
filePath: ColorFormatter;
moduleName: ColorFormatter;
projectName: ColorFormatter;
symbol: ColorFormatter;
};
export default _default;
//# sourceMappingURL=color.d.ts.map

225

lib/index.js

@@ -1,18 +0,209 @@

"use strict";
/**
* @copyright 2020, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var debug = _interopDefault(require('debug'));
/* eslint-disable no-magic-numbers, sort-keys */
// https://github.com/chalk/ansi-styles/blob/master/index.js#L75
function createColor(open) {
return function (message) {
return "\x1B[" + open + "m" + String(message) + "\x1B[39m";
};
}
var color = {
// States
fail: createColor(31),
mute: createColor(90),
pass: createColor(32),
// Types
filePath: createColor(36),
moduleName: createColor(33),
projectName: createColor(34),
symbol: createColor(35)
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.env = exports.createScopedError = exports.createInternalDebugger = exports.color = void 0;
const color_1 = __importDefault(require("./color"));
exports.color = color_1.default;
const createInternalDebugger_1 = __importDefault(require("./createInternalDebugger"));
exports.createInternalDebugger = createInternalDebugger_1.default;
const createScopedError_1 = __importDefault(require("./createScopedError"));
exports.createScopedError = createScopedError_1.default;
const env_1 = __importDefault(require("./env"));
exports.env = env_1.default;
function sentenceCase(value) {
return String(value).replace(/[A-Z]/g, function (match) {
return " " + match.toLocaleLowerCase();
}).trim();
}
debug.formatters.S = sentenceCase;
function createInternalDebugger(namespace) {
return debug("boost:" + namespace);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
var internalErrors = {
INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',
UNKNOWN_ERROR: 'An unknown error has occurred.'
};
var TOKEN_PATTERN = /\{([0-9]+)\}/g;
function createScopedError(scope, name, errors) {
var _temp;
function msg(code, messages, params) {
if (params === void 0) {
params = [];
}
if (!messages[code]) {
return '';
}
return messages[code].replace(TOKEN_PATTERN, function (match, index) {
return String(params[index]);
}) + " [" + scope + ":" + code + "]";
}
if ("production" !== process.env.NODE_ENV) {
if (scope.length !== 3 || scope !== scope.toUpperCase()) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
}
return _temp = /*#__PURE__*/function (_Error) {
_inheritsLoose(InternalError, _Error);
function InternalError(code, params) {
var _this;
_this = _Error.call(this, msg(code, errors, params)) || this;
_this.code = void 0;
_this.scope = scope;
_this.code = code;
_this.name = name; // If a message was not loaded, we are throwing an unknown error
if (!_this.message) {
_this.code = 'UNKNOWN_ERROR';
_this.message = msg('UNKNOWN_ERROR', internalErrors);
}
return _this;
}
return InternalError;
}( /*#__PURE__*/_wrapNativeSuper(Error)), _temp;
}
var envVars = {};
if (typeof global.process !== 'undefined') {
envVars = process.env;
} else if (typeof global.window !== 'undefined') {
// @ts-expect-error
envVars = window;
}
function env(key, value) {
var name = "BOOSTJS_" + key;
if (value === null) {
delete envVars[name];
return undefined;
}
if (typeof value === 'string') {
envVars[name] = value;
return value;
}
return envVars[name];
}
exports.color = color;
exports.createInternalDebugger = createInternalDebugger;
exports.createScopedError = createScopedError;
exports.env = env;
{
"name": "@boost/internal",
"version": "2.0.0",
"version": "2.1.0",
"release": "1594765247526",

@@ -11,2 +11,3 @@ "description": "Boost internals.",

"main": "./lib/index.js",
"module": "./esm/index.js",
"types": "./lib/index.d.ts",

@@ -22,3 +23,2 @@ "engines": {

"dependencies": {
"chalk": "^4.1.0",
"debug": "^4.1.1"

@@ -30,3 +30,3 @@ },

},
"gitHead": "501cfc8418d89ea534572bfe6d3d4340c559e03c"
"gitHead": "7982950ce80d97d1815234ee0d66b5dc4ac3a843"
}

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