@atlaskit/codemod-cli 0.31.2 → 0.32.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.
Files changed (20) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/presets/badge-appearance-semantic-migration/badge-appearance-semantic-migration.js +44 -0
  3. package/dist/cjs/presets/badge-appearance-semantic-migration/codemods/badge-appearance-semantic-migration.js +145 -0
  4. package/dist/cjs/presets/index.js +2 -1
  5. package/dist/cjs/presets/lozenge-to-tag-migration/codemods/lozenge-to-tag-migration.js +23 -1
  6. package/dist/es2019/presets/badge-appearance-semantic-migration/badge-appearance-semantic-migration.js +18 -0
  7. package/dist/es2019/presets/badge-appearance-semantic-migration/codemods/badge-appearance-semantic-migration.js +144 -0
  8. package/dist/es2019/presets/index.js +2 -1
  9. package/dist/es2019/presets/lozenge-to-tag-migration/codemods/lozenge-to-tag-migration.js +23 -1
  10. package/dist/esm/presets/badge-appearance-semantic-migration/badge-appearance-semantic-migration.js +37 -0
  11. package/dist/esm/presets/badge-appearance-semantic-migration/codemods/badge-appearance-semantic-migration.js +139 -0
  12. package/dist/esm/presets/index.js +2 -1
  13. package/dist/esm/presets/lozenge-to-tag-migration/codemods/lozenge-to-tag-migration.js +23 -1
  14. package/dist/types/presets/badge-appearance-semantic-migration/badge-appearance-semantic-migration.d.ts +2 -0
  15. package/dist/types/presets/badge-appearance-semantic-migration/codemods/badge-appearance-semantic-migration.d.ts +10 -0
  16. package/dist/types/presets/index.d.ts +1 -0
  17. package/dist/types-ts4.5/presets/badge-appearance-semantic-migration/badge-appearance-semantic-migration.d.ts +2 -0
  18. package/dist/types-ts4.5/presets/badge-appearance-semantic-migration/codemods/badge-appearance-semantic-migration.d.ts +10 -0
  19. package/dist/types-ts4.5/presets/index.d.ts +1 -0
  20. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/codemod-cli
2
2
 
3
+ ## 0.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b866a7f72dab4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b866a7f72dab4) -
8
+ Updated lozenge-to-tag-migration codemod to handle variable lozenge children
9
+
10
+ ## 0.32.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`a5b157e56828d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a5b157e56828d) -
15
+ Add a new codemod `badge-appearance-semantic-migration` to migrate deprecated Badge appearances to
16
+ colorsas part of the Labelling System Phase 1 migration.
17
+
3
18
  ## 0.31.2
4
19
 
5
20
  ### Patch Changes
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _badgeAppearanceSemanticMigration = _interopRequireDefault(require("./codemods/badge-appearance-semantic-migration"));
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ function transformer(_x, _x2) {
15
+ return _transformer.apply(this, arguments);
16
+ }
17
+ function _transformer() {
18
+ _transformer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file, api) {
19
+ var transformers, src;
20
+ return _regenerator.default.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ transformers = [_badgeAppearanceSemanticMigration.default];
24
+ src = file.source;
25
+ transformers.forEach(function (transformer) {
26
+ if (typeof src === 'undefined') {
27
+ return;
28
+ }
29
+ var nextSrc = transformer(_objectSpread(_objectSpread({}, file), {}, {
30
+ source: src
31
+ }), api);
32
+ if (nextSrc) {
33
+ src = nextSrc;
34
+ }
35
+ });
36
+ return _context.abrupt("return", src);
37
+ case 4:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee);
42
+ }));
43
+ return _transformer.apply(this, arguments);
44
+ }
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformer;
7
+ var _utils = require("@hypermod/utils");
8
+ var _codemodUtils = require("@atlaskit/codemod-utils");
9
+ var BADGE_ENTRY_POINT = '@atlaskit/badge';
10
+ var PRINT_SETTINGS = {
11
+ quote: 'single'
12
+ };
13
+
14
+ // Old appearance values that map to new semantic appearance values
15
+ var OLD_TO_NEW_APPEARANCE_MAP = {
16
+ added: 'success',
17
+ removed: 'danger',
18
+ default: 'neutral',
19
+ primary: 'information',
20
+ primaryInverted: 'inverse',
21
+ important: 'danger'
22
+ };
23
+ /**
24
+ * Codemod to migrate Badge component appearance semantic values.
25
+ *
26
+ * This codemod:
27
+ * 1. Updates `appearance` prop values to new semantic values
28
+ * 2. Maps old semantic values to new semantic values (e.g. added → success, removed → danger, primary → information)
29
+ * 3. Adds comments for dynamic values that need manual verification
30
+ */
31
+ function transformer(file, api) {
32
+ var j = api.jscodeshift;
33
+ var source = j(file.source);
34
+
35
+ // Find all Badge imports
36
+ var badgeImports = (0, _utils.getImportDeclaration)(j, source, BADGE_ENTRY_POINT);
37
+
38
+ // If no Badge imports, exit early
39
+ if (!badgeImports.length) {
40
+ return file.source;
41
+ }
42
+
43
+ // Get all imported Badge identifiers (could be renamed)
44
+ var badgeIdentifiers = new Set();
45
+ badgeImports.forEach(function (importPath) {
46
+ var _importPath$value$spe;
47
+ (_importPath$value$spe = importPath.value.specifiers) === null || _importPath$value$spe === void 0 || _importPath$value$spe.forEach(function (specifier) {
48
+ var _specifier$imported;
49
+ if (specifier.type === 'ImportDefaultSpecifier') {
50
+ var _specifier$local;
51
+ // Handle: import Badge from '@atlaskit/badge'
52
+ badgeIdentifiers.add(((_specifier$local = specifier.local) === null || _specifier$local === void 0 ? void 0 : _specifier$local.name) || 'Badge');
53
+ } else if (specifier.type === 'ImportSpecifier' && ((_specifier$imported = specifier.imported) === null || _specifier$imported === void 0 ? void 0 : _specifier$imported.type) === 'Identifier' && specifier.imported.name === 'default') {
54
+ var _specifier$local2;
55
+ // Handle: import { default as MyBadge } from '@atlaskit/badge'
56
+ badgeIdentifiers.add(((_specifier$local2 = specifier.local) === null || _specifier$local2 === void 0 ? void 0 : _specifier$local2.name) || 'Badge');
57
+ }
58
+ });
59
+ });
60
+
61
+ // If no Badge identifiers found, exit early
62
+ if (badgeIdentifiers.size === 0) {
63
+ return file.source;
64
+ }
65
+
66
+ // Find all Badge JSX elements
67
+ var badgeElements = [];
68
+ source.find(j.JSXElement).forEach(function (path) {
69
+ var _openingElement$name;
70
+ var openingElement = path.value.openingElement;
71
+ if (((_openingElement$name = openingElement.name) === null || _openingElement$name === void 0 ? void 0 : _openingElement$name.type) === 'JSXIdentifier' && badgeIdentifiers.has(openingElement.name.name)) {
72
+ var _openingElement$attri;
73
+ var element = {
74
+ path: path,
75
+ hasAppearanceProp: false
76
+ };
77
+
78
+ // Check for appearance prop
79
+ (_openingElement$attri = openingElement.attributes) === null || _openingElement$attri === void 0 || _openingElement$attri.forEach(function (attr) {
80
+ var _attr$name;
81
+ if (attr.type === 'JSXAttribute' && ((_attr$name = attr.name) === null || _attr$name === void 0 ? void 0 : _attr$name.type) === 'JSXIdentifier') {
82
+ if (attr.name.name === 'appearance') {
83
+ var _attr$value, _attr$value2;
84
+ element.hasAppearanceProp = true;
85
+ if (((_attr$value = attr.value) === null || _attr$value === void 0 ? void 0 : _attr$value.type) === 'StringLiteral') {
86
+ element.appearanceValue = attr.value.value;
87
+ } else if (((_attr$value2 = attr.value) === null || _attr$value2 === void 0 ? void 0 : _attr$value2.type) === 'JSXExpressionContainer') {
88
+ // Handle dynamic values
89
+ var expression = attr.value.expression;
90
+ if (expression.type === 'StringLiteral') {
91
+ element.appearanceValue = expression.value;
92
+ } else {
93
+ element.appearanceValue = 'dynamic';
94
+ }
95
+ }
96
+ }
97
+ }
98
+ });
99
+ badgeElements.push(element);
100
+ }
101
+ });
102
+
103
+ // Process each Badge element
104
+ badgeElements.forEach(function (element) {
105
+ var path = element.path,
106
+ hasAppearanceProp = element.hasAppearanceProp,
107
+ appearanceValue = element.appearanceValue;
108
+ var openingElement = path.value.openingElement;
109
+
110
+ // Update appearance prop values to new semantic values
111
+ if (hasAppearanceProp) {
112
+ var _openingElement$attri2;
113
+ (_openingElement$attri2 = openingElement.attributes) === null || _openingElement$attri2 === void 0 || _openingElement$attri2.forEach(function (attr) {
114
+ var _attr$name2;
115
+ if (attr.type === 'JSXAttribute' && ((_attr$name2 = attr.name) === null || _attr$name2 === void 0 ? void 0 : _attr$name2.type) === 'JSXIdentifier' && attr.name.name === 'appearance') {
116
+ // Handle different types of appearance values
117
+ if (appearanceValue === 'dynamic') {
118
+ // For dynamic values, add a comment
119
+ (0, _codemodUtils.addCommentBefore)(j, j(path), "FIXME: This Badge component uses a dynamic `appearance` prop with updated semantic values.\nPlease verify that the values being passed use the new semantic values: neutral, information, inverse, danger, success.\nOld values mapping: default\u2192neutral, primary\u2192information, primaryInverted\u2192inverse, added\u2192success, removed\u2192danger, important\u2192danger.");
120
+ } else if (appearanceValue === 'primaryInverted') {
121
+ var _attr$value3;
122
+ // For primaryInverted, we need to add a comment since it maps to inverse
123
+ (0, _codemodUtils.addCommentBefore)(j, j(path), "FIXME: This Badge component used `appearance=\"primaryInverted\"` which has been migrated to `appearance=\"inverse\"`.\nPlease verify the visual appearance matches your expectations.");
124
+ // Update the value
125
+ if (((_attr$value3 = attr.value) === null || _attr$value3 === void 0 ? void 0 : _attr$value3.type) === 'StringLiteral') {
126
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
127
+ }
128
+ } else if (appearanceValue && !OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
129
+ // For invalid string values, add a warning comment
130
+ (0, _codemodUtils.addCommentBefore)(j, j(path), "FIXME: This Badge component uses an unknown `appearance` value \"".concat(appearanceValue, "\".\nValid new semantic appearance values are: ").concat(Object.values(OLD_TO_NEW_APPEARANCE_MAP).filter(function (v, i, arr) {
131
+ return arr.indexOf(v) === i;
132
+ }).join(', '), ".\nPlease update this value to a valid semantic appearance value."));
133
+ } else if (appearanceValue && OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
134
+ var _attr$value4;
135
+ // For valid string values, update the value to the new semantic value
136
+ if (((_attr$value4 = attr.value) === null || _attr$value4 === void 0 ? void 0 : _attr$value4.type) === 'StringLiteral') {
137
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
138
+ }
139
+ }
140
+ }
141
+ });
142
+ }
143
+ });
144
+ return source.toSource(PRINT_SETTINGS);
145
+ }
@@ -16,12 +16,13 @@ require("./remove-dark-theme-vr-options/remove-dark-theme-vr-options");
16
16
  require("./remove-token-fallbacks/remove-token-fallbacks");
17
17
  require("./lozenge-appearance-semantic-migration/lozenge-appearance-semantic-migration");
18
18
  require("./lozenge-to-tag-migration/lozenge-to-tag-migration");
19
+ require("./badge-appearance-semantic-migration/badge-appearance-semantic-migration");
19
20
  /**
20
21
  * Manually import presets to make sure typescript includes them
21
22
  * in the final bundle.
22
23
  */
23
24
 
24
- var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration'].map(function (preset) {
25
+ var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration', 'badge-appearance-semantic-migration'].map(function (preset) {
25
26
  return _path.default.join(__dirname, preset, "".concat(preset, ".@(ts|js|tsx)"));
26
27
  });
27
28
  var _default = exports.default = presets;
@@ -99,6 +99,8 @@ var transformer = function transformer(file, api) {
99
99
  var unknownAppearanceValue = '';
100
100
 
101
101
  // Process children to extract text
102
+ var hasVariableChild = false;
103
+ var variableChildExpression = null;
102
104
  if (element.children && element.children.length > 0) {
103
105
  if (element.children.length === 1) {
104
106
  var child = element.children[0];
@@ -109,7 +111,21 @@ var transformer = function transformer(file, api) {
109
111
  }
110
112
  } else if (j.JSXExpressionContainer.check(child) && j.StringLiteral.check(child.expression)) {
111
113
  textContent = child.expression.value;
114
+ } else if (j.JSXExpressionContainer.check(child)) {
115
+ // Check if it's a simple identifier (variable) or member expression
116
+ if (j.Identifier.check(child.expression)) {
117
+ hasVariableChild = true;
118
+ variableChildExpression = child.expression;
119
+ } else if (j.MemberExpression.check(child.expression)) {
120
+ // Handle member expressions like obj.prop
121
+ hasVariableChild = true;
122
+ variableChildExpression = child.expression;
123
+ } else {
124
+ // Complex expression or JSX element
125
+ hasComplexChildren = true;
126
+ }
112
127
  } else {
128
+ // JSX elements or other complex children
113
129
  hasComplexChildren = true;
114
130
  }
115
131
  } else {
@@ -159,8 +175,11 @@ var transformer = function transformer(file, api) {
159
175
  });
160
176
 
161
177
  // Assemble attributes in correct order: text, other props, color
162
- if (textContent && !hasComplexChildren) {
178
+ if (textContent && !hasComplexChildren && !hasVariableChild) {
163
179
  newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.stringLiteral(textContent)));
180
+ } else if (hasVariableChild && variableChildExpression) {
181
+ // Use the variable expression as the text prop
182
+ newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.jsxExpressionContainer(variableChildExpression)));
164
183
  }
165
184
 
166
185
  // Add other attributes
@@ -182,6 +201,9 @@ var transformer = function transformer(file, api) {
182
201
  if (hasComplexChildren) {
183
202
  warnings.push("FIXME: This Tag component has complex children that couldn't be automatically migrated to the text prop.\nTag component only supports simple text via the text prop. Please manually convert the children content.");
184
203
  }
204
+ if (hasVariableChild) {
205
+ warnings.push('FIXME: This Tag component uses a variable as the text prop. Please verify that the variable contains a string value.');
206
+ }
185
207
  if (hasMaxWidthProp) {
186
208
  warnings.push('FIXME: maxWidth prop was removed during migration from Lozenge to Tag.\nTag component does not support maxWidth. Please review if width constraints are needed.');
187
209
  }
@@ -0,0 +1,18 @@
1
+ import badgeAppearanceSemanticMigrationTransformer from './codemods/badge-appearance-semantic-migration';
2
+ export default async function transformer(file, api) {
3
+ const transformers = [badgeAppearanceSemanticMigrationTransformer];
4
+ let src = file.source;
5
+ transformers.forEach(transformer => {
6
+ if (typeof src === 'undefined') {
7
+ return;
8
+ }
9
+ const nextSrc = transformer({
10
+ ...file,
11
+ source: src
12
+ }, api);
13
+ if (nextSrc) {
14
+ src = nextSrc;
15
+ }
16
+ });
17
+ return src;
18
+ }
@@ -0,0 +1,144 @@
1
+ import { getImportDeclaration } from '@hypermod/utils';
2
+ import { addCommentBefore } from '@atlaskit/codemod-utils';
3
+ const BADGE_ENTRY_POINT = '@atlaskit/badge';
4
+ const PRINT_SETTINGS = {
5
+ quote: 'single'
6
+ };
7
+
8
+ // Old appearance values that map to new semantic appearance values
9
+ const OLD_TO_NEW_APPEARANCE_MAP = {
10
+ added: 'success',
11
+ removed: 'danger',
12
+ default: 'neutral',
13
+ primary: 'information',
14
+ primaryInverted: 'inverse',
15
+ important: 'danger'
16
+ };
17
+ /**
18
+ * Codemod to migrate Badge component appearance semantic values.
19
+ *
20
+ * This codemod:
21
+ * 1. Updates `appearance` prop values to new semantic values
22
+ * 2. Maps old semantic values to new semantic values (e.g. added → success, removed → danger, primary → information)
23
+ * 3. Adds comments for dynamic values that need manual verification
24
+ */
25
+ export default function transformer(file, api) {
26
+ const j = api.jscodeshift;
27
+ const source = j(file.source);
28
+
29
+ // Find all Badge imports
30
+ const badgeImports = getImportDeclaration(j, source, BADGE_ENTRY_POINT);
31
+
32
+ // If no Badge imports, exit early
33
+ if (!badgeImports.length) {
34
+ return file.source;
35
+ }
36
+
37
+ // Get all imported Badge identifiers (could be renamed)
38
+ const badgeIdentifiers = new Set();
39
+ badgeImports.forEach(importPath => {
40
+ var _importPath$value$spe;
41
+ (_importPath$value$spe = importPath.value.specifiers) === null || _importPath$value$spe === void 0 ? void 0 : _importPath$value$spe.forEach(specifier => {
42
+ var _specifier$imported;
43
+ if (specifier.type === 'ImportDefaultSpecifier') {
44
+ var _specifier$local;
45
+ // Handle: import Badge from '@atlaskit/badge'
46
+ badgeIdentifiers.add(((_specifier$local = specifier.local) === null || _specifier$local === void 0 ? void 0 : _specifier$local.name) || 'Badge');
47
+ } else if (specifier.type === 'ImportSpecifier' && ((_specifier$imported = specifier.imported) === null || _specifier$imported === void 0 ? void 0 : _specifier$imported.type) === 'Identifier' && specifier.imported.name === 'default') {
48
+ var _specifier$local2;
49
+ // Handle: import { default as MyBadge } from '@atlaskit/badge'
50
+ badgeIdentifiers.add(((_specifier$local2 = specifier.local) === null || _specifier$local2 === void 0 ? void 0 : _specifier$local2.name) || 'Badge');
51
+ }
52
+ });
53
+ });
54
+
55
+ // If no Badge identifiers found, exit early
56
+ if (badgeIdentifiers.size === 0) {
57
+ return file.source;
58
+ }
59
+
60
+ // Find all Badge JSX elements
61
+ const badgeElements = [];
62
+ source.find(j.JSXElement).forEach(path => {
63
+ var _openingElement$name;
64
+ const openingElement = path.value.openingElement;
65
+ if (((_openingElement$name = openingElement.name) === null || _openingElement$name === void 0 ? void 0 : _openingElement$name.type) === 'JSXIdentifier' && badgeIdentifiers.has(openingElement.name.name)) {
66
+ var _openingElement$attri;
67
+ const element = {
68
+ path,
69
+ hasAppearanceProp: false
70
+ };
71
+
72
+ // Check for appearance prop
73
+ (_openingElement$attri = openingElement.attributes) === null || _openingElement$attri === void 0 ? void 0 : _openingElement$attri.forEach(attr => {
74
+ var _attr$name;
75
+ if (attr.type === 'JSXAttribute' && ((_attr$name = attr.name) === null || _attr$name === void 0 ? void 0 : _attr$name.type) === 'JSXIdentifier') {
76
+ if (attr.name.name === 'appearance') {
77
+ var _attr$value, _attr$value2;
78
+ element.hasAppearanceProp = true;
79
+ if (((_attr$value = attr.value) === null || _attr$value === void 0 ? void 0 : _attr$value.type) === 'StringLiteral') {
80
+ element.appearanceValue = attr.value.value;
81
+ } else if (((_attr$value2 = attr.value) === null || _attr$value2 === void 0 ? void 0 : _attr$value2.type) === 'JSXExpressionContainer') {
82
+ // Handle dynamic values
83
+ const expression = attr.value.expression;
84
+ if (expression.type === 'StringLiteral') {
85
+ element.appearanceValue = expression.value;
86
+ } else {
87
+ element.appearanceValue = 'dynamic';
88
+ }
89
+ }
90
+ }
91
+ }
92
+ });
93
+ badgeElements.push(element);
94
+ }
95
+ });
96
+
97
+ // Process each Badge element
98
+ badgeElements.forEach(element => {
99
+ const {
100
+ path,
101
+ hasAppearanceProp,
102
+ appearanceValue
103
+ } = element;
104
+ const openingElement = path.value.openingElement;
105
+
106
+ // Update appearance prop values to new semantic values
107
+ if (hasAppearanceProp) {
108
+ var _openingElement$attri2;
109
+ (_openingElement$attri2 = openingElement.attributes) === null || _openingElement$attri2 === void 0 ? void 0 : _openingElement$attri2.forEach(attr => {
110
+ var _attr$name2;
111
+ if (attr.type === 'JSXAttribute' && ((_attr$name2 = attr.name) === null || _attr$name2 === void 0 ? void 0 : _attr$name2.type) === 'JSXIdentifier' && attr.name.name === 'appearance') {
112
+ // Handle different types of appearance values
113
+ if (appearanceValue === 'dynamic') {
114
+ // For dynamic values, add a comment
115
+ addCommentBefore(j, j(path), `FIXME: This Badge component uses a dynamic \`appearance\` prop with updated semantic values.
116
+ Please verify that the values being passed use the new semantic values: neutral, information, inverse, danger, success.
117
+ Old values mapping: default→neutral, primary→information, primaryInverted→inverse, added→success, removed→danger, important→danger.`);
118
+ } else if (appearanceValue === 'primaryInverted') {
119
+ var _attr$value3;
120
+ // For primaryInverted, we need to add a comment since it maps to inverse
121
+ addCommentBefore(j, j(path), `FIXME: This Badge component used \`appearance="primaryInverted"\` which has been migrated to \`appearance="inverse"\`.
122
+ Please verify the visual appearance matches your expectations.`);
123
+ // Update the value
124
+ if (((_attr$value3 = attr.value) === null || _attr$value3 === void 0 ? void 0 : _attr$value3.type) === 'StringLiteral') {
125
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
126
+ }
127
+ } else if (appearanceValue && !OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
128
+ // For invalid string values, add a warning comment
129
+ addCommentBefore(j, j(path), `FIXME: This Badge component uses an unknown \`appearance\` value "${appearanceValue}".
130
+ Valid new semantic appearance values are: ${Object.values(OLD_TO_NEW_APPEARANCE_MAP).filter((v, i, arr) => arr.indexOf(v) === i).join(', ')}.
131
+ Please update this value to a valid semantic appearance value.`);
132
+ } else if (appearanceValue && OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
133
+ var _attr$value4;
134
+ // For valid string values, update the value to the new semantic value
135
+ if (((_attr$value4 = attr.value) === null || _attr$value4 === void 0 ? void 0 : _attr$value4.type) === 'StringLiteral') {
136
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
137
+ }
138
+ }
139
+ }
140
+ });
141
+ }
142
+ });
143
+ return source.toSource(PRINT_SETTINGS);
144
+ }
@@ -14,5 +14,6 @@ import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
14
14
  import './remove-token-fallbacks/remove-token-fallbacks';
15
15
  import './lozenge-appearance-semantic-migration/lozenge-appearance-semantic-migration';
16
16
  import './lozenge-to-tag-migration/lozenge-to-tag-migration';
17
- const presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration'].map(preset => path.join(__dirname, preset, `${preset}.@(ts|js|tsx)`));
17
+ import './badge-appearance-semantic-migration/badge-appearance-semantic-migration';
18
+ const presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration', 'badge-appearance-semantic-migration'].map(preset => path.join(__dirname, preset, `${preset}.@(ts|js|tsx)`));
18
19
  export default presets;
@@ -90,6 +90,8 @@ If isBold is typically false, consider migrating to <Tag /> from '@atlaskit/tag'
90
90
  let unknownAppearanceValue = '';
91
91
 
92
92
  // Process children to extract text
93
+ let hasVariableChild = false;
94
+ let variableChildExpression = null;
93
95
  if (element.children && element.children.length > 0) {
94
96
  if (element.children.length === 1) {
95
97
  const child = element.children[0];
@@ -100,7 +102,21 @@ If isBold is typically false, consider migrating to <Tag /> from '@atlaskit/tag'
100
102
  }
101
103
  } else if (j.JSXExpressionContainer.check(child) && j.StringLiteral.check(child.expression)) {
102
104
  textContent = child.expression.value;
105
+ } else if (j.JSXExpressionContainer.check(child)) {
106
+ // Check if it's a simple identifier (variable) or member expression
107
+ if (j.Identifier.check(child.expression)) {
108
+ hasVariableChild = true;
109
+ variableChildExpression = child.expression;
110
+ } else if (j.MemberExpression.check(child.expression)) {
111
+ // Handle member expressions like obj.prop
112
+ hasVariableChild = true;
113
+ variableChildExpression = child.expression;
114
+ } else {
115
+ // Complex expression or JSX element
116
+ hasComplexChildren = true;
117
+ }
103
118
  } else {
119
+ // JSX elements or other complex children
104
120
  hasComplexChildren = true;
105
121
  }
106
122
  } else {
@@ -150,8 +166,11 @@ If isBold is typically false, consider migrating to <Tag /> from '@atlaskit/tag'
150
166
  });
151
167
 
152
168
  // Assemble attributes in correct order: text, other props, color
153
- if (textContent && !hasComplexChildren) {
169
+ if (textContent && !hasComplexChildren && !hasVariableChild) {
154
170
  newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.stringLiteral(textContent)));
171
+ } else if (hasVariableChild && variableChildExpression) {
172
+ // Use the variable expression as the text prop
173
+ newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.jsxExpressionContainer(variableChildExpression)));
155
174
  }
156
175
 
157
176
  // Add other attributes
@@ -173,6 +192,9 @@ If isBold is typically false, consider migrating to <Tag /> from '@atlaskit/tag'
173
192
  if (hasComplexChildren) {
174
193
  warnings.push("FIXME: This Tag component has complex children that couldn't be automatically migrated to the text prop.\nTag component only supports simple text via the text prop. Please manually convert the children content.");
175
194
  }
195
+ if (hasVariableChild) {
196
+ warnings.push('FIXME: This Tag component uses a variable as the text prop. Please verify that the variable contains a string value.');
197
+ }
176
198
  if (hasMaxWidthProp) {
177
199
  warnings.push('FIXME: maxWidth prop was removed during migration from Lozenge to Tag.\nTag component does not support maxWidth. Please review if width constraints are needed.');
178
200
  }
@@ -0,0 +1,37 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import badgeAppearanceSemanticMigrationTransformer from './codemods/badge-appearance-semantic-migration';
7
+ export default function transformer(_x, _x2) {
8
+ return _transformer.apply(this, arguments);
9
+ }
10
+ function _transformer() {
11
+ _transformer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, api) {
12
+ var transformers, src;
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ transformers = [badgeAppearanceSemanticMigrationTransformer];
17
+ src = file.source;
18
+ transformers.forEach(function (transformer) {
19
+ if (typeof src === 'undefined') {
20
+ return;
21
+ }
22
+ var nextSrc = transformer(_objectSpread(_objectSpread({}, file), {}, {
23
+ source: src
24
+ }), api);
25
+ if (nextSrc) {
26
+ src = nextSrc;
27
+ }
28
+ });
29
+ return _context.abrupt("return", src);
30
+ case 4:
31
+ case "end":
32
+ return _context.stop();
33
+ }
34
+ }, _callee);
35
+ }));
36
+ return _transformer.apply(this, arguments);
37
+ }
@@ -0,0 +1,139 @@
1
+ import { getImportDeclaration } from '@hypermod/utils';
2
+ import { addCommentBefore } from '@atlaskit/codemod-utils';
3
+ var BADGE_ENTRY_POINT = '@atlaskit/badge';
4
+ var PRINT_SETTINGS = {
5
+ quote: 'single'
6
+ };
7
+
8
+ // Old appearance values that map to new semantic appearance values
9
+ var OLD_TO_NEW_APPEARANCE_MAP = {
10
+ added: 'success',
11
+ removed: 'danger',
12
+ default: 'neutral',
13
+ primary: 'information',
14
+ primaryInverted: 'inverse',
15
+ important: 'danger'
16
+ };
17
+ /**
18
+ * Codemod to migrate Badge component appearance semantic values.
19
+ *
20
+ * This codemod:
21
+ * 1. Updates `appearance` prop values to new semantic values
22
+ * 2. Maps old semantic values to new semantic values (e.g. added → success, removed → danger, primary → information)
23
+ * 3. Adds comments for dynamic values that need manual verification
24
+ */
25
+ export default function transformer(file, api) {
26
+ var j = api.jscodeshift;
27
+ var source = j(file.source);
28
+
29
+ // Find all Badge imports
30
+ var badgeImports = getImportDeclaration(j, source, BADGE_ENTRY_POINT);
31
+
32
+ // If no Badge imports, exit early
33
+ if (!badgeImports.length) {
34
+ return file.source;
35
+ }
36
+
37
+ // Get all imported Badge identifiers (could be renamed)
38
+ var badgeIdentifiers = new Set();
39
+ badgeImports.forEach(function (importPath) {
40
+ var _importPath$value$spe;
41
+ (_importPath$value$spe = importPath.value.specifiers) === null || _importPath$value$spe === void 0 || _importPath$value$spe.forEach(function (specifier) {
42
+ var _specifier$imported;
43
+ if (specifier.type === 'ImportDefaultSpecifier') {
44
+ var _specifier$local;
45
+ // Handle: import Badge from '@atlaskit/badge'
46
+ badgeIdentifiers.add(((_specifier$local = specifier.local) === null || _specifier$local === void 0 ? void 0 : _specifier$local.name) || 'Badge');
47
+ } else if (specifier.type === 'ImportSpecifier' && ((_specifier$imported = specifier.imported) === null || _specifier$imported === void 0 ? void 0 : _specifier$imported.type) === 'Identifier' && specifier.imported.name === 'default') {
48
+ var _specifier$local2;
49
+ // Handle: import { default as MyBadge } from '@atlaskit/badge'
50
+ badgeIdentifiers.add(((_specifier$local2 = specifier.local) === null || _specifier$local2 === void 0 ? void 0 : _specifier$local2.name) || 'Badge');
51
+ }
52
+ });
53
+ });
54
+
55
+ // If no Badge identifiers found, exit early
56
+ if (badgeIdentifiers.size === 0) {
57
+ return file.source;
58
+ }
59
+
60
+ // Find all Badge JSX elements
61
+ var badgeElements = [];
62
+ source.find(j.JSXElement).forEach(function (path) {
63
+ var _openingElement$name;
64
+ var openingElement = path.value.openingElement;
65
+ if (((_openingElement$name = openingElement.name) === null || _openingElement$name === void 0 ? void 0 : _openingElement$name.type) === 'JSXIdentifier' && badgeIdentifiers.has(openingElement.name.name)) {
66
+ var _openingElement$attri;
67
+ var element = {
68
+ path: path,
69
+ hasAppearanceProp: false
70
+ };
71
+
72
+ // Check for appearance prop
73
+ (_openingElement$attri = openingElement.attributes) === null || _openingElement$attri === void 0 || _openingElement$attri.forEach(function (attr) {
74
+ var _attr$name;
75
+ if (attr.type === 'JSXAttribute' && ((_attr$name = attr.name) === null || _attr$name === void 0 ? void 0 : _attr$name.type) === 'JSXIdentifier') {
76
+ if (attr.name.name === 'appearance') {
77
+ var _attr$value, _attr$value2;
78
+ element.hasAppearanceProp = true;
79
+ if (((_attr$value = attr.value) === null || _attr$value === void 0 ? void 0 : _attr$value.type) === 'StringLiteral') {
80
+ element.appearanceValue = attr.value.value;
81
+ } else if (((_attr$value2 = attr.value) === null || _attr$value2 === void 0 ? void 0 : _attr$value2.type) === 'JSXExpressionContainer') {
82
+ // Handle dynamic values
83
+ var expression = attr.value.expression;
84
+ if (expression.type === 'StringLiteral') {
85
+ element.appearanceValue = expression.value;
86
+ } else {
87
+ element.appearanceValue = 'dynamic';
88
+ }
89
+ }
90
+ }
91
+ }
92
+ });
93
+ badgeElements.push(element);
94
+ }
95
+ });
96
+
97
+ // Process each Badge element
98
+ badgeElements.forEach(function (element) {
99
+ var path = element.path,
100
+ hasAppearanceProp = element.hasAppearanceProp,
101
+ appearanceValue = element.appearanceValue;
102
+ var openingElement = path.value.openingElement;
103
+
104
+ // Update appearance prop values to new semantic values
105
+ if (hasAppearanceProp) {
106
+ var _openingElement$attri2;
107
+ (_openingElement$attri2 = openingElement.attributes) === null || _openingElement$attri2 === void 0 || _openingElement$attri2.forEach(function (attr) {
108
+ var _attr$name2;
109
+ if (attr.type === 'JSXAttribute' && ((_attr$name2 = attr.name) === null || _attr$name2 === void 0 ? void 0 : _attr$name2.type) === 'JSXIdentifier' && attr.name.name === 'appearance') {
110
+ // Handle different types of appearance values
111
+ if (appearanceValue === 'dynamic') {
112
+ // For dynamic values, add a comment
113
+ addCommentBefore(j, j(path), "FIXME: This Badge component uses a dynamic `appearance` prop with updated semantic values.\nPlease verify that the values being passed use the new semantic values: neutral, information, inverse, danger, success.\nOld values mapping: default\u2192neutral, primary\u2192information, primaryInverted\u2192inverse, added\u2192success, removed\u2192danger, important\u2192danger.");
114
+ } else if (appearanceValue === 'primaryInverted') {
115
+ var _attr$value3;
116
+ // For primaryInverted, we need to add a comment since it maps to inverse
117
+ addCommentBefore(j, j(path), "FIXME: This Badge component used `appearance=\"primaryInverted\"` which has been migrated to `appearance=\"inverse\"`.\nPlease verify the visual appearance matches your expectations.");
118
+ // Update the value
119
+ if (((_attr$value3 = attr.value) === null || _attr$value3 === void 0 ? void 0 : _attr$value3.type) === 'StringLiteral') {
120
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
121
+ }
122
+ } else if (appearanceValue && !OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
123
+ // For invalid string values, add a warning comment
124
+ addCommentBefore(j, j(path), "FIXME: This Badge component uses an unknown `appearance` value \"".concat(appearanceValue, "\".\nValid new semantic appearance values are: ").concat(Object.values(OLD_TO_NEW_APPEARANCE_MAP).filter(function (v, i, arr) {
125
+ return arr.indexOf(v) === i;
126
+ }).join(', '), ".\nPlease update this value to a valid semantic appearance value."));
127
+ } else if (appearanceValue && OLD_TO_NEW_APPEARANCE_MAP[appearanceValue]) {
128
+ var _attr$value4;
129
+ // For valid string values, update the value to the new semantic value
130
+ if (((_attr$value4 = attr.value) === null || _attr$value4 === void 0 ? void 0 : _attr$value4.type) === 'StringLiteral') {
131
+ attr.value.value = OLD_TO_NEW_APPEARANCE_MAP[appearanceValue];
132
+ }
133
+ }
134
+ }
135
+ });
136
+ }
137
+ });
138
+ return source.toSource(PRINT_SETTINGS);
139
+ }
@@ -14,7 +14,8 @@ import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
14
14
  import './remove-token-fallbacks/remove-token-fallbacks';
15
15
  import './lozenge-appearance-semantic-migration/lozenge-appearance-semantic-migration';
16
16
  import './lozenge-to-tag-migration/lozenge-to-tag-migration';
17
- var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration'].map(function (preset) {
17
+ import './badge-appearance-semantic-migration/badge-appearance-semantic-migration';
18
+ var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-link', 'migrate-to-new-buttons', 'migrate-icon-object-to-object', 'upgrade-pragmatic-drag-and-drop-to-stable', 'remove-dark-theme-vr-options', 'remove-token-fallbacks', 'lozenge-appearance-semantic-migration', 'lozenge-to-tag-migration', 'badge-appearance-semantic-migration'].map(function (preset) {
18
19
  return path.join(__dirname, preset, "".concat(preset, ".@(ts|js|tsx)"));
19
20
  });
20
21
  export default presets;
@@ -93,6 +93,8 @@ var transformer = function transformer(file, api) {
93
93
  var unknownAppearanceValue = '';
94
94
 
95
95
  // Process children to extract text
96
+ var hasVariableChild = false;
97
+ var variableChildExpression = null;
96
98
  if (element.children && element.children.length > 0) {
97
99
  if (element.children.length === 1) {
98
100
  var child = element.children[0];
@@ -103,7 +105,21 @@ var transformer = function transformer(file, api) {
103
105
  }
104
106
  } else if (j.JSXExpressionContainer.check(child) && j.StringLiteral.check(child.expression)) {
105
107
  textContent = child.expression.value;
108
+ } else if (j.JSXExpressionContainer.check(child)) {
109
+ // Check if it's a simple identifier (variable) or member expression
110
+ if (j.Identifier.check(child.expression)) {
111
+ hasVariableChild = true;
112
+ variableChildExpression = child.expression;
113
+ } else if (j.MemberExpression.check(child.expression)) {
114
+ // Handle member expressions like obj.prop
115
+ hasVariableChild = true;
116
+ variableChildExpression = child.expression;
117
+ } else {
118
+ // Complex expression or JSX element
119
+ hasComplexChildren = true;
120
+ }
106
121
  } else {
122
+ // JSX elements or other complex children
107
123
  hasComplexChildren = true;
108
124
  }
109
125
  } else {
@@ -153,8 +169,11 @@ var transformer = function transformer(file, api) {
153
169
  });
154
170
 
155
171
  // Assemble attributes in correct order: text, other props, color
156
- if (textContent && !hasComplexChildren) {
172
+ if (textContent && !hasComplexChildren && !hasVariableChild) {
157
173
  newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.stringLiteral(textContent)));
174
+ } else if (hasVariableChild && variableChildExpression) {
175
+ // Use the variable expression as the text prop
176
+ newAttributes.push(j.jsxAttribute(j.jsxIdentifier('text'), j.jsxExpressionContainer(variableChildExpression)));
158
177
  }
159
178
 
160
179
  // Add other attributes
@@ -176,6 +195,9 @@ var transformer = function transformer(file, api) {
176
195
  if (hasComplexChildren) {
177
196
  warnings.push("FIXME: This Tag component has complex children that couldn't be automatically migrated to the text prop.\nTag component only supports simple text via the text prop. Please manually convert the children content.");
178
197
  }
198
+ if (hasVariableChild) {
199
+ warnings.push('FIXME: This Tag component uses a variable as the text prop. Please verify that the variable contains a string value.');
200
+ }
179
201
  if (hasMaxWidthProp) {
180
202
  warnings.push('FIXME: maxWidth prop was removed during migration from Lozenge to Tag.\nTag component does not support maxWidth. Please review if width constraints are needed.');
181
203
  }
@@ -0,0 +1,2 @@
1
+ import type { API, FileInfo } from 'jscodeshift';
2
+ export default function transformer(file: FileInfo, api: API): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import { type API, type FileInfo } from 'jscodeshift';
2
+ /**
3
+ * Codemod to migrate Badge component appearance semantic values.
4
+ *
5
+ * This codemod:
6
+ * 1. Updates `appearance` prop values to new semantic values
7
+ * 2. Maps old semantic values to new semantic values (e.g. added → success, removed → danger, primary → information)
8
+ * 3. Adds comments for dynamic values that need manual verification
9
+ */
10
+ export default function transformer(file: FileInfo, api: API): string;
@@ -12,5 +12,6 @@ import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
12
12
  import './remove-token-fallbacks/remove-token-fallbacks';
13
13
  import './lozenge-appearance-semantic-migration/lozenge-appearance-semantic-migration';
14
14
  import './lozenge-to-tag-migration/lozenge-to-tag-migration';
15
+ import './badge-appearance-semantic-migration/badge-appearance-semantic-migration';
15
16
  declare const presets: string[];
16
17
  export default presets;
@@ -0,0 +1,2 @@
1
+ import type { API, FileInfo } from 'jscodeshift';
2
+ export default function transformer(file: FileInfo, api: API): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import { type API, type FileInfo } from 'jscodeshift';
2
+ /**
3
+ * Codemod to migrate Badge component appearance semantic values.
4
+ *
5
+ * This codemod:
6
+ * 1. Updates `appearance` prop values to new semantic values
7
+ * 2. Maps old semantic values to new semantic values (e.g. added → success, removed → danger, primary → information)
8
+ * 3. Adds comments for dynamic values that need manual verification
9
+ */
10
+ export default function transformer(file: FileInfo, api: API): string;
@@ -12,5 +12,6 @@ import './remove-dark-theme-vr-options/remove-dark-theme-vr-options';
12
12
  import './remove-token-fallbacks/remove-token-fallbacks';
13
13
  import './lozenge-appearance-semantic-migration/lozenge-appearance-semantic-migration';
14
14
  import './lozenge-to-tag-migration/lozenge-to-tag-migration';
15
+ import './badge-appearance-semantic-migration/badge-appearance-semantic-migration';
15
16
  declare const presets: string[];
16
17
  export default presets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.31.2",
3
+ "version": "0.32.1",
4
4
  "description": "A cli for distributing codemods for atlassian-frontend components and services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "bin": "./bin/codemod-cli.js",
30
30
  "dependencies": {
31
31
  "@atlaskit/codemod-utils": "^4.2.0",
32
- "@atlaskit/tokens": "^8.0.0",
32
+ "@atlaskit/tokens": "^8.4.0",
33
33
  "@babel/runtime": "^7.0.0",
34
34
  "@codeshift/utils": "^0.2.4",
35
35
  "@hypermod/utils": "^0.4.2",