@storybook/codemod 7.0.0-alpha.1 → 7.0.0-alpha.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,5 +36,10 @@ function jscodeshiftToPrettierParser(parser) {
36
36
  ts: 'typescript',
37
37
  tsx: 'typescript'
38
38
  };
39
+
40
+ if (!parser) {
41
+ return 'babel';
42
+ }
43
+
39
44
  return parserMap[parser] || 'babel';
40
45
  }
@@ -123,7 +123,11 @@ function transform({
123
123
 
124
124
 
125
125
  var storyFn = template && csf._templates[template];
126
- if (!storyFn) storyFn = init;
126
+
127
+ if (!storyFn) {
128
+ storyFn = init;
129
+ }
130
+
127
131
  var keyId = t.identifier(key); // @ts-ignore
128
132
 
129
133
  var typeAnnotation = id.typeAnnotation;
@@ -30,7 +30,7 @@ function parseIncludeExclude(prop) {
30
30
  code = _prettyPrint2.code; // eslint-disable-next-line no-eval
31
31
 
32
32
 
33
- return eval(code);
33
+ return (0, eval)(code);
34
34
  }
35
35
  /**
36
36
  * Convert a component's module story file into an MDX file
@@ -21,5 +21,10 @@ export function jscodeshiftToPrettierParser(parser) {
21
21
  ts: 'typescript',
22
22
  tsx: 'typescript'
23
23
  };
24
+
25
+ if (!parser) {
26
+ return 'babel';
27
+ }
28
+
24
29
  return parserMap[parser] || 'babel';
25
30
  }
@@ -107,7 +107,11 @@ function transform({
107
107
 
108
108
 
109
109
  var storyFn = template && csf._templates[template];
110
- if (!storyFn) storyFn = init;
110
+
111
+ if (!storyFn) {
112
+ storyFn = init;
113
+ }
114
+
111
115
  var keyId = t.identifier(key); // @ts-ignore
112
116
 
113
117
  var typeAnnotation = id.typeAnnotation;
@@ -22,7 +22,7 @@ function parseIncludeExclude(prop) {
22
22
  code = _prettyPrint2.code; // eslint-disable-next-line no-eval
23
23
 
24
24
 
25
- return eval(code);
25
+ return (0, eval)(code);
26
26
  }
27
27
  /**
28
28
  * Convert a component's module story file into an MDX file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/codemod",
3
- "version": "7.0.0-alpha.1",
3
+ "version": "7.0.0-alpha.12",
4
4
  "description": "A collection of codemod scripts written with JSCodeshift",
5
5
  "keywords": [
6
6
  "storybook"
@@ -38,29 +38,30 @@
38
38
  "!__testfixtures__"
39
39
  ],
40
40
  "scripts": {
41
+ "check": "tsc --noEmit",
41
42
  "prepare": "node ../../scripts/prepare.js"
42
43
  },
43
44
  "dependencies": {
44
45
  "@babel/types": "^7.12.11",
45
46
  "@mdx-js/mdx": "^1.6.22",
46
47
  "@storybook/csf": "0.0.2--canary.4566f4d.1",
47
- "@storybook/csf-tools": "7.0.0-alpha.1",
48
- "@storybook/node-logger": "7.0.0-alpha.1",
48
+ "@storybook/csf-tools": "7.0.0-alpha.12",
49
+ "@storybook/node-logger": "7.0.0-alpha.12",
49
50
  "core-js": "^3.8.2",
50
51
  "cross-spawn": "^7.0.3",
51
52
  "globby": "^11.0.2",
52
53
  "jscodeshift": "^0.13.1",
53
54
  "lodash": "^4.17.21",
54
55
  "prettier": ">=2.2.1 <=2.3.0",
55
- "recast": "^0.19.0",
56
- "regenerator-runtime": "^0.13.7"
56
+ "recast": "^0.19.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "jest": "^26.6.3",
60
- "jest-specific-snapshot": "^4.0.0"
60
+ "jest-specific-snapshot": "^4.0.0",
61
+ "typescript": "~4.6.3"
61
62
  },
62
63
  "publishConfig": {
63
64
  "access": "public"
64
65
  },
65
- "gitHead": "b90b85210f66da59656c2ef58b0910b156256bea"
66
+ "gitHead": "5070efff271ecb5c26b3eb94c128c4896171cffe"
66
67
  }