@neurosity/sdk 6.5.10 → 6.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/neurosity.iife.js +118 -49
- package/dist/browser/neurosity.js +112 -112
- package/dist/browser/neurosity.js.map +1 -1
- package/dist/cjs/__tests__/Neurosity.test.d.ts +1 -0
- package/dist/cjs/__tests__/Neurosity.test.js +201 -0
- package/dist/cjs/__tests__/WebBluetoothTransport.test.d.ts +1 -0
- package/dist/cjs/__tests__/WebBluetoothTransport.test.js +201 -0
- package/dist/cjs/__tests__/accelerometer.test.d.ts +1 -0
- package/dist/cjs/__tests__/accelerometer.test.js +158 -0
- package/dist/cjs/__tests__/auth.test.d.ts +1 -0
- package/dist/cjs/__tests__/auth.test.js +239 -0
- package/dist/cjs/__tests__/brainwaves.test.d.ts +1 -0
- package/dist/cjs/__tests__/brainwaves.test.js +291 -0
- package/dist/cjs/__tests__/device.test.d.ts +1 -0
- package/dist/cjs/__tests__/device.test.js +281 -0
- package/dist/cjs/__tests__/haptics.test.d.ts +1 -0
- package/dist/cjs/__tests__/haptics.test.js +162 -0
- package/dist/cjs/__tests__/metrics.test.d.ts +1 -0
- package/dist/cjs/__tests__/metrics.test.js +178 -0
- package/dist/cjs/__tests__/oauth.test.d.ts +1 -0
- package/dist/cjs/__tests__/oauth.test.js +138 -0
- package/dist/cjs/__tests__/settings.test.d.ts +1 -0
- package/dist/cjs/__tests__/settings.test.js +130 -0
- package/dist/cjs/__tests__/setup/webBluetooth.setup.d.ts +11 -0
- package/dist/cjs/__tests__/setup/webBluetooth.setup.js +35 -0
- package/dist/cjs/__tests__/setup.d.ts +0 -0
- package/dist/cjs/__tests__/setup.js +7 -0
- package/dist/cjs/__tests__/streaming.test.d.ts +1 -0
- package/dist/cjs/__tests__/streaming.test.js +259 -0
- package/dist/cjs/__tests__/timesync.test.d.ts +1 -0
- package/dist/cjs/__tests__/timesync.test.js +54 -0
- package/dist/cjs/__tests__/utils.test.d.ts +1 -0
- package/dist/cjs/__tests__/utils.test.js +281 -0
- package/dist/cjs/api/bluetooth/BluetoothClient.d.ts +6 -6
- package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +1 -1
- package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
- package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
- package/dist/cjs/api/bluetooth/types/index.d.ts +2 -2
- package/dist/cjs/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
- package/dist/cjs/api/bluetooth/utils/stitch.d.ts +1 -1
- package/dist/cjs/api/bluetooth/utils/textCodec.d.ts +1 -1
- package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
- package/dist/cjs/api/firebase/FirebaseDevice.d.ts +1 -1
- package/dist/cjs/api/firebase/FirebaseUser.d.ts +1 -1
- package/dist/cjs/api/index.js +1 -1
- package/dist/cjs/timesync/Timesync.d.ts +1 -1
- package/dist/cjs/types/awareness.d.ts +1 -1
- package/dist/cjs/types/brainwaves.d.ts +25 -12
- package/dist/cjs/types/credentials.d.ts +4 -4
- package/dist/cjs/types/deviceInfo.d.ts +4 -4
- package/dist/cjs/types/epoch.d.ts +1 -1
- package/dist/cjs/types/experiment.d.ts +1 -1
- package/dist/cjs/types/hapticEffects.d.ts +1 -1
- package/dist/cjs/types/marker.d.ts +1 -1
- package/dist/cjs/types/metrics.d.ts +2 -2
- package/dist/cjs/types/oauth.d.ts +4 -4
- package/dist/cjs/types/sample.d.ts +2 -2
- package/dist/cjs/types/signalQuality.d.ts +1 -1
- package/dist/cjs/types/skill.d.ts +2 -2
- package/dist/cjs/types/user.d.ts +3 -3
- package/dist/cjs/utils/oauth.d.ts +1 -1
- package/dist/cjs/utils/transferDevice.d.ts +3 -3
- package/dist/cjs/utils/whileOnline.d.ts +1 -1
- package/dist/electron/index.js +1 -1
- package/dist/electron/index.js.map +1 -1
- package/dist/esm/__tests__/Neurosity.test.d.ts +1 -0
- package/dist/esm/__tests__/Neurosity.test.js +199 -0
- package/dist/esm/__tests__/WebBluetoothTransport.test.d.ts +1 -0
- package/dist/esm/__tests__/WebBluetoothTransport.test.js +199 -0
- package/dist/esm/__tests__/accelerometer.test.d.ts +1 -0
- package/dist/esm/__tests__/accelerometer.test.js +156 -0
- package/dist/esm/__tests__/auth.test.d.ts +1 -0
- package/dist/esm/__tests__/auth.test.js +237 -0
- package/dist/esm/__tests__/brainwaves.test.d.ts +1 -0
- package/dist/esm/__tests__/brainwaves.test.js +289 -0
- package/dist/esm/__tests__/device.test.d.ts +1 -0
- package/dist/esm/__tests__/device.test.js +279 -0
- package/dist/esm/__tests__/haptics.test.d.ts +1 -0
- package/dist/esm/__tests__/haptics.test.js +160 -0
- package/dist/esm/__tests__/metrics.test.d.ts +1 -0
- package/dist/esm/__tests__/metrics.test.js +176 -0
- package/dist/esm/__tests__/oauth.test.d.ts +1 -0
- package/dist/esm/__tests__/oauth.test.js +133 -0
- package/dist/esm/__tests__/settings.test.d.ts +1 -0
- package/dist/esm/__tests__/settings.test.js +128 -0
- package/dist/esm/__tests__/setup/webBluetooth.setup.d.ts +11 -0
- package/dist/esm/__tests__/setup/webBluetooth.setup.js +35 -0
- package/dist/esm/__tests__/setup.d.ts +0 -0
- package/dist/esm/__tests__/setup.js +7 -0
- package/dist/esm/__tests__/streaming.test.d.ts +1 -0
- package/dist/esm/__tests__/streaming.test.js +257 -0
- package/dist/esm/__tests__/timesync.test.d.ts +1 -0
- package/dist/esm/__tests__/timesync.test.js +52 -0
- package/dist/esm/__tests__/utils.test.d.ts +1 -0
- package/dist/esm/__tests__/utils.test.js +279 -0
- package/dist/esm/api/bluetooth/BluetoothClient.d.ts +6 -6
- package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +1 -1
- package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
- package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
- package/dist/esm/api/bluetooth/types/index.d.ts +2 -2
- package/dist/esm/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
- package/dist/esm/api/bluetooth/utils/stitch.d.ts +1 -1
- package/dist/esm/api/bluetooth/utils/textCodec.d.ts +1 -1
- package/dist/esm/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
- package/dist/esm/api/firebase/FirebaseDevice.d.ts +1 -1
- package/dist/esm/api/firebase/FirebaseUser.d.ts +1 -1
- package/dist/esm/api/index.js +2 -2
- package/dist/esm/neurosity.mjs +118 -49
- package/dist/esm/timesync/Timesync.d.ts +1 -1
- package/dist/esm/types/awareness.d.ts +1 -1
- package/dist/esm/types/brainwaves.d.ts +25 -12
- package/dist/esm/types/credentials.d.ts +4 -4
- package/dist/esm/types/deviceInfo.d.ts +4 -4
- package/dist/esm/types/epoch.d.ts +1 -1
- package/dist/esm/types/experiment.d.ts +1 -1
- package/dist/esm/types/hapticEffects.d.ts +1 -1
- package/dist/esm/types/marker.d.ts +1 -1
- package/dist/esm/types/metrics.d.ts +2 -2
- package/dist/esm/types/oauth.d.ts +4 -4
- package/dist/esm/types/sample.d.ts +2 -2
- package/dist/esm/types/signalQuality.d.ts +1 -1
- package/dist/esm/types/skill.d.ts +2 -2
- package/dist/esm/types/user.d.ts +3 -3
- package/dist/esm/utils/oauth.d.ts +1 -1
- package/dist/esm/utils/transferDevice.d.ts +3 -3
- package/dist/esm/utils/whileOnline.d.ts +1 -1
- package/dist/examples/neurosity.iife.js +118 -49
- package/dist/examples/neurosity.js +112 -112
- package/dist/examples/neurosity.mjs +118 -49
- package/package.json +16 -4
|
@@ -42871,7 +42871,7 @@ var Neurosity = (function (exports) {
|
|
|
42871
42871
|
this.firebaseApp = new FirebaseApp(options);
|
|
42872
42872
|
this.firebaseUser = new FirebaseUser(this.firebaseApp);
|
|
42873
42873
|
this._selectedDevice.next(undefined);
|
|
42874
|
-
this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(
|
|
42874
|
+
this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(shareReplay(1))).pipe(filterInternalKeys(), shareReplay(1));
|
|
42875
42875
|
this.osVersion$ = this.observeNamespace("info/osVersion").pipe(shareReplay(1));
|
|
42876
42876
|
this.firebaseUser.onAuthStateChanged().subscribe((user) => {
|
|
42877
42877
|
this.user = user;
|
|
@@ -44511,7 +44511,7 @@ var Neurosity = (function (exports) {
|
|
|
44511
44511
|
};
|
|
44512
44512
|
|
|
44513
44513
|
// eslint-disable-next-line strict
|
|
44514
|
-
var
|
|
44514
|
+
var httpAdapter = null;
|
|
44515
44515
|
|
|
44516
44516
|
/**
|
|
44517
44517
|
* Determines if the given thing is a array or js object.
|
|
@@ -45965,7 +45965,7 @@ var Neurosity = (function (exports) {
|
|
|
45965
45965
|
};
|
|
45966
45966
|
|
|
45967
45967
|
const knownAdapters = {
|
|
45968
|
-
http:
|
|
45968
|
+
http: httpAdapter,
|
|
45969
45969
|
xhr: xhrAdapter
|
|
45970
45970
|
};
|
|
45971
45971
|
|
|
@@ -47281,7 +47281,6 @@ var Neurosity = (function (exports) {
|
|
|
47281
47281
|
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
47282
47282
|
}
|
|
47283
47283
|
|
|
47284
|
-
|
|
47285
47284
|
if (typeof value === 'number') {
|
|
47286
47285
|
throw new TypeError(
|
|
47287
47286
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -47464,7 +47463,6 @@ var Neurosity = (function (exports) {
|
|
|
47464
47463
|
}
|
|
47465
47464
|
}
|
|
47466
47465
|
|
|
47467
|
-
|
|
47468
47466
|
function checked (length) {
|
|
47469
47467
|
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
|
47470
47468
|
// length is NaN (which is otherwise coerced to zero.)
|
|
@@ -47575,7 +47573,6 @@ var Neurosity = (function (exports) {
|
|
|
47575
47573
|
return buffer
|
|
47576
47574
|
};
|
|
47577
47575
|
|
|
47578
|
-
|
|
47579
47576
|
function byteLength (string, encoding) {
|
|
47580
47577
|
if (Buffer.isBuffer(string)) {
|
|
47581
47578
|
return string.length
|
|
@@ -48172,7 +48169,6 @@ var Neurosity = (function (exports) {
|
|
|
48172
48169
|
return decodeCodePointsArray(res)
|
|
48173
48170
|
}
|
|
48174
48171
|
|
|
48175
|
-
|
|
48176
48172
|
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
48177
48173
|
// the lowest limit is Chrome, with 0x10000 args.
|
|
48178
48174
|
// We go 1 magnitude less, for safety
|
|
@@ -50642,30 +50638,78 @@ var Neurosity = (function (exports) {
|
|
|
50642
50638
|
// Max safe segment length for coercion.
|
|
50643
50639
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
50644
50640
|
|
|
50641
|
+
// Max safe length for a build identifier. The max length minus 6 characters for
|
|
50642
|
+
// the shortest version with a build 0.0.0+BUILD.
|
|
50643
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
50644
|
+
|
|
50645
|
+
const RELEASE_TYPES = [
|
|
50646
|
+
'major',
|
|
50647
|
+
'premajor',
|
|
50648
|
+
'minor',
|
|
50649
|
+
'preminor',
|
|
50650
|
+
'patch',
|
|
50651
|
+
'prepatch',
|
|
50652
|
+
'prerelease',
|
|
50653
|
+
];
|
|
50654
|
+
|
|
50645
50655
|
var constants = {
|
|
50646
|
-
SEMVER_SPEC_VERSION,
|
|
50647
50656
|
MAX_LENGTH,
|
|
50648
|
-
MAX_SAFE_INTEGER,
|
|
50649
50657
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
50658
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
50659
|
+
MAX_SAFE_INTEGER,
|
|
50660
|
+
RELEASE_TYPES,
|
|
50661
|
+
SEMVER_SPEC_VERSION,
|
|
50662
|
+
FLAG_INCLUDE_PRERELEASE: 0b001,
|
|
50663
|
+
FLAG_LOOSE: 0b010,
|
|
50650
50664
|
};
|
|
50651
50665
|
|
|
50652
50666
|
var re_1 = createCommonjsModule(function (module, exports) {
|
|
50653
|
-
const {
|
|
50667
|
+
const {
|
|
50668
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
50669
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
50670
|
+
MAX_LENGTH,
|
|
50671
|
+
} = constants;
|
|
50654
50672
|
|
|
50655
50673
|
exports = module.exports = {};
|
|
50656
50674
|
|
|
50657
50675
|
// The actual regexps go on exports.re
|
|
50658
50676
|
const re = exports.re = [];
|
|
50677
|
+
const safeRe = exports.safeRe = [];
|
|
50659
50678
|
const src = exports.src = [];
|
|
50660
50679
|
const t = exports.t = {};
|
|
50661
50680
|
let R = 0;
|
|
50662
50681
|
|
|
50682
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
50683
|
+
|
|
50684
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
50685
|
+
// used internally via the safeRe object since all inputs in this library get
|
|
50686
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
|
50687
|
+
// regexes are exported for userland consumption and lower level usage. A
|
|
50688
|
+
// future breaking change could export the safer regex only with a note that
|
|
50689
|
+
// all input should have extra whitespace removed.
|
|
50690
|
+
const safeRegexReplacements = [
|
|
50691
|
+
['\\s', 1],
|
|
50692
|
+
['\\d', MAX_LENGTH],
|
|
50693
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
|
50694
|
+
];
|
|
50695
|
+
|
|
50696
|
+
const makeSafeRegex = (value) => {
|
|
50697
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
50698
|
+
value = value
|
|
50699
|
+
.split(`${token}*`).join(`${token}{0,${max}}`)
|
|
50700
|
+
.split(`${token}+`).join(`${token}{1,${max}}`);
|
|
50701
|
+
}
|
|
50702
|
+
return value
|
|
50703
|
+
};
|
|
50704
|
+
|
|
50663
50705
|
const createToken = (name, value, isGlobal) => {
|
|
50706
|
+
const safe = makeSafeRegex(value);
|
|
50664
50707
|
const index = R++;
|
|
50665
50708
|
debug_1(name, index, value);
|
|
50666
50709
|
t[name] = index;
|
|
50667
50710
|
src[index] = value;
|
|
50668
50711
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
50712
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
|
50669
50713
|
};
|
|
50670
50714
|
|
|
50671
50715
|
// The following Regular Expressions can be used for tokenizing,
|
|
@@ -50675,13 +50719,13 @@ var Neurosity = (function (exports) {
|
|
|
50675
50719
|
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
50676
50720
|
|
|
50677
50721
|
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
|
50678
|
-
createToken('NUMERICIDENTIFIERLOOSE', '
|
|
50722
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
|
50679
50723
|
|
|
50680
50724
|
// ## Non-numeric Identifier
|
|
50681
50725
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
50682
50726
|
// more letters, digits, or hyphens.
|
|
50683
50727
|
|
|
50684
|
-
createToken('NONNUMERICIDENTIFIER',
|
|
50728
|
+
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
50685
50729
|
|
|
50686
50730
|
// ## Main Version
|
|
50687
50731
|
// Three dot-separated numeric identifiers.
|
|
@@ -50716,7 +50760,7 @@ var Neurosity = (function (exports) {
|
|
|
50716
50760
|
// ## Build Metadata Identifier
|
|
50717
50761
|
// Any combination of digits, letters, or hyphens.
|
|
50718
50762
|
|
|
50719
|
-
createToken('BUILDIDENTIFIER',
|
|
50763
|
+
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
|
|
50720
50764
|
|
|
50721
50765
|
// ## Build Metadata
|
|
50722
50766
|
// Plus sign, followed by one or more period-separated build metadata
|
|
@@ -50776,12 +50820,17 @@ var Neurosity = (function (exports) {
|
|
|
50776
50820
|
|
|
50777
50821
|
// Coercion.
|
|
50778
50822
|
// Extract anything that could conceivably be a part of a valid semver
|
|
50779
|
-
createToken('
|
|
50823
|
+
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
|
50780
50824
|
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
50781
50825
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
50782
|
-
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`
|
|
50826
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
50827
|
+
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
50828
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
|
50829
|
+
`(?:${src[t.PRERELEASE]})?` +
|
|
50830
|
+
`(?:${src[t.BUILD]})?` +
|
|
50783
50831
|
`(?:$|[^\\d])`);
|
|
50784
50832
|
createToken('COERCERTL', src[t.COERCE], true);
|
|
50833
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
|
50785
50834
|
|
|
50786
50835
|
// Tilde ranges.
|
|
50787
50836
|
// Meaning is "reasonably at or greater than"
|
|
@@ -50834,22 +50883,27 @@ var Neurosity = (function (exports) {
|
|
|
50834
50883
|
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
50835
50884
|
});
|
|
50836
50885
|
var re_2 = re_1.re;
|
|
50837
|
-
var re_3 = re_1.
|
|
50838
|
-
var re_4 = re_1.
|
|
50839
|
-
var re_5 = re_1.
|
|
50840
|
-
var re_6 = re_1.
|
|
50841
|
-
var re_7 = re_1.
|
|
50842
|
-
|
|
50843
|
-
|
|
50844
|
-
//
|
|
50845
|
-
const
|
|
50846
|
-
const
|
|
50847
|
-
|
|
50848
|
-
|
|
50849
|
-
|
|
50850
|
-
|
|
50851
|
-
|
|
50852
|
-
|
|
50886
|
+
var re_3 = re_1.safeRe;
|
|
50887
|
+
var re_4 = re_1.src;
|
|
50888
|
+
var re_5 = re_1.t;
|
|
50889
|
+
var re_6 = re_1.tildeTrimReplace;
|
|
50890
|
+
var re_7 = re_1.caretTrimReplace;
|
|
50891
|
+
var re_8 = re_1.comparatorTrimReplace;
|
|
50892
|
+
|
|
50893
|
+
// parse out just the options we care about
|
|
50894
|
+
const looseOption = Object.freeze({ loose: true });
|
|
50895
|
+
const emptyOpts = Object.freeze({ });
|
|
50896
|
+
const parseOptions = options => {
|
|
50897
|
+
if (!options) {
|
|
50898
|
+
return emptyOpts
|
|
50899
|
+
}
|
|
50900
|
+
|
|
50901
|
+
if (typeof options !== 'object') {
|
|
50902
|
+
return looseOption
|
|
50903
|
+
}
|
|
50904
|
+
|
|
50905
|
+
return options
|
|
50906
|
+
};
|
|
50853
50907
|
var parseOptions_1 = parseOptions;
|
|
50854
50908
|
|
|
50855
50909
|
const numeric = /^[0-9]+$/;
|
|
@@ -50877,7 +50931,7 @@ var Neurosity = (function (exports) {
|
|
|
50877
50931
|
};
|
|
50878
50932
|
|
|
50879
50933
|
const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants;
|
|
50880
|
-
const {
|
|
50934
|
+
const { safeRe: re$1, t: t$1 } = re_1;
|
|
50881
50935
|
|
|
50882
50936
|
|
|
50883
50937
|
const { compareIdentifiers: compareIdentifiers$1 } = identifiers;
|
|
@@ -50893,7 +50947,7 @@ var Neurosity = (function (exports) {
|
|
|
50893
50947
|
version = version.version;
|
|
50894
50948
|
}
|
|
50895
50949
|
} else if (typeof version !== 'string') {
|
|
50896
|
-
throw new TypeError(`Invalid
|
|
50950
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
|
|
50897
50951
|
}
|
|
50898
50952
|
|
|
50899
50953
|
if (version.length > MAX_LENGTH$1) {
|
|
@@ -51035,7 +51089,7 @@ var Neurosity = (function (exports) {
|
|
|
51035
51089
|
do {
|
|
51036
51090
|
const a = this.build[i];
|
|
51037
51091
|
const b = other.build[i];
|
|
51038
|
-
debug_1('
|
|
51092
|
+
debug_1('build compare', i, a, b);
|
|
51039
51093
|
if (a === undefined && b === undefined) {
|
|
51040
51094
|
return 0
|
|
51041
51095
|
} else if (b === undefined) {
|
|
@@ -51052,36 +51106,36 @@ var Neurosity = (function (exports) {
|
|
|
51052
51106
|
|
|
51053
51107
|
// preminor will bump the version up to the next minor release, and immediately
|
|
51054
51108
|
// down to pre-release. premajor and prepatch work the same way.
|
|
51055
|
-
inc (release, identifier) {
|
|
51109
|
+
inc (release, identifier, identifierBase) {
|
|
51056
51110
|
switch (release) {
|
|
51057
51111
|
case 'premajor':
|
|
51058
51112
|
this.prerelease.length = 0;
|
|
51059
51113
|
this.patch = 0;
|
|
51060
51114
|
this.minor = 0;
|
|
51061
51115
|
this.major++;
|
|
51062
|
-
this.inc('pre', identifier);
|
|
51116
|
+
this.inc('pre', identifier, identifierBase);
|
|
51063
51117
|
break
|
|
51064
51118
|
case 'preminor':
|
|
51065
51119
|
this.prerelease.length = 0;
|
|
51066
51120
|
this.patch = 0;
|
|
51067
51121
|
this.minor++;
|
|
51068
|
-
this.inc('pre', identifier);
|
|
51122
|
+
this.inc('pre', identifier, identifierBase);
|
|
51069
51123
|
break
|
|
51070
51124
|
case 'prepatch':
|
|
51071
51125
|
// If this is already a prerelease, it will bump to the next version
|
|
51072
51126
|
// drop any prereleases that might already exist, since they are not
|
|
51073
51127
|
// relevant at this point.
|
|
51074
51128
|
this.prerelease.length = 0;
|
|
51075
|
-
this.inc('patch', identifier);
|
|
51076
|
-
this.inc('pre', identifier);
|
|
51129
|
+
this.inc('patch', identifier, identifierBase);
|
|
51130
|
+
this.inc('pre', identifier, identifierBase);
|
|
51077
51131
|
break
|
|
51078
51132
|
// If the input is a non-prerelease version, this acts the same as
|
|
51079
51133
|
// prepatch.
|
|
51080
51134
|
case 'prerelease':
|
|
51081
51135
|
if (this.prerelease.length === 0) {
|
|
51082
|
-
this.inc('patch', identifier);
|
|
51136
|
+
this.inc('patch', identifier, identifierBase);
|
|
51083
51137
|
}
|
|
51084
|
-
this.inc('pre', identifier);
|
|
51138
|
+
this.inc('pre', identifier, identifierBase);
|
|
51085
51139
|
break
|
|
51086
51140
|
|
|
51087
51141
|
case 'major':
|
|
@@ -51123,9 +51177,15 @@ var Neurosity = (function (exports) {
|
|
|
51123
51177
|
break
|
|
51124
51178
|
// This probably shouldn't be used publicly.
|
|
51125
51179
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
51126
|
-
case 'pre':
|
|
51180
|
+
case 'pre': {
|
|
51181
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
51182
|
+
|
|
51183
|
+
if (!identifier && identifierBase === false) {
|
|
51184
|
+
throw new Error('invalid increment argument: identifier is empty')
|
|
51185
|
+
}
|
|
51186
|
+
|
|
51127
51187
|
if (this.prerelease.length === 0) {
|
|
51128
|
-
this.prerelease = [
|
|
51188
|
+
this.prerelease = [base];
|
|
51129
51189
|
} else {
|
|
51130
51190
|
let i = this.prerelease.length;
|
|
51131
51191
|
while (--i >= 0) {
|
|
@@ -51136,27 +51196,36 @@ var Neurosity = (function (exports) {
|
|
|
51136
51196
|
}
|
|
51137
51197
|
if (i === -1) {
|
|
51138
51198
|
// didn't increment anything
|
|
51139
|
-
this.prerelease.
|
|
51199
|
+
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
|
51200
|
+
throw new Error('invalid increment argument: identifier already exists')
|
|
51201
|
+
}
|
|
51202
|
+
this.prerelease.push(base);
|
|
51140
51203
|
}
|
|
51141
51204
|
}
|
|
51142
51205
|
if (identifier) {
|
|
51143
51206
|
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
51144
51207
|
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
51208
|
+
let prerelease = [identifier, base];
|
|
51209
|
+
if (identifierBase === false) {
|
|
51210
|
+
prerelease = [identifier];
|
|
51211
|
+
}
|
|
51145
51212
|
if (compareIdentifiers$1(this.prerelease[0], identifier) === 0) {
|
|
51146
51213
|
if (isNaN(this.prerelease[1])) {
|
|
51147
|
-
this.prerelease =
|
|
51214
|
+
this.prerelease = prerelease;
|
|
51148
51215
|
}
|
|
51149
51216
|
} else {
|
|
51150
|
-
this.prerelease =
|
|
51217
|
+
this.prerelease = prerelease;
|
|
51151
51218
|
}
|
|
51152
51219
|
}
|
|
51153
51220
|
break
|
|
51154
|
-
|
|
51221
|
+
}
|
|
51155
51222
|
default:
|
|
51156
51223
|
throw new Error(`invalid increment argument: ${release}`)
|
|
51157
51224
|
}
|
|
51158
|
-
this.format();
|
|
51159
|
-
this.
|
|
51225
|
+
this.raw = this.format();
|
|
51226
|
+
if (this.build.length) {
|
|
51227
|
+
this.raw += `+${this.build.join('.')}`;
|
|
51228
|
+
}
|
|
51160
51229
|
return this
|
|
51161
51230
|
}
|
|
51162
51231
|
}
|