@storybook/cli 8.5.0-beta.10 → 8.5.0-beta.11

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.
@@ -133,7 +133,8 @@ ${import_picocolors5.default.cyan("npx storybook doctor")}`;logger2.info(),found
133
133
 
134
134
  `)},async run({result}){let{setupFile,transformedSetupCode,transformedPreviewCode,previewFile}=result;transformedSetupCode&&setupFile&&(0,import_fs.writeFileSync)(setupFile,transformedSetupCode,"utf8"),transformedPreviewCode&&previewFile&&(0,import_fs.writeFileSync)(previewFile,transformedPreviewCode,"utf8")}};function transformSetupFile(source){let j=jscodeshift.withParser("ts"),root=j(source),importDeclaration=j.importDeclaration([j.importNamespaceSpecifier(j.identifier("a11yAddonAnnotations"))],j.literal("@storybook/addon-a11y/preview")),setProjectAnnotationsCall=root.find(j.CallExpression,{callee:{type:"Identifier",name:"setProjectAnnotations"}});if(setProjectAnnotationsCall.length===0)throw new Error("Could not find setProjectAnnotations call in vitest.setup file");return setProjectAnnotationsCall.forEach(p=>{if(p.value.arguments.length===1&&p.value.arguments[0].type==="ArrayExpression")p.value.arguments[0].elements.unshift(j.identifier("a11yAddonAnnotations"));else if(p.value.arguments.length===1&&p.value.arguments[0].type==="Identifier"){let arg=p.value.arguments[0];p.value.arguments[0]=j.arrayExpression([j.identifier("a11yAddonAnnotations"),arg])}}),root.get().node.program.body.unshift(importDeclaration),root.toSource()}async function transformPreviewFile(source,filePath){let previewConfig=(0,import_csf_tools3.loadConfig)(source).parse(),tags=previewConfig.getFieldNode(["tags"]),tagsNode=previewConfig.getFieldNode(["tags"]),tagsValue=previewConfig.getFieldValue(["tags"])??[];if(tags&&tagsValue&&(tagsValue.includes("a11y-test")||tagsValue.includes("!a11y-test")))return source;if(tagsNode){let tagsElementsLength=tagsNode.elements.length,lastTagElement=tagsNode.elements[tagsElementsLength-1];lastTagElement&&(lastTagElement.comments=[{type:"CommentBlock",leading:!1,trailing:!0,value:', "a11y-test"'}],previewConfig.setFieldNode(["tags"],tagsNode))}else previewConfig.setFieldValue(["tags"],["a11y-test"]);let formattedPreviewConfig=(0,import_csf_tools3.formatConfig)(previewConfig),lines=formattedPreviewConfig.split(`
135
135
  `),tagsLineIndex=lines.findIndex(line=>line.includes("tags: ["));if(tagsLineIndex===-1)return formattedPreviewConfig;lines[tagsLineIndex]=lines[tagsLineIndex].replace("['a11y-test']","[/*'a11y-test'*/]"),lines[tagsLineIndex]=lines[tagsLineIndex].replace('["a11y-test"]','[/*"a11y-test"*/]');let indentation=lines[tagsLineIndex]?.match(/^\s*/)?.[0],comment=`${indentation}// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
136
- ${indentation}// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;return lines.splice(tagsLineIndex,0,comment),(0,import_common8.formatFileContent)(filePath,lines.join(`
136
+ ${indentation}// The tag and its behavior are experimental and subject to change.
137
+ ${indentation}// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;return lines.splice(tagsLineIndex,0,comment),(0,import_common8.formatFileContent)(filePath,lines.join(`
137
138
  `))}var import_picocolors7=__toESM(require_picocolors(),1),import_ts_dedent5=require("ts-dedent");var addonPostCSS={id:"addon-postcss",versionRange:["*","*"],promptType:"notification",async check({mainConfig}){return!getAddonNames(mainConfig).find(addon=>addon.includes("@storybook/addon-postcss"))?null:{hasAddonPostcss:!0}},prompt(){return import_ts_dedent5.dedent`
138
139
  ${import_picocolors7.default.bold("Attention")}: We've detected that you're using the following package which is incompatible with Storybook 8 and beyond:
139
140
 
package/dist/bin/index.js CHANGED
@@ -118,7 +118,8 @@ ${import_picocolors5.default.cyan("npx storybook doctor")}`;logger2.info(),found
118
118
 
119
119
  `)},async run({result}){let{setupFile,transformedSetupCode,transformedPreviewCode,previewFile}=result;transformedSetupCode&&setupFile&&writeFileSync(setupFile,transformedSetupCode,"utf8"),transformedPreviewCode&&previewFile&&writeFileSync(previewFile,transformedPreviewCode,"utf8");}};function transformSetupFile(source){let j=jscodeshift.withParser("ts"),root=j(source),importDeclaration=j.importDeclaration([j.importNamespaceSpecifier(j.identifier("a11yAddonAnnotations"))],j.literal("@storybook/addon-a11y/preview")),setProjectAnnotationsCall=root.find(j.CallExpression,{callee:{type:"Identifier",name:"setProjectAnnotations"}});if(setProjectAnnotationsCall.length===0)throw new Error("Could not find setProjectAnnotations call in vitest.setup file");return setProjectAnnotationsCall.forEach(p=>{if(p.value.arguments.length===1&&p.value.arguments[0].type==="ArrayExpression")p.value.arguments[0].elements.unshift(j.identifier("a11yAddonAnnotations"));else if(p.value.arguments.length===1&&p.value.arguments[0].type==="Identifier"){let arg=p.value.arguments[0];p.value.arguments[0]=j.arrayExpression([j.identifier("a11yAddonAnnotations"),arg]);}}),root.get().node.program.body.unshift(importDeclaration),root.toSource()}async function transformPreviewFile(source,filePath){let previewConfig=loadConfig(source).parse(),tags=previewConfig.getFieldNode(["tags"]),tagsNode=previewConfig.getFieldNode(["tags"]),tagsValue=previewConfig.getFieldValue(["tags"])??[];if(tags&&tagsValue&&(tagsValue.includes("a11y-test")||tagsValue.includes("!a11y-test")))return source;if(tagsNode){let tagsElementsLength=tagsNode.elements.length,lastTagElement=tagsNode.elements[tagsElementsLength-1];lastTagElement&&(lastTagElement.comments=[{type:"CommentBlock",leading:!1,trailing:!0,value:', "a11y-test"'}],previewConfig.setFieldNode(["tags"],tagsNode));}else previewConfig.setFieldValue(["tags"],["a11y-test"]);let formattedPreviewConfig=formatConfig(previewConfig),lines=formattedPreviewConfig.split(`
120
120
  `),tagsLineIndex=lines.findIndex(line=>line.includes("tags: ["));if(tagsLineIndex===-1)return formattedPreviewConfig;lines[tagsLineIndex]=lines[tagsLineIndex].replace("['a11y-test']","[/*'a11y-test'*/]"),lines[tagsLineIndex]=lines[tagsLineIndex].replace('["a11y-test"]','[/*"a11y-test"*/]');let indentation=lines[tagsLineIndex]?.match(/^\s*/)?.[0],comment=`${indentation}// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
121
- ${indentation}// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;return lines.splice(tagsLineIndex,0,comment),formatFileContent(filePath,lines.join(`
121
+ ${indentation}// The tag and its behavior are experimental and subject to change.
122
+ ${indentation}// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;return lines.splice(tagsLineIndex,0,comment),formatFileContent(filePath,lines.join(`
122
123
  `))}var import_picocolors7=__toESM(require_picocolors(),1);var addonPostCSS={id:"addon-postcss",versionRange:["*","*"],promptType:"notification",async check({mainConfig}){return !getAddonNames(mainConfig).find(addon=>addon.includes("@storybook/addon-postcss"))?null:{hasAddonPostcss:!0}},prompt(){return dedent`
123
124
  ${import_picocolors7.default.bold("Attention")}: We've detected that you're using the following package which is incompatible with Storybook 8 and beyond:
124
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/cli",
3
- "version": "8.5.0-beta.10",
3
+ "version": "8.5.0-beta.11",
4
4
  "description": "Storybook CLI",
5
5
  "keywords": [
6
6
  "storybook"
@@ -42,10 +42,10 @@
42
42
  "dependencies": {
43
43
  "@babel/core": "^7.24.4",
44
44
  "@babel/types": "^7.24.0",
45
- "@storybook/codemod": "8.5.0-beta.10",
45
+ "@storybook/codemod": "8.5.0-beta.11",
46
46
  "@types/semver": "^7.3.4",
47
47
  "commander": "^12.1.0",
48
- "create-storybook": "8.5.0-beta.10",
48
+ "create-storybook": "8.5.0-beta.11",
49
49
  "cross-spawn": "^7.0.3",
50
50
  "envinfo": "^7.7.3",
51
51
  "fd-package-json": "^1.2.0",
@@ -57,7 +57,7 @@
57
57
  "leven": "^3.1.0",
58
58
  "prompts": "^2.4.0",
59
59
  "semver": "^7.3.7",
60
- "storybook": "8.5.0-beta.10",
60
+ "storybook": "8.5.0-beta.11",
61
61
  "tiny-invariant": "^1.3.1",
62
62
  "ts-dedent": "^2.0.0"
63
63
  },