@storybook/preset-react-webpack 7.0.0-alpha.52 → 7.0.0-alpha.54

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!="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};
@@ -1 +1 @@
1
- import{a as p}from"./chunk-HKSD7XQF.mjs";import{logger as i}from"@storybook/node-logger";import n from"fs";import s from"path";import m from"semver";import{logger as d}from"@storybook/node-logger";var l=n.realpathSync(process.cwd()),r;function h({noCache:e}={}){if(r&&!e)return r;let t=n.realpathSync(s.join(l,"/node_modules/.bin/react-scripts"));try{if(/node_modules[\\/]\.bin[\\/]react-scripts/i.test(t)){let c=n.readFileSync(t,"utf8").match(/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i);c&&c.length>1&&(t=s.join(l,"/node_modules/.bin/",c[1]))}}catch(a){d.warn(`Error occurred during react-scripts package path resolving: ${a}`)}r=s.join(t,"../..");let o=s.join(r,"package.json");return n.existsSync(o)||(r="react-scripts"),r}function f(e="2.0.0"){try{let t=p(s.join(h(),"package.json"));return!m.gtr(e,t.version)}catch{return!1}}var u=e=>{e.some(o=>{let a=typeof o=="string"?o:o.name;return/@storybook(\/|\\)preset-create-react-app/.test(a)})||(i.warn("Storybook support for Create React App is now a separate preset."),i.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."),i.warn("The built-in preset has been disabled in Storybook 6.0."))},v=(e,{presetsList:t})=>(f()&&t&&u(t),e.module?.rules?.push({test:/\.m?js$/,type:"javascript/auto"},{test:/\.m?js$/,resolve:{fullySpecified:!1}}),e);export{v as webpackFinal};
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 +1 @@
1
- import{a as o}from"./chunk-HKSD7XQF.mjs";import c from"@storybook/react-docgen-typescript-plugin";import{hasDocsOrControls as p}from"@storybook/docs-tools";var y=async(t,e)=>{if(!p(e))return t;let s=await e.presets.apply("typescript",{}),{reactDocgen:r}=s||{};return typeof r!="string"?t:{...t,overrides:[...t?.overrides||[],{test:r==="react-docgen"?/\.(cjs|mjs|tsx?|jsx?)$/:/\.(cjs|mjs|jsx?)$/,plugins:[[o.resolve("babel-plugin-react-docgen")]]}]}},l=async(t,e)=>{if(!p(e))return t;let s=await e.presets.apply("typescript",{}),{reactDocgen:r,reactDocgenTypescriptOptions:n}=s||{};return r!=="react-docgen-typescript"?t:{...t,plugins:[...t.plugins||[],new c({...n,savePropValueAsString:!0})]}};export{y as babel,l as webpackFinal};
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 +1 @@
1
- import{a as o}from"./chunk-HKSD7XQF.mjs";import{readJSON as t}from"fs-extra";import{IgnorePlugin as a}from"webpack";var c=async r=>{let e=await t(o.resolve("react-dom/package.json"));return{...r,plugins:[...r.plugins||[],e?.version?.startsWith("18")||e?.version?.startsWith("0.0.0")?null:new a({resourceRegExp:/react-dom\/client$/,contextRegExp:/(renderers\/react|renderers\\react|@storybook\/react|@storybook\\react)/})].filter(Boolean)}};export{c as webpackFinal};
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 +1 @@
1
- import{a as r}from"./chunk-HKSD7XQF.mjs";import n from"path";import c from"@pmmmwh/react-refresh-webpack-plugin";import{logger as p}from"@storybook/node-logger";var i=async e=>{let t=e.configType==="DEVELOPMENT",o=await e.presets.apply("framework"),s=typeof o=="object"?o.options:{};return t&&(s.fastRefresh||process.env.FAST_REFRESH==="true")},y=async(e,t)=>await i(t)?{...e,plugins:[[r.resolve("react-refresh/babel"),{},"storybook-react-refresh"],...e.plugins||[]]}:e,a=n.dirname(r.resolve("@storybook/preset-react-webpack/package.json")),l=a.includes("node_modules")?n.join(a,"../../"):n.join(a,"../../node_modules"),u=()=>{try{return r.resolve("react/jsx-runtime",{paths:[l]}),!0}catch{return!1}},R=async e=>{let t=u()?{runtime:"automatic"}:{};return{...e,presets:[...e?.presets||[],[r.resolve("@babel/preset-react"),t]],plugins:[...e?.plugins||[],r.resolve("babel-plugin-add-react-displayname")]}},h=async(e,t)=>await i(t)?e.plugins?.find(s=>s.constructor.name==="ReactRefreshPlugin")?(p.warn("=> React refresh is already set. You don't need to set the option"),e):(p.info("=> Using React fast refresh"),{...e,plugins:[...e.plugins||[],new c({overlay:{sockIntegration:"whm"}})]}):e;export{y as babel,R as babelDefault,h as webpackFinal};
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};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e}from"./chunk-HKSD7XQF.mjs";var r=[e.resolve("@storybook/preset-react-webpack/dist/framework-preset-react"),e.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-dom-hack"),e.resolve("@storybook/preset-react-webpack/dist/framework-preset-cra"),e.resolve("@storybook/preset-react-webpack/dist/framework-preset-react-docs")];export{r as addons};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preset-react-webpack",
3
- "version": "7.0.0-alpha.52",
3
+ "version": "7.0.0-alpha.54",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -74,12 +74,12 @@
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-alpha.52",
78
- "@storybook/docs-tools": "7.0.0-alpha.52",
79
- "@storybook/node-logger": "7.0.0-alpha.52",
80
- "@storybook/react": "7.0.0-alpha.52",
77
+ "@storybook/core-webpack": "7.0.0-alpha.54",
78
+ "@storybook/docs-tools": "7.0.0-alpha.54",
79
+ "@storybook/node-logger": "7.0.0-alpha.54",
80
+ "@storybook/react": "7.0.0-alpha.54",
81
81
  "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0",
82
- "@types/node": "^16.0.0 || ^18.0.0",
82
+ "@types/node": "^16.0.0",
83
83
  "@types/semver": "^7.3.4",
84
84
  "babel-plugin-add-react-displayname": "^0.0.5",
85
85
  "babel-plugin-react-docgen": "^4.2.1",
@@ -123,5 +123,5 @@
123
123
  ],
124
124
  "platform": "node"
125
125
  },
126
- "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666"
126
+ "gitHead": "91177d4e27daec556a24ae6223c3cbe17a998d9b"
127
127
  }
@@ -1 +0,0 @@
1
- var d=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});export{d as a};