-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29633 from storybookjs/version-non-patch-from-8.5…
….0-alpha.5 Release: Prerelease 8.5.0-alpha.6
- Loading branch information
Showing
165 changed files
with
10,263 additions
and
1,250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Storybook for React Native Web & Vite | ||
|
||
See [documentation](https://storybook.js.org/docs/get-started/frameworks/react-native-web-vite?renderer=react-native-web) for installation instructions, usage examples, APIs, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"name": "@storybook/react-native-web-vite", | ||
"version": "8.5.0-alpha.5", | ||
"description": "Develop react-native components an isolated web environment with hot reloading.", | ||
"keywords": [ | ||
"storybook" | ||
], | ||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/react-native-web-vite", | ||
"bugs": { | ||
"url": "https://github.com/storybookjs/storybook/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/storybookjs/storybook.git", | ||
"directory": "code/frameworks/react-native-web-vite" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/storybook" | ||
}, | ||
"license": "MIT", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"node": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./preset": { | ||
"types": "./dist/preset.d.ts", | ||
"require": "./dist/preset.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*", | ||
"template/cli/**/*", | ||
"README.md", | ||
"*.js", | ||
"*.d.ts", | ||
"!src/**/*" | ||
], | ||
"scripts": { | ||
"check": "jiti ../../../scripts/prepare/check.ts", | ||
"prep": "jiti ../../../scripts/prepare/bundle.ts" | ||
}, | ||
"dependencies": { | ||
"@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0", | ||
"@storybook/builder-vite": "workspace:*", | ||
"@storybook/react": "workspace:*", | ||
"@storybook/react-vite": "workspace:*", | ||
"@vitejs/plugin-react": "^4.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.0.0", | ||
"typescript": "^5.3.2" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", | ||
"react-native": ">=0.74.5", | ||
"react-native-web": "^0.19.12", | ||
"storybook": "workspace:^", | ||
"vite": "^5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"bundler": { | ||
"entries": [ | ||
"./src/index.ts", | ||
"./src/preset.ts" | ||
], | ||
"platform": "node" | ||
}, | ||
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/preset'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "react-native-web-vite", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "library", | ||
"targets": { | ||
"build": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { FrameworkOptions, StorybookConfig } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// @ts-expect-error FIXME | ||
import { viteFinal as reactViteFinal } from '@storybook/react-vite/preset'; | ||
|
||
import type { BabelOptions, Options as ReactOptions } from '@vitejs/plugin-react'; | ||
import react from '@vitejs/plugin-react'; | ||
import type { PluginOption } from 'vite'; | ||
|
||
import type { FrameworkOptions, StorybookConfig } from './types'; | ||
|
||
function reactNativeWeb( | ||
reactOptions: Omit<ReactOptions, 'babel'> & { babel?: BabelOptions } | ||
): PluginOption { | ||
return { | ||
name: 'vite:react-native-web', | ||
config(_userConfig, env) { | ||
return { | ||
define: { | ||
// reanimated support | ||
'global.__x': {}, | ||
_frameTimestamp: undefined, | ||
_WORKLET: false, | ||
__DEV__: `${env.mode === 'development'}`, | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || env.mode), | ||
}, | ||
optimizeDeps: { | ||
include: [], | ||
esbuildOptions: { | ||
jsx: 'transform', | ||
resolveExtensions: [ | ||
'.web.js', | ||
'.web.ts', | ||
'.web.tsx', | ||
'.js', | ||
'.jsx', | ||
'.json', | ||
'.ts', | ||
'.tsx', | ||
'.mjs', | ||
], | ||
loader: { | ||
'.js': 'jsx', | ||
}, | ||
}, | ||
}, | ||
resolve: { | ||
extensions: [ | ||
'.web.js', | ||
'.web.ts', | ||
'.web.tsx', | ||
'.js', | ||
'.jsx', | ||
'.json', | ||
'.ts', | ||
'.tsx', | ||
'.mjs', | ||
], | ||
alias: { | ||
'react-native': 'react-native-web', | ||
}, | ||
}, | ||
}; | ||
}, | ||
}; | ||
} | ||
|
||
export const viteFinal: StorybookConfig['viteFinal'] = async (config, options) => { | ||
const { pluginReactOptions = {} } = | ||
await options.presets.apply<FrameworkOptions>('frameworkOptions'); | ||
|
||
const reactConfig = await reactViteFinal(config, options); | ||
const { plugins = [] } = reactConfig; | ||
|
||
plugins.unshift( | ||
react({ | ||
babel: { | ||
babelrc: false, | ||
configFile: false, | ||
}, | ||
jsxRuntime: 'automatic', | ||
...pluginReactOptions, | ||
}) | ||
); | ||
plugins.push(reactNativeWeb(pluginReactOptions)); | ||
|
||
return reactConfig; | ||
}; | ||
|
||
export const core = { | ||
builder: '@storybook/builder-vite', | ||
renderer: '@storybook/react', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { CompatibleString } from 'storybook/internal/types'; | ||
|
||
import type { | ||
FrameworkOptions as FrameworkOptionsBase, | ||
StorybookConfig as StorybookConfigBase, | ||
} from '@storybook/react-vite'; | ||
|
||
import type { BabelOptions, Options as ReactOptions } from '@vitejs/plugin-react'; | ||
|
||
export type FrameworkOptions = FrameworkOptionsBase & { | ||
pluginReactOptions?: Omit<ReactOptions, 'babel'> & { babel?: BabelOptions }; | ||
}; | ||
|
||
type FrameworkName = CompatibleString<'@storybook/react-native-web-vite'>; | ||
|
||
/** The interface for Storybook configuration in `main.ts` files. */ | ||
export type StorybookConfig = Omit<StorybookConfigBase, 'framework'> & { | ||
framework: | ||
| FrameworkName | ||
| { | ||
name: FrameworkName; | ||
options: FrameworkOptions; | ||
}; | ||
}; |
7 changes: 7 additions & 0 deletions
7
code/frameworks/react-native-web-vite/template/cli/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"rules": { | ||
"import/extensions": "off", | ||
"react/no-unknown-property": "off", | ||
"react/react-in-jsx-scope": "off" | ||
} | ||
} |
Oops, something went wrong.