@jsenv/core 38.4.8 → 38.4.10
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/babel_helpers/asyncIterator/asyncIterator.js +4 -1
- package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +1 -1
- package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +1 -1
- package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +1 -1
- package/dist/babel_helpers/setFunctionName/setFunctionName.js +1 -0
- package/dist/babel_helpers/writeOnlyError/writeOnlyError.js +2 -3
- package/dist/js/ws.js +44 -59
- package/dist/jsenv_core.js +82 -251
- package/package.json +26 -22
- package/src/kitchen/fetched_content_compliance.js +2 -2
|
@@ -44,7 +44,10 @@ function AsyncFromSyncIterator(s) {
|
|
|
44
44
|
},
|
|
45
45
|
throw: function (value) {
|
|
46
46
|
var thr = this.s.return;
|
|
47
|
-
if (thr === undefined)
|
|
47
|
+
if (thr === undefined) {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
49
|
+
return Promise.reject(maybeError);
|
|
50
|
+
}
|
|
48
51
|
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
|
|
49
52
|
},
|
|
50
53
|
};
|
|
@@ -11,7 +11,7 @@ export default function _isNativeReflectConstruct() {
|
|
|
11
11
|
var result = !Boolean.prototype.valueOf.call(
|
|
12
12
|
Reflect.construct(Boolean, [], function () {}),
|
|
13
13
|
);
|
|
14
|
-
} catch (
|
|
14
|
+
} catch (_) {}
|
|
15
15
|
// @ts-expect-error assign to function
|
|
16
16
|
return (_isNativeReflectConstruct = function () {
|
|
17
17
|
return !!result;
|
|
@@ -10,7 +10,7 @@ export default (source, excluded) => {
|
|
|
10
10
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
11
11
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
12
12
|
key = sourceSymbolKeys[i];
|
|
13
|
-
if (excluded.
|
|
13
|
+
if (excluded.includes(key)) continue;
|
|
14
14
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
15
15
|
target[key] = source[key];
|
|
16
16
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// https://tc39.es/ecma262/#sec-setfunctionname
|
|
4
4
|
export default function setFunctionName(fn, name, prefix) {
|
|
5
5
|
if (typeof name === "symbol") {
|
|
6
|
+
// Here `undefined` is possible, we check for it in the next line.
|
|
6
7
|
name = name.description;
|
|
7
8
|
name = name ? "[" + name + "]" : "";
|
|
8
9
|
}
|
package/dist/js/ws.js
CHANGED
|
@@ -876,13 +876,6 @@ const { concat, toArrayBuffer, unmask } = bufferUtilExports;
|
|
|
876
876
|
const { isValidStatusCode: isValidStatusCode$1, isValidUTF8 } = validationExports;
|
|
877
877
|
|
|
878
878
|
const FastBuffer = Buffer[Symbol.species];
|
|
879
|
-
const promise = Promise.resolve();
|
|
880
|
-
|
|
881
|
-
//
|
|
882
|
-
// `queueMicrotask()` is not available in Node.js < 11.
|
|
883
|
-
//
|
|
884
|
-
const queueTask =
|
|
885
|
-
typeof queueMicrotask === 'function' ? queueMicrotask : queueMicrotaskShim;
|
|
886
879
|
|
|
887
880
|
const GET_INFO = 0;
|
|
888
881
|
const GET_PAYLOAD_LENGTH_16 = 1;
|
|
@@ -902,7 +895,7 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
902
895
|
* Creates a Receiver instance.
|
|
903
896
|
*
|
|
904
897
|
* @param {Object} [options] Options object
|
|
905
|
-
* @param {Boolean} [options.allowSynchronousEvents=
|
|
898
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
906
899
|
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
907
900
|
* multiple times in the same tick
|
|
908
901
|
* @param {String} [options.binaryType=nodebuffer] The type for binary data
|
|
@@ -917,7 +910,10 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
917
910
|
constructor(options = {}) {
|
|
918
911
|
super();
|
|
919
912
|
|
|
920
|
-
this._allowSynchronousEvents =
|
|
913
|
+
this._allowSynchronousEvents =
|
|
914
|
+
options.allowSynchronousEvents !== undefined
|
|
915
|
+
? options.allowSynchronousEvents
|
|
916
|
+
: true;
|
|
921
917
|
this._binaryType = options.binaryType || BINARY_TYPES$1[0];
|
|
922
918
|
this._extensions = options.extensions || {};
|
|
923
919
|
this._isServer = !!options.isServer;
|
|
@@ -1430,17 +1426,12 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1430
1426
|
data = fragments;
|
|
1431
1427
|
}
|
|
1432
1428
|
|
|
1433
|
-
|
|
1434
|
-
// If the state is `INFLATING`, it means that the frame data was
|
|
1435
|
-
// decompressed asynchronously, so there is no need to defer the event
|
|
1436
|
-
// as it will be emitted asynchronously anyway.
|
|
1437
|
-
//
|
|
1438
|
-
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
1429
|
+
if (this._allowSynchronousEvents) {
|
|
1439
1430
|
this.emit('message', data, true);
|
|
1440
1431
|
this._state = GET_INFO;
|
|
1441
1432
|
} else {
|
|
1442
1433
|
this._state = DEFER_EVENT;
|
|
1443
|
-
|
|
1434
|
+
setImmediate(() => {
|
|
1444
1435
|
this.emit('message', data, true);
|
|
1445
1436
|
this._state = GET_INFO;
|
|
1446
1437
|
this.startLoop(cb);
|
|
@@ -1467,7 +1458,7 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1467
1458
|
this._state = GET_INFO;
|
|
1468
1459
|
} else {
|
|
1469
1460
|
this._state = DEFER_EVENT;
|
|
1470
|
-
|
|
1461
|
+
setImmediate(() => {
|
|
1471
1462
|
this.emit('message', buf, false);
|
|
1472
1463
|
this._state = GET_INFO;
|
|
1473
1464
|
this.startLoop(cb);
|
|
@@ -1538,7 +1529,7 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1538
1529
|
this._state = GET_INFO;
|
|
1539
1530
|
} else {
|
|
1540
1531
|
this._state = DEFER_EVENT;
|
|
1541
|
-
|
|
1532
|
+
setImmediate(() => {
|
|
1542
1533
|
this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
|
|
1543
1534
|
this._state = GET_INFO;
|
|
1544
1535
|
this.startLoop(cb);
|
|
@@ -1575,35 +1566,6 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1575
1566
|
|
|
1576
1567
|
var receiver = Receiver$1;
|
|
1577
1568
|
|
|
1578
|
-
/**
|
|
1579
|
-
* A shim for `queueMicrotask()`.
|
|
1580
|
-
*
|
|
1581
|
-
* @param {Function} cb Callback
|
|
1582
|
-
*/
|
|
1583
|
-
function queueMicrotaskShim(cb) {
|
|
1584
|
-
promise.then(cb).catch(throwErrorNextTick);
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
/**
|
|
1588
|
-
* Throws an error.
|
|
1589
|
-
*
|
|
1590
|
-
* @param {Error} err The error to throw
|
|
1591
|
-
* @private
|
|
1592
|
-
*/
|
|
1593
|
-
function throwError(err) {
|
|
1594
|
-
throw err;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
/**
|
|
1598
|
-
* Throws an error in the next tick.
|
|
1599
|
-
*
|
|
1600
|
-
* @param {Error} err The error to throw
|
|
1601
|
-
* @private
|
|
1602
|
-
*/
|
|
1603
|
-
function throwErrorNextTick(err) {
|
|
1604
|
-
process.nextTick(throwError, err);
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
1569
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
|
|
1608
1570
|
const { randomFillSync } = require$$1;
|
|
1609
1571
|
|
|
@@ -1614,6 +1576,9 @@ const { mask: applyMask, toBuffer: toBuffer$1 } = bufferUtilExports;
|
|
|
1614
1576
|
|
|
1615
1577
|
const kByteLength = Symbol('kByteLength');
|
|
1616
1578
|
const maskBuffer = Buffer.alloc(4);
|
|
1579
|
+
const RANDOM_POOL_SIZE = 8 * 1024;
|
|
1580
|
+
let randomPool;
|
|
1581
|
+
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
1617
1582
|
|
|
1618
1583
|
/**
|
|
1619
1584
|
* HyBi Sender implementation.
|
|
@@ -1678,7 +1643,24 @@ let Sender$1 = class Sender {
|
|
|
1678
1643
|
if (options.generateMask) {
|
|
1679
1644
|
options.generateMask(mask);
|
|
1680
1645
|
} else {
|
|
1681
|
-
|
|
1646
|
+
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
1647
|
+
/* istanbul ignore else */
|
|
1648
|
+
if (randomPool === undefined) {
|
|
1649
|
+
//
|
|
1650
|
+
// This is lazily initialized because server-sent frames must not
|
|
1651
|
+
// be masked so it may never be used.
|
|
1652
|
+
//
|
|
1653
|
+
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
1657
|
+
randomPoolPointer = 0;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
mask[0] = randomPool[randomPoolPointer++];
|
|
1661
|
+
mask[1] = randomPool[randomPoolPointer++];
|
|
1662
|
+
mask[2] = randomPool[randomPoolPointer++];
|
|
1663
|
+
mask[3] = randomPool[randomPoolPointer++];
|
|
1682
1664
|
}
|
|
1683
1665
|
|
|
1684
1666
|
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
@@ -2571,7 +2553,7 @@ function format$1(extensions) {
|
|
|
2571
2553
|
|
|
2572
2554
|
var extension$1 = { format: format$1, parse: parse$2 };
|
|
2573
2555
|
|
|
2574
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$" }] */
|
|
2556
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */
|
|
2575
2557
|
|
|
2576
2558
|
const EventEmitter$1 = require$$0$3;
|
|
2577
2559
|
const https = require$$1$1;
|
|
@@ -3193,7 +3175,7 @@ var websocket = WebSocket$1;
|
|
|
3193
3175
|
* @param {(String|URL)} address The URL to which to connect
|
|
3194
3176
|
* @param {Array} protocols The subprotocols
|
|
3195
3177
|
* @param {Object} [options] Connection options
|
|
3196
|
-
* @param {Boolean} [options.allowSynchronousEvents=
|
|
3178
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any
|
|
3197
3179
|
* of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple
|
|
3198
3180
|
* times in the same tick
|
|
3199
3181
|
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
@@ -3222,7 +3204,7 @@ var websocket = WebSocket$1;
|
|
|
3222
3204
|
*/
|
|
3223
3205
|
function initAsClient(websocket, address, protocols, options) {
|
|
3224
3206
|
const opts = {
|
|
3225
|
-
allowSynchronousEvents:
|
|
3207
|
+
allowSynchronousEvents: true,
|
|
3226
3208
|
autoPong: true,
|
|
3227
3209
|
protocolVersion: protocolVersions[1],
|
|
3228
3210
|
maxPayload: 100 * 1024 * 1024,
|
|
@@ -3231,7 +3213,6 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3231
3213
|
followRedirects: false,
|
|
3232
3214
|
maxRedirects: 10,
|
|
3233
3215
|
...options,
|
|
3234
|
-
createConnection: undefined,
|
|
3235
3216
|
socketPath: undefined,
|
|
3236
3217
|
hostname: undefined,
|
|
3237
3218
|
protocol: undefined,
|
|
@@ -3302,7 +3283,8 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3302
3283
|
const protocolSet = new Set();
|
|
3303
3284
|
let perMessageDeflate;
|
|
3304
3285
|
|
|
3305
|
-
opts.createConnection =
|
|
3286
|
+
opts.createConnection =
|
|
3287
|
+
opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
3306
3288
|
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
3307
3289
|
opts.port = parsedUrl.port || defaultPort;
|
|
3308
3290
|
opts.host = parsedUrl.hostname.startsWith('[')
|
|
@@ -3498,7 +3480,9 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3498
3480
|
|
|
3499
3481
|
req = websocket._req = null;
|
|
3500
3482
|
|
|
3501
|
-
|
|
3483
|
+
const upgrade = res.headers.upgrade;
|
|
3484
|
+
|
|
3485
|
+
if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
|
|
3502
3486
|
abortHandshake$1(websocket, socket, 'Invalid Upgrade header');
|
|
3503
3487
|
return;
|
|
3504
3488
|
}
|
|
@@ -3966,7 +3950,7 @@ function parse(header) {
|
|
|
3966
3950
|
|
|
3967
3951
|
var subprotocol$1 = { parse };
|
|
3968
3952
|
|
|
3969
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$" }] */
|
|
3953
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
|
|
3970
3954
|
|
|
3971
3955
|
const EventEmitter = require$$0$3;
|
|
3972
3956
|
const http = require$$2;
|
|
@@ -3994,7 +3978,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
3994
3978
|
* Create a `WebSocketServer` instance.
|
|
3995
3979
|
*
|
|
3996
3980
|
* @param {Object} options Configuration options
|
|
3997
|
-
* @param {Boolean} [options.allowSynchronousEvents=
|
|
3981
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
3998
3982
|
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
3999
3983
|
* multiple times in the same tick
|
|
4000
3984
|
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
@@ -4025,7 +4009,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
4025
4009
|
super();
|
|
4026
4010
|
|
|
4027
4011
|
options = {
|
|
4028
|
-
allowSynchronousEvents:
|
|
4012
|
+
allowSynchronousEvents: true,
|
|
4029
4013
|
autoPong: true,
|
|
4030
4014
|
maxPayload: 100 * 1024 * 1024,
|
|
4031
4015
|
skipUTF8Validation: false,
|
|
@@ -4200,6 +4184,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
4200
4184
|
socket.on('error', socketOnError);
|
|
4201
4185
|
|
|
4202
4186
|
const key = req.headers['sec-websocket-key'];
|
|
4187
|
+
const upgrade = req.headers.upgrade;
|
|
4203
4188
|
const version = +req.headers['sec-websocket-version'];
|
|
4204
4189
|
|
|
4205
4190
|
if (req.method !== 'GET') {
|
|
@@ -4208,13 +4193,13 @@ class WebSocketServer extends EventEmitter {
|
|
|
4208
4193
|
return;
|
|
4209
4194
|
}
|
|
4210
4195
|
|
|
4211
|
-
if (
|
|
4196
|
+
if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
|
|
4212
4197
|
const message = 'Invalid Upgrade header';
|
|
4213
4198
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
4214
4199
|
return;
|
|
4215
4200
|
}
|
|
4216
4201
|
|
|
4217
|
-
if (
|
|
4202
|
+
if (key === undefined || !keyRegex.test(key)) {
|
|
4218
4203
|
const message = 'Missing or invalid Sec-WebSocket-Key header';
|
|
4219
4204
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
4220
4205
|
return;
|
package/dist/jsenv_core.js
CHANGED
|
@@ -110,7 +110,7 @@ const applyMatching = (pattern, string) => {
|
|
|
110
110
|
}
|
|
111
111
|
// pattern consumed, string not consumed
|
|
112
112
|
if (remainingPattern === "" && remainingString !== "") {
|
|
113
|
-
return false; // fails because string longer than
|
|
113
|
+
return false; // fails because string longer than expect
|
|
114
114
|
}
|
|
115
115
|
// -- from this point pattern is not consumed --
|
|
116
116
|
// string consumed, pattern not consumed
|
|
@@ -123,7 +123,7 @@ const applyMatching = (pattern, string) => {
|
|
|
123
123
|
if (remainingPattern === "*") {
|
|
124
124
|
groups.push({ string: "" });
|
|
125
125
|
}
|
|
126
|
-
return false; // fail because string shorter than
|
|
126
|
+
return false; // fail because string shorter than expect
|
|
127
127
|
}
|
|
128
128
|
// -- from this point pattern and string are not consumed --
|
|
129
129
|
// fast path trailing slash
|
|
@@ -185,7 +185,7 @@ const applyMatching = (pattern, string) => {
|
|
|
185
185
|
groups.push({ string: consumeString(slashIndex) });
|
|
186
186
|
return false;
|
|
187
187
|
}
|
|
188
|
-
// the next char must not the one
|
|
188
|
+
// the next char must not the one expect by remainingPattern[0]
|
|
189
189
|
// because * is greedy and expect to skip at least one char
|
|
190
190
|
if (remainingPattern[0] === remainingString[0]) {
|
|
191
191
|
groups.push({ string: "" });
|
|
@@ -676,170 +676,86 @@ const error = (...args) => console.error(...args);
|
|
|
676
676
|
|
|
677
677
|
const errorDisabled = () => {};
|
|
678
678
|
|
|
679
|
-
|
|
680
|
-
const OSC = '\u001B]';
|
|
681
|
-
const BEL = '\u0007';
|
|
682
|
-
const SEP = ';';
|
|
679
|
+
/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
|
|
683
680
|
|
|
684
|
-
|
|
685
|
-
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
681
|
+
const isBrowser = globalThis.window?.document !== undefined;
|
|
686
682
|
|
|
687
|
-
|
|
688
|
-
const isWindows$3 = !isBrowser && process$1.platform === 'win32';
|
|
689
|
-
const cwdFunction = isBrowser ? () => {
|
|
690
|
-
throw new Error('`process.cwd()` only works in Node.js, not the browser.');
|
|
691
|
-
} : process$1.cwd;
|
|
683
|
+
globalThis.process?.versions?.node !== undefined;
|
|
692
684
|
|
|
693
|
-
|
|
685
|
+
globalThis.process?.versions?.bun !== undefined;
|
|
694
686
|
|
|
695
|
-
|
|
696
|
-
if (typeof x !== 'number') {
|
|
697
|
-
throw new TypeError('The `x` argument is required');
|
|
698
|
-
}
|
|
687
|
+
globalThis.Deno?.version?.deno !== undefined;
|
|
699
688
|
|
|
700
|
-
|
|
701
|
-
return ESC + (x + 1) + 'G';
|
|
702
|
-
}
|
|
689
|
+
globalThis.process?.versions?.electron !== undefined;
|
|
703
690
|
|
|
704
|
-
|
|
705
|
-
};
|
|
691
|
+
globalThis.navigator?.userAgent?.includes('jsdom') === true;
|
|
706
692
|
|
|
707
|
-
|
|
708
|
-
if (typeof x !== 'number') {
|
|
709
|
-
throw new TypeError('The `x` argument is required');
|
|
710
|
-
}
|
|
693
|
+
typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;
|
|
711
694
|
|
|
712
|
-
|
|
695
|
+
typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
713
696
|
|
|
714
|
-
|
|
715
|
-
returnValue += ESC + (-x) + 'D';
|
|
716
|
-
} else if (x > 0) {
|
|
717
|
-
returnValue += ESC + x + 'C';
|
|
718
|
-
}
|
|
697
|
+
typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;
|
|
719
698
|
|
|
720
|
-
|
|
721
|
-
returnValue += ESC + (-y) + 'A';
|
|
722
|
-
} else if (y > 0) {
|
|
723
|
-
returnValue += ESC + y + 'B';
|
|
724
|
-
}
|
|
699
|
+
typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;
|
|
725
700
|
|
|
726
|
-
|
|
727
|
-
|
|
701
|
+
// Note: I'm intentionally not DRYing up the other variables to keep them "lazy".
|
|
702
|
+
const platform = globalThis.navigator?.userAgentData?.platform;
|
|
703
|
+
|
|
704
|
+
platform === 'macOS'
|
|
705
|
+
|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.
|
|
706
|
+
|| globalThis.navigator?.userAgent?.includes(' Mac ') === true
|
|
707
|
+
|| globalThis.process?.platform === 'darwin';
|
|
708
|
+
|
|
709
|
+
platform === 'Windows'
|
|
710
|
+
|| globalThis.navigator?.platform === 'Win32'
|
|
711
|
+
|| globalThis.process?.platform === 'win32';
|
|
712
|
+
|
|
713
|
+
platform === 'Linux'
|
|
714
|
+
|| globalThis.navigator?.platform?.startsWith('Linux') === true
|
|
715
|
+
|| globalThis.navigator?.userAgent?.includes(' Linux ') === true
|
|
716
|
+
|| globalThis.process?.platform === 'linux';
|
|
717
|
+
|
|
718
|
+
platform === 'Android'
|
|
719
|
+
|| globalThis.navigator?.platform === 'Android'
|
|
720
|
+
|| globalThis.navigator?.userAgent?.includes(' Android ') === true
|
|
721
|
+
|| globalThis.process?.platform === 'android';
|
|
722
|
+
|
|
723
|
+
const ESC = '\u001B[';
|
|
724
|
+
|
|
725
|
+
!isBrowser && process$1.env.TERM_PROGRAM === 'Apple_Terminal';
|
|
726
|
+
const isWindows$3 = !isBrowser && process$1.platform === 'win32';
|
|
728
727
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
|
|
728
|
+
isBrowser ? () => {
|
|
729
|
+
throw new Error('`process.cwd()` only works in Node.js, not the browser.');
|
|
730
|
+
} : process$1.cwd;
|
|
733
731
|
|
|
734
|
-
|
|
735
|
-
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
|
|
736
|
-
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
|
|
737
|
-
ansiEscapes.cursorGetPosition = ESC + '6n';
|
|
738
|
-
ansiEscapes.cursorNextLine = ESC + 'E';
|
|
739
|
-
ansiEscapes.cursorPrevLine = ESC + 'F';
|
|
740
|
-
ansiEscapes.cursorHide = ESC + '?25l';
|
|
741
|
-
ansiEscapes.cursorShow = ESC + '?25h';
|
|
732
|
+
const cursorUp = (count = 1) => ESC + count + 'A';
|
|
742
733
|
|
|
743
|
-
|
|
734
|
+
const cursorLeft = ESC + 'G';
|
|
735
|
+
|
|
736
|
+
const eraseLines = count => {
|
|
744
737
|
let clear = '';
|
|
745
738
|
|
|
746
739
|
for (let i = 0; i < count; i++) {
|
|
747
|
-
clear +=
|
|
740
|
+
clear += eraseLine + (i < count - 1 ? cursorUp() : '');
|
|
748
741
|
}
|
|
749
742
|
|
|
750
743
|
if (count) {
|
|
751
|
-
clear +=
|
|
744
|
+
clear += cursorLeft;
|
|
752
745
|
}
|
|
753
746
|
|
|
754
747
|
return clear;
|
|
755
748
|
};
|
|
749
|
+
const eraseLine = ESC + '2K';
|
|
750
|
+
const eraseScreen = ESC + '2J';
|
|
756
751
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
ansiEscapes.eraseLine = ESC + '2K';
|
|
760
|
-
ansiEscapes.eraseDown = ESC + 'J';
|
|
761
|
-
ansiEscapes.eraseUp = ESC + '1J';
|
|
762
|
-
ansiEscapes.eraseScreen = ESC + '2J';
|
|
763
|
-
ansiEscapes.scrollUp = ESC + 'S';
|
|
764
|
-
ansiEscapes.scrollDown = ESC + 'T';
|
|
765
|
-
|
|
766
|
-
ansiEscapes.clearScreen = '\u001Bc';
|
|
767
|
-
|
|
768
|
-
ansiEscapes.clearTerminal = isWindows$3
|
|
769
|
-
? `${ansiEscapes.eraseScreen}${ESC}0f`
|
|
752
|
+
const clearTerminal = isWindows$3
|
|
753
|
+
? `${eraseScreen}${ESC}0f`
|
|
770
754
|
// 1. Erases the screen (Only done in case `2` is not supported)
|
|
771
755
|
// 2. Erases the whole screen including scrollback buffer
|
|
772
756
|
// 3. Moves cursor to the top-left position
|
|
773
757
|
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
774
|
-
:
|
|
775
|
-
|
|
776
|
-
ansiEscapes.enterAlternativeScreen = ESC + '?1049h';
|
|
777
|
-
ansiEscapes.exitAlternativeScreen = ESC + '?1049l';
|
|
778
|
-
|
|
779
|
-
ansiEscapes.beep = BEL;
|
|
780
|
-
|
|
781
|
-
ansiEscapes.link = (text, url) => [
|
|
782
|
-
OSC,
|
|
783
|
-
'8',
|
|
784
|
-
SEP,
|
|
785
|
-
SEP,
|
|
786
|
-
url,
|
|
787
|
-
BEL,
|
|
788
|
-
text,
|
|
789
|
-
OSC,
|
|
790
|
-
'8',
|
|
791
|
-
SEP,
|
|
792
|
-
SEP,
|
|
793
|
-
BEL,
|
|
794
|
-
].join('');
|
|
795
|
-
|
|
796
|
-
ansiEscapes.image = (buffer, options = {}) => {
|
|
797
|
-
let returnValue = `${OSC}1337;File=inline=1`;
|
|
798
|
-
|
|
799
|
-
if (options.width) {
|
|
800
|
-
returnValue += `;width=${options.width}`;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if (options.height) {
|
|
804
|
-
returnValue += `;height=${options.height}`;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
if (options.preserveAspectRatio === false) {
|
|
808
|
-
returnValue += ';preserveAspectRatio=0';
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return returnValue + ':' + buffer.toString('base64') + BEL;
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
ansiEscapes.iTerm = {
|
|
815
|
-
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
816
|
-
|
|
817
|
-
annotation(message, options = {}) {
|
|
818
|
-
let returnValue = `${OSC}1337;`;
|
|
819
|
-
|
|
820
|
-
const hasX = typeof options.x !== 'undefined';
|
|
821
|
-
const hasY = typeof options.y !== 'undefined';
|
|
822
|
-
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
|
|
823
|
-
throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
message = message.replace(/\|/g, '');
|
|
827
|
-
|
|
828
|
-
returnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
|
|
829
|
-
|
|
830
|
-
if (options.length > 0) {
|
|
831
|
-
returnValue += (
|
|
832
|
-
hasX
|
|
833
|
-
? [message, options.length, options.x, options.y]
|
|
834
|
-
: [options.length, message]
|
|
835
|
-
).join('|');
|
|
836
|
-
} else {
|
|
837
|
-
returnValue += message;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
return returnValue + BEL;
|
|
841
|
-
},
|
|
842
|
-
};
|
|
758
|
+
: `${eraseScreen}${ESC}3J${ESC}H`;
|
|
843
759
|
|
|
844
760
|
/*
|
|
845
761
|
* see also https://github.com/vadimdemedes/ink
|
|
@@ -887,7 +803,7 @@ const createDynamicLog = ({
|
|
|
887
803
|
if (visualLineCount > rows) {
|
|
888
804
|
if (clearTerminalAllowed) {
|
|
889
805
|
clearAttemptResult = true;
|
|
890
|
-
return
|
|
806
|
+
return clearTerminal;
|
|
891
807
|
}
|
|
892
808
|
// the whole log cannot be cleared because it's vertically to long
|
|
893
809
|
// (longer than terminal height)
|
|
@@ -900,7 +816,7 @@ const createDynamicLog = ({
|
|
|
900
816
|
}
|
|
901
817
|
|
|
902
818
|
clearAttemptResult = true;
|
|
903
|
-
return
|
|
819
|
+
return eraseLines(visualLineCount);
|
|
904
820
|
};
|
|
905
821
|
|
|
906
822
|
const update = (string) => {
|
|
@@ -929,20 +845,22 @@ const createDynamicLog = ({
|
|
|
929
845
|
clearAttemptResult = undefined;
|
|
930
846
|
};
|
|
931
847
|
|
|
932
|
-
const clearDuringFunctionCall = (
|
|
848
|
+
const clearDuringFunctionCall = (
|
|
849
|
+
callback,
|
|
850
|
+
ouputAfterCallback = lastOutput,
|
|
851
|
+
) => {
|
|
933
852
|
// 1. Erase the current log
|
|
934
|
-
// 2. Call callback (
|
|
853
|
+
// 2. Call callback (expect to write something on stdout)
|
|
935
854
|
// 3. Restore the current log
|
|
936
855
|
// During step 2. we expect a "write from outside" so we uninstall
|
|
937
856
|
// the stream spy during function call
|
|
938
|
-
const currentOutput = lastOutput;
|
|
939
857
|
update("");
|
|
940
858
|
|
|
941
859
|
writing = true;
|
|
942
860
|
callback();
|
|
943
861
|
writing = false;
|
|
944
862
|
|
|
945
|
-
update(
|
|
863
|
+
update(ouputAfterCallback);
|
|
946
864
|
};
|
|
947
865
|
|
|
948
866
|
const writeFromOutsideEffect = (value) => {
|
|
@@ -1215,14 +1133,19 @@ const ANSI = {
|
|
|
1215
1133
|
YELLOW: "\x1b[33m",
|
|
1216
1134
|
BLUE: "\x1b[34m",
|
|
1217
1135
|
MAGENTA: "\x1b[35m",
|
|
1136
|
+
CYAN: "\x1b[36m",
|
|
1218
1137
|
GREY: "\x1b[90m",
|
|
1219
1138
|
color: (text, ANSI_COLOR) => {
|
|
1220
|
-
return ANSI.supported ? `${ANSI_COLOR}${text}${RESET}` : text;
|
|
1139
|
+
return ANSI.supported && ANSI_COLOR ? `${ANSI_COLOR}${text}${RESET}` : text;
|
|
1221
1140
|
},
|
|
1222
1141
|
|
|
1223
1142
|
BOLD: "\x1b[1m",
|
|
1143
|
+
UNDERLINE: "\x1b[4m",
|
|
1144
|
+
STRIKE: "\x1b[9m",
|
|
1224
1145
|
effect: (text, ANSI_EFFECT) => {
|
|
1225
|
-
return ANSI.supported
|
|
1146
|
+
return ANSI.supported && ANSI_EFFECT
|
|
1147
|
+
? `${ANSI_EFFECT}${text}${RESET}`
|
|
1148
|
+
: text;
|
|
1226
1149
|
},
|
|
1227
1150
|
};
|
|
1228
1151
|
|
|
@@ -1567,6 +1490,9 @@ const UNICODE = {
|
|
|
1567
1490
|
get CIRCLE_CROSS() {
|
|
1568
1491
|
return ANSI.color(UNICODE.CIRCLE_CROSS_RAW, ANSI.RED);
|
|
1569
1492
|
},
|
|
1493
|
+
get ELLIPSIS() {
|
|
1494
|
+
return UNICODE.supported ? `…` : `...`;
|
|
1495
|
+
},
|
|
1570
1496
|
};
|
|
1571
1497
|
|
|
1572
1498
|
const createTaskLog = (
|
|
@@ -2521,7 +2447,7 @@ const ensureWindowsDriveLetter = (url, baseUrl) => {
|
|
|
2521
2447
|
try {
|
|
2522
2448
|
url = String(new URL(url));
|
|
2523
2449
|
} catch (e) {
|
|
2524
|
-
throw new Error(`absolute url
|
|
2450
|
+
throw new Error(`absolute url expect but got ${url}`);
|
|
2525
2451
|
}
|
|
2526
2452
|
|
|
2527
2453
|
if (!isWindows$2) {
|
|
@@ -2532,7 +2458,7 @@ const ensureWindowsDriveLetter = (url, baseUrl) => {
|
|
|
2532
2458
|
baseUrl = String(new URL(baseUrl));
|
|
2533
2459
|
} catch (e) {
|
|
2534
2460
|
throw new Error(
|
|
2535
|
-
`absolute baseUrl
|
|
2461
|
+
`absolute baseUrl expect but got ${baseUrl} to ensure windows drive letter on ${url}`,
|
|
2536
2462
|
);
|
|
2537
2463
|
}
|
|
2538
2464
|
|
|
@@ -2554,7 +2480,7 @@ const ensureWindowsDriveLetter = (url, baseUrl) => {
|
|
|
2554
2480
|
);
|
|
2555
2481
|
if (!driveLetter) {
|
|
2556
2482
|
throw new Error(
|
|
2557
|
-
`drive letter
|
|
2483
|
+
`drive letter expect on baseUrl but got ${baseUrl} to ensure windows drive letter on ${url}`,
|
|
2558
2484
|
);
|
|
2559
2485
|
}
|
|
2560
2486
|
return `file:///${driveLetter}:${afterProtocol}`;
|
|
@@ -2754,7 +2680,7 @@ const createOperation = () => {
|
|
|
2754
2680
|
const operationSignal = operationAbortController.signal;
|
|
2755
2681
|
|
|
2756
2682
|
// abortCallbackList is used to ignore the max listeners warning from Node.js
|
|
2757
|
-
// this warning is useful but becomes problematic when it's
|
|
2683
|
+
// this warning is useful but becomes problematic when it's expect
|
|
2758
2684
|
// (a function doing 20 http call in parallel)
|
|
2759
2685
|
// To be 100% sure we don't have memory leak, only Abortable.asyncCallback
|
|
2760
2686
|
// uses abortCallbackList to know when something is aborted
|
|
@@ -3114,67 +3040,11 @@ const readDirectory = async (url, { emfileMaxWait = 1000 } = {}) => {
|
|
|
3114
3040
|
return attempt();
|
|
3115
3041
|
};
|
|
3116
3042
|
|
|
3117
|
-
// https://github.com/coderaiser/cloudcmd/issues/63#issuecomment-195478143
|
|
3118
|
-
// https://nodejs.org/api/fs.html#fs_file_modes
|
|
3119
|
-
// https://github.com/TooTallNate/stat-mode
|
|
3120
|
-
|
|
3121
|
-
// cannot get from fs.constants because they are not available on windows
|
|
3122
|
-
const S_IRUSR = 256; /* 0000400 read permission, owner */
|
|
3123
|
-
const S_IWUSR = 128; /* 0000200 write permission, owner */
|
|
3124
|
-
const S_IXUSR = 64; /* 0000100 execute/search permission, owner */
|
|
3125
|
-
const S_IRGRP = 32; /* 0000040 read permission, group */
|
|
3126
|
-
const S_IWGRP = 16; /* 0000020 write permission, group */
|
|
3127
|
-
const S_IXGRP = 8; /* 0000010 execute/search permission, group */
|
|
3128
|
-
const S_IROTH = 4; /* 0000004 read permission, others */
|
|
3129
|
-
const S_IWOTH = 2; /* 0000002 write permission, others */
|
|
3130
|
-
const S_IXOTH = 1; /* 0000001 execute/search permission, others */
|
|
3131
|
-
|
|
3132
|
-
const permissionsToBinaryFlags = ({ owner, group, others }) => {
|
|
3133
|
-
let binaryFlags = 0;
|
|
3134
|
-
|
|
3135
|
-
if (owner.read) binaryFlags |= S_IRUSR;
|
|
3136
|
-
if (owner.write) binaryFlags |= S_IWUSR;
|
|
3137
|
-
if (owner.execute) binaryFlags |= S_IXUSR;
|
|
3138
|
-
|
|
3139
|
-
if (group.read) binaryFlags |= S_IRGRP;
|
|
3140
|
-
if (group.write) binaryFlags |= S_IWGRP;
|
|
3141
|
-
if (group.execute) binaryFlags |= S_IXGRP;
|
|
3142
|
-
|
|
3143
|
-
if (others.read) binaryFlags |= S_IROTH;
|
|
3144
|
-
if (others.write) binaryFlags |= S_IWOTH;
|
|
3145
|
-
if (others.execute) binaryFlags |= S_IXOTH;
|
|
3146
|
-
|
|
3147
|
-
return binaryFlags;
|
|
3148
|
-
};
|
|
3149
|
-
|
|
3150
3043
|
const writeEntryPermissions = async (source, permissions) => {
|
|
3151
3044
|
const sourceUrl = assertAndNormalizeFileUrl(source);
|
|
3152
3045
|
|
|
3153
3046
|
let binaryFlags;
|
|
3154
|
-
|
|
3155
|
-
permissions = {
|
|
3156
|
-
owner: {
|
|
3157
|
-
read: getPermissionOrComputeDefault("read", "owner", permissions),
|
|
3158
|
-
write: getPermissionOrComputeDefault("write", "owner", permissions),
|
|
3159
|
-
execute: getPermissionOrComputeDefault("execute", "owner", permissions),
|
|
3160
|
-
},
|
|
3161
|
-
group: {
|
|
3162
|
-
read: getPermissionOrComputeDefault("read", "group", permissions),
|
|
3163
|
-
write: getPermissionOrComputeDefault("write", "group", permissions),
|
|
3164
|
-
execute: getPermissionOrComputeDefault("execute", "group", permissions),
|
|
3165
|
-
},
|
|
3166
|
-
others: {
|
|
3167
|
-
read: getPermissionOrComputeDefault("read", "others", permissions),
|
|
3168
|
-
write: getPermissionOrComputeDefault("write", "others", permissions),
|
|
3169
|
-
execute: getPermissionOrComputeDefault(
|
|
3170
|
-
"execute",
|
|
3171
|
-
"others",
|
|
3172
|
-
permissions,
|
|
3173
|
-
),
|
|
3174
|
-
},
|
|
3175
|
-
};
|
|
3176
|
-
binaryFlags = permissionsToBinaryFlags(permissions);
|
|
3177
|
-
} else {
|
|
3047
|
+
{
|
|
3178
3048
|
binaryFlags = permissions;
|
|
3179
3049
|
}
|
|
3180
3050
|
|
|
@@ -3189,45 +3059,6 @@ const writeEntryPermissions = async (source, permissions) => {
|
|
|
3189
3059
|
});
|
|
3190
3060
|
};
|
|
3191
3061
|
|
|
3192
|
-
const actionLevels = { read: 0, write: 1, execute: 2 };
|
|
3193
|
-
const subjectLevels = { others: 0, group: 1, owner: 2 };
|
|
3194
|
-
|
|
3195
|
-
const getPermissionOrComputeDefault = (action, subject, permissions) => {
|
|
3196
|
-
if (subject in permissions) {
|
|
3197
|
-
const subjectPermissions = permissions[subject];
|
|
3198
|
-
if (action in subjectPermissions) {
|
|
3199
|
-
return subjectPermissions[action];
|
|
3200
|
-
}
|
|
3201
|
-
|
|
3202
|
-
const actionLevel = actionLevels[action];
|
|
3203
|
-
const actionFallback = Object.keys(actionLevels).find(
|
|
3204
|
-
(actionFallbackCandidate) =>
|
|
3205
|
-
actionLevels[actionFallbackCandidate] > actionLevel &&
|
|
3206
|
-
actionFallbackCandidate in subjectPermissions,
|
|
3207
|
-
);
|
|
3208
|
-
if (actionFallback) {
|
|
3209
|
-
return subjectPermissions[actionFallback];
|
|
3210
|
-
}
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
const subjectLevel = subjectLevels[subject];
|
|
3214
|
-
// do we have a subject with a stronger level (group or owner)
|
|
3215
|
-
// where we could read the action permission ?
|
|
3216
|
-
const subjectFallback = Object.keys(subjectLevels).find(
|
|
3217
|
-
(subjectFallbackCandidate) =>
|
|
3218
|
-
subjectLevels[subjectFallbackCandidate] > subjectLevel &&
|
|
3219
|
-
subjectFallbackCandidate in permissions,
|
|
3220
|
-
);
|
|
3221
|
-
if (subjectFallback) {
|
|
3222
|
-
const subjectPermissions = permissions[subjectFallback];
|
|
3223
|
-
return action in subjectPermissions
|
|
3224
|
-
? subjectPermissions[action]
|
|
3225
|
-
: getPermissionOrComputeDefault(action, subjectFallback, permissions);
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
return false;
|
|
3229
|
-
};
|
|
3230
|
-
|
|
3231
3062
|
/*
|
|
3232
3063
|
* - stats object documentation on Node.js
|
|
3233
3064
|
* https://nodejs.org/docs/latest-v13.x/api/fs.html#fs_class_fs_stats
|
|
@@ -3952,7 +3783,7 @@ const registerDirectoryLifecycle = (
|
|
|
3952
3783
|
notifyExistent = false,
|
|
3953
3784
|
keepProcessAlive = true,
|
|
3954
3785
|
recursive = false,
|
|
3955
|
-
// filesystem might dispatch more events than
|
|
3786
|
+
// filesystem might dispatch more events than expect
|
|
3956
3787
|
// Code can use "cooldownBetweenFileEvents" to prevent that
|
|
3957
3788
|
// BUT it is UNADVISED to rely on this as explained later (search for "is lying" in this file)
|
|
3958
3789
|
// For this reason"cooldownBetweenFileEvents" should be reserved to scenarios
|
|
@@ -4320,7 +4151,7 @@ const ETAG_FOR_EMPTY_CONTENT$1 = '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
|
4320
4151
|
|
|
4321
4152
|
const bufferToEtag$1 = (buffer) => {
|
|
4322
4153
|
if (!Buffer.isBuffer(buffer)) {
|
|
4323
|
-
throw new TypeError(`buffer
|
|
4154
|
+
throw new TypeError(`buffer expect,got ${buffer}`);
|
|
4324
4155
|
}
|
|
4325
4156
|
|
|
4326
4157
|
if (buffer.length === 0) {
|
|
@@ -7290,7 +7121,7 @@ const ETAG_FOR_EMPTY_CONTENT = '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
|
7290
7121
|
|
|
7291
7122
|
const bufferToEtag = (buffer) => {
|
|
7292
7123
|
if (!Buffer.isBuffer(buffer)) {
|
|
7293
|
-
throw new TypeError(`buffer
|
|
7124
|
+
throw new TypeError(`buffer expect,got ${buffer}`);
|
|
7294
7125
|
}
|
|
7295
7126
|
|
|
7296
7127
|
if (buffer.length === 0) {
|
|
@@ -14120,13 +13951,13 @@ const assertFetchedContentCompliance = ({ urlInfo, content }) => {
|
|
|
14120
13951
|
const { expectedContentType } = urlInfo.firstReference;
|
|
14121
13952
|
if (expectedContentType && urlInfo.contentType !== expectedContentType) {
|
|
14122
13953
|
throw new Error(
|
|
14123
|
-
`Unexpected content-type on url: "${expectedContentType}" was
|
|
13954
|
+
`Unexpected content-type on url: "${expectedContentType}" was expect but got "${urlInfo.contentType}`,
|
|
14124
13955
|
);
|
|
14125
13956
|
}
|
|
14126
13957
|
const { expectedType } = urlInfo.firstReference;
|
|
14127
13958
|
if (expectedType && urlInfo.type !== expectedType) {
|
|
14128
13959
|
throw new Error(
|
|
14129
|
-
`Unexpected type on url: "${expectedType}" was
|
|
13960
|
+
`Unexpected type on url: "${expectedType}" was expect but got "${urlInfo.type}"`,
|
|
14130
13961
|
);
|
|
14131
13962
|
}
|
|
14132
13963
|
const { integrity } = urlInfo.firstReference;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "38.4.
|
|
3
|
+
"version": "38.4.10",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"/dist/",
|
|
35
35
|
"/src/"
|
|
36
36
|
],
|
|
37
|
+
"volta": {
|
|
38
|
+
"node": "22.3.0"
|
|
39
|
+
},
|
|
37
40
|
"workspaces": [
|
|
38
41
|
"./packages/independent/*",
|
|
39
42
|
"./packages/internal/*",
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"scripts": {
|
|
44
47
|
"eslint": "npx eslint . --ext=.js,.mjs,.cjs,.html",
|
|
45
48
|
"dev": "node --conditions=development ./scripts/dev/dev.mjs",
|
|
46
|
-
"test": "node --conditions=development ./scripts/test/test.mjs",
|
|
49
|
+
"test": "node --trace-deprecation --conditions=development ./scripts/test/test.mjs",
|
|
47
50
|
"test:workspace": "npm run test --workspaces --if-present -- --workspace",
|
|
48
51
|
"test:snapshots_clear": "npx @jsenv/snapshot clear **/tests/**/snapshots/",
|
|
49
52
|
"test:only_dev_server_errors": "node --conditions=development ./tests/dev_server/errors/dev_errors_snapshots.test.mjs",
|
|
@@ -62,27 +65,28 @@
|
|
|
62
65
|
"dependencies": {
|
|
63
66
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
64
67
|
"@jsenv/abort": "4.3.0",
|
|
65
|
-
"@jsenv/ast": "6.0.
|
|
66
|
-
"@jsenv/filesystem": "4.6.
|
|
68
|
+
"@jsenv/ast": "6.0.4",
|
|
69
|
+
"@jsenv/filesystem": "4.6.6",
|
|
70
|
+
"@jsenv/humanize": "1.1.0",
|
|
67
71
|
"@jsenv/importmap": "1.2.1",
|
|
68
72
|
"@jsenv/integrity": "0.0.1",
|
|
69
|
-
"@jsenv/js-module-fallback": "1.3.
|
|
70
|
-
"@jsenv/humanize": "1.0.0",
|
|
73
|
+
"@jsenv/js-module-fallback": "1.3.13",
|
|
71
74
|
"@jsenv/node-esm-resolution": "1.0.2",
|
|
72
|
-
"@jsenv/plugin-bundling": "2.6.
|
|
75
|
+
"@jsenv/plugin-bundling": "2.6.7",
|
|
73
76
|
"@jsenv/plugin-minification": "1.5.4",
|
|
74
|
-
"@jsenv/plugin-supervisor": "1.4.
|
|
75
|
-
"@jsenv/plugin-transpilation": "1.3.
|
|
76
|
-
"@jsenv/runtime-compat": "1.
|
|
77
|
-
"@jsenv/server": "15.2.
|
|
78
|
-
"@jsenv/sourcemap": "1.2.
|
|
77
|
+
"@jsenv/plugin-supervisor": "1.4.4",
|
|
78
|
+
"@jsenv/plugin-transpilation": "1.3.13",
|
|
79
|
+
"@jsenv/runtime-compat": "1.3.0",
|
|
80
|
+
"@jsenv/server": "15.2.3",
|
|
81
|
+
"@jsenv/sourcemap": "1.2.7",
|
|
79
82
|
"@jsenv/url-meta": "8.4.0",
|
|
80
|
-
"@jsenv/urls": "2.2.
|
|
83
|
+
"@jsenv/urls": "2.2.4",
|
|
81
84
|
"@jsenv/utils": "2.1.1"
|
|
82
85
|
},
|
|
83
86
|
"devDependencies": {
|
|
84
|
-
"@babel/eslint-parser": "7.
|
|
85
|
-
"@babel/plugin-syntax-import-assertions": "7.
|
|
87
|
+
"@babel/eslint-parser": "7.24.7",
|
|
88
|
+
"@babel/plugin-syntax-import-assertions": "7.24.7",
|
|
89
|
+
"@babel/plugin-syntax-optional-chaining-assign": "7.24.7",
|
|
86
90
|
"@jsenv/assert": "./packages/independent/assert/",
|
|
87
91
|
"@jsenv/core": "./",
|
|
88
92
|
"@jsenv/eslint-config": "./packages/independent/eslint-config/",
|
|
@@ -93,16 +97,16 @@
|
|
|
93
97
|
"@jsenv/plugin-as-js-classic": "./packages/related/plugin-as-js-classic/",
|
|
94
98
|
"@jsenv/snapshot": "./packages/independent/snapshot/",
|
|
95
99
|
"@jsenv/test": "./packages/related/test/",
|
|
100
|
+
"@playwright/browser-chromium": "1.45.0",
|
|
101
|
+
"@playwright/browser-firefox": "1.45.0",
|
|
102
|
+
"@playwright/browser-webkit": "1.45.0",
|
|
96
103
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
97
104
|
"eslint": "8.56.0",
|
|
98
105
|
"eslint-plugin-html": "7.1.0",
|
|
99
106
|
"eslint-plugin-import": "2.29.1",
|
|
100
|
-
"eslint-plugin-react": "7.
|
|
101
|
-
"open": "10.0
|
|
102
|
-
"playwright": "1.
|
|
103
|
-
"
|
|
104
|
-
"@playwright/browser-firefox": "1.40.1",
|
|
105
|
-
"@playwright/browser-webkit": "1.40.1",
|
|
106
|
-
"prettier": "3.2.2"
|
|
107
|
+
"eslint-plugin-react": "7.34.3",
|
|
108
|
+
"open": "10.1.0",
|
|
109
|
+
"playwright": "1.45.0",
|
|
110
|
+
"prettier": "3.3.2"
|
|
107
111
|
}
|
|
108
112
|
}
|
|
@@ -4,13 +4,13 @@ export const assertFetchedContentCompliance = ({ urlInfo, content }) => {
|
|
|
4
4
|
const { expectedContentType } = urlInfo.firstReference;
|
|
5
5
|
if (expectedContentType && urlInfo.contentType !== expectedContentType) {
|
|
6
6
|
throw new Error(
|
|
7
|
-
`Unexpected content-type on url: "${expectedContentType}" was
|
|
7
|
+
`Unexpected content-type on url: "${expectedContentType}" was expect but got "${urlInfo.contentType}`,
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
const { expectedType } = urlInfo.firstReference;
|
|
11
11
|
if (expectedType && urlInfo.type !== expectedType) {
|
|
12
12
|
throw new Error(
|
|
13
|
-
`Unexpected type on url: "${expectedType}" was
|
|
13
|
+
`Unexpected type on url: "${expectedType}" was expect but got "${urlInfo.type}"`,
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
const { integrity } = urlInfo.firstReference;
|