wp_default_packages_scripts( WP_Scripts $scripts )
Registers all the WordPress packages scripts that are in the standardized js/dist/
location.
Description Description
For the order of $scripts->add
see wp_default_scripts
.
Parameters Parameters
- $scripts
-
(WP_Scripts) (Required) WP_Scripts object.
Source Source
File: wp-includes/script-loader.php
function wp_default_packages_scripts( &$scripts ) { $suffix = wp_scripts_get_suffix(); $packages_versions = array( 'a11y' => '2.5.1', 'annotations' => '1.7.2', 'api-fetch' => '3.6.4', 'autop' => '2.5.1', 'blob' => '2.5.1', 'block-editor' => '3.2.4', 'block-library' => '2.9.5', 'block-serialization-default-parser' => '3.4.1', 'blocks' => '6.7.2', 'components' => '8.3.2', 'compose' => '3.7.2', 'core-data' => '2.7.4', 'data-controls' => '1.3.4', 'data' => '4.9.2', 'date' => '3.5.0', 'deprecated' => '2.6.1', 'dom-ready' => '2.5.1', 'dom' => '2.5.2', 'edit-post' => '3.8.5', 'editor' => '9.7.5', 'element' => '2.8.2', 'escape-html' => '1.5.1', 'format-library' => '1.9.4', 'hooks' => '2.6.0', 'html-entities' => '2.5.0', 'i18n' => '3.6.1', 'is-shallow-equal' => '1.6.1', 'keycodes' => '2.6.2', 'list-reusable-blocks' => '1.8.4', 'media-utils' => '1.2.4', 'notices' => '1.8.2', 'nux' => '3.7.2', 'plugins' => '2.7.2', 'priority-queue' => '1.3.1', 'redux-routine' => '3.6.2', 'rich-text' => '3.7.2', 'shortcode' => '2.4.1', 'server-side-render' => '1.3.4', 'token-list' => '1.6.1', 'url' => '2.8.2', 'viewport' => '2.8.2', 'wordcount' => '2.6.2', ); $packages_dependencies = array( 'a11y' => array( 'wp-dom-ready', 'wp-polyfill', ), 'annotations' => array( 'lodash', 'wp-data', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'wp-rich-text', ), 'api-fetch' => array( 'wp-i18n', 'wp-polyfill', 'wp-url', ), 'autop' => array( 'wp-polyfill', ), 'blob' => array( 'wp-polyfill', ), 'block-editor' => array( 'lodash', 'wp-a11y', 'wp-blob', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-wordcount', ), 'block-library' => array( 'editor', 'lodash', 'moment', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-viewport', ), 'block-serialization-default-parser' => array( 'wp-polyfill', ), 'blocks' => array( 'lodash', 'wp-autop', 'wp-blob', 'wp-block-serialization-default-parser', 'wp-compose', 'wp-data', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-shortcode', ), 'components' => array( 'lodash', 'moment', 'wp-a11y', 'wp-compose', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-rich-text', ), 'compose' => array( 'lodash', 'wp-element', 'wp-is-shallow-equal', 'wp-polyfill', ), 'core-data' => array( 'lodash', 'wp-api-fetch', 'wp-data', 'wp-deprecated', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-url', ), 'data' => array( 'lodash', 'wp-compose', 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-priority-queue', 'wp-redux-routine', ), 'data-controls' => array( 'wp-api-fetch', 'wp-data', 'wp-polyfill', ), 'date' => array( 'moment', 'wp-polyfill', ), 'deprecated' => array( 'wp-hooks', 'wp-polyfill', ), 'dom' => array( 'lodash', 'wp-polyfill', ), 'dom-ready' => array( 'wp-polyfill', ), 'edit-post' => array( 'lodash', 'postbox', 'media-models', 'media-views', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url', 'wp-viewport', ), 'editor' => array( 'lodash', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-nux', 'wp-polyfill', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-viewport', 'wp-wordcount', ), 'element' => array( 'lodash', 'react', 'react-dom', 'wp-escape-html', 'wp-polyfill', ), 'escape-html' => array( 'wp-polyfill', ), 'format-library' => array( 'lodash', 'wp-block-editor', 'wp-components', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-rich-text', 'wp-url', ), 'hooks' => array( 'wp-polyfill', ), 'html-entities' => array( 'wp-polyfill', ), 'i18n' => array( 'wp-polyfill', ), 'is-shallow-equal' => array( 'wp-polyfill', ), 'keycodes' => array( 'lodash', 'wp-i18n', 'wp-polyfill', ), 'list-reusable-blocks' => array( 'lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-polyfill', ), 'media-utils' => array( 'lodash', 'wp-api-fetch', 'wp-blob', 'wp-element', 'wp-i18n', 'wp-polyfill', ), 'notices' => array( 'lodash', 'wp-a11y', 'wp-data', 'wp-polyfill', ), 'nux' => array( 'lodash', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', ), 'plugins' => array( 'lodash', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill', ), 'priority-queue' => array( 'wp-polyfill', ), 'redux-routine' => array( 'lodash', 'wp-polyfill', ), 'rich-text' => array( 'lodash', 'wp-compose', 'wp-data', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', ), 'server-side-render' => array( 'lodash', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url', ), 'shortcode' => array( 'lodash', 'wp-polyfill', ), 'token-list' => array( 'lodash', 'wp-polyfill', ), 'url' => array( 'wp-polyfill', ), 'viewport' => array( 'lodash', 'wp-compose', 'wp-data', 'wp-polyfill', ), 'wordcount' => array( 'lodash', 'wp-polyfill', ), ); $package_translations = array( 'api-fetch', 'blocks', 'block-editor', 'block-library', 'components', 'edit-post', 'editor', 'format-library', 'keycodes', 'list-reusable-blocks', 'nux', ); foreach ( $packages_dependencies as $package => $dependencies ) { $handle = 'wp-' . $package; $path = "/wp-includes/js/dist/$package$suffix.js"; $version = $packages_versions[ $package ]; $scripts->add( $handle, $path, $dependencies, $version, 1 ); if ( in_array( $package, $package_translations, true ) ) { $scripts->set_translations( $handle ); } } }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |