@jsenv/core 25.4.0 → 25.4.4

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 (32) hide show
  1. package/dist/build_manifest.js +4 -4
  2. package/dist/compile_proxy/asset-manifest.json +2 -2
  3. package/dist/compile_proxy/{compile_proxy.html__inline__20_2334a374.js.map → compile_proxy.html__inline__20_f4285042.js.map} +3 -2
  4. package/dist/compile_proxy/{compile_proxy_9f737eaf.html → compile_proxy_ab528227.html} +6 -4
  5. package/dist/redirector/asset-manifest.json +2 -2
  6. package/dist/redirector/{redirector.html__inline__12_009c47c7.js.map → redirector.html__inline__12_404b8295.js.map} +6 -5
  7. package/dist/redirector/{redirector_96f74871.html → redirector_6df2620a.html} +57 -52
  8. package/dist/toolbar/asset-manifest.json +2 -2
  9. package/dist/toolbar/{toolbar.main_86335f90.js.map → toolbar.main_279b3a68.js.map} +175 -180
  10. package/dist/toolbar/{toolbar_d3a918a4.html → toolbar_0a91ca3b.html} +1232 -1285
  11. package/dist/toolbar_injector/asset-manifest.json +2 -2
  12. package/dist/toolbar_injector/toolbar_injector_34f6ad8e.js +976 -0
  13. package/dist/toolbar_injector/toolbar_injector_34f6ad8e.js.map +294 -0
  14. package/package.json +4 -5
  15. package/src/dev_server.js +36 -6
  16. package/src/importUsingChildProcess.js +1 -0
  17. package/src/internal/compiling/babel_plugin_transform_import_meta.js +23 -55
  18. package/src/internal/compiling/js-compilation-service/transformJs.js +1 -3
  19. package/src/internal/compiling/jsenvCompilerForHtml.js +9 -11
  20. package/src/internal/compiling/jsenv_directory/comparison_utils.js +4 -1
  21. package/src/internal/compiling/startCompileServer.js +1 -0
  22. package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +9 -2
  23. package/src/internal/dev_server/toolbar/toolbar.html +6 -0
  24. package/src/internal/dev_server/toolbar/toolbar.injector.js +11 -3
  25. package/src/internal/dev_server/toolbar/toolbar.main.js +10 -14
  26. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +7 -3
  27. package/src/internal/import-resolution/importmap_default.js +2 -17
  28. package/src/internal/node_launcher/createControllableNodeProcess.js +0 -3
  29. package/src/internal/node_runtime/nodeControllableFile.mjs +1 -5
  30. package/src/internal/redirector/redirector.html +6 -4
  31. package/dist/toolbar_injector/toolbar_injector_978bbd14.js +0 -267
  32. package/dist/toolbar_injector/toolbar_injector_978bbd14.js.map +0 -119
@@ -983,7 +983,7 @@
983
983
  /* eslint-env browser */
984
984
 
985
985
 
986
- function _await$8(value, then, direct) {
986
+ function _await$9(value, then, direct) {
987
987
  if (direct) {
988
988
  return then ? then(value) : value;
989
989
  }
@@ -1009,7 +1009,7 @@
1009
1009
  };
1010
1010
  }
1011
1011
 
1012
- function _call$2(body, then, direct) {
1012
+ function _call$1(body, then, direct) {
1013
1013
  if (direct) {
1014
1014
  return then ? then(body()) : body();
1015
1015
  }
@@ -1106,7 +1106,7 @@
1106
1106
  }
1107
1107
 
1108
1108
  xhr.send(body);
1109
- return _await$8(headersPromise, function () {
1109
+ return _await$9(headersPromise, function () {
1110
1110
  // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
1111
1111
  var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
1112
1112
  var responseStatus = xhr.status;
@@ -1114,7 +1114,7 @@
1114
1114
  var responseHeaders = getHeadersFromXHR(xhr);
1115
1115
 
1116
1116
  var readBody = function readBody() {
1117
- return _await$8(bodyPromise, function () {
1117
+ return _await$9(bodyPromise, function () {
1118
1118
  var status = xhr.status; // in Chrome on file:/// URLs, status is 0
1119
1119
 
1120
1120
  if (status === 0) {
@@ -1130,7 +1130,7 @@
1130
1130
  };
1131
1131
 
1132
1132
  var text = function text() {
1133
- return _call$2(readBody, function (_ref2) {
1133
+ return _call$1(readBody, function (_ref2) {
1134
1134
  var responseBody = _ref2.responseBody,
1135
1135
  responseBodyType = _ref2.responseBodyType;
1136
1136
 
@@ -1147,7 +1147,7 @@
1147
1147
  };
1148
1148
 
1149
1149
  var json = function json() {
1150
- return _call$2(text, JSON.parse);
1150
+ return _call$1(text, JSON.parse);
1151
1151
  };
1152
1152
 
1153
1153
  var blob = _async$8(function () {
@@ -1155,7 +1155,7 @@
1155
1155
  throw new Error("blob not supported");
1156
1156
  }
1157
1157
 
1158
- return _call$2(readBody, function (_ref3) {
1158
+ return _call$1(readBody, function (_ref3) {
1159
1159
  var responseBody = _ref3.responseBody,
1160
1160
  responseBodyType = _ref3.responseBodyType;
1161
1161
 
@@ -1180,10 +1180,10 @@
1180
1180
  });
1181
1181
 
1182
1182
  var arrayBuffer = function arrayBuffer() {
1183
- return _call$2(readBody, function (_ref4) {
1183
+ return _call$1(readBody, function (_ref4) {
1184
1184
  var responseBody = _ref4.responseBody,
1185
1185
  responseBodyType = _ref4.responseBodyType;
1186
- return responseBodyType === "arrayBuffer" ? cloneBuffer(responseBody) : _call$2(blob, blobToArrayBuffer);
1186
+ return responseBodyType === "arrayBuffer" ? cloneBuffer(responseBody) : _call$1(blob, blobToArrayBuffer);
1187
1187
  });
1188
1188
  };
1189
1189
 
@@ -1192,7 +1192,7 @@
1192
1192
  throw new Error("formData not supported");
1193
1193
  }
1194
1194
 
1195
- return _call$2(text, textToFormData);
1195
+ return _call$1(text, textToFormData);
1196
1196
  });
1197
1197
 
1198
1198
  return {
@@ -1419,7 +1419,7 @@
1419
1419
 
1420
1420
  var _excluded = ["mode"];
1421
1421
 
1422
- function _await$7(value, then, direct) {
1422
+ function _await$8(value, then, direct) {
1423
1423
  if (direct) {
1424
1424
  return then ? then(value) : value;
1425
1425
  }
@@ -1452,7 +1452,7 @@
1452
1452
  mode = _ref$mode === void 0 ? "cors" : _ref$mode,
1453
1453
  options = _objectWithoutProperties(_ref, _excluded);
1454
1454
 
1455
- return _await$7(window.fetch(url, _objectSpread2({
1455
+ return _await$8(window.fetch(url, _objectSpread2({
1456
1456
  mode: mode
1457
1457
  }, options)), function (response) {
1458
1458
  return {
@@ -1489,7 +1489,7 @@
1489
1489
 
1490
1490
  var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
1491
1491
 
1492
- function _await$6(value, then, direct) {
1492
+ function _await$7(value, then, direct) {
1493
1493
  if (direct) {
1494
1494
  return then ? then(value) : value;
1495
1495
  }
@@ -1517,8 +1517,8 @@
1517
1517
 
1518
1518
  var fetchJson = _async$6(function (url) {
1519
1519
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1520
- return _await$6(fetchUrl(url, options), function (response) {
1521
- return _await$6(response.json());
1520
+ return _await$7(fetchUrl(url, options), function (response) {
1521
+ return _await$7(response.json());
1522
1522
  });
1523
1523
  });
1524
1524
  /*
@@ -1805,7 +1805,7 @@
1805
1805
  return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
1806
1806
  };
1807
1807
 
1808
- function _await$5(value, then, direct) {
1808
+ function _await$6(value, then, direct) {
1809
1809
  if (direct) {
1810
1810
  return then ? then(value) : value;
1811
1811
  }
@@ -1866,7 +1866,7 @@
1866
1866
 
1867
1867
  document.body.appendChild(importmapScript);
1868
1868
  return _catch$4(function () {
1869
- return _await$5(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
1869
+ return _await$6(executeWithScriptModuleInjection("import supported from \"".concat(specifier, "\"; window.__jsenv_runtime_test_importmap__ = supported")), function () {
1870
1870
  document.body.removeChild(importmapScript);
1871
1871
  var supported = window.__jsenv_runtime_test_importmap__;
1872
1872
  delete window.__jsenv_runtime_test_importmap__;
@@ -1878,7 +1878,7 @@
1878
1878
  });
1879
1879
  });
1880
1880
 
1881
- function _await$4(value, then, direct) {
1881
+ function _await$5(value, then, direct) {
1882
1882
  if (direct) {
1883
1883
  return then ? then(value) : value;
1884
1884
  }
@@ -1921,8 +1921,8 @@
1921
1921
  var supportsDynamicImport = _async$4(function () {
1922
1922
  var moduleSource = asBase64Url("export default 42");
1923
1923
  return _catch$3(function () {
1924
- return _await$4(executeWithScriptModuleInjection("window.__jsenv_runtime_test_dynamic_import__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
1925
- return _await$4(window.__jsenv_runtime_test_dynamic_import__, function (namespace) {
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
1926
  delete window.__jsenv_runtime_test_dynamic_import__;
1927
1927
  return namespace.default === 42;
1928
1928
  });
@@ -1932,7 +1932,7 @@
1932
1932
  });
1933
1933
  });
1934
1934
 
1935
- function _await$3(value, then, direct) {
1935
+ function _await$4(value, then, direct) {
1936
1936
  if (direct) {
1937
1937
  return then ? then(value) : value;
1938
1938
  }
@@ -1959,8 +1959,8 @@
1959
1959
  }
1960
1960
 
1961
1961
  var supportsTopLevelAwait = function supportsTopLevelAwait() {
1962
- return _await$3(_catch$2(function () {
1963
- return _await$3(executeWithScriptModuleInjection("window.__jsenv_runtime_test_top_level_await__ = await Promise.resolve(42)"), function () {
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
1964
  var supported = window.__jsenv_runtime_test_top_level_await__ === 42;
1965
1965
  delete window.__jsenv_runtime_test_top_level_await__;
1966
1966
  return supported;
@@ -1970,7 +1970,7 @@
1970
1970
  }));
1971
1971
  };
1972
1972
 
1973
- function _await$2(value, then, direct) {
1973
+ function _await$3(value, then, direct) {
1974
1974
  if (direct) {
1975
1975
  return then ? then(value) : value;
1976
1976
  }
@@ -2014,8 +2014,8 @@
2014
2014
  var jsonBase64Url = asBase64Url("42", "application/json");
2015
2015
  var moduleSource = asBase64Url("import data from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }\n export default data"));
2016
2016
  return _catch$1(function () {
2017
- return _await$2(executeWithScriptModuleInjection("window.__jsenv_runtime_test_json_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2018
- return _await$2(window.__jsenv_runtime_test_json_import_assertion__, function (namespace) {
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
2019
  var supported = namespace.default === 42;
2020
2020
  delete window.__jsenv_runtime_test_json_import_assertion__;
2021
2021
  return supported;
@@ -2026,7 +2026,7 @@
2026
2026
  });
2027
2027
  });
2028
2028
 
2029
- function _await$1(value, then, direct) {
2029
+ function _await$2(value, then, direct) {
2030
2030
  if (direct) {
2031
2031
  return then ? then(value) : value;
2032
2032
  }
@@ -2070,8 +2070,8 @@
2070
2070
  var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
2071
2071
  var moduleSource = asBase64Url("import css from \"".concat(cssBase64Url, "\" assert { type: \"css\" }\n export default css"));
2072
2072
  return _catch(function () {
2073
- return _await$1(executeWithScriptModuleInjection("window.__jsenv_runtime_test_css_import_assertion__ = import(".concat(JSON.stringify(moduleSource), ")")), function () {
2074
- return _await$1(window.__jsenv_runtime_test_css_import_assertion__, function (namespace) {
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
2075
  return namespace.default instanceof CSSStyleSheet;
2076
2076
  });
2077
2077
  });
@@ -2090,7 +2090,7 @@
2090
2090
  }
2091
2091
  };
2092
2092
 
2093
- function _await(value, then, direct) {
2093
+ function _await$1(value, then, direct) {
2094
2094
  if (direct) {
2095
2095
  return then ? then(value) : value;
2096
2096
  }
@@ -2116,7 +2116,7 @@
2116
2116
  };
2117
2117
  }
2118
2118
 
2119
- function _call$1(body, then, direct) {
2119
+ function _call(body, then, direct) {
2120
2120
  if (direct) {
2121
2121
  return then ? then(body()) : body();
2122
2122
  }
@@ -2139,15 +2139,16 @@
2139
2139
  forceSource = _ref$forceSource === void 0 ? false : _ref$forceSource;
2140
2140
 
2141
2141
  var jsenvCompileProfileUrl = "/__jsenv_compile_profile__";
2142
- return _await(fetchJson(jsenvCompileProfileUrl), function (_ref2) {
2142
+ return _await$1(fetchJson(jsenvCompileProfileUrl), function (_ref2) {
2143
2143
  var jsenvDirectoryRelativeUrl = _ref2.jsenvDirectoryRelativeUrl,
2144
- inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML;
2144
+ inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
2145
+ availableCompileIds = _ref2.availableCompileIds;
2145
2146
 
2146
2147
  var _detectBrowser = detectBrowser(),
2147
2148
  name = _detectBrowser.name,
2148
2149
  version = _detectBrowser.version;
2149
2150
 
2150
- return _await(detectSupportedFeatures({
2151
+ return _await$1(detectSupportedFeatures({
2151
2152
  coverageHandledFromOutside: coverageHandledFromOutside,
2152
2153
  inlineImportMapIntoHTML: inlineImportMapIntoHTML
2153
2154
  }), function (featuresReport) {
@@ -2161,7 +2162,7 @@
2161
2162
  forceSource: forceSource,
2162
2163
  forceCompilation: forceCompilation
2163
2164
  };
2164
- return _await(fetchJson(jsenvCompileProfileUrl, {
2165
+ return _await$1(fetchJson(jsenvCompileProfileUrl, {
2165
2166
  method: "POST",
2166
2167
  headers: {
2167
2168
  "content-type": "application/json"
@@ -2173,9 +2174,10 @@
2173
2174
  return {
2174
2175
  jsenvDirectoryRelativeUrl: jsenvDirectoryRelativeUrl,
2175
2176
  inlineImportMapIntoHTML: inlineImportMapIntoHTML,
2177
+ availableCompileIds: availableCompileIds,
2178
+ runtimeReport: runtimeReport,
2176
2179
  compileProfile: compileProfile,
2177
- compileId: compileId,
2178
- runtimeReport: runtimeReport
2180
+ compileId: compileId
2179
2181
  };
2180
2182
  });
2181
2183
  });
@@ -2194,7 +2196,7 @@
2194
2196
  // so that there is not module script loaded beore importmap is injected
2195
2197
  // it would log an error in chrome console and return undefined
2196
2198
 
2197
- return _await(supportsImportmap({
2199
+ return _await$1(supportsImportmap({
2198
2200
  // chrome supports inline but not remote importmap
2199
2201
  // https://github.com/WICG/import-maps/issues/235
2200
2202
  // at this stage we won't know if the html file will use
@@ -2207,15 +2209,15 @@
2207
2209
  }), function (_supportsImportmap) {
2208
2210
  featuresReport.importmap = _supportsImportmap; // dynamic import
2209
2211
 
2210
- return _call$1(supportsDynamicImport, function (_supportsDynamicImpor) {
2212
+ return _call(supportsDynamicImport, function (_supportsDynamicImpor) {
2211
2213
  featuresReport["import_dynamic"] = _supportsDynamicImpor; // top level await
2212
2214
 
2213
- return _call$1(supportsTopLevelAwait, function (_supportsTopLevelAwai) {
2215
+ return _call(supportsTopLevelAwait, function (_supportsTopLevelAwai) {
2214
2216
  featuresReport["top_level_await"] = _supportsTopLevelAwai; // import assertions
2215
2217
 
2216
- return _call$1(supportsJsonImportAssertions, function (_supportsJsonImportAs) {
2218
+ return _call(supportsJsonImportAssertions, function (_supportsJsonImportAs) {
2217
2219
  featuresReport["import_assertion_type_json"] = _supportsJsonImportAs;
2218
- return _call$1(supportsCssImportAssertions, function (_supportsCssImportAss) {
2220
+ return _call(supportsCssImportAssertions, function (_supportsCssImportAss) {
2219
2221
  featuresReport["import_assertion_type_css"] = _supportsCssImportAss;
2220
2222
  return featuresReport;
2221
2223
  });
@@ -2225,22 +2227,25 @@
2225
2227
  });
2226
2228
  });
2227
2229
 
2228
- function _call(body, then, direct) {
2230
+ function _await(value, then, direct) {
2229
2231
  if (direct) {
2230
- return then ? then(body()) : body();
2232
+ return then ? then(value) : value;
2231
2233
  }
2232
2234
 
2233
- try {
2234
- var result = Promise.resolve(body());
2235
- return then ? result.then(then) : result;
2236
- } catch (e) {
2237
- return Promise.reject(e);
2235
+ if (!value || !value.then) {
2236
+ value = Promise.resolve(value);
2238
2237
  }
2238
+
2239
+ return then ? value.then(then) : value;
2239
2240
  }
2240
2241
 
2241
2242
  var redirect = _async(function () {
2242
- var redirectTarget = new URLSearchParams(window.location.search).get("redirect");
2243
- return _call(scanBrowserRuntimeFeatures, function (browserRuntimeProfile) {
2243
+ var searchParams = new URLSearchParams(window.location.search);
2244
+ var redirectTarget = searchParams.get("redirect");
2245
+ var forceCompilation = searchParams.get("force_compilation");
2246
+ return _await(scanBrowserRuntimeFeatures({
2247
+ forceCompilation: forceCompilation === "1"
2248
+ }), function (browserRuntimeProfile) {
2244
2249
  var href = "".concat(getDirectoryUrl(browserRuntimeProfile)).concat(redirectTarget); // It's IMPORTANT to use location.replace and NOT location.href = url
2245
2250
  // otherwise it would break the back button
2246
2251
 
@@ -2278,7 +2283,7 @@
2278
2283
  };
2279
2284
  });
2280
2285
 
2281
- //# sourceMappingURL=redirector.html__inline__12_009c47c7.js.map</script>
2286
+ //# sourceMappingURL=redirector.html__inline__12_404b8295.js.map</script>
2282
2287
 
2283
2288
 
2284
2289
  </body></html>
@@ -8,6 +8,6 @@
8
8
  "assets/settings.css.map": "assets/settings.css_61548139.map",
9
9
  "assets/toolbar.main.css.map": "assets/toolbar.main.css_269d7ce2.map",
10
10
  "assets/tooltip.css.map": "assets/tooltip.css_a94a8bdd.map",
11
- "toolbar.html": "toolbar_d3a918a4.html",
12
- "toolbar.main.js.map": "toolbar.main_86335f90.js.map"
11
+ "toolbar.html": "toolbar_0a91ca3b.html",
12
+ "toolbar.main.js.map": "toolbar.main_279b3a68.js.map"
13
13
  }