@atlaskit/codemod-utils 4.2.5 → 4.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/codemod-utils
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f768b61932518`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f768b61932518) -
8
+ Autofix: add explicit package exports (barrel removal)
9
+
3
10
  ## 4.2.5
4
11
 
5
12
  ### Patch Changes
@@ -109,16 +116,13 @@
109
116
  @atlaskit/adf-schema to their own entry points. These new entry points are as follows
110
117
 
111
118
  @atlaskit/adf-schema/schema-bitbucket for:
112
-
113
119
  - bitbucketSchema
114
120
 
115
121
  @atlaskit/adf-schema/schema-confluence for:
116
-
117
122
  - confluenceSchema
118
123
  - confluenceSchemaWithMediaSingle
119
124
 
120
125
  @atlaskit/adf-schema/schema-jira for:
121
-
122
126
  - default as createJIRASchema
123
127
  - isSchemaWithLists
124
128
  - isSchemaWithMentions
@@ -133,7 +137,6 @@
133
137
  - isSchemaWithTables
134
138
 
135
139
  @atlaskit/adf-schema/schema-default for:
136
-
137
140
  - defaultSchema
138
141
  - getSchemaBasedOnStage
139
142
  - defaultSchemaConfig
@@ -202,7 +205,6 @@
202
205
  - [#10787](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10787)
203
206
  [`2ec9e608acc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2ec9e608acc) - Update
204
207
  `addCommentBefore` helper method to:
205
-
206
208
  - Make the message prefix optional.
207
209
  - _The default remains as `TODO: (from codemod)` for backwards compatibility_
208
210
  - Support both block & line comment output.
@@ -263,7 +265,6 @@
263
265
  - [#8169](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/8169)
264
266
  [`7e295f4d9da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7e295f4d9da) - Added
265
267
  more lower level helpers for writing codemod:
266
-
267
268
  - getDefaultSpecifier
268
269
  - getNamedSpecifier
269
270
  - hasJSXAttributesByName
@@ -73,7 +73,7 @@ const replaceImportStatementFor = (pkg, convertMap) => (j, root) => {
73
73
  });
74
74
  };
75
75
  exports.replaceImportStatementFor = replaceImportStatementFor;
76
- const createRenameImportFor = (component, from, to) => (j, source) => {
76
+ const createRenameImportFor = (component, _, to) => (j, source) => {
77
77
  source.find(j.ImportDeclaration).filter(path => path.node.source.value === component).forEach(path => {
78
78
  j(path).replaceWith(j.importDeclaration(path.value.specifiers, j.literal(to)));
79
79
  });
@@ -63,7 +63,7 @@ const replaceImportStatementFor = (pkg, convertMap) => (j, root) => {
63
63
  j(path).insertAfter(otherDeclarations);
64
64
  });
65
65
  };
66
- const createRenameImportFor = (component, from, to) => (j, source) => {
66
+ const createRenameImportFor = (component, _, to) => (j, source) => {
67
67
  source.find(j.ImportDeclaration).filter(path => path.node.source.value === component).forEach(path => {
68
68
  j(path).replaceWith(j.importDeclaration(path.value.specifiers, j.literal(to)));
69
69
  });
@@ -81,7 +81,7 @@ var replaceImportStatementFor = function replaceImportStatementFor(pkg, convertM
81
81
  });
82
82
  };
83
83
  };
84
- var createRenameImportFor = function createRenameImportFor(component, from, to) {
84
+ var createRenameImportFor = function createRenameImportFor(component, _, to) {
85
85
  return function (j, source) {
86
86
  source.find(j.ImportDeclaration).filter(function (path) {
87
87
  return path.node.source.value === component;
@@ -1,2 +1,3 @@
1
1
  export { createRenameFuncFor, createConvertFuncFor, createRenameImportFor, createRemoveFuncFor, replaceImportStatementFor, elevateComponentToNewEntryPoint, createTransformer, renameNamedImportWithAliasName, flattenCertainChildPropsAsProp, createRenameJSXFunc, createRemoveFuncAddCommentFor, changeImportEntryPoint, } from './utils';
2
2
  export { getDefaultSpecifier, getNamedSpecifier, getJSXAttributesByName, hasJSXAttributesByName, doesIdentifierExist, hasImportDeclaration, hasImportDeclarationFromAnyPackageEntrypoint, addCommentBefore, addCommentToStartOfFile, callExpressionArgMatchesString, testMethodVariantEach, getSafeImportName, removeImport, getDynamicImportName, addDynamicImport, tryCreateImport, addToImport, } from './utils/support';
3
+ export type { API, FileInfo, Options, JSCodeshift, Collection, Node } from 'jscodeshift';
@@ -1,10 +1,12 @@
1
1
  import type { API, ASTPath, Collection, default as core, FileInfo, Options } from 'jscodeshift';
2
2
  declare 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;
3
3
  declare const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
4
- declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
4
+ declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: (value: any) => boolean) => (j: core.JSCodeshift, source: Collection<Node>) => void;
5
5
  declare const replaceImportStatementFor: (pkg: string, convertMap: any) => (j: core.JSCodeshift, root: Collection<Node>) => void;
6
- declare const createRenameImportFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
7
- 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;
6
+ declare const createRenameImportFor: (component: string, _: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
7
+ declare const createTransformer: (migrates: {
8
+ (j: core.JSCodeshift, source: Collection<Node>): void;
9
+ }[], shouldApplyTransform?: (j: core.JSCodeshift, source: Collection<Node>) => boolean) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
8
10
  declare const elevateComponentToNewEntryPoint: (pkg: string, toPkg: string, innerElementName: string) => (j: core.JSCodeshift, root: any) => void;
9
11
  declare const flattenCertainChildPropsAsProp: (component: string, propName: string, childProps: string[]) => (j: core.JSCodeshift, source: Collection<Node>) => void;
10
12
  declare const createRenameJSXFunc: (packagePath: string, from: string, to: string, fallback?: string | undefined) => (j: core.JSCodeshift, source: any) => void;
@@ -28,7 +28,7 @@ export declare function placeholderStringMatches(placeholderStr: string, resolve
28
28
  * @returns Boolean: True if the strings matched (after considering the placeholder), or false if not.
29
29
  */
30
30
  export declare function matchesStringWithFormatSpecifier(argValue: string | number | boolean | RegExp | null, str: string): boolean;
31
- declare const callExpressionArgMatchesString: (arg: CallExpression['arguments'][number], str: string) => boolean;
31
+ declare const callExpressionArgMatchesString: (arg: CallExpression["arguments"][number], str: string) => boolean;
32
32
  declare const testMethodVariantEach: (path: ASTPath<CallExpression>, testMethods: Set<string>) => boolean;
33
33
  declare const hasJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => boolean;
34
34
  declare const doesIdentifierExist: (j: core.JSCodeshift, base: Collection<any>, name: string) => boolean;
@@ -1,2 +1,3 @@
1
1
  export { createRenameFuncFor, createConvertFuncFor, createRenameImportFor, createRemoveFuncFor, replaceImportStatementFor, elevateComponentToNewEntryPoint, createTransformer, renameNamedImportWithAliasName, flattenCertainChildPropsAsProp, createRenameJSXFunc, createRemoveFuncAddCommentFor, changeImportEntryPoint, } from './utils';
2
2
  export { getDefaultSpecifier, getNamedSpecifier, getJSXAttributesByName, hasJSXAttributesByName, doesIdentifierExist, hasImportDeclaration, hasImportDeclarationFromAnyPackageEntrypoint, addCommentBefore, addCommentToStartOfFile, callExpressionArgMatchesString, testMethodVariantEach, getSafeImportName, removeImport, getDynamicImportName, addDynamicImport, tryCreateImport, addToImport, } from './utils/support';
3
+ export type { API, FileInfo, Options, JSCodeshift, Collection, Node } from 'jscodeshift';
@@ -1,10 +1,12 @@
1
1
  import type { API, ASTPath, Collection, default as core, FileInfo, Options } from 'jscodeshift';
2
2
  declare 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;
3
3
  declare const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
4
- declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
4
+ declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: (value: any) => boolean) => (j: core.JSCodeshift, source: Collection<Node>) => void;
5
5
  declare const replaceImportStatementFor: (pkg: string, convertMap: any) => (j: core.JSCodeshift, root: Collection<Node>) => void;
6
- declare const createRenameImportFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
7
- 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;
6
+ declare const createRenameImportFor: (component: string, _: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
7
+ declare const createTransformer: (migrates: {
8
+ (j: core.JSCodeshift, source: Collection<Node>): void;
9
+ }[], shouldApplyTransform?: (j: core.JSCodeshift, source: Collection<Node>) => boolean) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
8
10
  declare const elevateComponentToNewEntryPoint: (pkg: string, toPkg: string, innerElementName: string) => (j: core.JSCodeshift, root: any) => void;
9
11
  declare const flattenCertainChildPropsAsProp: (component: string, propName: string, childProps: string[]) => (j: core.JSCodeshift, source: Collection<Node>) => void;
10
12
  declare const createRenameJSXFunc: (packagePath: string, from: string, to: string, fallback?: string | undefined) => (j: core.JSCodeshift, source: any) => void;
@@ -28,7 +28,7 @@ export declare function placeholderStringMatches(placeholderStr: string, resolve
28
28
  * @returns Boolean: True if the strings matched (after considering the placeholder), or false if not.
29
29
  */
30
30
  export declare function matchesStringWithFormatSpecifier(argValue: string | number | boolean | RegExp | null, str: string): boolean;
31
- declare const callExpressionArgMatchesString: (arg: CallExpression['arguments'][number], str: string) => boolean;
31
+ declare const callExpressionArgMatchesString: (arg: CallExpression["arguments"][number], str: string) => boolean;
32
32
  declare const testMethodVariantEach: (path: ASTPath<CallExpression>, testMethods: Set<string>) => boolean;
33
33
  declare const hasJSXAttributesByName: (j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) => boolean;
34
34
  declare const doesIdentifierExist: (j: core.JSCodeshift, base: Collection<any>, name: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-utils",
3
- "version": "4.2.5",
3
+ "version": "4.3.0",
4
4
  "author": "Atlassian Pty Ltd",
5
5
  "license": "Apache-2.0",
6
6
  "description": " jscodeshift-compatible codemod utilities",
@@ -8,7 +8,10 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Build Infra"
11
+ "team": "Build Infra",
12
+ "toolingLabels": [
13
+ "codemods"
14
+ ]
12
15
  },
13
16
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
14
17
  "main": "dist/cjs/index.js",
@@ -25,16 +28,12 @@
25
28
  },
26
29
  "sideEffects": false,
27
30
  "atlaskit:src": "src/index.ts",
28
- "af:exports": {
29
- ".": "./src/index.ts"
30
- },
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.0.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/jscodeshift": "^0.11.0",
36
- "jscodeshift": "^0.16.1",
37
- "typescript": "~5.4.2"
36
+ "jscodeshift": "^17.0.0"
38
37
  },
39
38
  "techstack": {
40
39
  "@atlassian/frontend": {
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/codemod-utils/support",
3
+ "main": "../dist/cjs/utils/support.js",
4
+ "module": "../dist/esm/utils/support.js",
5
+ "module:es2019": "../dist/es2019/utils/support.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/utils/support.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/utils/support.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/codemod-utils/utils",
3
+ "main": "../dist/cjs/utils/index.js",
4
+ "module": "../dist/esm/utils/index.js",
5
+ "module:es2019": "../dist/es2019/utils/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/utils/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/utils/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }