@teambit/renaming 0.0.284 → 0.0.286

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
@@ -10,19 +10,14 @@ Object.defineProperty(exports, "RenamingAspect", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  function _renaming() {
15
14
  const data = require("./renaming.aspect");
16
-
17
15
  _renaming = function () {
18
16
  return data;
19
17
  };
20
-
21
18
  return data;
22
19
  }
23
-
24
20
  var _default = _renaming().RenamingAspect;
25
-
26
21
  exports.default = _default;
27
22
 
28
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["RenamingAspect"],"sources":["index.ts"],"sourcesContent":["import { RenamingAspect } from './renaming.aspect';\n\nexport type { RenamingMain } from './renaming.main.runtime';\nexport default RenamingAspect;\nexport { RenamingAspect };\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAGeA,0B"}
1
+ {"version":3,"names":["RenamingAspect"],"sources":["index.ts"],"sourcesContent":["import { RenamingAspect } from './renaming.aspect';\n\nexport type { RenamingMain } from './renaming.main.runtime';\nexport default RenamingAspect;\nexport { RenamingAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD,eAGpCA,0BAAc;AAAA"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.RenameCmd = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  class RenameCmd {
35
25
  constructor(renaming) {
36
26
  this.renaming = renaming;
@@ -51,14 +41,11 @@ class RenameCmd {
51
41
  (0, _defineProperty2().default)(this, "migration", true);
52
42
  (0, _defineProperty2().default)(this, "remoteOp", true);
53
43
  }
54
-
55
44
  async report([sourceId, targetId], options) {
56
45
  const results = await this.renaming.rename(sourceId, targetId, options);
57
46
  return _chalk().default.green(`successfully renamed ${_chalk().default.bold(results.sourceId.toString())} to ${_chalk().default.bold(results.targetId.toString())}`);
58
47
  }
59
-
60
48
  }
61
-
62
49
  exports.RenameCmd = RenameCmd;
63
50
 
64
51
  //# sourceMappingURL=rename.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RenameCmd","constructor","renaming","name","description","report","sourceId","targetId","options","results","rename","chalk","green","bold","toString"],"sources":["rename.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { RenamingMain } from '.';\n\nexport type RenameOptions = {\n scope?: string;\n path?: string;\n refactor?: boolean;\n};\n\nexport class RenameCmd implements Command {\n name = 'rename <current-name> <new-name>';\n description =\n 'EXPERIMENTAL. rename component. if tagged/exported, create a new component and deprecate the original component';\n arguments = [\n {\n name: 'current-name',\n description: 'the current component name (without its scope name)',\n },\n {\n name: 'new-name',\n description: 'the new component name (without its scope name)',\n },\n ];\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n options = [\n ['s', 'scope <scope-name>', 'default scope for the newly created component'],\n [\n 'p',\n 'path <relative-path>',\n 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`',\n ],\n ['r', 'refactor', 'update the import/require statements in all dependent components (in the same workspace)'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private renaming: RenamingMain) {}\n\n async report([sourceId, targetId]: [string, string], options: RenameOptions): Promise<string> {\n const results = await this.renaming.rename(sourceId, targetId, options);\n return chalk.green(\n `successfully renamed ${chalk.bold(results.sourceId.toString())} to ${chalk.bold(results.targetId.toString())}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAUO,MAAMA,SAAN,CAAmC;EA8BxCC,WAAW,CAASC,QAAT,EAAiC;IAAA,KAAxBA,QAAwB,GAAxBA,QAAwB;IAAA,8CA7BrC,kCA6BqC;IAAA,qDA3B1C,iHA2B0C;IAAA,mDA1BhC,CACV;MACEC,IAAI,EAAE,cADR;MAEEC,WAAW,EAAE;IAFf,CADU,EAKV;MACED,IAAI,EAAE,UADR;MAEEC,WAAW,EAAE;IAFf,CALU,CA0BgC;IAAA,+CAhBpC,aAgBoC;IAAA,uDAf5B,IAe4B;IAAA,+CAdpC,EAcoC;IAAA,iDAblC,CACR,CAAC,GAAD,EAAM,oBAAN,EAA4B,+CAA5B,CADQ,EAER,CACE,GADF,EAEE,sBAFF,EAGE,qFAHF,CAFQ,EAOR,CAAC,GAAD,EAAM,UAAN,EAAkB,0FAAlB,CAPQ,CAakC;IAAA,gDAJnC,IAImC;IAAA,mDAHhC,IAGgC;IAAA,kDAFjC,IAEiC;EAAE;;EAElC,MAANC,MAAM,CAAC,CAACC,QAAD,EAAWC,QAAX,CAAD,EAAyCC,OAAzC,EAAkF;IAC5F,MAAMC,OAAO,GAAG,MAAM,KAAKP,QAAL,CAAcQ,MAAd,CAAqBJ,QAArB,EAA+BC,QAA/B,EAAyCC,OAAzC,CAAtB;IACA,OAAOG,gBAAA,CAAMC,KAAN,CACJ,wBAAuBD,gBAAA,CAAME,IAAN,CAAWJ,OAAO,CAACH,QAAR,CAAiBQ,QAAjB,EAAX,CAAwC,OAAMH,gBAAA,CAAME,IAAN,CAAWJ,OAAO,CAACF,QAAR,CAAiBO,QAAjB,EAAX,CAAwC,EADzG,CAAP;EAGD;;AArCuC"}
1
+ {"version":3,"names":["RenameCmd","constructor","renaming","name","description","report","sourceId","targetId","options","results","rename","chalk","green","bold","toString"],"sources":["rename.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { RenamingMain } from '.';\n\nexport type RenameOptions = {\n scope?: string;\n path?: string;\n refactor?: boolean;\n};\n\nexport class RenameCmd implements Command {\n name = 'rename <current-name> <new-name>';\n description =\n 'EXPERIMENTAL. rename component. if tagged/exported, create a new component and deprecate the original component';\n arguments = [\n {\n name: 'current-name',\n description: 'the current component name (without its scope name)',\n },\n {\n name: 'new-name',\n description: 'the new component name (without its scope name)',\n },\n ];\n group = 'collaborate';\n skipWorkspace = true;\n alias = '';\n options = [\n ['s', 'scope <scope-name>', 'default scope for the newly created component'],\n [\n 'p',\n 'path <relative-path>',\n 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`',\n ],\n ['r', 'refactor', 'update the import/require statements in all dependent components (in the same workspace)'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private renaming: RenamingMain) {}\n\n async report([sourceId, targetId]: [string, string], options: RenameOptions): Promise<string> {\n const results = await this.renaming.rename(sourceId, targetId, options);\n return chalk.green(\n `successfully renamed ${chalk.bold(results.sourceId.toString())} to ${chalk.bold(results.targetId.toString())}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAUO,MAAMA,SAAS,CAAoB;EA8BxCC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CA7BnC,kCAAkC;IAAA,qDAEvC,iHAAiH;IAAA,mDACvG,CACV;MACEC,IAAI,EAAE,cAAc;MACpBC,WAAW,EAAE;IACf,CAAC,EACD;MACED,IAAI,EAAE,UAAU;MAChBC,WAAW,EAAE;IACf,CAAC,CACF;IAAA,+CACO,aAAa;IAAA,uDACL,IAAI;IAAA,+CACZ,EAAE;IAAA,iDACA,CACR,CAAC,GAAG,EAAE,oBAAoB,EAAE,+CAA+C,CAAC,EAC5E,CACE,GAAG,EACH,sBAAsB,EACtB,qFAAqF,CACtF,EACD,CAAC,GAAG,EAAE,UAAU,EAAE,0FAA0F,CAAC,CAC9G;IAAA,gDACQ,IAAI;IAAA,mDACD,IAAI;IAAA,kDACL,IAAI;EAE8B;EAE7C,MAAMC,MAAM,CAAC,CAACC,QAAQ,EAAEC,QAAQ,CAAmB,EAAEC,OAAsB,EAAmB;IAC5F,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACP,QAAQ,CAACQ,MAAM,CAACJ,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACvE,OAAOG,gBAAK,CAACC,KAAK,CACf,wBAAuBD,gBAAK,CAACE,IAAI,CAACJ,OAAO,CAACH,QAAQ,CAACQ,QAAQ,EAAE,CAAE,OAAMH,gBAAK,CAACE,IAAI,CAACJ,OAAO,CAACF,QAAQ,CAACO,QAAQ,EAAE,CAAE,EAAC,CAChH;EACH;AACF;AAAC"}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RenamingAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const RenamingAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.component/renaming'
20
16
  });
21
-
22
17
  exports.RenamingAspect = RenamingAspect;
23
18
 
24
19
  //# sourceMappingURL=renaming.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RenamingAspect","Aspect","create","id"],"sources":["renaming.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const RenamingAspect = Aspect.create({\n id: 'teambit.component/renaming',\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,cAAc,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EAC1CC,EAAE,EAAE;AADsC,CAAd,CAAvB"}
1
+ {"version":3,"names":["RenamingAspect","Aspect","create","id"],"sources":["renaming.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const RenamingAspect = Aspect.create({\n id: 'teambit.component/renaming',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,cAAc,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC1CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/rename.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=renaming.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["renaming.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/rename.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["renaming.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/rename.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAoD,EAAG,CAEzF;AAAC"}
@@ -1,31 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.RenamingFragment = void 0;
11
-
12
9
  function _defineProperty2() {
13
10
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
-
15
11
  _defineProperty2 = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  class RenamingFragment {
23
17
  constructor(renaming) {
24
18
  this.renaming = renaming;
25
19
  (0, _defineProperty2().default)(this, "title", 'renaming');
26
20
  (0, _defineProperty2().default)(this, "weight", 3);
27
21
  }
28
-
29
22
  async renderRow(component) {
30
23
  const renamingInfo = this.renaming.getRenamingInfo(component);
31
24
  const content = renamingInfo ? `origin: ${renamingInfo.renamedFrom.toString()}` : '';
@@ -34,16 +27,13 @@ class RenamingFragment {
34
27
  content
35
28
  };
36
29
  }
37
-
38
30
  async json(component) {
39
31
  return {
40
32
  title: this.title,
41
33
  json: this.renaming.getRenamingInfo(component)
42
34
  };
43
35
  }
44
-
45
36
  }
46
-
47
37
  exports.RenamingFragment = RenamingFragment;
48
38
 
49
39
  //# sourceMappingURL=renaming.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RenamingFragment","constructor","renaming","renderRow","component","renamingInfo","getRenamingInfo","content","renamedFrom","toString","title","json"],"sources":["renaming.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport class RenamingFragment implements ShowFragment {\n constructor(private renaming: RenamingMain) {}\n\n title = 'renaming';\n\n async renderRow(component: Component) {\n const renamingInfo = this.renaming.getRenamingInfo(component);\n const content = renamingInfo ? `origin: ${renamingInfo.renamedFrom.toString()}` : '';\n return {\n title: this.title,\n content,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.renaming.getRenamingInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,gBAAN,CAA+C;EACpDC,WAAW,CAASC,QAAT,EAAiC;IAAA,KAAxBA,QAAwB,GAAxBA,QAAwB;IAAA,+CAEpC,UAFoC;IAAA,gDAoBnC,CApBmC;EAAE;;EAI/B,MAATC,SAAS,CAACC,SAAD,EAAuB;IACpC,MAAMC,YAAY,GAAG,KAAKH,QAAL,CAAcI,eAAd,CAA8BF,SAA9B,CAArB;IACA,MAAMG,OAAO,GAAGF,YAAY,GAAI,WAAUA,YAAY,CAACG,WAAb,CAAyBC,QAAzB,EAAoC,EAAlD,GAAsD,EAAlF;IACA,OAAO;MACLC,KAAK,EAAE,KAAKA,KADP;MAELH;IAFK,CAAP;EAID;;EAES,MAAJI,IAAI,CAACP,SAAD,EAAuB;IAC/B,OAAO;MACLM,KAAK,EAAE,KAAKA,KADP;MAELC,IAAI,EAAE,KAAKT,QAAL,CAAcI,eAAd,CAA8BF,SAA9B;IAFD,CAAP;EAID;;AAnBmD"}
1
+ {"version":3,"names":["RenamingFragment","constructor","renaming","renderRow","component","renamingInfo","getRenamingInfo","content","renamedFrom","toString","title","json"],"sources":["renaming.fragment.ts"],"sourcesContent":["import { Component, ShowFragment } from '@teambit/component';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport class RenamingFragment implements ShowFragment {\n constructor(private renaming: RenamingMain) {}\n\n title = 'renaming';\n\n async renderRow(component: Component) {\n const renamingInfo = this.renaming.getRenamingInfo(component);\n const content = renamingInfo ? `origin: ${renamingInfo.renamedFrom.toString()}` : '';\n return {\n title: this.title,\n content,\n };\n }\n\n async json(component: Component) {\n return {\n title: this.title,\n json: this.renaming.getRenamingInfo(component),\n };\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGO,MAAMA,gBAAgB,CAAyB;EACpDC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,+CAElC,UAAU;IAAA,gDAkBT,CAAC;EApBmC;EAI7C,MAAMC,SAAS,CAACC,SAAoB,EAAE;IACpC,MAAMC,YAAY,GAAG,IAAI,CAACH,QAAQ,CAACI,eAAe,CAACF,SAAS,CAAC;IAC7D,MAAMG,OAAO,GAAGF,YAAY,GAAI,WAAUA,YAAY,CAACG,WAAW,CAACC,QAAQ,EAAG,EAAC,GAAG,EAAE;IACpF,OAAO;MACLC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBH;IACF,CAAC;EACH;EAEA,MAAMI,IAAI,CAACP,SAAoB,EAAE;IAC/B,OAAO;MACLM,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,IAAI,EAAE,IAAI,CAACT,QAAQ,CAACI,eAAe,CAACF,SAAS;IAC/C,CAAC;EACH;AAGF;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.renamingSchema = renamingSchema;
9
-
10
8
  function _graphqlTag() {
11
9
  const data = _interopRequireDefault(require("graphql-tag"));
12
-
13
10
  _graphqlTag = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  function renamingSchema(renaming) {
21
16
  return {
22
17
  typeDefs: (0, _graphqlTag().default)`
@@ -1 +1 @@
1
- {"version":3,"names":["renamingSchema","renaming","typeDefs","gql","resolvers","Component","component","renamingInfo","getRenamingInfo","renamedFrom","toString"],"sources":["renaming.graphql.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport gql from 'graphql-tag';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport function renamingSchema(renaming: RenamingMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n renaming: RenamingInfo\n }\n\n type RenamingInfo {\n renamedFrom: String\n }\n `,\n resolvers: {\n Component: {\n renaming: (component: Component) => {\n const renamingInfo = renaming.getRenamingInfo(component);\n return {\n renamedFrom: renamingInfo?.renamedFrom.toString(),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,SAASA,cAAT,CAAwBC,QAAxB,EAAwD;EAC7D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAA,CAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KATS;IAULC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTJ,QAAQ,EAAGK,SAAD,IAA0B;UAClC,MAAMC,YAAY,GAAGN,QAAQ,CAACO,eAAT,CAAyBF,SAAzB,CAArB;UACA,OAAO;YACLG,WAAW,EAAEF,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEE,WAAd,CAA0BC,QAA1B;UADR,CAAP;QAGD;MANQ;IADF;EAVN,CAAP;AAqBD"}
1
+ {"version":3,"names":["renamingSchema","renaming","typeDefs","gql","resolvers","Component","component","renamingInfo","getRenamingInfo","renamedFrom","toString"],"sources":["renaming.graphql.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport gql from 'graphql-tag';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport function renamingSchema(renaming: RenamingMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n renaming: RenamingInfo\n }\n\n type RenamingInfo {\n renamedFrom: String\n }\n `,\n resolvers: {\n Component: {\n renaming: (component: Component) => {\n const renamingInfo = renaming.getRenamingInfo(component);\n return {\n renamedFrom: renamingInfo?.renamedFrom.toString(),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,cAAc,CAACC,QAAsB,EAAU;EAC7D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTJ,QAAQ,EAAGK,SAAoB,IAAK;UAClC,MAAMC,YAAY,GAAGN,QAAQ,CAACO,eAAe,CAACF,SAAS,CAAC;UACxD,OAAO;YACLG,WAAW,EAAEF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,WAAW,CAACC,QAAQ;UACjD,CAAC;QACH;MACF;IACF;EACF,CAAC;AACH"}
@@ -1,204 +1,142 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.RenamingMain = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _bitError() {
25
18
  const data = require("@teambit/bit-error");
26
-
27
19
  _bitError = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _componentIdToPackageName() {
35
25
  const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/bit/component-id-to-package-name"));
36
-
37
26
  _componentIdToPackageName = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _config() {
45
32
  const data = require("@teambit/config");
46
-
47
33
  _config = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _cli() {
55
39
  const data = require("@teambit/cli");
56
-
57
40
  _cli = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _component() {
65
46
  const data = _interopRequireWildcard(require("@teambit/component"));
66
-
67
47
  _component = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _deprecation() {
75
53
  const data = require("@teambit/deprecation");
76
-
77
54
  _deprecation = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function _graphql() {
85
60
  const data = _interopRequireDefault(require("@teambit/graphql"));
86
-
87
61
  _graphql = function () {
88
62
  return data;
89
63
  };
90
-
91
64
  return data;
92
65
  }
93
-
94
66
  function _newComponentHelper() {
95
67
  const data = _interopRequireDefault(require("@teambit/new-component-helper"));
96
-
97
68
  _newComponentHelper = function () {
98
69
  return data;
99
70
  };
100
-
101
71
  return data;
102
72
  }
103
-
104
73
  function _refactoring() {
105
74
  const data = _interopRequireDefault(require("@teambit/refactoring"));
106
-
107
75
  _refactoring = function () {
108
76
  return data;
109
77
  };
110
-
111
78
  return data;
112
79
  }
113
-
114
80
  function _componentConfig() {
115
81
  const data = require("@teambit/legacy/dist/consumer/config/component-config");
116
-
117
82
  _componentConfig = function () {
118
83
  return data;
119
84
  };
120
-
121
85
  return data;
122
86
  }
123
-
124
87
  function _workspace() {
125
88
  const data = _interopRequireDefault(require("@teambit/workspace"));
126
-
127
89
  _workspace = function () {
128
90
  return data;
129
91
  };
130
-
131
92
  return data;
132
93
  }
133
-
134
94
  function _install() {
135
95
  const data = require("@teambit/install");
136
-
137
96
  _install = function () {
138
97
  return data;
139
98
  };
140
-
141
99
  return data;
142
100
  }
143
-
144
101
  function _rename() {
145
102
  const data = require("./rename.cmd");
146
-
147
103
  _rename = function () {
148
104
  return data;
149
105
  };
150
-
151
106
  return data;
152
107
  }
153
-
154
108
  function _renaming() {
155
109
  const data = require("./renaming.aspect");
156
-
157
110
  _renaming = function () {
158
111
  return data;
159
112
  };
160
-
161
113
  return data;
162
114
  }
163
-
164
115
  function _renaming2() {
165
116
  const data = require("./renaming.fragment");
166
-
167
117
  _renaming2 = function () {
168
118
  return data;
169
119
  };
170
-
171
120
  return data;
172
121
  }
173
-
174
122
  function _renaming3() {
175
123
  const data = require("./renaming.graphql");
176
-
177
124
  _renaming3 = function () {
178
125
  return data;
179
126
  };
180
-
181
127
  return data;
182
128
  }
183
-
184
129
  function _scopeRename() {
185
130
  const data = require("./scope-rename.cmd");
186
-
187
131
  _scopeRename = function () {
188
132
  return data;
189
133
  };
190
-
191
134
  return data;
192
135
  }
193
-
194
136
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
195
-
196
137
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
197
-
198
138
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
199
-
200
139
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
201
-
202
140
  class RenamingMain {
203
141
  constructor(workspace, install, newComponentHelper, deprecation, refactoring, config) {
204
142
  this.workspace = workspace;
@@ -208,13 +146,11 @@ class RenamingMain {
208
146
  this.refactoring = refactoring;
209
147
  this.config = config;
210
148
  }
211
-
212
149
  async rename(sourceIdStr, targetIdStr, options) {
213
150
  const sourceId = await this.workspace.resolveComponentId(sourceIdStr);
214
151
  const isTagged = sourceId.hasVersion();
215
152
  const sourceComp = await this.workspace.get(sourceId);
216
153
  const targetId = this.newComponentHelper.getNewComponentId(targetIdStr, undefined, options === null || options === void 0 ? void 0 : options.scope);
217
-
218
154
  if (isTagged) {
219
155
  const config = await this.getConfig(sourceComp);
220
156
  await this.newComponentHelper.writeAndAddNewComp(sourceComp, targetId, options, config);
@@ -223,7 +159,6 @@ class RenamingMain {
223
159
  this.workspace.bitMap.renameNewComponent(sourceId, targetId);
224
160
  await this.workspace.bitMap.write();
225
161
  }
226
-
227
162
  if (options.refactor) {
228
163
  const allComponents = await this.workspace.list();
229
164
  const {
@@ -231,42 +166,35 @@ class RenamingMain {
231
166
  } = await this.refactoring.refactorDependencyName(allComponents, sourceId, targetId);
232
167
  await Promise.all(changedComponents.map(comp => this.workspace.write(comp)));
233
168
  }
234
-
235
169
  await this.install.link();
236
170
  return {
237
171
  sourceId,
238
172
  targetId
239
173
  };
240
174
  }
241
-
242
175
  getRenamingInfo(component) {
243
176
  var _component$state$aspe;
244
-
245
177
  const renameConfig = (_component$state$aspe = component.state.aspects.get(_renaming().RenamingAspect.id)) === null || _component$state$aspe === void 0 ? void 0 : _component$state$aspe.config;
246
178
  if (!renameConfig) return null;
247
179
  return {
248
180
  renamedFrom: _component().ComponentID.fromObject(renameConfig.renamedFrom)
249
181
  };
250
182
  }
183
+
251
184
  /**
252
185
  * change the default-scope for new components. optionally (if refactor is true), change the source code to match the
253
186
  * new scope-name.
254
187
  * keep in mind that this is working for new components only, for tagged/exported it's impossible. See the errors
255
188
  * thrown in such cases in this method.
256
189
  */
257
-
258
-
259
190
  async renameScope(oldScope, newScope, options) {
260
191
  const allComponents = await this.workspace.list();
261
192
  const componentsUsingOldScope = allComponents.filter(comp => comp.id.scope === oldScope);
262
-
263
193
  if (!componentsUsingOldScope.length && this.workspace.defaultScope !== oldScope) {
264
194
  throw new (_bitError().BitError)(`none of the components is using "${oldScope}". also, the workspace is not configured with "${oldScope}"`);
265
- } // verify they're all new.
266
-
267
-
195
+ }
196
+ // verify they're all new.
268
197
  const exported = componentsUsingOldScope.filter(comp => comp.id._legacy.hasScope());
269
-
270
198
  if (exported.length) {
271
199
  const idsStr = exported.map(comp => comp.id.toString()).join(', ');
272
200
  throw new (_bitError().BitError)(`unable to rename the scope for the following exported components:\n${idsStr}
@@ -274,26 +202,21 @@ because these components were exported already, other components may use them an
274
202
  instead, deprecate the above components (using "bit deprecate"), tag, export and then eject them.
275
203
  once they are not in the workspace, you can fork them ("bit fork") with the new scope-name`);
276
204
  }
277
-
278
205
  const tagged = componentsUsingOldScope.filter(comp => comp.id.hasVersion());
279
-
280
206
  if (tagged.length) {
281
207
  const idsStr = tagged.map(comp => comp.id.toString()).join(', ');
282
208
  throw new (_bitError().BitError)(`unable to rename the scope for the following tagged components:\n${idsStr}
283
209
  because these components were tagged, the objects have the dependencies data of the old-scope.
284
210
  to be able to rename the scope, please untag the components first (using "bit reset" command)`);
285
211
  }
286
-
287
212
  if (this.workspace.defaultScope === oldScope) {
288
213
  await this.workspace.setDefaultScope(newScope);
289
214
  componentsUsingOldScope.forEach(comp => this.workspace.bitMap.removeDefaultScope(comp.id));
290
215
  } else {
291
216
  componentsUsingOldScope.forEach(comp => this.workspace.bitMap.setDefaultScope(comp.id, newScope));
292
217
  }
293
-
294
218
  await this.workspace.bitMap.write();
295
219
  const refactoredIds = [];
296
-
297
220
  if (options.refactor) {
298
221
  const legacyComps = componentsUsingOldScope.map(c => c.state._consumer);
299
222
  const packagesToReplace = legacyComps.map(comp => {
@@ -313,13 +236,11 @@ to be able to rename the scope, please untag the components first (using "bit re
313
236
  await Promise.all(changedComponents.map(comp => this.workspace.write(comp)));
314
237
  refactoredIds.push(...changedComponents.map(c => c.id));
315
238
  }
316
-
317
239
  return {
318
240
  scopeRenamedComponentIds: componentsUsingOldScope.map(comp => comp.id),
319
241
  refactoredIds
320
242
  };
321
243
  }
322
-
323
244
  async renameScopeOfAspectIdsInWorkspaceConfig(ids, newScope) {
324
245
  const config = this.config.workspaceConfig;
325
246
  if (!config) throw new Error('unable to get workspace config');
@@ -330,7 +251,6 @@ to be able to rename the scope, please untag the components first (using "bit re
330
251
  });
331
252
  if (hasChanged) await config.write();
332
253
  }
333
-
334
254
  async getConfig(comp) {
335
255
  const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);
336
256
  return _objectSpread(_objectSpread({}, fromExisting), {}, {
@@ -339,10 +259,8 @@ to be able to rename the scope, please untag the components first (using "bit re
339
259
  }
340
260
  });
341
261
  }
342
-
343
262
  static async provider([cli, workspace, deprecation, newComponentHelper, componentMain, graphql, refactoring, install, config]) {
344
263
  var _scopeCommand$command;
345
-
346
264
  const renaming = new RenamingMain(workspace, install, newComponentHelper, deprecation, refactoring, config);
347
265
  cli.register(new (_rename().RenameCmd)(renaming));
348
266
  const scopeCommand = cli.getCommand('scope');
@@ -351,14 +269,11 @@ to be able to rename the scope, please untag the components first (using "bit re
351
269
  componentMain.registerShowFragments([new (_renaming2().RenamingFragment)(renaming)]);
352
270
  return renaming;
353
271
  }
354
-
355
272
  }
356
-
357
273
  exports.RenamingMain = RenamingMain;
358
274
  (0, _defineProperty2().default)(RenamingMain, "slots", []);
359
275
  (0, _defineProperty2().default)(RenamingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _deprecation().DeprecationAspect, _newComponentHelper().default, _component().default, _graphql().default, _refactoring().default, _install().InstallAspect, _config().ConfigAspect]);
360
276
  (0, _defineProperty2().default)(RenamingMain, "runtime", _cli().MainRuntime);
361
-
362
277
  _renaming().RenamingAspect.addRuntime(RenamingMain);
363
278
 
364
279
  //# sourceMappingURL=renaming.main.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RenamingMain","constructor","workspace","install","newComponentHelper","deprecation","refactoring","config","rename","sourceIdStr","targetIdStr","options","sourceId","resolveComponentId","isTagged","hasVersion","sourceComp","get","targetId","getNewComponentId","undefined","scope","getConfig","writeAndAddNewComp","deprecate","bitMap","renameNewComponent","write","refactor","allComponents","list","changedComponents","refactorDependencyName","Promise","all","map","comp","link","getRenamingInfo","component","renameConfig","state","aspects","RenamingAspect","id","renamedFrom","ComponentID","fromObject","renameScope","oldScope","newScope","componentsUsingOldScope","filter","length","defaultScope","BitError","exported","_legacy","hasScope","idsStr","toString","join","tagged","setDefaultScope","forEach","removeDefaultScope","refactoredIds","legacyComps","c","_consumer","packagesToReplace","oldStr","componentIdToPackageName","newStr","bindingPrefix","getBindingPrefixByDefaultScope","replaceMultipleStrings","renameScopeOfAspectIdsInWorkspaceConfig","push","scopeRenamedComponentIds","ids","workspaceConfig","Error","hasChanged","changed","renameExtensionInRaw","toStringWithoutVersion","changeScope","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","graphql","renaming","register","RenameCmd","scopeCommand","getCommand","commands","ScopeRenameCmd","renamingSchema","registerShowFragments","RenamingFragment","CLIAspect","WorkspaceAspect","DeprecationAspect","NewComponentHelperAspect","ComponentAspect","GraphqlAspect","RefactoringAspect","InstallAspect","ConfigAspect","MainRuntime","addRuntime"],"sources":["renaming.main.runtime.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { DeprecationAspect, DeprecationMain } from '@teambit/deprecation';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring';\nimport { getBindingPrefixByDefaultScope } from '@teambit/legacy/dist/consumer/config/component-config';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { RenameCmd, RenameOptions } from './rename.cmd';\nimport { RenamingAspect } from './renaming.aspect';\nimport { RenamingFragment } from './renaming.fragment';\nimport { renamingSchema } from './renaming.graphql';\nimport { ScopeRenameCmd } from './scope-rename.cmd';\n\nexport class RenamingMain {\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private newComponentHelper: NewComponentHelperMain,\n private deprecation: DeprecationMain,\n private refactoring: RefactoringMain,\n private config: ConfigMain\n ) {}\n\n async rename(sourceIdStr: string, targetIdStr: string, options: RenameOptions): Promise<RenameDependencyNameResult> {\n const sourceId = await this.workspace.resolveComponentId(sourceIdStr);\n const isTagged = sourceId.hasVersion();\n const sourceComp = await this.workspace.get(sourceId);\n const targetId = this.newComponentHelper.getNewComponentId(targetIdStr, undefined, options?.scope);\n if (isTagged) {\n const config = await this.getConfig(sourceComp);\n await this.newComponentHelper.writeAndAddNewComp(sourceComp, targetId, options, config);\n await this.deprecation.deprecate(sourceId, targetId);\n } else {\n this.workspace.bitMap.renameNewComponent(sourceId, targetId);\n await this.workspace.bitMap.write();\n }\n if (options.refactor) {\n const allComponents = await this.workspace.list();\n const { changedComponents } = await this.refactoring.refactorDependencyName(allComponents, sourceId, targetId);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n\n await this.install.link();\n\n return {\n sourceId,\n targetId,\n };\n }\n\n getRenamingInfo(component: Component): RenamingInfo | null {\n const renameConfig = component.state.aspects.get(RenamingAspect.id)?.config as RenamingInfo | undefined;\n if (!renameConfig) return null;\n return {\n renamedFrom: ComponentID.fromObject(renameConfig.renamedFrom),\n };\n }\n\n /**\n * change the default-scope for new components. optionally (if refactor is true), change the source code to match the\n * new scope-name.\n * keep in mind that this is working for new components only, for tagged/exported it's impossible. See the errors\n * thrown in such cases in this method.\n */\n async renameScope(oldScope: string, newScope: string, options: { refactor?: boolean }): Promise<RenameScopeResult> {\n const allComponents = await this.workspace.list();\n const componentsUsingOldScope = allComponents.filter((comp) => comp.id.scope === oldScope);\n if (!componentsUsingOldScope.length && this.workspace.defaultScope !== oldScope) {\n throw new BitError(\n `none of the components is using \"${oldScope}\". also, the workspace is not configured with \"${oldScope}\"`\n );\n }\n // verify they're all new.\n const exported = componentsUsingOldScope.filter((comp) => comp.id._legacy.hasScope());\n if (exported.length) {\n const idsStr = exported.map((comp) => comp.id.toString()).join(', ');\n throw new BitError(`unable to rename the scope for the following exported components:\\n${idsStr}\nbecause these components were exported already, other components may use them and they'll break upon rename.\ninstead, deprecate the above components (using \"bit deprecate\"), tag, export and then eject them.\nonce they are not in the workspace, you can fork them (\"bit fork\") with the new scope-name`);\n }\n const tagged = componentsUsingOldScope.filter((comp) => comp.id.hasVersion());\n if (tagged.length) {\n const idsStr = tagged.map((comp) => comp.id.toString()).join(', ');\n throw new BitError(`unable to rename the scope for the following tagged components:\\n${idsStr}\nbecause these components were tagged, the objects have the dependencies data of the old-scope.\nto be able to rename the scope, please untag the components first (using \"bit reset\" command)`);\n }\n if (this.workspace.defaultScope === oldScope) {\n await this.workspace.setDefaultScope(newScope);\n componentsUsingOldScope.forEach((comp) => this.workspace.bitMap.removeDefaultScope(comp.id));\n } else {\n componentsUsingOldScope.forEach((comp) => this.workspace.bitMap.setDefaultScope(comp.id, newScope));\n }\n await this.workspace.bitMap.write();\n const refactoredIds: ComponentID[] = [];\n if (options.refactor) {\n const legacyComps = componentsUsingOldScope.map((c) => c.state._consumer);\n const packagesToReplace: MultipleStringsReplacement = legacyComps.map((comp) => {\n return {\n oldStr: componentIdToPackageName(comp),\n newStr: componentIdToPackageName({\n ...comp,\n bindingPrefix: getBindingPrefixByDefaultScope(newScope),\n id: comp.id,\n defaultScope: newScope,\n }),\n };\n });\n const { changedComponents } = await this.refactoring.replaceMultipleStrings(allComponents, packagesToReplace);\n await this.renameScopeOfAspectIdsInWorkspaceConfig(\n componentsUsingOldScope.map((c) => c.id),\n newScope\n );\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n refactoredIds.push(...changedComponents.map((c) => c.id));\n }\n\n return { scopeRenamedComponentIds: componentsUsingOldScope.map((comp) => comp.id), refactoredIds };\n }\n\n private async renameScopeOfAspectIdsInWorkspaceConfig(ids: ComponentID[], newScope: string) {\n const config = this.config.workspaceConfig;\n if (!config) throw new Error('unable to get workspace config');\n let hasChanged = false;\n ids.forEach((id) => {\n const changed = config.renameExtensionInRaw(\n id.toStringWithoutVersion(),\n id._legacy.changeScope(newScope).toStringWithoutVersion()\n );\n if (changed) hasChanged = true;\n });\n if (hasChanged) await config.write();\n }\n\n private async getConfig(comp: Component) {\n const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);\n return {\n ...fromExisting,\n [RenamingAspect.id]: {\n renamedFrom: comp.id.toObject(),\n },\n };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DeprecationAspect,\n NewComponentHelperAspect,\n ComponentAspect,\n GraphqlAspect,\n RefactoringAspect,\n InstallAspect,\n ConfigAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n deprecation,\n newComponentHelper,\n componentMain,\n graphql,\n refactoring,\n install,\n config,\n ]: [\n CLIMain,\n Workspace,\n DeprecationMain,\n NewComponentHelperMain,\n ComponentMain,\n GraphqlMain,\n RefactoringMain,\n InstallMain,\n ConfigMain\n ]) {\n const renaming = new RenamingMain(workspace, install, newComponentHelper, deprecation, refactoring, config);\n cli.register(new RenameCmd(renaming));\n\n const scopeCommand = cli.getCommand('scope');\n scopeCommand?.commands?.push(new ScopeRenameCmd(renaming));\n\n graphql.register(renamingSchema(renaming));\n componentMain.registerShowFragments([new RenamingFragment(renaming)]);\n return renaming;\n }\n}\n\nRenamingAspect.addRuntime(RenamingMain);\n\nexport type RenameDependencyNameResult = { sourceId: ComponentID; targetId: ComponentID };\n\nexport type RenamingInfo = {\n renamedFrom: ComponentID;\n};\n\nexport type RenameScopeResult = { scopeRenamedComponentIds: ComponentID[]; refactoredIds: ComponentID[] };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IA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CAA0BnH,YAA1B"}
1
+ {"version":3,"names":["RenamingMain","constructor","workspace","install","newComponentHelper","deprecation","refactoring","config","rename","sourceIdStr","targetIdStr","options","sourceId","resolveComponentId","isTagged","hasVersion","sourceComp","get","targetId","getNewComponentId","undefined","scope","getConfig","writeAndAddNewComp","deprecate","bitMap","renameNewComponent","write","refactor","allComponents","list","changedComponents","refactorDependencyName","Promise","all","map","comp","link","getRenamingInfo","component","renameConfig","state","aspects","RenamingAspect","id","renamedFrom","ComponentID","fromObject","renameScope","oldScope","newScope","componentsUsingOldScope","filter","length","defaultScope","BitError","exported","_legacy","hasScope","idsStr","toString","join","tagged","setDefaultScope","forEach","removeDefaultScope","refactoredIds","legacyComps","c","_consumer","packagesToReplace","oldStr","componentIdToPackageName","newStr","bindingPrefix","getBindingPrefixByDefaultScope","replaceMultipleStrings","renameScopeOfAspectIdsInWorkspaceConfig","push","scopeRenamedComponentIds","ids","workspaceConfig","Error","hasChanged","changed","renameExtensionInRaw","toStringWithoutVersion","changeScope","fromExisting","getConfigFromExistingToNewComponent","toObject","provider","cli","componentMain","graphql","renaming","register","RenameCmd","scopeCommand","getCommand","commands","ScopeRenameCmd","renamingSchema","registerShowFragments","RenamingFragment","CLIAspect","WorkspaceAspect","DeprecationAspect","NewComponentHelperAspect","ComponentAspect","GraphqlAspect","RefactoringAspect","InstallAspect","ConfigAspect","MainRuntime","addRuntime"],"sources":["renaming.main.runtime.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component';\nimport { DeprecationAspect, DeprecationMain } from '@teambit/deprecation';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring';\nimport { getBindingPrefixByDefaultScope } from '@teambit/legacy/dist/consumer/config/component-config';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { RenameCmd, RenameOptions } from './rename.cmd';\nimport { RenamingAspect } from './renaming.aspect';\nimport { RenamingFragment } from './renaming.fragment';\nimport { renamingSchema } from './renaming.graphql';\nimport { ScopeRenameCmd } from './scope-rename.cmd';\n\nexport class RenamingMain {\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private newComponentHelper: NewComponentHelperMain,\n private deprecation: DeprecationMain,\n private refactoring: RefactoringMain,\n private config: ConfigMain\n ) {}\n\n async rename(sourceIdStr: string, targetIdStr: string, options: RenameOptions): Promise<RenameDependencyNameResult> {\n const sourceId = await this.workspace.resolveComponentId(sourceIdStr);\n const isTagged = sourceId.hasVersion();\n const sourceComp = await this.workspace.get(sourceId);\n const targetId = this.newComponentHelper.getNewComponentId(targetIdStr, undefined, options?.scope);\n if (isTagged) {\n const config = await this.getConfig(sourceComp);\n await this.newComponentHelper.writeAndAddNewComp(sourceComp, targetId, options, config);\n await this.deprecation.deprecate(sourceId, targetId);\n } else {\n this.workspace.bitMap.renameNewComponent(sourceId, targetId);\n await this.workspace.bitMap.write();\n }\n if (options.refactor) {\n const allComponents = await this.workspace.list();\n const { changedComponents } = await this.refactoring.refactorDependencyName(allComponents, sourceId, targetId);\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n }\n\n await this.install.link();\n\n return {\n sourceId,\n targetId,\n };\n }\n\n getRenamingInfo(component: Component): RenamingInfo | null {\n const renameConfig = component.state.aspects.get(RenamingAspect.id)?.config as RenamingInfo | undefined;\n if (!renameConfig) return null;\n return {\n renamedFrom: ComponentID.fromObject(renameConfig.renamedFrom),\n };\n }\n\n /**\n * change the default-scope for new components. optionally (if refactor is true), change the source code to match the\n * new scope-name.\n * keep in mind that this is working for new components only, for tagged/exported it's impossible. See the errors\n * thrown in such cases in this method.\n */\n async renameScope(oldScope: string, newScope: string, options: { refactor?: boolean }): Promise<RenameScopeResult> {\n const allComponents = await this.workspace.list();\n const componentsUsingOldScope = allComponents.filter((comp) => comp.id.scope === oldScope);\n if (!componentsUsingOldScope.length && this.workspace.defaultScope !== oldScope) {\n throw new BitError(\n `none of the components is using \"${oldScope}\". also, the workspace is not configured with \"${oldScope}\"`\n );\n }\n // verify they're all new.\n const exported = componentsUsingOldScope.filter((comp) => comp.id._legacy.hasScope());\n if (exported.length) {\n const idsStr = exported.map((comp) => comp.id.toString()).join(', ');\n throw new BitError(`unable to rename the scope for the following exported components:\\n${idsStr}\nbecause these components were exported already, other components may use them and they'll break upon rename.\ninstead, deprecate the above components (using \"bit deprecate\"), tag, export and then eject them.\nonce they are not in the workspace, you can fork them (\"bit fork\") with the new scope-name`);\n }\n const tagged = componentsUsingOldScope.filter((comp) => comp.id.hasVersion());\n if (tagged.length) {\n const idsStr = tagged.map((comp) => comp.id.toString()).join(', ');\n throw new BitError(`unable to rename the scope for the following tagged components:\\n${idsStr}\nbecause these components were tagged, the objects have the dependencies data of the old-scope.\nto be able to rename the scope, please untag the components first (using \"bit reset\" command)`);\n }\n if (this.workspace.defaultScope === oldScope) {\n await this.workspace.setDefaultScope(newScope);\n componentsUsingOldScope.forEach((comp) => this.workspace.bitMap.removeDefaultScope(comp.id));\n } else {\n componentsUsingOldScope.forEach((comp) => this.workspace.bitMap.setDefaultScope(comp.id, newScope));\n }\n await this.workspace.bitMap.write();\n const refactoredIds: ComponentID[] = [];\n if (options.refactor) {\n const legacyComps = componentsUsingOldScope.map((c) => c.state._consumer);\n const packagesToReplace: MultipleStringsReplacement = legacyComps.map((comp) => {\n return {\n oldStr: componentIdToPackageName(comp),\n newStr: componentIdToPackageName({\n ...comp,\n bindingPrefix: getBindingPrefixByDefaultScope(newScope),\n id: comp.id,\n defaultScope: newScope,\n }),\n };\n });\n const { changedComponents } = await this.refactoring.replaceMultipleStrings(allComponents, packagesToReplace);\n await this.renameScopeOfAspectIdsInWorkspaceConfig(\n componentsUsingOldScope.map((c) => c.id),\n newScope\n );\n await Promise.all(changedComponents.map((comp) => this.workspace.write(comp)));\n refactoredIds.push(...changedComponents.map((c) => c.id));\n }\n\n return { scopeRenamedComponentIds: componentsUsingOldScope.map((comp) => comp.id), refactoredIds };\n }\n\n private async renameScopeOfAspectIdsInWorkspaceConfig(ids: ComponentID[], newScope: string) {\n const config = this.config.workspaceConfig;\n if (!config) throw new Error('unable to get workspace config');\n let hasChanged = false;\n ids.forEach((id) => {\n const changed = config.renameExtensionInRaw(\n id.toStringWithoutVersion(),\n id._legacy.changeScope(newScope).toStringWithoutVersion()\n );\n if (changed) hasChanged = true;\n });\n if (hasChanged) await config.write();\n }\n\n private async getConfig(comp: Component) {\n const fromExisting = await this.newComponentHelper.getConfigFromExistingToNewComponent(comp);\n return {\n ...fromExisting,\n [RenamingAspect.id]: {\n renamedFrom: comp.id.toObject(),\n },\n };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n DeprecationAspect,\n NewComponentHelperAspect,\n ComponentAspect,\n GraphqlAspect,\n RefactoringAspect,\n InstallAspect,\n ConfigAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n deprecation,\n newComponentHelper,\n componentMain,\n graphql,\n refactoring,\n install,\n config,\n ]: [\n CLIMain,\n Workspace,\n DeprecationMain,\n NewComponentHelperMain,\n ComponentMain,\n GraphqlMain,\n RefactoringMain,\n InstallMain,\n ConfigMain\n ]) {\n const renaming = new RenamingMain(workspace, install, newComponentHelper, deprecation, refactoring, config);\n cli.register(new RenameCmd(renaming));\n\n const scopeCommand = cli.getCommand('scope');\n scopeCommand?.commands?.push(new ScopeRenameCmd(renaming));\n\n graphql.register(renamingSchema(renaming));\n componentMain.registerShowFragments([new RenamingFragment(renaming)]);\n return renaming;\n }\n}\n\nRenamingAspect.addRuntime(RenamingMain);\n\nexport type RenameDependencyNameResult = { sourceId: ComponentID; targetId: ComponentID };\n\nexport type RenamingInfo = {\n renamedFrom: ComponentID;\n};\n\nexport type RenameScopeResult = { scopeRenamedComponentIds: ComponentID[]; refactoredIds: ComponentID[] };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoD;AAAA;AAAA;AAAA;AAE7C,MAAMA,YAAY,CAAC;EACxBC,WAAW,CACDC,SAAoB,EACpBC,OAAoB,EACpBC,kBAA0C,EAC1CC,WAA4B,EAC5BC,WAA4B,EAC5BC,MAAkB,EAC1B;IAAA,KANQL,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,OAAoB,GAApBA,OAAoB;IAAA,KACpBC,kBAA0C,GAA1CA,kBAA0C;IAAA,KAC1CC,WAA4B,GAA5BA,WAA4B;IAAA,KAC5BC,WAA4B,GAA5BA,WAA4B;IAAA,K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gB,EAACT,QAAQ,CAAC,CAAC,CAAC;IACrE,OAAOA,QAAQ;EACjB;AACF;AAAC;AAAA,gCAhLY/F,YAAY,WAoIR,EAAE;AAAA,gCApINA,YAAY,kBAqID,CACpByG,gBAAS,EACTC,oBAAe,EACfC,gCAAiB,EACjBC,6BAAwB,EACxBC,oBAAe,EACfC,kBAAa,EACbC,sBAAiB,EACjBC,wBAAa,EACbC,sBAAY,CACb;AAAA,gCA/IUjH,YAAY,aAgJNkH,kBAAW;AAkC9BvE,0BAAc,CAACwE,UAAU,CAACnH,YAAY,CAAC"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.ScopeRenameCmd = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  class ScopeRenameCmd {
35
25
  constructor(renaming) {
36
26
  this.renaming = renaming;
@@ -46,7 +36,6 @@ class ScopeRenameCmd {
46
36
  (0, _defineProperty2().default)(this, "options", [['r', 'refactor', 'update the import statements in all dependent components to the new package name (that contains the new scope name)']]);
47
37
  (0, _defineProperty2().default)(this, "group", 'development');
48
38
  }
49
-
50
39
  async report([oldName, newName], {
51
40
  refactor
52
41
  }) {
@@ -56,16 +45,12 @@ class ScopeRenameCmd {
56
45
  } = await this.renaming.renameScope(oldName, newName, {
57
46
  refactor
58
47
  });
59
-
60
48
  const title = _chalk().default.green(`successfully replaced "${oldName}" scope with "${newName}"`);
61
-
62
49
  const renamedIdsStr = scopeRenamedComponentIds.length ? `\n${_chalk().default.bold('the following components were affected by this scope-name change:')}\n${scopeRenamedComponentIds.map(c => c.changeScope(newName)).join('\n')}` : '';
63
50
  const refactoredStr = refactoredIds.length ? `\n\n${_chalk().default.bold('the following components have been refactored:')}\n${refactoredIds.join('\n')}` : '';
64
51
  return `${title}\n${renamedIdsStr}${refactoredStr}`;
65
52
  }
66
-
67
53
  }
68
-
69
54
  exports.ScopeRenameCmd = ScopeRenameCmd;
70
55
 
71
56
  //# sourceMappingURL=scope-rename.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ScopeRenameCmd","constructor","renaming","name","description","report","oldName","newName","refactor","scopeRenamedComponentIds","refactoredIds","renameScope","title","chalk","green","renamedIdsStr","length","bold","map","c","changeScope","join","refactoredStr"],"sources":["scope-rename.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport class ScopeRenameCmd implements Command {\n name = 'rename <current-scope-name> <new-scope-name>';\n description = \"Renames the scope name for all components with the specified 'current scope name'\";\n arguments = [\n { name: 'current-scope-name', description: 'the scope name to be replaced by another scope name' },\n { name: 'new-scope-name', description: 'a new scope name to replace the current scope name' },\n ];\n options = [\n [\n 'r',\n 'refactor',\n 'update the import statements in all dependent components to the new package name (that contains the new scope name)',\n ],\n ] as CommandOptions;\n group = 'development';\n\n constructor(private renaming: RenamingMain) {}\n\n async report([oldName, newName]: [string, string], { refactor }: { refactor?: boolean }) {\n const { scopeRenamedComponentIds, refactoredIds } = await this.renaming.renameScope(oldName, newName, { refactor });\n const title = chalk.green(`successfully replaced \"${oldName}\" scope with \"${newName}\"`);\n const renamedIdsStr = scopeRenamedComponentIds.length\n ? `\\n${chalk.bold(\n 'the following components were affected by this scope-name change:'\n )}\\n${scopeRenamedComponentIds.map((c) => c.changeScope(newName)).join('\\n')}`\n : '';\n const refactoredStr = refactoredIds.length\n ? `\\n\\n${chalk.bold('the following components have been refactored:')}\\n${refactoredIds.join('\\n')}`\n : '';\n return `${title}\\n${renamedIdsStr}${refactoredStr}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAgB7CC,WAAW,CAASC,QAAT,EAAiC;IAAA,KAAxBA,QAAwB,GAAxBA,QAAwB;IAAA,8CAfrC,8CAeqC;IAAA,qDAd9B,mFAc8B;IAAA,mDAbhC,CACV;MAAEC,IAAI,EAAE,oBAAR;MAA8BC,WAAW,EAAE;IAA3C,CADU,EAEV;MAAED,IAAI,EAAE,gBAAR;MAA0BC,WAAW,EAAE;IAAvC,CAFU,CAagC;IAAA,iDATlC,CACR,CACE,GADF,EAEE,UAFF,EAGE,qHAHF,CADQ,CASkC;IAAA,+CAFpC,aAEoC;EAAE;;EAElC,MAANC,MAAM,CAAC,CAACC,OAAD,EAAUC,OAAV,CAAD,EAAuC;IAAEC;EAAF,CAAvC,EAA6E;IACvF,MAAM;MAAEC,wBAAF;MAA4BC;IAA5B,IAA8C,MAAM,KAAKR,QAAL,CAAcS,WAAd,CAA0BL,OAA1B,EAAmCC,OAAnC,EAA4C;MAAEC;IAAF,CAA5C,CAA1D;;IACA,MAAMI,KAAK,GAAGC,gBAAA,CAAMC,KAAN,CAAa,0BAAyBR,OAAQ,iBAAgBC,OAAQ,GAAtE,CAAd;;IACA,MAAMQ,aAAa,GAAGN,wBAAwB,CAACO,MAAzB,GACjB,KAAIH,gBAAA,CAAMI,IAAN,CACH,mEADG,CAEH,KAAIR,wBAAwB,CAACS,GAAzB,CAA8BC,CAAD,IAAOA,CAAC,CAACC,WAAF,CAAcb,OAAd,CAApC,EAA4Dc,IAA5D,CAAiE,IAAjE,CAAuE,EAH3D,GAIlB,EAJJ;IAKA,MAAMC,aAAa,GAAGZ,aAAa,CAACM,MAAd,GACjB,OAAMH,gBAAA,CAAMI,IAAN,CAAW,gDAAX,CAA6D,KAAIP,aAAa,CAACW,IAAd,CAAmB,IAAnB,CAAyB,EAD/E,GAElB,EAFJ;IAGA,OAAQ,GAAET,KAAM,KAAIG,aAAc,GAAEO,aAAc,EAAlD;EACD;;AA9B4C"}
1
+ {"version":3,"names":["ScopeRenameCmd","constructor","renaming","name","description","report","oldName","newName","refactor","scopeRenamedComponentIds","refactoredIds","renameScope","title","chalk","green","renamedIdsStr","length","bold","map","c","changeScope","join","refactoredStr"],"sources":["scope-rename.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { RenamingMain } from './renaming.main.runtime';\n\nexport class ScopeRenameCmd implements Command {\n name = 'rename <current-scope-name> <new-scope-name>';\n description = \"Renames the scope name for all components with the specified 'current scope name'\";\n arguments = [\n { name: 'current-scope-name', description: 'the scope name to be replaced by another scope name' },\n { name: 'new-scope-name', description: 'a new scope name to replace the current scope name' },\n ];\n options = [\n [\n 'r',\n 'refactor',\n 'update the import statements in all dependent components to the new package name (that contains the new scope name)',\n ],\n ] as CommandOptions;\n group = 'development';\n\n constructor(private renaming: RenamingMain) {}\n\n async report([oldName, newName]: [string, string], { refactor }: { refactor?: boolean }) {\n const { scopeRenamedComponentIds, refactoredIds } = await this.renaming.renameScope(oldName, newName, { refactor });\n const title = chalk.green(`successfully replaced \"${oldName}\" scope with \"${newName}\"`);\n const renamedIdsStr = scopeRenamedComponentIds.length\n ? `\\n${chalk.bold(\n 'the following components were affected by this scope-name change:'\n )}\\n${scopeRenamedComponentIds.map((c) => c.changeScope(newName)).join('\\n')}`\n : '';\n const refactoredStr = refactoredIds.length\n ? `\\n\\n${chalk.bold('the following components have been refactored:')}\\n${refactoredIds.join('\\n')}`\n : '';\n return `${title}\\n${renamedIdsStr}${refactoredStr}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;E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1,12 @@
1
1
  {
2
2
  "name": "@teambit/renaming",
3
- "version": "0.0.284",
3
+ "version": "0.0.286",
4
4
  "homepage": "https://bit.dev/teambit/component/renaming",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "renaming",
9
- "version": "0.0.284"
9
+ "version": "0.0.286"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,16 +14,16 @@
14
14
  "@babel/runtime": "7.12.18",
15
15
  "core-js": "^3.0.0",
16
16
  "@teambit/harmony": "0.3.3",
17
- "@teambit/cli": "0.0.590",
18
- "@teambit/component": "0.0.880",
19
- "@teambit/graphql": "0.0.880",
17
+ "@teambit/cli": "0.0.591",
18
+ "@teambit/component": "0.0.882",
19
+ "@teambit/graphql": "0.0.882",
20
20
  "@teambit/bit-error": "0.0.400",
21
- "@teambit/config": "0.0.603",
22
- "@teambit/deprecation": "0.0.880",
23
- "@teambit/install": "0.0.27",
24
- "@teambit/new-component-helper": "0.0.284",
25
- "@teambit/refactoring": "0.0.177",
26
- "@teambit/workspace": "0.0.880"
21
+ "@teambit/config": "0.0.604",
22
+ "@teambit/deprecation": "0.0.882",
23
+ "@teambit/install": "0.0.29",
24
+ "@teambit/new-component-helper": "0.0.286",
25
+ "@teambit/refactoring": "0.0.179",
26
+ "@teambit/workspace": "0.0.882"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/react": "^17.0.8",
@@ -34,7 +34,7 @@
34
34
  "@types/node": "12.20.4"
35
35
  },
36
36
  "peerDependencies": {
37
- "@teambit/legacy": "1.0.373",
37
+ "@teambit/legacy": "1.0.374",
38
38
  "react-dom": "^16.8.0 || ^17.0.0",
39
39
  "react": "^16.8.0 || ^17.0.0"
40
40
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_renaming@0.0.284/dist/renaming.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_renaming@0.0.284/dist/renaming.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_renaming@0.0.286/dist/renaming.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_renaming@0.0.286/dist/renaming.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];