@teambit/lister 1.0.949 → 1.0.951
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lister.main.runtime.d.ts +23 -0
- package/dist/lister.main.runtime.js +105 -1
- package/dist/lister.main.runtime.js.map +1 -1
- package/dist/search.cmd.d.ts +26 -0
- package/dist/search.cmd.js +74 -0
- package/dist/search.cmd.js.map +1 -0
- package/package.json +5 -3
- /package/dist/{preview-1776357718472.js → preview-1776432715724.js} +0 -0
|
@@ -11,6 +11,26 @@ export type ListScopeResult = {
|
|
|
11
11
|
laneReadmeOf?: string[];
|
|
12
12
|
rootDir?: string;
|
|
13
13
|
};
|
|
14
|
+
export type SearchOptions = {
|
|
15
|
+
owners?: string[];
|
|
16
|
+
skipAutoOwner?: boolean;
|
|
17
|
+
localOnly?: boolean;
|
|
18
|
+
remoteOnly?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type SearchResults = {
|
|
21
|
+
remote: string[];
|
|
22
|
+
local: string[];
|
|
23
|
+
perQuery: Array<{
|
|
24
|
+
query: string;
|
|
25
|
+
remoteCount: number;
|
|
26
|
+
localCount: number;
|
|
27
|
+
error?: string;
|
|
28
|
+
}>;
|
|
29
|
+
ownersUsed?: string[];
|
|
30
|
+
hasWorkspace: boolean;
|
|
31
|
+
/** true = connected, false = connection failed, undefined = remote search was not attempted */
|
|
32
|
+
remoteAvailable?: boolean;
|
|
33
|
+
};
|
|
14
34
|
export declare class ListerMain {
|
|
15
35
|
private logger;
|
|
16
36
|
private workspace?;
|
|
@@ -35,6 +55,9 @@ export declare class ListerMain {
|
|
|
35
55
|
private extractErrorMessage;
|
|
36
56
|
localList(showAll?: boolean, showRemoteVersion?: boolean, namespacesUsingWildcards?: string, scopeName?: string): Promise<ListScopeResult[]>;
|
|
37
57
|
private sortListScopeResults;
|
|
58
|
+
private _http?;
|
|
59
|
+
private getHttp;
|
|
60
|
+
search(queries: string[], opts?: SearchOptions): Promise<SearchResults>;
|
|
38
61
|
static slots: never[];
|
|
39
62
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
40
63
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
@@ -60,6 +60,27 @@ function _toolboxPromise() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
+
function _scope2() {
|
|
64
|
+
const data = require("@teambit/scope.network");
|
|
65
|
+
_scope2 = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
function _legacy3() {
|
|
71
|
+
const data = require("@teambit/legacy.constants");
|
|
72
|
+
_legacy3 = function () {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
function _legacy4() {
|
|
78
|
+
const data = require("@teambit/legacy.utils");
|
|
79
|
+
_legacy4 = function () {
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
63
84
|
function _list() {
|
|
64
85
|
const data = require("./list.cmd");
|
|
65
86
|
_list = function () {
|
|
@@ -67,6 +88,13 @@ function _list() {
|
|
|
67
88
|
};
|
|
68
89
|
return data;
|
|
69
90
|
}
|
|
91
|
+
function _search() {
|
|
92
|
+
const data = require("./search.cmd");
|
|
93
|
+
_search = function () {
|
|
94
|
+
return data;
|
|
95
|
+
};
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
70
98
|
function _lister() {
|
|
71
99
|
const data = require("./lister.aspect");
|
|
72
100
|
_lister = function () {
|
|
@@ -90,6 +118,7 @@ class ListerMain {
|
|
|
90
118
|
constructor(logger, workspace) {
|
|
91
119
|
this.logger = logger;
|
|
92
120
|
this.workspace = workspace;
|
|
121
|
+
_defineProperty(this, "_http", void 0);
|
|
93
122
|
}
|
|
94
123
|
async remoteList(scopeName, {
|
|
95
124
|
namespacesUsingWildcards,
|
|
@@ -211,10 +240,85 @@ class ListerMain {
|
|
|
211
240
|
sortListScopeResults(listScopeResults) {
|
|
212
241
|
return listScopeResults.sort((a, b) => a.id.toString().localeCompare(b.id.toString()));
|
|
213
242
|
}
|
|
243
|
+
async getHttp() {
|
|
244
|
+
if (!this._http) {
|
|
245
|
+
this._http = await _scope2().Http.connect(_legacy3().SYMPHONY_GRAPHQL, _legacy3().CENTRAL_BIT_HUB_NAME);
|
|
246
|
+
}
|
|
247
|
+
return this._http;
|
|
248
|
+
}
|
|
249
|
+
async search(queries, opts = {}) {
|
|
250
|
+
if (!queries.length) throw new (_bitError().BitError)('search requires at least one query');
|
|
251
|
+
if (opts.localOnly && opts.remoteOnly) {
|
|
252
|
+
throw new (_bitError().BitError)('--local-only and --remote-only cannot be used together');
|
|
253
|
+
}
|
|
254
|
+
if (opts.localOnly && !this.workspace) {
|
|
255
|
+
throw new (_bitError().BitError)('--local-only requires a workspace. Run without --local-only to search remote only.');
|
|
256
|
+
}
|
|
257
|
+
const uniqueQueries = [...new Set(queries)];
|
|
258
|
+
let ownersToUse = opts.owners?.length ? opts.owners : undefined;
|
|
259
|
+
if (!ownersToUse && !opts.skipAutoOwner && this.workspace) {
|
|
260
|
+
const owner = (0, _legacy4().parseScope)(this.workspace.defaultScope).owner ?? this.workspace.defaultScope;
|
|
261
|
+
if (owner) ownersToUse = [owner];
|
|
262
|
+
}
|
|
263
|
+
const [localIds, http] = await Promise.all([!opts.remoteOnly && this.workspace ? this.workspace.listIds().map(id => id.toStringWithoutVersion()) : [], opts.localOnly ? undefined : this.getHttp().catch(err => {
|
|
264
|
+
this.logger.warn(`failed to connect to remote: ${this.extractErrorMessage(err)}`);
|
|
265
|
+
return undefined;
|
|
266
|
+
})]);
|
|
267
|
+
const localIdsLower = localIds.map(id => id.toLowerCase());
|
|
268
|
+
const perQuery = await Promise.all(uniqueQueries.map(async query => {
|
|
269
|
+
const lower = query.toLowerCase();
|
|
270
|
+
const localMatches = localIds.filter((_, i) => localIdsLower[i].includes(lower));
|
|
271
|
+
let remoteCount = 0;
|
|
272
|
+
let remoteComponents = [];
|
|
273
|
+
let error;
|
|
274
|
+
if (http) {
|
|
275
|
+
try {
|
|
276
|
+
const result = await http.search(query, ownersToUse);
|
|
277
|
+
remoteComponents = result?.components || [];
|
|
278
|
+
remoteCount = remoteComponents.length;
|
|
279
|
+
} catch (err) {
|
|
280
|
+
error = this.extractErrorMessage(err);
|
|
281
|
+
this.logger.warn(`search failed for query "${query}": ${error}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
query,
|
|
286
|
+
remoteCount,
|
|
287
|
+
localCount: localMatches.length,
|
|
288
|
+
error,
|
|
289
|
+
localMatches,
|
|
290
|
+
remoteComponents
|
|
291
|
+
};
|
|
292
|
+
}));
|
|
293
|
+
const remoteSet = new Set();
|
|
294
|
+
const localSet = new Set();
|
|
295
|
+
for (const result of perQuery) {
|
|
296
|
+
result.remoteComponents.forEach(id => remoteSet.add(id));
|
|
297
|
+
result.localMatches.forEach(id => localSet.add(id));
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
remote: Array.from(remoteSet).sort(),
|
|
301
|
+
local: Array.from(localSet).sort(),
|
|
302
|
+
perQuery: perQuery.map(({
|
|
303
|
+
query,
|
|
304
|
+
remoteCount,
|
|
305
|
+
localCount,
|
|
306
|
+
error
|
|
307
|
+
}) => ({
|
|
308
|
+
query,
|
|
309
|
+
remoteCount,
|
|
310
|
+
localCount,
|
|
311
|
+
error
|
|
312
|
+
})),
|
|
313
|
+
ownersUsed: ownersToUse,
|
|
314
|
+
hasWorkspace: !!this.workspace,
|
|
315
|
+
remoteAvailable: opts.localOnly ? undefined : !!http
|
|
316
|
+
};
|
|
317
|
+
}
|
|
214
318
|
static async provider([cli, loggerMain, workspace]) {
|
|
215
319
|
const logger = loggerMain.createLogger(_lister().ListerAspect.id);
|
|
216
320
|
const lister = new ListerMain(logger, workspace);
|
|
217
|
-
cli.register(new (_list().ListCmd)(lister));
|
|
321
|
+
cli.register(new (_list().ListCmd)(lister), new (_search().SearchCmd)(lister));
|
|
218
322
|
return lister;
|
|
219
323
|
}
|
|
220
324
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_logger","_workspace","_legacy","_scope","_legacy2","_bitError","_toolboxPromise","_list","_lister","_noIdMatchWildcard","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BEFORE_REMOTE_LIST","BEFORE_LOCAL_LIST","ListerMain","constructor","logger","workspace","remoteList","scopeName","namespacesUsingWildcards","includeDeprecated","includeDeleted","skipStatusLine","remote","getRemoteByName","consumer","setStatusLine","listResult","list","results","filter","deprecated","sortListScopeResults","getRemoteCompIdsByWildcards","idStr","includes","BitError","idSplit","split","rest","join","length","NoIdMatchWildcard","map","result","id","getRemoteCompIdsByOwnerGrouped","owner","scopes","listScopesByOwner","totalScopes","consoleSuccess","scopeIds","Map","failedScopes","failedScopesErrors","pMapPool","ids","set","err","push","extractErrorMessage","concurrency","size","totalComponents","Array","from","values","reduce","sum","response","errors","message","msg","startsWith","parsed","JSON","parse","localList","showAll","showRemoteVersion","ConsumerNotFound","componentsList","ComponentsList","listAll","scope","bitMap","allComponents","getAllComponents","componentMapById","componentMap","toStringWithoutVersion","forEach","get","rootDir","getComponentDir","listScopeResults","sort","a","b","toString","localeCompare","provider","cli","loggerMain","createLogger","ListerAspect","lister","register","ListCmd","exports","CLIAspect","LoggerAspect","WorkspaceAspect","MainRuntime","addRuntime"],"sources":["lister.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy.consumer';\nimport type { Remote } from '@teambit/scope.remotes';\nimport { getRemoteByName, listScopesByOwner } from '@teambit/scope.remotes';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { BitError } from '@teambit/bit-error';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { ListCmd } from './list.cmd';\nimport { ListerAspect } from './lister.aspect';\nimport { NoIdMatchWildcard } from './no-id-match-wildcard';\n\nconst BEFORE_REMOTE_LIST = 'listing remote components';\nconst BEFORE_LOCAL_LIST = 'listing components';\n\nexport type ListScopeResult = {\n id: ComponentID;\n currentlyUsedVersion?: string | null | undefined;\n remoteVersion?: string;\n deprecated?: boolean;\n removed?: boolean;\n laneReadmeOf?: string[];\n rootDir?: string;\n};\n\nexport class ListerMain {\n constructor(\n private logger: Logger,\n private workspace?: Workspace\n ) {}\n\n async remoteList(\n scopeName: string,\n {\n namespacesUsingWildcards,\n includeDeprecated = true,\n includeDeleted = false,\n skipStatusLine = false,\n }: {\n namespacesUsingWildcards?: string;\n includeDeprecated?: boolean;\n includeDeleted?: boolean;\n skipStatusLine?: boolean;\n }\n ): Promise<ListScopeResult[]> {\n const remote: Remote = await getRemoteByName(scopeName, this.workspace?.consumer);\n if (!skipStatusLine) {\n this.logger.setStatusLine(BEFORE_REMOTE_LIST);\n }\n const listResult = await remote.list(namespacesUsingWildcards, includeDeleted);\n const results = includeDeprecated ? listResult : listResult.filter((r) => !r.deprecated);\n return this.sortListScopeResults(results);\n }\n\n async getRemoteCompIdsByWildcards(idStr: string, includeDeprecated = true): Promise<ComponentID[]> {\n if (!idStr.includes('/')) {\n throw new BitError(`import with wildcards expects full scope-name before the wildcards, instead, got \"${idStr}\"`);\n }\n const idSplit = idStr.split('/');\n const [scopeName, ...rest] = idSplit;\n const namespacesUsingWildcards = rest.join('/');\n const listResult = await this.remoteList(scopeName, { namespacesUsingWildcards, includeDeprecated });\n if (!listResult.length) {\n throw new NoIdMatchWildcard([idStr]);\n }\n return listResult.map((result) => result.id);\n }\n\n /**\n * Get all component IDs from all scopes owned by a specific owner, grouped by scope.\n * This is used with the --owner flag, e.g., `bit import teambit --owner`.\n * Returns a map of scopeName -> componentIds, allowing the caller to handle each scope separately.\n */\n async getRemoteCompIdsByOwnerGrouped(\n owner: string,\n includeDeprecated = true\n ): Promise<{\n scopeIds: Map<string, ComponentID[]>;\n failedScopes: string[];\n failedScopesErrors: Map<string, string>;\n }> {\n this.logger.setStatusLine(`fetching scopes for owner \"${owner}\"`);\n const scopes = await listScopesByOwner(owner);\n\n if (!scopes.length) {\n throw new BitError(`no scopes found for owner \"${owner}\"`);\n }\n\n const totalScopes = scopes.length;\n this.logger.consoleSuccess(`found ${totalScopes} scopes for owner \"${owner}\"`);\n this.logger.setStatusLine(`fetching component-ids from ${totalScopes} scopes for owner \"${owner}\"`);\n const scopeIds = new Map<string, ComponentID[]>();\n const failedScopes: string[] = [];\n const failedScopesErrors = new Map<string, string>();\n\n await pMapPool(\n scopes,\n async (scopeName) => {\n try {\n const listResult = await this.remoteList(scopeName, {\n namespacesUsingWildcards: '**',\n includeDeprecated,\n skipStatusLine: true,\n });\n const ids = listResult.map((result) => result.id);\n if (ids.length) {\n scopeIds.set(scopeName, ids);\n }\n } catch (err: any) {\n failedScopes.push(scopeName);\n failedScopesErrors.set(scopeName, this.extractErrorMessage(err));\n }\n },\n { concurrency: 10 }\n );\n\n if (!scopeIds.size) {\n throw new NoIdMatchWildcard([`${owner}/**`]);\n }\n\n const totalComponents = Array.from(scopeIds.values()).reduce((sum, ids) => sum + ids.length, 0);\n this.logger.consoleSuccess(`found ${totalComponents} components across ${scopeIds.size} scopes`);\n\n return { scopeIds, failedScopes, failedScopesErrors };\n }\n\n private extractErrorMessage(err: any): string {\n // GraphQL client errors have response.errors array\n if (err.response?.errors?.length) {\n return err.response.errors.map((e: any) => e.message).join('; ');\n }\n // Sometimes the error message itself is JSON stringified\n const msg = err.message || String(err);\n if (msg.startsWith('{')) {\n try {\n const parsed = JSON.parse(msg);\n if (parsed.response?.errors?.length) {\n return parsed.response.errors.map((e: any) => e.message).join('; ');\n }\n } catch {\n // Not valid JSON, return as-is\n }\n }\n return msg;\n }\n\n async localList(\n showAll = false,\n showRemoteVersion = false,\n namespacesUsingWildcards?: string,\n scopeName?: string\n ): Promise<ListScopeResult[]> {\n if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n this.logger.setStatusLine(BEFORE_LOCAL_LIST);\n const componentsList = new ComponentsList(this.workspace);\n let results: ListScopeResult[] = await componentsList.listAll(showRemoteVersion, showAll, namespacesUsingWildcards);\n if (scopeName) {\n results = results.filter((result) => result.id.scope === scopeName);\n }\n const bitMap = this.workspace.consumer.bitMap;\n const allComponents = bitMap.getAllComponents();\n const componentMapById = new Map(\n allComponents.map((componentMap) => [componentMap.id.toStringWithoutVersion(), componentMap])\n );\n results.forEach((result) => {\n const componentMap = componentMapById.get(result.id.toStringWithoutVersion());\n if (componentMap) {\n result.rootDir = componentMap.getComponentDir();\n }\n });\n return this.sortListScopeResults(results);\n }\n\n private sortListScopeResults(listScopeResults: ListScopeResult[]): ListScopeResult[] {\n return listScopeResults.sort((a, b) => a.id.toString().localeCompare(b.id.toString()));\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect, WorkspaceAspect];\n static runtime = MainRuntime;\n static async provider([cli, loggerMain, workspace]: [CLIMain, LoggerMain, Workspace]) {\n const logger = loggerMain.createLogger(ListerAspect.id);\n const lister = new ListerMain(logger, workspace);\n cli.register(new ListCmd(lister));\n return lister;\n }\n}\n\nListerAspect.addRuntime(ListerMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AA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uD,QAAQ,CAAC,CAAC,CAAC,CAAC;EACxF;EAKA,aAAaE,QAAQA,CAAC,CAACC,GAAG,EAAEC,UAAU,EAAExF,SAAS,CAAmC,EAAE;IACpF,MAAMD,MAAM,GAAGyF,UAAU,CAACC,YAAY,CAACC,sBAAY,CAAC7D,EAAE,CAAC;IACvD,MAAM8D,MAAM,GAAG,IAAI9F,UAAU,CAACE,MAAM,EAAEC,SAAS,CAAC;IAChDuF,GAAG,CAACK,QAAQ,CAAC,KAAIC,eAAO,EAACF,MAAM,CAAC,CAAC;IACjC,OAAOA,MAAM;EACf;AACF;AAACG,OAAA,CAAAjG,UAAA,GAAAA,UAAA;AAAArB,eAAA,CAnKYqB,UAAU,WA0JN,EAAE;AAAArB,eAAA,CA1JNqB,UAAU,kBA2JC,CAACkG,gBAAS,EAAEC,sBAAY,EAAEC,4BAAe,CAAC;AAAAzH,eAAA,CA3JrDqB,UAAU,aA4JJqG,kBAAW;AAS9BR,sBAAY,CAACS,UAAU,CAACtG,UAAU,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_logger","_workspace","_legacy","_scope","_legacy2","_bitError","_toolboxPromise","_scope2","_legacy3","_legacy4","_list","_search","_lister","_noIdMatchWildcard","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BEFORE_REMOTE_LIST","BEFORE_LOCAL_LIST","ListerMain","constructor","logger","workspace","remoteList","scopeName","namespacesUsingWildcards","includeDeprecated","includeDeleted","skipStatusLine","remote","getRemoteByName","consumer","setStatusLine","listResult","list","results","filter","deprecated","sortListScopeResults","getRemoteCompIdsByWildcards","idStr","includes","BitError","idSplit","split","rest","join","length","NoIdMatchWildcard","map","result","id","getRemoteCompIdsByOwnerGrouped","owner","scopes","listScopesByOwner","totalScopes","consoleSuccess","scopeIds","Map","failedScopes","failedScopesErrors","pMapPool","ids","set","err","push","extractErrorMessage","concurrency","size","totalComponents","Array","from","values","reduce","sum","response","errors","message","msg","startsWith","parsed","JSON","parse","localList","showAll","showRemoteVersion","ConsumerNotFound","componentsList","ComponentsList","listAll","scope","bitMap","allComponents","getAllComponents","componentMapById","componentMap","toStringWithoutVersion","forEach","get","rootDir","getComponentDir","listScopeResults","sort","a","b","toString","localeCompare","getHttp","_http","Http","connect","SYMPHONY_GRAPHQL","CENTRAL_BIT_HUB_NAME","search","queries","opts","localOnly","remoteOnly","uniqueQueries","Set","ownersToUse","owners","undefined","skipAutoOwner","parseScope","defaultScope","localIds","http","Promise","all","listIds","catch","warn","localIdsLower","toLowerCase","perQuery","query","lower","localMatches","_","remoteCount","remoteComponents","error","components","localCount","remoteSet","localSet","add","local","ownersUsed","hasWorkspace","remoteAvailable","provider","cli","loggerMain","createLogger","ListerAspect","lister","register","ListCmd","SearchCmd","exports","CLIAspect","LoggerAspect","WorkspaceAspect","MainRuntime","addRuntime"],"sources":["lister.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ConsumerNotFound } from '@teambit/legacy.consumer';\nimport type { Remote } from '@teambit/scope.remotes';\nimport { getRemoteByName, listScopesByOwner } from '@teambit/scope.remotes';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { BitError } from '@teambit/bit-error';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { Http } from '@teambit/scope.network';\nimport { CENTRAL_BIT_HUB_NAME, SYMPHONY_GRAPHQL } from '@teambit/legacy.constants';\nimport { parseScope } from '@teambit/legacy.utils';\nimport { ListCmd } from './list.cmd';\nimport { SearchCmd } from './search.cmd';\nimport { ListerAspect } from './lister.aspect';\nimport { NoIdMatchWildcard } from './no-id-match-wildcard';\n\nconst BEFORE_REMOTE_LIST = 'listing remote components';\nconst BEFORE_LOCAL_LIST = 'listing components';\n\nexport type ListScopeResult = {\n id: ComponentID;\n currentlyUsedVersion?: string | null | undefined;\n remoteVersion?: string;\n deprecated?: boolean;\n removed?: boolean;\n laneReadmeOf?: string[];\n rootDir?: string;\n};\n\nexport type SearchOptions = {\n owners?: string[];\n skipAutoOwner?: boolean;\n localOnly?: boolean;\n remoteOnly?: boolean;\n};\n\nexport type SearchResults = {\n remote: string[];\n local: string[];\n perQuery: Array<{ query: string; remoteCount: number; localCount: number; error?: string }>;\n ownersUsed?: string[];\n hasWorkspace: boolean;\n /** true = connected, false = connection failed, undefined = remote search was not attempted */\n remoteAvailable?: boolean;\n};\n\nexport class ListerMain {\n constructor(\n private logger: Logger,\n private workspace?: Workspace\n ) {}\n\n async remoteList(\n scopeName: string,\n {\n namespacesUsingWildcards,\n includeDeprecated = true,\n includeDeleted = false,\n skipStatusLine = false,\n }: {\n namespacesUsingWildcards?: string;\n includeDeprecated?: boolean;\n includeDeleted?: boolean;\n skipStatusLine?: boolean;\n }\n ): Promise<ListScopeResult[]> {\n const remote: Remote = await getRemoteByName(scopeName, this.workspace?.consumer);\n if (!skipStatusLine) {\n this.logger.setStatusLine(BEFORE_REMOTE_LIST);\n }\n const listResult = await remote.list(namespacesUsingWildcards, includeDeleted);\n const results = includeDeprecated ? listResult : listResult.filter((r) => !r.deprecated);\n return this.sortListScopeResults(results);\n }\n\n async getRemoteCompIdsByWildcards(idStr: string, includeDeprecated = true): Promise<ComponentID[]> {\n if (!idStr.includes('/')) {\n throw new BitError(`import with wildcards expects full scope-name before the wildcards, instead, got \"${idStr}\"`);\n }\n const idSplit = idStr.split('/');\n const [scopeName, ...rest] = idSplit;\n const namespacesUsingWildcards = rest.join('/');\n const listResult = await this.remoteList(scopeName, { namespacesUsingWildcards, includeDeprecated });\n if (!listResult.length) {\n throw new NoIdMatchWildcard([idStr]);\n }\n return listResult.map((result) => result.id);\n }\n\n /**\n * Get all component IDs from all scopes owned by a specific owner, grouped by scope.\n * This is used with the --owner flag, e.g., `bit import teambit --owner`.\n * Returns a map of scopeName -> componentIds, allowing the caller to handle each scope separately.\n */\n async getRemoteCompIdsByOwnerGrouped(\n owner: string,\n includeDeprecated = true\n ): Promise<{\n scopeIds: Map<string, ComponentID[]>;\n failedScopes: string[];\n failedScopesErrors: Map<string, string>;\n }> {\n this.logger.setStatusLine(`fetching scopes for owner \"${owner}\"`);\n const scopes = await listScopesByOwner(owner);\n\n if (!scopes.length) {\n throw new BitError(`no scopes found for owner \"${owner}\"`);\n }\n\n const totalScopes = scopes.length;\n this.logger.consoleSuccess(`found ${totalScopes} scopes for owner \"${owner}\"`);\n this.logger.setStatusLine(`fetching component-ids from ${totalScopes} scopes for owner \"${owner}\"`);\n const scopeIds = new Map<string, ComponentID[]>();\n const failedScopes: string[] = [];\n const failedScopesErrors = new Map<string, string>();\n\n await pMapPool(\n scopes,\n async (scopeName) => {\n try {\n const listResult = await this.remoteList(scopeName, {\n namespacesUsingWildcards: '**',\n includeDeprecated,\n skipStatusLine: true,\n });\n const ids = listResult.map((result) => result.id);\n if (ids.length) {\n scopeIds.set(scopeName, ids);\n }\n } catch (err: any) {\n failedScopes.push(scopeName);\n failedScopesErrors.set(scopeName, this.extractErrorMessage(err));\n }\n },\n { concurrency: 10 }\n );\n\n if (!scopeIds.size) {\n throw new NoIdMatchWildcard([`${owner}/**`]);\n }\n\n const totalComponents = Array.from(scopeIds.values()).reduce((sum, ids) => sum + ids.length, 0);\n this.logger.consoleSuccess(`found ${totalComponents} components across ${scopeIds.size} scopes`);\n\n return { scopeIds, failedScopes, failedScopesErrors };\n }\n\n private extractErrorMessage(err: any): string {\n // GraphQL client errors have response.errors array\n if (err.response?.errors?.length) {\n return err.response.errors.map((e: any) => e.message).join('; ');\n }\n // Sometimes the error message itself is JSON stringified\n const msg = err.message || String(err);\n if (msg.startsWith('{')) {\n try {\n const parsed = JSON.parse(msg);\n if (parsed.response?.errors?.length) {\n return parsed.response.errors.map((e: any) => e.message).join('; ');\n }\n } catch {\n // Not valid JSON, return as-is\n }\n }\n return msg;\n }\n\n async localList(\n showAll = false,\n showRemoteVersion = false,\n namespacesUsingWildcards?: string,\n scopeName?: string\n ): Promise<ListScopeResult[]> {\n if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n this.logger.setStatusLine(BEFORE_LOCAL_LIST);\n const componentsList = new ComponentsList(this.workspace);\n let results: ListScopeResult[] = await componentsList.listAll(showRemoteVersion, showAll, namespacesUsingWildcards);\n if (scopeName) {\n results = results.filter((result) => result.id.scope === scopeName);\n }\n const bitMap = this.workspace.consumer.bitMap;\n const allComponents = bitMap.getAllComponents();\n const componentMapById = new Map(\n allComponents.map((componentMap) => [componentMap.id.toStringWithoutVersion(), componentMap])\n );\n results.forEach((result) => {\n const componentMap = componentMapById.get(result.id.toStringWithoutVersion());\n if (componentMap) {\n result.rootDir = componentMap.getComponentDir();\n }\n });\n return this.sortListScopeResults(results);\n }\n\n private sortListScopeResults(listScopeResults: ListScopeResult[]): ListScopeResult[] {\n return listScopeResults.sort((a, b) => a.id.toString().localeCompare(b.id.toString()));\n }\n\n private _http?: Http;\n private async getHttp(): Promise<Http> {\n if (!this._http) {\n this._http = await Http.connect(SYMPHONY_GRAPHQL, CENTRAL_BIT_HUB_NAME);\n }\n return this._http;\n }\n\n async search(queries: string[], opts: SearchOptions = {}): Promise<SearchResults> {\n if (!queries.length) throw new BitError('search requires at least one query');\n if (opts.localOnly && opts.remoteOnly) {\n throw new BitError('--local-only and --remote-only cannot be used together');\n }\n if (opts.localOnly && !this.workspace) {\n throw new BitError('--local-only requires a workspace. Run without --local-only to search remote only.');\n }\n const uniqueQueries = [...new Set(queries)];\n\n let ownersToUse = opts.owners?.length ? opts.owners : undefined;\n if (!ownersToUse && !opts.skipAutoOwner && this.workspace) {\n const owner = parseScope(this.workspace.defaultScope).owner ?? this.workspace.defaultScope;\n if (owner) ownersToUse = [owner];\n }\n\n const [localIds, http] = await Promise.all([\n !opts.remoteOnly && this.workspace ? this.workspace.listIds().map((id) => id.toStringWithoutVersion()) : [],\n opts.localOnly\n ? undefined\n : this.getHttp().catch((err) => {\n this.logger.warn(`failed to connect to remote: ${this.extractErrorMessage(err)}`);\n return undefined;\n }),\n ]);\n\n const localIdsLower = localIds.map((id) => id.toLowerCase());\n\n const perQuery = await Promise.all(\n uniqueQueries.map(async (query) => {\n const lower = query.toLowerCase();\n const localMatches = localIds.filter((_, i) => localIdsLower[i].includes(lower));\n\n let remoteCount = 0;\n let remoteComponents: string[] = [];\n let error: string | undefined;\n if (http) {\n try {\n const result = await http.search(query, ownersToUse);\n remoteComponents = result?.components || [];\n remoteCount = remoteComponents.length;\n } catch (err: any) {\n error = this.extractErrorMessage(err);\n this.logger.warn(`search failed for query \"${query}\": ${error}`);\n }\n }\n\n return { query, remoteCount, localCount: localMatches.length, error, localMatches, remoteComponents };\n })\n );\n\n const remoteSet = new Set<string>();\n const localSet = new Set<string>();\n for (const result of perQuery) {\n result.remoteComponents.forEach((id) => remoteSet.add(id));\n result.localMatches.forEach((id) => localSet.add(id));\n }\n\n return {\n remote: Array.from(remoteSet).sort(),\n local: Array.from(localSet).sort(),\n perQuery: perQuery.map(({ query, remoteCount, localCount, error }) => ({\n query,\n remoteCount,\n localCount,\n error,\n })),\n ownersUsed: ownersToUse,\n hasWorkspace: !!this.workspace,\n remoteAvailable: opts.localOnly ? undefined : !!http,\n };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect, WorkspaceAspect];\n static runtime = MainRuntime;\n static async provider([cli, loggerMain, workspace]: [CLIMain, LoggerMain, Workspace]) {\n const logger = loggerMain.createLogger(ListerAspect.id);\n const lister = new ListerMain(logger, workspace);\n cli.register(new ListCmd(lister), new SearchCmd(lister));\n return lister;\n }\n}\n\nListerAspect.addRuntime(ListerMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;E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EC,4BAAe,CAAC;AAAAvK,eAAA,CA5OrDqB,UAAU,aA6OJmJ,kBAAW;AAS9BT,sBAAY,CAACU,UAAU,CAACpJ,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import type { ListerMain, SearchResults } from './lister.main.runtime';
|
|
3
|
+
type SearchFlags = {
|
|
4
|
+
owners?: string;
|
|
5
|
+
skipAutoOwner?: boolean;
|
|
6
|
+
remoteOnly?: boolean;
|
|
7
|
+
localOnly?: boolean;
|
|
8
|
+
json?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare class SearchCmd implements Command {
|
|
11
|
+
private lister;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
extendedDescription: string;
|
|
15
|
+
group: string;
|
|
16
|
+
options: CommandOptions;
|
|
17
|
+
loader: boolean;
|
|
18
|
+
skipWorkspace: boolean;
|
|
19
|
+
remoteOp: boolean;
|
|
20
|
+
constructor(lister: ListerMain);
|
|
21
|
+
private parseOwners;
|
|
22
|
+
private run;
|
|
23
|
+
report([queries]: [string[]], flags: SearchFlags): Promise<string>;
|
|
24
|
+
json([queries]: [string[]], flags: SearchFlags): Promise<SearchResults>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SearchCmd = void 0;
|
|
7
|
+
function _cli() {
|
|
8
|
+
const data = require("@teambit/cli");
|
|
9
|
+
_cli = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
class SearchCmd {
|
|
18
|
+
constructor(lister) {
|
|
19
|
+
this.lister = lister;
|
|
20
|
+
_defineProperty(this, "name", 'search <query...>');
|
|
21
|
+
_defineProperty(this, "description", 'search for components by keyword in the local workspace and remote bit cloud');
|
|
22
|
+
_defineProperty(this, "extendedDescription", `runs the provided query terms in parallel against bit cloud and against the local workspace.
|
|
23
|
+
multiple queries are unioned (deduplicated) in the output. by default, remote results are filtered by the
|
|
24
|
+
owner extracted from the workspace's defaultScope; use --owners or --skip-auto-owner to change this.`);
|
|
25
|
+
_defineProperty(this, "group", 'info-analysis');
|
|
26
|
+
_defineProperty(this, "options", [['o', 'owners <list>', 'comma-separated list of owners/orgs to filter remote results by'], ['', 'skip-auto-owner', 'do not auto-extract owner from workspace defaultScope'], ['r', 'remote-only', 'only search remote bit cloud, skip local workspace'], ['l', 'local-only', 'only search the local workspace, skip remote bit cloud'], ['j', 'json', 'show the output in JSON format']]);
|
|
27
|
+
_defineProperty(this, "loader", true);
|
|
28
|
+
_defineProperty(this, "skipWorkspace", true);
|
|
29
|
+
_defineProperty(this, "remoteOp", true);
|
|
30
|
+
}
|
|
31
|
+
parseOwners(owners) {
|
|
32
|
+
if (!owners) return undefined;
|
|
33
|
+
return owners.split(',').map(o => o.trim()).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
async run(queries, flags) {
|
|
36
|
+
return this.lister.search(queries, {
|
|
37
|
+
owners: this.parseOwners(flags.owners),
|
|
38
|
+
skipAutoOwner: flags.skipAutoOwner,
|
|
39
|
+
remoteOnly: flags.remoteOnly,
|
|
40
|
+
localOnly: flags.localOnly
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async report([queries], flags) {
|
|
44
|
+
const results = await this.run(queries, flags);
|
|
45
|
+
const sections = [];
|
|
46
|
+
if (results.ownersUsed?.length && !flags.localOnly && results.remoteAvailable !== false) {
|
|
47
|
+
sections.push((0, _cli().formatHint)(`remote search filtered by owners: ${results.ownersUsed.join(', ')}`));
|
|
48
|
+
}
|
|
49
|
+
if (!flags.remoteOnly && results.hasWorkspace) {
|
|
50
|
+
const body = results.local.length ? results.local.join('\n') : (0, _cli().formatHint)('no matches in workspace');
|
|
51
|
+
sections.push(`${(0, _cli().formatTitle)(`Local (${results.local.length})`)}\n${body}`);
|
|
52
|
+
}
|
|
53
|
+
if (!flags.localOnly) {
|
|
54
|
+
if (results.remoteAvailable === false) {
|
|
55
|
+
sections.push((0, _cli().formatHint)('remote search unavailable (connection failed)'));
|
|
56
|
+
} else {
|
|
57
|
+
const body = results.remote.length ? results.remote.join('\n') : (0, _cli().formatHint)('no matches on bit cloud');
|
|
58
|
+
sections.push(`${(0, _cli().formatTitle)(`Remote (${results.remote.length})`)}\n${body}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const failed = results.perQuery.filter(r => r.error);
|
|
62
|
+
if (failed.length) {
|
|
63
|
+
const items = failed.map(r => ` - "${r.query}": ${r.error}`);
|
|
64
|
+
sections.push(`${(0, _cli().formatWarningSummary)('Failed queries:')}\n${items.join('\n')}`);
|
|
65
|
+
}
|
|
66
|
+
return (0, _cli().joinSections)(sections);
|
|
67
|
+
}
|
|
68
|
+
async json([queries], flags) {
|
|
69
|
+
return this.run(queries, flags);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.SearchCmd = SearchCmd;
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=search.cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SearchCmd","constructor","lister","parseOwners","owners","undefined","split","map","o","trim","filter","Boolean","run","queries","flags","search","skipAutoOwner","remoteOnly","localOnly","report","results","sections","ownersUsed","length","remoteAvailable","push","formatHint","join","hasWorkspace","body","local","formatTitle","remote","failed","perQuery","error","items","query","formatWarningSummary","joinSections","json","exports"],"sources":["search.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatTitle, formatHint, formatWarningSummary, joinSections } from '@teambit/cli';\nimport type { ListerMain, SearchResults } from './lister.main.runtime';\n\ntype SearchFlags = {\n owners?: string;\n skipAutoOwner?: boolean;\n remoteOnly?: boolean;\n localOnly?: boolean;\n json?: boolean;\n};\n\nexport class SearchCmd implements Command {\n name = 'search <query...>';\n description = 'search for components by keyword in the local workspace and remote bit cloud';\n extendedDescription = `runs the provided query terms in parallel against bit cloud and against the local workspace.\nmultiple queries are unioned (deduplicated) in the output. by default, remote results are filtered by the\nowner extracted from the workspace's defaultScope; use --owners or --skip-auto-owner to change this.`;\n group = 'info-analysis';\n options = [\n ['o', 'owners <list>', 'comma-separated list of owners/orgs to filter remote results by'],\n ['', 'skip-auto-owner', 'do not auto-extract owner from workspace defaultScope'],\n ['r', 'remote-only', 'only search remote bit cloud, skip local workspace'],\n ['l', 'local-only', 'only search the local workspace, skip remote bit cloud'],\n ['j', 'json', 'show the output in JSON format'],\n ] as CommandOptions;\n loader = true;\n skipWorkspace = true;\n remoteOp = true;\n\n constructor(private lister: ListerMain) {}\n\n private parseOwners(owners?: string): string[] | undefined {\n if (!owners) return undefined;\n return owners\n .split(',')\n .map((o) => o.trim())\n .filter(Boolean);\n }\n\n private async run(queries: string[], flags: SearchFlags): Promise<SearchResults> {\n return this.lister.search(queries, {\n owners: this.parseOwners(flags.owners),\n skipAutoOwner: flags.skipAutoOwner,\n remoteOnly: flags.remoteOnly,\n localOnly: flags.localOnly,\n });\n }\n\n async report([queries]: [string[]], flags: SearchFlags) {\n const results = await this.run(queries, flags);\n const sections: string[] = [];\n\n if (results.ownersUsed?.length && !flags.localOnly && results.remoteAvailable !== false) {\n sections.push(formatHint(`remote search filtered by owners: ${results.ownersUsed.join(', ')}`));\n }\n\n if (!flags.remoteOnly && results.hasWorkspace) {\n const body = results.local.length ? results.local.join('\\n') : formatHint('no matches in workspace');\n sections.push(`${formatTitle(`Local (${results.local.length})`)}\\n${body}`);\n }\n\n if (!flags.localOnly) {\n if (results.remoteAvailable === false) {\n sections.push(formatHint('remote search unavailable (connection failed)'));\n } else {\n const body = results.remote.length ? results.remote.join('\\n') : formatHint('no matches on bit cloud');\n sections.push(`${formatTitle(`Remote (${results.remote.length})`)}\\n${body}`);\n }\n }\n\n const failed = results.perQuery.filter((r) => r.error);\n if (failed.length) {\n const items = failed.map((r) => ` - \"${r.query}\": ${r.error}`);\n sections.push(`${formatWarningSummary('Failed queries:')}\\n${items.join('\\n')}`);\n }\n\n return joinSections(sections);\n }\n\n async json([queries]: [string[]], flags: SearchFlags) {\n return this.run(queries, flags);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2F,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAA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Y,MAAM,CAACT,MAAM,GAAGH,OAAO,CAACY,MAAM,CAACL,IAAI,CAAC,IAAI,CAAC,GAAG,IAAAD,iBAAU,EAAC,yBAAyB,CAAC;QACtGL,QAAQ,CAACI,IAAI,CAAC,GAAG,IAAAM,kBAAW,EAAC,WAAWX,OAAO,CAACY,MAAM,CAACT,MAAM,GAAG,CAAC,KAAKM,IAAI,EAAE,CAAC;MAC/E;IACF;IAEA,MAAMI,MAAM,GAAGb,OAAO,CAACc,QAAQ,CAACxB,MAAM,CAAE3B,CAAC,IAAKA,CAAC,CAACoD,KAAK,CAAC;IACtD,IAAIF,MAAM,CAACV,MAAM,EAAE;MACjB,MAAMa,KAAK,GAAGH,MAAM,CAAC1B,GAAG,CAAExB,CAAC,IAAK,QAAQA,CAAC,CAACsD,KAAK,MAAMtD,CAAC,CAACoD,KAAK,EAAE,CAAC;MAC/Dd,QAAQ,CAACI,IAAI,CAAC,GAAG,IAAAa,2BAAoB,EAAC,iBAAiB,CAAC,KAAKF,KAAK,CAACT,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAClF;IAEA,OAAO,IAAAY,mBAAY,EAAClB,QAAQ,CAAC;EAC/B;EAEA,MAAMmB,IAAIA,CAAC,CAAC3B,OAAO,CAAa,EAAEC,KAAkB,EAAE;IACpD,OAAO,IAAI,CAACF,GAAG,CAACC,OAAO,EAAEC,KAAK,CAAC;EACjC;AACF;AAAC2B,OAAA,CAAAzC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/lister",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.951",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/lister",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "lister",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.951"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -19,11 +19,13 @@
|
|
|
19
19
|
"@teambit/bit-error": "0.0.404",
|
|
20
20
|
"@teambit/component-id": "1.2.4",
|
|
21
21
|
"@teambit/legacy.component-list": "0.0.161",
|
|
22
|
+
"@teambit/legacy.constants": "0.0.26",
|
|
22
23
|
"@teambit/legacy.consumer": "0.0.107",
|
|
23
24
|
"@teambit/logger": "0.0.1409",
|
|
25
|
+
"@teambit/scope.network": "0.0.107",
|
|
24
26
|
"@teambit/scope.remotes": "0.0.107",
|
|
25
27
|
"@teambit/toolbox.promise.map-pool": "0.0.14",
|
|
26
|
-
"@teambit/workspace": "1.0.
|
|
28
|
+
"@teambit/workspace": "1.0.951"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@types/cli-table": "^0.3.0",
|
|
File without changes
|