@teambit/isolator 1.0.108 → 1.0.109

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.
@@ -0,0 +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={35001:(e,t,o)=>{var n={id:"teambit.component/isolator@1.0.109",homepage:"https://bit.cloud/teambit/component/isolator",exported:!0};function r(){const e=s(o(87363));return r=function(){return e},e}function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,s.__bit_component=n;const a=()=>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"}));a.__bit_component=n,t.Logo=a},87363:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.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(35001);o(87363);const r=MdxJsReact,s=TeambitMdxUiMdxScopeContext;var a=["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,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)o=s[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)o=s[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,a);return(0,r.mdx)(p,i({},l,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(s.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,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@1.0.108/dist/isolator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@1.0.108/dist/isolator.docs.md';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@1.0.109/dist/isolator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@1.0.109/dist/isolator.docs.md';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/isolator",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
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.108"
9
+ "version": "1.0.109"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -27,16 +27,16 @@
27
27
  "@teambit/component-id": "1.2.0",
28
28
  "@teambit/graph.cleargraph": "0.0.1",
29
29
  "@teambit/harmony": "0.4.6",
30
- "@teambit/component": "1.0.108",
31
- "@teambit/dependency-resolver": "1.0.108",
32
- "@teambit/aspect-loader": "1.0.108",
33
- "@teambit/cli": "0.0.840",
30
+ "@teambit/component": "1.0.109",
31
+ "@teambit/dependency-resolver": "1.0.109",
32
+ "@teambit/aspect-loader": "1.0.109",
33
+ "@teambit/cli": "0.0.841",
34
34
  "@teambit/component-package-version": "0.0.431",
35
35
  "@teambit/dependencies.fs.linked-dependencies": "0.0.6",
36
- "@teambit/global-config": "0.0.842",
37
- "@teambit/graph": "1.0.108",
38
- "@teambit/logger": "0.0.933",
39
- "@teambit/workspace.modules.node-modules-linker": "0.0.158"
36
+ "@teambit/global-config": "0.0.843",
37
+ "@teambit/graph": "1.0.109",
38
+ "@teambit/logger": "0.0.934",
39
+ "@teambit/workspace.modules.node-modules-linker": "0.0.159"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/fs-extra": "9.0.7",
@@ -47,7 +47,7 @@
47
47
  "@types/mocha": "9.1.0",
48
48
  "@types/jest": "^29.2.2",
49
49
  "@types/testing-library__jest-dom": "^5.9.5",
50
- "@teambit/harmony.envs.core-aspect-env": "0.0.13"
50
+ "@teambit/harmony.envs.core-aspect-env": "0.0.14"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "react": "^17.0.0 || ^18.0.0",
package/capsule-list.ts DELETED
@@ -1,65 +0,0 @@
1
- import type { Component } from '@teambit/component';
2
- import { Dependency, DependencyResolverMain } from '@teambit/dependency-resolver';
3
- import { Edge, Graph, Node } from '@teambit/graph.cleargraph';
4
- import { ComponentID } from '@teambit/component-id';
5
- import { normalize } from 'path';
6
- import { Capsule } from './capsule';
7
-
8
- export default class CapsuleList extends Array<Capsule> {
9
- getCapsule(id: ComponentID): Capsule | undefined {
10
- return this.find((capsule) => capsule.component.id.isEqual(id));
11
- }
12
- getCapsuleByLegacyId(id: ComponentID): Capsule | undefined {
13
- return this.find((capsule) => capsule.component.id.isEqual(id));
14
- }
15
- getCapsuleIgnoreVersion(id: ComponentID): Capsule | undefined {
16
- return this.find((capsule) => capsule.component.id.isEqual(id, { ignoreVersion: true }));
17
- }
18
- getAllCapsuleDirs(): string[] {
19
- return this.map((capsule) => capsule.path);
20
- }
21
- getIdByPathInCapsule(pathInCapsule: string): ComponentID | null {
22
- const normalizedPathInCapsule = normalize(pathInCapsule);
23
- const found = this.find((capsule) => normalizedPathInCapsule === normalize(capsule.path));
24
- return found ? found.component.id : null;
25
- }
26
- getAllComponents(): Component[] {
27
- return this.map((c) => c.component);
28
- }
29
- // Sort the capsules by their dependencies. The capsules with no dependencies will be first. Returns a new array.
30
- async toposort(depResolver: DependencyResolverMain): Promise<CapsuleList> {
31
- const components = this.getAllComponents();
32
- const graph = new Graph<Component, string>();
33
-
34
- // Build a graph with all the components from the current capsule list
35
- components.forEach((comp: Component) => graph.setNode(new Node(depResolver.getPackageName(comp), comp)));
36
-
37
- // Add edges between the components according to their interdependencies
38
- for (const node of graph.nodes) {
39
- // eslint-disable-next-line no-await-in-loop
40
- const deps = await depResolver.getDependencies(node.attr);
41
- deps.forEach((dep: Dependency) => {
42
- const depPkgName = dep.getPackageName?.();
43
- if (depPkgName && graph.hasNode(depPkgName)) {
44
- graph.setEdge(new Edge(node.id, depPkgName, dep.lifecycle));
45
- }
46
- });
47
- }
48
-
49
- const sortedSeeders = graph.toposort(true);
50
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
- const sortedCapsules: Capsule[] = sortedSeeders.map((node: Node<Component>) => this.getCapsule(node.attr.id)!);
52
- return CapsuleList.fromArray(sortedCapsules);
53
- }
54
- static fromArray(capsules: Capsule[]) {
55
- return new CapsuleList(...capsules);
56
- }
57
- /**
58
- * determines whether or not a capsule can theoretically use the dists saved in the last snap, rather than re-compile them.
59
- * practically, this optimization is used for components that have typescript as their compiler.
60
- */
61
- static async capsuleUsePreviouslySavedDists(component: Component): Promise<boolean> {
62
- const isModified = await component.isModified();
63
- return component.buildStatus === 'succeed' && !isModified;
64
- }
65
- }
package/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export { CAPSULE_READY_FILE } from './isolator.main.runtime';
2
- export { Network } from './network';
3
- export { FsContainer, Capsule, ContainerExec } from './capsule';
4
- export type { IsolatorMain, IsolateComponentsOptions } from './isolator.main.runtime';
5
- export { IsolatorAspect } from './isolator.aspect';
6
- export { default as CapsuleList } from './capsule-list';
@@ -1,7 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const IsolatorAspect = Aspect.create({
4
- id: 'teambit.component/isolator',
5
- dependencies: [],
6
- defaultConfig: {},
7
- });