@storybook/codemod 9.0.0-alpha.2 → 9.0.0-alpha.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.
- package/README.md +1 -156
- package/dist/index.d.ts +0 -3
- package/dist/index.js +1 -1
- package/package.json +2 -17
- package/dist/transforms/add-component-parameters.d.ts +0 -21
- package/dist/transforms/add-component-parameters.js +0 -1
- package/dist/transforms/csf-hoist-story-annotations.d.ts +0 -26
- package/dist/transforms/csf-hoist-story-annotations.js +0 -1
- package/dist/transforms/mdx-to-csf.d.ts +0 -10
- package/dist/transforms/mdx-to-csf.js +0 -67
- package/dist/transforms/migrate-to-test-package.d.ts +0 -6
- package/dist/transforms/migrate-to-test-package.js +0 -1
- package/dist/transforms/move-builtin-addons.d.ts +0 -3
- package/dist/transforms/move-builtin-addons.js +0 -1
- package/dist/transforms/storiesof-to-csf.d.ts +0 -25
- package/dist/transforms/storiesof-to-csf.js +0 -1
- package/dist/transforms/update-addon-info.d.ts +0 -23
- package/dist/transforms/update-addon-info.js +0 -1
- package/dist/transforms/update-organisation-name.d.ts +0 -25
- package/dist/transforms/update-organisation-name.js +0 -1
package/README.md
CHANGED
@@ -39,7 +39,7 @@ From the directory where you installed both `jscodeshift` and `@storybook/codemo
|
|
39
39
|
Example:
|
40
40
|
|
41
41
|
```sh
|
42
|
-
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/
|
42
|
+
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/upgrade-hierarchy-separators.js . --ignore-pattern "node_modules|dist"
|
43
43
|
```
|
44
44
|
|
45
45
|
Explanation:
|
@@ -48,161 +48,6 @@ Explanation:
|
|
48
48
|
|
49
49
|
## Transforms
|
50
50
|
|
51
|
-
### update-organisation-name
|
52
|
-
|
53
|
-
Updates package names in imports to migrate to the new package names of storybook.
|
54
|
-
|
55
|
-
```sh
|
56
|
-
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/update-organisation-name.js . --ignore-pattern "node_modules|dist"
|
57
|
-
```
|
58
|
-
|
59
|
-
There's a mapping of paths we replace but this example explains the gist of it:
|
60
|
-
|
61
|
-
Example:
|
62
|
-
|
63
|
-
```js
|
64
|
-
import { storiesOf } from '@kadira/storybook';
|
65
|
-
import { linkTo } from '@kadira/storybook-addon-links';
|
66
|
-
```
|
67
|
-
|
68
|
-
Becomes
|
69
|
-
|
70
|
-
```js
|
71
|
-
import { storiesOf } from '@storybook/react';
|
72
|
-
import { linkTo } from '@storybook/addon-links';
|
73
|
-
```
|
74
|
-
|
75
|
-
### update-addon-info
|
76
|
-
|
77
|
-
Replaces the Info addon's deprecated `addWithInfo` API with the standard `withInfo` API.
|
78
|
-
|
79
|
-
```sh
|
80
|
-
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/update-addon-info.js . --ignore-pattern "node_modules|dist"
|
81
|
-
```
|
82
|
-
|
83
|
-
Example:
|
84
|
-
|
85
|
-
```js
|
86
|
-
storiesOf('Button').addWithInfo('simple usage', 'This is the basic usage of the button.', () => (
|
87
|
-
<Button label="The Button" />
|
88
|
-
));
|
89
|
-
```
|
90
|
-
|
91
|
-
Becomes
|
92
|
-
|
93
|
-
```js
|
94
|
-
storiesOf('Button').add(
|
95
|
-
'simple usage',
|
96
|
-
withInfo('This is the basic usage of the button.')(() => <Button label="The Button" />)
|
97
|
-
);
|
98
|
-
```
|
99
|
-
|
100
|
-
With options example:
|
101
|
-
|
102
|
-
```js
|
103
|
-
storiesOf('Button').addWithInfo(
|
104
|
-
'simple usage (disable source)',
|
105
|
-
'This is the basic usage of the button.',
|
106
|
-
() => <Button label="The Button" />,
|
107
|
-
{ source: false, inline: true }
|
108
|
-
);
|
109
|
-
```
|
110
|
-
|
111
|
-
Becomes
|
112
|
-
|
113
|
-
```js
|
114
|
-
storiesOf('Button').add(
|
115
|
-
'simple usage (disable source)',
|
116
|
-
withInfo({
|
117
|
-
text: 'This is the basic usage of the button.',
|
118
|
-
source: false,
|
119
|
-
inline: true,
|
120
|
-
})(() => <Button label="The Button" />)
|
121
|
-
);
|
122
|
-
```
|
123
|
-
|
124
|
-
### add-component-parameters
|
125
|
-
|
126
|
-
This tries to smartly adds "component" parameters to all your existing stories
|
127
|
-
for use in SB Docs.
|
128
|
-
|
129
|
-
```sh
|
130
|
-
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/add-component-parameters.js . --ignore-pattern "node_modules|dist"
|
131
|
-
```
|
132
|
-
|
133
|
-
For example:
|
134
|
-
|
135
|
-
```js
|
136
|
-
import { Button } from './Button';
|
137
|
-
|
138
|
-
storiesOf('Button', module).add('story', () => <Button label="The Button" />);
|
139
|
-
```
|
140
|
-
|
141
|
-
Becomes:
|
142
|
-
|
143
|
-
```js
|
144
|
-
import { Button } from './Button';
|
145
|
-
|
146
|
-
storiesOf('Button', module)
|
147
|
-
.addParameters({ component: Button })
|
148
|
-
.add('story', () => <Button label="The Button" />);
|
149
|
-
```
|
150
|
-
|
151
|
-
Heuristics:
|
152
|
-
|
153
|
-
- The storiesOf "kind" name must be Button
|
154
|
-
- Button must be imported in the file
|
155
|
-
|
156
|
-
### storiesof-to-csf
|
157
|
-
|
158
|
-
This converts all of your "old-style" `storiesOf` stories into Component Story Format (CSF), which uses standard ES6 modules.
|
159
|
-
|
160
|
-
> NOTE: The output of this transformation may require manual editing after running the transformation. `storiesOf` API allows multiple "kinds" (components) to be declared per file, but CSF only allows a single component per file. Therefore, if you use this feature in your input stories, you will need to split up the resulting outputs by hand. You'll see a warning at the console if you need to hand edit.
|
161
|
-
|
162
|
-
```sh
|
163
|
-
./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/storiesof-to-csf.js . --ignore-pattern "node_modules|dist"
|
164
|
-
```
|
165
|
-
|
166
|
-
For example:
|
167
|
-
|
168
|
-
```js
|
169
|
-
storiesOf('Button', module)
|
170
|
-
.add('story', () => <Button label="Story 1" />)
|
171
|
-
.add('second story', () => <Button label="Story 2" onClick={action('click')} />)
|
172
|
-
.add('complex story', () => (
|
173
|
-
<div>
|
174
|
-
<Button label="The Button" onClick={action('onClick')} />
|
175
|
-
<br />
|
176
|
-
</div>
|
177
|
-
));
|
178
|
-
```
|
179
|
-
|
180
|
-
Becomes:
|
181
|
-
|
182
|
-
```js
|
183
|
-
export default {
|
184
|
-
title: 'Button',
|
185
|
-
};
|
186
|
-
|
187
|
-
export const story = () => <Button label="Story 1" />;
|
188
|
-
|
189
|
-
export const story2 = () => <Button label="Story 2" onClick={action('click')} />;
|
190
|
-
story2.story = { name: 'second story' };
|
191
|
-
|
192
|
-
export const story3 = () => (
|
193
|
-
<div>
|
194
|
-
<Button label="The Button" onClick={action('onClick')} />
|
195
|
-
<br />
|
196
|
-
</div>
|
197
|
-
);
|
198
|
-
story3.story = { name: 'complex story' };
|
199
|
-
```
|
200
|
-
|
201
|
-
Heuristics:
|
202
|
-
|
203
|
-
- If a file has any default export, it will be skipped
|
204
|
-
- If a file has multiple `storiesOf` declarations, it will convert each one separately. This generates invalid ES6, but you can edit the file by hand to split it into multiple files (or whatever is appropriate).
|
205
|
-
|
206
51
|
### upgrade-hierarchy-separators
|
207
52
|
|
208
53
|
Starting in 5.3, Storybook is moving to using a single path separator, `/`, to specify the story hierarchy. It previously defaulted to `|` for story "roots" (optional) and either `/` or `.` for denoting paths. This codemod updates the old default to the new default.
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
export { packageNames, default as updateOrganisationName } from './transforms/update-organisation-name.js';
|
2
|
-
export { default as updateAddonInfo } from './transforms/update-addon-info.js';
|
3
|
-
|
4
1
|
declare function listCodemods(): string[];
|
5
2
|
declare function runCodemod(codemod: any, { glob, logger, dryRun, rename, parser, }: {
|
6
3
|
glob: any;
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{listCodemods:()=>listCodemods,
|
1
|
+
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{listCodemods:()=>listCodemods,runCodemod:()=>runCodemod});module.exports=__toCommonJS(index_exports);var import_node_fs=require("fs"),import_promises=require("fs/promises"),import_node_path=require("path"),import_cross_spawn=require("cross-spawn");var import_compat=require("es-toolkit/compat");function jscodeshiftToPrettierParser(parser){let parserMap={babylon:"babel",flow:"flow",ts:"typescript",tsx:"typescript"};return parser&&parserMap[parser]||"babel"}var TRANSFORM_DIR=`${__dirname}/transforms`;function listCodemods(){return(0,import_node_fs.readdirSync)(TRANSFORM_DIR).filter(fname=>fname.endsWith(".js")).map(fname=>fname.slice(0,-3))}async function renameFile(file,from,to,{logger}){let newFile=file.replace(from,to);return logger.log(`Rename: ${file} ${newFile}`),(0,import_promises.rename)(file,newFile)}async function runCodemod(codemod,{glob,logger,dryRun,rename,parser}){if(!listCodemods().includes(codemod))throw new Error(`Unknown codemod ${codemod}. Run --list for options.`);let renameParts=null;if(rename&&(renameParts=rename.split(":"),renameParts.length!==2))throw new Error(`Codemod rename: expected format "from:to", got "${rename}"`);let inferredParser=parser;if(!parser){let extension=(0,import_node_path.extname)(glob).slice(1);jscodeshiftToPrettierParser(extension)!=="babel"&&(inferredParser=extension)}let{globby}=await import("globby"),files=await globby([glob,"!**/node_modules","!**/dist"]),extensions=new Set(files.map(file=>(0,import_node_path.extname)(file).slice(1))),commaSeparatedExtensions=Array.from(extensions).join(",");if(logger.log(`=> Applying ${codemod}: ${files.length} files`),files.length===0){logger.log(`=> No matching files for glob: ${glob}`);return}if(!dryRun&&files.length>0){let parserArgs=inferredParser?["--parser",inferredParser]:[],result=(0,import_cross_spawn.sync)("node",[require.resolve("jscodeshift/bin/jscodeshift"),"--no-babel",`--extensions=${commaSeparatedExtensions}`,"--fail-on-error","-t",`${TRANSFORM_DIR}/${codemod}.js`,...parserArgs,...files.map(file=>`"${file}"`)],{stdio:"inherit",shell:!0});if(codemod==="mdx-to-csf"&&result.status===1)logger.log("The codemod was not able to transform the files mentioned above. We have renamed the files to .mdx.broken. Please check the files and rename them back to .mdx after you have either manually transformed them to mdx + csf or fixed the issues so that the codemod can transform them.");else if(result.status===1){logger.log("Skipped renaming because of errors.");return}}if(renameParts){let[from,to]=renameParts;logger.log(`=> Renaming ${rename}: ${files.length} files`),await Promise.all(files.map(file=>renameFile(file,new RegExp(`${from}$`),to,{logger})))}}0&&(module.exports={listCodemods,runCodemod});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/codemod",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.4",
|
4
4
|
"description": "A collection of codemod scripts written with JSCodeshift",
|
5
5
|
"keywords": [
|
6
6
|
"storybook"
|
@@ -26,16 +26,9 @@
|
|
26
26
|
"node": "./dist/index.js",
|
27
27
|
"require": "./dist/index.js"
|
28
28
|
},
|
29
|
-
"./dist/transforms/add-component-parameters.js": "./dist/transforms/add-component-parameters.js",
|
30
29
|
"./dist/transforms/csf-2-to-3.js": "./dist/transforms/csf-2-to-3.js",
|
31
30
|
"./dist/transforms/csf-hoist-story-annotations.js": "./dist/transforms/csf-hoist-story-annotations.js",
|
32
31
|
"./dist/transforms/find-implicit-spies.js": "./dist/transforms/find-implicit-spies.js",
|
33
|
-
"./dist/transforms/move-builtin-addons.js": "./dist/transforms/move-builtin-addons.js",
|
34
|
-
"./dist/transforms/mdx-to-csf.js": "./dist/transforms/mdx-to-csf.js",
|
35
|
-
"./dist/transforms/migrate-to-test-package.js": "./dist/transforms/migrate-to-test-package.js",
|
36
|
-
"./dist/transforms/storiesof-to-csf.js": "./dist/transforms/storiesof-to-csf.js",
|
37
|
-
"./dist/transforms/update-addon-info.js": "./dist/transforms/update-addon-info.js",
|
38
|
-
"./dist/transforms/update-organisation-name.js": "./dist/transforms/update-organisation-name.js",
|
39
32
|
"./dist/transforms/upgrade-deprecated-types.js": "./dist/transforms/upgrade-deprecated-types.js",
|
40
33
|
"./dist/transforms/upgrade-hierarchy-separators.js": "./dist/transforms/upgrade-hierarchy-separators.js",
|
41
34
|
"./package.json": "./package.json"
|
@@ -64,7 +57,7 @@
|
|
64
57
|
"jscodeshift": "^0.15.1",
|
65
58
|
"prettier": "^3.1.1",
|
66
59
|
"recast": "^0.23.5",
|
67
|
-
"storybook": "9.0.0-alpha.
|
60
|
+
"storybook": "9.0.0-alpha.4",
|
68
61
|
"tiny-invariant": "^1.3.1"
|
69
62
|
},
|
70
63
|
"devDependencies": {
|
@@ -89,16 +82,8 @@
|
|
89
82
|
"bundler": {
|
90
83
|
"entries": [
|
91
84
|
"./src/index.ts",
|
92
|
-
"./src/transforms/storiesof-to-csf.js",
|
93
|
-
"./src/transforms/mdx-to-csf.ts",
|
94
85
|
"./src/transforms/csf-2-to-3.ts",
|
95
|
-
"./src/transforms/csf-hoist-story-annotations.js",
|
96
86
|
"./src/transforms/find-implicit-spies.ts",
|
97
|
-
"./src/transforms/add-component-parameters.js",
|
98
|
-
"./src/transforms/migrate-to-test-package.ts",
|
99
|
-
"./src/transforms/move-builtin-addons.js",
|
100
|
-
"./src/transforms/update-addon-info.js",
|
101
|
-
"./src/transforms/update-organisation-name.js",
|
102
87
|
"./src/transforms/upgrade-deprecated-types.ts",
|
103
88
|
"./src/transforms/upgrade-hierarchy-separators.js"
|
104
89
|
],
|
@@ -1,21 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Adds a `component` parameter for each storiesOf(...) call.
|
3
|
-
*
|
4
|
-
* For example:
|
5
|
-
*
|
6
|
-
* Input { Button } from './Button'; storiesOf('Button', module).add('story', () => <Button
|
7
|
-
* label="The Button" />);
|
8
|
-
*
|
9
|
-
* Becomes:
|
10
|
-
*
|
11
|
-
* Input { Button } from './Button'; storiesOf('Button', module) .addParameters({ component: Button
|
12
|
-
* }) .add('story', () => <Button label="The Button" />);
|
13
|
-
*
|
14
|
-
* Heuristics:
|
15
|
-
*
|
16
|
-
* - The storiesOf "kind" name must be Button
|
17
|
-
* - Button must be imported in the file
|
18
|
-
*/
|
19
|
-
declare function transformer(file: any, api: any): any;
|
20
|
-
|
21
|
-
export { transformer as default };
|
@@ -1 +0,0 @@
|
|
1
|
-
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var add_component_parameters_exports={};__export(add_component_parameters_exports,{default:()=>transformer});module.exports=__toCommonJS(add_component_parameters_exports);function transformer(file,api){let j=api.jscodeshift,root=j(file.source),importMap={};root.find(j.ImportDeclaration).forEach(imp=>imp.node.specifiers.forEach(spec=>{importMap[spec.local.name]=!0}));function getLeafName(string){let parts=string.split(/\/|\.|\|/);return parts[parts.length-1]}function addComponentParameter(call){let{node}=call,leafName=getLeafName(node.arguments[0].value);return j.callExpression(j.memberExpression(node,j.identifier("addParameters")),[j.objectExpression([j.property("init",j.identifier("component"),j.identifier(leafName))])])}return root.find(j.CallExpression).filter(call=>call.node.callee.name==="storiesOf").filter(call=>call.node.arguments.length>0&&call.node.arguments[0].type==="Literal").filter(call=>{let leafName=getLeafName(call.node.arguments[0].value);return importMap[leafName]}).replaceWith(addComponentParameter),root.toSource()}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Hoist CSF .story annotations
|
3
|
-
*
|
4
|
-
* @example
|
5
|
-
*
|
6
|
-
* ```jsx
|
7
|
-
* export const Basic = () => <Button />
|
8
|
-
* Basic.story = {
|
9
|
-
* name: 'foo',
|
10
|
-
* parameters: { },
|
11
|
-
* decorators = [ ],
|
12
|
-
* };
|
13
|
-
* ```
|
14
|
-
*
|
15
|
-
* Becomes:
|
16
|
-
*
|
17
|
-
* ```
|
18
|
-
* export const Basic = () => <Button />;
|
19
|
-
* Basic.storyName = 'foo';
|
20
|
-
* Basic.parameters = {};
|
21
|
-
* Basic.decorators = [];
|
22
|
-
* ```
|
23
|
-
*/
|
24
|
-
declare function transformer(file: any, api: any): any;
|
25
|
-
|
26
|
-
export { transformer as default };
|
@@ -1 +0,0 @@
|
|
1
|
-
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var csf_hoist_story_annotations_exports={};__export(csf_hoist_story_annotations_exports,{default:()=>transformer});module.exports=__toCommonJS(csf_hoist_story_annotations_exports);var getContainingStatement=n=>n.node.type.endsWith("Statement")?n:getContainingStatement(n.parent);function transformer(file,api){let j=api.jscodeshift,root=j(file.source),renameKey=exp=>exp.type==="Identifier"&&exp.name==="name"?j.identifier("storyName"):exp;if(root.find(j.ExportDefaultDeclaration).filter(def=>def.node.declaration.type==="ObjectExpression"&&def.node.declaration.properties.map(p=>p.key.name).includes("title")).size()===0)return root.toSource();let storyAssignments=root.find(j.AssignmentExpression).filter(exp=>{let{left,right}=exp.node;return left.type==="MemberExpression"&&left.object.type==="Identifier"&&left.property.type==="Identifier"&&left.property.name==="story"&&right.type==="ObjectExpression"});return storyAssignments.forEach(exp=>{let{left,right}=exp.node;right.properties.forEach(prop=>{getContainingStatement(exp).insertBefore(j.assignmentStatement("=",j.memberExpression(left.object,renameKey(prop.key)),prop.value))})}),storyAssignments.remove(),root.find(j.AssignmentExpression).filter(exp=>{let{left}=exp.node;return left.type==="MemberExpression"&&left.object.type==="MemberExpression"&&left.object.property.type==="Identifier"&&left.object.property.name==="story"&&left.property.type==="Identifier"}).replaceWith(exp=>{let{left,right}=exp.node;return j.assignmentExpression("=",j.memberExpression(left.object.object,renameKey(left.property)),right)}),root.toSource({quote:"single"})}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { FileInfo } from 'jscodeshift';
|
2
|
-
|
3
|
-
declare function jscodeshift(info: FileInfo): Promise<string>;
|
4
|
-
declare function transform(info: FileInfo, baseName: string): Promise<{
|
5
|
-
mdx: string;
|
6
|
-
csf: string | null;
|
7
|
-
}>;
|
8
|
-
declare function nameToValidExport(name: string): string;
|
9
|
-
|
10
|
-
export { jscodeshift as default, nameToValidExport, transform };
|