@jsenv/core 25.2.1 → 25.4.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 (112) 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_f4285042.js.map +343 -0
  7. package/dist/compile_proxy/{compile_proxy_8dfaee51.html → compile_proxy_ab528227.html} +358 -397
  8. package/dist/redirector/asset-manifest.json +2 -2
  9. package/dist/redirector/redirector.html__inline__12_404b8295.js.map +349 -0
  10. package/dist/redirector/{redirector_3e9a97b9.html → redirector_6df2620a.html} +369 -407
  11. package/dist/toolbar/asset-manifest.json +2 -2
  12. package/dist/toolbar/toolbar.main_279b3a68.js.map +764 -0
  13. package/dist/toolbar/{toolbar_361afb84.html → toolbar_0a91ca3b.html} +1509 -1583
  14. package/dist/toolbar_injector/asset-manifest.json +2 -2
  15. package/dist/toolbar_injector/{toolbar_injector_fac1e995.js → toolbar_injector_34f6ad8e.js} +18 -15
  16. package/dist/toolbar_injector/{toolbar_injector_fac1e995.js.map → toolbar_injector_34f6ad8e.js.map} +15 -15
  17. package/package.json +16 -12
  18. package/readme.md +54 -54
  19. package/src/buildProject.js +31 -26
  20. package/src/dev_server.js +111 -92
  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/transformJs.js +153 -23
  39. package/src/internal/compiling/jsenvCompilerForHtml.js +29 -32
  40. package/src/internal/compiling/jsenvCompilerForImportmap.js +2 -2
  41. package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -4
  42. package/src/internal/compiling/jsenv_directory/comparison_utils.js +24 -0
  43. package/src/internal/compiling/{compile-directory/compile-asset.js → jsenv_directory/compile_asset.js} +0 -0
  44. package/src/internal/compiling/jsenv_directory/compile_context.js +68 -0
  45. package/src/internal/compiling/jsenv_directory/compile_profile.js +218 -0
  46. package/src/internal/compiling/{compile-directory/createLockRegistry.js → jsenv_directory/file_lock_registry.js} +0 -0
  47. package/src/internal/compiling/{compile-directory/createLockRegistry.test.js → jsenv_directory/file_lock_registry.test.js} +2 -1
  48. package/src/internal/compiling/{compile-directory → jsenv_directory}/fs-optimized-for-cache.js +0 -0
  49. package/src/internal/compiling/{compile-directory → jsenv_directory}/getOrGenerateCompiledFile.js +2 -2
  50. package/src/internal/compiling/jsenv_directory/jsenv_directory.js +174 -0
  51. package/src/internal/compiling/{compile-directory → jsenv_directory}/updateMeta.js +1 -1
  52. package/src/internal/compiling/{compile-directory → jsenv_directory}/validateCache.js +0 -0
  53. package/src/internal/compiling/sse_service/sse_service.js +369 -0
  54. package/src/internal/compiling/startCompileServer.js +157 -804
  55. package/src/internal/compiling/transformResultToCompilationResult.js +2 -2
  56. package/src/internal/dev_server/exploring/exploring.js +10 -8
  57. package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +92 -78
  58. package/src/internal/dev_server/toolbar/settings/toolbar.settings.js +13 -0
  59. package/src/internal/dev_server/toolbar/toolbar.html +46 -16
  60. package/src/internal/dev_server/toolbar/toolbar.injector.js +17 -15
  61. package/src/internal/dev_server/toolbar/toolbar.main.js +12 -16
  62. package/src/internal/executing/executeConcurrently.js +1 -1
  63. package/src/internal/executing/executePlan.js +2 -3
  64. package/src/internal/{generateGroupMap → features}/babel_plugins_compatibility.js +8 -8
  65. package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +20 -0
  66. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +23 -0
  67. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +25 -0
  68. package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +37 -0
  69. package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +9 -0
  70. package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +14 -0
  71. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +89 -0
  72. package/src/internal/{browser_feature_detection → features/browser_feature_detection}/compile_proxy.html +1 -1
  73. package/src/internal/features/browser_feature_detection/execute_with_script_module.js +24 -0
  74. package/src/internal/features/features_compat_from_runtime.js +38 -0
  75. package/src/internal/features/features_compat_from_runtime_support.js +31 -0
  76. package/src/internal/{generateGroupMap → features}/features_compatibility.js +3 -3
  77. package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_dynamic_import.mjs +0 -0
  78. package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_top_level_await.mjs +0 -0
  79. package/src/internal/{node_feature_detection/nodeSupportsDynamicImport.js → features/node_feature_detection/node_feature_detect_dynamic_import.js} +0 -0
  80. package/src/internal/{node_feature_detection/nodeSupportsTopLevelAwait.js → features/node_feature_detection/node_feature_detect_top_level_await.js} +0 -0
  81. package/src/internal/features/node_feature_detection/node_feature_detection.js +66 -0
  82. package/src/internal/jsenv_remote_directory.js +1 -1
  83. package/src/internal/node_launcher/createControllableNodeProcess.js +4 -3
  84. package/src/internal/node_launcher/node_runtime_report.js +15 -9
  85. package/src/internal/node_runtime/fetchSource.js +2 -4
  86. package/src/internal/node_runtime/node_execution_systemjs.js +2 -5
  87. package/src/internal/redirector/redirector.html +40 -0
  88. package/src/internal/{generateGroupMap/jsenvRuntimeSupport.js → runtime_support/jsenv_runtime_support.js} +0 -0
  89. package/src/internal/{generateGroupMap → runtime_support}/runtime_support.js +0 -0
  90. package/src/internal/url_conversion.js +12 -17
  91. package/src/launchNode.js +29 -41
  92. package/dist/compile_proxy/compile_proxy.html__inline__20_809f35f7.js.map +0 -392
  93. package/dist/redirector/redirector.html__inline__15_e391410e.js.map +0 -397
  94. package/dist/toolbar/toolbar.main_6c1b3d82.js.map +0 -802
  95. package/src/internal/CONSTANTS.js +0 -11
  96. package/src/internal/browser_feature_detection/browser_feature_detection.js +0 -274
  97. package/src/internal/compiling/js-compilation-service/jsenvTransform.js +0 -242
  98. package/src/internal/dev_server/redirector/redirector.html +0 -48
  99. package/src/internal/generateGroupMap/generateGroupMap.js +0 -65
  100. package/src/internal/generateGroupMap/one_runtime_compat.js +0 -38
  101. package/src/internal/generateGroupMap/runtime_compat.js +0 -34
  102. package/src/internal/generateGroupMap/runtime_compat_composition.js +0 -76
  103. package/src/internal/generateGroupMap/shake_babel_plugin_map.js +0 -21
  104. package/src/internal/integrity/integrity_algorithms.js +0 -26
  105. package/src/internal/integrity/integrity_parsing.js +0 -50
  106. package/src/internal/integrity/integrity_update.js +0 -23
  107. package/src/internal/integrity/integrity_validation.js +0 -49
  108. package/src/internal/node_feature_detection/node_feature_detection.js +0 -117
  109. package/src/internal/node_runtime/detectNode.js +0 -3
  110. package/src/internal/runtime/computeCompileIdFromGroupId.js +0 -30
  111. package/src/internal/runtime/resolveGroup.js +0 -13
  112. package/src/internal/runtime/resolveRuntimeGroup.js +0 -11
@@ -872,7 +872,7 @@
872
872
  <script type="systemjs-importmap">{
873
873
  "imports": {}
874
874
  }</script>
875
- <script>System.register("redirector.html__inline__15.js", [], function () {
875
+ <script>System.register("redirector.html__inline__12.js", [], function () {
876
876
  'use strict';
877
877
 
878
878
  return {
@@ -897,172 +897,6 @@
897
897
  return obj;
898
898
  };
899
899
 
900
- var createDetailedMessage = function createDetailedMessage(message) {
901
- var details = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
902
- var string = "".concat(message);
903
- Object.keys(details).forEach(function (key) {
904
- var value = details[key];
905
- string += "\n--- ".concat(key, " ---\n").concat(Array.isArray(value) ? value.join("\n") : value);
906
- });
907
- return string;
908
- };
909
-
910
- var COMPILE_ID_OTHERWISE = "otherwise";
911
-
912
- var computeCompileIdFromGroupId = function computeCompileIdFromGroupId(_ref) {
913
- var groupId = _ref.groupId,
914
- groupMap = _ref.groupMap;
915
-
916
- if (typeof groupId === "undefined") {
917
- if (COMPILE_ID_OTHERWISE in groupMap) {
918
- return COMPILE_ID_OTHERWISE;
919
- }
920
-
921
- var keys = Object.keys(groupMap);
922
-
923
- if (keys.length === 1) {
924
- return keys[0];
925
- }
926
-
927
- throw new Error(createUnexpectedGroupIdMessage({
928
- groupMap: groupMap
929
- }));
930
- }
931
-
932
- if (groupId in groupMap === false) {
933
- throw new Error(createUnexpectedGroupIdMessage({
934
- groupId: groupId,
935
- groupMap: groupMap
936
- }));
937
- }
938
-
939
- return groupId;
940
- };
941
-
942
- var createUnexpectedGroupIdMessage = function createUnexpectedGroupIdMessage(_ref2) {
943
- var _createDetailedMessag;
944
-
945
- var compileId = _ref2.compileId,
946
- groupMap = _ref2.groupMap;
947
- return createDetailedMessage("unexpected groupId.", (_createDetailedMessag = {}, _defineProperty(_createDetailedMessag, "expected compiled id", Object.keys(groupMap)), _defineProperty(_createDetailedMessag, "received compile id", compileId), _createDetailedMessag));
948
- };
949
-
950
- var valueToVersion = function valueToVersion(value) {
951
- if (typeof value === "number") {
952
- return numberToVersion(value);
953
- }
954
-
955
- if (typeof value === "string") {
956
- return stringToVersion(value);
957
- }
958
-
959
- throw new TypeError("version must be a number or a string, got ".concat(value));
960
- };
961
-
962
- var numberToVersion = function numberToVersion(number) {
963
- return {
964
- major: number,
965
- minor: 0,
966
- patch: 0
967
- };
968
- };
969
-
970
- var stringToVersion = function stringToVersion(string) {
971
- if (string.indexOf(".") > -1) {
972
- var parts = string.split(".");
973
- return {
974
- major: Number(parts[0]),
975
- minor: parts[1] ? Number(parts[1]) : 0,
976
- patch: parts[2] ? Number(parts[2]) : 0
977
- };
978
- }
979
-
980
- if (isNaN(string)) {
981
- return {
982
- major: 0,
983
- minor: 0,
984
- patch: 0
985
- };
986
- }
987
-
988
- return {
989
- major: Number(string),
990
- minor: 0,
991
- patch: 0
992
- };
993
- };
994
-
995
- var versionCompare = function versionCompare(versionA, versionB) {
996
- var semanticVersionA = valueToVersion(versionA);
997
- var semanticVersionB = valueToVersion(versionB);
998
- var majorDiff = semanticVersionA.major - semanticVersionB.major;
999
-
1000
- if (majorDiff > 0) {
1001
- return majorDiff;
1002
- }
1003
-
1004
- if (majorDiff < 0) {
1005
- return majorDiff;
1006
- }
1007
-
1008
- var minorDiff = semanticVersionA.minor - semanticVersionB.minor;
1009
-
1010
- if (minorDiff > 0) {
1011
- return minorDiff;
1012
- }
1013
-
1014
- if (minorDiff < 0) {
1015
- return minorDiff;
1016
- }
1017
-
1018
- var patchDiff = semanticVersionA.patch - semanticVersionB.patch;
1019
-
1020
- if (patchDiff > 0) {
1021
- return patchDiff;
1022
- }
1023
-
1024
- if (patchDiff < 0) {
1025
- return patchDiff;
1026
- }
1027
-
1028
- return 0;
1029
- };
1030
-
1031
- var versionIsBelow = function versionIsBelow(versionSupposedBelow, versionSupposedAbove) {
1032
- return versionCompare(versionSupposedBelow, versionSupposedAbove) < 0;
1033
- };
1034
-
1035
- var findHighestVersion = function findHighestVersion() {
1036
- for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
1037
- values[_key] = arguments[_key];
1038
- }
1039
-
1040
- if (values.length === 0) throw new Error("missing argument");
1041
- return values.reduce(function (highestVersion, value) {
1042
- if (versionIsBelow(highestVersion, value)) {
1043
- return value;
1044
- }
1045
-
1046
- return highestVersion;
1047
- });
1048
- };
1049
-
1050
- var resolveGroup = function resolveGroup(_ref, groupMap) {
1051
- var name = _ref.name,
1052
- version = _ref.version;
1053
- return Object.keys(groupMap).find(function (compileIdCandidate) {
1054
- var minRuntimeVersions = groupMap[compileIdCandidate].minRuntimeVersions;
1055
- var versionForGroup = minRuntimeVersions[name];
1056
-
1057
- if (!versionForGroup) {
1058
- return false;
1059
- }
1060
-
1061
- var highestVersion = findHighestVersion(version, versionForGroup);
1062
- return highestVersion === version;
1063
- });
1064
- };
1065
-
1066
900
  function ownKeys(object, enumerableOnly) {
1067
901
  var keys = Object.keys(object);
1068
902
 
@@ -1149,7 +983,7 @@
1149
983
  /* eslint-env browser */
1150
984
 
1151
985
 
1152
- function _await$4(value, then, direct) {
986
+ function _await$9(value, then, direct) {
1153
987
  if (direct) {
1154
988
  return then ? then(value) : value;
1155
989
  }
@@ -1161,7 +995,7 @@
1161
995
  return then ? value.then(then) : value;
1162
996
  }
1163
997
 
1164
- function _async$4(f) {
998
+ function _async$8(f) {
1165
999
  return function () {
1166
1000
  for (var args = [], i = 0; i < arguments.length; i++) {
1167
1001
  args[i] = arguments[i];
@@ -1188,7 +1022,7 @@
1188
1022
  }
1189
1023
  }
1190
1024
 
1191
- var fetchUsingXHR = _async$4(function (url) {
1025
+ var fetchUsingXHR = _async$8(function (url) {
1192
1026
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1193
1027
  signal = _ref.signal,
1194
1028
  _ref$method = _ref.method,
@@ -1272,7 +1106,7 @@
1272
1106
  }
1273
1107
 
1274
1108
  xhr.send(body);
1275
- return _await$4(headersPromise, function () {
1109
+ return _await$9(headersPromise, function () {
1276
1110
  // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
1277
1111
  var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
1278
1112
  var responseStatus = xhr.status;
@@ -1280,7 +1114,7 @@
1280
1114
  var responseHeaders = getHeadersFromXHR(xhr);
1281
1115
 
1282
1116
  var readBody = function readBody() {
1283
- return _await$4(bodyPromise, function () {
1117
+ return _await$9(bodyPromise, function () {
1284
1118
  var status = xhr.status; // in Chrome on file:/// URLs, status is 0
1285
1119
 
1286
1120
  if (status === 0) {
@@ -1316,7 +1150,7 @@
1316
1150
  return _call$1(text, JSON.parse);
1317
1151
  };
1318
1152
 
1319
- var blob = _async$4(function () {
1153
+ var blob = _async$8(function () {
1320
1154
  if (!hasBlob) {
1321
1155
  throw new Error("blob not supported");
1322
1156
  }
@@ -1353,7 +1187,7 @@
1353
1187
  });
1354
1188
  };
1355
1189
 
1356
- var formData = _async$4(function () {
1190
+ var formData = _async$8(function () {
1357
1191
  if (!hasFormData) {
1358
1192
  throw new Error("formData not supported");
1359
1193
  }
@@ -1534,7 +1368,7 @@
1534
1368
  return form;
1535
1369
  };
1536
1370
 
1537
- var blobToArrayBuffer = _async$4(function (blob) {
1371
+ var blobToArrayBuffer = _async$8(function (blob) {
1538
1372
  var reader = new FileReader();
1539
1373
  var promise = fileReaderReady(reader);
1540
1374
  reader.readAsArrayBuffer(blob);
@@ -1585,7 +1419,7 @@
1585
1419
 
1586
1420
  var _excluded = ["mode"];
1587
1421
 
1588
- function _await$3(value, then, direct) {
1422
+ function _await$8(value, then, direct) {
1589
1423
  if (direct) {
1590
1424
  return then ? then(value) : value;
1591
1425
  }
@@ -1597,7 +1431,7 @@
1597
1431
  return then ? value.then(then) : value;
1598
1432
  }
1599
1433
 
1600
- function _async$3(f) {
1434
+ function _async$7(f) {
1601
1435
  return function () {
1602
1436
  for (var args = [], i = 0; i < arguments.length; i++) {
1603
1437
  args[i] = arguments[i];
@@ -1611,14 +1445,14 @@
1611
1445
  };
1612
1446
  }
1613
1447
 
1614
- var fetchNative = _async$3(function (url) {
1448
+ var fetchNative = _async$7(function (url) {
1615
1449
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1616
1450
 
1617
1451
  var _ref$mode = _ref.mode,
1618
1452
  mode = _ref$mode === void 0 ? "cors" : _ref$mode,
1619
1453
  options = _objectWithoutProperties(_ref, _excluded);
1620
1454
 
1621
- return _await$3(window.fetch(url, _objectSpread2({
1455
+ return _await$8(window.fetch(url, _objectSpread2({
1622
1456
  mode: mode
1623
1457
  }, options)), function (response) {
1624
1458
  return {
@@ -1655,7 +1489,7 @@
1655
1489
 
1656
1490
  var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
1657
1491
 
1658
- function _await$2(value, then, direct) {
1492
+ function _await$7(value, then, direct) {
1659
1493
  if (direct) {
1660
1494
  return then ? then(value) : value;
1661
1495
  }
@@ -1667,7 +1501,7 @@
1667
1501
  return then ? value.then(then) : value;
1668
1502
  }
1669
1503
 
1670
- function _async$2(f) {
1504
+ function _async$6(f) {
1671
1505
  return function () {
1672
1506
  for (var args = [], i = 0; i < arguments.length; i++) {
1673
1507
  args[i] = arguments[i];
@@ -1681,10 +1515,10 @@
1681
1515
  };
1682
1516
  }
1683
1517
 
1684
- var fetchJson = _async$2(function (url) {
1518
+ var fetchJson = _async$6(function (url) {
1685
1519
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1686
- return _await$2(fetchUrl(url, options), function (response) {
1687
- return _await$2(response.json());
1520
+ return _await$7(fetchUrl(url, options), function (response) {
1521
+ return _await$7(response.json());
1688
1522
  });
1689
1523
  });
1690
1524
  /*
@@ -1946,7 +1780,32 @@
1946
1780
  return version;
1947
1781
  };
1948
1782
 
1949
- function _await$1(value, then, direct) {
1783
+ var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
1784
+ var scriptModule = document.createElement("script");
1785
+ scriptModule.type = "module";
1786
+ var loadPromise = new Promise(function (resolve, reject) {
1787
+ scriptModule.onload = function () {
1788
+ document.body.removeChild(scriptModule);
1789
+ resolve();
1790
+ };
1791
+
1792
+ scriptModule.onerror = function () {
1793
+ document.body.removeChild(scriptModule);
1794
+ reject();
1795
+ };
1796
+
1797
+ document.body.appendChild(scriptModule);
1798
+ });
1799
+ scriptModule.src = asBase64Url(code);
1800
+ return loadPromise;
1801
+ };
1802
+
1803
+ var asBase64Url = function asBase64Url(text) {
1804
+ var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
1805
+ return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
1806
+ };
1807
+
1808
+ function _await$6(value, then, direct) {
1950
1809
  if (direct) {
1951
1810
  return then ? then(value) : value;
1952
1811
  }
@@ -1958,7 +1817,21 @@
1958
1817
  return then ? value.then(then) : value;
1959
1818
  }
1960
1819
 
1961
- function _async$1(f) {
1820
+ function _catch$4(body, recover) {
1821
+ try {
1822
+ var result = body();
1823
+ } catch (e) {
1824
+ return recover(e);
1825
+ }
1826
+
1827
+ if (result && result.then) {
1828
+ return result.then(void 0, recover);
1829
+ }
1830
+
1831
+ return result;
1832
+ }
1833
+
1834
+ function _async$5(f) {
1962
1835
  return function () {
1963
1836
  for (var args = [], i = 0; i < arguments.length; i++) {
1964
1837
  args[i] = arguments[i];
@@ -1972,30 +1845,52 @@
1972
1845
  };
1973
1846
  }
1974
1847
 
1975
- function _call(body, then, direct) {
1976
- if (direct) {
1977
- return then ? then(body()) : body();
1978
- }
1848
+ var supportsImportmap = _async$5(function () {
1849
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1850
+ _ref$remote = _ref.remote,
1851
+ remote = _ref$remote === void 0 ? true : _ref$remote;
1979
1852
 
1980
- try {
1981
- var result = Promise.resolve(body());
1982
- return then ? result.then(then) : result;
1983
- } catch (e) {
1984
- return Promise.reject(e);
1853
+ var specifier = asBase64Url("export default false");
1854
+ var importMap = {
1855
+ imports: _defineProperty({}, specifier, asBase64Url("export default true"))
1856
+ };
1857
+ var importmapScript = document.createElement("script");
1858
+ var importmapString = JSON.stringify(importMap, null, " ");
1859
+ importmapScript.type = "importmap";
1860
+
1861
+ if (remote) {
1862
+ importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
1863
+ } else {
1864
+ importmapScript.textContent = importmapString;
1985
1865
  }
1986
- }
1987
1866
 
1988
- function _invoke(body, then) {
1989
- var result = body();
1867
+ document.body.appendChild(importmapScript);
1868
+ return _catch$4(function () {
1869
+ return _await$6(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
1870
+ document.body.removeChild(importmapScript);
1871
+ var supported = window.__jsenv_runtime_test_importmap__;
1872
+ delete window.__jsenv_runtime_test_importmap__;
1873
+ return supported;
1874
+ });
1875
+ }, function () {
1876
+ document.body.removeChild(importmapScript);
1877
+ return false;
1878
+ });
1879
+ });
1990
1880
 
1991
- if (result && result.then) {
1992
- return result.then(then);
1881
+ function _await$5(value, then, direct) {
1882
+ if (direct) {
1883
+ return then ? then(value) : value;
1884
+ }
1885
+
1886
+ if (!value || !value.then) {
1887
+ value = Promise.resolve(value);
1993
1888
  }
1994
1889
 
1995
- return then(result);
1890
+ return then ? value.then(then) : value;
1996
1891
  }
1997
1892
 
1998
- function _catch(body, recover) {
1893
+ function _catch$3(body, recover) {
1999
1894
  try {
2000
1895
  var result = body();
2001
1896
  } catch (e) {
@@ -2009,177 +1904,175 @@
2009
1904
  return result;
2010
1905
  }
2011
1906
 
2012
- var scanBrowserRuntimeFeatures = _async$1(function () {
2013
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2014
- _ref$coverageHandledF = _ref.coverageHandledFromOutside,
2015
- coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
2016
- _ref$failFastOnFeatur = _ref.failFastOnFeatureDetection,
2017
- failFastOnFeatureDetection = _ref$failFastOnFeatur === void 0 ? false : _ref$failFastOnFeatur;
1907
+ function _async$4(f) {
1908
+ return function () {
1909
+ for (var args = [], i = 0; i < arguments.length; i++) {
1910
+ args[i] = arguments[i];
1911
+ }
2018
1912
 
2019
- return _await$1(fetchJson("/.jsenv/__compile_server_meta__.json"), function (_ref2) {
2020
- var outDirectoryRelativeUrl = _ref2.outDirectoryRelativeUrl,
2021
- inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
2022
- customCompilerPatterns = _ref2.customCompilerPatterns,
2023
- compileServerGroupMap = _ref2.compileServerGroupMap;
2024
- var browser = detectBrowser();
2025
- var compileId = computeCompileIdFromGroupId({
2026
- groupId: resolveGroup(browser, compileServerGroupMap),
2027
- groupMap: compileServerGroupMap
2028
- });
2029
- var groupInfo = compileServerGroupMap[compileId];
2030
- var featuresReport = {
2031
- importmap: undefined,
2032
- dynamicImport: undefined,
2033
- topLevelAwait: undefined,
2034
- jsonImportAssertions: undefined,
2035
- cssImportAssertions: undefined,
2036
- newStylesheet: undefined
2037
- };
2038
- return _await$1(detectSupportedFeatures({
2039
- featuresReport: featuresReport,
2040
- failFastOnFeatureDetection: failFastOnFeatureDetection,
2041
- inlineImportMapIntoHTML: inlineImportMapIntoHTML
2042
- }), function () {
2043
- return _await$1(adjustMissingFeatureNames(groupInfo, {
2044
- featuresReport: featuresReport,
2045
- coverageHandledFromOutside: coverageHandledFromOutside
2046
- }), function (missingFeatureNames) {
2047
- var canAvoidCompilation = customCompilerPatterns.length === 0 && missingFeatureNames.length === 0 && featuresReport.importmap && featuresReport.dynamicImport && featuresReport.topLevelAwait;
2048
- return {
2049
- canAvoidCompilation: canAvoidCompilation,
2050
- featuresReport: featuresReport,
2051
- customCompilerPatterns: customCompilerPatterns,
2052
- missingFeatureNames: missingFeatureNames,
2053
- inlineImportMapIntoHTML: inlineImportMapIntoHTML,
2054
- outDirectoryRelativeUrl: outDirectoryRelativeUrl,
2055
- compileId: compileId,
2056
- browser: browser
2057
- };
1913
+ try {
1914
+ return Promise.resolve(f.apply(this, args));
1915
+ } catch (e) {
1916
+ return Promise.reject(e);
1917
+ }
1918
+ };
1919
+ }
1920
+
1921
+ var supportsDynamicImport = _async$4(function () {
1922
+ var moduleSource = asBase64Url("export default 42");
1923
+ return _catch$3(function () {
1924
+ return _await$5(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
1925
+ return _await$5(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
1926
+ delete window.__jsenv_runtime_test_dynamic_import__;
1927
+ return namespace.default === 42;
2058
1928
  });
2059
1929
  });
1930
+ }, function () {
1931
+ return false;
2060
1932
  });
2061
1933
  });
2062
1934
 
2063
- var adjustMissingFeatureNames = _async$1(function (groupInfo, _ref3) {
2064
- var featuresReport = _ref3.featuresReport,
2065
- coverageHandledFromOutside = _ref3.coverageHandledFromOutside;
2066
- var missingFeatureNames = groupInfo.missingFeatureNames;
2067
- var missingFeatureNamesCopy = missingFeatureNames.slice();
1935
+ function _await$4(value, then, direct) {
1936
+ if (direct) {
1937
+ return then ? then(value) : value;
1938
+ }
2068
1939
 
2069
- var markAsSupported = function markAsSupported(name) {
2070
- var index = missingFeatureNamesCopy.indexOf(name);
1940
+ if (!value || !value.then) {
1941
+ value = Promise.resolve(value);
1942
+ }
2071
1943
 
2072
- if (index > -1) {
2073
- missingFeatureNamesCopy.splice(index, 1);
2074
- }
2075
- }; // When instrumentation CAN be handed by playwright
2076
- // https://playwright.dev/docs/api/class-chromiumcoverage#chromiumcoveragestartjscoverageoptions
2077
- // coverageHandledFromOutside is true and "transform-instrument" becomes non mandatory
1944
+ return then ? value.then(then) : value;
1945
+ }
2078
1946
 
1947
+ function _catch$2(body, recover) {
1948
+ try {
1949
+ var result = body();
1950
+ } catch (e) {
1951
+ return recover(e);
1952
+ }
2079
1953
 
2080
- if (coverageHandledFromOutside) {
2081
- markAsSupported("transform-instrument");
1954
+ if (result && result.then) {
1955
+ return result.then(void 0, recover);
2082
1956
  }
2083
1957
 
2084
- return _invoke(function () {
2085
- if (missingFeatureNames.includes("transform-import-assertions")) {
2086
- return _call(supportsJsonImportAssertions, function (jsonImportAssertions) {
2087
- featuresReport.jsonImportAssertions = jsonImportAssertions;
2088
- return _call(supportsCssImportAssertions, function (cssImportAssertions) {
2089
- featuresReport.cssImportAssertions = cssImportAssertions;
1958
+ return result;
1959
+ }
2090
1960
 
2091
- if (jsonImportAssertions && cssImportAssertions) {
2092
- markAsSupported("transform-import-assertions");
2093
- }
2094
- });
2095
- });
2096
- }
1961
+ var supportsTopLevelAwait = function supportsTopLevelAwait() {
1962
+ return _await$4(_catch$2(function () {
1963
+ return _await$4(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
1964
+ var supported = window.__jsenv_runtime_test_top_level_await__ === 42;
1965
+ delete window.__jsenv_runtime_test_top_level_await__;
1966
+ return supported;
1967
+ });
2097
1968
  }, function () {
2098
- if (missingFeatureNames.includes("new-stylesheet-as-jsenv-import")) {
2099
- var newStylesheet = supportsNewStylesheet();
2100
- featuresReport.newStylesheet = newStylesheet;
2101
- markAsSupported("new-stylesheet-as-jsenv-import");
2102
- }
1969
+ return false;
1970
+ }));
1971
+ };
2103
1972
 
2104
- return missingFeatureNamesCopy;
2105
- });
2106
- });
1973
+ function _await$3(value, then, direct) {
1974
+ if (direct) {
1975
+ return then ? then(value) : value;
1976
+ }
2107
1977
 
2108
- var detectSupportedFeatures = _async$1(function (_ref4) {
2109
- var featuresReport = _ref4.featuresReport,
2110
- failFastOnFeatureDetection = _ref4.failFastOnFeatureDetection,
2111
- inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML; // start testing importmap support first and not in paralell
2112
- // so that there is not module script loaded beore importmap is injected
2113
- // it would log an error in chrome console and return undefined
1978
+ if (!value || !value.then) {
1979
+ value = Promise.resolve(value);
1980
+ }
2114
1981
 
2115
- return _await$1(supportsImportmap({
2116
- // chrome supports inline but not remote importmap
2117
- // https://github.com/WICG/import-maps/issues/235
2118
- // at this stage we won't know if the html file will use
2119
- // an importmap or not and if that importmap is inline or specified with an src
2120
- // so we should test if browser support local and remote importmap.
2121
- // But there exploring server can inline importmap by transforming html
2122
- // and in that case we can test only the local importmap support
2123
- // so we test importmap support and the remote one
2124
- remote: !inlineImportMapIntoHTML
2125
- }), function (importmap) {
2126
- featuresReport.importmap = importmap;
1982
+ return then ? value.then(then) : value;
1983
+ }
2127
1984
 
2128
- if (!importmap && failFastOnFeatureDetection) {
2129
- return;
2130
- }
1985
+ function _catch$1(body, recover) {
1986
+ try {
1987
+ var result = body();
1988
+ } catch (e) {
1989
+ return recover(e);
1990
+ }
2131
1991
 
2132
- return _call(supportsDynamicImport, function (dynamicImport) {
2133
- featuresReport.dynamicImport = dynamicImport;
1992
+ if (result && result.then) {
1993
+ return result.then(void 0, recover);
1994
+ }
2134
1995
 
2135
- if (!dynamicImport && failFastOnFeatureDetection) {
2136
- return;
2137
- }
1996
+ return result;
1997
+ }
1998
+
1999
+ function _async$3(f) {
2000
+ return function () {
2001
+ for (var args = [], i = 0; i < arguments.length; i++) {
2002
+ args[i] = arguments[i];
2003
+ }
2138
2004
 
2139
- return _call(supportsTopLevelAwait, function (topLevelAwait) {
2140
- featuresReport.topLevelAwait = topLevelAwait;
2005
+ try {
2006
+ return Promise.resolve(f.apply(this, args));
2007
+ } catch (e) {
2008
+ return Promise.reject(e);
2009
+ }
2010
+ };
2011
+ }
2012
+
2013
+ var supportsJsonImportAssertions = _async$3(function () {
2014
+ var jsonBase64Url = asBase64Url("42", "application/json");
2015
+ var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\n export default data"));
2016
+ return _catch$1(function () {
2017
+ return _await$3(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2018
+ return _await$3(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
2019
+ var supported = namespace.default === 42;
2020
+ delete window.__jsenv_runtime_test_json_import_assertion__;
2021
+ return supported;
2141
2022
  });
2142
2023
  });
2024
+ }, function () {
2025
+ return false;
2143
2026
  });
2144
2027
  });
2145
2028
 
2146
- var supportsImportmap = _async$1(function () {
2147
- var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2148
- _ref5$remote = _ref5.remote,
2149
- remote = _ref5$remote === void 0 ? true : _ref5$remote;
2029
+ function _await$2(value, then, direct) {
2030
+ if (direct) {
2031
+ return then ? then(value) : value;
2032
+ }
2033
+
2034
+ if (!value || !value.then) {
2035
+ value = Promise.resolve(value);
2036
+ }
2150
2037
 
2151
- var specifier = asBase64Url("export default false");
2152
- var importMap = {
2153
- imports: _defineProperty({}, specifier, asBase64Url("export default true"))
2154
- };
2155
- var importmapScript = document.createElement("script");
2156
- var importmapString = JSON.stringify(importMap, null, " ");
2157
- importmapScript.type = "importmap";
2038
+ return then ? value.then(then) : value;
2039
+ }
2158
2040
 
2159
- if (remote) {
2160
- importmapScript.src = "data:application/json;base64,".concat(window.btoa(importmapString));
2161
- } else {
2162
- importmapScript.textContent = importmapString;
2041
+ function _catch(body, recover) {
2042
+ try {
2043
+ var result = body();
2044
+ } catch (e) {
2045
+ return recover(e);
2163
2046
  }
2164
2047
 
2165
- document.body.appendChild(importmapScript);
2166
- return _catch(function () {
2167
- return _await$1(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
2168
- document.body.removeChild(importmapScript);
2169
- return window.__jsenv_runtime_test_importmap__;
2170
- });
2171
- }, function () {
2172
- document.body.removeChild(importmapScript);
2173
- return false;
2174
- });
2175
- });
2048
+ if (result && result.then) {
2049
+ return result.then(void 0, recover);
2050
+ }
2176
2051
 
2177
- var supportsDynamicImport = _async$1(function () {
2178
- var moduleSource = asBase64Url("export default 42");
2052
+ return result;
2053
+ }
2054
+
2055
+ function _async$2(f) {
2056
+ return function () {
2057
+ for (var args = [], i = 0; i < arguments.length; i++) {
2058
+ args[i] = arguments[i];
2059
+ }
2060
+
2061
+ try {
2062
+ return Promise.resolve(f.apply(this, args));
2063
+ } catch (e) {
2064
+ return Promise.reject(e);
2065
+ }
2066
+ };
2067
+ }
2068
+
2069
+ var supportsCssImportAssertions = _async$2(function () {
2070
+ var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
2071
+ var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\n export default css"));
2179
2072
  return _catch(function () {
2180
- return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2181
- return _await$1(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
2182
- return namespace.default === 42;
2073
+ return _await$2(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2074
+ return _await$2(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
2075
+ return namespace.default instanceof CSSStyleSheet;
2183
2076
  });
2184
2077
  });
2185
2078
  }, function () {
@@ -2197,74 +2090,142 @@
2197
2090
  }
2198
2091
  };
2199
2092
 
2200
- var supportsTopLevelAwait = function supportsTopLevelAwait() {
2201
- return _await$1(_catch(function () {
2202
- return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
2203
- return window.__jsenv_runtime_test_top_level_await__ === 42;
2204
- });
2205
- }, function () {
2206
- return false;
2207
- }));
2208
- }; // to execute in a browser devtools
2209
- // const featuresReport = {}
2210
- // await detectSupportedFeatures({ featuresReport, inlineImportMapIntoHTML: true })
2211
- // console.log(featuresReport)
2093
+ function _await$1(value, then, direct) {
2094
+ if (direct) {
2095
+ return then ? then(value) : value;
2096
+ }
2212
2097
 
2098
+ if (!value || !value.then) {
2099
+ value = Promise.resolve(value);
2100
+ }
2213
2101
 
2214
- var supportsJsonImportAssertions = _async$1(function () {
2215
- var jsonBase64Url = asBase64Url("42", "application/json");
2216
- var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\nexport default data"));
2217
- return _catch(function () {
2218
- return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2219
- return _await$1(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
2220
- return namespace.default === 42;
2221
- });
2222
- });
2223
- }, function () {
2224
- return false;
2225
- });
2226
- });
2102
+ return then ? value.then(then) : value;
2103
+ }
2227
2104
 
2228
- var supportsCssImportAssertions = _async$1(function () {
2229
- var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
2230
- var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\nexport default css"));
2231
- return _catch(function () {
2232
- return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2233
- return _await$1(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
2234
- return namespace.default instanceof CSSStyleSheet;
2105
+ function _async$1(f) {
2106
+ return function () {
2107
+ for (var args = [], i = 0; i < arguments.length; i++) {
2108
+ args[i] = arguments[i];
2109
+ }
2110
+
2111
+ try {
2112
+ return Promise.resolve(f.apply(this, args));
2113
+ } catch (e) {
2114
+ return Promise.reject(e);
2115
+ }
2116
+ };
2117
+ }
2118
+
2119
+ function _call(body, then, direct) {
2120
+ if (direct) {
2121
+ return then ? then(body()) : body();
2122
+ }
2123
+
2124
+ try {
2125
+ var result = Promise.resolve(body());
2126
+ return then ? result.then(then) : result;
2127
+ } catch (e) {
2128
+ return Promise.reject(e);
2129
+ }
2130
+ }
2131
+
2132
+ var scanBrowserRuntimeFeatures = _async$1(function () {
2133
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2134
+ _ref$coverageHandledF = _ref.coverageHandledFromOutside,
2135
+ coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
2136
+ _ref$forceCompilation = _ref.forceCompilation,
2137
+ forceCompilation = _ref$forceCompilation === void 0 ? false : _ref$forceCompilation,
2138
+ _ref$forceSource = _ref.forceSource,
2139
+ forceSource = _ref$forceSource === void 0 ? false : _ref$forceSource;
2140
+
2141
+ var jsenvCompileProfileUrl = "/__jsenv_compile_profile__";
2142
+ return _await$1(fetchJson(jsenvCompileProfileUrl), function (_ref2) {
2143
+ var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
2144
+ inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
2145
+ availableCompileIds = _ref2.availableCompileIds;
2146
+
2147
+ var _detectBrowser = detectBrowser(),
2148
+ name = _detectBrowser.name,
2149
+ version = _detectBrowser.version;
2150
+
2151
+ return _await$1(detectSupportedFeatures({
2152
+ coverageHandledFromOutside: coverageHandledFromOutside,
2153
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML
2154
+ }), function (featuresReport) {
2155
+ var runtimeReport = {
2156
+ env: {
2157
+ browser: true
2158
+ },
2159
+ name: name,
2160
+ version: version,
2161
+ featuresReport: featuresReport,
2162
+ forceSource: forceSource,
2163
+ forceCompilation: forceCompilation
2164
+ };
2165
+ return _await$1(fetchJson(jsenvCompileProfileUrl, {
2166
+ method: "POST",
2167
+ headers: {
2168
+ "content-type": "application/json"
2169
+ },
2170
+ body: JSON.stringify(runtimeReport)
2171
+ }), function (_ref3) {
2172
+ var compileProfile = _ref3.compileProfile,
2173
+ compileId = _ref3.compileId;
2174
+ return {
2175
+ jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
2176
+ inlineImportMapIntoHTML: inlineImportMapIntoHTML,
2177
+ availableCompileIds: availableCompileIds,
2178
+ runtimeReport: runtimeReport,
2179
+ compileProfile: compileProfile,
2180
+ compileId: compileId
2181
+ };
2235
2182
  });
2236
2183
  });
2237
- }, function () {
2238
- return false;
2239
2184
  });
2240
2185
  });
2241
2186
 
2242
- var executeWithScriptModuleInjection = function executeWithScriptModuleInjection(code) {
2243
- var scriptModule = document.createElement("script");
2244
- scriptModule.type = "module";
2245
- var loadPromise = new Promise(function (resolve, reject) {
2246
- scriptModule.onload = function () {
2247
- document.body.removeChild(scriptModule);
2248
- resolve();
2249
- };
2187
+ var detectSupportedFeatures = _async$1(function (_ref4) {
2188
+ var coverageHandledFromOutside = _ref4.coverageHandledFromOutside,
2189
+ inlineImportMapIntoHTML = _ref4.inlineImportMapIntoHTML;
2190
+ var featuresReport = {};
2191
+ featuresReport["import_http"] = true;
2192
+ featuresReport["coverage_js"] = coverageHandledFromOutside; // new CSSStyleSheet
2193
+
2194
+ featuresReport["new_stylesheet"] = supportsNewStylesheet(); // importmap
2195
+ // start testing importmap support first and not in paralell
2196
+ // so that there is not module script loaded beore importmap is injected
2197
+ // it would log an error in chrome console and return undefined
2250
2198
 
2251
- scriptModule.onerror = function () {
2252
- document.body.removeChild(scriptModule);
2253
- reject();
2254
- };
2199
+ return _await$1(supportsImportmap({
2200
+ // chrome supports inline but not remote importmap
2201
+ // https://github.com/WICG/import-maps/issues/235
2202
+ // at this stage we won't know if the html file will use
2203
+ // an importmap or not and if that importmap is inline or specified with an src
2204
+ // so we should test if browser support local and remote importmap.
2205
+ // But there exploring server can inline importmap by transforming html
2206
+ // and in that case we can test only the local importmap support
2207
+ // so we test importmap support and the remote one
2208
+ remote: !inlineImportMapIntoHTML
2209
+ }), function (_supportsImportmap) {
2210
+ featuresReport.importmap = _supportsImportmap; // dynamic import
2255
2211
 
2256
- document.body.appendChild(scriptModule);
2257
- });
2258
- scriptModule.src = asBase64Url(code);
2259
- return loadPromise;
2260
- };
2212
+ return _call(supportsDynamicImport, function (_supportsDynamicImpor) {
2213
+ featuresReport["import_dynamic"] = _supportsDynamicImpor; // top level await
2261
2214
 
2262
- var asBase64Url = function asBase64Url(text) {
2263
- var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
2264
- return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
2265
- }; // const cssImportAssertions = await supportsCssImportAssertions()
2266
- // console.log({ cssImportAssertions })
2215
+ return _call(supportsTopLevelAwait, function (_supportsTopLevelAwai) {
2216
+ featuresReport["top_level_await"] = _supportsTopLevelAwai; // import assertions
2267
2217
 
2218
+ return _call(supportsJsonImportAssertions, function (_supportsJsonImportAs) {
2219
+ featuresReport["import_assertion_type_json"] = _supportsJsonImportAs;
2220
+ return _call(supportsCssImportAssertions, function (_supportsCssImportAss) {
2221
+ featuresReport["import_assertion_type_css"] = _supportsCssImportAss;
2222
+ return featuresReport;
2223
+ });
2224
+ });
2225
+ });
2226
+ });
2227
+ });
2228
+ });
2268
2229
 
2269
2230
  function _await(value, then, direct) {
2270
2231
  if (direct) {
@@ -2279,11 +2240,13 @@
2279
2240
  }
2280
2241
 
2281
2242
  var redirect = _async(function () {
2282
- var redirectTarget = new URLSearchParams(window.location.search).get("redirect");
2243
+ var searchParams = new URLSearchParams(window.location.search);
2244
+ var redirectTarget = searchParams.get("redirect");
2245
+ var forceCompilation = searchParams.get("force_compilation");
2283
2246
  return _await(scanBrowserRuntimeFeatures({
2284
- failFastOnFeatureDetection: true
2285
- }), function (browserRuntimeFeaturesReport) {
2286
- var href = "".concat(getDirectoryUrl(browserRuntimeFeaturesReport)).concat(redirectTarget); // It's IMPORTANT to use location.replace and NOT location.href = url
2247
+ forceCompilation: forceCompilation === "1"
2248
+ }), function (browserRuntimeProfile) {
2249
+ var href = "".concat(getDirectoryUrl(browserRuntimeProfile)).concat(redirectTarget); // It's IMPORTANT to use location.replace and NOT location.href = url
2287
2250
  // otherwise it would break the back button
2288
2251
 
2289
2252
  window.location.replace(href);
@@ -2305,15 +2268,14 @@
2305
2268
  }
2306
2269
 
2307
2270
  var getDirectoryUrl = function getDirectoryUrl(_ref) {
2308
- var canAvoidCompilation = _ref.canAvoidCompilation,
2309
- outDirectoryRelativeUrl = _ref.outDirectoryRelativeUrl,
2271
+ var jsenvDirectoryRelativeUrl = _ref.jsenvDirectoryRelativeUrl,
2310
2272
  compileId = _ref.compileId;
2311
2273
 
2312
- if (canAvoidCompilation) {
2313
- return "/";
2274
+ if (compileId) {
2275
+ return "/".concat(jsenvDirectoryRelativeUrl).concat(compileId, "/");
2314
2276
  }
2315
2277
 
2316
- return "/".concat(outDirectoryRelativeUrl).concat(compileId, "/");
2278
+ return "/";
2317
2279
  };
2318
2280
 
2319
2281
  redirect();
@@ -2321,7 +2283,7 @@
2321
2283
  };
2322
2284
  });
2323
2285
 
2324
- //# sourceMappingURL=redirector.html__inline__15_e391410e.js.map</script>
2286
+ //# sourceMappingURL=redirector.html__inline__12_404b8295.js.map</script>
2325
2287
 
2326
2288
 
2327
2289
  </body></html>