@teambit/isolator 1.0.226 → 1.0.228

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/network.d.ts DELETED
@@ -1,122 +0,0 @@
1
- import { ComponentID } from '@teambit/component';
2
- import { PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';
3
- import CapsuleList from './capsule-list';
4
- /**
5
- * collection of isolated components (capsules).
6
- * normally, "seeders" are the components that this network was created for.
7
- * "graphCapsules" is the graph created from the seeders and it includes also the dependencies.
8
- *
9
- * however, during "bit build"/"bit tag"/"bit snap", things are more complex because there is one more variable in the
10
- * picture, which is the "env". the Network is created per env.
11
- * in practice, for "build-task", a task is called per env, and the network passed to the task is relevant to that env.
12
- * the "originalSeeders" are the ones the network was created for, but only for this env.
13
- * the "seeders" are similar to the "graphCapsules" above, which contains also the dependencies, but only for this env.
14
- * the "graphCapsules" is the entire graph, including capsules from other envs.
15
- *
16
- * for example:
17
- * comp1 depends on comp2. comp1 env is "react". comp2 env is "aspect".
18
- *
19
- * when the user is running "bit build comp1", two `Network` instances will be created with the following:
20
- * Network for "react" env: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].
21
- * Network for "aspect" env: originalSeeders: [], seeders: ['comp2'], graphCapsules: ['comp2'].
22
- *
23
- * on the other hand, when the user is running "bit capsule create comp1", only one `Network` instance is created:
24
- * Network: originalSeeders: ['comp1'], seeders: ['comp1'], graphCapsules: ['comp1', 'comp2'].
25
- *
26
- * (as a side note, another implementation was attempt to have the "seeders" as the original-seeders for build,
27
- * however, it's failed. see https://github.com/teambit/bit/pull/5407 for more details).
28
- *
29
- *
30
- * A more detailed explanation about the "seeders" vs "originalSeeders" vs "graphCapsules" is provided below:
31
- * an example: comp1 -> comp2 -> comp3 (as in comp1 uses comp2, comp2 uses comp3).
32
- * I changed only comp2.
33
- * From comp2 perspective, comp1 is a “dependent”, comp3 is a “dependency”.
34
- *
35
- * 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".
36
- * 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.
37
- * (btw, bit test command also include dependents when it provided with no args).
38
- *
39
- * 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”.
40
- * 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.
41
- * In our case, if all components use the same env, the Network consist of:
42
- * seedersCapsules: [comp1, comp2]
43
- * originalSeedersCapsules: [comp1, comp2]
44
- * graphCapsules: [comp1, comp2, comp3].
45
- *
46
- * It gets more complex when multiple envs involved.
47
- * Imagine that comp1 uses env1, comp2 uses env2 and comp3 uses env3.
48
- * Because bit build runs the tasks per env, it needs to create 3 networks. Each per env.
49
- * The “seeders” refer to the seeders of the same env and includes only components from the same env.
50
- * The “originalSeeders” refer to the ones that originally started the build command and are from the same env.
51
- * Network1:
52
- * seedersCapsules: [comp1]
53
- * originalSeedersCapsules: [comp1]
54
- * graphCapsules: [comp1, comp2, comp3].
55
- * Network2:
56
- * seedersCapsules: [comp2]
57
- * originalSeedersCapsules: [comp2]
58
- * graphCapsules: [comp2, comp3].
59
- * Network3:
60
- * seedersCapsules: [comp3]
61
- * originalSeedersCapsules: []
62
- * graphCapsules: [comp3].
63
- * As you can see, in network3, the originalSeeders is empty, because comp3 wasn’t part of the original seeders.
64
- * These 3 networks are created for build-pipeline. This pipeline asks for all components in the graph and then create the network per env.
65
- * 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.
66
- * A build-task provides context with a network instance to the execute() method. (it also provide Component[] which are the “seeders”. not “originalSeeders”).
67
- *
68
- * Each build-task can decide on what components to operate. It has 3 options:
69
- * 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.
70
- * 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.
71
- * 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.
72
- *
73
- * 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.
74
- */
75
- export declare class Network {
76
- private _graphCapsules;
77
- private seedersIds;
78
- private _capsulesRootDir;
79
- _originalSeeders: ComponentID[] | undefined;
80
- constructor(_graphCapsules: CapsuleList, seedersIds: ComponentID[], _capsulesRootDir: string);
81
- /**
82
- * for non build-tasks, this includes the original components the network was created for.
83
- *
84
- * for build-tasks (during bit build/tag/snap), this `Network` instance is created per env, and it depends on the pipeline.
85
- * build-pipeline: includes the component graph (meaning include the dependencies) of the current env.
86
- * snap/tag pipeline: it's the same as `this.originalSeedersCapsules`. it includes only the original to
87
- * tag/snap/build of the current env.
88
- *
89
- * for example comp1 of env1 is using comp2 of env2. when running build/tag/snap on comp1 only, two networks are created
90
- * for build pipeline:
91
- * network1: seedersCapsules: [comp1], originalSeedersCapsules: [comp1], graphCapsules: [comp1, comp2]
92
- * network2: seedersCapsules: [comp2], originalSeedersCapsules: [], graphCapsules: [comp2]
93
- *
94
- * for snap/tag pipeline, only network1 is created, and it includes only the originalSeedersCapsules.
95
- *
96
- * see the description of this Network class for more info.
97
- */
98
- get seedersCapsules(): CapsuleList;
99
- /**
100
- * for non build-tasks, this is the same as `this.seedersCapsules`, which includes the original components the
101
- * network was created for.
102
- *
103
- * for build-tasks (during bit build/tag/snap), this includes the component to build/tag/snap of the current env.
104
- * see the description of this Network class for more info.
105
- */
106
- get originalSeedersCapsules(): CapsuleList;
107
- /**
108
- * some of the capsules (non-modified) are written already with the dists files, so no need to re-compile them.
109
- * this method helps optimizing compilers that are running on the capsules.
110
- */
111
- getCapsulesToCompile(): Promise<CapsuleList>;
112
- /**
113
- * originalSeeders are not always set (currently, only during build process), so if they're missing, just provide the
114
- * seeders, which are probably the original-seeders
115
- */
116
- private getOriginalSeeders;
117
- /**
118
- * all capsules, including the dependencies of the seeders. (even when they belong to another env)
119
- */
120
- get graphCapsules(): CapsuleList;
121
- get capsulesRootDir(): PathOsBasedAbsolute;
122
- }
@@ -1,6 +0,0 @@
1
- import { LinkDetail } from '@teambit/dependency-resolver';
2
- import { Logger } from '@teambit/logger';
3
- import { Capsule } from './capsule';
4
- import CapsuleList from './capsule-list';
5
- export declare function symlinkDependenciesToCapsules(capsules: Capsule[], capsuleList: CapsuleList, logger: Logger): Promise<Record<string, Record<string, string>>>;
6
- export declare function symlinkOnCapsuleRoot(capsuleList: CapsuleList, logger: Logger, capsuleRoot: string): Promise<LinkDetail[]>;