storybook-react-native-web-rsbuild 3.4.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +55 -43
- package/dist/index.js +1 -5
- package/dist/node/index.d.ts +51 -43
- package/dist/node/index.js +3 -17
- package/dist/preset.js +40 -52
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import type { BuilderOptions } from 'storybook-builder-rsbuild';
|
|
2
|
+
import type { CompatibleString } from 'storybook/internal/types';
|
|
3
|
+
import { __definePreview as definePreview } from '@storybook/react';
|
|
4
|
+
import type { PluginReactNativeWebOptions } from 'rsbuild-plugin-react-native-web';
|
|
5
|
+
import type { StorybookConfig as StorybookConfig_2 } from 'storybook/internal/types';
|
|
6
|
+
import type { StorybookConfigRsbuild } from 'storybook-builder-rsbuild';
|
|
7
|
+
import type { TypescriptOptions } from 'storybook/internal/types';
|
|
8
|
+
import type { TypescriptOptions as TypescriptOptions_2 } from 'storybook-builder-rsbuild';
|
|
9
|
+
|
|
10
|
+
declare type BuilderName = CompatibleString<'storybook-builder-rsbuild'>;
|
|
11
|
+
|
|
12
|
+
export { definePreview }
|
|
13
|
+
|
|
14
|
+
declare type FrameworkName = CompatibleString<'storybook-react-native-web-rsbuild'>;
|
|
15
|
+
|
|
16
|
+
export declare type FrameworkOptions = {
|
|
17
|
+
builder?: BuilderOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Additional node_modules that need to be transpiled.
|
|
20
|
+
* Many React Native packages ship untranspiled code.
|
|
21
|
+
* By default, packages starting with `react-native`, `@react-native`, `expo`, and `@expo`
|
|
22
|
+
* are already included.
|
|
23
|
+
*
|
|
24
|
+
* @example ['react-native-reanimated', 'nativewind']
|
|
25
|
+
*/
|
|
26
|
+
modulesToTranspile?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Options passed to the React Native Web Rsbuild plugin.
|
|
29
|
+
*/
|
|
30
|
+
pluginOptions?: PluginReactNativeWebOptions;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
35
|
+
*/
|
|
36
|
+
export declare type StorybookConfig = Omit<StorybookConfig_2, keyof StorybookConfigRsbuild | keyof StorybookConfigFramework> & StorybookConfigRsbuild & StorybookConfigFramework;
|
|
37
|
+
|
|
38
|
+
declare type StorybookConfigFramework = {
|
|
39
|
+
framework: FrameworkName | {
|
|
40
|
+
name: FrameworkName;
|
|
41
|
+
options: FrameworkOptions;
|
|
42
|
+
};
|
|
43
|
+
core?: StorybookConfig_2['core'] & {
|
|
44
|
+
builder?: BuilderName | {
|
|
45
|
+
name: BuilderName;
|
|
46
|
+
options: BuilderOptions;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
typescript?: Partial<TypescriptOptions & TypescriptOptions_2>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export * from "@storybook/react";
|
|
54
|
+
|
|
55
|
+
export { }
|
package/dist/index.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import type { BuilderOptions } from 'storybook-builder-rsbuild';
|
|
2
|
+
import type { CompatibleString } from 'storybook/internal/types';
|
|
3
|
+
import type { PluginReactNativeWebOptions } from 'rsbuild-plugin-react-native-web';
|
|
4
|
+
import type { StorybookConfig as StorybookConfig_2 } from 'storybook/internal/types';
|
|
5
|
+
import type { StorybookConfigRsbuild } from 'storybook-builder-rsbuild';
|
|
6
|
+
import type { TypescriptOptions } from 'storybook/internal/types';
|
|
7
|
+
import type { TypescriptOptions as TypescriptOptions_2 } from 'storybook-builder-rsbuild';
|
|
8
|
+
|
|
9
|
+
declare type BuilderName = CompatibleString<'storybook-builder-rsbuild'>;
|
|
10
|
+
|
|
11
|
+
export declare function defineMain(config: StorybookConfig): StorybookConfig;
|
|
12
|
+
|
|
13
|
+
declare type FrameworkName = CompatibleString<'storybook-react-native-web-rsbuild'>;
|
|
14
|
+
|
|
15
|
+
declare type FrameworkOptions = {
|
|
16
|
+
builder?: BuilderOptions;
|
|
17
|
+
/**
|
|
18
|
+
* Additional node_modules that need to be transpiled.
|
|
19
|
+
* Many React Native packages ship untranspiled code.
|
|
20
|
+
* By default, packages starting with `react-native`, `@react-native`, `expo`, and `@expo`
|
|
21
|
+
* are already included.
|
|
22
|
+
*
|
|
23
|
+
* @example ['react-native-reanimated', 'nativewind']
|
|
24
|
+
*/
|
|
25
|
+
modulesToTranspile?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Options passed to the React Native Web Rsbuild plugin.
|
|
28
|
+
*/
|
|
29
|
+
pluginOptions?: PluginReactNativeWebOptions;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
34
|
+
*/
|
|
35
|
+
declare type StorybookConfig = Omit<StorybookConfig_2, keyof StorybookConfigRsbuild | keyof StorybookConfigFramework> & StorybookConfigRsbuild & StorybookConfigFramework;
|
|
36
|
+
|
|
37
|
+
declare type StorybookConfigFramework = {
|
|
38
|
+
framework: FrameworkName | {
|
|
39
|
+
name: FrameworkName;
|
|
40
|
+
options: FrameworkOptions;
|
|
41
|
+
};
|
|
42
|
+
core?: StorybookConfig_2['core'] & {
|
|
43
|
+
builder?: BuilderName | {
|
|
44
|
+
name: BuilderName;
|
|
45
|
+
options: BuilderOptions;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
typescript?: Partial<TypescriptOptions & TypescriptOptions_2>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { }
|
package/dist/node/index.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_d7de9dd107a01a66 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_d7de9dd107a01a66 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_d7de9dd107a01a66.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_d7de9dd107a01a66.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_d7de9dd107a01a66.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
// src/node/index.ts
|
|
1
|
+
import "node:module";
|
|
14
2
|
function defineMain(config) {
|
|
15
|
-
|
|
3
|
+
return config;
|
|
16
4
|
}
|
|
17
|
-
export {
|
|
18
|
-
defineMain
|
|
19
|
-
};
|
|
5
|
+
export { defineMain };
|
package/dist/preset.js
CHANGED
|
@@ -1,60 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_d7de9dd107a01a66 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_d7de9dd107a01a66.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_d7de9dd107a01a66.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_d7de9dd107a01a66.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
// src/preset.ts
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
14
3
|
import { createRequire } from "node:module";
|
|
15
4
|
import { dirname } from "node:path";
|
|
16
5
|
import { fileURLToPath } from "node:url";
|
|
17
|
-
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
18
6
|
import { pluginReactNativeWeb } from "rsbuild-plugin-react-native-web";
|
|
19
|
-
import { rsbuildFinal
|
|
7
|
+
import { rsbuildFinal } from "storybook-react-rsbuild/preset";
|
|
20
8
|
function resolveReactNativeWeb(configDir) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
var rsbuildFinal = async (config, options) => {
|
|
29
|
-
let reactConfig = await reactRsbuildFinal(config, options), framework = await options.presets.apply("framework"), frameworkOptions = typeof framework == "string" ? {} : framework.options || {}, reactNativeWebPath = resolveReactNativeWeb(options.configDir);
|
|
30
|
-
return mergeRsbuildConfig(reactConfig, {
|
|
31
|
-
plugins: [
|
|
32
|
-
pluginReactNativeWeb({
|
|
33
|
-
modulesToTranspile: frameworkOptions.modulesToTranspile,
|
|
34
|
-
// Pass the resolved path to enable absolute imports in transformed code
|
|
35
|
-
reactNativeWebPath,
|
|
36
|
-
...frameworkOptions.pluginOptions
|
|
37
|
-
})
|
|
38
|
-
],
|
|
39
|
-
resolve: {
|
|
40
|
-
alias: {
|
|
41
|
-
// Use absolute path to ensure proper resolution in pnpm/monorepo setups
|
|
42
|
-
"react-native": reactNativeWebPath
|
|
43
|
-
}
|
|
9
|
+
try {
|
|
10
|
+
const require = createRequire(`${configDir}/package.json`);
|
|
11
|
+
const packageJsonPath = require.resolve('react-native-web/package.json');
|
|
12
|
+
return dirname(packageJsonPath);
|
|
13
|
+
} catch {
|
|
14
|
+
return 'react-native-web';
|
|
44
15
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
16
|
+
}
|
|
17
|
+
const preset_rsbuildFinal = async (config, options)=>{
|
|
18
|
+
const reactConfig = await rsbuildFinal(config, options);
|
|
19
|
+
const frameworkOptions = await options.presets.apply('frameworkOptions');
|
|
20
|
+
const reactNativeWebPath = resolveReactNativeWeb(options.configDir);
|
|
21
|
+
return mergeRsbuildConfig(reactConfig, {
|
|
22
|
+
plugins: [
|
|
23
|
+
pluginReactNativeWeb({
|
|
24
|
+
modulesToTranspile: frameworkOptions?.modulesToTranspile,
|
|
25
|
+
dev: options.features?.developmentModeForBuild && 'PRODUCTION' === options.configType ? true : void 0,
|
|
26
|
+
reactNativeWebPath,
|
|
27
|
+
...frameworkOptions?.pluginOptions
|
|
28
|
+
})
|
|
29
|
+
],
|
|
30
|
+
resolve: {
|
|
31
|
+
alias: {
|
|
32
|
+
'react-native': reactNativeWebPath
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
56
36
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
37
|
+
const core = async (config, options)=>{
|
|
38
|
+
const frameworkOptions = await options.presets.apply('frameworkOptions');
|
|
39
|
+
return {
|
|
40
|
+
...config,
|
|
41
|
+
builder: {
|
|
42
|
+
name: fileURLToPath(import.meta.resolve('storybook-builder-rsbuild')),
|
|
43
|
+
options: frameworkOptions?.builder || {}
|
|
44
|
+
},
|
|
45
|
+
renderer: fileURLToPath(import.meta.resolve('@storybook/react/preset'))
|
|
46
|
+
};
|
|
60
47
|
};
|
|
48
|
+
export { core, preset_rsbuildFinal as rsbuildFinal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-react-native-web-rsbuild",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Storybook for React Native Web and Rsbuild: Develop React Native components for web in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -41,19 +41,20 @@
|
|
|
41
41
|
"!src/**/*"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@storybook/react": "^10.
|
|
45
|
-
"rsbuild-plugin-react-native-web": "3.
|
|
46
|
-
"storybook-react-rsbuild": "3.
|
|
47
|
-
"storybook-builder-rsbuild": "3.
|
|
44
|
+
"@storybook/react": "^10.6.0",
|
|
45
|
+
"rsbuild-plugin-react-native-web": "3.6.0",
|
|
46
|
+
"storybook-react-rsbuild": "3.6.0",
|
|
47
|
+
"storybook-builder-rsbuild": "3.6.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@
|
|
50
|
+
"@microsoft/api-extractor": "^7.59.1",
|
|
51
|
+
"@rsbuild/core": "^2.2.6",
|
|
51
52
|
"@types/node": "^22.0.0",
|
|
52
53
|
"@types/react": "^18.3.31",
|
|
53
54
|
"react": "18.3.1",
|
|
54
55
|
"react-dom": "18.3.1",
|
|
55
56
|
"react-native-web": "^0.21.2",
|
|
56
|
-
"storybook": "10.
|
|
57
|
+
"storybook": "10.6.0",
|
|
57
58
|
"typescript": "^5.9.3"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
62
63
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
63
64
|
"react-native-web": "^0.19.0 || ^0.20.0 || ^0.21.0",
|
|
64
|
-
"storybook": "^10.
|
|
65
|
+
"storybook": "^10.6.0"
|
|
65
66
|
},
|
|
66
67
|
"engines": {
|
|
67
68
|
"node": ">=18.0.0"
|
|
@@ -78,8 +79,7 @@
|
|
|
78
79
|
"platform": "node"
|
|
79
80
|
},
|
|
80
81
|
"scripts": {
|
|
81
|
-
"build": "
|
|
82
|
-
"
|
|
83
|
-
"prep": "jiti ../../scripts/build/build-package.ts"
|
|
82
|
+
"build": "rstack lib",
|
|
83
|
+
"dev": "rstack lib --watch"
|
|
84
84
|
}
|
|
85
85
|
}
|