@react-spectrum/codemods 0.6.1 → 0.7.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/index.js CHANGED
File without changes
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = transformDateField;
4
+ const transforms_1 = require("../../shared/transforms");
5
+ /**
6
+ * Transforms DateField:
7
+ * - Remove isQuiet (it is no longer supported in Spectrum 2).
8
+ * - Change validationState="invalid" to isInvalid.
9
+ * - Remove validationState="valid" (it is no longer supported in Spectrum 2).
10
+ */
11
+ function transformDateField(path) {
12
+ // Change validationState="invalid" to isInvalid
13
+ (0, transforms_1.updatePropNameAndValue)(path, {
14
+ oldPropName: 'validationState',
15
+ oldPropValue: 'invalid',
16
+ newPropName: 'isInvalid',
17
+ newPropValue: true
18
+ });
19
+ // Remove validationState="valid"
20
+ (0, transforms_1.removeProp)(path, { propName: 'validationState', propValue: 'valid' });
21
+ // Remove isQuiet
22
+ (0, transforms_1.removeProp)(path, { propName: 'isQuiet' });
23
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = transformDatePicker;
4
+ const transforms_1 = require("../../shared/transforms");
5
+ /**
6
+ * Transforms DatePicker:
7
+ * - Remove isQuiet (it is no longer supported in Spectrum 2).
8
+ * - Change validationState="invalid" to isInvalid.
9
+ * - Remove validationState="valid" (it is no longer supported in Spectrum 2).
10
+ */
11
+ function transformDatePicker(path) {
12
+ // Change validationState="invalid" to isInvalid
13
+ (0, transforms_1.updatePropNameAndValue)(path, {
14
+ oldPropName: 'validationState',
15
+ oldPropValue: 'invalid',
16
+ newPropName: 'isInvalid',
17
+ newPropValue: true
18
+ });
19
+ // Remove validationState="valid"
20
+ (0, transforms_1.removeProp)(path, { propName: 'validationState', propValue: 'valid' });
21
+ // Remove isQuiet
22
+ (0, transforms_1.removeProp)(path, { propName: 'isQuiet' });
23
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = transformDateRangePicker;
4
+ const transforms_1 = require("../../shared/transforms");
5
+ /**
6
+ * Transforms DateRangePicker:
7
+ * - Remove isQuiet (it is no longer supported in Spectrum 2).
8
+ * - Change validationState="invalid" to isInvalid.
9
+ * - Remove validationState="valid" (it is no longer supported in Spectrum 2).
10
+ */
11
+ function transformDateRangePicker(path) {
12
+ // Change validationState="invalid" to isInvalid
13
+ (0, transforms_1.updatePropNameAndValue)(path, {
14
+ oldPropName: 'validationState',
15
+ oldPropValue: 'invalid',
16
+ newPropName: 'isInvalid',
17
+ newPropValue: true
18
+ });
19
+ // Remove validationState="valid"
20
+ (0, transforms_1.removeProp)(path, { propName: 'validationState', propValue: 'valid' });
21
+ // Remove isQuiet
22
+ (0, transforms_1.removeProp)(path, { propName: 'isQuiet' });
23
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = transformTimeField;
4
+ const transforms_1 = require("../../shared/transforms");
5
+ /**
6
+ * Transforms TimeField:
7
+ * - Remove isQuiet (it is no longer supported in Spectrum 2).
8
+ * - Change validationState="invalid" to isInvalid.
9
+ * - Remove validationState="valid" (it is no longer supported in Spectrum 2).
10
+ */
11
+ function transformTimeField(path) {
12
+ // Change validationState="invalid" to isInvalid
13
+ (0, transforms_1.updatePropNameAndValue)(path, {
14
+ oldPropName: 'validationState',
15
+ oldPropValue: 'invalid',
16
+ newPropName: 'isInvalid',
17
+ newPropValue: true
18
+ });
19
+ // Remove validationState="valid"
20
+ (0, transforms_1.removeProp)(path, { propName: 'validationState', propValue: 'valid' });
21
+ // Remove isQuiet
22
+ (0, transforms_1.removeProp)(path, { propName: 'isQuiet' });
23
+ }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = transformer;
4
3
  const fs = require('fs');
5
4
  const path = require('path');
6
5
  function areSpecifiersAlphabetized(specifiers) {
@@ -20,7 +19,7 @@ function areSpecifiersAlphabetized(specifiers) {
20
19
  *
21
20
  * Run this from a directory where the relevant packages are installed in node_modules so it knows which monopackage exports are available to use (since exports may vary by version).
22
21
  */
23
- function transformer(file, api, options) {
22
+ const transformer = function transformer(file, api, options) {
24
23
  const j = api.jscodeshift;
25
24
  const root = j(file.source);
26
25
  const packages = {
@@ -142,5 +141,6 @@ function transformer(file, api, options) {
142
141
  }
143
142
  });
144
143
  return root.toSource();
145
- }
144
+ };
146
145
  transformer.parser = 'tsx';
146
+ exports.default = transformer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/codemods",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "main": "dist/index.js",
5
5
  "source": "src/index.ts",
6
6
  "bin": "dist/index.js",
@@ -24,8 +24,8 @@
24
24
  "@babel/parser": "^7.24.5",
25
25
  "@babel/traverse": "^7.24.5",
26
26
  "@babel/types": "^7.24.5",
27
- "@react-spectrum/s2": "^0.9.1",
28
- "@react-types/shared": "^3.30.0",
27
+ "@react-spectrum/s2": "^0.10.0",
28
+ "@react-types/shared": "^3.31.0",
29
29
  "@types/node": "^22",
30
30
  "boxen": "^5.1.2",
31
31
  "build": "^0.1.4",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "265b4d7f107905ee1c6e87a8af1613ab440a6849"
53
+ "gitHead": "8b9348ff255e018b2dd9b27e2a45507cadfa1d35"
54
54
  }