@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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from "node:path"
|
|
2
2
|
import MagicString from "magic-string"
|
|
3
3
|
import { composeTwoImportMaps, normalizeImportMap } from "@jsenv/importmap"
|
|
4
4
|
import { isSpecifierForNodeCoreModule } from "@jsenv/importmap/src/isSpecifierForNodeCoreModule.js"
|
|
@@ -15,25 +15,28 @@ import {
|
|
|
15
15
|
urlToBasename,
|
|
16
16
|
urlToFilename,
|
|
17
17
|
readFile,
|
|
18
|
+
urlToFileSystemPath,
|
|
18
19
|
} from "@jsenv/filesystem"
|
|
19
20
|
import { UNICODE } from "@jsenv/log"
|
|
20
21
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { transformJs } from "@jsenv/core/src/internal/
|
|
22
|
+
import { jsenvHelpersDirectoryInfo } from "@jsenv/core/src/jsenv_file_urls.js"
|
|
23
|
+
import { require } from "@jsenv/core/src/internal/require.js"
|
|
24
|
+
import { transformJs } from "@jsenv/core/src/internal/compile_server/js/js_transformer.js"
|
|
24
25
|
import { createUrlConverter } from "@jsenv/core/src/internal/url_conversion.js"
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { sortObjectByPathnames } from "@jsenv/core/src/internal/building/sortObjectByPathnames.js"
|
|
29
|
-
import { jsenvHelpersDirectoryInfo } from "@jsenv/core/src/internal/jsenvInternalFiles.js"
|
|
30
|
-
import { createImportResolverForNode } from "@jsenv/core/src/internal/import-resolution/import-resolver-node.js"
|
|
31
|
-
import { createImportResolverForImportmap } from "@jsenv/core/src/internal/import-resolution/import-resolver-importmap.js"
|
|
32
|
-
import { getDefaultImportmap } from "@jsenv/core/src/internal/import-resolution/importmap_default.js"
|
|
26
|
+
import { createImportResolverForNode } from "@jsenv/core/src/internal/import_resolution/import_resolver_node.js"
|
|
27
|
+
import { createImportResolverForImportmap } from "@jsenv/core/src/internal/import_resolution/import_resolver_importmap.js"
|
|
28
|
+
import { getDefaultImportmap } from "@jsenv/core/src/internal/import_resolution/importmap_default.js"
|
|
33
29
|
import { createJsenvRemoteDirectory } from "@jsenv/core/src/internal/jsenv_remote_directory.js"
|
|
34
30
|
import { setUrlSearchParamsDescriptor } from "@jsenv/core/src/internal/url_utils.js"
|
|
35
|
-
import { shakeBabelPluginMap } from "@jsenv/core/src/internal/
|
|
36
|
-
|
|
31
|
+
import { shakeBabelPluginMap } from "@jsenv/core/src/internal/compile_server/jsenv_directory/compile_profile.js"
|
|
32
|
+
|
|
33
|
+
import { convertJsonTextToJavascriptModule } from "./import_assertions/json_module.js"
|
|
34
|
+
import { convertCssTextToJavascriptModule } from "./import_assertions/css_module.js"
|
|
35
|
+
import { importMapsFromHtml } from "./html/html_scan.js"
|
|
36
|
+
import { esToSystem } from "./global_format/es_to_system.js"
|
|
37
|
+
import { createUrlFetcher } from "./url_fetcher.js"
|
|
38
|
+
import { createUrlLoader } from "./url_loader.js"
|
|
39
|
+
import { stringifyUrlTrace } from "./url_trace.js"
|
|
37
40
|
import {
|
|
38
41
|
formatBuildStartLog,
|
|
39
42
|
formatUseImportMapFromHtml,
|
|
@@ -41,14 +44,14 @@ import {
|
|
|
41
44
|
formatRessourceHintNeverUsedWarning,
|
|
42
45
|
formatBuildDoneInfo,
|
|
43
46
|
} from "./build_logs.js"
|
|
44
|
-
import {
|
|
45
|
-
import { parseRessource } from "./parseRessource.js"
|
|
47
|
+
import { parseRessource } from "./parse_ressource.js"
|
|
46
48
|
import {
|
|
47
49
|
createRessourceBuilder,
|
|
48
50
|
referenceToCodeForRollup,
|
|
49
51
|
} from "./ressource_builder.js"
|
|
50
52
|
import { createBuildUrlGenerator } from "./build_url_generator.js"
|
|
51
53
|
import { visitImportReferences } from "./import_references.js"
|
|
54
|
+
import { sortObjectByPathnames } from "./sort_pathnames.js"
|
|
52
55
|
import { createBuildStats } from "./build_stats.js"
|
|
53
56
|
|
|
54
57
|
export const createRollupPlugins = async ({
|
|
@@ -66,13 +69,12 @@ export const createRollupPlugins = async ({
|
|
|
66
69
|
externalImportSpecifiers,
|
|
67
70
|
importPaths,
|
|
68
71
|
preservedUrls,
|
|
69
|
-
workers,
|
|
70
|
-
serviceWorkers,
|
|
71
72
|
serviceWorkerFinalizer,
|
|
72
|
-
|
|
73
|
-
classicServiceWorkers,
|
|
73
|
+
|
|
74
74
|
format,
|
|
75
75
|
systemJsUrl,
|
|
76
|
+
globals,
|
|
77
|
+
preservedDynamicImports,
|
|
76
78
|
|
|
77
79
|
node,
|
|
78
80
|
compileServer,
|
|
@@ -127,12 +129,15 @@ export const createRollupPlugins = async ({
|
|
|
127
129
|
let buildStats = {}
|
|
128
130
|
const buildStartMs = Date.now()
|
|
129
131
|
|
|
132
|
+
const serviceWorkerUrls = []
|
|
133
|
+
const classicServiceWorkerUrls = []
|
|
134
|
+
|
|
130
135
|
let lastErrorMessage
|
|
131
136
|
const storeLatestJsenvPluginError = (error) => {
|
|
132
137
|
lastErrorMessage = error.message
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
const extension = extname(entryPoints[Object.keys(entryPoints)[0]])
|
|
140
|
+
const extension = path.extname(entryPoints[Object.keys(entryPoints)[0]])
|
|
136
141
|
const outputExtension = extension === ".html" ? ".js" : extension
|
|
137
142
|
|
|
138
143
|
const entryPointUrls = {}
|
|
@@ -140,19 +145,6 @@ export const createRollupPlugins = async ({
|
|
|
140
145
|
const url = resolveUrl(key, projectDirectoryUrl)
|
|
141
146
|
entryPointUrls[url] = entryPoints[key]
|
|
142
147
|
})
|
|
143
|
-
const workerUrls = workers.map((worker) =>
|
|
144
|
-
resolveUrl(worker, projectDirectoryUrl),
|
|
145
|
-
)
|
|
146
|
-
const serviceWorkerUrls = serviceWorkers.map((serviceWorker) =>
|
|
147
|
-
resolveUrl(serviceWorker, projectDirectoryUrl),
|
|
148
|
-
)
|
|
149
|
-
const classicWorkerUrls = classicWorkers.map((classicWorker) =>
|
|
150
|
-
resolveUrl(classicWorker, projectDirectoryUrl),
|
|
151
|
-
)
|
|
152
|
-
const classicServiceWorkerUrls = classicServiceWorkers.map(
|
|
153
|
-
(classicServiceWorker) =>
|
|
154
|
-
resolveUrl(classicServiceWorker, projectDirectoryUrl),
|
|
155
|
-
)
|
|
156
148
|
|
|
157
149
|
let ressourceBuilder
|
|
158
150
|
let importResolver
|
|
@@ -311,18 +303,136 @@ export const createRollupPlugins = async ({
|
|
|
311
303
|
},
|
|
312
304
|
})
|
|
313
305
|
}
|
|
306
|
+
if (format === "global") {
|
|
307
|
+
const globalsForRollup = {}
|
|
308
|
+
Object.keys(globals).forEach((key) => {
|
|
309
|
+
if (key.startsWith("./")) {
|
|
310
|
+
const keyAsUrl = resolveUrl(key, projectDirectoryUrl)
|
|
311
|
+
const keyAsPath = urlToFileSystemPath(keyAsUrl)
|
|
312
|
+
globalsForRollup[keyAsPath] = globals[key]
|
|
313
|
+
} else {
|
|
314
|
+
globalsForRollup[key] = globals[key]
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
const ESIIFE = require("es-iife")
|
|
318
|
+
const globalNameFromChunkInfo = (chunkInfo) => {
|
|
319
|
+
const originalUrl = asOriginalUrl(chunkInfo.facadeModuleId)
|
|
320
|
+
const originalPath = urlToFileSystemPath(originalUrl)
|
|
321
|
+
const nameFromGlobals = globalsForRollup[originalPath]
|
|
322
|
+
return nameFromGlobals || path.parse(chunkInfo.fileName).name
|
|
323
|
+
}
|
|
324
|
+
const structuredMetaMap = normalizeStructuredMetaMap(
|
|
325
|
+
{ preserved: preservedDynamicImports },
|
|
326
|
+
projectDirectoryUrl,
|
|
327
|
+
)
|
|
328
|
+
const isPreservedDynamicImport = (url) => {
|
|
329
|
+
const meta = urlToMeta({ url, structuredMetaMap })
|
|
330
|
+
return Boolean(meta.preserved)
|
|
331
|
+
}
|
|
332
|
+
rollupPlugins.push({
|
|
333
|
+
async transform(code, id) {
|
|
334
|
+
const serverUrl = asServerUrl(id)
|
|
335
|
+
const originalUrl = asOriginalUrl(id)
|
|
336
|
+
if (isPreservedDynamicImport(originalUrl)) {
|
|
337
|
+
return null
|
|
338
|
+
}
|
|
339
|
+
const jsRessource = ressourceBuilder.findRessource((ressource) => {
|
|
340
|
+
return ressource.url === serverUrl
|
|
341
|
+
})
|
|
342
|
+
if (!jsRessource || !jsRessource.isEntryPoint) {
|
|
343
|
+
return null
|
|
344
|
+
}
|
|
345
|
+
let map = null
|
|
346
|
+
const ast = this.parse(code, {
|
|
347
|
+
// used to know node line and column
|
|
348
|
+
locations: true,
|
|
349
|
+
})
|
|
350
|
+
let useDynamicImport = false
|
|
351
|
+
const { walk } = await import("estree-walker")
|
|
352
|
+
walk(ast, {
|
|
353
|
+
enter: (node) => {
|
|
354
|
+
if (node.type === "ImportExpression") {
|
|
355
|
+
useDynamicImport = true
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
})
|
|
359
|
+
if (!useDynamicImport) {
|
|
360
|
+
return null
|
|
361
|
+
}
|
|
362
|
+
const magicString = new MagicString(code)
|
|
363
|
+
magicString.prepend(
|
|
364
|
+
`import "@jsenv/core/src/internal/runtime_client/s.js";`,
|
|
365
|
+
)
|
|
366
|
+
code = magicString.toString()
|
|
367
|
+
map = magicString.generateMap({ hires: true })
|
|
368
|
+
return { code, map }
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
outputOptions: (outputOptions) => {
|
|
372
|
+
outputOptions.globals = globalsForRollup
|
|
373
|
+
outputOptions.format = "esm"
|
|
374
|
+
},
|
|
375
|
+
resolveImportMeta: (property, { chunkId }) => {
|
|
376
|
+
if (property === "url") {
|
|
377
|
+
return `(document.currentScript && document.currentScript.src || new URL("${chunkId}", document.baseURI).href);`
|
|
378
|
+
}
|
|
379
|
+
return undefined
|
|
380
|
+
},
|
|
381
|
+
renderDynamicImport: ({ moduleId }) => {
|
|
382
|
+
const originalUrl = asOriginalUrl(moduleId)
|
|
383
|
+
if (isPreservedDynamicImport(originalUrl)) {
|
|
384
|
+
return null
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
left: "System.import(",
|
|
388
|
+
right: ")",
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
async renderChunk(code, chunkInfo) {
|
|
392
|
+
const serverUrl = asServerUrl(chunkInfo.facadeModuleId)
|
|
393
|
+
const jsRessource = ressourceBuilder.findRessource(
|
|
394
|
+
(ressource) => ressource.url === serverUrl,
|
|
395
|
+
)
|
|
396
|
+
if (jsRessource.isEntryPoint) {
|
|
397
|
+
const name = globalNameFromChunkInfo(chunkInfo)
|
|
398
|
+
const out = ESIIFE.transform({
|
|
399
|
+
code,
|
|
400
|
+
parse: this.parse,
|
|
401
|
+
name,
|
|
402
|
+
sourcemap: true,
|
|
403
|
+
resolveGlobal: (specifier) => {
|
|
404
|
+
const url = resolveUrl(specifier, chunkInfo.facadeModuleId)
|
|
405
|
+
const globalName = urlToBasename(url)
|
|
406
|
+
return globalName
|
|
407
|
+
},
|
|
408
|
+
strict: true,
|
|
409
|
+
})
|
|
410
|
+
code = out.code
|
|
411
|
+
const map = out.map
|
|
412
|
+
return {
|
|
413
|
+
code,
|
|
414
|
+
map,
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return esToSystem({
|
|
418
|
+
code,
|
|
419
|
+
url: serverUrl,
|
|
420
|
+
map: chunkInfo.map,
|
|
421
|
+
})
|
|
422
|
+
},
|
|
423
|
+
})
|
|
424
|
+
}
|
|
314
425
|
if (minify) {
|
|
315
426
|
const methodHooks = {
|
|
316
427
|
minifyJs: async (...args) => {
|
|
317
|
-
const { minifyJs } = await import("./js/
|
|
428
|
+
const { minifyJs } = await import("./js/minify_js.js")
|
|
318
429
|
return minifyJs(...args)
|
|
319
430
|
},
|
|
320
431
|
minifyHtml: async (...args) => {
|
|
321
|
-
const { minifyHtml } = await import("./html/
|
|
432
|
+
const { minifyHtml } = await import("./html/minify_html.js")
|
|
322
433
|
return minifyHtml(...args)
|
|
323
434
|
},
|
|
324
435
|
}
|
|
325
|
-
|
|
326
436
|
minifyJs = async ({ url, code, map, ...rest }) => {
|
|
327
437
|
const result = await methodHooks.minifyJs({
|
|
328
438
|
url,
|
|
@@ -336,11 +446,9 @@ export const createRollupPlugins = async ({
|
|
|
336
446
|
map: result.map,
|
|
337
447
|
}
|
|
338
448
|
}
|
|
339
|
-
|
|
340
449
|
minifyHtml = async (html) => {
|
|
341
450
|
return methodHooks.minifyHtml(html, minifyHtmlOptions)
|
|
342
451
|
}
|
|
343
|
-
|
|
344
452
|
rollupPlugins.push({
|
|
345
453
|
name: "jsenv_minifier",
|
|
346
454
|
async renderChunk(code, chunk) {
|
|
@@ -354,7 +462,6 @@ export const createRollupPlugins = async ({
|
|
|
354
462
|
module: format === "esmodule",
|
|
355
463
|
...(format === "global" ? { toplevel: false } : { toplevel: true }),
|
|
356
464
|
})
|
|
357
|
-
|
|
358
465
|
code = result.code
|
|
359
466
|
map = result.map
|
|
360
467
|
return {
|
|
@@ -685,19 +792,21 @@ export const createRollupPlugins = async ({
|
|
|
685
792
|
const compiledFileUrl = asCompiledServerUrl(fileUrl)
|
|
686
793
|
resolutionResult.url = compiledFileUrl
|
|
687
794
|
}
|
|
688
|
-
|
|
689
|
-
if (
|
|
795
|
+
const { searchParams } = new URL(ressourceUrl)
|
|
796
|
+
if (searchParams.has("module")) {
|
|
797
|
+
resolutionResult.isJsModule = true
|
|
798
|
+
} else if (searchParams.has("worker")) {
|
|
690
799
|
resolutionResult.isWorker = true
|
|
691
800
|
resolutionResult.isJsModule = true
|
|
692
|
-
} else if (
|
|
801
|
+
} else if (searchParams.has("service_worker")) {
|
|
693
802
|
resolutionResult.isServiceWorker = true
|
|
694
803
|
resolutionResult.isJsModule = true
|
|
695
|
-
|
|
804
|
+
serviceWorkerUrls.push(ressourceOriginalUrl)
|
|
805
|
+
} else if (searchParams.has("worker_type_classic")) {
|
|
696
806
|
resolutionResult.isWorker = true
|
|
697
|
-
} else if (
|
|
698
|
-
classicServiceWorkerUrls.includes(ressourceOriginalUrl)
|
|
699
|
-
) {
|
|
807
|
+
} else if (searchParams.has("service_worker_type_classic")) {
|
|
700
808
|
resolutionResult.isServiceWorker = true
|
|
809
|
+
classicServiceWorkerUrls.push(ressourceOriginalUrl)
|
|
701
810
|
}
|
|
702
811
|
return resolutionResult
|
|
703
812
|
},
|
|
@@ -927,6 +1036,9 @@ export const createRollupPlugins = async ({
|
|
|
927
1036
|
return ressource.rollupReferenceId === referenceId
|
|
928
1037
|
})
|
|
929
1038
|
ressource.buildRelativeUrlWithoutHash = fileName
|
|
1039
|
+
if (ressource.isJsModule) {
|
|
1040
|
+
return fileName
|
|
1041
|
+
}
|
|
930
1042
|
const buildRelativeUrl = ressource.buildRelativeUrl
|
|
931
1043
|
return buildRelativeUrl
|
|
932
1044
|
}
|
|
@@ -1047,22 +1159,16 @@ export const createRollupPlugins = async ({
|
|
|
1047
1159
|
onReferenceWithImportMetaUrlPattern: async ({ importNode }) => {
|
|
1048
1160
|
const specifier = importNode.arguments[0].value
|
|
1049
1161
|
const { line, column } = importNode.loc.start
|
|
1050
|
-
|
|
1051
1162
|
const { id } = normalizeRollupResolveReturnValue(
|
|
1052
1163
|
await this.resolve(specifier, url),
|
|
1053
1164
|
)
|
|
1054
1165
|
const ressourceUrl = asServerUrl(id)
|
|
1055
|
-
const originalUrl = asOriginalUrl(ressourceUrl)
|
|
1056
|
-
const isJsModule = Boolean(
|
|
1057
|
-
workerUrls[originalUrl] || serviceWorkerUrls[originalUrl],
|
|
1058
|
-
)
|
|
1059
1166
|
const reference = ressourceBuilder.createReferenceFoundInJsModule({
|
|
1060
1167
|
referenceLabel: "URL + import.meta.url",
|
|
1061
1168
|
jsUrl: url,
|
|
1062
1169
|
jsLine: line,
|
|
1063
1170
|
jsColumn: column,
|
|
1064
1171
|
ressourceSpecifier: ressourceUrl,
|
|
1065
|
-
isJsModule,
|
|
1066
1172
|
})
|
|
1067
1173
|
if (!reference) {
|
|
1068
1174
|
return
|
|
@@ -1363,7 +1469,6 @@ export const createRollupPlugins = async ({
|
|
|
1363
1469
|
}
|
|
1364
1470
|
return sourceUrl
|
|
1365
1471
|
}
|
|
1366
|
-
|
|
1367
1472
|
return outputOptions
|
|
1368
1473
|
},
|
|
1369
1474
|
|
|
@@ -1373,12 +1478,15 @@ export const createRollupPlugins = async ({
|
|
|
1373
1478
|
// happens for inline module scripts for instance
|
|
1374
1479
|
return null
|
|
1375
1480
|
}
|
|
1376
|
-
|
|
1377
1481
|
const url = asOriginalUrl(facadeModuleId)
|
|
1378
|
-
|
|
1482
|
+
const { searchParams } = new URL(url)
|
|
1483
|
+
if (
|
|
1484
|
+
format === "systemjs" &&
|
|
1485
|
+
(searchParams.has("worker") || searchParams.has("service_worker"))
|
|
1486
|
+
) {
|
|
1379
1487
|
const magicString = new MagicString(code)
|
|
1380
1488
|
const systemjsCode = await readFile(
|
|
1381
|
-
new URL("../
|
|
1489
|
+
new URL("../runtime_client/s.js", import.meta.url),
|
|
1382
1490
|
)
|
|
1383
1491
|
magicString.prepend(systemjsCode)
|
|
1384
1492
|
code = magicString.toString()
|
|
@@ -1388,7 +1496,6 @@ export const createRollupPlugins = async ({
|
|
|
1388
1496
|
map,
|
|
1389
1497
|
}
|
|
1390
1498
|
}
|
|
1391
|
-
|
|
1392
1499
|
return null
|
|
1393
1500
|
},
|
|
1394
1501
|
|
|
@@ -1609,9 +1716,9 @@ export const createRollupPlugins = async ({
|
|
|
1609
1716
|
buildMappings = sortObjectByPathnames(buildMappings)
|
|
1610
1717
|
await visitServiceWorkers({
|
|
1611
1718
|
projectDirectoryUrl,
|
|
1719
|
+
serviceWorkerFinalizer,
|
|
1612
1720
|
serviceWorkerUrls,
|
|
1613
1721
|
classicServiceWorkerUrls,
|
|
1614
|
-
serviceWorkerFinalizer,
|
|
1615
1722
|
buildMappings,
|
|
1616
1723
|
ressourceMappings,
|
|
1617
1724
|
buildFileContents,
|
|
@@ -1831,7 +1938,6 @@ const visitServiceWorkers = async ({
|
|
|
1831
1938
|
...serviceWorkerUrls,
|
|
1832
1939
|
...classicServiceWorkerUrls,
|
|
1833
1940
|
]
|
|
1834
|
-
|
|
1835
1941
|
await Promise.all(
|
|
1836
1942
|
allServiceWorkerUrls.map(async (serviceWorkerUrl) => {
|
|
1837
1943
|
const serviceWorkerRelativeUrl = urlToRelativeUrl(
|
|
@@ -1845,7 +1951,6 @@ const visitServiceWorkers = async ({
|
|
|
1845
1951
|
`"${serviceWorkerRelativeUrl}" service worker file missing in the build`,
|
|
1846
1952
|
)
|
|
1847
1953
|
}
|
|
1848
|
-
|
|
1849
1954
|
if (serviceWorkerFinalizer) {
|
|
1850
1955
|
let code = buildFileContents[serviceWorkerBuildRelativeUrl]
|
|
1851
1956
|
code = await serviceWorkerFinalizer(code, {
|
|
File without changes
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { resolveUrl } from "@jsenv/filesystem"
|
|
2
2
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
parseDataUrl,
|
|
7
|
-
} from "@jsenv/core/src/internal/dataUrl.utils.js"
|
|
8
|
-
import { fetchUrl } from "@jsenv/core/src/internal/fetchUrl.js"
|
|
4
|
+
import { DataUrl } from "@jsenv/core/src/internal/data_url.js"
|
|
5
|
+
import { fetchUrl } from "@jsenv/core/src/internal/fetching.js"
|
|
9
6
|
import { validateResponse } from "@jsenv/core/src/internal/response_validation.js"
|
|
10
7
|
|
|
11
8
|
export const loadSourcemap = async ({
|
|
@@ -23,7 +20,7 @@ export const loadSourcemap = async ({
|
|
|
23
20
|
|
|
24
21
|
const sourcemapUrl = resolveUrl(sourcemapSpecifier, url)
|
|
25
22
|
if (sourcemapUrl.startsWith("data:")) {
|
|
26
|
-
const sourcemapString =
|
|
23
|
+
const sourcemapString = DataUrl.parse(sourcemapUrl, { as: "string" })
|
|
27
24
|
return parseSourcemapString(
|
|
28
25
|
sourcemapString,
|
|
29
26
|
sourcemapUrl,
|
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
getHtmlNodeAttributeByName,
|
|
5
5
|
stringifyHtmlAst,
|
|
6
6
|
getHtmlNodeLocation,
|
|
7
|
-
} from "@jsenv/core/src/internal/
|
|
8
|
-
|
|
7
|
+
} from "@jsenv/core/src/internal/compile_server/html/html_ast.js"
|
|
8
|
+
|
|
9
9
|
import { getRessourceAsBase64Url } from "../ressource_builder_util.js"
|
|
10
|
-
import {
|
|
10
|
+
import { collectNodesMutations } from "../html/html_node_mutations.js"
|
|
11
|
+
import { minifyHtml } from "../html/minify_html.js"
|
|
11
12
|
|
|
12
13
|
export const parseSvgRessource = async (
|
|
13
14
|
svgRessource,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
2
2
|
import { urlToExtension, urlToRelativeUrl } from "@jsenv/filesystem"
|
|
3
3
|
|
|
4
|
-
import { fetchUrl as jsenvFetchUrl } from "@jsenv/core/src/internal/
|
|
4
|
+
import { fetchUrl as jsenvFetchUrl } from "@jsenv/core/src/internal/fetching.js"
|
|
5
5
|
import { validateResponse } from "@jsenv/core/src/internal/response_validation.js"
|
|
6
6
|
|
|
7
7
|
export const createUrlFetcher = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
|
|
1
|
+
import { getJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourcemap_utils.js"
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { convertJsonTextToJavascriptModule } from "./import_assertions/json_module.js"
|
|
4
|
+
import { loadSourcemap } from "./sourcemap/sourcemap_loader.js"
|
|
5
5
|
|
|
6
6
|
export const createUrlLoader = ({
|
|
7
7
|
urlCustomLoaders,
|
|
File without changes
|
|
File without changes
|
package/src/internal/{compiling → compile_server/commonjs}/rollup_plugin_commonjs_named_exports.js
RENAMED
|
File without changes
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
} from "@jsenv/filesystem"
|
|
8
8
|
import { convertFileSystemErrorToResponseProperties } from "@jsenv/server/src/internal/convertFileSystemErrorToResponseProperties.js"
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { reuseOrCreateCompiledFile } from "./jsenv_directory/reuse_or_create_compiled_file.js"
|
|
11
|
+
import { updateCompileCache } from "./jsenv_directory/update_compile_cache.js"
|
|
12
12
|
|
|
13
13
|
export const compileFile = async ({
|
|
14
14
|
logger,
|
|
@@ -47,7 +47,7 @@ export const compileFile = async ({
|
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
49
|
const { meta, compileResult, compileResultStatus, timing } =
|
|
50
|
-
await
|
|
50
|
+
await reuseOrCreateCompiledFile({
|
|
51
51
|
logger,
|
|
52
52
|
projectDirectoryUrl,
|
|
53
53
|
originalFileUrl,
|
|
@@ -101,7 +101,7 @@ export const compileFile = async ({
|
|
|
101
101
|
if (compileResultStatus !== "cached" && compileCacheStrategy !== "none") {
|
|
102
102
|
// we MUST await updateMeta otherwise we might get 404
|
|
103
103
|
// when serving sourcemap files
|
|
104
|
-
await
|
|
104
|
+
await updateCompileCache({
|
|
105
105
|
logger,
|
|
106
106
|
meta,
|
|
107
107
|
compileResult,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
readRequestBody,
|
|
10
10
|
} from "@jsenv/server"
|
|
11
11
|
import {
|
|
12
|
-
resolveUrl,
|
|
13
12
|
urlToRelativeUrl,
|
|
14
13
|
resolveDirectoryUrl,
|
|
15
14
|
urlIsInsideOf,
|
|
@@ -18,24 +17,25 @@ import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
|
18
17
|
import { createCallbackListNotifiedOnce } from "@jsenv/abort"
|
|
19
18
|
|
|
20
19
|
import {
|
|
20
|
+
jsenvDistDirectoryUrl,
|
|
21
21
|
sourcemapMainFileInfo,
|
|
22
22
|
sourcemapMappingFileInfo,
|
|
23
|
-
} from "@jsenv/core/src/
|
|
23
|
+
} from "@jsenv/core/src/jsenv_file_urls.js"
|
|
24
24
|
import { createJsenvRemoteDirectory } from "../jsenv_remote_directory.js"
|
|
25
|
-
|
|
26
|
-
import { jsenvDistDirectoryUrl } from "../jsenvCoreDirectoryUrl.js"
|
|
25
|
+
|
|
27
26
|
import { createCompileContext } from "./jsenv_directory/compile_context.js"
|
|
28
27
|
import { createCompileProfile } from "./jsenv_directory/compile_profile.js"
|
|
29
28
|
import { setupJsenvDirectory } from "./jsenv_directory/jsenv_directory.js"
|
|
30
29
|
import { urlIsCompilationAsset } from "./jsenv_directory/compile_asset.js"
|
|
31
30
|
import { createSSEService } from "./sse_service/sse_service.js"
|
|
32
|
-
import { loadBabelPluginMapFromFile } from "./load_babel_plugin_map_from_file.js"
|
|
33
|
-
import { extractSyntaxBabelPluginMap } from "./babel_plugins.js"
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
31
|
+
import { loadBabelPluginMapFromFile } from "./js/load_babel_plugin_map_from_file.js"
|
|
32
|
+
import { extractSyntaxBabelPluginMap } from "./js/babel_plugins.js"
|
|
33
|
+
import { babelPluginReplaceExpressions } from "./js/babel_plugin_replace_expressions.js"
|
|
34
|
+
import { babelPluginGlobalThisAsJsenvImport } from "./js/babel_plugin_global_this_as_jsenv_import.js"
|
|
35
|
+
import { babelPluginNewStylesheetAsJsenvImport } from "./js/babel_plugin_new_stylesheet_as_jsenv_import.js"
|
|
36
|
+
import { babelPluginImportAssertions } from "./js/babel_plugin_import_assertions.js"
|
|
37
|
+
import { createCompiledFileService } from "./compiled_file_service.js"
|
|
38
|
+
import { createTransformHtmlSourceFileService } from "./html/html_source_file_service.js"
|
|
39
39
|
|
|
40
40
|
let compileServerId = 0
|
|
41
41
|
|
|
@@ -79,8 +79,6 @@ export const startCompileServer = async ({
|
|
|
79
79
|
babelConfigFileUrl,
|
|
80
80
|
customCompilers = {},
|
|
81
81
|
preservedUrls,
|
|
82
|
-
workers = [],
|
|
83
|
-
serviceWorkers = [],
|
|
84
82
|
importMapInWebWorkers = false,
|
|
85
83
|
prependSystemJs,
|
|
86
84
|
|
|
@@ -127,12 +125,6 @@ export const startCompileServer = async ({
|
|
|
127
125
|
*/
|
|
128
126
|
...preservedUrls,
|
|
129
127
|
}
|
|
130
|
-
const workerUrls = workers.map((worker) =>
|
|
131
|
-
resolveUrl(worker, projectDirectoryUrl),
|
|
132
|
-
)
|
|
133
|
-
const serviceWorkerUrls = serviceWorkers.map((serviceWorker) =>
|
|
134
|
-
resolveUrl(serviceWorker, projectDirectoryUrl),
|
|
135
|
-
)
|
|
136
128
|
const babelPluginMapFromFile = await loadBabelPluginMapFromFile({
|
|
137
129
|
projectDirectoryUrl,
|
|
138
130
|
babelConfigFileUrl,
|
|
@@ -209,8 +201,6 @@ export const startCompileServer = async ({
|
|
|
209
201
|
})
|
|
210
202
|
const compileContext = await createCompileContext({
|
|
211
203
|
preservedUrls,
|
|
212
|
-
workers,
|
|
213
|
-
serviceWorkers,
|
|
214
204
|
replaceProcessEnvNodeEnv,
|
|
215
205
|
inlineImportMapIntoHTML,
|
|
216
206
|
})
|
|
@@ -252,7 +242,6 @@ export const startCompileServer = async ({
|
|
|
252
242
|
customCompilers,
|
|
253
243
|
babelPluginMapWithoutSyntax,
|
|
254
244
|
preservedUrls,
|
|
255
|
-
workerUrls,
|
|
256
245
|
importMapInWebWorkers,
|
|
257
246
|
moduleOutFormat,
|
|
258
247
|
sourcemapMethod,
|
|
@@ -343,8 +332,6 @@ export const startCompileServer = async ({
|
|
|
343
332
|
topLevelAwait,
|
|
344
333
|
babelPluginMap,
|
|
345
334
|
customCompilers,
|
|
346
|
-
workerUrls,
|
|
347
|
-
serviceWorkerUrls,
|
|
348
335
|
prependSystemJs,
|
|
349
336
|
jsenvEventSourceClientInjection,
|
|
350
337
|
jsenvToolbarInjection,
|
|
@@ -12,10 +12,10 @@ import { serverUrlToCompileInfo } from "@jsenv/core/src/internal/url_conversion.
|
|
|
12
12
|
import { setUrlExtension } from "../url_utils.js"
|
|
13
13
|
|
|
14
14
|
import { shakeBabelPluginMap } from "./jsenv_directory/compile_profile.js"
|
|
15
|
-
import { compileFile } from "./
|
|
16
|
-
import { compileHtml } from "./
|
|
17
|
-
import { compileImportmap } from "./
|
|
18
|
-
import { compileJavascript } from "./
|
|
15
|
+
import { compileFile } from "./compile_file.js"
|
|
16
|
+
import { compileHtml } from "./html/jsenv_compile_html.js"
|
|
17
|
+
import { compileImportmap } from "./importmap/jsenv_compile_importmap.js"
|
|
18
|
+
import { compileJavascript } from "./js/jsenv_compile_js.js"
|
|
19
19
|
|
|
20
20
|
const jsenvCompilers = {
|
|
21
21
|
"**/*.js": compileJavascript,
|
|
@@ -41,8 +41,6 @@ export const createCompiledFileService = ({
|
|
|
41
41
|
topLevelAwait,
|
|
42
42
|
prependSystemJs,
|
|
43
43
|
customCompilers,
|
|
44
|
-
workerUrls,
|
|
45
|
-
serviceWorkerUrls,
|
|
46
44
|
|
|
47
45
|
jsenvEventSourceClientInjection,
|
|
48
46
|
jsenvToolbarInjection,
|
|
@@ -167,8 +165,6 @@ export const createCompiledFileService = ({
|
|
|
167
165
|
babelPluginMap,
|
|
168
166
|
compileProfile,
|
|
169
167
|
}),
|
|
170
|
-
workerUrls,
|
|
171
|
-
serviceWorkerUrls,
|
|
172
168
|
topLevelAwait,
|
|
173
169
|
prependSystemJs,
|
|
174
170
|
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { createHash } from "node:crypto"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
All script type="module" will be converted to inline script.
|
|
6
|
-
These inline script execution order is non predictible it depends
|
|
7
|
-
which one is being done first
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { createHash } from "crypto"
|
|
12
|
-
|
|
13
|
-
import { require } from "../require.js"
|
|
3
|
+
import { require } from "@jsenv/core/src/internal/require.js"
|
|
14
4
|
|
|
15
5
|
// https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tree-adapters/default.js
|
|
16
6
|
// eslint-disable-next-line import/no-unresolved
|