@boost/common
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -14,2 +14,6 @@ import { ModuleID, Pathable, PortablePath } from './types'; | ||
/** | ||
* Convert a module path-like value to a formatted module path string. | ||
*/ | ||
static path(part: PortablePath): ModuleID; | ||
/** | ||
* Append path parts to the end of the current path | ||
@@ -16,0 +20,0 @@ * and return a new `ModulePath` instance. |
@@ -18,2 +18,6 @@ import { FilePath, Pathable, PortablePath } from './types'; | ||
/** | ||
* Convert a path-like value to a formatted path string. | ||
*/ | ||
static path(part: PortablePath): FilePath; | ||
/** | ||
* Like `create()` but also resolves the path against a working directory. | ||
@@ -20,0 +24,0 @@ */ |
import { Path } from './Path'; | ||
import { FilePath } from './types'; | ||
import { FilePath, PortablePath } from './types'; | ||
/** | ||
@@ -10,2 +10,6 @@ * An immutable class for operating on file system paths, | ||
/** | ||
* Convert a path-like value to a formatted virtual path string. | ||
*/ | ||
static path(part: PortablePath): FilePath; | ||
/** | ||
* Return the current module path as a normalized string, | ||
@@ -12,0 +16,0 @@ * converting all path separators to "/". |
@@ -13,20 +13,8 @@ 'use strict'; | ||
if (typeof Symbol !== "undefined") { | ||
async = Symbol.asyncIterator; | ||
sync = Symbol.iterator; | ||
for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { | ||
if (async && null != (method = iterable[async])) return method.call(iterable); | ||
if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); | ||
async = "@@asyncIterator", sync = "@@iterator"; | ||
} | ||
while (retry--) { | ||
if (async && (method = iterable[async]) != null) { | ||
return method.call(iterable); | ||
} | ||
if (sync && (method = iterable[sync]) != null) { | ||
return new AsyncFromSyncIterator(method.call(iterable)); | ||
} | ||
async = "@@asyncIterator"; | ||
sync = "@@iterator"; | ||
} | ||
throw new TypeError("Object is not async iterable"); | ||
@@ -36,8 +24,16 @@ } | ||
function AsyncFromSyncIterator(s) { | ||
AsyncFromSyncIterator = function (s) { | ||
this.s = s; | ||
this.n = s.next; | ||
}; | ||
function AsyncFromSyncIteratorContinuation(r) { | ||
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); | ||
var done = r.done; | ||
return Promise.resolve(r.value).then(function (value) { | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
}); | ||
} | ||
AsyncFromSyncIterator.prototype = { | ||
return AsyncFromSyncIterator = function (s) { | ||
this.s = s, this.n = s.next; | ||
}, AsyncFromSyncIterator.prototype = { | ||
s: null, | ||
@@ -50,34 +46,12 @@ n: null, | ||
var ret = this.s.return; | ||
if (ret === undefined) { | ||
return Promise.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
} | ||
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); | ||
return void 0 === ret ? Promise.resolve({ | ||
value: value, | ||
done: !0 | ||
}) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); | ||
}, | ||
throw: function (value) { | ||
var thr = this.s.return; | ||
if (thr === undefined) return Promise.reject(value); | ||
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); | ||
return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); | ||
} | ||
}; | ||
function AsyncFromSyncIteratorContinuation(r) { | ||
if (Object(r) !== r) { | ||
return Promise.reject(new TypeError(r + " is not an object.")); | ||
} | ||
var done = r.done; | ||
return Promise.resolve(r.value).then(function (value) { | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
}); | ||
} | ||
return new AsyncFromSyncIterator(s); | ||
}, new AsyncFromSyncIterator(s); | ||
} | ||
@@ -88,41 +62,17 @@ | ||
function _jsx(type, props, key, children) { | ||
if (!REACT_ELEMENT_TYPE) { | ||
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; | ||
} | ||
REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103); | ||
var defaultProps = type && type.defaultProps, | ||
childrenLength = arguments.length - 3; | ||
if (props || 0 === childrenLength || (props = { | ||
children: void 0 | ||
}), 1 === childrenLength) props.children = children;else if (childrenLength > 1) { | ||
for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; | ||
var defaultProps = type && type.defaultProps; | ||
var childrenLength = arguments.length - 3; | ||
if (!props && childrenLength !== 0) { | ||
props = { | ||
children: void 0 | ||
}; | ||
} | ||
if (childrenLength === 1) { | ||
props.children = children; | ||
} else if (childrenLength > 1) { | ||
var childArray = new Array(childrenLength); | ||
for (var i = 0; i < childrenLength; i++) { | ||
childArray[i] = arguments[i + 3]; | ||
} | ||
props.children = childArray; | ||
} | ||
if (props && defaultProps) { | ||
for (var propName in defaultProps) { | ||
if (props[propName] === void 0) { | ||
props[propName] = defaultProps[propName]; | ||
} | ||
} | ||
} else if (!props) { | ||
props = defaultProps || {}; | ||
} | ||
if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {}); | ||
return { | ||
$$typeof: REACT_ELEMENT_TYPE, | ||
type: type, | ||
key: key === undefined ? null : "" + key, | ||
key: void 0 === key ? null : "" + key, | ||
ref: null, | ||
@@ -139,10 +89,5 @@ props: props, | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) { | ||
symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
} | ||
keys.push.apply(keys, symbols); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
@@ -155,15 +100,8 @@ | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
@@ -177,13 +115,7 @@ | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
@@ -193,28 +125,28 @@ | ||
_wrapRegExp = function (re, groups) { | ||
return new BabelRegExp(re, undefined, groups); | ||
return new BabelRegExp(re, void 0, groups); | ||
}; | ||
var _super = RegExp.prototype; | ||
var _super = RegExp.prototype, | ||
_groups = new WeakMap(); | ||
var _groups = new WeakMap(); | ||
function BabelRegExp(re, flags, groups) { | ||
var _this = new RegExp(re, flags); | ||
_groups.set(_this, groups || _groups.get(re)); | ||
return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); | ||
} | ||
return _setPrototypeOf(_this, BabelRegExp.prototype); | ||
function buildGroups(result, re) { | ||
var g = _groups.get(re); | ||
return Object.keys(g).reduce(function (groups, name) { | ||
return groups[name] = result[g[name]], groups; | ||
}, Object.create(null)); | ||
} | ||
_inherits(BabelRegExp, RegExp); | ||
BabelRegExp.prototype.exec = function (str) { | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { | ||
var result = _super.exec.call(this, str); | ||
if (result) result.groups = buildGroups(result, this); | ||
return result; | ||
}; | ||
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { | ||
if (typeof substitution === "string") { | ||
return result && (result.groups = buildGroups(result, this)), result; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { | ||
if ("string" == typeof substitution) { | ||
var groups = _groups.get(this); | ||
@@ -225,3 +157,5 @@ | ||
})); | ||
} else if (typeof substitution === "function") { | ||
} | ||
if ("function" == typeof substitution) { | ||
var _this = this; | ||
@@ -231,25 +165,8 @@ | ||
var args = arguments; | ||
if (typeof args[args.length - 1] !== "object") { | ||
args = [].slice.call(args); | ||
args.push(buildGroups(args, _this)); | ||
} | ||
return substitution.apply(this, args); | ||
return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); | ||
}); | ||
} else { | ||
return _super[Symbol.replace].call(this, str, substitution); | ||
} | ||
}; | ||
function buildGroups(result, re) { | ||
var g = _groups.get(re); | ||
return Object.keys(g).reduce(function (groups, name) { | ||
groups[name] = result[g[name]]; | ||
return groups; | ||
}, Object.create(null)); | ||
} | ||
return _wrapRegExp.apply(this, arguments); | ||
return _super[Symbol.replace].call(this, str, substitution); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
@@ -476,2 +393,5 @@ | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, "prototype", { | ||
writable: false | ||
}); | ||
return Constructor; | ||
@@ -575,8 +495,11 @@ } | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
Object.defineProperty(subClass, "prototype", { | ||
value: Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}), | ||
writable: false | ||
}); | ||
@@ -583,0 +506,0 @@ if (superClass) _setPrototypeOf(subClass, superClass); |
'use strict'; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
@@ -7,0 +7,0 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
'use strict'; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
@@ -7,0 +7,0 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
'use strict'; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
@@ -7,0 +7,0 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
@@ -34,2 +34,10 @@ 'use strict'; | ||
/** | ||
* Convert a module path-like value to a formatted module path string. | ||
*/ | ||
static path(part) { | ||
return new ModulePath(part).path(); | ||
} | ||
/** | ||
* Append path parts to the end of the current path | ||
@@ -36,0 +44,0 @@ * and return a new `ModulePath` instance. |
'use strict'; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
@@ -7,0 +7,0 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
@@ -40,2 +40,10 @@ 'use strict'; | ||
/** | ||
* Convert a path-like value to a formatted path string. | ||
*/ | ||
static path(part) { | ||
return new Path(part).path(); | ||
} | ||
/** | ||
* Like `create()` but also resolves the path against a working directory. | ||
@@ -42,0 +50,0 @@ */ |
@@ -25,5 +25,13 @@ 'use strict'; | ||
/** | ||
* Convert a path-like value to a formatted virtual path string. | ||
*/ | ||
static path(part) { | ||
return new VirtualPath(part).path(); | ||
} | ||
/** | ||
* Return the current module path as a normalized string, | ||
* converting all path separators to "/". | ||
*/ | ||
path() { | ||
@@ -30,0 +38,0 @@ if (!this.isNormalized) { |
{ | ||
"name": "@boost/common", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"release": "1594765247526", | ||
@@ -42,3 +42,3 @@ "description": "A collection of common utilities, classes, and helpers.", | ||
"json5": "^2.2.0", | ||
"optimal": "^5.1.0", | ||
"optimal": "^5.1.1", | ||
"pretty-ms": "^7.0.1", | ||
@@ -68,3 +68,3 @@ "resolve": "^1.20.0", | ||
}, | ||
"gitHead": "7004d65394cb7c69b6bd28dcc64a2052bc13b0f2" | ||
"gitHead": "45b58d0e1bbf8112e7b498da7004beceb4e9570a" | ||
} |
@@ -24,2 +24,9 @@ import path from 'path'; | ||
/** | ||
* Convert a module path-like value to a formatted module path string. | ||
*/ | ||
static path(part: PortablePath): ModuleID { | ||
return new ModulePath(part).path(); | ||
} | ||
/** | ||
* Append path parts to the end of the current path | ||
@@ -26,0 +33,0 @@ * and return a new `ModulePath` instance. |
@@ -31,2 +31,9 @@ import fs from 'fs'; | ||
/** | ||
* Convert a path-like value to a formatted path string. | ||
*/ | ||
static path(part: PortablePath): FilePath { | ||
return new Path(part).path(); | ||
} | ||
/** | ||
* Like `create()` but also resolves the path against a working directory. | ||
@@ -33,0 +40,0 @@ */ |
import path from 'path'; | ||
import { Path } from './Path'; | ||
import { FilePath } from './types'; | ||
import { FilePath, PortablePath } from './types'; | ||
@@ -12,2 +12,9 @@ /** | ||
/** | ||
* Convert a path-like value to a formatted virtual path string. | ||
*/ | ||
static override path(part: PortablePath): FilePath { | ||
return new VirtualPath(part).path(); | ||
} | ||
/** | ||
* Return the current module path as a normalized string, | ||
@@ -14,0 +21,0 @@ * converting all path separators to "/". |
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
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
205122
5024
Updatedoptimal@^5.1.1