@teambit/isolator 1.0.282 → 1.0.284

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,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.component/isolator@1.0.282" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.component/isolator@1.0.284" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.component/isolator-preview"]=t():e["teambit.component/isolator-preview"]=t()}(self,(()=>(()=>{"use strict";var e={64005:(e,t,o)=>{var n={id:"teambit.component/isolator@1.0.282",homepage:"https://bit.cloud/teambit/component/isolator",exported:!0};function r(){const e=a(o(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,a.__bit_component=n;const s=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/isolator.svg"}));s.__bit_component=n,t.Logo=s},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>d,compositions_metadata:()=>m,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>c});var t=o(64005);o(41594);const r=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var s=["components"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i.apply(this,arguments)}var l={},p="wrapper";function c(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,s);return(0,r.mdx)(p,i({},l,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("h2",null,"Isolate a component"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit create-capsule ui/button\n")),(0,r.mdx)("h2",null,"Entities"),(0,r.mdx)("h3",null,"Capsule"),(0,r.mdx)("p",null,"Bit implements a filesystem capsule, which is an isolated folder containing the component files.\nCapsules include the component files and links to other capsules that include the component's dependencies."),(0,r.mdx)("h3",null,"Network"),(0,r.mdx)("p",null,"A network is a group of capsules, related to one another by their dependencies.\nA network includes a graph of all seed components given to it, as well as a list of the capsules."),(0,r.mdx)("p",null,"Example:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-javascript"},"const Network = {\n graph: Graph,\n capsules: CapsuleList,\n};\n")),(0,r.mdx)("h2",null,"API"),(0,r.mdx)("p",null,"The exact particularities of this API are beyond the scope of this readme. Instead, this document opts to\nprovide a general description of the methods of this API and their purpose."),(0,r.mdx)("h3",null,"Isolator.isolateComponents"),(0,r.mdx)("p",null,"This method receives a list of components, create capsule for the components and write the components data into the capsule.\nIt returns a list of capsules.")))}c.isMDXComponent=!0;const d=[t],u=[e],m={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.component/isolator-preview"]=t():e["teambit.component/isolator-preview"]=t()}(self,(()=>(()=>{"use strict";var e={61099:(e,t,o)=>{var n={id:"teambit.component/isolator@1.0.284",homepage:"https://bit.cloud/teambit/component/isolator",exported:!0};function r(){const e=a(o(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,a.__bit_component=n;const s=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/isolator.svg"}));s.__bit_component=n,t.Logo=s},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>d,compositions_metadata:()=>m,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>c});var t=o(61099);o(41594);const r=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var s=["components"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i.apply(null,arguments)}var l={},p="wrapper";function c(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||{}.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,s);return(0,r.mdx)(p,i({},l,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("h2",null,"Isolate a component"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit create-capsule ui/button\n")),(0,r.mdx)("h2",null,"Entities"),(0,r.mdx)("h3",null,"Capsule"),(0,r.mdx)("p",null,"Bit implements a filesystem capsule, which is an isolated folder containing the component files.\nCapsules include the component files and links to other capsules that include the component's dependencies."),(0,r.mdx)("h3",null,"Network"),(0,r.mdx)("p",null,"A network is a group of capsules, related to one another by their dependencies.\nA network includes a graph of all seed components given to it, as well as a list of the capsules."),(0,r.mdx)("p",null,"Example:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-javascript"},"const Network = {\n graph: Graph,\n capsules: CapsuleList,\n};\n")),(0,r.mdx)("h2",null,"API"),(0,r.mdx)("p",null,"The exact particularities of this API are beyond the scope of this readme. Instead, this document opts to\nprovide a general description of the methods of this API and their purpose."),(0,r.mdx)("h3",null,"Isolator.isolateComponents"),(0,r.mdx)("p",null,"This method receives a list of components, create capsule for the components and write the components data into the capsule.\nIt returns a list of capsules.")))}c.isMDXComponent=!0;const d=[t],u=[e],m={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
@@ -1241,7 +1241,7 @@
1241
1241
  "_legacy": {
1242
1242
  "scope": "teambit.component",
1243
1243
  "name": "isolator",
1244
- "version": "1.0.282"
1244
+ "version": "1.0.284"
1245
1245
  },
1246
1246
  "_scope": "teambit.component"
1247
1247
  }
@@ -2469,7 +2469,7 @@
2469
2469
  "_legacy": {
2470
2470
  "scope": "teambit.component",
2471
2471
  "name": "isolator",
2472
- "version": "1.0.282"
2472
+ "version": "1.0.284"
2473
2473
  },
2474
2474
  "_scope": "teambit.component"
2475
2475
  }
@@ -2755,7 +2755,7 @@
2755
2755
  "_legacy": {
2756
2756
  "scope": "teambit.component",
2757
2757
  "name": "isolator",
2758
- "version": "1.0.282"
2758
+ "version": "1.0.284"
2759
2759
  },
2760
2760
  "_scope": "teambit.component"
2761
2761
  }
@@ -2784,7 +2784,7 @@
2784
2784
  "_legacy": {
2785
2785
  "scope": "teambit.component",
2786
2786
  "name": "isolator",
2787
- "version": "1.0.282"
2787
+ "version": "1.0.284"
2788
2788
  },
2789
2789
  "_scope": "teambit.component"
2790
2790
  }
@@ -5562,7 +5562,7 @@
5562
5562
  "_legacy": {
5563
5563
  "scope": "teambit.component",
5564
5564
  "name": "isolator",
5565
- "version": "1.0.282"
5565
+ "version": "1.0.284"
5566
5566
  },
5567
5567
  "_scope": "teambit.component"
5568
5568
  }
@@ -6017,7 +6017,7 @@
6017
6017
  "_legacy": {
6018
6018
  "scope": "teambit.component",
6019
6019
  "name": "isolator",
6020
- "version": "1.0.282"
6020
+ "version": "1.0.284"
6021
6021
  },
6022
6022
  "_scope": "teambit.component"
6023
6023
  }
@@ -6078,7 +6078,7 @@
6078
6078
  "_legacy": {
6079
6079
  "scope": "teambit.component",
6080
6080
  "name": "isolator",
6081
- "version": "1.0.282"
6081
+ "version": "1.0.284"
6082
6082
  },
6083
6083
  "_scope": "teambit.component"
6084
6084
  }
@@ -6984,7 +6984,7 @@
6984
6984
  "_legacy": {
6985
6985
  "scope": "teambit.component",
6986
6986
  "name": "isolator",
6987
- "version": "1.0.282"
6987
+ "version": "1.0.284"
6988
6988
  },
6989
6989
  "_scope": "teambit.component"
6990
6990
  }
@@ -8247,7 +8247,7 @@
8247
8247
  "_legacy": {
8248
8248
  "scope": "teambit.component",
8249
8249
  "name": "isolator",
8250
- "version": "1.0.282"
8250
+ "version": "1.0.284"
8251
8251
  },
8252
8252
  "_scope": "teambit.component"
8253
8253
  }
@@ -8535,7 +8535,7 @@
8535
8535
  "_legacy": {
8536
8536
  "scope": "teambit.component",
8537
8537
  "name": "isolator",
8538
- "version": "1.0.282"
8538
+ "version": "1.0.284"
8539
8539
  },
8540
8540
  "_scope": "teambit.component"
8541
8541
  }
@@ -8564,7 +8564,7 @@
8564
8564
  "_legacy": {
8565
8565
  "scope": "teambit.component",
8566
8566
  "name": "isolator",
8567
- "version": "1.0.282"
8567
+ "version": "1.0.284"
8568
8568
  },
8569
8569
  "_scope": "teambit.component"
8570
8570
  }
@@ -12221,7 +12221,7 @@
12221
12221
  "_legacy": {
12222
12222
  "scope": "teambit.component",
12223
12223
  "name": "isolator",
12224
- "version": "1.0.282"
12224
+ "version": "1.0.284"
12225
12225
  },
12226
12226
  "_scope": "teambit.component"
12227
12227
  }
@@ -12237,7 +12237,7 @@
12237
12237
  "componentId": {
12238
12238
  "scope": "teambit.component",
12239
12239
  "name": "isolator",
12240
- "version": "1.0.282"
12240
+ "version": "1.0.284"
12241
12241
  },
12242
12242
  "taggedModuleExports": []
12243
12243
  }
@@ -60,10 +60,10 @@ function _containerExec() {
60
60
  };
61
61
  return data;
62
62
  }
63
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
63
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
64
64
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
65
65
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
66
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
66
+ 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; }
67
67
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
68
68
  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); }
69
69
  class Capsule extends _capsule().Capsule {
@@ -1 +1 @@
1
- {"version":3,"names":["_capsule","data","require","_filenamify","_interopRequireDefault","_fs","_glob","_path","_uuid","_container","_containerExec","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Capsule","CapsuleTemplate","constructor","container","fs","console","Console","state","component","_wrkDir","wrkDir","path","realpathSync","start","execNode","executable","args","exec","typedExec","command","cwd","opts","ContainerExec","outputFile","file","options","removePath","dir","symlink","src","dest","execute","cmd","execResults","split","stdout","stderr","Promise","resolve","reject","on","error","getAllFilesPaths","files","glob","sync","join","nodir","map","getCapsuleDirName","config","name","filenamify","id","toString","replacement","getCapsuleRootDir","baseDir","createFromComponent","capsuleDirName","alwaysNew","v4","FsContainer","capsule","State","exports"],"sources":["capsule.ts"],"sourcesContent":["import { NodeFS } from '@teambit/any-fs';\nimport { Capsule as CapsuleTemplate, Console, Exec, State } from '@teambit/capsule';\nimport { Component } from '@teambit/component';\nimport filenamify from 'filenamify';\nimport { realpathSync } from 'fs';\nimport glob from 'glob';\nimport path from 'path';\nimport { v4 } from 'uuid';\n\nimport FsContainer, { BitExecOption } from './container';\nimport ContainerExec from './container-exec';\n\nexport default class Capsule extends CapsuleTemplate<Exec, NodeFS> {\n private _wrkDir: string;\n constructor(\n /**\n * container implementation the capsule is being executed within.\n */\n protected container: FsContainer,\n /**\n * the capsule's file system.\n */\n readonly fs: NodeFS,\n /**\n * console for controlling process streams as stdout, stdin and stderr.\n */\n readonly console: Console = new Console(),\n /**\n * capsule's state.\n */\n readonly state: State,\n readonly component: Component\n ) {\n super(container, fs, console, state);\n this._wrkDir = container.wrkDir;\n }\n\n /**\n * @deprecated please use `this.path`\n */\n get wrkDir(): string {\n return this.path;\n }\n\n get path(): string {\n return realpathSync(this._wrkDir);\n }\n\n start(): Promise<any> {\n return this.container.start();\n }\n\n async execNode(executable: string, args: any, exec: ContainerExec) {\n return this.typedExec(\n {\n command: ['node', executable, ...(args.args || [])],\n cwd: '',\n },\n exec\n );\n }\n\n async typedExec(opts: BitExecOption, exec = new ContainerExec()) {\n return this.container.exec(opts, exec);\n }\n\n outputFile(file: string, data: any, options?: any): Promise<any> {\n return this.container.outputFile(file, data, options);\n }\n\n removePath(dir: string): Promise<any> {\n return this.container.removePath(dir);\n }\n\n symlink(src: string, dest: string): Promise<any> {\n return this.container.symlink(src, dest);\n }\n\n // TODO: refactor this crap and simplify capsule API\n async execute(cmd: string, options?: Record<string, any> | null | undefined) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const execResults = await this.exec({ command: cmd.split(' '), options });\n let stdout = '';\n let stderr = '';\n return new Promise((resolve, reject) => {\n execResults.stdout.on('data', (data: string) => {\n stdout += data;\n });\n execResults.stdout.on('error', (error: string) => {\n return reject(error);\n });\n // @ts-ignore\n execResults.on('close', () => {\n return resolve({ stdout, stderr });\n });\n execResults.stderr.on('error', (error: string) => {\n return reject(error);\n });\n execResults.stderr.on('data', (data: string) => {\n stderr += data;\n });\n });\n }\n\n /**\n * @todo: fix.\n * it skips the capsule fs because for some reason `capsule.fs.promises.readdir` doesn't work\n * the same as `capsule.fs.readdir` and it doesn't have the capsule dir as pwd.\n *\n * returns the paths inside the capsule\n */\n getAllFilesPaths(dir = '.', options: { ignore?: string[] } = {}) {\n const files = glob.sync('**', { cwd: path.join(this.path, dir), nodir: true, ...options });\n return files.map((file) => path.join(dir, file));\n }\n\n static getCapsuleDirName(component: Component, config: { alwaysNew?: boolean; name?: string } = {}) {\n return config.name || filenamify(component.id.toString(), { replacement: '_' });\n }\n\n static getCapsuleRootDir(component: Component, baseDir: string, config: { alwaysNew?: boolean; name?: string } = {}) {\n return path.join(baseDir, Capsule.getCapsuleDirName(component, config));\n }\n\n static async createFromComponent(\n component: Component,\n baseDir: string,\n config: { alwaysNew?: boolean } = {}\n ): Promise<Capsule> {\n // TODO: make this a static method and combine with ComponentCapsule\n const capsuleDirName = Capsule.getCapsuleDirName(component, config);\n const wrkDir = path.join(baseDir, config.alwaysNew ? `${capsuleDirName}_${v4()}` : capsuleDirName);\n const container = new FsContainer(wrkDir);\n const capsule = new Capsule(container, container.fs, new Console(), new State(), component);\n await capsule.start();\n return capsule;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAA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BA,CAC9BlD,SAAoB,EACpBiD,OAAe,EACfP,MAA+B,GAAG,CAAC,CAAC,EAClB;IAClB;IACA,MAAMS,cAAc,GAAG3D,OAAO,CAACiD,iBAAiB,CAACzC,SAAS,EAAE0C,MAAM,CAAC;IACnE,MAAMxC,MAAM,GAAGC,eAAI,CAACmC,IAAI,CAACW,OAAO,EAAEP,MAAM,CAACU,SAAS,GAAI,GAAED,cAAe,IAAG,IAAAE,UAAE,EAAC,CAAE,EAAC,GAAGF,cAAc,CAAC;IAClG,MAAMxD,SAAS,GAAG,KAAI2D,oBAAW,EAACpD,MAAM,CAAC;IACzC,MAAMqD,OAAO,GAAG,IAAI/D,OAAO,CAACG,SAAS,EAAEA,SAAS,CAACC,EAAE,EAAE,KAAIE,kBAAO,EAAC,CAAC,EAAE,KAAI0D,gBAAK,EAAC,CAAC,EAAExD,SAAS,CAAC;IAC3F,MAAMuD,OAAO,CAAClD,KAAK,CAAC,CAAC;IACrB,OAAOkD,OAAO;EAChB;AACF;AAACE,OAAA,CAAApG,OAAA,GAAAmC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_capsule","data","require","_filenamify","_interopRequireDefault","_fs","_glob","_path","_uuid","_container","_containerExec","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Capsule","CapsuleTemplate","constructor","container","fs","console","Console","state","component","_wrkDir","wrkDir","path","realpathSync","start","execNode","executable","args","exec","typedExec","command","cwd","opts","ContainerExec","outputFile","file","options","removePath","dir","symlink","src","dest","execute","cmd","execResults","split","stdout","stderr","Promise","resolve","reject","on","error","getAllFilesPaths","files","glob","sync","join","nodir","map","getCapsuleDirName","config","name","filenamify","id","toString","replacement","getCapsuleRootDir","baseDir","createFromComponent","capsuleDirName","alwaysNew","v4","FsContainer","capsule","State","exports"],"sources":["capsule.ts"],"sourcesContent":["import { NodeFS } from '@teambit/any-fs';\nimport { Capsule as CapsuleTemplate, Console, Exec, State } from '@teambit/capsule';\nimport { Component } from '@teambit/component';\nimport filenamify from 'filenamify';\nimport { realpathSync } from 'fs';\nimport glob from 'glob';\nimport path from 'path';\nimport { v4 } from 'uuid';\n\nimport FsContainer, { BitExecOption } from './container';\nimport ContainerExec from './container-exec';\n\nexport default class Capsule extends CapsuleTemplate<Exec, NodeFS> {\n private _wrkDir: string;\n constructor(\n /**\n * container implementation the capsule is being executed within.\n */\n protected container: FsContainer,\n /**\n * the capsule's file system.\n */\n readonly fs: NodeFS,\n /**\n * console for controlling process streams as stdout, stdin and stderr.\n */\n readonly console: Console = new Console(),\n /**\n * capsule's state.\n */\n readonly state: State,\n readonly component: Component\n ) {\n super(container, fs, console, state);\n this._wrkDir = container.wrkDir;\n }\n\n /**\n * @deprecated please use `this.path`\n */\n get wrkDir(): string {\n return this.path;\n }\n\n get path(): string {\n return realpathSync(this._wrkDir);\n }\n\n start(): Promise<any> {\n return this.container.start();\n }\n\n async execNode(executable: string, args: any, exec: ContainerExec) {\n return this.typedExec(\n {\n command: ['node', executable, ...(args.args || [])],\n cwd: '',\n },\n exec\n );\n }\n\n async typedExec(opts: BitExecOption, exec = new ContainerExec()) {\n return this.container.exec(opts, exec);\n }\n\n outputFile(file: string, data: any, options?: any): Promise<any> {\n return this.container.outputFile(file, data, options);\n }\n\n removePath(dir: string): Promise<any> {\n return this.container.removePath(dir);\n }\n\n symlink(src: string, dest: string): Promise<any> {\n return this.container.symlink(src, dest);\n }\n\n // TODO: refactor this crap and simplify capsule API\n async execute(cmd: string, options?: Record<string, any> | null | undefined) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const execResults = await this.exec({ command: cmd.split(' '), options });\n let stdout = '';\n let stderr = '';\n return new Promise((resolve, reject) => {\n execResults.stdout.on('data', (data: string) => {\n stdout += data;\n });\n execResults.stdout.on('error', (error: string) => {\n return reject(error);\n });\n // @ts-ignore\n execResults.on('close', () => {\n return resolve({ stdout, stderr });\n });\n execResults.stderr.on('error', (error: string) => {\n return reject(error);\n });\n execResults.stderr.on('data', (data: string) => {\n stderr += data;\n });\n });\n }\n\n /**\n * @todo: fix.\n * it skips the capsule fs because for some reason `capsule.fs.promises.readdir` doesn't work\n * the same as `capsule.fs.readdir` and it doesn't have the capsule dir as pwd.\n *\n * returns the paths inside the capsule\n */\n getAllFilesPaths(dir = '.', options: { ignore?: string[] } = {}) {\n const files = glob.sync('**', { cwd: path.join(this.path, dir), nodir: true, ...options });\n return files.map((file) => path.join(dir, file));\n }\n\n static getCapsuleDirName(component: Component, config: { alwaysNew?: boolean; name?: string } = {}) {\n return config.name || filenamify(component.id.toString(), { replacement: '_' });\n }\n\n static getCapsuleRootDir(component: Component, baseDir: string, config: { alwaysNew?: boolean; name?: string } = {}) {\n return path.join(baseDir, Capsule.getCapsuleDirName(component, config));\n }\n\n static async createFromComponent(\n component: Component,\n baseDir: string,\n config: { alwaysNew?: boolean } = {}\n ): Promise<Capsule> {\n // TODO: make this a static method and combine with ComponentCapsule\n const capsuleDirName = Capsule.getCapsuleDirName(component, config);\n const wrkDir = path.join(baseDir, config.alwaysNew ? `${capsuleDirName}_${v4()}` : capsuleDirName);\n const container = new FsContainer(wrkDir);\n const capsule = new Capsule(container, container.fs, new Console(), new State(), component);\n await capsule.start();\n return capsule;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;E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BlD,SAAoB,EACpBiD,OAAe,EACfP,MAA+B,GAAG,CAAC,CAAC,EAClB;IAClB;IACA,MAAMS,cAAc,GAAG3D,OAAO,CAACiD,iBAAiB,CAACzC,SAAS,EAAE0C,MAAM,CAAC;IACnE,MAAMxC,MAAM,GAAGC,eAAI,CAACmC,IAAI,CAACW,OAAO,EAAEP,MAAM,CAACU,SAAS,GAAG,GAAGD,cAAc,IAAI,IAAAE,UAAE,EAAC,CAAC,EAAE,GAAGF,cAAc,CAAC;IAClG,MAAMxD,SAAS,GAAG,KAAI2D,oBAAW,EAACpD,MAAM,CAAC;IACzC,MAAMqD,OAAO,GAAG,IAAI/D,OAAO,CAACG,SAAS,EAAEA,SAAS,CAACC,EAAE,EAAE,KAAIE,kBAAO,EAAC,CAAC,EAAE,KAAI0D,gBAAK,EAAC,CAAC,EAAExD,SAAS,CAAC;IAC3F,MAAMuD,OAAO,CAAClD,KAAK,CAAC,CAAC;IACrB,OAAOkD,OAAO;EAChB;AACF;AAACE,OAAA,CAAAlG,OAAA,GAAAiC,OAAA","ignoreList":[]}
@@ -18,7 +18,7 @@ function _events() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
+ 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; }
22
22
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
23
  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); }
24
24
  class ContainerExec extends _events().EventEmitter {
@@ -1 +1 @@
1
- {"version":3,"names":["_capsule","data","require","_events","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","ContainerExec","EventEmitter","constructor","_code","DuplexBufferStream","setStatus","status","emit","code","inspect","Promise","resolve","running","pid","abort","Error","exports","default"],"sources":["container-exec.ts"],"sourcesContent":["import { DuplexBufferStream, Exec, ExecStatus } from '@teambit/capsule';\nimport { EventEmitter } from 'events';\n\nexport default class ContainerExec extends EventEmitter implements Exec {\n constructor(private _code: number = 0) {\n super();\n }\n\n stdout: DuplexBufferStream = new DuplexBufferStream();\n stderr: DuplexBufferStream = new DuplexBufferStream();\n stdin: DuplexBufferStream = new DuplexBufferStream();\n\n setStatus(status: number): void {\n this._code = status;\n this.emit('close');\n }\n\n get code(): number {\n return this._code;\n }\n\n inspect(): Promise<ExecStatus> {\n return Promise.resolve({\n running: true,\n pid: 1,\n });\n }\n abort(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AAEvB,MAAMW,aAAa,SAASC,sBAAY,CAAiB;EACtEC,WAAWA,CAASC,KAAa,GAAG,CAAC,EAAE;IACrC,KAAK,CAAC,CAAC;IAAC,KADUA,KAAa,GAAbA,KAAa;IAAAxB,eAAA,iBAIJ,KAAIyB,6BAAkB,EAAC,CAAC;IAAAzB,eAAA,iBACxB,KAAIyB,6BAAkB,EAAC,CAAC;IAAAzB,eAAA,gBACzB,KAAIyB,6BAAkB,EAAC,CAAC;EAJpD;EAMAC,SAASA,CAACC,MAAc,EAAQ;IAC9B,IAAI,CAACH,KAAK,GAAGG,MAAM;IACnB,IAAI,CAACC,IAAI,CAAC,OAAO,CAAC;EACpB;EAEA,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACL,KAAK;EACnB;EAEAM,OAAOA,CAAA,EAAwB;IAC7B,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBC,OAAO,EAAE,IAAI;MACbC,GAAG,EAAE;IACP,CAAC,CAAC;EACJ;EACAC,KAAKA,CAAA,EAAkB;IACrB,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAjB,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_capsule","data","require","_events","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ContainerExec","EventEmitter","constructor","_code","DuplexBufferStream","setStatus","status","emit","code","inspect","Promise","resolve","running","pid","abort","Error","exports","default"],"sources":["container-exec.ts"],"sourcesContent":["import { DuplexBufferStream, Exec, ExecStatus } from '@teambit/capsule';\nimport { EventEmitter } from 'events';\n\nexport default class ContainerExec extends EventEmitter implements Exec {\n constructor(private _code: number = 0) {\n super();\n }\n\n stdout: DuplexBufferStream = new DuplexBufferStream();\n stderr: DuplexBufferStream = new DuplexBufferStream();\n stdin: DuplexBufferStream = new DuplexBufferStream();\n\n setStatus(status: number): void {\n this._code = status;\n this.emit('close');\n }\n\n get code(): number {\n return this._code;\n }\n\n inspect(): Promise<ExecStatus> {\n return Promise.resolve({\n running: true,\n pid: 1,\n });\n }\n abort(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAG,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,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEvB,MAAMgB,aAAa,SAASC,sBAAY,CAAiB;EACtEC,WAAWA,CAASC,KAAa,GAAG,CAAC,EAAE;IACrC,KAAK,CAAC,CAAC;IAAC,KADUA,KAAa,GAAbA,KAAa;IAAAtB,eAAA,iBAIJ,KAAIuB,6BAAkB,EAAC,CAAC;IAAAvB,eAAA,iBACxB,KAAIuB,6BAAkB,EAAC,CAAC;IAAAvB,eAAA,gBACzB,KAAIuB,6BAAkB,EAAC,CAAC;EAJpD;EAMAC,SAASA,CAACC,MAAc,EAAQ;IAC9B,IAAI,CAACH,KAAK,GAAGG,MAAM;IACnB,IAAI,CAACC,IAAI,CAAC,OAAO,CAAC;EACpB;EAEA,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACL,KAAK;EACnB;EAEAM,OAAOA,CAAA,EAAwB;IAC7B,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBC,OAAO,EAAE,IAAI;MACbC,GAAG,EAAE;IACP,CAAC,CAAC;EACJ;EACAC,KAAKA,CAAA,EAAkB;IACrB,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAjB,aAAA","ignoreList":[]}
@@ -41,8 +41,8 @@ function _containerExec() {
41
41
  }
42
42
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
43
43
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
44
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
45
+ 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; }
46
46
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
47
47
  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); }
48
48
  const debug = require('debug')('fs-container');
@@ -1 +1 @@
1
- {"version":3,"names":["_anyFs","data","require","_execa","_interopRequireDefault","_fsExtra","path","_interopRequireWildcard","_containerExec","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","debug","FsContainer","constructor","wrkDir","NodeFS","getPath","composePath","pathToCompose","join","outputFile","file","options","filePath","fs","removePath","dir","pathToRemove","remove","symlink","src","dest","srcPath","destPath","ensureDir","dirname","ensureSymlink","exec","execOptions","ContainerExec","cwd","command","subprocessP","execa","shell","stdio","on","msg","emit","stderr","pipe","stdout","forEach","eventName","statusCode","setStatus","execP","hasError","Promise","resolve","reject","getContents","size","toString","terminal","process","env","SHELL","start","inspect","pause","resume","stop","ttl","destroy","log","Error","event","fn","exports"],"sources":["container.ts"],"sourcesContent":["import { AnyFS, NodeFS } from '@teambit/any-fs';\nimport { Container, ContainerFactoryOptions, ContainerStatus, Exec, ExecOptions } from '@teambit/capsule';\nimport execa from 'execa';\nimport fs from 'fs-extra';\nimport * as path from 'path';\nimport { Stream } from 'stream';\n\nimport ContainerExec from './container-exec';\n\nconst debug = require('debug')('fs-container');\n\nexport interface BitExecOption extends ExecOptions {\n cwd: string;\n stdio?: 'pipe' | 'ipc' | 'ignore' | 'inherit' | Stream | number | undefined;\n}\nexport interface BitContainerConfig extends ContainerFactoryOptions {\n other?: string;\n}\n\nexport default class FsContainer implements Container<Exec, AnyFS> {\n id = 'FS Container';\n\n fs: NodeFS = new NodeFS(this.wrkDir);\n\n constructor(readonly wrkDir: string) {}\n\n // TODO: do we need this?\n public getPath() {\n return this.wrkDir;\n }\n\n private composePath(pathToCompose) {\n return path.join(this.getPath(), pathToCompose);\n }\n\n outputFile(file, data, options) {\n const filePath = this.composePath(file);\n debug(`writing file on ${filePath}`);\n return fs.outputFile(filePath, data, options);\n }\n\n removePath(dir: string): Promise<any> {\n const pathToRemove = this.composePath(dir);\n return fs.remove(pathToRemove);\n }\n\n async symlink(src: string, dest: string): Promise<any> {\n const srcPath = this.composePath(src);\n const destPath = this.composePath(dest);\n await fs.ensureDir(path.dirname(destPath));\n return fs.ensureSymlink(srcPath, destPath);\n }\n\n async exec(execOptions: BitExecOption, exec = new ContainerExec()): Promise<ContainerExec> {\n const cwd = execOptions.cwd ? this.composePath(execOptions.cwd) : this.getPath();\n debug(`executing the following command: ${execOptions.command.join(' ')}, on cwd: ${cwd}`);\n const subprocessP = execa.command(execOptions.command.join(' '), {\n shell: true,\n cwd,\n stdio: ['ipc'],\n });\n\n // @TODO: FIX! This probably causes errors ad the promise is not handled properly!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n subprocessP.on('message', function (msg: any) {\n exec.emit('message', msg);\n });\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n subprocessP.stderr?.pipe(exec.stderr);\n subprocessP.stdout?.pipe(exec.stdout);\n ['close', 'exit'].forEach(function (eventName: string) {\n // @TODO: FIX! This probably causes errors ad the promise is not handled properly!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n subprocessP.on(eventName, function (statusCode) {\n exec.setStatus(statusCode);\n });\n });\n\n return exec;\n }\n\n async execP(execOptions: BitExecOption): Promise<string> {\n let hasError = false;\n const exec = await this.exec(execOptions);\n return new Promise((resolve, reject) => {\n exec.stdout.on('error', () => {\n hasError = true;\n });\n exec.on('close', () => {\n if (hasError) reject(exec.stderr.getContents!(exec.stderr.size).toString());\n resolve(exec.stdout.getContents!(exec.stdout.size).toString());\n });\n });\n }\n\n async terminal() {\n const cwd = this.getPath();\n return execa.command(process.env.SHELL || '/bin/zsh', { cwd, stdio: 'inherit' });\n }\n\n start(): Promise<void> {\n return fs.ensureDir(this.wrkDir);\n }\n // @ts-ignore\n async inspect(): Promise<ContainerStatus> {\n // todo: probably not needed for this container\n }\n async pause(): Promise<void> {\n // do nothing\n }\n async resume(): Promise<void> {\n // do nothing\n }\n // eslint-disable-next-line\n stop(ttl?: number | undefined): Promise<void> {\n return fs.remove(this.wrkDir);\n }\n async destroy(): Promise<void> {\n await this.stop();\n }\n log(): Promise<Exec> {\n throw new Error('Method not implemented.');\n }\n on(event: string, fn: (data: any) => void): void {\n return fn(event);\n // throw new Error('Method not implemented.');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;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C,CAAC;EACnB;EACAG,GAAGA,CAAA,EAAkB;IACnB,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA9B,EAAEA,CAAC+B,KAAa,EAAEC,EAAuB,EAAQ;IAC/C,OAAOA,EAAE,CAACD,KAAK,CAAC;IAChB;EACF;AACF;AAACE,OAAA,CAAAhG,OAAA,GAAA6B,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["_anyFs","data","require","_execa","_interopRequireDefault","_fsExtra","path","_interopRequireWildcard","_containerExec","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","debug","FsContainer","constructor","wrkDir","NodeFS","getPath","composePath","pathToCompose","join","outputFile","file","options","filePath","fs","removePath","dir","pathToRemove","remove","symlink","src","dest","srcPath","destPath","ensureDir","dirname","ensureSymlink","exec","execOptions","ContainerExec","cwd","command","subprocessP","execa","shell","stdio","on","msg","emit","stderr","pipe","stdout","forEach","eventName","statusCode","setStatus","execP","hasError","Promise","resolve","reject","getContents","size","toString","terminal","process","env","SHELL","start","inspect","pause","resume","stop","ttl","destroy","log","Error","event","fn","exports"],"sources":["container.ts"],"sourcesContent":["import { AnyFS, NodeFS } from '@teambit/any-fs';\nimport { Container, ContainerFactoryOptions, ContainerStatus, Exec, ExecOptions } from '@teambit/capsule';\nimport execa from 'execa';\nimport fs from 'fs-extra';\nimport * as path from 'path';\nimport { Stream } from 'stream';\n\nimport ContainerExec from './container-exec';\n\nconst debug = require('debug')('fs-container');\n\nexport interface BitExecOption extends ExecOptions {\n cwd: string;\n stdio?: 'pipe' | 'ipc' | 'ignore' | 'inherit' | Stream | number | undefined;\n}\nexport interface BitContainerConfig extends ContainerFactoryOptions {\n other?: string;\n}\n\nexport default class FsContainer implements Container<Exec, AnyFS> {\n id = 'FS Container';\n\n fs: NodeFS = new NodeFS(this.wrkDir);\n\n constructor(readonly wrkDir: string) {}\n\n // TODO: do we need this?\n public getPath() {\n return this.wrkDir;\n }\n\n private composePath(pathToCompose) {\n return path.join(this.getPath(), pathToCompose);\n }\n\n outputFile(file, data, options) {\n const filePath = this.composePath(file);\n debug(`writing file on ${filePath}`);\n return fs.outputFile(filePath, data, options);\n }\n\n removePath(dir: string): Promise<any> {\n const pathToRemove = this.composePath(dir);\n return fs.remove(pathToRemove);\n }\n\n async symlink(src: string, dest: string): Promise<any> {\n const srcPath = this.composePath(src);\n const destPath = this.composePath(dest);\n await fs.ensureDir(path.dirname(destPath));\n return fs.ensureSymlink(srcPath, destPath);\n }\n\n async exec(execOptions: BitExecOption, exec = new ContainerExec()): Promise<ContainerExec> {\n const cwd = execOptions.cwd ? this.composePath(execOptions.cwd) : this.getPath();\n debug(`executing the following command: ${execOptions.command.join(' ')}, on cwd: ${cwd}`);\n const subprocessP = execa.command(execOptions.command.join(' '), {\n shell: true,\n cwd,\n stdio: ['ipc'],\n });\n\n // @TODO: FIX! This probably causes errors ad the promise is not handled properly!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n subprocessP.on('message', function (msg: any) {\n exec.emit('message', msg);\n });\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n subprocessP.stderr?.pipe(exec.stderr);\n subprocessP.stdout?.pipe(exec.stdout);\n ['close', 'exit'].forEach(function (eventName: string) {\n // @TODO: FIX! This probably causes errors ad the promise is not handled properly!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n subprocessP.on(eventName, function (statusCode) {\n exec.setStatus(statusCode);\n });\n });\n\n return exec;\n }\n\n async execP(execOptions: BitExecOption): Promise<string> {\n let hasError = false;\n const exec = await this.exec(execOptions);\n return new Promise((resolve, reject) => {\n exec.stdout.on('error', () => {\n hasError = true;\n });\n exec.on('close', () => {\n if (hasError) reject(exec.stderr.getContents!(exec.stderr.size).toString());\n resolve(exec.stdout.getContents!(exec.stdout.size).toString());\n });\n });\n }\n\n async terminal() {\n const cwd = this.getPath();\n return execa.command(process.env.SHELL || '/bin/zsh', { cwd, stdio: 'inherit' });\n }\n\n start(): Promise<void> {\n return fs.ensureDir(this.wrkDir);\n }\n // @ts-ignore\n async inspect(): Promise<ContainerStatus> {\n // todo: probably not needed for this container\n }\n async pause(): Promise<void> {\n // do nothing\n }\n async resume(): Promise<void> {\n // do nothing\n }\n // eslint-disable-next-line\n stop(ttl?: number | undefined): Promise<void> {\n return fs.remove(this.wrkDir);\n }\n async destroy(): Promise<void> {\n await this.stop();\n }\n log(): Promise<Exec> {\n throw new Error('Method not implemented.');\n }\n on(event: string, fn: (data: any) => void): void {\n return fn(event);\n // throw new Error('Method not implemented.');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,KAAA;EAAA,MAAAL,IAAA,GAAAM,uBAAA,CAAAL,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6C,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC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AC,CAAC;IAC1B,OAAO2B,gBAAK,CAACF,OAAO,CAACwB,OAAO,CAACC,GAAG,CAACC,KAAK,IAAI,UAAU,EAAE;MAAE3B,GAAG;MAAEK,KAAK,EAAE;IAAU,CAAC,CAAC;EAClF;EAEAuB,KAAKA,CAAA,EAAkB;IACrB,OAAO5C,kBAAE,CAACU,SAAS,CAAC,IAAI,CAACpB,MAAM,CAAC;EAClC;EACA;EACA,MAAMuD,OAAOA,CAAA,EAA6B;IACxC;EAAA;EAEF,MAAMC,KAAKA,CAAA,EAAkB;IAC3B;EAAA;EAEF,MAAMC,MAAMA,CAAA,EAAkB;IAC5B;EAAA;EAEF;EACAC,IAAIA,CAACC,GAAwB,EAAiB;IAC5C,OAAOjD,kBAAE,CAACI,MAAM,CAAC,IAAI,CAACd,MAAM,CAAC;EAC/B;EACA,MAAM4D,OAAOA,CAAA,EAAkB;IAC7B,MAAM,IAAI,CAACF,IAAI,CAAC,CAAC;EACnB;EACAG,GAAGA,CAAA,EAAkB;IACnB,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA9B,EAAEA,CAAC+B,KAAa,EAAEC,EAAuB,EAAQ;IAC/C,OAAOA,EAAE,CAACD,KAAK,CAAC;IAChB;EACF;AACF;AAACE,OAAA,CAAA9F,OAAA,GAAA2B,WAAA","ignoreList":[]}
@@ -42,6 +42,6 @@ function _containerExec() {
42
42
  };
43
43
  return data;
44
44
  }
45
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
46
 
47
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_capsule","data","_interopRequireDefault","require","_container","_containerExec","obj","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as Capsule } from './capsule';\nexport { default as FsContainer } from './container';\nexport { default as ContainerExec } from './container-exec';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4D,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA","ignoreList":[]}
1
+ {"version":3,"names":["_capsule","data","_interopRequireDefault","require","_container","_containerExec","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as Capsule } from './capsule';\nexport { default as FsContainer } from './container';\nexport { default as ContainerExec } from './container-exec';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4D,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
package/dist/index.js CHANGED
@@ -80,6 +80,6 @@ function _capsuleList() {
80
80
  };
81
81
  return data;
82
82
  }
83
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
83
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
84
84
 
85
85
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_isolatorMain","data","require","_network","_capsule","_isolator","_capsuleList","_interopRequireDefault","obj","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { CAPSULE_READY_FILE } from './isolator.main.runtime';\nexport { Network } from './network';\nexport { FsContainer, Capsule, ContainerExec } from './capsule';\nexport type { IsolatorMain, IsolateComponentsOptions } from './isolator.main.runtime';\nexport { IsolatorAspect } from './isolator.aspect';\nexport { default as CapsuleList } from './capsule-list';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAM,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA","ignoreList":[]}
1
+ {"version":3,"names":["_isolatorMain","data","require","_network","_capsule","_isolator","_capsuleList","_interopRequireDefault","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { CAPSULE_READY_FILE } from './isolator.main.runtime';\nexport { Network } from './network';\nexport { FsContainer, Capsule, ContainerExec } from './capsule';\nexport type { IsolatorMain, IsolateComponentsOptions } from './isolator.main.runtime';\nexport { IsolatorAspect } from './isolator.aspect';\nexport { default as CapsuleList } from './capsule-list';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -11,7 +11,7 @@ function _react() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
16
  style: {
17
17
  height: '100%',
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","obj","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["isolator.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/isolator.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAsD,CAAE,CACpF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["isolator.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/isolator.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAsD,CAAE,CACpF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -244,10 +244,10 @@ function _network() {
244
244
  }
245
245
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
246
246
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
247
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
247
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
248
248
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
249
249
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
250
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
250
+ 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; }
251
251
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
252
252
  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); }
253
253
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_rimraf","data","_interopRequireDefault","require","_uuid","_cli","_semver","_chalk","_lodash","_aspectLoader","_component","_componentPackageVersion","_dependenciesFs","_graph","_harmony","_dependencyResolver","_logger","_componentId","_globalConfig","_constants","_packageJsonFile","_artifactFiles","_path","_fsExtra","_interopRequireWildcard","_objectHash","_path2","_dataToPersist","_removePath","_workspaceModules","_componentIdToPackageName","_concurrency","_pMap","_capsule","_capsuleList","_isolator","_symlinkDependenciesToCapsules","_network","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","CAPSULE_DIR_LENGTH","DEFAULT_ISOLATE_INSTALL_OPTIONS","installPackages","dedupe","installPeersFromEnvs","copyPeerToRuntimeOnComponents","copyPeerToRuntimeOnRoot","CAPSULE_READY_FILE","exports","IsolatorMain","provider","dependencyResolver","loggerExtension","componentAspect","graphMain","globalConfig","aspectLoader","cli","_config","capsuleTransferSlot","logger","createLogger","IsolatorAspect","id","isolator","constructor","graph","Map","Set","isolateComponents","seeders","opts","legacyScope","host","getHost","debug","join","JSON","stringify","assign","name","createGraphOpts","pick","componentsToIsolate","seedersOnly","getMany","createGraph","seedersWithVersions","map","seeder","_legacy","hasVersion","comp","find","component","isEqual","ignoreVersion","Error","toString","baseDir","path","shouldUseDatedDirs","capsuleDir","getCapsulesRootDir","useDatedDirs","cacheCapsulesDir","capsuleList","createCapsules","rootBaseDir","cacheCapsules","process","env","CACHE_CAPSULES","cacheLockFileOnly","targetCapsuleDir","registerMoveCapsuleOnProcessExit","relinkCoreAspectsInCapsuleDir","Network","getGraphOpts","getGraphIds","successorsSubgraph","compsAndDepsIds","nodes","node","attr","existingCompsIds","Promise","all","existing","includeFromNestedHosts","hasIdNested","hasId","undefined","existingComps","compact","datedCapsuleDir","info","registerOnBeforeExit","allDirs","getAllCapsulesDirsFromRoot","moveCapsulesLockFileToTargetDir","moveCapsulesToTargetDir","rootDir","fs","readdir","withFileTypes","capsuleDirents","dir","isDirectory","capsulesDirs","sourceRootDir","promises","sourceDir","dirname","basename","sourceLockFile","pathExistsSync","_movedLockFiles","console","targetDir","targetLockFile","targetLockFileExists","pathExists","remove","mvFunc","getCapsuleTransferFn","add","err","error","sourceCapsuleReadyFile","getCapsuleReadyFilePath","targetCapsuleReadyFile","rimraf","sync","removeCapsuleReadyFileSync","moveWithTempName","writeCapsuleReadyFileSync","move","tempDir","v4","exists","capsulesDir","linkingOptions","linkTeambitBit","linkCoreAspects","linker","getLinker","linkingContext","inCapsule","linkedRootDeps","calculateLinkedDeps","ComponentMap","create","createLinks","skipIfSymlinkValid","alwaysNew","getExistingAsIs","installOptions","useNesting","realCapsulesDir","allCapsulesExists","every","Capsule","getCapsuleDirName","readyFilePath","existsSync","cloneCapsule","originalCapsule","newBaseDir","network","clonedCapsule","seedersCapsules","copy","components","longProcessLogger","context","aspects","wsPath","workspaceName","createLongProcessLogger","chalk","cyan","bold","isolatedCapsules","emptyRootDir","supportsDedupingOnExistingRoot","config","emptyDir","capsules","createCapsulesFromComponents","allCapsuleList","CapsuleList","fromArray","end","skipIfExists","existingCapsules","capsule","capsulesWithPackagesData","getCapsulesPreviousPackageJson","writeComponentsInCapsules","updateWithCurrentPackageJsonData","cachePackagesOnCapsulesRoot","installLongProcessLogger","rootLinks","linkInCapsulesRoot","index","newCapsuleList","cacheCapsuleDir","lockFilePath","lockExists","copyFile","linkedDependencies","linkInCapsules","installInCapsules","packageManager","nodeLinker","capsuleWithPackageData","currentPackageJson","writeFileSync","PACKAGE_JSON","markCapsulesAsReady","capsuleListOutput","consoleSuccess","markCapsuleAsReady","writeFile","capsulePath","exist","removeSync","isolateInstallOptions","installer","getInstaller","cacheRootDirectory","installingContext","peerOnlyPolicy","getWorkspacePeersOnlyPolicy","installTeambitBit","packageManagerConfigRootDir","resolveVersionsFromDependenciesOnly","forceTeambitHarmonyLink","hasHarmonyInRootPolicy","excludeExtensionsDependencies","dedupeInjectedDeps","packageManagerInstallOptions","autoInstallPeers","nmSelfReferences","capsuleSelfReference","overrides","capsulesOverrides","hoistPatterns","rootComponentsForCapsules","keepExistingModulesDir","hasRootComponents","hoistWorkspacePackages","install","toComponentMap","nestedLinks","capsulesWithModifiedPackageJson","getCapsulesWithModifiedPackageJson","symlinkDependenciesToCapsules","linkNestedDepsInNM","symlinkOnCapsuleRoot","coreAspectIds","getCoreAspectIds","coreAspectCapsules","compIdWithoutVersion","split","includes","toLocalLinks","localLinks","link","linkDetailToLocalDepEntry","fromEntries","linkDetail","packageName","from","packageJsonHasChanged","wereDependenciesInPackageJsonChanged","modifiedComps","unmodifiedComps","capsuleUsePreviouslySavedDists","legacyUnmodifiedComps","state","_consumer","clone","legacyModifiedComps","legacyComponents","importMultipleDistsArtifacts","allIds","ComponentIdList","c","getCapsule","scope","populateArtifactsFrom","dataToPersist","populateComponentsFilesToWriteForCapsule","persistAllToCapsule","keepExistingCapsule","workspacePolicy","getWorkspacePolicy","byLifecycleType","tuples","list","withoutNodeModules","capsuleFullPaths","code","registerCapsuleTransferFn","fn","register","values","getDefaultCapsuleTransferFn","source","target","overwrite","getCapsuleDirOpts","useHash","datedDirId","getCapsuleDirOptsWithDefaults","capsulesRootBaseDir","getRootDirOfAllCapsules","date","Date","month","getMonth","dateDir","getFullYear","getDate","defaultDatedBaseDir","datedBaseDir","getSync","CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR","hashDir","finalDatedDirId","_datedHashForName","hash","substring","deleteCapsules","dirToDelete","pMap","createFromComponent","concurrency","concurrentComponentsLimit","getGlobalCapsulesBaseDir","previousPackageJson","DEPENDENCIES_FIELDS","some","field","packageJsonPath","previousPackageJsonRaw","readFile","encoding","parse","packageJson","getCurrentPackageJson","found","packageJsonObject","currentVersion","getComponentPackageVersion","getComponentDepsManifest","dependencies","manifest","devDependencies","peerDependencies","compDeps","toTypeArray","dep","depCapsule","componentId","version","snapToSemver","keyName","KEY_NAME_BY_LIFECYCLE_TYPE","lifecycle","entry","toManifest","versionRange","deps","getDependencies","PackageJsonFile","loadFromCapsuleSync","addDependencies","packageJsonFile","addDevDependencies","addPeerDependencies","addOrUpdateProperty","ids","legacyComp","DataToPersist","clonedFiles","files","file","writeToPath","updatePaths","newBase","removePath","RemovePath","addFile","preparePackageJsonToWrite","semver","inc","PackageJsonTransformer","applyTransformers","valuesToMerge","componentOverridesPackageJsonData","mergePackageJsonObject","toVinylFile","artifacts","getArtifacts","addManyFiles","bitDir","ignoreBitDependencies","getBitDependencies","reduce","acc","depId","Array","isArray","searchWithoutVersion","packageDependency","componentIdToPackageName","isDependency","bitDependencies","getAllIds","bitDevDependencies","bitExtensionDependencies","extensions","extensionsBitIds","main","pathNormalizeToLinux","mainFile","buildStatus","artifactFilesToFetch","compParent","getConsumerComponent","getArtifactFilesExcludeExtension","extensionsNamesForArtifacts","flatten","extName","getArtifactFilesByExtension","artifactsFiles","artifactsVinylFlattened","artifactFiles","ArtifactFiles","deserializeArtifactFiles","vinylFiles","getVinylsAndImportIfMissing","artifactsDir","writtenPath","MainRuntime","DependencyResolverAspect","LoggerAspect","ComponentAspect","GraphAspect","GlobalConfigAspect","AspectLoaderAspect","CLIAspect","Slot","withType","addRuntime"],"sources":["isolator.main.runtime.ts"],"sourcesContent":["import rimraf from 'rimraf';\nimport { v4 } from 'uuid';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\nimport chalk from 'chalk';\nimport { compact, flatten, isEqual, pick } from 'lodash';\nimport { AspectLoaderMain, AspectLoaderAspect } from '@teambit/aspect-loader';\nimport { Component, ComponentMap, ComponentAspect } from '@teambit/component';\nimport type { ComponentMain, ComponentFactory } from '@teambit/component';\nimport { getComponentPackageVersion, snapToSemver } from '@teambit/component-package-version';\nimport { createLinks } from '@teambit/dependencies.fs.linked-dependencies';\nimport { GraphAspect, GraphMain } from '@teambit/graph';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport {\n DependencyResolverAspect,\n DependencyResolverMain,\n LinkingOptions,\n LinkDetail,\n WorkspacePolicy,\n InstallOptions,\n DependencyList,\n ComponentDependency,\n KEY_NAME_BY_LIFECYCLE_TYPE,\n PackageManagerInstallOptions,\n NodeLinker,\n} from '@teambit/dependency-resolver';\nimport { Logger, LoggerAspect, LoggerMain, LongProcessLogger } from '@teambit/logger';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport LegacyScope from '@teambit/legacy/dist/scope/scope';\nimport { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config';\nimport {\n DEPENDENCIES_FIELDS,\n PACKAGE_JSON,\n CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR,\n} from '@teambit/legacy/dist/constants';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport {\n ArtifactFiles,\n deserializeArtifactFiles,\n getArtifactFilesByExtension,\n getArtifactFilesExcludeExtension,\n importMultipleDistsArtifacts,\n} from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport fs, { copyFile } from 'fs-extra';\nimport hash from 'object-hash';\nimport path, { basename } from 'path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { PackageJsonTransformer } from '@teambit/workspace.modules.node-modules-linker';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { concurrentComponentsLimit } from '@teambit/legacy/dist/utils/concurrency';\nimport pMap from 'p-map';\nimport { Capsule } from './capsule';\nimport CapsuleList from './capsule-list';\nimport { IsolatorAspect } from './isolator.aspect';\nimport { symlinkOnCapsuleRoot, symlinkDependenciesToCapsules } from './symlink-dependencies-to-capsules';\nimport { Network } from './network';\n\nexport type ListResults = {\n capsules: string[];\n};\n\nexport type CapsuleTransferFn = (sourceDir: string, targetDir: string) => Promise<void>;\n\nexport type CapsuleTransferSlot = SlotRegistry<CapsuleTransferFn>;\n\n/**\n * Context for the isolation process\n */\nexport type IsolationContext = {\n /**\n * Whether the isolation done for aspects (as opposed to regular components)\n */\n aspects?: boolean;\n\n /**\n * Workspace name where the isolation starts from\n */\n workspaceName?: string;\n};\n\n/**\n * it's normally a sha1 of the workspace/scope dir. 40 chars long. however, Windows is not happy with long paths.\n * so we use a shorter hash. the number 9 is pretty random, it's what we use for short-hash of snaps.\n * we're aware of an extremely low risk of collision. take into account that in most cases you won't have more than 10\n * capsules in the machine.\n */\nconst CAPSULE_DIR_LENGTH = 9;\n\nexport type IsolateComponentsInstallOptions = {\n installPackages?: boolean; // default: true\n // TODO: add back when depResolver.getInstaller support it\n // packageManager?: string;\n dedupe?: boolean;\n copyPeerToRuntimeOnComponents?: boolean;\n copyPeerToRuntimeOnRoot?: boolean;\n installPeersFromEnvs?: boolean;\n installTeambitBit?: boolean;\n packageManagerConfigRootDir?: string;\n // When set to true, the newly added components will be grouped inside one directory.\n // This is useful for scope aspect capsules, which are installed in stages.\n useNesting?: boolean;\n};\n\ntype CreateGraphOptions = {\n /**\n * include components that exists in nested hosts. for example include components that exist in scope but not in the workspace\n */\n includeFromNestedHosts?: boolean;\n\n /**\n * Force specific host to get the component from.\n */\n host?: ComponentFactory;\n};\n\nexport type IsolateComponentsOptions = CreateGraphOptions & {\n name?: string;\n\n /**\n * absolute path to put all the capsules dirs inside.\n */\n rootBaseDir?: string;\n\n /**\n * the capsule root-dir based on a *hash* of this baseDir, not on the baseDir itself.\n * A folder with this hash as its name will be created in the rootBaseDir\n * By default this value will be the host path\n */\n baseDir?: string;\n\n /**\n * Whether to use hash function (of base dir) as capsules root dir name\n */\n useHash?: boolean;\n\n /**\n * create a new capsule with a random string attached to the path suffix\n */\n alwaysNew?: boolean;\n\n /**\n * If this is true -\n * the isolator will check if there are missing capsules in the base dir\n * if yes, it will create the capsule in a special dir inside a dir with the current date (without time)\n * then inside that dir, it will create a dir with a random hash\n * at the end of the process it will move missing capsules from the temp dir to the base dir so they can be used in\n * the next iteration\n */\n useDatedDirs?: boolean;\n\n /**\n * If this is true -\n * the isolator will do few things:\n * 1. in the end of the process it will only move the lock file (pnpm-lock.yaml) into the capsule cache\n * 2. in the beginning of the process it will check if there is a lock file in the capsule cache, if yes it will move\n * it to the temp dated dir\n * 3. it will write env's file into the dated dir (as it only contain the lock file)\n * 4. it will run install in the dated dir (as there is no node_modules there yet)\n */\n cacheLockFileOnly?: boolean;\n\n /**\n * If set, along with useDatedDirs, then we will use the same hash dir for all capsules created with the same\n * datedDirId\n */\n datedDirId?: string;\n\n /**\n * installation options\n */\n installOptions?: IsolateComponentsInstallOptions;\n\n linkingOptions?: LinkingOptions;\n\n /**\n * delete the capsule rootDir first. it makes sure that the isolation process starts fresh with\n * no previous capsules. for build and tag this is true.\n */\n emptyRootDir?: boolean;\n\n /**\n * skip the reproduction of the capsule in case it exists.\n */\n skipIfExists?: boolean;\n\n /**\n * get existing capsule without doing any changes, no writes, no installations.\n */\n getExistingAsIs?: boolean;\n\n /**\n * place the package-manager cache on the capsule-root\n */\n cachePackagesOnCapsulesRoot?: boolean;\n\n /**\n * do not build graph with all dependencies. isolate the seeders only.\n */\n seedersOnly?: boolean;\n\n /**\n * relevant for tagging from scope, where we tag an existing snap without any code-changes.\n * the idea is to have all build artifacts from the previous snap and run deploy pipeline on top of it.\n */\n populateArtifactsFrom?: ComponentID[];\n\n /**\n * Force specific host to get the component from.\n */\n host?: ComponentFactory;\n\n /**\n * Use specific package manager for the isolation process (override the package manager from the dep resolver config)\n */\n packageManager?: string;\n\n /**\n * Use specific node linker for the isolation process (override the package manager from the dep resolver config)\n */\n nodeLinker?: NodeLinker;\n\n /**\n * Dir where to read the package manager config from\n * usually used when running package manager in the capsules dir to use the config\n * from the workspace dir\n */\n packageManagerConfigRootDir?: string;\n\n context?: IsolationContext;\n\n /**\n * Root dir of capsulse cache (used mostly to copy lock file if used with cache lock file only option)\n */\n cacheCapsulesDir?: string;\n};\n\ntype GetCapsuleDirOpts = Pick<\n IsolateComponentsOptions,\n 'datedDirId' | 'useHash' | 'rootBaseDir' | 'useDatedDirs' | 'cacheLockFileOnly'\n> & {\n baseDir: string;\n};\n\ntype CapsulePackageJsonData = {\n capsule: Capsule;\n currentPackageJson?: Record<string, any>;\n previousPackageJson: Record<string, any> | null;\n};\n\nconst DEFAULT_ISOLATE_INSTALL_OPTIONS: IsolateComponentsInstallOptions = {\n installPackages: true,\n dedupe: true,\n installPeersFromEnvs: true,\n copyPeerToRuntimeOnComponents: false,\n copyPeerToRuntimeOnRoot: true,\n};\n\n/**\n * File name to indicate that the capsule is ready (all packages are installed and links are created)\n */\nexport const CAPSULE_READY_FILE = '.bit-capsule-ready';\n\nexport class IsolatorMain {\n static runtime = MainRuntime;\n static dependencies = [\n DependencyResolverAspect,\n LoggerAspect,\n ComponentAspect,\n GraphAspect,\n GlobalConfigAspect,\n AspectLoaderAspect,\n CLIAspect,\n ];\n static slots = [Slot.withType<CapsuleTransferFn>()];\n static defaultConfig = {};\n _componentsPackagesVersionCache: { [idStr: string]: string } = {}; // cache packages versions of components\n _datedHashForName = new Map<string, string>(); // cache dated hash for a specific name\n _movedLockFiles = new Set(); // cache moved lock files to avoid show warning about them\n\n static async provider(\n [dependencyResolver, loggerExtension, componentAspect, graphMain, globalConfig, aspectLoader, cli]: [\n DependencyResolverMain,\n LoggerMain,\n ComponentMain,\n GraphMain,\n GlobalConfigMain,\n AspectLoaderMain,\n CLIMain\n ],\n _config,\n [capsuleTransferSlot]: [CapsuleTransferSlot]\n ): Promise<IsolatorMain> {\n const logger = loggerExtension.createLogger(IsolatorAspect.id);\n const isolator = new IsolatorMain(\n dependencyResolver,\n logger,\n componentAspect,\n graphMain,\n cli,\n globalConfig,\n aspectLoader,\n capsuleTransferSlot\n );\n return isolator;\n }\n constructor(\n private dependencyResolver: DependencyResolverMain,\n private logger: Logger,\n private componentAspect: ComponentMain,\n private graph: GraphMain,\n private cli: CLIMain,\n private globalConfig: GlobalConfigMain,\n private aspectLoader: AspectLoaderMain,\n private capsuleTransferSlot: CapsuleTransferSlot\n ) {}\n\n // TODO: the legacy scope used for the component writer, which then decide if it need to write the artifacts and dists\n // TODO: we should think of another way to provide it (maybe a new opts) then take the scope internally from the host\n async isolateComponents(\n seeders: ComponentID[],\n opts: IsolateComponentsOptions,\n legacyScope?: LegacyScope\n ): Promise<Network> {\n const host = opts.host || this.componentAspect.getHost();\n this.logger.debug(\n `isolateComponents, ${seeders.join(', ')}. opts: ${JSON.stringify(\n Object.assign({}, opts, { host: opts.host?.name })\n )}`\n );\n const createGraphOpts = pick(opts, ['includeFromNestedHosts', 'host']);\n const componentsToIsolate = opts.seedersOnly\n ? await host.getMany(seeders)\n : await this.createGraph(seeders, createGraphOpts);\n this.logger.debug(`isolateComponents, total componentsToIsolate: ${componentsToIsolate.length}`);\n const seedersWithVersions = seeders.map((seeder) => {\n if (seeder._legacy.hasVersion()) return seeder;\n const comp = componentsToIsolate.find((component) => component.id.isEqual(seeder, { ignoreVersion: true }));\n if (!comp) throw new Error(`unable to find seeder ${seeder.toString()} in componentsToIsolate`);\n return comp.id;\n });\n opts.baseDir = opts.baseDir || host.path;\n const shouldUseDatedDirs = this.shouldUseDatedDirs(componentsToIsolate, opts);\n const capsuleDir = this.getCapsulesRootDir({\n ...opts,\n useDatedDirs: shouldUseDatedDirs,\n baseDir: opts.baseDir || '',\n });\n const cacheCapsulesDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n opts.cacheCapsulesDir = cacheCapsulesDir;\n const capsuleList = await this.createCapsules(componentsToIsolate, capsuleDir, opts, legacyScope);\n this.logger.debug(\n `creating network with base dir: ${opts.baseDir}, rootBaseDir: ${opts.rootBaseDir}. final capsule-dir: ${capsuleDir}. capsuleList: ${capsuleList.length}`\n );\n const cacheCapsules = process.env.CACHE_CAPSULES || opts.cacheLockFileOnly;\n if (shouldUseDatedDirs && cacheCapsules) {\n const targetCapsuleDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n this.registerMoveCapsuleOnProcessExit(capsuleDir, targetCapsuleDir, opts.cacheLockFileOnly);\n // TODO: ideally this should be inside the on process exit hook\n // but this is an async op which make it a bit hard\n await this.relinkCoreAspectsInCapsuleDir(targetCapsuleDir);\n }\n return new Network(capsuleList, seedersWithVersions, capsuleDir);\n }\n\n private async createGraph(seeders: ComponentID[], opts: CreateGraphOptions = {}): Promise<Component[]> {\n const host = opts.host || this.componentAspect.getHost();\n const getGraphOpts = pick(opts, ['host']);\n const graph = await this.graph.getGraphIds(seeders, getGraphOpts);\n const successorsSubgraph = graph.successorsSubgraph(seeders.map((id) => id.toString()));\n const compsAndDepsIds = successorsSubgraph.nodes.map((node) => node.attr);\n // do not ignore the version here. a component might be in .bitmap with one version and\n // installed as a package with another version. we don't want them both.\n const existingCompsIds = await Promise.all(\n compsAndDepsIds.map(async (id) => {\n let existing;\n if (opts.includeFromNestedHosts) {\n existing = await host.hasIdNested(id, true);\n } else {\n existing = await host.hasId(id);\n }\n if (existing) return id;\n return undefined;\n })\n );\n const existingComps = await host.getMany(compact(existingCompsIds));\n return existingComps;\n }\n\n private registerMoveCapsuleOnProcessExit(\n datedCapsuleDir: string,\n targetCapsuleDir: string,\n cacheLockFileOnly = false\n ): void {\n this.logger.info(`registering process.on(exit) to move capsules from ${datedCapsuleDir} to ${targetCapsuleDir}`);\n this.cli.registerOnBeforeExit(async () => {\n const allDirs = await this.getAllCapsulesDirsFromRoot(datedCapsuleDir);\n if (cacheLockFileOnly) {\n await this.moveCapsulesLockFileToTargetDir(allDirs, datedCapsuleDir, targetCapsuleDir);\n } else {\n await this.moveCapsulesToTargetDir(allDirs, datedCapsuleDir, targetCapsuleDir);\n }\n });\n }\n\n private async getAllCapsulesDirsFromRoot(rootDir: string): Promise<string[]> {\n const allDirs = await fs.readdir(rootDir, { withFileTypes: true });\n const capsuleDirents = allDirs.filter((dir) => dir.isDirectory() && dir.name !== 'node_modules');\n return capsuleDirents.map((dir) => path.join(rootDir, dir.name));\n }\n\n private async moveCapsulesLockFileToTargetDir(\n capsulesDirs: string[],\n sourceRootDir: string,\n targetCapsuleDir: string\n ): Promise<void> {\n this.logger.info(`start moving lock files from ${sourceRootDir} to ${targetCapsuleDir}`);\n const promises = capsulesDirs.map(async (sourceDir) => {\n const dirname = path.basename(sourceDir);\n const sourceLockFile = path.join(sourceDir, 'pnpm-lock.yaml');\n // Lock file is not exist, don't copy it to the cache\n if (!fs.pathExistsSync(sourceLockFile)) {\n // It was already moved during the process, do not show the log for it\n if (!this._movedLockFiles.has(sourceLockFile)) {\n this.logger.console(`skipping moving lock file to cache as it is not exist ${sourceDir}`);\n }\n return;\n }\n const targetDir = path.join(targetCapsuleDir, dirname);\n const targetLockFile = path.join(targetDir, 'pnpm-lock.yaml');\n const targetLockFileExists = await fs.pathExists(targetLockFile);\n if (targetLockFileExists) {\n // Lock file is already in the cache, no need to move it\n // this.logger.console(`skipping moving lock file to cache as it is already exist at ${targetDir}`);\n\n // Delete existing lock file so we can update it\n await fs.remove(targetLockFile);\n return;\n }\n this.logger.debug(`moving lock file from ${sourceLockFile} to ${targetDir}`);\n const mvFunc = this.getCapsuleTransferFn();\n try {\n await mvFunc(sourceLockFile, path.join(targetDir, 'pnpm-lock.yaml'));\n this._movedLockFiles.add(sourceLockFile);\n } catch (err) {\n this.logger.error(`failed moving lock file from ${sourceLockFile} to ${targetDir}`, err);\n }\n });\n await Promise.all(promises);\n }\n\n private async moveCapsulesToTargetDir(\n capsulesDirs: string[],\n sourceRootDir: string,\n targetCapsuleDir: string\n ): Promise<void> {\n this.logger.info(`start moving capsules from ${sourceRootDir} to ${targetCapsuleDir}`);\n const promises = capsulesDirs.map(async (sourceDir) => {\n const dirname = path.basename(sourceDir);\n const sourceCapsuleReadyFile = this.getCapsuleReadyFilePath(sourceDir);\n if (!fs.pathExistsSync(sourceCapsuleReadyFile)) {\n // Capsule is not ready, don't copy it to the cache\n this.logger.console(`skipping moving capsule to cache as it is not ready ${sourceDir}`);\n return;\n }\n const targetDir = path.join(targetCapsuleDir, dirname);\n if (fs.pathExistsSync(path.join(targetCapsuleDir, dirname))) {\n const targetCapsuleReadyFile = this.getCapsuleReadyFilePath(targetDir);\n if (fs.pathExistsSync(targetCapsuleReadyFile)) {\n // Capsule is already in the cache, no need to move it\n this.logger.console(`skipping moving capsule to cache as it is already exist at ${targetDir}`);\n return;\n }\n this.logger.console(`cleaning target capsule location as it's not ready at: ${targetDir}`);\n rimraf.sync(targetDir);\n }\n this.logger.console(`moving specific capsule from ${sourceDir} to ${targetDir}`);\n // We delete the ready file path first, as the move might take a long time, so we don't want to move\n // the ready file indicator before the capsule is ready in the new location\n this.removeCapsuleReadyFileSync(sourceDir);\n await this.moveWithTempName(sourceDir, targetDir, this.getCapsuleTransferFn());\n // Mark the capsule as ready in the new location\n this.writeCapsuleReadyFileSync(targetDir);\n });\n await Promise.all(promises);\n }\n\n /**\n * The function moves a directory from a source location to a target location using a temporary directory.\n * This is using temp dir because sometime the source dir and target dir might be in different FS\n * (for example different mounts) which means the move might take a long time\n * during the time of moving, another process will see that the capsule is not ready and will try to remove then\n * move it again, which lead to the first process throwing an error\n * @param sourceDir - The source directory from where the files or directories will be moved.\n * @param targetDir - The target directory where the source directory will be moved to.\n */\n private async moveWithTempName(sourceDir, targetDir, mvFunc: Function = fs.move): Promise<void> {\n const tempDir = `${targetDir}-${v4()}`;\n this.logger.console(`moving capsule from ${sourceDir} to a temp dir ${tempDir}`);\n await mvFunc(sourceDir, tempDir);\n const exists = await fs.pathExists(targetDir);\n // This might exist if in the time when we move to the temp dir, another process created the target dir already\n if (exists) {\n this.logger.console(`skip moving capsule from temp dir to real dir as it's already exist: ${targetDir}`);\n // Clean leftovers\n await rimraf(tempDir);\n return;\n }\n this.logger.console(`moving capsule from a temp dir ${tempDir} to the target dir ${targetDir}`);\n await mvFunc(tempDir, targetDir);\n }\n\n /**\n * Re-create the core aspects links in the real capsule dir\n * This is required mainly for the first time when that folder is empty\n */\n private async relinkCoreAspectsInCapsuleDir(capsulesDir: string): Promise<void> {\n const linkingOptions = {\n linkTeambitBit: true,\n linkCoreAspects: true,\n };\n const linker = this.dependencyResolver.getLinker({\n rootDir: capsulesDir,\n linkingOptions,\n linkingContext: { inCapsule: true },\n });\n const { linkedRootDeps } = await linker.calculateLinkedDeps(capsulesDir, ComponentMap.create([]), linkingOptions);\n // This links are in the global cache which used by many process\n // we don't want to delete and re-create the links if they already exist and valid\n return createLinks(capsulesDir, linkedRootDeps, { skipIfSymlinkValid: true });\n }\n\n private shouldUseDatedDirs(componentsToIsolate: Component[], opts: IsolateComponentsOptions): boolean {\n if (!opts.useDatedDirs) return false;\n // No need to use the dated dirs in case we anyway create new capsule for each one\n if (opts.alwaysNew) return false;\n // if (opts.skipIfExists) return false;\n // no point to use dated dir in case of getExistingAsIs as it will be just always empty\n if (opts.getExistingAsIs) return false;\n // Do not use the dated dirs in case we don't use nesting, as the capsules\n // will not work after moving to the real dir\n if (!opts.installOptions?.useNesting) return false;\n // Getting the real capsule dir to check if all capsules exists\n const realCapsulesDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n // validate all capsules in the real location exists and valid\n const allCapsulesExists = componentsToIsolate.every((component) => {\n const capsuleDir = path.join(realCapsulesDir, Capsule.getCapsuleDirName(component));\n const readyFilePath = this.getCapsuleReadyFilePath(capsuleDir);\n return fs.existsSync(capsuleDir) && fs.existsSync(readyFilePath);\n });\n if (allCapsulesExists) {\n this.logger.debug(\n `All required capsules already exists and valid in the real (cached) location: ${realCapsulesDir}`\n );\n return false;\n }\n this.logger.debug(\n `Missing required capsules in the real (cached) location: ${realCapsulesDir}, using dated (temp) dir`\n );\n return true;\n }\n\n /**\n *\n * @param originalCapsule the capsule that contains the original component\n * @param newBaseDir relative path. (it will be saved inside `this.getRootDirOfAllCapsules()`. the final path of the capsule will be getRootDirOfAllCapsules() + newBaseDir + filenameify(component.id))\n * @returns a new capsule with the same content of the original capsule but with a new baseDir and all packages\n * installed in the newBaseDir.\n */\n async cloneCapsule(originalCapsule: Capsule, newBaseDir: string): Promise<Capsule> {\n const network = await this.isolateComponents([originalCapsule.component.id], { baseDir: newBaseDir });\n const clonedCapsule = network.seedersCapsules[0];\n await fs.copy(originalCapsule.path, clonedCapsule.path);\n return clonedCapsule;\n }\n\n /**\n * Create capsules for the provided components\n * do not use this outside directly, use isolate components which build the entire network\n * @param components\n * @param opts\n * @param legacyScope\n */\n private async createCapsules(\n components: Component[],\n capsulesDir: string,\n opts: IsolateComponentsOptions,\n legacyScope?: Scope\n ): Promise<CapsuleList> {\n this.logger.debug(`createCapsules, ${components.length} components`);\n\n let longProcessLogger;\n if (opts.context?.aspects) {\n // const wsPath = opts.host?.path || 'unknown';\n const wsPath = opts.context.workspaceName || opts.host?.path || opts.name || 'unknown';\n longProcessLogger = this.logger.createLongProcessLogger(\n `ensuring ${chalk.cyan(components.length.toString())} capsule(s) for all envs and aspects for ${chalk.bold(\n wsPath\n )} at ${chalk.bold(capsulesDir)}`\n );\n }\n const useNesting = this.dependencyResolver.isolatedCapsules() && opts.installOptions?.useNesting;\n const installOptions = {\n ...DEFAULT_ISOLATE_INSTALL_OPTIONS,\n ...opts.installOptions,\n useNesting,\n };\n if (!opts.emptyRootDir) {\n installOptions.dedupe = installOptions.dedupe && this.dependencyResolver.supportsDedupingOnExistingRoot();\n }\n\n const config = { installPackages: true, ...opts };\n if (opts.emptyRootDir) {\n await fs.emptyDir(capsulesDir);\n }\n let capsules = await this.createCapsulesFromComponents(components, capsulesDir, config);\n const allCapsuleList = CapsuleList.fromArray(capsules);\n let capsuleList = allCapsuleList;\n if (opts.getExistingAsIs) {\n longProcessLogger?.end();\n\n return capsuleList;\n }\n\n if (opts.skipIfExists) {\n if (!installOptions.useNesting) {\n const existingCapsules = CapsuleList.fromArray(\n capsuleList.filter((capsule) => capsule.fs.existsSync('package.json'))\n );\n\n if (existingCapsules.length === capsuleList.length) {\n longProcessLogger?.end();\n return existingCapsules;\n }\n } else {\n capsules = capsules.filter((capsule) => !capsule.fs.existsSync('package.json'));\n capsuleList = CapsuleList.fromArray(capsules);\n }\n }\n const capsulesWithPackagesData = await this.getCapsulesPreviousPackageJson(capsules);\n\n await this.writeComponentsInCapsules(components, capsuleList, legacyScope, opts);\n await this.updateWithCurrentPackageJsonData(capsulesWithPackagesData, capsuleList);\n if (installOptions.installPackages) {\n const cachePackagesOnCapsulesRoot = opts.cachePackagesOnCapsulesRoot ?? false;\n const linkingOptions = opts.linkingOptions ?? {};\n let installLongProcessLogger: LongProcessLogger | undefined;\n // Only show the log message in case we are going to install something\n if (capsuleList && capsuleList.length && !opts.context?.aspects) {\n installLongProcessLogger = this.logger.createLongProcessLogger(\n `install packages in ${capsuleList.length} capsules`\n );\n }\n const rootLinks = await this.linkInCapsulesRoot(capsulesDir, capsuleList, linkingOptions);\n if (installOptions.useNesting) {\n await Promise.all(\n capsuleList.map(async (capsule, index) => {\n const newCapsuleList = CapsuleList.fromArray([capsule]);\n if (opts.cacheCapsulesDir && capsulesDir !== opts.cacheCapsulesDir && opts.cacheLockFileOnly) {\n const cacheCapsuleDir = path.join(opts.cacheCapsulesDir, basename(capsule.path));\n const lockFilePath = path.join(cacheCapsuleDir, 'pnpm-lock.yaml');\n const lockExists = await fs.pathExists(lockFilePath);\n if (lockExists) {\n try {\n // this.logger.console(`moving lock file from ${lockFilePath} to ${capsule.path}`);\n await copyFile(lockFilePath, path.join(capsule.path, 'pnpm-lock.yaml'));\n } catch (err) {\n // We can ignore the error, we don't want to break the flow. the file will be anyway re-generated\n // in the target capsule. it will only be a bit slower.\n this.logger.error(\n `failed moving lock file from cache folder path: ${lockFilePath} to local capsule at ${capsule.path} (even though the lock file seems to exist)`,\n err\n );\n }\n }\n }\n const linkedDependencies = await this.linkInCapsules(newCapsuleList, capsulesWithPackagesData);\n if (index === 0) {\n linkedDependencies[capsulesDir] = rootLinks;\n }\n await this.installInCapsules(capsule.path, newCapsuleList, installOptions, {\n cachePackagesOnCapsulesRoot,\n linkedDependencies,\n packageManager: opts.packageManager,\n nodeLinker: opts.nodeLinker,\n });\n })\n );\n } else {\n const linkedDependencies = await this.linkInCapsules(capsuleList, capsulesWithPackagesData);\n linkedDependencies[capsulesDir] = rootLinks;\n await this.installInCapsules(capsulesDir, capsuleList, installOptions, {\n cachePackagesOnCapsulesRoot,\n linkedDependencies,\n packageManager: opts.packageManager,\n });\n }\n if (installLongProcessLogger) {\n installLongProcessLogger.end('success');\n }\n }\n\n // rewrite the package-json with the component dependencies in it. the original package.json\n // that was written before, didn't have these dependencies in order for the package-manager to\n // be able to install them without crushing when the versions don't exist yet\n capsulesWithPackagesData.forEach((capsuleWithPackageData) => {\n const { currentPackageJson, capsule } = capsuleWithPackageData;\n if (!currentPackageJson)\n throw new Error(\n `isolator.createCapsules, unable to find currentPackageJson for ${capsule.component.id.toString()}`\n );\n capsuleWithPackageData.capsule.fs.writeFileSync(PACKAGE_JSON, JSON.stringify(currentPackageJson, null, 2));\n });\n await this.markCapsulesAsReady(capsuleList);\n if (longProcessLogger) {\n longProcessLogger.end();\n }\n // Only show this message if at least one new capsule created\n if (longProcessLogger && capsuleList.length) {\n // this.logger.consoleSuccess();\n const capsuleListOutput = allCapsuleList.map((capsule) => capsule.component.id.toString()).join(', ');\n this.logger.consoleSuccess(`resolved aspect(s): ${chalk.cyan(capsuleListOutput)}`);\n }\n\n return allCapsuleList;\n }\n\n private async markCapsulesAsReady(capsuleList: CapsuleList): Promise<void> {\n await Promise.all(\n capsuleList.map(async (capsule) => {\n return this.markCapsuleAsReady(capsule);\n })\n );\n }\n\n private async markCapsuleAsReady(capsule: Capsule): Promise<void> {\n const readyFilePath = this.getCapsuleReadyFilePath(capsule.path);\n return fs.writeFile(readyFilePath, '');\n }\n\n private removeCapsuleReadyFileSync(capsulePath: string): void {\n const readyFilePath = this.getCapsuleReadyFilePath(capsulePath);\n const exist = fs.pathExistsSync(readyFilePath);\n if (!exist) return;\n fs.removeSync(readyFilePath);\n }\n\n private writeCapsuleReadyFileSync(capsulePath: string): void {\n const readyFilePath = this.getCapsuleReadyFilePath(capsulePath);\n const exist = fs.pathExistsSync(readyFilePath);\n if (exist) return;\n fs.writeFileSync(readyFilePath, '');\n }\n\n private getCapsuleReadyFilePath(capsulePath: string): string {\n return path.join(capsulePath, CAPSULE_READY_FILE);\n }\n\n private async installInCapsules(\n capsulesDir: string,\n capsuleList: CapsuleList,\n isolateInstallOptions: IsolateComponentsInstallOptions,\n opts: {\n cachePackagesOnCapsulesRoot?: boolean;\n linkedDependencies?: Record<string, Record<string, string>>;\n packageManager?: string;\n nodeLinker?: NodeLinker;\n }\n ) {\n const installer = this.dependencyResolver.getInstaller({\n rootDir: capsulesDir,\n cacheRootDirectory: opts.cachePackagesOnCapsulesRoot ? capsulesDir : undefined,\n installingContext: { inCapsule: true },\n packageManager: opts.packageManager,\n nodeLinker: opts.nodeLinker,\n });\n // When using isolator we don't want to use the policy defined in the workspace directly,\n // we only want to instal deps from components and the peer from the workspace\n\n const peerOnlyPolicy = this.getWorkspacePeersOnlyPolicy();\n const installOptions: InstallOptions = {\n installTeambitBit: !!isolateInstallOptions.installTeambitBit,\n packageManagerConfigRootDir: isolateInstallOptions.packageManagerConfigRootDir,\n resolveVersionsFromDependenciesOnly: true,\n linkedDependencies: opts.linkedDependencies,\n forceTeambitHarmonyLink: !this.dependencyResolver.hasHarmonyInRootPolicy(),\n excludeExtensionsDependencies: true,\n dedupeInjectedDeps: true,\n };\n\n const packageManagerInstallOptions: PackageManagerInstallOptions = {\n autoInstallPeers: this.dependencyResolver.config.autoInstallPeers,\n dedupe: isolateInstallOptions.dedupe,\n copyPeerToRuntimeOnComponents: isolateInstallOptions.copyPeerToRuntimeOnComponents,\n copyPeerToRuntimeOnRoot: isolateInstallOptions.copyPeerToRuntimeOnRoot,\n installPeersFromEnvs: isolateInstallOptions.installPeersFromEnvs,\n nmSelfReferences: this.dependencyResolver.config.capsuleSelfReference,\n overrides: this.dependencyResolver.config.capsulesOverrides || this.dependencyResolver.config.overrides,\n hoistPatterns: this.dependencyResolver.config.hoistPatterns,\n rootComponentsForCapsules: this.dependencyResolver.isolatedCapsules(),\n useNesting: isolateInstallOptions.useNesting,\n keepExistingModulesDir: this.dependencyResolver.isolatedCapsules(),\n hasRootComponents: this.dependencyResolver.isolatedCapsules(),\n hoistWorkspacePackages: true,\n };\n await installer.install(\n capsulesDir,\n peerOnlyPolicy,\n this.toComponentMap(capsuleList),\n installOptions,\n packageManagerInstallOptions\n );\n }\n\n private async linkInCapsules(\n capsuleList: CapsuleList,\n capsulesWithPackagesData: CapsulePackageJsonData[]\n ): Promise<Record<string, Record<string, string>>> {\n let nestedLinks: Record<string, Record<string, string>> | undefined;\n if (!this.dependencyResolver.isolatedCapsules()) {\n const capsulesWithModifiedPackageJson = this.getCapsulesWithModifiedPackageJson(capsulesWithPackagesData);\n nestedLinks = await symlinkDependenciesToCapsules(capsulesWithModifiedPackageJson, capsuleList, this.logger);\n }\n return nestedLinks ?? {};\n }\n\n private async linkInCapsulesRoot(\n capsulesDir: string,\n capsuleList: CapsuleList,\n linkingOptions: LinkingOptions\n ): Promise<Record<string, string>> {\n const linker = this.dependencyResolver.getLinker({\n rootDir: capsulesDir,\n linkingOptions,\n linkingContext: { inCapsule: true },\n });\n const { linkedRootDeps } = await linker.calculateLinkedDeps(capsulesDir, this.toComponentMap(capsuleList), {\n ...linkingOptions,\n linkNestedDepsInNM: !this.dependencyResolver.isolatedCapsules() && linkingOptions.linkNestedDepsInNM,\n });\n let rootLinks: LinkDetail[] | undefined;\n if (!this.dependencyResolver.isolatedCapsules()) {\n rootLinks = await symlinkOnCapsuleRoot(capsuleList, this.logger, capsulesDir);\n } else {\n const coreAspectIds = this.aspectLoader.getCoreAspectIds();\n const coreAspectCapsules = CapsuleList.fromArray(\n capsuleList.filter((capsule) => {\n const [compIdWithoutVersion] = capsule.component.id.toString().split('@');\n return coreAspectIds.includes(compIdWithoutVersion);\n })\n );\n rootLinks = await symlinkOnCapsuleRoot(coreAspectCapsules, this.logger, capsulesDir);\n }\n return {\n ...linkedRootDeps,\n ...this.toLocalLinks(rootLinks),\n };\n }\n\n private toLocalLinks(rootLinks: LinkDetail[] | undefined): Record<string, string> {\n const localLinks: Array<[string, string]> = [];\n if (rootLinks) {\n rootLinks.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link));\n });\n }\n return Object.fromEntries(localLinks.map(([key, value]) => [key, `link:${value}`]));\n }\n\n private linkDetailToLocalDepEntry(linkDetail: LinkDetail): [string, string] {\n return [linkDetail.packageName, linkDetail.from];\n }\n\n private getCapsulesWithModifiedPackageJson(capsulesWithPackagesData: CapsulePackageJsonData[]) {\n const capsulesWithModifiedPackageJson: Capsule[] = capsulesWithPackagesData\n .filter((capsuleWithPackageData) => {\n const packageJsonHasChanged = this.wereDependenciesInPackageJsonChanged(capsuleWithPackageData);\n // @todo: when a component is tagged, it changes all package-json of its dependents, but it\n // should not trigger any \"npm install\" because they dependencies are symlinked by us\n return packageJsonHasChanged;\n })\n .map((capsuleWithPackageData) => capsuleWithPackageData.capsule);\n return capsulesWithModifiedPackageJson;\n }\n\n private async writeComponentsInCapsules(\n components: Component[],\n capsuleList: CapsuleList,\n legacyScope?: Scope,\n opts?: IsolateComponentsOptions\n ) {\n const modifiedComps: Component[] = [];\n const unmodifiedComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n if (await CapsuleList.capsuleUsePreviouslySavedDists(component)) {\n unmodifiedComps.push(component);\n } else {\n modifiedComps.push(component);\n }\n })\n );\n const legacyUnmodifiedComps = unmodifiedComps.map((component) => component.state._consumer.clone());\n const legacyModifiedComps = modifiedComps.map((component) => component.state._consumer.clone());\n const legacyComponents = [...legacyUnmodifiedComps, ...legacyModifiedComps];\n if (legacyScope && unmodifiedComps.length) await importMultipleDistsArtifacts(legacyScope, legacyUnmodifiedComps);\n const allIds = ComponentIdList.fromArray(legacyComponents.map((c) => c.id));\n await Promise.all(\n components.map(async (component) => {\n const capsule = capsuleList.getCapsule(component.id);\n if (!capsule) return;\n const scope =\n (await CapsuleList.capsuleUsePreviouslySavedDists(component)) || opts?.populateArtifactsFrom\n ? legacyScope\n : undefined;\n const dataToPersist = await this.populateComponentsFilesToWriteForCapsule(component, allIds, scope, opts);\n await dataToPersist.persistAllToCapsule(capsule, { keepExistingCapsule: true });\n })\n );\n }\n\n private getWorkspacePeersOnlyPolicy(): WorkspacePolicy {\n const workspacePolicy = this.dependencyResolver.getWorkspacePolicy();\n const peerOnlyPolicy = workspacePolicy.byLifecycleType('peer');\n return peerOnlyPolicy;\n }\n\n private toComponentMap(capsuleList: CapsuleList): ComponentMap<string> {\n const tuples: [Component, string][] = capsuleList.map((capsule) => {\n return [capsule.component, capsule.path];\n });\n\n return ComponentMap.create(tuples);\n }\n\n async list(rootDir: string): Promise<ListResults> {\n try {\n const capsules = await fs.readdir(rootDir);\n const withoutNodeModules = capsules.filter((c) => c !== 'node_modules');\n const capsuleFullPaths = withoutNodeModules.map((c) => path.join(rootDir, c));\n return {\n capsules: capsuleFullPaths,\n };\n } catch (e: any) {\n if (e.code === 'ENOENT') {\n return { capsules: [] };\n }\n throw e;\n }\n }\n\n registerCapsuleTransferFn(fn: CapsuleTransferFn) {\n this.capsuleTransferSlot.register(fn);\n }\n\n private getCapsuleTransferFn(): CapsuleTransferFn {\n return this.capsuleTransferSlot.values()[0] || this.getDefaultCapsuleTransferFn();\n }\n\n private getDefaultCapsuleTransferFn(): CapsuleTransferFn {\n return async (source, target) => {\n return fs.move(source, target, { overwrite: true });\n };\n }\n\n /** @deprecated use the new function signature with an object parameter instead */\n getCapsulesRootDir(baseDir: string, rootBaseDir?: string, useHash?: boolean): PathOsBasedAbsolute;\n getCapsulesRootDir(getCapsuleDirOpts: GetCapsuleDirOpts): PathOsBasedAbsolute;\n getCapsulesRootDir(\n getCapsuleDirOpts: GetCapsuleDirOpts | string,\n rootBaseDir?: string,\n useHash = true,\n useDatedDirs = false,\n datedDirId?: string\n ): PathOsBasedAbsolute {\n if (typeof getCapsuleDirOpts === 'string') {\n getCapsuleDirOpts = { baseDir: getCapsuleDirOpts, rootBaseDir, useHash, useDatedDirs, datedDirId };\n }\n const getCapsuleDirOptsWithDefaults = {\n useHash: true,\n useDatedDirs: false,\n cacheLockFileOnly: false,\n ...getCapsuleDirOpts,\n };\n const capsulesRootBaseDir = getCapsuleDirOptsWithDefaults.rootBaseDir || this.getRootDirOfAllCapsules();\n if (getCapsuleDirOptsWithDefaults.useDatedDirs) {\n const date = new Date();\n const month = date.getMonth() < 12 ? date.getMonth() + 1 : 1;\n const dateDir = `${date.getFullYear()}-${month}-${date.getDate()}`;\n const defaultDatedBaseDir = 'dated-capsules';\n const datedBaseDir = this.globalConfig.getSync(CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR) || defaultDatedBaseDir;\n let hashDir;\n const finalDatedDirId = getCapsuleDirOpts.datedDirId;\n if (finalDatedDirId && this._datedHashForName.has(finalDatedDirId)) {\n // Make sure in the same process we always use the same hash for the same datedDirId\n hashDir = this._datedHashForName.get(finalDatedDirId);\n } else {\n hashDir = v4();\n if (finalDatedDirId) {\n this._datedHashForName.set(finalDatedDirId, hashDir);\n }\n }\n return path.join(capsulesRootBaseDir, datedBaseDir, dateDir, hashDir);\n }\n const dir = getCapsuleDirOptsWithDefaults.useHash\n ? hash(getCapsuleDirOptsWithDefaults.baseDir).substring(0, CAPSULE_DIR_LENGTH)\n : getCapsuleDirOptsWithDefaults.baseDir;\n return path.join(capsulesRootBaseDir, dir);\n }\n\n async deleteCapsules(rootDir?: string): Promise<string> {\n const dirToDelete = rootDir || this.getRootDirOfAllCapsules();\n await fs.remove(dirToDelete);\n return dirToDelete;\n }\n\n private async createCapsulesFromComponents(\n components: Component[],\n baseDir: string,\n opts: IsolateComponentsOptions\n ): Promise<Capsule[]> {\n this.logger.debug(`createCapsulesFromComponents: ${components.length} components`);\n const capsules: Capsule[] = await pMap(\n components,\n (component: Component) => {\n return Capsule.createFromComponent(component, baseDir, opts);\n },\n { concurrency: concurrentComponentsLimit() }\n );\n return capsules;\n }\n\n private getRootDirOfAllCapsules(): string {\n return this.globalConfig.getGlobalCapsulesBaseDir();\n }\n\n private wereDependenciesInPackageJsonChanged(capsuleWithPackageData: CapsulePackageJsonData): boolean {\n const { previousPackageJson, currentPackageJson } = capsuleWithPackageData;\n if (!previousPackageJson) return true;\n // @ts-ignore at this point, currentPackageJson is set\n return DEPENDENCIES_FIELDS.some((field) => !isEqual(previousPackageJson[field], currentPackageJson[field]));\n }\n\n private async getCapsulesPreviousPackageJson(capsules: Capsule[]): Promise<CapsulePackageJsonData[]> {\n return Promise.all(\n capsules.map(async (capsule) => {\n const packageJsonPath = path.join(capsule.path, 'package.json');\n let previousPackageJson: any = null;\n try {\n const previousPackageJsonRaw = await capsule.fs.promises.readFile(packageJsonPath, { encoding: 'utf8' });\n previousPackageJson = JSON.parse(previousPackageJsonRaw);\n } catch (e: any) {\n // package-json doesn't exist in the capsule, that's fine, it'll be considered as a cache miss\n }\n return {\n capsule,\n previousPackageJson,\n };\n })\n );\n }\n\n private async updateWithCurrentPackageJsonData(\n capsulesWithPackagesData: CapsulePackageJsonData[],\n capsules: CapsuleList\n ) {\n return Promise.all(\n capsules.map(async (capsule) => {\n const packageJson = await this.getCurrentPackageJson(capsule, capsules);\n const found = capsulesWithPackagesData.filter((c) => c.capsule.component.id.isEqual(capsule.component.id));\n if (!found.length) throw new Error(`updateWithCurrentPackageJsonData unable to find ${capsule.component.id}`);\n if (found.length > 1)\n throw new Error(\n `updateWithCurrentPackageJsonData found duplicate capsules: ${capsule.component.id.toString()}\"\"`\n );\n found[0].currentPackageJson = packageJson.packageJsonObject;\n })\n );\n }\n\n private async getCurrentPackageJson(capsule: Capsule, capsules: CapsuleList): Promise<PackageJsonFile> {\n const component: Component = capsule.component;\n const currentVersion = getComponentPackageVersion(component);\n const getComponentDepsManifest = async (dependencies: DependencyList) => {\n const manifest = {\n dependencies: {},\n devDependencies: {},\n peerDependencies: {},\n };\n const compDeps = dependencies.toTypeArray<ComponentDependency>('component');\n const promises = compDeps.map(async (dep) => {\n const depCapsule = capsules.getCapsule(dep.componentId);\n let version = dep.version;\n if (depCapsule) {\n version = getComponentPackageVersion(depCapsule?.component);\n } else {\n version = snapToSemver(version);\n }\n const keyName = KEY_NAME_BY_LIFECYCLE_TYPE[dep.lifecycle];\n const entry = dep.toManifest();\n if (entry) {\n manifest[keyName][entry.packageName] = keyName === 'peerDependencies' ? dep.versionRange : version;\n }\n });\n await Promise.all(promises);\n return manifest;\n };\n const deps = this.dependencyResolver.getDependencies(component);\n const manifest = await getComponentDepsManifest(deps);\n\n // component.packageJsonFile is not available here. we don't mutate the component object for capsules.\n // also, don't use `PackageJsonFile.createFromComponent`, as it looses the intermediate changes\n // such as postInstall scripts for custom-module-resolution.\n const packageJson = PackageJsonFile.loadFromCapsuleSync(capsule.path);\n\n const addDependencies = (packageJsonFile: PackageJsonFile) => {\n packageJsonFile.addDependencies(manifest.dependencies);\n packageJsonFile.addDevDependencies(manifest.devDependencies);\n packageJsonFile.addPeerDependencies(manifest.peerDependencies);\n };\n addDependencies(packageJson);\n packageJson.addOrUpdateProperty('version', currentVersion);\n return packageJson;\n }\n\n async populateComponentsFilesToWriteForCapsule(\n component: Component,\n ids: ComponentIdList,\n legacyScope?: Scope,\n opts?: IsolateComponentsOptions\n ): Promise<DataToPersist> {\n const legacyComp: ConsumerComponent = component.state._consumer;\n const dataToPersist = new DataToPersist();\n const clonedFiles = legacyComp.files.map((file) => file.clone());\n const writeToPath = '.';\n clonedFiles.forEach((file) => file.updatePaths({ newBase: writeToPath }));\n dataToPersist.removePath(new RemovePath(writeToPath));\n clonedFiles.map((file) => dataToPersist.addFile(file));\n const packageJson = this.preparePackageJsonToWrite(\n component,\n writeToPath,\n ids // this.ignoreBitDependencies,\n );\n if (!legacyComp.id.hasVersion()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n packageJson.addOrUpdateProperty('version', semver.inc(legacyComp.version!, 'prerelease') || '0.0.1-0');\n }\n await PackageJsonTransformer.applyTransformers(component, packageJson);\n const valuesToMerge = legacyComp.overrides.componentOverridesPackageJsonData;\n packageJson.mergePackageJsonObject(valuesToMerge);\n dataToPersist.addFile(packageJson.toVinylFile());\n const artifacts = await this.getArtifacts(component, legacyScope, opts?.populateArtifactsFrom);\n dataToPersist.addManyFiles(artifacts);\n return dataToPersist;\n }\n\n private preparePackageJsonToWrite(\n component: Component,\n bitDir: string,\n ignoreBitDependencies: ComponentIdList | boolean = true\n ): PackageJsonFile {\n const legacyComp: ConsumerComponent = component.state._consumer;\n this.logger.debug(`package-json.preparePackageJsonToWrite. bitDir ${bitDir}.`);\n const getBitDependencies = (dependencies: ComponentIdList) => {\n if (ignoreBitDependencies === true) return {};\n return dependencies.reduce((acc, depId: ComponentID) => {\n if (Array.isArray(ignoreBitDependencies) && ignoreBitDependencies.searchWithoutVersion(depId)) return acc;\n const packageDependency = depId.version;\n const packageName = componentIdToPackageName({\n ...legacyComp,\n id: depId,\n isDependency: true,\n });\n acc[packageName] = packageDependency;\n return acc;\n }, {});\n };\n const bitDependencies = getBitDependencies(legacyComp.dependencies.getAllIds());\n const bitDevDependencies = getBitDependencies(legacyComp.devDependencies.getAllIds());\n const bitExtensionDependencies = getBitDependencies(legacyComp.extensions.extensionsBitIds);\n const packageJson = PackageJsonFile.createFromComponent(bitDir, legacyComp);\n const main = pathNormalizeToLinux(legacyComp.mainFile);\n packageJson.addOrUpdateProperty('main', main);\n const addDependencies = (packageJsonFile: PackageJsonFile) => {\n packageJsonFile.addDependencies(bitDependencies);\n packageJsonFile.addDevDependencies({\n ...bitDevDependencies,\n ...bitExtensionDependencies,\n });\n };\n addDependencies(packageJson);\n const currentVersion = getComponentPackageVersion(component);\n packageJson.addOrUpdateProperty('version', currentVersion);\n\n return packageJson;\n }\n\n /**\n * currently, it writes all artifacts.\n * later, this responsibility might move to pkg extension, which could write only artifacts\n * that are set in package.json.files[], to have a similar structure of a package.\n */\n private async getArtifacts(\n component: Component,\n legacyScope?: Scope,\n populateArtifactsFrom?: ComponentID[]\n ): Promise<AbstractVinyl[]> {\n const legacyComp: ConsumerComponent = component.state._consumer;\n if (!legacyScope) {\n if (populateArtifactsFrom) throw new Error(`unable to fetch from parent, the legacyScope was not provided`);\n // when capsules are written via the workspace, do not write artifacts, they get created by\n // build-pipeline. when capsules are written via the scope, we do need the dists.\n return [];\n }\n if (legacyComp.buildStatus !== 'succeed' && !populateArtifactsFrom) {\n // this is important for \"bit sign\" when on lane to not go to the original scope\n return [];\n }\n const artifactFilesToFetch = async () => {\n if (populateArtifactsFrom) {\n const found = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n if (!found) {\n throw new Error(\n `getArtifacts: unable to find where to populate the artifacts from for ${component.id.toString()}`\n );\n }\n const compParent = await legacyScope.getConsumerComponent(found);\n return getArtifactFilesExcludeExtension(compParent.extensions, 'teambit.pkg/pkg');\n }\n const extensionsNamesForArtifacts = ['teambit.compilation/compiler'];\n return flatten(\n extensionsNamesForArtifacts.map((extName) => getArtifactFilesByExtension(legacyComp.extensions, extName))\n );\n };\n\n const artifactsFiles = await artifactFilesToFetch();\n const artifactsVinylFlattened: ArtifactVinyl[] = [];\n await Promise.all(\n artifactsFiles.map(async (artifactFiles) => {\n if (!artifactFiles) return;\n if (!(artifactFiles instanceof ArtifactFiles)) {\n artifactFiles = deserializeArtifactFiles(artifactFiles);\n }\n // fyi, if this is coming from the isolator aspect, it is optimized to import all at once.\n // see artifact-files.importMultipleDistsArtifacts().\n const vinylFiles = await artifactFiles.getVinylsAndImportIfMissing(legacyComp.id, legacyScope);\n artifactsVinylFlattened.push(...vinylFiles);\n })\n );\n const artifactsDir = legacyComp.writtenPath;\n if (artifactsDir) {\n artifactsVinylFlattened.forEach((a) => a.updatePaths({ newBase: artifactsDir }));\n }\n return artifactsVinylFlattened;\n }\n}\n\nIsolatorAspect.addRuntime(IsolatorMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,cAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,aAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,WAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,UAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;E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Ba,0BAAc,CAACmb,UAAU,CAAChc,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_rimraf","data","_interopRequireDefault","require","_uuid","_cli","_semver","_chalk","_lodash","_aspectLoader","_component","_componentPackageVersion","_dependenciesFs","_graph","_harmony","_dependencyResolver","_logger","_componentId","_globalConfig","_constants","_packageJsonFile","_artifactFiles","_path","_fsExtra","_interopRequireWildcard","_objectHash","_path2","_dataToPersist","_removePath","_workspaceModules","_componentIdToPackageName","_concurrency","_pMap","_capsule","_capsuleList","_isolator","_symlinkDependenciesToCapsules","_network","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","CAPSULE_DIR_LENGTH","DEFAULT_ISOLATE_INSTALL_OPTIONS","installPackages","dedupe","installPeersFromEnvs","copyPeerToRuntimeOnComponents","copyPeerToRuntimeOnRoot","CAPSULE_READY_FILE","exports","IsolatorMain","provider","dependencyResolver","loggerExtension","componentAspect","graphMain","globalConfig","aspectLoader","cli","_config","capsuleTransferSlot","logger","createLogger","IsolatorAspect","id","isolator","constructor","graph","Map","Set","isolateComponents","seeders","opts","legacyScope","host","getHost","debug","join","JSON","stringify","assign","name","createGraphOpts","pick","componentsToIsolate","seedersOnly","getMany","createGraph","seedersWithVersions","map","seeder","_legacy","hasVersion","comp","find","component","isEqual","ignoreVersion","Error","toString","baseDir","path","shouldUseDatedDirs","capsuleDir","getCapsulesRootDir","useDatedDirs","cacheCapsulesDir","capsuleList","createCapsules","rootBaseDir","cacheCapsules","process","env","CACHE_CAPSULES","cacheLockFileOnly","targetCapsuleDir","registerMoveCapsuleOnProcessExit","relinkCoreAspectsInCapsuleDir","Network","getGraphOpts","getGraphIds","successorsSubgraph","compsAndDepsIds","nodes","node","attr","existingCompsIds","Promise","all","existing","includeFromNestedHosts","hasIdNested","hasId","undefined","existingComps","compact","datedCapsuleDir","info","registerOnBeforeExit","allDirs","getAllCapsulesDirsFromRoot","moveCapsulesLockFileToTargetDir","moveCapsulesToTargetDir","rootDir","fs","readdir","withFileTypes","capsuleDirents","dir","isDirectory","capsulesDirs","sourceRootDir","promises","sourceDir","dirname","basename","sourceLockFile","pathExistsSync","_movedLockFiles","console","targetDir","targetLockFile","targetLockFileExists","pathExists","remove","mvFunc","getCapsuleTransferFn","add","err","error","sourceCapsuleReadyFile","getCapsuleReadyFilePath","targetCapsuleReadyFile","rimraf","sync","removeCapsuleReadyFileSync","moveWithTempName","writeCapsuleReadyFileSync","move","tempDir","v4","exists","capsulesDir","linkingOptions","linkTeambitBit","linkCoreAspects","linker","getLinker","linkingContext","inCapsule","linkedRootDeps","calculateLinkedDeps","ComponentMap","create","createLinks","skipIfSymlinkValid","alwaysNew","getExistingAsIs","installOptions","useNesting","realCapsulesDir","allCapsulesExists","every","Capsule","getCapsuleDirName","readyFilePath","existsSync","cloneCapsule","originalCapsule","newBaseDir","network","clonedCapsule","seedersCapsules","copy","components","longProcessLogger","context","aspects","wsPath","workspaceName","createLongProcessLogger","chalk","cyan","bold","isolatedCapsules","emptyRootDir","supportsDedupingOnExistingRoot","config","emptyDir","capsules","createCapsulesFromComponents","allCapsuleList","CapsuleList","fromArray","end","skipIfExists","existingCapsules","capsule","capsulesWithPackagesData","getCapsulesPreviousPackageJson","writeComponentsInCapsules","updateWithCurrentPackageJsonData","cachePackagesOnCapsulesRoot","installLongProcessLogger","rootLinks","linkInCapsulesRoot","index","newCapsuleList","cacheCapsuleDir","lockFilePath","lockExists","copyFile","linkedDependencies","linkInCapsules","installInCapsules","packageManager","nodeLinker","capsuleWithPackageData","currentPackageJson","writeFileSync","PACKAGE_JSON","markCapsulesAsReady","capsuleListOutput","consoleSuccess","markCapsuleAsReady","writeFile","capsulePath","exist","removeSync","isolateInstallOptions","installer","getInstaller","cacheRootDirectory","installingContext","peerOnlyPolicy","getWorkspacePeersOnlyPolicy","installTeambitBit","packageManagerConfigRootDir","resolveVersionsFromDependenciesOnly","forceTeambitHarmonyLink","hasHarmonyInRootPolicy","excludeExtensionsDependencies","dedupeInjectedDeps","packageManagerInstallOptions","autoInstallPeers","nmSelfReferences","capsuleSelfReference","overrides","capsulesOverrides","hoistPatterns","rootComponentsForCapsules","keepExistingModulesDir","hasRootComponents","hoistWorkspacePackages","install","toComponentMap","nestedLinks","capsulesWithModifiedPackageJson","getCapsulesWithModifiedPackageJson","symlinkDependenciesToCapsules","linkNestedDepsInNM","symlinkOnCapsuleRoot","coreAspectIds","getCoreAspectIds","coreAspectCapsules","compIdWithoutVersion","split","includes","toLocalLinks","localLinks","link","linkDetailToLocalDepEntry","fromEntries","key","linkDetail","packageName","from","packageJsonHasChanged","wereDependenciesInPackageJsonChanged","modifiedComps","unmodifiedComps","capsuleUsePreviouslySavedDists","legacyUnmodifiedComps","state","_consumer","clone","legacyModifiedComps","legacyComponents","importMultipleDistsArtifacts","allIds","ComponentIdList","c","getCapsule","scope","populateArtifactsFrom","dataToPersist","populateComponentsFilesToWriteForCapsule","persistAllToCapsule","keepExistingCapsule","workspacePolicy","getWorkspacePolicy","byLifecycleType","tuples","list","withoutNodeModules","capsuleFullPaths","code","registerCapsuleTransferFn","fn","register","values","getDefaultCapsuleTransferFn","source","target","overwrite","getCapsuleDirOpts","useHash","datedDirId","getCapsuleDirOptsWithDefaults","capsulesRootBaseDir","getRootDirOfAllCapsules","date","Date","month","getMonth","dateDir","getFullYear","getDate","defaultDatedBaseDir","datedBaseDir","getSync","CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR","hashDir","finalDatedDirId","_datedHashForName","hash","substring","deleteCapsules","dirToDelete","pMap","createFromComponent","concurrency","concurrentComponentsLimit","getGlobalCapsulesBaseDir","previousPackageJson","DEPENDENCIES_FIELDS","some","field","packageJsonPath","previousPackageJsonRaw","readFile","encoding","parse","packageJson","getCurrentPackageJson","found","packageJsonObject","currentVersion","getComponentPackageVersion","getComponentDepsManifest","dependencies","manifest","devDependencies","peerDependencies","compDeps","toTypeArray","dep","depCapsule","componentId","version","snapToSemver","keyName","KEY_NAME_BY_LIFECYCLE_TYPE","lifecycle","entry","toManifest","versionRange","deps","getDependencies","PackageJsonFile","loadFromCapsuleSync","addDependencies","packageJsonFile","addDevDependencies","addPeerDependencies","addOrUpdateProperty","ids","legacyComp","DataToPersist","clonedFiles","files","file","writeToPath","updatePaths","newBase","removePath","RemovePath","addFile","preparePackageJsonToWrite","semver","inc","PackageJsonTransformer","applyTransformers","valuesToMerge","componentOverridesPackageJsonData","mergePackageJsonObject","toVinylFile","artifacts","getArtifacts","addManyFiles","bitDir","ignoreBitDependencies","getBitDependencies","reduce","acc","depId","Array","isArray","searchWithoutVersion","packageDependency","componentIdToPackageName","isDependency","bitDependencies","getAllIds","bitDevDependencies","bitExtensionDependencies","extensions","extensionsBitIds","main","pathNormalizeToLinux","mainFile","buildStatus","artifactFilesToFetch","compParent","getConsumerComponent","getArtifactFilesExcludeExtension","extensionsNamesForArtifacts","flatten","extName","getArtifactFilesByExtension","artifactsFiles","artifactsVinylFlattened","artifactFiles","ArtifactFiles","deserializeArtifactFiles","vinylFiles","getVinylsAndImportIfMissing","artifactsDir","writtenPath","MainRuntime","DependencyResolverAspect","LoggerAspect","ComponentAspect","GraphAspect","GlobalConfigAspect","AspectLoaderAspect","CLIAspect","Slot","withType","addRuntime"],"sources":["isolator.main.runtime.ts"],"sourcesContent":["import rimraf from 'rimraf';\nimport { v4 } from 'uuid';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport semver from 'semver';\nimport chalk from 'chalk';\nimport { compact, flatten, isEqual, pick } from 'lodash';\nimport { AspectLoaderMain, AspectLoaderAspect } from '@teambit/aspect-loader';\nimport { Component, ComponentMap, ComponentAspect } from '@teambit/component';\nimport type { ComponentMain, ComponentFactory } from '@teambit/component';\nimport { getComponentPackageVersion, snapToSemver } from '@teambit/component-package-version';\nimport { createLinks } from '@teambit/dependencies.fs.linked-dependencies';\nimport { GraphAspect, GraphMain } from '@teambit/graph';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport {\n DependencyResolverAspect,\n DependencyResolverMain,\n LinkingOptions,\n LinkDetail,\n WorkspacePolicy,\n InstallOptions,\n DependencyList,\n ComponentDependency,\n KEY_NAME_BY_LIFECYCLE_TYPE,\n PackageManagerInstallOptions,\n NodeLinker,\n} from '@teambit/dependency-resolver';\nimport { Logger, LoggerAspect, LoggerMain, LongProcessLogger } from '@teambit/logger';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport LegacyScope from '@teambit/legacy/dist/scope/scope';\nimport { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config';\nimport {\n DEPENDENCIES_FIELDS,\n PACKAGE_JSON,\n CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR,\n} from '@teambit/legacy/dist/constants';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-json-file';\nimport {\n ArtifactFiles,\n deserializeArtifactFiles,\n getArtifactFilesByExtension,\n getArtifactFilesExcludeExtension,\n importMultipleDistsArtifacts,\n} from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport fs, { copyFile } from 'fs-extra';\nimport hash from 'object-hash';\nimport path, { basename } from 'path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { PackageJsonTransformer } from '@teambit/workspace.modules.node-modules-linker';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport { concurrentComponentsLimit } from '@teambit/legacy/dist/utils/concurrency';\nimport pMap from 'p-map';\nimport { Capsule } from './capsule';\nimport CapsuleList from './capsule-list';\nimport { IsolatorAspect } from './isolator.aspect';\nimport { symlinkOnCapsuleRoot, symlinkDependenciesToCapsules } from './symlink-dependencies-to-capsules';\nimport { Network } from './network';\n\nexport type ListResults = {\n capsules: string[];\n};\n\nexport type CapsuleTransferFn = (sourceDir: string, targetDir: string) => Promise<void>;\n\nexport type CapsuleTransferSlot = SlotRegistry<CapsuleTransferFn>;\n\n/**\n * Context for the isolation process\n */\nexport type IsolationContext = {\n /**\n * Whether the isolation done for aspects (as opposed to regular components)\n */\n aspects?: boolean;\n\n /**\n * Workspace name where the isolation starts from\n */\n workspaceName?: string;\n};\n\n/**\n * it's normally a sha1 of the workspace/scope dir. 40 chars long. however, Windows is not happy with long paths.\n * so we use a shorter hash. the number 9 is pretty random, it's what we use for short-hash of snaps.\n * we're aware of an extremely low risk of collision. take into account that in most cases you won't have more than 10\n * capsules in the machine.\n */\nconst CAPSULE_DIR_LENGTH = 9;\n\nexport type IsolateComponentsInstallOptions = {\n installPackages?: boolean; // default: true\n // TODO: add back when depResolver.getInstaller support it\n // packageManager?: string;\n dedupe?: boolean;\n copyPeerToRuntimeOnComponents?: boolean;\n copyPeerToRuntimeOnRoot?: boolean;\n installPeersFromEnvs?: boolean;\n installTeambitBit?: boolean;\n packageManagerConfigRootDir?: string;\n // When set to true, the newly added components will be grouped inside one directory.\n // This is useful for scope aspect capsules, which are installed in stages.\n useNesting?: boolean;\n};\n\ntype CreateGraphOptions = {\n /**\n * include components that exists in nested hosts. for example include components that exist in scope but not in the workspace\n */\n includeFromNestedHosts?: boolean;\n\n /**\n * Force specific host to get the component from.\n */\n host?: ComponentFactory;\n};\n\nexport type IsolateComponentsOptions = CreateGraphOptions & {\n name?: string;\n\n /**\n * absolute path to put all the capsules dirs inside.\n */\n rootBaseDir?: string;\n\n /**\n * the capsule root-dir based on a *hash* of this baseDir, not on the baseDir itself.\n * A folder with this hash as its name will be created in the rootBaseDir\n * By default this value will be the host path\n */\n baseDir?: string;\n\n /**\n * Whether to use hash function (of base dir) as capsules root dir name\n */\n useHash?: boolean;\n\n /**\n * create a new capsule with a random string attached to the path suffix\n */\n alwaysNew?: boolean;\n\n /**\n * If this is true -\n * the isolator will check if there are missing capsules in the base dir\n * if yes, it will create the capsule in a special dir inside a dir with the current date (without time)\n * then inside that dir, it will create a dir with a random hash\n * at the end of the process it will move missing capsules from the temp dir to the base dir so they can be used in\n * the next iteration\n */\n useDatedDirs?: boolean;\n\n /**\n * If this is true -\n * the isolator will do few things:\n * 1. in the end of the process it will only move the lock file (pnpm-lock.yaml) into the capsule cache\n * 2. in the beginning of the process it will check if there is a lock file in the capsule cache, if yes it will move\n * it to the temp dated dir\n * 3. it will write env's file into the dated dir (as it only contain the lock file)\n * 4. it will run install in the dated dir (as there is no node_modules there yet)\n */\n cacheLockFileOnly?: boolean;\n\n /**\n * If set, along with useDatedDirs, then we will use the same hash dir for all capsules created with the same\n * datedDirId\n */\n datedDirId?: string;\n\n /**\n * installation options\n */\n installOptions?: IsolateComponentsInstallOptions;\n\n linkingOptions?: LinkingOptions;\n\n /**\n * delete the capsule rootDir first. it makes sure that the isolation process starts fresh with\n * no previous capsules. for build and tag this is true.\n */\n emptyRootDir?: boolean;\n\n /**\n * skip the reproduction of the capsule in case it exists.\n */\n skipIfExists?: boolean;\n\n /**\n * get existing capsule without doing any changes, no writes, no installations.\n */\n getExistingAsIs?: boolean;\n\n /**\n * place the package-manager cache on the capsule-root\n */\n cachePackagesOnCapsulesRoot?: boolean;\n\n /**\n * do not build graph with all dependencies. isolate the seeders only.\n */\n seedersOnly?: boolean;\n\n /**\n * relevant for tagging from scope, where we tag an existing snap without any code-changes.\n * the idea is to have all build artifacts from the previous snap and run deploy pipeline on top of it.\n */\n populateArtifactsFrom?: ComponentID[];\n\n /**\n * Force specific host to get the component from.\n */\n host?: ComponentFactory;\n\n /**\n * Use specific package manager for the isolation process (override the package manager from the dep resolver config)\n */\n packageManager?: string;\n\n /**\n * Use specific node linker for the isolation process (override the package manager from the dep resolver config)\n */\n nodeLinker?: NodeLinker;\n\n /**\n * Dir where to read the package manager config from\n * usually used when running package manager in the capsules dir to use the config\n * from the workspace dir\n */\n packageManagerConfigRootDir?: string;\n\n context?: IsolationContext;\n\n /**\n * Root dir of capsulse cache (used mostly to copy lock file if used with cache lock file only option)\n */\n cacheCapsulesDir?: string;\n};\n\ntype GetCapsuleDirOpts = Pick<\n IsolateComponentsOptions,\n 'datedDirId' | 'useHash' | 'rootBaseDir' | 'useDatedDirs' | 'cacheLockFileOnly'\n> & {\n baseDir: string;\n};\n\ntype CapsulePackageJsonData = {\n capsule: Capsule;\n currentPackageJson?: Record<string, any>;\n previousPackageJson: Record<string, any> | null;\n};\n\nconst DEFAULT_ISOLATE_INSTALL_OPTIONS: IsolateComponentsInstallOptions = {\n installPackages: true,\n dedupe: true,\n installPeersFromEnvs: true,\n copyPeerToRuntimeOnComponents: false,\n copyPeerToRuntimeOnRoot: true,\n};\n\n/**\n * File name to indicate that the capsule is ready (all packages are installed and links are created)\n */\nexport const CAPSULE_READY_FILE = '.bit-capsule-ready';\n\nexport class IsolatorMain {\n static runtime = MainRuntime;\n static dependencies = [\n DependencyResolverAspect,\n LoggerAspect,\n ComponentAspect,\n GraphAspect,\n GlobalConfigAspect,\n AspectLoaderAspect,\n CLIAspect,\n ];\n static slots = [Slot.withType<CapsuleTransferFn>()];\n static defaultConfig = {};\n _componentsPackagesVersionCache: { [idStr: string]: string } = {}; // cache packages versions of components\n _datedHashForName = new Map<string, string>(); // cache dated hash for a specific name\n _movedLockFiles = new Set(); // cache moved lock files to avoid show warning about them\n\n static async provider(\n [dependencyResolver, loggerExtension, componentAspect, graphMain, globalConfig, aspectLoader, cli]: [\n DependencyResolverMain,\n LoggerMain,\n ComponentMain,\n GraphMain,\n GlobalConfigMain,\n AspectLoaderMain,\n CLIMain\n ],\n _config,\n [capsuleTransferSlot]: [CapsuleTransferSlot]\n ): Promise<IsolatorMain> {\n const logger = loggerExtension.createLogger(IsolatorAspect.id);\n const isolator = new IsolatorMain(\n dependencyResolver,\n logger,\n componentAspect,\n graphMain,\n cli,\n globalConfig,\n aspectLoader,\n capsuleTransferSlot\n );\n return isolator;\n }\n constructor(\n private dependencyResolver: DependencyResolverMain,\n private logger: Logger,\n private componentAspect: ComponentMain,\n private graph: GraphMain,\n private cli: CLIMain,\n private globalConfig: GlobalConfigMain,\n private aspectLoader: AspectLoaderMain,\n private capsuleTransferSlot: CapsuleTransferSlot\n ) {}\n\n // TODO: the legacy scope used for the component writer, which then decide if it need to write the artifacts and dists\n // TODO: we should think of another way to provide it (maybe a new opts) then take the scope internally from the host\n async isolateComponents(\n seeders: ComponentID[],\n opts: IsolateComponentsOptions,\n legacyScope?: LegacyScope\n ): Promise<Network> {\n const host = opts.host || this.componentAspect.getHost();\n this.logger.debug(\n `isolateComponents, ${seeders.join(', ')}. opts: ${JSON.stringify(\n Object.assign({}, opts, { host: opts.host?.name })\n )}`\n );\n const createGraphOpts = pick(opts, ['includeFromNestedHosts', 'host']);\n const componentsToIsolate = opts.seedersOnly\n ? await host.getMany(seeders)\n : await this.createGraph(seeders, createGraphOpts);\n this.logger.debug(`isolateComponents, total componentsToIsolate: ${componentsToIsolate.length}`);\n const seedersWithVersions = seeders.map((seeder) => {\n if (seeder._legacy.hasVersion()) return seeder;\n const comp = componentsToIsolate.find((component) => component.id.isEqual(seeder, { ignoreVersion: true }));\n if (!comp) throw new Error(`unable to find seeder ${seeder.toString()} in componentsToIsolate`);\n return comp.id;\n });\n opts.baseDir = opts.baseDir || host.path;\n const shouldUseDatedDirs = this.shouldUseDatedDirs(componentsToIsolate, opts);\n const capsuleDir = this.getCapsulesRootDir({\n ...opts,\n useDatedDirs: shouldUseDatedDirs,\n baseDir: opts.baseDir || '',\n });\n const cacheCapsulesDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n opts.cacheCapsulesDir = cacheCapsulesDir;\n const capsuleList = await this.createCapsules(componentsToIsolate, capsuleDir, opts, legacyScope);\n this.logger.debug(\n `creating network with base dir: ${opts.baseDir}, rootBaseDir: ${opts.rootBaseDir}. final capsule-dir: ${capsuleDir}. capsuleList: ${capsuleList.length}`\n );\n const cacheCapsules = process.env.CACHE_CAPSULES || opts.cacheLockFileOnly;\n if (shouldUseDatedDirs && cacheCapsules) {\n const targetCapsuleDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n this.registerMoveCapsuleOnProcessExit(capsuleDir, targetCapsuleDir, opts.cacheLockFileOnly);\n // TODO: ideally this should be inside the on process exit hook\n // but this is an async op which make it a bit hard\n await this.relinkCoreAspectsInCapsuleDir(targetCapsuleDir);\n }\n return new Network(capsuleList, seedersWithVersions, capsuleDir);\n }\n\n private async createGraph(seeders: ComponentID[], opts: CreateGraphOptions = {}): Promise<Component[]> {\n const host = opts.host || this.componentAspect.getHost();\n const getGraphOpts = pick(opts, ['host']);\n const graph = await this.graph.getGraphIds(seeders, getGraphOpts);\n const successorsSubgraph = graph.successorsSubgraph(seeders.map((id) => id.toString()));\n const compsAndDepsIds = successorsSubgraph.nodes.map((node) => node.attr);\n // do not ignore the version here. a component might be in .bitmap with one version and\n // installed as a package with another version. we don't want them both.\n const existingCompsIds = await Promise.all(\n compsAndDepsIds.map(async (id) => {\n let existing;\n if (opts.includeFromNestedHosts) {\n existing = await host.hasIdNested(id, true);\n } else {\n existing = await host.hasId(id);\n }\n if (existing) return id;\n return undefined;\n })\n );\n const existingComps = await host.getMany(compact(existingCompsIds));\n return existingComps;\n }\n\n private registerMoveCapsuleOnProcessExit(\n datedCapsuleDir: string,\n targetCapsuleDir: string,\n cacheLockFileOnly = false\n ): void {\n this.logger.info(`registering process.on(exit) to move capsules from ${datedCapsuleDir} to ${targetCapsuleDir}`);\n this.cli.registerOnBeforeExit(async () => {\n const allDirs = await this.getAllCapsulesDirsFromRoot(datedCapsuleDir);\n if (cacheLockFileOnly) {\n await this.moveCapsulesLockFileToTargetDir(allDirs, datedCapsuleDir, targetCapsuleDir);\n } else {\n await this.moveCapsulesToTargetDir(allDirs, datedCapsuleDir, targetCapsuleDir);\n }\n });\n }\n\n private async getAllCapsulesDirsFromRoot(rootDir: string): Promise<string[]> {\n const allDirs = await fs.readdir(rootDir, { withFileTypes: true });\n const capsuleDirents = allDirs.filter((dir) => dir.isDirectory() && dir.name !== 'node_modules');\n return capsuleDirents.map((dir) => path.join(rootDir, dir.name));\n }\n\n private async moveCapsulesLockFileToTargetDir(\n capsulesDirs: string[],\n sourceRootDir: string,\n targetCapsuleDir: string\n ): Promise<void> {\n this.logger.info(`start moving lock files from ${sourceRootDir} to ${targetCapsuleDir}`);\n const promises = capsulesDirs.map(async (sourceDir) => {\n const dirname = path.basename(sourceDir);\n const sourceLockFile = path.join(sourceDir, 'pnpm-lock.yaml');\n // Lock file is not exist, don't copy it to the cache\n if (!fs.pathExistsSync(sourceLockFile)) {\n // It was already moved during the process, do not show the log for it\n if (!this._movedLockFiles.has(sourceLockFile)) {\n this.logger.console(`skipping moving lock file to cache as it is not exist ${sourceDir}`);\n }\n return;\n }\n const targetDir = path.join(targetCapsuleDir, dirname);\n const targetLockFile = path.join(targetDir, 'pnpm-lock.yaml');\n const targetLockFileExists = await fs.pathExists(targetLockFile);\n if (targetLockFileExists) {\n // Lock file is already in the cache, no need to move it\n // this.logger.console(`skipping moving lock file to cache as it is already exist at ${targetDir}`);\n\n // Delete existing lock file so we can update it\n await fs.remove(targetLockFile);\n return;\n }\n this.logger.debug(`moving lock file from ${sourceLockFile} to ${targetDir}`);\n const mvFunc = this.getCapsuleTransferFn();\n try {\n await mvFunc(sourceLockFile, path.join(targetDir, 'pnpm-lock.yaml'));\n this._movedLockFiles.add(sourceLockFile);\n } catch (err) {\n this.logger.error(`failed moving lock file from ${sourceLockFile} to ${targetDir}`, err);\n }\n });\n await Promise.all(promises);\n }\n\n private async moveCapsulesToTargetDir(\n capsulesDirs: string[],\n sourceRootDir: string,\n targetCapsuleDir: string\n ): Promise<void> {\n this.logger.info(`start moving capsules from ${sourceRootDir} to ${targetCapsuleDir}`);\n const promises = capsulesDirs.map(async (sourceDir) => {\n const dirname = path.basename(sourceDir);\n const sourceCapsuleReadyFile = this.getCapsuleReadyFilePath(sourceDir);\n if (!fs.pathExistsSync(sourceCapsuleReadyFile)) {\n // Capsule is not ready, don't copy it to the cache\n this.logger.console(`skipping moving capsule to cache as it is not ready ${sourceDir}`);\n return;\n }\n const targetDir = path.join(targetCapsuleDir, dirname);\n if (fs.pathExistsSync(path.join(targetCapsuleDir, dirname))) {\n const targetCapsuleReadyFile = this.getCapsuleReadyFilePath(targetDir);\n if (fs.pathExistsSync(targetCapsuleReadyFile)) {\n // Capsule is already in the cache, no need to move it\n this.logger.console(`skipping moving capsule to cache as it is already exist at ${targetDir}`);\n return;\n }\n this.logger.console(`cleaning target capsule location as it's not ready at: ${targetDir}`);\n rimraf.sync(targetDir);\n }\n this.logger.console(`moving specific capsule from ${sourceDir} to ${targetDir}`);\n // We delete the ready file path first, as the move might take a long time, so we don't want to move\n // the ready file indicator before the capsule is ready in the new location\n this.removeCapsuleReadyFileSync(sourceDir);\n await this.moveWithTempName(sourceDir, targetDir, this.getCapsuleTransferFn());\n // Mark the capsule as ready in the new location\n this.writeCapsuleReadyFileSync(targetDir);\n });\n await Promise.all(promises);\n }\n\n /**\n * The function moves a directory from a source location to a target location using a temporary directory.\n * This is using temp dir because sometime the source dir and target dir might be in different FS\n * (for example different mounts) which means the move might take a long time\n * during the time of moving, another process will see that the capsule is not ready and will try to remove then\n * move it again, which lead to the first process throwing an error\n * @param sourceDir - The source directory from where the files or directories will be moved.\n * @param targetDir - The target directory where the source directory will be moved to.\n */\n private async moveWithTempName(sourceDir, targetDir, mvFunc: Function = fs.move): Promise<void> {\n const tempDir = `${targetDir}-${v4()}`;\n this.logger.console(`moving capsule from ${sourceDir} to a temp dir ${tempDir}`);\n await mvFunc(sourceDir, tempDir);\n const exists = await fs.pathExists(targetDir);\n // This might exist if in the time when we move to the temp dir, another process created the target dir already\n if (exists) {\n this.logger.console(`skip moving capsule from temp dir to real dir as it's already exist: ${targetDir}`);\n // Clean leftovers\n await rimraf(tempDir);\n return;\n }\n this.logger.console(`moving capsule from a temp dir ${tempDir} to the target dir ${targetDir}`);\n await mvFunc(tempDir, targetDir);\n }\n\n /**\n * Re-create the core aspects links in the real capsule dir\n * This is required mainly for the first time when that folder is empty\n */\n private async relinkCoreAspectsInCapsuleDir(capsulesDir: string): Promise<void> {\n const linkingOptions = {\n linkTeambitBit: true,\n linkCoreAspects: true,\n };\n const linker = this.dependencyResolver.getLinker({\n rootDir: capsulesDir,\n linkingOptions,\n linkingContext: { inCapsule: true },\n });\n const { linkedRootDeps } = await linker.calculateLinkedDeps(capsulesDir, ComponentMap.create([]), linkingOptions);\n // This links are in the global cache which used by many process\n // we don't want to delete and re-create the links if they already exist and valid\n return createLinks(capsulesDir, linkedRootDeps, { skipIfSymlinkValid: true });\n }\n\n private shouldUseDatedDirs(componentsToIsolate: Component[], opts: IsolateComponentsOptions): boolean {\n if (!opts.useDatedDirs) return false;\n // No need to use the dated dirs in case we anyway create new capsule for each one\n if (opts.alwaysNew) return false;\n // if (opts.skipIfExists) return false;\n // no point to use dated dir in case of getExistingAsIs as it will be just always empty\n if (opts.getExistingAsIs) return false;\n // Do not use the dated dirs in case we don't use nesting, as the capsules\n // will not work after moving to the real dir\n if (!opts.installOptions?.useNesting) return false;\n // Getting the real capsule dir to check if all capsules exists\n const realCapsulesDir = this.getCapsulesRootDir({ ...opts, useDatedDirs: false, baseDir: opts.baseDir || '' });\n // validate all capsules in the real location exists and valid\n const allCapsulesExists = componentsToIsolate.every((component) => {\n const capsuleDir = path.join(realCapsulesDir, Capsule.getCapsuleDirName(component));\n const readyFilePath = this.getCapsuleReadyFilePath(capsuleDir);\n return fs.existsSync(capsuleDir) && fs.existsSync(readyFilePath);\n });\n if (allCapsulesExists) {\n this.logger.debug(\n `All required capsules already exists and valid in the real (cached) location: ${realCapsulesDir}`\n );\n return false;\n }\n this.logger.debug(\n `Missing required capsules in the real (cached) location: ${realCapsulesDir}, using dated (temp) dir`\n );\n return true;\n }\n\n /**\n *\n * @param originalCapsule the capsule that contains the original component\n * @param newBaseDir relative path. (it will be saved inside `this.getRootDirOfAllCapsules()`. the final path of the capsule will be getRootDirOfAllCapsules() + newBaseDir + filenameify(component.id))\n * @returns a new capsule with the same content of the original capsule but with a new baseDir and all packages\n * installed in the newBaseDir.\n */\n async cloneCapsule(originalCapsule: Capsule, newBaseDir: string): Promise<Capsule> {\n const network = await this.isolateComponents([originalCapsule.component.id], { baseDir: newBaseDir });\n const clonedCapsule = network.seedersCapsules[0];\n await fs.copy(originalCapsule.path, clonedCapsule.path);\n return clonedCapsule;\n }\n\n /**\n * Create capsules for the provided components\n * do not use this outside directly, use isolate components which build the entire network\n * @param components\n * @param opts\n * @param legacyScope\n */\n private async createCapsules(\n components: Component[],\n capsulesDir: string,\n opts: IsolateComponentsOptions,\n legacyScope?: Scope\n ): Promise<CapsuleList> {\n this.logger.debug(`createCapsules, ${components.length} components`);\n\n let longProcessLogger;\n if (opts.context?.aspects) {\n // const wsPath = opts.host?.path || 'unknown';\n const wsPath = opts.context.workspaceName || opts.host?.path || opts.name || 'unknown';\n longProcessLogger = this.logger.createLongProcessLogger(\n `ensuring ${chalk.cyan(components.length.toString())} capsule(s) for all envs and aspects for ${chalk.bold(\n wsPath\n )} at ${chalk.bold(capsulesDir)}`\n );\n }\n const useNesting = this.dependencyResolver.isolatedCapsules() && opts.installOptions?.useNesting;\n const installOptions = {\n ...DEFAULT_ISOLATE_INSTALL_OPTIONS,\n ...opts.installOptions,\n useNesting,\n };\n if (!opts.emptyRootDir) {\n installOptions.dedupe = installOptions.dedupe && this.dependencyResolver.supportsDedupingOnExistingRoot();\n }\n\n const config = { installPackages: true, ...opts };\n if (opts.emptyRootDir) {\n await fs.emptyDir(capsulesDir);\n }\n let capsules = await this.createCapsulesFromComponents(components, capsulesDir, config);\n const allCapsuleList = CapsuleList.fromArray(capsules);\n let capsuleList = allCapsuleList;\n if (opts.getExistingAsIs) {\n longProcessLogger?.end();\n\n return capsuleList;\n }\n\n if (opts.skipIfExists) {\n if (!installOptions.useNesting) {\n const existingCapsules = CapsuleList.fromArray(\n capsuleList.filter((capsule) => capsule.fs.existsSync('package.json'))\n );\n\n if (existingCapsules.length === capsuleList.length) {\n longProcessLogger?.end();\n return existingCapsules;\n }\n } else {\n capsules = capsules.filter((capsule) => !capsule.fs.existsSync('package.json'));\n capsuleList = CapsuleList.fromArray(capsules);\n }\n }\n const capsulesWithPackagesData = await this.getCapsulesPreviousPackageJson(capsules);\n\n await this.writeComponentsInCapsules(components, capsuleList, legacyScope, opts);\n await this.updateWithCurrentPackageJsonData(capsulesWithPackagesData, capsuleList);\n if (installOptions.installPackages) {\n const cachePackagesOnCapsulesRoot = opts.cachePackagesOnCapsulesRoot ?? false;\n const linkingOptions = opts.linkingOptions ?? {};\n let installLongProcessLogger: LongProcessLogger | undefined;\n // Only show the log message in case we are going to install something\n if (capsuleList && capsuleList.length && !opts.context?.aspects) {\n installLongProcessLogger = this.logger.createLongProcessLogger(\n `install packages in ${capsuleList.length} capsules`\n );\n }\n const rootLinks = await this.linkInCapsulesRoot(capsulesDir, capsuleList, linkingOptions);\n if (installOptions.useNesting) {\n await Promise.all(\n capsuleList.map(async (capsule, index) => {\n const newCapsuleList = CapsuleList.fromArray([capsule]);\n if (opts.cacheCapsulesDir && capsulesDir !== opts.cacheCapsulesDir && opts.cacheLockFileOnly) {\n const cacheCapsuleDir = path.join(opts.cacheCapsulesDir, basename(capsule.path));\n const lockFilePath = path.join(cacheCapsuleDir, 'pnpm-lock.yaml');\n const lockExists = await fs.pathExists(lockFilePath);\n if (lockExists) {\n try {\n // this.logger.console(`moving lock file from ${lockFilePath} to ${capsule.path}`);\n await copyFile(lockFilePath, path.join(capsule.path, 'pnpm-lock.yaml'));\n } catch (err) {\n // We can ignore the error, we don't want to break the flow. the file will be anyway re-generated\n // in the target capsule. it will only be a bit slower.\n this.logger.error(\n `failed moving lock file from cache folder path: ${lockFilePath} to local capsule at ${capsule.path} (even though the lock file seems to exist)`,\n err\n );\n }\n }\n }\n const linkedDependencies = await this.linkInCapsules(newCapsuleList, capsulesWithPackagesData);\n if (index === 0) {\n linkedDependencies[capsulesDir] = rootLinks;\n }\n await this.installInCapsules(capsule.path, newCapsuleList, installOptions, {\n cachePackagesOnCapsulesRoot,\n linkedDependencies,\n packageManager: opts.packageManager,\n nodeLinker: opts.nodeLinker,\n });\n })\n );\n } else {\n const linkedDependencies = await this.linkInCapsules(capsuleList, capsulesWithPackagesData);\n linkedDependencies[capsulesDir] = rootLinks;\n await this.installInCapsules(capsulesDir, capsuleList, installOptions, {\n cachePackagesOnCapsulesRoot,\n linkedDependencies,\n packageManager: opts.packageManager,\n });\n }\n if (installLongProcessLogger) {\n installLongProcessLogger.end('success');\n }\n }\n\n // rewrite the package-json with the component dependencies in it. the original package.json\n // that was written before, didn't have these dependencies in order for the package-manager to\n // be able to install them without crushing when the versions don't exist yet\n capsulesWithPackagesData.forEach((capsuleWithPackageData) => {\n const { currentPackageJson, capsule } = capsuleWithPackageData;\n if (!currentPackageJson)\n throw new Error(\n `isolator.createCapsules, unable to find currentPackageJson for ${capsule.component.id.toString()}`\n );\n capsuleWithPackageData.capsule.fs.writeFileSync(PACKAGE_JSON, JSON.stringify(currentPackageJson, null, 2));\n });\n await this.markCapsulesAsReady(capsuleList);\n if (longProcessLogger) {\n longProcessLogger.end();\n }\n // Only show this message if at least one new capsule created\n if (longProcessLogger && capsuleList.length) {\n // this.logger.consoleSuccess();\n const capsuleListOutput = allCapsuleList.map((capsule) => capsule.component.id.toString()).join(', ');\n this.logger.consoleSuccess(`resolved aspect(s): ${chalk.cyan(capsuleListOutput)}`);\n }\n\n return allCapsuleList;\n }\n\n private async markCapsulesAsReady(capsuleList: CapsuleList): Promise<void> {\n await Promise.all(\n capsuleList.map(async (capsule) => {\n return this.markCapsuleAsReady(capsule);\n })\n );\n }\n\n private async markCapsuleAsReady(capsule: Capsule): Promise<void> {\n const readyFilePath = this.getCapsuleReadyFilePath(capsule.path);\n return fs.writeFile(readyFilePath, '');\n }\n\n private removeCapsuleReadyFileSync(capsulePath: string): void {\n const readyFilePath = this.getCapsuleReadyFilePath(capsulePath);\n const exist = fs.pathExistsSync(readyFilePath);\n if (!exist) return;\n fs.removeSync(readyFilePath);\n }\n\n private writeCapsuleReadyFileSync(capsulePath: string): void {\n const readyFilePath = this.getCapsuleReadyFilePath(capsulePath);\n const exist = fs.pathExistsSync(readyFilePath);\n if (exist) return;\n fs.writeFileSync(readyFilePath, '');\n }\n\n private getCapsuleReadyFilePath(capsulePath: string): string {\n return path.join(capsulePath, CAPSULE_READY_FILE);\n }\n\n private async installInCapsules(\n capsulesDir: string,\n capsuleList: CapsuleList,\n isolateInstallOptions: IsolateComponentsInstallOptions,\n opts: {\n cachePackagesOnCapsulesRoot?: boolean;\n linkedDependencies?: Record<string, Record<string, string>>;\n packageManager?: string;\n nodeLinker?: NodeLinker;\n }\n ) {\n const installer = this.dependencyResolver.getInstaller({\n rootDir: capsulesDir,\n cacheRootDirectory: opts.cachePackagesOnCapsulesRoot ? capsulesDir : undefined,\n installingContext: { inCapsule: true },\n packageManager: opts.packageManager,\n nodeLinker: opts.nodeLinker,\n });\n // When using isolator we don't want to use the policy defined in the workspace directly,\n // we only want to instal deps from components and the peer from the workspace\n\n const peerOnlyPolicy = this.getWorkspacePeersOnlyPolicy();\n const installOptions: InstallOptions = {\n installTeambitBit: !!isolateInstallOptions.installTeambitBit,\n packageManagerConfigRootDir: isolateInstallOptions.packageManagerConfigRootDir,\n resolveVersionsFromDependenciesOnly: true,\n linkedDependencies: opts.linkedDependencies,\n forceTeambitHarmonyLink: !this.dependencyResolver.hasHarmonyInRootPolicy(),\n excludeExtensionsDependencies: true,\n dedupeInjectedDeps: true,\n };\n\n const packageManagerInstallOptions: PackageManagerInstallOptions = {\n autoInstallPeers: this.dependencyResolver.config.autoInstallPeers,\n dedupe: isolateInstallOptions.dedupe,\n copyPeerToRuntimeOnComponents: isolateInstallOptions.copyPeerToRuntimeOnComponents,\n copyPeerToRuntimeOnRoot: isolateInstallOptions.copyPeerToRuntimeOnRoot,\n installPeersFromEnvs: isolateInstallOptions.installPeersFromEnvs,\n nmSelfReferences: this.dependencyResolver.config.capsuleSelfReference,\n overrides: this.dependencyResolver.config.capsulesOverrides || this.dependencyResolver.config.overrides,\n hoistPatterns: this.dependencyResolver.config.hoistPatterns,\n rootComponentsForCapsules: this.dependencyResolver.isolatedCapsules(),\n useNesting: isolateInstallOptions.useNesting,\n keepExistingModulesDir: this.dependencyResolver.isolatedCapsules(),\n hasRootComponents: this.dependencyResolver.isolatedCapsules(),\n hoistWorkspacePackages: true,\n };\n await installer.install(\n capsulesDir,\n peerOnlyPolicy,\n this.toComponentMap(capsuleList),\n installOptions,\n packageManagerInstallOptions\n );\n }\n\n private async linkInCapsules(\n capsuleList: CapsuleList,\n capsulesWithPackagesData: CapsulePackageJsonData[]\n ): Promise<Record<string, Record<string, string>>> {\n let nestedLinks: Record<string, Record<string, string>> | undefined;\n if (!this.dependencyResolver.isolatedCapsules()) {\n const capsulesWithModifiedPackageJson = this.getCapsulesWithModifiedPackageJson(capsulesWithPackagesData);\n nestedLinks = await symlinkDependenciesToCapsules(capsulesWithModifiedPackageJson, capsuleList, this.logger);\n }\n return nestedLinks ?? {};\n }\n\n private async linkInCapsulesRoot(\n capsulesDir: string,\n capsuleList: CapsuleList,\n linkingOptions: LinkingOptions\n ): Promise<Record<string, string>> {\n const linker = this.dependencyResolver.getLinker({\n rootDir: capsulesDir,\n linkingOptions,\n linkingContext: { inCapsule: true },\n });\n const { linkedRootDeps } = await linker.calculateLinkedDeps(capsulesDir, this.toComponentMap(capsuleList), {\n ...linkingOptions,\n linkNestedDepsInNM: !this.dependencyResolver.isolatedCapsules() && linkingOptions.linkNestedDepsInNM,\n });\n let rootLinks: LinkDetail[] | undefined;\n if (!this.dependencyResolver.isolatedCapsules()) {\n rootLinks = await symlinkOnCapsuleRoot(capsuleList, this.logger, capsulesDir);\n } else {\n const coreAspectIds = this.aspectLoader.getCoreAspectIds();\n const coreAspectCapsules = CapsuleList.fromArray(\n capsuleList.filter((capsule) => {\n const [compIdWithoutVersion] = capsule.component.id.toString().split('@');\n return coreAspectIds.includes(compIdWithoutVersion);\n })\n );\n rootLinks = await symlinkOnCapsuleRoot(coreAspectCapsules, this.logger, capsulesDir);\n }\n return {\n ...linkedRootDeps,\n ...this.toLocalLinks(rootLinks),\n };\n }\n\n private toLocalLinks(rootLinks: LinkDetail[] | undefined): Record<string, string> {\n const localLinks: Array<[string, string]> = [];\n if (rootLinks) {\n rootLinks.forEach((link) => {\n localLinks.push(this.linkDetailToLocalDepEntry(link));\n });\n }\n return Object.fromEntries(localLinks.map(([key, value]) => [key, `link:${value}`]));\n }\n\n private linkDetailToLocalDepEntry(linkDetail: LinkDetail): [string, string] {\n return [linkDetail.packageName, linkDetail.from];\n }\n\n private getCapsulesWithModifiedPackageJson(capsulesWithPackagesData: CapsulePackageJsonData[]) {\n const capsulesWithModifiedPackageJson: Capsule[] = capsulesWithPackagesData\n .filter((capsuleWithPackageData) => {\n const packageJsonHasChanged = this.wereDependenciesInPackageJsonChanged(capsuleWithPackageData);\n // @todo: when a component is tagged, it changes all package-json of its dependents, but it\n // should not trigger any \"npm install\" because they dependencies are symlinked by us\n return packageJsonHasChanged;\n })\n .map((capsuleWithPackageData) => capsuleWithPackageData.capsule);\n return capsulesWithModifiedPackageJson;\n }\n\n private async writeComponentsInCapsules(\n components: Component[],\n capsuleList: CapsuleList,\n legacyScope?: Scope,\n opts?: IsolateComponentsOptions\n ) {\n const modifiedComps: Component[] = [];\n const unmodifiedComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n if (await CapsuleList.capsuleUsePreviouslySavedDists(component)) {\n unmodifiedComps.push(component);\n } else {\n modifiedComps.push(component);\n }\n })\n );\n const legacyUnmodifiedComps = unmodifiedComps.map((component) => component.state._consumer.clone());\n const legacyModifiedComps = modifiedComps.map((component) => component.state._consumer.clone());\n const legacyComponents = [...legacyUnmodifiedComps, ...legacyModifiedComps];\n if (legacyScope && unmodifiedComps.length) await importMultipleDistsArtifacts(legacyScope, legacyUnmodifiedComps);\n const allIds = ComponentIdList.fromArray(legacyComponents.map((c) => c.id));\n await Promise.all(\n components.map(async (component) => {\n const capsule = capsuleList.getCapsule(component.id);\n if (!capsule) return;\n const scope =\n (await CapsuleList.capsuleUsePreviouslySavedDists(component)) || opts?.populateArtifactsFrom\n ? legacyScope\n : undefined;\n const dataToPersist = await this.populateComponentsFilesToWriteForCapsule(component, allIds, scope, opts);\n await dataToPersist.persistAllToCapsule(capsule, { keepExistingCapsule: true });\n })\n );\n }\n\n private getWorkspacePeersOnlyPolicy(): WorkspacePolicy {\n const workspacePolicy = this.dependencyResolver.getWorkspacePolicy();\n const peerOnlyPolicy = workspacePolicy.byLifecycleType('peer');\n return peerOnlyPolicy;\n }\n\n private toComponentMap(capsuleList: CapsuleList): ComponentMap<string> {\n const tuples: [Component, string][] = capsuleList.map((capsule) => {\n return [capsule.component, capsule.path];\n });\n\n return ComponentMap.create(tuples);\n }\n\n async list(rootDir: string): Promise<ListResults> {\n try {\n const capsules = await fs.readdir(rootDir);\n const withoutNodeModules = capsules.filter((c) => c !== 'node_modules');\n const capsuleFullPaths = withoutNodeModules.map((c) => path.join(rootDir, c));\n return {\n capsules: capsuleFullPaths,\n };\n } catch (e: any) {\n if (e.code === 'ENOENT') {\n return { capsules: [] };\n }\n throw e;\n }\n }\n\n registerCapsuleTransferFn(fn: CapsuleTransferFn) {\n this.capsuleTransferSlot.register(fn);\n }\n\n private getCapsuleTransferFn(): CapsuleTransferFn {\n return this.capsuleTransferSlot.values()[0] || this.getDefaultCapsuleTransferFn();\n }\n\n private getDefaultCapsuleTransferFn(): CapsuleTransferFn {\n return async (source, target) => {\n return fs.move(source, target, { overwrite: true });\n };\n }\n\n /** @deprecated use the new function signature with an object parameter instead */\n getCapsulesRootDir(baseDir: string, rootBaseDir?: string, useHash?: boolean): PathOsBasedAbsolute;\n getCapsulesRootDir(getCapsuleDirOpts: GetCapsuleDirOpts): PathOsBasedAbsolute;\n getCapsulesRootDir(\n getCapsuleDirOpts: GetCapsuleDirOpts | string,\n rootBaseDir?: string,\n useHash = true,\n useDatedDirs = false,\n datedDirId?: string\n ): PathOsBasedAbsolute {\n if (typeof getCapsuleDirOpts === 'string') {\n getCapsuleDirOpts = { baseDir: getCapsuleDirOpts, rootBaseDir, useHash, useDatedDirs, datedDirId };\n }\n const getCapsuleDirOptsWithDefaults = {\n useHash: true,\n useDatedDirs: false,\n cacheLockFileOnly: false,\n ...getCapsuleDirOpts,\n };\n const capsulesRootBaseDir = getCapsuleDirOptsWithDefaults.rootBaseDir || this.getRootDirOfAllCapsules();\n if (getCapsuleDirOptsWithDefaults.useDatedDirs) {\n const date = new Date();\n const month = date.getMonth() < 12 ? date.getMonth() + 1 : 1;\n const dateDir = `${date.getFullYear()}-${month}-${date.getDate()}`;\n const defaultDatedBaseDir = 'dated-capsules';\n const datedBaseDir = this.globalConfig.getSync(CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR) || defaultDatedBaseDir;\n let hashDir;\n const finalDatedDirId = getCapsuleDirOpts.datedDirId;\n if (finalDatedDirId && this._datedHashForName.has(finalDatedDirId)) {\n // Make sure in the same process we always use the same hash for the same datedDirId\n hashDir = this._datedHashForName.get(finalDatedDirId);\n } else {\n hashDir = v4();\n if (finalDatedDirId) {\n this._datedHashForName.set(finalDatedDirId, hashDir);\n }\n }\n return path.join(capsulesRootBaseDir, datedBaseDir, dateDir, hashDir);\n }\n const dir = getCapsuleDirOptsWithDefaults.useHash\n ? hash(getCapsuleDirOptsWithDefaults.baseDir).substring(0, CAPSULE_DIR_LENGTH)\n : getCapsuleDirOptsWithDefaults.baseDir;\n return path.join(capsulesRootBaseDir, dir);\n }\n\n async deleteCapsules(rootDir?: string): Promise<string> {\n const dirToDelete = rootDir || this.getRootDirOfAllCapsules();\n await fs.remove(dirToDelete);\n return dirToDelete;\n }\n\n private async createCapsulesFromComponents(\n components: Component[],\n baseDir: string,\n opts: IsolateComponentsOptions\n ): Promise<Capsule[]> {\n this.logger.debug(`createCapsulesFromComponents: ${components.length} components`);\n const capsules: Capsule[] = await pMap(\n components,\n (component: Component) => {\n return Capsule.createFromComponent(component, baseDir, opts);\n },\n { concurrency: concurrentComponentsLimit() }\n );\n return capsules;\n }\n\n private getRootDirOfAllCapsules(): string {\n return this.globalConfig.getGlobalCapsulesBaseDir();\n }\n\n private wereDependenciesInPackageJsonChanged(capsuleWithPackageData: CapsulePackageJsonData): boolean {\n const { previousPackageJson, currentPackageJson } = capsuleWithPackageData;\n if (!previousPackageJson) return true;\n // @ts-ignore at this point, currentPackageJson is set\n return DEPENDENCIES_FIELDS.some((field) => !isEqual(previousPackageJson[field], currentPackageJson[field]));\n }\n\n private async getCapsulesPreviousPackageJson(capsules: Capsule[]): Promise<CapsulePackageJsonData[]> {\n return Promise.all(\n capsules.map(async (capsule) => {\n const packageJsonPath = path.join(capsule.path, 'package.json');\n let previousPackageJson: any = null;\n try {\n const previousPackageJsonRaw = await capsule.fs.promises.readFile(packageJsonPath, { encoding: 'utf8' });\n previousPackageJson = JSON.parse(previousPackageJsonRaw);\n } catch (e: any) {\n // package-json doesn't exist in the capsule, that's fine, it'll be considered as a cache miss\n }\n return {\n capsule,\n previousPackageJson,\n };\n })\n );\n }\n\n private async updateWithCurrentPackageJsonData(\n capsulesWithPackagesData: CapsulePackageJsonData[],\n capsules: CapsuleList\n ) {\n return Promise.all(\n capsules.map(async (capsule) => {\n const packageJson = await this.getCurrentPackageJson(capsule, capsules);\n const found = capsulesWithPackagesData.filter((c) => c.capsule.component.id.isEqual(capsule.component.id));\n if (!found.length) throw new Error(`updateWithCurrentPackageJsonData unable to find ${capsule.component.id}`);\n if (found.length > 1)\n throw new Error(\n `updateWithCurrentPackageJsonData found duplicate capsules: ${capsule.component.id.toString()}\"\"`\n );\n found[0].currentPackageJson = packageJson.packageJsonObject;\n })\n );\n }\n\n private async getCurrentPackageJson(capsule: Capsule, capsules: CapsuleList): Promise<PackageJsonFile> {\n const component: Component = capsule.component;\n const currentVersion = getComponentPackageVersion(component);\n const getComponentDepsManifest = async (dependencies: DependencyList) => {\n const manifest = {\n dependencies: {},\n devDependencies: {},\n peerDependencies: {},\n };\n const compDeps = dependencies.toTypeArray<ComponentDependency>('component');\n const promises = compDeps.map(async (dep) => {\n const depCapsule = capsules.getCapsule(dep.componentId);\n let version = dep.version;\n if (depCapsule) {\n version = getComponentPackageVersion(depCapsule?.component);\n } else {\n version = snapToSemver(version);\n }\n const keyName = KEY_NAME_BY_LIFECYCLE_TYPE[dep.lifecycle];\n const entry = dep.toManifest();\n if (entry) {\n manifest[keyName][entry.packageName] = keyName === 'peerDependencies' ? dep.versionRange : version;\n }\n });\n await Promise.all(promises);\n return manifest;\n };\n const deps = this.dependencyResolver.getDependencies(component);\n const manifest = await getComponentDepsManifest(deps);\n\n // component.packageJsonFile is not available here. we don't mutate the component object for capsules.\n // also, don't use `PackageJsonFile.createFromComponent`, as it looses the intermediate changes\n // such as postInstall scripts for custom-module-resolution.\n const packageJson = PackageJsonFile.loadFromCapsuleSync(capsule.path);\n\n const addDependencies = (packageJsonFile: PackageJsonFile) => {\n packageJsonFile.addDependencies(manifest.dependencies);\n packageJsonFile.addDevDependencies(manifest.devDependencies);\n packageJsonFile.addPeerDependencies(manifest.peerDependencies);\n };\n addDependencies(packageJson);\n packageJson.addOrUpdateProperty('version', currentVersion);\n return packageJson;\n }\n\n async populateComponentsFilesToWriteForCapsule(\n component: Component,\n ids: ComponentIdList,\n legacyScope?: Scope,\n opts?: IsolateComponentsOptions\n ): Promise<DataToPersist> {\n const legacyComp: ConsumerComponent = component.state._consumer;\n const dataToPersist = new DataToPersist();\n const clonedFiles = legacyComp.files.map((file) => file.clone());\n const writeToPath = '.';\n clonedFiles.forEach((file) => file.updatePaths({ newBase: writeToPath }));\n dataToPersist.removePath(new RemovePath(writeToPath));\n clonedFiles.map((file) => dataToPersist.addFile(file));\n const packageJson = this.preparePackageJsonToWrite(\n component,\n writeToPath,\n ids // this.ignoreBitDependencies,\n );\n if (!legacyComp.id.hasVersion()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n packageJson.addOrUpdateProperty('version', semver.inc(legacyComp.version!, 'prerelease') || '0.0.1-0');\n }\n await PackageJsonTransformer.applyTransformers(component, packageJson);\n const valuesToMerge = legacyComp.overrides.componentOverridesPackageJsonData;\n packageJson.mergePackageJsonObject(valuesToMerge);\n dataToPersist.addFile(packageJson.toVinylFile());\n const artifacts = await this.getArtifacts(component, legacyScope, opts?.populateArtifactsFrom);\n dataToPersist.addManyFiles(artifacts);\n return dataToPersist;\n }\n\n private preparePackageJsonToWrite(\n component: Component,\n bitDir: string,\n ignoreBitDependencies: ComponentIdList | boolean = true\n ): PackageJsonFile {\n const legacyComp: ConsumerComponent = component.state._consumer;\n this.logger.debug(`package-json.preparePackageJsonToWrite. bitDir ${bitDir}.`);\n const getBitDependencies = (dependencies: ComponentIdList) => {\n if (ignoreBitDependencies === true) return {};\n return dependencies.reduce((acc, depId: ComponentID) => {\n if (Array.isArray(ignoreBitDependencies) && ignoreBitDependencies.searchWithoutVersion(depId)) return acc;\n const packageDependency = depId.version;\n const packageName = componentIdToPackageName({\n ...legacyComp,\n id: depId,\n isDependency: true,\n });\n acc[packageName] = packageDependency;\n return acc;\n }, {});\n };\n const bitDependencies = getBitDependencies(legacyComp.dependencies.getAllIds());\n const bitDevDependencies = getBitDependencies(legacyComp.devDependencies.getAllIds());\n const bitExtensionDependencies = getBitDependencies(legacyComp.extensions.extensionsBitIds);\n const packageJson = PackageJsonFile.createFromComponent(bitDir, legacyComp);\n const main = pathNormalizeToLinux(legacyComp.mainFile);\n packageJson.addOrUpdateProperty('main', main);\n const addDependencies = (packageJsonFile: PackageJsonFile) => {\n packageJsonFile.addDependencies(bitDependencies);\n packageJsonFile.addDevDependencies({\n ...bitDevDependencies,\n ...bitExtensionDependencies,\n });\n };\n addDependencies(packageJson);\n const currentVersion = getComponentPackageVersion(component);\n packageJson.addOrUpdateProperty('version', currentVersion);\n\n return packageJson;\n }\n\n /**\n * currently, it writes all artifacts.\n * later, this responsibility might move to pkg extension, which could write only artifacts\n * that are set in package.json.files[], to have a similar structure of a package.\n */\n private async getArtifacts(\n component: Component,\n legacyScope?: Scope,\n populateArtifactsFrom?: ComponentID[]\n ): Promise<AbstractVinyl[]> {\n const legacyComp: ConsumerComponent = component.state._consumer;\n if (!legacyScope) {\n if (populateArtifactsFrom) throw new Error(`unable to fetch from parent, the legacyScope was not provided`);\n // when capsules are written via the workspace, do not write artifacts, they get created by\n // build-pipeline. when capsules are written via the scope, we do need the dists.\n return [];\n }\n if (legacyComp.buildStatus !== 'succeed' && !populateArtifactsFrom) {\n // this is important for \"bit sign\" when on lane to not go to the original scope\n return [];\n }\n const artifactFilesToFetch = async () => {\n if (populateArtifactsFrom) {\n const found = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n if (!found) {\n throw new Error(\n `getArtifacts: unable to find where to populate the artifacts from for ${component.id.toString()}`\n );\n }\n const compParent = await legacyScope.getConsumerComponent(found);\n return getArtifactFilesExcludeExtension(compParent.extensions, 'teambit.pkg/pkg');\n }\n const extensionsNamesForArtifacts = ['teambit.compilation/compiler'];\n return flatten(\n extensionsNamesForArtifacts.map((extName) => getArtifactFilesByExtension(legacyComp.extensions, extName))\n );\n };\n\n const artifactsFiles = await artifactFilesToFetch();\n const artifactsVinylFlattened: ArtifactVinyl[] = [];\n await Promise.all(\n artifactsFiles.map(async (artifactFiles) => {\n if (!artifactFiles) return;\n if (!(artifactFiles instanceof ArtifactFiles)) {\n artifactFiles = deserializeArtifactFiles(artifactFiles);\n }\n // fyi, if this is coming from the isolator aspect, it is optimized to import all at once.\n // see artifact-files.importMultipleDistsArtifacts().\n const vinylFiles = await artifactFiles.getVinylsAndImportIfMissing(legacyComp.id, legacyScope);\n artifactsVinylFlattened.push(...vinylFiles);\n })\n );\n const artifactsDir = legacyComp.writtenPath;\n if (artifactsDir) {\n artifactsVinylFlattened.forEach((a) => a.updatePaths({ newBase: artifactsDir }));\n }\n return artifactsVinylFlattened;\n }\n}\n\nIsolatorAspect.addRuntime(IsolatorMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,cAAA;EAAA,MAAAR,IAA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EAClBC,kCAAkB,EAClBC,gBAAS,CACV;AAAApd,eAAA,CAVUsB,YAAY,WAWR,CAAC+b,eAAI,CAACC,QAAQ,CAAoB,CAAC,CAAC;AAAAtd,eAAA,CAXxCsB,YAAY,mBAYA,CAAC,CAAC;AAs9B3Ba,0BAAc,CAACob,UAAU,CAACjc,YAAY,CAAC","ignoreList":[]}
package/dist/network.js CHANGED
@@ -18,8 +18,8 @@ function _capsuleList() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ 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; }
23
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
24
24
  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); }
25
25
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","data","require","_capsuleList","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","Network","constructor","_graphCapsules","seedersIds","_capsulesRootDir","seedersCapsules","capsules","map","seederId","capsule","graphCapsules","getCapsule","Error","toString","CapsuleList","fromArray","originalSeedersCapsules","getOriginalSeeders","getCapsulesToCompile","Promise","all","seederCapsule","component","id","capsuleUsePreviouslySavedDists","compact","_originalSeeders","capsulesRootDir","exports"],"sources":["network.ts"],"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 *\n *\n * A more detailed explanation about the \"seeders\" vs \"originalSeeders\" vs \"graphCapsules\" is provided below:\n * an example: comp1 -> comp2 -> comp3 (as in comp1 uses comp2, comp2 uses comp3).\n * I changed only comp2.\n * From comp2 perspective, comp1 is a “dependent”, comp3 is a “dependency”.\n *\n * When I run bit build with no args, it finds only one modified component: comp2, however, it doesn’t stop here. It also look for the dependents, in this case, comp1. So the seeders of this bit-build command are two: “comp1” and “comp2\".\n * The reason why the dependents are included is because you modified comp2, it’s possible you broke comp1. We want to build comp1 as well to make sure it’s still okay.\n * (btw, bit test command also include dependents when it provided with no args).\n *\n * Keep in mind that also bit tag normally runs on the dependents as well (when it runs the build pipeline), because these are the “auto-tag”.\n * With these two seeders it builds the graph. The graph calculates all the dependencies of the given seeders recursively. Eventually, it puts them in an instance of Network class.\n * In our case, if all components use the same env, the Network consist of:\n * seedersCapsules: [comp1, comp2]\n * originalSeedersCapsules: [comp1, comp2]\n * graphCapsules: [comp1, comp2, comp3].\n *\n * It gets more complex when multiple envs involved.\n * Imagine that comp1 uses env1, comp2 uses env2 and comp3 uses env3.\n * Because bit build runs the tasks per env, it needs to create 3 networks. Each per env.\n * The “seeders” refer to the seeders of the same env and includes only components from the same env.\n * The “originalSeeders” refer to the ones that originally started the build command and are from the same env.\n * Network1:\n * seedersCapsules: [comp1]\n * originalSeedersCapsules: [comp1]\n * graphCapsules: [comp1, comp2, comp3].\n * Network2:\n * seedersCapsules: [comp2]\n * originalSeedersCapsules: [comp2]\n * graphCapsules: [comp2, comp3].\n * Network3:\n * seedersCapsules: [comp3]\n * originalSeedersCapsules: []\n * graphCapsules: [comp3].\n * As you can see, in network3, the originalSeeders is empty, because comp3 wasn’t part of the original seeders.\n * These 3 networks are created for build-pipeline. This pipeline asks for all components in the graph and then create the network per env.\n * Snap/Tag pipelines are different. They ask only for the components about to tag/snap, which are the original-seeders, and create the network per env. For them, we end up with 2 network instances only. network1 and network2. Also, the seedersCapsules and originalSeedersCapsules are the same because we create the network instances out of the seeders only, without the dependencies.\n * A build-task provides context with a network instance to the execute() method. (it also provide Component[] which are the “seeders”. not “originalSeeders”).\n *\n * Each build-task can decide on what components to operate. It has 3 options:\n * run on graphCapsules. If you do that, you risk running your task multiple times on the same components. In the example above, a task of build-pipeline, will run 3 times on comp3, because this component is part of the graphCapsules in each one of the network instance. So this is probably not recommended for most tasks.\n * run on seedersCapsules. With this option you make sure that your task is running for each one of the capsules and it runs only once. This is good for example for the compiler task. It needs to make sure all capsules are built. Otherwise, if it’s running only on originalSeedersCapsules, the comp3 won’t be compiled, the dists will be missing and comp2 won’t be able to run its tests.\n * run on originalSeedersCapsules . With this option you ensure that your task runs only on the ids you started with and you don’t run them on the dependencies. This is the option that most tasks probably need. An example is the test task, it should test only the seeders, no need to test the dependencies.\n *\n * Again, the distinction between seedersCapsules and originalSeedersCapsules is relevant for build-pipeline only. For tag-pipeline and snap-pipeline, these two are the same. You can see for example that Publisher task runs on seedersCapsules and that’s fine, it won’t be running on dependencies unexpectedly, only on the components it’s now tagging.\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 non build-tasks, this includes the original components the network was created for.\n *\n * for build-tasks (during bit build/tag/snap), this `Network` instance is created per env, and it depends on the pipeline.\n * build-pipeline: includes the component graph (meaning include the dependencies) of the current env.\n * snap/tag pipeline: it's the same as `this.originalSeedersCapsules`. it includes only the original to\n * tag/snap/build of the current env.\n *\n * for example comp1 of env1 is using comp2 of env2. when running build/tag/snap on comp1 only, two networks are created\n * for build pipeline:\n * network1: seedersCapsules: [comp1], originalSeedersCapsules: [comp1], graphCapsules: [comp1, comp2]\n * network2: seedersCapsules: [comp2], originalSeedersCapsules: [], graphCapsules: [comp2]\n *\n * for snap/tag pipeline, only network1 is created, and it includes only the originalSeedersCapsules.\n *\n * see the description of this Network class for more info.\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 non build-tasks, this is the same as `this.seedersCapsules`, which includes the original components the\n * network was created for.\n *\n * for build-tasks (during bit build/tag/snap), this includes the component to build/tag/snap of the current env.\n * see the description of this Network class for more info.\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 capsuleUsePreviouslySavedDists = await CapsuleList.capsuleUsePreviouslySavedDists(\n seederCapsule.component\n );\n return capsuleUsePreviouslySavedDists ? null : seederCapsule;\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"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,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F,aAAa;MACtB;MACA,MAAMG,8BAA8B,GAAG,MAAMV,sBAAW,CAACU,8BAA8B,CACrFH,aAAa,CAACC,SAChB,CAAC;MACD,OAAOE,8BAA8B,GAAG,IAAI,GAAGH,aAAa;IAC9D,CAAC,CACH,CAAC;IACD,OAAOP,sBAAW,CAACC,SAAS,CAAC,IAAAU,iBAAO,EAACnB,QAAQ,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;AACA;EACUW,kBAAkBA,CAAA,EAAkB;IAC1C,OAAO,IAAI,CAACS,gBAAgB,IAAI,IAAI,CAACvB,UAAU;EACjD;;EAEA;AACF;AACA;EACE,IAAIO,aAAaA,CAAA,EAAgB;IAC/B,OAAO,IAAI,CAACR,cAAc;EAC5B;EAEA,IAAIyB,eAAeA,CAAA,EAAwB;IACzC,OAAO,IAAI,CAACvB,gBAAgB;EAC9B;AACF;AAACwB,OAAA,CAAA5B,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_lodash","data","require","_capsuleList","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Network","constructor","_graphCapsules","seedersIds","_capsulesRootDir","seedersCapsules","capsules","map","seederId","capsule","graphCapsules","getCapsule","Error","toString","CapsuleList","fromArray","originalSeedersCapsules","getOriginalSeeders","getCapsulesToCompile","Promise","all","seederCapsule","component","id","capsuleUsePreviouslySavedDists","compact","_originalSeeders","capsulesRootDir","exports"],"sources":["network.ts"],"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 *\n *\n * A more detailed explanation about the \"seeders\" vs \"originalSeeders\" vs \"graphCapsules\" is provided below:\n * an example: comp1 -> comp2 -> comp3 (as in comp1 uses comp2, comp2 uses comp3).\n * I changed only comp2.\n * From comp2 perspective, comp1 is a “dependent”, comp3 is a “dependency”.\n *\n * When I run bit build with no args, it finds only one modified component: comp2, however, it doesn’t stop here. It also look for the dependents, in this case, comp1. So the seeders of this bit-build command are two: “comp1” and “comp2\".\n * The reason why the dependents are included is because you modified comp2, it’s possible you broke comp1. We want to build comp1 as well to make sure it’s still okay.\n * (btw, bit test command also include dependents when it provided with no args).\n *\n * Keep in mind that also bit tag normally runs on the dependents as well (when it runs the build pipeline), because these are the “auto-tag”.\n * With these two seeders it builds the graph. The graph calculates all the dependencies of the given seeders recursively. Eventually, it puts them in an instance of Network class.\n * In our case, if all components use the same env, the Network consist of:\n * seedersCapsules: [comp1, comp2]\n * originalSeedersCapsules: [comp1, comp2]\n * graphCapsules: [comp1, comp2, comp3].\n *\n * It gets more complex when multiple envs involved.\n * Imagine that comp1 uses env1, comp2 uses env2 and comp3 uses env3.\n * Because bit build runs the tasks per env, it needs to create 3 networks. Each per env.\n * The “seeders” refer to the seeders of the same env and includes only components from the same env.\n * The “originalSeeders” refer to the ones that originally started the build command and are from the same env.\n * Network1:\n * seedersCapsules: [comp1]\n * originalSeedersCapsules: [comp1]\n * graphCapsules: [comp1, comp2, comp3].\n * Network2:\n * seedersCapsules: [comp2]\n * originalSeedersCapsules: [comp2]\n * graphCapsules: [comp2, comp3].\n * Network3:\n * seedersCapsules: [comp3]\n * originalSeedersCapsules: []\n * graphCapsules: [comp3].\n * As you can see, in network3, the originalSeeders is empty, because comp3 wasn’t part of the original seeders.\n * These 3 networks are created for build-pipeline. This pipeline asks for all components in the graph and then create the network per env.\n * Snap/Tag pipelines are different. They ask only for the components about to tag/snap, which are the original-seeders, and create the network per env. For them, we end up with 2 network instances only. network1 and network2. Also, the seedersCapsules and originalSeedersCapsules are the same because we create the network instances out of the seeders only, without the dependencies.\n * A build-task provides context with a network instance to the execute() method. (it also provide Component[] which are the “seeders”. not “originalSeeders”).\n *\n * Each build-task can decide on what components to operate. It has 3 options:\n * run on graphCapsules. If you do that, you risk running your task multiple times on the same components. In the example above, a task of build-pipeline, will run 3 times on comp3, because this component is part of the graphCapsules in each one of the network instance. So this is probably not recommended for most tasks.\n * run on seedersCapsules. With this option you make sure that your task is running for each one of the capsules and it runs only once. This is good for example for the compiler task. It needs to make sure all capsules are built. Otherwise, if it’s running only on originalSeedersCapsules, the comp3 won’t be compiled, the dists will be missing and comp2 won’t be able to run its tests.\n * run on originalSeedersCapsules . With this option you ensure that your task runs only on the ids you started with and you don’t run them on the dependencies. This is the option that most tasks probably need. An example is the test task, it should test only the seeders, no need to test the dependencies.\n *\n * Again, the distinction between seedersCapsules and originalSeedersCapsules is relevant for build-pipeline only. For tag-pipeline and snap-pipeline, these two are the same. You can see for example that Publisher task runs on seedersCapsules and that’s fine, it won’t be running on dependencies unexpectedly, only on the components it’s now tagging.\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 non build-tasks, this includes the original components the network was created for.\n *\n * for build-tasks (during bit build/tag/snap), this `Network` instance is created per env, and it depends on the pipeline.\n * build-pipeline: includes the component graph (meaning include the dependencies) of the current env.\n * snap/tag pipeline: it's the same as `this.originalSeedersCapsules`. it includes only the original to\n * tag/snap/build of the current env.\n *\n * for example comp1 of env1 is using comp2 of env2. when running build/tag/snap on comp1 only, two networks are created\n * for build pipeline:\n * network1: seedersCapsules: [comp1], originalSeedersCapsules: [comp1], graphCapsules: [comp1, comp2]\n * network2: seedersCapsules: [comp2], originalSeedersCapsules: [], graphCapsules: [comp2]\n *\n * for snap/tag pipeline, only network1 is created, and it includes only the originalSeedersCapsules.\n *\n * see the description of this Network class for more info.\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 non build-tasks, this is the same as `this.seedersCapsules`, which includes the original components the\n * network was created for.\n *\n * for build-tasks (during bit build/tag/snap), this includes the component to build/tag/snap of the current env.\n * see the description of this Network class for more info.\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 capsuleUsePreviouslySavedDists = await CapsuleList.capsuleUsePreviouslySavedDists(\n seederCapsule.component\n );\n return capsuleUsePreviouslySavedDists ? null : seederCapsule;\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"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAA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AC1C,OAAO,IAAI,CAACS,gBAAgB,IAAI,IAAI,CAACvB,UAAU;EACjD;;EAEA;AACF;AACA;EACE,IAAIO,aAAaA,CAAA,EAAgB;IAC/B,OAAO,IAAI,CAACR,cAAc;EAC5B;EAEA,IAAIyB,eAAeA,CAAA,EAAwB;IACzC,OAAO,IAAI,CAACvB,gBAAgB;EAC9B;AACF;AAACwB,OAAA,CAAA5B,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.282/dist/isolator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.282/dist/isolator.docs.md';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.284/dist/isolator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.284/dist/isolator.docs.md';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -19,7 +19,7 @@ function _path() {
19
19
  };
20
20
  return data;
21
21
  }
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
23
23
  async function symlinkDependenciesToCapsules(capsules, capsuleList, logger) {
24
24
  logger.debug(`symlinkDependenciesToCapsules, ${capsules.length} capsules`);
25
25
  return Object.fromEntries(await Promise.all(capsules.map(capsule => {
@@ -1 +1 @@
1
- {"version":3,"names":["_componentIdToPackageName","data","_interopRequireDefault","require","_path","obj","__esModule","default","symlinkDependenciesToCapsules","capsules","capsuleList","logger","debug","length","Object","fromEntries","Promise","all","map","capsule","symlinkComponent","component","state","_consumer","symlinkOnCapsuleRoot","capsuleRoot","modulesPath","path","join","packageName","componentIdToPackageName","dest","from","to","componentCapsule","getCapsuleIgnoreVersion","id","Error","toString","allDeps","getAllDependenciesIds","linkResults","reduce","acc","depId","devCapsule","toStringWithoutVersion","devCapsulePath"],"sources":["symlink-dependencies-to-capsules.ts"],"sourcesContent":["import { LinkDetail } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport path from 'path';\n\nimport { Capsule } from './capsule';\nimport CapsuleList from './capsule-list';\n\nexport async function symlinkDependenciesToCapsules(\n capsules: Capsule[],\n capsuleList: CapsuleList,\n logger: Logger\n): Promise<Record<string, Record<string, string>>> {\n logger.debug(`symlinkDependenciesToCapsules, ${capsules.length} capsules`);\n return Object.fromEntries(\n await Promise.all(\n capsules.map((capsule) => {\n return symlinkComponent(capsule.component.state._consumer, capsuleList, logger);\n })\n )\n );\n}\n\nexport async function symlinkOnCapsuleRoot(\n capsuleList: CapsuleList,\n logger: Logger,\n capsuleRoot: string\n): Promise<LinkDetail[]> {\n const modulesPath = path.join(capsuleRoot, 'node_modules');\n return capsuleList.map((capsule) => {\n const packageName = componentIdToPackageName(capsule.component.state._consumer);\n const dest = path.join(modulesPath, packageName);\n return {\n from: capsule.path,\n to: dest,\n packageName,\n };\n });\n}\n\nasync function symlinkComponent(\n component: ConsumerComponent,\n capsuleList: CapsuleList,\n logger: Logger\n): Promise<[string, Record<string, string>]> {\n const componentCapsule = capsuleList.getCapsuleIgnoreVersion(component.id);\n if (!componentCapsule) throw new Error(`unable to find the capsule for ${component.id.toString()}`);\n const allDeps = component.getAllDependenciesIds();\n const linkResults = allDeps.reduce((acc, depId: ComponentID) => {\n // TODO: this is dangerous - we might have 2 capsules for the same component with different version, then we might link to the wrong place\n const devCapsule = capsuleList.getCapsuleIgnoreVersion(depId);\n if (!devCapsule) {\n // happens when a dependency is not in the workspace. (it gets installed via the package manager)\n logger.debug(\n `symlinkComponentToCapsule: unable to find the capsule for ${depId.toStringWithoutVersion()}. skipping`\n );\n return acc;\n }\n const packageName = componentIdToPackageName(devCapsule.component.state._consumer);\n const devCapsulePath = devCapsule.path;\n acc[packageName] = `link:${devCapsulePath}`;\n return acc;\n }, {});\n\n return [componentCapsule.path, linkResults];\n}\n"],"mappings":";;;;;;;AAIA,SAAAA,0BAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,yBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKjB,eAAeG,6BAA6BA,CACjDC,QAAmB,EACnBC,WAAwB,EACxBC,MAAc,EACmC;EACjDA,MAAM,CAACC,KAAK,CAAE,kCAAiCH,QAAQ,CAACI,MAAO,WAAU,CAAC;EAC1E,OAAOC,MAAM,CAACC,WAAW,CACvB,MAAMC,OAAO,CAACC,GAAG,CACfR,QAAQ,CAACS,GAAG,CAAEC,OAAO,IAAK;IACxB,OAAOC,gBAAgB,CAACD,OAAO,CAACE,SAAS,CAACC,KAAK,CAACC,SAAS,EAAEb,WAAW,EAAEC,MAAM,CAAC;EACjF,CAAC,CACH,CACF,CAAC;AACH;AAEO,eAAea,oBAAoBA,CACxCd,WAAwB,EACxBC,MAAc,EACdc,WAAmB,EACI;EACvB,MAAMC,WAAW,GAAGC,eAAI,CAACC,IAAI,CAACH,WAAW,EAAE,cAAc,CAAC;EAC1D,OAAOf,WAAW,CAACQ,GAAG,CAAEC,OAAO,IAAK;IAClC,MAAMU,WAAW,GAAG,IAAAC,mCAAwB,EA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
+ {"version":3,"names":["_componentIdToPackageName","data","_interopRequireDefault","require","_path","e","__esModule","default","symlinkDependenciesToCapsules","capsules","capsuleList","logger","debug","length","Object","fromEntries","Promise","all","map","capsule","symlinkComponent","component","state","_consumer","symlinkOnCapsuleRoot","capsuleRoot","modulesPath","path","join","packageName","componentIdToPackageName","dest","from","to","componentCapsule","getCapsuleIgnoreVersion","id","Error","toString","allDeps","getAllDependenciesIds","linkResults","reduce","acc","depId","devCapsule","toStringWithoutVersion","devCapsulePath"],"sources":["symlink-dependencies-to-capsules.ts"],"sourcesContent":["import { LinkDetail } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport path from 'path';\n\nimport { Capsule } from './capsule';\nimport CapsuleList from './capsule-list';\n\nexport async function symlinkDependenciesToCapsules(\n capsules: Capsule[],\n capsuleList: CapsuleList,\n logger: Logger\n): Promise<Record<string, Record<string, string>>> {\n logger.debug(`symlinkDependenciesToCapsules, ${capsules.length} capsules`);\n return Object.fromEntries(\n await Promise.all(\n capsules.map((capsule) => {\n return symlinkComponent(capsule.component.state._consumer, capsuleList, logger);\n })\n )\n );\n}\n\nexport async function symlinkOnCapsuleRoot(\n capsuleList: CapsuleList,\n logger: Logger,\n capsuleRoot: string\n): Promise<LinkDetail[]> {\n const modulesPath = path.join(capsuleRoot, 'node_modules');\n return capsuleList.map((capsule) => {\n const packageName = componentIdToPackageName(capsule.component.state._consumer);\n const dest = path.join(modulesPath, packageName);\n return {\n from: capsule.path,\n to: dest,\n packageName,\n };\n });\n}\n\nasync function symlinkComponent(\n component: ConsumerComponent,\n capsuleList: CapsuleList,\n logger: Logger\n): Promise<[string, Record<string, string>]> {\n const componentCapsule = capsuleList.getCapsuleIgnoreVersion(component.id);\n if (!componentCapsule) throw new Error(`unable to find the capsule for ${component.id.toString()}`);\n const allDeps = component.getAllDependenciesIds();\n const linkResults = allDeps.reduce((acc, depId: ComponentID) => {\n // TODO: this is dangerous - we might have 2 capsules for the same component with different version, then we might link to the wrong place\n const devCapsule = capsuleList.getCapsuleIgnoreVersion(depId);\n if (!devCapsule) {\n // happens when a dependency is not in the workspace. (it gets installed via the package manager)\n logger.debug(\n `symlinkComponentToCapsule: unable to find the capsule for ${depId.toStringWithoutVersion()}. skipping`\n );\n return acc;\n }\n const packageName = componentIdToPackageName(devCapsule.component.state._consumer);\n const devCapsulePath = devCapsule.path;\n acc[packageName] = `link:${devCapsulePath}`;\n return acc;\n }, {});\n\n return [componentCapsule.path, linkResults];\n}\n"],"mappings":";;;;;;;AAIA,SAAAA,0BAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,yBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKjB,eAAeG,6BAA6BA,CACjDC,QAAmB,EACnBC,WAAwB,EACxBC,MAAc,EACmC;EACjDA,MAAM,CAACC,KAAK,CAAC,kCAAkCH,QAAQ,CAACI,MAAM,WAAW,CAAC;EAC1E,OAAOC,MAAM,CAACC,WAAW,CACvB,MAAMC,OAAO,CAACC,GAAG,CACfR,QAAQ,CAACS,GAAG,CAAEC,OAAO,IAAK;IACxB,OAAOC,gBAAgB,CAACD,OAAO,CAACE,SAAS,CAACC,KAAK,CAACC,SAAS,EAAEb,WAAW,EAAEC,MAAM,CAAC;EACjF,CAAC,CACH,CACF,CAAC;AACH;AAEO,eAAea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cAAc,GAAGF,UAAU,CAAClB,IAAI;IACtCgB,GAAG,CAACd,WAAW,CAAC,GAAG,QAAQkB,cAAc,EAAE;IAC3C,OAAOJ,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EAEN,OAAO,CAACT,gBAAgB,CAACP,IAAI,EAAEc,WAAW,CAAC;AAC7C","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/isolator",
3
- "version": "1.0.282",
3
+ "version": "1.0.284",
4
4
  "homepage": "https://bit.cloud/teambit/component/isolator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "isolator",
9
- "version": "1.0.282"
9
+ "version": "1.0.284"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -26,14 +26,14 @@
26
26
  "@teambit/component-id": "1.2.0",
27
27
  "@teambit/graph.cleargraph": "0.0.8",
28
28
  "@teambit/harmony": "0.4.6",
29
- "@teambit/component": "1.0.282",
30
- "@teambit/dependency-resolver": "1.0.282",
31
- "@teambit/aspect-loader": "1.0.282",
29
+ "@teambit/component": "1.0.284",
30
+ "@teambit/dependency-resolver": "1.0.284",
31
+ "@teambit/aspect-loader": "1.0.284",
32
32
  "@teambit/cli": "0.0.865",
33
33
  "@teambit/component-package-version": "0.0.433",
34
34
  "@teambit/dependencies.fs.linked-dependencies": "0.0.9",
35
35
  "@teambit/global-config": "0.0.868",
36
- "@teambit/graph": "1.0.282",
36
+ "@teambit/graph": "1.0.284",
37
37
  "@teambit/logger": "0.0.958",
38
38
  "@teambit/workspace.modules.node-modules-linker": "0.0.173"
39
39
  },