Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide base path from public URL of rollup-public-assets #2082

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

simonihmig
Copy link
Collaborator

As discussed in yesterday's team meeting, after some previous back and forth and confusion around where breaking changes should go into (main vs. stable), this PR is applying the same (breaking!) change that landed in main (#1972) to stable, so we can get this published (as yet another new major unfortunately) without waiting for main to stabilize.

More context in #1697 (comment)...

@simonihmig simonihmig marked this pull request as ready for review August 28, 2024 11:26
@simonihmig simonihmig requested a review from a team August 28, 2024 11:26
@simonihmig
Copy link
Collaborator Author

@mansona does release-plan expect an additional/different label other than breaking to make this into the release/changelog? I guess we could tag it as a bug fix, since it "fixes" an unexpected behavior?

@mansona
Copy link
Member

mansona commented Sep 28, 2024

@simonihmig no all you need is to define this as breaking and it will make it a major bump 👍

@@ -51,7 +51,7 @@ export default function publicAssets(
});
const publicAssets: Record<string, string> = filenames.reduce(
(acc: Record<string, string>, v): Record<string, string> => {
const namespace = opts?.namespace ?? join(pkg.name, path);
const namespace = opts?.namespace ?? pkg.name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this mean that all the public assets will just be flattened 🤔 you can't have any structure at all any more

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansone No, this is just the namespace, that is statically added to any file that is within the assets folder. Let's say the package name is fancy-addon, and its rollup config has addon.publicAssets('src/assets/public'), and it has a file in src/assets/public/foo/bar.jpg. Then before this change the plugin would add this to the package.json:

"public-assets": {
  "./src/assets/public/foo/bar.jpg": "fancy-addon/src/assets/public/foo/bar.jpg"
}

With this PR it would be:

"public-assets": {
  "./src/assets/public/foo/bar.jpg": "fancy-addon/foo/bar.jpg"
}

path in L54 would be src/assets/public in this example (as passed to the plugin), so that gets removed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants