centrifuge 5.3.2 → 5.3.3
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/README.md +5 -0
- package/build/index.js +1 -3
- package/build/index.mjs +1 -3
- package/build/protobuf/index.js +255 -280
- package/build/protobuf/index.mjs +255 -280
- package/dist/centrifuge.js +2 -2
- package/dist/centrifuge.js.map +2 -2
- package/dist/centrifuge.protobuf.js +2 -2
- package/dist/centrifuge.protobuf.js.map +2 -2
- package/package.json +1 -1
package/build/protobuf/index.js
CHANGED
|
@@ -1593,7 +1593,6 @@ class HttpStreamTransport {
|
|
|
1593
1593
|
body: body,
|
|
1594
1594
|
mode: 'cors',
|
|
1595
1595
|
credentials: 'same-origin',
|
|
1596
|
-
cache: 'no-cache'
|
|
1597
1596
|
};
|
|
1598
1597
|
fetchFunc(this.options.emulationEndpoint, fetchOptions);
|
|
1599
1598
|
}
|
|
@@ -1678,7 +1677,6 @@ class SseTransport {
|
|
|
1678
1677
|
body: body,
|
|
1679
1678
|
mode: 'cors',
|
|
1680
1679
|
credentials: 'same-origin',
|
|
1681
|
-
cache: 'no-cache'
|
|
1682
1680
|
};
|
|
1683
1681
|
fetchFunc(this.options.emulationEndpoint, fetchOptions);
|
|
1684
1682
|
}
|
|
@@ -2589,7 +2587,7 @@ class Centrifuge extends EventEmitter$2 {
|
|
|
2589
2587
|
websocket: websocket
|
|
2590
2588
|
});
|
|
2591
2589
|
if (!this._transport.supported()) {
|
|
2592
|
-
throw new Error('WebSocket not available');
|
|
2590
|
+
throw new Error('WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options');
|
|
2593
2591
|
}
|
|
2594
2592
|
}
|
|
2595
2593
|
}
|
|
@@ -3728,7 +3726,7 @@ var indexMinimal = {};
|
|
|
3728
3726
|
|
|
3729
3727
|
var minimal = {};
|
|
3730
3728
|
|
|
3731
|
-
var aspromise = asPromise;
|
|
3729
|
+
var aspromise = asPromise$1;
|
|
3732
3730
|
|
|
3733
3731
|
/**
|
|
3734
3732
|
* Callback as used by {@link util.asPromise}.
|
|
@@ -3747,7 +3745,7 @@ var aspromise = asPromise;
|
|
|
3747
3745
|
* @param {...*} params Function arguments
|
|
3748
3746
|
* @returns {Promise<*>} Promisified function
|
|
3749
3747
|
*/
|
|
3750
|
-
function asPromise(fn, ctx/*, varargs */) {
|
|
3748
|
+
function asPromise$1(fn, ctx/*, varargs */) {
|
|
3751
3749
|
var params = new Array(arguments.length - 1),
|
|
3752
3750
|
offset = 0,
|
|
3753
3751
|
index = 2,
|
|
@@ -4333,7 +4331,7 @@ function readUintBE(buf, pos) {
|
|
|
4333
4331
|
| buf[pos + 3]) >>> 0;
|
|
4334
4332
|
}
|
|
4335
4333
|
|
|
4336
|
-
var inquire_1 = inquire;
|
|
4334
|
+
var inquire_1 = inquire$1;
|
|
4337
4335
|
|
|
4338
4336
|
/**
|
|
4339
4337
|
* Requires a module only if available.
|
|
@@ -4341,7 +4339,7 @@ var inquire_1 = inquire;
|
|
|
4341
4339
|
* @param {string} moduleName Module to require
|
|
4342
4340
|
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
4343
4341
|
*/
|
|
4344
|
-
function inquire(moduleName) {
|
|
4342
|
+
function inquire$1(moduleName) {
|
|
4345
4343
|
try {
|
|
4346
4344
|
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
|
|
4347
4345
|
if (mod && (mod.length || Object.keys(mod).length))
|
|
@@ -6403,311 +6401,288 @@ var roots = {};
|
|
|
6403
6401
|
|
|
6404
6402
|
var util$1 = {exports: {}};
|
|
6405
6403
|
|
|
6406
|
-
var codegen_1;
|
|
6407
|
-
var hasRequiredCodegen;
|
|
6408
|
-
|
|
6409
|
-
function requireCodegen () {
|
|
6410
|
-
if (hasRequiredCodegen) return codegen_1;
|
|
6411
|
-
hasRequiredCodegen = 1;
|
|
6412
|
-
codegen_1 = codegen;
|
|
6404
|
+
var codegen_1 = codegen;
|
|
6413
6405
|
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6406
|
+
/**
|
|
6407
|
+
* Begins generating a function.
|
|
6408
|
+
* @memberof util
|
|
6409
|
+
* @param {string[]} functionParams Function parameter names
|
|
6410
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
6411
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
6412
|
+
*/
|
|
6413
|
+
function codegen(functionParams, functionName) {
|
|
6422
6414
|
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6415
|
+
/* istanbul ignore if */
|
|
6416
|
+
if (typeof functionParams === "string") {
|
|
6417
|
+
functionName = functionParams;
|
|
6418
|
+
functionParams = undefined;
|
|
6419
|
+
}
|
|
6428
6420
|
|
|
6429
|
-
|
|
6421
|
+
var body = [];
|
|
6430
6422
|
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6423
|
+
/**
|
|
6424
|
+
* Appends code to the function's body or finishes generation.
|
|
6425
|
+
* @typedef Codegen
|
|
6426
|
+
* @type {function}
|
|
6427
|
+
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
6428
|
+
* @param {...*} [formatParams] Format parameters
|
|
6429
|
+
* @returns {Codegen|Function} Itself or the generated function if finished
|
|
6430
|
+
* @throws {Error} If format parameter counts do not match
|
|
6431
|
+
*/
|
|
6440
6432
|
|
|
6441
|
-
|
|
6442
|
-
|
|
6433
|
+
function Codegen(formatStringOrScope) {
|
|
6434
|
+
// note that explicit array handling below makes this ~50% faster
|
|
6443
6435
|
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6436
|
+
// finish the function
|
|
6437
|
+
if (typeof formatStringOrScope !== "string") {
|
|
6438
|
+
var source = toString();
|
|
6439
|
+
if (codegen.verbose)
|
|
6440
|
+
console.log("codegen: " + source); // eslint-disable-line no-console
|
|
6441
|
+
source = "return " + source;
|
|
6442
|
+
if (formatStringOrScope) {
|
|
6443
|
+
var scopeKeys = Object.keys(formatStringOrScope),
|
|
6444
|
+
scopeParams = new Array(scopeKeys.length + 1),
|
|
6445
|
+
scopeValues = new Array(scopeKeys.length),
|
|
6446
|
+
scopeOffset = 0;
|
|
6447
|
+
while (scopeOffset < scopeKeys.length) {
|
|
6448
|
+
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
|
6449
|
+
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
|
6450
|
+
}
|
|
6451
|
+
scopeParams[scopeOffset] = source;
|
|
6452
|
+
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
|
6453
|
+
}
|
|
6454
|
+
return Function(source)(); // eslint-disable-line no-new-func
|
|
6455
|
+
}
|
|
6464
6456
|
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6457
|
+
// otherwise append to body
|
|
6458
|
+
var formatParams = new Array(arguments.length - 1),
|
|
6459
|
+
formatOffset = 0;
|
|
6460
|
+
while (formatOffset < formatParams.length)
|
|
6461
|
+
formatParams[formatOffset] = arguments[++formatOffset];
|
|
6462
|
+
formatOffset = 0;
|
|
6463
|
+
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
|
6464
|
+
var value = formatParams[formatOffset++];
|
|
6465
|
+
switch ($1) {
|
|
6466
|
+
case "d": case "f": return String(Number(value));
|
|
6467
|
+
case "i": return String(Math.floor(value));
|
|
6468
|
+
case "j": return JSON.stringify(value);
|
|
6469
|
+
case "s": return String(value);
|
|
6470
|
+
}
|
|
6471
|
+
return "%";
|
|
6472
|
+
});
|
|
6473
|
+
if (formatOffset !== formatParams.length)
|
|
6474
|
+
throw Error("parameter count mismatch");
|
|
6475
|
+
body.push(formatStringOrScope);
|
|
6476
|
+
return Codegen;
|
|
6477
|
+
}
|
|
6486
6478
|
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6479
|
+
function toString(functionNameOverride) {
|
|
6480
|
+
return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
|
6481
|
+
}
|
|
6490
6482
|
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6483
|
+
Codegen.toString = toString;
|
|
6484
|
+
return Codegen;
|
|
6485
|
+
}
|
|
6494
6486
|
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6487
|
+
/**
|
|
6488
|
+
* Begins generating a function.
|
|
6489
|
+
* @memberof util
|
|
6490
|
+
* @function codegen
|
|
6491
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
6492
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
6493
|
+
* @variation 2
|
|
6494
|
+
*/
|
|
6503
6495
|
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
return codegen_1;
|
|
6511
|
-
}
|
|
6512
|
-
|
|
6513
|
-
var fetch_1;
|
|
6514
|
-
var hasRequiredFetch;
|
|
6496
|
+
/**
|
|
6497
|
+
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
|
6498
|
+
* @name util.codegen.verbose
|
|
6499
|
+
* @type {boolean}
|
|
6500
|
+
*/
|
|
6501
|
+
codegen.verbose = false;
|
|
6515
6502
|
|
|
6516
|
-
|
|
6517
|
-
if (hasRequiredFetch) return fetch_1;
|
|
6518
|
-
hasRequiredFetch = 1;
|
|
6519
|
-
fetch_1 = fetch;
|
|
6503
|
+
var fetch_1 = fetch;
|
|
6520
6504
|
|
|
6521
|
-
|
|
6522
|
-
|
|
6505
|
+
var asPromise = aspromise,
|
|
6506
|
+
inquire = inquire_1;
|
|
6523
6507
|
|
|
6524
|
-
|
|
6508
|
+
var fs = inquire("fs");
|
|
6525
6509
|
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6510
|
+
/**
|
|
6511
|
+
* Node-style callback as used by {@link util.fetch}.
|
|
6512
|
+
* @typedef FetchCallback
|
|
6513
|
+
* @type {function}
|
|
6514
|
+
* @param {?Error} error Error, if any, otherwise `null`
|
|
6515
|
+
* @param {string} [contents] File contents, if there hasn't been an error
|
|
6516
|
+
* @returns {undefined}
|
|
6517
|
+
*/
|
|
6534
6518
|
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6519
|
+
/**
|
|
6520
|
+
* Options as used by {@link util.fetch}.
|
|
6521
|
+
* @typedef FetchOptions
|
|
6522
|
+
* @type {Object}
|
|
6523
|
+
* @property {boolean} [binary=false] Whether expecting a binary response
|
|
6524
|
+
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
|
6525
|
+
*/
|
|
6542
6526
|
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6527
|
+
/**
|
|
6528
|
+
* Fetches the contents of a file.
|
|
6529
|
+
* @memberof util
|
|
6530
|
+
* @param {string} filename File path or url
|
|
6531
|
+
* @param {FetchOptions} options Fetch options
|
|
6532
|
+
* @param {FetchCallback} callback Callback function
|
|
6533
|
+
* @returns {undefined}
|
|
6534
|
+
*/
|
|
6535
|
+
function fetch(filename, options, callback) {
|
|
6536
|
+
if (typeof options === "function") {
|
|
6537
|
+
callback = options;
|
|
6538
|
+
options = {};
|
|
6539
|
+
} else if (!options)
|
|
6540
|
+
options = {};
|
|
6557
6541
|
|
|
6558
|
-
|
|
6559
|
-
|
|
6542
|
+
if (!callback)
|
|
6543
|
+
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
|
|
6560
6544
|
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6545
|
+
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
|
6546
|
+
if (!options.xhr && fs && fs.readFile)
|
|
6547
|
+
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
6548
|
+
return err && typeof XMLHttpRequest !== "undefined"
|
|
6549
|
+
? fetch.xhr(filename, options, callback)
|
|
6550
|
+
: err
|
|
6551
|
+
? callback(err)
|
|
6552
|
+
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
6553
|
+
});
|
|
6570
6554
|
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6555
|
+
// use the XHR version otherwise.
|
|
6556
|
+
return fetch.xhr(filename, options, callback);
|
|
6557
|
+
}
|
|
6574
6558
|
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6559
|
+
/**
|
|
6560
|
+
* Fetches the contents of a file.
|
|
6561
|
+
* @name util.fetch
|
|
6562
|
+
* @function
|
|
6563
|
+
* @param {string} path File path or url
|
|
6564
|
+
* @param {FetchCallback} callback Callback function
|
|
6565
|
+
* @returns {undefined}
|
|
6566
|
+
* @variation 2
|
|
6567
|
+
*/
|
|
6584
6568
|
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6569
|
+
/**
|
|
6570
|
+
* Fetches the contents of a file.
|
|
6571
|
+
* @name util.fetch
|
|
6572
|
+
* @function
|
|
6573
|
+
* @param {string} path File path or url
|
|
6574
|
+
* @param {FetchOptions} [options] Fetch options
|
|
6575
|
+
* @returns {Promise<string|Uint8Array>} Promise
|
|
6576
|
+
* @variation 3
|
|
6577
|
+
*/
|
|
6594
6578
|
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6579
|
+
/**/
|
|
6580
|
+
fetch.xhr = function fetch_xhr(filename, options, callback) {
|
|
6581
|
+
var xhr = new XMLHttpRequest();
|
|
6582
|
+
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
|
6599
6583
|
|
|
6600
|
-
|
|
6601
|
-
|
|
6584
|
+
if (xhr.readyState !== 4)
|
|
6585
|
+
return undefined;
|
|
6602
6586
|
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6587
|
+
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
|
6588
|
+
// reliably distinguished from an actually empty file for security reasons. feel free
|
|
6589
|
+
// to send a pull request if you are aware of a solution.
|
|
6590
|
+
if (xhr.status !== 0 && xhr.status !== 200)
|
|
6591
|
+
return callback(Error("status " + xhr.status));
|
|
6608
6592
|
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6593
|
+
// if binary data is expected, make sure that some sort of array is returned, even if
|
|
6594
|
+
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
|
6595
|
+
if (options.binary) {
|
|
6596
|
+
var buffer = xhr.response;
|
|
6597
|
+
if (!buffer) {
|
|
6598
|
+
buffer = [];
|
|
6599
|
+
for (var i = 0; i < xhr.responseText.length; ++i)
|
|
6600
|
+
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
|
6601
|
+
}
|
|
6602
|
+
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
|
6603
|
+
}
|
|
6604
|
+
return callback(null, xhr.responseText);
|
|
6605
|
+
};
|
|
6622
6606
|
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6607
|
+
if (options.binary) {
|
|
6608
|
+
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
|
6609
|
+
if ("overrideMimeType" in xhr)
|
|
6610
|
+
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
|
6611
|
+
xhr.responseType = "arraybuffer";
|
|
6612
|
+
}
|
|
6629
6613
|
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
return fetch_1;
|
|
6634
|
-
}
|
|
6614
|
+
xhr.open("GET", filename);
|
|
6615
|
+
xhr.send();
|
|
6616
|
+
};
|
|
6635
6617
|
|
|
6636
6618
|
var path = {};
|
|
6637
6619
|
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
function requirePath () {
|
|
6641
|
-
if (hasRequiredPath) return path;
|
|
6642
|
-
hasRequiredPath = 1;
|
|
6643
|
-
(function (exports) {
|
|
6620
|
+
(function (exports) {
|
|
6644
6621
|
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6622
|
+
/**
|
|
6623
|
+
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
6624
|
+
* @memberof util
|
|
6625
|
+
* @namespace
|
|
6626
|
+
*/
|
|
6627
|
+
var path = exports;
|
|
6651
6628
|
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6629
|
+
var isAbsolute =
|
|
6630
|
+
/**
|
|
6631
|
+
* Tests if the specified path is absolute.
|
|
6632
|
+
* @param {string} path Path to test
|
|
6633
|
+
* @returns {boolean} `true` if path is absolute
|
|
6634
|
+
*/
|
|
6635
|
+
path.isAbsolute = function isAbsolute(path) {
|
|
6636
|
+
return /^(?:\/|\w+:)/.test(path);
|
|
6637
|
+
};
|
|
6661
6638
|
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6639
|
+
var normalize =
|
|
6640
|
+
/**
|
|
6641
|
+
* Normalizes the specified path.
|
|
6642
|
+
* @param {string} path Path to normalize
|
|
6643
|
+
* @returns {string} Normalized path
|
|
6644
|
+
*/
|
|
6645
|
+
path.normalize = function normalize(path) {
|
|
6646
|
+
path = path.replace(/\\/g, "/")
|
|
6647
|
+
.replace(/\/{2,}/g, "/");
|
|
6648
|
+
var parts = path.split("/"),
|
|
6649
|
+
absolute = isAbsolute(path),
|
|
6650
|
+
prefix = "";
|
|
6651
|
+
if (absolute)
|
|
6652
|
+
prefix = parts.shift() + "/";
|
|
6653
|
+
for (var i = 0; i < parts.length;) {
|
|
6654
|
+
if (parts[i] === "..") {
|
|
6655
|
+
if (i > 0 && parts[i - 1] !== "..")
|
|
6656
|
+
parts.splice(--i, 2);
|
|
6657
|
+
else if (absolute)
|
|
6658
|
+
parts.splice(i, 1);
|
|
6659
|
+
else
|
|
6660
|
+
++i;
|
|
6661
|
+
} else if (parts[i] === ".")
|
|
6662
|
+
parts.splice(i, 1);
|
|
6663
|
+
else
|
|
6664
|
+
++i;
|
|
6665
|
+
}
|
|
6666
|
+
return prefix + parts.join("/");
|
|
6667
|
+
};
|
|
6691
6668
|
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
return path;
|
|
6710
|
-
}
|
|
6669
|
+
/**
|
|
6670
|
+
* Resolves the specified include path against the specified origin path.
|
|
6671
|
+
* @param {string} originPath Path to the origin file
|
|
6672
|
+
* @param {string} includePath Include path relative to origin path
|
|
6673
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
6674
|
+
* @returns {string} Path to the include file
|
|
6675
|
+
*/
|
|
6676
|
+
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
6677
|
+
if (!alreadyNormalized)
|
|
6678
|
+
includePath = normalize(includePath);
|
|
6679
|
+
if (isAbsolute(includePath))
|
|
6680
|
+
return includePath;
|
|
6681
|
+
if (!alreadyNormalized)
|
|
6682
|
+
originPath = normalize(originPath);
|
|
6683
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
6684
|
+
};
|
|
6685
|
+
} (path));
|
|
6711
6686
|
|
|
6712
6687
|
var types = {};
|
|
6713
6688
|
|
|
@@ -10297,9 +10272,9 @@ function requireUtil () {
|
|
|
10297
10272
|
var Type, // cyclic
|
|
10298
10273
|
Enum;
|
|
10299
10274
|
|
|
10300
|
-
util.codegen =
|
|
10301
|
-
util.fetch =
|
|
10302
|
-
util.path =
|
|
10275
|
+
util.codegen = codegen_1;
|
|
10276
|
+
util.fetch = fetch_1;
|
|
10277
|
+
util.path = path;
|
|
10303
10278
|
|
|
10304
10279
|
/**
|
|
10305
10280
|
* Node's fs module if available.
|