@jsenv/core 25.6.2 → 27.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +18 -20
- package/package.json +38 -73
- package/readme.md +32 -44
- package/src/build/build.js +737 -0
- package/src/build/build_urls_generator.js +64 -0
- package/src/build/inject_version_mappings.js +62 -0
- package/src/build/plugins/bundle_js_module/jsenv_plugin_bundle_js_module.js +225 -0
- package/src/build/plugins/minify_html/jsenv_plugin_minify_html.js +30 -0
- package/src/build/plugins/minify_js/jsenv_plugin_minify_js.js +47 -0
- package/src/dev/plugins/autoreload/babel_plugin_metadata_import_meta_hot.js +98 -0
- package/src/dev/plugins/autoreload/client/autoreload_preference.js +11 -0
- package/src/dev/plugins/autoreload/client/event_source_client.js +186 -0
- package/src/{internal/dev_server/event_source_client → dev/plugins/autoreload/client}/event_source_connection.js +21 -25
- package/src/dev/plugins/autoreload/client/import_meta_hot.js +80 -0
- package/src/dev/plugins/autoreload/client/reload.js +101 -0
- package/src/dev/plugins/autoreload/client/url_helpers.js +20 -0
- package/src/dev/plugins/autoreload/html_hot_dependencies.js +156 -0
- package/src/dev/plugins/autoreload/jsenv_plugin_autoreload.js +374 -0
- package/src/dev/plugins/autoreload/sse_service.js +149 -0
- package/src/dev/plugins/explorer/client/explorer.html +607 -0
- package/src/{internal → dev/plugins/explorer/client}/jsenv.png +0 -0
- package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +74 -0
- package/src/{internal/dev_server/toolbar/animation/toolbar.animation.js → dev/plugins/toolbar/client/animation/toolbar_animation.js} +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/eventsource/eventsource.css +2 -2
- package/src/dev/plugins/toolbar/client/eventsource/toolbar_eventsource.js +57 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/execution/execution.css +0 -0
- package/src/dev/plugins/toolbar/client/execution/toolbar_execution.js +88 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/focus/focus.css +0 -0
- package/src/{internal/dev_server/toolbar/focus/toolbar.focus.js → dev/plugins/toolbar/client/focus/toolbar_focus.js} +0 -0
- package/src/{internal/dev_server/toolbar/jsenv-logo.svg → dev/plugins/toolbar/client/jsenv_logo.svg} +1 -1
- package/src/{internal/dev_server/toolbar/notification/toolbar.notification.js → dev/plugins/toolbar/client/notification/toolbar_notification.js} +0 -0
- package/src/{internal/dev_server/toolbar/responsive/overflow-menu.css → dev/plugins/toolbar/client/responsive/overflow_menu.css} +0 -0
- package/src/{internal/dev_server/toolbar/responsive/toolbar.responsive.js → dev/plugins/toolbar/client/responsive/toolbar_responsive.js} +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/settings/settings.css +0 -0
- package/src/{internal/dev_server/toolbar/settings/toolbar.settings.js → dev/plugins/toolbar/client/settings/toolbar_settings.js} +1 -0
- package/src/{internal/dev_server/toolbar/theme/jsenv-theme.css → dev/plugins/toolbar/client/theme/jsenv_theme.css} +1 -15
- package/src/{internal/dev_server/toolbar/theme/light-theme.css → dev/plugins/toolbar/client/theme/light_theme.css} +0 -17
- package/src/{internal/dev_server/toolbar/theme/toolbar.theme.js → dev/plugins/toolbar/client/theme/toolbar_theme.js} +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar.html +42 -201
- package/src/{internal/dev_server/toolbar/toolbar.injector.js → dev/plugins/toolbar/client/toolbar_injector.js} +10 -29
- package/src/{internal/dev_server/toolbar/toolbar.main.css → dev/plugins/toolbar/client/toolbar_main.css} +2 -26
- package/src/{internal/dev_server/toolbar/toolbar.main.js → dev/plugins/toolbar/client/toolbar_main.js} +18 -64
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.css +1 -1
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/tooltip/tooltip.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/animation.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/dom.js +0 -0
- package/src/{internal/browser_utils/fetchUsingXHR.js → dev/plugins/toolbar/client/util/fetch_using_xhr.js} +0 -2
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/fetching.js +2 -4
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/iframe_to_parent_href.js +0 -0
- package/src/{internal/dev_server/toolbar/util/jsenvLogger.js → dev/plugins/toolbar/client/util/jsenv_logger.js} +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/preferences.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/responsive.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/util/util.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/variant/variant.js +0 -0
- package/src/dev/plugins/toolbar/jsenv_plugin_toolbar.js +62 -0
- package/src/dev/start_dev_server.js +105 -0
- package/src/execute/execute.js +132 -0
- package/src/execute/run.js +208 -0
- package/src/execute/runtimes/browsers/chromium.js +8 -0
- package/src/execute/runtimes/browsers/firefox.js +7 -0
- package/src/execute/runtimes/browsers/from_playwright.js +464 -0
- package/src/execute/runtimes/browsers/webkit.js +24 -0
- package/src/{internal/node_launcher/createChildProcessOptions.js → execute/runtimes/node/child_exec_options.js} +25 -36
- package/src/{internal/node_runtime/nodeControllableFile.mjs → execute/runtimes/node/controllable_file.mjs} +1 -18
- package/src/{internal/node_launcher/createControllableNodeProcess.js → execute/runtimes/node/controlled_process.js} +128 -150
- package/src/execute/runtimes/node/exec_options.js +44 -0
- package/src/{internal/node_launcher → execute/runtimes/node}/kill_process_tree.js +4 -2
- package/src/execute/runtimes/node/node_process.js +92 -0
- package/src/execute/runtimes/node/node_worker_thread.js +28 -0
- package/src/omega/core_plugins/babel/babel_helper/babel_helper_directory.js +29 -0
- package/src/{internal/compiling/js-compilation-service → omega/core_plugins/babel/babel_helper}/babel_plugin_babel_helpers_as_jsenv_imports.js +16 -19
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/.eslintrc.cjs +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AsyncGenerator/AsyncGenerator.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/AwaitValue/AwaitValue.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayLikeToArray/arrayLikeToArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithHoles/arrayWithHoles.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/arrayWithoutHoles/arrayWithoutHoles.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/assertThisInitialized/assertThisInitialized.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncIterator/asyncIterator.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/asyncToGenerator/asyncToGenerator.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCallCheck/classCallCheck.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classNameTDZError/classNameTDZError.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldGet/classPrivateFieldGet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateFieldSet/classPrivateFieldSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodGet/classPrivateMethodGet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classPrivateMethodSet/classPrivateMethodSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/construct/construct.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createClass/createClass.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createRawReactElement/createRawReactElement.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/createSuper/createSuper.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/decorate/decorate.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defaults/defaults.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineEnumerableProperties/defineEnumerableProperties.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/defineProperty/defineProperty.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/extends/extends.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/get/get.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/getPrototypeOf/getPrototypeOf.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inherits/inherits.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/inheritsLoose/inheritsLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerDefineProperty/initializerDefineProperty.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/initializerWarningHelper/initializerWarningHelper.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/instanceof/instanceof.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireDefault/interopRequireDefault.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/interopRequireWildcard/interopRequireWildcard.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeFunction/isNativeFunction.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArray/iterableToArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimit/iterableToArrayLimit.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/jsx/jsx.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/maybeArrayLike/maybeArrayLike.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/newArrowCheck/newArrowCheck.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableRest/nonIterableRest.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/nonIterableSpread/nonIterableSpread.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread/objectSpread.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectSpread2/objectSpread2.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutProperties/objectWithoutProperties.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/possibleConstructorReturn/possibleConstructorReturn.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readOnlyError/readOnlyError.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/readme.md +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/set/set.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/setPrototypeOf/setPrototypeOf.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArray/slicedToArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/slicedToArrayLoose/slicedToArrayLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/superPropBase/superPropBase.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/tdz/tdz.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalRef/temporalRef.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/temporalUndefined/temporalUndefined.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toArray/toArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toConsumableArray/toConsumableArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPrimitive/toPrimitive.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/toPropertyKey/toPropertyKey.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/typeof/typeof.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapNativeSuper/wrapNativeSuper.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/wrapRegExp/wrapRegExp.js +0 -0
- package/{helpers/babel → src/omega/core_plugins/babel/babel_helper/client}/writeOnlyError/writeOnlyError.js +0 -0
- package/src/omega/core_plugins/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +35 -0
- package/{helpers/global-this/global-this.js → src/omega/core_plugins/babel/global_this/client/global_this.js} +0 -0
- package/src/omega/core_plugins/babel/helpers/babel_plugin_structure.js +187 -0
- package/src/{internal/features → omega/core_plugins/babel/helpers}/babel_plugins_compatibility.js +1 -24
- package/src/omega/core_plugins/babel/jsenv_plugin_babel.js +97 -0
- package/src/omega/core_plugins/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +117 -0
- package/src/omega/core_plugins/babel/new_stylesheet/client/.eslintrc.cjs +24 -0
- package/{helpers/new_stylesheet → src/omega/core_plugins/babel/new_stylesheet/client}/new_stylesheet.js +0 -0
- package/src/omega/core_plugins/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +34 -0
- package/{helpers/regenerator-runtime/regenerator-runtime.js → src/omega/core_plugins/babel/regenerator_runtime/client/regenerator_runtime.js} +0 -0
- package/src/omega/core_plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +169 -0
- package/src/omega/core_plugins/file_urls/jsenv_plugin_file_urls.js +67 -0
- package/src/omega/core_plugins/filesystem_magic/jsenv_plugin_filesystem_magic.js +58 -0
- package/src/{internal/browser_runtime/displayErrorInDocument.js → omega/core_plugins/html_supervisor/client/error_in_document.js} +10 -18
- package/src/{internal/browser_runtime/displayErrorNotification.js → omega/core_plugins/html_supervisor/client/error_in_notification.js} +0 -1
- package/src/omega/core_plugins/html_supervisor/client/html_supervisor_installer.js +168 -0
- package/src/omega/core_plugins/html_supervisor/client/html_supervisor_setup.js +77 -0
- package/src/{internal → omega/core_plugins/html_supervisor/client}/perf_browser.js +0 -2
- package/src/{internal/unevalException.js → omega/core_plugins/html_supervisor/client/uneval_exception.js} +1 -1
- package/src/omega/core_plugins/html_supervisor/jsenv_plugin_html_supervisor.js +233 -0
- package/src/omega/core_plugins/import_assertions/helpers/babel_plugin_metadata_import_assertions.js +98 -0
- package/src/{internal/building → omega/core_plugins/import_assertions/helpers}/json_module.js +3 -2
- package/src/omega/core_plugins/import_assertions/helpers/text_module.js +6 -0
- package/src/omega/core_plugins/import_assertions/jsenv_plugin_import_assertions.js +211 -0
- package/src/omega/core_plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +80 -0
- package/src/omega/core_plugins/importmap/jsenv_plugin_importmap.js +212 -0
- package/src/omega/core_plugins/inline/client/inline_content.js +6 -0
- package/src/omega/core_plugins/inline/jsenv_plugin_data_urls.js +70 -0
- package/src/omega/core_plugins/inline/jsenv_plugin_inline.js +13 -0
- package/src/omega/core_plugins/inline/jsenv_plugin_inline_query_param.js +42 -0
- package/src/omega/core_plugins/inline/jsenv_plugin_js_and_css_inside_html.js +142 -0
- package/src/omega/core_plugins/inline/jsenv_plugin_new_inline_content.js +210 -0
- package/src/omega/core_plugins/leading_slash/jsenv_plugin_leading_slash.js +12 -0
- package/src/omega/core_plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +77 -0
- package/src/omega/core_plugins/url_resolution/jsenv_plugin_url_resolution.js +28 -0
- package/src/omega/core_plugins/url_version/jsenv_plugin_url_version.js +50 -0
- package/src/omega/core_plugins.js +39 -0
- package/src/omega/errors.js +168 -0
- package/src/omega/file_url_converter.js +63 -0
- package/src/omega/kitchen.js +777 -0
- package/src/omega/omega_server.js +129 -0
- package/src/omega/plugin_controller.js +240 -0
- package/src/omega/runtime_support/default_runtime_support.js +13 -0
- package/src/omega/runtime_support/features_compatibility.js +91 -0
- package/src/omega/runtime_support/runtime_support.js +20 -0
- package/src/omega/server/file_service.js +155 -0
- package/src/omega/server/user_agent.js +22 -0
- package/src/omega/url_graph/url_graph_load.js +68 -0
- package/src/omega/url_graph/url_graph_report.js +151 -0
- package/src/omega/url_graph/url_graph_sort.js +29 -0
- package/src/omega/url_graph/url_info_transformations.js +161 -0
- package/src/omega/url_graph.js +132 -0
- package/src/omega/url_mentions/css_url_mentions.js +63 -0
- package/src/omega/url_mentions/html_url_mentions.js +185 -0
- package/src/omega/url_mentions/js_module_url_mentions.js +91 -0
- package/src/omega/url_mentions/parse_url_mentions.js +37 -0
- package/src/omega/url_mentions/worker_classic_url_mentions.js +37 -0
- package/src/{internal/executing/executePlan.js → test/execute_plan.js} +159 -213
- package/src/{executeTestPlan.js → test/execute_test_plan.js} +36 -84
- package/src/{internal/executing → test}/execution_colors.js +0 -0
- package/src/{internal/executing/generateFileExecutionSteps.js → test/execution_steps.js} +25 -4
- package/src/{internal/executing → test}/gc.js +0 -0
- package/src/test/logs_file_execution.js +223 -0
- package/dist/browser_runtime/asset-manifest.json +0 -4
- package/dist/browser_runtime/browser_runtime_c81cd9af.js +0 -5300
- package/dist/browser_runtime/browser_runtime_c81cd9af.js.map +0 -1089
- package/dist/build_manifest.js +0 -12
- package/dist/compile_proxy/asset-manifest.json +0 -4
- package/dist/compile_proxy/compile_proxy.html__inline__20_c05fdc30.js.map +0 -343
- package/dist/compile_proxy/compile_proxy_93ec4247.html +0 -2247
- package/dist/event_source_client/asset-manifest.json +0 -4
- package/dist/event_source_client/event_source_client_69f48287.js +0 -354
- package/dist/event_source_client/event_source_client_69f48287.js.map +0 -128
- package/dist/redirector/asset-manifest.json +0 -4
- package/dist/redirector/redirector.html__inline__12_20421b23.js.map +0 -349
- package/dist/redirector/redirector_ddc79416.html +0 -2292
- package/dist/toolbar/asset-manifest.json +0 -13
- package/dist/toolbar/assets/compilation.css_7421bd55.map +0 -12
- package/dist/toolbar/assets/eventsource.css_c0c71e7b.map +0 -12
- package/dist/toolbar/assets/execution.css_f3377c10.map +0 -12
- package/dist/toolbar/assets/focus.css_896f3e45.map +0 -12
- package/dist/toolbar/assets/light-theme.css_72a60fa3.map +0 -12
- package/dist/toolbar/assets/overflow-menu.css_2859d519.map +0 -12
- package/dist/toolbar/assets/settings.css_942b5a9e.map +0 -12
- package/dist/toolbar/assets/toolbar.main.css_b7d8bec1.map +0 -28
- package/dist/toolbar/assets/tooltip.css_a94a8bdd.map +0 -12
- package/dist/toolbar/toolbar.main_7d7783d3.js.map +0 -776
- package/dist/toolbar/toolbar_d6045dd0.html +0 -4978
- package/dist/toolbar_injector/asset-manifest.json +0 -5
- package/dist/toolbar_injector/assets/jsenv-logo_188b9ca6.svg +0 -95
- package/dist/toolbar_injector/toolbar_injector_c8c214dd.js +0 -977
- package/dist/toolbar_injector/toolbar_injector_c8c214dd.js.map +0 -294
- package/helpers/import-meta/import-meta-url-commonjs.js +0 -9
- package/helpers/import-meta/import-meta-url-global.js +0 -54
- package/src/buildProject.js +0 -336
- package/src/commonJsToJavaScriptModule.js +0 -180
- package/src/dev_server.js +0 -295
- package/src/execute.js +0 -184
- package/src/importUsingChildProcess.js +0 -68
- package/src/internal/argUtils.js +0 -12
- package/src/internal/babel_plugin_replace_expressions.js +0 -101
- package/src/internal/browser_detection/browser_detection.js +0 -68
- package/src/internal/browser_detection/detectAndroid.js +0 -13
- package/src/internal/browser_detection/detectChrome.js +0 -28
- package/src/internal/browser_detection/detectEdge.js +0 -13
- package/src/internal/browser_detection/detectElectron.js +0 -1
- package/src/internal/browser_detection/detectFirefox.js +0 -17
- package/src/internal/browser_detection/detectIOS.js +0 -19
- package/src/internal/browser_detection/detectInternetExplorer.js +0 -14
- package/src/internal/browser_detection/detectOpera.js +0 -27
- package/src/internal/browser_detection/detectSafari.js +0 -13
- package/src/internal/browser_detection/user_agent_data.js +0 -26
- package/src/internal/browser_detection/util.js +0 -13
- package/src/internal/browser_launcher/browser_runtime_profile.js +0 -81
- package/src/internal/browser_launcher/executeHtmlFile.js +0 -354
- package/src/internal/browser_launcher/from_playwright.js +0 -320
- package/src/internal/browser_launcher/trackPageToNotify.js +0 -77
- package/src/internal/browser_runtime/browser_runtime.js +0 -224
- package/src/internal/browser_runtime/browser_system.js +0 -218
- package/src/internal/browser_runtime/createBrowserRuntime.js +0 -146
- package/src/internal/browser_runtime/evalSource.js +0 -11
- package/src/internal/browser_runtime/makeNamespaceTransferable.js +0 -90
- package/src/internal/browser_utils/fetchAndEvalUsingFetch.js +0 -29
- package/src/internal/browser_utils/fetchAndEvalUsingScript.js +0 -49
- package/src/internal/browser_utils/fetchJson.js +0 -7
- package/src/internal/browser_utils/fetch_browser.js +0 -34
- package/src/internal/building/buildToCompilationResult.js +0 -183
- package/src/internal/building/buildUsingRollup.js +0 -359
- package/src/internal/building/build_logs.js +0 -133
- package/src/internal/building/build_stats.js +0 -100
- package/src/internal/building/build_url_generator.js +0 -153
- package/src/internal/building/css/applyPostCss.js +0 -55
- package/src/internal/building/css/moveCssUrls.js +0 -44
- package/src/internal/building/css/parseCssRessource.js +0 -259
- package/src/internal/building/css/parseCssUrls.js +0 -38
- package/src/internal/building/css/postcss_plugin_url_visitor.js +0 -244
- package/src/internal/building/css/replaceCssUrls.js +0 -67
- package/src/internal/building/css_module.js +0 -43
- package/src/internal/building/es_to_system.js +0 -34
- package/src/internal/building/html/htmlScan.js +0 -70
- package/src/internal/building/html/minifyHtml.js +0 -7
- package/src/internal/building/html/parseHtmlRessource.js +0 -814
- package/src/internal/building/import_references.js +0 -80
- package/src/internal/building/importmap/parseImportmapRessource.js +0 -28
- package/src/internal/building/js/babel_plugin_inline_worker_imports.js +0 -96
- package/src/internal/building/js/minifyJs.js +0 -33
- package/src/internal/building/js/parseJsRessource.js +0 -121
- package/src/internal/building/js/transform_worker.js +0 -55
- package/src/internal/building/json/parseJsonRessource.js +0 -11
- package/src/internal/building/parseRessource.js +0 -207
- package/src/internal/building/parsing.utils.js +0 -29
- package/src/internal/building/resolve_import_url_helper.js +0 -12
- package/src/internal/building/ressource_builder.js +0 -1097
- package/src/internal/building/ressource_builder_util.js +0 -194
- package/src/internal/building/rollup_plugin_jsenv.js +0 -1963
- package/src/internal/building/sortObjectByPathnames.js +0 -10
- package/src/internal/building/sourcemap_loader.js +0 -73
- package/src/internal/building/svg/parseSvgRessource.js +0 -111
- package/src/internal/building/url_fetcher.js +0 -85
- package/src/internal/building/url_loader.js +0 -127
- package/src/internal/building/url_trace.js +0 -229
- package/src/internal/building/url_versioning.js +0 -65
- package/src/internal/building/webmanifest/parseWebmanifestRessource.js +0 -48
- package/src/internal/compiling/babel_parse_error.js +0 -9
- package/src/internal/compiling/babel_plugin_global_this_as_jsenv_import.js +0 -34
- package/src/internal/compiling/babel_plugin_import_assertions.js +0 -120
- package/src/internal/compiling/babel_plugin_import_metadata.js +0 -18
- package/src/internal/compiling/babel_plugin_import_visitor.js +0 -84
- package/src/internal/compiling/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -113
- package/src/internal/compiling/babel_plugin_proxy_external_imports.js +0 -31
- package/src/internal/compiling/babel_plugin_transform_import_meta.js +0 -134
- package/src/internal/compiling/babel_plugins.js +0 -37
- package/src/internal/compiling/compileFile.js +0 -271
- package/src/internal/compiling/compileHtml.js +0 -544
- package/src/internal/compiling/createCompiledFileService.js +0 -263
- package/src/internal/compiling/html_source_file_service.js +0 -453
- package/src/internal/compiling/js-compilation-service/ansiToHTML.js +0 -9
- package/src/internal/compiling/js-compilation-service/babelHelper.js +0 -145
- package/src/internal/compiling/js-compilation-service/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -48
- package/src/internal/compiling/js-compilation-service/babel_plugin_systemjs_prepend.js +0 -23
- package/src/internal/compiling/js-compilation-service/generateBabelHelper.js +0 -36
- package/src/internal/compiling/js-compilation-service/transformJs.js +0 -196
- package/src/internal/compiling/jsenvCompilerForHtml.js +0 -674
- package/src/internal/compiling/jsenvCompilerForImportmap.js +0 -28
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +0 -61
- package/src/internal/compiling/jsenv_directory/comparison_utils.js +0 -27
- package/src/internal/compiling/jsenv_directory/compile_asset.js +0 -24
- package/src/internal/compiling/jsenv_directory/compile_context.js +0 -60
- package/src/internal/compiling/jsenv_directory/compile_profile.js +0 -217
- package/src/internal/compiling/jsenv_directory/file_lock_registry.js +0 -24
- package/src/internal/compiling/jsenv_directory/file_lock_registry.test.js +0 -47
- package/src/internal/compiling/jsenv_directory/fs-optimized-for-cache.js +0 -57
- package/src/internal/compiling/jsenv_directory/getOrGenerateCompiledFile.js +0 -269
- package/src/internal/compiling/jsenv_directory/jsenv_directory.js +0 -174
- package/src/internal/compiling/jsenv_directory/updateMeta.js +0 -150
- package/src/internal/compiling/jsenv_directory/validateCache.js +0 -264
- package/src/internal/compiling/load_babel_plugin_map_from_file.js +0 -49
- package/src/internal/compiling/rollup_plugin_commonjs_named_exports.js +0 -187
- package/src/internal/compiling/sse_service/sse_service.js +0 -369
- package/src/internal/compiling/startCompileServer.js +0 -518
- package/src/internal/compiling/transformResultToCompilationResult.js +0 -242
- package/src/internal/dataUrl.utils.js +0 -55
- package/src/internal/dev_server/event_source_client/event_source_client.js +0 -63
- package/src/internal/dev_server/event_source_client/file_changes.js +0 -82
- package/src/internal/dev_server/event_source_client/livereload_preference.js +0 -13
- package/src/internal/dev_server/exploring/exploring.css +0 -237
- package/src/internal/dev_server/exploring/exploring.html +0 -79
- package/src/internal/dev_server/exploring/exploring.js +0 -243
- package/src/internal/dev_server/exploring/fetchExploringJson.js +0 -19
- package/src/internal/dev_server/toolbar/compilation/compilation.css +0 -23
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +0 -201
- package/src/internal/dev_server/toolbar/eventsource/toolbar.eventsource.js +0 -83
- package/src/internal/dev_server/toolbar/execution/toolbar.execution.js +0 -91
- package/src/internal/error-stack-remapping/getOriginalCallsites.js +0 -217
- package/src/internal/error-stack-remapping/installBrowserErrorStackRemapping.js +0 -45
- package/src/internal/error-stack-remapping/installErrorStackRemapping.js +0 -141
- package/src/internal/error-stack-remapping/installNodeErrorStackRemapping.js +0 -20
- package/src/internal/error-stack-remapping/remapCallSite.js +0 -314
- package/src/internal/error-stack-remapping/stackToString.js +0 -9
- package/src/internal/escapeRegexpSpecialCharacters.js +0 -34
- package/src/internal/escapeTemplateStringSpecialCharacters.js +0 -20
- package/src/internal/executing/coverage/babel_plugin_instrument.js +0 -90
- package/src/internal/executing/coverage/reportToCoverage.js +0 -198
- package/src/internal/executing/coverage_missing/createEmptyCoverage.js +0 -6
- package/src/internal/executing/coverage_missing/list_files_not_covered.js +0 -20
- package/src/internal/executing/coverage_missing/missing_coverage.js +0 -46
- package/src/internal/executing/coverage_missing/relativeUrlToEmptyCoverage.js +0 -63
- package/src/internal/executing/coverage_reporter/coverage_reporter_html_directory.js +0 -36
- package/src/internal/executing/coverage_reporter/coverage_reporter_json_file.js +0 -22
- package/src/internal/executing/coverage_reporter/coverage_reporter_text_log.js +0 -19
- package/src/internal/executing/coverage_reporter/istanbulCoverageMapFromCoverage.js +0 -16
- package/src/internal/executing/coverage_utils/file_by_file_coverage.js +0 -28
- package/src/internal/executing/coverage_utils/istanbul_coverage_composition.js +0 -28
- package/src/internal/executing/coverage_utils/v8_and_istanbul.js +0 -38
- package/src/internal/executing/coverage_utils/v8_coverage_composition.js +0 -23
- package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +0 -86
- package/src/internal/executing/coverage_utils/v8_coverage_to_istanbul.js +0 -100
- package/src/internal/executing/createSummaryLog.js +0 -143
- package/src/internal/executing/executionIsPassed.js +0 -2
- package/src/internal/executing/executionLogs.js +0 -159
- package/src/internal/executing/generateExecutionSteps.js +0 -29
- package/src/internal/executing/launchAndExecute.js +0 -458
- package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +0 -20
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +0 -23
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +0 -25
- package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +0 -37
- package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +0 -9
- package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +0 -14
- package/src/internal/features/browser_feature_detection/browser_feature_detection.js +0 -89
- package/src/internal/features/browser_feature_detection/compile_proxy.html +0 -27
- package/src/internal/features/browser_feature_detection/execute_with_script_module.js +0 -24
- package/src/internal/features/features_compat_from_runtime.js +0 -38
- package/src/internal/features/features_compat_from_runtime_support.js +0 -31
- package/src/internal/features/features_compatibility.js +0 -37
- package/src/internal/features/node_feature_detection/feature_detect_dynamic_import.mjs +0 -5
- package/src/internal/features/node_feature_detection/feature_detect_top_level_await.mjs +0 -1
- package/src/internal/features/node_feature_detection/node_feature_detect_dynamic_import.js +0 -5
- package/src/internal/features/node_feature_detection/node_feature_detect_top_level_await.js +0 -16
- package/src/internal/features/node_feature_detection/node_feature_detection.js +0 -66
- package/src/internal/fetchUrl.js +0 -28
- package/src/internal/filePathUtils.js +0 -19
- package/src/internal/import-resolution/default-extension.js +0 -40
- package/src/internal/import-resolution/import-resolver-importmap.js +0 -64
- package/src/internal/import-resolution/import-resolver-node.js +0 -254
- package/src/internal/import-resolution/importmap_default.js +0 -37
- package/src/internal/jsenvCoreDirectoryUrl.js +0 -11
- package/src/internal/jsenvInternalFiles.js +0 -36
- package/src/internal/jsenv_builds.js +0 -19
- package/src/internal/jsenv_remote_directory.js +0 -156
- package/src/internal/logs/byte.js +0 -10
- package/src/internal/logs/byteAsFileSize.js +0 -9
- package/src/internal/logs/msAsDuration.js +0 -12
- package/src/internal/memoize.js +0 -24
- package/src/internal/node_launcher/node_runtime_report.js +0 -77
- package/src/internal/node_launcher/processOptions.js +0 -46
- package/src/internal/node_runtime/evalSource.js +0 -6
- package/src/internal/node_runtime/fetchSource.js +0 -8
- package/src/internal/node_runtime/node_execution_dynamic_import.js +0 -74
- package/src/internal/node_runtime/node_execution_performance.js +0 -67
- package/src/internal/node_runtime/node_execution_systemjs.js +0 -125
- package/src/internal/node_runtime/node_system.js +0 -191
- package/src/internal/origin_directory_converter.js +0 -62
- package/src/internal/perf_node.js +0 -13
- package/src/internal/promise_race.js +0 -19
- package/src/internal/redirector/redirector.html +0 -40
- package/src/internal/require.js +0 -3
- package/src/internal/response_validation.js +0 -130
- package/src/internal/runtime/module-registration.js +0 -207
- package/src/internal/runtime/s.js +0 -864
- package/src/internal/runtime/s.js.md +0 -1
- package/src/internal/runtime/valueInstall.js +0 -14
- package/src/internal/runtime_support/jsenv_runtime_support.js +0 -15
- package/src/internal/runtime_support/runtime_support.js +0 -70
- package/src/internal/semantic_versioning/findHighestVersion.js +0 -12
- package/src/internal/semantic_versioning/findLowestVersion.js +0 -12
- package/src/internal/semantic_versioning/index.js +0 -5
- package/src/internal/semantic_versioning/valueToVersion.js +0 -44
- package/src/internal/semantic_versioning/versionCompare.js +0 -32
- package/src/internal/semantic_versioning/versionIsAbove.js +0 -5
- package/src/internal/semantic_versioning/versionIsBelow.js +0 -5
- package/src/internal/semantic_versioning/versionIsEqual.js +0 -3
- package/src/internal/sourceMappingURLUtils.js +0 -112
- package/src/internal/url_conversion.js +0 -313
- package/src/internal/url_utils.js +0 -33
- package/src/internal/url_utils.test.js +0 -39
- package/src/jsenvCoverageConfig.js +0 -7
- package/src/jsenvExplorableConfig.js +0 -9
- package/src/jsenvRuntimeSupportDuringDev.js +0 -12
- package/src/jsenvServiceWorkerFinalizer.js +0 -55
- package/src/jsonToJavaScriptModule.js +0 -12
- package/src/launchBrowser.js +0 -43
- package/src/launchNode.js +0 -227
- package/src/playwright_browser_versions.js +0 -5
- package/src/requireUsingChildProcess.js +0 -67
- package/src/textToJavaScriptModule.js +0 -14
|
@@ -1 +0,0 @@
|
|
|
1
|
-
s.js exists to ease jsenv ability to find the file.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const jsenvBrowserRuntimeSupport = {
|
|
2
|
-
android: "0.0.0",
|
|
3
|
-
chrome: "0.0.0",
|
|
4
|
-
edge: "0.0.0",
|
|
5
|
-
electron: "0.0.0",
|
|
6
|
-
firefox: "0.0.0",
|
|
7
|
-
ios: "0.0.0",
|
|
8
|
-
opera: "0.0.0",
|
|
9
|
-
rhino: "0.0.0",
|
|
10
|
-
safari: "0.0.0",
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const jsenvNodeRuntimeSupport = {
|
|
14
|
-
node: "0.0.0",
|
|
15
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { findLowestVersion } from "../semantic_versioning/findLowestVersion.js"
|
|
2
|
-
|
|
3
|
-
export const isNodePartOfSupportedRuntimes = (runtimeSupport) => {
|
|
4
|
-
return Boolean(runtimeSupport.node)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const isBrowserPartOfSupportedRuntimes = (runtimeSupport) => {
|
|
8
|
-
return Boolean(
|
|
9
|
-
runtimeSupport.android ||
|
|
10
|
-
runtimeSupport.chrome ||
|
|
11
|
-
runtimeSupport.edge ||
|
|
12
|
-
runtimeSupport.electron ||
|
|
13
|
-
runtimeSupport.firefox ||
|
|
14
|
-
runtimeSupport.ios ||
|
|
15
|
-
runtimeSupport.opera ||
|
|
16
|
-
runtimeSupport.safari,
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const normalizeRuntimeSupport = (runtimeSupport) => {
|
|
21
|
-
const runtimeSupportNormalized = {}
|
|
22
|
-
|
|
23
|
-
Object.keys(runtimeSupport).forEach((runtimeName) => {
|
|
24
|
-
const runtimeNameNormalized = normalizeRuntimeName(runtimeName)
|
|
25
|
-
const runtimeVersion = normalizeRuntimeVersion(runtimeSupport[runtimeName])
|
|
26
|
-
mergeRuntimeSupport(runtimeSupportNormalized, {
|
|
27
|
-
[runtimeNameNormalized]: runtimeVersion,
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
return runtimeSupportNormalized
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const normalizeRuntimeName = (name) => {
|
|
35
|
-
return runtimeNameMapping[name] || name
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const runtimeNameMapping = {
|
|
39
|
-
chromium: "chrome",
|
|
40
|
-
webkit: "safari",
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const normalizeRuntimeVersion = (version) => {
|
|
44
|
-
if (version.indexOf(".") > -1) {
|
|
45
|
-
const parts = version.split(".")
|
|
46
|
-
// remove extraneous .
|
|
47
|
-
return parts.slice(0, 3).join(".")
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (version.indexOf("_") > -1) {
|
|
51
|
-
const parts = version.split("_")
|
|
52
|
-
// remove extraneous _
|
|
53
|
-
return parts.slice(0, 3).join("_")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return version
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const mergeRuntimeSupport = (runtimeSupport, childRuntimeSupport) => {
|
|
60
|
-
Object.keys(childRuntimeSupport).forEach((runtimeName) => {
|
|
61
|
-
const childRuntimeVersion = normalizeRuntimeVersion(
|
|
62
|
-
childRuntimeSupport[runtimeName],
|
|
63
|
-
)
|
|
64
|
-
const childRuntimeNameNormalized = normalizeRuntimeName(runtimeName)
|
|
65
|
-
const runtimeVersion = runtimeSupport[childRuntimeNameNormalized]
|
|
66
|
-
runtimeSupport[childRuntimeNameNormalized] = runtimeVersion
|
|
67
|
-
? findLowestVersion(runtimeVersion, childRuntimeVersion)
|
|
68
|
-
: childRuntimeVersion
|
|
69
|
-
})
|
|
70
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { versionIsBelow } from "./versionIsBelow.js"
|
|
2
|
-
|
|
3
|
-
export const findHighestVersion = (...values) => {
|
|
4
|
-
if (values.length === 0) throw new Error(`missing argument`)
|
|
5
|
-
|
|
6
|
-
return values.reduce((highestVersion, value) => {
|
|
7
|
-
if (versionIsBelow(highestVersion, value)) {
|
|
8
|
-
return value
|
|
9
|
-
}
|
|
10
|
-
return highestVersion
|
|
11
|
-
})
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { versionIsAbove } from "./versionIsAbove.js"
|
|
2
|
-
|
|
3
|
-
export const findLowestVersion = (...values) => {
|
|
4
|
-
if (values.length === 0) throw new Error(`missing argument`)
|
|
5
|
-
|
|
6
|
-
return values.reduce((lowestVersion, value) => {
|
|
7
|
-
if (versionIsAbove(lowestVersion, value)) {
|
|
8
|
-
return value
|
|
9
|
-
}
|
|
10
|
-
return lowestVersion
|
|
11
|
-
})
|
|
12
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { findLowestVersion } from "./findLowestVersion.js"
|
|
2
|
-
export { findHighestVersion } from "./findHighestVersion.js"
|
|
3
|
-
export { versionIsAbove } from "./versionIsAbove.js"
|
|
4
|
-
export { versionIsBelow } from "./versionIsBelow.js"
|
|
5
|
-
export { versionCompare } from "./versionCompare.js"
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export const valueToVersion = (value) => {
|
|
2
|
-
if (typeof value === "number") {
|
|
3
|
-
return numberToVersion(value)
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
if (typeof value === "string") {
|
|
7
|
-
return stringToVersion(value)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
throw new TypeError(`version must be a number or a string, got ${value}`)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const numberToVersion = (number) => {
|
|
14
|
-
return {
|
|
15
|
-
major: number,
|
|
16
|
-
minor: 0,
|
|
17
|
-
patch: 0,
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const stringToVersion = (string) => {
|
|
22
|
-
if (string.indexOf(".") > -1) {
|
|
23
|
-
const parts = string.split(".")
|
|
24
|
-
return {
|
|
25
|
-
major: Number(parts[0]),
|
|
26
|
-
minor: parts[1] ? Number(parts[1]) : 0,
|
|
27
|
-
patch: parts[2] ? Number(parts[2]) : 0,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (isNaN(string)) {
|
|
32
|
-
return {
|
|
33
|
-
major: 0,
|
|
34
|
-
minor: 0,
|
|
35
|
-
patch: 0,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
major: Number(string),
|
|
41
|
-
minor: 0,
|
|
42
|
-
patch: 0,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { valueToVersion } from "./valueToVersion.js"
|
|
2
|
-
|
|
3
|
-
export const versionCompare = (versionA, versionB) => {
|
|
4
|
-
const semanticVersionA = valueToVersion(versionA)
|
|
5
|
-
const semanticVersionB = valueToVersion(versionB)
|
|
6
|
-
|
|
7
|
-
const majorDiff = semanticVersionA.major - semanticVersionB.major
|
|
8
|
-
if (majorDiff > 0) {
|
|
9
|
-
return majorDiff
|
|
10
|
-
}
|
|
11
|
-
if (majorDiff < 0) {
|
|
12
|
-
return majorDiff
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const minorDiff = semanticVersionA.minor - semanticVersionB.minor
|
|
16
|
-
if (minorDiff > 0) {
|
|
17
|
-
return minorDiff
|
|
18
|
-
}
|
|
19
|
-
if (minorDiff < 0) {
|
|
20
|
-
return minorDiff
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const patchDiff = semanticVersionA.patch - semanticVersionB.patch
|
|
24
|
-
if (patchDiff > 0) {
|
|
25
|
-
return patchDiff
|
|
26
|
-
}
|
|
27
|
-
if (patchDiff < 0) {
|
|
28
|
-
return patchDiff
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return 0
|
|
32
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export const generateSourcemapUrl = (url) => {
|
|
2
|
-
// we want to remove eventual search params from url
|
|
3
|
-
const urlString = String(url)
|
|
4
|
-
const urlObject = new URL(url)
|
|
5
|
-
const origin = urlString.startsWith("file://") ? "file://" : urlObject.origin
|
|
6
|
-
const pathname = urlObject.pathname
|
|
7
|
-
const sourcemapUrl = `${origin}${pathname}.map`
|
|
8
|
-
return sourcemapUrl
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const getJavaScriptSourceMappingUrl = (javaScriptSource) => {
|
|
12
|
-
let sourceMappingUrl
|
|
13
|
-
replaceSourceMappingUrl(
|
|
14
|
-
javaScriptSource,
|
|
15
|
-
javascriptSourceMappingUrlCommentRegexp,
|
|
16
|
-
(value) => {
|
|
17
|
-
sourceMappingUrl = value
|
|
18
|
-
},
|
|
19
|
-
)
|
|
20
|
-
return sourceMappingUrl
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const setJavaScriptSourceMappingUrl = (
|
|
24
|
-
javaScriptSource,
|
|
25
|
-
sourceMappingFileUrl,
|
|
26
|
-
) => {
|
|
27
|
-
let replaced
|
|
28
|
-
const sourceAfterReplace = replaceSourceMappingUrl(
|
|
29
|
-
javaScriptSource,
|
|
30
|
-
javascriptSourceMappingUrlCommentRegexp,
|
|
31
|
-
() => {
|
|
32
|
-
replaced = true
|
|
33
|
-
return sourceMappingFileUrl
|
|
34
|
-
? writeJavaScriptSourceMappingURL(sourceMappingFileUrl)
|
|
35
|
-
: ""
|
|
36
|
-
},
|
|
37
|
-
)
|
|
38
|
-
if (replaced) {
|
|
39
|
-
return sourceAfterReplace
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return sourceMappingFileUrl
|
|
43
|
-
? `${javaScriptSource}
|
|
44
|
-
${writeJavaScriptSourceMappingURL(sourceMappingFileUrl)}`
|
|
45
|
-
: javaScriptSource
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const getCssSourceMappingUrl = (cssSource) => {
|
|
49
|
-
let sourceMappingUrl
|
|
50
|
-
replaceSourceMappingUrl(
|
|
51
|
-
cssSource,
|
|
52
|
-
cssSourceMappingUrlCommentRegExp,
|
|
53
|
-
(value) => {
|
|
54
|
-
sourceMappingUrl = value
|
|
55
|
-
},
|
|
56
|
-
)
|
|
57
|
-
return sourceMappingUrl
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const setCssSourceMappingUrl = (cssSource, sourceMappingFileUrl) => {
|
|
61
|
-
let replaced
|
|
62
|
-
const sourceAfterReplace = replaceSourceMappingUrl(
|
|
63
|
-
cssSource,
|
|
64
|
-
cssSourceMappingUrlCommentRegExp,
|
|
65
|
-
() => {
|
|
66
|
-
replaced = true
|
|
67
|
-
return sourceMappingFileUrl
|
|
68
|
-
? writeCssSourceMappingUrl(sourceMappingFileUrl)
|
|
69
|
-
: ""
|
|
70
|
-
},
|
|
71
|
-
)
|
|
72
|
-
if (replaced) {
|
|
73
|
-
return sourceAfterReplace
|
|
74
|
-
}
|
|
75
|
-
return sourceMappingFileUrl
|
|
76
|
-
? `${cssSource}
|
|
77
|
-
${writeCssSourceMappingUrl(sourceMappingFileUrl)}`
|
|
78
|
-
: cssSource
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const javascriptSourceMappingUrlCommentRegexp =
|
|
82
|
-
/\/\/ ?# ?sourceMappingURL=([^\s'"]+)/g
|
|
83
|
-
const cssSourceMappingUrlCommentRegExp =
|
|
84
|
-
/\/\*# ?sourceMappingURL=([^\s'"]+) \*\//g
|
|
85
|
-
|
|
86
|
-
// ${"//#"} is to avoid a parser thinking there is a sourceMappingUrl for this file
|
|
87
|
-
const writeJavaScriptSourceMappingURL = (value) =>
|
|
88
|
-
`${"//#"} sourceMappingURL=${value}`
|
|
89
|
-
const writeCssSourceMappingUrl = (value) => `/*# sourceMappingURL=${value} */`
|
|
90
|
-
|
|
91
|
-
export const sourcemapToBase64Url = (sourcemap) => {
|
|
92
|
-
const asBase64 = Buffer.from(JSON.stringify(sourcemap)).toString("base64")
|
|
93
|
-
return `data:application/json;charset=utf-8;base64,${asBase64}`
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const replaceSourceMappingUrl = (source, regexp, callback) => {
|
|
97
|
-
let lastSourceMappingUrl
|
|
98
|
-
let matchSourceMappingUrl
|
|
99
|
-
while ((matchSourceMappingUrl = regexp.exec(source))) {
|
|
100
|
-
lastSourceMappingUrl = matchSourceMappingUrl
|
|
101
|
-
}
|
|
102
|
-
if (lastSourceMappingUrl) {
|
|
103
|
-
const index = lastSourceMappingUrl.index
|
|
104
|
-
const before = source.slice(0, index)
|
|
105
|
-
const after = source.slice(index)
|
|
106
|
-
const mappedAfter = after.replace(regexp, (match, firstGroup) => {
|
|
107
|
-
return callback(firstGroup)
|
|
108
|
-
})
|
|
109
|
-
return `${before}${mappedAfter}`
|
|
110
|
-
}
|
|
111
|
-
return source
|
|
112
|
-
}
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveDirectoryUrl,
|
|
3
|
-
urlToRelativeUrl,
|
|
4
|
-
urlIsInsideOf,
|
|
5
|
-
resolveUrl,
|
|
6
|
-
} from "@jsenv/filesystem"
|
|
7
|
-
|
|
8
|
-
// use a fake and predictable compile server origin
|
|
9
|
-
// because rollup will check the dependencies url
|
|
10
|
-
// when computing the file hash
|
|
11
|
-
// https://github.com/rollup/rollup/blob/d6131378f9481a442aeaa6d4e608faf3303366dc/src/Chunk.ts#L483
|
|
12
|
-
// this way file hash remains the same when file content does not change
|
|
13
|
-
const STATIC_COMPILE_SERVER_AUTHORITY = "//jsenv.com"
|
|
14
|
-
|
|
15
|
-
export const createUrlConverter = ({
|
|
16
|
-
projectDirectoryUrl,
|
|
17
|
-
compileServerOrigin,
|
|
18
|
-
compileDirectoryRelativeUrl,
|
|
19
|
-
urlMappings,
|
|
20
|
-
}) => {
|
|
21
|
-
const compileServerOriginForRollup = String(
|
|
22
|
-
new URL(STATIC_COMPILE_SERVER_AUTHORITY, compileServerOrigin),
|
|
23
|
-
).slice(0, -1)
|
|
24
|
-
urlMappings = normalizeUrlMappings(urlMappings, projectDirectoryUrl)
|
|
25
|
-
const mappingsRevertMap = {}
|
|
26
|
-
|
|
27
|
-
const asRollupUrl = (url) => {
|
|
28
|
-
if (url.startsWith(`${compileServerOrigin}/`)) {
|
|
29
|
-
return `${compileServerOriginForRollup}/${url.slice(
|
|
30
|
-
`${compileServerOrigin}/`.length,
|
|
31
|
-
)}`
|
|
32
|
-
}
|
|
33
|
-
return url
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const asProjectUrl = (url) => {
|
|
37
|
-
return projectUrlFromUrl(asServerUrl(url) || url, {
|
|
38
|
-
projectDirectoryUrl,
|
|
39
|
-
compileServerOrigin,
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const asServerUrl = (url) => {
|
|
44
|
-
if (url.startsWith(`${compileServerOriginForRollup}/`)) {
|
|
45
|
-
return `${compileServerOrigin}/${url.slice(
|
|
46
|
-
`${compileServerOriginForRollup}/`.length,
|
|
47
|
-
)}`
|
|
48
|
-
}
|
|
49
|
-
return serverUrlFromUrl(url, { projectDirectoryUrl, compileServerOrigin })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const asCompiledUrl = (url) => {
|
|
53
|
-
const projectCompiledUrl = compiledProjectUrlFromUrl(
|
|
54
|
-
asProjectUrl(url) || url,
|
|
55
|
-
{
|
|
56
|
-
projectDirectoryUrl,
|
|
57
|
-
compileServerOrigin,
|
|
58
|
-
compileDirectoryRelativeUrl,
|
|
59
|
-
},
|
|
60
|
-
)
|
|
61
|
-
return projectCompiledUrl
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const asCompiledServerUrl = (url) => {
|
|
65
|
-
const projectCompiledUrl = asCompiledUrl(url)
|
|
66
|
-
return asServerUrl(projectCompiledUrl)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const asOriginalUrl = (url) => {
|
|
70
|
-
const projectOriginalUrl = originalProjectUrlFromUrl(
|
|
71
|
-
asProjectUrl(url) || url,
|
|
72
|
-
{
|
|
73
|
-
projectDirectoryUrl,
|
|
74
|
-
compileServerOrigin,
|
|
75
|
-
compileDirectoryRelativeUrl,
|
|
76
|
-
},
|
|
77
|
-
)
|
|
78
|
-
const withoutMapping = mappingsRevertMap[projectOriginalUrl]
|
|
79
|
-
return withoutMapping || projectOriginalUrl
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const asOriginalServerUrl = (url) => {
|
|
83
|
-
const projectOriginalUrl = asOriginalUrl(url)
|
|
84
|
-
return projectOriginalUrl ? asServerUrl(projectOriginalUrl) : null
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Url can
|
|
88
|
-
// - come from rollup "load" hook and be compiled
|
|
89
|
-
// - come from rollup "load" hook and be the original url
|
|
90
|
-
// - come from asset builder and be compiled
|
|
91
|
-
// - come from asset builder and be the original url
|
|
92
|
-
// We first want to ensure we are talking about the same url
|
|
93
|
-
// so we get the originalProjectUrl
|
|
94
|
-
// then we should return a mapped url, keeping in mind that
|
|
95
|
-
// if the url was compiled it should remain compiled
|
|
96
|
-
const applyUrlMappings = (url) => {
|
|
97
|
-
const originalProjectUrl = asOriginalUrl(url)
|
|
98
|
-
const urlMapping = urlMappings[originalProjectUrl]
|
|
99
|
-
if (!urlMapping) {
|
|
100
|
-
return url
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
mappingsRevertMap[urlMapping] = originalProjectUrl
|
|
104
|
-
const isInsideProject =
|
|
105
|
-
url === projectDirectoryUrl || urlIsInsideOf(url, projectDirectoryUrl)
|
|
106
|
-
const projectUrl = isInsideProject ? url : asProjectUrl(url)
|
|
107
|
-
const compileDirectoryUrl = resolveUrl(
|
|
108
|
-
compileDirectoryRelativeUrl,
|
|
109
|
-
projectDirectoryUrl,
|
|
110
|
-
)
|
|
111
|
-
const isCompiled =
|
|
112
|
-
projectUrl === compileDirectoryUrl ||
|
|
113
|
-
urlIsInsideOf(projectUrl, compileDirectoryUrl)
|
|
114
|
-
if (isCompiled && isInsideProject) {
|
|
115
|
-
return asCompiledUrl(urlMapping)
|
|
116
|
-
}
|
|
117
|
-
if (isCompiled) {
|
|
118
|
-
return asCompiledServerUrl(urlMapping)
|
|
119
|
-
}
|
|
120
|
-
if (isInsideProject) {
|
|
121
|
-
return asProjectUrl(urlMapping)
|
|
122
|
-
}
|
|
123
|
-
return asServerUrl(urlMapping)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
compileServerOriginForRollup,
|
|
128
|
-
asRollupUrl,
|
|
129
|
-
asProjectUrl,
|
|
130
|
-
asServerUrl,
|
|
131
|
-
|
|
132
|
-
asCompiledUrl,
|
|
133
|
-
asCompiledServerUrl,
|
|
134
|
-
asOriginalUrl,
|
|
135
|
-
asOriginalServerUrl,
|
|
136
|
-
applyUrlMappings,
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const normalizeUrlMappings = (urlMappings, baseUrl) => {
|
|
141
|
-
const urlMappingsNormalized = {}
|
|
142
|
-
Object.keys(urlMappings).forEach((key) => {
|
|
143
|
-
const value = urlMappings[key]
|
|
144
|
-
const keyNormalized = resolveUrl(key, baseUrl)
|
|
145
|
-
const valueNormalized = resolveUrl(value, baseUrl)
|
|
146
|
-
urlMappingsNormalized[keyNormalized] = valueNormalized
|
|
147
|
-
})
|
|
148
|
-
return urlMappingsNormalized
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export const serverUrlToCompileInfo = (
|
|
152
|
-
url,
|
|
153
|
-
{ compileServerOrigin, jsenvDirectoryRelativeUrl },
|
|
154
|
-
) => {
|
|
155
|
-
const jsenvDirectoryServerUrl = resolveDirectoryUrl(
|
|
156
|
-
jsenvDirectoryRelativeUrl,
|
|
157
|
-
compileServerOrigin,
|
|
158
|
-
)
|
|
159
|
-
// not inside compile directory -> nothing to compile
|
|
160
|
-
if (!url.startsWith(jsenvDirectoryServerUrl)) {
|
|
161
|
-
return { insideCompileDirectory: false }
|
|
162
|
-
}
|
|
163
|
-
const afterJsenvDirectory = url.slice(jsenvDirectoryServerUrl.length)
|
|
164
|
-
// serve files inside /.jsenv/* directly without compilation
|
|
165
|
-
// this is just to allow some files to be written inside outDirectory and read directly
|
|
166
|
-
if (!afterJsenvDirectory.includes("/") || afterJsenvDirectory[0] === "/") {
|
|
167
|
-
return { insideCompileDirectory: true }
|
|
168
|
-
}
|
|
169
|
-
const parts = afterJsenvDirectory.split("/")
|
|
170
|
-
const compileId = parts[0]
|
|
171
|
-
// no compileId, we don't know what to compile (not supposed so happen)
|
|
172
|
-
if (compileId === "") {
|
|
173
|
-
return { insideCompileDirectory: true, compileId: null }
|
|
174
|
-
}
|
|
175
|
-
const afterCompileId = parts.slice(1).join("/")
|
|
176
|
-
// note: afterCompileId can be '' (but not supposed to happen)
|
|
177
|
-
return { insideCompileDirectory: true, compileId, afterCompileId }
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// tries to convert an url into an url that is inside projectDirectoryUrl
|
|
181
|
-
const projectUrlFromUrl = (
|
|
182
|
-
url,
|
|
183
|
-
{ projectDirectoryUrl, compileServerOrigin },
|
|
184
|
-
) => {
|
|
185
|
-
if (url.startsWith(projectDirectoryUrl)) {
|
|
186
|
-
return url
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const serverUrl = serverUrlFromUrl(url, {
|
|
190
|
-
projectDirectoryUrl,
|
|
191
|
-
compileServerOrigin,
|
|
192
|
-
})
|
|
193
|
-
if (serverUrl) {
|
|
194
|
-
return `${projectDirectoryUrl}${serverUrl.slice(
|
|
195
|
-
`${compileServerOrigin}/`.length,
|
|
196
|
-
)}`
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return null
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// tries to convert an url into an url that is inside compileServerOrigin
|
|
203
|
-
const serverUrlFromUrl = (
|
|
204
|
-
url,
|
|
205
|
-
{ projectDirectoryUrl, compileServerOrigin },
|
|
206
|
-
) => {
|
|
207
|
-
if (url.startsWith(`${compileServerOrigin}/`)) {
|
|
208
|
-
return url
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (url.startsWith(projectDirectoryUrl)) {
|
|
212
|
-
return `${compileServerOrigin}/${url.slice(projectDirectoryUrl.length)}`
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return null
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// tries to convert an url into an url inside compileServerOrigin
|
|
219
|
-
// AND return the compiled url is the url is the original version
|
|
220
|
-
const compiledProjectUrlFromUrl = (
|
|
221
|
-
url,
|
|
222
|
-
{ projectDirectoryUrl, compileServerOrigin, compileDirectoryRelativeUrl },
|
|
223
|
-
) => {
|
|
224
|
-
const projectUrl = projectUrlFromUrl(url, {
|
|
225
|
-
projectDirectoryUrl,
|
|
226
|
-
compileServerOrigin,
|
|
227
|
-
})
|
|
228
|
-
if (!projectUrl) {
|
|
229
|
-
return null
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const compileDirectoryUrl = resolveUrl(
|
|
233
|
-
compileDirectoryRelativeUrl,
|
|
234
|
-
projectDirectoryUrl,
|
|
235
|
-
)
|
|
236
|
-
if (
|
|
237
|
-
projectUrl === compileDirectoryUrl ||
|
|
238
|
-
urlIsInsideOf(projectUrl, compileDirectoryUrl)
|
|
239
|
-
) {
|
|
240
|
-
return projectUrl
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const projectRelativeUrl = urlToRelativeUrl(projectUrl, projectDirectoryUrl)
|
|
244
|
-
if (projectRelativeUrl) {
|
|
245
|
-
return resolveUrl(projectRelativeUrl, compileDirectoryUrl)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return null
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// tries to convert an url into an url that is inside projectDirectoryUrl
|
|
252
|
-
// AND return the original url if the url is the compiled version
|
|
253
|
-
const originalProjectUrlFromUrl = (
|
|
254
|
-
url,
|
|
255
|
-
{
|
|
256
|
-
projectDirectoryUrl,
|
|
257
|
-
compileServerOrigin,
|
|
258
|
-
jsenvDirectoryRelativeUrl,
|
|
259
|
-
compileDirectoryRelativeUrl,
|
|
260
|
-
},
|
|
261
|
-
) => {
|
|
262
|
-
const projectUrl = projectUrlFromUrl(url, {
|
|
263
|
-
projectDirectoryUrl,
|
|
264
|
-
compileServerOrigin,
|
|
265
|
-
})
|
|
266
|
-
if (!projectUrl) {
|
|
267
|
-
return null
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (!compileDirectoryRelativeUrl) {
|
|
271
|
-
const serverUrl = serverUrlFromUrl(projectUrl, {
|
|
272
|
-
projectDirectoryUrl,
|
|
273
|
-
compileServerOrigin,
|
|
274
|
-
})
|
|
275
|
-
compileDirectoryRelativeUrl = extractCompileDirectoryRelativeUrl({
|
|
276
|
-
serverUrl,
|
|
277
|
-
compileServerOrigin,
|
|
278
|
-
jsenvDirectoryRelativeUrl,
|
|
279
|
-
})
|
|
280
|
-
if (!compileDirectoryRelativeUrl) {
|
|
281
|
-
return projectUrl
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const compileDirectoryUrl = resolveUrl(
|
|
286
|
-
compileDirectoryRelativeUrl,
|
|
287
|
-
projectDirectoryUrl,
|
|
288
|
-
)
|
|
289
|
-
if (projectUrl === compileDirectoryUrl) {
|
|
290
|
-
return projectDirectoryUrl
|
|
291
|
-
}
|
|
292
|
-
if (!urlIsInsideOf(projectUrl, compileDirectoryUrl)) {
|
|
293
|
-
return projectUrl
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const relativeUrl = urlToRelativeUrl(projectUrl, compileDirectoryUrl)
|
|
297
|
-
return resolveUrl(relativeUrl, projectDirectoryUrl)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const extractCompileDirectoryRelativeUrl = ({
|
|
301
|
-
serverUrl,
|
|
302
|
-
compileServerOrigin,
|
|
303
|
-
jsenvDirectoryRelativeUrl,
|
|
304
|
-
}) => {
|
|
305
|
-
const compileInfo = serverUrlToCompileInfo(serverUrl, {
|
|
306
|
-
compileServerOrigin,
|
|
307
|
-
jsenvDirectoryRelativeUrl,
|
|
308
|
-
})
|
|
309
|
-
if (compileInfo.compiledId) {
|
|
310
|
-
return `${jsenvDirectoryRelativeUrl}${compileInfo.compileId}/`
|
|
311
|
-
}
|
|
312
|
-
return null
|
|
313
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { urlToOrigin, urlToRessource, urlToExtension } from "@jsenv/filesystem"
|
|
2
|
-
|
|
3
|
-
export const setUrlExtension = (url, extension) => {
|
|
4
|
-
const origin = urlToOrigin(url)
|
|
5
|
-
const currentExtension = urlToExtension(url)
|
|
6
|
-
const ressource = urlToRessource(url)
|
|
7
|
-
const [pathname, search] = ressource.split("?")
|
|
8
|
-
const pathnameWithoutExtension = currentExtension
|
|
9
|
-
? pathname.slice(0, -currentExtension.length)
|
|
10
|
-
: pathname
|
|
11
|
-
const newPathname = `${pathnameWithoutExtension}${extension}`
|
|
12
|
-
return `${origin}${newPathname}${search ? `?${search}` : ""}`
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const getUrlSearchParamsDescriptor = (url) => {
|
|
16
|
-
const urlObject = new URL(url)
|
|
17
|
-
const { searchParams } = urlObject
|
|
18
|
-
const searchParamsDescriptor = {}
|
|
19
|
-
Array.from(searchParams.keys()).forEach((key) => {
|
|
20
|
-
const value = searchParams.getAll(key)
|
|
21
|
-
searchParamsDescriptor[key] = value.length === 1 ? value[0] : value
|
|
22
|
-
})
|
|
23
|
-
return searchParamsDescriptor
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const setUrlSearchParamsDescriptor = (url, searchParamsDescriptor) => {
|
|
27
|
-
const urlObject = new URL(url)
|
|
28
|
-
const { searchParams } = urlObject
|
|
29
|
-
Object.keys(searchParamsDescriptor).forEach((key) => {
|
|
30
|
-
searchParams.set(key, searchParamsDescriptor[key])
|
|
31
|
-
})
|
|
32
|
-
return String(urlObject)
|
|
33
|
-
}
|