@teambit/isolator 0.0.717 → 0.0.718

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/network.d.ts CHANGED
@@ -42,6 +42,11 @@ export declare class Network {
42
42
  * otherwise, this is the same as `this.seedersCapsules()`.
43
43
  */
44
44
  get originalSeedersCapsules(): CapsuleList;
45
+ /**
46
+ * some of the capsules (non-modified) are written already with the dists files, so no need to re-compile them.
47
+ * this method helps optimizing compilers that are running on the capsules.
48
+ */
49
+ getCapsulesToCompile(): Promise<CapsuleList>;
45
50
  /**
46
51
  * originalSeeders are not always set (currently, only during build process), so if they're missing, just provide the
47
52
  * seeders, which are probably the original-seeders
package/dist/network.js CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ require("core-js/modules/es.array.iterator.js");
6
+
7
+ require("core-js/modules/es.promise.js");
8
+
5
9
  Object.defineProperty(exports, "__esModule", {
6
10
  value: true
7
11
  });
@@ -17,6 +21,16 @@ function _defineProperty2() {
17
21
  return data;
18
22
  }
19
23
 
24
+ function _lodash() {
25
+ const data = require("lodash");
26
+
27
+ _lodash = function () {
28
+ return data;
29
+ };
30
+
31
+ return data;
32
+ }
33
+
20
34
  function _capsuleList() {
21
35
  const data = _interopRequireDefault(require("./capsule-list"));
22
36
 
@@ -87,6 +101,24 @@ class Network {
87
101
  });
88
102
  return _capsuleList().default.fromArray(capsules);
89
103
  }
104
+ /**
105
+ * some of the capsules (non-modified) are written already with the dists files, so no need to re-compile them.
106
+ * this method helps optimizing compilers that are running on the capsules.
107
+ */
108
+
109
+
110
+ async getCapsulesToCompile() {
111
+ const originalSeedersCapsules = this.originalSeedersCapsules;
112
+ const capsules = await Promise.all(this.seedersCapsules.map(async seederCapsule => {
113
+ if (originalSeedersCapsules.getCapsule(seederCapsule.component.id)) {
114
+ return seederCapsule;
115
+ }
116
+
117
+ const isModified = await seederCapsule.component.isModified();
118
+ return isModified ? seederCapsule : null;
119
+ }));
120
+ return _capsuleList().default.fromArray((0, _lodash().compact)(capsules));
121
+ }
90
122
  /**
91
123
  * originalSeeders are not always set (currently, only during build process), so if they're missing, just provide the
92
124
  * seeders, which are probably the original-seeders
@@ -1 +1 @@
1
- {"version":3,"sources":["network.ts"],"names":["Network","constructor","_graphCapsules","seedersIds","_capsulesRootDir","seedersCapsules","capsules","map","seederId","capsule","graphCapsules","getCapsule","Error","toString","CapsuleList","fromArray","originalSeedersCapsules","getOriginalSeeders","_originalSeeders","capsulesRootDir"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAN,CAAc;AAEnBC,EAAAA,WAAW,CACDC,cADC,EAEDC,UAFC,EAGDC,gBAHC,EAIT;AAAA,SAHQF,cAGR,GAHQA,cAGR;AAAA,SAFQC,UAER,GAFQA,UAER;AAAA,SADQC,gBACR,GADQA,gBACR;AAAA;AAAE;AAEJ;AACF;AACA;AACA;;;AACqB,MAAfC,eAAe,GAAgB;AACjC,UAAMC,QAAQ,GAAG,KAAKH,UAAL,CAAgBI,GAAhB,CAAqBC,QAAD,IAAc;AACjD,YAAMC,OAAO,GAAG,KAAKC,aAAL,CAAmBC,UAAnB,CAA8BH,QAA9B,CAAhB;AACA,UAAI,CAACC,OAAL,EAAc,MAAM,IAAIG,KAAJ,CAAW,kBAAiBJ,QAAQ,CAACK,QAAT,EAAoB,sBAAhD,CAAN;AACd,aAAOJ,OAAP;AACD,KAJgB,CAAjB;AAKA,WAAOK,uBAAYC,SAAZ,CAAsBT,QAAtB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AAC6B,MAAvBU,uBAAuB,GAAgB;AACzC,UAAMV,QAAQ,GAAG,KAAKW,kBAAL,GAA0BV,GAA1B,CAA+BC,QAAD,IAAc;AAC3D,YAAMC,OAAO,GAAG,KAAKC,aAAL,CAAmBC,UAAnB,CAA8BH,QAA9B,CAAhB;AACA,UAAI,CAACC,OAAL,EAAc,MAAM,IAAIG,KAAJ,CAAW,kBAAiBJ,QAAQ,CAACK,QAAT,EAAoB,sBAAhD,CAAN;AACd,aAAOJ,OAAP;AACD,KAJgB,CAAjB;AAKA,WAAOK,uBAAYC,SAAZ,CAAsBT,QAAtB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACUW,EAAAA,kBAAkB,GAAkB;AAC1C,WAAO,KAAKC,gBAAL,IAAyB,KAAKf,UAArC;AACD;AAED;AACF;AACA;;;AACmB,MAAbO,aAAa,GAAgB;AAC/B,WAAO,KAAKR,cAAZ;AACD;;AAEkB,MAAfiB,eAAe,GAAwB;AACzC,WAAO,KAAKf,gBAAZ;AACD;;AAnDkB","sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport CapsuleList from './capsule-list';\n\n/**\n * collection of isolated components (capsules).\n * normally, \"seeders\" are the components that this network was created for.\n * \"graphCapsules\" is the graph created from the seeders and it includes also the dependencies.\n *\n * however, during \"bit build\"/\"bit tag\"/\"bit snap\", things are more complex because there is one more variable in the\n * picture, which is the \"env\". the Network is created per env.\n * in practice, for \"build-task\", a task is called per env, and the network passed to the task is relevant to that env.\n * the \"originalSeeders\" are the ones the network was created for, but only for this env.\n * the \"seeders\" are similar to the \"graphCapsules\" above, which contains also the dependencies, but only for this env.\n * the \"graphCapsules\" is the entire graph, including capsules from other envs.\n *\n * for example:\n * comp1 depends on comp2. comp1 env is \"react\". comp2 env is \"aspect\".\n *\n * when the user is running \"bit build comp1\", two `Network` instances will be created with the following:\n * Network for \"react\" env: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].\n * Network for \"aspect\" env: originalSeeders: [], seeders: ['comp2'], graphCapsules: ['comp2'].\n *\n * on the other hand, when the user is running \"bit capsule create comp1\", only one `Network` instance is created:\n * Network: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].\n *\n * (as a side note, another implementation was attempt to have the \"seeders\" as the original-seeders for build,\n * however, it's failed. see https://github.com/teambit/bit/pull/5407 for more details).\n */\nexport class Network {\n _originalSeeders: ComponentID[] | undefined;\n constructor(\n private _graphCapsules: CapsuleList,\n private seedersIds: ComponentID[],\n private _capsulesRootDir: string\n ) {}\n\n /**\n * for build-tasks (during bit build/tag/snap), this includes the component graph of the current env only.\n * otherwise, this includes the original components the network was created for.\n */\n get seedersCapsules(): CapsuleList {\n const capsules = this.seedersIds.map((seederId) => {\n const capsule = this.graphCapsules.getCapsule(seederId);\n if (!capsule) throw new Error(`unable to find ${seederId.toString()} in the capsule list`);\n return capsule;\n });\n return CapsuleList.fromArray(capsules);\n }\n\n /**\n * for build-tasks (during bit build/tag/snap), this includes the original components of the current env.\n * otherwise, this is the same as `this.seedersCapsules()`.\n */\n get originalSeedersCapsules(): CapsuleList {\n const capsules = this.getOriginalSeeders().map((seederId) => {\n const capsule = this.graphCapsules.getCapsule(seederId);\n if (!capsule) throw new Error(`unable to find ${seederId.toString()} in the capsule list`);\n return capsule;\n });\n return CapsuleList.fromArray(capsules);\n }\n\n /**\n * originalSeeders are not always set (currently, only during build process), so if they're missing, just provide the\n * seeders, which are probably the original-seeders\n */\n private getOriginalSeeders(): ComponentID[] {\n return this._originalSeeders || this.seedersIds;\n }\n\n /**\n * all capsules, including the dependencies of the seeders. (even when they belong to another env)\n */\n get graphCapsules(): CapsuleList {\n return this._graphCapsules;\n }\n\n get capsulesRootDir(): PathOsBasedAbsolute {\n return this._capsulesRootDir;\n }\n}\n"]}
1
+ {"version":3,"sources":["network.ts"],"names":["Network","constructor","_graphCapsules","seedersIds","_capsulesRootDir","seedersCapsules","capsules","map","seederId","capsule","graphCapsules","getCapsule","Error","toString","CapsuleList","fromArray","originalSeedersCapsules","getOriginalSeeders","getCapsulesToCompile","Promise","all","seederCapsule","component","id","isModified","_originalSeeders","capsulesRootDir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAN,CAAc;AAEnBC,EAAAA,WAAW,CACDC,cADC,EAEDC,UAFC,EAGDC,gBAHC,EAIT;AAAA,SAHQF,cAGR,GAHQA,cAGR;AAAA,SAFQC,UAER,GAFQA,UAER;AAAA,SADQC,gBACR,GADQA,gBACR;AAAA;AAAE;AAEJ;AACF;AACA;AACA;;;AACqB,MAAfC,eAAe,GAAgB;AACjC,UAAMC,QAAQ,GAAG,KAAKH,UAAL,CAAgBI,GAAhB,CAAqBC,QAAD,IAAc;AACjD,YAAMC,OAAO,GAAG,KAAKC,aAAL,CAAmBC,UAAnB,CAA8BH,QAA9B,CAAhB;AACA,UAAI,CAACC,OAAL,EAAc,MAAM,IAAIG,KAAJ,CAAW,kBAAiBJ,QAAQ,CAACK,QAAT,EAAoB,sBAAhD,CAAN;AACd,aAAOJ,OAAP;AACD,KAJgB,CAAjB;AAKA,WAAOK,uBAAYC,SAAZ,CAAsBT,QAAtB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AAC6B,MAAvBU,uBAAuB,GAAgB;AACzC,UAAMV,QAAQ,GAAG,KAAKW,kBAAL,GAA0BV,GAA1B,CAA+BC,QAAD,IAAc;AAC3D,YAAMC,OAAO,GAAG,KAAKC,aAAL,CAAmBC,UAAnB,CAA8BH,QAA9B,CAAhB;AACA,UAAI,CAACC,OAAL,EAAc,MAAM,IAAIG,KAAJ,CAAW,kBAAiBJ,QAAQ,CAACK,QAAT,EAAoB,sBAAhD,CAAN;AACd,aAAOJ,OAAP;AACD,KAJgB,CAAjB;AAKA,WAAOK,uBAAYC,SAAZ,CAAsBT,QAAtB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AAC4B,QAApBY,oBAAoB,GAAG;AAC3B,UAAMF,uBAAuB,GAAG,KAAKA,uBAArC;AACA,UAAMV,QAAQ,GAAG,MAAMa,OAAO,CAACC,GAAR,CACrB,KAAKf,eAAL,CAAqBE,GAArB,CAAyB,MAAOc,aAAP,IAAyB;AAChD,UAAIL,uBAAuB,CAACL,UAAxB,CAAmCU,aAAa,CAACC,SAAd,CAAwBC,EAA3D,CAAJ,EAAoE;AAClE,eAAOF,aAAP;AACD;;AACD,YAAMG,UAAU,GAAG,MAAMH,aAAa,CAACC,SAAd,CAAwBE,UAAxB,EAAzB;AACA,aAAOA,UAAU,GAAGH,aAAH,GAAmB,IAApC;AACD,KAND,CADqB,CAAvB;AASA,WAAOP,uBAAYC,SAAZ,CAAsB,uBAAQT,QAAR,CAAtB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACUW,EAAAA,kBAAkB,GAAkB;AAC1C,WAAO,KAAKQ,gBAAL,IAAyB,KAAKtB,UAArC;AACD;AAED;AACF;AACA;;;AACmB,MAAbO,aAAa,GAAgB;AAC/B,WAAO,KAAKR,cAAZ;AACD;;AAEkB,MAAfwB,eAAe,GAAwB;AACzC,WAAO,KAAKtB,gBAAZ;AACD;;AArEkB","sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport { compact } from 'lodash';\nimport CapsuleList from './capsule-list';\n\n/**\n * collection of isolated components (capsules).\n * normally, \"seeders\" are the components that this network was created for.\n * \"graphCapsules\" is the graph created from the seeders and it includes also the dependencies.\n *\n * however, during \"bit build\"/\"bit tag\"/\"bit snap\", things are more complex because there is one more variable in the\n * picture, which is the \"env\". the Network is created per env.\n * in practice, for \"build-task\", a task is called per env, and the network passed to the task is relevant to that env.\n * the \"originalSeeders\" are the ones the network was created for, but only for this env.\n * the \"seeders\" are similar to the \"graphCapsules\" above, which contains also the dependencies, but only for this env.\n * the \"graphCapsules\" is the entire graph, including capsules from other envs.\n *\n * for example:\n * comp1 depends on comp2. comp1 env is \"react\". comp2 env is \"aspect\".\n *\n * when the user is running \"bit build comp1\", two `Network` instances will be created with the following:\n * Network for \"react\" env: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].\n * Network for \"aspect\" env: originalSeeders: [], seeders: ['comp2'], graphCapsules: ['comp2'].\n *\n * on the other hand, when the user is running \"bit capsule create comp1\", only one `Network` instance is created:\n * Network: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].\n *\n * (as a side note, another implementation was attempt to have the \"seeders\" as the original-seeders for build,\n * however, it's failed. see https://github.com/teambit/bit/pull/5407 for more details).\n */\nexport class Network {\n _originalSeeders: ComponentID[] | undefined;\n constructor(\n private _graphCapsules: CapsuleList,\n private seedersIds: ComponentID[],\n private _capsulesRootDir: string\n ) {}\n\n /**\n * for build-tasks (during bit build/tag/snap), this includes the component graph of the current env only.\n * otherwise, this includes the original components the network was created for.\n */\n get seedersCapsules(): CapsuleList {\n const capsules = this.seedersIds.map((seederId) => {\n const capsule = this.graphCapsules.getCapsule(seederId);\n if (!capsule) throw new Error(`unable to find ${seederId.toString()} in the capsule list`);\n return capsule;\n });\n return CapsuleList.fromArray(capsules);\n }\n\n /**\n * for build-tasks (during bit build/tag/snap), this includes the original components of the current env.\n * otherwise, this is the same as `this.seedersCapsules()`.\n */\n get originalSeedersCapsules(): CapsuleList {\n const capsules = this.getOriginalSeeders().map((seederId) => {\n const capsule = this.graphCapsules.getCapsule(seederId);\n if (!capsule) throw new Error(`unable to find ${seederId.toString()} in the capsule list`);\n return capsule;\n });\n return CapsuleList.fromArray(capsules);\n }\n\n /**\n * some of the capsules (non-modified) are written already with the dists files, so no need to re-compile them.\n * this method helps optimizing compilers that are running on the capsules.\n */\n async getCapsulesToCompile() {\n const originalSeedersCapsules = this.originalSeedersCapsules;\n const capsules = await Promise.all(\n this.seedersCapsules.map(async (seederCapsule) => {\n if (originalSeedersCapsules.getCapsule(seederCapsule.component.id)) {\n return seederCapsule;\n }\n const isModified = await seederCapsule.component.isModified();\n return isModified ? seederCapsule : null;\n })\n );\n return CapsuleList.fromArray(compact(capsules));\n }\n\n /**\n * originalSeeders are not always set (currently, only during build process), so if they're missing, just provide the\n * seeders, which are probably the original-seeders\n */\n private getOriginalSeeders(): ComponentID[] {\n return this._originalSeeders || this.seedersIds;\n }\n\n /**\n * all capsules, including the dependencies of the seeders. (even when they belong to another env)\n */\n get graphCapsules(): CapsuleList {\n return this._graphCapsules;\n }\n\n get capsulesRootDir(): PathOsBasedAbsolute {\n return this._capsulesRootDir;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/isolator",
3
- "version": "0.0.717",
3
+ "version": "0.0.718",
4
4
  "homepage": "https://bit.dev/teambit/component/isolator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "isolator",
9
- "version": "0.0.717"
9
+ "version": "0.0.718"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
@@ -23,13 +23,13 @@
23
23
  "@babel/runtime": "7.12.18",
24
24
  "core-js": "^3.0.0",
25
25
  "@teambit/harmony": "0.3.3",
26
- "@teambit/component": "0.0.717",
26
+ "@teambit/component": "0.0.718",
27
27
  "@teambit/legacy-bit-id": "0.0.399",
28
28
  "@teambit/cli": "0.0.477",
29
29
  "@teambit/component-package-version": "0.0.396",
30
- "@teambit/dependency-resolver": "0.0.717",
30
+ "@teambit/dependency-resolver": "0.0.718",
31
31
  "@teambit/global-config": "0.0.479",
32
- "@teambit/graph": "0.0.717",
32
+ "@teambit/graph": "0.0.718",
33
33
  "@teambit/logger": "0.0.569"
34
34
  },
35
35
  "devDependencies": {
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@0.0.717/dist/isolator.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@0.0.717/dist/isolator.docs.md')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@0.0.718/dist/isolator.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@0.0.718/dist/isolator.docs.md')]