Make WordPress Core

Opened 7 months ago

Last modified 7 weeks ago

#50460 new enhancement

Don't minimize the `script-loader-packages.php` file

Reported by: desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-patch
Focuses: Cc:


The wp-includes/assets/script-loader-packages.php file was added in #48154 through [47352] as a means to automate the process of updating the NPM packages from the Gutenberg repository (including dependencies and versions) in a way that the packages would still be available through the wp_(enqueue|register)_scripts().

This works great, but the file is a single line return statement that returns a multidimensional array, which makes it impossible to read through without reformatting it.

I am proposing that the file not be minimized to one line in order to make it human readable. This would have an added benefit of making the changesets readable, allowing someone to view a changeset and understand exactly what was changed or updated (see [47920], [47517], [47513]).

Change History (2)

#1 @desrosj
7 months ago

The generation of this file is handled in Webpack through the Dependency Extraction plugin in the Gutenberg repo. It doesn't seem that the output can be formatted in anything but single line looking over how that code works.

It may be easier to handle this in Core after the file is created.

#2 @johnbillion
7 weeks ago

There's a PHP plugin for Prettier, so the output could be post-processed with that.


Note: See TracTickets for help on using tickets.