@storybook/react-native-web-vite 0.0.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/README.md +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/preset.cjs +15 -0
- package/dist/preset.cjs.map +1 -0
- package/package.json +90 -0
- package/preset.js +4 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @storybook/react-native-web-vite
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StorybookConfig as StorybookConfig$1, TypescriptOptions as TypescriptOptions$1, CompatibleString } from 'storybook/internal/types';
|
|
2
|
+
import { Options, BabelOptions } from '@vitejs/plugin-react';
|
|
3
|
+
import { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
|
|
4
|
+
import docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
|
|
5
|
+
|
|
6
|
+
type FrameworkName = CompatibleString<"@storybook/react-native-web-vite">;
|
|
7
|
+
type BuilderName = CompatibleString<"@storybook/builder-vite">;
|
|
8
|
+
type FrameworkOptions = {
|
|
9
|
+
builder?: BuilderOptions;
|
|
10
|
+
strictMode?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Use React's legacy root API to mount components
|
|
13
|
+
*
|
|
14
|
+
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g.
|
|
15
|
+
* concurrent features) If this flag is true, the legacy Root API is used to mount components to
|
|
16
|
+
* make it easier to migrate step by step to React 18.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
legacyRootApi?: boolean;
|
|
21
|
+
pluginReactOptions?: Omit<Options, "babel"> & {
|
|
22
|
+
babel?: BabelOptions;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type StorybookConfigFramework = {
|
|
26
|
+
framework: FrameworkName | {
|
|
27
|
+
name: FrameworkName;
|
|
28
|
+
options: FrameworkOptions;
|
|
29
|
+
};
|
|
30
|
+
core?: StorybookConfig$1["core"] & {
|
|
31
|
+
builder?: BuilderName | {
|
|
32
|
+
name: BuilderName;
|
|
33
|
+
options: BuilderOptions;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type TypescriptOptions = TypescriptOptions$1 & {
|
|
38
|
+
/**
|
|
39
|
+
* Sets the type of Docgen when working with React and TypeScript
|
|
40
|
+
*
|
|
41
|
+
* @default `'react-docgen'`
|
|
42
|
+
*/
|
|
43
|
+
reactDocgen: "react-docgen-typescript" | "react-docgen" | false;
|
|
44
|
+
/** Configures `@joshwooding/vite-plugin-react-docgen-typescript` */
|
|
45
|
+
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>[0];
|
|
46
|
+
};
|
|
47
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
48
|
+
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework | "typescript"> & StorybookConfigVite & StorybookConfigFramework & {
|
|
49
|
+
typescript?: Partial<TypescriptOptions>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type { FrameworkOptions, StorybookConfig };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StorybookConfig as StorybookConfig$1, TypescriptOptions as TypescriptOptions$1, CompatibleString } from 'storybook/internal/types';
|
|
2
|
+
import { Options, BabelOptions } from '@vitejs/plugin-react';
|
|
3
|
+
import { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
|
|
4
|
+
import docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
|
|
5
|
+
|
|
6
|
+
type FrameworkName = CompatibleString<"@storybook/react-native-web-vite">;
|
|
7
|
+
type BuilderName = CompatibleString<"@storybook/builder-vite">;
|
|
8
|
+
type FrameworkOptions = {
|
|
9
|
+
builder?: BuilderOptions;
|
|
10
|
+
strictMode?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Use React's legacy root API to mount components
|
|
13
|
+
*
|
|
14
|
+
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g.
|
|
15
|
+
* concurrent features) If this flag is true, the legacy Root API is used to mount components to
|
|
16
|
+
* make it easier to migrate step by step to React 18.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
legacyRootApi?: boolean;
|
|
21
|
+
pluginReactOptions?: Omit<Options, "babel"> & {
|
|
22
|
+
babel?: BabelOptions;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type StorybookConfigFramework = {
|
|
26
|
+
framework: FrameworkName | {
|
|
27
|
+
name: FrameworkName;
|
|
28
|
+
options: FrameworkOptions;
|
|
29
|
+
};
|
|
30
|
+
core?: StorybookConfig$1["core"] & {
|
|
31
|
+
builder?: BuilderName | {
|
|
32
|
+
name: BuilderName;
|
|
33
|
+
options: BuilderOptions;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type TypescriptOptions = TypescriptOptions$1 & {
|
|
38
|
+
/**
|
|
39
|
+
* Sets the type of Docgen when working with React and TypeScript
|
|
40
|
+
*
|
|
41
|
+
* @default `'react-docgen'`
|
|
42
|
+
*/
|
|
43
|
+
reactDocgen: "react-docgen-typescript" | "react-docgen" | false;
|
|
44
|
+
/** Configures `@joshwooding/vite-plugin-react-docgen-typescript` */
|
|
45
|
+
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>[0];
|
|
46
|
+
};
|
|
47
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
48
|
+
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework | "typescript"> & StorybookConfigVite & StorybookConfigFramework & {
|
|
49
|
+
typescript?: Partial<TypescriptOptions>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type { FrameworkOptions, StorybookConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/preset.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var builderVite = require('@storybook/builder-vite');
|
|
4
|
+
var n = require('@vitejs/plugin-react');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var n__default = /*#__PURE__*/_interopDefault(n);
|
|
9
|
+
|
|
10
|
+
function r(t){return {name:"vite:react-native-web",enforce:"pre",config(o,e){return {plugins:[n__default.default(t)],define:{"global.__x":{},_frameTimestamp:void 0,_WORKLET:!1,__DEV__:`${e.mode==="development"}`,"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||e.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"}}}}}}var m=async(t,s)=>{let{pluginReactOptions:o={}}=await s.presets.apply("frameworkOptions"),{plugins:e=[]}=t;return await builderVite.hasVitePlugins(e,["vite:react-native-web"])||e.push(r(o)),t},c={builder:"@storybook/builder-vite",renderer:"@storybook/react"};
|
|
11
|
+
|
|
12
|
+
exports.core = c;
|
|
13
|
+
exports.viteFinal = m;
|
|
14
|
+
//# sourceMappingURL=preset.cjs.map
|
|
15
|
+
//# sourceMappingURL=preset.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/preset.ts"],"names":["reactNativeWeb","reactOptions","_userConfig","env","react","viteFinal","config","options","pluginReactOptions","plugins","hasVitePlugins","core"],"mappings":";;;;;;;;;AAQA,SAASA,CACPC,CAAAA,CAAAA,CACQ,CA2DR,OA1DuB,CACrB,IAAM,CAAA,uBAAA,CACN,QAAS,KACT,CAAA,MAAA,CAAOC,CAAaC,CAAAA,CAAAA,CAAK,CACvB,OAAO,CACL,OAAS,CAAA,CAACC,mBAAMH,CAAY,CAAC,CAC7B,CAAA,MAAA,CAAQ,CAEN,YAAc,CAAA,EACd,CAAA,eAAA,CAAiB,OACjB,QAAU,CAAA,CAAA,CAAA,CACV,OAAS,CAAA,CAAA,EAAGE,CAAI,CAAA,IAAA,GAAS,aAAa,CAAA,CAAA,CACtC,uBAAwB,IAAK,CAAA,SAAA,CAC3B,OAAQ,CAAA,GAAA,CAAI,UAAYA,CAAI,CAAA,IAC9B,CACF,CAAA,CACA,aAAc,CACZ,OAAA,CAAS,EAET,CACA,eAAgB,CACd,GAAA,CAAK,WACL,CAAA,iBAAA,CAAmB,CACjB,SACA,CAAA,SAAA,CACA,UACA,CAAA,KAAA,CACA,OACA,OACA,CAAA,KAAA,CACA,MACA,CAAA,MACF,EACA,MAAQ,CAAA,CACN,KAAO,CAAA,KACT,CACF,CACF,CACA,CAAA,OAAA,CAAS,CACP,UAAY,CAAA,CACV,SACA,CAAA,SAAA,CACA,WACA,KACA,CAAA,MAAA,CACA,OACA,CAAA,KAAA,CACA,OACA,MACF,CAAA,CACA,KAAO,CAAA,CACL,eAAgB,kBAClB,CACF,CACF,CACF,CACF,CAGF,CAEaE,IAAAA,CAAAA,CAA0C,MACrDC,CACAC,CAAAA,CAAAA,GACG,CACH,GAAM,CAAE,kBAAAC,CAAAA,CAAAA,CAAqB,EAAG,CAC9B,CAAA,MAAMD,CAAQ,CAAA,OAAA,CAAQ,MAAwB,kBAAkB,CAAA,CAE5D,CAAE,OAAA,CAAAE,EAAU,EAAG,CAAIH,CAAAA,CAAAA,CAEzB,OAAM,MAAMI,0BAAAA,CAAeD,CAAS,CAAA,CAAC,uBAAuB,CAAC,CAAA,EAC3DA,CAAQ,CAAA,IAAA,CAAKT,EAAeQ,CAAkB,CAAC,CAG1CF,CAAAA,CACT,EAEaK,CAAO,CAAA,CAClB,OAAS,CAAA,yBAAA,CACT,SAAU,kBACZ","file":"preset.cjs","sourcesContent":["import { hasVitePlugins } from \"@storybook/builder-vite\";\nimport react, {\n BabelOptions,\n Options as ReactOptions,\n} from \"@vitejs/plugin-react\";\nimport { Plugin } from \"vite\";\nimport { FrameworkOptions, StorybookConfig } from \"./types\";\n\nfunction reactNativeWeb(\n reactOptions: Omit<ReactOptions, \"babel\"> & { babel?: BabelOptions },\n): Plugin {\n const plugin: Plugin = {\n name: \"vite:react-native-web\",\n enforce: \"pre\",\n config(_userConfig, env) {\n return {\n plugins: [react(reactOptions)],\n define: {\n // reanimated support\n \"global.__x\": {},\n _frameTimestamp: undefined,\n _WORKLET: false,\n __DEV__: `${env.mode === \"development\"}`,\n \"process.env.NODE_ENV\": JSON.stringify(\n process.env.NODE_ENV || env.mode,\n ),\n },\n optimizeDeps: {\n include: [\n /* 'react-native-reanimated', */\n ],\n esbuildOptions: {\n jsx: \"transform\",\n resolveExtensions: [\n \".web.js\",\n \".web.ts\",\n \".web.tsx\",\n \".js\",\n \".jsx\",\n \".json\",\n \".ts\",\n \".tsx\",\n \".mjs\",\n ],\n loader: {\n \".js\": \"jsx\",\n },\n },\n },\n resolve: {\n extensions: [\n \".web.js\",\n \".web.ts\",\n \".web.tsx\",\n \".js\",\n \".jsx\",\n \".json\",\n \".ts\",\n \".tsx\",\n \".mjs\",\n ],\n alias: {\n \"react-native\": \"react-native-web\",\n },\n },\n };\n },\n };\n\n return plugin;\n}\n\nexport const viteFinal: StorybookConfig[\"viteFinal\"] = async (\n config,\n options,\n) => {\n const { pluginReactOptions = {} } =\n await options.presets.apply<FrameworkOptions>(\"frameworkOptions\");\n\n const { plugins = [] } = config;\n\n if (!(await hasVitePlugins(plugins, [\"vite:react-native-web\"]))) {\n plugins.push(reactNativeWeb(pluginReactOptions));\n }\n\n return config;\n};\n\nexport const core = {\n builder: \"@storybook/builder-vite\",\n renderer: \"@storybook/react\",\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@storybook/react-native-web-vite",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Sets up react native web with vite",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native-web",
|
|
7
|
+
"storybook-frameworks"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/storybookjs/react-native-web-vite"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Daniel Williams <dannyhyunsoowilliams@gmail.com>",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./preset": "./dist/preset.cjs",
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/**/*",
|
|
27
|
+
"README.md",
|
|
28
|
+
"*.js",
|
|
29
|
+
"*.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"build:watch": "npm run build -- --watch",
|
|
34
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
35
|
+
"start": "run-p build:watch \"storybook --quiet\"",
|
|
36
|
+
"prerelease": "zx scripts/prepublish-checks.js",
|
|
37
|
+
"release": "npm run build && auto shipit",
|
|
38
|
+
"eject-ts": "zx scripts/eject-typescript.js",
|
|
39
|
+
"storybook": "storybook dev -p 6006",
|
|
40
|
+
"build-storybook": "storybook build"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@storybook/react": "^8.3.5",
|
|
44
|
+
"@storybook/builder-vite": "^8.3.5",
|
|
45
|
+
"@vitejs/plugin-react": "^4.3.2"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@storybook/addon-essentials": "^8.3.5",
|
|
49
|
+
"@storybook/addon-interactions": "^8.3.5",
|
|
50
|
+
"@storybook/addon-links": "^8.3.5",
|
|
51
|
+
"@storybook/blocks": "^8.3.5",
|
|
52
|
+
"@storybook/react-vite": "^8.3.5",
|
|
53
|
+
"@storybook/test": "^8.3.5",
|
|
54
|
+
"@types/node": "^18.15.0",
|
|
55
|
+
"@types/react": "^18.2.65",
|
|
56
|
+
"@types/react-dom": "^18.2.21",
|
|
57
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
58
|
+
"auto": "^11.1.1",
|
|
59
|
+
"boxen": "^7.1.1",
|
|
60
|
+
"dedent": "^1.5.1",
|
|
61
|
+
"prettier": "^3.3.3",
|
|
62
|
+
"prompts": "^2.4.2",
|
|
63
|
+
"react": "^18.2.0",
|
|
64
|
+
"react-dom": "^18.2.0",
|
|
65
|
+
"storybook": "^8.3.5",
|
|
66
|
+
"tsup": "^8.2.4",
|
|
67
|
+
"typescript": "^5.5.4",
|
|
68
|
+
"vite": "^5.3.5",
|
|
69
|
+
"zx": "^7.2.3",
|
|
70
|
+
"react-native": "^0.75.4",
|
|
71
|
+
"react-native-web": "^0.19.12"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"storybook": ">8",
|
|
75
|
+
"react-native": "^0.75.4",
|
|
76
|
+
"react-native-web": "^0.19.12",
|
|
77
|
+
"vite": "^4.0.0 || ^5.0.0"
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public"
|
|
81
|
+
},
|
|
82
|
+
"bundler": {
|
|
83
|
+
"exportEntries": [
|
|
84
|
+
"src/index.ts"
|
|
85
|
+
],
|
|
86
|
+
"nodeEntries": [
|
|
87
|
+
"src/preset.ts"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
package/preset.js
ADDED