@teambit/isolator 0.0.549 → 0.0.555

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.
@@ -4,13 +4,44 @@ import { Component } from '@teambit/component';
4
4
  import FsContainer, { BitExecOption } from './container';
5
5
  import ContainerExec from './container-exec';
6
6
  export default class Capsule extends CapsuleTemplate<Exec, NodeFS> {
7
+ /**
8
+ * container implementation the capsule is being executed within.
9
+ */
7
10
  protected container: FsContainer;
11
+ /**
12
+ * the capsule's file system.
13
+ */
8
14
  readonly fs: NodeFS;
15
+ /**
16
+ * console for controlling process streams as stdout, stdin and stderr.
17
+ */
9
18
  readonly console: Console;
19
+ /**
20
+ * capsule's state.
21
+ */
10
22
  readonly state: State;
11
23
  readonly component: Component;
12
24
  private _wrkDir;
13
- constructor(container: FsContainer, fs: NodeFS, console: Console, state: State, component: Component);
25
+ constructor(
26
+ /**
27
+ * container implementation the capsule is being executed within.
28
+ */
29
+ container: FsContainer,
30
+ /**
31
+ * the capsule's file system.
32
+ */
33
+ fs: NodeFS,
34
+ /**
35
+ * console for controlling process streams as stdout, stdin and stderr.
36
+ */
37
+ console: Console,
38
+ /**
39
+ * capsule's state.
40
+ */
41
+ state: State, component: Component);
42
+ /**
43
+ * @deprecated please use `this.path`
44
+ */
14
45
  get wrkDir(): string;
15
46
  get path(): string;
16
47
  start(): Promise<any>;
@@ -20,6 +51,13 @@ export default class Capsule extends CapsuleTemplate<Exec, NodeFS> {
20
51
  removePath(dir: string): Promise<any>;
21
52
  symlink(src: string, dest: string): Promise<any>;
22
53
  execute(cmd: string, options?: Record<string, any> | null | undefined): Promise<unknown>;
54
+ /**
55
+ * @todo: fix.
56
+ * it skips the capsule fs because for some reason `capsule.fs.promises.readdir` doesn't work
57
+ * the same as `capsule.fs.readdir` and it doesn't have the capsule dir as pwd.
58
+ *
59
+ * returns the paths inside the capsule
60
+ */
23
61
  getAllFilesPaths(dir?: string, options?: {
24
62
  ignore?: string[];
25
63
  }): any;
@@ -19,21 +19,60 @@ export declare type IsolateComponentsInstallOptions = {
19
19
  installTeambitBit?: boolean;
20
20
  };
21
21
  declare type CreateGraphOptions = {
22
+ /**
23
+ * include components that exists in nested hosts. for example include components that exist in scope but not in the workspace
24
+ */
22
25
  includeFromNestedHosts?: boolean;
26
+ /**
27
+ * Force specific host to get the component from.
28
+ */
23
29
  host?: ComponentFactory;
24
30
  };
25
31
  export declare type IsolateComponentsOptions = CreateGraphOptions & {
26
32
  name?: string;
33
+ /**
34
+ * absolute path to put all the capsules dirs inside.
35
+ */
27
36
  rootBaseDir?: string;
37
+ /**
38
+ * the capsule root-dir based on a *hash* of this baseDir, not on the baseDir itself.
39
+ * A folder with this hash as its name will be created in the rootBaseDir
40
+ * By default this value will be the host path
41
+ */
28
42
  baseDir?: string;
43
+ /**
44
+ * create a new capsule with a random string attached to the path suffix
45
+ */
29
46
  alwaysNew?: boolean;
47
+ /**
48
+ * installation options
49
+ */
30
50
  installOptions?: IsolateComponentsInstallOptions;
31
51
  linkingOptions?: LinkingOptions;
52
+ /**
53
+ * delete the capsule rootDir first. it makes sure that the isolation process starts fresh with
54
+ * no previous capsules. for build and tag this is true.
55
+ */
32
56
  emptyRootDir?: boolean;
57
+ /**
58
+ * skip the reproduction of the capsule in case it exists.
59
+ */
33
60
  skipIfExists?: boolean;
61
+ /**
62
+ * get existing capsule without doing any changes, no writes, no installations.
63
+ */
34
64
  getExistingAsIs?: boolean;
65
+ /**
66
+ * place the package-manager cache on the capsule-root
67
+ */
35
68
  cachePackagesOnCapsulesRoot?: boolean;
69
+ /**
70
+ * do not build graph with all dependencies. isolate the seeders only.
71
+ */
36
72
  seedersOnly?: boolean;
73
+ /**
74
+ * Force specific host to get the component from.
75
+ */
37
76
  host?: ComponentFactory;
38
77
  };
39
78
  export declare class IsolatorMain {
@@ -58,6 +97,13 @@ export declare class IsolatorMain {
58
97
  constructor(dependencyResolver: DependencyResolverMain, logger: Logger, componentAspect: ComponentMain, graphBuilder: GraphBuilder, globalConfig: GlobalConfigMain);
59
98
  isolateComponents(seeders: ComponentID[], opts?: IsolateComponentsOptions, legacyScope?: LegacyScope): Promise<Network>;
60
99
  private createGraph;
100
+ /**
101
+ * Create capsules for the provided components
102
+ * do not use this outside directly, use isolate components which build the entire network
103
+ * @param components
104
+ * @param opts
105
+ * @param legacyScope
106
+ */
61
107
  private createCapsules;
62
108
  private installInCapsules;
63
109
  private linkInCapsules;
package/dist/network.d.ts CHANGED
@@ -6,7 +6,14 @@ export declare class Network {
6
6
  private seedersIds;
7
7
  private _capsulesRootDir;
8
8
  constructor(_graphCapsules: CapsuleList, seedersIds: ComponentID[], _capsulesRootDir: string);
9
+ /**
10
+ * seeders capsules only without the entire graph. normally, this includes the capsules of one
11
+ * env.
12
+ */
9
13
  get seedersCapsules(): CapsuleList;
14
+ /**
15
+ * all capsules, including the dependencies of the seeders. (even when they belong to another env)
16
+ */
10
17
  get graphCapsules(): CapsuleList;
11
18
  get capsulesRootDir(): PathOsBasedAbsolute;
12
19
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/isolator",
3
- "version": "0.0.549",
3
+ "version": "0.0.555",
4
4
  "homepage": "https://bit.dev/teambit/component/isolator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "isolator",
9
- "version": "0.0.549"
9
+ "version": "0.0.555"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -23,14 +23,14 @@
23
23
  "execa": "2.1.0",
24
24
  "@babel/runtime": "7.12.18",
25
25
  "core-js": "^3.0.0",
26
- "@teambit/component": "0.0.549",
27
- "@teambit/legacy-bit-id": "0.0.369",
28
- "@teambit/cli": "0.0.380",
29
- "@teambit/component-package-version": "0.0.366",
30
- "@teambit/dependency-resolver": "0.0.549",
31
- "@teambit/global-config": "0.0.381",
32
- "@teambit/graph": "0.0.549",
33
- "@teambit/logger": "0.0.465"
26
+ "@teambit/component": "0.0.555",
27
+ "@teambit/legacy-bit-id": "0.0.375",
28
+ "@teambit/cli": "0.0.386",
29
+ "@teambit/component-package-version": "0.0.372",
30
+ "@teambit/dependency-resolver": "0.0.555",
31
+ "@teambit/global-config": "0.0.387",
32
+ "@teambit/graph": "0.0.555",
33
+ "@teambit/logger": "0.0.471"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/fs-extra": "9.0.7",
@@ -45,7 +45,7 @@
45
45
  "@types/node": "12.20.4"
46
46
  },
47
47
  "peerDependencies": {
48
- "@teambit/legacy": "1.0.76",
48
+ "@teambit/legacy": "1.0.172",
49
49
  "react-dom": "^16.8.0 || ^17.0.0",
50
50
  "react": "^16.8.0 || ^17.0.0"
51
51
  },
@@ -73,7 +73,7 @@
73
73
  "react": "-"
74
74
  },
75
75
  "peerDependencies": {
76
- "@teambit/legacy": "1.0.76",
76
+ "@teambit/legacy": "1.0.172",
77
77
  "react-dom": "^16.8.0 || ^17.0.0",
78
78
  "react": "^16.8.0 || ^17.0.0"
79
79
  }
package/tsconfig.json CHANGED
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },