@jsenv/core 35.0.0 → 35.0.1

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 CHANGED
@@ -4,7 +4,7 @@ Jsenv was created to provide a tool that can be used both for the web and Node.j
4
4
  It has naturally evolved to cover the core needs of a JavaScript project: developement, testing and building for production.
5
5
 
6
6
  - :ok_hand: Seamless integration with standard HTML, CSS and JS.
7
- - :sparkles: Same tooling for dev, tests and build.
7
+ - :sparkles: Same developer experience on source files and test files.
8
8
  - :exploding_head: Can execute tests on Chrome, Firefox, Safari and Node.js.
9
9
 
10
10
  [Documentation](<https://github.com/jsenv/core/wiki/A)-Getting-started>)
@@ -30,10 +30,3 @@ One of the circle is web browsers, the other is Node.js.
30
30
  It represents the two JavaScript runtimes supported by jsenv.
31
31
 
32
32
  ![jsenv logo with legend](./docs/jsenv_logo_legend.png)
33
-
34
- # See also
35
-
36
- | Link | Description |
37
- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
38
- | [@jsenv/assert](./packages/assert) | NPM package to write assertions |
39
- | [I am too lazy for a test framework](https://dev.to/dmail/i-am-too-lazy-for-a-test-framework-92f) | Article presenting a straightforward testing experience |
package/dist/js/ws.js CHANGED
@@ -12,147 +12,6 @@ import require$$7 from "url";
12
12
  function getDefaultExportFromCjs(x) {
13
13
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
14
  }
15
- const {
16
- Duplex
17
- } = require$$0;
18
-
19
- /**
20
- * Emits the `'close'` event on a stream.
21
- *
22
- * @param {Duplex} stream The stream.
23
- * @private
24
- */
25
- function emitClose$1(stream) {
26
- stream.emit('close');
27
- }
28
-
29
- /**
30
- * The listener of the `'end'` event.
31
- *
32
- * @private
33
- */
34
- function duplexOnEnd() {
35
- if (!this.destroyed && this._writableState.finished) {
36
- this.destroy();
37
- }
38
- }
39
-
40
- /**
41
- * The listener of the `'error'` event.
42
- *
43
- * @param {Error} err The error
44
- * @private
45
- */
46
- function duplexOnError(err) {
47
- this.removeListener('error', duplexOnError);
48
- this.destroy();
49
- if (this.listenerCount('error') === 0) {
50
- // Do not suppress the throwing behavior.
51
- this.emit('error', err);
52
- }
53
- }
54
-
55
- /**
56
- * Wraps a `WebSocket` in a duplex stream.
57
- *
58
- * @param {WebSocket} ws The `WebSocket` to wrap
59
- * @param {Object} [options] The options for the `Duplex` constructor
60
- * @return {Duplex} The duplex stream
61
- * @public
62
- */
63
- function createWebSocketStream(ws, options) {
64
- let terminateOnDestroy = true;
65
- const duplex = new Duplex({
66
- ...options,
67
- autoDestroy: false,
68
- emitClose: false,
69
- objectMode: false,
70
- writableObjectMode: false
71
- });
72
- ws.on('message', function message(msg, isBinary) {
73
- const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
74
- if (!duplex.push(data)) ws.pause();
75
- });
76
- ws.once('error', function error(err) {
77
- if (duplex.destroyed) return;
78
-
79
- // Prevent `ws.terminate()` from being called by `duplex._destroy()`.
80
- //
81
- // - If the `'error'` event is emitted before the `'open'` event, then
82
- // `ws.terminate()` is a noop as no socket is assigned.
83
- // - Otherwise, the error is re-emitted by the listener of the `'error'`
84
- // event of the `Receiver` object. The listener already closes the
85
- // connection by calling `ws.close()`. This allows a close frame to be
86
- // sent to the other peer. If `ws.terminate()` is called right after this,
87
- // then the close frame might not be sent.
88
- terminateOnDestroy = false;
89
- duplex.destroy(err);
90
- });
91
- ws.once('close', function close() {
92
- if (duplex.destroyed) return;
93
- duplex.push(null);
94
- });
95
- duplex._destroy = function (err, callback) {
96
- if (ws.readyState === ws.CLOSED) {
97
- callback(err);
98
- process.nextTick(emitClose$1, duplex);
99
- return;
100
- }
101
- let called = false;
102
- ws.once('error', function error(err) {
103
- called = true;
104
- callback(err);
105
- });
106
- ws.once('close', function close() {
107
- if (!called) callback(err);
108
- process.nextTick(emitClose$1, duplex);
109
- });
110
- if (terminateOnDestroy) ws.terminate();
111
- };
112
- duplex._final = function (callback) {
113
- if (ws.readyState === ws.CONNECTING) {
114
- ws.once('open', function open() {
115
- duplex._final(callback);
116
- });
117
- return;
118
- }
119
-
120
- // If the value of the `_socket` property is `null` it means that `ws` is a
121
- // client websocket and the handshake failed. In fact, when this happens, a
122
- // socket is never assigned to the websocket. Wait for the `'error'` event
123
- // that will be emitted by the websocket.
124
- if (ws._socket === null) return;
125
- if (ws._socket._writableState.finished) {
126
- callback();
127
- if (duplex._readableState.endEmitted) duplex.destroy();
128
- } else {
129
- ws._socket.once('finish', function finish() {
130
- // `duplex` is not destroyed here because the `'end'` event will be
131
- // emitted on `duplex` after this `'finish'` event. The EOF signaling
132
- // `null` chunk is, in fact, pushed when the websocket emits `'close'`.
133
- callback();
134
- });
135
- ws.close();
136
- }
137
- };
138
- duplex._read = function () {
139
- if (ws.isPaused) ws.resume();
140
- };
141
- duplex._write = function (chunk, encoding, callback) {
142
- if (ws.readyState === ws.CONNECTING) {
143
- ws.once('open', function open() {
144
- duplex._write(chunk, encoding, callback);
145
- });
146
- return;
147
- }
148
- ws.send(chunk, callback);
149
- };
150
- duplex.on('end', duplexOnEnd);
151
- duplex.on('error', duplexOnError);
152
- return duplex;
153
- }
154
- var stream = createWebSocketStream;
155
- var stream$1 = /*@__PURE__*/getDefaultExportFromCjs(stream);
156
15
  var bufferUtil$1 = {
157
16
  exports: {}
158
17
  };
@@ -1303,7 +1162,6 @@ function error(ErrorCtor, message, prefix, statusCode, errorCode) {
1303
1162
  err[kStatusCode$1] = statusCode;
1304
1163
  return err;
1305
1164
  }
1306
- var receiver$1 = /*@__PURE__*/getDefaultExportFromCjs(receiver);
1307
1165
 
1308
1166
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^net|tls$" }] */
1309
1167
  const {
@@ -1720,7 +1578,6 @@ let Sender$1 = class Sender {
1720
1578
  }
1721
1579
  };
1722
1580
  var sender = Sender$1;
1723
- var sender$1 = /*@__PURE__*/getDefaultExportFromCjs(sender);
1724
1581
  const {
1725
1582
  kForOnEventAttribute: kForOnEventAttribute$1,
1726
1583
  kListener: kListener$1
@@ -3312,7 +3169,6 @@ function socketOnError$1() {
3312
3169
  this.destroy();
3313
3170
  }
3314
3171
  }
3315
- var WebSocket$2 = /*@__PURE__*/getDefaultExportFromCjs(websocket);
3316
3172
  const {
3317
3173
  tokenChars
3318
3174
  } = validationExports;
@@ -3800,4 +3656,4 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
3800
3656
  }
3801
3657
  var websocketServer$1 = /*@__PURE__*/getDefaultExportFromCjs(websocketServer);
3802
3658
 
3803
- export { receiver$1 as Receiver, sender$1 as Sender, WebSocket$2 as WebSocket, websocketServer$1 as WebSocketServer, stream$1 as createWebSocketStream, WebSocket$2 as default };
3659
+ export { websocketServer$1 as WebSocketServer };
@@ -3359,6 +3359,8 @@ ansiEscapes.clearTerminal = isWindows ? `${ansiEscapes.eraseScreen}${ESC}0f`
3359
3359
  // 3. Moves cursor to the top-left position
3360
3360
  // More info: https://www.real-world-systems.com/docs/ANSIcode.html
3361
3361
  : `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
3362
+ ansiEscapes.enterAlternativeScreen = ESC + '?1049h';
3363
+ ansiEscapes.exitAlternativeScreen = ESC + '?1049l';
3362
3364
  ansiEscapes.beep = BEL;
3363
3365
  ansiEscapes.link = (text, url) => [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
3364
3366
  ansiEscapes.image = (buffer, options = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "35.0.0",
3
+ "version": "35.0.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -76,7 +76,7 @@
76
76
  "@jsenv/utils": "2.0.1",
77
77
  "construct-style-sheets-polyfill": "3.1.0",
78
78
  "launch-editor": "2.6.0",
79
- "lightningcss": "1.19.0"
79
+ "lightningcss": "1.20.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@babel/eslint-parser": "7.21.3",
@@ -92,11 +92,11 @@
92
92
  "@jsenv/plugin-placeholders": "./packages/jsenv-plugin-placeholders/",
93
93
  "@jsenv/plugin-as-js-classic": "./packages/jsenv-plugin-as-js-classic/",
94
94
  "@jsenv/test": "./packages/test/",
95
- "eslint": "8.38.0",
95
+ "eslint": "8.39.0",
96
96
  "eslint-plugin-html": "7.1.0",
97
97
  "eslint-plugin-import": "2.27.5",
98
98
  "eslint-plugin-react": "7.32.2",
99
99
  "playwright": "1.32.3",
100
- "prettier": "2.8.7"
100
+ "prettier": "2.8.8"
101
101
  }
102
102
  }