Add a constant for the -1 version in LibraryDiscoveryParser

Created on 22 July 2023, over 1 year ago
Updated 18 April 2024, 8 months ago

Problem/Motivation

When LibraryDiscoveryParser find a library with no version specified, it sets it as -1. There's also a @todo to use a module version if that is set.

Steps to reproduce

Proposed resolution

Add a constant, probably LibraryDiscoveryInterface::UNVERSIONED or something? so that we can document the magic -1 number.

We could also potentially expand the scope to resolve the @todo and add module version there when it's not set, or do that in a follow-up if it's tricky.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Asset library 

Last updated about 23 hours ago

No maintainer
Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @catch
  • 🇨🇭Switzerland berdir Switzerland

    Somewhat related to this, should we more strongly discourage or even automatically replace/ignore a library version of "VERSION"? core uses that and contrib copies that a lot (I see 227 results for that just in the contrib modules in my current project).

    Or instead of removing and ignoring, we could possibly also make it work and get the module version in there.

    I think there's an existing separate issue for that as well, but I think the way 🐛 Ensure that edge caches are busted on deployments for css/js aggregates Fixed was solved means it will become much more of an issue.

  • 🇭🇺Hungary mxr576 Hungary

    Is there a reason why version === NULL should not replace version === -1? -1 is definitely not a valid semver number... I admittedly did not spend time on understanding from the original issue why -1 was decided to be used.

    When I updated the related documentation page I made sure that -1 is not mentioned because it has to remain an internal logic if it stays https://www.drupal.org/node/2274843/revisions/view/13464318/13535225

    Somewhat related to this, should we more strongly discourage or even automatically replace/ignore a library version of "VERSION"?

    Would be beneficial addressing that in the future, because there are always copy-paste-ppl out there who may not know (yet) what are they doing ;S

Production build 0.71.5 2024