@jsenv/core 29.7.1 → 29.8.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 (47) hide show
  1. package/README.md +9 -12
  2. package/dist/babel_helpers/checkInRHS/checkInRHS.js +6 -0
  3. package/dist/babel_helpers/createClass/createClass.js +2 -1
  4. package/dist/babel_helpers/defineProperty/defineProperty.js +2 -0
  5. package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +38 -21
  6. package/dist/js/s.js +2 -2
  7. package/dist/js/s.js.map +3 -3
  8. package/dist/js/ws.js +29 -8
  9. package/dist/main.js +431 -178
  10. package/package.json +6 -6
  11. package/src/build/build.js +12 -9
  12. package/src/dev/file_service.js +4 -7
  13. package/src/dev/start_dev_server.js +0 -1
  14. package/src/kitchen/compat/{features_compats.js → features_compatibility.js} +4 -1
  15. package/src/kitchen/compat/runtime_compat.js +3 -3
  16. package/src/kitchen/kitchen.js +18 -9
  17. package/src/kitchen/url_graph/url_info_transformations.js +1 -0
  18. package/src/kitchen/url_specifier_encoding.js +2 -2
  19. package/src/plugins/bundling/js_module/bundle_js_modules.js +5 -3
  20. package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +1 -1
  21. package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +3 -3
  22. package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +1 -1
  23. package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -2
  24. package/src/plugins/plugin_controller.js +70 -71
  25. package/src/plugins/ribbon/jsenv_plugin_ribbon.js +1 -1
  26. package/src/plugins/supervisor/jsenv_plugin_supervisor.js +1 -1
  27. package/src/plugins/toolbar/jsenv_plugin_toolbar.js +1 -1
  28. package/src/plugins/transpilation/as_js_classic/client/s.js +1 -1
  29. package/src/plugins/transpilation/as_js_classic/convert_js_module_to_js_classic.js +2 -0
  30. package/src/plugins/transpilation/as_js_classic/helpers/babel_plugin_transform_import_meta_resolve.js +26 -0
  31. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_conversion.js +5 -11
  32. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +2 -2
  33. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_library.js +3 -3
  34. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_workers.js +1 -1
  35. package/src/plugins/transpilation/as_js_module/convert_js_classic_to_js_module.js +45 -0
  36. package/src/plugins/transpilation/as_js_module/jsenv_plugin_as_js_module.js +78 -0
  37. package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +2 -2
  38. package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +11 -11
  39. package/src/plugins/transpilation/jsenv_plugin_import_meta_resolve.js +52 -0
  40. package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +16 -13
  41. package/src/plugins/transpilation/jsenv_plugin_transpilation.js +5 -0
  42. package/src/plugins/url_analysis/html/html_urls.js +1 -1
  43. package/src/plugins/url_analysis/js/js_urls.js +1 -0
  44. package/src/plugins/url_analysis/jsenv_plugin_reference_expected_types.js +4 -2
  45. package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +1 -1
  46. package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +3 -3
  47. package/src/plugins/url_resolution/node_esm_resolver.js +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @jsenv/core [![npm package](https://img.shields.io/npm/v/@jsenv/core.svg?logo=npm&label=package)](https://www.npmjs.com/package/@jsenv/core)
2
2
 
3
- Jsenv was first created to write tests that could be executed in different runtimes.
3
+ Jsenv was created to provide a tool that can be used both for the web and Node.js.
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
  - :exploding_head: Execute HTML files as tests
@@ -17,24 +17,21 @@ https://github.com/jsenv/jsenv-core/wiki
17
17
  npm install --save-dev @jsenv/core
18
18
  ```
19
19
 
20
- _@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.5.0. Other operating systems and Node.js versions are not tested.
20
+ _@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.5.0.
21
+ Other operating systems and Node.js versions are not tested.
21
22
 
22
23
  # Name
23
24
 
24
- The name "jsenv" stands for JavaScript environments. This is because the original purpose of jsenv was to bring closer two JavaScript runtimes: web browsers and Node.js.
25
+ The name "jsenv" stands for JavaScript environments.
25
26
 
26
- Maybe "jsenv" should be written "JSEnv"? That makes typing the name too complex:
27
-
28
- 1. Hold `shift` on keyboard
29
- 2. While holding `shift`, type `JSE`
30
- 3. Release `shift`
31
- 4. Finally, type `nv`.
32
-
33
- No one wants to do that: the prefered syntax is "jsenv".
27
+ Maybe "jsenv" should be written "JSEnv", but it would be too painful to type.
28
+ The prefered syntax is "jsenv".
34
29
 
35
30
  # Logo
36
31
 
37
- The logo is composed by the name at the center and two circles orbiting around it. One of the circle is web browsers, the other is Node.js. It represents the two JavaScript environments supported by jsenv.
32
+ The logo is composed by the name at the center and two circles orbiting around it.
33
+ One of the circle is web browsers, the other is Node.js.
34
+ It represents the two JavaScript runtimes supported by jsenv.
38
35
 
39
36
  ![jsenv logo with legend](./docs/jsenv_logo_legend.png)
40
37
 
@@ -0,0 +1,6 @@
1
+ export default function _checkInRHS(value) {
2
+ if (Object(value) !== value) {
3
+ throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
4
+ }
5
+ return value;
6
+ }
@@ -1,10 +1,11 @@
1
+ import toPropertyKey from "../toPropertyKey/toPropertyKey.js";
1
2
  function _defineProperties(target, props) {
2
3
  for (var i = 0; i < props.length; i++) {
3
4
  var descriptor = props[i];
4
5
  descriptor.enumerable = descriptor.enumerable || false;
5
6
  descriptor.configurable = true;
6
7
  if ("value" in descriptor) descriptor.writable = true;
7
- Object.defineProperty(target, descriptor.key, descriptor);
8
+ Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
8
9
  }
9
10
  }
10
11
  export default function _createClass(Constructor, protoProps, staticProps) {
@@ -1,4 +1,6 @@
1
+ import toPropertyKey from "../toPropertyKey/toPropertyKey.js";
1
2
  export default ((obj, key, value) => {
3
+ key = toPropertyKey(key);
2
4
  // Shortcircuit the slow defineProperty path when possible.
3
5
  // We are trying to avoid issues where setters defined on the
4
6
  // prototype cause side effects under the fast path of simple
@@ -16,6 +16,9 @@ export default function _regeneratorRuntime() {
16
16
  var exports = {};
17
17
  var Op = Object.prototype;
18
18
  var hasOwn = Op.hasOwnProperty;
19
+ var defineProperty = Object.defineProperty || function (obj, key, desc) {
20
+ obj[key] = desc.value;
21
+ };
19
22
  var undefined; // More compressible than void 0.
20
23
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
21
24
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
@@ -46,7 +49,9 @@ export default function _regeneratorRuntime() {
46
49
 
47
50
  // The ._invoke method unifies the implementations of the .next,
48
51
  // .throw, and .return methods.
49
- generator._invoke = makeInvokeMethod(innerFn, self, context);
52
+ defineProperty(generator, "_invoke", {
53
+ value: makeInvokeMethod(innerFn, self, context)
54
+ });
50
55
  return generator;
51
56
  }
52
57
  exports.wrap = wrap;
@@ -106,8 +111,14 @@ export default function _regeneratorRuntime() {
106
111
  }
107
112
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
108
113
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
109
- define(Gp, "constructor", GeneratorFunctionPrototype);
110
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
114
+ defineProperty(Gp, "constructor", {
115
+ value: GeneratorFunctionPrototype,
116
+ configurable: true
117
+ });
118
+ defineProperty(GeneratorFunctionPrototype, "constructor", {
119
+ value: GeneratorFunction,
120
+ configurable: true
121
+ });
111
122
  GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
112
123
 
113
124
  // Helper for defining the .next, .throw, and .return methods of the
@@ -202,7 +213,9 @@ export default function _regeneratorRuntime() {
202
213
 
203
214
  // Define the unified helper method that is used to implement .next,
204
215
  // .throw, and .return (see defineIteratorMethods).
205
- this._invoke = enqueue;
216
+ defineProperty(this, "_invoke", {
217
+ value: enqueue
218
+ });
206
219
  }
207
220
  defineIteratorMethods(AsyncIterator.prototype);
208
221
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
@@ -289,27 +302,30 @@ export default function _regeneratorRuntime() {
289
302
  // delegate iterator, or by modifying context.method and context.arg,
290
303
  // setting context.delegate to null, and returning the ContinueSentinel.
291
304
  function maybeInvokeDelegate(delegate, context) {
292
- var method = delegate.iterator[context.method];
305
+ var methodName = context.method;
306
+ var method = delegate.iterator[methodName];
293
307
  if (method === undefined) {
294
308
  // A .throw or .return when the delegate iterator has no .throw
295
- // method always terminates the yield* loop.
309
+ // method, or a missing .next mehtod, always terminate the
310
+ // yield* loop.
296
311
  context.delegate = null;
297
- if (context.method === "throw") {
298
- // Note: ["return"] must be used for ES3 parsing compatibility.
299
- if (delegate.iterator["return"]) {
300
- // If the delegate iterator has a return method, give it a
301
- // chance to clean up.
302
- context.method = "return";
303
- context.arg = undefined;
304
- maybeInvokeDelegate(delegate, context);
305
- if (context.method === "throw") {
306
- // If maybeInvokeDelegate(context) changed context.method from
307
- // "return" to "throw", let that override the TypeError below.
308
- return ContinueSentinel;
309
- }
312
+
313
+ // Note: ["return"] must be used for ES3 parsing compatibility.
314
+ if (methodName === "throw" && delegate.iterator["return"]) {
315
+ // If the delegate iterator has a return method, give it a
316
+ // chance to clean up.
317
+ context.method = "return";
318
+ context.arg = undefined;
319
+ maybeInvokeDelegate(delegate, context);
320
+ if (context.method === "throw") {
321
+ // If maybeInvokeDelegate(context) changed context.method from
322
+ // "return" to "throw", let that override the TypeError below.
323
+ return ContinueSentinel;
310
324
  }
325
+ }
326
+ if (methodName !== "return") {
311
327
  context.method = "throw";
312
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
328
+ context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method");
313
329
  }
314
330
  return ContinueSentinel;
315
331
  }
@@ -401,7 +417,8 @@ export default function _regeneratorRuntime() {
401
417
  tryLocsList.forEach(pushTryEntry, this);
402
418
  this.reset(true);
403
419
  }
404
- exports.keys = function (object) {
420
+ exports.keys = function (val) {
421
+ var object = Object(val);
405
422
  var keys = [];
406
423
  for (var key in object) {
407
424
  keys.push(key);
package/dist/js/s.js CHANGED
@@ -557,8 +557,8 @@ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function"
557
557
  var createMeta = function createMeta(url) {
558
558
  return {
559
559
  url: url,
560
- resolve: function resolve(id, parentUrl) {
561
- return resolveUrl(id, parentUrl);
560
+ resolve: function resolve(id) {
561
+ return resolveUrl(id, url);
562
562
  }
563
563
  };
564
564
  };