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

RNW-Vite: Add built-in Flow support #29756

Merged
merged 2 commits into from
Nov 30, 2024
Merged

Conversation

dannyhw
Copy link
Member

@dannyhw dannyhw commented Nov 30, 2024

Closes #

What I did

Added support for flow which is used by some React Native libraries and React Native source code itself.

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

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

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-storybook/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 pull request has been released as version 0.0.0-pr-29756-sha-18442450. Try it out in a new sandbox by running npx storybook@0.0.0-pr-29756-sha-18442450 sandbox or in an existing project with npx storybook@0.0.0-pr-29756-sha-18442450 upgrade.

More information
Published version 0.0.0-pr-29756-sha-18442450
Triggered by @shilman
Repository storybookjs/storybook
Branch dannyhw/fix-rnw-flow-support
Commit 18442450
Datetime Sat Nov 30 13:45:21 UTC 2024 (1732974321)
Workflow run 12096885441

To request a new release of this pull request, mention the @storybookjs/core team.

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 77.7 MB 364 B -0.37 0%
initSize 130 MB 130 MB 11.4 kB -1.73 0%
diffSize 52.4 MB 52.4 MB 11 kB -1.73 0%
buildSize 6.83 MB 6.83 MB 0 B 1.45 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B 0.42 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B 1.21 0%
buildSbPreviewSize 271 kB 271 kB 0 B 0.35 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.84 MB 3.84 MB 0 B 1.01 0%
buildPreviewSize 3 MB 3 MB 0 B 1.73 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.6s 23.4s 16.7s 1.27 🔺71.5%
generateTime 19.8s 18.2s -1s -545ms -0.85 -8.4%
initTime 13s 11.8s -1s -240ms -0.88 -10.5%
buildTime 7.9s 8.5s 617ms -0.47 7.2%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.2s 4.9s 725ms -0.59 14.7%
devManagerResponsive 3.2s 3.5s 379ms -0.11 10.6%
devManagerHeaderVisible 485ms 596ms 111ms -0.04 18.6%
devManagerIndexVisible 543ms 624ms 81ms -0.19 13%
devStoryVisibleUncached 1.6s 1.7s 184ms 0.77 10.3%
devStoryVisible 541ms 622ms 81ms -0.15 13%
devAutodocsVisible 419ms 487ms 68ms -0.28 14%
devMDXVisible 426ms 559ms 133ms 0.06 23.8%
buildManagerHeaderVisible 456ms 587ms 131ms -0.03 22.3%
buildManagerIndexVisible 469ms 602ms 133ms -0.04 22.1%
buildStoryVisible 456ms 590ms 134ms 0 22.7%
buildAutodocsVisible 384ms 476ms 92ms -0.04 19.3%
buildMDXVisible 368ms 447ms 79ms -0.2 17.7%

Greptile Summary

Added Flow support to React Native Web Vite framework in Storybook to handle Flow types used in React Native libraries and source code.

  • Added @bunchtogether/vite-plugin-flow dependency in code/frameworks/react-native-web-vite/package.json
  • Configured Flow plugin to run before React plugin in code/frameworks/react-native-web-vite/src/preset.ts
  • Added esbuild Flow support with JSX transformation for .flow and .jsx files
  • Added module declaration for Flow plugin in typings.d.ts for TypeScript compatibility

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

@shilman shilman changed the title RNW-Vite: feat add built in flow support RNW-Vite: Add built in flow support Nov 30, 2024
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +75 to +77
flowPlugin({
exclude: [],
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Empty exclude array may cause Flow to process all files. Consider adding appropriate exclusions for node_modules and build artifacts

@dannyhw dannyhw force-pushed the dannyhw/fix-rnw-flow-support branch from 54a9fee to 2462631 Compare November 30, 2024 13:04
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -1,8 +1,9 @@
// @ts-expect-error FIXME
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Fix the underlying type error instead of using @ts-expect-error

Copy link

nx-cloud bot commented Nov 30, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1844245. 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.

@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Nov 30, 2024

Package Benchmarks

Commit: 1844245, ran on 30 November 2024 at 13:52:51 UTC

The following packages have significant changes to their size or dependencies:

@storybook/addon-storysource

Before After Difference
Dependency count 7 7 0
Self size 1.89 MB 1.89 MB 0 B
Dependency size 10.25 MB 10.52 MB 🚨 +263 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-native-web-vite

Before After Difference
Dependency count 93 102 🚨 +9 🚨
Self size 41 KB 41 KB 🚨 +459 B 🚨
Dependency size 16.16 MB 17.87 MB 🚨 +1.71 MB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 390 390 0
Self size 484 KB 484 KB 0 B
Dependency size 74.63 MB 74.89 MB 🚨 +265 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 270 270 0
Self size 612 KB 612 KB 0 B
Dependency size 64.62 MB 64.89 MB 🚨 +265 KB 🚨
Bundle Size Analyzer Link Link

@storybook/source-loader

Before After Difference
Dependency count 5 5 0
Self size 41 KB 41 KB 0 B
Dependency size 10.20 MB 10.46 MB 🚨 +263 KB 🚨
Bundle Size Analyzer Link Link

@shilman shilman changed the title RNW-Vite: Add built in flow support RNW-Vite: Add built-in flow support Nov 30, 2024
@shilman shilman changed the title RNW-Vite: Add built-in flow support RNW-Vite: Add built-in Flow support Nov 30, 2024
@shilman shilman merged commit 78e0819 into next Nov 30, 2024
62 of 63 checks passed
@shilman shilman deleted the dannyhw/fix-rnw-flow-support branch November 30, 2024 16:24
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

132 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

return mergeConfig(reactConfig, {
optimizeDeps: {
esbuildOptions: {
plugins: [esbuildFlowPlugin(new RegExp(/\.(flow|jsx?)$/), (_path: string) => 'jsx')],
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Regular expression should be anchored with ^ and $ to prevent partial matches in file paths

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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