@atlaskit/codemod-utils 4.1.3 → 4.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-utils",
3
- "version": "4.1.3",
3
+ "version": "4.2.1",
4
4
  "author": "Atlassian Pty Ltd",
5
5
  "license": "Apache-2.0",
6
6
  "description": " jscodeshift-compatible codemod utilities",
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "UIP: Monorepo",
11
+ "team": "UIP: Frontend Delivery",
12
12
  "inPublicMirror": false,
13
13
  "releaseModel": "continuous"
14
14
  },
@@ -18,9 +18,10 @@
18
18
  "module:es2019": "dist/es2019/index.js",
19
19
  "types": "dist/types/index.d.ts",
20
20
  "typesVersions": {
21
- ">=4.0 <4.5": {
21
+ ">=4.5 <4.9": {
22
22
  "*": [
23
- "dist/types-ts4.0/*"
23
+ "dist/types-ts4.5/*",
24
+ "dist/types-ts4.5/index.d.ts"
24
25
  ]
25
26
  }
26
27
  },
@@ -37,7 +38,7 @@
37
38
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
38
39
  "@types/jscodeshift": "^0.11.0",
39
40
  "jscodeshift": "^0.13.0",
40
- "typescript": "4.5.5"
41
+ "typescript": "~4.9.5"
41
42
  },
42
43
  "techstack": {
43
44
  "@atlassian/frontend": {
@@ -52,6 +53,9 @@
52
53
  "analytics": [
53
54
  "analytics-next"
54
55
  ],
56
+ "design-tokens": [
57
+ "color"
58
+ ],
55
59
  "theming": [
56
60
  "react-context"
57
61
  ],
package/report.api.md CHANGED
@@ -1,12 +1,18 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
1
3
  ## API Report File for "@atlaskit/codemod-utils"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
8
12
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
13
+ ### Main Entry Types
14
+
15
+ <!--SECTION START: Main Entry Types-->
10
16
 
11
17
  ```ts
12
18
  import { API } from 'jscodeshift';
@@ -29,11 +35,11 @@ import { VariableDeclarator } from 'jscodeshift';
29
35
  export function addCommentBefore(
30
36
  j: core.JSCodeshift,
31
37
  target:
32
- | Collection<Program>
38
+ | Collection<CallExpression>
33
39
  | Collection<ImportDeclaration>
34
- | Collection<JSXElement>
35
40
  | Collection<JSXAttribute>
36
- | Collection<CallExpression>
41
+ | Collection<JSXElement>
42
+ | Collection<Program>
37
43
  | Collection<VariableDeclarator>,
38
44
  message: string,
39
45
  commentType?: 'block' | 'line',
@@ -63,7 +69,7 @@ export const addDynamicImport: (
63
69
  export function addToImport(
64
70
  j: core.JSCodeshift,
65
71
  base: Collection<any>,
66
- importSpecifier: ImportSpecifier | ImportDefaultSpecifier,
72
+ importSpecifier: ImportDefaultSpecifier | ImportSpecifier,
67
73
  packageName: string,
68
74
  ): void;
69
75
 
@@ -78,7 +84,7 @@ export const changeImportEntryPoint: (
78
84
  oldPackageName: string,
79
85
  importToConvert: string,
80
86
  newPackageName: string,
81
- shouldBeTypeImport?: boolean | undefined,
87
+ shouldBeTypeImport?: boolean,
82
88
  ) => (j: core.JSCodeshift, root: Collection<Node>) => void;
83
89
 
84
90
  // @public (undocumented)
@@ -93,7 +99,7 @@ export const createConvertFuncFor: (
93
99
  export const createRemoveFuncAddCommentFor: (
94
100
  component: string,
95
101
  prop: string,
96
- comment?: string | undefined,
102
+ comment?: string,
97
103
  ) => (j: core.JSCodeshift, source: Collection<Node>) => void;
98
104
 
99
105
  // @public (undocumented)
@@ -102,7 +108,7 @@ export const createRemoveFuncFor: (
102
108
  importName: string,
103
109
  prop: string,
104
110
  predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean,
105
- comment?: string | undefined,
111
+ comment?: string,
106
112
  ) => (j: core.JSCodeshift, source: Collection<Node>) => void;
107
113
 
108
114
  // @public (undocumented)
@@ -161,14 +167,14 @@ export const getDefaultSpecifier: (
161
167
  j: core.JSCodeshift,
162
168
  source: Collection<Node>,
163
169
  specifier: string,
164
- ) => string | null;
170
+ ) => null | string;
165
171
 
166
172
  // @public (undocumented)
167
173
  export const getDynamicImportName: (
168
174
  j: core.JSCodeshift,
169
175
  source: Collection<any>,
170
176
  importPath: string,
171
- ) => string | null;
177
+ ) => null | string;
172
178
 
173
179
  // @public (undocumented)
174
180
  export const getJSXAttributesByName: (
@@ -183,7 +189,7 @@ export function getNamedSpecifier(
183
189
  source: Collection<Node>,
184
190
  specifier: string,
185
191
  importName: string,
186
- ): string | null;
192
+ ): null | string;
187
193
 
188
194
  // @public (undocumented)
189
195
  export function getSafeImportName({
@@ -195,7 +201,7 @@ export function getSafeImportName({
195
201
  }: {
196
202
  j: core.JSCodeshift;
197
203
  base: Collection<any>;
198
- currentDefaultSpecifierName: string | null;
204
+ currentDefaultSpecifierName: null | string;
199
205
  desiredName: string;
200
206
  fallbackName: string;
201
207
  }): string;
@@ -258,3 +264,15 @@ export function tryCreateImport(
258
264
 
259
265
  // (No @packageDocumentation comment for this package)
260
266
  ```
267
+
268
+ <!--SECTION END: Main Entry Types-->
269
+
270
+ ### Peer Dependencies
271
+
272
+ <!--SECTION START: Peer Dependencies-->
273
+
274
+ ```json
275
+ {}
276
+ ```
277
+
278
+ <!--SECTION END: Peer Dependencies-->
@@ -0,0 +1,122 @@
1
+ ## API Report File for "@atlaskit/codemod-utils"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { API } from 'jscodeshift';
8
+ import { ASTPath } from 'jscodeshift';
9
+ import { CallExpression } from 'jscodeshift';
10
+ import { Collection } from 'jscodeshift/src/Collection';
11
+ import core from 'jscodeshift';
12
+ import { FileInfo } from 'jscodeshift';
13
+ import { ImportDeclaration } from 'jscodeshift';
14
+ import { ImportDefaultSpecifier } from 'jscodeshift';
15
+ import { ImportSpecifier } from 'jscodeshift';
16
+ import { JSXAttribute } from 'jscodeshift';
17
+ import { JSXElement } from 'jscodeshift';
18
+ import { Options } from 'jscodeshift';
19
+ import { Program } from 'jscodeshift';
20
+ import { VariableDeclaration } from 'jscodeshift';
21
+ import { VariableDeclarator } from 'jscodeshift';
22
+
23
+ // @public (undocumented)
24
+ export function addCommentBefore(j: core.JSCodeshift, target: Collection<CallExpression> | Collection<ImportDeclaration> | Collection<JSXAttribute> | Collection<JSXElement> | Collection<Program> | Collection<VariableDeclarator>, message: string, commentType?: 'block' | 'line', messagePrefix?: string): void;
25
+
26
+ // @public (undocumented)
27
+ export const addCommentToStartOfFile: ({ j, base, message, }: {
28
+ j: core.JSCodeshift;
29
+ base: Collection<Node>;
30
+ message: string;
31
+ }) => void;
32
+
33
+ // @public (undocumented)
34
+ export const addDynamicImport: (j: core.JSCodeshift, target: Collection<VariableDeclaration>, name: string, packageEndpoint: string) => void;
35
+
36
+ // @public (undocumented)
37
+ export function addToImport(j: core.JSCodeshift, base: Collection<any>, importSpecifier: ImportDefaultSpecifier | ImportSpecifier, packageName: string): void;
38
+
39
+ // @public (undocumented)
40
+ export const callExpressionArgMatchesString: (arg: CallExpression['arguments'][number], str: string) => boolean;
41
+
42
+ // @public (undocumented)
43
+ export const changeImportEntryPoint: (oldPackageName: string, importToConvert: string, newPackageName: string, shouldBeTypeImport?: boolean) => (j: core.JSCodeshift, root: Collection<Node>) => void;
44
+
45
+ // @public (undocumented)
46
+ export const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
47
+
48
+ // @public (undocumented)
49
+ export const createRemoveFuncAddCommentFor: (component: string, prop: string, comment?: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
50
+
51
+ // @public (undocumented)
52
+ export const createRemoveFuncFor: (component: string, importName: string, prop: string, predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean, comment?: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
53
+
54
+ // @public (undocumented)
55
+ export const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
56
+
57
+ // @public (undocumented)
58
+ export const createRenameImportFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
59
+
60
+ // @public (undocumented)
61
+ export const createRenameJSXFunc: (packagePath: string, from: string, to: string, fallback?: string | undefined) => (j: core.JSCodeshift, source: any) => void;
62
+
63
+ // @public (undocumented)
64
+ export const createTransformer: (migrates: ((j: core.JSCodeshift, source: Collection<Node>) => void)[], shouldApplyTransform?: ((j: core.JSCodeshift, source: Collection<Node>) => boolean) | undefined) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
65
+
66
+ // @public (undocumented)
67
+ export const doesIdentifierExist: (j: core.JSCodeshift, base: Collection<any>, name: string) => boolean;
68
+
69
+ // @public (undocumented)
70
+ export const elevateComponentToNewEntryPoint: (pkg: string, toPkg: string, innerElementName: string) => (j: core.JSCodeshift, root: any) => void;
71
+
72
+ // @public (undocumented)
73
+ export const flattenCertainChildPropsAsProp: (component: string, propName: string, childProps: string[]) => (j: core.JSCodeshift, source: Collection<Node>) => void;
74
+
75
+ // @public (undocumented)
76
+ export const getDefaultSpecifier: (j: core.JSCodeshift, source: Collection<Node>, specifier: string) => null | string;
77
+
78
+ // @public (undocumented)
79
+ export const getDynamicImportName: (j: core.JSCodeshift, source: Collection<any>, importPath: string) => null | string;
80
+
81
+ // @public (undocumented)
82
+ export const getJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => Collection<JSXAttribute>;
83
+
84
+ // @public (undocumented)
85
+ export function getNamedSpecifier(j: core.JSCodeshift, source: Collection<Node>, specifier: string, importName: string): null | string;
86
+
87
+ // @public (undocumented)
88
+ export function getSafeImportName({ j, base, currentDefaultSpecifierName, desiredName, fallbackName, }: {
89
+ j: core.JSCodeshift;
90
+ base: Collection<any>;
91
+ currentDefaultSpecifierName: null | string;
92
+ desiredName: string;
93
+ fallbackName: string;
94
+ }): string;
95
+
96
+ // @public (undocumented)
97
+ export const hasImportDeclaration: (j: core.JSCodeshift, source: Collection<Node>, importPath: string) => boolean;
98
+
99
+ // @public (undocumented)
100
+ export const hasImportDeclarationFromAnyPackageEntrypoint: (j: core.JSCodeshift, source: Collection<Node>, packageName: string) => boolean;
101
+
102
+ // @public (undocumented)
103
+ export const hasJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => boolean;
104
+
105
+ // @public (undocumented)
106
+ export function removeImport(j: core.JSCodeshift, base: Collection<any>, packageName: string): void;
107
+
108
+ // @public (undocumented)
109
+ export const renameNamedImportWithAliasName: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
110
+
111
+ // @public (undocumented)
112
+ export const replaceImportStatementFor: (pkg: string, convertMap: any) => (j: core.JSCodeshift, root: Collection<Node>) => void;
113
+
114
+ // @public (undocumented)
115
+ export const testMethodVariantEach: (path: ASTPath<CallExpression>, testMethods: Set<string>) => boolean;
116
+
117
+ // @public (undocumented)
118
+ export function tryCreateImport(j: core.JSCodeshift, base: Collection<any>, relativeToPackage: string, packageName: string, shouldBeTypeImport?: boolean): void;
119
+
120
+ // (No @packageDocumentation comment for this package)
121
+
122
+ ```
@@ -1,2 +0,0 @@
1
- export { createRenameFuncFor, createConvertFuncFor, createRenameImportFor, createRemoveFuncFor, replaceImportStatementFor, elevateComponentToNewEntryPoint, createTransformer, renameNamedImportWithAliasName, flattenCertainChildPropsAsProp, createRenameJSXFunc, createRemoveFuncAddCommentFor, changeImportEntryPoint, } from './utils';
2
- export { getDefaultSpecifier, getNamedSpecifier, getJSXAttributesByName, hasJSXAttributesByName, doesIdentifierExist, hasImportDeclaration, hasImportDeclarationFromAnyPackageEntrypoint, addCommentBefore, addCommentToStartOfFile, callExpressionArgMatchesString, testMethodVariantEach, getSafeImportName, removeImport, getDynamicImportName, addDynamicImport, tryCreateImport, addToImport, } from './utils/support';
@@ -1,15 +0,0 @@
1
- import core, { API, ASTPath, FileInfo, Options } from 'jscodeshift';
2
- import { Collection } from 'jscodeshift/src/Collection';
3
- declare const createRemoveFuncFor: (component: string, importName: string, prop: string, predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean, comment?: string | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
4
- declare const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
5
- declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
6
- declare const replaceImportStatementFor: (pkg: string, convertMap: any) => (j: core.JSCodeshift, root: Collection<Node>) => void;
7
- declare const createRenameImportFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
8
- declare const createTransformer: (migrates: ((j: core.JSCodeshift, source: Collection<Node>) => void)[], shouldApplyTransform?: ((j: core.JSCodeshift, source: Collection<Node>) => boolean) | undefined) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
9
- declare const elevateComponentToNewEntryPoint: (pkg: string, toPkg: string, innerElementName: string) => (j: core.JSCodeshift, root: any) => void;
10
- declare const flattenCertainChildPropsAsProp: (component: string, propName: string, childProps: string[]) => (j: core.JSCodeshift, source: Collection<Node>) => void;
11
- declare const createRenameJSXFunc: (packagePath: string, from: string, to: string, fallback?: string | undefined) => (j: core.JSCodeshift, source: any) => void;
12
- declare const createRemoveFuncAddCommentFor: (component: string, prop: string, comment?: string | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
13
- declare const renameNamedImportWithAliasName: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
14
- declare const changeImportEntryPoint: (oldPackageName: string, importToConvert: string, newPackageName: string, shouldBeTypeImport?: boolean | undefined) => (j: core.JSCodeshift, root: Collection<Node>) => void;
15
- export { createRenameFuncFor, createConvertFuncFor, createRenameImportFor, createRemoveFuncFor, replaceImportStatementFor, elevateComponentToNewEntryPoint, createTransformer, renameNamedImportWithAliasName, flattenCertainChildPropsAsProp, createRenameJSXFunc, createRemoveFuncAddCommentFor, changeImportEntryPoint, };
@@ -1,47 +0,0 @@
1
- import core, { ASTPath, CallExpression, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, JSXAttribute, JSXElement, Program, VariableDeclaration, VariableDeclarator } from 'jscodeshift';
2
- import { Collection } from 'jscodeshift/src/Collection';
3
- declare function getNamedSpecifier(j: core.JSCodeshift, source: Collection<Node>, specifier: string, importName: string): string | null;
4
- declare const getDynamicImportName: (j: core.JSCodeshift, source: Collection<any>, importPath: string) => string | null;
5
- declare const addDynamicImport: (j: core.JSCodeshift, target: Collection<VariableDeclaration>, name: string, packageEndpoint: string) => void;
6
- declare function clean(value: string): string;
7
- declare const addCommentToStartOfFile: ({ j, base, message, }: {
8
- j: core.JSCodeshift;
9
- base: Collection<Node>;
10
- message: string;
11
- }) => void;
12
- declare function addCommentBefore(j: core.JSCodeshift, target: Collection<Program> | Collection<ImportDeclaration> | Collection<JSXElement> | Collection<JSXAttribute> | Collection<CallExpression> | Collection<VariableDeclarator>, message: string, commentType?: 'block' | 'line', messagePrefix?: string): void;
13
- declare const getDefaultSpecifier: (j: core.JSCodeshift, source: Collection<Node>, specifier: string) => string | null;
14
- declare const getJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => Collection<JSXAttribute>;
15
- declare const isEmpty: any;
16
- declare const hasImportDeclaration: (j: core.JSCodeshift, source: Collection<Node>, importPath: string) => boolean;
17
- declare const hasImportDeclarationFromAnyPackageEntrypoint: (j: core.JSCodeshift, source: Collection<Node>, packageName: string) => boolean;
18
- declare const debug: (component: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
19
- export declare function placeholderStringMatches(placeholderStr: string, resolvedStr: string): boolean;
20
- /**
21
- * Check whether a value contains a Format Specifier (printf placeholder)
22
- *
23
- * @see https://jestjs.io/docs/api#testeachtablename-fn-timeout
24
- * @see https://nodejs.org/api/util.html#utilformatformat-args
25
- *
26
- * @param argValue The string potentially containing a format specifier (e.g. 'Foo %s')
27
- * @param str The string that has replaced a format specifier with a tangible value (e.g. 'Foo Bar`)
28
- *
29
- * @returns Boolean: True if the strings matched (after considering the placeholder), or false if not.
30
- */
31
- export declare function matchesStringWithFormatSpecifier(argValue: string | number | boolean | RegExp | null, str: string): boolean;
32
- declare const callExpressionArgMatchesString: (arg: CallExpression['arguments'][number], str: string) => boolean;
33
- declare const testMethodVariantEach: (path: ASTPath<CallExpression>, testMethods: Set<string>) => boolean;
34
- declare const hasJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => boolean;
35
- declare const doesIdentifierExist: (j: core.JSCodeshift, base: Collection<any>, name: string) => boolean;
36
- declare function removeImport(j: core.JSCodeshift, base: Collection<any>, packageName: string): void;
37
- declare function tryCreateImport(j: core.JSCodeshift, base: Collection<any>, relativeToPackage: string, packageName: string, shouldBeTypeImport?: boolean): void;
38
- declare function addToImport(j: core.JSCodeshift, base: Collection<any>, importSpecifier: ImportSpecifier | ImportDefaultSpecifier, packageName: string): void;
39
- declare const shiftDefaultImport: (j: core.JSCodeshift, base: Collection<any>, defaultName: string, oldPackagePath: string, newPackagePath: string) => void;
40
- declare function getSafeImportName({ j, base, currentDefaultSpecifierName, desiredName, fallbackName, }: {
41
- j: core.JSCodeshift;
42
- base: Collection<any>;
43
- currentDefaultSpecifierName: string | null;
44
- desiredName: string;
45
- fallbackName: string;
46
- }): string;
47
- export { getDefaultSpecifier, getNamedSpecifier, getJSXAttributesByName, hasJSXAttributesByName, hasImportDeclaration, hasImportDeclarationFromAnyPackageEntrypoint, addCommentBefore, addCommentToStartOfFile, doesIdentifierExist, removeImport, tryCreateImport, addToImport, shiftDefaultImport, isEmpty, clean, debug, callExpressionArgMatchesString, testMethodVariantEach, getSafeImportName, getDynamicImportName, addDynamicImport, };