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

fix: passing BindingResolveOptions#alias from js to rust with maintaining order #798

Merged

Conversation

PengBoUESTC
Copy link
Contributor

Description

convert alias to Vec<AliasItem>

for issue #790

Copy link

netlify bot commented Apr 8, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit d27f635
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/6613f3f28897e2000728e75a

Copy link

codspeed-hq bot commented Apr 8, 2024

CodSpeed Performance Report

Merging #798 will not alter performance

Comparing PengBoUESTC:feature/binding-resolve-options-alias (d27f635) with main (8318303)

Summary

✅ 6 untouched benchmarks

#[serde(rename_all = "camelCase")]
pub struct AliasItem {
pub find: String,
pub replacement: Vec<String>,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub replacement: Vec<String>,
pub replacements: Vec<String>,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

filename should be alias_item.rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

export type RolldownResolveOptions = Omit<BindingResolveOptions, 'alias'> & {
alias?: Record<string, string>
alias?: Record<string, string> | Alias[]
Copy link
Member

Choose a reason for hiding this comment

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

Please don't change the type of alias. For users, they still pass alias using object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I notice that, in vite and rollup, config alias is support for Array and object

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. Vite use https://github.com/rollup/plugins/tree/master/packages/alias#entries under the hood. The API it provided has different usages for array or object, which means you could not use object to use customResolver API.

However, we don't have this need. In our cases, object and array does the same thing. To keep it simple, supporting object only would be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, get it

@hyf0 hyf0 self-assigned this Apr 8, 2024
@hyf0 hyf0 linked an issue Apr 8, 2024 that may be closed by this pull request
@hyf0 hyf0 changed the title feat: passing BindingResolveOptions#alias from js to rust with maintaining order fix: passing BindingResolveOptions#alias from js to rust with maintaining order Apr 8, 2024
Copy link
Member

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

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

Thanks

@hyf0 hyf0 force-pushed the feature/binding-resolve-options-alias branch from 78d84cd to d27f635 Compare April 8, 2024 13:41
@hyf0 hyf0 enabled auto-merge (squash) April 8, 2024 13:41
@hyf0 hyf0 merged commit 2f3d865 into rolldown:main Apr 8, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing BindingResolveOptions#alias from js to rust with maintaining order
2 participants