@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
@@ -0,0 +1,187 @@
1
+ import { createRequire } from "node:module"
2
+
3
+ import { getBabelHelperFileUrl } from "../babel_helper/babel_helper_directory.js"
4
+ import { babelPluginCompatMap } from "./babel_plugins_compatibility.js"
5
+
6
+ const require = createRequire(import.meta.url)
7
+
8
+ export const getBaseBabelPluginStructure = ({
9
+ url,
10
+ isSupportedOnRuntime,
11
+ usesTopLevelAwait,
12
+ // // https://github.com/rpetrich/babel-plugin-transform-async-to-promises/blob/92755ff8c943c97596523e586b5fa515c2e99326/async-to-promises.ts#L55
13
+ topLevelAwait = "simple",
14
+ isJsModule,
15
+ }) => {
16
+ const isBabelPluginNeeded = (babelPluginName) => {
17
+ return !isSupportedOnRuntime(
18
+ babelPluginName,
19
+ babelPluginCompatMap[babelPluginName],
20
+ )
21
+ }
22
+
23
+ const babelPluginStructure = {}
24
+ if (isBabelPluginNeeded("proposal-numeric-separator")) {
25
+ babelPluginStructure[
26
+ "proposal-numeric-separator"
27
+ ] = require("@babel/plugin-proposal-numeric-separator")
28
+ }
29
+ if (isBabelPluginNeeded("proposal-json-strings")) {
30
+ babelPluginStructure[
31
+ "proposal-json-strings"
32
+ ] = require("@babel/plugin-proposal-json-strings")
33
+ }
34
+ if (isBabelPluginNeeded("proposal-object-rest-spread")) {
35
+ babelPluginStructure[
36
+ "proposal-object-rest-spread"
37
+ ] = require("@babel/plugin-proposal-object-rest-spread")
38
+ }
39
+ if (isBabelPluginNeeded("proposal-optional-catch-binding")) {
40
+ babelPluginStructure[
41
+ "proposal-optional-catch-binding"
42
+ ] = require("@babel/plugin-proposal-optional-catch-binding")
43
+ }
44
+ if (isBabelPluginNeeded("proposal-unicode-property-regex")) {
45
+ babelPluginStructure[
46
+ "proposal-unicode-property-regex"
47
+ ] = require("@babel/plugin-proposal-unicode-property-regex")
48
+ }
49
+ if (
50
+ isJsModule &&
51
+ usesTopLevelAwait &&
52
+ !isSupportedOnRuntime("top_level_await")
53
+ ) {
54
+ babelPluginStructure["transform-async-to-promises"] = [
55
+ require("babel-plugin-transform-async-to-promises"),
56
+ {
57
+ topLevelAwait,
58
+ },
59
+ ]
60
+ } else if (isBabelPluginNeeded("transform-async-to-promises")) {
61
+ babelPluginStructure[
62
+ "transform-async-to-promises"
63
+ ] = require("babel-plugin-transform-async-to-promises")
64
+ }
65
+ if (isBabelPluginNeeded("transform-arrow-functions")) {
66
+ babelPluginStructure[
67
+ "transform-arrow-functions"
68
+ ] = require("@babel/plugin-transform-arrow-functions")
69
+ }
70
+ if (isBabelPluginNeeded("transform-block-scoped-functions")) {
71
+ babelPluginStructure[
72
+ "transform-block-scoped-functions"
73
+ ] = require("@babel/plugin-transform-block-scoped-functions")
74
+ }
75
+ if (isBabelPluginNeeded("transform-block-scoping")) {
76
+ babelPluginStructure[
77
+ "transform-block-scoping"
78
+ ] = require("@babel/plugin-transform-block-scoping")
79
+ }
80
+ if (isBabelPluginNeeded("transform-classes")) {
81
+ babelPluginStructure[
82
+ "transform-classes"
83
+ ] = require("@babel/plugin-transform-classes")
84
+ }
85
+ if (isBabelPluginNeeded("transform-computed-properties")) {
86
+ babelPluginStructure[
87
+ "transform-computed-properties"
88
+ ] = require("@babel/plugin-transform-computed-properties")
89
+ }
90
+ if (isBabelPluginNeeded("transform-destructuring")) {
91
+ babelPluginStructure[
92
+ "transform-destructuring"
93
+ ] = require("@babel/plugin-transform-destructuring")
94
+ }
95
+ if (isBabelPluginNeeded("transform-dotall-regex")) {
96
+ babelPluginStructure[
97
+ "transform-dotall-regex"
98
+ ] = require("@babel/plugin-transform-dotall-regex")
99
+ }
100
+ if (isBabelPluginNeeded("transform-duplicate-keys")) {
101
+ babelPluginStructure[
102
+ "transform-duplicate-keys"
103
+ ] = require("@babel/plugin-transform-duplicate-keys")
104
+ }
105
+ if (isBabelPluginNeeded("transform-exponentiation-operator")) {
106
+ babelPluginStructure[
107
+ "transform-exponentiation-operator"
108
+ ] = require("@babel/plugin-transform-exponentiation-operator")
109
+ }
110
+ if (isBabelPluginNeeded("transform-for-of")) {
111
+ babelPluginStructure[
112
+ "transform-for-of"
113
+ ] = require("@babel/plugin-transform-for-of")
114
+ }
115
+ if (isBabelPluginNeeded("transform-function-name")) {
116
+ babelPluginStructure[
117
+ "transform-function-name"
118
+ ] = require("@babel/plugin-transform-function-name")
119
+ }
120
+ if (isBabelPluginNeeded("transform-literals")) {
121
+ babelPluginStructure[
122
+ "transform-literals"
123
+ ] = require("@babel/plugin-transform-literals")
124
+ }
125
+ if (isBabelPluginNeeded("transform-new-target")) {
126
+ babelPluginStructure[
127
+ "transform-new-target"
128
+ ] = require("@babel/plugin-transform-new-target")
129
+ }
130
+ if (isBabelPluginNeeded("transform-object-super")) {
131
+ babelPluginStructure[
132
+ "transform-object-super"
133
+ ] = require("@babel/plugin-transform-object-super")
134
+ }
135
+ if (isBabelPluginNeeded("transform-parameters")) {
136
+ babelPluginStructure[
137
+ "transform-parameters"
138
+ ] = require("@babel/plugin-transform-parameters")
139
+ }
140
+ if (isBabelPluginNeeded("transform-regenerator")) {
141
+ babelPluginStructure["transform-regenerator"] = [
142
+ require("@babel/plugin-transform-regenerator"),
143
+ {
144
+ asyncGenerators: true,
145
+ generators: true,
146
+ async: false,
147
+ },
148
+ ]
149
+ }
150
+ if (isBabelPluginNeeded("transform-shorthand-properties")) {
151
+ babelPluginStructure["transform-shorthand-properties"] = [
152
+ require("@babel/plugin-transform-shorthand-properties"),
153
+ ]
154
+ }
155
+ if (isBabelPluginNeeded("transform-spread")) {
156
+ babelPluginStructure["transform-spread"] = [
157
+ require("@babel/plugin-transform-spread"),
158
+ ]
159
+ }
160
+ if (isBabelPluginNeeded("transform-sticky-regex")) {
161
+ babelPluginStructure["transform-sticky-regex"] = [
162
+ require("@babel/plugin-transform-sticky-regex"),
163
+ ]
164
+ }
165
+ if (isBabelPluginNeeded("transform-template-literals")) {
166
+ babelPluginStructure["transform-template-literals"] = [
167
+ require("@babel/plugin-transform-template-literals"),
168
+ ]
169
+ }
170
+ if (
171
+ isBabelPluginNeeded("transform-typeof-symbol") &&
172
+ // prevent "typeof" to be injected into itself:
173
+ // - not needed
174
+ // - would create infinite attempt to transform typeof
175
+ url !== getBabelHelperFileUrl("typeof")
176
+ ) {
177
+ babelPluginStructure["transform-typeof-symbol"] = [
178
+ require("@babel/plugin-transform-typeof-symbol"),
179
+ ]
180
+ }
181
+ if (isBabelPluginNeeded("transform-unicode-regex")) {
182
+ babelPluginStructure["transform-unicode-regex"] = [
183
+ require("@babel/plugin-transform-unicode-regex"),
184
+ ]
185
+ }
186
+ return babelPluginStructure
187
+ }
@@ -162,12 +162,12 @@ export const babelPluginCompatMap = {
162
162
  chrome: "41",
163
163
  opera: "28",
164
164
  edge: "13",
165
+ electron: "0.22",
165
166
  firefox: "34",
166
167
  safari: "13",
167
168
  node: "4",
168
169
  ios: "13",
169
170
  samsung: "3.4",
170
- electron: "0.22",
171
171
  },
172
172
  "transform-literals": {
173
173
  chrome: "44",
@@ -430,26 +430,3 @@ babelPluginCompatMap["transform-async-to-promises"] =
430
430
 
431
431
  babelPluginCompatMap["regenerator-transform"] =
432
432
  babelPluginCompatMap["transform-regenerator"]
433
-
434
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
435
- babelPluginCompatMap["global-this-as-jsenv-import"] = {
436
- edge: "79",
437
- firefox: "65",
438
- chrome: "71",
439
- safari: "12.1",
440
- opera: "58",
441
- ios: "12.2",
442
- android: "94",
443
- node: "12",
444
- }
445
-
446
- // needs support for both json and css
447
- babelPluginCompatMap["transform-import-assertions"] = {
448
- chrome: "93",
449
- edge: "93",
450
- }
451
-
452
- babelPluginCompatMap["new-stylesheet-as-jsenv-import"] = {
453
- chrome: "93",
454
- edge: "93",
455
- }
@@ -0,0 +1,97 @@
1
+ import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
2
+
3
+ import { getBaseBabelPluginStructure } from "./helpers/babel_plugin_structure.js"
4
+ import { babelPluginNewStylesheetAsJsenvImport } from "./new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js"
5
+ import { babelPluginGlobalThisAsJsenvImport } from "./global_this/babel_plugin_global_this_as_jsenv_import.js"
6
+ import { babelPluginRegeneratorRuntimeAsJsenvImport } from "./regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js"
7
+ import { babelPluginBabelHelpersAsJsenvImports } from "./babel_helper/babel_plugin_babel_helpers_as_jsenv_imports.js"
8
+
9
+ export const jsenvPluginBabel = ({
10
+ getCustomBabelPlugins,
11
+ topLevelAwait,
12
+ } = {}) => {
13
+ const transformWithBabel = async (urlInfo, context) => {
14
+ const isJsModule = urlInfo.type === "js_module"
15
+ const isWorker =
16
+ urlInfo.subtype === "worker" || urlInfo.subtype === "service_worker"
17
+ const { isSupportedOnRuntime, referenceUtils } = context
18
+ const babelPluginStructure = getBaseBabelPluginStructure({
19
+ url: urlInfo.url,
20
+ isSupportedOnRuntime,
21
+ topLevelAwait,
22
+ usesTopLevelAwait: urlInfo.data.usesTopLevelAwait,
23
+ isJsModule,
24
+ isWorker,
25
+ })
26
+ if (getCustomBabelPlugins) {
27
+ Object.assign(babelPluginStructure, getCustomBabelPlugins(context))
28
+ }
29
+
30
+ if (isJsModule) {
31
+ const getImportSpecifier = (clientFileUrl) => {
32
+ const [reference] = referenceUtils.inject({
33
+ type: "js_import_export",
34
+ specifier: clientFileUrl,
35
+ })
36
+ return JSON.parse(reference.generatedSpecifier)
37
+ }
38
+ if (!isSupportedOnRuntime("global_this")) {
39
+ babelPluginStructure["global-this-as-jsenv-import"] = [
40
+ babelPluginGlobalThisAsJsenvImport,
41
+ {
42
+ getImportSpecifier,
43
+ },
44
+ ]
45
+ }
46
+ if (!isSupportedOnRuntime("async_generator_function")) {
47
+ babelPluginStructure["regenerator-runtime-as-jsenv-import"] = [
48
+ babelPluginRegeneratorRuntimeAsJsenvImport,
49
+ {
50
+ getImportSpecifier,
51
+ },
52
+ ]
53
+ }
54
+ if (!isSupportedOnRuntime("new_stylesheet")) {
55
+ babelPluginStructure["new-stylesheet-as-jsenv-import"] = [
56
+ babelPluginNewStylesheetAsJsenvImport,
57
+ {
58
+ getImportSpecifier,
59
+ },
60
+ ]
61
+ }
62
+ if (Object.keys(babelPluginStructure).length > 0) {
63
+ babelPluginStructure["babel-helper-as-jsenv-import"] = [
64
+ babelPluginBabelHelpersAsJsenvImports,
65
+ {
66
+ getImportSpecifier,
67
+ },
68
+ ]
69
+ }
70
+ }
71
+ // otherwise, concerning global_this, and new_stylesheet we must inject the code
72
+ // (we cannot inject an import)
73
+
74
+ const babelPlugins = Object.keys(babelPluginStructure).map(
75
+ (babelPluginName) => babelPluginStructure[babelPluginName],
76
+ )
77
+ const { code, map } = await applyBabelPlugins({
78
+ babelPlugins,
79
+ url: urlInfo.url,
80
+ generatedUrl: urlInfo.generatedUrl,
81
+ content: urlInfo.content,
82
+ })
83
+ return {
84
+ content: code,
85
+ sourcemap: map,
86
+ }
87
+ }
88
+
89
+ return {
90
+ name: "jsenv:babel",
91
+ appliesDuring: "*",
92
+ transform: {
93
+ js_module: transformWithBabel,
94
+ js_classic: transformWithBabel,
95
+ },
96
+ }
97
+ }
@@ -0,0 +1,117 @@
1
+ /*
2
+ * TODO:
3
+ * - code should also inject helper when code uses new keyword on "CSSStyleSheet"
4
+ * - code should also inject helper when code uses "document.adoptedStylesheets"
5
+ */
6
+
7
+ import { pathToFileURL } from "node:url"
8
+
9
+ import { injectImport } from "@jsenv/utils/js_ast/babel_utils.js"
10
+
11
+ export const babelPluginNewStylesheetAsJsenvImport = (
12
+ babel,
13
+ { getImportSpecifier },
14
+ ) => {
15
+ const newStylesheetClientFileUrl = new URL(
16
+ "./client/new_stylesheet.js",
17
+ import.meta.url,
18
+ ).href
19
+
20
+ return {
21
+ name: "new-stylesheet-as-jsenv-import",
22
+ visitor: {
23
+ Program: (programPath, { filename }) => {
24
+ const fileUrl = pathToFileURL(filename).href
25
+ if (fileUrl === newStylesheetClientFileUrl) {
26
+ return
27
+ }
28
+ let usesNewStylesheet = false
29
+ programPath.traverse({
30
+ CallExpression: (path) => {
31
+ if (path.node.callee.type !== "Import") {
32
+ // Some other function call, not import();
33
+ return
34
+ }
35
+ if (path.node.arguments[0].type !== "StringLiteral") {
36
+ // Non-string argument, probably a variable or expression, e.g.
37
+ // import(moduleId)
38
+ // import('./' + moduleName)
39
+ return
40
+ }
41
+ const sourcePath = path.get("arguments")[0]
42
+ usesNewStylesheet =
43
+ hasCssModuleQueryParam(sourcePath) ||
44
+ hasImportTypeCssAssertion(path)
45
+ if (usesNewStylesheet) {
46
+ path.stop()
47
+ }
48
+ },
49
+ ImportDeclaration: (path) => {
50
+ const sourcePath = path.get("source")
51
+ usesNewStylesheet =
52
+ hasCssModuleQueryParam(sourcePath) ||
53
+ hasImportTypeCssAssertion(path)
54
+ if (usesNewStylesheet) {
55
+ path.stop()
56
+ }
57
+ },
58
+ ExportAllDeclaration: (path) => {
59
+ const sourcePath = path.get("source")
60
+ usesNewStylesheet = hasCssModuleQueryParam(sourcePath)
61
+ if (usesNewStylesheet) {
62
+ path.stop()
63
+ }
64
+ },
65
+ ExportNamedDeclaration: (path) => {
66
+ if (!path.node.source) {
67
+ // This export has no "source", so it's probably
68
+ // a local variable or function, e.g.
69
+ // export { varName }
70
+ // export const constName = ...
71
+ // export function funcName() {}
72
+ return
73
+ }
74
+ const sourcePath = path.get("source")
75
+ usesNewStylesheet = hasCssModuleQueryParam(sourcePath)
76
+ if (usesNewStylesheet) {
77
+ path.stop()
78
+ }
79
+ },
80
+ })
81
+ if (usesNewStylesheet) {
82
+ injectImport({
83
+ programPath,
84
+ from: getImportSpecifier(newStylesheetClientFileUrl),
85
+ sideEffect: true,
86
+ })
87
+ }
88
+ },
89
+ },
90
+ }
91
+ }
92
+
93
+ const hasCssModuleQueryParam = (path) => {
94
+ const { node } = path
95
+ return (
96
+ node.type === "StringLiteral" &&
97
+ new URL(node.value, "https://jsenv.dev").searchParams.has(`css_module`)
98
+ )
99
+ }
100
+
101
+ const hasImportTypeCssAssertion = (path) => {
102
+ const importAssertionsDescriptor = getImportAssertionsDescriptor(
103
+ path.node.assertions,
104
+ )
105
+ return Boolean(importAssertionsDescriptor.type === "css")
106
+ }
107
+
108
+ const getImportAssertionsDescriptor = (importAssertions) => {
109
+ const importAssertionsDescriptor = {}
110
+ if (importAssertions) {
111
+ importAssertions.forEach((importAssertion) => {
112
+ importAssertionsDescriptor[importAssertion.key.name] =
113
+ importAssertion.value.value
114
+ })
115
+ }
116
+ return importAssertionsDescriptor
117
+ }
@@ -0,0 +1,24 @@
1
+ const eslintConfig = require("../../../../../../.eslintrc.cjs")
2
+
3
+ // babel helpers are copy pasted from the babel repository
4
+ Object.assign(eslintConfig.rules, {
5
+ "eqeqeq": ["off"],
6
+ "no-eq-null": ["off"],
7
+ "no-undef-init": ["off"],
8
+ "dot-notation": ["off"],
9
+ "consistent-return": ["off"],
10
+ "one-var": ["off"],
11
+ "object-shorthand": ["off"],
12
+ "no-return-assign": ["off"],
13
+ "prefer-template": ["off"],
14
+ "prefer-rest-params": ["off"],
15
+ "no-void": ["off"],
16
+ "no-implicit-coercion": ["off"],
17
+ "prefer-spread": ["off"],
18
+ "no-loop-func": ["off"],
19
+ "no-negated-condition": ["off"],
20
+ "no-func-assign": ["off"],
21
+ "no-else-return": ["off"],
22
+ })
23
+
24
+ module.exports = eslintConfig
@@ -0,0 +1,34 @@
1
+ import { pathToFileURL } from "node:url"
2
+
3
+ import { injectImport } from "@jsenv/utils/js_ast/babel_utils.js"
4
+
5
+ export const babelPluginRegeneratorRuntimeAsJsenvImport = (
6
+ babel,
7
+ { getImportSpecifier },
8
+ ) => {
9
+ const regeneratorRuntimeClientFileUrl = new URL(
10
+ "./client/regenerator_runtime.js",
11
+ import.meta.url,
12
+ ).href
13
+
14
+ return {
15
+ name: "regenerator-runtime-as-jsenv-import",
16
+ visitor: {
17
+ Identifier(path, opts) {
18
+ const { filename } = opts
19
+ const fileUrl = pathToFileURL(filename).href
20
+ if (fileUrl === regeneratorRuntimeClientFileUrl) {
21
+ return
22
+ }
23
+ const { node } = path
24
+ if (node.name === "regeneratorRuntime") {
25
+ injectImport({
26
+ programPath: path.scope.getProgramParent().path,
27
+ from: getImportSpecifier(regeneratorRuntimeClientFileUrl),
28
+ sideEffect: true,
29
+ })
30
+ }
31
+ },
32
+ },
33
+ }
34
+ }
@@ -0,0 +1,169 @@
1
+ /*
2
+ * Some code uses globals specific to Node.js in code meant to run in browsers...
3
+ * This plugin will replace some node globals to things compatible with web:
4
+ * - process.env.NODE_ENV
5
+ * - __filename
6
+ * - __dirname
7
+ * - global
8
+ */
9
+
10
+ import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
11
+ import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
12
+
13
+ export const jsenvPluginCommonJsGlobals = () => {
14
+ return {
15
+ name: "jsenv:commonjs_globals",
16
+ appliesDuring: "*",
17
+ transform: {
18
+ js_module: async ({ url, generatedUrl, content }, { scenario }) => {
19
+ const replaceMap = {
20
+ "process.env.NODE_ENV": `("${
21
+ scenario === "dev" || scenario === "test" ? "dev" : "prod"
22
+ }")`,
23
+ "global": "globalThis",
24
+ "__filename": `import.meta.url.slice('file:///'.length)`,
25
+ "__dirname": `import.meta.url.slice('file:///'.length).replace(/[\\\/\\\\][^\\\/\\\\]*$/, '')`,
26
+ }
27
+ const { metadata } = await applyBabelPlugins({
28
+ babelPlugins: [
29
+ [
30
+ babelPluginMetadataExpressionPaths,
31
+ {
32
+ replaceMap,
33
+ allowConflictingReplacements: true,
34
+ },
35
+ ],
36
+ ],
37
+ url,
38
+ generatedUrl,
39
+ content,
40
+ })
41
+ const { expressionPaths } = metadata
42
+ const keys = Object.keys(expressionPaths)
43
+ if (keys.length === 0) {
44
+ return null
45
+ }
46
+ const magicSource = createMagicSource(content)
47
+ keys.forEach((key) => {
48
+ expressionPaths[key].forEach((path) => {
49
+ magicSource.replace({
50
+ start: path.node.start,
51
+ end: path.node.end,
52
+ replacement: replaceMap[key],
53
+ })
54
+ })
55
+ })
56
+ return magicSource.toContentAndSourcemap()
57
+ },
58
+ },
59
+ }
60
+ }
61
+
62
+ // heavily inspired from https://github.com/jviide/babel-plugin-transform-replace-expressions
63
+ // last known commit: 57b608e0eeb8807db53d1c68292621dfafb5599c
64
+ const babelPluginMetadataExpressionPaths = (
65
+ babel,
66
+ { replaceMap = {}, allowConflictingReplacements = false },
67
+ ) => {
68
+ const { traverse, parse, types } = babel
69
+ const replacementMap = new Map()
70
+ const valueExpressionSet = new Set()
71
+
72
+ return {
73
+ name: "metadata-replace",
74
+
75
+ pre: (state) => {
76
+ // https://github.com/babel/babel/blob/d50e78d45b608f6e0f6cc33aeb22f5db5027b153/packages/babel-traverse/src/path/replacement.js#L93
77
+ const parseExpression = (value) => {
78
+ const expressionNode = parse(value, state.opts).program.body[0]
79
+ .expression
80
+ traverse.removeProperties(expressionNode)
81
+ return expressionNode
82
+ }
83
+ Object.keys(replaceMap).forEach((key) => {
84
+ const keyExpressionNode = parseExpression(key)
85
+ const candidateArray = replacementMap.get(keyExpressionNode.type) || []
86
+ const value = replaceMap[key]
87
+ const valueExpressionNode = parseExpression(value)
88
+ const equivalentKeyExpressionIndex = candidateArray.findIndex(
89
+ (candidate) =>
90
+ types.isNodesEquivalent(
91
+ candidate.keyExpressionNode,
92
+ keyExpressionNode,
93
+ ),
94
+ )
95
+ if (
96
+ !allowConflictingReplacements &&
97
+ equivalentKeyExpressionIndex > -1
98
+ ) {
99
+ throw new Error(
100
+ `Expressions ${candidateArray[equivalentKeyExpressionIndex].key} and ${key} conflict`,
101
+ )
102
+ }
103
+ const newCandidate = {
104
+ key,
105
+ value,
106
+ keyExpressionNode,
107
+ valueExpressionNode,
108
+ }
109
+ if (equivalentKeyExpressionIndex > -1) {
110
+ candidateArray[equivalentKeyExpressionIndex] = newCandidate
111
+ } else {
112
+ candidateArray.push(newCandidate)
113
+ }
114
+ replacementMap.set(keyExpressionNode.type, candidateArray)
115
+ })
116
+ replacementMap.forEach((candidateArray) => {
117
+ candidateArray.forEach((candidate) => {
118
+ valueExpressionSet.add(candidate.valueExpressionNode)
119
+ })
120
+ })
121
+ },
122
+ visitor: {
123
+ Program: (programPath, state) => {
124
+ const expressionPaths = {}
125
+ programPath.traverse({
126
+ Expression(path) {
127
+ if (valueExpressionSet.has(path.node)) {
128
+ path.skip()
129
+ return
130
+ }
131
+ const candidateArray = replacementMap.get(path.node.type)
132
+ if (!candidateArray) {
133
+ return
134
+ }
135
+ const candidateFound = candidateArray.find((candidate) => {
136
+ return types.isNodesEquivalent(
137
+ candidate.keyExpressionNode,
138
+ path.node,
139
+ )
140
+ })
141
+ if (candidateFound) {
142
+ try {
143
+ types.validate(
144
+ path.parent,
145
+ path.key,
146
+ candidateFound.valueExpressionNode,
147
+ )
148
+ } catch (err) {
149
+ if (err instanceof TypeError) {
150
+ path.skip()
151
+ return
152
+ }
153
+ throw err
154
+ }
155
+ const paths = expressionPaths[candidateFound.key]
156
+ if (paths) {
157
+ expressionPaths[candidateFound.key] = [...paths, path]
158
+ } else {
159
+ expressionPaths[candidateFound.key] = [path]
160
+ }
161
+ return
162
+ }
163
+ },
164
+ })
165
+ state.file.metadata.expressionPaths = expressionPaths
166
+ },
167
+ },
168
+ }
169
+ }