joist-codegen 2.1.0-next.16 → 2.1.0-next.17

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.
@@ -1 +1 @@
1
- {"version":3,"file":"codemod_0001-rename_has_async_property.d.ts","sourceRoot":"","sources":["../../src/codemods/codemod_0001-rename_has_async_property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAO,MAAM,sCAAsC,gBAKlD,CAAC;AAWF,+FAA+F;AAC/F,QAAA,MAAM,SAAS,EAAE,SAShB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"codemod_0001-rename_has_async_property.d.ts","sourceRoot":"","sources":["../../src/codemods/codemod_0001-rename_has_async_property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAO,MAAM,sCAAsC,gBAKlD,CAAC;AAWF,+FAA+F;AAC/F,QAAA,MAAM,SAAS,EAAE,SAYhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -3,22 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.codemod_0001_rename_has_async_property = void 0;
4
4
  const JscodeshiftMod_1 = require("./JscodeshiftMod");
5
5
  exports.codemod_0001_rename_has_async_property = new JscodeshiftMod_1.JscodeshiftMod(1, "codemod_0001-rename_has_async_property", "Rename `hasAsyncProperty` to `hasProperty`", (config) => `${config.entitiesDirectory}/*.ts`);
6
- const renames = {
7
- hasAsyncProperty: "hasProperty",
8
- hasReactiveAsyncProperty: "hasReactiveProperty",
9
- AsyncProperty: "Property",
10
- AsyncPropertyImpl: "PropertyImpl",
11
- isAsyncProperty: "isProperty",
12
- isLoadedAsyncProperty: "isLoadedProperty",
13
- };
6
+ const renames = new Map([
7
+ ["hasAsyncProperty", "hasProperty"],
8
+ ["hasReactiveAsyncProperty", "hasReactiveProperty"],
9
+ ["AsyncProperty", "Property"],
10
+ ["AsyncPropertyImpl", "PropertyImpl"],
11
+ ["isAsyncProperty", "isProperty"],
12
+ ["isLoadedAsyncProperty", "isLoadedProperty"],
13
+ ]);
14
14
  /** Find/replace the various `*AsyncProperty*` symbols with their `*Property*` counterparts. */
15
- const transform = (file, api) => {
15
+ const transform = function (file, api) {
16
16
  const j = api.jscodeshift;
17
17
  return j(file.source)
18
18
  .find(j.Identifier)
19
- .filter((path) => path.node.name in renames)
20
19
  .forEach((path) => {
21
- j(path).replaceWith(j.identifier(renames[path.node.name]));
20
+ const rename = renames.get(path.node.name);
21
+ if (!rename) {
22
+ return;
23
+ }
24
+ j(path).replaceWith(j.identifier(rename));
22
25
  })
23
26
  .toSource();
24
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"codemod_0001-rename_has_async_property.js","sourceRoot":"","sources":["../../src/codemods/codemod_0001-rename_has_async_property.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAErC,QAAA,sCAAsC,GAAG,IAAI,+BAAc,CACtE,CAAC,EACD,wCAAwC,EACxC,4CAA4C,EAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,iBAAiB,OAAO,CAC/C,CAAC;AAEF,MAAM,OAAO,GAA2B;IACtC,gBAAgB,EAAE,aAAa;IAC/B,wBAAwB,EAAE,qBAAqB;IAC/C,aAAa,EAAE,UAAU;IACzB,iBAAiB,EAAE,cAAc;IACjC,eAAe,EAAE,YAAY;IAC7B,qBAAqB,EAAE,kBAAkB;CAC1C,CAAC;AAEF,+FAA+F;AAC/F,MAAM,SAAS,GAAc,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACzC,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;IAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;SAClB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;SAClB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC;SAC3C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;SACD,QAAQ,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"codemod_0001-rename_has_async_property.js","sourceRoot":"","sources":["../../src/codemods/codemod_0001-rename_has_async_property.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAErC,QAAA,sCAAsC,GAAG,IAAI,+BAAc,CACtE,CAAC,EACD,wCAAwC,EACxC,4CAA4C,EAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,iBAAiB,OAAO,CAC/C,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB;IACtC,CAAC,kBAAkB,EAAE,aAAa,CAAC;IACnC,CAAC,0BAA0B,EAAE,qBAAqB,CAAC;IACnD,CAAC,eAAe,EAAE,UAAU,CAAC;IAC7B,CAAC,mBAAmB,EAAE,cAAc,CAAC;IACrC,CAAC,iBAAiB,EAAE,YAAY,CAAC;IACjC,CAAC,uBAAuB,EAAE,kBAAkB,CAAC;CAC9C,CAAC,CAAC;AAEH,+FAA+F;AAC/F,MAAM,SAAS,GAAc,UAAU,IAAI,EAAE,GAAG;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;IAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;SAClB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;SAClB,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QACD,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;SACD,QAAQ,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joist-codegen",
3
- "version": "2.1.0-next.16",
3
+ "version": "2.1.0-next.17",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "build"
18
18
  ],
19
19
  "peerDependencies": {
20
- "joist-utils": "2.1.0-next.16",
20
+ "joist-utils": "2.1.0-next.17",
21
21
  "knex": "^3.1.0",
22
22
  "pg": "^8.16.3"
23
23
  },