@storybook/preset-react-webpack 7.1.0-alpha.8 → 7.1.0-beta.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/framework-preset-react-docs.d.ts +1 -1
- package/dist/framework-preset-react-docs.js +1 -1
- package/dist/framework-preset-react.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -1
- package/dist/{types-b181cc47.d.ts → types-1597a784.d.ts} +1 -1
- package/package.json +22 -22
- package/src/typings.d.ts +44 -0
- package/dist/chunk-R4NKYYJA.mjs +0 -1
- package/dist/framework-preset-cra.mjs +0 -1
- package/dist/framework-preset-react-docs.mjs +0 -1
- package/dist/framework-preset-react.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var framework_preset_react_docs_exports={};__export(framework_preset_react_docs_exports,{babel:()=>babel,webpackFinal:()=>webpackFinal});module.exports=__toCommonJS(framework_preset_react_docs_exports);var
|
|
1
|
+
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var framework_preset_react_docs_exports={};__export(framework_preset_react_docs_exports,{babel:()=>babel,webpackFinal:()=>webpackFinal});module.exports=__toCommonJS(framework_preset_react_docs_exports);var import_docs_tools=require("@storybook/docs-tools"),babel=async(config,options)=>{if(!(0,import_docs_tools.hasDocsOrControls)(options))return config;let typescriptOptions=await options.presets.apply("typescript",{}),{reactDocgen}=typescriptOptions||{};return typeof reactDocgen!="string"?config:{...config,overrides:[...(config==null?void 0:config.overrides)||[],{test:reactDocgen==="react-docgen"?/\.(cjs|mjs|tsx?|jsx?)$/:/\.(cjs|mjs|jsx?)$/,plugins:[[require.resolve("babel-plugin-react-docgen")]]}]}},webpackFinal=async(config,options)=>{if(!(0,import_docs_tools.hasDocsOrControls)(options))return config;let typescriptOptions=await options.presets.apply("typescript",{}),{reactDocgen,reactDocgenTypescriptOptions}=typescriptOptions||{};if(reactDocgen!=="react-docgen-typescript")return config;let{ReactDocgenTypeScriptPlugin}=await import("@storybook/react-docgen-typescript-plugin");return{...config,plugins:[...config.plugins||[],new ReactDocgenTypeScriptPlugin({...reactDocgenTypescriptOptions,savePropValueAsString:!0})]}};0&&(module.exports={babel,webpackFinal});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StorybookConfig } from './types-
|
|
2
|
-
export { R as ReactOptions, T as TypescriptOptions } from './types-
|
|
1
|
+
import { S as StorybookConfig } from './types-1597a784.js';
|
|
2
|
+
export { R as ReactOptions, T as TypescriptOptions } from './types-1597a784.js';
|
|
3
3
|
export { BuilderResult } from '@storybook/core-webpack';
|
|
4
4
|
import '@storybook/react-docgen-typescript-plugin';
|
|
5
5
|
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+x+'" is not supported')});var addons=[__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-cra"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-docs")];
|
|
2
|
+
|
|
3
|
+
export { addons };
|
|
@@ -24,7 +24,7 @@ type TypescriptOptions = TypescriptOptions$1 & {
|
|
|
24
24
|
* Configures `react-docgen-typescript-plugin`
|
|
25
25
|
*
|
|
26
26
|
* @default
|
|
27
|
-
* @see https://github.com/storybookjs/storybook/blob/next/
|
|
27
|
+
* @see https://github.com/storybookjs/storybook/blob/next/code/builders/builder-webpack5/src/config/defaults.js#L4-L6
|
|
28
28
|
*/
|
|
29
29
|
reactDocgenTypescriptOptions: PluginOptions;
|
|
30
30
|
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/preset-react-webpack",
|
|
3
|
-
"version": "7.1.0-
|
|
3
|
+
"version": "7.1.0-beta.0",
|
|
4
4
|
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/
|
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/presets/react-webpack",
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/storybookjs/storybook/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/storybookjs/storybook.git",
|
|
15
|
-
"directory": "presets/react-webpack"
|
|
15
|
+
"directory": "code/presets/react-webpack"
|
|
16
16
|
},
|
|
17
17
|
"funding": {
|
|
18
18
|
"type": "opencollective",
|
|
@@ -21,31 +21,31 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
24
25
|
"node": "./dist/index.js",
|
|
25
26
|
"require": "./dist/index.js",
|
|
26
|
-
"import": "./dist/index.mjs"
|
|
27
|
-
"types": "./dist/index.d.ts"
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./preset": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
30
31
|
"node": "./dist/index.js",
|
|
31
32
|
"require": "./dist/index.js",
|
|
32
|
-
"import": "./dist/index.mjs"
|
|
33
|
-
"types": "./dist/index.d.ts"
|
|
33
|
+
"import": "./dist/index.mjs"
|
|
34
34
|
},
|
|
35
35
|
"./dist/framework-preset-cra": {
|
|
36
|
+
"types": "./dist/framework-preset-cra.d.ts",
|
|
36
37
|
"require": "./dist/framework-preset-cra.js",
|
|
37
|
-
"import": "./dist/framework-preset-cra.mjs"
|
|
38
|
-
"types": "./dist/framework-preset-cra.d.ts"
|
|
38
|
+
"import": "./dist/framework-preset-cra.mjs"
|
|
39
39
|
},
|
|
40
40
|
"./dist/framework-preset-react-docs": {
|
|
41
|
+
"types": "./dist/framework-preset-react-docs.d.ts",
|
|
41
42
|
"require": "./dist/framework-preset-react-docs.js",
|
|
42
|
-
"import": "./dist/framework-preset-react-docs.mjs"
|
|
43
|
-
"types": "./dist/framework-preset-react-docs.d.ts"
|
|
43
|
+
"import": "./dist/framework-preset-react-docs.mjs"
|
|
44
44
|
},
|
|
45
45
|
"./dist/framework-preset-react": {
|
|
46
|
+
"types": "./dist/framework-preset-react.d.ts",
|
|
46
47
|
"require": "./dist/framework-preset-react.js",
|
|
47
|
-
"import": "./dist/framework-preset-react.mjs"
|
|
48
|
-
"types": "./dist/framework-preset-react.d.ts"
|
|
48
|
+
"import": "./dist/framework-preset-react.mjs"
|
|
49
49
|
},
|
|
50
50
|
"./package.json": "./package.json"
|
|
51
51
|
},
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@babel/preset-flow": "^7.
|
|
67
|
-
"@babel/preset-react": "^7.
|
|
66
|
+
"@babel/preset-flow": "^7.21.0",
|
|
67
|
+
"@babel/preset-react": "^7.22.0",
|
|
68
68
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
69
|
-
"@storybook/core-webpack": "7.1.0-
|
|
70
|
-
"@storybook/docs-tools": "7.1.0-
|
|
71
|
-
"@storybook/node-logger": "7.1.0-
|
|
72
|
-
"@storybook/react": "7.1.0-
|
|
69
|
+
"@storybook/core-webpack": "7.1.0-beta.0",
|
|
70
|
+
"@storybook/docs-tools": "7.1.0-beta.0",
|
|
71
|
+
"@storybook/node-logger": "7.1.0-beta.0",
|
|
72
|
+
"@storybook/react": "7.1.0-beta.0",
|
|
73
73
|
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
|
|
74
74
|
"@types/node": "^16.0.0",
|
|
75
75
|
"@types/semver": "^7.3.4",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"typescript": "~4.9.3"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@babel/core": "^7.
|
|
87
|
+
"@babel/core": "^7.22.0",
|
|
88
88
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
89
89
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
90
90
|
},
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
],
|
|
112
112
|
"platform": "node"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
115
|
-
}
|
|
114
|
+
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
|
|
115
|
+
}
|
package/src/typings.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// TODO: Replace, as soon as @types/react-dom 17.0.14 is used
|
|
2
|
+
// Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fb0f14b7a35cde26ffaa82e7536c062e593e9ae6/types/react-dom/client.d.ts
|
|
3
|
+
declare module 'react-dom/client' {
|
|
4
|
+
import React = require('react');
|
|
5
|
+
|
|
6
|
+
export interface HydrationOptions {
|
|
7
|
+
onHydrated?(suspenseInstance: Comment): void;
|
|
8
|
+
onDeleted?(suspenseInstance: Comment): void;
|
|
9
|
+
/**
|
|
10
|
+
* Prefix for `useId`.
|
|
11
|
+
*/
|
|
12
|
+
identifierPrefix?: string;
|
|
13
|
+
onRecoverableError?: (error: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface RootOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Prefix for `useId`.
|
|
19
|
+
*/
|
|
20
|
+
identifierPrefix?: string;
|
|
21
|
+
onRecoverableError?: (error: unknown) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Root {
|
|
25
|
+
render(children: React.ReactChild | Iterable<React.ReactNode>): void;
|
|
26
|
+
unmount(): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode.
|
|
31
|
+
*
|
|
32
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#createroot
|
|
33
|
+
*/
|
|
34
|
+
export function createRoot(
|
|
35
|
+
container: Element | Document | DocumentFragment | Comment,
|
|
36
|
+
options?: RootOptions
|
|
37
|
+
): Root;
|
|
38
|
+
|
|
39
|
+
export function hydrateRoot(
|
|
40
|
+
container: Element | Document | DocumentFragment | Comment,
|
|
41
|
+
initialChildren: React.ReactChild | Iterable<React.ReactNode>,
|
|
42
|
+
options?: HydrationOptions
|
|
43
|
+
): Root;
|
|
44
|
+
}
|
package/dist/chunk-R4NKYYJA.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+x+'" is not supported')});export{__require};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{__require}from"./chunk-R4NKYYJA.mjs";import{logger as logger2}from"@storybook/node-logger";import fs from"fs";import path from"path";import semver from"semver";import{logger}from"@storybook/node-logger";var appDirectory=fs.realpathSync(process.cwd()),reactScriptsPath;function getReactScriptsPath({noCache}={}){if(reactScriptsPath&&!noCache)return reactScriptsPath;let reactScriptsScriptPath=fs.realpathSync(path.join(appDirectory,"/node_modules/.bin/react-scripts"));try{if(/node_modules[\\/]\.bin[\\/]react-scripts/i.test(reactScriptsScriptPath)){let packagePathMatch=fs.readFileSync(reactScriptsScriptPath,"utf8").match(/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i);packagePathMatch&&packagePathMatch.length>1&&(reactScriptsScriptPath=path.join(appDirectory,"/node_modules/.bin/",packagePathMatch[1]))}}catch(e){logger.warn(`Error occurred during react-scripts package path resolving: ${e}`)}reactScriptsPath=path.join(reactScriptsScriptPath,"../..");let scriptsPkgJson=path.join(reactScriptsPath,"package.json");return fs.existsSync(scriptsPkgJson)||(reactScriptsPath="react-scripts"),reactScriptsPath}function isReactScriptsInstalled(requiredVersion="2.0.0"){try{let reactScriptsJson=__require(path.join(getReactScriptsPath(),"package.json"));return!semver.gtr(requiredVersion,reactScriptsJson.version)}catch{return!1}}var checkForNewPreset=presetsList=>{presetsList.some(preset=>{let presetName=typeof preset=="string"?preset:preset.name;return/@storybook(\/|\\)preset-create-react-app/.test(presetName)})||(logger2.warn("Storybook support for Create React App is now a separate preset."),logger2.warn("To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file."),logger2.warn("The built-in preset has been disabled in Storybook 6.0."))},webpackFinal=(config,{presetsList})=>(isReactScriptsInstalled()&&presetsList&&checkForNewPreset(presetsList),config.module?.rules?.push({test:/\.m?js$/,type:"javascript/auto"},{test:/\.m?js$/,resolve:{fullySpecified:!1}}),config);export{webpackFinal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{__require}from"./chunk-R4NKYYJA.mjs";import ReactDocgenTypescriptPlugin from"@storybook/react-docgen-typescript-plugin";import{hasDocsOrControls}from"@storybook/docs-tools";var babel=async(config,options)=>{if(!hasDocsOrControls(options))return config;let typescriptOptions=await options.presets.apply("typescript",{}),{reactDocgen}=typescriptOptions||{};return typeof reactDocgen!="string"?config:{...config,overrides:[...config?.overrides||[],{test:reactDocgen==="react-docgen"?/\.(cjs|mjs|tsx?|jsx?)$/:/\.(cjs|mjs|jsx?)$/,plugins:[[__require.resolve("babel-plugin-react-docgen")]]}]}},webpackFinal=async(config,options)=>{if(!hasDocsOrControls(options))return config;let typescriptOptions=await options.presets.apply("typescript",{}),{reactDocgen,reactDocgenTypescriptOptions}=typescriptOptions||{};return reactDocgen!=="react-docgen-typescript"?config:{...config,plugins:[...config.plugins||[],new ReactDocgenTypescriptPlugin({...reactDocgenTypescriptOptions,savePropValueAsString:!0})]}};export{babel,webpackFinal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{__require}from"./chunk-R4NKYYJA.mjs";import{dirname,join}from"path";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import{logger}from"@storybook/node-logger";var wrapForPnP=input=>dirname(__require.resolve(join(input,"package.json"))),applyFastRefresh=async options=>{let isDevelopment=options.configType==="DEVELOPMENT",framework=await options.presets.apply("framework"),reactOptions=typeof framework=="object"?framework.options:{};return isDevelopment&&(reactOptions.fastRefresh||process.env.FAST_REFRESH==="true")},babel=async(config,options)=>await applyFastRefresh(options)?{...config,plugins:[[__require.resolve("react-refresh/babel"),{},"storybook-react-refresh"],...config.plugins||[]]}:config,storybookReactDirName=wrapForPnP("@storybook/preset-react-webpack"),context=storybookReactDirName.includes("node_modules")?join(storybookReactDirName,"../../"):join(storybookReactDirName,"../../node_modules"),hasJsxRuntime=()=>{try{return __require.resolve("react/jsx-runtime",{paths:[context]}),!0}catch{return!1}},babelDefault=async config=>{let presetReactOptions=hasJsxRuntime()?{runtime:"automatic"}:{};return{...config,presets:[...config?.presets||[],[__require.resolve("@babel/preset-react"),presetReactOptions]],plugins:[...config?.plugins||[],__require.resolve("babel-plugin-add-react-displayname")]}},webpackFinal=async(config,options)=>await applyFastRefresh(options)?config.plugins?.find(p=>p.constructor.name==="ReactRefreshPlugin")?(logger.warn("=> React refresh is already set. You don't need to set the option"),config):(logger.info("=> Using React fast refresh"),{...config,plugins:[...config.plugins||[],new ReactRefreshWebpackPlugin({overlay:{sockIntegration:"whm"}})]}):config;export{babel,babelDefault,webpackFinal};
|