@teambit/snapping 0.0.473 → 0.0.475

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,8 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.flat.js");
5
- require("core-js/modules/es.array.unscopables.flat.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
@@ -42,6 +39,7 @@ function _lodash() {
42
39
  };
43
40
  return data;
44
41
  }
42
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
43
  class ComponentsHaveIssues extends _bitError().BitError {
46
44
  constructor(components) {
47
45
  components.forEach(component => {
@@ -1 +1 @@
1
- {"version":3,"names":["_bitError","data","require","_issues","_interopRequireDefault","_componentIssuesTemplate","_chalk","_lodash","ComponentsHaveIssues","BitError","constructor","components","forEach","component","issues","filterNonTagBlocking","allIssueNames","uniq","map","comp","getAllIssueNames","flat","issuesColored","componentIssuesTemplate","join","IssuesAspect","id","issue","exports","format","chalk","underline","cyan","toString","formatIssues","result"],"sources":["components-have-issues.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport IssuesAspect from '@teambit/issues';\nimport { formatIssues } from '@teambit/legacy/dist/cli/templates/component-issues-template';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport chalk from 'chalk';\nimport { uniq } from 'lodash';\n\nexport class ComponentsHaveIssues extends BitError {\n constructor(components: ConsumerComponent[]) {\n components.forEach((component) => {\n component.issues = component.issues.filterNonTagBlocking();\n });\n const allIssueNames = uniq(components.map((comp) => comp.issues.getAllIssueNames()).flat());\n const issuesColored = componentIssuesTemplate(components);\n super(`error: issues found with the following components\n${issuesColored}\n\nto get the list of component-issues names and suggestions how to resolve them, run \"bit component-issues\".\n\nwhile highly not recommended, it's possible to ignore issues in two ways:\n1) temporarily ignore for this tag/snap command by entering \"--ignore-issues\" flag, e.g. \\`bit tag --ignore-issues \"${allIssueNames.join(\n ', '\n )}\" \\`\n2) ignore the issue completely by configuring it in the workspace.jsonc file. e.g:\n\"${IssuesAspect.id}\": {\n \"ignoreIssues\": [${allIssueNames.map((issue) => `\"${issue}\"`).join(', ')}]\n}\n`);\n }\n}\n\nfunction componentIssuesTemplate(components: ConsumerComponent[]) {\n function format(component: ConsumerComponent) {\n return `${chalk.underline(chalk.cyan(component.id.toString()))}\\n${formatIssues(component)}`;\n }\n\n const result = `\\n${components.map(format).join('\\n')}`;\n return result;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,yBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,wBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMO,oBAAoB,SAASC,oBAAQ,CAAC;EACjDC,WAAWA,CAACC,UAA+B,EAAE;IAC3CA,UAAU,CAACC,OAAO,CAAEC,SAAS,IAAK;MAChCA,SAAS,CAACC,MAAM,GAAGD,SAAS,CAACC,MAAM,CAACC,oBAAoB,CAAC,CAAC;IAC5D,CAAC,CAAC;IACF,MAAMC,aAAa,GAAG,IAAAC,cAAI,EAACN,UAAU,CAACO,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACL,MAAM,CAACM,gBAAgB,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IAC3F,MAAMC,aAAa,GAAGC,uBAAuB,CAACZ,UAAU,CAAC;IACzD,KAAK,CAAE;AACX,EAAEW,aAAc;AAChB;AACA;AACA;AACA;AACA,sHAAsHN,aAAa,CAACQ,IAAI,CAClI,IACF,CAAE;AACN;AACA,GAAGC,iBAAY,CAACC,EAAG;AACnB,qBAAqBV,aAAa,CAACE,GAAG,CAAES,KAAK,IAAM,IAAGA,KAAM,GAAE,CAAC,CAACH,IAAI,CAAC,IAAI,CAAE;AAC3E;AACA,CAAC,CAAC;EACA;AACF;AAACI,OAAA,CAAApB,oBAAA,GAAAA,oBAAA;AAED,SAASe,uBAAuBA,CAACZ,UAA+B,EAAE;EAChE,SAASkB,MAAMA,CAAChB,SAA4B,EAAE;IAC5C,OAAQ,GAAEiB,gBAAK,CAACC,SAAS,CAACD,gBAAK,CAACE,IAAI,CAACnB,SAAS,CAACa,EAAE,CAACO,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAI,IAAAC,uCAAY,EAACrB,SAAS,CAAE,EAAC;EAC9F;EAEA,MAAMsB,MAAM,GAAI,KAAIxB,UAAU,CAACO,GAAG,CAACW,MAAM,CAAC,CAACL,IAAI,CAAC,IAAI,CAAE,EAAC;EACvD,OAAOW,MAAM;AACf"}
1
+ {"version":3,"names":["_bitError","data","require","_issues","_interopRequireDefault","_componentIssuesTemplate","_chalk","_lodash","obj","__esModule","default","ComponentsHaveIssues","BitError","constructor","components","forEach","component","issues","filterNonTagBlocking","allIssueNames","uniq","map","comp","getAllIssueNames","flat","issuesColored","componentIssuesTemplate","join","IssuesAspect","id","issue","exports","format","chalk","underline","cyan","toString","formatIssues","result"],"sources":["components-have-issues.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport IssuesAspect from '@teambit/issues';\nimport { formatIssues } from '@teambit/legacy/dist/cli/templates/component-issues-template';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport chalk from 'chalk';\nimport { uniq } from 'lodash';\n\nexport class ComponentsHaveIssues extends BitError {\n constructor(components: ConsumerComponent[]) {\n components.forEach((component) => {\n component.issues = component.issues.filterNonTagBlocking();\n });\n const allIssueNames = uniq(components.map((comp) => comp.issues.getAllIssueNames()).flat());\n const issuesColored = componentIssuesTemplate(components);\n super(`error: issues found with the following components\n${issuesColored}\n\nto get the list of component-issues names and suggestions how to resolve them, run \"bit component-issues\".\n\nwhile highly not recommended, it's possible to ignore issues in two ways:\n1) temporarily ignore for this tag/snap command by entering \"--ignore-issues\" flag, e.g. \\`bit tag --ignore-issues \"${allIssueNames.join(\n ', '\n )}\" \\`\n2) ignore the issue completely by configuring it in the workspace.jsonc file. e.g:\n\"${IssuesAspect.id}\": {\n \"ignoreIssues\": [${allIssueNames.map((issue) => `\"${issue}\"`).join(', ')}]\n}\n`);\n }\n}\n\nfunction componentIssuesTemplate(components: ConsumerComponent[]) {\n function format(component: ConsumerComponent) {\n return `${chalk.underline(chalk.cyan(component.id.toString()))}\\n${formatIssues(component)}`;\n }\n\n const result = `\\n${components.map(format).join('\\n')}`;\n return result;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,yBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,wBAAA,YAAAA,CAAA;IAAA,OAAAJ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B,MAAMA,CAAChB,SAA4B,EAAE;IAC5C,OAAQ,GAAEiB,gBAAK,CAACC,SAAS,CAACD,gBAAK,CAACE,IAAI,CAACnB,SAAS,CAACa,EAAE,CAACO,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAI,IAAAC,uCAAY,EAACrB,SAAS,CAAE,EAAC;EAC9F;EAEA,MAAMsB,MAAM,GAAI,KAAIxB,UAAU,CAACO,GAAG,CAACW,MAAM,CAAC,CAACL,IAAI,CAAC,IAAI,CAAE,EAAC;EACvD,OAAOW,MAAM;AACf"}
package/dist/reset-cmd.js CHANGED
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.default = void 0;
10
- function _defineProperty2() {
11
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- _defineProperty2 = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
7
  function _bitError() {
18
8
  const data = require("@teambit/bit-error");
19
9
  _bitError = function () {
@@ -35,24 +25,28 @@ function _constants() {
35
25
  };
36
26
  return data;
37
27
  }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
30
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
31
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
38
32
  class ResetCmd {
39
33
  constructor(snapping) {
40
34
  this.snapping = snapping;
41
- (0, _defineProperty2().default)(this, "name", 'reset [component-pattern]');
42
- (0, _defineProperty2().default)(this, "description", 'revert tagged or snapped versions for component(s)');
43
- (0, _defineProperty2().default)(this, "arguments", [{
35
+ _defineProperty(this, "name", 'reset [component-pattern]');
36
+ _defineProperty(this, "description", 'revert tagged or snapped versions for component(s)');
37
+ _defineProperty(this, "arguments", [{
44
38
  name: 'component-pattern',
45
39
  description: _constants().COMPONENT_PATTERN_HELP
46
40
  }, {
47
41
  name: 'component-version',
48
42
  description: 'the version to untag (semver for tags. hash for snaps)'
49
43
  }]);
50
- (0, _defineProperty2().default)(this, "group", 'development');
51
- (0, _defineProperty2().default)(this, "extendedDescription", `https://${_constants().BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`);
52
- (0, _defineProperty2().default)(this, "alias", '');
53
- (0, _defineProperty2().default)(this, "options", [['a', 'all', 'revert all unexported tags/snaps for all components'], ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'], ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'], ['f', 'force', "revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted"]]);
54
- (0, _defineProperty2().default)(this, "loader", true);
55
- (0, _defineProperty2().default)(this, "migration", true);
44
+ _defineProperty(this, "group", 'development');
45
+ _defineProperty(this, "extendedDescription", `https://${_constants().BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`);
46
+ _defineProperty(this, "alias", '');
47
+ _defineProperty(this, "options", [['a', 'all', 'revert all unexported tags/snaps for all components'], ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'], ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'], ['f', 'force', "revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted"]]);
48
+ _defineProperty(this, "loader", true);
49
+ _defineProperty(this, "migration", true);
56
50
  }
57
51
  async report([pattern], {
58
52
  all = false,
@@ -1 +1 @@
1
- {"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","ResetCmd","constructor","snapping","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","BitError","results","isSoftUntag","reset","titleSuffix","title","chalk","green","length","components","map","result","cyan","id","toStringWithoutVersion","versions","join","exports"],"sources":["reset-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BASE_DOCS_DOMAIN, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport default class ResetCmd implements Command {\n name = 'reset [component-pattern]';\n description = 'revert tagged or snapped versions for component(s)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'component-version',\n description: 'the version to untag (semver for tags. hash for snaps)',\n },\n ];\n group = 'development';\n extendedDescription = `https://${BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`;\n alias = '';\n options = [\n ['a', 'all', 'revert all unexported tags/snaps for all components'],\n ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'],\n ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'],\n [\n 'f',\n 'force',\n \"revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted\",\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n head = false,\n force = false,\n soft = false,\n }: { all?: boolean; head?: boolean; force?: boolean; soft?: boolean }\n ) {\n if (!pattern && !all) {\n throw new BitError('please specify a component-pattern or use --all flag');\n }\n if (pattern && all) {\n throw new BitError('please specify either a component-pattern or --all flag, not both');\n }\n if (soft && head) {\n throw new BitError('please specify either --soft or --head flag, not both');\n }\n const { results, isSoftUntag } = await this.snapping.reset(pattern, head, force, soft);\n const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : 'untagged';\n const title = chalk.green(`${results.length} component(s) were ${titleSuffix}:\\n`);\n const components = results.map((result) => {\n return `${chalk.cyan(result.id.toStringWithoutVersion())}. version(s): ${result.versions.join(', ')}`;\n });\n return title + components.join('\\n');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGe,MAAMK,QAAQ,CAAoB;EA6B/CC,WAAWA,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBA5BnC,2BAA2B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACpB,oDAAoD;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBACtD,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,EACD;MACEF,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAE;IACf,CAAC,CACF;IAAA,IAAAH,gBAAA,GAAAC,OAAA,iBACO,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BACE,WAAUI,6BAAiB,gCAA+B;IAAA,IAAAL,gBAAA,GAAAC,OAAA,iBACzE,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACA,CACR,CAAC,GAAG,EAAE,KAAK,EAAE,qDAAqD,CAAC,EACnE,C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,CAAC,CAAC;IACF,OAAOX,KAAK,GAAGI,UAAU,CAACO,IAAI,CAAC,IAAI,CAAC;EACtC;AACF;AAACC,OAAA,CAAA5B,OAAA,GAAAJ,QAAA"}
1
+ {"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ResetCmd","constructor","snapping","name","description","COMPONENT_PATTERN_HELP","BASE_DOCS_DOMAIN","report","pattern","all","head","force","soft","BitError","results","isSoftUntag","reset","titleSuffix","title","chalk","green","length","components","map","result","cyan","id","toStringWithoutVersion","versions","join","exports"],"sources":["reset-cmd.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BASE_DOCS_DOMAIN, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport default class ResetCmd implements Command {\n name = 'reset [component-pattern]';\n description = 'revert tagged or snapped versions for component(s)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'component-version',\n description: 'the version to untag (semver for tags. hash for snaps)',\n },\n ];\n group = 'development';\n extendedDescription = `https://${BASE_DOCS_DOMAIN}/components/tags#undoing-a-tag`;\n alias = '';\n options = [\n ['a', 'all', 'revert all unexported tags/snaps for all components'],\n ['', 'head', 'revert the head tag/snap only (by default, all local tags/snaps are reverted)'],\n ['', 'soft', 'revert only soft-tags (components tagged with --soft flag)'],\n [\n 'f',\n 'force',\n \"revert the tag even if it's used as a dependency. WARNING: components that depend on this tag will be corrupted\",\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n head = false,\n force = false,\n soft = false,\n }: { all?: boolean; head?: boolean; force?: boolean; soft?: boolean }\n ) {\n if (!pattern && !all) {\n throw new BitError('please specify a component-pattern or use --all flag');\n }\n if (pattern && all) {\n throw new BitError('please specify either a component-pattern or --all flag, not both');\n }\n if (soft && head) {\n throw new BitError('please specify either --soft or --head flag, not both');\n }\n const { results, isSoftUntag } = await this.snapping.reset(pattern, head, force, soft);\n const titleSuffix = isSoftUntag ? 'soft-untagged (are not candidates for tagging any more)' : 'untagged';\n const title = chalk.green(`${results.length} component(s) were ${titleSuffix}:\\n`);\n const components = results.map((result) => {\n return `${chalk.cyan(result.id.toStringWithoutVersion())}. version(s): ${result.versions.join(', ')}`;\n });\n return title + components.join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0F,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,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AAK;IACXC,IAAI,GAAG,KAAK;IACZC,KAAK,GAAG,KAAK;IACbC,IAAI,GAAG;EAC2D,CAAC,EACrE;IACA,IAAI,CAACJ,OAAO,IAAI,CAACC,GAAG,EAAE;MACpB,MAAM,KAAII,oBAAQ,EAAC,sDAAsD,CAAC;IAC5E;IACA,IAAIL,OAAO,IAAIC,GAAG,EAAE;MAClB,MAAM,KAAII,oBAAQ,EAAC,mEAAmE,CAAC;IACzF;IACA,IAAID,IAAI,IAAIF,IAAI,EAAE;MAChB,MAAM,KAAIG,oBAAQ,EAAC,uDAAuD,CAAC;IAC7E;IACA,MAAM;MAAEC,OAAO;MAAEC;IAAY,CAAC,GAAG,MAAM,IAAI,CAACb,QAAQ,CAACc,KAAK,CAACR,OAAO,EAAEE,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC;IACtF,MAAMK,WAAW,GAAGF,WAAW,GAAG,yDAAyD,GAAG,UAAU;IACxG,MAAMG,KAAK,GAAGC,gBAAK,CAACC,KAAK,CAAE,GAAEN,OAAO,CAACO,MAAO,sBAAqBJ,WAAY,KAAI,CAAC;IAClF,MAAMK,UAAU,GAAGR,OAAO,CAACS,GAAG,CAAEC,MAAM,IAAK;MACzC,OAAQ,GAAEL,gBAAK,CAACM,IAAI,CAACD,MAAM,CAACE,EAAE,CAACC,sBAAsB,CAAC,CAAC,CAAE,iBAAgBH,MAAM,CAACI,QAAQ,CAACC,IAAI,CAAC,IAAI,CAAE,EAAC;IACvG,CAAC,CAAC;IACF,OAAOX,KAAK,GAAGI,UAAU,CAACO,IAAI,CAAC,IAAI,CAAC;EACtC;AACF;AAACC,OAAA,CAAArD,OAAA,GAAAuB,QAAA"}
package/dist/snap-cmd.js CHANGED
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.SnapCmd = void 0;
10
- function _defineProperty2() {
11
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- _defineProperty2 = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
7
  function _chalk() {
18
8
  const data = _interopRequireDefault(require("chalk"));
19
9
  _chalk = function () {
@@ -49,25 +39,29 @@ function _tagCmd() {
49
39
  };
50
40
  return data;
51
41
  }
42
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
45
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
52
46
  class SnapCmd {
53
47
  constructor(snapping, logger) {
54
48
  this.snapping = snapping;
55
49
  this.logger = logger;
56
- (0, _defineProperty2().default)(this, "name", 'snap [component-pattern]');
57
- (0, _defineProperty2().default)(this, "description", 'create an immutable and exportable component snapshot (non-release version)');
58
- (0, _defineProperty2().default)(this, "extendedDescription", void 0);
59
- (0, _defineProperty2().default)(this, "group", 'development');
60
- (0, _defineProperty2().default)(this, "arguments", [{
50
+ _defineProperty(this, "name", 'snap [component-pattern]');
51
+ _defineProperty(this, "description", 'create an immutable and exportable component snapshot (non-release version)');
52
+ _defineProperty(this, "extendedDescription", void 0);
53
+ _defineProperty(this, "group", 'development');
54
+ _defineProperty(this, "arguments", [{
61
55
  name: 'component-pattern',
62
56
  description: `${_constants().COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`
63
57
  }]);
64
- (0, _defineProperty2().default)(this, "helpUrl", 'reference/components/snaps');
65
- (0, _defineProperty2().default)(this, "alias", '');
66
- (0, _defineProperty2().default)(this, "options", [['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'], ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled'], ['', 'editor [editor]', 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
58
+ _defineProperty(this, "helpUrl", 'reference/components/snaps');
59
+ _defineProperty(this, "alias", '');
60
+ _defineProperty(this, "options", [['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'], ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled'], ['', 'editor [editor]', 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
67
61
  [${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
68
62
  to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)'], ['f', 'force', 'DEPRECATED (use "--skip-tests" or "--unmodified" instead). force-snap even if tests are failing and even when component has not changed']]);
69
- (0, _defineProperty2().default)(this, "loader", true);
70
- (0, _defineProperty2().default)(this, "migration", true);
63
+ _defineProperty(this, "loader", true);
64
+ _defineProperty(this, "migration", true);
71
65
  }
72
66
  async report([pattern], {
73
67
  message = '',
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_featureToggle","_constants","_tagCmd","SnapCmd","constructor","snapping","logger","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","Object","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","isFeatureEnabled","BUILD_ON_CI","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { NOTHING_TO_SNAP_MSG, AUTO_SNAPPED_MSG, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n [\n 'b',\n 'build',\n 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled',\n ],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter(\n (component) => !newComponents.searchWithoutVersion(component.id)\n );\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: BitId) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,iBAAA;EAAA,M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,EAAEC,UAAU,KAAK;MACzD,IAAI,CAACA,UAAU,CAACtB,MAAM,EAAE,OAAO,EAAE;MACjC,OAAQ,KAAIhB,gBAAK,CAACuC,SAAS,CAACH,KAAK,CAAE,MAAKC,WAAY,MAAKb,gBAAgB,CAACc,UAAU,CAAE,IAAG;IAC3F,CAAC;IACD,MAAME,OAAO,GAAGjC,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,GAAEtC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuByB,OAAQ,EAAC,CAAC,GAC3FtB,eAAe,GACfiB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAErB,eAAe,CAAC,GACjFqB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAE1B,iBAAiB,CAAC,GAC7F,IAAAiC,2BAAiB,EAAC,oBAAoB,EAAElC,iBAAiB,CAAC;EAE9D;AACF;AAACmC,OAAA,CAAAhF,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_featureToggle","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","isFeatureEnabled","BUILD_ON_CI","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","green","outputIdsIfExists","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { NOTHING_TO_SNAP_MSG, AUTO_SNAPPED_MSG, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n [\n 'b',\n 'build',\n 'not needed for now. run the build pipeline locally in case the feature-flag build-on-ci is enabled',\n ],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter(\n (component) => !newComponents.searchWithoutVersion(component.id)\n );\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)\\n`;\n\n const compInBold = (id: BitId) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n warningsOutput +\n chalk.green(`${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation +\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents)\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KA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C,QAAQ,GAAI,QAAOA,QAAS,QAAO,GAAG,EAAE;IAExD,OACEU,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,GAAEtC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuByB,OAAQ,EAAC,CAAC,GAC3FtB,eAAe,GACfiB,cAAc,CAAC,gBAAgB,EAAE,8BAA8B,EAAErB,eAAe,CAAC,GACjFqB,cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAE1B,iBAAiB,CAAC,GAC7F,IAAAiC,2BAAiB,EAAC,oBAAoB,EAAElC,iBAAiB,CAAC;EAE9D;AACF;AAACmC,OAAA,CAAA7E,OAAA,GAAAA,OAAA"}
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.SnapFromScopeCmd = void 0;
10
- function _defineProperty2() {
11
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- _defineProperty2 = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
7
  function _chalk() {
18
8
  const data = _interopRequireDefault(require("chalk"));
19
9
  _chalk = function () {
@@ -35,13 +25,17 @@ function _bitError() {
35
25
  };
36
26
  return data;
37
27
  }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
30
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
31
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
38
32
  class SnapFromScopeCmd {
39
33
  constructor(snapping, logger) {
40
34
  this.snapping = snapping;
41
35
  this.logger = logger;
42
- (0, _defineProperty2().default)(this, "name", '_snap <data>');
43
- (0, _defineProperty2().default)(this, "description", 'snap components from a bare-scope');
44
- (0, _defineProperty2().default)(this, "extendedDescription", `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.
36
+ _defineProperty(this, "name", '_snap <data>');
37
+ _defineProperty(this, "description", 'snap components from a bare-scope');
38
+ _defineProperty(this, "extendedDescription", `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.
45
39
  the input data is a stringified JSON of an array of the following object.
46
40
  {
47
41
  componentId: string; // ids always have scope, so it's safe to parse them from string
@@ -51,13 +45,13 @@ the input data is a stringified JSON of an array of the following object.
51
45
  }
52
46
  an example of the final data: '[{"componentId":"ci.remote2/comp-b","message": "first snap"}]'
53
47
  `);
54
- (0, _defineProperty2().default)(this, "alias", '');
55
- (0, _defineProperty2().default)(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
48
+ _defineProperty(this, "alias", '');
49
+ _defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
56
50
  [${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
57
51
  to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['j', 'json', 'output as json format']]);
58
- (0, _defineProperty2().default)(this, "loader", true);
59
- (0, _defineProperty2().default)(this, "private", true);
60
- (0, _defineProperty2().default)(this, "migration", true);
52
+ _defineProperty(this, "loader", true);
53
+ _defineProperty(this, "private", true);
54
+ _defineProperty(this, "migration", true);
61
55
  }
62
56
  async report([data], options) {
63
57
  const results = await this.json([data], options);
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","SnapFromScopeCmd","constructor","snapping","logger","_defineProperty2","default","Object","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n });\n\n return results;\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n });\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAoBO,MAAMK,gBAAgB,CAAoB;EAoC/CC,WAAWA,CAASC,QAAsB,EAAUC,MAAc,EAAE;IAAA,KAAhDD,QAAsB,GAAtBA,QAAsB;IAAA,KAAUC,MAAc,GAAdA,MAAc;IAAA,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IAC/B,CAAC,CAAC,OAAO2C,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAE,gDAA+CD,GAAG,CAAChB,OAAQ,EAAC,CAAC;IAChF;IACA,IAAI,CAACkB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;IAC3F,CAAC,CAAC;IACF,OAAOJ,UAAU;EACnB;AACF;AAACU,OAAA,CAAA7C,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n });\n\n return results;\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n });\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,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AAA"}
@@ -1,23 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.flat.js");
5
- require("core-js/modules/es.array.iterator.js");
6
- require("core-js/modules/es.array.unscopables.flat.js");
7
- require("core-js/modules/es.promise.js");
8
- require("core-js/modules/es.regexp.exec.js");
9
- require("core-js/modules/es.string.trim.js");
10
3
  Object.defineProperty(exports, "__esModule", {
11
4
  value: true
12
5
  });
13
6
  exports.default = exports.SnappingMain = void 0;
14
- function _defineProperty2() {
15
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- _defineProperty2 = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
7
  function _cli() {
22
8
  const data = require("@teambit/cli");
23
9
  _cli = function () {
@@ -326,10 +312,14 @@ function _snapFromScope() {
326
312
  };
327
313
  return data;
328
314
  }
315
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
329
316
  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); }
330
317
  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; }
331
318
  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; }
332
- 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; }
319
+ 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) { _defineProperty(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; }
320
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
321
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
322
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
333
323
  const HooksManagerInstance = _hooks().default.getInstance();
334
324
  class SnappingMain {
335
325
  constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer) {
@@ -343,7 +333,7 @@ class SnappingMain {
343
333
  this.exporter = exporter;
344
334
  this.builder = builder;
345
335
  this.importer = importer;
346
- (0, _defineProperty2().default)(this, "objectsRepo", void 0);
336
+ _defineProperty(this, "objectsRepo", void 0);
347
337
  this.objectsRepo = (_this$scope = this.scope) === null || _this$scope === void 0 ? void 0 : (_this$scope$legacySco = _this$scope.legacyScope) === null || _this$scope$legacySco === void 0 ? void 0 : _this$scope$legacySco.objects;
348
338
  }
349
339
 
@@ -1236,9 +1226,9 @@ another option, in case this dependency is not in main yet is to remove all refe
1236
1226
  }
1237
1227
  }
1238
1228
  exports.SnappingMain = SnappingMain;
1239
- (0, _defineProperty2().default)(SnappingMain, "slots", []);
1240
- (0, _defineProperty2().default)(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect, _issues().default, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().default]);
1241
- (0, _defineProperty2().default)(SnappingMain, "runtime", _cli().MainRuntime);
1229
+ _defineProperty(SnappingMain, "slots", []);
1230
+ _defineProperty(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _logger().LoggerAspect, _issues().default, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().default]);
1231
+ _defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
1242
1232
  _snapping().SnappingAspect.addRuntime(SnappingMain);
1243
1233
  var _default = SnappingMain;
1244
1234
  exports.default = _default;