@jsenv/core 34.3.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.
Files changed (74) hide show
  1. package/README.md +2 -9
  2. package/dist/js/ws.js +1 -145
  3. package/dist/{jsenv.js → jsenv_core.js} +1056 -3850
  4. package/package.json +8 -23
  5. package/src/build/build.js +2 -2
  6. package/src/dev/file_service.js +8 -8
  7. package/src/dev/start_dev_server.js +3 -3
  8. package/src/dev/user_agent.js +1 -1
  9. package/src/main.js +0 -23
  10. package/src/plugins/supervisor/jsenv_plugin_supervisor.js +1 -1
  11. package/src/plugins/transpilation/babel/require_babel_plugin.js +1 -1
  12. package/src/plugins/transpilation/js_module_fallback/convert_js_module_to_js_classic.js +1 -1
  13. package/dist/controllable_child_process.mjs +0 -129
  14. package/dist/controllable_worker_thread.mjs +0 -91
  15. package/dist/importmap_node_loader.mjs +0 -49
  16. package/dist/js/execute_using_dynamic_import.js +0 -850
  17. package/dist/js/resolveImport.js +0 -504
  18. package/dist/js/v8_coverage.js +0 -508
  19. package/dist/no_experimental_warnings.cjs +0 -8
  20. package/src/execute/execute.js +0 -111
  21. package/src/execute/run.js +0 -161
  22. package/src/execute/runtimes/browsers/chromium.js +0 -10
  23. package/src/execute/runtimes/browsers/firefox.js +0 -9
  24. package/src/execute/runtimes/browsers/from_playwright.js +0 -574
  25. package/src/execute/runtimes/browsers/middleware_istanbul.js +0 -65
  26. package/src/execute/runtimes/browsers/middleware_js_supervisor.js +0 -100
  27. package/src/execute/runtimes/browsers/webkit.js +0 -26
  28. package/src/execute/runtimes/node/child_exec_options.js +0 -166
  29. package/src/execute/runtimes/node/controllable_child_process.mjs +0 -135
  30. package/src/execute/runtimes/node/controllable_worker_thread.mjs +0 -103
  31. package/src/execute/runtimes/node/exec_options.js +0 -57
  32. package/src/execute/runtimes/node/execute_using_dynamic_import.js +0 -55
  33. package/src/execute/runtimes/node/exit_codes.js +0 -9
  34. package/src/execute/runtimes/node/importmap_node_loader.mjs +0 -51
  35. package/src/execute/runtimes/node/importmap_node_loader_file_url.js +0 -4
  36. package/src/execute/runtimes/node/kill_process_tree.js +0 -76
  37. package/src/execute/runtimes/node/no_experimental_warnings.cjs +0 -12
  38. package/src/execute/runtimes/node/no_experimental_warnings_file_url.js +0 -4
  39. package/src/execute/runtimes/node/node_child_process.js +0 -363
  40. package/src/execute/runtimes/node/node_execution_performance.js +0 -67
  41. package/src/execute/runtimes/node/node_worker_thread.js +0 -295
  42. package/src/execute/runtimes/node/profiler_v8_coverage.js +0 -56
  43. package/src/execute/runtimes/readme.md +0 -13
  44. package/src/execute/web_server_param.js +0 -74
  45. package/src/test/coverage/babel_plugin_instrument.js +0 -48
  46. package/src/test/coverage/coverage_reporter_html_directory.js +0 -32
  47. package/src/test/coverage/coverage_reporter_json_file.js +0 -17
  48. package/src/test/coverage/coverage_reporter_text_log.js +0 -19
  49. package/src/test/coverage/empty_coverage_factory.js +0 -52
  50. package/src/test/coverage/file_by_file_coverage.js +0 -25
  51. package/src/test/coverage/istanbul_coverage_composition.js +0 -28
  52. package/src/test/coverage/istanbul_coverage_map_from_coverage.js +0 -16
  53. package/src/test/coverage/list_files_not_covered.js +0 -15
  54. package/src/test/coverage/missing_coverage.js +0 -41
  55. package/src/test/coverage/report_to_coverage.js +0 -198
  56. package/src/test/coverage/v8_and_istanbul.js +0 -37
  57. package/src/test/coverage/v8_coverage.js +0 -26
  58. package/src/test/coverage/v8_coverage_composition.js +0 -24
  59. package/src/test/coverage/v8_coverage_node_directory.js +0 -85
  60. package/src/test/coverage/v8_coverage_to_istanbul.js +0 -99
  61. package/src/test/execute_steps.js +0 -425
  62. package/src/test/execute_test_plan.js +0 -372
  63. package/src/test/execution_colors.js +0 -10
  64. package/src/test/execution_steps.js +0 -65
  65. package/src/test/gc.js +0 -9
  66. package/src/test/logs_file_execution.js +0 -427
  67. package/src/test/logs_file_execution.test.mjs +0 -41
  68. package/src/test/readme.md +0 -3
  69. /package/src/{basic_fetch.js → helpers/basic_fetch.js} +0 -0
  70. /package/src/{lookup_package_directory.js → helpers/lookup_package_directory.js} +0 -0
  71. /package/src/{ping_server.js → helpers/ping_server.js} +0 -0
  72. /package/src/{require_from_jsenv.js → helpers/require_from_jsenv.js} +0 -0
  73. /package/src/{watch_source_files.js → helpers/watch_source_files.js} +0 -0
  74. /package/src/{web_url_converter.js → helpers/web_url_converter.js} +0 -0
package/README.md CHANGED
@@ -4,10 +4,10 @@ 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
- [Documentation](<https://github.com/jsenv/jsenv-core/wiki/A)-Getting-started>)
10
+ [Documentation](<https://github.com/jsenv/core/wiki/A)-Getting-started>)
11
11
 
12
12
  # Installation
13
13
 
@@ -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 };