@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,80 +0,0 @@
|
|
|
1
|
-
export const visitImportReferences = async ({
|
|
2
|
-
ast,
|
|
3
|
-
onReferenceWithImportMetaUrlPattern,
|
|
4
|
-
onReferenceWithImportAssertion,
|
|
5
|
-
}) => {
|
|
6
|
-
const { asyncWalk } = await import("estree-walker")
|
|
7
|
-
await asyncWalk(ast, {
|
|
8
|
-
enter: async (node, parent) => {
|
|
9
|
-
if (isNewUrlImportMetaUrl(node)) {
|
|
10
|
-
await onReferenceWithImportMetaUrlPattern({
|
|
11
|
-
importNode: node,
|
|
12
|
-
})
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (node.type === "ImportDeclaration") {
|
|
17
|
-
const { assertions = [] } = node
|
|
18
|
-
if (assertions.length === 0) {
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
const assertionsDescriptor = getImportAssertionsDescriptor(assertions)
|
|
22
|
-
await onReferenceWithImportAssertion({
|
|
23
|
-
importNode: node,
|
|
24
|
-
assertions: assertionsDescriptor,
|
|
25
|
-
})
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
node.type === "ObjectExpression" &&
|
|
31
|
-
parent.type === "ImportExpression"
|
|
32
|
-
) {
|
|
33
|
-
const { properties } = node
|
|
34
|
-
const assertProperty = properties.find((property) => {
|
|
35
|
-
return property.key.name === "assert"
|
|
36
|
-
})
|
|
37
|
-
if (!assertProperty) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const assertProperties = assertProperty.value.properties
|
|
42
|
-
const typePropertyNode = assertProperties.find((property) => {
|
|
43
|
-
return property.key.name === "type"
|
|
44
|
-
})
|
|
45
|
-
if (!typePropertyNode) {
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
await onReferenceWithImportAssertion({
|
|
50
|
-
importNode: parent,
|
|
51
|
-
typePropertyNode,
|
|
52
|
-
})
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const isNewUrlImportMetaUrl = (node) => {
|
|
60
|
-
return (
|
|
61
|
-
node.type === "NewExpression" &&
|
|
62
|
-
node.callee.type === "Identifier" &&
|
|
63
|
-
node.callee.name === "URL" &&
|
|
64
|
-
node.arguments.length === 2 &&
|
|
65
|
-
node.arguments[0].type === "Literal" &&
|
|
66
|
-
typeof node.arguments[0].value === "string" &&
|
|
67
|
-
node.arguments[1].type === "MemberExpression" &&
|
|
68
|
-
node.arguments[1].object.type === "MetaProperty" &&
|
|
69
|
-
node.arguments[1].property.type === "Identifier" &&
|
|
70
|
-
node.arguments[1].property.name === "url"
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const getImportAssertionsDescriptor = (importAssertions) => {
|
|
75
|
-
const assertionAttributes = {}
|
|
76
|
-
importAssertions.forEach((importAssertion) => {
|
|
77
|
-
assertionAttributes[importAssertion.key.name] = importAssertion.value.value
|
|
78
|
-
})
|
|
79
|
-
return assertionAttributes
|
|
80
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const parseImportmapRessource = (
|
|
2
|
-
importmapRessource,
|
|
3
|
-
notifiers,
|
|
4
|
-
{ minify, importMapToInject },
|
|
5
|
-
) => {
|
|
6
|
-
const importmapString = String(importmapRessource.bufferBeforeBuild)
|
|
7
|
-
|
|
8
|
-
return () => {
|
|
9
|
-
if (importMapToInject) {
|
|
10
|
-
const jsonText = minify
|
|
11
|
-
? valueToCompactJsonString(importMapToInject)
|
|
12
|
-
: valueToReadableJsonString(importMapToInject)
|
|
13
|
-
importmapRessource.buildEnd(jsonText)
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const jsonText = minify
|
|
18
|
-
? valueToCompactJsonString(JSON.parse(importmapString))
|
|
19
|
-
: importmapString
|
|
20
|
-
importmapRessource.buildEnd(jsonText)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// removes eventual whitespace in json
|
|
25
|
-
const valueToCompactJsonString = (json) => JSON.stringify(json)
|
|
26
|
-
|
|
27
|
-
// prefer a readable json when minification is disabled
|
|
28
|
-
const valueToReadableJsonString = (json) => JSON.stringify(json, null, " ")
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveUrl,
|
|
3
|
-
fileSystemPathToUrl,
|
|
4
|
-
urlToFileSystemPath,
|
|
5
|
-
} from "@jsenv/filesystem"
|
|
6
|
-
|
|
7
|
-
export const babelPluginInlineWorkerImports = (
|
|
8
|
-
babel,
|
|
9
|
-
{ readImportedScript },
|
|
10
|
-
) => {
|
|
11
|
-
const { types } = babel
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
name: "transform-inline-worker-imports",
|
|
15
|
-
|
|
16
|
-
visitor: {
|
|
17
|
-
CallExpression: (path, opts) => {
|
|
18
|
-
const calleePath = path.get("callee")
|
|
19
|
-
|
|
20
|
-
const replaceImportScriptsWithFileContents = () => {
|
|
21
|
-
const filename = opts.filename
|
|
22
|
-
const fileUrl = fileSystemPathToUrl(filename)
|
|
23
|
-
|
|
24
|
-
let previousArgType = ""
|
|
25
|
-
const importedUrls = path.get("arguments").map((arg, index) => {
|
|
26
|
-
if (!types.isStringLiteral(arg)) {
|
|
27
|
-
if (previousArgType && previousArgType !== "dynamic") {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`importScript mixed arguments: arg number ${index} is dynamic while previous arg was ${previousArgType}`,
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
previousArgType = "dynamic"
|
|
33
|
-
return arg
|
|
34
|
-
}
|
|
35
|
-
const importedUrl = resolveUrl(arg.node.value, fileUrl)
|
|
36
|
-
if (!importedUrl.startsWith("file://")) {
|
|
37
|
-
if (previousArgType && previousArgType !== "remote") {
|
|
38
|
-
throw new Error(
|
|
39
|
-
`importScript mixed arguments: arg number ${index} targets a remote url while previous arg was ${previousArgType}`,
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
previousArgType = "remote"
|
|
43
|
-
return arg
|
|
44
|
-
}
|
|
45
|
-
previousArgType = "local"
|
|
46
|
-
return importedUrl
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
if (previousArgType === "local") {
|
|
50
|
-
const nodes = importedUrls.reduce((previous, importedUrl) => {
|
|
51
|
-
const importedScriptCode = readImportedScript(importedUrl)
|
|
52
|
-
const { ast } = babel.transformSync(importedScriptCode, {
|
|
53
|
-
filename: urlToFileSystemPath(importedUrl),
|
|
54
|
-
configFile: false,
|
|
55
|
-
babelrc: false, // trust only these options, do not read any babelrc config file
|
|
56
|
-
ast: true,
|
|
57
|
-
sourceMaps: true,
|
|
58
|
-
// sourceFileName: scriptPath,
|
|
59
|
-
plugins: [
|
|
60
|
-
[
|
|
61
|
-
babelPluginInlineWorkerImports,
|
|
62
|
-
{
|
|
63
|
-
readImportedScript,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
],
|
|
67
|
-
})
|
|
68
|
-
return [...previous, ...ast.program.body]
|
|
69
|
-
}, [])
|
|
70
|
-
|
|
71
|
-
calleePath.parentPath.replaceWithMultiple(nodes)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (types.isIdentifier(calleePath.node, { name: "importScripts" })) {
|
|
76
|
-
replaceImportScriptsWithFileContents()
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (types.isMemberExpression(calleePath.node)) {
|
|
81
|
-
const calleeObject = calleePath.get("object")
|
|
82
|
-
const isSelf = types.isIdentifier(calleeObject.node, { name: "self" })
|
|
83
|
-
if (isSelf) {
|
|
84
|
-
const propertyPath = calleePath.get("property")
|
|
85
|
-
if (
|
|
86
|
-
types.isIdentifier(propertyPath.node, { name: "importScripts" })
|
|
87
|
-
) {
|
|
88
|
-
replaceImportScriptsWithFileContents()
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const minifyJs = async ({
|
|
2
|
-
url,
|
|
3
|
-
code,
|
|
4
|
-
map,
|
|
5
|
-
sourcemapIncludeSources = true,
|
|
6
|
-
...rest
|
|
7
|
-
}) => {
|
|
8
|
-
// https://github.com/terser-js/terser#minify-options
|
|
9
|
-
const { minify } = await import("terser")
|
|
10
|
-
|
|
11
|
-
const terserResult = await minify(
|
|
12
|
-
{
|
|
13
|
-
[url]: code,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
sourceMap: {
|
|
17
|
-
...(map ? { content: JSON.stringify(map) } : {}),
|
|
18
|
-
asObject: true,
|
|
19
|
-
includeSources: sourcemapIncludeSources,
|
|
20
|
-
},
|
|
21
|
-
...rest,
|
|
22
|
-
},
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
code = terserResult.code
|
|
26
|
-
map = terserResult.map
|
|
27
|
-
|
|
28
|
-
if (!map.sourcesContent) {
|
|
29
|
-
map.sourcesContent = [code]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return { code, map }
|
|
33
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { urlToFilename, resolveUrl, urlToRelativeUrl } from "@jsenv/filesystem"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
generateSourcemapUrl,
|
|
5
|
-
getJavaScriptSourceMappingUrl,
|
|
6
|
-
setJavaScriptSourceMappingUrl,
|
|
7
|
-
} from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
|
|
8
|
-
import { transformWorker } from "./transform_worker.js"
|
|
9
|
-
|
|
10
|
-
export const parseJsRessource = async (
|
|
11
|
-
jsRessource,
|
|
12
|
-
{ notifyReferenceFound },
|
|
13
|
-
{ asProjectUrl, asOriginalUrl, minify, minifyJs },
|
|
14
|
-
) => {
|
|
15
|
-
const jsUrl = jsRessource.url
|
|
16
|
-
const jsString = String(jsRessource.bufferBeforeBuild)
|
|
17
|
-
const jsSourcemapUrl = getJavaScriptSourceMappingUrl(jsString)
|
|
18
|
-
|
|
19
|
-
let sourcemapReference
|
|
20
|
-
if (jsSourcemapUrl) {
|
|
21
|
-
sourcemapReference = notifyReferenceFound({
|
|
22
|
-
referenceLabel: "js sourcemapping comment",
|
|
23
|
-
contentTypeExpected: ["application/json", "application/octet-stream"],
|
|
24
|
-
ressourceSpecifier: jsSourcemapUrl,
|
|
25
|
-
// we don't really know the line or column
|
|
26
|
-
// but let's asusme it the last line and first column
|
|
27
|
-
referenceLine: jsString.split(/\r?\n/).length,
|
|
28
|
-
// ${"//#"} is to avoid a parser thinking there is a sourceMappingUrl for this file
|
|
29
|
-
referenceColumn: `${"//#"} sourceMappingURL=`.length + 1,
|
|
30
|
-
isSourcemap: true,
|
|
31
|
-
})
|
|
32
|
-
} else {
|
|
33
|
-
sourcemapReference = notifyReferenceFound({
|
|
34
|
-
referenceLabel: "js sourcemapping comment",
|
|
35
|
-
contentType: "application/octet-stream",
|
|
36
|
-
ressourceSpecifier: urlToRelativeUrl(generateSourcemapUrl(jsUrl), jsUrl),
|
|
37
|
-
isPlaceholder: true,
|
|
38
|
-
isSourcemap: true,
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return async ({ buildDirectoryUrl }) => {
|
|
43
|
-
const sourcemapRessource = sourcemapReference.ressource
|
|
44
|
-
let code
|
|
45
|
-
let map
|
|
46
|
-
if (!sourcemapRessource.isPlaceholder) {
|
|
47
|
-
map = JSON.parse(String(sourcemapRessource.bufferBeforeBuild))
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// in case this js asset is a worker, we transform it so that
|
|
51
|
-
// importScripts() calls are inlined
|
|
52
|
-
// We could also parse each importScripts call and decide to inline
|
|
53
|
-
// or not. For now inlining/concatenation is forced
|
|
54
|
-
if (jsRessource.isWorker || jsRessource.isServiceWorker) {
|
|
55
|
-
const transformResult = await transformWorker({
|
|
56
|
-
url: asOriginalUrl(jsUrl),
|
|
57
|
-
code: String(jsRessource.bufferBeforeBuild),
|
|
58
|
-
map,
|
|
59
|
-
})
|
|
60
|
-
code = transformResult.code
|
|
61
|
-
map = transformResult.map
|
|
62
|
-
} else {
|
|
63
|
-
code = jsString
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const jsCompiledUrl = jsRessource.url
|
|
67
|
-
const jsOriginalUrl = asOriginalUrl(jsCompiledUrl)
|
|
68
|
-
|
|
69
|
-
if (minify) {
|
|
70
|
-
const result = await minifyJs({
|
|
71
|
-
url: map ? asProjectUrl(jsCompiledUrl) : jsOriginalUrl,
|
|
72
|
-
code,
|
|
73
|
-
map,
|
|
74
|
-
toplevel: false,
|
|
75
|
-
})
|
|
76
|
-
code = result.code
|
|
77
|
-
map = result.map
|
|
78
|
-
}
|
|
79
|
-
jsRessource.buildEnd(code)
|
|
80
|
-
if (!map) {
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
// In theory code should never be modified once buildEnd() is called
|
|
84
|
-
// because buildRelativeUrl might be versioned based on file content
|
|
85
|
-
// There is an exception for sourcemap because we want to update sourcemap.file
|
|
86
|
-
// to the cached filename of the js file.
|
|
87
|
-
// To achieve that we set/update the sourceMapping url comment in compiled js file.
|
|
88
|
-
// This is totally fine to do that because sourcemap and js file lives togethers
|
|
89
|
-
// so this comment changes nothing regarding cache invalidation and is not important
|
|
90
|
-
// to decide buildRelativeUrl for this js file.
|
|
91
|
-
const jsBuildUrl = resolveUrl(
|
|
92
|
-
jsRessource.buildRelativeUrl,
|
|
93
|
-
buildDirectoryUrl,
|
|
94
|
-
)
|
|
95
|
-
const sourcemapPrecomputedBuildUrl = generateSourcemapUrl(jsBuildUrl)
|
|
96
|
-
map.file = urlToFilename(jsBuildUrl)
|
|
97
|
-
if (map.sources) {
|
|
98
|
-
map.sources = map.sources.map((source) => {
|
|
99
|
-
const sourceUrl = resolveUrl(source, jsUrl)
|
|
100
|
-
const sourceOriginalUrl = asOriginalUrl(sourceUrl) || sourceUrl
|
|
101
|
-
const sourceUrlRelativeToSourceMap = urlToRelativeUrl(
|
|
102
|
-
sourceOriginalUrl,
|
|
103
|
-
sourcemapPrecomputedBuildUrl,
|
|
104
|
-
)
|
|
105
|
-
return sourceUrlRelativeToSourceMap
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
const mapAsText = JSON.stringify(map, null, " ")
|
|
109
|
-
sourcemapRessource.buildEnd(mapAsText)
|
|
110
|
-
const sourcemapBuildUrl = resolveUrl(
|
|
111
|
-
sourcemapRessource.buildRelativeUrl,
|
|
112
|
-
buildDirectoryUrl,
|
|
113
|
-
)
|
|
114
|
-
const sourcemapUrlForJs = urlToRelativeUrl(sourcemapBuildUrl, jsBuildUrl)
|
|
115
|
-
const codeWithSourcemapComment = setJavaScriptSourceMappingUrl(
|
|
116
|
-
code,
|
|
117
|
-
sourcemapUrlForJs,
|
|
118
|
-
)
|
|
119
|
-
jsRessource.bufferAfterBuild = codeWithSourcemapComment
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// we could inline a worker by doing
|
|
2
|
-
// var blob = new Blob(code, { type: 'text/javascript' })
|
|
3
|
-
// window.URL.createObjectURL(blob)
|
|
4
|
-
|
|
5
|
-
import { readFileSync } from "fs"
|
|
6
|
-
import { urlToFileSystemPath } from "@jsenv/filesystem"
|
|
7
|
-
import { createDetailedMessage } from "@jsenv/logger"
|
|
8
|
-
|
|
9
|
-
import { babelPluginInlineWorkerImports } from "./babel_plugin_inline_worker_imports.js"
|
|
10
|
-
|
|
11
|
-
export const transformWorker = async ({ url, code, map }) => {
|
|
12
|
-
const { transformSync } = await import("@babel/core")
|
|
13
|
-
|
|
14
|
-
const transformResult = transformSync(code, {
|
|
15
|
-
filename: urlToFileSystemPath(url),
|
|
16
|
-
configFile: false,
|
|
17
|
-
babelrc: false, // trust only these options, do not read any babelrc config file
|
|
18
|
-
ast: false,
|
|
19
|
-
inputSourceMap: map,
|
|
20
|
-
sourceMaps: true,
|
|
21
|
-
// sourceFileName: scriptPath,
|
|
22
|
-
plugins: [
|
|
23
|
-
[
|
|
24
|
-
babelPluginInlineWorkerImports,
|
|
25
|
-
{
|
|
26
|
-
readImportedScript: readWorkerFile,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
],
|
|
30
|
-
})
|
|
31
|
-
code = transformResult.code
|
|
32
|
-
map = transformResult.map
|
|
33
|
-
return { code, map }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const readWorkerFile = (url, importerUrl) => {
|
|
37
|
-
const filePath = urlToFileSystemPath(url)
|
|
38
|
-
try {
|
|
39
|
-
const code = String(readFileSync(filePath))
|
|
40
|
-
return code
|
|
41
|
-
} catch (e) {
|
|
42
|
-
if (e.code === "ENOENT") {
|
|
43
|
-
if (importerUrl) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
createDetailedMessage(`no file found for an import in a worker.`, {
|
|
46
|
-
["worker url"]: importerUrl,
|
|
47
|
-
["imported url"]: url,
|
|
48
|
-
}),
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`no worker file at ${url}`)
|
|
52
|
-
}
|
|
53
|
-
throw e
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const parseJsonRessource = (jsonRessource, notifiers, { minify }) => {
|
|
2
|
-
const jsonString = String(jsonRessource.bufferBeforeBuild)
|
|
3
|
-
return () => {
|
|
4
|
-
if (minify) {
|
|
5
|
-
// this is to remove eventual whitespaces
|
|
6
|
-
jsonRessource.buildEnd(JSON.stringify(JSON.parse(jsonString)))
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
jsonRessource.buildEnd(jsonString)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { readFile, urlToRelativeUrl } from "@jsenv/filesystem"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
parseHtmlString,
|
|
5
|
-
findHtmlNode,
|
|
6
|
-
htmlNodeIsScriptModule,
|
|
7
|
-
getHtmlNodeAttributeByName,
|
|
8
|
-
getHtmlNodeTextNode,
|
|
9
|
-
manipulateHtmlAst,
|
|
10
|
-
findFirstImportMapNode,
|
|
11
|
-
} from "@jsenv/core/src/internal/compiling/compileHtml.js"
|
|
12
|
-
import {
|
|
13
|
-
jsenvSystemJsFileInfo,
|
|
14
|
-
jsenvResolveImportUrlHelper,
|
|
15
|
-
} from "@jsenv/core/src/internal/jsenvInternalFiles.js"
|
|
16
|
-
|
|
17
|
-
import { parseHtmlRessource } from "./html/parseHtmlRessource.js"
|
|
18
|
-
import { parseImportmapRessource } from "./importmap/parseImportmapRessource.js"
|
|
19
|
-
import { parseSvgRessource } from "./svg/parseSvgRessource.js"
|
|
20
|
-
import { parseCssRessource } from "./css/parseCssRessource.js"
|
|
21
|
-
import { parseJsRessource } from "./js/parseJsRessource.js"
|
|
22
|
-
import { parseJsonRessource } from "./json/parseJsonRessource.js"
|
|
23
|
-
import { parseWebmanifestRessource } from "./webmanifest/parseWebmanifestRessource.js"
|
|
24
|
-
|
|
25
|
-
export const parseRessource = async (
|
|
26
|
-
ressource,
|
|
27
|
-
notifiers,
|
|
28
|
-
{
|
|
29
|
-
projectDirectoryUrl,
|
|
30
|
-
jsenvRemoteDirectory,
|
|
31
|
-
format,
|
|
32
|
-
systemJsUrl,
|
|
33
|
-
asProjectUrl,
|
|
34
|
-
asOriginalUrl,
|
|
35
|
-
asOriginalServerUrl,
|
|
36
|
-
ressourceHintNeverUsedCallback,
|
|
37
|
-
useImportMapToMaximizeCacheReuse,
|
|
38
|
-
createImportMapForFilesUsedInJs,
|
|
39
|
-
minify,
|
|
40
|
-
minifyJs,
|
|
41
|
-
minifyHtml,
|
|
42
|
-
minifyCssOptions,
|
|
43
|
-
cssConcatenation,
|
|
44
|
-
},
|
|
45
|
-
) => {
|
|
46
|
-
const { contentType } = ressource
|
|
47
|
-
if (!contentType) {
|
|
48
|
-
return null
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (contentType === "text/html") {
|
|
52
|
-
return parseHtmlRessource(ressource, notifiers, {
|
|
53
|
-
minify,
|
|
54
|
-
minifyHtml,
|
|
55
|
-
htmlStringToHtmlAst: async (htmlString) => {
|
|
56
|
-
const htmlAst = parseHtmlString(htmlString)
|
|
57
|
-
|
|
58
|
-
const { hasModuleScript, hasInlineModuleScript } =
|
|
59
|
-
getHtmlModuleScriptInfo(htmlAst)
|
|
60
|
-
|
|
61
|
-
if (hasModuleScript && format === "systemjs") {
|
|
62
|
-
// force presence of systemjs script if html contains a module script
|
|
63
|
-
// use our own version of systemjs by default
|
|
64
|
-
if (typeof systemJsUrl === "undefined") {
|
|
65
|
-
systemJsUrl = `/${urlToRelativeUrl(
|
|
66
|
-
jsenvSystemJsFileInfo.url,
|
|
67
|
-
projectDirectoryUrl,
|
|
68
|
-
)}`
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
manipulateHtmlAst(htmlAst, {
|
|
72
|
-
scriptInjections: [
|
|
73
|
-
{
|
|
74
|
-
id: "jsenv_inject_systemjs",
|
|
75
|
-
src: systemJsUrl,
|
|
76
|
-
...(hasInlineModuleScript
|
|
77
|
-
? { "data-jsenv-force-inline": true }
|
|
78
|
-
: {}),
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (useImportMapToMaximizeCacheReuse) {
|
|
85
|
-
if (hasModuleScript && format === "esmodule") {
|
|
86
|
-
// inject an inline script helper to resolve url
|
|
87
|
-
manipulateHtmlAst(htmlAst, {
|
|
88
|
-
scriptInjections: [
|
|
89
|
-
{
|
|
90
|
-
id: "jsenv_import_url_resolution_helper",
|
|
91
|
-
text: await readFile(jsenvResolveImportUrlHelper.url),
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!findFirstImportMapNode(htmlAst)) {
|
|
98
|
-
// force the presence of a fake+inline+empty importmap script
|
|
99
|
-
// if html contains no importmap and we useImportMapToMaximizeCacheReuse
|
|
100
|
-
// this inline importmap will be transformed later to have top level remapping
|
|
101
|
-
// required to target hashed js urls
|
|
102
|
-
manipulateHtmlAst(htmlAst, {
|
|
103
|
-
scriptInjections: [
|
|
104
|
-
{
|
|
105
|
-
type: "importmap",
|
|
106
|
-
id: "jsenv_inject_importmap",
|
|
107
|
-
text: "{}",
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return htmlAst
|
|
115
|
-
},
|
|
116
|
-
ressourceHintNeverUsedCallback: (info) => {
|
|
117
|
-
ressourceHintNeverUsedCallback({
|
|
118
|
-
...info,
|
|
119
|
-
htmlSource: String(ressource.bufferBeforeBuild),
|
|
120
|
-
htmlUrl: asOriginalUrl(ressource.url),
|
|
121
|
-
htmlAttributeName: "href",
|
|
122
|
-
})
|
|
123
|
-
},
|
|
124
|
-
})
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (contentType === "text/css") {
|
|
128
|
-
return parseCssRessource(ressource, notifiers, {
|
|
129
|
-
jsenvRemoteDirectory,
|
|
130
|
-
asProjectUrl,
|
|
131
|
-
asOriginalUrl,
|
|
132
|
-
asOriginalServerUrl,
|
|
133
|
-
minify,
|
|
134
|
-
minifyCssOptions,
|
|
135
|
-
cssConcatenation,
|
|
136
|
-
})
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (contentType === "application/importmap+json") {
|
|
140
|
-
return parseImportmapRessource(ressource, notifiers, {
|
|
141
|
-
minify,
|
|
142
|
-
importMapToInject: useImportMapToMaximizeCacheReuse
|
|
143
|
-
? createImportMapForFilesUsedInJs()
|
|
144
|
-
: undefined,
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
contentType === "application/manifest+json" ||
|
|
150
|
-
ressource.references[0].contentTypeExpected === "application/manifest+json"
|
|
151
|
-
) {
|
|
152
|
-
return parseWebmanifestRessource(ressource, notifiers, { minify })
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
contentType === "application/javascript" ||
|
|
157
|
-
contentType === "text/javascript"
|
|
158
|
-
) {
|
|
159
|
-
return parseJsRessource(ressource, notifiers, {
|
|
160
|
-
projectDirectoryUrl,
|
|
161
|
-
jsenvRemoteDirectory,
|
|
162
|
-
asProjectUrl,
|
|
163
|
-
asOriginalUrl,
|
|
164
|
-
asOriginalServerUrl,
|
|
165
|
-
minify,
|
|
166
|
-
minifyJs,
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (contentType === "image/svg+xml") {
|
|
171
|
-
return parseSvgRessource(ressource, notifiers, {
|
|
172
|
-
minify,
|
|
173
|
-
minifyHtml,
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (contentType === "application/json" || contentType.endsWith("+json")) {
|
|
178
|
-
return parseJsonRessource(ressource, notifiers, { minify })
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return null
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const getHtmlModuleScriptInfo = (htmlAst) => {
|
|
185
|
-
let hasModuleScript = false
|
|
186
|
-
let hasInlineModuleScript = false
|
|
187
|
-
findHtmlNode(htmlAst, (htmlNode) => {
|
|
188
|
-
const isScriptModule = htmlNodeIsScriptModule(htmlNode)
|
|
189
|
-
if (!isScriptModule) {
|
|
190
|
-
return false
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
hasModuleScript = true
|
|
194
|
-
|
|
195
|
-
const isInline =
|
|
196
|
-
getHtmlNodeAttributeByName(htmlNode, "data-jsenv-force-inline") ||
|
|
197
|
-
(!getHtmlNodeAttributeByName(htmlNode, "src") &&
|
|
198
|
-
getHtmlNodeTextNode(htmlNode))
|
|
199
|
-
if (!isInline) {
|
|
200
|
-
return false
|
|
201
|
-
}
|
|
202
|
-
hasInlineModuleScript = true
|
|
203
|
-
return true
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
return { hasModuleScript, hasInlineModuleScript }
|
|
207
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const collectNodesMutations = (nodes, params, ressource, candidates) => {
|
|
2
|
-
const mutations = []
|
|
3
|
-
nodes.forEach((node) => {
|
|
4
|
-
mutations.push(
|
|
5
|
-
...collectNodeMutations(node, params, ressource, nodes, candidates),
|
|
6
|
-
)
|
|
7
|
-
})
|
|
8
|
-
return mutations
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const collectNodeMutations = (node, params, ressource, nodes, candidates) => {
|
|
12
|
-
let firstValueReturned
|
|
13
|
-
candidates.find((candidate) => {
|
|
14
|
-
const returnValue = candidate(node, params, ressource, nodes)
|
|
15
|
-
if (returnValue === null || returnValue === undefined) {
|
|
16
|
-
return false
|
|
17
|
-
}
|
|
18
|
-
firstValueReturned = returnValue
|
|
19
|
-
return true
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
if (typeof firstValueReturned === "function") {
|
|
23
|
-
return [firstValueReturned]
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(firstValueReturned)) {
|
|
26
|
-
return firstValueReturned
|
|
27
|
-
}
|
|
28
|
-
return []
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
window.__resolveImportUrl__ = (url, baseUrl) => {
|
|
3
|
-
const importmapNode = document.querySelector('[type="importmap"]')
|
|
4
|
-
|
|
5
|
-
if (importmapNode) {
|
|
6
|
-
const importmap = JSON.parse(importmapNode.textContent)
|
|
7
|
-
const specifier = importmap.imports[url] || url
|
|
8
|
-
return new URL(specifier, baseUrl)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return new URL(url, baseUrl)
|
|
12
|
-
}
|