app-builder-lib 26.0.3 → 26.0.5

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.
Files changed (36) hide show
  1. package/out/node-module-collector/hoist.d.ts +123 -0
  2. package/out/node-module-collector/hoist.js +881 -0
  3. package/out/node-module-collector/hoist.js.map +1 -0
  4. package/out/node-module-collector/index.d.ts +4 -0
  5. package/out/node-module-collector/index.js +28 -0
  6. package/out/node-module-collector/index.js.map +1 -0
  7. package/out/node-module-collector/nodeModulesCollector.d.ts +17 -0
  8. package/out/node-module-collector/nodeModulesCollector.js +134 -0
  9. package/out/node-module-collector/nodeModulesCollector.js.map +1 -0
  10. package/out/node-module-collector/npmNodeModulesCollector.d.ts +8 -0
  11. package/out/node-module-collector/npmNodeModulesCollector.js +28 -0
  12. package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -0
  13. package/out/node-module-collector/packageManager.d.ts +7 -0
  14. package/out/node-module-collector/packageManager.js +90 -0
  15. package/out/node-module-collector/packageManager.js.map +1 -0
  16. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +8 -0
  17. package/out/node-module-collector/pnpmNodeModulesCollector.js +33 -0
  18. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -0
  19. package/out/node-module-collector/types.d.ts +40 -0
  20. package/out/node-module-collector/types.js +3 -0
  21. package/out/node-module-collector/types.js.map +1 -0
  22. package/out/node-module-collector/yarnNodeModulesCollector.d.ts +8 -0
  23. package/out/node-module-collector/yarnNodeModulesCollector.js +28 -0
  24. package/out/node-module-collector/yarnNodeModulesCollector.js.map +1 -0
  25. package/out/platformPackager.js +1 -1
  26. package/out/platformPackager.js.map +1 -1
  27. package/out/util/appFileCopier.js +5 -3
  28. package/out/util/appFileCopier.js.map +1 -1
  29. package/out/util/packageDependencies.d.ts +1 -1
  30. package/out/util/packageDependencies.js.map +1 -1
  31. package/out/util/yarn.js +20 -24
  32. package/out/util/yarn.js.map +1 -1
  33. package/out/version.d.ts +1 -1
  34. package/out/version.js +1 -1
  35. package/out/version.js.map +1 -1
  36. package/package.json +7 -7
@@ -0,0 +1,123 @@
1
+ /**
2
+ BSD 2-Clause License
3
+
4
+ Copyright (c) 2016-present, Yarn Contributors.
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+
10
+ 1. Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+ /**
29
+ * High-level node_modules hoisting algorithm recipe
30
+ *
31
+ * 1. Take input dependency graph and start traversing it,
32
+ * as you visit new node in the graph - clone it if there can be multiple paths
33
+ * to access the node from the graph root to the node, e.g. essentially represent
34
+ * the graph with a tree as you go, to make hoisting possible.
35
+ * 2. You want to hoist every node possible to the top root node first,
36
+ * then to each of its children etc, so you need to keep track what is your current
37
+ * root node into which you are hoisting
38
+ * 3. Traverse the dependency graph from the current root node and for each package name
39
+ * that can be potentially hoisted to the current root node build a list of idents
40
+ * in descending hoisting preference. You will check in next steps whether most preferred ident
41
+ * for the given package name can be hoisted first, and if not, then you check the
42
+ * less preferred ident, etc, until either some ident will be hoisted
43
+ * or you run out of idents to check
44
+ * (no need to convert the graph to the tree when you build this preference map).
45
+ * 4. The children of the root node are already "hoisted", so you need to start
46
+ * from the dependencies of these children. You take some child and
47
+ * sort its dependencies so that regular dependencies without peer dependencies
48
+ * will come first and then those dependencies that peer depend on them.
49
+ * This is needed to make algorithm more efficient and hoist nodes which are easier
50
+ * to hoist first and then handle peer dependent nodes.
51
+ * 5. You take this sorted list of dependencies and check if each of them can be
52
+ * hoisted to the current root node. To answer is the node can be hoisted you check
53
+ * your constraints - require promise and peer dependency promise.
54
+ * The possible answers can be: YES - the node is hoistable to the current root,
55
+ * NO - the node is not hoistable to the current root
56
+ * and DEPENDS - the node is hoistable to the root if nodes X, Y, Z are hoistable
57
+ * to the root. The case DEPENDS happens when all the require and other
58
+ * constraints are met, except peer dependency constraints. Note, that the nodes
59
+ * that are not package idents currently at the top of preference list are considered
60
+ * to have the answer NO right away, before doing any other constraint checks.
61
+ * 6. When you have hoistable answer for each dependency of a node you then build
62
+ * a list of nodes that are NOT hoistable. These are the nodes that have answer NO
63
+ * and the nodes that DEPENDS on these nodes. All the other nodes are hoistable,
64
+ * those that have answer YES and those that have answer DEPENDS,
65
+ * because they are cyclically dependent on each another
66
+ * 7. You hoist all the hoistable nodes to the current root and continue traversing
67
+ * the tree. Note, you need to track newly added nodes to the current root,
68
+ * because after you finished tree traversal you want to come back to these new nodes
69
+ * first thing and hoist everything from each of them to the current tree root.
70
+ * 8. After you have finished traversing newly hoisted current root nodes
71
+ * it means you cannot hoist anything to the current tree root and you need to pick
72
+ * the next node as current tree root and run the algorithm again
73
+ * until you run out of candidates for current tree root.
74
+ */
75
+ type PackageName = string;
76
+ export declare enum HoisterDependencyKind {
77
+ REGULAR = 0,
78
+ WORKSPACE = 1,
79
+ EXTERNAL_SOFT_LINK = 2
80
+ }
81
+ export type HoisterTree = {
82
+ name: PackageName;
83
+ identName: PackageName;
84
+ reference: string;
85
+ dependencies: Set<HoisterTree>;
86
+ peerNames: Set<PackageName>;
87
+ hoistPriority?: number;
88
+ dependencyKind?: HoisterDependencyKind;
89
+ };
90
+ export type HoisterResult = {
91
+ name: PackageName;
92
+ identName: PackageName;
93
+ references: Set<string>;
94
+ dependencies: Set<HoisterResult>;
95
+ };
96
+ type Locator = string;
97
+ declare enum DebugLevel {
98
+ NONE = -1,
99
+ PERF = 0,
100
+ CHECK = 1,
101
+ REASONS = 2,
102
+ INTENSIVE_CHECK = 9
103
+ }
104
+ export type HoistOptions = {
105
+ /** Runs self-checks after hoisting is finished */
106
+ check?: boolean;
107
+ /** Debug level */
108
+ debugLevel?: DebugLevel;
109
+ /** Hoist borders are defined by parent node locator and its dependency name. The dependency is considered a border, nothing can be hoisted past this dependency, but dependency can be hoisted */
110
+ hoistingLimits?: Map<Locator, Set<PackageName>>;
111
+ };
112
+ /**
113
+ * Hoists package tree.
114
+ *
115
+ * The root node of a tree must has id: '.'.
116
+ * This function does not mutate its arguments, it hoists and returns tree copy.
117
+ *
118
+ * @param tree package tree (cycles in the tree are allowed)
119
+ *
120
+ * @returns hoisted tree copy
121
+ */
122
+ export declare const hoist: (tree: HoisterTree, opts?: HoistOptions) => HoisterResult;
123
+ export {};