@teambit/workspace 1.0.1040 → 1.0.1041

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,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1040/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1040/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1041/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1041/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -296,7 +296,17 @@ export declare class Workspace implements ComponentFactory {
296
296
  listPotentialTagIds(): Promise<ComponentID[]>;
297
297
  getNewAndModifiedIds(): Promise<ComponentID[]>;
298
298
  newAndModified(): Promise<Component[]>;
299
- getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;
299
+ getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string, throwIfMissing?: boolean): Promise<ComponentLog[]>;
300
+ /**
301
+ * reflect the not-yet-snapped (staged) deprecation in the component logs.
302
+ * `bit deprecate` only writes the deprecation config to the workspace `.bitmap`; it's baked into a
303
+ * Version object on the next tag/snap. The `deprecated` field is otherwise computed from the committed
304
+ * head Version, so without this overlay a staged range-deprecation wouldn't be reflected in the logs
305
+ * (CLI `bit log` or the workspace UI version-history) until the next tag/snap. We mirror the model's
306
+ * range logic here so the staged state (including a staged `bit undeprecate` that clears the range)
307
+ * matches the post-snap output.
308
+ */
309
+ private applyStagedDeprecation;
300
310
  getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;
301
311
  getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;
302
312
  getUnavailableOnMainComponents(): Promise<ComponentID[]>;
package/dist/workspace.js CHANGED
@@ -11,6 +11,13 @@ function _commentJson() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _semver() {
15
+ const data = _interopRequireDefault(require("semver"));
16
+ _semver = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _pMapSeries() {
15
22
  const data = _interopRequireDefault(require("p-map-series"));
16
23
  _pMapSeries = function () {
@@ -749,8 +756,31 @@ class Workspace {
749
756
  const ids = await this.getNewAndModifiedIds();
750
757
  return this.getMany(ids);
751
758
  }
752
- async getLogs(id, shortHash = false, startsFrom) {
753
- return this.scope.getLogs(id, shortHash, startsFrom);
759
+ async getLogs(id, shortHash = false, startsFrom, throwIfMissing = false) {
760
+ const logs = await this.scope.getLogs(id, shortHash, startsFrom, throwIfMissing);
761
+ this.applyStagedDeprecation(id, logs);
762
+ return logs;
763
+ }
764
+
765
+ /**
766
+ * reflect the not-yet-snapped (staged) deprecation in the component logs.
767
+ * `bit deprecate` only writes the deprecation config to the workspace `.bitmap`; it's baked into a
768
+ * Version object on the next tag/snap. The `deprecated` field is otherwise computed from the committed
769
+ * head Version, so without this overlay a staged range-deprecation wouldn't be reflected in the logs
770
+ * (CLI `bit log` or the workspace UI version-history) until the next tag/snap. We mirror the model's
771
+ * range logic here so the staged state (including a staged `bit undeprecate` that clears the range)
772
+ * matches the post-snap output.
773
+ */
774
+ applyStagedDeprecation(id, logs) {
775
+ const bitmapEntry = this.bitMap.getBitmapEntryIfExist(id, {
776
+ ignoreVersion: true
777
+ });
778
+ const stagedConfig = bitmapEntry?.config?.[_legacy5().Extensions.deprecation];
779
+ if (!stagedConfig || stagedConfig === '-') return;
780
+ const range = stagedConfig.range;
781
+ logs.forEach(log => {
782
+ log.deprecated = Boolean(range && log.tag && _semver().default.satisfies(log.tag, range));
783
+ });
754
784
  }
755
785
  async getGraph(ids, shouldThrowOnMissingDep = true) {
756
786
  if (!ids || ids.length < 1) ids = this.listIds();