@ornikar/kitt-universal 9.29.1 → 9.30.0

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.
Files changed (29) hide show
  1. package/babel-plugin-csf-to-jest.js +64 -1
  2. package/dist/definitions/Tooltip/Tooltip.web.d.ts.map +1 -1
  3. package/dist/index-browser-all.es.android.js +1000 -1380
  4. package/dist/index-browser-all.es.android.js.map +1 -1
  5. package/dist/index-browser-all.es.ios.js +1000 -1380
  6. package/dist/index-browser-all.es.ios.js.map +1 -1
  7. package/dist/index-browser-all.es.js +1000 -1382
  8. package/dist/index-browser-all.es.js.map +1 -1
  9. package/dist/index-browser-all.es.web.js +825 -1129
  10. package/dist/index-browser-all.es.web.js.map +1 -1
  11. package/dist/index-node-14.17.cjs.js +176 -319
  12. package/dist/index-node-14.17.cjs.js.map +1 -1
  13. package/dist/index-node-14.17.cjs.web.js +178 -276
  14. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  15. package/dist/linaria-themes-browser-all.es.android.js +3 -2
  16. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  17. package/dist/linaria-themes-browser-all.es.ios.js +3 -2
  18. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  19. package/dist/linaria-themes-browser-all.es.js +3 -2
  20. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  21. package/dist/linaria-themes-browser-all.es.web.js +3 -2
  22. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  23. package/dist/linaria-themes-node-14.17.cjs.js +3 -2
  24. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  25. package/dist/linaria-themes-node-14.17.cjs.web.js +3 -2
  26. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  27. package/dist/tsbuildinfo +1 -1
  28. package/package.json +5 -5
  29. package/typings/react-native-web.d.ts +2 -0
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-param-reassign */
2
+
1
3
  'use strict';
2
4
 
3
5
  module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
@@ -15,6 +17,10 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
15
17
  let expression = path.node.declaration;
16
18
 
17
19
  if (types.isTSAsExpression(expression)) {
20
+ throw path.buildCodeFrameError('Invalid export default, using "as" expression, you should use "satisfies"');
21
+ }
22
+
23
+ if (types.isTSSatisfiesExpression(expression)) {
18
24
  expression = expression.expression;
19
25
  }
20
26
 
@@ -105,7 +111,64 @@ module.exports = function babelPluginStorybookCSFToJest({ types }, opts) {
105
111
  );
106
112
  }
107
113
 
108
- // Need to add decorators and parameters
114
+ if (!types.isArrowFunctionExpression(declaration.init)) {
115
+ throw path.buildCodeFrameError(`Invalid init, expecting Arrow Function, got "${declaration.init.type}"`);
116
+ }
117
+
118
+ let hasArgs = false;
119
+ let foundArgs = false;
120
+ if (declaration.init.params.length > 0) {
121
+ if (declaration.init.params.length > 1) {
122
+ throw path.buildCodeFrameError('Invalid init, expecting maximum one parameter');
123
+ }
124
+
125
+ if (declaration.init.params[0].name !== 'args') {
126
+ throw path.buildCodeFrameError(
127
+ `Invalid init, expecting maximum one parameter called "args", got "${declaration.init.params[0].name}"`,
128
+ );
129
+ }
130
+
131
+ declaration.init.params = [];
132
+ hasArgs = true;
133
+ }
134
+
135
+ const binding = path.scope.getBinding(declaration.id.name);
136
+
137
+ binding.referencePaths.forEach((refPath) => {
138
+ if (refPath === path) return; // skip named export
139
+
140
+ if (!types.isMemberExpression(refPath.parent)) {
141
+ throw path.buildCodeFrameError(
142
+ `Invalid ref, expecting member expression, got "${refPath.parent.type}"`,
143
+ );
144
+ }
145
+
146
+ const memberExpressionPath = refPath.parentPath;
147
+ const assignmentExpression = memberExpressionPath.parent;
148
+
149
+ if (!types.isAssignmentExpression(assignmentExpression)) {
150
+ throw path.buildCodeFrameError(
151
+ `Invalid ref, expecting assignment expression, got "${assignmentExpression.type}"`,
152
+ );
153
+ }
154
+
155
+ const prop = refPath.parent.property;
156
+ if (types.isIdentifier(prop) && prop.name === 'args') {
157
+ foundArgs = true;
158
+ path.scope.push({
159
+ id: types.identifier('args'),
160
+ init: assignmentExpression.right,
161
+ });
162
+ }
163
+
164
+ // Need to add decorators and parameters
165
+
166
+ memberExpressionPath.parentPath.remove();
167
+ });
168
+
169
+ if (hasArgs && !foundArgs) {
170
+ throw path.buildCodeFrameError('Found param named "args" but not default args.');
171
+ }
109
172
 
110
173
  return types.expressionStatement(
111
174
  types.callExpression(types.memberExpression(types.identifier(storiesOfName), types.identifier('add')), [
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.web.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,UAAU,uBAAwB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;IACvF,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE;QACJ,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QAC1B,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;KAC1B,CAAC;CACH;AAED,UAAU,eAAgB,SAAQ,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC;IACjE,QAAQ,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,cAAc,EACd,QAAgB,EAChB,OAAO,EACP,eAAe,EACf,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE,eAAe,GAAG,YAAY,CAgJhC;yBAzJe,OAAO"}
1
+ {"version":3,"file":"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