@teambit/importer 0.0.310 → 0.0.311
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/fetch-cmd.js +0 -22
- package/dist/fetch-cmd.js.map +1 -1
- package/dist/import-components.js +19 -191
- package/dist/import-components.js.map +1 -1
- package/dist/import.cmd.js +5 -59
- package/dist/import.cmd.js.map +1 -1
- package/dist/importer.aspect.js +0 -5
- package/dist/importer.aspect.js.map +1 -1
- package/dist/importer.composition.js +0 -6
- package/dist/importer.composition.js.map +1 -1
- package/dist/importer.main.runtime.js +1 -96
- package/dist/importer.main.runtime.js.map +1 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/package-tar/teambit-importer-0.0.311.tgz +0 -0
- package/package.json +5 -5
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-importer-0.0.310.tgz +0 -0
package/dist/fetch-cmd.js
CHANGED
|
@@ -1,46 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.FetchCmd = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _chalk() {
|
|
25
18
|
const data = _interopRequireDefault(require("chalk"));
|
|
26
|
-
|
|
27
19
|
_chalk = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _mergeVersion() {
|
|
35
25
|
const data = require("@teambit/legacy/dist/consumer/versions-ops/merge-version/merge-version");
|
|
36
|
-
|
|
37
26
|
_mergeVersion = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
class FetchCmd {
|
|
45
32
|
constructor(importer) {
|
|
46
33
|
this.importer = importer;
|
|
@@ -52,7 +39,6 @@ class FetchCmd {
|
|
|
52
39
|
(0, _defineProperty2().default)(this, "options", [['l', 'lanes', 'EXPERIMENTAL. fetch component objects from lanes. note, it does not save the remote lanes objects locally, only the refs'], ['c', 'components', 'fetch components'], ['j', 'json', 'return the output as JSON'], ['', 'from-original-scopes', 'fetch indirect dependencies from their original scope as opposed to from their dependents']]);
|
|
53
40
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
54
41
|
}
|
|
55
|
-
|
|
56
42
|
async report([ids = []], {
|
|
57
43
|
lanes = false,
|
|
58
44
|
components = false,
|
|
@@ -63,13 +49,11 @@ class FetchCmd {
|
|
|
63
49
|
importedIds,
|
|
64
50
|
importDetails
|
|
65
51
|
} = await this.importer.fetch(ids, lanes, components, fromOriginalScope);
|
|
66
|
-
|
|
67
52
|
if (json) {
|
|
68
53
|
return JSON.stringify({
|
|
69
54
|
importDetails
|
|
70
55
|
}, null, 4);
|
|
71
56
|
}
|
|
72
|
-
|
|
73
57
|
if (importedIds.length) {
|
|
74
58
|
const title = importedIds.length === 1 ? 'successfully fetched one component' : `successfully fetched ${importedIds.length} components`;
|
|
75
59
|
const componentDependencies = importedIds.map(id => {
|
|
@@ -80,20 +64,15 @@ class FetchCmd {
|
|
|
80
64
|
const componentDependenciesOutput = [_chalk().default.green(title)].concat(componentDependencies).join('\n');
|
|
81
65
|
return componentDependenciesOutput;
|
|
82
66
|
}
|
|
83
|
-
|
|
84
67
|
return _chalk().default.yellow('nothing to import');
|
|
85
68
|
}
|
|
86
|
-
|
|
87
69
|
}
|
|
88
|
-
|
|
89
70
|
exports.FetchCmd = FetchCmd;
|
|
90
|
-
|
|
91
71
|
function formatPlainComponentItemWithVersions(bitId, importDetails) {
|
|
92
72
|
const status = importDetails.status;
|
|
93
73
|
const id = bitId.toStringWithoutVersion();
|
|
94
74
|
const versions = importDetails.versions.length ? `new versions: ${importDetails.versions.join(', ')}` : '';
|
|
95
75
|
const usedVersion = status === 'added' ? `, currently used version ${bitId.version}` : '';
|
|
96
|
-
|
|
97
76
|
const getConflictMessage = () => {
|
|
98
77
|
if (!importDetails.filesStatus) return '';
|
|
99
78
|
const conflictedFiles = Object.keys(importDetails.filesStatus) // $FlowFixMe file is set
|
|
@@ -102,7 +81,6 @@ function formatPlainComponentItemWithVersions(bitId, importDetails) {
|
|
|
102
81
|
if (!conflictedFiles.length) return '';
|
|
103
82
|
return `(the following files were saved with conflicts ${conflictedFiles.map(file => _chalk().default.bold(file)).join(', ')}) `;
|
|
104
83
|
};
|
|
105
|
-
|
|
106
84
|
const deprecated = importDetails.deprecated ? _chalk().default.yellow('deprecated') : '';
|
|
107
85
|
const missingDeps = importDetails.missingDeps.length ? _chalk().default.red(`missing dependencies: ${importDetails.missingDeps.map(d => d.toString()).join(', ')}`) : '';
|
|
108
86
|
return `- ${_chalk().default.green(status)} ${_chalk().default.cyan(id)} ${versions}${usedVersion} ${getConflictMessage()}${deprecated} ${missingDeps}`;
|
package/dist/fetch-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FetchCmd","constructor","importer","report","ids","lanes","components","json","fromOriginalScope","importedIds","importDetails","fetch","JSON","stringify","length","title","componentDependencies","map","id","details","find","c","toStringWithoutVersion","Error","toString","formatPlainComponentItemWithVersions","componentDependenciesOutput","chalk","green","concat","join","yellow","bitId","status","versions","usedVersion","version","getConflictMessage","filesStatus","conflictedFiles","Object","keys","filter","file","FileStatus","manual","bold","deprecated","missingDeps","red","d","cyan"],"sources":["fetch-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { FileStatus } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/merge-version';\nimport { ImporterMain } from './importer.main.runtime';\nimport { ImportDetails, ImportStatus } from './import-components';\n\nexport class FetchCmd implements Command {\n name = 'fetch [ids...]';\n description = `fetch remote objects and store locally`;\n extendedDescription = `for lanes, use \"/\" as a separator between the remote and the lane name, e.g. teambit.ui/fix-button`;\n alias = '';\n private = true;\n options = [\n [\n 'l',\n 'lanes',\n 'EXPERIMENTAL. fetch component objects from lanes. note, it does not save the remote lanes objects locally, only the refs',\n ],\n ['c', 'components', 'fetch components'],\n ['j', 'json', 'return the output as JSON'],\n [\n '',\n 'from-original-scopes',\n 'fetch indirect dependencies from their original scope as opposed to from their dependents',\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(private importer: ImporterMain) {}\n\n async report(\n [ids = []]: [string[]],\n {\n lanes = false,\n components = false,\n json = false,\n fromOriginalScope = false,\n }: {\n lanes?: boolean;\n components?: boolean;\n json?: boolean;\n fromOriginalScope?: boolean;\n }\n ) {\n const { importedIds, importDetails } = await this.importer.fetch(ids, lanes, components, fromOriginalScope);\n if (json) {\n return JSON.stringify({ importDetails }, null, 4);\n }\n if (importedIds.length) {\n const title =\n importedIds.length === 1\n ? 'successfully fetched one component'\n : `successfully fetched ${importedIds.length} components`;\n const componentDependencies = importedIds.map((id) => {\n const details = importDetails.find((c) => c.id === id.toStringWithoutVersion());\n if (!details) throw new Error(`missing details of component ${id.toString()}`);\n return formatPlainComponentItemWithVersions(id, details);\n });\n const componentDependenciesOutput = [chalk.green(title)].concat(componentDependencies).join('\\n');\n\n return componentDependenciesOutput;\n }\n return chalk.yellow('nothing to import');\n }\n}\n\nfunction formatPlainComponentItemWithVersions(bitId: BitId, importDetails: ImportDetails) {\n const status: ImportStatus = importDetails.status;\n const id = bitId.toStringWithoutVersion();\n const versions = importDetails.versions.length ? `new versions: ${importDetails.versions.join(', ')}` : '';\n const usedVersion = status === 'added' ? `, currently used version ${bitId.version}` : '';\n const getConflictMessage = () => {\n if (!importDetails.filesStatus) return '';\n const conflictedFiles = Object.keys(importDetails.filesStatus) // $FlowFixMe file is set\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .filter((file) => importDetails.filesStatus[file] === FileStatus.manual);\n if (!conflictedFiles.length) return '';\n return `(the following files were saved with conflicts ${conflictedFiles\n .map((file) => chalk.bold(file))\n .join(', ')}) `;\n };\n const deprecated = importDetails.deprecated ? chalk.yellow('deprecated') : '';\n const missingDeps = importDetails.missingDeps.length\n ? chalk.red(`missing dependencies: ${importDetails.missingDeps.map((d) => d.toString()).join(', ')}`)\n : '';\n return `- ${chalk.green(status)} ${chalk.cyan(\n id\n )} ${versions}${usedVersion} ${getConflictMessage()}${deprecated} ${missingDeps}`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["FetchCmd","constructor","importer","report","ids","lanes","components","json","fromOriginalScope","importedIds","importDetails","fetch","JSON","stringify","length","title","componentDependencies","map","id","details","find","c","toStringWithoutVersion","Error","toString","formatPlainComponentItemWithVersions","componentDependenciesOutput","chalk","green","concat","join","yellow","bitId","status","versions","usedVersion","version","getConflictMessage","filesStatus","conflictedFiles","Object","keys","filter","file","FileStatus","manual","bold","deprecated","missingDeps","red","d","cyan"],"sources":["fetch-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { FileStatus } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/merge-version';\nimport { ImporterMain } from './importer.main.runtime';\nimport { ImportDetails, ImportStatus } from './import-components';\n\nexport class FetchCmd implements Command {\n name = 'fetch [ids...]';\n description = `fetch remote objects and store locally`;\n extendedDescription = `for lanes, use \"/\" as a separator between the remote and the lane name, e.g. teambit.ui/fix-button`;\n alias = '';\n private = true;\n options = [\n [\n 'l',\n 'lanes',\n 'EXPERIMENTAL. fetch component objects from lanes. note, it does not save the remote lanes objects locally, only the refs',\n ],\n ['c', 'components', 'fetch components'],\n ['j', 'json', 'return the output as JSON'],\n [\n '',\n 'from-original-scopes',\n 'fetch indirect dependencies from their original scope as opposed to from their dependents',\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(private importer: ImporterMain) {}\n\n async report(\n [ids = []]: [string[]],\n {\n lanes = false,\n components = false,\n json = false,\n fromOriginalScope = false,\n }: {\n lanes?: boolean;\n components?: boolean;\n json?: boolean;\n fromOriginalScope?: boolean;\n }\n ) {\n const { importedIds, importDetails } = await this.importer.fetch(ids, lanes, components, fromOriginalScope);\n if (json) {\n return JSON.stringify({ importDetails }, null, 4);\n }\n if (importedIds.length) {\n const title =\n importedIds.length === 1\n ? 'successfully fetched one component'\n : `successfully fetched ${importedIds.length} components`;\n const componentDependencies = importedIds.map((id) => {\n const details = importDetails.find((c) => c.id === id.toStringWithoutVersion());\n if (!details) throw new Error(`missing details of component ${id.toString()}`);\n return formatPlainComponentItemWithVersions(id, details);\n });\n const componentDependenciesOutput = [chalk.green(title)].concat(componentDependencies).join('\\n');\n\n return componentDependenciesOutput;\n }\n return chalk.yellow('nothing to import');\n }\n}\n\nfunction formatPlainComponentItemWithVersions(bitId: BitId, importDetails: ImportDetails) {\n const status: ImportStatus = importDetails.status;\n const id = bitId.toStringWithoutVersion();\n const versions = importDetails.versions.length ? `new versions: ${importDetails.versions.join(', ')}` : '';\n const usedVersion = status === 'added' ? `, currently used version ${bitId.version}` : '';\n const getConflictMessage = () => {\n if (!importDetails.filesStatus) return '';\n const conflictedFiles = Object.keys(importDetails.filesStatus) // $FlowFixMe file is set\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .filter((file) => importDetails.filesStatus[file] === FileStatus.manual);\n if (!conflictedFiles.length) return '';\n return `(the following files were saved with conflicts ${conflictedFiles\n .map((file) => chalk.bold(file))\n .join(', ')}) `;\n };\n const deprecated = importDetails.deprecated ? chalk.yellow('deprecated') : '';\n const missingDeps = importDetails.missingDeps.length\n ? chalk.red(`missing dependencies: ${importDetails.missingDeps.map((d) => d.toString()).join(', ')}`)\n : '';\n return `- ${chalk.green(status)} ${chalk.cyan(\n id\n )} ${versions}${usedVersion} ${getConflictMessage()}${deprecated} ${missingDeps}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,MAAMA,QAAQ,CAAoB;EAsBvCC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CArBnC,gBAAgB;IAAA,qDACR,wCAAuC;IAAA,6DAC/B,oGAAmG;IAAA,+CAClH,EAAE;IAAA,iDACA,IAAI;IAAA,iDACJ,CACR,CACE,GAAG,EACH,OAAO,EACP,0HAA0H,CAC3H,EACD,CAAC,GAAG,EAAE,YAAY,EAAE,kBAAkB,CAAC,EACvC,CAAC,GAAG,EAAE,MAAM,EAAE,2BAA2B,CAAC,EAC1C,CACE,EAAE,EACF,sBAAsB,EACtB,2FAA2F,CAC5F,CACF;IAAA,gDACQ,IAAI;EAEgC;EAE7C,MAAMC,MAAM,CACV,CAACC,GAAG,GAAG,EAAE,CAAa,EACtB;IACEC,KAAK,GAAG,KAAK;IACbC,UAAU,GAAG,KAAK;IAClBC,IAAI,GAAG,KAAK;IACZC,iBAAiB,GAAG;EAMtB,CAAC,EACD;IACA,MAAM;MAAEC,WAAW;MAAEC;IAAc,CAAC,GAAG,MAAM,IAAI,CAACR,QAAQ,CAACS,KAAK,CAACP,GAAG,EAAEC,KAAK,EAAEC,UAAU,EAAEE,iBAAiB,CAAC;IAC3G,IAAID,IAAI,EAAE;MACR,OAAOK,IAAI,C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