@compiled/react 0.6.12 → 0.9.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 (219) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/browser/class-names/index.d.ts +2 -2
  3. package/dist/browser/class-names/index.js.flow +45 -0
  4. package/dist/browser/css/index.d.ts +17 -3
  5. package/dist/browser/css/index.js +4 -12
  6. package/dist/browser/css/index.js.flow +35 -0
  7. package/dist/browser/css/index.js.map +1 -1
  8. package/dist/browser/index.d.ts +4 -1
  9. package/dist/browser/index.js +1 -0
  10. package/dist/browser/index.js.flow +40 -0
  11. package/dist/browser/index.js.map +1 -1
  12. package/dist/browser/keyframes/__fixtures__/index.d.ts +3 -0
  13. package/dist/browser/keyframes/__fixtures__/index.js +12 -0
  14. package/dist/browser/keyframes/__fixtures__/index.js.map +1 -0
  15. package/dist/browser/keyframes/index.d.ts +47 -0
  16. package/dist/browser/keyframes/index.js +9 -0
  17. package/dist/browser/keyframes/index.js.flow +54 -0
  18. package/dist/browser/keyframes/index.js.map +1 -0
  19. package/dist/browser/runtime/ax.js.flow +27 -0
  20. package/dist/browser/runtime/css-custom-property.js.flow +19 -0
  21. package/dist/browser/runtime/dev-warnings.d.ts +0 -1
  22. package/dist/browser/runtime/dev-warnings.js +1 -1
  23. package/dist/browser/runtime/dev-warnings.js.flow +7 -0
  24. package/dist/browser/runtime/dev-warnings.js.map +1 -1
  25. package/dist/browser/runtime/index.js.flow +10 -0
  26. package/dist/browser/runtime/is-node.js.flow +19 -0
  27. package/dist/browser/runtime/sheet.d.ts +1 -1
  28. package/dist/browser/runtime/sheet.js.flow +36 -0
  29. package/dist/browser/runtime/style-cache.d.ts +1 -1
  30. package/dist/browser/runtime/style-cache.js.flow +19 -0
  31. package/dist/browser/runtime/style.d.ts +1 -1
  32. package/dist/browser/runtime/style.js.flow +17 -0
  33. package/dist/browser/runtime/types.js.flow +23 -0
  34. package/dist/browser/runtime.js.flow +7 -0
  35. package/dist/browser/styled/index.d.ts +6 -9
  36. package/dist/browser/styled/index.js.flow +69 -0
  37. package/dist/browser/styled/index.js.map +1 -1
  38. package/dist/browser/types.d.ts +6 -3
  39. package/dist/browser/types.js.flow +29 -0
  40. package/dist/browser/utils/error.js.flow +7 -0
  41. package/dist/cjs/class-names/index.d.ts +2 -2
  42. package/dist/cjs/class-names/index.js.flow +45 -0
  43. package/dist/cjs/css/index.d.ts +17 -3
  44. package/dist/cjs/css/index.js +4 -12
  45. package/dist/cjs/css/index.js.flow +35 -0
  46. package/dist/cjs/css/index.js.map +1 -1
  47. package/dist/cjs/index.d.ts +4 -1
  48. package/dist/cjs/index.js +3 -1
  49. package/dist/cjs/index.js.flow +40 -0
  50. package/dist/cjs/index.js.map +1 -1
  51. package/dist/cjs/keyframes/__fixtures__/index.d.ts +3 -0
  52. package/dist/cjs/keyframes/__fixtures__/index.js +15 -0
  53. package/dist/cjs/keyframes/__fixtures__/index.js.map +1 -0
  54. package/dist/cjs/keyframes/index.d.ts +47 -0
  55. package/dist/cjs/keyframes/index.js +13 -0
  56. package/dist/cjs/keyframes/index.js.flow +54 -0
  57. package/dist/cjs/keyframes/index.js.map +1 -0
  58. package/dist/cjs/runtime/ax.js.flow +27 -0
  59. package/dist/cjs/runtime/css-custom-property.js.flow +19 -0
  60. package/dist/cjs/runtime/dev-warnings.d.ts +0 -1
  61. package/dist/cjs/runtime/dev-warnings.js +2 -3
  62. package/dist/cjs/runtime/dev-warnings.js.flow +7 -0
  63. package/dist/cjs/runtime/dev-warnings.js.map +1 -1
  64. package/dist/cjs/runtime/index.js.flow +10 -0
  65. package/dist/cjs/runtime/is-node.js.flow +19 -0
  66. package/dist/cjs/runtime/sheet.d.ts +1 -1
  67. package/dist/cjs/runtime/sheet.js.flow +36 -0
  68. package/dist/cjs/runtime/style-cache.d.ts +1 -1
  69. package/dist/cjs/runtime/style-cache.js.flow +19 -0
  70. package/dist/cjs/runtime/style.d.ts +1 -1
  71. package/dist/cjs/runtime/style.js.flow +17 -0
  72. package/dist/cjs/runtime/types.js.flow +23 -0
  73. package/dist/cjs/runtime.js.flow +7 -0
  74. package/dist/cjs/styled/index.d.ts +6 -9
  75. package/dist/cjs/styled/index.js.flow +69 -0
  76. package/dist/cjs/styled/index.js.map +1 -1
  77. package/dist/cjs/types.d.ts +6 -3
  78. package/dist/cjs/types.js.flow +29 -0
  79. package/dist/cjs/utils/error.js.flow +7 -0
  80. package/dist/esm/class-names/index.d.ts +2 -2
  81. package/dist/esm/class-names/index.js.flow +45 -0
  82. package/dist/esm/css/index.d.ts +17 -3
  83. package/dist/esm/css/index.js +4 -12
  84. package/dist/esm/css/index.js.flow +35 -0
  85. package/dist/esm/css/index.js.map +1 -1
  86. package/dist/esm/index.d.ts +4 -1
  87. package/dist/esm/index.js +1 -0
  88. package/dist/esm/index.js.flow +40 -0
  89. package/dist/esm/index.js.map +1 -1
  90. package/dist/esm/keyframes/__fixtures__/index.d.ts +3 -0
  91. package/dist/esm/keyframes/__fixtures__/index.js +12 -0
  92. package/dist/esm/keyframes/__fixtures__/index.js.map +1 -0
  93. package/dist/esm/keyframes/index.d.ts +47 -0
  94. package/dist/esm/keyframes/index.js +9 -0
  95. package/dist/esm/keyframes/index.js.flow +54 -0
  96. package/dist/esm/keyframes/index.js.map +1 -0
  97. package/dist/esm/runtime/ax.js.flow +27 -0
  98. package/dist/esm/runtime/css-custom-property.js.flow +19 -0
  99. package/dist/esm/runtime/dev-warnings.d.ts +0 -1
  100. package/dist/esm/runtime/dev-warnings.js +1 -1
  101. package/dist/esm/runtime/dev-warnings.js.flow +7 -0
  102. package/dist/esm/runtime/dev-warnings.js.map +1 -1
  103. package/dist/esm/runtime/index.js.flow +10 -0
  104. package/dist/esm/runtime/is-node.js.flow +19 -0
  105. package/dist/esm/runtime/sheet.d.ts +1 -1
  106. package/dist/esm/runtime/sheet.js.flow +36 -0
  107. package/dist/esm/runtime/style-cache.d.ts +1 -1
  108. package/dist/esm/runtime/style-cache.js.flow +19 -0
  109. package/dist/esm/runtime/style.d.ts +1 -1
  110. package/dist/esm/runtime/style.js.flow +17 -0
  111. package/dist/esm/runtime/types.js.flow +23 -0
  112. package/dist/esm/runtime.js.flow +7 -0
  113. package/dist/esm/styled/index.d.ts +6 -9
  114. package/dist/esm/styled/index.js.flow +69 -0
  115. package/dist/esm/styled/index.js.map +1 -1
  116. package/dist/esm/types.d.ts +6 -3
  117. package/dist/esm/types.js.flow +29 -0
  118. package/dist/esm/utils/error.js.flow +7 -0
  119. package/package.json +18 -20
  120. package/src/class-names/__tests__/types.test.js.flow +28 -0
  121. package/src/class-names/index.js.flow +45 -0
  122. package/src/class-names/index.tsx +2 -2
  123. package/src/css/__tests__/index.test.tsx +41 -0
  124. package/src/css/__tests__/types.test.js.flow +17 -0
  125. package/src/css/index.js.flow +35 -0
  126. package/src/css/index.tsx +26 -3
  127. package/src/index.js.flow +40 -0
  128. package/src/index.tsx +5 -2
  129. package/src/keyframes/__fixtures__/index.tsx +14 -0
  130. package/src/keyframes/__tests__/index.test.tsx +324 -0
  131. package/src/keyframes/__tests__/types.test.js.flow +31 -0
  132. package/src/keyframes/index.js.flow +54 -0
  133. package/src/keyframes/index.tsx +61 -0
  134. package/src/runtime/__tests__/style.test.tsx +91 -57
  135. package/src/runtime/ax.js.flow +27 -0
  136. package/src/runtime/css-custom-property.js.flow +19 -0
  137. package/src/runtime/dev-warnings.js.flow +7 -0
  138. package/src/runtime/dev-warnings.tsx +1 -1
  139. package/src/runtime/index.js.flow +10 -0
  140. package/src/runtime/is-node.js.flow +19 -0
  141. package/src/runtime/sheet.js.flow +36 -0
  142. package/src/runtime/sheet.tsx +1 -1
  143. package/src/runtime/style-cache.js.flow +19 -0
  144. package/src/runtime/style-cache.tsx +1 -1
  145. package/src/runtime/style.js.flow +17 -0
  146. package/src/runtime/style.tsx +1 -1
  147. package/src/runtime/types.js.flow +23 -0
  148. package/src/runtime.js.flow +7 -0
  149. package/src/styled/__tests__/types.test.js.flow +30 -0
  150. package/src/styled/index.js.flow +69 -0
  151. package/src/styled/index.tsx +6 -10
  152. package/src/types.js.flow +29 -0
  153. package/src/types.tsx +7 -3
  154. package/src/utils/error.js.flow +7 -0
  155. package/dist/browser/codemods/codemods-helpers.d.ts +0 -60
  156. package/dist/browser/codemods/codemods-helpers.js +0 -201
  157. package/dist/browser/codemods/codemods-helpers.js.map +0 -1
  158. package/dist/browser/codemods/constants.d.ts +0 -3
  159. package/dist/browser/codemods/constants.js +0 -4
  160. package/dist/browser/codemods/constants.js.map +0 -1
  161. package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
  162. package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -178
  163. package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
  164. package/dist/browser/codemods/emotion-to-compiled/index.d.ts +0 -1
  165. package/dist/browser/codemods/emotion-to-compiled/index.js +0 -2
  166. package/dist/browser/codemods/emotion-to-compiled/index.js.map +0 -1
  167. package/dist/browser/codemods/styled-components-to-compiled/index.d.ts +0 -1
  168. package/dist/browser/codemods/styled-components-to-compiled/index.js +0 -2
  169. package/dist/browser/codemods/styled-components-to-compiled/index.js.map +0 -1
  170. package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
  171. package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -33
  172. package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
  173. package/dist/cjs/codemods/codemods-helpers.d.ts +0 -60
  174. package/dist/cjs/codemods/codemods-helpers.js +0 -217
  175. package/dist/cjs/codemods/codemods-helpers.js.map +0 -1
  176. package/dist/cjs/codemods/constants.d.ts +0 -3
  177. package/dist/cjs/codemods/constants.js +0 -7
  178. package/dist/cjs/codemods/constants.js.map +0 -1
  179. package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
  180. package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -180
  181. package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
  182. package/dist/cjs/codemods/emotion-to-compiled/index.d.ts +0 -1
  183. package/dist/cjs/codemods/emotion-to-compiled/index.js +0 -9
  184. package/dist/cjs/codemods/emotion-to-compiled/index.js.map +0 -1
  185. package/dist/cjs/codemods/styled-components-to-compiled/index.d.ts +0 -1
  186. package/dist/cjs/codemods/styled-components-to-compiled/index.js +0 -9
  187. package/dist/cjs/codemods/styled-components-to-compiled/index.js.map +0 -1
  188. package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
  189. package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -35
  190. package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
  191. package/dist/esm/codemods/codemods-helpers.d.ts +0 -60
  192. package/dist/esm/codemods/codemods-helpers.js +0 -201
  193. package/dist/esm/codemods/codemods-helpers.js.map +0 -1
  194. package/dist/esm/codemods/constants.d.ts +0 -3
  195. package/dist/esm/codemods/constants.js +0 -4
  196. package/dist/esm/codemods/constants.js.map +0 -1
  197. package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
  198. package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -178
  199. package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
  200. package/dist/esm/codemods/emotion-to-compiled/index.d.ts +0 -1
  201. package/dist/esm/codemods/emotion-to-compiled/index.js +0 -2
  202. package/dist/esm/codemods/emotion-to-compiled/index.js.map +0 -1
  203. package/dist/esm/codemods/styled-components-to-compiled/index.d.ts +0 -1
  204. package/dist/esm/codemods/styled-components-to-compiled/index.js +0 -2
  205. package/dist/esm/codemods/styled-components-to-compiled/index.js.map +0 -1
  206. package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
  207. package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -33
  208. package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
  209. package/src/codemods/README.md +0 -8
  210. package/src/codemods/codemods-helpers.tsx +0 -369
  211. package/src/codemods/constants.tsx +0 -3
  212. package/src/codemods/emotion-to-compiled/README.md +0 -71
  213. package/src/codemods/emotion-to-compiled/__tests__/emotion-to-compiled.test.tsx +0 -526
  214. package/src/codemods/emotion-to-compiled/emotion-to-compiled.tsx +0 -249
  215. package/src/codemods/emotion-to-compiled/index.tsx +0 -1
  216. package/src/codemods/styled-components-to-compiled/README.md +0 -37
  217. package/src/codemods/styled-components-to-compiled/__tests__/styled-components-to-compiled.test.tsx +0 -109
  218. package/src/codemods/styled-components-to-compiled/index.tsx +0 -1
  219. package/src/codemods/styled-components-to-compiled/styled-components-to-compiled.tsx +0 -45
@@ -1,217 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeImportSpecifiersAlongWithTheirComments = exports.replaceImportDeclaration = exports.addReactIdentifier = exports.addCommentForUnresolvedImportSpecifiers = exports.addCommentToStartOfFile = exports.addCommentBefore = exports.convertDefaultImportToNamedImport = exports.findImportSpecifierName = exports.getAllImportSpecifiers = exports.getImportSpecifierName = exports.getImportDefaultSpecifierName = exports.hasImportDeclaration = exports.getImportDeclarationCollection = void 0;
4
- var constants_1 = require("./constants");
5
- var getImportDeclarationCollection = function (_a) {
6
- var j = _a.j, collection = _a.collection, importPath = _a.importPath;
7
- var found = collection
8
- .find(j.ImportDeclaration)
9
- .filter(function (importDeclarationPath) { return importDeclarationPath.node.source.value === importPath; });
10
- return found;
11
- };
12
- exports.getImportDeclarationCollection = getImportDeclarationCollection;
13
- var hasImportDeclaration = function (_a) {
14
- var j = _a.j, collection = _a.collection, importPath = _a.importPath;
15
- var result = exports.getImportDeclarationCollection({
16
- j: j,
17
- collection: collection,
18
- importPath: importPath,
19
- });
20
- return result.length > 0;
21
- };
22
- exports.hasImportDeclaration = hasImportDeclaration;
23
- var getImportDefaultSpecifierName = function (importDefaultSpecifierCollection) {
24
- var name = importDefaultSpecifierCollection.nodes()[0].local.name;
25
- if (!name) {
26
- throw new Error('Name should exist.');
27
- }
28
- return name;
29
- };
30
- exports.getImportDefaultSpecifierName = getImportDefaultSpecifierName;
31
- var getImportSpecifierName = function (importSpecifierCollection) { return importSpecifierCollection.nodes()[0].local.name; };
32
- exports.getImportSpecifierName = getImportSpecifierName;
33
- var getAllImportSpecifiers = function (_a) {
34
- var j = _a.j, importDeclarationCollection = _a.importDeclarationCollection;
35
- var importSpecifiersImportedNodes = [];
36
- importDeclarationCollection.find(j.ImportSpecifier).forEach(function (importSpecifierPath) {
37
- var node = importSpecifierPath.node.imported;
38
- if (node) {
39
- importSpecifiersImportedNodes.push(node);
40
- }
41
- });
42
- return importSpecifiersImportedNodes;
43
- };
44
- exports.getAllImportSpecifiers = getAllImportSpecifiers;
45
- var findImportSpecifierName = function (_a) {
46
- var j = _a.j, importDeclarationCollection = _a.importDeclarationCollection, importName = _a.importName;
47
- var importSpecifierCollection = importDeclarationCollection
48
- .find(j.ImportSpecifier)
49
- .filter(function (importSpecifierPath) { return importSpecifierPath.node.imported.name === importName; });
50
- if (importSpecifierCollection.length === 0) {
51
- return null;
52
- }
53
- return exports.getImportSpecifierName(importSpecifierCollection);
54
- };
55
- exports.findImportSpecifierName = findImportSpecifierName;
56
- var convertDefaultImportToNamedImport = function (_a) {
57
- var j = _a.j, collection = _a.collection, importPath = _a.importPath, namedImport = _a.namedImport;
58
- var importDeclarationCollection = exports.getImportDeclarationCollection({
59
- j: j,
60
- collection: collection,
61
- importPath: importPath,
62
- });
63
- importDeclarationCollection.forEach(function (importDeclarationPath) {
64
- var importDefaultSpecifierCollection = j(importDeclarationPath).find(j.ImportDefaultSpecifier);
65
- if (importDefaultSpecifierCollection.length > 0) {
66
- var oldNode = importDeclarationPath.node;
67
- var comments = oldNode.comments;
68
- j(importDeclarationPath).replaceWith([
69
- j.importDeclaration([
70
- j.importSpecifier(j.identifier(namedImport), j.identifier(exports.getImportDefaultSpecifierName(importDefaultSpecifierCollection))),
71
- ], j.literal(constants_1.COMPILED_IMPORT_PATH)),
72
- ]);
73
- var newNode = importDeclarationPath.node;
74
- if (newNode !== oldNode) {
75
- newNode.comments = comments;
76
- }
77
- }
78
- });
79
- };
80
- exports.convertDefaultImportToNamedImport = convertDefaultImportToNamedImport;
81
- // not replacing newlines (which \s does)
82
- var spacesAndTabs = /[ \t]{2,}/g;
83
- var lineStartWithSpaces = /^[ \t]*/gm;
84
- var clean = function (value) {
85
- return value
86
- .replace(spacesAndTabs, ' ')
87
- .replace(lineStartWithSpaces, '')
88
- // using .trim() to clear the any newlines before the first text and after last text
89
- .trim();
90
- };
91
- var addCommentBefore = function (_a) {
92
- var j = _a.j, collection = _a.collection, message = _a.message;
93
- var content = " TODO(" + constants_1.COMPILED_IMPORT_PATH + " codemod): " + clean(message) + " ";
94
- collection.forEach(function (path) {
95
- path.value.comments = path.value.comments || [];
96
- var exists = path.value.comments.find(function (comment) { return comment.value === content; });
97
- // avoiding duplicates of the same comment
98
- if (exists) {
99
- return;
100
- }
101
- path.value.comments.push(j.commentBlock(content));
102
- });
103
- };
104
- exports.addCommentBefore = addCommentBefore;
105
- var addCommentToStartOfFile = function (_a) {
106
- var j = _a.j, collection = _a.collection, message = _a.message;
107
- exports.addCommentBefore({
108
- j: j,
109
- collection: collection.find(j.Program),
110
- message: message,
111
- });
112
- };
113
- exports.addCommentToStartOfFile = addCommentToStartOfFile;
114
- var addCommentForUnresolvedImportSpecifiers = function (_a) {
115
- var j = _a.j, collection = _a.collection, importPath = _a.importPath, allowedImportSpecifierNames = _a.allowedImportSpecifierNames;
116
- var importDeclarationCollection = exports.getImportDeclarationCollection({
117
- j: j,
118
- collection: collection,
119
- importPath: importPath,
120
- });
121
- var importSpecifiers = exports.getAllImportSpecifiers({
122
- j: j,
123
- importDeclarationCollection: importDeclarationCollection,
124
- });
125
- importSpecifiers
126
- .filter(function (identifierPath) { return !allowedImportSpecifierNames.includes(identifierPath.name); })
127
- .forEach(function (importSpecifierPath) {
128
- exports.addCommentToStartOfFile({
129
- j: j,
130
- collection: collection,
131
- message: "\"" + importSpecifierPath.name + "\" is not exported from \"" + constants_1.COMPILED_IMPORT_PATH + "\" at the moment. Please find an alternative for it.",
132
- });
133
- });
134
- };
135
- exports.addCommentForUnresolvedImportSpecifiers = addCommentForUnresolvedImportSpecifiers;
136
- var addReactIdentifier = function (_a) {
137
- var j = _a.j, collection = _a.collection;
138
- var hasReactImportDeclaration = exports.hasImportDeclaration({
139
- j: j,
140
- collection: collection,
141
- importPath: constants_1.REACT_IMPORT_PATH,
142
- });
143
- if (!hasReactImportDeclaration) {
144
- collection.find(j.Program).forEach(function (programPath) {
145
- programPath.node.body.unshift(j.importDeclaration([j.importNamespaceSpecifier(j.identifier(constants_1.REACT_IMPORT_NAME))], j.literal(constants_1.REACT_IMPORT_PATH)));
146
- });
147
- }
148
- else {
149
- var importDeclarationCollection = exports.getImportDeclarationCollection({
150
- j: j,
151
- collection: collection,
152
- importPath: constants_1.REACT_IMPORT_PATH,
153
- });
154
- importDeclarationCollection.forEach(function (importDeclarationPath) {
155
- var importDefaultSpecifierCollection = j(importDeclarationPath).find(j.ImportDefaultSpecifier);
156
- var importNamespaceSpecifierCollection = j(importDeclarationPath).find(j.ImportNamespaceSpecifier);
157
- var hasNoDefaultReactImportDeclaration = importDefaultSpecifierCollection.length === 0;
158
- var hasNoNamespaceReactImportDeclaration = importNamespaceSpecifierCollection.length === 0;
159
- if (hasNoDefaultReactImportDeclaration &&
160
- hasNoNamespaceReactImportDeclaration &&
161
- importDeclarationPath.node.specifiers) {
162
- importDeclarationPath.node.specifiers.unshift(j.importDefaultSpecifier(j.identifier(constants_1.REACT_IMPORT_NAME)));
163
- }
164
- });
165
- }
166
- };
167
- exports.addReactIdentifier = addReactIdentifier;
168
- var replaceImportDeclaration = function (_a) {
169
- var j = _a.j, collection = _a.collection, importPath = _a.importPath;
170
- var importDeclarationCollection = exports.getImportDeclarationCollection({
171
- j: j,
172
- collection: collection,
173
- importPath: importPath,
174
- });
175
- importDeclarationCollection.forEach(function (importDeclarationPath) {
176
- importDeclarationPath.node.source.value = constants_1.COMPILED_IMPORT_PATH;
177
- });
178
- };
179
- exports.replaceImportDeclaration = replaceImportDeclaration;
180
- var mergeImportSpecifiersAlongWithTheirComments = function (_a) {
181
- var j = _a.j, collection = _a.collection, _b = _a.filter, filter = _b === void 0 ? function (_) { return true; } : _b;
182
- var importDeclarationCollection = exports.getImportDeclarationCollection({
183
- j: j,
184
- collection: collection,
185
- importPath: constants_1.COMPILED_IMPORT_PATH,
186
- });
187
- var importSpecifiers = [];
188
- importDeclarationCollection
189
- .find(j.ImportSpecifier)
190
- .filter(function (importSpecifierPath) { return filter(importSpecifierPath.node.imported.name); })
191
- .forEach(function (importSpecifierPath) {
192
- importSpecifiers.push(importSpecifierPath.node);
193
- });
194
- var importDeclarationCollectionLength = importDeclarationCollection.length;
195
- var importDeclarationComments = [];
196
- importDeclarationCollection.forEach(function (importDeclarationPath, index) {
197
- var oldNode = importDeclarationPath.node;
198
- var comments = oldNode.comments;
199
- if (comments) {
200
- importDeclarationComments.push.apply(importDeclarationComments, comments);
201
- }
202
- if (index === importDeclarationCollectionLength - 1) {
203
- j(importDeclarationPath).replaceWith([
204
- j.importDeclaration(importSpecifiers, j.literal(constants_1.COMPILED_IMPORT_PATH)),
205
- ]);
206
- var newNode = importDeclarationPath.node;
207
- if (newNode !== oldNode) {
208
- newNode.comments = importDeclarationComments;
209
- }
210
- }
211
- else {
212
- j(importDeclarationPath).remove();
213
- }
214
- });
215
- };
216
- exports.mergeImportSpecifiersAlongWithTheirComments = mergeImportSpecifiersAlongWithTheirComments;
217
- //# sourceMappingURL=codemods-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codemods-helpers.js","sourceRoot":"","sources":["../../../src/codemods/codemods-helpers.tsx"],"names":[],"mappings":";;;AAaA,yCA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B,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEL,IAAM,iCAAiC,GAAG,2BAA2B,CAAC,MAAM,CAAC;IAC7E,IAAM,yBAAyB,GAAqB,EAAE,CAAC;IAEvD,2BAA2B,CAAC,OAAO,CAAC,UAAC,qBAAqB,EAAE,KAAK;QAC/D,IAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC;QACnC,IAAA,QAAQ,GAAK,OAAO,SAAZ,CAAa;QAE7B,IAAI,QAAQ,EAAE;YACZ,yBAAyB,CAAC,IAAI,OAA9B,yBAAyB,EAAS,QAAQ,EAAE;SAC7C;QAED,IAAI,KAAK,KAAK,iCAAiC,GAAG,CAAC,EAAE;YACnD,CAAC,CAAC,qBAAqB,CAAC,CAAC,WAAW,CAAC;gBACnC,CAAC,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,gCAAoB,CAAC,CAAC;aACvE,CAAC,CAAC;YAEH,IAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC;YAE3C,IAAI,OAAO,KAAK,OAAO,EAAE;gBACvB,OAAO,CAAC,QAAQ,GAAG,yBAAyB,CAAC;aAC9C;SACF;aAAM;YACL,CAAC,CAAC,qBAAqB,CAAC,CAAC,MAAM,EAAE,CAAC;SACnC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAnDW,QAAA,2CAA2C,+CAmDtD"}
@@ -1,3 +0,0 @@
1
- export declare const COMPILED_IMPORT_PATH = "@compiled/react";
2
- export declare const REACT_IMPORT_PATH = "react";
3
- export declare const REACT_IMPORT_NAME = "React";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REACT_IMPORT_NAME = exports.REACT_IMPORT_PATH = exports.COMPILED_IMPORT_PATH = void 0;
4
- exports.COMPILED_IMPORT_PATH = '@compiled/react';
5
- exports.REACT_IMPORT_PATH = 'react';
6
- exports.REACT_IMPORT_NAME = 'React';
7
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/codemods/constants.tsx"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,iBAAiB,CAAC;AACzC,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAC5B,QAAA,iBAAiB,GAAG,OAAO,CAAC"}
@@ -1,3 +0,0 @@
1
- import { FileInfo, API, Options } from 'jscodeshift';
2
- declare const transformer: (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
3
- export default transformer;
@@ -1,180 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
4
- to[j] = from[i];
5
- return to;
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- var constants_1 = require("../constants");
9
- var codemods_helpers_1 = require("../codemods-helpers");
10
- var imports = {
11
- compiledStyledImportName: 'styled',
12
- emotionStyledPackageName: '@emotion/styled',
13
- emotionCoreJSXPragma: '@jsx jsx',
14
- emotionCoreImportNames: { jsx: 'jsx', css: 'css', ClassNames: 'ClassNames' },
15
- emotionCorePackageName: '@emotion/core',
16
- };
17
- var removeEmotionCoreJSXPragma = function (j, collection) {
18
- var commentCollection = collection.find(j.Comment);
19
- commentCollection.forEach(function (commentPath) {
20
- var commentBlockCollection = j(commentPath).filter(function (commentBlockPath) {
21
- return commentBlockPath.value.value.includes(imports.emotionCoreJSXPragma);
22
- });
23
- commentBlockCollection.forEach(function (commentBlockPath) {
24
- j(commentBlockPath).remove();
25
- codemods_helpers_1.addReactIdentifier({ j: j, collection: collection });
26
- });
27
- });
28
- };
29
- var replaceEmotionCoreCSSTaggedTemplateExpression = function (j, collection) {
30
- var importDeclarationCollection = codemods_helpers_1.getImportDeclarationCollection({
31
- j: j,
32
- collection: collection,
33
- importPath: imports.emotionCorePackageName,
34
- });
35
- var name = codemods_helpers_1.findImportSpecifierName({
36
- j: j,
37
- importDeclarationCollection: importDeclarationCollection,
38
- importName: imports.emotionCoreImportNames.css,
39
- });
40
- if (name == null) {
41
- return;
42
- }
43
- collection
44
- .find(j.TaggedTemplateExpression)
45
- .filter(function (taggedTemplateExpressionPath) {
46
- return j(taggedTemplateExpressionPath)
47
- .find(j.Identifier)
48
- .some(function (identifierPath) { return identifierPath.node.name === name; });
49
- })
50
- .forEach(function (taggedTemplateExpressionPath) {
51
- var quasi = taggedTemplateExpressionPath.node.quasi;
52
- if (quasi) {
53
- j(taggedTemplateExpressionPath).replaceWith([quasi]);
54
- }
55
- });
56
- };
57
- var handleClassNamesCXBehavior = function (j, objectPattern) {
58
- var cxIdentifierName = 'cx';
59
- var axIdentifierName = 'ax';
60
- var compiledRuntimePackageName = constants_1.COMPILED_IMPORT_PATH + "/runtime";
61
- var cxObjectPropertyCollection = j(objectPattern)
62
- .find(j.ObjectProperty)
63
- .filter(function (objectPropertyPath) {
64
- return objectPropertyPath.node.key.type === 'Identifier' &&
65
- objectPropertyPath.node.key.name === cxIdentifierName;
66
- });
67
- cxObjectPropertyCollection.forEach(function (cxObjectPropertyPath) {
68
- codemods_helpers_1.addCommentBefore({
69
- j: j,
70
- collection: j(cxObjectPropertyPath.node),
71
- message: "Please replace \"" + cxIdentifierName + "\" with \"" + axIdentifierName + "\" from \"" + compiledRuntimePackageName + "\".\n Usage: import { " + axIdentifierName + " } from '" + compiledRuntimePackageName + "';\n\n NOTE: Both \"" + cxIdentifierName + "\" and \"" + axIdentifierName + "\" have some differences, so we have not replaced its usage.\n Please check the docs for \"" + axIdentifierName + "\" usage.\n\n In future, we will expose \"" + axIdentifierName + "\" directly from \"" + imports.emotionCoreImportNames.ClassNames + "\" props.\n\n Issue tracked on Github: https://github.com/atlassian-labs/compiled/issues/373",
72
- });
73
- });
74
- };
75
- var handleClassNamesStyleBehavior = function (j, objectPattern) {
76
- var styleIdentifierName = 'style';
77
- var hasStyleObjectProperty = j(objectPattern)
78
- .find(j.ObjectProperty)
79
- .some(function (objectPropertyPath) {
80
- return objectPropertyPath.node.key.type === 'Identifier' &&
81
- objectPropertyPath.node.key.name === styleIdentifierName;
82
- });
83
- if (!hasStyleObjectProperty) {
84
- var styleObjectProperty = j.objectProperty(j.identifier(styleIdentifierName), j.identifier(styleIdentifierName));
85
- objectPattern.properties.push(styleObjectProperty);
86
- codemods_helpers_1.addCommentBefore({
87
- j: j,
88
- collection: j(styleObjectProperty),
89
- message: "We have exported \"" + styleIdentifierName + "\" from \"" + imports.emotionCoreImportNames.ClassNames + "\" props.\n If you are using dynamic declarations, make sure to set the \"" + styleIdentifierName + "\"\n prop otherwise remove it.",
90
- });
91
- }
92
- };
93
- var handleClassNamesBehavior = function (j, collection) {
94
- var importDeclarationCollection = codemods_helpers_1.getImportDeclarationCollection({
95
- j: j,
96
- collection: collection,
97
- importPath: imports.emotionCorePackageName,
98
- });
99
- var name = codemods_helpers_1.findImportSpecifierName({
100
- j: j,
101
- importDeclarationCollection: importDeclarationCollection,
102
- importName: imports.emotionCoreImportNames.ClassNames,
103
- });
104
- if (name == null) {
105
- return;
106
- }
107
- collection
108
- .find(j.JSXElement)
109
- .filter(function (jsxElementPath) {
110
- return j(jsxElementPath)
111
- .find(j.JSXIdentifier)
112
- .some(function (jsxIdentifierPath) { return jsxIdentifierPath.node.name === name; });
113
- })
114
- .find(j.JSXExpressionContainer)
115
- .forEach(function (jsxExpressionContainer) {
116
- var expression = jsxExpressionContainer.node.expression;
117
- if (expression.type === 'FunctionExpression' ||
118
- expression.type === 'ArrowFunctionExpression') {
119
- if (expression.params.length && expression.params[0].type === 'ObjectPattern') {
120
- var objectPattern = expression.params[0];
121
- handleClassNamesStyleBehavior(j, objectPattern);
122
- handleClassNamesCXBehavior(j, objectPattern);
123
- }
124
- }
125
- });
126
- };
127
- var mergeCompiledImportSpecifiers = function (j, collection) {
128
- var allowedCompiledNames = __spreadArray([
129
- imports.compiledStyledImportName
130
- ], Object.values(imports.emotionCoreImportNames)).filter(function (name) {
131
- return ![imports.emotionCoreImportNames.jsx, imports.emotionCoreImportNames.css].includes(name);
132
- });
133
- codemods_helpers_1.mergeImportSpecifiersAlongWithTheirComments({
134
- j: j,
135
- collection: collection,
136
- filter: function (name) { return !!(name && allowedCompiledNames.includes(name)); },
137
- });
138
- };
139
- var transformer = function (fileInfo, _a, options) {
140
- var j = _a.jscodeshift;
141
- var source = fileInfo.source;
142
- var collection = j(source);
143
- var hasEmotionCoreImportDeclaration = codemods_helpers_1.hasImportDeclaration({
144
- j: j,
145
- collection: collection,
146
- importPath: imports.emotionCorePackageName,
147
- });
148
- var hasEmotionStyledImportDeclaration = codemods_helpers_1.hasImportDeclaration({
149
- j: j,
150
- collection: collection,
151
- importPath: imports.emotionStyledPackageName,
152
- });
153
- if (!hasEmotionCoreImportDeclaration && !hasEmotionStyledImportDeclaration) {
154
- return source;
155
- }
156
- if (hasEmotionStyledImportDeclaration) {
157
- codemods_helpers_1.convertDefaultImportToNamedImport({
158
- j: j,
159
- collection: collection,
160
- importPath: imports.emotionStyledPackageName,
161
- namedImport: imports.compiledStyledImportName,
162
- });
163
- }
164
- if (hasEmotionCoreImportDeclaration) {
165
- removeEmotionCoreJSXPragma(j, collection);
166
- codemods_helpers_1.addCommentForUnresolvedImportSpecifiers({
167
- j: j,
168
- collection: collection,
169
- importPath: imports.emotionCorePackageName,
170
- allowedImportSpecifierNames: Object.values(imports.emotionCoreImportNames),
171
- });
172
- replaceEmotionCoreCSSTaggedTemplateExpression(j, collection);
173
- handleClassNamesBehavior(j, collection);
174
- codemods_helpers_1.replaceImportDeclaration({ j: j, collection: collection, importPath: imports.emotionCorePackageName });
175
- }
176
- mergeCompiledImportSpecifiers(j, collection);
177
- return collection.toSource(options.printOptions || { quote: 'single' });
178
- };
179
- exports.default = transformer;
180
- //# sourceMappingURL=emotion-to-compiled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emotion-to-compiled.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I,+BAA+B,EAAE;QACnC,0BAA0B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC1C,0DAAuC,CAAC;YACtC,CAAC,GAAA;YACD,UAAU,YAAA;YACV,UAAU,EAAE,OAAO,CAAC,sBAAsB;YAC1C,2BAA2B,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC;SAC3E,CAAC,CAAC;QACH,6CAA6C,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC7D,wBAAwB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACxC,2CAAwB,CAAC,EAAE,CAAC,GAAA,EAAE,UAAU,YAAA,EAAE,UAAU,EAAE,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;KACzF;IAED,6BAA6B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- export { default } from './emotion-to-compiled';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var emotion_to_compiled_1 = require("./emotion-to-compiled");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(emotion_to_compiled_1).default; } });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codemods/emotion-to-compiled/index.tsx"],"names":[],"mappings":";;;;;;AAAA,6DAAgD;AAAvC,+HAAA,OAAO,OAAA"}
@@ -1 +0,0 @@
1
- export { default } from './styled-components-to-compiled';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var styled_components_to_compiled_1 = require("./styled-components-to-compiled");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(styled_components_to_compiled_1).default; } });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codemods/styled-components-to-compiled/index.tsx"],"names":[],"mappings":";;;;;;AAAA,iFAA0D;AAAjD,yIAAA,OAAO,OAAA"}
@@ -1,3 +0,0 @@
1
- import { FileInfo, API, Options } from 'jscodeshift';
2
- declare const transformer: (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
3
- export default transformer;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var codemods_helpers_1 = require("../codemods-helpers");
4
- var imports = {
5
- compiledStyledImportName: 'styled',
6
- styledComponentsPackageName: 'styled-components',
7
- };
8
- var transformer = function (fileInfo, _a, options) {
9
- var j = _a.jscodeshift;
10
- var source = fileInfo.source;
11
- var collection = j(source);
12
- var hasStyledComponentsImportDeclaration = codemods_helpers_1.hasImportDeclaration({
13
- j: j,
14
- collection: collection,
15
- importPath: imports.styledComponentsPackageName,
16
- });
17
- if (!hasStyledComponentsImportDeclaration) {
18
- return source;
19
- }
20
- codemods_helpers_1.addCommentForUnresolvedImportSpecifiers({
21
- j: j,
22
- collection: collection,
23
- importPath: imports.styledComponentsPackageName,
24
- allowedImportSpecifierNames: [],
25
- });
26
- codemods_helpers_1.convertDefaultImportToNamedImport({
27
- j: j,
28
- collection: collection,
29
- importPath: imports.styledComponentsPackageName,
30
- namedImport: imports.compiledStyledImportName,
31
- });
32
- return collection.toSource(options.printOptions || { quote: 'single' });
33
- };
34
- exports.default = transformer;
35
- //# sourceMappingURL=styled-components-to-compiled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled-components-to-compiled.js","sourceRoot":"","sources":["../../../../src/codemods/styled-components-to-compiled/styled-components-to-compiled.tsx"],"names":[],"mappings":";;AAEA,wDAI6B;AAE7B,IAAM,OAAO,GAAG;IACd,wBAAwB,EAAE,QAAQ;IAClC,2BAA2B,EAAE,mBAAmB;CACjD,CAAC;AAEF,IAAM,WAAW,GAAG,UAAC,QAAkB,EAAE,EAAuB,EAAE,OAAgB;QAA1B,CAAC,iBAAA;IAC/C,IAAA,MAAM,GAAK,QAAQ,OAAb,CAAc;IAC5B,IAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAM,oCAAoC,GAAG,uCAAoB,CAAC;QAChE,CAAC,GAAA;QACD,UAAU,YAAA;QACV,UAAU,EAAE,OAAO,CAAC,2BAA2B;KAChD,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE;QACzC,OAAO,MAAM,CAAC;KACf;IAED,0DAAuC,CAAC;QACtC,CAAC,GAAA;QACD,UAAU,YAAA;QACV,UAAU,EAAE,OAAO,CAAC,2BAA2B;QAC/C,2BAA2B,EAAE,EAAE;KAChC,CAAC,CAAC;IAEH,oDAAiC,CAAC;QAChC,CAAC,GAAA;QACD,UAAU,YAAA;QACV,UAAU,EAAE,OAAO,CAAC,2BAA2B;QAC/C,WAAW,EAAE,OAAO,CAAC,wBAAwB;KAC9C,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,60 +0,0 @@
1
- import { JSCodeshift, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, Program, Identifier, JSXIdentifier, TSTypeParameter, Node, Collection } from 'jscodeshift';
2
- declare type Identifiers = Array<Identifier | JSXIdentifier | TSTypeParameter>;
3
- export declare const getImportDeclarationCollection: ({ j, collection, importPath, }: {
4
- j: JSCodeshift;
5
- collection: Collection<any>;
6
- importPath: string;
7
- }) => Collection<ImportDeclaration>;
8
- export declare const hasImportDeclaration: ({ j, collection, importPath, }: {
9
- j: JSCodeshift;
10
- collection: Collection<any>;
11
- importPath: string;
12
- }) => boolean;
13
- export declare const getImportDefaultSpecifierName: (importDefaultSpecifierCollection: Collection<ImportDefaultSpecifier>) => string;
14
- export declare const getImportSpecifierName: (importSpecifierCollection: Collection<ImportSpecifier>) => string | undefined;
15
- export declare const getAllImportSpecifiers: ({ j, importDeclarationCollection, }: {
16
- j: JSCodeshift;
17
- importDeclarationCollection: Collection<ImportDeclaration>;
18
- }) => Identifiers;
19
- export declare const findImportSpecifierName: ({ j, importDeclarationCollection, importName, }: {
20
- j: JSCodeshift;
21
- importDeclarationCollection: Collection<ImportDeclaration>;
22
- importName: string;
23
- }) => string | null | undefined;
24
- export declare const convertDefaultImportToNamedImport: ({ j, collection, importPath, namedImport, }: {
25
- j: JSCodeshift;
26
- collection: Collection<any>;
27
- importPath: string;
28
- namedImport: string;
29
- }) => void;
30
- export declare const addCommentBefore: ({ j, collection, message, }: {
31
- j: JSCodeshift;
32
- collection: Collection<Program>;
33
- message: string;
34
- }) => void;
35
- export declare const addCommentToStartOfFile: ({ j, collection, message, }: {
36
- j: JSCodeshift;
37
- collection: Collection<Node>;
38
- message: string;
39
- }) => void;
40
- export declare const addCommentForUnresolvedImportSpecifiers: ({ j, collection, importPath, allowedImportSpecifierNames, }: {
41
- j: JSCodeshift;
42
- collection: Collection<Node>;
43
- importPath: string;
44
- allowedImportSpecifierNames: string[];
45
- }) => void;
46
- export declare const addReactIdentifier: ({ j, collection, }: {
47
- j: JSCodeshift;
48
- collection: Collection<Node>;
49
- }) => void;
50
- export declare const replaceImportDeclaration: ({ j, collection, importPath, }: {
51
- j: JSCodeshift;
52
- collection: Collection<Node>;
53
- importPath: string;
54
- }) => void;
55
- export declare const mergeImportSpecifiersAlongWithTheirComments: ({ j, collection, filter, }: {
56
- j: JSCodeshift;
57
- collection: Collection<Node>;
58
- filter?: ((name: string | undefined) => boolean) | undefined;
59
- }) => void;
60
- export {};