@atlaskit/checkbox 17.3.9 → 17.3.11

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 (31) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/codemods/15.0.0-size-removal.tsx +2 -2
  3. package/codemods/migrations/remove-full-width.tsx +6 -0
  4. package/codemods/migrations/remove-imports.tsx +1 -1
  5. package/codemods/migrations/remove-overrides.tsx +15 -0
  6. package/codemods/migrations/remove-size.tsx +6 -0
  7. package/codemods/migrations/remove-theme.tsx +15 -0
  8. package/codemods/migrations/rename-checkbox-without-analytics-import.tsx +11 -0
  9. package/codemods/migrations/rename-deep-type-import.tsx +10 -0
  10. package/codemods/migrations/rename-input-ref-to-ref.tsx +1 -1
  11. package/codemods/migrations/rename-type-import.tsx +10 -0
  12. package/codemods/types.tsx +1 -0
  13. package/codemods/utils/add-comment-before.tsx +40 -0
  14. package/codemods/utils/add-comment-to-start-of-file.tsx +20 -0
  15. package/codemods/utils/add-to-import.tsx +32 -0
  16. package/codemods/utils/create-remove-func-for.tsx +33 -0
  17. package/codemods/utils/create-remove-imports-for.tsx +84 -0
  18. package/codemods/utils/create-rename-func-for.tsx +42 -0
  19. package/codemods/utils/create-rename-import-for.tsx +98 -0
  20. package/codemods/utils/create-transformer.tsx +23 -0
  21. package/codemods/utils/find-identifier-and-replace-attribute.tsx +27 -0
  22. package/codemods/utils/get-default-specifier.tsx +17 -0
  23. package/codemods/utils/get-jsx-attributes-by-name.tsx +18 -0
  24. package/codemods/utils/get-named-specifier.tsx +24 -0
  25. package/codemods/utils/has-import-declaration.tsx +12 -0
  26. package/codemods/utils/has-variable-assignment.tsx +18 -0
  27. package/codemods/utils/try-create-import.tsx +27 -0
  28. package/package.json +13 -5
  29. package/codemods/migrations/remove-props.tsx +0 -39
  30. package/codemods/migrations/rename-import.tsx +0 -33
  31. package/codemods/utils.tsx +0 -477
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/checkbox
2
2
 
3
+ ## 17.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 17.3.10
10
+
11
+ ### Patch Changes
12
+
13
+ - [`02483200273ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/02483200273ec) -
14
+ Enrol all Design System UI packages into the React Compiler with platform gating via
15
+ isReactCompilerActivePlatform.
16
+ - Updated dependencies
17
+
3
18
  ## 17.3.9
4
19
 
5
20
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  import type { API, FileInfo, Options } from 'jscodeshift';
2
2
 
3
- import { removeSize } from './migrations/remove-props';
4
- import { createTransformer } from './utils';
3
+ import { removeSize } from './migrations/remove-size';
4
+ import { createTransformer } from './utils/create-transformer';
5
5
 
6
6
  const transformer: (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string =
7
7
  createTransformer('@atlaskit/checkbox', [removeSize]);
@@ -0,0 +1,6 @@
1
+ import { createRemoveFuncFor } from '../utils/create-remove-func-for';
2
+
3
+ export const removeFullWidth: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'isFullWidth');
@@ -1,4 +1,4 @@
1
- import { createRemoveImportsFor } from '../utils';
1
+ import { createRemoveImportsFor } from '../utils/create-remove-imports-for';
2
2
 
3
3
  export const removeThemeImports: (
4
4
  j: import('jscodeshift/src/core').JSCodeshift,
@@ -0,0 +1,15 @@
1
+ import { createRemoveFuncFor } from '../utils/create-remove-func-for';
2
+
3
+ export const removeOverrides: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRemoveFuncFor(
7
+ '@atlaskit/checkbox',
8
+ 'Checkbox',
9
+ 'overrides',
10
+ `This file uses the @atlaskit/checkbox \`overrides\` prop
11
+ which has now been removed due to its poor performance characteristics. We have not
12
+ replaced overrides with an equivalent API and the overrides pattern exposes internal
13
+ implementation detail as public API and makes it harder for you to upgrade. The appearance
14
+ of Checkbox will have likely changed.`,
15
+ );
@@ -0,0 +1,6 @@
1
+ import { createRemoveFuncFor } from '../utils/create-remove-func-for';
2
+
3
+ export const removeSize: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'size');
@@ -0,0 +1,15 @@
1
+ import { createRemoveFuncFor } from '../utils/create-remove-func-for';
2
+
3
+ export const removeTheme: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRemoveFuncFor(
7
+ '@atlaskit/checkbox',
8
+ 'Checkbox',
9
+ 'theme',
10
+ `This file uses the @atlaskit/checkbox \`theme\` prop which
11
+ has now been removed due to its poor performance characteristics. We have not replaced
12
+ theme with an equivalent API due to minimal usage of the \`theme\` prop. However if you
13
+ were using theme to customise the size of the checkbox there is now a \`size\` prop.
14
+ The appearance of Checkbox will have likely changed.`,
15
+ );
@@ -0,0 +1,11 @@
1
+ import { createRenameImportFor } from '../utils/create-rename-import-for';
2
+
3
+ export const renameCheckboxWithoutAnalyticsImport: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRenameImportFor({
7
+ componentName: 'CheckboxWithoutAnalytics',
8
+ newComponentName: 'Checkbox',
9
+ oldPackagePath: '@atlaskit/checkbox/Checkbox',
10
+ newPackagePath: '@atlaskit/checkbox',
11
+ });
@@ -0,0 +1,10 @@
1
+ import { createRenameImportFor } from '../utils/create-rename-import-for';
2
+
3
+ export const renameDeepTypeImport: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRenameImportFor({
7
+ componentName: 'CheckboxProps',
8
+ oldPackagePath: '@atlaskit/checkbox/dist/cjs/types',
9
+ newPackagePath: '@atlaskit/checkbox',
10
+ });
@@ -1,4 +1,4 @@
1
- import { createRenameFuncFor } from '../utils';
1
+ import { createRenameFuncFor } from '../utils/create-rename-func-for';
2
2
 
3
3
  export const renameInputRef: (
4
4
  j: import('jscodeshift/src/core').JSCodeshift,
@@ -0,0 +1,10 @@
1
+ import { createRenameImportFor } from '../utils/create-rename-import-for';
2
+
3
+ export const renameTypeImport: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRenameImportFor({
7
+ componentName: 'CheckboxProps',
8
+ oldPackagePath: '@atlaskit/checkbox/types',
9
+ newPackagePath: '@atlaskit/checkbox',
10
+ });
@@ -0,0 +1 @@
1
+ export type Nullable<T> = T | null;
@@ -0,0 +1,40 @@
1
+ import { type ASTPath, type ImportDeclaration, type JSCodeshift, type Program } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ // not replacing newlines (which \s does)
5
+ const spacesAndTabs: RegExp = /[ \t]{2,}/g;
6
+ const lineStartWithSpaces: RegExp = /^[ \t]*/gm;
7
+
8
+ function clean(value: string): string {
9
+ return (
10
+ value
11
+ .replace(spacesAndTabs, ' ')
12
+ .replace(lineStartWithSpaces, '')
13
+ // using .trim() to clear the any newlines before the first text and after last text
14
+ .trim()
15
+ );
16
+ }
17
+
18
+ export function addCommentBefore({
19
+ j,
20
+ target,
21
+ message,
22
+ }: {
23
+ j: JSCodeshift;
24
+ target: Collection<Program> | Collection<ImportDeclaration>;
25
+ message: string;
26
+ }): void {
27
+ const content: string = ` TODO: (from codemod) ${clean(message)} `;
28
+ target.forEach((path: ASTPath<Program | ImportDeclaration>) => {
29
+ path.value.comments = path.value.comments || [];
30
+
31
+ const exists = path.value.comments.find((comment) => comment.value === content);
32
+
33
+ // avoiding duplicates of the same comment
34
+ if (exists) {
35
+ return;
36
+ }
37
+
38
+ path.value.comments.push(j.commentBlock(content));
39
+ });
40
+ }
@@ -0,0 +1,20 @@
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { addCommentBefore } from './add-comment-before';
5
+
6
+ export function addCommentToStartOfFile({
7
+ j,
8
+ base,
9
+ message,
10
+ }: {
11
+ j: JSCodeshift;
12
+ base: Collection<Node>;
13
+ message: string;
14
+ }): void {
15
+ addCommentBefore({
16
+ j,
17
+ target: base.find(j.Program),
18
+ message,
19
+ });
20
+ }
@@ -0,0 +1,32 @@
1
+ import { type ImportDefaultSpecifier, type ImportSpecifier, type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ export function addToImport({
5
+ j,
6
+ base,
7
+ importSpecifier,
8
+ packageName,
9
+ }: {
10
+ j: JSCodeshift;
11
+ base: Collection<any>;
12
+ importSpecifier: ImportSpecifier | ImportDefaultSpecifier;
13
+ packageName: string;
14
+ }): void {
15
+ base
16
+ .find(j.ImportDeclaration)
17
+ .filter((path) => path.value.source.value === packageName)
18
+ .replaceWith((declaration) => {
19
+ return j.importDeclaration(
20
+ [
21
+ // we are appending to the existing specifiers
22
+ // We are doing a filter hear because sometimes specifiers can be removed
23
+ // but they hand around in the declaration
24
+ ...(declaration.value.specifiers || []).filter(
25
+ (item) => item.type === 'ImportSpecifier' && item.imported != null,
26
+ ),
27
+ importSpecifier,
28
+ ],
29
+ j.literal(packageName),
30
+ );
31
+ });
32
+ }
@@ -0,0 +1,33 @@
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { addCommentToStartOfFile } from './add-comment-to-start-of-file';
5
+ import { getDefaultSpecifier } from './get-default-specifier';
6
+ import { getJSXAttributesByName } from './get-jsx-attributes-by-name';
7
+ import { getNamedSpecifier } from './get-named-specifier';
8
+
9
+ export const createRemoveFuncFor: (
10
+ component: string,
11
+ importName: string,
12
+ prop: string,
13
+ comment?: string,
14
+ ) => (j: JSCodeshift, source: Collection<Node>) => void =
15
+ (component: string, importName: string, prop: string, comment?: string) =>
16
+ (j: JSCodeshift, source: Collection<Node>) => {
17
+ const specifier =
18
+ getNamedSpecifier(j, source, component, importName) ||
19
+ getDefaultSpecifier(j, source, component);
20
+
21
+ if (!specifier) {
22
+ return;
23
+ }
24
+
25
+ source.findJSXElements(specifier).forEach((element) => {
26
+ getJSXAttributesByName(j, element, prop).forEach((attribute) => {
27
+ j(attribute).remove();
28
+ if (comment) {
29
+ addCommentToStartOfFile({ j, base: source, message: comment });
30
+ }
31
+ });
32
+ });
33
+ };
@@ -0,0 +1,84 @@
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { type Nullable } from '../types';
5
+
6
+ import { addCommentToStartOfFile } from './add-comment-to-start-of-file';
7
+
8
+ export const createRemoveImportsFor: ({
9
+ importsToRemove,
10
+ packagePath,
11
+ comment,
12
+ }: {
13
+ importsToRemove: string[];
14
+ packagePath: string;
15
+ comment: string;
16
+ }) => (j: JSCodeshift, source: Collection<Node>) => void =
17
+ ({
18
+ importsToRemove,
19
+ packagePath,
20
+ comment,
21
+ }: {
22
+ importsToRemove: string[];
23
+ packagePath: string;
24
+ comment: string;
25
+ }) =>
26
+ (j: JSCodeshift, source: Collection<Node>) => {
27
+ const isUsingName: boolean =
28
+ source.find(j.ImportDeclaration).filter((path) => path.node.source.value === packagePath)
29
+ .length > 0;
30
+ if (!isUsingName) {
31
+ return;
32
+ }
33
+
34
+ const existingAlias: Nullable<string> =
35
+ source
36
+ .find(j.ImportDeclaration)
37
+ .filter((path) => path.node.source.value === packagePath)
38
+ .find(j.ImportSpecifier)
39
+ .nodes()
40
+ .map((specifier): Nullable<string> => {
41
+ if (!importsToRemove.includes(specifier.imported.name)) {
42
+ return null;
43
+ }
44
+ // If aliased: return the alias
45
+ if (specifier.local && !importsToRemove.includes(specifier.local.name)) {
46
+ return specifier.local.name;
47
+ }
48
+
49
+ return null;
50
+ })
51
+ .filter(Boolean)[0] || null;
52
+
53
+ // Remove imports
54
+ source
55
+ .find(j.ImportDeclaration)
56
+ .filter((path) => path.node.source.value === packagePath)
57
+ .find(j.ImportSpecifier)
58
+ .find(j.Identifier)
59
+ .filter((identifier) => {
60
+ if (
61
+ importsToRemove.includes(identifier.value.name) ||
62
+ identifier.value.name === existingAlias
63
+ ) {
64
+ addCommentToStartOfFile({ j, base: source, message: comment });
65
+ return true;
66
+ }
67
+ return false;
68
+ })
69
+ .remove();
70
+
71
+ // Remove entire import if it is empty
72
+ const isEmptyImport =
73
+ source
74
+ .find(j.ImportDeclaration)
75
+ .filter((path) => path.node.source.value === packagePath)
76
+ .find(j.ImportSpecifier)
77
+ .find(j.Identifier).length === 0;
78
+ if (isEmptyImport) {
79
+ source
80
+ .find(j.ImportDeclaration)
81
+ .filter((path) => path.node.source.value === packagePath)
82
+ .remove();
83
+ }
84
+ };
@@ -0,0 +1,42 @@
1
+ import { type JSCodeshift, type VariableDeclaration } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { findIdentifierAndReplaceAttribute } from './find-identifier-and-replace-attribute';
5
+ import { getJSXAttributesByName } from './get-jsx-attributes-by-name';
6
+ import { getNamedSpecifier } from './get-named-specifier';
7
+ import { hasVariableAssignment } from './has-variable-assignment';
8
+
9
+ export const createRenameFuncFor: (
10
+ component: string,
11
+ importName: string,
12
+ from: string,
13
+ to: string,
14
+ ) => (j: JSCodeshift, source: Collection<Node>) => void =
15
+ (component: string, importName: string, from: string, to: string) =>
16
+ (j: JSCodeshift, source: Collection<Node>) => {
17
+ const specifier = getNamedSpecifier(j, source, component, importName);
18
+
19
+ if (!specifier) {
20
+ return;
21
+ }
22
+
23
+ source.findJSXElements(specifier).forEach((element) => {
24
+ getJSXAttributesByName(j, element, from).forEach((attribute) => {
25
+ j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(to), attribute.node.value));
26
+ });
27
+ });
28
+
29
+ let variable = hasVariableAssignment(j, source, specifier);
30
+ if (variable) {
31
+ (variable as Collection<VariableDeclaration>)
32
+ .find(j.VariableDeclarator)
33
+ .forEach((declarator) => {
34
+ j(declarator)
35
+ .find(j.Identifier)
36
+ .filter((identifier) => identifier.name === 'id')
37
+ .forEach((ids) => {
38
+ findIdentifierAndReplaceAttribute(j, source, ids.node.name, from, to);
39
+ });
40
+ });
41
+ }
42
+ };
@@ -0,0 +1,98 @@
1
+ import { type ImportDefaultSpecifier, type ImportSpecifier, type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { type Nullable } from '../types';
5
+
6
+ import { addToImport } from './add-to-import';
7
+ import { tryCreateImport } from './try-create-import';
8
+
9
+ export const createRenameImportFor: ({
10
+ componentName,
11
+ newComponentName,
12
+ oldPackagePath,
13
+ newPackagePath,
14
+ }: {
15
+ componentName: string;
16
+ newComponentName?: string;
17
+ oldPackagePath: string;
18
+ newPackagePath: string;
19
+ }) => (j: JSCodeshift, source: Collection<Node>) => void =
20
+ ({
21
+ componentName,
22
+ newComponentName,
23
+ oldPackagePath,
24
+ newPackagePath,
25
+ }: {
26
+ componentName: string;
27
+ newComponentName?: string;
28
+ oldPackagePath: string;
29
+ newPackagePath: string;
30
+ }) =>
31
+ (j: JSCodeshift, source: Collection<Node>) => {
32
+ const isUsingName: boolean =
33
+ source
34
+ .find(j.ImportDeclaration)
35
+ .filter((path) => path.node.source.value === oldPackagePath)
36
+ .find(j.ImportSpecifier)
37
+ .nodes()
38
+ .filter((specifier) => specifier.imported && specifier.imported.name === componentName)
39
+ .length > 0;
40
+ if (!isUsingName) {
41
+ return;
42
+ }
43
+
44
+ const existingAlias: Nullable<string> =
45
+ source
46
+ .find(j.ImportDeclaration)
47
+ .filter((path) => path.node.source.value === oldPackagePath)
48
+ .find(j.ImportSpecifier)
49
+ .nodes()
50
+ .map((specifier): Nullable<string> => {
51
+ if (specifier.imported && specifier.imported.name !== componentName) {
52
+ return null;
53
+ }
54
+ // If aliased: return the alias
55
+ if (specifier.local && specifier.local.name !== componentName) {
56
+ return specifier.local.name;
57
+ }
58
+
59
+ return null;
60
+ })
61
+ .filter(Boolean)[0] || null;
62
+
63
+ // Check to see if need to create new package path
64
+ // Try create an import declaration just before the old import
65
+ tryCreateImport({
66
+ j,
67
+ base: source,
68
+ relativeToPackage: oldPackagePath,
69
+ packageName: newPackagePath,
70
+ });
71
+
72
+ const newSpecifier: ImportSpecifier | ImportDefaultSpecifier = (() => {
73
+ // If there's a new name use that
74
+ if (newComponentName) {
75
+ return j.importSpecifier(j.identifier(newComponentName), j.identifier(newComponentName));
76
+ }
77
+
78
+ if (existingAlias) {
79
+ return j.importSpecifier(j.identifier(componentName), j.identifier(existingAlias));
80
+ }
81
+
82
+ // Add specifier
83
+ return j.importSpecifier(j.identifier(componentName), j.identifier(componentName));
84
+ })();
85
+
86
+ addToImport({
87
+ j,
88
+ base: source,
89
+ importSpecifier: newSpecifier,
90
+ packageName: newPackagePath,
91
+ });
92
+
93
+ // Remove old path
94
+ source
95
+ .find(j.ImportDeclaration)
96
+ .filter((path) => path.node.source.value === oldPackagePath)
97
+ .remove();
98
+ };
@@ -0,0 +1,23 @@
1
+ import { type API, type FileInfo, type JSCodeshift, type Options } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ import { hasImportDeclaration } from './has-import-declaration';
5
+
6
+ export const createTransformer: (
7
+ component: string,
8
+ migrates: {
9
+ (j: JSCodeshift, source: Collection<Node>): void;
10
+ }[],
11
+ ) => (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string =
12
+ (component: string, migrates: { (j: JSCodeshift, source: Collection<Node>): void }[]) =>
13
+ (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => {
14
+ const source: Collection<Node> = jscodeshift(fileInfo.source);
15
+
16
+ if (!hasImportDeclaration(jscodeshift, source, component)) {
17
+ return fileInfo.source;
18
+ }
19
+
20
+ migrates.forEach((tf) => tf(jscodeshift, source));
21
+
22
+ return source.toSource(options.printOptions || { quote: 'single' });
23
+ };
@@ -0,0 +1,27 @@
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+
3
+ export function findIdentifierAndReplaceAttribute(
4
+ j: JSCodeshift,
5
+ source: ReturnType<typeof j>,
6
+ identifierName: string,
7
+ searchAttr: string,
8
+ replaceWithAttr: string,
9
+ ): void {
10
+ source
11
+ .find(j.JSXElement)
12
+ .find(j.JSXOpeningElement)
13
+ .filter((path) => {
14
+ return !!j(path.node)
15
+ .find(j.JSXIdentifier)
16
+ .filter((identifier) => identifier.value.name === identifierName);
17
+ })
18
+ .forEach((element) => {
19
+ j(element)
20
+ .find(j.JSXAttribute)
21
+ .find(j.JSXIdentifier)
22
+ .filter((attr) => attr.node.name === searchAttr)
23
+ .forEach((attribute) => {
24
+ j(attribute).replaceWith(j.jsxIdentifier(replaceWithAttr));
25
+ });
26
+ });
27
+ }
@@ -0,0 +1,17 @@
1
+ import { type ASTPath, type ImportDeclaration, type JSCodeshift } from 'jscodeshift';
2
+
3
+ export function getDefaultSpecifier(
4
+ j: JSCodeshift,
5
+ source: ReturnType<typeof j>,
6
+ specifier: string,
7
+ ): string | null {
8
+ const specifiers = source
9
+ .find(j.ImportDeclaration)
10
+ .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
11
+ .find(j.ImportDefaultSpecifier);
12
+
13
+ if (!specifiers.length) {
14
+ return null;
15
+ }
16
+ return specifiers.nodes()[0]!.local!.name;
17
+ }
@@ -0,0 +1,18 @@
1
+ import { type ASTPath, type JSCodeshift, type JSXAttribute } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ export function getJSXAttributesByName(
5
+ j: JSCodeshift,
6
+ element: ASTPath<any>,
7
+ attributeName: string,
8
+ ): Collection<JSXAttribute> {
9
+ return j(element)
10
+ .find(j.JSXOpeningElement)
11
+ .find(j.JSXAttribute)
12
+ .filter((attribute) => {
13
+ const matches = j(attribute)
14
+ .find(j.JSXIdentifier)
15
+ .filter((identifier) => identifier.value.name === attributeName);
16
+ return Boolean(matches.length);
17
+ });
18
+ }
@@ -0,0 +1,24 @@
1
+ import {
2
+ type ASTPath,
3
+ type ImportDeclaration,
4
+ type ImportSpecifier,
5
+ type JSCodeshift,
6
+ } from 'jscodeshift';
7
+
8
+ export function getNamedSpecifier(
9
+ j: JSCodeshift,
10
+ source: any,
11
+ specifier: string,
12
+ importName: string,
13
+ ): any {
14
+ const specifiers = source
15
+ .find(j.ImportDeclaration)
16
+ .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
17
+ .find(j.ImportSpecifier)
18
+ .filter((path: ASTPath<ImportSpecifier>) => path.node.imported.name === importName);
19
+
20
+ if (!specifiers.length) {
21
+ return null;
22
+ }
23
+ return specifiers.nodes()[0]!.local!.name;
24
+ }
@@ -0,0 +1,12 @@
1
+ import { type ASTPath, type ImportDeclaration, type JSCodeshift } from 'jscodeshift';
2
+
3
+ export function hasImportDeclaration(j: JSCodeshift, source: any, importPath: string): boolean {
4
+ const imports = source
5
+ .find(j.ImportDeclaration)
6
+ .filter(
7
+ (path: ASTPath<ImportDeclaration>) =>
8
+ typeof path.node.source.value === 'string' && path.node.source.value.startsWith(importPath),
9
+ );
10
+
11
+ return Boolean(imports.length);
12
+ }
@@ -0,0 +1,18 @@
1
+ import { type JSCodeshift, type VariableDeclaration } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ export function hasVariableAssignment(
5
+ j: JSCodeshift,
6
+ source: ReturnType<typeof j>,
7
+ identifierName: string,
8
+ ): Collection<VariableDeclaration> | boolean {
9
+ const occurance = source.find(j.VariableDeclaration).filter((path) => {
10
+ return !!j(path.node)
11
+ .find(j.VariableDeclarator)
12
+ .find(j.Identifier)
13
+ .filter((identifier) => {
14
+ return identifier.node.name === identifierName;
15
+ }).length;
16
+ });
17
+ return !!occurance.length ? occurance : false;
18
+ }
@@ -0,0 +1,27 @@
1
+ import { type JSCodeshift } from 'jscodeshift';
2
+ import { type Collection } from 'jscodeshift/src/Collection';
3
+
4
+ export function tryCreateImport({
5
+ j,
6
+ base,
7
+ relativeToPackage,
8
+ packageName,
9
+ }: {
10
+ j: JSCodeshift;
11
+ base: Collection<any>;
12
+ relativeToPackage: string;
13
+ packageName: string;
14
+ }): void {
15
+ const exists: boolean =
16
+ base.find(j.ImportDeclaration).filter((path) => path.value.source.value === packageName)
17
+ .length > 0;
18
+
19
+ if (exists) {
20
+ return;
21
+ }
22
+
23
+ base
24
+ .find(j.ImportDeclaration)
25
+ .filter((path) => path.value.source.value === relativeToPackage)
26
+ .insertBefore(j.importDeclaration([], j.literal(packageName)));
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "17.3.9",
3
+ "version": "17.3.11",
4
4
  "description": "A checkbox is an input control that allows a user to select one or more options from a number of choices.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,6 +25,13 @@
25
25
  ],
26
26
  "atlaskit:src": "src/index.tsx",
27
27
  "atlassian": {
28
+ "react-compiler": {
29
+ "enabled": true,
30
+ "gating": {
31
+ "source": "@atlassian/react-compiler-gating",
32
+ "importSpecifierName": "isReactCompilerActivePlatform"
33
+ }
34
+ },
28
35
  "team": "Design System Team",
29
36
  "website": {
30
37
  "name": "Checkbox",
@@ -34,8 +41,8 @@
34
41
  "dependencies": {
35
42
  "@atlaskit/analytics-next": "^11.2.0",
36
43
  "@atlaskit/css": "^0.19.0",
37
- "@atlaskit/ds-lib": "^6.0.0",
38
- "@atlaskit/tokens": "^11.4.0",
44
+ "@atlaskit/ds-lib": "^7.0.0",
45
+ "@atlaskit/tokens": "^12.0.0",
39
46
  "@babel/runtime": "^7.0.0",
40
47
  "@compiled/react": "^0.20.0"
41
48
  },
@@ -47,12 +54,13 @@
47
54
  "@af/integration-testing": "workspace:^",
48
55
  "@af/suppress-react-warnings": "workspace:^",
49
56
  "@af/visual-regression": "workspace:^",
50
- "@atlaskit/button": "^23.10.0",
57
+ "@atlaskit/button": "^23.11.0",
51
58
  "@atlaskit/docs": "^11.7.0",
52
59
  "@atlaskit/form": "^15.5.0",
53
- "@atlaskit/link": "^3.3.0",
60
+ "@atlaskit/link": "^3.4.0",
54
61
  "@atlaskit/primitives": "^18.1.0",
55
62
  "@atlaskit/section-message": "^8.12.0",
63
+ "@atlassian/react-compiler-gating": "workspace:^",
56
64
  "@atlassian/ssr-tests": "workspace:^",
57
65
  "@atlassian/structured-docs-types": "workspace:^",
58
66
  "@testing-library/react": "^16.3.0",
@@ -1,39 +0,0 @@
1
- import { createRemoveFuncFor } from '../utils';
2
-
3
- export const removeFullWidth: (
4
- j: import('jscodeshift/src/core').JSCodeshift,
5
- source: import('jscodeshift/src/Collection').Collection<Node>,
6
- ) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'isFullWidth');
7
-
8
- export const removeOverrides: (
9
- j: import('jscodeshift/src/core').JSCodeshift,
10
- source: import('jscodeshift/src/Collection').Collection<Node>,
11
- ) => void = createRemoveFuncFor(
12
- '@atlaskit/checkbox',
13
- 'Checkbox',
14
- 'overrides',
15
- `This file uses the @atlaskit/checkbox \`overrides\` prop
16
- which has now been removed due to its poor performance characteristics. We have not
17
- replaced overrides with an equivalent API and the overrides pattern exposes internal
18
- implementation detail as public API and makes it harder for you to upgrade. The appearance
19
- of Checkbox will have likely changed.`,
20
- );
21
-
22
- export const removeTheme: (
23
- j: import('jscodeshift/src/core').JSCodeshift,
24
- source: import('jscodeshift/src/Collection').Collection<Node>,
25
- ) => void = createRemoveFuncFor(
26
- '@atlaskit/checkbox',
27
- 'Checkbox',
28
- 'theme',
29
- `This file uses the @atlaskit/checkbox \`theme\` prop which
30
- has now been removed due to its poor performance characteristics. We have not replaced
31
- theme with an equivalent API due to minimal usage of the \`theme\` prop. However if you
32
- were using theme to customise the size of the checkbox there is now a \`size\` prop.
33
- The appearance of Checkbox will have likely changed.`,
34
- );
35
-
36
- export const removeSize: (
37
- j: import('jscodeshift/src/core').JSCodeshift,
38
- source: import('jscodeshift/src/Collection').Collection<Node>,
39
- ) => void = createRemoveFuncFor('@atlaskit/checkbox', 'Checkbox', 'size');
@@ -1,33 +0,0 @@
1
- import { createRenameImportFor } from '../utils';
2
-
3
- // As you could access everything in Checkbox with the old entry points
4
- // there are a lot of possible things to fix. Having searched on SourceTree
5
- // these are the only things that need to be fixed
6
-
7
- export const renameTypeImport: (
8
- j: import('jscodeshift/src/core').JSCodeshift,
9
- source: import('jscodeshift/src/Collection').Collection<Node>,
10
- ) => void = createRenameImportFor({
11
- componentName: 'CheckboxProps',
12
- oldPackagePath: '@atlaskit/checkbox/types',
13
- newPackagePath: '@atlaskit/checkbox',
14
- });
15
-
16
- export const renameDeepTypeImport: (
17
- j: import('jscodeshift/src/core').JSCodeshift,
18
- source: import('jscodeshift/src/Collection').Collection<Node>,
19
- ) => void = createRenameImportFor({
20
- componentName: 'CheckboxProps',
21
- oldPackagePath: '@atlaskit/checkbox/dist/cjs/types',
22
- newPackagePath: '@atlaskit/checkbox',
23
- });
24
-
25
- export const renameCheckboxWithoutAnalyticsImport: (
26
- j: import('jscodeshift/src/core').JSCodeshift,
27
- source: import('jscodeshift/src/Collection').Collection<Node>,
28
- ) => void = createRenameImportFor({
29
- componentName: 'CheckboxWithoutAnalytics',
30
- newComponentName: 'Checkbox',
31
- oldPackagePath: '@atlaskit/checkbox/Checkbox',
32
- newPackagePath: '@atlaskit/checkbox',
33
- });
@@ -1,477 +0,0 @@
1
- import type {
2
- API,
3
- ASTPath,
4
- default as core,
5
- FileInfo,
6
- ImportDeclaration,
7
- ImportDefaultSpecifier,
8
- ImportSpecifier,
9
- JSXAttribute,
10
- Options,
11
- Program,
12
- VariableDeclaration,
13
- } from 'jscodeshift';
14
- import { type Collection } from 'jscodeshift/src/Collection';
15
-
16
- export type Nullable<T> = T | null;
17
-
18
- export function getNamedSpecifier(
19
- j: core.JSCodeshift,
20
- source: any,
21
- specifier: string,
22
- importName: string,
23
- ): any {
24
- const specifiers = source
25
- .find(j.ImportDeclaration)
26
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
27
- .find(j.ImportSpecifier)
28
- .filter((path: ASTPath<ImportSpecifier>) => path.node.imported.name === importName);
29
-
30
- if (!specifiers.length) {
31
- return null;
32
- }
33
- return specifiers.nodes()[0]!.local!.name;
34
- }
35
-
36
- function getDefaultSpecifier(j: core.JSCodeshift, source: ReturnType<typeof j>, specifier: string) {
37
- const specifiers = source
38
- .find(j.ImportDeclaration)
39
- .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
40
- .find(j.ImportDefaultSpecifier);
41
-
42
- if (!specifiers.length) {
43
- return null;
44
- }
45
- return specifiers.nodes()[0]!.local!.name;
46
- }
47
-
48
- export function getJSXAttributesByName(
49
- j: core.JSCodeshift,
50
- element: ASTPath<any>,
51
- attributeName: string,
52
- ): Collection<JSXAttribute> {
53
- return j(element)
54
- .find(j.JSXOpeningElement)
55
- .find(j.JSXAttribute)
56
- .filter((attribute) => {
57
- const matches = j(attribute)
58
- .find(j.JSXIdentifier)
59
- .filter((identifier) => identifier.value.name === attributeName);
60
- return Boolean(matches.length);
61
- });
62
- }
63
-
64
- export function hasImportDeclaration(
65
- j: core.JSCodeshift,
66
- source: any,
67
- importPath: string,
68
- ): boolean {
69
- const imports = source
70
- .find(j.ImportDeclaration)
71
- .filter(
72
- (path: ASTPath<ImportDeclaration>) =>
73
- typeof path.node.source.value === 'string' && path.node.source.value.startsWith(importPath),
74
- );
75
-
76
- return Boolean(imports.length);
77
- }
78
-
79
- export function findIdentifierAndReplaceAttribute(
80
- j: core.JSCodeshift,
81
- source: ReturnType<typeof j>,
82
- identifierName: string,
83
- searchAttr: string,
84
- replaceWithAttr: string,
85
- ): void {
86
- source
87
- .find(j.JSXElement)
88
- .find(j.JSXOpeningElement)
89
- .filter((path) => {
90
- return !!j(path.node)
91
- .find(j.JSXIdentifier)
92
- .filter((identifier) => identifier.value.name === identifierName);
93
- })
94
- .forEach((element) => {
95
- j(element)
96
- .find(j.JSXAttribute)
97
- .find(j.JSXIdentifier)
98
- .filter((attr) => attr.node.name === searchAttr)
99
- .forEach((attribute) => {
100
- j(attribute).replaceWith(j.jsxIdentifier(replaceWithAttr));
101
- });
102
- });
103
- }
104
-
105
- export function hasVariableAssignment(
106
- j: core.JSCodeshift,
107
- source: ReturnType<typeof j>,
108
- identifierName: string,
109
- ): Collection<VariableDeclaration> | boolean {
110
- const occurance = source.find(j.VariableDeclaration).filter((path) => {
111
- return !!j(path.node)
112
- .find(j.VariableDeclarator)
113
- .find(j.Identifier)
114
- .filter((identifier) => {
115
- return identifier.node.name === identifierName;
116
- }).length;
117
- });
118
- return !!occurance.length ? occurance : false;
119
- }
120
-
121
- // not replacing newlines (which \s does)
122
- const spacesAndTabs: RegExp = /[ \t]{2,}/g;
123
- const lineStartWithSpaces: RegExp = /^[ \t]*/gm;
124
-
125
- function clean(value: string): string {
126
- return (
127
- value
128
- .replace(spacesAndTabs, ' ')
129
- .replace(lineStartWithSpaces, '')
130
- // using .trim() to clear the any newlines before the first text and after last text
131
- .trim()
132
- );
133
- }
134
-
135
- export function addCommentToStartOfFile({
136
- j,
137
- base,
138
- message,
139
- }: {
140
- j: core.JSCodeshift;
141
- base: Collection<Node>;
142
- message: string;
143
- }): void {
144
- addCommentBefore({
145
- j,
146
- target: base.find(j.Program),
147
- message,
148
- });
149
- }
150
-
151
- export function addCommentBefore({
152
- j,
153
- target,
154
- message,
155
- }: {
156
- j: core.JSCodeshift;
157
- target: Collection<Program> | Collection<ImportDeclaration>;
158
- message: string;
159
- }): void {
160
- const content: string = ` TODO: (from codemod) ${clean(message)} `;
161
- target.forEach((path: ASTPath<Program | ImportDeclaration>) => {
162
- path.value.comments = path.value.comments || [];
163
-
164
- const exists = path.value.comments.find((comment) => comment.value === content);
165
-
166
- // avoiding duplicates of the same comment
167
- if (exists) {
168
- return;
169
- }
170
-
171
- path.value.comments.push(j.commentBlock(content));
172
- });
173
- }
174
-
175
- export function tryCreateImport({
176
- j,
177
- base,
178
- relativeToPackage,
179
- packageName,
180
- }: {
181
- j: core.JSCodeshift;
182
- base: Collection<any>;
183
- relativeToPackage: string;
184
- packageName: string;
185
- }): void {
186
- const exists: boolean =
187
- base.find(j.ImportDeclaration).filter((path) => path.value.source.value === packageName)
188
- .length > 0;
189
-
190
- if (exists) {
191
- return;
192
- }
193
-
194
- base
195
- .find(j.ImportDeclaration)
196
- .filter((path) => path.value.source.value === relativeToPackage)
197
- .insertBefore(j.importDeclaration([], j.literal(packageName)));
198
- }
199
-
200
- export function addToImport({
201
- j,
202
- base,
203
- importSpecifier,
204
- packageName,
205
- }: {
206
- j: core.JSCodeshift;
207
- base: Collection<any>;
208
- importSpecifier: ImportSpecifier | ImportDefaultSpecifier;
209
- packageName: string;
210
- }): void {
211
- base
212
- .find(j.ImportDeclaration)
213
- .filter((path) => path.value.source.value === packageName)
214
- .replaceWith((declaration) => {
215
- return j.importDeclaration(
216
- [
217
- // we are appending to the existing specifiers
218
- // We are doing a filter hear because sometimes specifiers can be removed
219
- // but they hand around in the declaration
220
- ...(declaration.value.specifiers || []).filter(
221
- (item) => item.type === 'ImportSpecifier' && item.imported != null,
222
- ),
223
- importSpecifier,
224
- ],
225
- j.literal(packageName),
226
- );
227
- });
228
- }
229
-
230
- export const createRenameFuncFor: (
231
- component: string,
232
- importName: string,
233
- from: string,
234
- to: string,
235
- ) => (j: core.JSCodeshift, source: Collection<Node>) => void =
236
- (component: string, importName: string, from: string, to: string) =>
237
- (j: core.JSCodeshift, source: Collection<Node>) => {
238
- const specifier = getNamedSpecifier(j, source, component, importName);
239
-
240
- if (!specifier) {
241
- return;
242
- }
243
-
244
- source.findJSXElements(specifier).forEach((element) => {
245
- getJSXAttributesByName(j, element, from).forEach((attribute) => {
246
- j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(to), attribute.node.value));
247
- });
248
- });
249
-
250
- let variable = hasVariableAssignment(j, source, specifier);
251
- if (variable) {
252
- (variable as Collection<VariableDeclaration>)
253
- .find(j.VariableDeclarator)
254
- .forEach((declarator) => {
255
- j(declarator)
256
- .find(j.Identifier)
257
- .filter((identifier) => identifier.name === 'id')
258
- .forEach((ids) => {
259
- findIdentifierAndReplaceAttribute(j, source, ids.node.name, from, to);
260
- });
261
- });
262
- }
263
- };
264
-
265
- export const createRemoveFuncFor: (
266
- component: string,
267
- importName: string,
268
- prop: string,
269
- comment?: string,
270
- ) => (j: core.JSCodeshift, source: Collection<Node>) => void =
271
- (component: string, importName: string, prop: string, comment?: string) =>
272
- (j: core.JSCodeshift, source: Collection<Node>) => {
273
- const specifier =
274
- getNamedSpecifier(j, source, component, importName) ||
275
- getDefaultSpecifier(j, source, component);
276
-
277
- if (!specifier) {
278
- return;
279
- }
280
-
281
- source.findJSXElements(specifier).forEach((element) => {
282
- getJSXAttributesByName(j, element, prop).forEach((attribute) => {
283
- j(attribute).remove();
284
- if (comment) {
285
- addCommentToStartOfFile({ j, base: source, message: comment });
286
- }
287
- });
288
- });
289
- };
290
-
291
- export const createRenameImportFor: ({
292
- componentName,
293
- newComponentName,
294
- oldPackagePath,
295
- newPackagePath,
296
- }: {
297
- componentName: string;
298
- newComponentName?: string;
299
- oldPackagePath: string;
300
- newPackagePath: string;
301
- }) => (j: core.JSCodeshift, source: Collection<Node>) => void =
302
- ({
303
- componentName,
304
- newComponentName,
305
- oldPackagePath,
306
- newPackagePath,
307
- }: {
308
- componentName: string;
309
- newComponentName?: string;
310
- oldPackagePath: string;
311
- newPackagePath: string;
312
- }) =>
313
- (j: core.JSCodeshift, source: Collection<Node>) => {
314
- const isUsingName: boolean =
315
- source
316
- .find(j.ImportDeclaration)
317
- .filter((path) => path.node.source.value === oldPackagePath)
318
- .find(j.ImportSpecifier)
319
- .nodes()
320
- .filter((specifier) => specifier.imported && specifier.imported.name === componentName)
321
- .length > 0;
322
- if (!isUsingName) {
323
- return;
324
- }
325
-
326
- const existingAlias: Nullable<string> =
327
- source
328
- .find(j.ImportDeclaration)
329
- .filter((path) => path.node.source.value === oldPackagePath)
330
- .find(j.ImportSpecifier)
331
- .nodes()
332
- .map((specifier): Nullable<string> => {
333
- if (specifier.imported && specifier.imported.name !== componentName) {
334
- return null;
335
- }
336
- // If aliased: return the alias
337
- if (specifier.local && specifier.local.name !== componentName) {
338
- return specifier.local.name;
339
- }
340
-
341
- return null;
342
- })
343
- .filter(Boolean)[0] || null;
344
-
345
- // Check to see if need to create new package path
346
- // Try create an import declaration just before the old import
347
- tryCreateImport({
348
- j,
349
- base: source,
350
- relativeToPackage: oldPackagePath,
351
- packageName: newPackagePath,
352
- });
353
-
354
- const newSpecifier: ImportSpecifier | ImportDefaultSpecifier = (() => {
355
- // If there's a new name use that
356
- if (newComponentName) {
357
- return j.importSpecifier(j.identifier(newComponentName), j.identifier(newComponentName));
358
- }
359
-
360
- if (existingAlias) {
361
- return j.importSpecifier(j.identifier(componentName), j.identifier(existingAlias));
362
- }
363
-
364
- // Add specifier
365
- return j.importSpecifier(j.identifier(componentName), j.identifier(componentName));
366
- })();
367
-
368
- addToImport({
369
- j,
370
- base: source,
371
- importSpecifier: newSpecifier,
372
- packageName: newPackagePath,
373
- });
374
-
375
- // Remove old path
376
- source
377
- .find(j.ImportDeclaration)
378
- .filter((path) => path.node.source.value === oldPackagePath)
379
- .remove();
380
- };
381
-
382
- export const createRemoveImportsFor: ({
383
- importsToRemove,
384
- packagePath,
385
- comment,
386
- }: {
387
- importsToRemove: string[];
388
- packagePath: string;
389
- comment: string;
390
- }) => (j: core.JSCodeshift, source: Collection<Node>) => void =
391
- ({
392
- importsToRemove,
393
- packagePath,
394
- comment,
395
- }: {
396
- importsToRemove: string[];
397
- packagePath: string;
398
- comment: string;
399
- }) =>
400
- (j: core.JSCodeshift, source: Collection<Node>) => {
401
- const isUsingName: boolean =
402
- source.find(j.ImportDeclaration).filter((path) => path.node.source.value === packagePath)
403
- .length > 0;
404
- if (!isUsingName) {
405
- return;
406
- }
407
-
408
- const existingAlias: Nullable<string> =
409
- source
410
- .find(j.ImportDeclaration)
411
- .filter((path) => path.node.source.value === packagePath)
412
- .find(j.ImportSpecifier)
413
- .nodes()
414
- .map((specifier): Nullable<string> => {
415
- if (!importsToRemove.includes(specifier.imported.name)) {
416
- return null;
417
- }
418
- // If aliased: return the alias
419
- if (specifier.local && !importsToRemove.includes(specifier.local.name)) {
420
- return specifier.local.name;
421
- }
422
-
423
- return null;
424
- })
425
- .filter(Boolean)[0] || null;
426
-
427
- // Remove imports
428
- source
429
- .find(j.ImportDeclaration)
430
- .filter((path) => path.node.source.value === packagePath)
431
- .find(j.ImportSpecifier)
432
- .find(j.Identifier)
433
- .filter((identifier) => {
434
- if (
435
- importsToRemove.includes(identifier.value.name) ||
436
- identifier.value.name === existingAlias
437
- ) {
438
- addCommentToStartOfFile({ j, base: source, message: comment });
439
- return true;
440
- }
441
- return false;
442
- })
443
- .remove();
444
-
445
- // Remove entire import if it is empty
446
- const isEmptyImport =
447
- source
448
- .find(j.ImportDeclaration)
449
- .filter((path) => path.node.source.value === packagePath)
450
- .find(j.ImportSpecifier)
451
- .find(j.Identifier).length === 0;
452
- if (isEmptyImport) {
453
- source
454
- .find(j.ImportDeclaration)
455
- .filter((path) => path.node.source.value === packagePath)
456
- .remove();
457
- }
458
- };
459
-
460
- export const createTransformer: (
461
- component: string,
462
- migrates: {
463
- (j: core.JSCodeshift, source: Collection<Node>): void;
464
- }[],
465
- ) => (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string =
466
- (component: string, migrates: { (j: core.JSCodeshift, source: Collection<Node>): void }[]) =>
467
- (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => {
468
- const source: Collection<Node> = jscodeshift(fileInfo.source);
469
-
470
- if (!hasImportDeclaration(jscodeshift, source, component)) {
471
- return fileInfo.source;
472
- }
473
-
474
- migrates.forEach((tf) => tf(jscodeshift, source));
475
-
476
- return source.toSource(options.printOptions || { quote: 'single' });
477
- };