From 497df33b68eb773967baab48ebbc05e52dda64fe Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Feb 2023 17:46:07 +0100 Subject: [PATCH 1/5] possible fix for the error we get reported --- code/lib/csf-tools/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 42e373a72231..cbd0312b71f1 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -41,20 +41,20 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/types": "^7.20.2", "@storybook/csf": "next", "@storybook/types": "7.0.0-beta.55", "fs-extra": "^11.1.0", - "recast": "^0.23.1", "ts-dedent": "^2.0.0" }, "devDependencies": { "@babel/generator": "^7.20.4", "@babel/parser": "^7.20.3", "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2", "@types/fs-extra": "^11.0.1", "@types/js-yaml": "^3.12.6", "js-yaml": "^3.14.1", + "recast": "^0.23.1", "typescript": "~4.9.3" }, "publishConfig": { From a82bb1878ff3acc049b0a1d7209d9d7c554969f0 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Feb 2023 19:09:36 +0100 Subject: [PATCH 2/5] fix --- code/lib/codemod/package.json | 2 +- code/lib/codemod/src/transforms/csf-2-to-3.ts | 12 ++++++++---- code/lib/codemod/src/transforms/mdx-to-csf.ts | 11 +++++++---- code/yarn.lock | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 531c440d2957..4d9893333fd7 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -47,7 +47,7 @@ "dependencies": { "@babel/core": "^7.20.2", "@babel/preset-env": "^7.20.2", - "@babel/types": "^7.20.7", + "@babel/types": "^7.21.2", "@storybook/csf": "next", "@storybook/csf-tools": "7.0.0-beta.55", "@storybook/node-logger": "7.0.0-beta.55", diff --git a/code/lib/codemod/src/transforms/csf-2-to-3.ts b/code/lib/codemod/src/transforms/csf-2-to-3.ts index 59b4b16b8399..457d1fdb2fff 100644 --- a/code/lib/codemod/src/transforms/csf-2-to-3.ts +++ b/code/lib/codemod/src/transforms/csf-2-to-3.ts @@ -140,7 +140,7 @@ export default function transform(info: FileInfo, api: API, options: { parser?: // Remove the render function when we can hoist the template // const Template = (args) => ; // export const A = Template.bind({}); - let storyFn = template && csf._templates[template]; + let storyFn: t.Expression = template && (csf._templates[template] as any as t.Expression); if (!storyFn) { storyFn = init; } @@ -163,20 +163,24 @@ export default function transform(info: FileInfo, api: API, options: { parser?: importHelper.removeDeprecatedStoryImport(); csf._ast.program.body = csf._ast.program.body.reduce((acc, stmt) => { + const statement = stmt as t.Statement; // remove story annotations & template declarations - if (isStoryAnnotation(stmt, objectExports) || isTemplateDeclaration(stmt, csf._templates)) { + if ( + isStoryAnnotation(statement, objectExports) || + isTemplateDeclaration(statement, csf._templates) + ) { return acc; } // replace story exports with new object exports - const newExport = getNewExport(stmt, objectExports); + const newExport = getNewExport(statement, objectExports); if (newExport) { acc.push(newExport); return acc; } // include unknown statements - acc.push(stmt); + acc.push(statement); return acc; }, []); diff --git a/code/lib/codemod/src/transforms/mdx-to-csf.ts b/code/lib/codemod/src/transforms/mdx-to-csf.ts index 1702ab561f21..ce9dcbddd7f8 100644 --- a/code/lib/codemod/src/transforms/mdx-to-csf.ts +++ b/code/lib/codemod/src/transforms/mdx-to-csf.ts @@ -179,7 +179,10 @@ export function transform(source: string, baseName: string): [mdx: string, csf: return [t.objectProperty(t.identifier(attribute.name), t.stringLiteral(attribute.value))]; } return [ - t.objectProperty(t.identifier(attribute.name), babelParseExpression(attribute.value.value)), + t.objectProperty( + t.identifier(attribute.name), + babelParseExpression(attribute.value.value) as any as t.Expression + ), ]; } return []; @@ -216,7 +219,7 @@ export function transform(source: string, baseName: string): [mdx: string, csf: return t.arrowFunctionExpression([], t.stringLiteral(child.value)); } if (child.type === 'mdxFlowExpression' || child.type === 'mdxTextExpression') { - const expression = babelParseExpression(child.value); + const expression = babelParseExpression(child.value) as any as t.Expression; // Recreating those lines: https://github.com/storybookjs/mdx1-csf/blob/f408fc97e9a63097ca1ee577df9315a3cccca975/src/sb-mdx-plugin.ts#L185-L198 const BIND_REGEX = /\.bind\(.*\)/; @@ -234,7 +237,7 @@ export function transform(source: string, baseName: string): [mdx: string, csf: const expression = babelParseExpression( mdxProcessor.stringify({ type: 'root', children: [child] }) - ); + ) as any as t.Expression; return t.arrowFunctionExpression([], expression); } @@ -272,7 +275,7 @@ export function transform(source: string, baseName: string): [mdx: string, csf: return [ t.objectProperty( t.identifier(attribute.name), - babelParseExpression(attribute.value.value) + babelParseExpression(attribute.value.value) as any as t.Expression ), ]; } diff --git a/code/yarn.lock b/code/yarn.lock index 92f0347fac40..8dcdb79c6161 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5898,7 +5898,7 @@ __metadata: dependencies: "@babel/core": ^7.20.2 "@babel/preset-env": ^7.20.2 - "@babel/types": ^7.20.7 + "@babel/types": ^7.21.2 "@storybook/csf": next "@storybook/csf-tools": 7.0.0-beta.55 "@storybook/node-logger": 7.0.0-beta.55 From f428219c0d9fcb938cdfdf2ceccbb6f48361992c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Feb 2023 19:36:43 +0100 Subject: [PATCH 3/5] prebundle codemods babel dependencies too --- code/lib/codemod/package.json | 22 +++++++++++----------- code/lib/csf-tools/package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 4d9893333fd7..c7093822773b 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -45,28 +45,27 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/core": "^7.20.2", - "@babel/preset-env": "^7.20.2", - "@babel/types": "^7.21.2", "@storybook/csf": "next", "@storybook/csf-tools": "7.0.0-beta.55", "@storybook/node-logger": "7.0.0-beta.55", - "@storybook/types": "7.0.0-beta.55", - "cross-spawn": "^7.0.3", - "globby": "^11.0.2", - "jscodeshift": "^0.14.0", - "lodash": "^4.17.21", - "prettier": "^2.8.0", - "recast": "^0.23.1", - "util": "^0.12.4" + "@storybook/types": "7.0.0-beta.55" }, "devDependencies": { + "@babel/core": "^7.20.2", + "@babel/preset-env": "^7.20.2", + "@babel/types": "^7.21.2", "@types/jscodeshift": "^0.11.6", "ansi-regex": "^5.0.1", + "cross-spawn": "^7.0.3", + "globby": "^11.0.2", "jest": "^29.3.1", "jest-specific-snapshot": "^7.0.0", + "jscodeshift": "^0.14.0", + "lodash": "^4.17.21", "mdast-util-mdx-jsx": "^2.1.2", "mdast-util-mdxjs-esm": "^1.3.1", + "prettier": "^2.8.0", + "recast": "^0.23.1", "remark": "^14.0.2", "remark-mdx": "^2.2.1", "ts-dedent": "^2.2.0", @@ -74,6 +73,7 @@ "unist-util-is": "^5.2.0", "unist-util-select": "^4.0.3", "unist-util-visit": "^4.1.2", + "util": "^0.12.4", "vfile": "^5.3.7" }, "publishConfig": { diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index cbd0312b71f1..dd5e4d05a7fb 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -50,7 +50,7 @@ "@babel/generator": "^7.20.4", "@babel/parser": "^7.20.3", "@babel/traverse": "^7.20.1", - "@babel/types": "^7.20.2", + "@babel/types": "^7.21.2", "@types/fs-extra": "^11.0.1", "@types/js-yaml": "^3.12.6", "js-yaml": "^3.14.1", From ae99f10b5d7e90e0c8d18282f2f5c1d25e5dafe1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Feb 2023 19:58:04 +0100 Subject: [PATCH 4/5] simplify lockfile --- code/lib/codemod/package.json | 2 +- code/lib/csf-tools/package.json | 6 +- code/yarn.lock | 258 ++++---------------------------- 3 files changed, 34 insertions(+), 232 deletions(-) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index c7093822773b..cd6d6bc1ec92 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -51,7 +51,7 @@ "@storybook/types": "7.0.0-beta.55" }, "devDependencies": { - "@babel/core": "^7.20.2", + "@babel/core": "^7.21.0", "@babel/preset-env": "^7.20.2", "@babel/types": "^7.21.2", "@types/jscodeshift": "^0.11.6", diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index dd5e4d05a7fb..0e29d7e48b64 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -47,9 +47,9 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { - "@babel/generator": "^7.20.4", - "@babel/parser": "^7.20.3", - "@babel/traverse": "^7.20.1", + "@babel/generator": "^7.21.1", + "@babel/parser": "^7.21.2", + "@babel/traverse": "^7.21.2", "@babel/types": "^7.21.2", "@types/fs-extra": "^11.0.1", "@types/js-yaml": "^3.12.6", diff --git a/code/yarn.lock b/code/yarn.lock index 8dcdb79c6161..48f12a714984 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -12,7 +12,7 @@ __metadata: languageName: node linkType: hard -"@ampproject/remapping@npm:2.2.0, @ampproject/remapping@npm:^2.1.0, @ampproject/remapping@npm:^2.2.0": +"@ampproject/remapping@npm:2.2.0, @ampproject/remapping@npm:^2.2.0": version: 2.2.0 resolution: "@ampproject/remapping@npm:2.2.0" dependencies: @@ -402,7 +402,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.16.7, @babel/code-frame@npm:^7.18.6, @babel/code-frame@npm:^7.8.3": +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.16.7, @babel/code-frame@npm:^7.18.6": version: 7.18.6 resolution: "@babel/code-frame@npm:7.18.6" dependencies: @@ -418,100 +418,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:7.12.9": - version: 7.12.9 - resolution: "@babel/core@npm:7.12.9" - dependencies: - "@babel/code-frame": ^7.10.4 - "@babel/generator": ^7.12.5 - "@babel/helper-module-transforms": ^7.12.1 - "@babel/helpers": ^7.12.5 - "@babel/parser": ^7.12.7 - "@babel/template": ^7.12.7 - "@babel/traverse": ^7.12.9 - "@babel/types": ^7.12.7 - convert-source-map: ^1.7.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.1 - json5: ^2.1.2 - lodash: ^4.17.19 - resolve: ^1.3.2 - semver: ^5.4.1 - source-map: ^0.5.0 - checksum: c11d26f5a33a29c94fdd1c492dfd723f48926c51e975448dda57c081c0d74c7b03298642b2651559e0d330ec868b5757b60f9648c71cf7f89fddf79a17cf006f - languageName: node - linkType: hard - -"@babel/core@npm:7.19.3": - version: 7.19.3 - resolution: "@babel/core@npm:7.19.3" - dependencies: - "@ampproject/remapping": ^2.1.0 - "@babel/code-frame": ^7.18.6 - "@babel/generator": ^7.19.3 - "@babel/helper-compilation-targets": ^7.19.3 - "@babel/helper-module-transforms": ^7.19.0 - "@babel/helpers": ^7.19.0 - "@babel/parser": ^7.19.3 - "@babel/template": ^7.18.10 - "@babel/traverse": ^7.19.3 - "@babel/types": ^7.19.3 - convert-source-map: ^1.7.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.2 - json5: ^2.2.1 - semver: ^6.3.0 - checksum: 2ef6bc3c407f5aa868a3fdc5ec58bcaf98d073de5fff65c1b16b1133cd232f43b5a413a1356c4cdd37f477fb006ac9fc0d5fce8a0f2f4f5d881de0dd1f6b0b06 - languageName: node - linkType: hard - -"@babel/core@npm:7.20.12": - version: 7.20.12 - resolution: "@babel/core@npm:7.20.12" - dependencies: - "@ampproject/remapping": ^2.1.0 - "@babel/code-frame": ^7.18.6 - "@babel/generator": ^7.20.7 - "@babel/helper-compilation-targets": ^7.20.7 - "@babel/helper-module-transforms": ^7.20.11 - "@babel/helpers": ^7.20.7 - "@babel/parser": ^7.20.7 - "@babel/template": ^7.20.7 - "@babel/traverse": ^7.20.12 - "@babel/types": ^7.20.7 - convert-source-map: ^1.7.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.2 - json5: ^2.2.2 - semver: ^6.3.0 - checksum: 190f5e144396692e163d62f17ea715a4cc3cfc22ea8052424e20a5e2bdf162195eac71440244689b2e6d4d61dfdeab1d7f475d77ab31904832c844fe572fbee2 - languageName: node - linkType: hard - -"@babel/core@npm:7.8.7": - version: 7.8.7 - resolution: "@babel/core@npm:7.8.7" - dependencies: - "@babel/code-frame": ^7.8.3 - "@babel/generator": ^7.8.7 - "@babel/helpers": ^7.8.4 - "@babel/parser": ^7.8.7 - "@babel/template": ^7.8.6 - "@babel/traverse": ^7.8.6 - "@babel/types": ^7.8.7 - convert-source-map: ^1.7.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.1 - json5: ^2.1.0 - lodash: ^4.17.13 - resolve: ^1.3.2 - semver: ^5.4.1 - source-map: ^0.5.0 - checksum: ffff3e94f219c7a4a32c825eca57c9beb1a83a60c0c5c37e7ddbcecd45c5c188cece5352f56a91a14c05c25ffcb298155429fedb9e86477cf2c91c3388b1f2c9 - languageName: node - linkType: hard - -"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.12, @babel/core@npm:^7.20.2, @babel/core@npm:^7.20.5, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5, @babel/core@npm:^7.9.6": +"@babel/core@npm:7.12.9, @babel/core@npm:7.19.3, @babel/core@npm:7.20.12, @babel/core@npm:7.8.7, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.12, @babel/core@npm:^7.20.2, @babel/core@npm:^7.20.5, @babel/core@npm:^7.21.0, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5, @babel/core@npm:^7.9.6": version: 7.21.0 resolution: "@babel/core@npm:7.21.0" dependencies: @@ -534,18 +441,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:7.20.7": - version: 7.20.7 - resolution: "@babel/generator@npm:7.20.7" - dependencies: - "@babel/types": ^7.20.7 - "@jridgewell/gen-mapping": ^0.3.2 - jsesc: ^2.5.1 - checksum: b22032867dfad3115404ea74fd063079883428cf838ec490a1f64d2e5e4dd82f94f77df90eb95a57740fb387a115b5ffe655e768cb50862832c6f9f6ffb4be79 - languageName: node - linkType: hard - -"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.12.5, @babel/generator@npm:^7.19.3, @babel/generator@npm:^7.20.4, @babel/generator@npm:^7.20.7, @babel/generator@npm:^7.21.0, @babel/generator@npm:^7.21.1, @babel/generator@npm:^7.7.2, @babel/generator@npm:^7.8.7": +"@babel/generator@npm:7.20.7, @babel/generator@npm:^7.12.11, @babel/generator@npm:^7.21.0, @babel/generator@npm:^7.21.1, @babel/generator@npm:^7.7.2": version: 7.21.1 resolution: "@babel/generator@npm:7.21.1" dependencies: @@ -576,7 +472,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.17.7, @babel/helper-compilation-targets@npm:^7.18.9, @babel/helper-compilation-targets@npm:^7.19.3, @babel/helper-compilation-targets@npm:^7.20.0, @babel/helper-compilation-targets@npm:^7.20.7": +"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.17.7, @babel/helper-compilation-targets@npm:^7.18.9, @babel/helper-compilation-targets@npm:^7.20.0, @babel/helper-compilation-targets@npm:^7.20.7": version: 7.20.7 resolution: "@babel/helper-compilation-targets@npm:7.20.7" dependencies: @@ -690,7 +586,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.19.0, @babel/helper-module-transforms@npm:^7.20.11, @babel/helper-module-transforms@npm:^7.21.0, @babel/helper-module-transforms@npm:^7.21.2": +"@babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.20.11, @babel/helper-module-transforms@npm:^7.21.0, @babel/helper-module-transforms@npm:^7.21.2": version: 7.21.2 resolution: "@babel/helper-module-transforms@npm:7.21.2" dependencies: @@ -715,14 +611,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:7.10.4": - version: 7.10.4 - resolution: "@babel/helper-plugin-utils@npm:7.10.4" - checksum: 113d0405281f5490658f7c1c3a81b4a37927375e1ebcccd2fd90be538a102da0c2d6024561aaf26bd1c71ef7688b5a8b96a87d938db8d9774454ab635011fc7f - languageName: node - linkType: hard - -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": +"@babel/helper-plugin-utils@npm:7.10.4, @babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.20.2 resolution: "@babel/helper-plugin-utils@npm:7.20.2" checksum: bf4de040e57b7ddff36ea599e963c391eb246d5a95207bb9ef3e33073c451bcc0821e3a9cc08dfede862a6dcc110d7e6e7d9a483482f852be358c5b60add499c @@ -817,7 +706,7 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.12.5, @babel/helpers@npm:^7.19.0, @babel/helpers@npm:^7.20.7, @babel/helpers@npm:^7.21.0, @babel/helpers@npm:^7.8.4": +"@babel/helpers@npm:^7.21.0": version: 7.21.0 resolution: "@babel/helpers@npm:7.21.0" dependencies: @@ -839,7 +728,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.13.12, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.4, @babel/parser@npm:^7.18.4, @babel/parser@npm:^7.19.3, @babel/parser@npm:^7.20.3, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.0, @babel/parser@npm:^7.21.2, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.7.0, @babel/parser@npm:^7.8.6, @babel/parser@npm:^7.8.7, @babel/parser@npm:^7.9.6": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.12, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.4, @babel/parser@npm:^7.18.4, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.0, @babel/parser@npm:^7.21.2, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.7.0, @babel/parser@npm:^7.9.6": version: 7.21.2 resolution: "@babel/parser@npm:7.21.2" bin: @@ -998,20 +887,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-object-rest-spread@npm:7.12.1": - version: 7.12.1 - resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.12.1" - dependencies: - "@babel/helper-plugin-utils": ^7.10.4 - "@babel/plugin-syntax-object-rest-spread": ^7.8.0 - "@babel/plugin-transform-parameters": ^7.12.1 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: f773d59ead8b056b646d585e95d610cca2f0aeaa2eeaad74b3eb9e25821b06f27e361dd0aac9a088a10c22fee1ead8863f82a2be073e28eb04ca9a330a00941e - languageName: node - linkType: hard - -"@babel/plugin-proposal-object-rest-spread@npm:^7.20.2, @babel/plugin-proposal-object-rest-spread@npm:^7.20.7": +"@babel/plugin-proposal-object-rest-spread@npm:7.12.1, @babel/plugin-proposal-object-rest-spread@npm:^7.20.2, @babel/plugin-proposal-object-rest-spread@npm:^7.20.7": version: 7.20.7 resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.20.7" dependencies: @@ -1210,18 +1086,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-jsx@npm:7.12.1": - version: 7.12.1 - resolution: "@babel/plugin-syntax-jsx@npm:7.12.1" - dependencies: - "@babel/helper-plugin-utils": ^7.10.4 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 11d435f9e4e71c0f00e5bc295b40747c2c42341b7f38ddc5f8ac41d49ddfa247514dbe91932fa3dabd65581b4c7a9fe5b3d1c2b285e5ca32f4e5296cc185d40c - languageName: node - linkType: hard - -"@babel/plugin-syntax-jsx@npm:^7.17.12, @babel/plugin-syntax-jsx@npm:^7.18.6, @babel/plugin-syntax-jsx@npm:^7.7.2": +"@babel/plugin-syntax-jsx@npm:7.12.1, @babel/plugin-syntax-jsx@npm:^7.17.12, @babel/plugin-syntax-jsx@npm:^7.18.6, @babel/plugin-syntax-jsx@npm:^7.7.2": version: 7.18.6 resolution: "@babel/plugin-syntax-jsx@npm:7.18.6" dependencies: @@ -1265,7 +1130,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-object-rest-spread@npm:7.8.3, @babel/plugin-syntax-object-rest-spread@npm:^7.8.0, @babel/plugin-syntax-object-rest-spread@npm:^7.8.3": +"@babel/plugin-syntax-object-rest-spread@npm:7.8.3, @babel/plugin-syntax-object-rest-spread@npm:^7.8.3": version: 7.8.3 resolution: "@babel/plugin-syntax-object-rest-spread@npm:7.8.3" dependencies: @@ -1609,7 +1474,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.20.1, @babel/plugin-transform-parameters@npm:^7.20.7": +"@babel/plugin-transform-parameters@npm:^7.20.1, @babel/plugin-transform-parameters@npm:^7.20.7": version: 7.20.7 resolution: "@babel/plugin-transform-parameters@npm:7.20.7" dependencies: @@ -1725,23 +1590,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-runtime@npm:7.19.6": - version: 7.19.6 - resolution: "@babel/plugin-transform-runtime@npm:7.19.6" - dependencies: - "@babel/helper-module-imports": ^7.18.6 - "@babel/helper-plugin-utils": ^7.19.0 - babel-plugin-polyfill-corejs2: ^0.3.3 - babel-plugin-polyfill-corejs3: ^0.6.0 - babel-plugin-polyfill-regenerator: ^0.4.1 - semver: ^6.3.0 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 39c1a7a6421dbd00d599082b4c38ed1b3ba5844af1249d3860d7de7ce7e6451641ee0fc5b237af4a02f5cd77c7896a2b50799d0f90b1b30b6d2cd92061b2fdff - languageName: node - linkType: hard - -"@babel/plugin-transform-runtime@npm:^7.13.9, @babel/plugin-transform-runtime@npm:^7.21.0": +"@babel/plugin-transform-runtime@npm:7.19.6, @babel/plugin-transform-runtime@npm:^7.13.9, @babel/plugin-transform-runtime@npm:^7.21.0": version: 7.21.0 resolution: "@babel/plugin-transform-runtime@npm:7.21.0" dependencies: @@ -2033,34 +1882,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:7.12.18": - version: 7.12.18 - resolution: "@babel/runtime@npm:7.12.18" - dependencies: - regenerator-runtime: ^0.13.4 - checksum: 380d0e6e1dd239541cce00f3be9efdf9d1167598cf2f3441c428bc858668034862bd9ef6c5804a1af0be78d9cfa32550f6c36700983b61cca8907fb2e786ffab - languageName: node - linkType: hard - -"@babel/runtime@npm:7.20.7": - version: 7.20.7 - resolution: "@babel/runtime@npm:7.20.7" - dependencies: - regenerator-runtime: ^0.13.11 - checksum: 60ff1a1452d0f88b766211604610b92d5e063d7024150b6dab87af238e2a6634c01eff4add9e14b4335ced966640af34196ee4cd63a0c181c2d4edd387795c0f - languageName: node - linkType: hard - -"@babel/runtime@npm:7.7.2": - version: 7.7.2 - resolution: "@babel/runtime@npm:7.7.2" - dependencies: - regenerator-runtime: ^0.13.2 - checksum: a1bab397bf1ae0117a7ac1fb67885833368b065425960ed7e5d8856efad5fc46765ae27d82d3d6ede2ade35c901d56745e1ae8ad75b36ca309a9dfd0fca5a712 - languageName: node - linkType: hard - -"@babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2": +"@babel/runtime@npm:7.12.18, @babel/runtime@npm:7.20.7, @babel/runtime@npm:7.7.2, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2, @babel/runtime@npm:~7.5.4": version: 7.21.0 resolution: "@babel/runtime@npm:7.21.0" dependencies: @@ -2069,16 +1891,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:~7.5.4": - version: 7.5.5 - resolution: "@babel/runtime@npm:7.5.5" - dependencies: - regenerator-runtime: ^0.13.2 - checksum: ee5789200681462dc668ce4a0720914b16b872b4f71b79931a343fd4114154a3ec64e7e93ec38f634b7e3f54767005883402af86d60eb5172e897cae275ef8da - languageName: node - linkType: hard - -"@babel/template@npm:7.20.7, @babel/template@npm:^7.12.7, @babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7, @babel/template@npm:^7.3.3, @babel/template@npm:^7.7.0, @babel/template@npm:^7.8.6": +"@babel/template@npm:7.20.7, @babel/template@npm:7.8.6, @babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7, @babel/template@npm:^7.3.3, @babel/template@npm:^7.7.0": version: 7.20.7 resolution: "@babel/template@npm:7.20.7" dependencies: @@ -2089,18 +1902,7 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:7.8.6": - version: 7.8.6 - resolution: "@babel/template@npm:7.8.6" - dependencies: - "@babel/code-frame": ^7.8.3 - "@babel/parser": ^7.8.6 - "@babel/types": ^7.8.6 - checksum: c89b2f39452083303beaaabc794ebf83194bb5599647c54591d3b8358b42d720bab050daa34450052e4fdf21bcb77cf60b6419fec73d50eb2ce60c4abfe7292e - languageName: node - linkType: hard - -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.19.3, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.20.12, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7, @babel/traverse@npm:^7.21.0, @babel/traverse@npm:^7.21.2, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.0, @babel/traverse@npm:^7.7.2, @babel/traverse@npm:^7.8.6": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7, @babel/traverse@npm:^7.21.0, @babel/traverse@npm:^7.21.2, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.0, @babel/traverse@npm:^7.7.2": version: 7.21.2 resolution: "@babel/traverse@npm:7.21.2" dependencies: @@ -2118,7 +1920,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.12.7, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.8, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.3, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.5, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.2, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.0, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.8.6, @babel/types@npm:^7.8.7, @babel/types@npm:^7.9.6": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.8, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.5, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.2, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.0, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": version: 7.21.2 resolution: "@babel/types@npm:7.21.2" dependencies: @@ -5896,7 +5698,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/codemod@workspace:lib/codemod" dependencies: - "@babel/core": ^7.20.2 + "@babel/core": ^7.21.0 "@babel/preset-env": ^7.20.2 "@babel/types": ^7.21.2 "@storybook/csf": next @@ -6099,10 +5901,10 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/csf-tools@workspace:lib/csf-tools" dependencies: - "@babel/generator": ^7.20.4 - "@babel/parser": ^7.20.3 - "@babel/traverse": ^7.20.1 - "@babel/types": ^7.20.2 + "@babel/generator": ^7.21.1 + "@babel/parser": ^7.21.2 + "@babel/traverse": ^7.21.2 + "@babel/types": ^7.21.2 "@storybook/csf": next "@storybook/types": 7.0.0-beta.55 "@types/fs-extra": ^11.0.1 @@ -16327,7 +16129,7 @@ __metadata: languageName: node linkType: hard -"gensync@npm:^1.0.0-beta.1, gensync@npm:^1.0.0-beta.2": +"gensync@npm:^1.0.0-beta.2": version: 1.0.0-beta.2 resolution: "gensync@npm:1.0.0-beta.2" checksum: 782aba6cba65b1bb5af3b095d96249d20edbe8df32dbf4696fd49be2583faf676173bf4809386588828e4dd76a3354fcbeb577bab1c833ccd9fc4577f26103f8 @@ -20895,7 +20697,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.13, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4": +"lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c @@ -26110,7 +25912,7 @@ __metadata: languageName: node linkType: hard -"regenerator-runtime@npm:^0.13.11, regenerator-runtime@npm:^0.13.2, regenerator-runtime@npm:^0.13.4": +"regenerator-runtime@npm:^0.13.11, regenerator-runtime@npm:^0.13.4": version: 0.13.11 resolution: "regenerator-runtime@npm:0.13.11" checksum: 12b069dc774001fbb0014f6a28f11c09ebfe3c0d984d88c9bced77fdb6fedbacbca434d24da9ae9371bfbf23f754869307fb51a4c98a8b8b18e5ef748677ca24 @@ -26753,7 +26555,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:1.22.1, resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.13.1, resolve@npm:^1.14.2, resolve@npm:^1.15.1, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.3.2, resolve@npm:^1.4.0": +"resolve@npm:1.22.1, resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.13.1, resolve@npm:^1.14.2, resolve@npm:^1.15.1, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.4.0": version: 1.22.1 resolution: "resolve@npm:1.22.1" dependencies: @@ -26779,7 +26581,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@1.22.1#~builtin, resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.12.0#~builtin, resolve@patch:resolve@^1.13.1#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.15.1#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.4.0#~builtin": +"resolve@patch:resolve@1.22.1#~builtin, resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.12.0#~builtin, resolve@patch:resolve@^1.13.1#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.15.1#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.4.0#~builtin": version: 1.22.1 resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin::version=1.22.1&hash=c3c19d" dependencies: @@ -27225,7 +27027,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.3.0, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1": +"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.3.0, semver@npm:^5.5.0, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1": version: 5.7.1 resolution: "semver@npm:5.7.1" bin: @@ -27784,7 +27586,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.5.0, source-map@npm:^0.5.6, source-map@npm:^0.5.7": +"source-map@npm:^0.5.6, source-map@npm:^0.5.7": version: 0.5.7 resolution: "source-map@npm:0.5.7" checksum: 904e767bb9c494929be013017380cbba013637da1b28e5943b566031e29df04fba57edf3f093e0914be094648b577372bd8ad247fa98cfba9c600794cd16b599 From 4d5036f1b72825974dd57b989da9933ebc8530d7 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Feb 2023 21:05:41 +0100 Subject: [PATCH 5/5] fix tests, recast uses instance-of --- code/lib/codemod/package.json | 4 ++-- code/lib/csf-tools/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 39c6092c8321..59170f19875d 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -48,7 +48,8 @@ "@storybook/csf": "next", "@storybook/csf-tools": "7.0.0-beta.56", "@storybook/node-logger": "7.0.0-beta.56", - "@storybook/types": "7.0.0-beta.56" + "@storybook/types": "7.0.0-beta.56", + "recast": "^0.23.1" }, "devDependencies": { "@babel/core": "^7.21.0", @@ -65,7 +66,6 @@ "mdast-util-mdx-jsx": "^2.1.2", "mdast-util-mdxjs-esm": "^1.3.1", "prettier": "^2.8.0", - "recast": "^0.23.1", "remark": "^14.0.2", "remark-mdx": "^2.2.1", "ts-dedent": "^2.2.0", diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 0589f830369f..5e5894b1311f 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -44,6 +44,7 @@ "@storybook/csf": "next", "@storybook/types": "7.0.0-beta.56", "fs-extra": "^11.1.0", + "recast": "^0.23.1", "ts-dedent": "^2.0.0" }, "devDependencies": { @@ -54,7 +55,6 @@ "@types/fs-extra": "^11.0.1", "@types/js-yaml": "^3.12.6", "js-yaml": "^3.14.1", - "recast": "^0.23.1", "typescript": "~4.9.3" }, "publishConfig": {