@jsenv/core 25.2.0 → 25.4.0

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 (114) hide show
  1. package/dist/browser_runtime/asset-manifest.json +2 -2
  2. package/dist/browser_runtime/{browser_runtime_91c5a3b8.js → browser_runtime_0e3396a1.js} +15 -16
  3. package/dist/browser_runtime/{browser_runtime_91c5a3b8.js.map → browser_runtime_0e3396a1.js.map} +13 -13
  4. package/dist/build_manifest.js +5 -5
  5. package/dist/compile_proxy/asset-manifest.json +2 -2
  6. package/dist/compile_proxy/compile_proxy.html__inline__20_2334a374.js.map +342 -0
  7. package/dist/compile_proxy/{compile_proxy_8dfaee51.html → compile_proxy_9f737eaf.html} +357 -398
  8. package/dist/redirector/asset-manifest.json +2 -2
  9. package/dist/redirector/redirector.html__inline__12_009c47c7.js.map +348 -0
  10. package/dist/redirector/{redirector_3e9a97b9.html → redirector_96f74871.html} +378 -421
  11. package/dist/toolbar/asset-manifest.json +2 -2
  12. package/dist/toolbar/{toolbar.main_6c1b3d82.js.map → toolbar.main_86335f90.js.map} +82 -115
  13. package/dist/toolbar/{toolbar_361afb84.html → toolbar_d3a918a4.html} +487 -508
  14. package/dist/toolbar_injector/asset-manifest.json +2 -2
  15. package/dist/toolbar_injector/toolbar_injector_978bbd14.js +267 -0
  16. package/dist/toolbar_injector/toolbar_injector_978bbd14.js.map +119 -0
  17. package/package.json +19 -14
  18. package/readme.md +54 -54
  19. package/src/buildProject.js +31 -26
  20. package/src/dev_server.js +78 -87
  21. package/src/execute.js +3 -8
  22. package/src/internal/browser_launcher/{browser_runtime_report.js → browser_runtime_profile.js} +21 -15
  23. package/src/internal/browser_launcher/executeHtmlFile.js +22 -14
  24. package/src/internal/browser_launcher/from_playwright.js +6 -4
  25. package/src/internal/browser_runtime/browser_runtime.js +12 -14
  26. package/src/internal/browser_runtime/createBrowserRuntime.js +7 -6
  27. package/src/internal/browser_utils/fetchAndEvalUsingFetch.js +1 -1
  28. package/src/internal/browser_utils/fetchJson.js +1 -1
  29. package/src/internal/browser_utils/{fetch-browser.js → fetch_browser.js} +0 -2
  30. package/src/internal/building/buildUsingRollup.js +41 -57
  31. package/src/internal/building/html/parseHtmlRessource.js +2 -1
  32. package/src/internal/building/rollup_plugin_jsenv.js +28 -8
  33. package/src/internal/compiling/babel_parse_error.js +9 -0
  34. package/src/internal/{babel_plugin_transform_import_meta.js → compiling/babel_plugin_transform_import_meta.js} +58 -9
  35. package/src/internal/compiling/compileFile.js +2 -2
  36. package/src/internal/compiling/compileHtml.js +1 -1
  37. package/src/internal/compiling/createCompiledFileService.js +25 -74
  38. package/src/internal/compiling/js-compilation-service/babelHelper.js +10 -13
  39. package/src/internal/compiling/js-compilation-service/babel_plugin_babel_helpers_as_jsenv_imports.js +4 -2
  40. package/src/internal/compiling/js-compilation-service/transformJs.js +153 -23
  41. package/src/internal/compiling/jsenvCompilerForHtml.js +34 -34
  42. package/src/internal/compiling/jsenvCompilerForImportmap.js +2 -2
  43. package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -4
  44. package/src/internal/compiling/jsenv_directory/comparison_utils.js +24 -0
  45. package/src/internal/compiling/{compile-directory/compile-asset.js → jsenv_directory/compile_asset.js} +0 -0
  46. package/src/internal/compiling/jsenv_directory/compile_context.js +68 -0
  47. package/src/internal/compiling/jsenv_directory/compile_profile.js +218 -0
  48. package/src/internal/compiling/{compile-directory/createLockRegistry.js → jsenv_directory/file_lock_registry.js} +0 -0
  49. package/src/internal/compiling/{compile-directory/createLockRegistry.test.js → jsenv_directory/file_lock_registry.test.js} +2 -1
  50. package/src/internal/compiling/{compile-directory → jsenv_directory}/fs-optimized-for-cache.js +0 -0
  51. package/src/internal/compiling/{compile-directory → jsenv_directory}/getOrGenerateCompiledFile.js +2 -2
  52. package/src/internal/compiling/jsenv_directory/jsenv_directory.js +174 -0
  53. package/src/internal/compiling/{compile-directory → jsenv_directory}/updateMeta.js +4 -2
  54. package/src/internal/compiling/{compile-directory → jsenv_directory}/validateCache.js +0 -0
  55. package/src/internal/compiling/sse_service/sse_service.js +369 -0
  56. package/src/internal/compiling/startCompileServer.js +156 -804
  57. package/src/internal/compiling/transformResultToCompilationResult.js +2 -2
  58. package/src/internal/dev_server/exploring/exploring.js +10 -8
  59. package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +85 -78
  60. package/src/internal/dev_server/toolbar/settings/toolbar.settings.js +13 -0
  61. package/src/internal/dev_server/toolbar/toolbar.html +40 -16
  62. package/src/internal/dev_server/toolbar/toolbar.injector.js +11 -17
  63. package/src/internal/dev_server/toolbar/toolbar.main.js +6 -6
  64. package/src/internal/executing/executeConcurrently.js +1 -1
  65. package/src/internal/executing/executePlan.js +2 -3
  66. package/src/internal/{generateGroupMap → features}/babel_plugins_compatibility.js +8 -8
  67. package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +20 -0
  68. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +23 -0
  69. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +25 -0
  70. package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +37 -0
  71. package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +9 -0
  72. package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +14 -0
  73. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +85 -0
  74. package/src/internal/{browser_feature_detection → features/browser_feature_detection}/compile_proxy.html +1 -1
  75. package/src/internal/features/browser_feature_detection/execute_with_script_module.js +24 -0
  76. package/src/internal/features/features_compat_from_runtime.js +38 -0
  77. package/src/internal/features/features_compat_from_runtime_support.js +31 -0
  78. package/src/internal/{generateGroupMap → features}/features_compatibility.js +3 -3
  79. package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_dynamic_import.mjs +0 -0
  80. package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_top_level_await.mjs +0 -0
  81. package/src/internal/{node_feature_detection/nodeSupportsDynamicImport.js → features/node_feature_detection/node_feature_detect_dynamic_import.js} +0 -0
  82. package/src/internal/{node_feature_detection/nodeSupportsTopLevelAwait.js → features/node_feature_detection/node_feature_detect_top_level_await.js} +0 -0
  83. package/src/internal/features/node_feature_detection/node_feature_detection.js +66 -0
  84. package/src/internal/jsenv_remote_directory.js +1 -1
  85. package/src/internal/node_launcher/createControllableNodeProcess.js +4 -3
  86. package/src/internal/node_launcher/node_runtime_report.js +15 -9
  87. package/src/internal/node_runtime/fetchSource.js +2 -4
  88. package/src/internal/node_runtime/node_execution_systemjs.js +2 -5
  89. package/src/internal/{dev_server/redirector → redirector}/redirector.html +8 -18
  90. package/src/internal/{generateGroupMap/jsenvRuntimeSupport.js → runtime_support/jsenv_runtime_support.js} +0 -0
  91. package/src/internal/{generateGroupMap → runtime_support}/runtime_support.js +0 -0
  92. package/src/internal/url_conversion.js +12 -17
  93. package/src/launchNode.js +29 -41
  94. package/dist/compile_proxy/compile_proxy.html__inline__20_809f35f7.js.map +0 -392
  95. package/dist/redirector/redirector.html__inline__15_e391410e.js.map +0 -397
  96. package/dist/toolbar_injector/toolbar_injector_fac1e995.js +0 -973
  97. package/dist/toolbar_injector/toolbar_injector_fac1e995.js.map +0 -294
  98. package/src/internal/CONSTANTS.js +0 -11
  99. package/src/internal/browser_feature_detection/browser_feature_detection.js +0 -274
  100. package/src/internal/compiling/js-compilation-service/jsenvTransform.js +0 -243
  101. package/src/internal/generateGroupMap/generateGroupMap.js +0 -65
  102. package/src/internal/generateGroupMap/one_runtime_compat.js +0 -38
  103. package/src/internal/generateGroupMap/runtime_compat.js +0 -34
  104. package/src/internal/generateGroupMap/runtime_compat_composition.js +0 -76
  105. package/src/internal/generateGroupMap/shake_babel_plugin_map.js +0 -21
  106. package/src/internal/integrity/integrity_algorithms.js +0 -26
  107. package/src/internal/integrity/integrity_parsing.js +0 -50
  108. package/src/internal/integrity/integrity_update.js +0 -23
  109. package/src/internal/integrity/integrity_validation.js +0 -49
  110. package/src/internal/node_feature_detection/node_feature_detection.js +0 -117
  111. package/src/internal/node_runtime/detectNode.js +0 -3
  112. package/src/internal/runtime/computeCompileIdFromGroupId.js +0 -30
  113. package/src/internal/runtime/resolveGroup.js +0 -13
  114. package/src/internal/runtime/resolveRuntimeGroup.js +0 -11
@@ -1915,19 +1915,28 @@ html[data-toolbar-visible] #toolbar-trigger {
1915
1915
  <div class="files_compilation_text">
1916
1916
  <span data-when="filesCompilation:no">Files shown are source files</span>
1917
1917
  <span data-when="filesCompilation:html_only">Files shown are source files, except html</span>
1918
- <span data-when="filesCompilation:yes">Files shown are compiled</span>
1918
+ <span data-when="filesCompilation:yes">Files shown are compiled for {runtime}</span>
1919
+ <span data-when="filesCompilation:mismatch">Files shown are compiled for an other runtime</span>
1919
1920
  </div>
1920
- <a data-when="compiled:yes" class="go_to_source_link" href="javascript:void(0);">Switch to source files</a>
1921
- <a data-when="compiled:no" class="go_to_compiled_link" href="javascript:void(0);">Switch to compiled files</a>
1921
+ <a data-when="compilation_link:source" class="link_to_source_files" href="javascript:void(0);">Switch to source files</a>
1922
+ <a data-when="compilation_link:mismatch" class="link_to_appropriate_files" href="javascript:void(0);">Switch to appropriate files</a>
1923
+ <a data-when="compilation_link:compiled" class="link_to_compiled_files" href="javascript:void(0);">Switch to compiled files</a>
1922
1924
  </div>
1923
1925
  </div>
1924
1926
  </div>
1925
1927
  </div>
1926
1928
  </div>
1927
1929
  <button id="settings-button" class="toolbar-icon-wrapper">
1928
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px" class="iconToolbar">
1929
- <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
1930
- </svg>
1930
+ <div data-when="has_warning:yes">
1931
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 511.999 511.999" width="24px" height="24px" class="iconToolbar">
1932
+ <path d="M506.43 421.536 291.573 49.394c-15.814-27.391-55.327-27.401-71.147 0L5.568 421.536c-15.814 27.391 3.934 61.616 35.574 61.616h429.714c31.629.001 51.394-34.214 35.574-61.616zm-231.609-36.502c0 10.394-8.427 18.821-18.821 18.821s-18.821-8.427-18.821-18.821v-11.239c0-10.394 8.427-18.821 18.821-18.821s18.821 8.427 18.821 18.821v11.239zm0-73.332c0 10.394-8.427 18.821-18.821 18.821s-18.821-8.427-18.821-18.821v-107.89c0-10.394 8.427-18.821 18.821-18.821s18.821 8.427 18.821 18.821v107.89z"></path>
1933
+ </svg>
1934
+ </div>
1935
+ <div data-when="has_warning:no">
1936
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px" class="iconToolbar">
1937
+ <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
1938
+ </svg>
1939
+ </div>
1931
1940
  </button>
1932
1941
  </section>
1933
1942
 
@@ -2278,7 +2287,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2278
2287
  /* eslint-env browser */
2279
2288
 
2280
2289
 
2281
- function _await$5(value, then, direct) {
2290
+ function _await$a(value, then, direct) {
2282
2291
  if (direct) {
2283
2292
  return then ? then(value) : value;
2284
2293
  }
@@ -2290,7 +2299,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2290
2299
  return then ? value.then(then) : value;
2291
2300
  }
2292
2301
 
2293
- function _async$6(f) {
2302
+ function _async$a(f) {
2294
2303
  return function () {
2295
2304
  for (var args = [], i = 0; i < arguments.length; i++) {
2296
2305
  args[i] = arguments[i];
@@ -2317,7 +2326,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2317
2326
  }
2318
2327
  }
2319
2328
 
2320
- var fetchUsingXHR = _async$6(function (url) {
2329
+ var fetchUsingXHR = _async$a(function (url) {
2321
2330
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
2322
2331
  signal = _ref.signal,
2323
2332
  _ref$method = _ref.method,
@@ -2401,7 +2410,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2401
2410
  }
2402
2411
 
2403
2412
  xhr.send(body);
2404
- return _await$5(headersPromise, function () {
2413
+ return _await$a(headersPromise, function () {
2405
2414
  // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
2406
2415
  var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
2407
2416
  var responseStatus = xhr.status;
@@ -2409,7 +2418,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2409
2418
  var responseHeaders = getHeadersFromXHR(xhr);
2410
2419
 
2411
2420
  var readBody = function readBody() {
2412
- return _await$5(bodyPromise, function () {
2421
+ return _await$a(bodyPromise, function () {
2413
2422
  var status = xhr.status; // in Chrome on file:/// URLs, status is 0
2414
2423
 
2415
2424
  if (status === 0) {
@@ -2445,7 +2454,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2445
2454
  return _call$2(text, JSON.parse);
2446
2455
  };
2447
2456
 
2448
- var blob = _async$6(function () {
2457
+ var blob = _async$a(function () {
2449
2458
  if (!hasBlob) {
2450
2459
  throw new Error("blob not supported");
2451
2460
  }
@@ -2482,7 +2491,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2482
2491
  });
2483
2492
  };
2484
2493
 
2485
- var formData = _async$6(function () {
2494
+ var formData = _async$a(function () {
2486
2495
  if (!hasFormData) {
2487
2496
  throw new Error("formData not supported");
2488
2497
  }
@@ -2663,7 +2672,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2663
2672
  return form;
2664
2673
  };
2665
2674
 
2666
- var blobToArrayBuffer = _async$6(function (blob) {
2675
+ var blobToArrayBuffer = _async$a(function (blob) {
2667
2676
  var reader = new FileReader();
2668
2677
  var promise = fileReaderReady(reader);
2669
2678
  reader.readAsArrayBuffer(blob);
@@ -2714,7 +2723,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2714
2723
 
2715
2724
  var _excluded$1 = ["mode"];
2716
2725
 
2717
- function _await$4(value, then, direct) {
2726
+ function _await$9(value, then, direct) {
2718
2727
  if (direct) {
2719
2728
  return then ? then(value) : value;
2720
2729
  }
@@ -2726,7 +2735,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2726
2735
  return then ? value.then(then) : value;
2727
2736
  }
2728
2737
 
2729
- function _async$5(f) {
2738
+ function _async$9(f) {
2730
2739
  return function () {
2731
2740
  for (var args = [], i = 0; i < arguments.length; i++) {
2732
2741
  args[i] = arguments[i];
@@ -2740,14 +2749,14 @@ html[data-toolbar-visible] #toolbar-trigger {
2740
2749
  };
2741
2750
  }
2742
2751
 
2743
- var fetchNative = _async$5(function (url) {
2752
+ var fetchNative = _async$9(function (url) {
2744
2753
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2745
2754
 
2746
2755
  var _ref$mode = _ref.mode,
2747
2756
  mode = _ref$mode === void 0 ? "cors" : _ref$mode,
2748
2757
  options = _objectWithoutProperties(_ref, _excluded$1);
2749
2758
 
2750
- return _await$4(window.fetch(url, _objectSpread2({
2759
+ return _await$9(window.fetch(url, _objectSpread2({
2751
2760
  mode: mode
2752
2761
  }, options)), function (response) {
2753
2762
  return {
@@ -2784,7 +2793,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2784
2793
 
2785
2794
  var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
2786
2795
 
2787
- function _await$3(value, then, direct) {
2796
+ function _await$8(value, then, direct) {
2788
2797
  if (direct) {
2789
2798
  return then ? then(value) : value;
2790
2799
  }
@@ -2796,7 +2805,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2796
2805
  return then ? value.then(then) : value;
2797
2806
  }
2798
2807
 
2799
- function _async$4(f) {
2808
+ function _async$8(f) {
2800
2809
  return function () {
2801
2810
  for (var args = [], i = 0; i < arguments.length; i++) {
2802
2811
  args[i] = arguments[i];
@@ -2810,14 +2819,14 @@ html[data-toolbar-visible] #toolbar-trigger {
2810
2819
  };
2811
2820
  }
2812
2821
 
2813
- var fetchJson = _async$4(function (url) {
2822
+ var fetchJson = _async$8(function (url) {
2814
2823
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2815
- return _await$3(fetchUrl(url, options), function (response) {
2816
- return _await$3(response.json());
2824
+ return _await$8(fetchUrl(url, options), function (response) {
2825
+ return _await$8(response.json());
2817
2826
  });
2818
2827
  });
2819
2828
 
2820
- function _await$2(value, then, direct) {
2829
+ function _await$7(value, then, direct) {
2821
2830
  if (direct) {
2822
2831
  return then ? then(value) : value;
2823
2832
  }
@@ -2829,7 +2838,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2829
2838
  return then ? value.then(then) : value;
2830
2839
  }
2831
2840
 
2832
- function _catch$1(body, recover) {
2841
+ function _catch$5(body, recover) {
2833
2842
  try {
2834
2843
  var result = body();
2835
2844
  } catch (e) {
@@ -2843,7 +2852,7 @@ html[data-toolbar-visible] #toolbar-trigger {
2843
2852
  return result;
2844
2853
  }
2845
2854
 
2846
- function _async$3(f) {
2855
+ function _async$7(f) {
2847
2856
  return function () {
2848
2857
  for (var args = [], i = 0; i < arguments.length; i++) {
2849
2858
  args[i] = arguments[i];
@@ -2857,12 +2866,12 @@ html[data-toolbar-visible] #toolbar-trigger {
2857
2866
  };
2858
2867
  }
2859
2868
 
2860
- var fetchExploringJson = _async$3(function () {
2869
+ var fetchExploringJson = _async$7(function () {
2861
2870
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2862
2871
  signal = _ref.signal;
2863
2872
 
2864
- return _catch$1(function () {
2865
- return _await$2(fetchJson("/.jsenv/exploring.json", {
2873
+ return _catch$5(function () {
2874
+ return _await$7(fetchJson("/.jsenv/exploring.json", {
2866
2875
  signal: signal
2867
2876
  }));
2868
2877
  }, function (e) {
@@ -3122,33 +3131,6 @@ html[data-toolbar-visible] #toolbar-trigger {
3122
3131
  });
3123
3132
  };
3124
3133
 
3125
- var renderToolbarSettings = function renderToolbarSettings() {
3126
- document.querySelector("#settings-button").onclick = toggleSettings;
3127
- document.querySelector("#button-close-settings").onclick = toggleSettings;
3128
- };
3129
-
3130
- var toggleSettings = function toggleSettings() {
3131
- if (settingsAreVisible()) {
3132
- hideSettings();
3133
- } else {
3134
- showSettings();
3135
- }
3136
- };
3137
-
3138
- var settingsAreVisible = function settingsAreVisible() {
3139
- return toolbarSectionIsActive(document.querySelector("#settings"));
3140
- };
3141
-
3142
- var hideSettings = function hideSettings() {
3143
- deactivateToolbarSection(document.querySelector("#settings"));
3144
- updateIframeOverflowOnParentWindow();
3145
- };
3146
-
3147
- var showSettings = function showSettings() {
3148
- activateToolbarSection(document.querySelector("#settings"));
3149
- updateIframeOverflowOnParentWindow();
3150
- };
3151
-
3152
3134
  var enableVariant = function enableVariant(rootNode, variables) {
3153
3135
  var nodesNotMatching = Array.from(rootNode.querySelectorAll("[".concat(attributeIndicatingACondition, "]")));
3154
3136
  nodesNotMatching.forEach(function (nodeNotMatching) {
@@ -3214,9 +3196,48 @@ html[data-toolbar-visible] #toolbar-trigger {
3214
3196
  node.removeAttribute(name);
3215
3197
  };
3216
3198
 
3199
+ var renderToolbarSettings = function renderToolbarSettings() {
3200
+ document.querySelector("#settings-button").onclick = toggleSettings;
3201
+ document.querySelector("#button-close-settings").onclick = toggleSettings;
3202
+ };
3203
+
3204
+ var toggleSettings = function toggleSettings() {
3205
+ if (settingsAreVisible()) {
3206
+ hideSettings();
3207
+ } else {
3208
+ showSettings();
3209
+ }
3210
+ };
3211
+
3212
+ var enableWarningStyle = function enableWarningStyle() {
3213
+ enableVariant(document.querySelector("#settings-button"), {
3214
+ has_warning: "yes"
3215
+ });
3216
+ };
3217
+
3218
+ var disableWarningStyle = function disableWarningStyle() {
3219
+ enableVariant(document.querySelector("#settings-button"), {
3220
+ has_warning: "no"
3221
+ });
3222
+ };
3223
+
3224
+ var settingsAreVisible = function settingsAreVisible() {
3225
+ return toolbarSectionIsActive(document.querySelector("#settings"));
3226
+ };
3227
+
3228
+ var hideSettings = function hideSettings() {
3229
+ deactivateToolbarSection(document.querySelector("#settings"));
3230
+ updateIframeOverflowOnParentWindow();
3231
+ };
3232
+
3233
+ var showSettings = function showSettings() {
3234
+ activateToolbarSection(document.querySelector("#settings"));
3235
+ updateIframeOverflowOnParentWindow();
3236
+ };
3237
+
3217
3238
  var _excluded = ["clickToFocus", "clickToClose"];
3218
3239
 
3219
- function _async$2(f) {
3240
+ function _async$6(f) {
3220
3241
  return function () {
3221
3242
  for (var args = [], i = 0; i < arguments.length; i++) {
3222
3243
  args[i] = arguments[i];
@@ -3230,7 +3251,7 @@ html[data-toolbar-visible] #toolbar-trigger {
3230
3251
  };
3231
3252
  }
3232
3253
 
3233
- function _await$1(value, then, direct) {
3254
+ function _await$6(value, then, direct) {
3234
3255
  if (direct) {
3235
3256
  return then ? then(value) : value;
3236
3257
  }
@@ -3346,7 +3367,7 @@ html[data-toolbar-visible] #toolbar-trigger {
3346
3367
  };
3347
3368
 
3348
3369
  var permission = "default";
3349
- var notify = notificationAvailable ? _async$2(function (title) {
3370
+ var notify = notificationAvailable ? _async$6(function (title) {
3350
3371
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3351
3372
 
3352
3373
  var _ref$clickToFocus = _ref.clickToFocus,
@@ -3386,10 +3407,10 @@ html[data-toolbar-visible] #toolbar-trigger {
3386
3407
  return notification;
3387
3408
  }) : function () {};
3388
3409
  var requestPromise;
3389
- var requestPermission = notificationAvailable ? _async$2(function () {
3410
+ var requestPermission = notificationAvailable ? _async$6(function () {
3390
3411
  if (requestPromise) return requestPromise;
3391
3412
  requestPromise = Notification.requestPermission();
3392
- return _await$1(requestPromise, function (_requestPromise) {
3413
+ return _await$6(requestPromise, function (_requestPromise) {
3393
3414
  permission = _requestPromise;
3394
3415
  requestPromise = undefined;
3395
3416
  return permission;
@@ -3700,172 +3721,6 @@ html[data-toolbar-visible] #toolbar-trigger {
3700
3721
  input.style.width = "".concat(input.value.length, "ch");
3701
3722
  }
3702
3723
  };
3703
-
3704
- var createDetailedMessage = function createDetailedMessage(message) {
3705
- var details = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3706
- var string = "".concat(message);
3707
- Object.keys(details).forEach(function (key) {
3708
- var value = details[key];
3709
- string += "\n--- ".concat(key, " ---\n").concat(Array.isArray(value) ? value.join("\n") : value);
3710
- });
3711
- return string;
3712
- };
3713
-
3714
- var COMPILE_ID_OTHERWISE = "otherwise";
3715
-
3716
- var computeCompileIdFromGroupId = function computeCompileIdFromGroupId(_ref) {
3717
- var groupId = _ref.groupId,
3718
- groupMap = _ref.groupMap;
3719
-
3720
- if (typeof groupId === "undefined") {
3721
- if (COMPILE_ID_OTHERWISE in groupMap) {
3722
- return COMPILE_ID_OTHERWISE;
3723
- }
3724
-
3725
- var keys = Object.keys(groupMap);
3726
-
3727
- if (keys.length === 1) {
3728
- return keys[0];
3729
- }
3730
-
3731
- throw new Error(createUnexpectedGroupIdMessage({
3732
- groupMap: groupMap
3733
- }));
3734
- }
3735
-
3736
- if (groupId in groupMap === false) {
3737
- throw new Error(createUnexpectedGroupIdMessage({
3738
- groupId: groupId,
3739
- groupMap: groupMap
3740
- }));
3741
- }
3742
-
3743
- return groupId;
3744
- };
3745
-
3746
- var createUnexpectedGroupIdMessage = function createUnexpectedGroupIdMessage(_ref2) {
3747
- var _createDetailedMessag;
3748
-
3749
- var compileId = _ref2.compileId,
3750
- groupMap = _ref2.groupMap;
3751
- return createDetailedMessage("unexpected groupId.", (_createDetailedMessag = {}, _defineProperty(_createDetailedMessag, "expected compiled id", Object.keys(groupMap)), _defineProperty(_createDetailedMessag, "received compile id", compileId), _createDetailedMessag));
3752
- };
3753
-
3754
- var valueToVersion = function valueToVersion(value) {
3755
- if (typeof value === "number") {
3756
- return numberToVersion(value);
3757
- }
3758
-
3759
- if (typeof value === "string") {
3760
- return stringToVersion(value);
3761
- }
3762
-
3763
- throw new TypeError("version must be a number or a string, got ".concat(value));
3764
- };
3765
-
3766
- var numberToVersion = function numberToVersion(number) {
3767
- return {
3768
- major: number,
3769
- minor: 0,
3770
- patch: 0
3771
- };
3772
- };
3773
-
3774
- var stringToVersion = function stringToVersion(string) {
3775
- if (string.indexOf(".") > -1) {
3776
- var parts = string.split(".");
3777
- return {
3778
- major: Number(parts[0]),
3779
- minor: parts[1] ? Number(parts[1]) : 0,
3780
- patch: parts[2] ? Number(parts[2]) : 0
3781
- };
3782
- }
3783
-
3784
- if (isNaN(string)) {
3785
- return {
3786
- major: 0,
3787
- minor: 0,
3788
- patch: 0
3789
- };
3790
- }
3791
-
3792
- return {
3793
- major: Number(string),
3794
- minor: 0,
3795
- patch: 0
3796
- };
3797
- };
3798
-
3799
- var versionCompare = function versionCompare(versionA, versionB) {
3800
- var semanticVersionA = valueToVersion(versionA);
3801
- var semanticVersionB = valueToVersion(versionB);
3802
- var majorDiff = semanticVersionA.major - semanticVersionB.major;
3803
-
3804
- if (majorDiff > 0) {
3805
- return majorDiff;
3806
- }
3807
-
3808
- if (majorDiff < 0) {
3809
- return majorDiff;
3810
- }
3811
-
3812
- var minorDiff = semanticVersionA.minor - semanticVersionB.minor;
3813
-
3814
- if (minorDiff > 0) {
3815
- return minorDiff;
3816
- }
3817
-
3818
- if (minorDiff < 0) {
3819
- return minorDiff;
3820
- }
3821
-
3822
- var patchDiff = semanticVersionA.patch - semanticVersionB.patch;
3823
-
3824
- if (patchDiff > 0) {
3825
- return patchDiff;
3826
- }
3827
-
3828
- if (patchDiff < 0) {
3829
- return patchDiff;
3830
- }
3831
-
3832
- return 0;
3833
- };
3834
-
3835
- var versionIsBelow = function versionIsBelow(versionSupposedBelow, versionSupposedAbove) {
3836
- return versionCompare(versionSupposedBelow, versionSupposedAbove) < 0;
3837
- };
3838
-
3839
- var findHighestVersion = function findHighestVersion() {
3840
- for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
3841
- values[_key] = arguments[_key];
3842
- }
3843
-
3844
- if (values.length === 0) throw new Error("missing argument");
3845
- return values.reduce(function (highestVersion, value) {
3846
- if (versionIsBelow(highestVersion, value)) {
3847
- return value;
3848
- }
3849
-
3850
- return highestVersion;
3851
- });
3852
- };
3853
-
3854
- var resolveGroup = function resolveGroup(_ref, groupMap) {
3855
- var name = _ref.name,
3856
- version = _ref.version;
3857
- return Object.keys(groupMap).find(function (compileIdCandidate) {
3858
- var minRuntimeVersions = groupMap[compileIdCandidate].minRuntimeVersions;
3859
- var versionForGroup = minRuntimeVersions[name];
3860
-
3861
- if (!versionForGroup) {
3862
- return false;
3863
- }
3864
-
3865
- var highestVersion = findHighestVersion(version, versionForGroup);
3866
- return highestVersion === version;
3867
- });
3868
- };
3869
3724
  /*
3870
3725
  * Prefer window.navigator.userAgentData before resorting to
3871
3726
  * window.navigator.userAgent because of
@@ -4125,7 +3980,32 @@ html[data-toolbar-visible] #toolbar-trigger {
4125
3980
  return version;
4126
3981
  };
4127
3982
 
4128
- function _await(value, then, direct) {
3983
+ var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
3984
+ var scriptModule = document.createElement("script");
3985
+ scriptModule.type = "module";
3986
+ var loadPromise = new Promise(function (resolve, reject) {
3987
+ scriptModule.onload = function () {
3988
+ document.body.removeChild(scriptModule);
3989
+ resolve();
3990
+ };
3991
+
3992
+ scriptModule.onerror = function () {
3993
+ document.body.removeChild(scriptModule);
3994
+ reject();
3995
+ };
3996
+
3997
+ document.body.appendChild(scriptModule);
3998
+ });
3999
+ scriptModule.src = asBase64Url(code);
4000
+ return loadPromise;
4001
+ };
4002
+
4003
+ var asBase64Url = function asBase64Url(text) {
4004
+ var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
4005
+ return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
4006
+ };
4007
+
4008
+ function _await$5(value, then, direct) {
4129
4009
  if (direct) {
4130
4010
  return then ? then(value) : value;
4131
4011
  }
@@ -4137,7 +4017,21 @@ html[data-toolbar-visible] #toolbar-trigger {
4137
4017
  return then ? value.then(then) : value;
4138
4018
  }
4139
4019
 
4140
- function _async$1(f) {
4020
+ function _catch$4(body, recover) {
4021
+ try {
4022
+ var result = body();
4023
+ } catch (e) {
4024
+ return recover(e);
4025
+ }
4026
+
4027
+ if (result && result.then) {
4028
+ return result.then(void 0, recover);
4029
+ }
4030
+
4031
+ return result;
4032
+ }
4033
+
4034
+ function _async$5(f) {
4141
4035
  return function () {
4142
4036
  for (var args = [], i = 0; i < arguments.length; i++) {
4143
4037
  args[i] = arguments[i];
@@ -4151,30 +4045,52 @@ html[data-toolbar-visible] #toolbar-trigger {
4151
4045
  };
4152
4046
  }
4153
4047
 
4154
- function _call$1(body, then, direct) {
4155
- if (direct) {
4156
- return then ? then(body()) : body();
4157
- }
4048
+ var supportsImportmap = _async$5(function () {
4049
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4050
+ _ref$remote = _ref.remote,
4051
+ remote = _ref$remote === void 0 ? true : _ref$remote;
4158
4052
 
4159
- try {
4160
- var result = Promise.resolve(body());
4161
- return then ? result.then(then) : result;
4162
- } catch (e) {
4163
- return Promise.reject(e);
4053
+ var specifier = asBase64Url("export default false");
4054
+ var importMap = {
4055
+ imports: _defineProperty({}, specifier, asBase64Url("export default true"))
4056
+ };
4057
+ var importmapScript = document.createElement("script");
4058
+ var importmapString = JSON.stringify(importMap, null, " ");
4059
+ importmapScript.type = "importmap";
4060
+
4061
+ if (remote) {
4062
+ importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
4063
+ } else {
4064
+ importmapScript.textContent = importmapString;
4164
4065
  }
4165
- }
4166
4066
 
4167
- function _invoke(body, then) {
4168
- var result = body();
4067
+ document.body.appendChild(importmapScript);
4068
+ return _catch$4(function () {
4069
+ return _await$5(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
4070
+ document.body.removeChild(importmapScript);
4071
+ var supported = window.__jsenv_runtime_test_importmap__;
4072
+ delete window.__jsenv_runtime_test_importmap__;
4073
+ return supported;
4074
+ });
4075
+ }, function () {
4076
+ document.body.removeChild(importmapScript);
4077
+ return false;
4078
+ });
4079
+ });
4080
+
4081
+ function _await$4(value, then, direct) {
4082
+ if (direct) {
4083
+ return then ? then(value) : value;
4084
+ }
4169
4085
 
4170
- if (result && result.then) {
4171
- return result.then(then);
4086
+ if (!value || !value.then) {
4087
+ value = Promise.resolve(value);
4172
4088
  }
4173
4089
 
4174
- return then(result);
4090
+ return then ? value.then(then) : value;
4175
4091
  }
4176
4092
 
4177
- function _catch(body, recover) {
4093
+ function _catch$3(body, recover) {
4178
4094
  try {
4179
4095
  var result = body();
4180
4096
  } catch (e) {
@@ -4188,177 +4104,175 @@ html[data-toolbar-visible] #toolbar-trigger {
4188
4104
  return result;
4189
4105
  }
4190
4106
 
4191
- var scanBrowserRuntimeFeatures = _async$1(function () {
4192
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4193
- _ref$coverageHandledF = _ref.coverageHandledFromOutside,
4194
- coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
4195
- _ref$failFastOnFeatur = _ref.failFastOnFeatureDetection,
4196
- failFastOnFeatureDetection = _ref$failFastOnFeatur === void 0 ? false : _ref$failFastOnFeatur;
4107
+ function _async$4(f) {
4108
+ return function () {
4109
+ for (var args = [], i = 0; i < arguments.length; i++) {
4110
+ args[i] = arguments[i];
4111
+ }
4197
4112
 
4198
- return _await(fetchJson("/.jsenv/__compile_server_meta__.json"), function (_ref2) {
4199
- var outDirectoryRelativeUrl = _ref2.outDirectoryRelativeUrl,
4200
- inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
4201
- customCompilerPatterns = _ref2.customCompilerPatterns,
4202
- compileServerGroupMap = _ref2.compileServerGroupMap;
4203
- var browser = detectBrowser();
4204
- var compileId = computeCompileIdFromGroupId({
4205
- groupId: resolveGroup(browser, compileServerGroupMap),
4206
- groupMap: compileServerGroupMap
4207
- });
4208
- var groupInfo = compileServerGroupMap[compileId];
4209
- var featuresReport = {
4210
- importmap: undefined,
4211
- dynamicImport: undefined,
4212
- topLevelAwait: undefined,
4213
- jsonImportAssertions: undefined,
4214
- cssImportAssertions: undefined,
4215
- newStylesheet: undefined
4216
- };
4217
- return _await(detectSupportedFeatures({
4218
- featuresReport: featuresReport,
4219
- failFastOnFeatureDetection: failFastOnFeatureDetection,
4220
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
4221
- }), function () {
4222
- return _await(adjustMissingFeatureNames(groupInfo, {
4223
- featuresReport: featuresReport,
4224
- coverageHandledFromOutside: coverageHandledFromOutside
4225
- }), function (missingFeatureNames) {
4226
- var canAvoidCompilation = customCompilerPatterns.length === 0 && missingFeatureNames.length === 0 && featuresReport.importmap && featuresReport.dynamicImport && featuresReport.topLevelAwait;
4227
- return {
4228
- canAvoidCompilation: canAvoidCompilation,
4229
- featuresReport: featuresReport,
4230
- customCompilerPatterns: customCompilerPatterns,
4231
- missingFeatureNames: missingFeatureNames,
4232
- inlineImportMapIntoHTML: inlineImportMapIntoHTML,
4233
- outDirectoryRelativeUrl: outDirectoryRelativeUrl,
4234
- compileId: compileId,
4235
- browser: browser
4236
- };
4113
+ try {
4114
+ return Promise.resolve(f.apply(this, args));
4115
+ } catch (e) {
4116
+ return Promise.reject(e);
4117
+ }
4118
+ };
4119
+ }
4120
+
4121
+ var supportsDynamicImport = _async$4(function () {
4122
+ var moduleSource = asBase64Url("export default 42");
4123
+ return _catch$3(function () {
4124
+ return _await$4(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4125
+ return _await$4(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
4126
+ delete window.__jsenv_runtime_test_dynamic_import__;
4127
+ return namespace.default === 42;
4237
4128
  });
4238
4129
  });
4130
+ }, function () {
4131
+ return false;
4239
4132
  });
4240
4133
  });
4241
4134
 
4242
- var adjustMissingFeatureNames = _async$1(function (groupInfo, _ref3) {
4243
- var featuresReport = _ref3.featuresReport,
4244
- coverageHandledFromOutside = _ref3.coverageHandledFromOutside;
4245
- var missingFeatureNames = groupInfo.missingFeatureNames;
4246
- var missingFeatureNamesCopy = missingFeatureNames.slice();
4135
+ function _await$3(value, then, direct) {
4136
+ if (direct) {
4137
+ return then ? then(value) : value;
4138
+ }
4247
4139
 
4248
- var markAsSupported = function markAsSupported(name) {
4249
- var index = missingFeatureNamesCopy.indexOf(name);
4140
+ if (!value || !value.then) {
4141
+ value = Promise.resolve(value);
4142
+ }
4250
4143
 
4251
- if (index > -1) {
4252
- missingFeatureNamesCopy.splice(index, 1);
4253
- }
4254
- }; // When instrumentation CAN be handed by playwright
4255
- // https://playwright.dev/docs/api/class-chromiumcoverage#chromiumcoveragestartjscoverageoptions
4256
- // coverageHandledFromOutside is true and "transform-instrument" becomes non mandatory
4144
+ return then ? value.then(then) : value;
4145
+ }
4257
4146
 
4147
+ function _catch$2(body, recover) {
4148
+ try {
4149
+ var result = body();
4150
+ } catch (e) {
4151
+ return recover(e);
4152
+ }
4258
4153
 
4259
- if (coverageHandledFromOutside) {
4260
- markAsSupported("transform-instrument");
4154
+ if (result && result.then) {
4155
+ return result.then(void 0, recover);
4261
4156
  }
4262
4157
 
4263
- return _invoke(function () {
4264
- if (missingFeatureNames.includes("transform-import-assertions")) {
4265
- return _call$1(supportsJsonImportAssertions, function (jsonImportAssertions) {
4266
- featuresReport.jsonImportAssertions = jsonImportAssertions;
4267
- return _call$1(supportsCssImportAssertions, function (cssImportAssertions) {
4268
- featuresReport.cssImportAssertions = cssImportAssertions;
4158
+ return result;
4159
+ }
4269
4160
 
4270
- if (jsonImportAssertions && cssImportAssertions) {
4271
- markAsSupported("transform-import-assertions");
4272
- }
4273
- });
4274
- });
4275
- }
4161
+ var supportsTopLevelAwait = function supportsTopLevelAwait() {
4162
+ return _await$3(_catch$2(function () {
4163
+ return _await$3(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
4164
+ var supported = window.__jsenv_runtime_test_top_level_await__ === 42;
4165
+ delete window.__jsenv_runtime_test_top_level_await__;
4166
+ return supported;
4167
+ });
4276
4168
  }, function () {
4277
- if (missingFeatureNames.includes("new-stylesheet-as-jsenv-import")) {
4278
- var newStylesheet = supportsNewStylesheet();
4279
- featuresReport.newStylesheet = newStylesheet;
4280
- markAsSupported("new-stylesheet-as-jsenv-import");
4281
- }
4169
+ return false;
4170
+ }));
4171
+ };
4282
4172
 
4283
- return missingFeatureNamesCopy;
4284
- });
4285
- });
4173
+ function _await$2(value, then, direct) {
4174
+ if (direct) {
4175
+ return then ? then(value) : value;
4176
+ }
4286
4177
 
4287
- var detectSupportedFeatures = _async$1(function (_ref4) {
4288
- var featuresReport = _ref4.featuresReport,
4289
- failFastOnFeatureDetection = _ref4.failFastOnFeatureDetection,
4290
- inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML; // start testing importmap support first and not in paralell
4291
- // so that there is not module script loaded beore importmap is injected
4292
- // it would log an error in chrome console and return undefined
4178
+ if (!value || !value.then) {
4179
+ value = Promise.resolve(value);
4180
+ }
4293
4181
 
4294
- return _await(supportsImportmap({
4295
- // chrome supports inline but not remote importmap
4296
- // https://github.com/WICG/import-maps/issues/235
4297
- // at this stage we won't know if the html file will use
4298
- // an importmap or not and if that importmap is inline or specified with an src
4299
- // so we should test if browser support local and remote importmap.
4300
- // But there exploring server can inline importmap by transforming html
4301
- // and in that case we can test only the local importmap support
4302
- // so we test importmap support and the remote one
4303
- remote: !inlineImportMapIntoHTML
4304
- }), function (importmap) {
4305
- featuresReport.importmap = importmap;
4182
+ return then ? value.then(then) : value;
4183
+ }
4306
4184
 
4307
- if (!importmap && failFastOnFeatureDetection) {
4308
- return;
4309
- }
4185
+ function _catch$1(body, recover) {
4186
+ try {
4187
+ var result = body();
4188
+ } catch (e) {
4189
+ return recover(e);
4190
+ }
4310
4191
 
4311
- return _call$1(supportsDynamicImport, function (dynamicImport) {
4312
- featuresReport.dynamicImport = dynamicImport;
4192
+ if (result && result.then) {
4193
+ return result.then(void 0, recover);
4194
+ }
4313
4195
 
4314
- if (!dynamicImport && failFastOnFeatureDetection) {
4315
- return;
4316
- }
4196
+ return result;
4197
+ }
4198
+
4199
+ function _async$3(f) {
4200
+ return function () {
4201
+ for (var args = [], i = 0; i < arguments.length; i++) {
4202
+ args[i] = arguments[i];
4203
+ }
4204
+
4205
+ try {
4206
+ return Promise.resolve(f.apply(this, args));
4207
+ } catch (e) {
4208
+ return Promise.reject(e);
4209
+ }
4210
+ };
4211
+ }
4317
4212
 
4318
- return _call$1(supportsTopLevelAwait, function (topLevelAwait) {
4319
- featuresReport.topLevelAwait = topLevelAwait;
4213
+ var supportsJsonImportAssertions = _async$3(function () {
4214
+ var jsonBase64Url = asBase64Url("42", "application/json");
4215
+ var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\n export default data"));
4216
+ return _catch$1(function () {
4217
+ return _await$2(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4218
+ return _await$2(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
4219
+ var supported = namespace.default === 42;
4220
+ delete window.__jsenv_runtime_test_json_import_assertion__;
4221
+ return supported;
4320
4222
  });
4321
4223
  });
4224
+ }, function () {
4225
+ return false;
4322
4226
  });
4323
4227
  });
4324
4228
 
4325
- var supportsImportmap = _async$1(function () {
4326
- var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4327
- _ref5$remote = _ref5.remote,
4328
- remote = _ref5$remote === void 0 ? true : _ref5$remote;
4229
+ function _await$1(value, then, direct) {
4230
+ if (direct) {
4231
+ return then ? then(value) : value;
4232
+ }
4329
4233
 
4330
- var specifier = asBase64Url("export default false");
4331
- var importMap = {
4332
- imports: _defineProperty({}, specifier, asBase64Url("export default true"))
4333
- };
4334
- var importmapScript = document.createElement("script");
4335
- var importmapString = JSON.stringify(importMap, null, " ");
4336
- importmapScript.type = "importmap";
4234
+ if (!value || !value.then) {
4235
+ value = Promise.resolve(value);
4236
+ }
4337
4237
 
4338
- if (remote) {
4339
- importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
4340
- } else {
4341
- importmapScript.textContent = importmapString;
4238
+ return then ? value.then(then) : value;
4239
+ }
4240
+
4241
+ function _catch(body, recover) {
4242
+ try {
4243
+ var result = body();
4244
+ } catch (e) {
4245
+ return recover(e);
4342
4246
  }
4343
4247
 
4344
- document.body.appendChild(importmapScript);
4345
- return _catch(function () {
4346
- return _await(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
4347
- document.body.removeChild(importmapScript);
4348
- return window.__jsenv_runtime_test_importmap__;
4349
- });
4350
- }, function () {
4351
- document.body.removeChild(importmapScript);
4352
- return false;
4353
- });
4354
- });
4248
+ if (result && result.then) {
4249
+ return result.then(void 0, recover);
4250
+ }
4355
4251
 
4356
- var supportsDynamicImport = _async$1(function () {
4357
- var moduleSource = asBase64Url("export default 42");
4252
+ return result;
4253
+ }
4254
+
4255
+ function _async$2(f) {
4256
+ return function () {
4257
+ for (var args = [], i = 0; i < arguments.length; i++) {
4258
+ args[i] = arguments[i];
4259
+ }
4260
+
4261
+ try {
4262
+ return Promise.resolve(f.apply(this, args));
4263
+ } catch (e) {
4264
+ return Promise.reject(e);
4265
+ }
4266
+ };
4267
+ }
4268
+
4269
+ var supportsCssImportAssertions = _async$2(function () {
4270
+ var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
4271
+ var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\n export default css"));
4358
4272
  return _catch(function () {
4359
- return _await(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4360
- return _await(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
4361
- return namespace.default === 42;
4273
+ return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4274
+ return _await$1(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
4275
+ return namespace.default instanceof CSSStyleSheet;
4362
4276
  });
4363
4277
  });
4364
4278
  }, function () {
@@ -4376,74 +4290,140 @@ html[data-toolbar-visible] #toolbar-trigger {
4376
4290
  }
4377
4291
  };
4378
4292
 
4379
- var supportsTopLevelAwait = function supportsTopLevelAwait() {
4380
- return _await(_catch(function () {
4381
- return _await(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
4382
- return window.__jsenv_runtime_test_top_level_await__ === 42;
4383
- });
4384
- }, function () {
4385
- return false;
4386
- }));
4387
- }; // to execute in a browser devtools
4388
- // const featuresReport = {}
4389
- // await detectSupportedFeatures({ featuresReport, inlineImportMapIntoHTML: true })
4390
- // console.log(featuresReport)
4293
+ function _await(value, then, direct) {
4294
+ if (direct) {
4295
+ return then ? then(value) : value;
4296
+ }
4391
4297
 
4298
+ if (!value || !value.then) {
4299
+ value = Promise.resolve(value);
4300
+ }
4392
4301
 
4393
- var supportsJsonImportAssertions = _async$1(function () {
4394
- var jsonBase64Url = asBase64Url("42", "application/json");
4395
- var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\nexport default data"));
4396
- return _catch(function () {
4397
- return _await(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4398
- return _await(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
4399
- return namespace.default === 42;
4400
- });
4401
- });
4402
- }, function () {
4403
- return false;
4404
- });
4405
- });
4302
+ return then ? value.then(then) : value;
4303
+ }
4406
4304
 
4407
- var supportsCssImportAssertions = _async$1(function () {
4408
- var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
4409
- var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\nexport default css"));
4410
- return _catch(function () {
4411
- return _await(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
4412
- return _await(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
4413
- return namespace.default instanceof CSSStyleSheet;
4305
+ function _async$1(f) {
4306
+ return function () {
4307
+ for (var args = [], i = 0; i < arguments.length; i++) {
4308
+ args[i] = arguments[i];
4309
+ }
4310
+
4311
+ try {
4312
+ return Promise.resolve(f.apply(this, args));
4313
+ } catch (e) {
4314
+ return Promise.reject(e);
4315
+ }
4316
+ };
4317
+ }
4318
+
4319
+ function _call$1(body, then, direct) {
4320
+ if (direct) {
4321
+ return then ? then(body()) : body();
4322
+ }
4323
+
4324
+ try {
4325
+ var result = Promise.resolve(body());
4326
+ return then ? result.then(then) : result;
4327
+ } catch (e) {
4328
+ return Promise.reject(e);
4329
+ }
4330
+ }
4331
+
4332
+ var scanBrowserRuntimeFeatures = _async$1(function () {
4333
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4334
+ _ref$coverageHandledF = _ref.coverageHandledFromOutside,
4335
+ coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
4336
+ _ref$forceCompilation = _ref.forceCompilation,
4337
+ forceCompilation = _ref$forceCompilation === void 0 ? false : _ref$forceCompilation,
4338
+ _ref$forceSource = _ref.forceSource,
4339
+ forceSource = _ref$forceSource === void 0 ? false : _ref$forceSource;
4340
+
4341
+ var jsenvCompileProfileUrl = "/__jsenv_compile_profile__";
4342
+ return _await(fetchJson(jsenvCompileProfileUrl), function (_ref2) {
4343
+ var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
4344
+ inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML;
4345
+
4346
+ var _detectBrowser = detectBrowser(),
4347
+ name = _detectBrowser.name,
4348
+ version = _detectBrowser.version;
4349
+
4350
+ return _await(detectSupportedFeatures({
4351
+ coverageHandledFromOutside: coverageHandledFromOutside,
4352
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML
4353
+ }), function (featuresReport) {
4354
+ var runtimeReport = {
4355
+ env: {
4356
+ browser: true
4357
+ },
4358
+ name: name,
4359
+ version: version,
4360
+ featuresReport: featuresReport,
4361
+ forceSource: forceSource,
4362
+ forceCompilation: forceCompilation
4363
+ };
4364
+ return _await(fetchJson(jsenvCompileProfileUrl, {
4365
+ method: "POST",
4366
+ headers: {
4367
+ "content-type": "application/json"
4368
+ },
4369
+ body: JSON.stringify(runtimeReport)
4370
+ }), function (_ref3) {
4371
+ var compileProfile = _ref3.compileProfile,
4372
+ compileId = _ref3.compileId;
4373
+ return {
4374
+ jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4375
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML,
4376
+ compileProfile: compileProfile,
4377
+ compileId: compileId,
4378
+ runtimeReport: runtimeReport
4379
+ };
4414
4380
  });
4415
4381
  });
4416
- }, function () {
4417
- return false;
4418
4382
  });
4419
4383
  });
4420
4384
 
4421
- var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
4422
- var scriptModule = document.createElement("script");
4423
- scriptModule.type = "module";
4424
- var loadPromise = new Promise(function (resolve, reject) {
4425
- scriptModule.onload = function () {
4426
- document.body.removeChild(scriptModule);
4427
- resolve();
4428
- };
4385
+ var detectSupportedFeatures = _async$1(function (_ref4) {
4386
+ var coverageHandledFromOutside = _ref4.coverageHandledFromOutside,
4387
+ inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML;
4388
+ var featuresReport = {};
4389
+ featuresReport["import_http"] = true;
4390
+ featuresReport["coverage_js"] = coverageHandledFromOutside; // new CSSStyleSheet
4391
+
4392
+ featuresReport["new_stylesheet"] = supportsNewStylesheet(); // importmap
4393
+ // start testing importmap support first and not in paralell
4394
+ // so that there is not module script loaded beore importmap is injected
4395
+ // it would log an error in chrome console and return undefined
4429
4396
 
4430
- scriptModule.onerror = function () {
4431
- document.body.removeChild(scriptModule);
4432
- reject();
4433
- };
4397
+ return _await(supportsImportmap({
4398
+ // chrome supports inline but not remote importmap
4399
+ // https://github.com/WICG/import-maps/issues/235
4400
+ // at this stage we won't know if the html file will use
4401
+ // an importmap or not and if that importmap is inline or specified with an src
4402
+ // so we should test if browser support local and remote importmap.
4403
+ // But there exploring server can inline importmap by transforming html
4404
+ // and in that case we can test only the local importmap support
4405
+ // so we test importmap support and the remote one
4406
+ remote: !inlineImportMapIntoHTML
4407
+ }), function (_supportsImportmap) {
4408
+ featuresReport.importmap = _supportsImportmap; // dynamic import
4434
4409
 
4435
- document.body.appendChild(scriptModule);
4436
- });
4437
- scriptModule.src = asBase64Url(code);
4438
- return loadPromise;
4439
- };
4410
+ return _call$1(supportsDynamicImport, function (_supportsDynamicImpor) {
4411
+ featuresReport["import_dynamic"] = _supportsDynamicImpor; // top level await
4440
4412
 
4441
- var asBase64Url = function asBase64Url(text) {
4442
- var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
4443
- return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
4444
- }; // const cssImportAssertions = await supportsCssImportAssertions()
4445
- // console.log({ cssImportAssertions })
4413
+ return _call$1(supportsTopLevelAwait, function (_supportsTopLevelAwai) {
4414
+ featuresReport["top_level_await"] = _supportsTopLevelAwai; // import assertions
4446
4415
 
4416
+ return _call$1(supportsJsonImportAssertions, function (_supportsJsonImportAs) {
4417
+ featuresReport["import_assertion_type_json"] = _supportsJsonImportAs;
4418
+ return _call$1(supportsCssImportAssertions, function (_supportsCssImportAss) {
4419
+ featuresReport["import_assertion_type_css"] = _supportsCssImportAss;
4420
+ return featuresReport;
4421
+ });
4422
+ });
4423
+ });
4424
+ });
4425
+ });
4426
+ });
4447
4427
 
4448
4428
  var renderCompilationInToolbar = function renderCompilationInToolbar(_ref) {
4449
4429
  var compileGroup = _ref.compileGroup;
@@ -4452,14 +4432,12 @@ html[data-toolbar-visible] #toolbar-trigger {
4452
4432
  removeForceHideElement(browserSupportRootNode);
4453
4433
  removeForceHideElement(filesCompilationRootNode);
4454
4434
  scanBrowserRuntimeFeatures().then(function (_ref2) {
4455
- var canAvoidCompilation = _ref2.canAvoidCompilation,
4456
- featuresReport = _ref2.featuresReport,
4457
- customCompilerPatterns = _ref2.customCompilerPatterns,
4458
- missingFeatureNames = _ref2.missingFeatureNames,
4435
+ var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
4459
4436
  inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
4460
- outDirectoryRelativeUrl = _ref2.outDirectoryRelativeUrl,
4461
- compileId = _ref2.compileId;
4462
- var browserSupport = canAvoidCompilation ? inlineImportMapIntoHTML ? "partial" : "full" : "no";
4437
+ compileProfile = _ref2.compileProfile,
4438
+ compileId = _ref2.compileId,
4439
+ runtimeReport = _ref2.runtimeReport;
4440
+ var browserSupport = compileId ? "no" : inlineImportMapIntoHTML ? "partial" : "full";
4463
4441
  enableVariant(browserSupportRootNode, {
4464
4442
  browserSupport: browserSupport
4465
4443
  });
@@ -4467,57 +4445,60 @@ html[data-toolbar-visible] #toolbar-trigger {
4467
4445
  if (browserSupport === "no") {
4468
4446
  browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4469
4447
  // eslint-disable-next-line no-alert
4470
- window.alert("Source files needs to be compiled to be executable in this browser because: ".concat(getBrowserSupportMessage({
4471
- missingOnly: true,
4472
- featuresReport: featuresReport,
4473
- customCompilerPatterns: customCompilerPatterns,
4474
- missingFeatureNames: missingFeatureNames,
4475
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
4448
+ window.alert("Source files needs to be compiled to be executable in this browser because: ".concat(listWhatIsMissing({
4449
+ compileProfile: compileProfile
4476
4450
  })));
4477
4451
  };
4478
4452
  } else if (browserSupport === "partial") {
4479
4453
  browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4480
4454
  // eslint-disable-next-line no-alert
4481
- window.alert("Source files (except html) can be executed directly in this browser because: ".concat(getBrowserSupportMessage({
4482
- featuresReport: featuresReport,
4483
- customCompilerPatterns: customCompilerPatterns,
4484
- missingFeatureNames: missingFeatureNames,
4455
+ window.alert("Source files (except html) can be executed directly in this browser because: ".concat(listWhatIsSupported({
4485
4456
  inlineImportMapIntoHTML: inlineImportMapIntoHTML
4486
4457
  })));
4487
4458
  };
4488
4459
  } else if (browserSupport === "full") {
4489
4460
  browserSupportRootNode.querySelector("a.browser_support_read_more_link").onclick = function () {
4490
4461
  // eslint-disable-next-line no-alert
4491
- window.alert("Source files can be executed directly in this browser because: ".concat(getBrowserSupportMessage({
4492
- featuresReport: featuresReport,
4493
- customCompilerPatterns: customCompilerPatterns,
4494
- missingFeatureNames: missingFeatureNames,
4462
+ window.alert("Source files can be executed directly in this browser because: ".concat(listWhatIsSupported({
4495
4463
  inlineImportMapIntoHTML: inlineImportMapIntoHTML
4496
4464
  })));
4497
4465
  };
4498
4466
  }
4499
4467
 
4500
- var filesCompilation = compileGroup.compileId ? "yes" : inlineImportMapIntoHTML ? "html_only" : "no";
4468
+ var actualCompileId = compileGroup.compileId;
4469
+ var expectedCompiledId = compileId;
4470
+ var shouldSwitchCompileId = expectedCompiledId && actualCompileId && actualCompileId !== expectedCompiledId;
4471
+ var shouldCompile = !actualCompileId && browserSupport === "no";
4472
+ var filesCompilation = shouldSwitchCompileId ? "mismatch" : actualCompileId ? "yes" : inlineImportMapIntoHTML ? "html_only" : "no";
4473
+ var hasWarning = shouldCompile || shouldSwitchCompileId;
4501
4474
  enableVariant(filesCompilationRootNode, {
4502
4475
  filesCompilation: filesCompilation,
4503
- compiled: compileGroup.compileId ? "yes" : "no"
4476
+ compilation_link: shouldSwitchCompileId ? "mismatch" : actualCompileId ? "source" : "compiled"
4504
4477
  });
4505
4478
 
4506
- filesCompilationRootNode.querySelector("a.go_to_source_link").onclick = function () {
4507
- window.parent.location = "/".concat(compileGroup.fileRelativeUrl);
4479
+ if (filesCompilation === "yes") {
4480
+ document.querySelector(".files_compilation_text").innerHTML = "Files shown are compiled for ".concat(runtimeReport.name, "@").concat(runtimeReport.version);
4481
+ }
4482
+
4483
+ filesCompilationRootNode.querySelector("a.link_to_source_files").onclick = function () {
4484
+ window.parent.location.href = "/".concat(compileGroup.fileRelativeUrl);
4508
4485
  };
4509
4486
 
4510
- filesCompilationRootNode.querySelector("a.go_to_compiled_link").onclick = function () {
4511
- window.parent.location = "/".concat(outDirectoryRelativeUrl).concat(compileId, "/").concat(compileGroup.fileRelativeUrl);
4487
+ filesCompilationRootNode.querySelector("a.link_to_compiled_files").onclick = function () {
4488
+ window.parent.location.href = "/".concat(jsenvDirectoryRelativeUrl).concat(compileId, "/").concat(compileGroup.fileRelativeUrl);
4512
4489
  };
4513
4490
 
4514
- var shouldCompile = filesCompilation !== "yes" && browserSupport === "no";
4491
+ filesCompilationRootNode.querySelector("a.link_to_appropriate_files").onclick = function () {
4492
+ window.parent.location.href = "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl);
4493
+ };
4515
4494
 
4516
- if (shouldCompile) {
4495
+ if (hasWarning) {
4496
+ enableWarningStyle();
4517
4497
  document.querySelector(".files_compilation_text").setAttribute("data-warning", "");
4518
4498
  document.querySelector(".browser_support_text").setAttribute("data-warning", "");
4519
4499
  document.querySelector("#settings-button").setAttribute("data-warning", "");
4520
4500
  } else {
4501
+ disableWarningStyle();
4521
4502
  document.querySelector(".files_compilation_text").removeAttribute("data-warning");
4522
4503
  document.querySelector(".browser_support_text").removeAttribute("data-warning");
4523
4504
  document.querySelector("#settings-button").removeAttribute("data-warning");
@@ -4525,56 +4506,54 @@ html[data-toolbar-visible] #toolbar-trigger {
4525
4506
  });
4526
4507
  };
4527
4508
 
4528
- var getBrowserSupportMessage = function getBrowserSupportMessage(_ref3) {
4529
- var missingOnly = _ref3.missingOnly,
4530
- featuresReport = _ref3.featuresReport,
4531
- customCompilerPatterns = _ref3.customCompilerPatterns,
4532
- missingFeatureNames = _ref3.missingFeatureNames,
4533
- inlineImportMapIntoHTML = _ref3.inlineImportMapIntoHTML;
4509
+ var listWhatIsSupported = function listWhatIsSupported(_ref3) {
4510
+ var inlineImportMapIntoHTML = _ref3.inlineImportMapIntoHTML;
4534
4511
  var parts = [];
4535
4512
 
4536
- if (featuresReport.importmap) {
4537
- if (!missingOnly) {
4538
- if (inlineImportMapIntoHTML) {
4539
- parts.push("importmaps are supported (only when inlined in html files)");
4540
- } else {
4541
- parts.push("importmaps are supported");
4542
- }
4543
- }
4513
+ if (inlineImportMapIntoHTML) {
4514
+ parts.push("importmaps are supported (only when inlined in html files)");
4544
4515
  } else {
4516
+ parts.push("importmaps are supported");
4517
+ }
4518
+
4519
+ parts.push("dynamic imports are supported");
4520
+ parts.push("top level await is supported");
4521
+ parts.push("all features are natively supported");
4522
+ return "\n- ".concat(parts.join("\n- "));
4523
+ };
4524
+
4525
+ var listWhatIsMissing = function listWhatIsMissing(_ref4) {
4526
+ var compileProfile = _ref4.compileProfile;
4527
+ var parts = [];
4528
+ var missingFeatures = compileProfile.missingFeatures;
4529
+
4530
+ if (missingFeatures.importmap) {
4545
4531
  parts.push("importmaps are not supported");
4546
4532
  }
4547
4533
 
4548
- if (featuresReport.dynamicImport) {
4549
- if (!missingOnly) {
4550
- parts.push("dynamic imports are supported");
4551
- }
4552
- } else {
4534
+ if (missingFeatures.dynamicImport) {
4553
4535
  parts.push("dynamic imports are not supported");
4554
4536
  }
4555
4537
 
4556
- if (featuresReport.topLevelAwait) {
4557
- if (!missingOnly) {
4558
- parts.push("top level await is supported");
4559
- }
4560
- } else {
4538
+ if (missingFeatures.topLevelAwait) {
4561
4539
  parts.push("top level await is not supported");
4562
4540
  }
4563
4541
 
4542
+ var missingFeatureNames = Object.keys(missingFeatures).filter(function (name) {
4543
+ return name !== "importmap" && name !== "dynamicImport" && name !== "topLevelAwait" && name !== "custom_compiler_patterns";
4544
+ });
4564
4545
  var missingFeatureCount = missingFeatureNames.length;
4565
4546
 
4566
- if (missingFeatureCount === 0) {
4567
- if (!missingOnly) {
4568
- parts.push("all features are natively supported");
4569
- }
4570
- } else {
4547
+ if (missingFeatureCount > 0) {
4571
4548
  parts.push("".concat(missingFeatureCount, " features are missing: ").concat(missingFeatureNames));
4572
4549
  }
4573
4550
 
4574
- var customCompilerCount = customCompilerPatterns.length;
4575
- if (customCompilerCount === 0) ;else {
4576
- parts.push("".concat(customCompilerCount, " custom compilers enabled: ").concat(customCompilerPatterns));
4551
+ var custom_compiler_patterns = missingFeatures.custom_compiler_patterns;
4552
+
4553
+ if (custom_compiler_patterns) {
4554
+ parts.push("".concat(custom_compiler_patterns.length, " custom compilers enabled: ").concat(custom_compiler_patterns));
4577
4555
  }
4556
+
4578
4557
  return "\n- ".concat(parts.join("\n- "));
4579
4558
  };
4580
4559
 
@@ -4784,11 +4763,11 @@ html[data-toolbar-visible] #toolbar-trigger {
4784
4763
  var compileServerOrigin = window.parent.location.origin; // this should not block the whole toolbar rendering + interactivity
4785
4764
 
4786
4765
  return _call(fetchExploringJson, function (exploringConfig) {
4787
- var outDirectoryRelativeUrl = exploringConfig.outDirectoryRelativeUrl,
4766
+ var jsenvDirectoryRelativeUrl = exploringConfig.jsenvDirectoryRelativeUrl,
4788
4767
  livereloading = exploringConfig.livereloading;
4789
4768
  var compileGroup = getCompileGroup({
4790
4769
  executedFileCompiledUrl: executedFileCompiledUrl,
4791
- outDirectoryRelativeUrl: outDirectoryRelativeUrl,
4770
+ jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4792
4771
  compileServerOrigin: compileServerOrigin
4793
4772
  });
4794
4773
  var executedFileRelativeUrl = compileGroup.fileRelativeUrl;
@@ -4930,9 +4909,9 @@ html[data-toolbar-visible] #toolbar-trigger {
4930
4909
 
4931
4910
  var getCompileGroup = function getCompileGroup(_ref3) {
4932
4911
  var executedFileCompiledUrl = _ref3.executedFileCompiledUrl,
4933
- outDirectoryRelativeUrl = _ref3.outDirectoryRelativeUrl,
4912
+ jsenvDirectoryRelativeUrl = _ref3.jsenvDirectoryRelativeUrl,
4934
4913
  compileServerOrigin = _ref3.compileServerOrigin;
4935
- var outDirectoryServerUrl = String(new URL(outDirectoryRelativeUrl, compileServerOrigin));
4914
+ var outDirectoryServerUrl = String(new URL(jsenvDirectoryRelativeUrl, compileServerOrigin));
4936
4915
 
4937
4916
  if (urlIsInsideOf(executedFileCompiledUrl, outDirectoryServerUrl)) {
4938
4917
  var afterCompileDirectory = urlToRelativeUrl(executedFileCompiledUrl, outDirectoryServerUrl);
@@ -4940,14 +4919,14 @@ html[data-toolbar-visible] #toolbar-trigger {
4940
4919
  var fileRelativeUrl = afterCompileDirectory.slice(slashIndex + 1);
4941
4920
  return {
4942
4921
  fileRelativeUrl: fileRelativeUrl,
4943
- outDirectoryRelativeUrl: outDirectoryRelativeUrl,
4922
+ jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4944
4923
  compileId: afterCompileDirectory.slice(0, slashIndex)
4945
4924
  };
4946
4925
  }
4947
4926
 
4948
4927
  return {
4949
4928
  fileRelativeUrl: new URL(executedFileCompiledUrl).pathname.slice(1),
4950
- outDirectoryRelativeUrl: outDirectoryRelativeUrl,
4929
+ jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
4951
4930
  compileId: null
4952
4931
  };
4953
4932
  };
@@ -5009,7 +4988,7 @@ html[data-toolbar-visible] #toolbar-trigger {
5009
4988
  };
5010
4989
  });
5011
4990
 
5012
- //# sourceMappingURL=toolbar.main_6c1b3d82.js.map</script>
4991
+ //# sourceMappingURL=toolbar.main_86335f90.js.map</script>
5013
4992
 
5014
4993
 
5015
4994
  </body></html>