Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@eltharin
Copy link
Contributor

@eltharin eltharin commented May 26, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Issues Fix ##59791
License MIT

This PR allow AssetMApper to deal with "no modules" libraries,
When we want to require a JS/CSS lib witch doen't have js module, we must import all files to download them.
But in a furthurer version, if one file is added or removed we can skip it.

With the new type "full", Assetmapper can read package contents files and download all of them.

  • create tests
  • Add documentation
  • Add flex change for importmap require from bundle

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.3" but it seems your PR description refers to branch "7.4".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@eltharin eltharin changed the title add "full" type for packages to download all content [AssetMapper] add "full" type for packages to download all content May 26, 2025
@eltharin eltharin force-pushed the assetmapper_ad_full_type branch from 5403809 to 5a74e2c Compare May 26, 2025 18:13
@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
@eltharin eltharin force-pushed the assetmapper_ad_full_type branch from 5a74e2c to 2efdbb1 Compare May 26, 2025 18:26
@smnandre
Copy link
Member

smnandre commented Jul 7, 2025

Could you give an example to illustrate ?

@eltharin
Copy link
Contributor Author

all js/css lib to require without esm.
I saw some issues where asked too.
For CSS files it avoid to specify all one by one and omit if new one appear

example : #57604

With the flex update, it will be possible to require external js and css from a bundle

@smnandre
Copy link
Member

So... I'll quote the documentation of AssetMapper here

image
  • Mapping & Versioning Assets: All files inside of assets/ are made available publicly and versioned
  • Importmaps: A native browser feature that makes it easier to use the JavaScript import statement

This PR allow AssetMApper to deal with "no modules" libraries,

Then this should not be done in the importmap command / classes. As it is fundamentally different from what this package is about. I don't think we would add a sendSms() method in the Mailer package. This is the same level of difference

With the flex update, it will be possible to require external js and css from a bundle

This is outside importmap responsibility, and should imho stay that way.

ImportMap package is made to handle.... import maps (meaning modules).

<personal note>
If people want to work on a better DX for bundle users, and want to spend time working on that, they can open PR / discussions... I even have a couple ideas / promising concepts: but they do need people with time and desire to work on it, and will require bigger changes / new features in the component.

But bringing "hidden features"* in AssetMapper / ImportMap because it feels a "quick way" to do things from the bundle editor perspective seems weird to me.. what i mean by hidden features is "things never asked by end-users, or that are outside the scope of this component, and that are only technical methods for one goal: automate download of assets for bundle editors wanting to force that after composer install -- again, not the goal of this component.
</personal note>

--

On the implementation side, i think it would be best to isolate this code in another part of the component.

Correct me if I miss understood something here, but as i read the PR code, "full" type does not seem to be a package type like the existing others and i'm not sure we should have it mixed with CSS and JS, that are used for other purpose here. Using it as command option would allow unpredictable things like asking for a CSS file as FULL type, right?

@eltharin eltharin closed this Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants