@jsenv/core 25.6.2 → 27.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (476) hide show
  1. package/main.js +18 -20
  2. package/package.json +38 -73
  3. package/readme.md +32 -44
  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/animation/toolbar.animation.js → 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/focus/toolbar.focus.js → dev/plugins/toolbar/client/focus/toolbar_focus.js} +0 -0
  30. package/src/{internal/dev_server/toolbar/jsenv-logo.svg → dev/plugins/toolbar/client/jsenv_logo.svg} +1 -1
  31. package/src/{internal/dev_server/toolbar/notification/toolbar.notification.js → dev/plugins/toolbar/client/notification/toolbar_notification.js} +0 -0
  32. package/src/{internal/dev_server/toolbar/responsive/overflow-menu.css → dev/plugins/toolbar/client/responsive/overflow_menu.css} +0 -0
  33. package/src/{internal/dev_server/toolbar/responsive/toolbar.responsive.js → 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/settings/toolbar.settings.js → dev/plugins/toolbar/client/settings/toolbar_settings.js} +1 -0
  36. package/src/{internal/dev_server/toolbar/theme/jsenv-theme.css → dev/plugins/toolbar/client/theme/jsenv_theme.css} +1 -15
  37. package/src/{internal/dev_server/toolbar/theme/light-theme.css → dev/plugins/toolbar/client/theme/light_theme.css} +0 -17
  38. package/src/{internal/dev_server/toolbar/theme/toolbar.theme.js → dev/plugins/toolbar/client/theme/toolbar_theme.js} +0 -0
  39. package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar.html +42 -201
  40. package/src/{internal/dev_server/toolbar/toolbar.injector.js → dev/plugins/toolbar/client/toolbar_injector.js} +10 -29
  41. package/src/{internal/dev_server/toolbar/toolbar.main.css → dev/plugins/toolbar/client/toolbar_main.css} +2 -26
  42. package/src/{internal/dev_server/toolbar/toolbar.main.js → dev/plugins/toolbar/client/toolbar_main.js} +18 -64
  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/fetchUsingXHR.js → dev/plugins/toolbar/client/util/fetch_using_xhr.js} +0 -2
  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/util/jsenvLogger.js → 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/execute/runtimes/browsers/webkit.js +24 -0
  63. package/src/{internal/node_launcher/createChildProcessOptions.js → execute/runtimes/node/child_exec_options.js} +25 -36
  64. package/src/{internal/node_runtime/nodeControllableFile.mjs → execute/runtimes/node/controllable_file.mjs} +1 -18
  65. package/src/{internal/node_launcher/createControllableNodeProcess.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 +4 -2
  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/compiling/js-compilation-service → omega/core_plugins/babel/babel_helper}/babel_plugin_babel_helpers_as_jsenv_imports.js +16 -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_runtime/displayErrorInDocument.js → omega/core_plugins/html_supervisor/client/error_in_document.js} +10 -18
  176. package/src/{internal/browser_runtime/displayErrorNotification.js → omega/core_plugins/html_supervisor/client/error_in_notification.js} +0 -1
  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 → omega/core_plugins/html_supervisor/client}/perf_browser.js +0 -2
  180. package/src/{internal/unevalException.js → omega/core_plugins/html_supervisor/client/uneval_exception.js} +1 -1
  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 → 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/executePlan.js → test/execute_plan.js} +159 -213
  220. package/src/{executeTestPlan.js → test/execute_test_plan.js} +36 -84
  221. package/src/{internal/executing → test}/execution_colors.js +0 -0
  222. package/src/{internal/executing/generateFileExecutionSteps.js → test/execution_steps.js} +25 -4
  223. package/src/{internal/executing → test}/gc.js +0 -0
  224. package/src/test/logs_file_execution.js +223 -0
  225. package/dist/browser_runtime/asset-manifest.json +0 -4
  226. package/dist/browser_runtime/browser_runtime_c81cd9af.js +0 -5300
  227. package/dist/browser_runtime/browser_runtime_c81cd9af.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_c05fdc30.js.map +0 -343
  231. package/dist/compile_proxy/compile_proxy_93ec4247.html +0 -2247
  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_20421b23.js.map +0 -349
  237. package/dist/redirector/redirector_ddc79416.html +0 -2292
  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_72a60fa3.map +0 -12
  244. package/dist/toolbar/assets/overflow-menu.css_2859d519.map +0 -12
  245. package/dist/toolbar/assets/settings.css_942b5a9e.map +0 -12
  246. package/dist/toolbar/assets/toolbar.main.css_b7d8bec1.map +0 -28
  247. package/dist/toolbar/assets/tooltip.css_a94a8bdd.map +0 -12
  248. package/dist/toolbar/toolbar.main_7d7783d3.js.map +0 -776
  249. package/dist/toolbar/toolbar_d6045dd0.html +0 -4978
  250. package/dist/toolbar_injector/asset-manifest.json +0 -5
  251. package/dist/toolbar_injector/assets/jsenv-logo_188b9ca6.svg +0 -95
  252. package/dist/toolbar_injector/toolbar_injector_c8c214dd.js +0 -977
  253. package/dist/toolbar_injector/toolbar_injector_c8c214dd.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/buildProject.js +0 -336
  257. package/src/commonJsToJavaScriptModule.js +0 -180
  258. package/src/dev_server.js +0 -295
  259. package/src/execute.js +0 -184
  260. package/src/importUsingChildProcess.js +0 -68
  261. package/src/internal/argUtils.js +0 -12
  262. package/src/internal/babel_plugin_replace_expressions.js +0 -101
  263. package/src/internal/browser_detection/browser_detection.js +0 -68
  264. package/src/internal/browser_detection/detectAndroid.js +0 -13
  265. package/src/internal/browser_detection/detectChrome.js +0 -28
  266. package/src/internal/browser_detection/detectEdge.js +0 -13
  267. package/src/internal/browser_detection/detectElectron.js +0 -1
  268. package/src/internal/browser_detection/detectFirefox.js +0 -17
  269. package/src/internal/browser_detection/detectIOS.js +0 -19
  270. package/src/internal/browser_detection/detectInternetExplorer.js +0 -14
  271. package/src/internal/browser_detection/detectOpera.js +0 -27
  272. package/src/internal/browser_detection/detectSafari.js +0 -13
  273. package/src/internal/browser_detection/user_agent_data.js +0 -26
  274. package/src/internal/browser_detection/util.js +0 -13
  275. package/src/internal/browser_launcher/browser_runtime_profile.js +0 -81
  276. package/src/internal/browser_launcher/executeHtmlFile.js +0 -354
  277. package/src/internal/browser_launcher/from_playwright.js +0 -320
  278. package/src/internal/browser_launcher/trackPageToNotify.js +0 -77
  279. package/src/internal/browser_runtime/browser_runtime.js +0 -224
  280. package/src/internal/browser_runtime/browser_system.js +0 -218
  281. package/src/internal/browser_runtime/createBrowserRuntime.js +0 -146
  282. package/src/internal/browser_runtime/evalSource.js +0 -11
  283. package/src/internal/browser_runtime/makeNamespaceTransferable.js +0 -90
  284. package/src/internal/browser_utils/fetchAndEvalUsingFetch.js +0 -29
  285. package/src/internal/browser_utils/fetchAndEvalUsingScript.js +0 -49
  286. package/src/internal/browser_utils/fetchJson.js +0 -7
  287. package/src/internal/browser_utils/fetch_browser.js +0 -34
  288. package/src/internal/building/buildToCompilationResult.js +0 -183
  289. package/src/internal/building/buildUsingRollup.js +0 -359
  290. package/src/internal/building/build_logs.js +0 -133
  291. package/src/internal/building/build_stats.js +0 -100
  292. package/src/internal/building/build_url_generator.js +0 -153
  293. package/src/internal/building/css/applyPostCss.js +0 -55
  294. package/src/internal/building/css/moveCssUrls.js +0 -44
  295. package/src/internal/building/css/parseCssRessource.js +0 -259
  296. package/src/internal/building/css/parseCssUrls.js +0 -38
  297. package/src/internal/building/css/postcss_plugin_url_visitor.js +0 -244
  298. package/src/internal/building/css/replaceCssUrls.js +0 -67
  299. package/src/internal/building/css_module.js +0 -43
  300. package/src/internal/building/es_to_system.js +0 -34
  301. package/src/internal/building/html/htmlScan.js +0 -70
  302. package/src/internal/building/html/minifyHtml.js +0 -7
  303. package/src/internal/building/html/parseHtmlRessource.js +0 -814
  304. package/src/internal/building/import_references.js +0 -80
  305. package/src/internal/building/importmap/parseImportmapRessource.js +0 -28
  306. package/src/internal/building/js/babel_plugin_inline_worker_imports.js +0 -96
  307. package/src/internal/building/js/minifyJs.js +0 -33
  308. package/src/internal/building/js/parseJsRessource.js +0 -121
  309. package/src/internal/building/js/transform_worker.js +0 -55
  310. package/src/internal/building/json/parseJsonRessource.js +0 -11
  311. package/src/internal/building/parseRessource.js +0 -207
  312. package/src/internal/building/parsing.utils.js +0 -29
  313. package/src/internal/building/resolve_import_url_helper.js +0 -12
  314. package/src/internal/building/ressource_builder.js +0 -1097
  315. package/src/internal/building/ressource_builder_util.js +0 -194
  316. package/src/internal/building/rollup_plugin_jsenv.js +0 -1963
  317. package/src/internal/building/sortObjectByPathnames.js +0 -10
  318. package/src/internal/building/sourcemap_loader.js +0 -73
  319. package/src/internal/building/svg/parseSvgRessource.js +0 -111
  320. package/src/internal/building/url_fetcher.js +0 -85
  321. package/src/internal/building/url_loader.js +0 -127
  322. package/src/internal/building/url_trace.js +0 -229
  323. package/src/internal/building/url_versioning.js +0 -65
  324. package/src/internal/building/webmanifest/parseWebmanifestRessource.js +0 -48
  325. package/src/internal/compiling/babel_parse_error.js +0 -9
  326. package/src/internal/compiling/babel_plugin_global_this_as_jsenv_import.js +0 -34
  327. package/src/internal/compiling/babel_plugin_import_assertions.js +0 -120
  328. package/src/internal/compiling/babel_plugin_import_metadata.js +0 -18
  329. package/src/internal/compiling/babel_plugin_import_visitor.js +0 -84
  330. package/src/internal/compiling/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -113
  331. package/src/internal/compiling/babel_plugin_proxy_external_imports.js +0 -31
  332. package/src/internal/compiling/babel_plugin_transform_import_meta.js +0 -134
  333. package/src/internal/compiling/babel_plugins.js +0 -37
  334. package/src/internal/compiling/compileFile.js +0 -271
  335. package/src/internal/compiling/compileHtml.js +0 -544
  336. package/src/internal/compiling/createCompiledFileService.js +0 -263
  337. package/src/internal/compiling/html_source_file_service.js +0 -453
  338. package/src/internal/compiling/js-compilation-service/ansiToHTML.js +0 -9
  339. package/src/internal/compiling/js-compilation-service/babelHelper.js +0 -145
  340. package/src/internal/compiling/js-compilation-service/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -48
  341. package/src/internal/compiling/js-compilation-service/babel_plugin_systemjs_prepend.js +0 -23
  342. package/src/internal/compiling/js-compilation-service/generateBabelHelper.js +0 -36
  343. package/src/internal/compiling/js-compilation-service/transformJs.js +0 -196
  344. package/src/internal/compiling/jsenvCompilerForHtml.js +0 -674
  345. package/src/internal/compiling/jsenvCompilerForImportmap.js +0 -28
  346. package/src/internal/compiling/jsenvCompilerForJavaScript.js +0 -61
  347. package/src/internal/compiling/jsenv_directory/comparison_utils.js +0 -27
  348. package/src/internal/compiling/jsenv_directory/compile_asset.js +0 -24
  349. package/src/internal/compiling/jsenv_directory/compile_context.js +0 -60
  350. package/src/internal/compiling/jsenv_directory/compile_profile.js +0 -217
  351. package/src/internal/compiling/jsenv_directory/file_lock_registry.js +0 -24
  352. package/src/internal/compiling/jsenv_directory/file_lock_registry.test.js +0 -47
  353. package/src/internal/compiling/jsenv_directory/fs-optimized-for-cache.js +0 -57
  354. package/src/internal/compiling/jsenv_directory/getOrGenerateCompiledFile.js +0 -269
  355. package/src/internal/compiling/jsenv_directory/jsenv_directory.js +0 -174
  356. package/src/internal/compiling/jsenv_directory/updateMeta.js +0 -150
  357. package/src/internal/compiling/jsenv_directory/validateCache.js +0 -264
  358. package/src/internal/compiling/load_babel_plugin_map_from_file.js +0 -49
  359. package/src/internal/compiling/rollup_plugin_commonjs_named_exports.js +0 -187
  360. package/src/internal/compiling/sse_service/sse_service.js +0 -369
  361. package/src/internal/compiling/startCompileServer.js +0 -518
  362. package/src/internal/compiling/transformResultToCompilationResult.js +0 -242
  363. package/src/internal/dataUrl.utils.js +0 -55
  364. package/src/internal/dev_server/event_source_client/event_source_client.js +0 -63
  365. package/src/internal/dev_server/event_source_client/file_changes.js +0 -82
  366. package/src/internal/dev_server/event_source_client/livereload_preference.js +0 -13
  367. package/src/internal/dev_server/exploring/exploring.css +0 -237
  368. package/src/internal/dev_server/exploring/exploring.html +0 -79
  369. package/src/internal/dev_server/exploring/exploring.js +0 -243
  370. package/src/internal/dev_server/exploring/fetchExploringJson.js +0 -19
  371. package/src/internal/dev_server/toolbar/compilation/compilation.css +0 -23
  372. package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +0 -201
  373. package/src/internal/dev_server/toolbar/eventsource/toolbar.eventsource.js +0 -83
  374. package/src/internal/dev_server/toolbar/execution/toolbar.execution.js +0 -91
  375. package/src/internal/error-stack-remapping/getOriginalCallsites.js +0 -217
  376. package/src/internal/error-stack-remapping/installBrowserErrorStackRemapping.js +0 -45
  377. package/src/internal/error-stack-remapping/installErrorStackRemapping.js +0 -141
  378. package/src/internal/error-stack-remapping/installNodeErrorStackRemapping.js +0 -20
  379. package/src/internal/error-stack-remapping/remapCallSite.js +0 -314
  380. package/src/internal/error-stack-remapping/stackToString.js +0 -9
  381. package/src/internal/escapeRegexpSpecialCharacters.js +0 -34
  382. package/src/internal/escapeTemplateStringSpecialCharacters.js +0 -20
  383. package/src/internal/executing/coverage/babel_plugin_instrument.js +0 -90
  384. package/src/internal/executing/coverage/reportToCoverage.js +0 -198
  385. package/src/internal/executing/coverage_missing/createEmptyCoverage.js +0 -6
  386. package/src/internal/executing/coverage_missing/list_files_not_covered.js +0 -20
  387. package/src/internal/executing/coverage_missing/missing_coverage.js +0 -46
  388. package/src/internal/executing/coverage_missing/relativeUrlToEmptyCoverage.js +0 -63
  389. package/src/internal/executing/coverage_reporter/coverage_reporter_html_directory.js +0 -36
  390. package/src/internal/executing/coverage_reporter/coverage_reporter_json_file.js +0 -22
  391. package/src/internal/executing/coverage_reporter/coverage_reporter_text_log.js +0 -19
  392. package/src/internal/executing/coverage_reporter/istanbulCoverageMapFromCoverage.js +0 -16
  393. package/src/internal/executing/coverage_utils/file_by_file_coverage.js +0 -28
  394. package/src/internal/executing/coverage_utils/istanbul_coverage_composition.js +0 -28
  395. package/src/internal/executing/coverage_utils/v8_and_istanbul.js +0 -38
  396. package/src/internal/executing/coverage_utils/v8_coverage_composition.js +0 -23
  397. package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +0 -86
  398. package/src/internal/executing/coverage_utils/v8_coverage_to_istanbul.js +0 -100
  399. package/src/internal/executing/createSummaryLog.js +0 -143
  400. package/src/internal/executing/executionIsPassed.js +0 -2
  401. package/src/internal/executing/executionLogs.js +0 -159
  402. package/src/internal/executing/generateExecutionSteps.js +0 -29
  403. package/src/internal/executing/launchAndExecute.js +0 -458
  404. package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +0 -20
  405. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +0 -23
  406. package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +0 -25
  407. package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +0 -37
  408. package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +0 -9
  409. package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +0 -14
  410. package/src/internal/features/browser_feature_detection/browser_feature_detection.js +0 -89
  411. package/src/internal/features/browser_feature_detection/compile_proxy.html +0 -27
  412. package/src/internal/features/browser_feature_detection/execute_with_script_module.js +0 -24
  413. package/src/internal/features/features_compat_from_runtime.js +0 -38
  414. package/src/internal/features/features_compat_from_runtime_support.js +0 -31
  415. package/src/internal/features/features_compatibility.js +0 -37
  416. package/src/internal/features/node_feature_detection/feature_detect_dynamic_import.mjs +0 -5
  417. package/src/internal/features/node_feature_detection/feature_detect_top_level_await.mjs +0 -1
  418. package/src/internal/features/node_feature_detection/node_feature_detect_dynamic_import.js +0 -5
  419. package/src/internal/features/node_feature_detection/node_feature_detect_top_level_await.js +0 -16
  420. package/src/internal/features/node_feature_detection/node_feature_detection.js +0 -66
  421. package/src/internal/fetchUrl.js +0 -28
  422. package/src/internal/filePathUtils.js +0 -19
  423. package/src/internal/import-resolution/default-extension.js +0 -40
  424. package/src/internal/import-resolution/import-resolver-importmap.js +0 -64
  425. package/src/internal/import-resolution/import-resolver-node.js +0 -254
  426. package/src/internal/import-resolution/importmap_default.js +0 -37
  427. package/src/internal/jsenvCoreDirectoryUrl.js +0 -11
  428. package/src/internal/jsenvInternalFiles.js +0 -36
  429. package/src/internal/jsenv_builds.js +0 -19
  430. package/src/internal/jsenv_remote_directory.js +0 -156
  431. package/src/internal/logs/byte.js +0 -10
  432. package/src/internal/logs/byteAsFileSize.js +0 -9
  433. package/src/internal/logs/msAsDuration.js +0 -12
  434. package/src/internal/memoize.js +0 -24
  435. package/src/internal/node_launcher/node_runtime_report.js +0 -77
  436. package/src/internal/node_launcher/processOptions.js +0 -46
  437. package/src/internal/node_runtime/evalSource.js +0 -6
  438. package/src/internal/node_runtime/fetchSource.js +0 -8
  439. package/src/internal/node_runtime/node_execution_dynamic_import.js +0 -74
  440. package/src/internal/node_runtime/node_execution_performance.js +0 -67
  441. package/src/internal/node_runtime/node_execution_systemjs.js +0 -125
  442. package/src/internal/node_runtime/node_system.js +0 -191
  443. package/src/internal/origin_directory_converter.js +0 -62
  444. package/src/internal/perf_node.js +0 -13
  445. package/src/internal/promise_race.js +0 -19
  446. package/src/internal/redirector/redirector.html +0 -40
  447. package/src/internal/require.js +0 -3
  448. package/src/internal/response_validation.js +0 -130
  449. package/src/internal/runtime/module-registration.js +0 -207
  450. package/src/internal/runtime/s.js +0 -864
  451. package/src/internal/runtime/s.js.md +0 -1
  452. package/src/internal/runtime/valueInstall.js +0 -14
  453. package/src/internal/runtime_support/jsenv_runtime_support.js +0 -15
  454. package/src/internal/runtime_support/runtime_support.js +0 -70
  455. package/src/internal/semantic_versioning/findHighestVersion.js +0 -12
  456. package/src/internal/semantic_versioning/findLowestVersion.js +0 -12
  457. package/src/internal/semantic_versioning/index.js +0 -5
  458. package/src/internal/semantic_versioning/valueToVersion.js +0 -44
  459. package/src/internal/semantic_versioning/versionCompare.js +0 -32
  460. package/src/internal/semantic_versioning/versionIsAbove.js +0 -5
  461. package/src/internal/semantic_versioning/versionIsBelow.js +0 -5
  462. package/src/internal/semantic_versioning/versionIsEqual.js +0 -3
  463. package/src/internal/sourceMappingURLUtils.js +0 -112
  464. package/src/internal/url_conversion.js +0 -313
  465. package/src/internal/url_utils.js +0 -33
  466. package/src/internal/url_utils.test.js +0 -39
  467. package/src/jsenvCoverageConfig.js +0 -7
  468. package/src/jsenvExplorableConfig.js +0 -9
  469. package/src/jsenvRuntimeSupportDuringDev.js +0 -12
  470. package/src/jsenvServiceWorkerFinalizer.js +0 -55
  471. package/src/jsonToJavaScriptModule.js +0 -12
  472. package/src/launchBrowser.js +0 -43
  473. package/src/launchNode.js +0 -227
  474. package/src/playwright_browser_versions.js +0 -5
  475. package/src/requireUsingChildProcess.js +0 -67
  476. package/src/textToJavaScriptModule.js +0 -14
@@ -1,18 +1,9 @@
1
1
  import { findFreePort } from "@jsenv/server"
2
2
  import { createDetailedMessage } from "@jsenv/logger"
3
3
 
4
- import { processOptionsFromExecArgv } from "./processOptions.js"
4
+ import { ExecOptions } from "./exec_options.js"
5
5
 
6
- const AVAILABLE_DEBUG_MODE = [
7
- "none",
8
- "inherit",
9
- "inspect",
10
- "inspect-brk",
11
- "debug",
12
- "debug-brk",
13
- ]
14
-
15
- export const createChildProcessOptions = async ({
6
+ export const createChildExecOptions = async ({
16
7
  signal = new AbortController().signal,
17
8
  // https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses
18
9
  processExecArgv = process.execArgv,
@@ -33,22 +24,28 @@ export const createChildProcessOptions = async ({
33
24
  }),
34
25
  )
35
26
  }
36
-
37
- const childProcessOptions = processOptionsFromExecArgv(processExecArgv)
38
-
39
- await mutateDebuggingOptions(childProcessOptions, {
27
+ const childExecOptions = ExecOptions.fromExecArgv(processExecArgv)
28
+ await mutateDebuggingOptions(childExecOptions, {
40
29
  signal,
41
30
  processDebugPort,
42
31
  debugMode,
43
32
  debugPort,
44
33
  debugModeInheritBreak,
45
34
  })
46
-
47
- return childProcessOptions
35
+ return childExecOptions
48
36
  }
49
37
 
38
+ const AVAILABLE_DEBUG_MODE = [
39
+ "none",
40
+ "inherit",
41
+ "inspect",
42
+ "inspect-brk",
43
+ "debug",
44
+ "debug-brk",
45
+ ]
46
+
50
47
  const mutateDebuggingOptions = async (
51
- childProcessOptions,
48
+ childExecOptions,
52
49
  {
53
50
  // ensure multiline
54
51
  signal,
@@ -58,7 +55,7 @@ const mutateDebuggingOptions = async (
58
55
  debugModeInheritBreak,
59
56
  },
60
57
  ) => {
61
- const parentDebugInfo = getDebugInfo(childProcessOptions)
58
+ const parentDebugInfo = getDebugInfo(childExecOptions)
62
59
  const parentDebugModeOptionName = parentDebugInfo.debugModeOptionName
63
60
  const parentDebugPortOptionName = parentDebugInfo.debugPortOptionName
64
61
  const childDebugModeOptionName = getChildDebugModeOptionName({
@@ -70,10 +67,10 @@ const mutateDebuggingOptions = async (
70
67
  if (!childDebugModeOptionName) {
71
68
  // remove debug mode and debug port fron child options
72
69
  if (parentDebugModeOptionName) {
73
- delete childProcessOptions[parentDebugModeOptionName]
70
+ delete childExecOptions[parentDebugModeOptionName]
74
71
  }
75
72
  if (parentDebugPortOptionName) {
76
- delete childProcessOptions[parentDebugPortOptionName]
73
+ delete childExecOptions[parentDebugPortOptionName]
77
74
  }
78
75
  return
79
76
  }
@@ -83,9 +80,9 @@ const mutateDebuggingOptions = async (
83
80
  parentDebugModeOptionName &&
84
81
  parentDebugModeOptionName !== childDebugModeOptionName
85
82
  ) {
86
- delete childProcessOptions[parentDebugModeOptionName]
83
+ delete childExecOptions[parentDebugModeOptionName]
87
84
  }
88
- childProcessOptions[childDebugModeOptionName] = ""
85
+ childExecOptions[childDebugModeOptionName] = ""
89
86
 
90
87
  // this is required because vscode does not
91
88
  // support assigning a child spawned without a specific port
@@ -95,9 +92,9 @@ const mutateDebuggingOptions = async (
95
92
  : debugPort
96
93
  // replace child debug port
97
94
  if (parentDebugPortOptionName) {
98
- delete childProcessOptions[parentDebugPortOptionName]
95
+ delete childExecOptions[parentDebugPortOptionName]
99
96
  }
100
- childProcessOptions[childDebugModeOptionName] = portToArgValue(
97
+ childExecOptions[childDebugModeOptionName] = portToArgValue(
101
98
  childDebugPortOptionValue,
102
99
  )
103
100
  }
@@ -110,22 +107,18 @@ const getChildDebugModeOptionName = ({
110
107
  if (debugMode === "none") {
111
108
  return undefined
112
109
  }
113
-
114
110
  if (debugMode !== "inherit") {
115
111
  return `--${debugMode}`
116
112
  }
117
-
118
113
  if (!parentDebugModeOptionName) {
119
114
  return undefined
120
115
  }
121
-
122
116
  if (!debugModeInheritBreak && parentDebugModeOptionName === "--inspect-brk") {
123
117
  return "--inspect"
124
118
  }
125
119
  if (!debugModeInheritBreak && parentDebugModeOptionName === "--debug-brk") {
126
120
  return "--debug"
127
121
  }
128
-
129
122
  return parentDebugModeOptionName
130
123
  }
131
124
 
@@ -144,7 +137,6 @@ const getDebugInfo = (processOptions) => {
144
137
  debugPortOptionName: "--inspect-port",
145
138
  }
146
139
  }
147
-
148
140
  const inspectBreakOption = processOptions["--inspect-brk"]
149
141
  if (inspectBreakOption !== undefined) {
150
142
  return {
@@ -152,7 +144,6 @@ const getDebugInfo = (processOptions) => {
152
144
  debugPortOptionName: "--inspect-port",
153
145
  }
154
146
  }
155
-
156
147
  const debugOption = processOptions["--debug"]
157
148
  if (debugOption !== undefined) {
158
149
  return {
@@ -160,7 +151,6 @@ const getDebugInfo = (processOptions) => {
160
151
  debugPortOptionName: "--debug-port",
161
152
  }
162
153
  }
163
-
164
154
  const debugBreakOption = processOptions["--debug-brk"]
165
155
  if (debugBreakOption !== undefined) {
166
156
  return {
@@ -168,10 +158,9 @@ const getDebugInfo = (processOptions) => {
168
158
  debugPortOptionName: "--debug-port",
169
159
  }
170
160
  }
171
-
172
161
  return {}
173
162
  }
174
163
 
175
- export const processIsExecutedByVSCode = () => {
176
- return typeof process.env.VSCODE_PID === "string"
177
- }
164
+ // export const processIsExecutedByVSCode = () => {
165
+ // return typeof process.env.VSCODE_PID === "string"
166
+ // }
@@ -1,25 +1,8 @@
1
1
  import v8 from "node:v8"
2
2
  import { uneval } from "@jsenv/uneval"
3
3
 
4
- const NODE_EXECUTION_DYNAMIC_IMPORT_URL = new URL(
5
- "./node_execution_dynamic_import.js",
6
- import.meta.url,
7
- ).href
8
- const NODE_EXECUTION_SYSTEMJS_URL = new URL(
9
- "./node_execution_systemjs.js",
10
- import.meta.url,
11
- ).href
12
-
13
4
  const ACTIONS_AVAILABLE = {
14
- "execute-using-dynamic-import": async (executeParams) => {
15
- const { execute } = await import(NODE_EXECUTION_DYNAMIC_IMPORT_URL)
16
- return execute(executeParams)
17
- },
18
- "execute-using-systemjs": async (executeParams) => {
19
- const { execute } = await import(NODE_EXECUTION_SYSTEMJS_URL)
20
- return execute(executeParams)
21
- },
22
- "execute-using-import": async ({ fileUrl }) => {
5
+ "execute-using-dynamic-import": async ({ fileUrl }) => {
23
6
  const namespace = await import(fileUrl)
24
7
  const namespaceResolved = {}
25
8
  await Promise.all([
@@ -1,46 +1,33 @@
1
1
  import { fork } from "node:child_process"
2
- import { urlToFileSystemPath, assertFilePresence } from "@jsenv/filesystem"
3
- import { createLogger, createDetailedMessage } from "@jsenv/logger"
2
+ import { urlToFileSystemPath } from "@jsenv/filesystem"
3
+ import { createDetailedMessage } from "@jsenv/logger"
4
4
  import {
5
5
  Abort,
6
6
  raceCallbacks,
7
- createCallbackList,
8
7
  createCallbackListNotifiedOnce,
9
8
  } from "@jsenv/abort"
10
9
  import { uneval } from "@jsenv/uneval"
11
10
 
12
- import { nodeSupportsDynamicImport } from "@jsenv/core/src/internal/features/node_feature_detection/node_feature_detect_dynamic_import.js"
11
+ import { memoize } from "@jsenv/utils/memoize/memoize.js"
13
12
 
14
- import { createChildProcessOptions } from "./createChildProcessOptions.js"
15
- import {
16
- processOptionsFromExecArgv,
17
- execArgvFromProcessOptions,
18
- } from "./processOptions.js"
13
+ import { createChildExecOptions } from "./child_exec_options.js"
14
+ import { ExecOptions } from "./exec_options.js"
19
15
  import { killProcessTree } from "./kill_process_tree.js"
20
16
 
21
17
  const NODE_CONTROLLABLE_FILE_URL = new URL(
22
- "../node_runtime/nodeControllableFile.mjs",
18
+ "./controllable_file.mjs",
23
19
  import.meta.url,
24
20
  ).href
25
21
 
26
- // https://nodejs.org/api/process.html#process_signal_events
27
- const SIGINT_SIGNAL_NUMBER = 2
28
- const SIGABORT_SIGNAL_NUMBER = 6
29
- const SIGTERM_SIGNAL_NUMBER = 15
30
- const SIGINT_EXIT_CODE = 128 + SIGINT_SIGNAL_NUMBER
31
- const SIGABORT_EXIT_CODE = 128 + SIGABORT_SIGNAL_NUMBER
32
- const SIGTERM_EXIT_CODE = 128 + SIGTERM_SIGNAL_NUMBER
33
- // http://man7.org/linux/man-pages/man7/signal.7.html
34
- // https:// github.com/nodejs/node/blob/1d9511127c419ec116b3ddf5fc7a59e8f0f1c1e4/lib/internal/child_process.js#L472
35
- const GRACEFUL_STOP_SIGNAL = "SIGTERM"
36
- const STOP_SIGNAL = "SIGKILL"
37
- // it would be more correct if GRACEFUL_STOP_FAILED_SIGNAL was SIGHUP instead of SIGKILL.
38
- // but I'm not sure and it changes nothing so just use SIGKILL
39
- const GRACEFUL_STOP_FAILED_SIGNAL = "SIGKILL"
40
-
41
- export const createControllableNodeProcess = async ({
22
+ export const createControlledProcess = async ({
42
23
  signal = new AbortController().signal,
43
- logLevel,
24
+ logger,
25
+ logProcessCommand = false,
26
+
27
+ onStop,
28
+ onError,
29
+ onConsole,
30
+
44
31
  debugPort,
45
32
  debugMode,
46
33
  debugModeInheritBreak,
@@ -51,50 +38,47 @@ export const createControllableNodeProcess = async ({
51
38
  stdin = "pipe",
52
39
  stdout = "pipe",
53
40
  stderr = "pipe",
54
- logProcessCommand = false,
55
41
  }) => {
56
- const logger = createLogger({ logLevel })
57
- const dynamicImportSupported = await nodeSupportsDynamicImport()
58
- if (!dynamicImportSupported) {
59
- throw new Error(`node does not support dynamic import`)
42
+ if (env !== undefined && typeof env !== "object") {
43
+ throw new TypeError(`env must be an object, got ${env}`)
44
+ }
45
+ const cleanupCallbackList = createCallbackListNotifiedOnce()
46
+ const cleanup = async (reason) => {
47
+ await cleanupCallbackList.notify({ reason })
60
48
  }
61
49
 
62
- const childProcessOptions = await createChildProcessOptions({
50
+ const childExecOptions = await createChildExecOptions({
63
51
  signal,
64
52
  debugPort,
65
53
  debugMode,
66
54
  debugModeInheritBreak,
67
55
  })
68
- const processOptions = {
69
- ...childProcessOptions,
70
- ...processOptionsFromExecArgv(commandLineOptions),
71
- }
72
- const execArgv = execArgvFromProcessOptions(processOptions)
73
-
74
- if (env !== undefined && typeof env !== "object") {
75
- throw new TypeError(`env must be an object, got ${env}`)
76
- }
77
-
78
- await assertFilePresence(NODE_CONTROLLABLE_FILE_URL)
56
+ const execArgv = ExecOptions.toExecArgv({
57
+ ...childExecOptions,
58
+ ...ExecOptions.fromExecArgv(commandLineOptions),
59
+ })
79
60
  const envForChildProcess = {
80
61
  ...(inheritProcessEnv ? process.env : {}),
81
62
  ...env,
82
63
  }
64
+ logger[logProcessCommand ? "info" : "debug"](
65
+ `${process.argv[0]} ${execArgv.join(" ")} ${urlToFileSystemPath(
66
+ NODE_CONTROLLABLE_FILE_URL,
67
+ )}`,
68
+ )
83
69
  const childProcess = fork(urlToFileSystemPath(NODE_CONTROLLABLE_FILE_URL), {
84
70
  execArgv,
85
71
  // silent: true
86
72
  stdio: ["pipe", "pipe", "pipe", "ipc"],
87
73
  env: envForChildProcess,
88
74
  })
89
-
90
75
  logger.debug(
91
- createDetailedMessage(`fork child process pid ${childProcess.pid}`, {
76
+ createDetailedMessage(`child process forked (pid ${childProcess.pid})`, {
92
77
  "execArgv": execArgv.join(`\n`),
93
78
  "custom env": JSON.stringify(env, null, " "),
94
79
  }),
95
80
  )
96
-
97
- // if we passe stream, pipe them https://github.com/sindresorhus/execa/issues/81
81
+ // if we pass stream, pipe them https://github.com/sindresorhus/execa/issues/81
98
82
  if (typeof stdin === "object") {
99
83
  stdin.pipe(childProcess.stdin)
100
84
  }
@@ -104,30 +88,49 @@ export const createControllableNodeProcess = async ({
104
88
  if (typeof stderr === "object") {
105
89
  childProcess.stderr.pipe(stderr)
106
90
  }
107
- if (logProcessCommand) {
108
- console.log(
109
- `${process.argv[0]} ${execArgv.join(" ")} ${urlToFileSystemPath(
110
- NODE_CONTROLLABLE_FILE_URL,
111
- )}`,
112
- )
113
- }
114
-
115
91
  const childProcessReadyPromise = new Promise((resolve) => {
116
92
  onceProcessMessage(childProcess, "ready", resolve)
117
93
  })
118
-
119
- const outputCallbackList = createCallbackList()
120
94
  const removeOutputListener = installProcessOutputListener(
121
95
  childProcess,
122
96
  ({ type, text }) => {
123
- outputCallbackList.notify({ type, text })
97
+ onConsole({ type, text })
124
98
  },
125
99
  )
126
-
127
- const errorCallbackList = createCallbackList()
128
-
129
- const stoppedCallbackList = createCallbackListNotifiedOnce()
130
-
100
+ const stop = memoize(async ({ gracefulStopAllocatedMs } = {}) => {
101
+ // all libraries are facing problem on windows when trying
102
+ // to kill a process spawning other processes.
103
+ // "killProcessTree" is theorically correct but sometimes keep process handing forever.
104
+ // Inside GitHub workflow the whole Virtual machine gets unresponsive and ends up being killed
105
+ // There is no satisfying solution to this problem so we stick to the basic
106
+ // childProcess.kill()
107
+ if (process.platform === "win32") {
108
+ childProcess.kill()
109
+ return
110
+ }
111
+ if (gracefulStopAllocatedMs) {
112
+ try {
113
+ await killProcessTree(childProcess.pid, {
114
+ signal: GRACEFUL_STOP_SIGNAL,
115
+ timeout: gracefulStopAllocatedMs,
116
+ })
117
+ return
118
+ } catch (e) {
119
+ if (e.code === "TIMEOUT") {
120
+ logger.debug(
121
+ `kill with SIGTERM because gracefulStop still pending after ${gracefulStopAllocatedMs}ms`,
122
+ )
123
+ await killProcessTree(childProcess.pid, {
124
+ signal: GRACEFUL_STOP_FAILED_SIGNAL,
125
+ })
126
+ return
127
+ }
128
+ throw e
129
+ }
130
+ }
131
+ await killProcessTree(childProcess.pid, { signal: STOP_SIGNAL })
132
+ return
133
+ })
131
134
  raceCallbacks(
132
135
  {
133
136
  // https://nodejs.org/api/child_process.html#child_process_event_disconnect
@@ -157,9 +160,9 @@ export const createControllableNodeProcess = async ({
157
160
  ) {
158
161
  return
159
162
  }
160
- errorCallbackList.notify(error)
163
+ onError(error)
161
164
  },
162
- exit: ({ code, signal }) => {
165
+ exit: async ({ code, signal }) => {
163
166
  // process.exit(1) in child process or process.exitCode = 1 + process.exit()
164
167
  // means there was an error even if we don't know exactly what.
165
168
  if (
@@ -169,112 +172,88 @@ export const createControllableNodeProcess = async ({
169
172
  code !== SIGTERM_EXIT_CODE &&
170
173
  code !== SIGABORT_EXIT_CODE
171
174
  ) {
172
- errorCallbackList.notify(createExitWithFailureCodeError(code))
175
+ onError(createExitWithFailureCodeError(code))
173
176
  }
174
- stoppedCallbackList.notify({ code, signal })
177
+ await cleanup("process exit")
178
+ onStop({ code, signal })
175
179
  },
176
180
  }
177
181
  raceEffects[winner.name](winner.data)
178
182
  },
179
183
  )
180
-
181
- const stop = async ({ gracefulStopAllocatedMs } = {}) => {
182
- if (stoppedCallbackList.notified) {
183
- return {}
184
- }
185
-
186
- const createStoppedPromise = async () => {
187
- if (stoppedCallbackList.notified) {
188
- return
189
- }
190
- await new Promise((resolve) => stoppedCallbackList.add(resolve))
191
- }
192
-
193
- if (gracefulStopAllocatedMs) {
194
- try {
195
- await killProcessTree(childProcess.pid, {
196
- signal: GRACEFUL_STOP_SIGNAL,
197
- timeout: gracefulStopAllocatedMs,
198
- })
199
- await createStoppedPromise()
200
- return { graceful: true }
201
- } catch (e) {
202
- if (e.code === "TIMEOUT") {
203
- logger.debug(
204
- `kill with SIGTERM because gracefulStop still pending after ${gracefulStopAllocatedMs}ms`,
205
- )
206
- await killProcessTree(childProcess.pid, {
207
- signal: GRACEFUL_STOP_FAILED_SIGNAL,
208
- })
209
- await createStoppedPromise()
210
- return { graceful: false }
211
- }
212
- throw e
213
- }
214
- }
215
-
216
- await killProcessTree(childProcess.pid, { signal: STOP_SIGNAL })
217
- await createStoppedPromise()
218
- return { graceful: false }
219
- }
220
-
221
- const requestActionOnChildProcess = ({
184
+ const requestActionOnChildProcess = async ({
222
185
  signal,
223
186
  actionType,
224
187
  actionParams,
225
188
  }) => {
226
189
  const actionOperation = Abort.startOperation()
227
190
  actionOperation.addAbortSignal(signal)
228
-
229
- return new Promise(async (resolve, reject) => {
230
- actionOperation.throwIfAborted()
231
- await childProcessReadyPromise
232
-
233
- onceProcessMessage(childProcess, "action-result", ({ status, value }) => {
234
- if (status === "action-completed") {
235
- resolve(value)
236
- } else {
237
- reject(value)
238
- }
239
- })
240
-
241
- logger.debug(
242
- createDetailedMessage(`ask child process to perform an action`, {
243
- actionType,
244
- actionParams: JSON.stringify(actionParams, null, " "),
245
- }),
246
- )
247
-
248
- try {
191
+ try {
192
+ const result = await new Promise(async (resolve, reject) => {
249
193
  actionOperation.throwIfAborted()
250
- await sendToProcess(childProcess, "action", {
251
- actionType,
252
- actionParams,
253
- })
254
- } catch (e) {
255
- if (Abort.isAbortError(e) && actionOperation.signal.aborted) {
256
- throw e
257
- }
258
- logger.error(
259
- createDetailedMessage(`error while sending message to child`, {
260
- ["error stack"]: e.stack,
194
+ await childProcessReadyPromise
195
+ onceProcessMessage(
196
+ childProcess,
197
+ "action-result",
198
+ ({ status, value }) => {
199
+ if (status === "action-completed") {
200
+ resolve(value)
201
+ } else {
202
+ reject(value)
203
+ }
204
+ },
205
+ )
206
+ logger.debug(
207
+ createDetailedMessage(`ask child process to perform an action`, {
208
+ actionType,
209
+ actionParams: JSON.stringify(actionParams, null, " "),
261
210
  }),
262
211
  )
263
- throw e
264
- }
265
- })
212
+ try {
213
+ actionOperation.throwIfAborted()
214
+ await sendToProcess(childProcess, "action", {
215
+ actionType,
216
+ actionParams,
217
+ })
218
+ } catch (e) {
219
+ if (Abort.isAbortError(e) && actionOperation.signal.aborted) {
220
+ throw e
221
+ }
222
+ logger.error(
223
+ createDetailedMessage(`error while sending message to child`, {
224
+ ["error stack"]: e.stack,
225
+ }),
226
+ )
227
+ throw e
228
+ }
229
+ })
230
+ return result
231
+ } finally {
232
+ await actionOperation.end()
233
+ }
266
234
  }
267
-
268
235
  return {
269
236
  execArgv,
270
- stoppedCallbackList,
271
- errorCallbackList,
272
- outputCallbackList,
273
237
  stop,
274
238
  requestActionOnChildProcess,
275
239
  }
276
240
  }
277
241
 
242
+ // https://nodejs.org/api/process.html#process_signal_events
243
+ const SIGINT_SIGNAL_NUMBER = 2
244
+ const SIGABORT_SIGNAL_NUMBER = 6
245
+ const SIGTERM_SIGNAL_NUMBER = 15
246
+ const SIGINT_EXIT_CODE = 128 + SIGINT_SIGNAL_NUMBER
247
+ const SIGABORT_EXIT_CODE = 128 + SIGABORT_SIGNAL_NUMBER
248
+ const SIGTERM_EXIT_CODE = 128 + SIGTERM_SIGNAL_NUMBER
249
+ // http://man7.org/linux/man-pages/man7/signal.7.html
250
+ // https:// github.com/nodejs/node/blob/1d9511127c419ec116b3ddf5fc7a59e8f0f1c1e4/lib/internal/child_process.js#L472
251
+ const GRACEFUL_STOP_SIGNAL = "SIGTERM"
252
+ const STOP_SIGNAL = "SIGKILL"
253
+ // it would be more correct if GRACEFUL_STOP_FAILED_SIGNAL was SIGHUP instead of SIGKILL.
254
+ // but I'm not sure and it changes nothing so just use SIGKILL
255
+ const GRACEFUL_STOP_FAILED_SIGNAL = "SIGKILL"
256
+
278
257
  const sendToProcess = async (childProcess, type, data) => {
279
258
  const source = uneval(data, { functionAllowed: true })
280
259
  return new Promise((resolve, reject) => {
@@ -331,7 +310,6 @@ const onceProcessMessage = (childProcess, type, callback) => {
331
310
 
332
311
  const onceProcessEvent = (childProcess, type, callback) => {
333
312
  childProcess.once(type, callback)
334
-
335
313
  return () => {
336
314
  childProcess.removeListener(type, callback)
337
315
  }
@@ -0,0 +1,44 @@
1
+ export const ExecOptions = {
2
+ fromExecArgv: (execArgv) => {
3
+ const execOptions = {}
4
+ let i = 0
5
+ while (i < execArgv.length) {
6
+ const execArg = execArgv[i]
7
+ const option = execOptionFromExecArg(execArg)
8
+ execOptions[option.name] = option.value
9
+ i++
10
+ }
11
+ return execOptions
12
+ },
13
+ toExecArgv: (execOptions) => {
14
+ const execArgv = []
15
+ Object.keys(execOptions).forEach((optionName) => {
16
+ const optionValue = execOptions[optionName]
17
+ if (optionValue === "unset") {
18
+ return
19
+ }
20
+ if (optionValue === "") {
21
+ execArgv.push(optionName)
22
+ return
23
+ }
24
+ execArgv.push(`${optionName}=${optionValue}`)
25
+ })
26
+ return execArgv
27
+ },
28
+ }
29
+
30
+ const execOptionFromExecArg = (execArg) => {
31
+ const equalCharIndex = execArg.indexOf("=")
32
+ if (equalCharIndex === -1) {
33
+ return {
34
+ name: execArg,
35
+ value: "",
36
+ }
37
+ }
38
+ const name = execArg.slice(0, equalCharIndex)
39
+ const value = execArg.slice(equalCharIndex + 1)
40
+ return {
41
+ name,
42
+ value,
43
+ }
44
+ }
@@ -1,11 +1,13 @@
1
- import { require } from "../require.js"
1
+ import { createRequire } from "node:module"
2
+
3
+ const require = createRequire(import.meta.url)
2
4
 
3
5
  // see also https://github.com/sindresorhus/execa/issues/96
4
6
  export const killProcessTree = async (
5
7
  processId,
6
8
  { signal, timeout = 2000 },
7
9
  ) => {
8
- var pidtree = require("pidtree")
10
+ const pidtree = require("pidtree")
9
11
 
10
12
  let descendantProcessIds
11
13
  try {