@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
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
import { existsSync } from "node:fs"
|
|
2
|
+
import { memoryUsage } from "node:process"
|
|
3
|
+
import wrapAnsi from "wrap-ansi"
|
|
4
|
+
import stripAnsi from "strip-ansi"
|
|
5
|
+
import cuid from "cuid"
|
|
6
|
+
import { createDetailedMessage, loggerToLevels } from "@jsenv/logger"
|
|
7
|
+
import { createLog, startSpinner } from "@jsenv/log"
|
|
8
|
+
import {
|
|
9
|
+
Abort,
|
|
10
|
+
raceProcessTeardownEvents,
|
|
11
|
+
createCallbackListNotifiedOnce,
|
|
12
|
+
} from "@jsenv/abort"
|
|
13
|
+
import {
|
|
14
|
+
urlToFileSystemPath,
|
|
15
|
+
resolveUrl,
|
|
16
|
+
writeDirectory,
|
|
17
|
+
ensureEmptyDirectory,
|
|
18
|
+
normalizeStructuredMetaMap,
|
|
19
|
+
urlToMeta,
|
|
20
|
+
writeFile,
|
|
21
|
+
} from "@jsenv/filesystem"
|
|
22
|
+
|
|
23
|
+
import { startCompileServer } from "@jsenv/core/src/internal/compile_server/compile_server.js"
|
|
24
|
+
import { babelPluginInstrument } from "@jsenv/core/src/internal/coverage/babel_plugin_instrument.js"
|
|
25
|
+
import { reportToCoverage } from "@jsenv/core/src/internal/coverage/report_to_coverage.js"
|
|
26
|
+
|
|
27
|
+
import { ensureGlobalGc } from "./gc.js"
|
|
28
|
+
import { launchAndExecute } from "./launch_and_execute.js"
|
|
29
|
+
import { generateExecutionSteps } from "./execution_steps.js"
|
|
30
|
+
import {
|
|
31
|
+
formatExecuting,
|
|
32
|
+
formatExecutionResult,
|
|
33
|
+
} from "./logs_file_execution.js"
|
|
34
|
+
import { createSummaryLog } from "./logs_plan_summary.js"
|
|
35
|
+
|
|
36
|
+
export const executePlan = async (
|
|
37
|
+
plan,
|
|
38
|
+
{
|
|
39
|
+
signal,
|
|
40
|
+
handleSIGINT,
|
|
41
|
+
|
|
42
|
+
logger,
|
|
43
|
+
compileServerLogLevel,
|
|
44
|
+
launchAndExecuteLogLevel,
|
|
45
|
+
|
|
46
|
+
projectDirectoryUrl,
|
|
47
|
+
jsenvDirectoryRelativeUrl,
|
|
48
|
+
jsenvDirectoryClean,
|
|
49
|
+
|
|
50
|
+
importResolutionMethod,
|
|
51
|
+
importDefaultExtension,
|
|
52
|
+
|
|
53
|
+
logSummary,
|
|
54
|
+
logMemoryHeapUsage,
|
|
55
|
+
logFileRelativeUrl,
|
|
56
|
+
completedExecutionLogMerging,
|
|
57
|
+
completedExecutionLogAbbreviation,
|
|
58
|
+
|
|
59
|
+
defaultMsAllocatedPerExecution,
|
|
60
|
+
maxExecutionsInParallel,
|
|
61
|
+
failFast,
|
|
62
|
+
gcBetweenExecutions,
|
|
63
|
+
stopAfterExecute,
|
|
64
|
+
cooldownBetweenExecutions,
|
|
65
|
+
|
|
66
|
+
coverage,
|
|
67
|
+
coverageConfig,
|
|
68
|
+
coverageIncludeMissing,
|
|
69
|
+
coverageForceIstanbul,
|
|
70
|
+
coverageV8ConflictWarning,
|
|
71
|
+
coverageTempDirectoryRelativeUrl,
|
|
72
|
+
|
|
73
|
+
protocol,
|
|
74
|
+
privateKey,
|
|
75
|
+
certificate,
|
|
76
|
+
ip,
|
|
77
|
+
port,
|
|
78
|
+
compileServerCanReadFromFilesystem,
|
|
79
|
+
compileServerCanWriteOnFilesystem,
|
|
80
|
+
babelPluginMap,
|
|
81
|
+
babelConfigFileUrl,
|
|
82
|
+
preservedUrls,
|
|
83
|
+
workers,
|
|
84
|
+
serviceWorkers,
|
|
85
|
+
importMapInWebWorkers,
|
|
86
|
+
customCompilers,
|
|
87
|
+
|
|
88
|
+
beforeExecutionCallback = () => {},
|
|
89
|
+
afterExecutionCallback = () => {},
|
|
90
|
+
} = {},
|
|
91
|
+
) => {
|
|
92
|
+
if (coverage) {
|
|
93
|
+
babelPluginMap = {
|
|
94
|
+
...babelPluginMap,
|
|
95
|
+
"transform-instrument": [
|
|
96
|
+
babelPluginInstrument,
|
|
97
|
+
{ projectDirectoryUrl, coverageConfig },
|
|
98
|
+
],
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const runtimes = {}
|
|
102
|
+
Object.keys(plan).forEach((filePattern) => {
|
|
103
|
+
const filePlan = plan[filePattern]
|
|
104
|
+
Object.keys(filePlan).forEach((executionName) => {
|
|
105
|
+
const executionConfig = filePlan[executionName]
|
|
106
|
+
const { runtime } = executionConfig
|
|
107
|
+
if (runtime) {
|
|
108
|
+
runtimes[runtime.name] = runtime.version
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
logger.debug(
|
|
113
|
+
createDetailedMessage(`Prepare executing plan`, {
|
|
114
|
+
runtimes: JSON.stringify(runtimes, null, " "),
|
|
115
|
+
}),
|
|
116
|
+
)
|
|
117
|
+
const multipleExecutionsOperation = Abort.startOperation()
|
|
118
|
+
multipleExecutionsOperation.addAbortSignal(signal)
|
|
119
|
+
if (handleSIGINT) {
|
|
120
|
+
multipleExecutionsOperation.addAbortSource((abort) => {
|
|
121
|
+
return raceProcessTeardownEvents(
|
|
122
|
+
{
|
|
123
|
+
SIGINT: true,
|
|
124
|
+
},
|
|
125
|
+
() => {
|
|
126
|
+
logger.debug(`SIGINT abort`)
|
|
127
|
+
abort()
|
|
128
|
+
},
|
|
129
|
+
)
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
const failFastAbortController = new AbortController()
|
|
133
|
+
if (failFast) {
|
|
134
|
+
multipleExecutionsOperation.addAbortSignal(failFastAbortController.signal)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
const compileServer = await startCompileServer({
|
|
139
|
+
signal: multipleExecutionsOperation.signal,
|
|
140
|
+
logLevel: compileServerLogLevel,
|
|
141
|
+
|
|
142
|
+
projectDirectoryUrl,
|
|
143
|
+
jsenvDirectoryRelativeUrl,
|
|
144
|
+
jsenvDirectoryClean,
|
|
145
|
+
|
|
146
|
+
importResolutionMethod,
|
|
147
|
+
importDefaultExtension,
|
|
148
|
+
|
|
149
|
+
protocol,
|
|
150
|
+
privateKey,
|
|
151
|
+
certificate,
|
|
152
|
+
ip,
|
|
153
|
+
port,
|
|
154
|
+
compileServerCanReadFromFilesystem,
|
|
155
|
+
compileServerCanWriteOnFilesystem,
|
|
156
|
+
keepProcessAlive: true, // to be sure it stays alive
|
|
157
|
+
babelPluginMap,
|
|
158
|
+
babelConfigFileUrl,
|
|
159
|
+
preservedUrls,
|
|
160
|
+
workers,
|
|
161
|
+
serviceWorkers,
|
|
162
|
+
importMapInWebWorkers,
|
|
163
|
+
customCompilers,
|
|
164
|
+
})
|
|
165
|
+
babelPluginMap = compileServer.babelPluginMap
|
|
166
|
+
multipleExecutionsOperation.addEndCallback(async () => {
|
|
167
|
+
await compileServer.stop()
|
|
168
|
+
})
|
|
169
|
+
logger.debug(`Generate executions`)
|
|
170
|
+
const executionSteps = await getExecutionAsSteps({
|
|
171
|
+
plan,
|
|
172
|
+
compileServer,
|
|
173
|
+
multipleExecutionsOperation,
|
|
174
|
+
projectDirectoryUrl,
|
|
175
|
+
})
|
|
176
|
+
logger.debug(`${executionSteps.length} executions planned`)
|
|
177
|
+
|
|
178
|
+
if (completedExecutionLogMerging && !process.stdout.isTTY) {
|
|
179
|
+
completedExecutionLogMerging = false
|
|
180
|
+
logger.debug(
|
|
181
|
+
`Force completedExecutionLogMerging to false because process.stdout.isTTY is false`,
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
const executionLogsEnabled = loggerToLevels(logger).info
|
|
185
|
+
const executionSpinner = executionLogsEnabled && process.stdout.isTTY
|
|
186
|
+
|
|
187
|
+
const startMs = Date.now()
|
|
188
|
+
const report = {}
|
|
189
|
+
const executionCount = executionSteps.length
|
|
190
|
+
let rawOutput = ""
|
|
191
|
+
|
|
192
|
+
let transformReturnValue = (value) => value
|
|
193
|
+
|
|
194
|
+
if (gcBetweenExecutions) {
|
|
195
|
+
ensureGlobalGc()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const coverageTempDirectoryUrl = resolveUrl(
|
|
199
|
+
coverageTempDirectoryRelativeUrl,
|
|
200
|
+
projectDirectoryUrl,
|
|
201
|
+
)
|
|
202
|
+
const structuredMetaMapForCover = normalizeStructuredMetaMap(
|
|
203
|
+
{
|
|
204
|
+
cover: coverageConfig,
|
|
205
|
+
},
|
|
206
|
+
projectDirectoryUrl,
|
|
207
|
+
)
|
|
208
|
+
const coverageIgnorePredicate = (url) => {
|
|
209
|
+
return !urlToMeta({
|
|
210
|
+
url: resolveUrl(url, projectDirectoryUrl),
|
|
211
|
+
structuredMetaMap: structuredMetaMapForCover,
|
|
212
|
+
}).cover
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (coverage) {
|
|
216
|
+
// in case runned multiple times, we don't want to keep writing lot of files in this directory
|
|
217
|
+
if (!process.env.NODE_V8_COVERAGE) {
|
|
218
|
+
await ensureEmptyDirectory(coverageTempDirectoryUrl)
|
|
219
|
+
}
|
|
220
|
+
if (runtimes.node) {
|
|
221
|
+
// v8 coverage is written in a directoy and auto propagate to subprocesses
|
|
222
|
+
// through process.env.NODE_V8_COVERAGE.
|
|
223
|
+
if (!coverageForceIstanbul && !process.env.NODE_V8_COVERAGE) {
|
|
224
|
+
const v8CoverageDirectory = resolveUrl(
|
|
225
|
+
`./node_v8/${cuid()}`,
|
|
226
|
+
coverageTempDirectoryUrl,
|
|
227
|
+
)
|
|
228
|
+
await writeDirectory(v8CoverageDirectory, { allowUseless: true })
|
|
229
|
+
process.env.NODE_V8_COVERAGE =
|
|
230
|
+
urlToFileSystemPath(v8CoverageDirectory)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
transformReturnValue = async (value) => {
|
|
235
|
+
if (multipleExecutionsOperation.signal.aborted) {
|
|
236
|
+
// don't try to do the coverage stuff
|
|
237
|
+
return value
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
value.coverage = await reportToCoverage(value.report, {
|
|
242
|
+
signal: multipleExecutionsOperation.signal,
|
|
243
|
+
logger,
|
|
244
|
+
projectDirectoryUrl,
|
|
245
|
+
babelPluginMap,
|
|
246
|
+
coverageConfig,
|
|
247
|
+
coverageIncludeMissing,
|
|
248
|
+
coverageForceIstanbul,
|
|
249
|
+
coverageIgnorePredicate,
|
|
250
|
+
coverageV8ConflictWarning,
|
|
251
|
+
})
|
|
252
|
+
} catch (e) {
|
|
253
|
+
if (Abort.isAbortError(e)) {
|
|
254
|
+
return value
|
|
255
|
+
}
|
|
256
|
+
throw e
|
|
257
|
+
}
|
|
258
|
+
return value
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
logger.info("")
|
|
263
|
+
let executionLog = createLog({ newLine: "" })
|
|
264
|
+
let abortedCount = 0
|
|
265
|
+
let timedoutCount = 0
|
|
266
|
+
let erroredCount = 0
|
|
267
|
+
let completedCount = 0
|
|
268
|
+
const stopAfterAllExecutionCallbackList = createCallbackListNotifiedOnce()
|
|
269
|
+
|
|
270
|
+
let executionDoneCount = 0
|
|
271
|
+
await executeInParallel({
|
|
272
|
+
multipleExecutionsOperation,
|
|
273
|
+
maxExecutionsInParallel,
|
|
274
|
+
cooldownBetweenExecutions,
|
|
275
|
+
executionSteps,
|
|
276
|
+
start: async (paramsFromStep) => {
|
|
277
|
+
const executionIndex = executionSteps.indexOf(paramsFromStep)
|
|
278
|
+
const { executionName, fileRelativeUrl, runtime } = paramsFromStep
|
|
279
|
+
const runtimeName = runtime.name
|
|
280
|
+
const runtimeVersion = runtime.version
|
|
281
|
+
|
|
282
|
+
const executionParams = {
|
|
283
|
+
// the params below can be overriden by executionDefaultParams
|
|
284
|
+
measurePerformance: false,
|
|
285
|
+
collectPerformance: false,
|
|
286
|
+
captureConsole: true,
|
|
287
|
+
stopAfterExecute,
|
|
288
|
+
stopAfterExecuteReason: "execution-done",
|
|
289
|
+
allocatedMs: defaultMsAllocatedPerExecution,
|
|
290
|
+
...paramsFromStep,
|
|
291
|
+
runtime,
|
|
292
|
+
// mirrorConsole: false because file will be executed in parallel
|
|
293
|
+
// so log would be a mess to read
|
|
294
|
+
mirrorConsole: false,
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const beforeExecutionInfo = {
|
|
298
|
+
fileRelativeUrl,
|
|
299
|
+
runtimeName,
|
|
300
|
+
runtimeVersion,
|
|
301
|
+
executionIndex,
|
|
302
|
+
executionParams,
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let spinner
|
|
306
|
+
if (executionSpinner) {
|
|
307
|
+
spinner = startSpinner({
|
|
308
|
+
log: executionLog,
|
|
309
|
+
text: formatExecuting(beforeExecutionInfo, {
|
|
310
|
+
executionCount,
|
|
311
|
+
abortedCount,
|
|
312
|
+
timedoutCount,
|
|
313
|
+
erroredCount,
|
|
314
|
+
completedCount,
|
|
315
|
+
...(logMemoryHeapUsage
|
|
316
|
+
? { memoryHeap: memoryUsage().heapUsed }
|
|
317
|
+
: {}),
|
|
318
|
+
}),
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
beforeExecutionCallback(beforeExecutionInfo)
|
|
322
|
+
|
|
323
|
+
const filePath = urlToFileSystemPath(
|
|
324
|
+
`${projectDirectoryUrl}${fileRelativeUrl}`,
|
|
325
|
+
)
|
|
326
|
+
let executionResult
|
|
327
|
+
if (existsSync(filePath)) {
|
|
328
|
+
executionResult = await launchAndExecute({
|
|
329
|
+
signal: multipleExecutionsOperation.signal,
|
|
330
|
+
launchAndExecuteLogLevel,
|
|
331
|
+
|
|
332
|
+
...executionParams,
|
|
333
|
+
collectCoverage: coverage,
|
|
334
|
+
coverageTempDirectoryUrl,
|
|
335
|
+
runtimeParams: {
|
|
336
|
+
projectDirectoryUrl,
|
|
337
|
+
compileServerOrigin: compileServer.origin,
|
|
338
|
+
compileServerId: compileServer.id,
|
|
339
|
+
jsenvDirectoryRelativeUrl:
|
|
340
|
+
compileServer.jsenvDirectoryRelativeUrl,
|
|
341
|
+
|
|
342
|
+
collectCoverage: coverage,
|
|
343
|
+
coverageIgnorePredicate,
|
|
344
|
+
coverageForceIstanbul,
|
|
345
|
+
stopAfterAllExecutionCallbackList,
|
|
346
|
+
...executionParams.runtimeParams,
|
|
347
|
+
},
|
|
348
|
+
executeParams: {
|
|
349
|
+
fileRelativeUrl,
|
|
350
|
+
...executionParams.executeParams,
|
|
351
|
+
},
|
|
352
|
+
coverageV8ConflictWarning,
|
|
353
|
+
})
|
|
354
|
+
} else {
|
|
355
|
+
executionResult = {
|
|
356
|
+
status: "errored",
|
|
357
|
+
error: new Error(
|
|
358
|
+
`No file at ${fileRelativeUrl} for execution "${executionName}"`,
|
|
359
|
+
),
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
executionDoneCount++
|
|
363
|
+
if (fileRelativeUrl in report === false) {
|
|
364
|
+
report[fileRelativeUrl] = {}
|
|
365
|
+
}
|
|
366
|
+
report[fileRelativeUrl][executionName] = executionResult
|
|
367
|
+
const afterExecutionInfo = {
|
|
368
|
+
...beforeExecutionInfo,
|
|
369
|
+
endMs: Date.now(),
|
|
370
|
+
executionResult,
|
|
371
|
+
}
|
|
372
|
+
afterExecutionCallback(afterExecutionInfo)
|
|
373
|
+
|
|
374
|
+
if (executionResult.status === "aborted") {
|
|
375
|
+
abortedCount++
|
|
376
|
+
} else if (executionResult.status === "timedout") {
|
|
377
|
+
timedoutCount++
|
|
378
|
+
} else if (executionResult.status === "errored") {
|
|
379
|
+
erroredCount++
|
|
380
|
+
} else if (executionResult.status === "completed") {
|
|
381
|
+
completedCount++
|
|
382
|
+
}
|
|
383
|
+
if (gcBetweenExecutions) {
|
|
384
|
+
global.gc()
|
|
385
|
+
}
|
|
386
|
+
if (executionLogsEnabled) {
|
|
387
|
+
let log = formatExecutionResult(afterExecutionInfo, {
|
|
388
|
+
completedExecutionLogAbbreviation,
|
|
389
|
+
executionCount,
|
|
390
|
+
abortedCount,
|
|
391
|
+
timedoutCount,
|
|
392
|
+
erroredCount,
|
|
393
|
+
completedCount,
|
|
394
|
+
...(logMemoryHeapUsage
|
|
395
|
+
? { memoryHeap: memoryUsage().heapUsed }
|
|
396
|
+
: {}),
|
|
397
|
+
})
|
|
398
|
+
log = `${log}
|
|
399
|
+
|
|
400
|
+
`
|
|
401
|
+
const { columns = 80 } = process.stdout
|
|
402
|
+
log = wrapAnsi(log, columns, {
|
|
403
|
+
trim: false,
|
|
404
|
+
hard: true,
|
|
405
|
+
wordWrap: false,
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
// replace spinner with this execution result
|
|
409
|
+
if (spinner) spinner.stop()
|
|
410
|
+
executionLog.write(log)
|
|
411
|
+
rawOutput += stripAnsi(log)
|
|
412
|
+
|
|
413
|
+
const canOverwriteLog = canOverwriteLogGetter({
|
|
414
|
+
completedExecutionLogMerging,
|
|
415
|
+
executionResult,
|
|
416
|
+
})
|
|
417
|
+
if (canOverwriteLog) {
|
|
418
|
+
// nothing to do, we reuse the current executionLog object
|
|
419
|
+
} else {
|
|
420
|
+
executionLog.destroy()
|
|
421
|
+
executionLog = createLog({ newLine: "" })
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (
|
|
425
|
+
failFast &&
|
|
426
|
+
executionResult.status !== "completed" &&
|
|
427
|
+
executionDoneCount < executionCount
|
|
428
|
+
) {
|
|
429
|
+
logger.info(`"failFast" enabled -> cancel remaining executions`)
|
|
430
|
+
failFastAbortController.abort()
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
if (stopAfterExecute) {
|
|
436
|
+
stopAfterAllExecutionCallbackList.notify()
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const summaryCounts = reportToSummary(report)
|
|
440
|
+
const summary = {
|
|
441
|
+
executionCount,
|
|
442
|
+
...summaryCounts,
|
|
443
|
+
// when execution is aborted, the remaining executions are "cancelled"
|
|
444
|
+
cancelledCount: executionCount - executionDoneCount,
|
|
445
|
+
duration: Date.now() - startMs,
|
|
446
|
+
}
|
|
447
|
+
if (logSummary) {
|
|
448
|
+
const summaryLog = createSummaryLog(summary)
|
|
449
|
+
rawOutput += stripAnsi(summaryLog)
|
|
450
|
+
logger.info(summaryLog)
|
|
451
|
+
}
|
|
452
|
+
if (summary.executionCount !== summary.completedCount) {
|
|
453
|
+
const logFileUrl = new URL(logFileRelativeUrl, projectDirectoryUrl)
|
|
454
|
+
writeFile(logFileUrl, rawOutput)
|
|
455
|
+
logger.info(`-> ${urlToFileSystemPath(logFileUrl)}`)
|
|
456
|
+
}
|
|
457
|
+
const result = await transformReturnValue({
|
|
458
|
+
summary,
|
|
459
|
+
report,
|
|
460
|
+
})
|
|
461
|
+
return {
|
|
462
|
+
aborted: multipleExecutionsOperation.signal.aborted,
|
|
463
|
+
planSummary: result.summary,
|
|
464
|
+
planReport: result.report,
|
|
465
|
+
planCoverage: result.coverage,
|
|
466
|
+
}
|
|
467
|
+
} finally {
|
|
468
|
+
await multipleExecutionsOperation.end()
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const getExecutionAsSteps = async ({
|
|
473
|
+
plan,
|
|
474
|
+
compileServer,
|
|
475
|
+
multipleExecutionsOperation,
|
|
476
|
+
projectDirectoryUrl,
|
|
477
|
+
}) => {
|
|
478
|
+
try {
|
|
479
|
+
const executionSteps = await generateExecutionSteps(
|
|
480
|
+
{
|
|
481
|
+
...plan,
|
|
482
|
+
[compileServer.jsenvDirectoryRelativeUrl]: null,
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
signal: multipleExecutionsOperation.signal,
|
|
486
|
+
projectDirectoryUrl,
|
|
487
|
+
},
|
|
488
|
+
)
|
|
489
|
+
return executionSteps
|
|
490
|
+
} catch (e) {
|
|
491
|
+
if (Abort.isAbortError(e)) {
|
|
492
|
+
return {
|
|
493
|
+
aborted: true,
|
|
494
|
+
planSummary: {},
|
|
495
|
+
planReport: {},
|
|
496
|
+
planCoverage: null,
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
throw e
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const canOverwriteLogGetter = ({
|
|
504
|
+
completedExecutionLogMerging,
|
|
505
|
+
executionResult,
|
|
506
|
+
}) => {
|
|
507
|
+
if (!completedExecutionLogMerging) {
|
|
508
|
+
return false
|
|
509
|
+
}
|
|
510
|
+
if (executionResult.status === "aborted") {
|
|
511
|
+
return true
|
|
512
|
+
}
|
|
513
|
+
if (executionResult.status !== "completed") {
|
|
514
|
+
return false
|
|
515
|
+
}
|
|
516
|
+
const { consoleCalls = [] } = executionResult
|
|
517
|
+
if (consoleCalls.length > 0) {
|
|
518
|
+
return false
|
|
519
|
+
}
|
|
520
|
+
return true
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const executeInParallel = async ({
|
|
524
|
+
multipleExecutionsOperation,
|
|
525
|
+
maxExecutionsInParallel,
|
|
526
|
+
cooldownBetweenExecutions,
|
|
527
|
+
executionSteps,
|
|
528
|
+
start,
|
|
529
|
+
}) => {
|
|
530
|
+
const executionResults = []
|
|
531
|
+
let progressionIndex = 0
|
|
532
|
+
let remainingExecutionCount = executionSteps.length
|
|
533
|
+
|
|
534
|
+
const nextChunk = async () => {
|
|
535
|
+
if (multipleExecutionsOperation.signal.aborted) {
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
const outputPromiseArray = []
|
|
539
|
+
while (
|
|
540
|
+
remainingExecutionCount > 0 &&
|
|
541
|
+
outputPromiseArray.length < maxExecutionsInParallel
|
|
542
|
+
) {
|
|
543
|
+
remainingExecutionCount--
|
|
544
|
+
const outputPromise = executeOne(progressionIndex)
|
|
545
|
+
progressionIndex++
|
|
546
|
+
outputPromiseArray.push(outputPromise)
|
|
547
|
+
}
|
|
548
|
+
if (outputPromiseArray.length) {
|
|
549
|
+
await Promise.all(outputPromiseArray)
|
|
550
|
+
if (remainingExecutionCount > 0) {
|
|
551
|
+
await nextChunk()
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const executeOne = async (index) => {
|
|
557
|
+
const input = executionSteps[index]
|
|
558
|
+
const output = await start(input)
|
|
559
|
+
if (!multipleExecutionsOperation.signal.aborted) {
|
|
560
|
+
executionResults[index] = output
|
|
561
|
+
}
|
|
562
|
+
if (cooldownBetweenExecutions) {
|
|
563
|
+
await new Promise((resolve) =>
|
|
564
|
+
setTimeout(resolve, cooldownBetweenExecutions),
|
|
565
|
+
)
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
await nextChunk()
|
|
570
|
+
|
|
571
|
+
return executionResults
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const reportToSummary = (report) => {
|
|
575
|
+
const fileNames = Object.keys(report)
|
|
576
|
+
const countResultMatching = (predicate) => {
|
|
577
|
+
return fileNames.reduce((previous, fileName) => {
|
|
578
|
+
const fileExecutionResult = report[fileName]
|
|
579
|
+
|
|
580
|
+
return (
|
|
581
|
+
previous +
|
|
582
|
+
Object.keys(fileExecutionResult).filter((executionName) => {
|
|
583
|
+
const fileExecutionResultForRuntime =
|
|
584
|
+
fileExecutionResult[executionName]
|
|
585
|
+
return predicate(fileExecutionResultForRuntime)
|
|
586
|
+
}).length
|
|
587
|
+
)
|
|
588
|
+
}, 0)
|
|
589
|
+
}
|
|
590
|
+
const abortedCount = countResultMatching(({ status }) => status === "aborted")
|
|
591
|
+
const timedoutCount = countResultMatching(
|
|
592
|
+
({ status }) => status === "timedout",
|
|
593
|
+
)
|
|
594
|
+
const erroredCount = countResultMatching(({ status }) => status === "errored")
|
|
595
|
+
const completedCount = countResultMatching(
|
|
596
|
+
({ status }) => status === "completed",
|
|
597
|
+
)
|
|
598
|
+
return {
|
|
599
|
+
abortedCount,
|
|
600
|
+
timedoutCount,
|
|
601
|
+
erroredCount,
|
|
602
|
+
completedCount,
|
|
603
|
+
}
|
|
604
|
+
}
|
|
@@ -1,5 +1,32 @@
|
|
|
1
|
+
import { collectFiles } from "@jsenv/filesystem"
|
|
1
2
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
2
3
|
|
|
4
|
+
export const generateExecutionSteps = async (
|
|
5
|
+
plan,
|
|
6
|
+
{ signal, projectDirectoryUrl },
|
|
7
|
+
) => {
|
|
8
|
+
const structuredMetaMap = {
|
|
9
|
+
filePlan: plan,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const fileResultArray = await collectFiles({
|
|
13
|
+
signal,
|
|
14
|
+
directoryUrl: projectDirectoryUrl,
|
|
15
|
+
structuredMetaMap,
|
|
16
|
+
predicate: ({ filePlan }) => filePlan,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const executionSteps = []
|
|
20
|
+
fileResultArray.forEach(({ relativeUrl, meta }) => {
|
|
21
|
+
const fileExecutionSteps = generateFileExecutionSteps({
|
|
22
|
+
fileRelativeUrl: relativeUrl,
|
|
23
|
+
filePlan: meta.filePlan,
|
|
24
|
+
})
|
|
25
|
+
executionSteps.push(...fileExecutionSteps)
|
|
26
|
+
})
|
|
27
|
+
return executionSteps
|
|
28
|
+
}
|
|
29
|
+
|
|
3
30
|
export const generateFileExecutionSteps = ({ fileRelativeUrl, filePlan }) => {
|
|
4
31
|
const fileExecutionSteps = []
|
|
5
32
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import cuid from "cuid"
|
|
2
|
+
import { resolveUrl, writeFile } from "@jsenv/filesystem"
|
|
2
3
|
import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
3
4
|
import { Abort, raceCallbacks } from "@jsenv/abort"
|
|
4
|
-
import { resolveUrl, writeFile } from "@jsenv/filesystem"
|
|
5
5
|
|
|
6
|
-
import { composeTwoFileByFileIstanbulCoverages } from "
|
|
6
|
+
import { composeTwoFileByFileIstanbulCoverages } from "@jsenv/core/src/internal/coverage/istanbul_coverage_composition.js"
|
|
7
7
|
|
|
8
8
|
export const launchAndExecute = async ({
|
|
9
9
|
signal = new AbortController().signal,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ANSI, UNICODE } from "@jsenv/log"
|
|
2
2
|
|
|
3
|
-
import { msAsDuration } from "
|
|
3
|
+
import { msAsDuration } from "@jsenv/core/src/internal/logs/ms_as_duration.js"
|
|
4
|
+
|
|
4
5
|
import { EXECUTION_COLORS } from "./execution_colors.js"
|
|
5
|
-
import { createIntermediateSummary } from "./
|
|
6
|
+
import { createIntermediateSummary } from "./logs_plan_summary.js"
|
|
6
7
|
|
|
7
8
|
export const formatExecuting = (
|
|
8
9
|
{ executionIndex },
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ANSI } from "@jsenv/log"
|
|
2
2
|
|
|
3
|
-
import { msAsDuration } from "
|
|
4
|
-
import { formatByte } from "
|
|
3
|
+
import { msAsDuration } from "@jsenv/core/src/internal/logs/ms_as_duration.js"
|
|
4
|
+
import { formatByte } from "@jsenv/core/src/internal/logs/byte.js"
|
|
5
|
+
|
|
5
6
|
import { EXECUTION_COLORS } from "./execution_colors.js"
|
|
6
7
|
|
|
7
8
|
export const createSummaryLog = (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchJson } from "../../browser_utils/
|
|
1
|
+
import { fetchJson } from "../../browser_utils/fetch_json.js"
|
|
2
2
|
import { detectBrowser } from "../../browser_detection/browser_detection.js"
|
|
3
3
|
|
|
4
4
|
import { supportsImportmap } from "./browser_feature_detect_importmap.js"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchSource } from "@jsenv/core/src/internal/
|
|
1
|
+
import { fetchSource } from "@jsenv/core/src/internal/node_launcher/fetch_source.js"
|
|
2
2
|
|
|
3
3
|
import { nodeSupportsDynamicImport } from "./node_feature_detect_dynamic_import.js"
|
|
4
4
|
import { nodeSupportsTopLevelAwait } from "./node_feature_detect_top_level_await.js"
|
|
File without changes
|
|
File without changes
|