@storybook/nextjs 7.6.2 → 7.6.4

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.
@@ -6,7 +6,7 @@
6
6
  We are unable to load the helper functions to use next/font/local.
7
7
  Please downgrade Next.js to version 13.2.4 to continue to use next/font/local in Storybook.
8
8
  Feel free to open a Github Issue!
9
- `)}}}}});var storybook_nextjs_font_loader_exports={};__export(storybook_nextjs_font_loader_exports,{default:()=>storybookNextjsFontLoader});module.exports=__toCommonJS(storybook_nextjs_font_loader_exports);var import_loader_utils3=__toESM(require("next/dist/compiled/loader-utils3")),import_server_errors=require("@storybook/core-events/server-errors"),cssCache=new Map;async function getFontFaceDeclarations(options){let{fetchCSSFromGoogleFonts:fetchCSSFromGoogleFonts2,getFontAxes:getFontAxes2,getUrl:getUrl2,validateData:validateData3}=(init_google_font_utils(),__toCommonJS(google_font_utils_exports)),{fontFamily,weights,styles,selectedVariableAxes,display,variable}=validateData3(options.fontFamily,[options.props],null),fontAxes=getFontAxes2(fontFamily,weights,styles,selectedVariableAxes),url=getUrl2(fontFamily,fontAxes,display);try{let hasCachedCSS=cssCache.has(url),fontFaceCSS=hasCachedCSS?cssCache.get(url):await fetchCSSFromGoogleFonts2(url,fontFamily).catch(()=>null);if(hasCachedCSS?cssCache.delete(url):cssCache.set(url,fontFaceCSS),fontFaceCSS===null)throw new import_server_errors.GoogleFontsDownloadError({fontFamily,url});return{id:import_loader_utils3.default.getHashDigest(url,"md5","hex",6),fontFamily,fontFaceCSS,weights,styles,variable}}catch(error){throw new import_server_errors.GoogleFontsLoadingError({error,url})}}var import_loader_utils32=__toESM(require("next/dist/compiled/loader-utils3")),import_core_common=require("@storybook/core-common"),import_path=__toESM(require("path"));async function getFontFaceDeclarations2(options,rootContext){let localFontSrc=options.props.src,parentFolder=import_path.default.dirname(import_path.default.join((0,import_core_common.getProjectRoot)(),options.filename)).replace(rootContext,""),{validateData:validateData3}=(init_local_font_utils(),__toCommonJS(local_font_utils_exports)),{weight,style,variable}=validateData3("",options.props),id=`font-${import_loader_utils32.default.getHashDigest(Buffer.from(JSON.stringify(localFontSrc)),"md5","hex",6)}`,arePathsWin32Format=/^[a-z]:\\/iu.test(options.filename),cleanWin32Path=pathString=>arePathsWin32Format?pathString.replace(/\\/gu,"/"):pathString;return{id,fontFamily:id,fontFaceCSS:(()=>{if(typeof localFontSrc=="string"){let localFontPath=cleanWin32Path(import_path.default.join(parentFolder,localFontSrc));return`@font-face {
9
+ `)}}}}});var storybook_nextjs_font_loader_exports={};__export(storybook_nextjs_font_loader_exports,{default:()=>storybookNextjsFontLoader});module.exports=__toCommonJS(storybook_nextjs_font_loader_exports);var import_loader_utils3=__toESM(require("next/dist/compiled/loader-utils3")),import_server_errors=require("@storybook/core-events/server-errors"),cssCache=new Map;async function getFontFaceDeclarations(options){let{fetchCSSFromGoogleFonts:fetchCSSFromGoogleFonts2,getFontAxes:getFontAxes2,getUrl:getUrl2,validateData:validateData3}=(init_google_font_utils(),__toCommonJS(google_font_utils_exports)),{fontFamily,weights,styles,selectedVariableAxes,display,variable}=validateData3(options.fontFamily,[options.props],null),fontAxes=getFontAxes2(fontFamily,weights,styles,selectedVariableAxes),url=getUrl2(fontFamily,fontAxes,display);try{let hasCachedCSS=cssCache.has(url),fontFaceCSS=hasCachedCSS?cssCache.get(url):await fetchCSSFromGoogleFonts2(url,fontFamily).catch(()=>null);if(hasCachedCSS?cssCache.delete(url):cssCache.set(url,fontFaceCSS),fontFaceCSS===null)throw new import_server_errors.GoogleFontsDownloadError({fontFamily,url});return{id:import_loader_utils3.default.getHashDigest(url,"md5","hex",6),fontFamily,fontFaceCSS,weights,styles,variable}}catch(error){throw new import_server_errors.GoogleFontsLoadingError({error,url})}}var import_loader_utils32=__toESM(require("next/dist/compiled/loader-utils3")),import_core_common=require("@storybook/core-common"),import_path=__toESM(require("path"));async function getFontFaceDeclarations2(options,rootContext,swcMode){let localFontSrc=options.props.src,parentFolder=swcMode?import_path.default.dirname(import_path.default.join((0,import_core_common.getProjectRoot)(),options.filename)).replace(rootContext,""):import_path.default.dirname(options.filename).replace(rootContext,""),{validateData:validateData3}=(init_local_font_utils(),__toCommonJS(local_font_utils_exports)),{weight,style,variable}=validateData3("",options.props),id=`font-${import_loader_utils32.default.getHashDigest(Buffer.from(JSON.stringify(localFontSrc)),"md5","hex",6)}`,arePathsWin32Format=/^[a-z]:\\/iu.test(options.filename),cleanWin32Path=pathString=>arePathsWin32Format?pathString.replace(/\\/gu,"/"):pathString;return{id,fontFamily:id,fontFaceCSS:(()=>{if(typeof localFontSrc=="string"){let localFontPath=cleanWin32Path(import_path.default.join(parentFolder,localFontSrc));return`@font-face {
10
10
  font-family: ${id};
11
11
  src: url(.${localFontPath});
12
12
  }`}return localFontSrc.map(font=>{let localFontPath=cleanWin32Path(import_path.default.join(parentFolder,font.path));return`@font-face {
@@ -37,7 +37,7 @@
37
37
  document.head.appendChild(classNamesStyle);
38
38
 
39
39
  }
40
- `}async function storybookNextjsFontLoader(){let loaderOptions=this.getOptions(),options;if(Object.keys(loaderOptions).length>0)options=loaderOptions;else{let importQuery=JSON.parse(this.resourceQuery.slice(1));options={filename:importQuery.path,fontFamily:importQuery.import,props:importQuery.arguments[0],source:this.context.replace(this.rootContext,"")}}let rootCtx=this.rootContext,fontFaceDeclaration;if((options.source.endsWith("next/font/google")||options.source.endsWith("@next/font/google"))&&(fontFaceDeclaration=await getFontFaceDeclarations(options)),(options.source.endsWith("next/font/local")||options.source.endsWith("@next/font/local"))&&(fontFaceDeclaration=await getFontFaceDeclarations2(options,rootCtx)),typeof fontFaceDeclaration<"u"){let cssMeta=getCSSMeta(fontFaceDeclaration);return`
40
+ `}async function storybookNextjsFontLoader(){let loaderOptions=this.getOptions(),swcMode=!1,options;if(Object.keys(loaderOptions).length>0)options=loaderOptions;else{let importQuery=JSON.parse(this.resourceQuery.slice(1));swcMode=!0,options={filename:importQuery.path,fontFamily:importQuery.import,props:importQuery.arguments[0],source:this.context.replace(this.rootContext,"")}}let rootCtx=this.rootContext,fontFaceDeclaration;if((options.source.endsWith("next/font/google")||options.source.endsWith("@next/font/google"))&&(fontFaceDeclaration=await getFontFaceDeclarations(options)),(options.source.endsWith("next/font/local")||options.source.endsWith("@next/font/local"))&&(fontFaceDeclaration=await getFontFaceDeclarations2(options,rootCtx,swcMode)),typeof fontFaceDeclaration<"u"){let cssMeta=getCSSMeta(fontFaceDeclaration);return`
41
41
  ${setFontDeclarationsInHead({fontFaceCSS:cssMeta.fontFaceCSS,id:fontFaceDeclaration.id,classNamesCSS:cssMeta.classNamesCSS})}
42
42
 
43
43
  module.exports = {
@@ -13,7 +13,7 @@ var google_font_utils_exports={};__export(google_font_utils_exports,{fetchCSSFro
13
13
  We are unable to load the helper functions to use next/font/local.
14
14
  Please downgrade Next.js to version 13.2.4 to continue to use next/font/local in Storybook.
15
15
  Feel free to open a Github Issue!
16
- `)}}}}});var cssCache=new Map;async function getFontFaceDeclarations(options){let{fetchCSSFromGoogleFonts:fetchCSSFromGoogleFonts2,getFontAxes:getFontAxes2,getUrl:getUrl2,validateData:validateData3}=(init_google_font_utils(),__toCommonJS(google_font_utils_exports)),{fontFamily,weights,styles,selectedVariableAxes,display,variable}=validateData3(options.fontFamily,[options.props],null),fontAxes=getFontAxes2(fontFamily,weights,styles,selectedVariableAxes),url=getUrl2(fontFamily,fontAxes,display);try{let hasCachedCSS=cssCache.has(url),fontFaceCSS=hasCachedCSS?cssCache.get(url):await fetchCSSFromGoogleFonts2(url,fontFamily).catch(()=>null);if(hasCachedCSS?cssCache.delete(url):cssCache.set(url,fontFaceCSS),fontFaceCSS===null)throw new GoogleFontsDownloadError({fontFamily,url});return {id:loaderUtils.getHashDigest(url,"md5","hex",6),fontFamily,fontFaceCSS,weights,styles,variable}}catch(error){throw new GoogleFontsLoadingError({error,url})}}async function getFontFaceDeclarations2(options,rootContext){let localFontSrc=options.props.src,parentFolder=path.dirname(path.join(getProjectRoot(),options.filename)).replace(rootContext,""),{validateData:validateData3}=(init_local_font_utils(),__toCommonJS(local_font_utils_exports)),{weight,style,variable}=validateData3("",options.props),id=`font-${loaderUtils.getHashDigest(Buffer.from(JSON.stringify(localFontSrc)),"md5","hex",6)}`,arePathsWin32Format=/^[a-z]:\\/iu.test(options.filename),cleanWin32Path=pathString=>arePathsWin32Format?pathString.replace(/\\/gu,"/"):pathString;return {id,fontFamily:id,fontFaceCSS:(()=>{if(typeof localFontSrc=="string"){let localFontPath=cleanWin32Path(path.join(parentFolder,localFontSrc));return `@font-face {
16
+ `)}}}}});var cssCache=new Map;async function getFontFaceDeclarations(options){let{fetchCSSFromGoogleFonts:fetchCSSFromGoogleFonts2,getFontAxes:getFontAxes2,getUrl:getUrl2,validateData:validateData3}=(init_google_font_utils(),__toCommonJS(google_font_utils_exports)),{fontFamily,weights,styles,selectedVariableAxes,display,variable}=validateData3(options.fontFamily,[options.props],null),fontAxes=getFontAxes2(fontFamily,weights,styles,selectedVariableAxes),url=getUrl2(fontFamily,fontAxes,display);try{let hasCachedCSS=cssCache.has(url),fontFaceCSS=hasCachedCSS?cssCache.get(url):await fetchCSSFromGoogleFonts2(url,fontFamily).catch(()=>null);if(hasCachedCSS?cssCache.delete(url):cssCache.set(url,fontFaceCSS),fontFaceCSS===null)throw new GoogleFontsDownloadError({fontFamily,url});return {id:loaderUtils.getHashDigest(url,"md5","hex",6),fontFamily,fontFaceCSS,weights,styles,variable}}catch(error){throw new GoogleFontsLoadingError({error,url})}}async function getFontFaceDeclarations2(options,rootContext,swcMode){let localFontSrc=options.props.src,parentFolder=swcMode?path.dirname(path.join(getProjectRoot(),options.filename)).replace(rootContext,""):path.dirname(options.filename).replace(rootContext,""),{validateData:validateData3}=(init_local_font_utils(),__toCommonJS(local_font_utils_exports)),{weight,style,variable}=validateData3("",options.props),id=`font-${loaderUtils.getHashDigest(Buffer.from(JSON.stringify(localFontSrc)),"md5","hex",6)}`,arePathsWin32Format=/^[a-z]:\\/iu.test(options.filename),cleanWin32Path=pathString=>arePathsWin32Format?pathString.replace(/\\/gu,"/"):pathString;return {id,fontFamily:id,fontFaceCSS:(()=>{if(typeof localFontSrc=="string"){let localFontPath=cleanWin32Path(path.join(parentFolder,localFontSrc));return `@font-face {
17
17
  font-family: ${id};
18
18
  src: url(.${localFontPath});
19
19
  }`}return localFontSrc.map(font=>{let localFontPath=cleanWin32Path(path.join(parentFolder,font.path));return `@font-face {
@@ -44,7 +44,7 @@ var google_font_utils_exports={};__export(google_font_utils_exports,{fetchCSSFro
44
44
  document.head.appendChild(classNamesStyle);
45
45
 
46
46
  }
47
- `}async function storybookNextjsFontLoader(){let loaderOptions=this.getOptions(),options;if(Object.keys(loaderOptions).length>0)options=loaderOptions;else {let importQuery=JSON.parse(this.resourceQuery.slice(1));options={filename:importQuery.path,fontFamily:importQuery.import,props:importQuery.arguments[0],source:this.context.replace(this.rootContext,"")};}let rootCtx=this.rootContext,fontFaceDeclaration;if((options.source.endsWith("next/font/google")||options.source.endsWith("@next/font/google"))&&(fontFaceDeclaration=await getFontFaceDeclarations(options)),(options.source.endsWith("next/font/local")||options.source.endsWith("@next/font/local"))&&(fontFaceDeclaration=await getFontFaceDeclarations2(options,rootCtx)),typeof fontFaceDeclaration<"u"){let cssMeta=getCSSMeta(fontFaceDeclaration);return `
47
+ `}async function storybookNextjsFontLoader(){let loaderOptions=this.getOptions(),swcMode=!1,options;if(Object.keys(loaderOptions).length>0)options=loaderOptions;else {let importQuery=JSON.parse(this.resourceQuery.slice(1));swcMode=!0,options={filename:importQuery.path,fontFamily:importQuery.import,props:importQuery.arguments[0],source:this.context.replace(this.rootContext,"")};}let rootCtx=this.rootContext,fontFaceDeclaration;if((options.source.endsWith("next/font/google")||options.source.endsWith("@next/font/google"))&&(fontFaceDeclaration=await getFontFaceDeclarations(options)),(options.source.endsWith("next/font/local")||options.source.endsWith("@next/font/local"))&&(fontFaceDeclaration=await getFontFaceDeclarations2(options,rootCtx,swcMode)),typeof fontFaceDeclaration<"u"){let cssMeta=getCSSMeta(fontFaceDeclaration);return `
48
48
  ${setFontDeclarationsInHead({fontFaceCSS:cssMeta.fontFaceCSS,id:fontFaceDeclaration.id,classNamesCSS:cssMeta.classNamesCSS})}
49
49
 
50
50
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/nextjs",
3
- "version": "7.6.2",
3
+ "version": "7.6.4",
4
4
  "description": "Storybook for Next.js",
5
5
  "keywords": [
6
6
  "storybook",
@@ -98,14 +98,14 @@
98
98
  "@babel/preset-react": "^7.22.15",
99
99
  "@babel/preset-typescript": "^7.23.2",
100
100
  "@babel/runtime": "^7.23.2",
101
- "@storybook/addon-actions": "7.6.2",
102
- "@storybook/builder-webpack5": "7.6.2",
103
- "@storybook/core-common": "7.6.2",
104
- "@storybook/core-events": "7.6.2",
105
- "@storybook/node-logger": "7.6.2",
106
- "@storybook/preset-react-webpack": "7.6.2",
107
- "@storybook/preview-api": "7.6.2",
108
- "@storybook/react": "7.6.2",
101
+ "@storybook/addon-actions": "7.6.4",
102
+ "@storybook/builder-webpack5": "7.6.4",
103
+ "@storybook/core-common": "7.6.4",
104
+ "@storybook/core-events": "7.6.4",
105
+ "@storybook/node-logger": "7.6.4",
106
+ "@storybook/preset-react-webpack": "7.6.4",
107
+ "@storybook/preview-api": "7.6.4",
108
+ "@storybook/react": "7.6.4",
109
109
  "@types/node": "^18.0.0",
110
110
  "css-loader": "^6.7.3",
111
111
  "find-up": "^5.0.0",