storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.68k stars 9.32k forks source link

Addon Docs: Dynamically import rehype #29544

Open valentinpalkovic opened 1 week ago

valentinpalkovic commented 1 week ago

Closes https://github.com/storybookjs/storybook/issues/29467

What I did

I have rewritten rehype imports to dynamic imports so that the import doesn't break in CJS environments.

Checklist for Contributors

Testing

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

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

Checklist for Maintainers

🦋 Canary release

This pull request has been released as version 0.0.0-pr-29544-sha-fd7f82f1. Try it out in a new sandbox by running npx storybook@0.0.0-pr-29544-sha-fd7f82f1 sandbox or in an existing project with npx storybook@0.0.0-pr-29544-sha-fd7f82f1 upgrade.

More information | | | | --- | --- | | **Published version** | [`0.0.0-pr-29544-sha-fd7f82f1`](https://npmjs.com/package/storybook/v/0.0.0-pr-29544-sha-fd7f82f1) | | **Triggered by** | @valentinpalkovic | | **Repository** | [storybookjs/storybook](https://github.com/storybookjs/storybook) | | **Branch** | [`valentin/dynamic-import-of-rehype`](https://github.com/storybookjs/storybook/tree/valentin/dynamic-import-of-rehype) | | **Commit** | [`fd7f82f1`](https://github.com/storybookjs/storybook/commit/fd7f82f1f620ba07de603f2135420cfcf451a2ba) | | **Datetime** | Tue Nov 5 11:21:27 UTC 2024 (`1730805687`) | | **Workflow run** | [11683115704](https://github.com/storybookjs/storybook/actions/runs/11683115704) | To request a new release of this pull request, mention the `@storybookjs/core` team. _core team members can create a new canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) or locally with `gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=29544`_
name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.2 MB 78.2 MB 0 B 1.16 0%
initSize 143 MB 143 MB 3.6 kB 1.19 0%
diffSize 65.1 MB 65.1 MB 3.6 kB 1.29 0%
buildSize 6.88 MB 6.88 MB 0 B 1.12 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 1.11 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B 1.11 0%
buildPreviewSize 3 MB 3 MB 0 B 1.11 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 6.5s 20.3s 13.7s 0.92 67.7%
generateTime 19.5s 19.7s 148ms -0.7 0.8%
initTime 13.5s 13.9s 425ms -0.84 3%
buildTime 8.1s 9.1s 981ms 0.1 10.7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.5s 5.6s 163ms -0.52 2.9%
devManagerResponsive 3.5s 3.3s -176ms -0.93 -5.2%
devManagerHeaderVisible 473ms 517ms 44ms -0.88 8.5%
devManagerIndexVisible 500ms 551ms 51ms -1.12 9.3%
devStoryVisibleUncached 602ms 1.1s 511ms 0.31 45.9%
devStoryVisible 499ms 550ms 51ms -1.03 9.3%
devAutodocsVisible 467ms 481ms 14ms -0.63 2.9%
devMDXVisible 450ms 501ms 51ms -0.39 10.2%
buildManagerHeaderVisible 631ms 503ms -128ms -0.87 -25.4%
buildManagerIndexVisible 648ms 523ms -125ms -0.78 -23.9%
buildStoryVisible 630ms 501ms -129ms -0.89 -25.7%
buildAutodocsVisible 477ms 412ms -65ms -0.93 -15.8%
buildMDXVisible 478ms 414ms -64ms -0.77 -15.5%

Greptile Summary

Modified the import method for rehype plugins in MDX-related files to use dynamic imports instead of static imports, improving CommonJS environment compatibility.

nx-cloud[bot] commented 1 week ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit fd7f82f1f620ba07de603f2135420cfcf451a2ba. 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 2 targets - [`nx affected -t check -c production --parallel=7`](https://cloud.nx.app/runs/ui89i9lWft?utm_source=pull-request&utm_medium=comment) - [`nx run-many -t build -c production --parallel=3`](https://cloud.nx.app/runs/qMIt7rRvz8?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.