@jsenv/core 25.4.9 → 26.0.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.
- package/dist/browser_client/asset-manifest.json +4 -0
- package/dist/browser_client/browser_client_fb33eaa4.js +5320 -0
- package/dist/browser_client/browser_client_fb33eaa4.js.map +1089 -0
- package/dist/build_manifest.js +6 -6
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/compile_proxy.html__inline__20_651d1e7b.js.map +343 -0
- package/dist/compile_proxy/{compile_proxy_ab528227.html → compile_proxy_62f952c4.html} +7 -6
- package/dist/event_source_client/asset-manifest.json +2 -2
- package/dist/event_source_client/event_source_client_69f48287.js +354 -0
- package/dist/event_source_client/{event_source_client_80644aee.js.map → event_source_client_69f48287.js.map} +2 -2
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/redirector.html__inline__12_171e07b4.js.map +349 -0
- package/dist/redirector/{redirector_6df2620a.html → redirector_8117ec92.html} +7 -6
- package/dist/toolbar/asset-manifest.json +5 -5
- package/dist/toolbar/assets/{light-theme.css_72a60fa3.map → light_theme.css_5bff0336.map} +2 -2
- package/dist/toolbar/assets/{overflow-menu.css_2859d519.map → overflow_menu.css_9a0fc3d8.map} +2 -2
- package/dist/toolbar/assets/{toolbar.main.css_b7d8bec1.map → toolbar_main.css_b1c67dd7.map} +7 -7
- package/dist/toolbar/{toolbar_9a52325b.html → toolbar_b0c9100c.html} +8 -7
- package/dist/toolbar/{toolbar.main_2c56a4e0.js.map → toolbar_main_f54c1bb0.js.map} +32 -32
- package/dist/toolbar_injector/asset-manifest.json +3 -3
- package/dist/toolbar_injector/assets/{jsenv-logo_188b9ca6.svg → jsenv_logo_192011c2.svg} +1 -1
- package/dist/toolbar_injector/toolbar_injector_65b501eb.js +976 -0
- package/dist/toolbar_injector/toolbar_injector_65b501eb.js.map +294 -0
- package/helpers/babel/asyncIterator/asyncIterator.js +61 -8
- package/helpers/babel/createClass/createClass.js +12 -12
- package/helpers/babel/inherits/inherits.js +10 -6
- package/helpers/babel/jsx/jsx.js +27 -22
- package/helpers/babel/objectSpread2/objectSpread2.js +22 -14
- package/helpers/babel/readme.md +3 -8
- package/helpers/babel/wrapRegExp/wrapRegExp.js +29 -29
- package/main.js +19 -14
- package/package.json +43 -43
- package/readme.md +21 -18
- package/src/{launchBrowser.js → browser_runtimes.js} +3 -8
- package/src/{buildProject.js → build_project.js} +6 -17
- package/src/{commonJsToJavaScriptModule.js → commonjs_to_js_module.js} +5 -5
- package/src/dev_server.js +19 -10
- package/src/execute.js +3 -3
- package/src/{executeTestPlan.js → execute_test_plan.js} +24 -20
- package/src/{importUsingChildProcess.js → import_using_child_process.js} +2 -2
- package/src/internal/{browser_runtime/browser_runtime.js → browser_client/browser_client.js} +13 -17
- package/src/internal/{browser_runtime/createBrowserRuntime.js → browser_client/browser_client_factory.js} +7 -9
- package/src/internal/{error-stack-remapping/installBrowserErrorStackRemapping.js → browser_client/browser_error_stack_remap.js} +1 -3
- package/src/internal/{browser_runtime → browser_client}/browser_system.js +2 -4
- package/src/internal/{browser_runtime/displayErrorInDocument.js → browser_client/error_in_document.js} +0 -2
- package/src/internal/{browser_runtime/displayErrorNotification.js → browser_client/error_in_notification.js} +0 -1
- package/src/internal/{browser_runtime/makeNamespaceTransferable.js → browser_client/module_namespace_transfer.js} +1 -1
- package/src/internal/{perf_browser.js → browser_client/perf_browser.js} +0 -2
- package/src/internal/browser_detection/browser_detection.js +9 -12
- package/src/internal/browser_detection/{detectAndroid.js → detect_android.js} +0 -0
- package/src/internal/browser_detection/{detectChrome.js → detect_chrome.js} +0 -0
- package/src/internal/browser_detection/{detectEdge.js → detect_edge.js} +0 -0
- package/src/internal/browser_detection/{detectElectron.js → detect_electron.js} +0 -0
- package/src/internal/browser_detection/{detectFirefox.js → detect_firefox.js} +0 -0
- package/src/internal/browser_detection/{detectInternetExplorer.js → detect_internet_explorer.js} +0 -0
- package/src/internal/browser_detection/{detectIOS.js → detect_ios.js} +0 -0
- package/src/internal/browser_detection/{detectOpera.js → detect_opera.js} +0 -0
- package/src/internal/browser_detection/{detectSafari.js → detect_safari.js} +0 -0
- package/src/internal/browser_detection/user_agent_data.js +0 -1
- package/src/internal/browser_launcher/{executeHtmlFile.js → execute_html_file.js} +5 -4
- package/src/internal/browser_launcher/from_playwright.js +3 -3
- package/src/internal/browser_launcher/{trackPageToNotify.js → page_errors_and_logs.js} +1 -1
- package/src/internal/browser_utils/{fetchAndEvalUsingFetch.js → fetch_and_eval.js} +1 -3
- package/src/internal/browser_utils/{fetchAndEvalUsingScript.js → fetch_and_eval_using_script.js} +0 -2
- package/src/internal/browser_utils/fetch_browser.js +1 -1
- package/src/internal/browser_utils/{fetchJson.js → fetch_json.js} +0 -0
- package/src/internal/browser_utils/{fetchUsingXHR.js → fetch_using_xhr.js} +0 -2
- package/src/internal/building/build_logs.js +37 -40
- package/src/internal/building/build_stats.js +2 -1
- package/src/internal/building/build_url_generator.js +1 -1
- package/src/internal/building/{buildUsingRollup.js → build_using_rollup.js} +6 -21
- package/src/internal/building/css/{applyPostCss.js → apply_post_css.js} +0 -0
- package/src/internal/building/css/{parseCssRessource.js → jsenv_parse_css.js} +5 -4
- package/src/internal/building/css/{moveCssUrls.js → move_css_urls.js} +1 -1
- package/src/internal/building/css/{parseCssUrls.js → parse_css_urls.js} +1 -1
- package/src/internal/building/css/postcss_plugin_url_visitor.js +1 -0
- package/src/internal/building/css/{replaceCssUrls.js → replace_css_urls.js} +2 -1
- package/src/internal/building/global_format/es_to_system.js +34 -0
- package/src/internal/building/{parsing.utils.js → html/html_node_mutations.js} +0 -0
- package/src/internal/building/html/{htmlScan.js → html_scan.js} +1 -1
- package/src/internal/building/html/{parseHtmlRessource.js → jsenv_parse_html.js} +5 -6
- package/src/internal/building/html/{minifyHtml.js → minify_html.js} +0 -0
- package/src/internal/building/{css_module.js → import_assertions/css_module.js} +3 -3
- package/src/internal/building/{json_module.js → import_assertions/json_module.js} +0 -0
- package/src/internal/building/import_references.js +0 -1
- package/src/internal/building/importmap/{parseImportmapRessource.js → jsenv_parse_importmap.js} +0 -0
- package/src/internal/building/js/{parseJsRessource.js → jsenv_parse_js.js} +2 -1
- package/src/internal/building/js/{minifyJs.js → minify_js.js} +0 -0
- package/src/internal/building/js/transform_worker.js +1 -1
- package/src/internal/building/json/{parseJsonRessource.js → jsenv_parse_json.js} +0 -0
- package/src/internal/building/{parseRessource.js → parse_ressource.js} +13 -13
- package/src/internal/building/ressource_builder.js +4 -3
- package/src/internal/building/ressource_builder_util.js +2 -2
- package/src/internal/building/rollup_plugin_jsenv.js +166 -61
- package/src/internal/building/{sortObjectByPathnames.js → sort_pathnames.js} +0 -0
- package/src/internal/building/{sourcemap_loader.js → sourcemap/sourcemap_loader.js} +3 -6
- package/src/internal/building/svg/{parseSvgRessource.js → jsenv_parse_svg.js} +4 -3
- package/src/internal/building/url_fetcher.js +1 -1
- package/src/internal/building/url_loader.js +3 -3
- package/src/internal/building/{resolve_import_url_helper.js → url_versioning/resolve_import_url_helper.js} +0 -0
- package/src/internal/building/{url_versioning.js → url_versioning/url_versioning.js} +1 -1
- package/src/internal/building/webmanifest/{parseWebmanifestRessource.js → jsenv_parse_webmanifest.js} +0 -0
- package/src/internal/{compiling → compile_server/commonjs}/rollup_plugin_commonjs_named_exports.js +0 -0
- package/src/internal/{compiling/compileFile.js → compile_server/compile_file.js} +4 -4
- package/src/internal/{compiling/startCompileServer.js → compile_server/compile_server.js} +11 -24
- package/src/internal/{compiling/createCompiledFileService.js → compile_server/compiled_file_service.js} +4 -8
- package/src/internal/{compiling/compileHtml.js → compile_server/html/html_ast.js} +2 -12
- package/src/internal/{compiling → compile_server/html}/html_source_file_service.js +10 -10
- package/src/internal/{compiling/jsenvCompilerForHtml.js → compile_server/html/jsenv_compile_html.js} +12 -12
- package/src/internal/{compiling/jsenvCompilerForImportmap.js → compile_server/importmap/jsenv_compile_importmap.js} +1 -1
- package/src/internal/{compiling/js-compilation-service/ansiToHTML.js → compile_server/js/ansi_to_html.js} +1 -1
- package/src/internal/{compiling/js-compilation-service → compile_server/js}/babelHelper.js +1 -1
- package/src/internal/{compiling → compile_server/js}/babel_parse_error.js +0 -0
- package/src/internal/{compiling/js-compilation-service → compile_server/js}/babel_plugin_babel_helpers_as_jsenv_imports.js +2 -1
- package/src/internal/{compiling → compile_server/js}/babel_plugin_global_this_as_jsenv_import.js +1 -1
- package/src/internal/{compiling → compile_server/js}/babel_plugin_import_assertions.js +1 -0
- package/src/internal/{compiling → compile_server/js}/babel_plugin_import_metadata.js +0 -0
- package/src/internal/{compiling → compile_server/js}/babel_plugin_import_visitor.js +0 -0
- package/src/internal/{compiling → compile_server/js}/babel_plugin_new_stylesheet_as_jsenv_import.js +1 -1
- package/src/internal/{compiling → compile_server/js}/babel_plugin_proxy_external_imports.js +0 -0
- package/src/internal/{compiling/js-compilation-service → compile_server/js}/babel_plugin_regenerator_runtime_as_jsenv_import.js +1 -1
- package/src/internal/{babel_plugin_replace_expressions.js → compile_server/js/babel_plugin_replace_expressions.js} +0 -0
- package/src/internal/{compiling/js-compilation-service → compile_server/js}/babel_plugin_systemjs_prepend.js +2 -2
- package/src/internal/{compiling → compile_server/js}/babel_plugin_transform_import_meta.js +0 -0
- package/src/internal/{compiling → compile_server/js}/babel_plugins.js +0 -0
- package/src/internal/{compiling/js-compilation-service → compile_server/js}/generateBabelHelper.js +1 -1
- package/src/internal/{compiling/js-compilation-service/transformJs.js → compile_server/js/js_transformer.js} +8 -9
- package/src/internal/{compiling/jsenvCompilerForJavaScript.js → compile_server/js/jsenv_compile_js.js} +7 -7
- package/src/internal/{compiling → compile_server/js}/load_babel_plugin_map_from_file.js +0 -0
- package/src/internal/{compiling → compile_server}/jsenv_directory/comparison_utils.js +0 -0
- package/src/internal/{compiling/transformResultToCompilationResult.js → compile_server/jsenv_directory/compilation_result.js} +6 -5
- package/src/internal/{building/buildToCompilationResult.js → compile_server/jsenv_directory/compilation_result_from_build.js} +4 -3
- package/src/internal/{compiling → compile_server}/jsenv_directory/compile_asset.js +0 -0
- package/src/internal/{compiling → compile_server}/jsenv_directory/compile_context.js +4 -13
- package/src/internal/{compiling → compile_server}/jsenv_directory/compile_profile.js +1 -2
- package/src/internal/{compiling → compile_server}/jsenv_directory/file_lock_registry.js +0 -0
- package/src/internal/{compiling → compile_server}/jsenv_directory/file_lock_registry.test.js +0 -0
- package/src/internal/{compiling/jsenv_directory/fs-optimized-for-cache.js → compile_server/jsenv_directory/fs_optimized_for_cache.js} +0 -0
- package/src/internal/{compiling → compile_server}/jsenv_directory/jsenv_directory.js +0 -0
- package/src/internal/{compiling/jsenv_directory/getOrGenerateCompiledFile.js → compile_server/jsenv_directory/reuse_or_create_compiled_file.js} +3 -3
- package/src/internal/{compiling/jsenv_directory/updateMeta.js → compile_server/jsenv_directory/update_compile_cache.js} +2 -2
- package/src/internal/{compiling/jsenv_directory/validateCache.js → compile_server/jsenv_directory/validate_compile_cache.js} +1 -1
- package/src/internal/{compiling → compile_server}/sse_service/sse_service.js +1 -1
- package/src/internal/{executing/coverage → coverage}/babel_plugin_instrument.js +1 -1
- package/src/internal/{executing/coverage_reporter → coverage}/coverage_reporter_html_directory.js +3 -2
- package/src/internal/{executing/coverage_reporter → coverage}/coverage_reporter_json_file.js +1 -1
- package/src/internal/{executing/coverage_reporter → coverage}/coverage_reporter_text_log.js +3 -2
- package/src/internal/{executing/coverage_missing/relativeUrlToEmptyCoverage.js → coverage/empty_coverage_factory.js} +10 -3
- package/src/internal/{executing/coverage_utils → coverage}/file_by_file_coverage.js +0 -0
- package/src/internal/{executing/coverage_utils → coverage}/istanbul_coverage_composition.js +1 -1
- package/src/internal/{executing/coverage_reporter/istanbulCoverageMapFromCoverage.js → coverage/istanbul_coverage_map_from_coverage.js} +1 -1
- package/src/internal/{executing/coverage_missing → coverage}/list_files_not_covered.js +0 -0
- package/src/internal/{executing/coverage_missing → coverage}/missing_coverage.js +1 -1
- package/src/internal/{executing/coverage/reportToCoverage.js → coverage/report_to_coverage.js} +8 -7
- package/src/internal/{executing/coverage_utils → coverage}/v8_and_istanbul.js +0 -0
- package/src/internal/{executing/coverage_utils → coverage}/v8_coverage_composition.js +0 -0
- package/src/internal/{executing/coverage_utils → coverage}/v8_coverage_from_directory.js +2 -1
- package/src/internal/{executing/coverage_utils → coverage}/v8_coverage_to_istanbul.js +0 -0
- package/src/internal/data_url.js +54 -0
- package/src/internal/dev_server/exploring/exploring.js +1 -1
- package/src/internal/dev_server/exploring/{fetchExploringJson.js → fetch_exploring_json.js} +1 -1
- package/src/internal/dev_server/toolbar/animation/{toolbar.animation.js → toolbar_animation.js} +0 -0
- package/src/internal/dev_server/toolbar/compilation/{toolbar.compilation.js → toolbar_compilation.js} +3 -2
- package/src/internal/dev_server/toolbar/eventsource/{toolbar.eventsource.js → toolbar_eventsource.js} +0 -0
- package/src/internal/dev_server/toolbar/execution/{toolbar.execution.js → toolbar_execution.js} +1 -1
- package/src/internal/dev_server/toolbar/focus/{toolbar.focus.js → toolbar_focus.js} +0 -0
- package/src/internal/dev_server/toolbar/{jsenv-logo.svg → jsenv_logo.svg} +1 -1
- package/src/internal/dev_server/toolbar/notification/{toolbar.notification.js → toolbar_notification.js} +0 -0
- package/src/internal/dev_server/toolbar/responsive/{overflow-menu.css → overflow_menu.css} +0 -0
- package/src/internal/dev_server/toolbar/responsive/{toolbar.responsive.js → toolbar_responsive.js} +0 -0
- package/src/internal/dev_server/toolbar/settings/{toolbar.settings.js → toolbar_settings.js} +0 -0
- package/src/internal/dev_server/toolbar/theme/{jsenv-theme.css → jsenv_theme.css} +0 -0
- package/src/internal/dev_server/toolbar/theme/{light-theme.css → light_theme.css} +0 -0
- package/src/internal/dev_server/toolbar/theme/{toolbar.theme.js → toolbar_theme.js} +0 -0
- package/src/internal/dev_server/toolbar/toolbar.html +2 -2
- package/src/internal/dev_server/toolbar/{toolbar.injector.js → toolbar_injector.js} +4 -3
- package/src/internal/dev_server/toolbar/{toolbar.main.css → toolbar_main.css} +2 -2
- package/src/internal/dev_server/toolbar/{toolbar.main.js → toolbar_main.js} +9 -9
- package/src/internal/dev_server/toolbar/util/fetching.js +1 -1
- package/src/internal/dev_server/toolbar/util/{jsenvLogger.js → jsenv_logger.js} +0 -0
- package/src/internal/{error-stack-remapping/installErrorStackRemapping.js → error_stack_remap/install_error_stack_remapping.js} +6 -5
- package/src/internal/{error-stack-remapping/remapCallSite.js → error_stack_remap/remap_call_site.js} +2 -1
- package/src/internal/{error-stack-remapping/getOriginalCallsites.js → error_stack_remap/remap_stack.js} +7 -6
- package/src/internal/{error-stack-remapping/stackToString.js → error_stack_remap/stringify_stack.js} +1 -1
- package/src/internal/executing/execute_plan.js +604 -0
- package/src/internal/executing/{generateFileExecutionSteps.js → execution_steps.js} +27 -0
- package/src/internal/executing/{launchAndExecute.js → launch_and_execute.js} +2 -2
- package/src/internal/executing/{executionLogs.js → logs_file_execution.js} +3 -2
- package/src/internal/executing/{createSummaryLog.js → logs_plan_summary.js} +3 -2
- package/src/internal/features/browser_feature_detection/browser_feature_detection.js +1 -1
- package/src/internal/features/features_compat_from_runtime.js +1 -1
- package/src/internal/features/node_feature_detection/node_feature_detection.js +1 -1
- package/src/internal/{fetchUrl.js → fetching.js} +0 -0
- package/src/internal/{import-resolution/default-extension.js → import_resolution/default_extension.js} +0 -0
- package/src/internal/{import-resolution/import-resolver-importmap.js → import_resolution/import_resolver_importmap.js} +2 -2
- package/src/internal/{import-resolution/import-resolver-node.js → import_resolution/import_resolver_node.js} +2 -2
- package/src/internal/{import-resolution → import_resolution}/importmap_default.js +1 -1
- package/src/internal/jsenv_builds.js +1 -1
- package/src/internal/{argUtils.js → jsenv_params_assertions.js} +0 -0
- package/src/internal/jsenv_remote_directory.js +1 -1
- package/src/internal/logs/{byteAsFileSize.js → byte_as_file_size.js} +1 -1
- package/src/internal/logs/{msAsDuration.js → ms_as_duration.js} +1 -1
- package/src/internal/node_launcher/{createChildProcessOptions.js → child_process_options.js} +1 -1
- package/src/internal/{node_runtime/evalSource.js → node_launcher/eval_source.js} +0 -0
- package/src/internal/{node_runtime/fetchSource.js → node_launcher/fetch_source.js} +1 -1
- package/src/internal/node_launcher/kill_process_tree.js +2 -2
- package/src/internal/{node_runtime/nodeControllableFile.mjs → node_launcher/node_controllable_file.mjs} +0 -0
- package/src/internal/node_launcher/{createControllableNodeProcess.js → node_controllable_process.js} +3 -3
- package/src/internal/{error-stack-remapping/installNodeErrorStackRemapping.js → node_launcher/node_error_stack_remap.js} +5 -3
- package/src/internal/{node_runtime → node_launcher}/node_execution_dynamic_import.js +3 -2
- package/src/internal/{node_runtime → node_launcher}/node_execution_performance.js +0 -0
- package/src/internal/{node_runtime → node_launcher}/node_execution_systemjs.js +6 -6
- package/src/internal/{node_runtime → node_launcher}/node_system.js +7 -6
- package/src/internal/{perf_node.js → node_launcher/perf_node.js} +1 -1
- package/src/internal/node_launcher/{processOptions.js → process_options.js} +0 -0
- package/src/internal/{runtime/valueInstall.js → node_launcher/value_install.js} +0 -0
- package/src/internal/{escapeRegexpSpecialCharacters.js → regexp_escape.js} +0 -0
- package/src/internal/{runtime/module-registration.js → runtime_client/module_registration.js} +0 -0
- package/src/internal/{runtime → runtime_client}/s.js +3 -2
- package/src/internal/{runtime → runtime_client}/s.js.md +0 -0
- package/src/internal/{unevalException.js → runtime_client/uneval_exception.js} +0 -0
- package/src/internal/runtime_support/runtime_support.js +2 -2
- package/src/internal/semantic_versioning/{versionCompare.js → compare_versions.js} +4 -8
- package/src/internal/semantic_versioning/{findHighestVersion.js → highest_version.js} +1 -2
- package/src/internal/semantic_versioning/is_above.js +5 -0
- package/src/internal/semantic_versioning/is_below.js +5 -0
- package/src/internal/semantic_versioning/{versionIsEqual.js → is_equal.js} +0 -0
- package/src/internal/semantic_versioning/{findLowestVersion.js → lowest_version.js} +1 -2
- package/src/internal/semantic_versioning/{valueToVersion.js → version_from_value.js} +1 -3
- package/src/internal/{sourceMappingURLUtils.js → sourcemap_utils.js} +0 -0
- package/src/internal/{escapeTemplateStringSpecialCharacters.js → template_string_escape.js} +0 -0
- package/src/internal/{filePathUtils.js → windows_file_path_utils.js} +0 -3
- package/src/jsenv_file_urls.js +35 -0
- package/src/{jsenvServiceWorkerFinalizer.js → jsenv_service_worker_finalizer.js} +1 -1
- package/src/{textToJavaScriptModule.js → json_to_js_module.js} +1 -2
- package/src/{launchNode.js → node_runtime.js} +3 -3
- package/src/{requireUsingChildProcess.js → require_using_child_process.js} +2 -2
- package/src/{jsonToJavaScriptModule.js → text_to_js_module.js} +3 -2
- package/dist/browser_runtime/asset-manifest.json +0 -4
- package/dist/browser_runtime/browser_runtime_0e3396a1.js +0 -5298
- package/dist/browser_runtime/browser_runtime_0e3396a1.js.map +0 -1089
- package/dist/compile_proxy/compile_proxy.html__inline__20_f4285042.js.map +0 -343
- package/dist/event_source_client/event_source_client_80644aee.js +0 -356
- package/dist/redirector/redirector.html__inline__12_404b8295.js.map +0 -349
- package/dist/toolbar_injector/toolbar_injector_1e193101.js +0 -976
- package/dist/toolbar_injector/toolbar_injector_1e193101.js.map +0 -294
- package/src/internal/browser_runtime/evalSource.js +0 -11
- package/src/internal/dataUrl.utils.js +0 -55
- package/src/internal/executing/coverage_missing/createEmptyCoverage.js +0 -6
- package/src/internal/executing/executeConcurrently.js +0 -440
- package/src/internal/executing/executePlan.js +0 -211
- package/src/internal/executing/executionIsPassed.js +0 -2
- package/src/internal/executing/generateExecutionSteps.js +0 -29
- package/src/internal/jsenvCoreDirectoryUrl.js +0 -22
- package/src/internal/jsenvInternalFiles.js +0 -36
- package/src/internal/semantic_versioning/index.js +0 -5
- package/src/internal/semantic_versioning/versionIsAbove.js +0 -5
- package/src/internal/semantic_versioning/versionIsBelow.js +0 -5
- package/src/jsenvCoverageConfig.js +0 -7
- package/src/jsenvExplorableConfig.js +0 -9
- package/src/jsenvRuntimeSupportDuringDev.js +0 -12
- package/src/playwright_browser_versions.js +0 -5
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs"
|
|
2
|
-
import { memoryUsage } from "node:process"
|
|
3
|
-
import wrapAnsi from "wrap-ansi"
|
|
4
|
-
import cuid from "cuid"
|
|
5
|
-
import { loggerToLevels } from "@jsenv/logger"
|
|
6
|
-
import { createLog, startSpinner } from "@jsenv/log"
|
|
7
|
-
import {
|
|
8
|
-
urlToFileSystemPath,
|
|
9
|
-
resolveUrl,
|
|
10
|
-
writeDirectory,
|
|
11
|
-
ensureEmptyDirectory,
|
|
12
|
-
normalizeStructuredMetaMap,
|
|
13
|
-
urlToMeta,
|
|
14
|
-
} from "@jsenv/filesystem"
|
|
15
|
-
import { Abort, createCallbackListNotifiedOnce } from "@jsenv/abort"
|
|
16
|
-
|
|
17
|
-
import { launchAndExecute } from "../executing/launchAndExecute.js"
|
|
18
|
-
import { reportToCoverage } from "./coverage/reportToCoverage.js"
|
|
19
|
-
import { formatExecuting, formatExecutionResult } from "./executionLogs.js"
|
|
20
|
-
import { createSummaryLog } from "./createSummaryLog.js"
|
|
21
|
-
import { ensureGlobalGc } from "./gc.js"
|
|
22
|
-
|
|
23
|
-
export const executeConcurrently = async (
|
|
24
|
-
executionSteps,
|
|
25
|
-
{
|
|
26
|
-
multipleExecutionsOperation,
|
|
27
|
-
|
|
28
|
-
logger,
|
|
29
|
-
launchAndExecuteLogLevel,
|
|
30
|
-
|
|
31
|
-
projectDirectoryUrl,
|
|
32
|
-
compileServer,
|
|
33
|
-
babelPluginMap,
|
|
34
|
-
|
|
35
|
-
logSummary,
|
|
36
|
-
logMemoryHeapUsage,
|
|
37
|
-
completedExecutionLogMerging,
|
|
38
|
-
completedExecutionLogAbbreviation,
|
|
39
|
-
|
|
40
|
-
maxExecutionsInParallel,
|
|
41
|
-
defaultMsAllocatedPerExecution,
|
|
42
|
-
stopAfterExecute,
|
|
43
|
-
cooldownBetweenExecutions,
|
|
44
|
-
gcBetweenExecutions,
|
|
45
|
-
|
|
46
|
-
coverage,
|
|
47
|
-
coverageConfig,
|
|
48
|
-
coverageIncludeMissing,
|
|
49
|
-
coverageForceIstanbul,
|
|
50
|
-
coverageV8ConflictWarning,
|
|
51
|
-
coverageTempDirectoryRelativeUrl,
|
|
52
|
-
runtimeSupport,
|
|
53
|
-
|
|
54
|
-
beforeExecutionCallback = () => {},
|
|
55
|
-
afterExecutionCallback = () => {},
|
|
56
|
-
},
|
|
57
|
-
) => {
|
|
58
|
-
if (completedExecutionLogMerging && !process.stdout.isTTY) {
|
|
59
|
-
completedExecutionLogMerging = false
|
|
60
|
-
logger.debug(
|
|
61
|
-
`Force completedExecutionLogMerging to false because process.stdout.isTTY is false`,
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
const executionLogsEnabled = loggerToLevels(logger).info
|
|
65
|
-
const executionSpinner = executionLogsEnabled && process.stdout.isTTY
|
|
66
|
-
|
|
67
|
-
const startMs = Date.now()
|
|
68
|
-
const report = {}
|
|
69
|
-
const executionCount = executionSteps.length
|
|
70
|
-
|
|
71
|
-
let transformReturnValue = (value) => value
|
|
72
|
-
|
|
73
|
-
if (gcBetweenExecutions) {
|
|
74
|
-
ensureGlobalGc()
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const coverageTempDirectoryUrl = resolveUrl(
|
|
78
|
-
coverageTempDirectoryRelativeUrl,
|
|
79
|
-
projectDirectoryUrl,
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
const structuredMetaMapForCover = normalizeStructuredMetaMap(
|
|
83
|
-
{
|
|
84
|
-
cover: coverageConfig,
|
|
85
|
-
},
|
|
86
|
-
projectDirectoryUrl,
|
|
87
|
-
)
|
|
88
|
-
const coverageIgnorePredicate = (url) => {
|
|
89
|
-
return !urlToMeta({
|
|
90
|
-
url: resolveUrl(url, projectDirectoryUrl),
|
|
91
|
-
structuredMetaMap: structuredMetaMapForCover,
|
|
92
|
-
}).cover
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (coverage) {
|
|
96
|
-
// in case runned multiple times, we don't want to keep writing lot of files in this directory
|
|
97
|
-
if (!process.env.NODE_V8_COVERAGE) {
|
|
98
|
-
await ensureEmptyDirectory(coverageTempDirectoryUrl)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (runtimeSupport.node) {
|
|
102
|
-
// v8 coverage is written in a directoy and auto propagate to subprocesses
|
|
103
|
-
// through process.env.NODE_V8_COVERAGE.
|
|
104
|
-
if (!coverageForceIstanbul && !process.env.NODE_V8_COVERAGE) {
|
|
105
|
-
const v8CoverageDirectory = resolveUrl(
|
|
106
|
-
`./node_v8/${cuid()}`,
|
|
107
|
-
coverageTempDirectoryUrl,
|
|
108
|
-
)
|
|
109
|
-
await writeDirectory(v8CoverageDirectory, { allowUseless: true })
|
|
110
|
-
process.env.NODE_V8_COVERAGE = urlToFileSystemPath(v8CoverageDirectory)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
transformReturnValue = async (value) => {
|
|
115
|
-
if (multipleExecutionsOperation.signal.aborted) {
|
|
116
|
-
// don't try to do the coverage stuff
|
|
117
|
-
return value
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
value.coverage = await reportToCoverage(value.report, {
|
|
122
|
-
signal: multipleExecutionsOperation.signal,
|
|
123
|
-
logger,
|
|
124
|
-
projectDirectoryUrl,
|
|
125
|
-
babelPluginMap,
|
|
126
|
-
coverageConfig,
|
|
127
|
-
coverageIncludeMissing,
|
|
128
|
-
coverageForceIstanbul,
|
|
129
|
-
coverageIgnorePredicate,
|
|
130
|
-
coverageV8ConflictWarning,
|
|
131
|
-
})
|
|
132
|
-
} catch (e) {
|
|
133
|
-
if (Abort.isAbortError(e)) {
|
|
134
|
-
return value
|
|
135
|
-
}
|
|
136
|
-
throw e
|
|
137
|
-
}
|
|
138
|
-
return value
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
logger.info("")
|
|
143
|
-
let executionLog = createLog({ newLine: "" })
|
|
144
|
-
let abortedCount = 0
|
|
145
|
-
let timedoutCount = 0
|
|
146
|
-
let erroredCount = 0
|
|
147
|
-
let completedCount = 0
|
|
148
|
-
const stopAfterAllExecutionCallbackList = createCallbackListNotifiedOnce()
|
|
149
|
-
|
|
150
|
-
const executionsDone = await executeInParallel({
|
|
151
|
-
multipleExecutionsOperation,
|
|
152
|
-
maxExecutionsInParallel,
|
|
153
|
-
cooldownBetweenExecutions,
|
|
154
|
-
executionSteps,
|
|
155
|
-
start: async (paramsFromStep) => {
|
|
156
|
-
const executionIndex = executionSteps.indexOf(paramsFromStep)
|
|
157
|
-
const { executionName, fileRelativeUrl, runtime } = paramsFromStep
|
|
158
|
-
const runtimeName = runtime.name
|
|
159
|
-
const runtimeVersion = runtime.version
|
|
160
|
-
|
|
161
|
-
const executionParams = {
|
|
162
|
-
// the params below can be overriden by executionDefaultParams
|
|
163
|
-
measurePerformance: false,
|
|
164
|
-
collectPerformance: false,
|
|
165
|
-
captureConsole: true,
|
|
166
|
-
stopAfterExecute,
|
|
167
|
-
stopAfterExecuteReason: "execution-done",
|
|
168
|
-
allocatedMs: defaultMsAllocatedPerExecution,
|
|
169
|
-
...paramsFromStep,
|
|
170
|
-
runtime,
|
|
171
|
-
// mirrorConsole: false because file will be executed in parallel
|
|
172
|
-
// so log would be a mess to read
|
|
173
|
-
mirrorConsole: false,
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const beforeExecutionInfo = {
|
|
177
|
-
fileRelativeUrl,
|
|
178
|
-
runtimeName,
|
|
179
|
-
runtimeVersion,
|
|
180
|
-
executionIndex,
|
|
181
|
-
executionParams,
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
let spinner
|
|
185
|
-
if (executionSpinner) {
|
|
186
|
-
spinner = startSpinner({
|
|
187
|
-
log: executionLog,
|
|
188
|
-
text: formatExecuting(beforeExecutionInfo, {
|
|
189
|
-
executionCount,
|
|
190
|
-
abortedCount,
|
|
191
|
-
timedoutCount,
|
|
192
|
-
erroredCount,
|
|
193
|
-
completedCount,
|
|
194
|
-
...(logMemoryHeapUsage
|
|
195
|
-
? { memoryHeap: memoryUsage().heapUsed }
|
|
196
|
-
: {}),
|
|
197
|
-
}),
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
beforeExecutionCallback(beforeExecutionInfo)
|
|
201
|
-
|
|
202
|
-
const filePath = urlToFileSystemPath(
|
|
203
|
-
`${projectDirectoryUrl}${fileRelativeUrl}`,
|
|
204
|
-
)
|
|
205
|
-
let executionResult
|
|
206
|
-
if (existsSync(filePath)) {
|
|
207
|
-
executionResult = await launchAndExecute({
|
|
208
|
-
signal: multipleExecutionsOperation.signal,
|
|
209
|
-
launchAndExecuteLogLevel,
|
|
210
|
-
|
|
211
|
-
...executionParams,
|
|
212
|
-
collectCoverage: coverage,
|
|
213
|
-
coverageTempDirectoryUrl,
|
|
214
|
-
runtimeParams: {
|
|
215
|
-
projectDirectoryUrl,
|
|
216
|
-
compileServerOrigin: compileServer.origin,
|
|
217
|
-
compileServerId: compileServer.id,
|
|
218
|
-
jsenvDirectoryRelativeUrl: compileServer.jsenvDirectoryRelativeUrl,
|
|
219
|
-
|
|
220
|
-
collectCoverage: coverage,
|
|
221
|
-
coverageIgnorePredicate,
|
|
222
|
-
coverageForceIstanbul,
|
|
223
|
-
stopAfterAllExecutionCallbackList,
|
|
224
|
-
...executionParams.runtimeParams,
|
|
225
|
-
},
|
|
226
|
-
executeParams: {
|
|
227
|
-
fileRelativeUrl,
|
|
228
|
-
...executionParams.executeParams,
|
|
229
|
-
},
|
|
230
|
-
coverageV8ConflictWarning,
|
|
231
|
-
})
|
|
232
|
-
} else {
|
|
233
|
-
executionResult = {
|
|
234
|
-
status: "errored",
|
|
235
|
-
error: new Error(
|
|
236
|
-
`No file at ${fileRelativeUrl} for execution "${executionName}"`,
|
|
237
|
-
),
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (fileRelativeUrl in report === false) {
|
|
241
|
-
report[fileRelativeUrl] = {}
|
|
242
|
-
}
|
|
243
|
-
report[fileRelativeUrl][executionName] = executionResult
|
|
244
|
-
const afterExecutionInfo = {
|
|
245
|
-
...beforeExecutionInfo,
|
|
246
|
-
endMs: Date.now(),
|
|
247
|
-
executionResult,
|
|
248
|
-
}
|
|
249
|
-
afterExecutionCallback(afterExecutionInfo)
|
|
250
|
-
|
|
251
|
-
if (executionResult.status === "aborted") {
|
|
252
|
-
abortedCount++
|
|
253
|
-
} else if (executionResult.status === "timedout") {
|
|
254
|
-
timedoutCount++
|
|
255
|
-
} else if (executionResult.status === "errored") {
|
|
256
|
-
erroredCount++
|
|
257
|
-
} else if (executionResult.status === "completed") {
|
|
258
|
-
completedCount++
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (gcBetweenExecutions) {
|
|
262
|
-
global.gc()
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (executionLogsEnabled) {
|
|
266
|
-
let log = formatExecutionResult(afterExecutionInfo, {
|
|
267
|
-
completedExecutionLogAbbreviation,
|
|
268
|
-
executionCount,
|
|
269
|
-
abortedCount,
|
|
270
|
-
timedoutCount,
|
|
271
|
-
erroredCount,
|
|
272
|
-
completedCount,
|
|
273
|
-
...(logMemoryHeapUsage ? { memoryHeap: memoryUsage().heapUsed } : {}),
|
|
274
|
-
})
|
|
275
|
-
log = `${log}
|
|
276
|
-
|
|
277
|
-
`
|
|
278
|
-
const { columns = 80 } = process.stdout
|
|
279
|
-
log = wrapAnsi(log, columns, {
|
|
280
|
-
trim: false,
|
|
281
|
-
hard: true,
|
|
282
|
-
wordWrap: false,
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
// replace spinner with this execution result
|
|
286
|
-
if (spinner) spinner.stop()
|
|
287
|
-
executionLog.write(log)
|
|
288
|
-
|
|
289
|
-
const canOverwriteLog = canOverwriteLogGetter({
|
|
290
|
-
completedExecutionLogMerging,
|
|
291
|
-
executionResult,
|
|
292
|
-
})
|
|
293
|
-
if (canOverwriteLog) {
|
|
294
|
-
// nothing to do, we reuse the current executionLog object
|
|
295
|
-
} else {
|
|
296
|
-
executionLog.destroy()
|
|
297
|
-
executionLog = createLog({ newLine: "" })
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
if (stopAfterExecute) {
|
|
304
|
-
stopAfterAllExecutionCallbackList.notify()
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const summaryCounts = reportToSummary(report)
|
|
308
|
-
|
|
309
|
-
const summary = {
|
|
310
|
-
executionCount,
|
|
311
|
-
...summaryCounts,
|
|
312
|
-
// when execution is aborted, the remaining executions are "cancelled"
|
|
313
|
-
cancelledCount:
|
|
314
|
-
executionCount -
|
|
315
|
-
executionsDone.length -
|
|
316
|
-
// we substract abortedCount because they are not pushed into executionsDone
|
|
317
|
-
summaryCounts.abortedCount,
|
|
318
|
-
duration: Date.now() - startMs,
|
|
319
|
-
}
|
|
320
|
-
if (logSummary) {
|
|
321
|
-
logger.info(createSummaryLog(summary))
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
return transformReturnValue({
|
|
325
|
-
summary,
|
|
326
|
-
report,
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const canOverwriteLogGetter = ({
|
|
331
|
-
completedExecutionLogMerging,
|
|
332
|
-
executionResult,
|
|
333
|
-
}) => {
|
|
334
|
-
if (!completedExecutionLogMerging) {
|
|
335
|
-
return false
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (executionResult.status === "aborted") {
|
|
339
|
-
return true
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (executionResult.status !== "completed") {
|
|
343
|
-
return false
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
const { consoleCalls = [] } = executionResult
|
|
347
|
-
if (consoleCalls.length > 0) {
|
|
348
|
-
return false
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return true
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const executeInParallel = async ({
|
|
355
|
-
multipleExecutionsOperation,
|
|
356
|
-
executionSteps,
|
|
357
|
-
start,
|
|
358
|
-
maxExecutionsInParallel = 1,
|
|
359
|
-
cooldownBetweenExecutions,
|
|
360
|
-
}) => {
|
|
361
|
-
const executionResults = []
|
|
362
|
-
let progressionIndex = 0
|
|
363
|
-
let remainingExecutionCount = executionSteps.length
|
|
364
|
-
|
|
365
|
-
const nextChunk = async () => {
|
|
366
|
-
if (multipleExecutionsOperation.signal.aborted) {
|
|
367
|
-
return
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const outputPromiseArray = []
|
|
371
|
-
while (
|
|
372
|
-
remainingExecutionCount > 0 &&
|
|
373
|
-
outputPromiseArray.length < maxExecutionsInParallel
|
|
374
|
-
) {
|
|
375
|
-
remainingExecutionCount--
|
|
376
|
-
const outputPromise = executeOne(progressionIndex)
|
|
377
|
-
progressionIndex++
|
|
378
|
-
outputPromiseArray.push(outputPromise)
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (outputPromiseArray.length) {
|
|
382
|
-
await Promise.all(outputPromiseArray)
|
|
383
|
-
if (remainingExecutionCount > 0) {
|
|
384
|
-
await nextChunk()
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const executeOne = async (index) => {
|
|
390
|
-
const input = executionSteps[index]
|
|
391
|
-
const output = await start(input)
|
|
392
|
-
if (!multipleExecutionsOperation.signal.aborted) {
|
|
393
|
-
executionResults[index] = output
|
|
394
|
-
}
|
|
395
|
-
if (cooldownBetweenExecutions) {
|
|
396
|
-
await new Promise((resolve) =>
|
|
397
|
-
setTimeout(resolve, cooldownBetweenExecutions),
|
|
398
|
-
)
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
await nextChunk()
|
|
403
|
-
|
|
404
|
-
return executionResults
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const reportToSummary = (report) => {
|
|
408
|
-
const fileNames = Object.keys(report)
|
|
409
|
-
|
|
410
|
-
const countResultMatching = (predicate) => {
|
|
411
|
-
return fileNames.reduce((previous, fileName) => {
|
|
412
|
-
const fileExecutionResult = report[fileName]
|
|
413
|
-
|
|
414
|
-
return (
|
|
415
|
-
previous +
|
|
416
|
-
Object.keys(fileExecutionResult).filter((executionName) => {
|
|
417
|
-
const fileExecutionResultForRuntime =
|
|
418
|
-
fileExecutionResult[executionName]
|
|
419
|
-
return predicate(fileExecutionResultForRuntime)
|
|
420
|
-
}).length
|
|
421
|
-
)
|
|
422
|
-
}, 0)
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
const abortedCount = countResultMatching(({ status }) => status === "aborted")
|
|
426
|
-
const timedoutCount = countResultMatching(
|
|
427
|
-
({ status }) => status === "timedout",
|
|
428
|
-
)
|
|
429
|
-
const erroredCount = countResultMatching(({ status }) => status === "errored")
|
|
430
|
-
const completedCount = countResultMatching(
|
|
431
|
-
({ status }) => status === "completed",
|
|
432
|
-
)
|
|
433
|
-
|
|
434
|
-
return {
|
|
435
|
-
abortedCount,
|
|
436
|
-
timedoutCount,
|
|
437
|
-
erroredCount,
|
|
438
|
-
completedCount,
|
|
439
|
-
}
|
|
440
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
2
|
-
import { createDetailedMessage } from "@jsenv/logger"
|
|
3
|
-
|
|
4
|
-
import { mergeRuntimeSupport } from "@jsenv/core/src/internal/runtime_support/runtime_support.js"
|
|
5
|
-
import { startCompileServer } from "../compiling/startCompileServer.js"
|
|
6
|
-
import { babelPluginInstrument } from "./coverage/babel_plugin_instrument.js"
|
|
7
|
-
import { generateExecutionSteps } from "./generateExecutionSteps.js"
|
|
8
|
-
import { executeConcurrently } from "./executeConcurrently.js"
|
|
9
|
-
|
|
10
|
-
export const executePlan = async (
|
|
11
|
-
plan,
|
|
12
|
-
{
|
|
13
|
-
signal,
|
|
14
|
-
handleSIGINT,
|
|
15
|
-
|
|
16
|
-
logger,
|
|
17
|
-
compileServerLogLevel,
|
|
18
|
-
launchAndExecuteLogLevel,
|
|
19
|
-
|
|
20
|
-
projectDirectoryUrl,
|
|
21
|
-
jsenvDirectoryRelativeUrl,
|
|
22
|
-
jsenvDirectoryClean,
|
|
23
|
-
|
|
24
|
-
importResolutionMethod,
|
|
25
|
-
importDefaultExtension,
|
|
26
|
-
|
|
27
|
-
logSummary,
|
|
28
|
-
logMemoryHeapUsage,
|
|
29
|
-
completedExecutionLogMerging,
|
|
30
|
-
completedExecutionLogAbbreviation,
|
|
31
|
-
|
|
32
|
-
defaultMsAllocatedPerExecution,
|
|
33
|
-
maxExecutionsInParallel,
|
|
34
|
-
gcBetweenExecutions,
|
|
35
|
-
stopAfterExecute,
|
|
36
|
-
cooldownBetweenExecutions,
|
|
37
|
-
|
|
38
|
-
coverage,
|
|
39
|
-
coverageConfig,
|
|
40
|
-
coverageIncludeMissing,
|
|
41
|
-
coverageForceIstanbul,
|
|
42
|
-
coverageV8ConflictWarning,
|
|
43
|
-
coverageTempDirectoryRelativeUrl,
|
|
44
|
-
|
|
45
|
-
protocol,
|
|
46
|
-
privateKey,
|
|
47
|
-
certificate,
|
|
48
|
-
ip,
|
|
49
|
-
port,
|
|
50
|
-
compileServerCanReadFromFilesystem,
|
|
51
|
-
compileServerCanWriteOnFilesystem,
|
|
52
|
-
babelPluginMap,
|
|
53
|
-
babelConfigFileUrl,
|
|
54
|
-
preservedUrls,
|
|
55
|
-
workers,
|
|
56
|
-
serviceWorkers,
|
|
57
|
-
importMapInWebWorkers,
|
|
58
|
-
customCompilers,
|
|
59
|
-
} = {},
|
|
60
|
-
) => {
|
|
61
|
-
if (coverage) {
|
|
62
|
-
babelPluginMap = {
|
|
63
|
-
...babelPluginMap,
|
|
64
|
-
"transform-instrument": [
|
|
65
|
-
babelPluginInstrument,
|
|
66
|
-
{ projectDirectoryUrl, coverageConfig },
|
|
67
|
-
],
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const runtimeSupport = {}
|
|
72
|
-
Object.keys(plan).forEach((filePattern) => {
|
|
73
|
-
const filePlan = plan[filePattern]
|
|
74
|
-
Object.keys(filePlan).forEach((executionName) => {
|
|
75
|
-
const executionConfig = filePlan[executionName]
|
|
76
|
-
const { runtime } = executionConfig
|
|
77
|
-
if (runtime) {
|
|
78
|
-
mergeRuntimeSupport(runtimeSupport, {
|
|
79
|
-
[runtime.name]: runtime.version,
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
logger.debug(
|
|
86
|
-
createDetailedMessage(`Prepare executing plan`, {
|
|
87
|
-
runtimeSupport: JSON.stringify(runtimeSupport, null, " "),
|
|
88
|
-
}),
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
const multipleExecutionsOperation = Abort.startOperation()
|
|
92
|
-
multipleExecutionsOperation.addAbortSignal(signal)
|
|
93
|
-
if (handleSIGINT) {
|
|
94
|
-
multipleExecutionsOperation.addAbortSource((abort) => {
|
|
95
|
-
return raceProcessTeardownEvents(
|
|
96
|
-
{
|
|
97
|
-
SIGINT: true,
|
|
98
|
-
},
|
|
99
|
-
() => {
|
|
100
|
-
logger.debug(`SIGINT abort`)
|
|
101
|
-
abort()
|
|
102
|
-
},
|
|
103
|
-
)
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
const compileServer = await startCompileServer({
|
|
109
|
-
signal: multipleExecutionsOperation.signal,
|
|
110
|
-
logLevel: compileServerLogLevel,
|
|
111
|
-
|
|
112
|
-
projectDirectoryUrl,
|
|
113
|
-
jsenvDirectoryRelativeUrl,
|
|
114
|
-
jsenvDirectoryClean,
|
|
115
|
-
|
|
116
|
-
importResolutionMethod,
|
|
117
|
-
importDefaultExtension,
|
|
118
|
-
|
|
119
|
-
protocol,
|
|
120
|
-
privateKey,
|
|
121
|
-
certificate,
|
|
122
|
-
ip,
|
|
123
|
-
port,
|
|
124
|
-
compileServerCanReadFromFilesystem,
|
|
125
|
-
compileServerCanWriteOnFilesystem,
|
|
126
|
-
keepProcessAlive: true, // to be sure it stays alive
|
|
127
|
-
babelPluginMap,
|
|
128
|
-
babelConfigFileUrl,
|
|
129
|
-
preservedUrls,
|
|
130
|
-
workers,
|
|
131
|
-
serviceWorkers,
|
|
132
|
-
importMapInWebWorkers,
|
|
133
|
-
customCompilers,
|
|
134
|
-
runtimeSupport,
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
multipleExecutionsOperation.addEndCallback(async () => {
|
|
138
|
-
await compileServer.stop()
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
logger.debug(`Generate executions`)
|
|
142
|
-
|
|
143
|
-
let executionSteps
|
|
144
|
-
try {
|
|
145
|
-
executionSteps = await generateExecutionSteps(
|
|
146
|
-
{
|
|
147
|
-
...plan,
|
|
148
|
-
[compileServer.jsenvDirectoryRelativeUrl]: null,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
signal: multipleExecutionsOperation.signal,
|
|
152
|
-
projectDirectoryUrl,
|
|
153
|
-
},
|
|
154
|
-
)
|
|
155
|
-
} catch (e) {
|
|
156
|
-
if (Abort.isAbortError(e)) {
|
|
157
|
-
return {
|
|
158
|
-
aborted: true,
|
|
159
|
-
planSummary: {},
|
|
160
|
-
planReport: {},
|
|
161
|
-
planCoverage: null,
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
throw e
|
|
165
|
-
}
|
|
166
|
-
logger.debug(`${executionSteps.length} executions planned`)
|
|
167
|
-
|
|
168
|
-
const result = await executeConcurrently(executionSteps, {
|
|
169
|
-
multipleExecutionsOperation,
|
|
170
|
-
logger,
|
|
171
|
-
launchAndExecuteLogLevel,
|
|
172
|
-
|
|
173
|
-
projectDirectoryUrl,
|
|
174
|
-
compileServer,
|
|
175
|
-
|
|
176
|
-
// not sure we actually have to pass import params to executeConcurrently
|
|
177
|
-
importResolutionMethod,
|
|
178
|
-
importDefaultExtension,
|
|
179
|
-
|
|
180
|
-
babelPluginMap: compileServer.babelPluginMap,
|
|
181
|
-
|
|
182
|
-
logSummary,
|
|
183
|
-
logMemoryHeapUsage,
|
|
184
|
-
completedExecutionLogMerging,
|
|
185
|
-
completedExecutionLogAbbreviation,
|
|
186
|
-
|
|
187
|
-
defaultMsAllocatedPerExecution,
|
|
188
|
-
maxExecutionsInParallel,
|
|
189
|
-
stopAfterExecute,
|
|
190
|
-
gcBetweenExecutions,
|
|
191
|
-
cooldownBetweenExecutions,
|
|
192
|
-
|
|
193
|
-
coverage,
|
|
194
|
-
coverageConfig,
|
|
195
|
-
coverageIncludeMissing,
|
|
196
|
-
coverageForceIstanbul,
|
|
197
|
-
coverageV8ConflictWarning,
|
|
198
|
-
coverageTempDirectoryRelativeUrl,
|
|
199
|
-
runtimeSupport,
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
aborted: multipleExecutionsOperation.signal.aborted,
|
|
204
|
-
planSummary: result.summary,
|
|
205
|
-
planReport: result.report,
|
|
206
|
-
planCoverage: result.coverage,
|
|
207
|
-
}
|
|
208
|
-
} finally {
|
|
209
|
-
await multipleExecutionsOperation.end()
|
|
210
|
-
}
|
|
211
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { collectFiles } from "@jsenv/filesystem"
|
|
2
|
-
|
|
3
|
-
import { generateFileExecutionSteps } from "./generateFileExecutionSteps.js"
|
|
4
|
-
|
|
5
|
-
export const generateExecutionSteps = async (
|
|
6
|
-
plan,
|
|
7
|
-
{ signal, projectDirectoryUrl },
|
|
8
|
-
) => {
|
|
9
|
-
const structuredMetaMap = {
|
|
10
|
-
filePlan: plan,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const fileResultArray = await collectFiles({
|
|
14
|
-
signal,
|
|
15
|
-
directoryUrl: projectDirectoryUrl,
|
|
16
|
-
structuredMetaMap,
|
|
17
|
-
predicate: ({ filePlan }) => filePlan,
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const executionSteps = []
|
|
21
|
-
fileResultArray.forEach(({ relativeUrl, meta }) => {
|
|
22
|
-
const fileExecutionSteps = generateFileExecutionSteps({
|
|
23
|
-
fileRelativeUrl: relativeUrl,
|
|
24
|
-
filePlan: meta.filePlan,
|
|
25
|
-
})
|
|
26
|
-
executionSteps.push(...fileExecutionSteps)
|
|
27
|
-
})
|
|
28
|
-
return executionSteps
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* global __filename */
|
|
2
|
-
|
|
3
|
-
import { fileSystemPathToUrl, resolveUrl } from "@jsenv/filesystem"
|
|
4
|
-
|
|
5
|
-
let jsenvCoreDirectoryUrl
|
|
6
|
-
if (typeof __filename === "string") {
|
|
7
|
-
jsenvCoreDirectoryUrl = resolveUrl(
|
|
8
|
-
// get ride of dist/commonjs/main.js
|
|
9
|
-
"../../",
|
|
10
|
-
fileSystemPathToUrl(__filename),
|
|
11
|
-
)
|
|
12
|
-
} else {
|
|
13
|
-
jsenvCoreDirectoryUrl = resolveUrl(
|
|
14
|
-
// get ride of src/internal/jsenvCoreDirectoryUrl.js
|
|
15
|
-
"../../",
|
|
16
|
-
import.meta.url,
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const jsenvDistDirectoryUrl = new URL("./dist/", jsenvCoreDirectoryUrl)
|
|
21
|
-
|
|
22
|
-
export { jsenvCoreDirectoryUrl }
|