@jsenv/core 26.0.1 → 27.0.0-alpha.2
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 +17 -24
- package/package.json +35 -71
- package/readme.md +30 -37
- 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 → 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 → dev/plugins/toolbar/client}/focus/toolbar_focus.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/jsenv_logo.svg +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/notification/toolbar_notification.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/responsive/overflow_menu.css +0 -0
- package/src/{internal/dev_server/toolbar → 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 → dev/plugins/toolbar/client}/settings/toolbar_settings.js +1 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/jsenv_theme.css +1 -15
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/light_theme.css +0 -17
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/theme/toolbar_theme.js +0 -0
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar.html +40 -199
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_injector.js +8 -28
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.css +0 -24
- package/src/{internal/dev_server/toolbar → dev/plugins/toolbar/client}/toolbar_main.js +10 -56
- 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 → dev/plugins/toolbar/client/util}/fetch_using_xhr.js +0 -0
- 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 → 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/{browser_runtimes.js → execute/runtimes/browsers/webkit.js} +4 -18
- package/src/{internal/node_launcher/child_process_options.js → execute/runtimes/node/child_exec_options.js} +25 -36
- package/src/{internal/node_launcher/node_controllable_file.mjs → execute/runtimes/node/controllable_file.mjs} +1 -18
- package/src/{internal/node_launcher/node_controllable_process.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 +3 -1
- 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/compile_server/js → omega/core_plugins/babel/babel_helper}/babel_plugin_babel_helpers_as_jsenv_imports.js +15 -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_client → omega/core_plugins/html_supervisor/client}/error_in_document.js +10 -16
- package/src/{internal/browser_client → omega/core_plugins/html_supervisor/client}/error_in_notification.js +0 -0
- 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/browser_client → omega/core_plugins/html_supervisor/client}/perf_browser.js +0 -0
- package/src/{internal/runtime_client → omega/core_plugins/html_supervisor/client}/uneval_exception.js +0 -0
- 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/import_assertions → 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 → test}/execute_plan.js +154 -211
- package/src/{execute_test_plan.js → test/execute_test_plan.js} +26 -81
- package/src/{internal/executing → test}/execution_colors.js +0 -0
- package/src/{internal/executing → test}/execution_steps.js +2 -8
- package/src/{internal/executing → test}/gc.js +0 -0
- package/src/test/logs_file_execution.js +223 -0
- package/dist/browser_client/asset-manifest.json +0 -4
- package/dist/browser_client/browser_client_fb33eaa4.js +0 -5320
- package/dist/browser_client/browser_client_fb33eaa4.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_651d1e7b.js.map +0 -343
- package/dist/compile_proxy/compile_proxy_62f952c4.html +0 -2245
- 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_171e07b4.js.map +0 -349
- package/dist/redirector/redirector_8117ec92.html +0 -2290
- 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_5bff0336.map +0 -12
- package/dist/toolbar/assets/overflow_menu.css_9a0fc3d8.map +0 -12
- package/dist/toolbar/assets/settings.css_942b5a9e.map +0 -12
- package/dist/toolbar/assets/toolbar_main.css_b1c67dd7.map +0 -28
- package/dist/toolbar/assets/tooltip.css_a94a8bdd.map +0 -12
- package/dist/toolbar/toolbar_b0c9100c.html +0 -4976
- package/dist/toolbar/toolbar_main_f54c1bb0.js.map +0 -776
- package/dist/toolbar_injector/asset-manifest.json +0 -5
- package/dist/toolbar_injector/assets/jsenv_logo_192011c2.svg +0 -95
- package/dist/toolbar_injector/toolbar_injector_65b501eb.js +0 -976
- package/dist/toolbar_injector/toolbar_injector_65b501eb.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/build_project.js +0 -336
- package/src/commonjs_to_js_module.js +0 -180
- package/src/dev_server.js +0 -302
- package/src/execute.js +0 -184
- package/src/import_using_child_process.js +0 -68
- package/src/internal/browser_client/browser_client.js +0 -220
- package/src/internal/browser_client/browser_client_factory.js +0 -144
- package/src/internal/browser_client/browser_error_stack_remap.js +0 -43
- package/src/internal/browser_client/browser_system.js +0 -216
- package/src/internal/browser_client/module_namespace_transfer.js +0 -90
- package/src/internal/browser_detection/browser_detection.js +0 -65
- package/src/internal/browser_detection/detect_android.js +0 -13
- package/src/internal/browser_detection/detect_chrome.js +0 -28
- package/src/internal/browser_detection/detect_edge.js +0 -13
- package/src/internal/browser_detection/detect_electron.js +0 -1
- package/src/internal/browser_detection/detect_firefox.js +0 -17
- package/src/internal/browser_detection/detect_internet_explorer.js +0 -14
- package/src/internal/browser_detection/detect_ios.js +0 -19
- package/src/internal/browser_detection/detect_opera.js +0 -27
- package/src/internal/browser_detection/detect_safari.js +0 -13
- package/src/internal/browser_detection/user_agent_data.js +0 -25
- 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/execute_html_file.js +0 -355
- package/src/internal/browser_launcher/from_playwright.js +0 -320
- package/src/internal/browser_launcher/page_errors_and_logs.js +0 -77
- package/src/internal/browser_utils/fetch_and_eval.js +0 -27
- package/src/internal/browser_utils/fetch_and_eval_using_script.js +0 -47
- package/src/internal/browser_utils/fetch_browser.js +0 -34
- package/src/internal/browser_utils/fetch_json.js +0 -7
- package/src/internal/building/build_logs.js +0 -134
- package/src/internal/building/build_stats.js +0 -100
- package/src/internal/building/build_url_generator.js +0 -153
- package/src/internal/building/build_using_rollup.js +0 -359
- package/src/internal/building/css/apply_post_css.js +0 -55
- package/src/internal/building/css/jsenv_parse_css.js +0 -260
- package/src/internal/building/css/move_css_urls.js +0 -44
- package/src/internal/building/css/parse_css_urls.js +0 -38
- package/src/internal/building/css/postcss_plugin_url_visitor.js +0 -245
- package/src/internal/building/css/replace_css_urls.js +0 -68
- package/src/internal/building/global_format/es_to_system.js +0 -34
- package/src/internal/building/html/html_node_mutations.js +0 -29
- package/src/internal/building/html/html_scan.js +0 -70
- package/src/internal/building/html/jsenv_parse_html.js +0 -813
- package/src/internal/building/html/minify_html.js +0 -7
- package/src/internal/building/import_assertions/css_module.js +0 -43
- package/src/internal/building/import_references.js +0 -80
- package/src/internal/building/importmap/jsenv_parse_importmap.js +0 -28
- package/src/internal/building/js/babel_plugin_inline_worker_imports.js +0 -96
- package/src/internal/building/js/jsenv_parse_js.js +0 -122
- package/src/internal/building/js/minify_js.js +0 -33
- package/src/internal/building/js/transform_worker.js +0 -55
- package/src/internal/building/json/jsenv_parse_json.js +0 -11
- package/src/internal/building/parse_ressource.js +0 -207
- package/src/internal/building/ressource_builder.js +0 -1098
- package/src/internal/building/ressource_builder_util.js +0 -194
- package/src/internal/building/rollup_plugin_jsenv.js +0 -1965
- package/src/internal/building/sort_pathnames.js +0 -10
- package/src/internal/building/sourcemap/sourcemap_loader.js +0 -70
- package/src/internal/building/svg/jsenv_parse_svg.js +0 -112
- 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/resolve_import_url_helper.js +0 -12
- package/src/internal/building/url_versioning/url_versioning.js +0 -65
- package/src/internal/building/webmanifest/jsenv_parse_webmanifest.js +0 -48
- package/src/internal/compile_server/commonjs/rollup_plugin_commonjs_named_exports.js +0 -187
- package/src/internal/compile_server/compile_file.js +0 -273
- package/src/internal/compile_server/compile_server.js +0 -519
- package/src/internal/compile_server/compiled_file_service.js +0 -264
- package/src/internal/compile_server/html/html_ast.js +0 -534
- package/src/internal/compile_server/html/html_source_file_service.js +0 -453
- package/src/internal/compile_server/html/jsenv_compile_html.js +0 -674
- package/src/internal/compile_server/importmap/jsenv_compile_importmap.js +0 -28
- package/src/internal/compile_server/js/ansi_to_html.js +0 -9
- package/src/internal/compile_server/js/babelHelper.js +0 -145
- package/src/internal/compile_server/js/babel_parse_error.js +0 -9
- package/src/internal/compile_server/js/babel_plugin_global_this_as_jsenv_import.js +0 -34
- package/src/internal/compile_server/js/babel_plugin_import_assertions.js +0 -121
- package/src/internal/compile_server/js/babel_plugin_import_metadata.js +0 -18
- package/src/internal/compile_server/js/babel_plugin_import_visitor.js +0 -84
- package/src/internal/compile_server/js/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -113
- package/src/internal/compile_server/js/babel_plugin_proxy_external_imports.js +0 -31
- package/src/internal/compile_server/js/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -48
- package/src/internal/compile_server/js/babel_plugin_replace_expressions.js +0 -101
- package/src/internal/compile_server/js/babel_plugin_systemjs_prepend.js +0 -23
- package/src/internal/compile_server/js/babel_plugin_transform_import_meta.js +0 -134
- package/src/internal/compile_server/js/babel_plugins.js +0 -37
- package/src/internal/compile_server/js/generateBabelHelper.js +0 -36
- package/src/internal/compile_server/js/js_transformer.js +0 -195
- package/src/internal/compile_server/js/jsenv_compile_js.js +0 -62
- package/src/internal/compile_server/js/load_babel_plugin_map_from_file.js +0 -49
- package/src/internal/compile_server/jsenv_directory/comparison_utils.js +0 -27
- package/src/internal/compile_server/jsenv_directory/compilation_result.js +0 -243
- package/src/internal/compile_server/jsenv_directory/compilation_result_from_build.js +0 -184
- package/src/internal/compile_server/jsenv_directory/compile_asset.js +0 -24
- package/src/internal/compile_server/jsenv_directory/compile_context.js +0 -60
- package/src/internal/compile_server/jsenv_directory/compile_profile.js +0 -217
- package/src/internal/compile_server/jsenv_directory/file_lock_registry.js +0 -24
- package/src/internal/compile_server/jsenv_directory/file_lock_registry.test.js +0 -47
- package/src/internal/compile_server/jsenv_directory/fs_optimized_for_cache.js +0 -57
- package/src/internal/compile_server/jsenv_directory/jsenv_directory.js +0 -183
- package/src/internal/compile_server/jsenv_directory/reuse_or_create_compiled_file.js +0 -269
- package/src/internal/compile_server/jsenv_directory/update_compile_cache.js +0 -131
- package/src/internal/compile_server/jsenv_directory/validate_compile_cache.js +0 -264
- package/src/internal/compile_server/sse_service/sse_service.js +0 -369
- package/src/internal/coverage/babel_plugin_instrument.js +0 -90
- package/src/internal/coverage/coverage_reporter_html_directory.js +0 -37
- package/src/internal/coverage/coverage_reporter_json_file.js +0 -22
- package/src/internal/coverage/coverage_reporter_text_log.js +0 -20
- package/src/internal/coverage/empty_coverage_factory.js +0 -70
- package/src/internal/coverage/file_by_file_coverage.js +0 -28
- package/src/internal/coverage/istanbul_coverage_composition.js +0 -28
- package/src/internal/coverage/istanbul_coverage_map_from_coverage.js +0 -16
- package/src/internal/coverage/list_files_not_covered.js +0 -20
- package/src/internal/coverage/missing_coverage.js +0 -46
- package/src/internal/coverage/report_to_coverage.js +0 -198
- package/src/internal/coverage/v8_and_istanbul.js +0 -38
- package/src/internal/coverage/v8_coverage_composition.js +0 -23
- package/src/internal/coverage/v8_coverage_from_directory.js +0 -86
- package/src/internal/coverage/v8_coverage_to_istanbul.js +0 -100
- package/src/internal/data_url.js +0 -54
- 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/fetch_exploring_json.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 -202
- 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_remap/install_error_stack_remapping.js +0 -142
- package/src/internal/error_stack_remap/remap_call_site.js +0 -315
- package/src/internal/error_stack_remap/remap_stack.js +0 -218
- package/src/internal/error_stack_remap/stringify_stack.js +0 -9
- package/src/internal/executing/launch_and_execute.js +0 -458
- package/src/internal/executing/logs_file_execution.js +0 -160
- package/src/internal/executing/logs_plan_summary.js +0 -144
- 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/fetching.js +0 -28
- 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/jsenv_builds.js +0 -19
- package/src/internal/jsenv_params_assertions.js +0 -12
- package/src/internal/jsenv_remote_directory.js +0 -156
- package/src/internal/logs/byte.js +0 -10
- package/src/internal/logs/byte_as_file_size.js +0 -9
- package/src/internal/logs/ms_as_duration.js +0 -12
- package/src/internal/memoize.js +0 -24
- package/src/internal/node_launcher/eval_source.js +0 -6
- package/src/internal/node_launcher/fetch_source.js +0 -8
- package/src/internal/node_launcher/node_error_stack_remap.js +0 -22
- package/src/internal/node_launcher/node_execution_dynamic_import.js +0 -75
- package/src/internal/node_launcher/node_execution_performance.js +0 -67
- package/src/internal/node_launcher/node_execution_systemjs.js +0 -125
- package/src/internal/node_launcher/node_runtime_report.js +0 -77
- package/src/internal/node_launcher/node_system.js +0 -192
- package/src/internal/node_launcher/perf_node.js +0 -13
- package/src/internal/node_launcher/process_options.js +0 -46
- package/src/internal/node_launcher/value_install.js +0 -14
- package/src/internal/origin_directory_converter.js +0 -62
- package/src/internal/promise_race.js +0 -19
- package/src/internal/redirector/redirector.html +0 -40
- package/src/internal/regexp_escape.js +0 -34
- package/src/internal/require.js +0 -3
- package/src/internal/response_validation.js +0 -130
- package/src/internal/runtime_client/module_registration.js +0 -207
- package/src/internal/runtime_client/s.js +0 -864
- package/src/internal/runtime_client/s.js.md +0 -1
- 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/compare_versions.js +0 -28
- package/src/internal/semantic_versioning/highest_version.js +0 -11
- package/src/internal/semantic_versioning/is_above.js +0 -5
- package/src/internal/semantic_versioning/is_below.js +0 -5
- package/src/internal/semantic_versioning/is_equal.js +0 -3
- package/src/internal/semantic_versioning/lowest_version.js +0 -11
- package/src/internal/semantic_versioning/version_from_value.js +0 -42
- package/src/internal/sourcemap_utils.js +0 -112
- package/src/internal/template_string_escape.js +0 -20
- 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/internal/windows_file_path_utils.js +0 -16
- package/src/jsenv_file_urls.js +0 -35
- package/src/jsenv_service_worker_finalizer.js +0 -55
- package/src/json_to_js_module.js +0 -13
- package/src/node_runtime.js +0 -227
- package/src/require_using_child_process.js +0 -67
- package/src/text_to_js_module.js +0 -13
|
@@ -1,674 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveUrl,
|
|
3
|
-
urlToFilename,
|
|
4
|
-
urlToRelativeUrl,
|
|
5
|
-
urlIsInsideOf,
|
|
6
|
-
} from "@jsenv/filesystem"
|
|
7
|
-
import { moveImportMap, composeTwoImportMaps } from "@jsenv/importmap"
|
|
8
|
-
import { createDetailedMessage } from "@jsenv/logger"
|
|
9
|
-
|
|
10
|
-
import { jsenvDistDirectoryUrl } from "@jsenv/core/src/jsenv_file_urls.js"
|
|
11
|
-
import {
|
|
12
|
-
BROWSER_CLIENT_BUILD_URL,
|
|
13
|
-
EVENT_SOURCE_CLIENT_BUILD_URL,
|
|
14
|
-
TOOLBAR_INJECTOR_BUILD_URL,
|
|
15
|
-
} from "@jsenv/core/dist/build_manifest.js"
|
|
16
|
-
import { fetchUrl } from "@jsenv/core/src/internal/fetching.js"
|
|
17
|
-
import { getDefaultImportmap } from "@jsenv/core/src/internal/import_resolution/importmap_default.js"
|
|
18
|
-
import { generateCompilationAssetUrl } from "@jsenv/core/src/internal/compile_server/jsenv_directory/compile_asset.js"
|
|
19
|
-
import {
|
|
20
|
-
generateSourcemapUrl,
|
|
21
|
-
setJavaScriptSourceMappingUrl,
|
|
22
|
-
sourcemapToBase64Url,
|
|
23
|
-
} from "@jsenv/core/src/internal/sourcemap_utils.js"
|
|
24
|
-
|
|
25
|
-
import { transformJs } from "../js/js_transformer.js"
|
|
26
|
-
import {
|
|
27
|
-
parseHtmlString,
|
|
28
|
-
parseHtmlAstRessources,
|
|
29
|
-
collectHtmlDependenciesFromAst,
|
|
30
|
-
manipulateHtmlAst,
|
|
31
|
-
stringifyHtmlAst,
|
|
32
|
-
getHtmlNodeAttributeByName,
|
|
33
|
-
getHtmlNodeTextNode,
|
|
34
|
-
getIdForInlineHtmlNode,
|
|
35
|
-
removeHtmlNodeAttribute,
|
|
36
|
-
setHtmlNodeText,
|
|
37
|
-
visitHtmlAst,
|
|
38
|
-
addHtmlNodeAttribute,
|
|
39
|
-
} from "./html_ast.js"
|
|
40
|
-
|
|
41
|
-
export const compileHtml = async ({
|
|
42
|
-
// cancellationToken,
|
|
43
|
-
logger,
|
|
44
|
-
url,
|
|
45
|
-
compiledUrl,
|
|
46
|
-
projectDirectoryUrl,
|
|
47
|
-
jsenvRemoteDirectory,
|
|
48
|
-
compileServerOrigin,
|
|
49
|
-
jsenvDirectoryRelativeUrl,
|
|
50
|
-
|
|
51
|
-
compileProfile,
|
|
52
|
-
compileId,
|
|
53
|
-
babelPluginMap,
|
|
54
|
-
topLevelAwait,
|
|
55
|
-
jsenvScriptInjection = true,
|
|
56
|
-
jsenvEventSourceClientInjection,
|
|
57
|
-
jsenvToolbarInjection,
|
|
58
|
-
onHtmlImportmapInfo,
|
|
59
|
-
|
|
60
|
-
sourcemapMethod,
|
|
61
|
-
code,
|
|
62
|
-
}) => {
|
|
63
|
-
const compileDirectoryUrl = `${projectDirectoryUrl}${jsenvDirectoryRelativeUrl}${compileId}/`
|
|
64
|
-
const browserClientBuildUrlRelativeToProject = urlToRelativeUrl(
|
|
65
|
-
BROWSER_CLIENT_BUILD_URL,
|
|
66
|
-
projectDirectoryUrl,
|
|
67
|
-
)
|
|
68
|
-
const eventSourceClientBuildRelativeUrlForProject = urlToRelativeUrl(
|
|
69
|
-
EVENT_SOURCE_CLIENT_BUILD_URL,
|
|
70
|
-
projectDirectoryUrl,
|
|
71
|
-
)
|
|
72
|
-
const toolbarInjectorBuildRelativeUrlForProject = urlToRelativeUrl(
|
|
73
|
-
TOOLBAR_INJECTOR_BUILD_URL,
|
|
74
|
-
projectDirectoryUrl,
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
// ideally we should try/catch html syntax error
|
|
78
|
-
const htmlAst = parseHtmlString(code)
|
|
79
|
-
manipulateHtmlAst(htmlAst, {
|
|
80
|
-
scriptInjections: [
|
|
81
|
-
...(jsenvScriptInjection
|
|
82
|
-
? [
|
|
83
|
-
{
|
|
84
|
-
src: `/${browserClientBuildUrlRelativeToProject}`,
|
|
85
|
-
},
|
|
86
|
-
]
|
|
87
|
-
: []),
|
|
88
|
-
...(jsenvEventSourceClientInjection
|
|
89
|
-
? [
|
|
90
|
-
{
|
|
91
|
-
src: `/${eventSourceClientBuildRelativeUrlForProject}`,
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
: []),
|
|
95
|
-
...(jsenvToolbarInjection
|
|
96
|
-
? [
|
|
97
|
-
{
|
|
98
|
-
src: `/${toolbarInjectorBuildRelativeUrlForProject}`,
|
|
99
|
-
defer: "",
|
|
100
|
-
async: "",
|
|
101
|
-
},
|
|
102
|
-
]
|
|
103
|
-
: []),
|
|
104
|
-
],
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
const sources = []
|
|
108
|
-
const sourcesContent = []
|
|
109
|
-
const assets = []
|
|
110
|
-
const assetsContent = []
|
|
111
|
-
|
|
112
|
-
const addHtmlSourceFile = ({ url, content }) => {
|
|
113
|
-
sources.push(url)
|
|
114
|
-
sourcesContent.push(content)
|
|
115
|
-
}
|
|
116
|
-
addHtmlSourceFile({ url, content: code })
|
|
117
|
-
|
|
118
|
-
const { scripts } = parseHtmlAstRessources(htmlAst)
|
|
119
|
-
const htmlDependencies = collectHtmlDependenciesFromAst(htmlAst)
|
|
120
|
-
|
|
121
|
-
const htmlAssetGenerators = []
|
|
122
|
-
const htmlMutations = []
|
|
123
|
-
const addHtmlAssetGenerator = (htmlAssetGenerator) => {
|
|
124
|
-
htmlAssetGenerators.push(htmlAssetGenerator)
|
|
125
|
-
}
|
|
126
|
-
const addHtmlMutation = (htmlMutation) => {
|
|
127
|
-
htmlMutations.push(htmlMutation)
|
|
128
|
-
}
|
|
129
|
-
const addHtmlDependency = ({ htmlNode, specifier }) => {
|
|
130
|
-
htmlDependencies.push({
|
|
131
|
-
htmlNode,
|
|
132
|
-
specifier,
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
if (compileProfile.moduleOutFormat !== "esmodule") {
|
|
136
|
-
const ressourceHints = collectRessourceHints(htmlAst)
|
|
137
|
-
await visitRessourceHints({
|
|
138
|
-
ressourceHints,
|
|
139
|
-
addHtmlMutation,
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
await visitImportmapScripts({
|
|
143
|
-
logger,
|
|
144
|
-
url,
|
|
145
|
-
compiledUrl,
|
|
146
|
-
projectDirectoryUrl,
|
|
147
|
-
compileDirectoryUrl,
|
|
148
|
-
|
|
149
|
-
compileProfile,
|
|
150
|
-
|
|
151
|
-
htmlAst,
|
|
152
|
-
scripts,
|
|
153
|
-
addHtmlMutation,
|
|
154
|
-
addHtmlSourceFile,
|
|
155
|
-
onHtmlImportmapInfo,
|
|
156
|
-
})
|
|
157
|
-
await visitScripts({
|
|
158
|
-
logger,
|
|
159
|
-
projectDirectoryUrl,
|
|
160
|
-
jsenvRemoteDirectory,
|
|
161
|
-
compileServerOrigin,
|
|
162
|
-
url,
|
|
163
|
-
compiledUrl,
|
|
164
|
-
|
|
165
|
-
compileProfile,
|
|
166
|
-
babelPluginMap,
|
|
167
|
-
topLevelAwait,
|
|
168
|
-
sourcemapMethod,
|
|
169
|
-
|
|
170
|
-
scripts,
|
|
171
|
-
addHtmlSourceFile,
|
|
172
|
-
addHtmlAssetGenerator,
|
|
173
|
-
addHtmlMutation,
|
|
174
|
-
addHtmlDependency,
|
|
175
|
-
})
|
|
176
|
-
await Promise.all(
|
|
177
|
-
htmlAssetGenerators.map(async (htmlAssetGenerator) => {
|
|
178
|
-
const assetInfos = await htmlAssetGenerator()
|
|
179
|
-
assetInfos.forEach((assetInfo) => {
|
|
180
|
-
assets.push(assetInfo.url)
|
|
181
|
-
assetsContent.push(assetInfo.content)
|
|
182
|
-
})
|
|
183
|
-
}),
|
|
184
|
-
)
|
|
185
|
-
htmlAssetGenerators.length = 0
|
|
186
|
-
htmlMutations.forEach((htmlMutation) => {
|
|
187
|
-
htmlMutation()
|
|
188
|
-
})
|
|
189
|
-
htmlMutations.length = 0
|
|
190
|
-
const htmlAfterTransformation = stringifyHtmlAst(htmlAst)
|
|
191
|
-
return {
|
|
192
|
-
contentType: "text/html",
|
|
193
|
-
compiledSource: htmlAfterTransformation,
|
|
194
|
-
sources,
|
|
195
|
-
sourcesContent,
|
|
196
|
-
assets,
|
|
197
|
-
assetsContent,
|
|
198
|
-
dependencies: htmlDependencies.map(({ specifier }) => {
|
|
199
|
-
return specifier
|
|
200
|
-
}),
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// transform <link type="modulepreload"> into <link type="preload">
|
|
205
|
-
// also remove integrity attributes because we don't know in advance
|
|
206
|
-
// the result of the file compilation
|
|
207
|
-
const visitRessourceHints = async ({ ressourceHints, addHtmlMutation }) => {
|
|
208
|
-
await Promise.all(
|
|
209
|
-
ressourceHints.map(async (ressourceHint) => {
|
|
210
|
-
const hrefAttribute = getHtmlNodeAttributeByName(ressourceHint, "href")
|
|
211
|
-
const href = hrefAttribute ? hrefAttribute.value : ""
|
|
212
|
-
if (!href) {
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
const integrityAttribute = getHtmlNodeAttributeByName(
|
|
216
|
-
ressourceHint,
|
|
217
|
-
"integrity",
|
|
218
|
-
)
|
|
219
|
-
if (integrityAttribute) {
|
|
220
|
-
addHtmlMutation(() => {
|
|
221
|
-
removeHtmlNodeAttribute(ressourceHint, integrityAttribute)
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
const relAttribute = getHtmlNodeAttributeByName(ressourceHint, "rel")
|
|
225
|
-
const asAttribute = getHtmlNodeAttributeByName(ressourceHint, "as")
|
|
226
|
-
// - "modulepreload" -> "preload" because it's now regular js script
|
|
227
|
-
if (ressourceHint.rel === "modulepreload") {
|
|
228
|
-
addHtmlMutation(() => {
|
|
229
|
-
relAttribute.value = "preload"
|
|
230
|
-
if (asAttribute) {
|
|
231
|
-
asAttribute.value = "script"
|
|
232
|
-
} else {
|
|
233
|
-
addHtmlNodeAttribute(ressourceHint, { name: "as", value: "script" })
|
|
234
|
-
}
|
|
235
|
-
})
|
|
236
|
-
return
|
|
237
|
-
}
|
|
238
|
-
// if (asAttribute && asAttribute.value === "script") {
|
|
239
|
-
// addHtmlMutation(() => {
|
|
240
|
-
// replaceHtmlNode(htmlNode, `<link as="script" />`)
|
|
241
|
-
// })
|
|
242
|
-
// return
|
|
243
|
-
// }
|
|
244
|
-
}),
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const visitImportmapScripts = async ({
|
|
249
|
-
logger,
|
|
250
|
-
url,
|
|
251
|
-
compiledUrl,
|
|
252
|
-
projectDirectoryUrl,
|
|
253
|
-
compileDirectoryUrl,
|
|
254
|
-
|
|
255
|
-
compileProfile,
|
|
256
|
-
|
|
257
|
-
htmlAst,
|
|
258
|
-
scripts,
|
|
259
|
-
addHtmlMutation,
|
|
260
|
-
addHtmlSourceFile,
|
|
261
|
-
onHtmlImportmapInfo,
|
|
262
|
-
}) => {
|
|
263
|
-
const importmapScripts = scripts.filter((script) => {
|
|
264
|
-
const typeAttribute = getHtmlNodeAttributeByName(script, "type")
|
|
265
|
-
const type = typeAttribute ? typeAttribute.value : "application/javascript"
|
|
266
|
-
return type === "importmap"
|
|
267
|
-
})
|
|
268
|
-
const jsenvImportmap = getDefaultImportmap(compiledUrl, {
|
|
269
|
-
projectDirectoryUrl,
|
|
270
|
-
compileDirectoryUrl,
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
// in case there is no importmap, force the presence
|
|
274
|
-
// so that '@jsenv/core/' are still remapped
|
|
275
|
-
if (importmapScripts.length === 0) {
|
|
276
|
-
const defaultImportMapAsText = JSON.stringify(jsenvImportmap, null, " ")
|
|
277
|
-
onHtmlImportmapInfo({
|
|
278
|
-
url: compiledUrl,
|
|
279
|
-
text: defaultImportMapAsText,
|
|
280
|
-
})
|
|
281
|
-
addHtmlMutation(() => {
|
|
282
|
-
manipulateHtmlAst(htmlAst, {
|
|
283
|
-
scriptInjections: [
|
|
284
|
-
{
|
|
285
|
-
type:
|
|
286
|
-
compileProfile.moduleOutFormat === "systemjs"
|
|
287
|
-
? "systemjs-importmap"
|
|
288
|
-
: "importmap",
|
|
289
|
-
text: defaultImportMapAsText,
|
|
290
|
-
},
|
|
291
|
-
],
|
|
292
|
-
})
|
|
293
|
-
})
|
|
294
|
-
return
|
|
295
|
-
}
|
|
296
|
-
if (importmapScripts.length > 1) {
|
|
297
|
-
logger.error("HTML file must contain max 1 importmap")
|
|
298
|
-
}
|
|
299
|
-
const firstImportmapScript = importmapScripts[0]
|
|
300
|
-
const srcAttribute = getHtmlNodeAttributeByName(firstImportmapScript, "src")
|
|
301
|
-
const src = srcAttribute ? srcAttribute.value : ""
|
|
302
|
-
if (src) {
|
|
303
|
-
const importmapUrl = resolveUrl(src, url)
|
|
304
|
-
const importMapResponse = await fetchUrl(importmapUrl)
|
|
305
|
-
let importmap
|
|
306
|
-
if (importMapResponse.status === 200) {
|
|
307
|
-
const importmapAsText = await importMapResponse.text()
|
|
308
|
-
addHtmlSourceFile({
|
|
309
|
-
url: importmapUrl,
|
|
310
|
-
content: importmapAsText,
|
|
311
|
-
})
|
|
312
|
-
let htmlImportmap = JSON.parse(importmapAsText)
|
|
313
|
-
importmap = moveImportMap(htmlImportmap, importmapUrl, url)
|
|
314
|
-
} else {
|
|
315
|
-
logger.warn(
|
|
316
|
-
createDetailedMessage(
|
|
317
|
-
importMapResponse.status === 404
|
|
318
|
-
? `importmap script file cannot be found.`
|
|
319
|
-
: `importmap script file unexpected response status (${importMapResponse.status}).`,
|
|
320
|
-
{
|
|
321
|
-
"importmap url": importmapUrl,
|
|
322
|
-
"html url": url,
|
|
323
|
-
},
|
|
324
|
-
),
|
|
325
|
-
)
|
|
326
|
-
importmap = {}
|
|
327
|
-
}
|
|
328
|
-
importmap = composeTwoImportMaps(jsenvImportmap, importmap)
|
|
329
|
-
const importmapAsText = JSON.stringify(importmap, null, " ")
|
|
330
|
-
onHtmlImportmapInfo({
|
|
331
|
-
url: importmapUrl,
|
|
332
|
-
text: importmapAsText,
|
|
333
|
-
})
|
|
334
|
-
addHtmlMutation(() => {
|
|
335
|
-
removeHtmlNodeAttribute(firstImportmapScript, srcAttribute)
|
|
336
|
-
setHtmlNodeText(firstImportmapScript, importmapAsText)
|
|
337
|
-
if (compileProfile.moduleOutFormat === "systemjs") {
|
|
338
|
-
const typeAttribute = getHtmlNodeAttributeByName(
|
|
339
|
-
firstImportmapScript,
|
|
340
|
-
"type",
|
|
341
|
-
)
|
|
342
|
-
typeAttribute.value = "systemjs-importmap"
|
|
343
|
-
}
|
|
344
|
-
})
|
|
345
|
-
return
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const htmlImportmap = JSON.parse(
|
|
349
|
-
getHtmlNodeTextNode(firstImportmapScript).value,
|
|
350
|
-
)
|
|
351
|
-
const importmap = composeTwoImportMaps(jsenvImportmap, htmlImportmap)
|
|
352
|
-
const importmapAsText = JSON.stringify(importmap, null, " ")
|
|
353
|
-
onHtmlImportmapInfo({
|
|
354
|
-
url: compiledUrl,
|
|
355
|
-
text: importmapAsText,
|
|
356
|
-
})
|
|
357
|
-
addHtmlMutation(() => {
|
|
358
|
-
removeHtmlNodeAttribute(firstImportmapScript, srcAttribute)
|
|
359
|
-
setHtmlNodeText(firstImportmapScript, importmapAsText)
|
|
360
|
-
if (compileProfile.moduleOutFormat === "systemjs") {
|
|
361
|
-
const typeAttribute = getHtmlNodeAttributeByName(
|
|
362
|
-
firstImportmapScript,
|
|
363
|
-
"type",
|
|
364
|
-
)
|
|
365
|
-
typeAttribute.value = "systemjs-importmap"
|
|
366
|
-
}
|
|
367
|
-
})
|
|
368
|
-
return
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const visitScripts = async ({
|
|
372
|
-
logger,
|
|
373
|
-
projectDirectoryUrl,
|
|
374
|
-
jsenvRemoteDirectory,
|
|
375
|
-
compileServerOrigin,
|
|
376
|
-
url,
|
|
377
|
-
compiledUrl,
|
|
378
|
-
|
|
379
|
-
compileProfile,
|
|
380
|
-
babelPluginMap,
|
|
381
|
-
topLevelAwait,
|
|
382
|
-
sourcemapMethod,
|
|
383
|
-
|
|
384
|
-
scripts,
|
|
385
|
-
addHtmlSourceFile,
|
|
386
|
-
addHtmlAssetGenerator,
|
|
387
|
-
addHtmlMutation,
|
|
388
|
-
addHtmlDependency,
|
|
389
|
-
}) => {
|
|
390
|
-
scripts.forEach((script) => {
|
|
391
|
-
const typeAttribute = getHtmlNodeAttributeByName(script, "type")
|
|
392
|
-
const type = typeAttribute ? typeAttribute.value : "application/javascript"
|
|
393
|
-
const srcAttribute = getHtmlNodeAttributeByName(script, "src")
|
|
394
|
-
const src = srcAttribute ? srcAttribute.value : ""
|
|
395
|
-
const integrityAttribute = getHtmlNodeAttributeByName(script, "integrity")
|
|
396
|
-
const textNode = getHtmlNodeTextNode(script)
|
|
397
|
-
if (type === "module") {
|
|
398
|
-
if (src) {
|
|
399
|
-
addHtmlMutation(() => {
|
|
400
|
-
if (compileProfile.moduleOutFormat === "systemjs") {
|
|
401
|
-
removeHtmlNodeAttribute(script, typeAttribute)
|
|
402
|
-
}
|
|
403
|
-
if (integrityAttribute) {
|
|
404
|
-
removeHtmlNodeAttribute(script, integrityAttribute)
|
|
405
|
-
}
|
|
406
|
-
removeHtmlNodeAttribute(script, srcAttribute)
|
|
407
|
-
const jsenvMethod =
|
|
408
|
-
compileProfile.moduleOutFormat === "systemjs"
|
|
409
|
-
? "executeFileUsingSystemJs"
|
|
410
|
-
: "executeFileUsingDynamicImport"
|
|
411
|
-
let specifier
|
|
412
|
-
if (
|
|
413
|
-
jsenvRemoteDirectory.isRemoteUrl(src) &&
|
|
414
|
-
!jsenvRemoteDirectory.isPreservedUrl(src)
|
|
415
|
-
) {
|
|
416
|
-
const fileUrl = jsenvRemoteDirectory.fileUrlFromRemoteUrl(src)
|
|
417
|
-
const fileUrlRelativeToHtml = urlToRelativeUrl(fileUrl, url)
|
|
418
|
-
specifier = `./${fileUrlRelativeToHtml}`
|
|
419
|
-
} else {
|
|
420
|
-
specifier = src
|
|
421
|
-
}
|
|
422
|
-
setHtmlNodeText(
|
|
423
|
-
script,
|
|
424
|
-
`window.__jsenv__.${jsenvMethod}(${JSON.stringify(specifier)})`,
|
|
425
|
-
)
|
|
426
|
-
})
|
|
427
|
-
return
|
|
428
|
-
}
|
|
429
|
-
const scriptId = getIdForInlineHtmlNode(script, scripts)
|
|
430
|
-
const inlineScriptName = `${scriptId}.js`
|
|
431
|
-
const scriptOriginalUrl = resolveUrl(inlineScriptName, url)
|
|
432
|
-
const scriptCompiledUrl = generateCompilationAssetUrl(
|
|
433
|
-
compiledUrl,
|
|
434
|
-
inlineScriptName,
|
|
435
|
-
)
|
|
436
|
-
addHtmlAssetGenerator(async () => {
|
|
437
|
-
return transformHtmlScript({
|
|
438
|
-
projectDirectoryUrl,
|
|
439
|
-
jsenvRemoteDirectory,
|
|
440
|
-
url: scriptOriginalUrl,
|
|
441
|
-
compiledUrl: scriptCompiledUrl,
|
|
442
|
-
|
|
443
|
-
type: "module",
|
|
444
|
-
compileProfile,
|
|
445
|
-
babelPluginMap,
|
|
446
|
-
topLevelAwait,
|
|
447
|
-
|
|
448
|
-
sourcemapMethod,
|
|
449
|
-
code: textNode.value,
|
|
450
|
-
})
|
|
451
|
-
})
|
|
452
|
-
const specifier = `./${urlToRelativeUrl(scriptCompiledUrl, compiledUrl)}`
|
|
453
|
-
addHtmlMutation(() => {
|
|
454
|
-
if (compileProfile.moduleOutFormat === "systemjs") {
|
|
455
|
-
removeHtmlNodeAttribute(script, typeAttribute)
|
|
456
|
-
}
|
|
457
|
-
removeHtmlNodeAttribute(script, srcAttribute)
|
|
458
|
-
const jsenvMethod =
|
|
459
|
-
compileProfile.moduleOutFormat === "systemjs"
|
|
460
|
-
? "executeFileUsingSystemJs"
|
|
461
|
-
: "executeFileUsingDynamicImport"
|
|
462
|
-
setHtmlNodeText(
|
|
463
|
-
script,
|
|
464
|
-
`window.__jsenv__.${jsenvMethod}(${JSON.stringify(specifier)})`,
|
|
465
|
-
)
|
|
466
|
-
})
|
|
467
|
-
addHtmlDependency({
|
|
468
|
-
htmlNode: script,
|
|
469
|
-
specifier,
|
|
470
|
-
})
|
|
471
|
-
return
|
|
472
|
-
}
|
|
473
|
-
if (type === "application/javascript" || type === "text/javascript") {
|
|
474
|
-
if (src) {
|
|
475
|
-
const htmlServerUrl = url.replace(
|
|
476
|
-
projectDirectoryUrl,
|
|
477
|
-
`${compileServerOrigin}/`,
|
|
478
|
-
)
|
|
479
|
-
const scriptOriginalServerUrl = resolveUrl(src, htmlServerUrl)
|
|
480
|
-
const scriptOriginalUrl = scriptOriginalServerUrl.replace(
|
|
481
|
-
`${compileServerOrigin}/`,
|
|
482
|
-
projectDirectoryUrl,
|
|
483
|
-
)
|
|
484
|
-
const fileIsInsideJsenvDistDirectory = urlIsInsideOf(
|
|
485
|
-
scriptOriginalUrl,
|
|
486
|
-
jsenvDistDirectoryUrl,
|
|
487
|
-
)
|
|
488
|
-
if (fileIsInsideJsenvDistDirectory) {
|
|
489
|
-
return
|
|
490
|
-
}
|
|
491
|
-
const isRemoteUrl = jsenvRemoteDirectory.isRemoteUrl(src)
|
|
492
|
-
if (isRemoteUrl && jsenvRemoteDirectory.isPreservedUrl(src)) {
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
const scriptCompiledUrl = generateCompilationAssetUrl(
|
|
496
|
-
compiledUrl,
|
|
497
|
-
urlToFilename(scriptOriginalUrl),
|
|
498
|
-
)
|
|
499
|
-
addHtmlAssetGenerator(async () => {
|
|
500
|
-
// we fetch scriptOriginalUrl on purpose because we do
|
|
501
|
-
// the transformation here and not in compile server
|
|
502
|
-
// (because compile server would think it's a module script
|
|
503
|
-
// and add things like systemjs)
|
|
504
|
-
// we could take into account the integrity her
|
|
505
|
-
const scriptResponse = await fetchUrl(scriptOriginalUrl)
|
|
506
|
-
if (scriptResponse.status !== 200) {
|
|
507
|
-
logger.warn(
|
|
508
|
-
createDetailedMessage(
|
|
509
|
-
scriptResponse.status === 404
|
|
510
|
-
? `script file cannot be found.`
|
|
511
|
-
: `script file unexpected response status (${scriptResponse.status}).`,
|
|
512
|
-
{
|
|
513
|
-
"script url": script.url,
|
|
514
|
-
"html url": url,
|
|
515
|
-
},
|
|
516
|
-
),
|
|
517
|
-
)
|
|
518
|
-
return []
|
|
519
|
-
}
|
|
520
|
-
const scriptAsText = await scriptResponse.text()
|
|
521
|
-
addHtmlSourceFile({
|
|
522
|
-
url: scriptOriginalUrl,
|
|
523
|
-
content: scriptAsText,
|
|
524
|
-
})
|
|
525
|
-
return transformHtmlScript({
|
|
526
|
-
projectDirectoryUrl,
|
|
527
|
-
jsenvRemoteDirectory,
|
|
528
|
-
url: scriptOriginalUrl,
|
|
529
|
-
compiledUrl: scriptCompiledUrl,
|
|
530
|
-
|
|
531
|
-
type: "classic",
|
|
532
|
-
compileProfile,
|
|
533
|
-
babelPluginMap,
|
|
534
|
-
topLevelAwait,
|
|
535
|
-
|
|
536
|
-
sourcemapMethod,
|
|
537
|
-
code: scriptAsText,
|
|
538
|
-
})
|
|
539
|
-
})
|
|
540
|
-
addHtmlMutation(() => {
|
|
541
|
-
if (integrityAttribute) {
|
|
542
|
-
removeHtmlNodeAttribute(script, integrityAttribute)
|
|
543
|
-
}
|
|
544
|
-
srcAttribute.value = `./${urlToRelativeUrl(
|
|
545
|
-
scriptCompiledUrl,
|
|
546
|
-
compiledUrl,
|
|
547
|
-
)}`
|
|
548
|
-
})
|
|
549
|
-
return
|
|
550
|
-
}
|
|
551
|
-
const scriptId = getIdForInlineHtmlNode(script, scripts)
|
|
552
|
-
const inlineScriptName = `${scriptId}.js`
|
|
553
|
-
const scriptOriginalUrl = resolveUrl(inlineScriptName, url)
|
|
554
|
-
const scriptCompiledUrl = generateCompilationAssetUrl(
|
|
555
|
-
compiledUrl,
|
|
556
|
-
inlineScriptName,
|
|
557
|
-
)
|
|
558
|
-
addHtmlAssetGenerator(async () => {
|
|
559
|
-
const htmlAssets = await transformHtmlScript({
|
|
560
|
-
projectDirectoryUrl,
|
|
561
|
-
jsenvRemoteDirectory,
|
|
562
|
-
url: scriptOriginalUrl,
|
|
563
|
-
compiledUrl: scriptCompiledUrl,
|
|
564
|
-
|
|
565
|
-
type: "classic",
|
|
566
|
-
compileProfile,
|
|
567
|
-
babelPluginMap,
|
|
568
|
-
topLevelAwait,
|
|
569
|
-
|
|
570
|
-
code: textNode.value,
|
|
571
|
-
sourcemapMethod,
|
|
572
|
-
})
|
|
573
|
-
addHtmlMutation(() => {
|
|
574
|
-
setHtmlNodeText(script, htmlAssets[0].content)
|
|
575
|
-
})
|
|
576
|
-
return htmlAssets
|
|
577
|
-
})
|
|
578
|
-
return
|
|
579
|
-
}
|
|
580
|
-
})
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
const transformHtmlScript = async ({
|
|
584
|
-
projectDirectoryUrl,
|
|
585
|
-
jsenvRemoteDirectory,
|
|
586
|
-
url,
|
|
587
|
-
compiledUrl,
|
|
588
|
-
|
|
589
|
-
type,
|
|
590
|
-
compileProfile,
|
|
591
|
-
babelPluginMap,
|
|
592
|
-
topLevelAwait,
|
|
593
|
-
|
|
594
|
-
code,
|
|
595
|
-
sourcemapMethod,
|
|
596
|
-
}) => {
|
|
597
|
-
let transformResult
|
|
598
|
-
try {
|
|
599
|
-
transformResult = await transformJs({
|
|
600
|
-
projectDirectoryUrl,
|
|
601
|
-
jsenvRemoteDirectory,
|
|
602
|
-
url,
|
|
603
|
-
compiledUrl,
|
|
604
|
-
|
|
605
|
-
babelPluginMap,
|
|
606
|
-
moduleOutFormat:
|
|
607
|
-
type === "module" ? compileProfile.moduleOutFormat : "global",
|
|
608
|
-
topLevelAwait: type === "module" ? topLevelAwait : false,
|
|
609
|
-
babelHelpersInjectionAsImport: type === "module" ? undefined : false,
|
|
610
|
-
|
|
611
|
-
code,
|
|
612
|
-
})
|
|
613
|
-
} catch (e) {
|
|
614
|
-
// If there is a syntax error in inline script
|
|
615
|
-
// we put the raw script without transformation.
|
|
616
|
-
// when systemjs will try to instantiate to script it
|
|
617
|
-
// will re-throw this syntax error.
|
|
618
|
-
// Thanks to this we see the syntax error in the
|
|
619
|
-
// document and livereloading still works
|
|
620
|
-
// because we gracefully handle this error
|
|
621
|
-
if (e.code === "PARSE_ERROR") {
|
|
622
|
-
return [{ url, content: code }]
|
|
623
|
-
}
|
|
624
|
-
throw e
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
code = transformResult.code
|
|
628
|
-
let map = transformResult.map
|
|
629
|
-
const sourcemapUrl = generateSourcemapUrl(compiledUrl)
|
|
630
|
-
if (sourcemapMethod === "inline") {
|
|
631
|
-
code = setJavaScriptSourceMappingUrl(code, sourcemapToBase64Url(map))
|
|
632
|
-
return [
|
|
633
|
-
{
|
|
634
|
-
url: compiledUrl,
|
|
635
|
-
content: code,
|
|
636
|
-
},
|
|
637
|
-
]
|
|
638
|
-
}
|
|
639
|
-
const sourcemapSpecifier = urlToRelativeUrl(sourcemapUrl, compiledUrl)
|
|
640
|
-
code = setJavaScriptSourceMappingUrl(code, sourcemapSpecifier)
|
|
641
|
-
return [
|
|
642
|
-
{
|
|
643
|
-
url: compiledUrl,
|
|
644
|
-
content: code,
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
url: sourcemapUrl,
|
|
648
|
-
content: JSON.stringify(map, null, " "),
|
|
649
|
-
},
|
|
650
|
-
]
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
const collectRessourceHints = (htmlAst) => {
|
|
654
|
-
const ressourceHints = []
|
|
655
|
-
visitHtmlAst(htmlAst, (htmlNode) => {
|
|
656
|
-
if (htmlNode.nodeName !== "link") {
|
|
657
|
-
return
|
|
658
|
-
}
|
|
659
|
-
const relAttribute = getHtmlNodeAttributeByName(htmlNode, "rel")
|
|
660
|
-
const rel = relAttribute ? relAttribute.value : ""
|
|
661
|
-
const isRessourceHint = [
|
|
662
|
-
"preconnect",
|
|
663
|
-
"dns-prefetch",
|
|
664
|
-
"prefetch",
|
|
665
|
-
"preload",
|
|
666
|
-
"modulepreload",
|
|
667
|
-
].includes(rel)
|
|
668
|
-
if (!isRessourceHint) {
|
|
669
|
-
return
|
|
670
|
-
}
|
|
671
|
-
ressourceHints.push(htmlNode)
|
|
672
|
-
})
|
|
673
|
-
return ressourceHints
|
|
674
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { composeTwoImportMaps } from "@jsenv/importmap"
|
|
2
|
-
|
|
3
|
-
import { getDefaultImportmap } from "@jsenv/core/src/internal/import_resolution/importmap_default.js"
|
|
4
|
-
|
|
5
|
-
export const compileImportmap = async ({
|
|
6
|
-
code,
|
|
7
|
-
url,
|
|
8
|
-
compiledUrl,
|
|
9
|
-
projectDirectoryUrl,
|
|
10
|
-
jsenvDirectoryRelativeUrl,
|
|
11
|
-
compileId,
|
|
12
|
-
}) => {
|
|
13
|
-
const jsenvImportmap = getDefaultImportmap(compiledUrl, {
|
|
14
|
-
projectDirectoryUrl,
|
|
15
|
-
compileDirectoryUrl: `${projectDirectoryUrl}${jsenvDirectoryRelativeUrl}${compileId}/`,
|
|
16
|
-
})
|
|
17
|
-
const projectImportmap = JSON.parse(code)
|
|
18
|
-
const importmap = composeTwoImportMaps(jsenvImportmap, projectImportmap)
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
contentType: "application/importmap+json",
|
|
22
|
-
compiledSource: JSON.stringify(importmap, null, " "),
|
|
23
|
-
sources: [url],
|
|
24
|
-
sourcesContent: [code],
|
|
25
|
-
assets: [],
|
|
26
|
-
assetsContent: [],
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { require } from "@jsenv/core/src/internal/require.js"
|
|
2
|
-
|
|
3
|
-
// https://github.com/rburns/ansi-to-html/blob/master/src/ansi_to_html.js
|
|
4
|
-
// https://github.com/drudru/ansi_up/blob/master/ansi_up.js
|
|
5
|
-
|
|
6
|
-
export const ansiToHTML = (ansiString) => {
|
|
7
|
-
const Convert = require("ansi-to-html")
|
|
8
|
-
return new Convert().toHtml(ansiString)
|
|
9
|
-
}
|