ember-codemod-add-component-signatures 5.5.1 → 5.6.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/dist/src/utils/analyze-project/find-arguments.js +2 -5
- package/dist/src/utils/analyze-project/find-blocks.js +1 -2
- package/dist/src/utils/analyze-project/find-element.js +1 -2
- package/dist/src/utils/components/get-base-component.js +1 -2
- package/dist/src/utils/create-registries/create-registry.js +1 -2
- package/dist/src/utils/create-registries/has-registry.js +1 -2
- package/dist/src/utils/create-registries/rename-component/pass-component-name-to-base-component.js +1 -2
- package/dist/src/utils/create-registries/rename-component/update-references.js +1 -2
- package/dist/src/utils/create-signatures/create-signature/pass-signature-to-base-component.js +1 -2
- package/dist/src/utils/create-signatures/create-signature/update-constructor.js +1 -2
- package/dist/src/utils/create-signatures/create-signature/update-reference.js +1 -2
- package/dist/src/utils/update-signatures/update-signature.js +1 -2
- package/package.json +8 -8
|
@@ -5,9 +5,7 @@ function analyzeClass(file) {
|
|
|
5
5
|
if (file === undefined) {
|
|
6
6
|
return args;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
const traverse = ASTJavaScript.traverse(true);
|
|
10
|
-
traverse(file, {
|
|
8
|
+
ASTJavaScript.traverse(file, {
|
|
11
9
|
visitMemberExpression(path) {
|
|
12
10
|
this.traverse(path);
|
|
13
11
|
if (path.node.object.type !== 'MemberExpression' ||
|
|
@@ -82,9 +80,8 @@ function analyzeClass(file) {
|
|
|
82
80
|
return args;
|
|
83
81
|
}
|
|
84
82
|
function analyzeTemplate(file) {
|
|
85
|
-
const traverse = ASTTemplate.traverse();
|
|
86
83
|
const args = new Set();
|
|
87
|
-
traverse(file, {
|
|
84
|
+
ASTTemplate.traverse(file, {
|
|
88
85
|
PathExpression(node) {
|
|
89
86
|
if (node.head.type !== 'AtHead') {
|
|
90
87
|
return;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-template';
|
|
2
2
|
import { getBlockParameterType, normalizeBlockName, } from '../components/index.js';
|
|
3
3
|
export function findBlocks(templateFile) {
|
|
4
|
-
const traverse = AST.traverse();
|
|
5
4
|
const blocksMap = new Map();
|
|
6
|
-
traverse(templateFile, {
|
|
5
|
+
AST.traverse(templateFile, {
|
|
7
6
|
MustacheStatement(node) {
|
|
8
7
|
if (node.path.type !== 'PathExpression' ||
|
|
9
8
|
node.path.original !== 'yield') {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-template';
|
|
2
2
|
import { getHtmlInterface } from '../components/index.js';
|
|
3
3
|
export function findElement(templateFile) {
|
|
4
|
-
const traverse = AST.traverse();
|
|
5
4
|
const htmlInterfaces = new Set();
|
|
6
|
-
traverse(templateFile, {
|
|
5
|
+
AST.traverse(templateFile, {
|
|
7
6
|
ElementNode(node) {
|
|
8
7
|
const hasSplattributes = node.attributes.find(({ name }) => {
|
|
9
8
|
return name === '...attributes';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function getBaseComponent(file) {
|
|
3
|
-
const traverse = AST.traverse(true);
|
|
4
3
|
let baseComponentName;
|
|
5
4
|
let importPath;
|
|
6
|
-
traverse(file, {
|
|
5
|
+
AST.traverse(file, {
|
|
7
6
|
visitImportDeclaration(path) {
|
|
8
7
|
switch (path.node.source.value) {
|
|
9
8
|
case '@ember/component':
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function createRegistry(file, data) {
|
|
3
|
-
const
|
|
4
|
-
const ast = traverse(file);
|
|
3
|
+
const ast = AST.traverse(file);
|
|
5
4
|
const registryEntries = AST.builders.tsInterfaceBody([
|
|
6
5
|
AST.builders.tsPropertySignature(AST.builders.stringLiteral(data.entity.doubleColonizedName), AST.builders.tsTypeAnnotation(AST.builders.tsTypeQuery(AST.builders.identifier(data.entity.pascalizedName)))),
|
|
7
6
|
AST.builders.tsPropertySignature(AST.builders.stringLiteral(data.entity.name), AST.builders.tsTypeAnnotation(AST.builders.tsTypeQuery(AST.builders.identifier(data.entity.pascalizedName)))),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function hasRegistry(file) {
|
|
3
|
-
const traverse = AST.traverse(true);
|
|
4
3
|
let hasRegistry = false;
|
|
5
|
-
traverse(file, {
|
|
4
|
+
AST.traverse(file, {
|
|
6
5
|
visitTSModuleDeclaration(path) {
|
|
7
6
|
if (path.node.id.type !== 'StringLiteral') {
|
|
8
7
|
return false;
|
package/dist/src/utils/create-registries/rename-component/pass-component-name-to-base-component.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function passComponentNameToBaseComponent(file, options) {
|
|
3
|
-
const traverse = AST.traverse(true);
|
|
4
3
|
const { baseComponentName, data } = options;
|
|
5
4
|
let componentName;
|
|
6
|
-
const ast = traverse(file, {
|
|
5
|
+
const ast = AST.traverse(file, {
|
|
7
6
|
visitClassDeclaration(path) {
|
|
8
7
|
if (!path.node.superClass ||
|
|
9
8
|
path.node.superClass.type !== 'Identifier' ||
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function updateReferences(file, options) {
|
|
3
|
-
const traverse = AST.traverse(true);
|
|
4
3
|
const { baseComponentName, componentName, data } = options;
|
|
5
|
-
const ast = traverse(file, {
|
|
4
|
+
const ast = AST.traverse(file, {
|
|
6
5
|
visitExportDefaultDeclaration(path) {
|
|
7
6
|
switch (path.node.declaration.type) {
|
|
8
7
|
case 'CallExpression': {
|
package/dist/src/utils/create-signatures/create-signature/pass-signature-to-base-component.js
CHANGED
|
@@ -2,10 +2,9 @@ import { AST } from '@codemod-utils/ast-javascript';
|
|
|
2
2
|
import { builderConvertArgsToSignature, builderCreateSignature, builderPassSignature, } from './builders.js';
|
|
3
3
|
import { isSignature } from './is-signature.js';
|
|
4
4
|
export function passSignatureToBaseComponent(file, options) {
|
|
5
|
-
const traverse = AST.traverse(true);
|
|
6
5
|
const { baseComponentName, data } = options;
|
|
7
6
|
let interfaceName;
|
|
8
|
-
const ast = traverse(file, {
|
|
7
|
+
const ast = AST.traverse(file, {
|
|
9
8
|
visitCallExpression(path) {
|
|
10
9
|
if (path.node.callee.type !== 'Identifier') {
|
|
11
10
|
return false;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AST } from '@codemod-utils/ast-javascript';
|
|
2
2
|
export function updateConstructor(file, options) {
|
|
3
|
-
const traverse = AST.traverse(true);
|
|
4
3
|
const { data } = options;
|
|
5
|
-
const ast = traverse(file, {
|
|
4
|
+
const ast = AST.traverse(file, {
|
|
6
5
|
visitClassMethod(path) {
|
|
7
6
|
if (path.node.kind !== 'constructor' || path.node.params.length !== 2) {
|
|
8
7
|
return false;
|
|
@@ -2,9 +2,8 @@ import { AST } from '@codemod-utils/ast-javascript';
|
|
|
2
2
|
import { builderConvertArgsToSignature, builderCreateSignature, } from './builders.js';
|
|
3
3
|
import { isSignature } from './is-signature.js';
|
|
4
4
|
export function updateReferences(file, options) {
|
|
5
|
-
const traverse = AST.traverse(true);
|
|
6
5
|
const { interfaceName, data } = options;
|
|
7
|
-
const ast = traverse(file, {
|
|
6
|
+
const ast = AST.traverse(file, {
|
|
8
7
|
visitTSInterfaceDeclaration(path) {
|
|
9
8
|
if (path.node.id.type !== 'Identifier' ||
|
|
10
9
|
path.node.id.name !== interfaceName) {
|
|
@@ -10,9 +10,8 @@ function getBodyNode(node, key) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
export function updateSignature(file, data) {
|
|
13
|
-
const traverse = AST.traverse(true);
|
|
14
13
|
const identifier = `${data.entity.pascalizedName}Signature`;
|
|
15
|
-
const ast = traverse(file, {
|
|
14
|
+
const ast = AST.traverse(file, {
|
|
16
15
|
visitTSInterfaceDeclaration(path) {
|
|
17
16
|
if (path.node.id.type !== 'Identifier' ||
|
|
18
17
|
path.node.id.name !== identifier) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-add-component-signatures",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Codemod to add component signatures",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codemod-utils/ast-javascript": "^
|
|
28
|
-
"@codemod-utils/ast-template": "^
|
|
29
|
-
"@codemod-utils/ast-template-tag": "^2.
|
|
27
|
+
"@codemod-utils/ast-javascript": "^4.0.1",
|
|
28
|
+
"@codemod-utils/ast-template": "^4.0.0",
|
|
29
|
+
"@codemod-utils/ast-template-tag": "^2.6.0",
|
|
30
30
|
"@codemod-utils/blueprints": "^3.1.0",
|
|
31
31
|
"@codemod-utils/ember": "^4.1.1",
|
|
32
32
|
"@codemod-utils/files": "^4.0.1",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"@changesets/cli": "^2.31.0",
|
|
39
39
|
"@codemod-utils/tests": "^3.0.2",
|
|
40
40
|
"@ijlee2-frontend-configs/changesets": "^2.1.1",
|
|
41
|
-
"@ijlee2-frontend-configs/eslint-config-node": "^3.
|
|
42
|
-
"@ijlee2-frontend-configs/prettier": "^3.1.
|
|
41
|
+
"@ijlee2-frontend-configs/eslint-config-node": "^3.4.2",
|
|
42
|
+
"@ijlee2-frontend-configs/prettier": "^3.1.1",
|
|
43
43
|
"@sondr3/minitest": "^0.1.2",
|
|
44
44
|
"@tsconfig/node22": "^22.0.5",
|
|
45
45
|
"@tsconfig/strictest": "^2.0.8",
|
|
46
|
-
"@types/node": "^22.19.
|
|
46
|
+
"@types/node": "^22.19.19",
|
|
47
47
|
"@types/yargs": "^17.0.35",
|
|
48
|
-
"concurrently": "^
|
|
48
|
+
"concurrently": "^10.0.0",
|
|
49
49
|
"eslint": "^9.39.4",
|
|
50
50
|
"prettier": "^3.8.3",
|
|
51
51
|
"typescript": "^5.9.3"
|