@jsenv/core 26.0.1 → 27.0.0-alpha.2

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 (465) hide show
  1. package/main.js +17 -24
  2. package/package.json +35 -71
  3. package/readme.md +30 -37
  4. package/src/build/build.js +737 -0
  5. package/src/build/build_urls_generator.js +64 -0
  6. package/src/build/inject_version_mappings.js +62 -0
  7. package/src/build/plugins/bundle_js_module/jsenv_plugin_bundle_js_module.js +225 -0
  8. package/src/build/plugins/minify_html/jsenv_plugin_minify_html.js +30 -0
  9. package/src/build/plugins/minify_js/jsenv_plugin_minify_js.js +47 -0
  10. package/src/dev/plugins/autoreload/babel_plugin_metadata_import_meta_hot.js +98 -0
  11. package/src/dev/plugins/autoreload/client/autoreload_preference.js +11 -0
  12. package/src/dev/plugins/autoreload/client/event_source_client.js +186 -0
  13. package/src/{internal/dev_server/event_source_client → dev/plugins/autoreload/client}/event_source_connection.js +21 -25
  14. package/src/dev/plugins/autoreload/client/import_meta_hot.js +80 -0
  15. package/src/dev/plugins/autoreload/client/reload.js +101 -0
  16. package/src/dev/plugins/autoreload/client/url_helpers.js +20 -0
  17. package/src/dev/plugins/autoreload/html_hot_dependencies.js +156 -0
  18. package/src/dev/plugins/autoreload/jsenv_plugin_autoreload.js +374 -0
  19. package/src/dev/plugins/autoreload/sse_service.js +149 -0
  20. package/src/dev/plugins/explorer/client/explorer.html +607 -0
  21. package/src/{internal → dev/plugins/explorer/client}/jsenv.png +0 -0
  22. package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +74 -0
  23. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/animation/toolbar_animation.js +0 -0
  24. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/eventsource/eventsource.css +2 -2
  25. package/src/dev/plugins/toolbar/client/eventsource/toolbar_eventsource.js +57 -0
  26. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/execution/execution.css +0 -0
  27. package/src/dev/plugins/toolbar/client/execution/toolbar_execution.js +88 -0
  28. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/focus/focus.css +0 -0
  29. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/focus/toolbar_focus.js +0 -0
  30. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/jsenv_logo.svg +0 -0
  31. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/notification/toolbar_notification.js +0 -0
  32. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/responsive/overflow_menu.css +0 -0
  33. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/responsive/toolbar_responsive.js +0 -0
  34. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/settings/settings.css +0 -0
  35. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/settings/toolbar_settings.js +1 -0
  36. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/jsenv_theme.css +1 -15
  37. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/light_theme.css +0 -17
  38. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/toolbar_theme.js +0 -0
  39. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar.html +40 -199
  40. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_injector.js +8 -28
  41. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.css +0 -24
  42. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.js +10 -56
  43. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.css +1 -1
  44. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.js +0 -0
  45. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/animation.js +0 -0
  46. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/dom.js +0 -0
  47. package/src/{internal/browser_utils → dev/plugins/toolbar/client/util}/fetch_using_xhr.js +0 -0
  48. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/fetching.js +2 -4
  49. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/iframe_to_parent_href.js +0 -0
  50. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/jsenv_logger.js +0 -0
  51. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/preferences.js +0 -0
  52. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/responsive.js +0 -0
  53. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/util.js +0 -0
  54. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/variant/variant.js +0 -0
  55. package/src/dev/plugins/toolbar/jsenv_plugin_toolbar.js +62 -0
  56. package/src/dev/start_dev_server.js +105 -0
  57. package/src/execute/execute.js +132 -0
  58. package/src/execute/run.js +208 -0
  59. package/src/execute/runtimes/browsers/chromium.js +8 -0
  60. package/src/execute/runtimes/browsers/firefox.js +7 -0
  61. package/src/execute/runtimes/browsers/from_playwright.js +464 -0
  62. package/src/{browser_runtimes.js → execute/runtimes/browsers/webkit.js} +4 -18
  63. package/src/{internal/node_launcher/child_process_options.js → execute/runtimes/node/child_exec_options.js} +25 -36
  64. package/src/{internal/node_launcher/node_controllable_file.mjs → execute/runtimes/node/controllable_file.mjs} +1 -18
  65. package/src/{internal/node_launcher/node_controllable_process.js → execute/runtimes/node/controlled_process.js} +128 -150
  66. package/src/execute/runtimes/node/exec_options.js +44 -0
  67. package/src/{internal/node_launcher → execute/runtimes/node}/kill_process_tree.js +3 -1
  68. package/src/execute/runtimes/node/node_process.js +92 -0
  69. package/src/execute/runtimes/node/node_worker_thread.js +28 -0
  70. package/src/omega/core_plugins/babel/babel_helper/babel_helper_directory.js +29 -0
  71. package/src/{internal/compile_server/js → omega/core_plugins/babel/babel_helper}/babel_plugin_babel_helpers_as_jsenv_imports.js +15 -19
  72. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/.eslintrc.cjs +0 -0
  73. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AsyncGenerator/AsyncGenerator.js +0 -0
  74. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AwaitValue/AwaitValue.js +0 -0
  75. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -0
  76. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayLikeToArray/arrayLikeToArray.js +0 -0
  77. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithHoles/arrayWithHoles.js +0 -0
  78. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithoutHoles/arrayWithoutHoles.js +0 -0
  79. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/assertThisInitialized/assertThisInitialized.js +0 -0
  80. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -0
  81. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncIterator/asyncIterator.js +0 -0
  82. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncToGenerator/asyncToGenerator.js +0 -0
  83. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -0
  84. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -0
  85. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -0
  86. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -0
  87. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCallCheck/classCallCheck.js +0 -0
  88. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -0
  89. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -0
  90. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -0
  91. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classNameTDZError/classNameTDZError.js +0 -0
  92. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -0
  93. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldGet/classPrivateFieldGet.js +0 -0
  94. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -0
  95. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -0
  96. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldSet/classPrivateFieldSet.js +0 -0
  97. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodGet/classPrivateMethodGet.js +0 -0
  98. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodSet/classPrivateMethodSet.js +0 -0
  99. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -0
  100. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -0
  101. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -0
  102. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -0
  103. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/construct/construct.js +0 -0
  104. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createClass/createClass.js +0 -0
  105. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -0
  106. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -0
  107. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createRawReactElement/createRawReactElement.js +0 -0
  108. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createSuper/createSuper.js +0 -0
  109. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/decorate/decorate.js +0 -0
  110. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defaults/defaults.js +0 -0
  111. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineEnumerableProperties/defineEnumerableProperties.js +0 -0
  112. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineProperty/defineProperty.js +0 -0
  113. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/extends/extends.js +0 -0
  114. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/get/get.js +0 -0
  115. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/getPrototypeOf/getPrototypeOf.js +0 -0
  116. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inherits/inherits.js +0 -0
  117. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inheritsLoose/inheritsLoose.js +0 -0
  118. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerDefineProperty/initializerDefineProperty.js +0 -0
  119. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerWarningHelper/initializerWarningHelper.js +0 -0
  120. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/instanceof/instanceof.js +0 -0
  121. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireDefault/interopRequireDefault.js +0 -0
  122. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireWildcard/interopRequireWildcard.js +0 -0
  123. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeFunction/isNativeFunction.js +0 -0
  124. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -0
  125. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArray/iterableToArray.js +0 -0
  126. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimit/iterableToArrayLimit.js +0 -0
  127. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -0
  128. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/jsx/jsx.js +0 -0
  129. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/maybeArrayLike/maybeArrayLike.js +0 -0
  130. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/newArrowCheck/newArrowCheck.js +0 -0
  131. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableRest/nonIterableRest.js +0 -0
  132. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableSpread/nonIterableSpread.js +0 -0
  133. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -0
  134. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread/objectSpread.js +0 -0
  135. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread2/objectSpread2.js +0 -0
  136. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutProperties/objectWithoutProperties.js +0 -0
  137. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -0
  138. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/possibleConstructorReturn/possibleConstructorReturn.js +0 -0
  139. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readOnlyError/readOnlyError.js +0 -0
  140. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readme.md +0 -0
  141. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/set/set.js +0 -0
  142. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/setPrototypeOf/setPrototypeOf.js +0 -0
  143. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -0
  144. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArray/slicedToArray.js +0 -0
  145. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArrayLoose/slicedToArrayLoose.js +0 -0
  146. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/superPropBase/superPropBase.js +0 -0
  147. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -0
  148. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -0
  149. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/tdz/tdz.js +0 -0
  150. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalRef/temporalRef.js +0 -0
  151. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalUndefined/temporalUndefined.js +0 -0
  152. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toArray/toArray.js +0 -0
  153. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toConsumableArray/toConsumableArray.js +0 -0
  154. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPrimitive/toPrimitive.js +0 -0
  155. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPropertyKey/toPropertyKey.js +0 -0
  156. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/typeof/typeof.js +0 -0
  157. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -0
  158. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -0
  159. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapNativeSuper/wrapNativeSuper.js +0 -0
  160. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapRegExp/wrapRegExp.js +0 -0
  161. package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/writeOnlyError/writeOnlyError.js +0 -0
  162. package/src/omega/core_plugins/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +35 -0
  163. package/{helpers/global-this/global-this.js → src/omega/core_plugins/babel/global_this/client/global_this.js} +0 -0
  164. package/src/omega/core_plugins/babel/helpers/babel_plugin_structure.js +187 -0
  165. package/src/{internal/features → omega/core_plugins/babel/helpers}/babel_plugins_compatibility.js +1 -24
  166. package/src/omega/core_plugins/babel/jsenv_plugin_babel.js +97 -0
  167. package/src/omega/core_plugins/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +117 -0
  168. package/src/omega/core_plugins/babel/new_stylesheet/client/.eslintrc.cjs +24 -0
  169. package/{helpers/new_stylesheet → src/omega/core_plugins/babel/new_stylesheet/client}/new_stylesheet.js +0 -0
  170. package/src/omega/core_plugins/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +34 -0
  171. package/{helpers/regenerator-runtime/regenerator-runtime.js → src/omega/core_plugins/babel/regenerator_runtime/client/regenerator_runtime.js} +0 -0
  172. package/src/omega/core_plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +169 -0
  173. package/src/omega/core_plugins/file_urls/jsenv_plugin_file_urls.js +67 -0
  174. package/src/omega/core_plugins/filesystem_magic/jsenv_plugin_filesystem_magic.js +58 -0
  175. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/error_in_document.js +10 -16
  176. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/error_in_notification.js +0 -0
  177. package/src/omega/core_plugins/html_supervisor/client/html_supervisor_installer.js +168 -0
  178. package/src/omega/core_plugins/html_supervisor/client/html_supervisor_setup.js +77 -0
  179. package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/perf_browser.js +0 -0
  180. package/src/{internal/runtime_client → omega/core_plugins/html_supervisor/client}/uneval_exception.js +0 -0
  181. package/src/omega/core_plugins/html_supervisor/jsenv_plugin_html_supervisor.js +233 -0
  182. package/src/omega/core_plugins/import_assertions/helpers/babel_plugin_metadata_import_assertions.js +98 -0
  183. package/src/{internal/building/import_assertions → omega/core_plugins/import_assertions/helpers}/json_module.js +3 -2
  184. package/src/omega/core_plugins/import_assertions/helpers/text_module.js +6 -0
  185. package/src/omega/core_plugins/import_assertions/jsenv_plugin_import_assertions.js +211 -0
  186. package/src/omega/core_plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +80 -0
  187. package/src/omega/core_plugins/importmap/jsenv_plugin_importmap.js +212 -0
  188. package/src/omega/core_plugins/inline/client/inline_content.js +6 -0
  189. package/src/omega/core_plugins/inline/jsenv_plugin_data_urls.js +70 -0
  190. package/src/omega/core_plugins/inline/jsenv_plugin_inline.js +13 -0
  191. package/src/omega/core_plugins/inline/jsenv_plugin_inline_query_param.js +42 -0
  192. package/src/omega/core_plugins/inline/jsenv_plugin_js_and_css_inside_html.js +142 -0
  193. package/src/omega/core_plugins/inline/jsenv_plugin_new_inline_content.js +210 -0
  194. package/src/omega/core_plugins/leading_slash/jsenv_plugin_leading_slash.js +12 -0
  195. package/src/omega/core_plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +77 -0
  196. package/src/omega/core_plugins/url_resolution/jsenv_plugin_url_resolution.js +28 -0
  197. package/src/omega/core_plugins/url_version/jsenv_plugin_url_version.js +50 -0
  198. package/src/omega/core_plugins.js +39 -0
  199. package/src/omega/errors.js +168 -0
  200. package/src/omega/file_url_converter.js +63 -0
  201. package/src/omega/kitchen.js +777 -0
  202. package/src/omega/omega_server.js +129 -0
  203. package/src/omega/plugin_controller.js +240 -0
  204. package/src/omega/runtime_support/default_runtime_support.js +13 -0
  205. package/src/omega/runtime_support/features_compatibility.js +91 -0
  206. package/src/omega/runtime_support/runtime_support.js +20 -0
  207. package/src/omega/server/file_service.js +155 -0
  208. package/src/omega/server/user_agent.js +22 -0
  209. package/src/omega/url_graph/url_graph_load.js +68 -0
  210. package/src/omega/url_graph/url_graph_report.js +151 -0
  211. package/src/omega/url_graph/url_graph_sort.js +29 -0
  212. package/src/omega/url_graph/url_info_transformations.js +161 -0
  213. package/src/omega/url_graph.js +132 -0
  214. package/src/omega/url_mentions/css_url_mentions.js +63 -0
  215. package/src/omega/url_mentions/html_url_mentions.js +185 -0
  216. package/src/omega/url_mentions/js_module_url_mentions.js +91 -0
  217. package/src/omega/url_mentions/parse_url_mentions.js +37 -0
  218. package/src/omega/url_mentions/worker_classic_url_mentions.js +37 -0
  219. package/src/{internal/executing → test}/execute_plan.js +154 -211
  220. package/src/{execute_test_plan.js → test/execute_test_plan.js} +26 -81
  221. package/src/{internal/executing → test}/execution_colors.js +0 -0
  222. package/src/{internal/executing → test}/execution_steps.js +2 -8
  223. package/src/{internal/executing → test}/gc.js +0 -0
  224. package/src/test/logs_file_execution.js +223 -0
  225. package/dist/browser_client/asset-manifest.json +0 -4
  226. package/dist/browser_client/browser_client_fb33eaa4.js +0 -5320
  227. package/dist/browser_client/browser_client_fb33eaa4.js.map +0 -1089
  228. package/dist/build_manifest.js +0 -12
  229. package/dist/compile_proxy/asset-manifest.json +0 -4
  230. package/dist/compile_proxy/compile_proxy.html__inline__20_651d1e7b.js.map +0 -343
  231. package/dist/compile_proxy/compile_proxy_62f952c4.html +0 -2245
  232. package/dist/event_source_client/asset-manifest.json +0 -4
  233. package/dist/event_source_client/event_source_client_69f48287.js +0 -354
  234. package/dist/event_source_client/event_source_client_69f48287.js.map +0 -128
  235. package/dist/redirector/asset-manifest.json +0 -4
  236. package/dist/redirector/redirector.html__inline__12_171e07b4.js.map +0 -349
  237. package/dist/redirector/redirector_8117ec92.html +0 -2290
  238. package/dist/toolbar/asset-manifest.json +0 -13
  239. package/dist/toolbar/assets/compilation.css_7421bd55.map +0 -12
  240. package/dist/toolbar/assets/eventsource.css_c0c71e7b.map +0 -12
  241. package/dist/toolbar/assets/execution.css_f3377c10.map +0 -12
  242. package/dist/toolbar/assets/focus.css_896f3e45.map +0 -12
  243. package/dist/toolbar/assets/light_theme.css_5bff0336.map +0 -12
  244. package/dist/toolbar/assets/overflow_menu.css_9a0fc3d8.map +0 -12
  245. package/dist/toolbar/assets/settings.css_942b5a9e.map +0 -12
  246. package/dist/toolbar/assets/toolbar_main.css_b1c67dd7.map +0 -28
  247. package/dist/toolbar/assets/tooltip.css_a94a8bdd.map +0 -12
  248. package/dist/toolbar/toolbar_b0c9100c.html +0 -4976
  249. package/dist/toolbar/toolbar_main_f54c1bb0.js.map +0 -776
  250. package/dist/toolbar_injector/asset-manifest.json +0 -5
  251. package/dist/toolbar_injector/assets/jsenv_logo_192011c2.svg +0 -95
  252. package/dist/toolbar_injector/toolbar_injector_65b501eb.js +0 -976
  253. package/dist/toolbar_injector/toolbar_injector_65b501eb.js.map +0 -294
  254. package/helpers/import-meta/import-meta-url-commonjs.js +0 -9
  255. package/helpers/import-meta/import-meta-url-global.js +0 -54
  256. package/src/build_project.js +0 -336
  257. package/src/commonjs_to_js_module.js +0 -180
  258. package/src/dev_server.js +0 -302
  259. package/src/execute.js +0 -184
  260. package/src/import_using_child_process.js +0 -68
  261. package/src/internal/browser_client/browser_client.js +0 -220
  262. package/src/internal/browser_client/browser_client_factory.js +0 -144
  263. package/src/internal/browser_client/browser_error_stack_remap.js +0 -43
  264. package/src/internal/browser_client/browser_system.js +0 -216
  265. package/src/internal/browser_client/module_namespace_transfer.js +0 -90
  266. package/src/internal/browser_detection/browser_detection.js +0 -65
  267. package/src/internal/browser_detection/detect_android.js +0 -13
  268. package/src/internal/browser_detection/detect_chrome.js +0 -28
  269. package/src/internal/browser_detection/detect_edge.js +0 -13
  270. package/src/internal/browser_detection/detect_electron.js +0 -1
  271. package/src/internal/browser_detection/detect_firefox.js +0 -17
  272. package/src/internal/browser_detection/detect_internet_explorer.js +0 -14
  273. package/src/internal/browser_detection/detect_ios.js +0 -19
  274. package/src/internal/browser_detection/detect_opera.js +0 -27
  275. package/src/internal/browser_detection/detect_safari.js +0 -13
  276. package/src/internal/browser_detection/user_agent_data.js +0 -25
  277. package/src/internal/browser_detection/util.js +0 -13
  278. package/src/internal/browser_launcher/browser_runtime_profile.js +0 -81
  279. package/src/internal/browser_launcher/execute_html_file.js +0 -355
  280. package/src/internal/browser_launcher/from_playwright.js +0 -320
  281. package/src/internal/browser_launcher/page_errors_and_logs.js +0 -77
  282. package/src/internal/browser_utils/fetch_and_eval.js +0 -27
  283. package/src/internal/browser_utils/fetch_and_eval_using_script.js +0 -47
  284. package/src/internal/browser_utils/fetch_browser.js +0 -34
  285. package/src/internal/browser_utils/fetch_json.js +0 -7
  286. package/src/internal/building/build_logs.js +0 -134
  287. package/src/internal/building/build_stats.js +0 -100
  288. package/src/internal/building/build_url_generator.js +0 -153
  289. package/src/internal/building/build_using_rollup.js +0 -359
  290. package/src/internal/building/css/apply_post_css.js +0 -55
  291. package/src/internal/building/css/jsenv_parse_css.js +0 -260
  292. package/src/internal/building/css/move_css_urls.js +0 -44
  293. package/src/internal/building/css/parse_css_urls.js +0 -38
  294. package/src/internal/building/css/postcss_plugin_url_visitor.js +0 -245
  295. package/src/internal/building/css/replace_css_urls.js +0 -68
  296. package/src/internal/building/global_format/es_to_system.js +0 -34
  297. package/src/internal/building/html/html_node_mutations.js +0 -29
  298. package/src/internal/building/html/html_scan.js +0 -70
  299. package/src/internal/building/html/jsenv_parse_html.js +0 -813
  300. package/src/internal/building/html/minify_html.js +0 -7
  301. package/src/internal/building/import_assertions/css_module.js +0 -43
  302. package/src/internal/building/import_references.js +0 -80
  303. package/src/internal/building/importmap/jsenv_parse_importmap.js +0 -28
  304. package/src/internal/building/js/babel_plugin_inline_worker_imports.js +0 -96
  305. package/src/internal/building/js/jsenv_parse_js.js +0 -122
  306. package/src/internal/building/js/minify_js.js +0 -33
  307. package/src/internal/building/js/transform_worker.js +0 -55
  308. package/src/internal/building/json/jsenv_parse_json.js +0 -11
  309. package/src/internal/building/parse_ressource.js +0 -207
  310. package/src/internal/building/ressource_builder.js +0 -1098
  311. package/src/internal/building/ressource_builder_util.js +0 -194
  312. package/src/internal/building/rollup_plugin_jsenv.js +0 -1965
  313. package/src/internal/building/sort_pathnames.js +0 -10
  314. package/src/internal/building/sourcemap/sourcemap_loader.js +0 -70
  315. package/src/internal/building/svg/jsenv_parse_svg.js +0 -112
  316. package/src/internal/building/url_fetcher.js +0 -85
  317. package/src/internal/building/url_loader.js +0 -127
  318. package/src/internal/building/url_trace.js +0 -229
  319. package/src/internal/building/url_versioning/resolve_import_url_helper.js +0 -12
  320. package/src/internal/building/url_versioning/url_versioning.js +0 -65
  321. package/src/internal/building/webmanifest/jsenv_parse_webmanifest.js +0 -48
  322. package/src/internal/compile_server/commonjs/rollup_plugin_commonjs_named_exports.js +0 -187
  323. package/src/internal/compile_server/compile_file.js +0 -273
  324. package/src/internal/compile_server/compile_server.js +0 -519
  325. package/src/internal/compile_server/compiled_file_service.js +0 -264
  326. package/src/internal/compile_server/html/html_ast.js +0 -534
  327. package/src/internal/compile_server/html/html_source_file_service.js +0 -453
  328. package/src/internal/compile_server/html/jsenv_compile_html.js +0 -674
  329. package/src/internal/compile_server/importmap/jsenv_compile_importmap.js +0 -28
  330. package/src/internal/compile_server/js/ansi_to_html.js +0 -9
  331. package/src/internal/compile_server/js/babelHelper.js +0 -145
  332. package/src/internal/compile_server/js/babel_parse_error.js +0 -9
  333. package/src/internal/compile_server/js/babel_plugin_global_this_as_jsenv_import.js +0 -34
  334. package/src/internal/compile_server/js/babel_plugin_import_assertions.js +0 -121
  335. package/src/internal/compile_server/js/babel_plugin_import_metadata.js +0 -18
  336. package/src/internal/compile_server/js/babel_plugin_import_visitor.js +0 -84
  337. package/src/internal/compile_server/js/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -113
  338. package/src/internal/compile_server/js/babel_plugin_proxy_external_imports.js +0 -31
  339. package/src/internal/compile_server/js/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -48
  340. package/src/internal/compile_server/js/babel_plugin_replace_expressions.js +0 -101
  341. package/src/internal/compile_server/js/babel_plugin_systemjs_prepend.js +0 -23
  342. package/src/internal/compile_server/js/babel_plugin_transform_import_meta.js +0 -134
  343. package/src/internal/compile_server/js/babel_plugins.js +0 -37
  344. package/src/internal/compile_server/js/generateBabelHelper.js +0 -36
  345. package/src/internal/compile_server/js/js_transformer.js +0 -195
  346. package/src/internal/compile_server/js/jsenv_compile_js.js +0 -62
  347. package/src/internal/compile_server/js/load_babel_plugin_map_from_file.js +0 -49
  348. package/src/internal/compile_server/jsenv_directory/comparison_utils.js +0 -27
  349. package/src/internal/compile_server/jsenv_directory/compilation_result.js +0 -243
  350. package/src/internal/compile_server/jsenv_directory/compilation_result_from_build.js +0 -184
  351. package/src/internal/compile_server/jsenv_directory/compile_asset.js +0 -24
  352. package/src/internal/compile_server/jsenv_directory/compile_context.js +0 -60
  353. package/src/internal/compile_server/jsenv_directory/compile_profile.js +0 -217
  354. package/src/internal/compile_server/jsenv_directory/file_lock_registry.js +0 -24
  355. package/src/internal/compile_server/jsenv_directory/file_lock_registry.test.js +0 -47
  356. package/src/internal/compile_server/jsenv_directory/fs_optimized_for_cache.js +0 -57
  357. package/src/internal/compile_server/jsenv_directory/jsenv_directory.js +0 -183
  358. package/src/internal/compile_server/jsenv_directory/reuse_or_create_compiled_file.js +0 -269
  359. package/src/internal/compile_server/jsenv_directory/update_compile_cache.js +0 -131
  360. package/src/internal/compile_server/jsenv_directory/validate_compile_cache.js +0 -264
  361. package/src/internal/compile_server/sse_service/sse_service.js +0 -369
  362. package/src/internal/coverage/babel_plugin_instrument.js +0 -90
  363. package/src/internal/coverage/coverage_reporter_html_directory.js +0 -37
  364. package/src/internal/coverage/coverage_reporter_json_file.js +0 -22
  365. package/src/internal/coverage/coverage_reporter_text_log.js +0 -20
  366. package/src/internal/coverage/empty_coverage_factory.js +0 -70
  367. package/src/internal/coverage/file_by_file_coverage.js +0 -28
  368. package/src/internal/coverage/istanbul_coverage_composition.js +0 -28
  369. package/src/internal/coverage/istanbul_coverage_map_from_coverage.js +0 -16
  370. package/src/internal/coverage/list_files_not_covered.js +0 -20
  371. package/src/internal/coverage/missing_coverage.js +0 -46
  372. package/src/internal/coverage/report_to_coverage.js +0 -198
  373. package/src/internal/coverage/v8_and_istanbul.js +0 -38
  374. package/src/internal/coverage/v8_coverage_composition.js +0 -23
  375. package/src/internal/coverage/v8_coverage_from_directory.js +0 -86
  376. package/src/internal/coverage/v8_coverage_to_istanbul.js +0 -100
  377. package/src/internal/data_url.js +0 -54
  378. package/src/internal/dev_server/event_source_client/event_source_client.js +0 -63
  379. package/src/internal/dev_server/event_source_client/file_changes.js +0 -82
  380. package/src/internal/dev_server/event_source_client/livereload_preference.js +0 -13
  381. package/src/internal/dev_server/exploring/exploring.css +0 -237
  382. package/src/internal/dev_server/exploring/exploring.html +0 -79
  383. package/src/internal/dev_server/exploring/exploring.js +0 -243
  384. package/src/internal/dev_server/exploring/fetch_exploring_json.js +0 -19
  385. package/src/internal/dev_server/toolbar/compilation/compilation.css +0 -23
  386. package/src/internal/dev_server/toolbar/compilation/toolbar_compilation.js +0 -202
  387. package/src/internal/dev_server/toolbar/eventsource/toolbar_eventsource.js +0 -83
  388. package/src/internal/dev_server/toolbar/execution/toolbar_execution.js +0 -91
  389. package/src/internal/error_stack_remap/install_error_stack_remapping.js +0 -142
  390. package/src/internal/error_stack_remap/remap_call_site.js +0 -315
  391. package/src/internal/error_stack_remap/remap_stack.js +0 -218
  392. package/src/internal/error_stack_remap/stringify_stack.js +0 -9
  393. package/src/internal/executing/launch_and_execute.js +0 -458
  394. package/src/internal/executing/logs_file_execution.js +0 -160
  395. package/src/internal/executing/logs_plan_summary.js +0 -144
  396. package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +0 -20
  397. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +0 -23
  398. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +0 -25
  399. package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +0 -37
  400. package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +0 -9
  401. package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +0 -14
  402. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +0 -89
  403. package/src/internal/features/browser_feature_detection/compile_proxy.html +0 -27
  404. package/src/internal/features/browser_feature_detection/execute_with_script_module.js +0 -24
  405. package/src/internal/features/features_compat_from_runtime.js +0 -38
  406. package/src/internal/features/features_compat_from_runtime_support.js +0 -31
  407. package/src/internal/features/features_compatibility.js +0 -37
  408. package/src/internal/features/node_feature_detection/feature_detect_dynamic_import.mjs +0 -5
  409. package/src/internal/features/node_feature_detection/feature_detect_top_level_await.mjs +0 -1
  410. package/src/internal/features/node_feature_detection/node_feature_detect_dynamic_import.js +0 -5
  411. package/src/internal/features/node_feature_detection/node_feature_detect_top_level_await.js +0 -16
  412. package/src/internal/features/node_feature_detection/node_feature_detection.js +0 -66
  413. package/src/internal/fetching.js +0 -28
  414. package/src/internal/import_resolution/default_extension.js +0 -40
  415. package/src/internal/import_resolution/import_resolver_importmap.js +0 -64
  416. package/src/internal/import_resolution/import_resolver_node.js +0 -254
  417. package/src/internal/import_resolution/importmap_default.js +0 -37
  418. package/src/internal/jsenv_builds.js +0 -19
  419. package/src/internal/jsenv_params_assertions.js +0 -12
  420. package/src/internal/jsenv_remote_directory.js +0 -156
  421. package/src/internal/logs/byte.js +0 -10
  422. package/src/internal/logs/byte_as_file_size.js +0 -9
  423. package/src/internal/logs/ms_as_duration.js +0 -12
  424. package/src/internal/memoize.js +0 -24
  425. package/src/internal/node_launcher/eval_source.js +0 -6
  426. package/src/internal/node_launcher/fetch_source.js +0 -8
  427. package/src/internal/node_launcher/node_error_stack_remap.js +0 -22
  428. package/src/internal/node_launcher/node_execution_dynamic_import.js +0 -75
  429. package/src/internal/node_launcher/node_execution_performance.js +0 -67
  430. package/src/internal/node_launcher/node_execution_systemjs.js +0 -125
  431. package/src/internal/node_launcher/node_runtime_report.js +0 -77
  432. package/src/internal/node_launcher/node_system.js +0 -192
  433. package/src/internal/node_launcher/perf_node.js +0 -13
  434. package/src/internal/node_launcher/process_options.js +0 -46
  435. package/src/internal/node_launcher/value_install.js +0 -14
  436. package/src/internal/origin_directory_converter.js +0 -62
  437. package/src/internal/promise_race.js +0 -19
  438. package/src/internal/redirector/redirector.html +0 -40
  439. package/src/internal/regexp_escape.js +0 -34
  440. package/src/internal/require.js +0 -3
  441. package/src/internal/response_validation.js +0 -130
  442. package/src/internal/runtime_client/module_registration.js +0 -207
  443. package/src/internal/runtime_client/s.js +0 -864
  444. package/src/internal/runtime_client/s.js.md +0 -1
  445. package/src/internal/runtime_support/jsenv_runtime_support.js +0 -15
  446. package/src/internal/runtime_support/runtime_support.js +0 -70
  447. package/src/internal/semantic_versioning/compare_versions.js +0 -28
  448. package/src/internal/semantic_versioning/highest_version.js +0 -11
  449. package/src/internal/semantic_versioning/is_above.js +0 -5
  450. package/src/internal/semantic_versioning/is_below.js +0 -5
  451. package/src/internal/semantic_versioning/is_equal.js +0 -3
  452. package/src/internal/semantic_versioning/lowest_version.js +0 -11
  453. package/src/internal/semantic_versioning/version_from_value.js +0 -42
  454. package/src/internal/sourcemap_utils.js +0 -112
  455. package/src/internal/template_string_escape.js +0 -20
  456. package/src/internal/url_conversion.js +0 -313
  457. package/src/internal/url_utils.js +0 -33
  458. package/src/internal/url_utils.test.js +0 -39
  459. package/src/internal/windows_file_path_utils.js +0 -16
  460. package/src/jsenv_file_urls.js +0 -35
  461. package/src/jsenv_service_worker_finalizer.js +0 -55
  462. package/src/json_to_js_module.js +0 -13
  463. package/src/node_runtime.js +0 -227
  464. package/src/require_using_child_process.js +0 -67
  465. package/src/text_to_js_module.js +0 -13
@@ -1,458 +0,0 @@
1
- import cuid from "cuid"
2
- import { resolveUrl, writeFile } from "@jsenv/filesystem"
3
- import { createLogger, createDetailedMessage } from "@jsenv/logger"
4
- import { Abort, raceCallbacks } from "@jsenv/abort"
5
-
6
- import { composeTwoFileByFileIstanbulCoverages } from "@jsenv/core/src/internal/coverage/istanbul_coverage_composition.js"
7
-
8
- export const launchAndExecute = async ({
9
- signal = new AbortController().signal,
10
- launchAndExecuteLogLevel,
11
-
12
- runtime,
13
- runtimeParams,
14
- executeParams,
15
-
16
- allocatedMs,
17
- mirrorConsole = false,
18
- captureConsole = false, // rename collectConsole ?
19
- inheritCoverage = false,
20
- collectCoverage = false,
21
- coverageTempDirectoryUrl,
22
- measurePerformance,
23
- collectPerformance = false,
24
-
25
- // stopAfterExecute false by default because you want to keep browser alive
26
- // or nodejs process
27
- // however unit test will pass true because they want to move on
28
- stopAfterExecute = false,
29
- stopAfterExecuteReason = "stop after execute",
30
- // when launch returns { stoppedCallbackList, gracefulStop, stop }
31
- // the launched runtime have that amount of ms for disconnected to resolve
32
- // before we call stop
33
- gracefulStopAllocatedMs = 4000,
34
-
35
- runtimeConsoleCallback = () => {},
36
- runtimeStartedCallback = () => {},
37
- runtimeStoppedCallback = () => {},
38
- runtimeErrorAfterExecutionCallback = (error) => {
39
- // by default throw on error after execution
40
- throw error
41
- },
42
- } = {}) => {
43
- const logger = createLogger({ logLevel: launchAndExecuteLogLevel })
44
-
45
- if (typeof runtime !== "object") {
46
- throw new TypeError(`runtime must be an object, got ${runtime}`)
47
- }
48
- if (typeof runtime.launch !== "function") {
49
- throw new TypeError(
50
- `runtime.launch must be a function, got ${runtime.launch}`,
51
- )
52
- }
53
-
54
- let executionResultTransformer = (executionResult) => executionResult
55
-
56
- const launchAndExecuteOperation = Abort.startOperation()
57
- launchAndExecuteOperation.addAbortSignal(signal)
58
-
59
- const hasAllocatedMs =
60
- typeof allocatedMs === "number" && allocatedMs !== Infinity
61
- let timeoutAbortSource
62
-
63
- if (hasAllocatedMs) {
64
- timeoutAbortSource = launchAndExecuteOperation.timeout(
65
- // FIXME: if allocatedMs is veryyyyyy big
66
- // setTimeout may be called immediatly
67
- // in that case we should just throw that the number is too big
68
- allocatedMs,
69
- )
70
- }
71
-
72
- if (mirrorConsole) {
73
- runtimeConsoleCallback = composeCallback(
74
- runtimeConsoleCallback,
75
- ({ type, text }) => {
76
- if (type === "error") {
77
- process.stderr.write(text)
78
- } else {
79
- process.stdout.write(text)
80
- }
81
- },
82
- )
83
- }
84
-
85
- if (captureConsole) {
86
- const consoleCalls = []
87
- runtimeConsoleCallback = composeCallback(
88
- runtimeConsoleCallback,
89
- ({ type, text }) => {
90
- consoleCalls.push({ type, text })
91
- },
92
- )
93
- executionResultTransformer = composeTransformer(
94
- executionResultTransformer,
95
- (executionResult) => {
96
- executionResult.consoleCalls = consoleCalls
97
- return executionResult
98
- },
99
- )
100
- }
101
-
102
- executionResultTransformer = composeTransformer(
103
- executionResultTransformer,
104
- (executionResult) => {
105
- executionResult.runtimeName = runtime.name
106
- executionResult.runtimeVersion = runtime.version
107
- return executionResult
108
- },
109
- )
110
-
111
- if (
112
- inheritCoverage &&
113
- // NODE_V8_COVERAGE is doing the coverage propagation for us
114
- !process.env.NODE_V8_COVERAGE
115
- ) {
116
- const collectCoverageSaved = collectCoverage
117
- collectCoverage = true
118
- executionResultTransformer = composeTransformer(
119
- executionResultTransformer,
120
- (executionResult) => {
121
- const { coverage } = executionResult
122
- // propagate coverage from execution to this process
123
- global.__coverage__ = composeTwoFileByFileIstanbulCoverages(
124
- global.__coverage__ || {},
125
- coverage || {},
126
- )
127
-
128
- if (!collectCoverageSaved) {
129
- delete executionResult.coverage
130
- }
131
-
132
- return executionResult
133
- },
134
- )
135
- }
136
-
137
- if (collectCoverage) {
138
- executionResultTransformer = composeTransformer(
139
- executionResultTransformer,
140
- async (executionResult) => {
141
- // we do not keep coverage in memory, it can grow very big
142
- // instead we store it on the filesystem, they will be read and merged together later on
143
- // in "executeConcurrently"
144
- const { coverage } = executionResult
145
- if (coverage) {
146
- const coverageFileUrl = resolveUrl(
147
- `./${runtime.name}/${cuid()}`,
148
- coverageTempDirectoryUrl,
149
- )
150
- await writeFile(coverageFileUrl, JSON.stringify(coverage, null, " "))
151
- executionResult.coverageFileUrl = coverageFileUrl
152
- delete executionResult.coverage
153
- }
154
-
155
- // indirectCoverage is a feature making possible to collect
156
- // coverage generated by executing a node process which executes
157
- // a browser. The coverage coming the browser execution would be lost
158
- // if not propagated somehow.
159
- // This is possible if the node process collect the browser coverage
160
- // and write it into global.__indirectCoverage__
161
- // This is used by jsenv during tests execution
162
- const { indirectCoverage } = executionResult
163
- if (indirectCoverage) {
164
- const indirectCoverageFileUrl = resolveUrl(
165
- `./${runtime.name}/${cuid()}`,
166
- coverageTempDirectoryUrl,
167
- )
168
- await writeFile(
169
- indirectCoverageFileUrl,
170
- JSON.stringify(indirectCoverage, null, " "),
171
- )
172
- executionResult.indirectCoverageFileUrl = indirectCoverageFileUrl
173
- delete executionResult.indirectCoverage
174
- }
175
-
176
- return executionResult
177
- },
178
- )
179
- } else {
180
- executionResultTransformer = composeTransformer(
181
- executionResultTransformer,
182
- (executionResult) => {
183
- // as collectCoverage is disabled
184
- // executionResult.coverage is undefined or {}
185
- // we delete it just to have a cleaner object
186
- delete executionResult.coverage
187
- delete executionResult.indirectCoverage
188
- return executionResult
189
- },
190
- )
191
- }
192
-
193
- const startMs = Date.now()
194
- executionResultTransformer = composeTransformer(
195
- executionResultTransformer,
196
- (executionResult) => {
197
- executionResult.duration = Date.now() - startMs
198
- return executionResult
199
- },
200
- )
201
-
202
- try {
203
- const runtimeLabel = `${runtime.name}/${runtime.version}`
204
- logger.debug(`launch ${runtimeLabel} to execute something in it`)
205
-
206
- launchAndExecuteOperation.throwIfAborted()
207
- const launchReturnValue = await runtime.launch({
208
- signal: launchAndExecuteOperation.signal,
209
- logger,
210
- stopAfterExecute,
211
- measurePerformance,
212
- collectPerformance,
213
- ...runtimeParams,
214
- })
215
- validateLaunchReturnValue(launchReturnValue)
216
-
217
- const stopRuntime = async (reason) => {
218
- const { stop } = launchReturnValue
219
- logger.debug(`${runtimeLabel}: stop() because ${reason}`)
220
- const { graceful } = await stop({ reason, gracefulStopAllocatedMs })
221
- if (graceful) {
222
- logger.debug(`${runtimeLabel}: runtime stopped gracefully`)
223
- } else {
224
- logger.debug(`${runtimeLabel}: runtime stopped`)
225
- }
226
- }
227
- launchAndExecuteOperation.addAbortCallback(async () => {
228
- await stopRuntime("Operation aborted")
229
- })
230
-
231
- logger.debug(createDetailedMessage(`${runtimeLabel}: runtime launched`))
232
- runtimeStartedCallback()
233
-
234
- logger.debug(`${runtimeLabel}: start execution`)
235
- const {
236
- errorCallbackList,
237
- outputCallbackList,
238
- stoppedCallbackList,
239
- execute,
240
- finalizeExecutionResult = (executionResult) => executionResult,
241
- } = launchReturnValue
242
- executionResultTransformer = composeTransformer(
243
- executionResultTransformer,
244
- finalizeExecutionResult,
245
- )
246
- outputCallbackList.add(runtimeConsoleCallback)
247
-
248
- let executionResult = await callExecute({
249
- launchAndExecuteOperation,
250
- errorCallbackList,
251
- stoppedCallbackList,
252
- execute,
253
- executeParams,
254
- })
255
-
256
- if (stopAfterExecute) {
257
- // stopping runtime is part of the execution
258
- try {
259
- await stopRuntime(stopAfterExecuteReason)
260
- } catch (e) {
261
- executionResult = createErroredExecutionResult({
262
- error: e,
263
- })
264
- }
265
- } else {
266
- // when the process is still alive
267
- // we want to catch error to notify runtimeErrorAfterExecutionCallback
268
- // and throw that error by default
269
- errorCallbackList.add((error) => {
270
- runtimeErrorAfterExecutionCallback(error)
271
- })
272
- stoppedCallbackList.add(() => {
273
- logger.debug(`${runtimeLabel}: runtime stopped after execution`)
274
- runtimeStoppedCallback()
275
- })
276
- }
277
-
278
- if (executionResult.status === "errored") {
279
- // debug log level because this error happens during execution
280
- // there is no need to log it.
281
- // the code will know the execution errored because it receives
282
- // an errored execution result
283
- logger.debug(
284
- createDetailedMessage(`error during execution`, {
285
- ["error stack"]: executionResult.error.stack,
286
- ["execute params"]: JSON.stringify(executeParams, null, " "),
287
- ["runtime"]: runtime,
288
- }),
289
- )
290
- } else {
291
- logger.debug(`${runtimeLabel}: execution ${executionResult.status}`)
292
- }
293
-
294
- return executionResultTransformer(executionResult)
295
- } catch (e) {
296
- if (Abort.isAbortError(e)) {
297
- if (timeoutAbortSource && timeoutAbortSource.signal.aborted) {
298
- const executionResult = createTimedoutExecutionResult()
299
- return executionResultTransformer(executionResult)
300
- }
301
- const executionResult = createAbortedExecutionResult()
302
- return executionResultTransformer(executionResult)
303
- }
304
- throw e
305
- } finally {
306
- await launchAndExecuteOperation.end()
307
- }
308
- }
309
-
310
- const callExecute = async ({
311
- launchAndExecuteOperation,
312
- errorCallbackList,
313
- stoppedCallbackList,
314
- execute,
315
- executeParams,
316
- }) => {
317
- const winnerPromise = new Promise((resolve, reject) => {
318
- raceCallbacks(
319
- {
320
- aborted: (cb) => {
321
- launchAndExecuteOperation.signal.addEventListener("abort", cb)
322
- return () => {
323
- launchAndExecuteOperation.signal.removeEventListener("abort", cb)
324
- }
325
- },
326
- error: (cb) => {
327
- return errorCallbackList.add(cb)
328
- },
329
- stopped: (cb) => {
330
- return stoppedCallbackList.add(cb)
331
- },
332
- executed: async (cb) => {
333
- try {
334
- const executionResult = await execute({
335
- signal: launchAndExecuteOperation.signal,
336
- ...executeParams,
337
- })
338
- cb(executionResult)
339
- } catch (e) {
340
- if (Abort.isAbortError(e)) {
341
- cb(e)
342
- return
343
- }
344
- reject(e)
345
- }
346
- },
347
- },
348
- resolve,
349
- )
350
- })
351
-
352
- launchAndExecuteOperation.throwIfAborted()
353
- const winner = await winnerPromise
354
-
355
- if (winner.name === "aborted") {
356
- launchAndExecuteOperation.throwIfAborted()
357
- }
358
-
359
- if (winner.name === "error") {
360
- return createErroredExecutionResult({
361
- error: winner.data,
362
- })
363
- }
364
-
365
- if (winner.name === "stopped") {
366
- return createErroredExecutionResult({
367
- error: new Error(`runtime stopped during execution`),
368
- })
369
- }
370
-
371
- const executeResult = winner.data
372
- if (Abort.isAbortError(executeResult)) {
373
- throw executeResult
374
- }
375
- const { status } = executeResult
376
- if (status === "errored") {
377
- return createErroredExecutionResult(executeResult)
378
- }
379
- return createCompletedExecutionResult(executeResult)
380
- }
381
-
382
- const createAbortedExecutionResult = () => {
383
- return {
384
- status: "aborted",
385
- }
386
- }
387
-
388
- const createTimedoutExecutionResult = () => {
389
- return {
390
- status: "timedout",
391
- }
392
- }
393
-
394
- const createErroredExecutionResult = (executionResult) => {
395
- return {
396
- ...executionResult,
397
- status: "errored",
398
- }
399
- }
400
-
401
- const createCompletedExecutionResult = (executionResult) => {
402
- return {
403
- ...executionResult,
404
- status: "completed",
405
- namespace: normalizeNamespace(executionResult.namespace),
406
- }
407
- }
408
-
409
- const normalizeNamespace = (namespace) => {
410
- if (typeof namespace !== "object") return namespace
411
- if (namespace instanceof Promise) return namespace
412
- const normalized = {}
413
- // remove "__esModule" or Symbol.toStringTag from namespace object
414
- Object.keys(namespace).forEach((key) => {
415
- normalized[key] = namespace[key]
416
- })
417
- return normalized
418
- }
419
-
420
- const composeCallback = (previousCallback, callback) => {
421
- return (...args) => {
422
- previousCallback(...args)
423
- return callback(...args)
424
- }
425
- }
426
-
427
- const composeTransformer = (previousTransformer, transformer) => {
428
- return async (value) => {
429
- const transformedValue = await previousTransformer(value)
430
- return transformer(transformedValue)
431
- }
432
- }
433
-
434
- const validateLaunchReturnValue = (launchReturnValue) => {
435
- if (launchReturnValue === null) {
436
- throw new Error(`runtime.launch must return an object, got null`)
437
- }
438
-
439
- if (typeof launchReturnValue !== "object") {
440
- throw new Error(
441
- `runtime.launch must return an object, got ${launchReturnValue}`,
442
- )
443
- }
444
-
445
- const { execute } = launchReturnValue
446
- if (typeof execute !== "function") {
447
- throw new Error(
448
- `runtime.launch must return an execute function, got ${execute}`,
449
- )
450
- }
451
-
452
- const { stoppedCallbackList } = launchReturnValue
453
- if (!stoppedCallbackList) {
454
- throw new Error(
455
- `runtime.launch must return a stoppedCallbackList object, got ${stoppedCallbackList}`,
456
- )
457
- }
458
- }
@@ -1,160 +0,0 @@
1
- import { ANSI, UNICODE } from "@jsenv/log"
2
-
3
- import { msAsDuration } from "@jsenv/core/src/internal/logs/ms_as_duration.js"
4
-
5
- import { EXECUTION_COLORS } from "./execution_colors.js"
6
- import { createIntermediateSummary } from "./logs_plan_summary.js"
7
-
8
- export const formatExecuting = (
9
- { executionIndex },
10
- {
11
- executionCount,
12
- abortedCount,
13
- timedoutCount,
14
- erroredCount,
15
- completedCount,
16
- memoryHeap,
17
- },
18
- ) => {
19
- const executionNumber = executionIndex + 1
20
- const description = ANSI.color(
21
- `executing ${executionNumber} of ${executionCount}`,
22
- EXECUTION_COLORS.executing,
23
- )
24
- const summary =
25
- executionIndex === 0
26
- ? ""
27
- : `(${createIntermediateSummary({
28
- executionCount: executionIndex,
29
- abortedCount,
30
- timedoutCount,
31
- erroredCount,
32
- completedCount,
33
- memoryHeap,
34
- })})`
35
-
36
- return formatExecution({
37
- label: `${description} ${summary}`,
38
- })
39
- }
40
-
41
- export const formatExecutionResult = (
42
- {
43
- executionIndex,
44
- fileRelativeUrl,
45
- runtimeName,
46
- runtimeVersion,
47
- executionParams,
48
- executionResult,
49
- },
50
- {
51
- completedExecutionLogAbbreviation,
52
- executionCount,
53
- abortedCount,
54
- timedoutCount,
55
- erroredCount,
56
- completedCount,
57
- memoryHeap,
58
- },
59
- ) => {
60
- const executionNumber = executionIndex + 1
61
- const { status } = executionResult
62
- const { allocatedMs } = executionParams
63
-
64
- const description = descriptionFormatters[status]({
65
- executionNumber,
66
- executionCount,
67
- allocatedMs,
68
- })
69
-
70
- const summary = `(${createIntermediateSummary({
71
- executionCount: executionNumber,
72
- abortedCount,
73
- timedoutCount,
74
- erroredCount,
75
- completedCount,
76
- memoryHeap,
77
- })})`
78
-
79
- if (completedExecutionLogAbbreviation && status === "completed") {
80
- return `${description} ${summary}`
81
- }
82
-
83
- const { consoleCalls = [], error, duration } = executionResult
84
- const console = formatConsoleCalls(consoleCalls)
85
-
86
- return formatExecution({
87
- label: `${description} ${summary}`,
88
- details: {
89
- file: fileRelativeUrl,
90
- runtime: `${runtimeName}/${runtimeVersion}`,
91
- duration: msAsDuration(duration),
92
- ...(error ? { error: error.stack } : {}),
93
- },
94
- console,
95
- })
96
- }
97
-
98
- const descriptionFormatters = {
99
- aborted: ({ executionNumber, executionCount }) => {
100
- return ANSI.color(
101
- `${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} aborted`,
102
- EXECUTION_COLORS.aborted,
103
- )
104
- },
105
- timedout: ({ executionNumber, allocatedMs, executionCount }) => {
106
- return ANSI.color(
107
- `${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} timeout after ${allocatedMs}ms`,
108
- EXECUTION_COLORS.timedout,
109
- )
110
- },
111
- errored: ({ executionNumber, executionCount }) => {
112
- return ANSI.color(
113
- `${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} errored`,
114
- EXECUTION_COLORS.errored,
115
- )
116
- },
117
- completed: ({ executionNumber, executionCount }) => {
118
- return ANSI.color(
119
- `${UNICODE.OK_RAW} execution ${executionNumber} of ${executionCount} completed`,
120
- EXECUTION_COLORS.completed,
121
- )
122
- },
123
- cancelled: ({ executionNumber, executionCount }) => {
124
- return ANSI.color(
125
- `${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} cancelled`,
126
- EXECUTION_COLORS.cancelled,
127
- )
128
- },
129
- }
130
-
131
- const formatConsoleCalls = (consoleCalls) => {
132
- const consoleOutput = consoleCalls.reduce((previous, { text }) => {
133
- return `${previous}${text}`
134
- }, "")
135
-
136
- const consoleOutputTrimmed = consoleOutput.trim()
137
- if (consoleOutputTrimmed === "") {
138
- return ""
139
- }
140
-
141
- return `${ANSI.color(`-------- console --------`, ANSI.GREY)}
142
- ${consoleOutputTrimmed}
143
- ${ANSI.color(`-------------------------`, ANSI.GREY)}`
144
- }
145
-
146
- const formatExecution = ({ label, details = {}, console }) => {
147
- let message = ``
148
-
149
- message += label
150
- Object.keys(details).forEach((key) => {
151
- message += `
152
- ${key}: ${details[key]}`
153
- })
154
- if (console) {
155
- message += `
156
- ${console}`
157
- }
158
-
159
- return message
160
- }