binary-collections 2.0.6 → 2.0.7

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 (95) hide show
  1. package/bin/git-diff.cmd +4 -0
  2. package/bin/git-fix-encoding.cmd +0 -0
  3. package/bin/nodekill.cmd +0 -0
  4. package/bin/nodekill.ps1 +0 -0
  5. package/bin/submodule-install +0 -0
  6. package/lib/{chunk-GA4DDV65.mjs → chunk-3LOB2P54.mjs} +3 -3
  7. package/lib/{chunk-M4IBUK4H.mjs → chunk-4LEXWIIF.mjs} +2 -2
  8. package/lib/chunk-BSD5CIRU.mjs +52 -0
  9. package/lib/chunk-FB6YIQYR.mjs +42 -0
  10. package/lib/{chunk-E75HJFJO.mjs → chunk-JL32QDSH.mjs} +2 -2
  11. package/lib/{chunk-LPLPQBYP.mjs → chunk-OKYLF2MU.mjs} +14 -14
  12. package/lib/chunk-VXZQNLPU.mjs +23 -0
  13. package/lib/del-gradle.cjs +12 -12
  14. package/lib/del-gradle.d.ts +1 -2
  15. package/lib/del-gradle.js +12 -69
  16. package/lib/del-gradle.mjs +3 -3
  17. package/lib/del-node-modules.cjs +12 -12
  18. package/lib/del-node-modules.d.ts +1 -2
  19. package/lib/del-node-modules.js +11 -68
  20. package/lib/del-node-modules.mjs +3 -3
  21. package/lib/del-ps.cjs +13 -626
  22. package/lib/del-ps.d.ts +1 -2
  23. package/lib/del-ps.js +27 -702
  24. package/lib/del-ps.mjs +5 -8
  25. package/lib/del-yarn-caches.cjs +12 -12
  26. package/lib/del-yarn-caches.d.ts +1 -2
  27. package/lib/del-yarn-caches.js +6 -63
  28. package/lib/del-yarn-caches.mjs +3 -3
  29. package/lib/find-node-modules-cli.cjs +59 -0
  30. package/lib/find-node-modules-cli.d.mts +1 -0
  31. package/lib/find-node-modules-cli.d.ts +2 -0
  32. package/lib/find-node-modules-cli.js +3 -0
  33. package/lib/find-node-modules-cli.mjs +14 -0
  34. package/lib/find-node-modules.cjs +31 -9
  35. package/lib/find-node-modules.d.mts +9 -1
  36. package/lib/find-node-modules.d.ts +9 -2
  37. package/lib/find-node-modules.js +41 -12
  38. package/lib/find-node-modules.mjs +5 -19
  39. package/lib/git-diff.cjs +74 -0
  40. package/lib/git-diff.d.cts +2 -0
  41. package/lib/git-diff.d.mts +87 -0
  42. package/lib/git-diff.d.ts +87 -0
  43. package/lib/git-diff.mjs +83 -0
  44. package/lib/git-purge.cjs +13 -626
  45. package/lib/git-purge.d.ts +1 -2
  46. package/lib/git-purge.js +53 -698
  47. package/lib/git-purge.mjs +4 -7
  48. package/lib/index.cjs +91 -1
  49. package/lib/index.d.mts +1 -2
  50. package/lib/index.d.ts +2 -2
  51. package/lib/index.js +8 -2
  52. package/lib/index.mjs +12 -3
  53. package/lib/npm-run-series.d.ts +1 -0
  54. package/lib/npm-run-series.js +80 -56
  55. package/lib/npm-run-series.mjs +2 -2
  56. package/lib/package-resolutions.mjs +1 -1
  57. package/lib/ps/connected-domain.cjs +0 -0
  58. package/lib/ps/connected-domain.d.ts +1 -2
  59. package/lib/ps/connected-domain.js +196 -150
  60. package/lib/ps/connected-domain.mjs +3 -3
  61. package/lib/ps/index.cjs +0 -0
  62. package/lib/ps/index.d.mjs +2 -2
  63. package/lib/ps/index.d.ts +2 -26
  64. package/lib/ps/index.js +230 -535
  65. package/lib/ps/index.mjs +5 -5
  66. package/lib/ps/isWin.cjs +0 -0
  67. package/lib/ps/isWin.d.ts +1 -2
  68. package/lib/ps/isWin.js +1 -2
  69. package/lib/ps/isWin.mjs +3 -3
  70. package/lib/ps/table-parser.cjs +0 -0
  71. package/lib/ps/table-parser.d.ts +1 -3
  72. package/lib/ps/table-parser.js +254 -345
  73. package/lib/ps/table-parser.mjs +4 -4
  74. package/lib/submodule-install.cjs +118 -0
  75. package/lib/submodule-install.d.cts +2 -0
  76. package/lib/submodule-install.d.mts +141 -0
  77. package/lib/submodule-install.d.ts +141 -0
  78. package/lib/submodule-install.mjs +116 -0
  79. package/lib/utils.cjs +12 -12
  80. package/lib/utils.d.ts +4 -8
  81. package/lib/utils.js +43 -28
  82. package/lib/utils.mjs +3 -3
  83. package/lib/yarn-reinstall.cjs +42 -0
  84. package/lib/yarn-reinstall.d.cts +1 -0
  85. package/lib/yarn-reinstall.d.mts +45 -0
  86. package/lib/yarn-reinstall.d.ts +45 -0
  87. package/lib/yarn-reinstall.mjs +50 -0
  88. package/package.json +37 -39
  89. package/readme.md +174 -49
  90. package/eslint.config.cjs +0 -97
  91. package/lib/chunk-7MSZ52XC.mjs +0 -14
  92. package/lib/chunk-AVDT32AY.mjs +0 -20
  93. package/lib/chunk-S4SJ7SDW.mjs +0 -625
  94. package/lib/package-resolutions.js +0 -28
  95. package/lib/ps/index.d.js +0 -17
@@ -1,156 +1,202 @@
1
- // src/ps/connected-domain.js
2
- module.exports = function(tdArray, indicator, hardlink) {
3
- hardlink = hardlink || false;
4
- if (!tdArray) {
5
- throw new Error("tdArray must be provided");
6
- }
7
- if (!indicator) {
8
- throw new Error("indicator must be provided");
9
- }
10
- tdArray = JSON.parse(JSON.stringify(tdArray));
11
- var domains = {};
12
- var domainUUID = 0;
13
- var pointsHash = {};
14
- tdArray.forEach(function(row, y) {
15
- row.forEach(function(colItem, x) {
16
- var identifier2 = indicator(colItem, x, y);
17
- var neighbours = [];
18
- if (tdArray[y - 1] && tdArray[y - 1][x] !== void 0) {
19
- neighbours.push(pointsHash[x + "_" + (y - 1)]);
20
- }
21
- if (row[x - 1] !== void 0) {
22
- neighbours.push(pointsHash[x - 1 + "_" + y]);
23
- }
24
- if (!hardlink) {
25
- if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== void 0) {
26
- neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
27
- }
28
- if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== void 0) {
29
- neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
30
- }
31
- }
32
- if (neighbours.length) {
33
- var matched = false;
34
- neighbours.forEach(function(neighbour) {
35
- if (neighbour.identifier == identifier2) {
36
- if (!matched) {
37
- addPointToDomain(colItem, x, y, neighbour.domainId);
38
- matched = true;
39
- } else {
40
- var colItemPoint = pointsHash[x + "_" + y];
41
- if (neighbour.domainId != colItemPoint.domainId) {
42
- mergeDomains(neighbour.domainId, colItemPoint.domainId);
43
- }
1
+ /**
2
+ * calculate all the connected domains based on the given two-dimensional array
3
+ */
4
+ /**
5
+ * @param {Array} tdArray
6
+ * @param {Function} indicator It receive the raw point data as the first parameter and decide what kind of domain the point belongs to, it should return a string as a domain identifier.
7
+ * @param {Boolean} hardlink If use hard link. Default to false.
8
+ * @return {Object} [{ bounding: { w: 12, h: 19, x: 0, y: 1 }, points: [ { x: 1, y: 2, point: {} } ], identifier: 'blue', domainId: 1 } ]
9
+ */
10
+ module.exports = function (tdArray, indicator, hardlink) {
11
+ hardlink = hardlink || false;
12
+ if (!tdArray) {
13
+ throw new Error("tdArray must be provided");
14
+ }
15
+ if (!indicator) {
16
+ throw new Error("indicator must be provided");
17
+ }
18
+ // clone 一份数据,因为需要对饮用进行修改,方便执行
19
+ tdArray = JSON.parse(JSON.stringify(tdArray));
20
+ // Result
21
+ var domains = {};
22
+ var domainUUID = 0;
23
+ var pointsHash = {};
24
+ // 遍历数组,划分domain
25
+ tdArray.forEach(function (row, y) {
26
+ row.forEach(function (colItem, x) {
27
+ // get the current point identifier.
28
+ var identifier = indicator(colItem, x, y);
29
+ // get neighbours
30
+ // Except for Undefined every data type is valid.
31
+ var neighbours = [];
32
+ // top neighbour
33
+ if (tdArray[y - 1] && tdArray[y - 1][x] !== undefined) {
34
+ neighbours.push(pointsHash[x + "_" + (y - 1)]);
35
+ }
36
+ // left neighbour
37
+ if (row[x - 1] !== undefined) {
38
+ neighbours.push(pointsHash[x - 1 + "_" + y]);
39
+ }
40
+ // soft link will treat corner link as domain link.
41
+ if (!hardlink) {
42
+ // top left neighbour
43
+ if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== undefined) {
44
+ neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
45
+ }
46
+ // top right neighbour
47
+ if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== undefined) {
48
+ neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
49
+ }
50
+ }
51
+ if (neighbours.length) {
52
+ var matched = false;
53
+ neighbours.forEach(function (neighbour) {
54
+ if (neighbour.identifier == identifier) {
55
+ // If the neighbour is the first neighbour has the same identifier
56
+ if (!matched) {
57
+ addPointToDomain(colItem, x, y, neighbour.domainId);
58
+ matched = true;
59
+ }
60
+ // If more than one neighbour matched, check if these neighbours belong to the same domain
61
+ // If not, merge these domains since they connects to each other.
62
+ else {
63
+ var colItemPoint = pointsHash[x + "_" + y];
64
+ if (neighbour.domainId != colItemPoint.domainId) {
65
+ mergeDomains(neighbour.domainId, colItemPoint.domainId);
66
+ }
67
+ }
68
+ }
69
+ });
70
+ if (!matched) {
71
+ addNewDomain(colItem, x, y, identifier);
72
+ }
73
+ }
74
+ else {
75
+ addNewDomain(colItem, x, y, identifier);
44
76
  }
45
- }
46
77
  });
47
- if (!matched) {
48
- addNewDomain(colItem, x, y, identifier2);
49
- }
50
- } else {
51
- addNewDomain(colItem, x, y, identifier2);
52
- }
53
- });
54
- });
55
- var result = {
56
- domains: [],
57
- totalDomains: 0,
58
- groupByIdentifier: {},
59
- totalIdentifiers: 0
60
- };
61
- var domainId = null;
62
- var identifier = null;
63
- var domain = null;
64
- for (domainId in domains) {
65
- domain = domains[domainId];
66
- domain.bounding = calculateBounding(domain.points);
67
- identifier = domain.identifier;
68
- result.domains.push(domain);
69
- result.totalDomains++;
70
- if (!(identifier in result.groupByIdentifier)) {
71
- result.groupByIdentifier[identifier] = [];
72
- result.totalIdentifiers++;
73
- }
74
- result.groupByIdentifier[identifier].push(domain);
75
- }
76
- function calculateBounding(points) {
77
- var minX = null;
78
- var minY = null;
79
- var maxX = null;
80
- var maxY = null;
81
- points.forEach(function(point) {
82
- if (minX === null || point.x < minX) {
83
- minX = point.x;
84
- }
85
- if (minY === null || point.y < minY) {
86
- minY = point.y;
87
- }
88
- if (maxX === null || point.x > maxX) {
89
- maxX = point.x;
90
- }
91
- if (maxY === null || point.y > maxY) {
92
- maxY = point.y;
93
- }
94
78
  });
95
- var w = maxX - minX;
96
- var h = maxY - minY;
97
- return {
98
- x: minX,
99
- y: minY,
100
- w,
101
- h
102
- };
103
- }
104
- function addNewDomain(point, x, y, identifier2) {
105
- var newDomain = {
106
- identifier: identifier2,
107
- domainId: ++domainUUID,
108
- bounding: {},
109
- points: []
110
- };
111
- var newPoint = {
112
- value: point,
113
- x,
114
- y,
115
- identifier: identifier2,
116
- domainId: newDomain.domainId
117
- };
118
- pointsHash[x + "_" + y] = {
119
- value: point,
120
- identifier: identifier2,
121
- domainId: newDomain.domainId
79
+ // some summary
80
+ var result = {
81
+ domains: [],
82
+ totalDomains: 0,
83
+ groupByIdentifier: {},
84
+ totalIdentifiers: 0
122
85
  };
123
- newDomain.points.push(newPoint);
124
- domains[newDomain.domainId] = newDomain;
125
- }
126
- function addPointToDomain(point, x, y, domainId2) {
127
- var domain2 = domains[domainId2];
128
- var newPoint = {
129
- value: point,
130
- x,
131
- y,
132
- identifier: domain2.identifier,
133
- domainId: domainId2
134
- };
135
- pointsHash[x + "_" + y] = {
136
- value: point,
137
- identifier: domain2.identifier,
138
- domainId: domainId2
139
- };
140
- domain2.points.push(newPoint);
141
- }
142
- function mergeDomains(domainAId, domainBId) {
143
- var domainA = domains[domainAId];
144
- var domainB = domains[domainBId];
145
- if (domainA.identifier == domainB.identifier) {
146
- domainB.domainId = domainA.domainId;
147
- domainB.points.forEach(function(point) {
148
- point.domainId = domainA.domainId;
149
- pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
150
- });
151
- domainA.points = domainA.points.concat(domainB.points);
152
- delete domains[domainBId];
86
+ var domainId = null;
87
+ var identifier = null;
88
+ var domain = null;
89
+ for (domainId in domains) {
90
+ domain = domains[domainId];
91
+ domain.bounding = calculateBounding(domain.points);
92
+ identifier = domain.identifier;
93
+ result.domains.push(domain);
94
+ result.totalDomains++;
95
+ if (!(identifier in result.groupByIdentifier)) {
96
+ result.groupByIdentifier[identifier] = [];
97
+ result.totalIdentifiers++;
98
+ }
99
+ result.groupByIdentifier[identifier].push(domain);
100
+ }
101
+ function calculateBounding(points) {
102
+ var minX = null;
103
+ var minY = null;
104
+ var maxX = null;
105
+ var maxY = null;
106
+ points.forEach(function (point) {
107
+ if (minX === null || point.x < minX) {
108
+ minX = point.x;
109
+ }
110
+ if (minY === null || point.y < minY) {
111
+ minY = point.y;
112
+ }
113
+ if (maxX === null || point.x > maxX) {
114
+ maxX = point.x;
115
+ }
116
+ if (maxY === null || point.y > maxY) {
117
+ maxY = point.y;
118
+ }
119
+ });
120
+ var w = maxX - minX;
121
+ var h = maxY - minY;
122
+ return {
123
+ x: minX,
124
+ y: minY,
125
+ w: w,
126
+ h: h
127
+ };
128
+ }
129
+ /**
130
+ *
131
+ * @param point
132
+ * @param x
133
+ * @param y
134
+ * @param identifier
135
+ */
136
+ function addNewDomain(point, x, y, identifier) {
137
+ var newDomain = {
138
+ identifier: identifier,
139
+ domainId: ++domainUUID,
140
+ bounding: {},
141
+ points: []
142
+ };
143
+ var newPoint = {
144
+ value: point,
145
+ x: x,
146
+ y: y,
147
+ identifier: identifier,
148
+ domainId: newDomain.domainId
149
+ };
150
+ pointsHash[x + "_" + y] = {
151
+ value: point,
152
+ identifier: identifier,
153
+ domainId: newDomain.domainId
154
+ };
155
+ newDomain.points.push(newPoint);
156
+ domains[newDomain.domainId] = newDomain;
157
+ }
158
+ /**
159
+ * add a point to a existing domain, and attach properties domainId and identifier to point.
160
+ * @param point
161
+ * @param x
162
+ * @param y
163
+ * @param domainId
164
+ */
165
+ function addPointToDomain(point, x, y, domainId) {
166
+ var domain = domains[domainId];
167
+ var newPoint = {
168
+ value: point,
169
+ x: x,
170
+ y: y,
171
+ identifier: domain.identifier,
172
+ domainId: domainId
173
+ };
174
+ pointsHash[x + "_" + y] = {
175
+ value: point,
176
+ identifier: domain.identifier,
177
+ domainId: domainId
178
+ };
179
+ domain.points.push(newPoint);
180
+ }
181
+ /**
182
+ * 将 domainB 合并到 domainA
183
+ * @param domainAId
184
+ * @param domainBId
185
+ */
186
+ function mergeDomains(domainAId, domainBId) {
187
+ var domainA = domains[domainAId];
188
+ var domainB = domains[domainBId];
189
+ if (domainA.identifier == domainB.identifier) {
190
+ // 更新 domainB 的domainId
191
+ domainB.domainId = domainA.domainId;
192
+ domainB.points.forEach(function (point) {
193
+ point.domainId = domainA.domainId;
194
+ pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
195
+ });
196
+ domainA.points = domainA.points.concat(domainB.points);
197
+ // 删除domainB
198
+ delete domains[domainBId];
199
+ }
153
200
  }
154
- }
155
- return result;
201
+ return result;
156
202
  };
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_connected_domain
4
- } from "../chunk-M4IBUK4H.mjs";
5
- import "../chunk-7MSZ52XC.mjs";
6
- import "../chunk-AVDT32AY.mjs";
4
+ } from "../chunk-4LEXWIIF.mjs";
5
+ import "../chunk-VXZQNLPU.mjs";
6
+ import "../chunk-FB6YIQYR.mjs";
7
7
  export default require_connected_domain();
package/lib/ps/index.cjs CHANGED
File without changes
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  init_esm_shims
4
- } from "../chunk-7MSZ52XC.mjs";
5
- import "../chunk-AVDT32AY.mjs";
4
+ } from "../chunk-VXZQNLPU.mjs";
5
+ import "../chunk-FB6YIQYR.mjs";
6
6
 
7
7
  // src/ps/index.d.ts
8
8
  init_esm_shims();
package/lib/ps/index.d.ts CHANGED
@@ -1,26 +1,2 @@
1
- interface Program {
2
- arguments: string[];
3
- command: string;
4
- pid: number;
5
- }
6
-
7
- interface Query {
8
- pid?: string | string[] | number | undefined;
9
- ppid?: number | undefined;
10
- command?: string | RegExp | undefined;
11
- arguments?: string | RegExp | undefined;
12
- psargs?: string | string[] | undefined;
13
- }
14
-
15
- interface Signal {
16
- signal: string;
17
- timeout: number;
18
- }
19
-
20
- /** Query Process: Focus on pid & cmd */
21
- declare function lookup(query: Query, cb: (err: Error, list: Program[]) => void): void;
22
-
23
- declare function kill(pID: number | string, cb?: (err?: Error) => void): void;
24
- declare function kill(pID: number | string, signal?: string | Signal, cb?: (err?: Error) => void): void;
25
-
26
- export { type Program, type Query, type Signal, kill, lookup };
1
+ declare const _exports: Function;
2
+ export = _exports;