Make WordPress Core

Opened 21 months ago

Closed 11 months ago

Last modified 8 months ago

#56731 closed enhancement (fixed)

Update the `imagesloaded` library

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 6.4 Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: good-first-bug has-patch dev-feedback
Focuses: javascript Cc:

Description

Currently, version 4.1.4 of imagesloaded is bundled in Core. Version 5.0.0 is available, so the bundled version should be updated.

This was looked at initially as part of #56670, but there's a strange issue with grunt jsvalidate:build where the new version of the file does not pass the first time the task is run, but does on successive runs.

Change History (22)

#1 follow-up: @desrosj
21 months ago

The failure encountered:

Running "jsvalidate:build" (jsvalidate) task
Validating src/wp-includes/js/imagesloaded.min.js  
>> Line 6: Unexpected identifier
Encountered 2 errors.
Warning: Task "jsvalidate:build" failed. Use --force to continue.

This ticket was mentioned in PR #3653 on WordPress/wordpress-develop by @nazsabuz.


19 months ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @nazsabuz
19 months ago

  • Keywords needs-patch added; has-patch removed

PR closed as it's not resolving the issue.

#4 @cunadkat
19 months ago

  • Keywords dev-feedback added

Hi,

Actully we don't need this library anymore. We can check if images are loaded or not with vanilla js. If that is okay. I can make the changes and raise PR

#5 @desrosj
19 months ago

  • Keywords dev-feedback removed

The imagesloaded library was included in Core to be used in conjunction with the masonry library.

While vanilla JavaScript could be used to accomplish the same things in modern times, the intention here is to update this external library to the latest version in case someone is still utilizing it. Some basic scans of the plugin and theme directory show that a fair number of sites are still enqueuing this library.

Once an external library is included in WordPress Core, it very rarely is removed for backwards compatibility reasons.

#6 @arnedb
18 months ago

Hi @desrosj ,

How exactly did you create this bug?

I've tried running npm run build:dev a couple of times on a fresh copy, but I keep getting a good result:

Running "jsvalidate:build" (jsvalidate) task
451 files are valid.

This ticket was mentioned in Slack in #core by costdev. View the logs.


17 months ago

#8 @desrosj
17 months ago

The bug I described only happens after attempting to update the dependency. Steps to reproduce:

  • Update the imagesloaded dependency to 5.0.0 in the package.json file.
  • Run npm install
  • Run npm run build and observe the error.

This ticket was mentioned in PR #3927 on WordPress/wordpress-develop by @desrosj.


17 months ago
#9

  • Keywords has-patch added; needs-patch removed

#10 @desrosj
17 months ago

  • Keywords needs-patch added; has-patch removed

This ticket was mentioned in Slack in #core by costdev. View the logs.


17 months ago

#12 @costdev
17 months ago

  • Milestone changed from 6.2 to Future Release

This ticket was discussed during the bug scrub. As 6.2 Beta 1 is in a few days, I'm moving this ticket to Future Release. If it's ready for commit before 6.2 Beta 1, feel free to re-milestone it for 6.2.

Additional props: @audrasjb

#13 @shanemuir
16 months ago

Hey, I wanted to maybe look into a patch a 'good first bug' since I have never contributed to WP before. I have been able to get the latest SVN repo running locally and re-produce this bug but since imagesloaded is a 3rd party package I am unsure on the steps to providing a patch. Can anyone give me any pointers on how to resolve this bug?

This ticket was mentioned in PR #4247 on WordPress/wordpress-develop by @AhmedGeek.


15 months ago
#14

  • Keywords has-patch added; needs-patch removed

V5.0.0 is built with ES6 and it needs to be transpiled first to pass the jsvalidate task.

I added a babel task that transpiles it, this required adding grunt-babel as a dev dependency.

Trac ticket: https://core.trac.wordpress.org/ticket/56731

#15 @valmedia2023
13 months ago

  • Component changed from External Libraries to Build/Test Tools
  • Focuses javascript added
  • Keywords dev-feedback missing file added
  • Resolution set to reported-upstream
  • Status changed from new to closed
  • Type changed from enhancement to defect (bug)
  • Version set to 6.2

When testing the test.js file I receive this message.
Build failed with 1 error:
error: Cannot find module 'ava' from '/' js 1.21 is not installed

Last edited 13 months ago by valmedia2023 (previous) (diff)

#16 @SergeyBiryukov
13 months ago

  • Component changed from Build/Test Tools to External Libraries
  • Keywords missing file removed
  • Resolution reported-upstream deleted
  • Status changed from closed to reopened
  • Type changed from defect (bug) to enhancement
  • Version 6.2 deleted

Restoring the correct component and properties, please see The Bug Tracker (Trac) and Trac Workflow Keywords.

#18 in reply to: ↑ 1 @SergeyBiryukov
11 months ago

  • Milestone changed from Future Release to 6.4

Replying to desrosj:

The failure encountered:

Running "jsvalidate:build" (jsvalidate) task
Validating src/wp-includes/js/imagesloaded.min.js  
>> Line 6: Unexpected identifier
Encountered 2 errors.
Warning: Task "jsvalidate:build" failed. Use --force to continue.

This appears to be unblocked by [56247] / #58645.

#19 @Hareesh Pillai
11 months ago

After the removal of jsvalidate, I could successfully generate a build with imagesloaded v5.0.0

Also, noting that the version might need to be updated in script-loader.php file as well.

#20 @desrosj
11 months ago

  • Owner set to desrosj
  • Status changed from reopened to reviewing

#21 @desrosj
11 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 56393:

External Libraries: Update imagesLoaded to version 5.0.0.

This release drops support for IE and moves to using ES6.

A full list of changes can be found on GitHub: https://github.com/desandro/imagesloaded/compare/v4.1.4...v5.0.0.

Props nazsabuz, arnedb, costdev, audrasjb, ahmedgeek , valmedia2023 , hareesh-pillai.
Fixes #56731.

Note: See TracTickets for help on using tickets.