@storybook/preset-react-webpack 7.0.0-beta.3 → 7.0.0-beta.5

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.
@@ -0,0 +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')});export{__require};
@@ -1 +1 @@
1
- import{__require}from"./chunk-HXSBEJGO.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
+ 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 +1 @@
1
- import{__require}from"./chunk-HXSBEJGO.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
+ 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 +1 @@
1
- import{__require}from"./chunk-HXSBEJGO.mjs";import{readJSON}from"fs-extra";import{IgnorePlugin}from"webpack";var webpackFinal=async config=>{let reactDomPkg=await readJSON(__require.resolve("react-dom/package.json"));return{...config,plugins:[...config.plugins||[],reactDomPkg?.version?.startsWith("18")||reactDomPkg?.version?.startsWith("0.0.0")?null:new IgnorePlugin({resourceRegExp:/react-dom\/client$/,contextRegExp:/(renderers\/react|renderers\\react|@storybook\/react|@storybook\\react)/})].filter(Boolean)}};export{webpackFinal};
1
+ import{__require}from"./chunk-R4NKYYJA.mjs";import{readJSON}from"fs-extra";import{IgnorePlugin}from"webpack";var webpackFinal=async config=>{let reactDomPkg=await readJSON(__require.resolve("react-dom/package.json"));return{...config,plugins:[...config.plugins||[],reactDomPkg?.version?.startsWith("18")||reactDomPkg?.version?.startsWith("0.0.0")?null:new IgnorePlugin({resourceRegExp:/react-dom\/client$/,contextRegExp:/(renderers\/react|renderers\\react|@storybook\/react|@storybook\\react)/})].filter(Boolean)}};export{webpackFinal};
@@ -1 +1 @@
1
- import{__require}from"./chunk-HXSBEJGO.mjs";import path from"path";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import{logger}from"@storybook/node-logger";var 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=path.dirname(__require.resolve("@storybook/preset-react-webpack/package.json")),context=storybookReactDirName.includes("node_modules")?path.join(storybookReactDirName,"../../"):path.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};
1
+ import{__require}from"./chunk-R4NKYYJA.mjs";import path from"path";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import{logger}from"@storybook/node-logger";var 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=path.dirname(__require.resolve("@storybook/preset-react-webpack/package.json")),context=storybookReactDirName.includes("node_modules")?path.join(storybookReactDirName,"../../"):path.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};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{__require}from"./chunk-HXSBEJGO.mjs";var addons=[__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-dom-hack"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-cra"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-docs")];export{addons};
1
+ import{__require}from"./chunk-R4NKYYJA.mjs";var addons=[__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-dom-hack"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-cra"),__require.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-docs")];export{addons};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preset-react-webpack",
3
- "version": "7.0.0-beta.3",
3
+ "version": "7.0.0-beta.5",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -74,10 +74,10 @@
74
74
  "@babel/preset-flow": "^7.18.6",
75
75
  "@babel/preset-react": "^7.18.6",
76
76
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
77
- "@storybook/core-webpack": "7.0.0-beta.3",
78
- "@storybook/docs-tools": "7.0.0-beta.3",
79
- "@storybook/node-logger": "7.0.0-beta.3",
80
- "@storybook/react": "7.0.0-beta.3",
77
+ "@storybook/core-webpack": "7.0.0-beta.5",
78
+ "@storybook/docs-tools": "7.0.0-beta.5",
79
+ "@storybook/node-logger": "7.0.0-beta.5",
80
+ "@storybook/react": "7.0.0-beta.5",
81
81
  "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0",
82
82
  "@types/node": "^16.0.0",
83
83
  "@types/semver": "^7.3.4",
@@ -120,5 +120,5 @@
120
120
  ],
121
121
  "platform": "node"
122
122
  },
123
- "gitHead": "9a57b4788c8b2817db516d799057d8295b187880"
123
+ "gitHead": "8a44bd60808941735aac4a5e9505e8f658131b3e"
124
124
  }
@@ -1 +0,0 @@
1
- var __require=(x=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(x,{get:(a,b)=>(typeof require!="undefined"?require:a)[b]}):x)(function(x){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+x+'" is not supported')});export{__require};