Quantcast
Viewing all articles
Browse latest Browse all 293522

Remove deprecated jQuery UI components and fork remaining source code into core

Problem/Motivation

In #3051352: [Plan] Remove unused jQuery UI components and replace with a suite of contrib packages for the continuous upgrade path, we established a plan to reduce the amount of jQuery UI code shipped in Drupal 9 core and exposed as core libraries, since jQuery UI is no longer maintained and no longer received security coverage. When we discussed this issue with the JavaScript maintainers, frontend framework managers, and release managers, we agreed that:

  1. jQuery UI components not used by core would be deprecated in 8.8.x and removed before 9.0.0: #3067251: Deprecate unused jQuery UI components in favour of a suite of contrib modules
  2. We would use July, August, and September 2019 to research and prototype potential replacement libraries for the six components core itself actually uses.
  3. If we found any such libraries that had consensus from JavaScript, frontend framework, and release managers as good core dependencies for Drupal 9, we'd try to replace usage of the equivalent jQuery UI library in 8.8.x, and if this could be done in a backwards-compatible and non-disruptive way, the jQuery UI library would be deprecated in favor of the replacement dependency.
  4. For riskier jQuery UI components (especially Dialog which is used extensively by core and has significant accessibility requirements), we'd still develop the replacement as far as possible against 8.8, but target the deprecation of the jQuery UI library for a Drupal 9 minor release instead.
  5. Finally, for any libraries still used by core as of 8.8.0, those libraries would be forked into the Drupal 9 core codebase (so that we could more easily maintain them ourselves in case of any security issues between now and Drupal 9's end-of-life), with the goal of deprecating them all for complete removal prior to 10.0.0

As of the 8.8.0-alpha1 commit deadline, the following jQuery UI issues require either too much work or too much risk to replace before 8.8.0-beta1:

Meanwhile, the following issues are still on track to be completed in time for 8.8.0-beta1:

Proposed resolution

Remove all the libraries that are deprecated in 8.8, and any unused files.

  • jquery.ui.accordion
  • jquery.ui.checkboxradio (required by jquery.ui.button)
  • jquery.ui.controlgroup (required by jquery.ui.button)
  • jquery.ui.droppable
  • jquery.ui.effects (all effects, core, blind, bounce, clip, drop, explode, fade, fold, highlight, puff, pulsate, scale, shake, size, slide, transfer)
  • jquery.ui.progressbar
  • jquery.ui.selectable
  • jquery.ui.selectmenu
  • jquery.ui.slider
  • jquery.ui.spinner
  • jquery.ui.tooltip

The following libraries may be removed if their deprecation issues are completed by 8.8.0-beta

  • jquery.ui.datepicker — success as of #32!
  • jquery.ui.sortable — success as of #35!
  • jquery.ui.touch-punch — success as of #35!

Fork the remaining jQuery UI source code into Drupal 9 core and provide a script to minify the javascript files.

List of files to be minified in core/assets/jquery.ui/ui:

  • i18n (full directory was removed with datepicker, see #32)
  • widgets/autocomplete-min.js
  • widgets/button-min.js
  • widgets/checkboxradio-min.js
  • widgets/controlgroup-min.js
  • widgets/datepicker-min.js
  • widgets/dialog-min.js
  • widgets/draggable-min.js
  • widgets/menu-min.js
  • widgets/mouse-min.js
  • widgets/resizable-min.js
  • widgets/sortable-min.js
  • data-min.js
  • disable-selection-min.js
  • escape-selector-min.js
  • focusable-min.js
  • form-min.js
  • form-reset-mixin-min.js
  • ie-min.js
  • jquery-1-7-min.js
  • keycode-min.js
  • labels-min.js
  • plugin-min.js
  • position-min.js
  • safe-active-element-min.js
  • safe-blur-min.js
  • scroll-parent-min.js
  • tabbable-min.js (used by dialog)
  • unique-id-min.js
  • version-min.js
  • widget-min.js

About the patch in #55

Remove deprecated jQuery UI libraries:

git rm core/assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js core/assets/vendor/jquery.ui/README.md core/assets/vendor/jquery.ui/package.json core/assets/vendor/jquery.ui/themes/base/accordion.css core/assets/vendor/jquery.ui/themes/base/all.css core/assets/vendor/jquery.ui/themes/base/base.css core/assets/vendor/jquery.ui/themes/base/progressbar.css core/assets/vendor/jquery.ui/themes/base/selectable.css core/assets/vendor/jquery.ui/themes/base/selectmenu.css core/assets/vendor/jquery.ui/themes/base/slider.css core/assets/vendor/jquery.ui/themes/base/sortable.css core/assets/vendor/jquery.ui/themes/base/spinner.css core/assets/vendor/jquery.ui/themes/base/tabs.css core/assets/vendor/jquery.ui/themes/base/tooltip.css core/assets/vendor/jquery.ui/ui/core-min.js core/assets/vendor/jquery.ui/ui/effect-min.js core/assets/vendor/jquery.ui/ui/effects/effect-blind-min.js core/assets/vendor/jquery.ui/ui/effects/effect-bounce-min.js core/assets/vendor/jquery.ui/ui/effects/effect-clip-min.js core/assets/vendor/jquery.ui/ui/effects/effect-drop-min.js core/assets/vendor/jquery.ui/ui/effects/effect-explode-min.js core/assets/vendor/jquery.ui/ui/effects/effect-fade-min.js core/assets/vendor/jquery.ui/ui/effects/effect-fold-min.js core/assets/vendor/jquery.ui/ui/effects/effect-highlight-min.js core/assets/vendor/jquery.ui/ui/effects/effect-puff-min.js core/assets/vendor/jquery.ui/ui/effects/effect-pulsate-min.js core/assets/vendor/jquery.ui/ui/effects/effect-scale-min.js core/assets/vendor/jquery.ui/ui/effects/effect-shake-min.js core/assets/vendor/jquery.ui/ui/effects/effect-size-min.js core/assets/vendor/jquery.ui/ui/effects/effect-slide-min.js core/assets/vendor/jquery.ui/ui/effects/effect-transfer-min.js core/assets/vendor/jquery.ui/ui/widgets/accordion-min.js core/assets/vendor/jquery.ui/ui/widgets/droppable-min.js core/assets/vendor/jquery.ui/ui/widgets/progressbar-min.js core/assets/vendor/jquery.ui/ui/widgets/selectable-min.js core/assets/vendor/jquery.ui/ui/widgets/selectmenu-min.js core/assets/vendor/jquery.ui/ui/widgets/slider-min.js core/assets/vendor/jquery.ui/ui/widgets/sortable-min.js core/assets/vendor/jquery.ui/ui/widgets/spinner-min.js core/assets/vendor/jquery.ui/ui/widgets/tabs-min.js core/assets/vendor/jquery.ui/ui/widgets/tooltip-min.js

Clone https://github.com/jquery/jquery-ui/tree/1.12.1 and copy source files to Drupal:

cd ../
git clone git@github.com:jquery/jquery-ui.git --branch 1.12.1
cd jquery-ui
cp ui/data.js ui/disable-selection.js ui/escape-selector.js ui/focusable.js ui/form.js ui/form-reset-mixin.js ui/ie.js ui/jquery-1-7.js ui/keycode.js ui/labels.js ui/plugin.js ui/position.js ui/safe-active-element.js ui/safe-blur.js ui/scroll-parent.js ui/tabbable.js ui/unique-id.js ui/version.js ui/widget.js ../drupal/core/assets/vendor/jquery.ui/ui
cp ui/widgets/autocomplete.js ui/widgets/button.js ui/widgets/checkboxradio.js ui/widgets/controlgroup.js ui/widgets/dialog.js ui/widgets/draggable.js ui/widgets/menu.js ui/widgets/mouse.js ui/widgets/resizable.js ../drupal/core/assets/vendor/jquery.ui/ui/widgets

Minified files re-generated using yarn build:jqueryui.

Additional files changed in this patch:

  • core/core.libraries.yml
  • core/package.json
  • core/tests/Drupal/KernelTests/Core/Asset/LegacyLibraryDiscoveryTest.php
  • core/yarn.lock
  • core/scripts/js/jqueryui-build.js
  • core/scripts/js/jqueryui-terser.js

Patch created with command: git diff 9.0.x HEAD > 3087685-55.patch

Dependency Evaluation

Terser was selected to minify the jQuery UI source. It is a modern, popular and well-maintained project for minifying JavaScript.

  • Maintainership of the package: Terser has multiple maintainers, in the past month 6 authors have pushed 44 commits. Only one person is listed as a maintainer, however there are several active contributors Terser is used by 1.3 million other packages. Terser is used by Webpack, Rollup, Next.js and CKEditor is a supporting sponsor.
  • Security policies of the package: Not found. This library is only used in by core developers in development environments.
  • Expected release and support cycles: There have been 3 major releases in the last 7 years. Minor releases are tagged every few days for at least the past year. Changelog is regularly updated.
  • Code quality: Well documented API with examples, test coverage using mocha and custom tests for compressor
  • Other dependencies it would add, if any: Everything in the list of additional dependencies is actually already used for our JavaScript ES6 transpilation, just in different versions, so we are not actually adding new packages. (This is a feature yarn supports.) We could do selective dependency resolution to flatten our dev dependency tree, but in this case it's probably not worth that since this is our dev dependency toolchain.

Remaining tasks

This issue was originally postponed on the following two issues (now completed):

  1. Review the patch
  2. Review the issue on d8githooks
  3. Put instructions for re-minifying the libraries somewhere that's easily discoverable as well as referenced in the core codebase, in case we need to fix any security issues for the retained libraries during Drupal 9's security coverage. (added in https://www.drupal.org/docs/8/frontend-developer-tools-for-drupal-core)

User interface changes

None from this issue in itself, but the blockers may introduce some.

API changes

Most jQuery UI libraries are removed from Drupal core.

Data model changes

N/A

Release notes snippet

Unused jQuery UI components were deprecated in Drupal 8.8 and removed in Drupal 9.0. The libraries which could not be removed for 8.8.0 were forked into Drupal 9 core to make them maintainable in case of any security issues before Drupal 9 end-of-life, with the goal of deprecating them all for complete removal prior to 10.0.0.


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>