ember-codemod-remove-inject-as-service 3.1.1 → 3.2.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.
@@ -2,16 +2,15 @@ import { AST } from '@codemod-utils/ast-javascript';
2
2
  function isValueImport(importKind) {
3
3
  return importKind === undefined || importKind === 'value';
4
4
  }
5
- function updateImportStatement(file, data) {
5
+ function updateImportStatement(file) {
6
6
  let localName;
7
- const traverse = AST.traverse(data.isTypeScript);
8
- const ast = traverse(file, {
7
+ const ast = AST.traverse(file, {
9
8
  visitImportDeclaration(path) {
10
9
  const { importKind, source, specifiers } = path.node;
11
10
  if (!isValueImport(importKind)) {
12
11
  return false;
13
12
  }
14
- if (source.type !== 'Literal' && source.type !== 'StringLiteral') {
13
+ if (source.type !== 'StringLiteral') {
15
14
  return false;
16
15
  }
17
16
  if (source.value !== '@ember/service' || !Array.isArray(specifiers)) {
@@ -42,8 +41,7 @@ function updateImportStatement(file, data) {
42
41
  };
43
42
  }
44
43
  function updateServiceDecorators(file, data) {
45
- const traverse = AST.traverse(data.isTypeScript);
46
- const ast = traverse(file, {
44
+ const ast = AST.traverse(file, {
47
45
  visitCallExpression(path) {
48
46
  this.traverse(path);
49
47
  switch (path.node.callee.type) {
@@ -104,9 +102,7 @@ function updateServiceDecorators(file, data) {
104
102
  export function updateClass(file, data) {
105
103
  const { isTypeScript } = data;
106
104
  // eslint-disable-next-line prefer-const
107
- let { localName, newFile } = updateImportStatement(file, {
108
- isTypeScript,
109
- });
105
+ let { localName, newFile } = updateImportStatement(file);
110
106
  if (!localName) {
111
107
  return file;
112
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-codemod-remove-inject-as-service",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Codemod to remove `inject as service`",
5
5
  "keywords": [
6
6
  "codemod",
@@ -20,8 +20,8 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@codemod-utils/ast-javascript": "^3.0.2",
24
- "@codemod-utils/ast-template-tag": "^2.3.0",
23
+ "@codemod-utils/ast-javascript": "^4.0.1",
24
+ "@codemod-utils/ast-template-tag": "^2.6.0",
25
25
  "@codemod-utils/files": "^4.0.1",
26
26
  "yargs": "^18.0.0"
27
27
  },
@@ -29,14 +29,14 @@
29
29
  "@changesets/cli": "^2.31.0",
30
30
  "@codemod-utils/tests": "^3.0.2",
31
31
  "@ijlee2-frontend-configs/changesets": "^2.1.1",
32
- "@ijlee2-frontend-configs/eslint-config-node": "^3.3.0",
33
- "@ijlee2-frontend-configs/prettier": "^3.1.0",
32
+ "@ijlee2-frontend-configs/eslint-config-node": "^3.4.2",
33
+ "@ijlee2-frontend-configs/prettier": "^3.1.1",
34
34
  "@sondr3/minitest": "^0.1.2",
35
35
  "@tsconfig/node22": "^22.0.5",
36
36
  "@tsconfig/strictest": "^2.0.8",
37
- "@types/node": "^22.19.17",
37
+ "@types/node": "^22.19.19",
38
38
  "@types/yargs": "^17.0.35",
39
- "concurrently": "^9.2.1",
39
+ "concurrently": "^10.0.0",
40
40
  "eslint": "^9.39.4",
41
41
  "prettier": "^3.8.3",
42
42
  "typescript": "^5.9.3"