@teambit/eject 0.0.352 → 0.0.354

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,100 +1,70 @@
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.ComponentsEjector = 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 _bitId() {
25
18
  const data = require("@teambit/legacy/dist/bit-id");
26
-
27
19
  _bitId = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _defaultErrorHandler() {
35
25
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/default-error-handler"));
36
-
37
26
  _defaultErrorHandler = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _scopeRemotes() {
45
32
  const data = require("@teambit/legacy/dist/scope/scope-remotes");
46
-
47
33
  _scopeRemotes = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _componentIdToPackageName() {
55
39
  const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/bit/component-id-to-package-name"));
56
-
57
40
  _componentIdToPackageName = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function packageJsonUtils() {
65
46
  const data = _interopRequireWildcard(require("@teambit/legacy/dist/consumer/component/package-json-utils"));
66
-
67
47
  packageJsonUtils = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _dataToPersist() {
75
53
  const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/sources/data-to-persist"));
76
-
77
54
  _dataToPersist = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function _removePath() {
85
60
  const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/sources/remove-path"));
86
-
87
61
  _removePath = function () {
88
62
  return data;
89
63
  };
90
-
91
64
  return data;
92
65
  }
93
-
94
66
  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); }
95
-
96
67
  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; }
97
-
98
68
  /**
99
69
  * a classic use case of eject is when a user imports a component using `bit import` to update it,
100
70
  * but the user has no intention to have the code as part of the project source code.
@@ -104,8 +74,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
104
74
  * since installing the component via NPM client is an error prone process, we do it first, before
105
75
  * removing the component files, so then it's easier to rollback.
106
76
  */
77
+
107
78
  class ComponentsEjector {
108
79
  // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
80
+
109
81
  // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
110
82
  // for rollback in case of errors
111
83
  constructor(workspace, install, logger, componentsIds, ejectOptions) {
@@ -129,29 +101,24 @@ class ComponentsEjector {
129
101
  selfHostedExportedComponents: new (_bitId().BitIds)()
130
102
  };
131
103
  }
132
-
133
104
  async eject() {
134
105
  await this.decideWhichComponentsToEject();
135
106
  this.logger.debug(`${this.idsToEject.length} to eject`);
136
107
  await this.loadComponentsToEject();
137
-
138
108
  if (this.idsToEject.length) {
139
109
  this._validateIdsHaveScopesAndVersions();
140
-
141
110
  await this.removeComponentsFromNodeModules();
142
111
  await this.untrackComponents();
143
112
  await this.installPackages();
144
113
  await this.removeComponentsFiles();
145
114
  await this.consumer.writeBitMap();
146
115
  }
147
-
148
116
  this.logger.debug('eject: completed successfully');
149
117
  return {
150
118
  ejectedComponents: this.idsToEject,
151
119
  failedComponents: this.failedComponents
152
120
  };
153
121
  }
154
-
155
122
  async decideWhichComponentsToEject() {
156
123
  this.logger.setStatusLine('Eject: getting the components status');
157
124
  if (!this.componentsIds.length) return;
@@ -161,7 +128,6 @@ class ComponentsEjector {
161
128
  const bitId = componentId._legacy;
162
129
  if (!bitId.hasScope()) this.failedComponents.notExportedComponents.push(bitId);else if (remotes.isHub(bitId.scope)) hubExportedComponents.push(bitId);else this.failedComponents.selfHostedExportedComponents.push(bitId);
163
130
  });
164
-
165
131
  if (this.ejectOptions.force) {
166
132
  this.idsToEject = hubExportedComponents;
167
133
  } else {
@@ -175,17 +141,14 @@ class ComponentsEjector {
175
141
  }
176
142
  }));
177
143
  }
178
-
179
144
  this.logger.consoleSuccess();
180
145
  }
181
-
182
146
  async loadComponentsToEject() {
183
147
  const {
184
148
  components
185
149
  } = await this.consumer.loadComponents(this.idsToEject);
186
150
  this.componentsToEject = components;
187
151
  }
188
-
189
152
  async removeComponentsFromNodeModules() {
190
153
  const action = 'Eject: removing the existing components from node_modules';
191
154
  this.logger.setStatusLine(action);
@@ -193,61 +156,50 @@ class ComponentsEjector {
193
156
  await packageJsonUtils().removeComponentsFromNodeModules(this.consumer, this.componentsToEject);
194
157
  this.logger.consoleSuccess(action);
195
158
  }
196
-
197
159
  async installPackages() {
198
160
  this.logger.setStatusLine('Eject: installing packages using the package-manager');
199
161
  const packages = this.getPackagesToInstall();
200
162
  await this.install.install(packages);
201
163
  }
202
-
203
164
  getPackagesToInstall() {
204
165
  return this.componentsToEject.map(c => (0, _componentIdToPackageName().default)(c));
205
166
  }
206
-
207
167
  _buildExceptionMessageWithRollbackData(action) {
208
168
  return `eject failed ${action}.
209
169
  your package.json (if existed) has been restored, however, some bit generated data may have been deleted, please run "bit link" to restore them.`;
210
170
  }
171
+
211
172
  /**
212
173
  * as part of the 'eject' operation, a component is removed locally. as opposed to the remove
213
174
  * command, in this case, no need to remove the objects from the scope, only remove from the
214
175
  * filesystem, which means, delete the component files, untrack from .bitmap and clean
215
176
  * package.json and bit.json traces.
216
177
  */
217
-
218
-
219
178
  async removeComponentsFiles() {
220
179
  if (this.ejectOptions.keepFiles) {
221
180
  return;
222
181
  }
223
-
224
182
  this.logger.setStatusLine('Eject: removing the components files from the filesystem');
225
183
  const dataToPersist = new (_dataToPersist().default)();
226
184
  this.componentsToEject.forEach(component => {
227
185
  const componentMap = component.componentMap;
228
-
229
186
  if (!componentMap) {
230
187
  throw new Error('ComponentEjector.removeComponentsFiles expect a component to have componentMap prop');
231
188
  }
232
-
233
189
  const rootDir = componentMap.rootDir;
234
-
235
190
  if (!rootDir) {
236
191
  throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');
237
192
  }
238
-
239
193
  dataToPersist.removePath(new (_removePath().default)(rootDir, true));
240
194
  });
241
195
  dataToPersist.addBasePath(this.consumer.getPath());
242
196
  await dataToPersist.persistAllToFS();
243
197
  this.logger.consoleSuccess();
244
198
  }
245
-
246
199
  async untrackComponents() {
247
200
  this.logger.debug('eject: removing the components from the .bitmap');
248
201
  await this.consumer.cleanFromBitMap(this.idsToEject);
249
202
  }
250
-
251
203
  throwEjectError(message, originalError) {
252
204
  const {
253
205
  message: originalErrorMessage
@@ -257,7 +209,6 @@ your package.json (if existed) has been restored, however, some bit generated da
257
209
 
258
210
  got the following error: ${originalErrorMessage}`);
259
211
  }
260
-
261
212
  _validateIdsHaveScopesAndVersions() {
262
213
  this.idsToEject.forEach(id => {
263
214
  if (!id.hasScope() || !id.hasVersion()) {
@@ -265,9 +216,7 @@ got the following error: ${originalErrorMessage}`);
265
216
  }
266
217
  });
267
218
  }
268
-
269
219
  }
270
-
271
220
  exports.ComponentsEjector = ComponentsEjector;
272
221
 
273
222
  //# sourceMappingURL=components-ejector.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","BitIds","failedComponents","modifiedComponents","stagedComponents","notExportedComponents","selfHostedExportedComponents","eject","decideWhichComponentsToEject","debug","length","loadComponentsToEject","_validateIdsHaveScopesAndVersions","removeComponentsFromNodeModules","untrackComponents","installPackages","removeComponentsFiles","writeBitMap","ejectedComponents","setStatusLine","remotes","getScopeRemotes","scope","hubExportedComponents","forEach","componentId","bitId","_legacy","hasScope","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","packageJsonUtils","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","hasVersion","TypeError"],"sources":["components-ejector.ts"],"sourcesContent":["/**\n * a classic use case of eject is when a user imports a component using `bit import` to update it,\n * but the user has no intention to have the code as part of the project source code.\n * the eject provides the option to delete the component locally and install it via the NPM client.\n *\n * an implementation note, the entire process is done with rollback in mind.\n * since installing the component via NPM client is an error prone process, we do it first, before\n * removing the component files, so then it's easier to rollback.\n */\nimport { Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport defaultErrorHandler from '@teambit/legacy/dist/cli/default-error-handler';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component-id';\nimport { InstallMain } from '@teambit/install';\n\nexport type EjectResults = {\n ejectedComponents: BitIds;\n failedComponents: FailedComponents;\n};\n\nexport type EjectOptions = {\n force: boolean; // eject although a component is modified/staged\n keepFiles: boolean; // keep component files on the workspace\n};\n\ntype FailedComponents = {\n modifiedComponents: BitIds;\n stagedComponents: BitIds;\n notExportedComponents: BitIds;\n selfHostedExportedComponents: BitIds;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: BitIds;\n componentsToEject: Component[] = [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n notEjectedDependents: Array<{ dependent: Component; ejectedDependencies: Component[] }>;\n failedComponents: FailedComponents;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n packageJsonFilesBeforeChanges: PackageJsonFile[]; // for rollback in case of errors\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private logger: Logger,\n private componentsIds: ComponentID[],\n private ejectOptions: EjectOptions\n ) {\n this.consumer = this.workspace.consumer;\n this.idsToEject = new BitIds();\n this.failedComponents = {\n modifiedComponents: new BitIds(),\n stagedComponents: new BitIds(),\n notExportedComponents: new BitIds(),\n selfHostedExportedComponents: new BitIds(),\n };\n }\n\n async eject(): Promise<EjectResults> {\n await this.decideWhichComponentsToEject();\n this.logger.debug(`${this.idsToEject.length} to eject`);\n await this.loadComponentsToEject();\n if (this.idsToEject.length) {\n this._validateIdsHaveScopesAndVersions();\n await this.removeComponentsFromNodeModules();\n await this.untrackComponents();\n await this.installPackages();\n await this.removeComponentsFiles();\n await this.consumer.writeBitMap();\n }\n this.logger.debug('eject: completed successfully');\n return {\n ejectedComponents: this.idsToEject,\n failedComponents: this.failedComponents,\n };\n }\n\n async decideWhichComponentsToEject(): Promise<void> {\n this.logger.setStatusLine('Eject: getting the components status');\n if (!this.componentsIds.length) return;\n const remotes = await getScopeRemotes(this.consumer.scope);\n const hubExportedComponents = new BitIds();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId._legacy;\n if (!bitId.hasScope()) this.failedComponents.notExportedComponents.push(bitId);\n else if (remotes.isHub(bitId.scope as string)) hubExportedComponents.push(bitId);\n else this.failedComponents.selfHostedExportedComponents.push(bitId);\n });\n if (this.ejectOptions.force) {\n this.idsToEject = hubExportedComponents;\n } else {\n await Promise.all(\n hubExportedComponents.map(async (id) => {\n try {\n const componentStatus = await this.consumer.getComponentStatusById(id);\n if (componentStatus.modified) this.failedComponents.modifiedComponents.push(id);\n else if (componentStatus.staged) this.failedComponents.stagedComponents.push(id);\n else this.idsToEject.push(id);\n } catch (err: any) {\n this.throwEjectError(\n `eject operation failed getting the status of ${id.toString()}, no action has been done.\n please fix the issue to continue.`,\n err\n );\n }\n })\n );\n }\n this.logger.consoleSuccess();\n }\n\n async loadComponentsToEject() {\n const { components } = await this.consumer.loadComponents(this.idsToEject);\n this.componentsToEject = components;\n }\n\n async removeComponentsFromNodeModules() {\n const action = 'Eject: removing the existing components from node_modules';\n this.logger.setStatusLine(action);\n this.logger.debug(action);\n await packageJsonUtils.removeComponentsFromNodeModules(this.consumer, this.componentsToEject);\n this.logger.consoleSuccess(action);\n }\n\n async installPackages() {\n this.logger.setStatusLine('Eject: installing packages using the package-manager');\n const packages = this.getPackagesToInstall();\n await this.install.install(packages);\n }\n\n getPackagesToInstall(): string[] {\n return this.componentsToEject.map((c) => componentIdToPackageName(c));\n }\n\n _buildExceptionMessageWithRollbackData(action: string): string {\n return `eject failed ${action}.\nyour package.json (if existed) has been restored, however, some bit generated data may have been deleted, please run \"bit link\" to restore them.`;\n }\n\n /**\n * as part of the 'eject' operation, a component is removed locally. as opposed to the remove\n * command, in this case, no need to remove the objects from the scope, only remove from the\n * filesystem, which means, delete the component files, untrack from .bitmap and clean\n * package.json and bit.json traces.\n */\n private async removeComponentsFiles() {\n if (this.ejectOptions.keepFiles) {\n return;\n }\n this.logger.setStatusLine('Eject: removing the components files from the filesystem');\n const dataToPersist = new DataToPersist();\n this.componentsToEject.forEach((component) => {\n const componentMap = component.componentMap;\n if (!componentMap) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a component to have componentMap prop');\n }\n const rootDir = componentMap.rootDir;\n if (!rootDir) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');\n }\n dataToPersist.removePath(new RemovePath(rootDir, true));\n });\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n this.logger.consoleSuccess();\n }\n\n private async untrackComponents() {\n this.logger.debug('eject: removing the components from the .bitmap');\n await this.consumer.cleanFromBitMap(this.idsToEject);\n }\n\n throwEjectError(message: string, originalError: Error) {\n const { message: originalErrorMessage } = defaultErrorHandler(originalError);\n this.logger.error(`eject has stopped due to an error ${originalErrorMessage}`, originalError);\n throw new Error(`${message}\n\ngot the following error: ${originalErrorMessage}`);\n }\n\n _validateIdsHaveScopesAndVersions() {\n this.idsToEject.forEach((id) => {\n if (!id.hasScope() || !id.hasVersion()) {\n throw new TypeError(`EjectComponents expects ids with scope and version, got ${id.toString()}`);\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA;EAAA;;EAAA;IAAA;EAAA;;EAAA;A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AApB,CAA1C;IACA,KAAKxE,MAAL,CAAY2E,KAAZ,CAAmB,qCAAoCF,oBAAqB,EAA5E,EAA+ED,aAA/E;IACA,MAAM,IAAIT,KAAJ,CAAW,GAAEQ,OAAQ;AAC/B;AACA,2BAA2BE,oBAAqB,EAFtC,CAAN;EAGD;;EAEDzD,iCAAiC,GAAG;IAClC,KAAKZ,UAAL,CAAgBwB,OAAhB,CAAyBW,EAAD,IAAQ;MAC9B,IAAI,CAACA,EAAE,CAACP,QAAH,EAAD,IAAkB,CAACO,EAAE,CAACqC,UAAH,EAAvB,EAAwC;QACtC,MAAM,IAAIC,SAAJ,CAAe,2DAA0DtC,EAAE,CAACO,QAAH,EAAc,EAAvF,CAAN;MACD;IACF,CAJD;EAKD;;AA1J4B"}
1
+ {"version":3,"names":["ComponentsEjector","constructor","workspace","install","logger","componentsIds","ejectOptions","consumer","idsToEject","BitIds","failedComponents","modifiedComponents","stagedComponents","notExportedComponents","selfHostedExportedComponents","eject","decideWhichComponentsToEject","debug","length","loadComponentsToEject","_validateIdsHaveScopesAndVersions","removeComponentsFromNodeModules","untrackComponents","installPackages","removeComponentsFiles","writeBitMap","ejectedComponents","setStatusLine","remotes","getScopeRemotes","scope","hubExportedComponents","forEach","componentId","bitId","_legacy","hasScope","push","isHub","force","Promise","all","map","id","componentStatus","getComponentStatusById","modified","staged","err","throwEjectError","toString","consoleSuccess","components","loadComponents","componentsToEject","action","packageJsonUtils","packages","getPackagesToInstall","c","componentIdToPackageName","_buildExceptionMessageWithRollbackData","keepFiles","dataToPersist","DataToPersist","component","componentMap","Error","rootDir","removePath","RemovePath","addBasePath","getPath","persistAllToFS","cleanFromBitMap","message","originalError","originalErrorMessage","defaultErrorHandler","error","hasVersion","TypeError"],"sources":["components-ejector.ts"],"sourcesContent":["/**\n * a classic use case of eject is when a user imports a component using `bit import` to update it,\n * but the user has no intention to have the code as part of the project source code.\n * the eject provides the option to delete the component locally and install it via the NPM client.\n *\n * an implementation note, the entire process is done with rollback in mind.\n * since installing the component via NPM client is an error prone process, we do it first, before\n * removing the component files, so then it's easier to rollback.\n */\nimport { Workspace } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport defaultErrorHandler from '@teambit/legacy/dist/cli/default-error-handler';\nimport { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport * as packageJsonUtils from '@teambit/legacy/dist/consumer/component/package-json-utils';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component-id';\nimport { InstallMain } from '@teambit/install';\n\nexport type EjectResults = {\n ejectedComponents: BitIds;\n failedComponents: FailedComponents;\n};\n\nexport type EjectOptions = {\n force: boolean; // eject although a component is modified/staged\n keepFiles: boolean; // keep component files on the workspace\n};\n\ntype FailedComponents = {\n modifiedComponents: BitIds;\n stagedComponents: BitIds;\n notExportedComponents: BitIds;\n selfHostedExportedComponents: BitIds;\n};\n\nexport class ComponentsEjector {\n consumer: Consumer;\n idsToEject: BitIds;\n componentsToEject: Component[] = [];\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n notEjectedDependents: Array<{ dependent: Component; ejectedDependencies: Component[] }>;\n failedComponents: FailedComponents;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n packageJsonFilesBeforeChanges: PackageJsonFile[]; // for rollback in case of errors\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private logger: Logger,\n private componentsIds: ComponentID[],\n private ejectOptions: EjectOptions\n ) {\n this.consumer = this.workspace.consumer;\n this.idsToEject = new BitIds();\n this.failedComponents = {\n modifiedComponents: new BitIds(),\n stagedComponents: new BitIds(),\n notExportedComponents: new BitIds(),\n selfHostedExportedComponents: new BitIds(),\n };\n }\n\n async eject(): Promise<EjectResults> {\n await this.decideWhichComponentsToEject();\n this.logger.debug(`${this.idsToEject.length} to eject`);\n await this.loadComponentsToEject();\n if (this.idsToEject.length) {\n this._validateIdsHaveScopesAndVersions();\n await this.removeComponentsFromNodeModules();\n await this.untrackComponents();\n await this.installPackages();\n await this.removeComponentsFiles();\n await this.consumer.writeBitMap();\n }\n this.logger.debug('eject: completed successfully');\n return {\n ejectedComponents: this.idsToEject,\n failedComponents: this.failedComponents,\n };\n }\n\n async decideWhichComponentsToEject(): Promise<void> {\n this.logger.setStatusLine('Eject: getting the components status');\n if (!this.componentsIds.length) return;\n const remotes = await getScopeRemotes(this.consumer.scope);\n const hubExportedComponents = new BitIds();\n this.componentsIds.forEach((componentId) => {\n const bitId = componentId._legacy;\n if (!bitId.hasScope()) this.failedComponents.notExportedComponents.push(bitId);\n else if (remotes.isHub(bitId.scope as string)) hubExportedComponents.push(bitId);\n else this.failedComponents.selfHostedExportedComponents.push(bitId);\n });\n if (this.ejectOptions.force) {\n this.idsToEject = hubExportedComponents;\n } else {\n await Promise.all(\n hubExportedComponents.map(async (id) => {\n try {\n const componentStatus = await this.consumer.getComponentStatusById(id);\n if (componentStatus.modified) this.failedComponents.modifiedComponents.push(id);\n else if (componentStatus.staged) this.failedComponents.stagedComponents.push(id);\n else this.idsToEject.push(id);\n } catch (err: any) {\n this.throwEjectError(\n `eject operation failed getting the status of ${id.toString()}, no action has been done.\n please fix the issue to continue.`,\n err\n );\n }\n })\n );\n }\n this.logger.consoleSuccess();\n }\n\n async loadComponentsToEject() {\n const { components } = await this.consumer.loadComponents(this.idsToEject);\n this.componentsToEject = components;\n }\n\n async removeComponentsFromNodeModules() {\n const action = 'Eject: removing the existing components from node_modules';\n this.logger.setStatusLine(action);\n this.logger.debug(action);\n await packageJsonUtils.removeComponentsFromNodeModules(this.consumer, this.componentsToEject);\n this.logger.consoleSuccess(action);\n }\n\n async installPackages() {\n this.logger.setStatusLine('Eject: installing packages using the package-manager');\n const packages = this.getPackagesToInstall();\n await this.install.install(packages);\n }\n\n getPackagesToInstall(): string[] {\n return this.componentsToEject.map((c) => componentIdToPackageName(c));\n }\n\n _buildExceptionMessageWithRollbackData(action: string): string {\n return `eject failed ${action}.\nyour package.json (if existed) has been restored, however, some bit generated data may have been deleted, please run \"bit link\" to restore them.`;\n }\n\n /**\n * as part of the 'eject' operation, a component is removed locally. as opposed to the remove\n * command, in this case, no need to remove the objects from the scope, only remove from the\n * filesystem, which means, delete the component files, untrack from .bitmap and clean\n * package.json and bit.json traces.\n */\n private async removeComponentsFiles() {\n if (this.ejectOptions.keepFiles) {\n return;\n }\n this.logger.setStatusLine('Eject: removing the components files from the filesystem');\n const dataToPersist = new DataToPersist();\n this.componentsToEject.forEach((component) => {\n const componentMap = component.componentMap;\n if (!componentMap) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a component to have componentMap prop');\n }\n const rootDir = componentMap.rootDir;\n if (!rootDir) {\n throw new Error('ComponentEjector.removeComponentsFiles expect a componentMap to have rootDir');\n }\n dataToPersist.removePath(new RemovePath(rootDir, true));\n });\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n this.logger.consoleSuccess();\n }\n\n private async untrackComponents() {\n this.logger.debug('eject: removing the components from the .bitmap');\n await this.consumer.cleanFromBitMap(this.idsToEject);\n }\n\n throwEjectError(message: string, originalError: Error) {\n const { message: originalErrorMessage } = defaultErrorHandler(originalError);\n this.logger.error(`eject has stopped due to an error ${originalErrorMessage}`, originalError);\n throw new Error(`${message}\n\ngot the following error: ${originalErrorMessage}`);\n }\n\n _validateIdsHaveScopesAndVersions() {\n this.idsToEject.forEach((id) => {\n if (!id.hasScope() || !id.hasVersion()) {\n throw new TypeError(`EjectComponents expects ids with scope and version, got ${id.toString()}`);\n }\n });\n }\n}\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MT,aAAa,CAACU,cAAc,EAAE;IACpC,IAAI,CAACrE,MAAM,CAAC+C,cAAc,EAAE;EAC9B;EAEA,MAAc7B,iBAAiB,GAAG;IAChC,IAAI,CAAClB,MAAM,CAACa,KAAK,CAAC,iDAAiD,CAAC;IACpE,MAAM,IAAI,CAACV,QAAQ,CAACmE,eAAe,CAAC,IAAI,CAAClE,UAAU,CAAC;EACtD;EAEAyC,eAAe,CAAC0B,OAAe,EAAEC,aAAoB,EAAE;IACrD,MAAM;MAAED,OAAO,EAAEE;IAAqB,CAAC,GAAG,IAAAC,8BAAmB,EAACF,aAAa,CAAC;IAC5E,IAAI,CAACxE,MAAM,CAAC2E,KAAK,CAAE,qCAAoCF,oBAAqB,EAAC,EAAED,aAAa,CAAC;IAC7F,MAAM,IAAIT,KAAK,CAAE,GAAEQ,OAAQ;AAC/B;AACA,2BAA2BE,oBAAqB,EAAC,CAAC;EAChD;EAEAzD,iCAAiC,GAAG;IAClC,IAAI,CAACZ,UAAU,CAACwB,OAAO,CAAEW,EAAE,IAAK;MAC9B,IAAI,CAACA,EAAE,CAACP,QAAQ,EAAE,IAAI,CAACO,EAAE,CAACqC,UAAU,EAAE,EAAE;QACtC,MAAM,IAAIC,SAAS,CAAE,2DAA0DtC,EAAE,CAACO,QAAQ,EAAG,EAAC,CAAC;MACjG;IACF,CAAC,CAAC;EACJ;AACF;AAAC"}
package/dist/eject-cmd.js CHANGED
@@ -1,56 +1,40 @@
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.EjectCmd = 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 _ejectTemplate() {
25
18
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/templates/eject-template"));
26
-
27
19
  _ejectTemplate = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _exceptions() {
35
25
  const data = require("@teambit/legacy/dist/consumer/exceptions");
36
-
37
26
  _exceptions = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _componentsEjector() {
45
32
  const data = require("./components-ejector");
46
-
47
33
  _componentsEjector = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  class EjectCmd {
55
39
  constructor(workspace, logger, install) {
56
40
  this.workspace = workspace;
@@ -68,7 +52,6 @@ class EjectCmd {
68
52
  (0, _defineProperty2().default)(this, "migration", true);
69
53
  (0, _defineProperty2().default)(this, "group", 'development');
70
54
  }
71
-
72
55
  async report([pattern], {
73
56
  force = false,
74
57
  json = false,
@@ -84,9 +67,7 @@ class EjectCmd {
84
67
  if (json) return JSON.stringify(ejectResults, null, 2);
85
68
  return (0, _ejectTemplate().default)(ejectResults);
86
69
  }
87
-
88
70
  }
89
-
90
71
  exports.EjectCmd = EjectCmd;
91
72
 
92
73
  //# sourceMappingURL=eject-cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["EjectCmd","constructor","workspace","logger","install","name","description","report","pattern","force","json","keepFiles","ConsumerNotFound","componentIds","idsByPattern","componentEjector","ComponentsEjector","ejectResults","eject","JSON","stringify","ejectTemplate"],"sources":["eject-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport ejectTemplate from '@teambit/legacy/dist/cli/templates/eject-template';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { Logger } from '@teambit/logger';\nimport { InstallMain } from '@teambit/install';\nimport { ComponentsEjector } from './components-ejector';\n\nexport class EjectCmd implements Command {\n name = 'eject <component-pattern>';\n description = 'replace components maintained in the workspace with their corresponding packages';\n arguments = [\n {\n name: 'component-pattern',\n description:\n 'component name, component id, or component pattern.\\nuse component pattern to select multiple components. use comma to separate patterns and \"!\" to exclude. e.g. \"ui/**, !ui/button\"\\nwrap the pattern with quotes',\n },\n ];\n alias = 'E';\n options = [\n ['f', 'force', 'ignore local version. remove the components even when they are staged or modified'],\n ['j', 'json', 'print the results in JSON format'],\n ['', 'keep-files', 'keep the component files in the workspace intact'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n group = 'development';\n\n constructor(private workspace: Workspace, private logger: Logger, private install: InstallMain) {}\n\n async report(\n [pattern]: [string],\n { force = false, json = false, keepFiles = false }: { force: boolean; json: boolean; keepFiles: boolean }\n ): Promise<string> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(pattern);\n const componentEjector = new ComponentsEjector(this.workspace, this.install, this.logger, componentIds, {\n force,\n keepFiles,\n });\n const ejectResults = await componentEjector.eject();\n if (json) return JSON.stringify(ejectResults, null, 2);\n return ejectTemplate(ejectResults);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,QAAN,CAAkC;EAoBvCC,WAAW,CAASC,SAAT,EAAuCC,MAAvC,EAA+DC,OAA/D,EAAqF;IAAA,KAA5EF,SAA4E,GAA5EA,SAA4E;IAAA,KAA9CC,MAA8C,GAA9CA,MAA8C;IAAA,KAAtBC,OAAsB,GAAtBA,OAAsB;IAAA,8CAnBzF,2BAmByF;IAAA,qDAlBlF,kFAkBkF;IAAA,mDAjBpF,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EACT;IAHJ,CADU,CAiBoF;IAAA,+CAVxF,GAUwF;IAAA,iDATtF,CACR,CAAC,GAAD,EAAM,OAAN,EAAe,mFAAf,CADQ,EAER,CAAC,GAAD,EAAM,MAAN,EAAc,kCAAd,CAFQ,EAGR,CAAC,EAAD,EAAK,YAAL,EAAmB,kDAAnB,CAHQ,CASsF;IAAA,gDAJvF,IAIuF;IAAA,mDAHpF,IAGoF;IAAA,+CAFxF,aAEwF;EAAE;;EAEtF,MAANC,MAAM,CACV,CAACC,OAAD,CADU,EAEV;IAAEC,KAAK,GAAG,KAAV;IAAiBC,IAAI,GAAG,KAAxB;IAA+BC,SAAS,GAAG;EAA3C,CAFU,EAGO;IACjB,IAAI,CAAC,KAAKT,SAAV,EAAqB,MAAM,KAAIU,8BAAJ,GAAN;IACrB,MAAMC,YAAY,GAAG,MAAM,KAAKX,SAAL,CAAeY,YAAf,CAA4BN,OAA5B,CAA3B;IACA,MAAMO,gBAAgB,GAAG,KAAIC,sCAAJ,EAAsB,KAAKd,SAA3B,EAAsC,KAAKE,OAA3C,EAAoD,KAAKD,MAAzD,EAAiEU,YAAjE,EAA+E;MACtGJ,KADsG;MAEtGE;IAFsG,CAA/E,CAAzB;IAIA,MAAMM,YAAY,GAAG,MAAMF,gBAAgB,CAACG,KAAjB,EAA3B;IACA,IAAIR,IAAJ,EAAU,OAAOS,IAAI,CAACC,SAAL,CAAeH,YAAf,EAA6B,IAA7B,EAAmC,CAAnC,CAAP;IACV,OAAO,IAAAI,wBAAA,EAAcJ,YAAd,CAAP;EACD;;AAnCsC"}
1
+ {"version":3,"names":["EjectCmd","constructor","workspace","logger","install","name","description","report","pattern","force","json","keepFiles","ConsumerNotFound","componentIds","idsByPattern","componentEjector","ComponentsEjector","ejectResults","eject","JSON","stringify","ejectTemplate"],"sources":["eject-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Workspace } from '@teambit/workspace';\nimport ejectTemplate from '@teambit/legacy/dist/cli/templates/eject-template';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { Logger } from '@teambit/logger';\nimport { InstallMain } from '@teambit/install';\nimport { ComponentsEjector } from './components-ejector';\n\nexport class EjectCmd implements Command {\n name = 'eject <component-pattern>';\n description = 'replace components maintained in the workspace with their corresponding packages';\n arguments = [\n {\n name: 'component-pattern',\n description:\n 'component name, component id, or component pattern.\\nuse component pattern to select multiple components. use comma to separate patterns and \"!\" to exclude. e.g. \"ui/**, !ui/button\"\\nwrap the pattern with quotes',\n },\n ];\n alias = 'E';\n options = [\n ['f', 'force', 'ignore local version. remove the components even when they are staged or modified'],\n ['j', 'json', 'print the results in JSON format'],\n ['', 'keep-files', 'keep the component files in the workspace intact'],\n ] as CommandOptions;\n loader = true;\n migration = true;\n group = 'development';\n\n constructor(private workspace: Workspace, private logger: Logger, private install: InstallMain) {}\n\n async report(\n [pattern]: [string],\n { force = false, json = false, keepFiles = false }: { force: boolean; json: boolean; keepFiles: boolean }\n ): Promise<string> {\n if (!this.workspace) throw new ConsumerNotFound();\n const componentIds = await this.workspace.idsByPattern(pattern);\n const componentEjector = new ComponentsEjector(this.workspace, this.install, this.logger, componentIds, {\n force,\n keepFiles,\n });\n const ejectResults = await componentEjector.eject();\n if (json) return JSON.stringify(ejectResults, null, 2);\n return ejectTemplate(ejectResults);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,QAAQ,CAAoB;EAoBvCC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAUC,OAAoB,EAAE;IAAA,KAA5EF,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;IAAA,KAAUC,OAAoB,GAApBA,OAAoB;IAAA,8CAnBvF,2BAA2B;IAAA,qDACpB,kFAAkF;IAAA,mDACpF,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EACT;IACJ,CAAC,CACF;IAAA,+CACO,GAAG;IAAA,iDACD,CACR,CAAC,GAAG,EAAE,OAAO,EAAE,mFAAmF,CAAC,EACnG,CAAC,GAAG,EAAE,MAAM,EAAE,kCAAkC,CAAC,EACjD,CAAC,EAAE,EAAE,YAAY,EAAE,kDAAkD,CAAC,CACvE;IAAA,gDACQ,IAAI;IAAA,mDACD,IAAI;IAAA,+CACR,aAAa;EAE4E;EAEjG,MAAMC,MAAM,CACV,CAACC,OAAO,CAAW,EACnB;IAAEC,KAAK,GAAG,KAAK;IAAEC,IAAI,GAAG,KAAK;IAAEC,SAAS,GAAG;EAA6D,CAAC,EACxF;IACjB,IAAI,CAAC,IAAI,CAACT,SAAS,EAAE,MAAM,KAAIU,8BAAgB,GAAE;IACjD,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACX,SAAS,CAACY,YAAY,CAACN,OAAO,CAAC;IAC/D,MAAMO,gBAAgB,GAAG,KAAIC,sCAAiB,EAAC,IAAI,CAACd,SAAS,EAAE,IAAI,CAACE,OAAO,EAAE,IAAI,CAACD,MAAM,EAAEU,YAAY,EAAE;MACtGJ,KAAK;MACLE;IACF,CAAC,CAAC;IACF,MAAMM,YAAY,GAAG,MAAMF,gBAAgB,CAACG,KAAK,EAAE;IACnD,IAAIR,IAAI,EAAE,OAAOS,IAAI,CAACC,SAAS,CAACH,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,IAAAI,wBAAa,EAACJ,YAAY,CAAC;EACpC;AACF;AAAC"}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.EjectAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const EjectAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.workspace/eject'
20
16
  });
21
-
22
17
  exports.EjectAspect = EjectAspect;
23
18
 
24
19
  //# sourceMappingURL=eject.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["EjectAspect","Aspect","create","id"],"sources":["eject.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const EjectAspect = Aspect.create({\n id: 'teambit.workspace/eject',\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,WAAW,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACvCC,EAAE,EAAE;AADmC,CAAd,CAApB"}
1
+ {"version":3,"names":["EjectAspect","Aspect","create","id"],"sources":["eject.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const EjectAspect = Aspect.create({\n id: 'teambit.workspace/eject',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,WAAW,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACvCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/eject.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=eject.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["eject.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/eject.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["eject.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/eject.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAmD,EAAG,CAExF;AAAC"}
@@ -1,99 +1,71 @@
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.EjectMain = 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 _cli() {
25
18
  const data = require("@teambit/cli");
26
-
27
19
  _cli = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _logger() {
35
25
  const data = require("@teambit/logger");
36
-
37
26
  _logger = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _workspace() {
45
32
  const data = _interopRequireDefault(require("@teambit/workspace"));
46
-
47
33
  _workspace = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _install() {
55
39
  const data = require("@teambit/install");
56
-
57
40
  _install = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _ejectCmd() {
65
46
  const data = require("./eject-cmd");
66
-
67
47
  _ejectCmd = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _eject() {
75
53
  const data = require("./eject.aspect");
76
-
77
54
  _eject = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  class EjectMain {
85
60
  static async provider([cli, workspace, loggerMain, install]) {
86
61
  const logger = loggerMain.createLogger(_eject().EjectAspect.id);
87
62
  cli.register(new (_ejectCmd().EjectCmd)(workspace, logger, install));
88
63
  return new EjectMain();
89
64
  }
90
-
91
65
  }
92
-
93
66
  exports.EjectMain = EjectMain;
94
67
  (0, _defineProperty2().default)(EjectMain, "runtime", _cli().MainRuntime);
95
68
  (0, _defineProperty2().default)(EjectMain, "dependencies", [_cli().CLIAspect, _workspace().default, _logger().LoggerAspect, _install().InstallAspect]);
96
-
97
69
  _eject().EjectAspect.addRuntime(EjectMain);
98
70
 
99
71
  //# sourceMappingURL=eject.main.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["EjectMain","provider","cli","workspace","loggerMain","install","logger","createLogger","EjectAspect","id","register","EjectCmd","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","InstallAspect","addRuntime"],"sources":["eject.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { EjectCmd } from './eject-cmd';\nimport { EjectAspect } from './eject.aspect';\n\nexport class EjectMain {\n static runtime = MainRuntime;\n\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, InstallAspect];\n\n static async provider([cli, workspace, loggerMain, install]: [CLIMain, Workspace, LoggerMain, InstallMain]) {\n const logger = loggerMain.createLogger(EjectAspect.id);\n cli.register(new EjectCmd(workspace, logger, install));\n\n return new EjectMain();\n }\n}\n\nEjectAspect.addRuntime(EjectMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,SAAN,CAAgB;EAKA,aAARC,QAAQ,CAAC,CAACC,GAAD,EAAMC,SAAN,EAAiBC,UAAjB,EAA6BC,OAA7B,CAAD,EAAuF;IAC1G,MAAMC,MAAM,GAAGF,UAAU,CAACG,YAAX,CAAwBC,oBAAA,CAAYC,EAApC,CAAf;IACAP,GAAG,CAACQ,QAAJ,CAAa,KAAIC,oBAAJ,EAAaR,SAAb,EAAwBG,MAAxB,EAAgCD,OAAhC,CAAb;IAEA,OAAO,IAAIL,SAAJ,EAAP;EACD;;AAVoB;;;gCAAVA,S,aACMY,kB;gCADNZ,S,kBAGW,CAACa,gBAAD,EAAYC,oBAAZ,EAA6BC,sBAA7B,EAA2CC,wBAA3C,C;;AAUxBR,oBAAA,CAAYS,UAAZ,CAAuBjB,SAAvB"}
1
+ {"version":3,"names":["EjectMain","provider","cli","workspace","loggerMain","install","logger","createLogger","EjectAspect","id","register","EjectCmd","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","InstallAspect","addRuntime"],"sources":["eject.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { EjectCmd } from './eject-cmd';\nimport { EjectAspect } from './eject.aspect';\n\nexport class EjectMain {\n static runtime = MainRuntime;\n\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, InstallAspect];\n\n static async provider([cli, workspace, loggerMain, install]: [CLIMain, Workspace, LoggerMain, InstallMain]) {\n const logger = loggerMain.createLogger(EjectAspect.id);\n cli.register(new EjectCmd(workspace, logger, install));\n\n return new EjectMain();\n }\n}\n\nEjectAspect.addRuntime(EjectMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,CAAC;EAKrB,aAAaC,QAAQ,CAAC,CAACC,GAAG,EAAEC,SAAS,EAAEC,UAAU,EAAEC,OAAO,CAAgD,EAAE;IAC1G,MAAMC,MAAM,GAAGF,UAAU,CAACG,YAAY,CAACC,oBAAW,CAACC,EAAE,CAAC;IACtDP,GAAG,CAACQ,QAAQ,CAAC,KAAIC,oBAAQ,EAACR,SAAS,EAAEG,MAAM,EAAED,OAAO,CAAC,CAAC;IAEtD,OAAO,IAAIL,SAAS,EAAE;EACxB;AACF;AAAC;AAAA,gCAXYA,SAAS,aACHY,kBAAW;AAAA,gCADjBZ,SAAS,kBAGE,CAACa,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wBAAa,CAAC;AAUjFR,oBAAW,CAACS,UAAU,CAACjB,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "EjectAspect", {
9
9
  return _eject().EjectAspect;
10
10
  }
11
11
  });
12
-
13
12
  function _eject() {
14
13
  const data = require("./eject.aspect");
15
-
16
14
  _eject = function () {
17
15
  return data;
18
16
  };
19
-
20
17
  return data;
21
18
  }
22
19
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { EjectMain } from './eject.main.runtime';\nexport { EjectAspect } from './eject.aspect';\n"],"mappings":";;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { EjectMain } from './eject.main.runtime';\nexport { EjectAspect } from './eject.aspect';\n"],"mappings":";;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@teambit/eject",
3
- "version": "0.0.352",
3
+ "version": "0.0.354",
4
4
  "homepage": "https://bit.dev/teambit/workspace/eject",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "eject",
9
- "version": "0.0.352"
9
+ "version": "0.0.354"
10
10
  },
11
11
  "dependencies": {
12
12
  "@babel/runtime": "7.12.18",
13
13
  "core-js": "^3.0.0",
14
14
  "@teambit/harmony": "0.3.3",
15
15
  "@teambit/component-id": "0.0.418",
16
- "@teambit/install": "0.0.28",
16
+ "@teambit/install": "0.0.29",
17
17
  "@teambit/logger": "0.0.684",
18
- "@teambit/workspace": "0.0.881",
18
+ "@teambit/workspace": "0.0.883",
19
19
  "@teambit/cli": "0.0.591"
20
20
  },
21
21
  "devDependencies": {
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@0.0.352/dist/eject.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@0.0.352/dist/eject.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@0.0.354/dist/eject.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_eject@0.0.354/dist/eject.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];