@teambit/workspace 0.0.763 → 0.0.766

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.
@@ -5,6 +5,7 @@ export declare class PatternCommand implements Command {
5
5
  name: string;
6
6
  alias: string;
7
7
  description: string;
8
+ extendedDescription: string;
8
9
  group: string;
9
10
  private: boolean;
10
11
  options: CommandOptions;
@@ -37,6 +37,14 @@ class PatternCommand {
37
37
  (0, _defineProperty2().default)(this, "name", 'pattern <pattern>');
38
38
  (0, _defineProperty2().default)(this, "alias", '');
39
39
  (0, _defineProperty2().default)(this, "description", 'list the component ids matching the given pattern');
40
+ (0, _defineProperty2().default)(this, "extendedDescription", `this command helps validating a pattern before using it in other commands.
41
+ a pattern can be a simple component-id or component-name. e.g. "ui/button".
42
+ a pattern can be used with wildcards for multiple component ids, e.g. "org.scope/utils/**".
43
+ to enter multiple patterns, separate them by a comma, e.g. "ui/*, lib/*"
44
+ to exclude, use "!". e.g. "ui/**, !ui/button"
45
+ always wrap the pattern with quotes to avoid collision with shell commands.
46
+ the matching algorithm is done by multimatch (@see https://github.com/sindresorhus/multimatch)
47
+ `);
40
48
  (0, _defineProperty2().default)(this, "group", 'development');
41
49
  (0, _defineProperty2().default)(this, "private", false);
42
50
  (0, _defineProperty2().default)(this, "options", [['j', 'json', 'return the output as JSON']]);
@@ -1 +1 @@
1
- {"version":3,"names":["PatternCommand","constructor","workspace","report","pattern","ids","json","title","chalk","green","bold","length","toString","join","idsByPattern"],"sources":["pattern.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class PatternCommand implements Command {\n name = 'pattern <pattern>';\n alias = '';\n description = 'list the component ids matching the given pattern';\n group = 'development';\n private = false;\n options = [['j', 'json', 'return the output as JSON']] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern]: [string]) {\n const ids = await this.json([pattern]);\n const title = chalk.green(`found ${chalk.bold(ids.length.toString())} components matching the pattern`);\n return `${title}\\n${ids.join('\\n')}`;\n }\n\n async json([pattern]: [string]) {\n return this.workspace.idsByPattern(pattern, false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAQ7CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAPnC,mBAOmC;IAAA,+CANlC,EAMkC;IAAA,qDAL5B,mDAK4B;IAAA,+CAJlC,aAIkC;IAAA,iDAHhC,KAGgC;IAAA,iDAFhC,CAAC,CAAC,GAAD,EAAM,MAAN,EAAc,2BAAd,CAAD,CAEgC;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,OAAD,CAAD,EAAsB;IAChC,MAAMC,GAAG,GAAG,MAAM,KAAKC,IAAL,CAAU,CAACF,OAAD,CAAV,CAAlB;;IACA,MAAMG,KAAK,GAAGC,gBAAA,CAAMC,KAAN,CAAa,SAAQD,gBAAA,CAAME,IAAN,CAAWL,GAAG,CAACM,MAAJ,CAAWC,QAAX,EAAX,CAAkC,kCAAvD,CAAd;;IACA,OAAQ,GAAEL,KAAM,KAAIF,GAAG,CAACQ,IAAJ,CAAS,IAAT,CAAe,EAAnC;EACD;;EAES,MAAJP,IAAI,CAAC,CAACF,OAAD,CAAD,EAAsB;IAC9B,OAAO,KAAKF,SAAL,CAAeY,YAAf,CAA4BV,OAA5B,EAAqC,KAArC,CAAP;EACD;;AAlB4C"}
1
+ {"version":3,"names":["PatternCommand","constructor","workspace","report","pattern","ids","json","title","chalk","green","bold","length","toString","join","idsByPattern"],"sources":["pattern.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class PatternCommand implements Command {\n name = 'pattern <pattern>';\n alias = '';\n description = 'list the component ids matching the given pattern';\n extendedDescription = `this command helps validating a pattern before using it in other commands.\na pattern can be a simple component-id or component-name. e.g. \"ui/button\".\na pattern can be used with wildcards for multiple component ids, e.g. \"org.scope/utils/**\".\nto enter multiple patterns, separate them by a comma, e.g. \"ui/*, lib/*\"\nto exclude, use \"!\". e.g. \"ui/**, !ui/button\"\nalways wrap the pattern with quotes to avoid collision with shell commands.\nthe matching algorithm is done by multimatch (@see https://github.com/sindresorhus/multimatch)\n`;\n\n group = 'development';\n private = false;\n options = [['j', 'json', 'return the output as JSON']] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern]: [string]) {\n const ids = await this.json([pattern]);\n const title = chalk.green(`found ${chalk.bold(ids.length.toString())} components matching the pattern`);\n return `${title}\\n${ids.join('\\n')}`;\n }\n\n async json([pattern]: [string]) {\n return this.workspace.idsByPattern(pattern, false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAiB7CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAhBnC,mBAgBmC;IAAA,+CAflC,EAekC;IAAA,qDAd5B,mDAc4B;IAAA,6DAbnB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,CAM4C;IAAA,+CAJlC,aAIkC;IAAA,iDAHhC,KAGgC;IAAA,iDAFhC,CAAC,CAAC,GAAD,EAAM,MAAN,EAAc,2BAAd,CAAD,CAEgC;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,OAAD,CAAD,EAAsB;IAChC,MAAMC,GAAG,GAAG,MAAM,KAAKC,IAAL,CAAU,CAACF,OAAD,CAAV,CAAlB;;IACA,MAAMG,KAAK,GAAGC,gBAAA,CAAMC,KAAN,CAAa,SAAQD,gBAAA,CAAME,IAAN,CAAWL,GAAG,CAACM,MAAJ,CAAWC,QAAX,EAAX,CAAkC,kCAAvD,CAAd;;IACA,OAAQ,GAAEL,KAAM,KAAIF,GAAG,CAACQ,IAAJ,CAAS,IAAT,CAAe,EAAnC;EACD;;EAES,MAAJP,IAAI,CAAC,CAACF,OAAD,CAAD,EAAsB;IAC9B,OAAO,KAAKF,SAAL,CAAeY,YAAf,CAA4BV,OAA5B,EAAqC,KAArC,CAAP;EACD;;AA3B4C"}
@@ -108,6 +108,12 @@ ${_chalk().default.red('Red')} - indicates a semantically breaking change`,
108
108
  // This is needed in order to have the values of the choices in the answer object.
109
109
  // Otherwise, only the names of the selected choices would've been included.
110
110
  return this.map(names);
111
+ },
112
+
113
+ cancel() {// By default, canceling the prompt via Ctrl+c throws an empty string.
114
+ // The custom cancel function prevents that behavior.
115
+ // Otherwise, Bit CLI would print an error and confuse users.
116
+ // See related issue: https://github.com/enquirer/enquirer/issues/225
111
117
  }
112
118
 
113
119
  });
@@ -1 +1 @@
1
- {"version":3,"names":["pickOutdatedPkgs","outdatedPkgs","updateDependencies","prompt","choices","makeOutdatedPkgChoices","footer","indicator","state","choice","enabled","message","chalk","cyan","green","red","name","pointer","styles","dark","white","em","bgBlack","whiteBright","success","type","validate","value","length","j","down","k","up","result","names","map","Object","values","filter","updateDependency","DEP_TYPE_PRIORITY","dependencies","devDependencies","peerDependencies","sort","pkg1","pkg2","targetField","localeCompare","renderedTable","alignColumns","outdatedPkgsRows","groupedChoices","forEach","outdatedPkg","index","context","renderContext","push","entries","subChoices","variantPattern","componentId","TARGET_FIELD_TO_DEP_TYPE","change","diff","semverDiff","currentRange","latestRange","colorizeChange","latest","colorizeSemverDiff","grey","rows","table","border","getBorderCharacters","columnDefault","paddingLeft","paddingRight","columns","alignment","drawHorizontalLine","split"],"sources":["pick-outdated-pkgs.ts"],"sourcesContent":["import colorizeSemverDiff from '@pnpm/colorize-semver-diff';\nimport semverDiff from '@pnpm/semver-diff';\nimport { OutdatedPkg } from '@teambit/dependency-resolver';\nimport { getBorderCharacters, table } from 'table';\nimport chalk from 'chalk';\nimport { prompt } from 'enquirer';\n\n/**\n * Lets the user pick the packages that should be updated.\n */\nexport async function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<OutdatedPkg[]> {\n const { updateDependencies } = (await prompt({\n choices: makeOutdatedPkgChoices(outdatedPkgs),\n footer: '\\nEnter to start updating. Ctrl-c to cancel.',\n indicator: (state: any, choice: any) => ` ${choice.enabled ? '●' : '○'}`,\n message:\n 'Choose which packages to update ' +\n `(Press ${chalk.cyan('<space>')} to select, ` +\n `${chalk.cyan('<a>')} to toggle all, ` +\n `${chalk.cyan('<i>')} to invert selection)\n${chalk.green('Green')} - indicates a semantically safe update\n${chalk.red('Red')} - indicates a semantically breaking change`,\n name: 'updateDependencies',\n pointer: '❯',\n styles: {\n dark: chalk.white,\n em: chalk.bgBlack.whiteBright,\n success: chalk.white,\n },\n type: 'multiselect',\n validate(value: string[]) {\n if (value.length === 0) {\n return 'You must choose at least one package.';\n }\n return true;\n },\n j() {\n return this.down();\n },\n k() {\n return this.up();\n },\n result (names: string[]) {\n // This is needed in order to have the values of the choices in the answer object.\n // Otherwise, only the names of the selected choices would've been included.\n return this.map(names);\n },\n } as any)) as { updateDependencies: Record<string, string | OutdatedPkg> };\n return Object.values(updateDependencies ?? {})\n .filter((updateDependency) => typeof updateDependency !== 'string') as OutdatedPkg[];\n}\n\nconst DEP_TYPE_PRIORITY = {\n dependencies: 0,\n devDependencies: 1,\n peerDependencies: 2,\n};\n\n/**\n * Groups the outdated packages and makes choices for enquirer's prompt.\n */\nexport function makeOutdatedPkgChoices(outdatedPkgs: OutdatedPkg[]) {\n outdatedPkgs.sort((pkg1, pkg2) => {\n if (pkg1.targetField === pkg2.targetField) return pkg1.name.localeCompare(pkg2.name);\n return DEP_TYPE_PRIORITY[pkg1.targetField] - DEP_TYPE_PRIORITY[pkg2.targetField];\n });\n const renderedTable = alignColumns(outdatedPkgsRows(outdatedPkgs));\n const groupedChoices = {};\n outdatedPkgs.forEach((outdatedPkg, index) => {\n const context = renderContext(outdatedPkg);\n if (!groupedChoices[context]) {\n groupedChoices[context] = [];\n }\n groupedChoices[context].push({\n message: renderedTable[index],\n name: outdatedPkg.name,\n value: outdatedPkg,\n });\n });\n const choices = Object.entries(groupedChoices).map(([context, subChoices]) => ({\n message: chalk.cyan(context),\n choices: subChoices,\n }));\n return choices;\n}\n\nfunction renderContext(outdatedPkg: OutdatedPkg) {\n if (outdatedPkg.variantPattern) {\n return `${outdatedPkg.variantPattern} (variant)`;\n }\n if (outdatedPkg.componentId) {\n return `${outdatedPkg.componentId} (component)`;\n }\n return 'Root policies';\n}\n\nconst TARGET_FIELD_TO_DEP_TYPE = {\n devDependencies: 'dev',\n dependencies: 'runtime',\n peerDependencies: 'peer',\n};\n\nfunction outdatedPkgsRows(outdatedPkgs: OutdatedPkg[]) {\n return outdatedPkgs.map((outdatedPkg) => {\n const { change, diff } = semverDiff(outdatedPkg.currentRange, outdatedPkg.latestRange);\n let colorizeChange = change ?? 'breaking';\n if (change === 'feature') {\n colorizeChange = 'fix';\n }\n const latest = colorizeSemverDiff({\n change: colorizeChange,\n diff,\n });\n return [\n outdatedPkg.name,\n chalk.grey(`(${TARGET_FIELD_TO_DEP_TYPE[outdatedPkg.targetField]})`),\n outdatedPkg.currentRange,\n '❯',\n latest,\n ];\n });\n}\n\nfunction alignColumns(rows: string[][]) {\n return table(rows, {\n border: getBorderCharacters('void'),\n columnDefault: {\n paddingLeft: 0,\n paddingRight: 1,\n },\n columns: {\n // This is the current range column\n 2: { alignment: 'right' },\n },\n drawHorizontalLine: () => false,\n }).split('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA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P,EAIL,GAJK,EAKLG,MALK,CAAP;EAOD,CAjBM,CAAP;AAkBD;;AAED,SAASpB,YAAT,CAAsBuB,IAAtB,EAAwC;EACtC,OAAO,IAAAC,cAAA,EAAMD,IAAN,EAAY;IACjBE,MAAM,EAAE,IAAAC,4BAAA,EAAoB,MAApB,CADS;IAEjBC,aAAa,EAAE;MACbC,WAAW,EAAE,CADA;MAEbC,YAAY,EAAE;IAFD,CAFE;IAMjBC,OAAO,EAAE;MACP;MACA,GAAG;QAAEC,SAAS,EAAE;MAAb;IAFI,CANQ;IAUjBC,kBAAkB,EAAE,MAAM;EAVT,CAAZ,EAWJC,KAXI,CAWE,IAXF,CAAP;AAYD"}
1
+ {"version":3,"names":["pickOutdatedPkgs","outdatedPkgs","updateDependencies","prompt","choices","makeOutdatedPkgChoices","footer","indicator","state","choice","enabled","message","chalk","cyan","green","red","name","pointer","styles","dark","white","em","bgBlack","whiteBright","success","type","validate","value","length","j","down","k","up","result","names","map","cancel","Object","values","filter","updateDependency","DEP_TYPE_PRIORITY","dependencies","devDependencies","peerDependencies","sort","pkg1","pkg2","targetField","localeCompare","renderedTable","alignColumns","outdatedPkgsRows","groupedChoices","forEach","outdatedPkg","index","context","renderContext","push","entries","subChoices","variantPattern","componentId","TARGET_FIELD_TO_DEP_TYPE","change","diff","semverDiff","currentRange","latestRange","colorizeChange","latest","colorizeSemverDiff","grey","rows","table","border","getBorderCharacters","columnDefault","paddingLeft","paddingRight","columns","alignment","drawHorizontalLine","split"],"sources":["pick-outdated-pkgs.ts"],"sourcesContent":["import colorizeSemverDiff from '@pnpm/colorize-semver-diff';\nimport semverDiff from '@pnpm/semver-diff';\nimport { OutdatedPkg } from '@teambit/dependency-resolver';\nimport { getBorderCharacters, table } from 'table';\nimport chalk from 'chalk';\nimport { prompt } from 'enquirer';\n\n/**\n * Lets the user pick the packages that should be updated.\n */\nexport async function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<OutdatedPkg[]> {\n const { updateDependencies } = (await prompt({\n choices: makeOutdatedPkgChoices(outdatedPkgs),\n footer: '\\nEnter to start updating. Ctrl-c to cancel.',\n indicator: (state: any, choice: any) => ` ${choice.enabled ? '●' : '○'}`,\n message:\n 'Choose which packages to update ' +\n `(Press ${chalk.cyan('<space>')} to select, ` +\n `${chalk.cyan('<a>')} to toggle all, ` +\n `${chalk.cyan('<i>')} to invert selection)\n${chalk.green('Green')} - indicates a semantically safe update\n${chalk.red('Red')} - indicates a semantically breaking change`,\n name: 'updateDependencies',\n pointer: '❯',\n styles: {\n dark: chalk.white,\n em: chalk.bgBlack.whiteBright,\n success: chalk.white,\n },\n type: 'multiselect',\n validate(value: string[]) {\n if (value.length === 0) {\n return 'You must choose at least one package.';\n }\n return true;\n },\n j() {\n return this.down();\n },\n k() {\n return this.up();\n },\n result (names: string[]) {\n // This is needed in order to have the values of the choices in the answer object.\n // Otherwise, only the names of the selected choices would've been included.\n return this.map(names);\n },\n cancel() {\n // By default, canceling the prompt via Ctrl+c throws an empty string.\n // The custom cancel function prevents that behavior.\n // Otherwise, Bit CLI would print an error and confuse users.\n // See related issue: https://github.com/enquirer/enquirer/issues/225\n },\n } as any)) as { updateDependencies: Record<string, string | OutdatedPkg> };\n return Object.values(updateDependencies ?? {})\n .filter((updateDependency) => typeof updateDependency !== 'string') as OutdatedPkg[];\n}\n\nconst DEP_TYPE_PRIORITY = {\n dependencies: 0,\n devDependencies: 1,\n peerDependencies: 2,\n};\n\n/**\n * Groups the outdated packages and makes choices for enquirer's prompt.\n */\nexport function makeOutdatedPkgChoices(outdatedPkgs: OutdatedPkg[]) {\n outdatedPkgs.sort((pkg1, pkg2) => {\n if (pkg1.targetField === pkg2.targetField) return pkg1.name.localeCompare(pkg2.name);\n return DEP_TYPE_PRIORITY[pkg1.targetField] - DEP_TYPE_PRIORITY[pkg2.targetField];\n });\n const renderedTable = alignColumns(outdatedPkgsRows(outdatedPkgs));\n const groupedChoices = {};\n outdatedPkgs.forEach((outdatedPkg, index) => {\n const context = renderContext(outdatedPkg);\n if (!groupedChoices[context]) {\n groupedChoices[context] = [];\n }\n groupedChoices[context].push({\n message: renderedTable[index],\n name: outdatedPkg.name,\n value: outdatedPkg,\n });\n });\n const choices = Object.entries(groupedChoices).map(([context, subChoices]) => ({\n message: chalk.cyan(context),\n choices: subChoices,\n }));\n return choices;\n}\n\nfunction renderContext(outdatedPkg: OutdatedPkg) {\n if (outdatedPkg.variantPattern) {\n return `${outdatedPkg.variantPattern} (variant)`;\n }\n if (outdatedPkg.componentId) {\n return `${outdatedPkg.componentId} (component)`;\n }\n return 'Root policies';\n}\n\nconst TARGET_FIELD_TO_DEP_TYPE = {\n devDependencies: 'dev',\n dependencies: 'runtime',\n peerDependencies: 'peer',\n};\n\nfunction outdatedPkgsRows(outdatedPkgs: OutdatedPkg[]) {\n return outdatedPkgs.map((outdatedPkg) => {\n const { change, diff } = semverDiff(outdatedPkg.currentRange, outdatedPkg.latestRange);\n let colorizeChange = change ?? 'breaking';\n if (change === 'feature') {\n colorizeChange = 'fix';\n }\n const latest = colorizeSemverDiff({\n change: colorizeChange,\n diff,\n });\n return [\n outdatedPkg.name,\n chalk.grey(`(${TARGET_FIELD_TO_DEP_TYPE[outdatedPkg.targetField]})`),\n outdatedPkg.currentRange,\n '❯',\n latest,\n ];\n });\n}\n\nfunction alignColumns(rows: string[][]) {\n return table(rows, {\n border: getBorderCharacters('void'),\n columnDefault: {\n paddingLeft: 0,\n paddingRight: 1,\n },\n columns: {\n // This is the current range column\n 2: { alignment: 'right' },\n },\n drawHorizontalLine: () => false,\n }).split('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;A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ACT,WAAW,CAACP,WAAb,CAA0B,GAAjE,CAFK,EAGLO,WAAW,CAACa,YAHP,EAIL,GAJK,EAKLG,MALK,CAAP;EAOD,CAjBM,CAAP;AAkBD;;AAED,SAASpB,YAAT,CAAsBuB,IAAtB,EAAwC;EACtC,OAAO,IAAAC,cAAA,EAAMD,IAAN,EAAY;IACjBE,MAAM,EAAE,IAAAC,4BAAA,EAAoB,MAApB,CADS;IAEjBC,aAAa,EAAE;MACbC,WAAW,EAAE,CADA;MAEbC,YAAY,EAAE;IAFD,CAFE;IAMjBC,OAAO,EAAE;MACP;MACA,GAAG;QAAEC,SAAS,EAAE;MAAb;IAFI,CANQ;IAUjBC,kBAAkB,EAAE,MAAM;EAVT,CAAZ,EAWJC,KAXI,CAWE,IAXF,CAAP;AAYD"}
@@ -26,7 +26,7 @@
26
26
  position: relative;
27
27
 
28
28
  > :first-child {
29
- z-index: $nav-z-index + 1;
29
+ z-index: $pane-splitter-zIndex;
30
30
  position: absolute;
31
31
  }
32
32
  }
@@ -271,6 +271,8 @@ export declare class Workspace implements ComponentFactory {
271
271
  */
272
272
  private resolveScopeAspectListIds;
273
273
  /**
274
+ * @deprecated use `this.idsByPattern` instead for consistency. also, it supports negation and list of patterns.
275
+ *
274
276
  * load components into the workspace through a variants pattern.
275
277
  * @param pattern variants.
276
278
  * @param scope scope name.
package/dist/workspace.js CHANGED
@@ -14,8 +14,6 @@ require("core-js/modules/es.promise.js");
14
14
 
15
15
  require("core-js/modules/es.regexp.exec.js");
16
16
 
17
- require("core-js/modules/es.string.trim.js");
18
-
19
17
  Object.defineProperty(exports, "__esModule", {
20
18
  value: true
21
19
  });
@@ -61,16 +59,6 @@ function _pMapSeries() {
61
59
  return data;
62
60
  }
63
61
 
64
- function _multimatch() {
65
- const data = _interopRequireDefault(require("multimatch"));
66
-
67
- _multimatch = function () {
68
- return data;
69
- };
70
-
71
- return data;
72
- }
73
-
74
62
  function _aspectLoader() {
75
63
  const data = require("@teambit/aspect-loader");
76
64
 
@@ -1078,6 +1066,8 @@ class Workspace {
1078
1066
  return resolvedList;
1079
1067
  }
1080
1068
  /**
1069
+ * @deprecated use `this.idsByPattern` instead for consistency. also, it supports negation and list of patterns.
1070
+ *
1081
1071
  * load components into the workspace through a variants pattern.
1082
1072
  * @param pattern variants.
1083
1073
  * @param scope scope name.
@@ -1110,17 +1100,7 @@ class Workspace {
1110
1100
  }
1111
1101
 
1112
1102
  const ids = await this.listIds();
1113
- const patterns = pattern.split(',').map(p => p.trim()); // check also as legacyId.toString, as it doesn't have the defaultScope
1114
-
1115
- const idsToCheck = id => [id.toStringWithoutVersion(), id._legacy.toStringWithoutVersion()];
1116
-
1117
- const idsFiltered = ids.filter(id => (0, _multimatch().default)(idsToCheck(id), patterns).length);
1118
-
1119
- if (throwForNoMatch && !idsFiltered.length) {
1120
- throw new (_bitError().BitError)(`unable to find any matching for "${pattern}" pattern`);
1121
- }
1122
-
1123
- return idsFiltered;
1103
+ return this.scope.filterIdsFromPoolIdsByPattern(pattern, ids, throwForNoMatch);
1124
1104
  }
1125
1105
  /**
1126
1106
  * useful for workspace commands, such as `bit build`, `bit compile`.
@@ -1136,7 +1116,8 @@ class Workspace {
1136
1116
  }
1137
1117
 
1138
1118
  if (pattern) {
1139
- return this.byPattern(pattern);
1119
+ const ids = await this.idsByPattern(pattern);
1120
+ return this.getMany(ids);
1140
1121
  }
1141
1122
 
1142
1123
  const newAndModified = await this.newAndModified();
@@ -2454,110 +2435,118 @@ your workspace.jsonc has this component-id set. you might want to remove/change
2454
2435
 
2455
2436
  let legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, true);
2456
2437
 
2457
- if (!legacyId) {
2458
- try {
2459
- const idWithVersion = id.toString();
2460
- const [idWithoutVersion, version] = id.toString().split('@');
2461
-
2462
- const _bitMapId = this.consumer.getParsedIdIfExist(idWithoutVersion, false, true); // This logic is very specific, and very sensitive for changes please do not touch this without consulting with @ran or @gilad
2463
- // example (partial list) cases which should be handled are:
2464
- // use case 1 - ws component provided with the local scope name:
2465
- // source id : my-scope1/my-name1
2466
- // bitmap res (_id) : my-name1 (comp is tagged but not exported)
2467
- // local scope name : my-scope1
2468
- // scope content : my-name1
2469
- // expected result : my-name1
2470
- // use case 2 - component with same name exist in ws and scope (but with different scope name)
2471
- // source id : my-scope2/my-name1
2472
- // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)
2473
- // local scope name : my-scope1
2474
- // scope content : my-scope2/my-name1
2475
- // expected result : my-scope2/my-name1
2476
- // use case 3 - component with same name exist in ws and scope (but with different scope name) - source provided without scope name
2477
- // source id : my-name1
2478
- // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)
2479
- // local scope name : my-scope1
2480
- // scope content : my-scope1/my-name1 and my-scope2/my-name1
2481
- // expected result : my-name1 (get the name from the bitmap)
2482
- // use case 4 - component with the same name and different scope are imported into the ws
2483
- // source id : my-name1
2484
- // bitmap res (_id) : my-scope2/my-name1 (comp exist in ws from different scope (imported))
2485
- // local scope name : my-scope1
2486
- // scope content : my-scope2/my-name1
2487
- // expected result : my-scope2/my-name1 (get the name from the bitmap)
2488
- // No entry in bitmap at all, search for the original input id
2489
-
2490
-
2491
- if (!_bitMapId) {
2492
- return await this.scope.resolveComponentId(id.toString());
2493
- }
2438
+ if (legacyId) {
2439
+ const defaultScope = await getDefaultScope(legacyId); // only reason to strip the scopeName from the given id is when this id has the defaultScope, because .bitmap
2440
+ // doesn't have the defaultScope. if the given id doesn't have scope or has scope different than the default,
2441
+ // then don't ignore it. search with the scope-name.
2494
2442
 
2495
- const _bitMapIdWithoutVersion = _bitMapId.toStringWithoutVersion();
2443
+ const shouldSearchWithoutScopeInProvidedId = id.toString().startsWith(`${defaultScope}/`);
2444
+ legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, shouldSearchWithoutScopeInProvidedId);
2496
2445
 
2497
- const _bitMapIdWithVersion = _bitMapId.changeVersion(version).toString(); // The id in the bitmap has prefix which is not in the source id - the bitmap entry has scope name
2498
- // Handle use case 4
2446
+ if (legacyId) {
2447
+ return _component().ComponentID.fromLegacy(legacyId, defaultScope);
2448
+ }
2449
+ }
2499
2450
 
2451
+ try {
2452
+ const idWithVersion = id.toString();
2453
+ const [idWithoutVersion, version] = id.toString().split('@');
2454
+
2455
+ const _bitMapId = this.consumer.getParsedIdIfExist(idWithoutVersion, false, true); // This logic is very specific, and very sensitive for changes please do not touch this without consulting with @ran or @gilad
2456
+ // example (partial list) cases which should be handled are:
2457
+ // use case 1 - ws component provided with the local scope name:
2458
+ // source id : my-scope1/my-name1
2459
+ // bitmap res (_id) : my-name1 (comp is tagged but not exported)
2460
+ // local scope name : my-scope1
2461
+ // scope content : my-name1
2462
+ // expected result : my-name1
2463
+ // use case 2 - component with same name exist in ws and scope (but with different scope name)
2464
+ // source id : my-scope2/my-name1
2465
+ // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)
2466
+ // local scope name : my-scope1
2467
+ // scope content : my-scope2/my-name1
2468
+ // expected result : my-scope2/my-name1
2469
+ // use case 3 - component with same name exist in ws and scope (but with different scope name) - source provided without scope name
2470
+ // source id : my-name1
2471
+ // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)
2472
+ // local scope name : my-scope1
2473
+ // scope content : my-scope1/my-name1 and my-scope2/my-name1
2474
+ // expected result : my-name1 (get the name from the bitmap)
2475
+ // use case 4 - component with the same name and different scope are imported into the ws
2476
+ // source id : my-name1
2477
+ // bitmap res (_id) : my-scope2/my-name1 (comp exist in ws from different scope (imported))
2478
+ // local scope name : my-scope1
2479
+ // scope content : my-scope2/my-name1
2480
+ // expected result : my-scope2/my-name1 (get the name from the bitmap)
2481
+ // No entry in bitmap at all, search for the original input id
2482
+
2483
+
2484
+ if (!_bitMapId) {
2485
+ return await this.scope.resolveComponentId(id.toString());
2486
+ }
2500
2487
 
2501
- if (_bitMapIdWithoutVersion.endsWith(idWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {
2502
- return await this.scope.resolveComponentId(_bitMapIdWithVersion);
2503
- } // Handle case when I tagged the component locally with a default scope which is not the local scope
2504
- // but not exported it yet
2505
- // now i'm trying to load it with source id contain the default scope prefix
2506
- // we want to get it from the local first before assuming it's something coming from outside
2488
+ const _bitMapIdWithoutVersion = _bitMapId.toStringWithoutVersion();
2507
2489
 
2490
+ const _bitMapIdWithVersion = _bitMapId.changeVersion(version).toString(); // The id in the bitmap has prefix which is not in the source id - the bitmap entry has scope name
2491
+ // Handle use case 4
2508
2492
 
2509
- if (!_bitMapId.scope) {
2510
- const defaultScopeForBitmapId = await getDefaultScope(_bitMapId, {
2511
- ignoreVersion: true
2512
- });
2513
2493
 
2514
- const getFromBitmapAddDefaultScope = () => {
2515
- let _bitmapIdWithVersionForSource = _bitMapId;
2494
+ if (_bitMapIdWithoutVersion.endsWith(idWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {
2495
+ return await this.scope.resolveComponentId(_bitMapIdWithVersion);
2496
+ } // Handle case when I tagged the component locally with a default scope which is not the local scope
2497
+ // but not exported it yet
2498
+ // now i'm trying to load it with source id contain the default scope prefix
2499
+ // we want to get it from the local first before assuming it's something coming from outside
2516
2500
 
2517
- if (version) {
2518
- _bitmapIdWithVersionForSource = _bitMapId.changeVersion(version);
2519
- }
2520
2501
 
2521
- return _component().ComponentID.fromLegacy(_bitmapIdWithVersionForSource, defaultScopeForBitmapId);
2522
- }; // a case when the given id contains the default scope
2502
+ if (!_bitMapId.scope) {
2503
+ const defaultScopeForBitmapId = await getDefaultScope(_bitMapId, {
2504
+ ignoreVersion: true
2505
+ });
2523
2506
 
2507
+ const getFromBitmapAddDefaultScope = () => {
2508
+ let _bitmapIdWithVersionForSource = _bitMapId;
2524
2509
 
2525
- if (idWithVersion.startsWith(`${defaultScopeForBitmapId}/${_bitMapIdWithoutVersion}`)) {
2526
- return getFromBitmapAddDefaultScope();
2527
- } // a case when the given id does not contain the default scope
2510
+ if (version) {
2511
+ _bitmapIdWithVersionForSource = _bitMapId.changeVersion(version);
2512
+ }
2528
2513
 
2514
+ return _component().ComponentID.fromLegacy(_bitmapIdWithVersionForSource, defaultScopeForBitmapId);
2515
+ }; // a case when the given id contains the default scope
2529
2516
 
2530
- const fromScope = await this.scope.resolveComponentId(idWithVersion);
2531
2517
 
2532
- if (!fromScope._legacy.hasScope()) {
2533
- return getFromBitmapAddDefaultScope();
2534
- }
2535
- }
2518
+ if (idWithVersion.startsWith(`${defaultScopeForBitmapId}/${_bitMapIdWithoutVersion}`)) {
2519
+ return getFromBitmapAddDefaultScope();
2520
+ } // a case when the given id does not contain the default scope
2536
2521
 
2537
- if (idWithoutVersion.endsWith(_bitMapIdWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {
2538
- // The id in the bitmap doesn't have scope, the source id has scope
2539
- // Handle use case 2 and use case 1
2540
- if (id.toString().startsWith(this.scope.name)) {
2541
- // Handle use case 1 - the provided id has scope name same as the local scope name
2542
- // we want to send it as it appear in the bitmap
2543
- return await this.scope.resolveComponentId(_bitMapIdWithVersion);
2544
- } // Handle use case 2 - the provided id has scope which is not the local scope
2545
- // we want to search by the source id
2546
2522
 
2523
+ const fromScope = await this.scope.resolveComponentId(idWithVersion);
2547
2524
 
2548
- return await this.scope.resolveComponentId(idWithVersion);
2549
- } // Handle use case 3
2525
+ if (!fromScope._legacy.hasScope()) {
2526
+ return getFromBitmapAddDefaultScope();
2527
+ }
2528
+ }
2529
+
2530
+ if (idWithoutVersion.endsWith(_bitMapIdWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {
2531
+ // The id in the bitmap doesn't have scope, the source id has scope
2532
+ // Handle use case 2 and use case 1
2533
+ if (id.toString().startsWith(this.scope.name)) {
2534
+ // Handle use case 1 - the provided id has scope name same as the local scope name
2535
+ // we want to send it as it appear in the bitmap
2536
+ return await this.scope.resolveComponentId(_bitMapIdWithVersion);
2537
+ } // Handle use case 2 - the provided id has scope which is not the local scope
2538
+ // we want to search by the source id
2550
2539
 
2551
2540
 
2552
2541
  return await this.scope.resolveComponentId(idWithVersion);
2553
- } catch (error) {
2554
- legacyId = _legacyBitId().BitId.parse(id.toString(), true);
2555
- return _component().ComponentID.fromLegacy(legacyId);
2556
- }
2557
- }
2542
+ } // Handle use case 3
2558
2543
 
2559
- const defaultScope = await getDefaultScope(legacyId);
2560
- return _component().ComponentID.fromLegacy(legacyId, defaultScope);
2544
+
2545
+ return await this.scope.resolveComponentId(idWithVersion);
2546
+ } catch (error) {
2547
+ legacyId = _legacyBitId().BitId.parse(id.toString(), true);
2548
+ return _component().ComponentID.fromLegacy(legacyId);
2549
+ }
2561
2550
  }
2562
2551
 
2563
2552
  async resolveMultipleComponentIds(ids) {