New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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 2.2.2 to 2.2.3

11

dts/color.d.ts

@@ -1,7 +0,5 @@

export interface ColorFormatter {
(message: string | {
toString: () => string;
}): string;
}
declare const _default: {
export declare type ColorFormatter = (message: string | {
toString: () => string;
}) => string;
export declare const color: {
fail: ColorFormatter;

@@ -15,3 +13,2 @@ mute: ColorFormatter;

};
export default _default;
//# sourceMappingURL=color.d.ts.map

@@ -1,4 +0,2 @@

export interface Errors {
[code: string]: string;
}
export declare type Errors = Record<string, string>;
export interface ScopedError<Code extends string = string> {

@@ -8,3 +6,3 @@ code: Code | 'UNKNOWN_ERROR';

}
export default function createScopedError<Code extends string = string>(scope: string, name: string, errors: Errors): new (code: Code, params?: unknown[]) => Error & ScopedError<Code>;
export declare function createScopedError<Code extends string = string>(scope: string, name: string, errors: Errors): new (code: Code, params?: unknown[]) => Error & ScopedError<Code>;
//# sourceMappingURL=createScopedError.d.ts.map

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

export default function env<T extends string = string>(key: string, value?: T | null): T | undefined;
export declare function env<T extends string = string>(key: string, value?: T | null): T | undefined;
//# sourceMappingURL=env.d.ts.map

@@ -5,7 +5,6 @@ /**

*/
import color from './color';
import { createInternalDebugger } from './createInternalDebugger';
import createScopedError from './createScopedError';
import env from './env';
export { color, createInternalDebugger, createScopedError, env };
export * from './color';
export * from './createInternalDebugger';
export * from './createScopedError';
export * from './env';
//# sourceMappingURL=index.d.ts.map

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

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }

@@ -15,4 +25,4 @@

// Generated with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm
// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: legacy, Format: esm
import debug from 'debug';

@@ -24,3 +34,3 @@ /* eslint-disable no-magic-numbers, sort-keys */

return function (message) {
return "\x1B[" + open + "m" + String(message) + "\x1B[39m";
return "\x1B[".concat(open, "m").concat(String(message), "\x1B[39m");
};

@@ -43,3 +53,3 @@ }

return String(value).replace(/[A-Z]/g, function (match) {
return " " + match.toLocaleLowerCase();
return " ".concat(match.toLocaleLowerCase());
}).trim();

@@ -51,3 +61,3 @@ }

function createInternalDebugger(namespace) {
return debug("boost:" + namespace);
return debug("boost:".concat(namespace));
}

@@ -62,6 +72,4 @@

function createScopedError(scope, name, errors) {
function msg(code, messages, params) {
if (params === void 0) {
params = [];
}
function msg(code, messages) {
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];

@@ -72,20 +80,22 @@ if (!messages[code]) {

return messages[code].replace(TOKEN_PATTERN, function (match, index) {
return "".concat(messages[code].replace(TOKEN_PATTERN, function (match, index) {
return String(params[index]);
}) + " [" + scope + ":" + code + "]";
}), " [").concat(scope, ":").concat(code, "]");
}
if (process.env.NODE_ENV !== "production") {
if (scope.length !== 3 || scope !== scope.toUpperCase()) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
if (process.env.NODE_ENV !== "production" && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
return /*#__PURE__*/function (_Error) {
_inheritsLoose(InternalError, _Error);
_inherits(InternalError, _Error);
var _super = _createSuper(InternalError);
function InternalError(code, params) {
var _this;
_this = _Error.call(this, msg(code, errors, params)) || this;
_classCallCheck(this, InternalError);
_this = _super.call(this, msg(code, errors, params));
_this.code = void 0;

@@ -113,3 +123,3 @@ _this.scope = scope;

} else if (typeof global.window !== 'undefined') {
// @ts-expect-error
// @ts-expect-error Allow type mismatch
envVars = window;

@@ -119,3 +129,3 @@ }

function env(key, value) {
var name = "BOOSTJS_" + key;
var name = "BOOSTJS_".concat(key);

@@ -135,3 +145,3 @@ if (value === null) {

export { color, createInternalDebugger, createScopedError, env };
export { color, createInternalDebugger, createScopedError, env, sentenceCase };
//# sourceMappingURL=index.js.map

@@ -1,7 +0,17 @@

// Generated with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: lib
// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: legacy, Format: lib
'use strict';
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }

@@ -25,4 +35,4 @@

function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : {
function _interopDefault(e) {
return e && e.__esModule ? e : {
'default': e

@@ -32,3 +42,3 @@ };

var debug__default = /*#__PURE__*/_interopDefaultLegacy(debug);
var debug__default = /*#__PURE__*/_interopDefault(debug);
/* eslint-disable no-magic-numbers, sort-keys */

@@ -40,3 +50,3 @@ // https://github.com/chalk/ansi-styles/blob/master/index.js#L75

return function (message) {
return "\x1B[" + open + "m" + String(message) + "\x1B[39m";
return "\x1B[".concat(open, "m").concat(String(message), "\x1B[39m");
};

@@ -59,3 +69,3 @@ }

return String(value).replace(/[A-Z]/g, function (match) {
return " " + match.toLocaleLowerCase();
return " ".concat(match.toLocaleLowerCase());
}).trim();

@@ -67,3 +77,3 @@ }

function createInternalDebugger(namespace) {
return debug__default['default']("boost:" + namespace);
return debug__default['default']("boost:".concat(namespace));
}

@@ -78,6 +88,4 @@

function createScopedError(scope, name, errors) {
function msg(code, messages, params) {
if (params === void 0) {
params = [];
}
function msg(code, messages) {
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];

@@ -88,20 +96,22 @@ if (!messages[code]) {

return messages[code].replace(TOKEN_PATTERN, function (match, index) {
return "".concat(messages[code].replace(TOKEN_PATTERN, function (match, index) {
return String(params[index]);
}) + " [" + scope + ":" + code + "]";
}), " [").concat(scope, ":").concat(code, "]");
}
if (process.env.NODE_ENV !== "production") {
if (scope.length !== 3 || scope !== scope.toUpperCase()) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
if (process.env.NODE_ENV !== "production" && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
return /*#__PURE__*/function (_Error) {
_inheritsLoose(InternalError, _Error);
_inherits(InternalError, _Error);
var _super = _createSuper(InternalError);
function InternalError(code, params) {
var _this;
_this = _Error.call(this, msg(code, errors, params)) || this;
_classCallCheck(this, InternalError);
_this = _super.call(this, msg(code, errors, params));
_this.code = void 0;

@@ -129,3 +139,3 @@ _this.scope = scope;

} else if (typeof global.window !== 'undefined') {
// @ts-expect-error
// @ts-expect-error Allow type mismatch
envVars = window;

@@ -135,3 +145,3 @@ }

function env(key, value) {
var name = "BOOSTJS_" + key;
var name = "BOOSTJS_".concat(key);

@@ -155,2 +165,3 @@ if (value === null) {

exports.env = env;
exports.sentenceCase = sentenceCase;
//# sourceMappingURL=index.js.map

@@ -1,4 +0,6 @@

// Generated with Packemon: https://packemon.dev
// Platform: node, Support: stable, Format: lib
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
/* eslint-disable no-magic-numbers, sort-keys */

@@ -11,3 +13,3 @@ // https://github.com/chalk/ansi-styles/blob/master/index.js#L75

var color = {
const color = {
// States

@@ -23,3 +25,3 @@ fail: createColor(31),

};
module.exports = color;
exports.color = color;
//# sourceMappingURL=color.js.map

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

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

@@ -11,4 +9,4 @@

function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : {
function _interopDefault(e) {
return e && e.__esModule ? e : {
'default': e

@@ -18,3 +16,3 @@ };

var debug__default = /*#__PURE__*/_interopDefaultLegacy(debug);
var debug__default = /*#__PURE__*/_interopDefault(debug);

@@ -21,0 +19,0 @@ function sentenceCase(value) {

@@ -1,5 +0,6 @@

// Generated with Packemon: https://packemon.dev
// Platform: node, Support: stable, Format: lib
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
const internalErrors = {

@@ -20,6 +21,4 @@ INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',

if (process.env.NODE_ENV !== "production") {
if (scope.length !== 3 || scope !== scope.toUpperCase()) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
if (process.env.NODE_ENV !== "production" && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}

@@ -44,3 +43,3 @@

module.exports = createScopedError;
exports.createScopedError = createScopedError;
//# sourceMappingURL=createScopedError.js.map

@@ -1,5 +0,6 @@

// Generated with Packemon: https://packemon.dev
// Platform: node, Support: stable, Format: lib
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
let envVars = {};

@@ -10,3 +11,3 @@

} else if (typeof global.window !== 'undefined') {
// @ts-expect-error
// @ts-expect-error Allow type mismatch
envVars = window;

@@ -31,3 +32,3 @@ }

module.exports = env;
exports.env = env;
//# sourceMappingURL=env.js.map

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

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

@@ -16,7 +14,13 @@

var env = require('./env.js');
/**
* @copyright 2020, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
exports.color = color;
exports.color = color.color;
exports.createInternalDebugger = createInternalDebugger.createInternalDebugger;
exports.createScopedError = createScopedError;
exports.env = env;
exports.sentenceCase = createInternalDebugger.sentenceCase;
exports.createScopedError = createScopedError.createScopedError;
exports.env = env.env;
//# sourceMappingURL=index.js.map
{
"name": "@boost/internal",
"version": "2.2.2",
"version": "2.2.3",
"release": "1594765247526",

@@ -35,3 +35,3 @@ "description": "Boost internals.",

"dependencies": {
"debug": "^4.3.1"
"debug": "^4.3.2"
},

@@ -43,2 +43,7 @@ "funding": {

"packemon": {
"format": [
"lib",
"esm"
],
"support": "legacy",
"platform": [

@@ -49,3 +54,3 @@ "browser",

},
"gitHead": "f9eb83de54fa41334f1a1e487216004a03caf662"
"gitHead": "34f5c1131c16dd22e9f95bcc19e19b9a5dee1fc7"
}
/* eslint-disable no-magic-numbers, sort-keys */
export interface ColorFormatter {
(message: string | { toString: () => string }): string;
}
export type ColorFormatter = (message: string | { toString: () => string }) => string;
// https://github.com/chalk/ansi-styles/blob/master/index.js#L75
function createColor(open: number): ColorFormatter {
return (message) => `\u001B[${open}m${String(message)}\u001B[39m`;
return (message) => `\u001B[${open}m${String(message)}\u001B[39m`;
}
export default {
// States
fail: createColor(31),
mute: createColor(90),
pass: createColor(32),
// Types
filePath: createColor(36),
moduleName: createColor(33),
projectName: createColor(34),
symbol: createColor(35),
export const color = {
// States
fail: createColor(31),
mute: createColor(90),
pass: createColor(32),
// Types
filePath: createColor(36),
moduleName: createColor(33),
projectName: createColor(34),
symbol: createColor(35),
};
import debug, { Debugger } from 'debug';
export function sentenceCase(value: unknown): string {
return String(value)
.replace(/[A-Z]/gu, (match) => ` ${match.toLocaleLowerCase()}`)
.trim();
return String(value)
.replace(/[A-Z]/gu, (match) => ` ${match.toLocaleLowerCase()}`)
.trim();
}

@@ -12,3 +12,3 @@

export function createInternalDebugger(namespace: string): Debugger {
return debug(`boost:${namespace}`);
return debug(`boost:${namespace}`);
}
const internalErrors = {
INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',
UNKNOWN_ERROR: 'An unknown error has occurred.',
INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',
UNKNOWN_ERROR: 'An unknown error has occurred.',
};

@@ -8,50 +8,46 @@

export interface Errors {
[code: string]: string;
}
export type Errors = Record<string, string>;
export interface ScopedError<Code extends string = string> {
code: Code | 'UNKNOWN_ERROR';
scope: string;
code: Code | 'UNKNOWN_ERROR';
scope: string;
}
export default function createScopedError<Code extends string = string>(
scope: string,
name: string,
errors: Errors,
export function createScopedError<Code extends string = string>(
scope: string,
name: string,
errors: Errors,
): new (code: Code, params?: unknown[]) => Error & ScopedError<Code> {
function msg(code: string, messages: Errors, params: unknown[] = []): string {
if (!messages[code]) {
return '';
}
function msg(code: string, messages: Errors, params: unknown[] = []): string {
if (!messages[code]) {
return '';
}
return `${messages[code].replace(TOKEN_PATTERN, (match, index) =>
String(params[index]),
)} [${scope}:${code}]`;
}
return `${messages[code].replace(TOKEN_PATTERN, (match, index) =>
String(params[index as number]),
)} [${scope}:${code}]`;
}
if (__DEV__) {
if (scope.length !== 3 || scope !== scope.toUpperCase()) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
}
if (__DEV__ && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
return class InternalError extends Error implements ScopedError<Code> {
code: Code | 'UNKNOWN_ERROR';
return class InternalError extends Error implements ScopedError<Code> {
code: Code | 'UNKNOWN_ERROR';
scope: string = scope;
scope: string = scope;
constructor(code: Code, params?: unknown[]) {
super(msg(code, errors, params));
constructor(code: Code, params?: unknown[]) {
super(msg(code, errors, params));
this.code = code;
this.name = name;
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);
}
}
};
// 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);
}
}
};
}

@@ -1,29 +0,26 @@

let envVars: { [key: string]: unknown } = {};
let envVars: Record<string, unknown> = {};
if (typeof global.process !== 'undefined') {
envVars = process.env;
envVars = process.env;
} else if (typeof global.window !== 'undefined') {
// @ts-expect-error
envVars = window;
// @ts-expect-error Allow type mismatch
envVars = window;
}
export default function env<T extends string = string>(
key: string,
value?: T | null,
): T | undefined {
const name = `BOOSTJS_${key}`;
export function env<T extends string = string>(key: string, value?: T | null): T | undefined {
const name = `BOOSTJS_${key}`;
if (value === null) {
delete envVars[name];
if (value === null) {
delete envVars[name];
return undefined;
}
return undefined;
}
if (typeof value === 'string') {
envVars[name] = value;
if (typeof value === 'string') {
envVars[name] = value;
return value;
}
return value;
}
return envVars[name] as T;
return envVars[name] as T;
}

@@ -6,7 +6,5 @@ /**

import color from './color';
import { createInternalDebugger } from './createInternalDebugger';
import createScopedError from './createScopedError';
import env from './env';
export { color, createInternalDebugger, createScopedError, env };
export * from './color';
export * from './createInternalDebugger';
export * from './createScopedError';
export * from './env';

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

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