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(imports): pass import aliases to mergeImports #5995

Merged
merged 9 commits into from
Jul 9, 2024
Merged

Conversation

liady
Copy link
Contributor

@liady liady commented Jun 19, 2024

Problem:
Currently our duplicate import mechanism doesn't consider import aliases, resulting in user actions generating duplicate imports in our sample project.

Fix:
This is the prep PR for passing the aliases to mergeImports - since it is running in a worker it cannot access it directly but needs to receive it from the calling context.

This PR only adds filePathMappings: FilePathMappings as an argument to mergeImports and renameDuplicateImports

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Preview mode

@liady liady changed the title fix(imports): fix import mechanism to cosider file path mappings (aliases) fix(imports): fix import mechanism to consider file path mappings (aliases) Jun 19, 2024
Copy link

relativeci bot commented Jun 19, 2024

#13271 Bundle Size — 62.51MiB (~+0.01%).

f9e7682(current) vs 6339ece master#13264(baseline)

Warning

Bundle contains 51 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#13271
     Baseline
#13264
Regression  Initial JS 45.57MiB(~+0.01%) 45.56MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 22.08% 21.84%
No change  Chunks 30 30
No change  Assets 33 33
No change  Modules 4323 4323
No change  Duplicate Modules 524 524
No change  Duplicate Code 31.74% 31.74%
No change  Packages 450 450
No change  Duplicate Packages 51 51
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#13271
     Baseline
#13264
Regression  JS 62.5MiB (~+0.01%) 62.5MiB
Improvement  HTML 11.16KiB (-0.33%) 11.2KiB

Bundle analysis reportBranch fix/alias-importsProject dashboard

@liady liady changed the title fix(imports): fix import mechanism to consider file path mappings (aliases) fix(imports): fix import mechanism to take file aliases into account Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
@concrete-utopia concrete-utopia deleted a comment from github-actions bot Jun 25, 2024
Copy link
Contributor

github-actions bot commented Jun 25, 2024

Try me

@@ -204,3 +207,20 @@ export function parsedJSONFailure(
endCol: endCol,
}
}

export function applyFilePathMappingsToFilePath(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this only moved as-is from editor/src/core/model/project-file-utils.ts

@liady liady changed the title fix(imports): fix import mechanism to take file aliases into account fix(imports): pass import aliases to mergeImports Jul 8, 2024
@liady liady marked this pull request as ready for review July 8, 2024 14:08
@liady liady merged commit 879bf53 into master Jul 9, 2024
15 checks passed
@liady liady deleted the fix/alias-imports branch July 9, 2024 10:01
liady added a commit that referenced this pull request Dec 13, 2024
**Problem:**
Currently our duplicate import mechanism doesn't consider import
aliases, resulting in user actions generating duplicate imports in our
sample project.

**Fix:**
This is the prep PR for passing the aliases to `mergeImports` - since it
is running in a worker it cannot access it directly but needs to receive
it from the calling context.

**This PR only adds `filePathMappings: FilePathMappings` as an argument
to `mergeImports` and `renameDuplicateImports`**

**Manual Tests:**
I hereby swear that:

- [X] I opened a hydrogen project and it loaded
- [X] I could navigate to various routes in Preview mode
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.

3 participants