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

Index: Add support for resolving import maps #28951

Draft
wants to merge 2 commits into
base: valentin/coverage-addon-1
Choose a base branch
from

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Aug 22, 2024

Closes #28949

What I did

I added support for import maps getting resolved for componentPath in story indexer.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Untested for now, I think this needs to be tested somehow, but I'm not sure about exactly which approach to take.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.4 MB 76.4 MB 2.3 kB 2.76 0%
initSize 177 MB 177 MB 12.5 kB 2.28 0%
diffSize 101 MB 101 MB 10.2 kB 2.24 0%
buildSize 7.46 MB 7.46 MB 0 B 1.88 0%
buildSbAddonsSize 1.62 MB 1.62 MB 0 B 2.23 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.3 MB 2.3 MB 0 B -2.24 0%
buildSbPreviewSize 351 kB 351 kB 0 B 2.24 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.46 MB 4.46 MB 0 B 2.23 0%
buildPreviewSize 3 MB 3 MB 0 B 0.66 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 23s 7.6s -15s -361ms -1.24 🔰-200.7%
generateTime 18.9s 22.5s 3.5s 1.72 🔺15.8%
initTime 16.5s 20.1s 3.6s 1.86 🔺17.9%
buildTime 11.7s 10.9s -736ms -1.54 🔰-6.7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.5s 7.4s 993ms -0.85 13.2%
devManagerResponsive 4.5s 5.2s 675ms -0.29 13%
devManagerHeaderVisible 731ms 662ms -69ms -1.84 🔰-10.4%
devManagerIndexVisible 773ms 696ms -77ms -1.88 🔰-11.1%
devStoryVisibleUncached 1s 1.1s 110ms -1.03 9.5%
devStoryVisible 781ms 705ms -76ms -1.93 🔰-10.8%
devAutodocsVisible 748ms 648ms -100ms -1.1 -15.4%
devMDXVisible 658ms 580ms -78ms -1.64 🔰-13.4%
buildManagerHeaderVisible 694ms 627ms -67ms -1.56 🔰-10.7%
buildManagerIndexVisible 726ms 632ms -94ms -1.57 🔰-14.9%
buildStoryVisible 728ms 663ms -65ms -1.53 🔰-9.8%
buildAutodocsVisible 683ms 624ms -59ms -1.08 -9.5%
buildMDXVisible 665ms 562ms -103ms -1.61 🔰-18.3%

Copy link

nx-cloud bot commented Aug 22, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 8c97c02. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

input.rawComponentPath &&
this.resolveComponentPath(input.rawComponentPath, absolutePath, matchPath);
let componentPath;
if (input.rawComponentPath?.startsWith('#')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In Storybook, we currently tell people to use a hash for import path mappings. But can this change? Is it theoretically allowed to use another prefix to make module mocking work?

cc @kasperpeulen

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAIK the spec says it has to be # symbol.

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.

2 participants