Ticket #48154: 48154.diff
File 48154.diff, 5.1 KB (added by , 5 years ago) |
---|
-
Gruntfile.js
117 117 WORKING_DIR + 'wp-includes/js/' 118 118 ], 119 119 'webpack-assets': [ 120 WORKING_DIR + 'wp-includes/js/ **/*.asset.php'120 WORKING_DIR + 'wp-includes/js/dist/assets.php' 121 121 ], 122 122 dynamic: { 123 123 dot: true, … … 356 356 ] 357 357 }, 358 358 'webpack-assets': { 359 expand: true, 360 cwd: WORKING_DIR + 'wp-includes/js/', 361 src: 'dist/*.asset.php', 362 dest: WORKING_DIR + 'wp-includes/assets/' 359 files: [ 360 { 361 src: WORKING_DIR + 'wp-includes/js/dist/assets.php', 362 dest: SOURCE_DIR + 'wp-includes/assets/script-loader-deps.php' 363 }, 364 { 365 src: WORKING_DIR + 'wp-includes/js/dist/assets.php', 366 dest: BUILD_DIR + 'wp-includes/assets/script-loader-deps.php' 367 } 368 ] 363 369 }, 364 370 version: { 365 371 options: { -
package-lock.json
2525 2525 } 2526 2526 }, 2527 2527 "@wordpress/dependency-extraction-webpack-plugin": { 2528 "version": "2. 2.0",2529 "resolved": "https://registry.npmjs.org/@wordpress/dependency-extraction-webpack-plugin/-/dependency-extraction-webpack-plugin-2. 2.0.tgz",2530 "integrity": "sha512- 74zJPfSohTfcNtNG/Y0VmE/ow1sG6wCEl7A7xN3VdhMRFUOfpfGV2XifBA9UjDoxY/IAbf80WDqiuA7MzcDMKw==",2528 "version": "2.3.0", 2529 "resolved": "https://registry.npmjs.org/@wordpress/dependency-extraction-webpack-plugin/-/dependency-extraction-webpack-plugin-2.3.0.tgz", 2530 "integrity": "sha512-FwEN0PuFr3Q5IdDLgerkIspiHkePNbzem71R3RlUevaSmnw+iH9/0Jzg4uIQ8KCMBpbrn1gAmhgdaTgTDn3EfQ==", 2531 2531 "dev": true, 2532 2532 "requires": { 2533 2533 "json2php": "^0.0.4", -
package.json
26 26 ], 27 27 "devDependencies": { 28 28 "@wordpress/custom-templated-path-webpack-plugin": "1.6.0", 29 "@wordpress/dependency-extraction-webpack-plugin": "2. 2.0",29 "@wordpress/dependency-extraction-webpack-plugin": "2.3.0", 30 30 "@wordpress/e2e-test-utils": "4.3.0", 31 31 "@wordpress/library-export-default-webpack-plugin": "1.6.0", 32 32 "@wordpress/scripts": "6.2.0", -
src/wp-includes/script-loader.php
231 231 function wp_default_packages_scripts( &$scripts ) { 232 232 $suffix = wp_scripts_get_suffix(); 233 233 234 $packages = array( 235 'a11y', 236 'annotations', 237 'api-fetch', 238 'autop', 239 'blob', 240 'block-directory', 241 'block-editor', 242 'block-library', 243 'block-serialization-default-parser', 244 'blocks', 245 'components', 246 'compose', 247 'core-data', 248 'data', 249 'data-controls', 250 'date', 251 'deprecated', 252 'dom', 253 'dom-ready', 254 'edit-post', 255 'editor', 256 'element', 257 'escape-html', 258 'format-library', 259 'hooks', 260 'html-entities', 261 'i18n', 262 'is-shallow-equal', 263 'keyboard-shortcuts', 264 'keycodes', 265 'list-reusable-blocks', 266 'media-utils', 267 'notices', 268 'nux', 269 'plugins', 270 'primitives', 271 'priority-queue', 272 'redux-routine', 273 'rich-text', 274 'shortcode', 275 'server-side-render', 276 'token-list', 277 'url', 278 'viewport', 279 'warning', 280 'wordcount', 281 ); 234 // Expects an array of: `'a11y.js' => array('dependencies' => array(...), 'version' => '...'),`. 235 $assets = include ABSPATH . WPINC . '/assets/script-loader-deps.php'; 236 $packages = array_keys( $assets ); 282 237 283 238 $package_translations = array( 284 239 'api-fetch', … … 296 251 ); 297 252 298 253 foreach ( $packages as $package ) { 299 $handle = 'wp-' . $package; 300 $path = "/wp-includes/js/dist/$package$suffix.js"; 254 $basename = basename( $package, '.js' ); 255 $handle = 'wp-' . $basename; 256 $path = "/wp-includes/js/dist/$basename$suffix.js"; 301 257 302 if ( ! file_exists( ABSPATH . $path ) ) { 303 continue; 258 if ( ! empty( $assets[ $package ]['dependencies'] ) ) { 259 $dependencies = $assets[ $package ]['dependencies']; 260 } else { 261 $dependencies = array(); 304 262 } 305 263 306 $asset_file = require ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php";307 $dependencies = $asset_file['dependencies'];308 309 264 // Add dependencies that cannot be detected and generated by build tools. 310 265 switch ( $handle ) { 311 266 case 'wp-block-library': … … 316 271 break; 317 272 } 318 273 319 $scripts->add( $handle, $path, $dependencies, $asset _file['version'], 1 );274 $scripts->add( $handle, $path, $dependencies, $assets[ $package ]['version'], 1 ); 320 275 321 if ( in_array( $ package, $package_translations, true ) ) {276 if ( in_array( $basename, $package_translations, true ) ) { 322 277 $scripts->set_translations( $handle ); 323 278 } 324 279 } -
tools/webpack/packages.js
246 246 } ), 247 247 new DependencyExtractionPlugin( { 248 248 injectPolyfill: true, 249 combineAssets: true, 249 250 } ), 250 251 new CopyWebpackPlugin( 251 252 [