@monorepolint/utils 0.5.0-alpha.97 → 0.5.0-beta.0
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/CHANGELOG.md +7 -0
- package/package.json +43 -20
- package/src/AggregateTiming.ts +1 -2
- package/src/CachingHost.ts +9 -7
- package/src/Host.ts +1 -1
- package/src/PackageJson.ts +2 -1
- package/src/SimpleHost.ts +3 -4
- package/src/Table.ts +1 -2
- package/src/Timing.ts +1 -2
- package/src/__tests__/CachingHost.spec.ts +5 -5
- package/src/findWorkspaceDir.ts +11 -3
- package/src/getPackageNameToDir.ts +4 -5
- package/src/getWorkspacePackageDirs.ts +32 -15
- package/src/index.ts +13 -13
- package/src/matchesAnyGlob.ts +9 -8
- package/src/mutateJson.ts +2 -3
- package/tsconfig.json +7 -2
- package/lib/AggregateTiming.d.ts +0 -15
- package/lib/AggregateTiming.d.ts.map +0 -1
- package/lib/AggregateTiming.js +0 -70
- package/lib/AggregateTiming.js.map +0 -1
- package/lib/CachingHost.d.ts +0 -39
- package/lib/CachingHost.d.ts.map +0 -1
- package/lib/CachingHost.js +0 -366
- package/lib/CachingHost.js.map +0 -1
- package/lib/Host.d.ts +0 -38
- package/lib/Host.d.ts.map +0 -1
- package/lib/Host.js +0 -9
- package/lib/Host.js.map +0 -1
- package/lib/PackageJson.d.ts +0 -19
- package/lib/PackageJson.d.ts.map +0 -1
- package/lib/PackageJson.js +0 -9
- package/lib/PackageJson.js.map +0 -1
- package/lib/SimpleHost.d.ts +0 -35
- package/lib/SimpleHost.d.ts.map +0 -1
- package/lib/SimpleHost.js +0 -56
- package/lib/SimpleHost.js.map +0 -1
- package/lib/Table.d.ts +0 -53
- package/lib/Table.d.ts.map +0 -1
- package/lib/Table.js +0 -234
- package/lib/Table.js.map +0 -1
- package/lib/Timing.d.ts +0 -9
- package/lib/Timing.d.ts.map +0 -1
- package/lib/Timing.js +0 -57
- package/lib/Timing.js.map +0 -1
- package/lib/__tests__/CachingHost.spec.d.ts +0 -8
- package/lib/__tests__/CachingHost.spec.d.ts.map +0 -1
- package/lib/__tests__/CachingHost.spec.js +0 -178
- package/lib/__tests__/CachingHost.spec.js.map +0 -1
- package/lib/findWorkspaceDir.d.ts +0 -9
- package/lib/findWorkspaceDir.d.ts.map +0 -1
- package/lib/findWorkspaceDir.js +0 -34
- package/lib/findWorkspaceDir.js.map +0 -1
- package/lib/getPackageNameToDir.d.ts +0 -14
- package/lib/getPackageNameToDir.d.ts.map +0 -1
- package/lib/getPackageNameToDir.js +0 -31
- package/lib/getPackageNameToDir.js.map +0 -1
- package/lib/getWorkspacePackageDirs.d.ts +0 -9
- package/lib/getWorkspacePackageDirs.d.ts.map +0 -1
- package/lib/getWorkspacePackageDirs.js +0 -46
- package/lib/getWorkspacePackageDirs.js.map +0 -1
- package/lib/index.d.ts +0 -20
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -32
- package/lib/index.js.map +0 -1
- package/lib/matchesAnyGlob.d.ts +0 -17
- package/lib/matchesAnyGlob.d.ts.map +0 -1
- package/lib/matchesAnyGlob.js +0 -131
- package/lib/matchesAnyGlob.js.map +0 -1
- package/lib/mutateJson.d.ts +0 -9
- package/lib/mutateJson.d.ts.map +0 -1
- package/lib/mutateJson.js +0 -16
- package/lib/mutateJson.js.map +0 -1
- package/lib/nanosecondsToSanity.d.ts +0 -8
- package/lib/nanosecondsToSanity.d.ts.map +0 -1
- package/lib/nanosecondsToSanity.js +0 -14
- package/lib/nanosecondsToSanity.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- /package/{jest.config.js → jest.config.cjs} +0 -0
package/lib/Table.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _Table_instances, _Table_rows, _Table_config, _Table_columnWidths, _Table_footer, _Table_footerRowConfig, _Table_totalWidth, _Table_sumColumn, _Table_updateFooterRow, _Table_calculateColumnWidths, _Table_printSeparator, _Table_printHeaderRow, _Table_printFooterRow, _Table_getCellValueAsString, _Table_getCellValueAligned;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Table = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
/*!
|
|
7
|
-
* Copyright 2022 Palantir Technologies, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
// tslint:disable:no-console
|
|
13
|
-
const nanosecondsToSanity_1 = require("./nanosecondsToSanity");
|
|
14
|
-
class Table {
|
|
15
|
-
constructor(config) {
|
|
16
|
-
_Table_instances.add(this);
|
|
17
|
-
_Table_rows.set(this, []);
|
|
18
|
-
_Table_config.set(this, void 0);
|
|
19
|
-
_Table_columnWidths.set(this, []);
|
|
20
|
-
_Table_footer.set(this, []);
|
|
21
|
-
_Table_footerRowConfig.set(this, void 0);
|
|
22
|
-
_Table_totalWidth.set(this, 0);
|
|
23
|
-
tslib_1.__classPrivateFieldSet(this, _Table_config, {
|
|
24
|
-
padding: 2,
|
|
25
|
-
...config,
|
|
26
|
-
}, "f");
|
|
27
|
-
tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f").fill(0, 0, config.columns.length);
|
|
28
|
-
if (config.showFooter) {
|
|
29
|
-
tslib_1.__classPrivateFieldSet(this, _Table_footerRowConfig, [], "f");
|
|
30
|
-
for (const columnConfig of config.columns) {
|
|
31
|
-
if (columnConfig.footer === undefined) {
|
|
32
|
-
throw new Error("Must specify footer fields when showFooter is true");
|
|
33
|
-
}
|
|
34
|
-
else if (typeof columnConfig.footer === "string") {
|
|
35
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f").push({
|
|
36
|
-
type: "string",
|
|
37
|
-
alignment: "left",
|
|
38
|
-
aggregate: "static",
|
|
39
|
-
value: columnConfig.footer,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else if ("value" in columnConfig.footer) {
|
|
43
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f").push({
|
|
44
|
-
type: "string",
|
|
45
|
-
alignment: "left",
|
|
46
|
-
...columnConfig.footer,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
else if ("aggregate" in columnConfig.footer) {
|
|
50
|
-
if (columnConfig.type !== "bigint")
|
|
51
|
-
throw new Error("expecting bigint for aggregate");
|
|
52
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f").push({
|
|
53
|
-
type: columnConfig.type,
|
|
54
|
-
renderAs: columnConfig.renderAs,
|
|
55
|
-
precision: columnConfig.precision,
|
|
56
|
-
alignment: "right",
|
|
57
|
-
...columnConfig.footer,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
addRow(...data) {
|
|
64
|
-
// TODO: maybe clone the data
|
|
65
|
-
tslib_1.__classPrivateFieldGet(this, _Table_rows, "f").push(data);
|
|
66
|
-
}
|
|
67
|
-
print() {
|
|
68
|
-
// let data = [...this.#rows];
|
|
69
|
-
if (tslib_1.__classPrivateFieldGet(this, _Table_config, "f").sortColumn !== undefined) {
|
|
70
|
-
// todo
|
|
71
|
-
}
|
|
72
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_updateFooterRow).call(this);
|
|
73
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_calculateColumnWidths).call(this);
|
|
74
|
-
console.log();
|
|
75
|
-
console.log(`${tslib_1.__classPrivateFieldGet(this, _Table_config, "f").title}`);
|
|
76
|
-
console.log("".padStart(tslib_1.__classPrivateFieldGet(this, _Table_totalWidth, "f"), "="));
|
|
77
|
-
const paddingString = "".padStart(tslib_1.__classPrivateFieldGet(this, _Table_config, "f").padding, " ");
|
|
78
|
-
if (tslib_1.__classPrivateFieldGet(this, _Table_config, "f").showHeader) {
|
|
79
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_printHeaderRow).call(this);
|
|
80
|
-
}
|
|
81
|
-
for (let r = 0; r < tslib_1.__classPrivateFieldGet(this, _Table_rows, "f").length; r++) {
|
|
82
|
-
let rowText = "";
|
|
83
|
-
for (let c = 0; c < tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns.length; c++) {
|
|
84
|
-
rowText += this.getEntryAsStringAligned(c, r) + paddingString;
|
|
85
|
-
}
|
|
86
|
-
rowText.trim();
|
|
87
|
-
console.log(rowText);
|
|
88
|
-
}
|
|
89
|
-
if (tslib_1.__classPrivateFieldGet(this, _Table_config, "f").showFooter)
|
|
90
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_printFooterRow).call(this);
|
|
91
|
-
console.log();
|
|
92
|
-
}
|
|
93
|
-
getEntryAsString(colNum, rowNum) {
|
|
94
|
-
var _a;
|
|
95
|
-
const config = tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns[colNum];
|
|
96
|
-
if (config.type === "bigint" && config.renderAs === "nanoseconds") {
|
|
97
|
-
return (0, nanosecondsToSanity_1.nanosecondsToSanity)(tslib_1.__classPrivateFieldGet(this, _Table_rows, "f")[rowNum][colNum], (_a = config.precision) !== null && _a !== void 0 ? _a : 9);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return "" + tslib_1.__classPrivateFieldGet(this, _Table_rows, "f")[rowNum][colNum];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
getEntryAsStringAligned(colNum, rowNum) {
|
|
104
|
-
var _a;
|
|
105
|
-
const config = tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns[colNum];
|
|
106
|
-
let result;
|
|
107
|
-
if (config.type === "bigint" && config.renderAs === "nanoseconds") {
|
|
108
|
-
result = (0, nanosecondsToSanity_1.nanosecondsToSanity)(tslib_1.__classPrivateFieldGet(this, _Table_rows, "f")[rowNum][colNum], (_a = config.precision) !== null && _a !== void 0 ? _a : 9);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
result = "" + tslib_1.__classPrivateFieldGet(this, _Table_rows, "f")[rowNum][colNum];
|
|
112
|
-
}
|
|
113
|
-
if (config.alignment === "left") {
|
|
114
|
-
return result.padEnd(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[colNum]);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return result.padStart(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[colNum]);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
getColumnWidth(colNum, config) {
|
|
121
|
-
var _a;
|
|
122
|
-
let maxWidth = Math.max(((_a = config.header) !== null && _a !== void 0 ? _a : "").length, tslib_1.__classPrivateFieldGet(this, _Table_footer, "f") && tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f")
|
|
123
|
-
? tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_getCellValueAsString).call(this, tslib_1.__classPrivateFieldGet(this, _Table_footer, "f")[colNum], tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f")[colNum]).length
|
|
124
|
-
: 0);
|
|
125
|
-
for (let r = 0; r < tslib_1.__classPrivateFieldGet(this, _Table_rows, "f").length; r++) {
|
|
126
|
-
maxWidth = Math.max(maxWidth, this.getEntryAsString(colNum, r).length);
|
|
127
|
-
// if (config.type == "bigint" && config.renderAs === "nanoseconds") {
|
|
128
|
-
// maxWidth = Math.max(maxWidth, Number(row[colNum] / BigInt(1000000000)) + 10); // 1 for period, 9 for digits
|
|
129
|
-
// } else if (config.type == "bigint" || config.type == "string") {
|
|
130
|
-
// maxWidth = Math.max(maxWidth, ("" + row[colNum]).length);
|
|
131
|
-
// }
|
|
132
|
-
}
|
|
133
|
-
return maxWidth;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
exports.Table = Table;
|
|
137
|
-
_Table_rows = new WeakMap(), _Table_config = new WeakMap(), _Table_columnWidths = new WeakMap(), _Table_footer = new WeakMap(), _Table_footerRowConfig = new WeakMap(), _Table_totalWidth = new WeakMap(), _Table_instances = new WeakSet(), _Table_sumColumn = function _Table_sumColumn(c) {
|
|
138
|
-
let total = BigInt(0);
|
|
139
|
-
for (const row of tslib_1.__classPrivateFieldGet(this, _Table_rows, "f")) {
|
|
140
|
-
total += row[c];
|
|
141
|
-
}
|
|
142
|
-
return total;
|
|
143
|
-
}, _Table_updateFooterRow = function _Table_updateFooterRow() {
|
|
144
|
-
const footerRowConfig = tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f");
|
|
145
|
-
if (footerRowConfig) {
|
|
146
|
-
for (let c = 0; c < footerRowConfig.length; c++) {
|
|
147
|
-
const footerColConfig = footerRowConfig[c];
|
|
148
|
-
switch (footerColConfig.aggregate) {
|
|
149
|
-
case "sum":
|
|
150
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footer, "f")[c] = tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_sumColumn).call(this, c);
|
|
151
|
-
break;
|
|
152
|
-
case "average":
|
|
153
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footer, "f")[c] = tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_sumColumn).call(this, c) / BigInt(tslib_1.__classPrivateFieldGet(this, _Table_rows, "f").length);
|
|
154
|
-
break;
|
|
155
|
-
case "static":
|
|
156
|
-
tslib_1.__classPrivateFieldGet(this, _Table_footer, "f")[c] = footerColConfig.value;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}, _Table_calculateColumnWidths = function _Table_calculateColumnWidths() {
|
|
162
|
-
var _a, _b, _c;
|
|
163
|
-
tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f").fill(0, 0, tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns.length);
|
|
164
|
-
for (let c = 0; c < tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns.length; c++) {
|
|
165
|
-
const colConfig = tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns[c];
|
|
166
|
-
tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[c] = Math.max(((_a = tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns[c].header) !== null && _a !== void 0 ? _a : "").length, ...tslib_1.__classPrivateFieldGet(this, _Table_rows, "f").map((a) => tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_getCellValueAsString).call(this, a[c], colConfig).length), tslib_1.__classPrivateFieldGet(this, _Table_footer, "f") && tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f")
|
|
167
|
-
? tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_getCellValueAsString).call(this, (_c = (_b = tslib_1.__classPrivateFieldGet(this, _Table_footer, "f")) === null || _b === void 0 ? void 0 : _b[c]) !== null && _c !== void 0 ? _c : "", tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f")[c]).length
|
|
168
|
-
: 0);
|
|
169
|
-
}
|
|
170
|
-
tslib_1.__classPrivateFieldSet(this, _Table_totalWidth, 0, "f");
|
|
171
|
-
for (const colWidth of tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")) {
|
|
172
|
-
tslib_1.__classPrivateFieldSet(this, _Table_totalWidth, tslib_1.__classPrivateFieldGet(this, _Table_totalWidth, "f") + colWidth, "f");
|
|
173
|
-
}
|
|
174
|
-
tslib_1.__classPrivateFieldSet(this, _Table_totalWidth, tslib_1.__classPrivateFieldGet(this, _Table_totalWidth, "f") + (tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f").length - 1) * tslib_1.__classPrivateFieldGet(this, _Table_config, "f").padding, "f");
|
|
175
|
-
}, _Table_printSeparator = function _Table_printSeparator(fillString) {
|
|
176
|
-
const paddingString = "".padStart(tslib_1.__classPrivateFieldGet(this, _Table_config, "f").padding, " ");
|
|
177
|
-
let hr2 = "";
|
|
178
|
-
// tslint:disable-next-line: prefer-for-of
|
|
179
|
-
for (let c = 0; c < tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f").length; c++) {
|
|
180
|
-
hr2 += "".padStart(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[c], fillString) + paddingString;
|
|
181
|
-
}
|
|
182
|
-
hr2 = hr2.trimRight();
|
|
183
|
-
console.log(hr2);
|
|
184
|
-
}, _Table_printHeaderRow = function _Table_printHeaderRow() {
|
|
185
|
-
var _a;
|
|
186
|
-
if (tslib_1.__classPrivateFieldGet(this, _Table_config, "f").showHeader) {
|
|
187
|
-
const colConfigs = tslib_1.__classPrivateFieldGet(this, _Table_config, "f").columns;
|
|
188
|
-
const paddingString = "".padStart(tslib_1.__classPrivateFieldGet(this, _Table_config, "f").padding, " ");
|
|
189
|
-
let hr = "";
|
|
190
|
-
for (let c = 0; c < colConfigs.length; c++) {
|
|
191
|
-
const heading = (_a = colConfigs[c].header) !== null && _a !== void 0 ? _a : "";
|
|
192
|
-
hr += heading.padEnd(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[c], " ") + paddingString;
|
|
193
|
-
}
|
|
194
|
-
hr = hr.trimRight();
|
|
195
|
-
console.log(hr);
|
|
196
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_printSeparator).call(this, "-");
|
|
197
|
-
}
|
|
198
|
-
}, _Table_printFooterRow = function _Table_printFooterRow() {
|
|
199
|
-
const footerRow = tslib_1.__classPrivateFieldGet(this, _Table_footer, "f");
|
|
200
|
-
if (footerRow) {
|
|
201
|
-
tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_printSeparator).call(this, "=");
|
|
202
|
-
const paddingString = "".padStart(tslib_1.__classPrivateFieldGet(this, _Table_config, "f").padding, " ");
|
|
203
|
-
let hr = "";
|
|
204
|
-
for (let c = 0; c < footerRow.length; c++) {
|
|
205
|
-
hr += tslib_1.__classPrivateFieldGet(this, _Table_instances, "m", _Table_getCellValueAligned).call(this, footerRow[c], tslib_1.__classPrivateFieldGet(this, _Table_footerRowConfig, "f")[c], c) + paddingString; // .padEnd(this.#columnWidths[c], " ") + paddingString;
|
|
206
|
-
}
|
|
207
|
-
hr = hr.trimRight();
|
|
208
|
-
console.log(hr);
|
|
209
|
-
}
|
|
210
|
-
}, _Table_getCellValueAsString = function _Table_getCellValueAsString(value, config) {
|
|
211
|
-
var _a;
|
|
212
|
-
if (config.type === "bigint" && config.renderAs === "nanoseconds") {
|
|
213
|
-
return (0, nanosecondsToSanity_1.nanosecondsToSanity)(value, (_a = config.precision) !== null && _a !== void 0 ? _a : 9);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
return "" + value;
|
|
217
|
-
}
|
|
218
|
-
}, _Table_getCellValueAligned = function _Table_getCellValueAligned(value, config, column) {
|
|
219
|
-
var _a;
|
|
220
|
-
let result;
|
|
221
|
-
if (config.type === "bigint" && config.renderAs === "nanoseconds") {
|
|
222
|
-
result = (0, nanosecondsToSanity_1.nanosecondsToSanity)(value, (_a = config.precision) !== null && _a !== void 0 ? _a : 9);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
result = "" + value;
|
|
226
|
-
}
|
|
227
|
-
if (config.alignment === "left") {
|
|
228
|
-
return result.padEnd(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[column]);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
return result.padStart(tslib_1.__classPrivateFieldGet(this, _Table_columnWidths, "f")[column]);
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
//# sourceMappingURL=Table.js.map
|
package/lib/Table.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../src/Table.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,4BAA4B;AAC5B,+DAA4D;AAyD5D,MAAa,KAAK;IAQhB,YACE,MAIgC;;QAZlC,sBAAa,EAAE,EAAC;QAChB,gCAA6B;QAC7B,8BAA0B,EAAE,EAAC;QAC7B,wBAAk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sources":["../src/Timing.ts"],"names":[],"mappings":"AASA,qBAAa,MAAM;;IAEL,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAI1B,KAAK,CAAC,IAAI,EAAE,MAAM;IAIlB,IAAI;IAIJ,YAAY;CA+BpB"}
|
package/lib/Timing.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _Timing_starts;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Timing = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
/*!
|
|
7
|
-
* Copyright 2022 Palantir Technologies, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
// tslint:disable:no-console
|
|
13
|
-
const Table_1 = require("./Table");
|
|
14
|
-
class Timing {
|
|
15
|
-
constructor(title) {
|
|
16
|
-
this.title = title;
|
|
17
|
-
_Timing_starts.set(this, []);
|
|
18
|
-
this.stop(); // make sure we have starting point
|
|
19
|
-
}
|
|
20
|
-
start(name) {
|
|
21
|
-
tslib_1.__classPrivateFieldGet(this, _Timing_starts, "f").push({ name, start: process.hrtime.bigint() });
|
|
22
|
-
}
|
|
23
|
-
stop() {
|
|
24
|
-
tslib_1.__classPrivateFieldGet(this, _Timing_starts, "f").push({ start: process.hrtime.bigint() });
|
|
25
|
-
}
|
|
26
|
-
printResults() {
|
|
27
|
-
const table = new Table_1.Table({
|
|
28
|
-
sortColumn: -1,
|
|
29
|
-
showFooter: true,
|
|
30
|
-
showHeader: true,
|
|
31
|
-
title: this.title,
|
|
32
|
-
columns: [
|
|
33
|
-
{
|
|
34
|
-
header: "Duration",
|
|
35
|
-
type: "bigint",
|
|
36
|
-
renderAs: "nanoseconds",
|
|
37
|
-
precision: 4,
|
|
38
|
-
footer: { aggregate: "sum" },
|
|
39
|
-
},
|
|
40
|
-
{ header: "Task", type: "string", footer: "TOTAL" },
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
this.stop(); // be sure we stopped the last one
|
|
44
|
-
let cur = tslib_1.__classPrivateFieldGet(this, _Timing_starts, "f")[0];
|
|
45
|
-
for (const entry of tslib_1.__classPrivateFieldGet(this, _Timing_starts, "f")) {
|
|
46
|
-
if (cur.name) {
|
|
47
|
-
const span = entry.start - cur.start;
|
|
48
|
-
table.addRow(span, cur.name);
|
|
49
|
-
}
|
|
50
|
-
cur = entry;
|
|
51
|
-
}
|
|
52
|
-
table.print();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.Timing = Timing;
|
|
56
|
-
_Timing_starts = new WeakMap();
|
|
57
|
-
//# sourceMappingURL=Timing.js.map
|
package/lib/Timing.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Timing.js","sourceRoot":"","sources":["../src/Timing.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,4BAA4B;AAC5B,mCAAgC;AAEhC,MAAa,MAAM;IAEjB,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QADjC,yBAAmD,EAAE,EAAC;QAEpD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,mCAAmC;IAClD,CAAC;IAEM,KAAK,CAAC,IAAY;QACvB,+BAAA,IAAI,sBAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEM,IAAI;QACT,+BAAA,IAAI,sBAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAEM,YAAY;QACjB,MAAM,KAAK,GAAG,IAAI,aAAK,CAAmB;YACxC,UAAU,EAAE,CAAC,CAAC;YACd,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP;oBACE,MAAM,EAAE,UAAU;oBAClB,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,aAAa;oBACvB,SAAS,EAAE,CAAC;oBACZ,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;iBAC7B;gBACD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;aACpD;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,kCAAkC;QAE/C,IAAI,GAAG,GAAqC,+BAAA,IAAI,sBAAQ,CAAC,CAAC,CAAC,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,+BAAA,IAAI,sBAAQ,EAAE;YAChC,IAAI,GAAG,CAAC,IAAI,EAAE;gBACZ,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;gBACrC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;aAC9B;YACD,GAAG,GAAG,KAAK,CAAC;SACb;QAED,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;CACF;AA7CD,wBA6CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHost.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/CachingHost.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright 2022 Palantir Technologies, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const tslib_1 = require("tslib");
|
|
10
|
-
const CachingHost_1 = require("../CachingHost");
|
|
11
|
-
const realfs = tslib_1.__importStar(require("fs"));
|
|
12
|
-
const path = tslib_1.__importStar(require("path"));
|
|
13
|
-
const os = tslib_1.__importStar(require("os"));
|
|
14
|
-
class RealFsTestCase {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.getFs = () => {
|
|
17
|
-
return realfs;
|
|
18
|
-
};
|
|
19
|
-
this.createTmpDir = () => {
|
|
20
|
-
return realfs.mkdtempSync(path.join(os.tmpdir(), "mrl-test"));
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
describe(CachingHost_1.CachingHost, () => {
|
|
25
|
-
describe.each([["fs", new RealFsTestCase()]])("%s", (_testCaseName, testCase) => {
|
|
26
|
-
let baseDir;
|
|
27
|
-
let fs;
|
|
28
|
-
let SYMLINK_JSON_PATH;
|
|
29
|
-
let SYMLINK_TXT_PATH;
|
|
30
|
-
let FILE_JSON_PATH;
|
|
31
|
-
let FILE_TXT_PATH;
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
fs = testCase.getFs();
|
|
34
|
-
baseDir = testCase.createTmpDir();
|
|
35
|
-
SYMLINK_JSON_PATH = path.resolve(baseDir, "symlink.json");
|
|
36
|
-
SYMLINK_TXT_PATH = path.resolve(baseDir, "symlink.txt");
|
|
37
|
-
FILE_TXT_PATH = path.resolve(baseDir, "file.txt");
|
|
38
|
-
FILE_JSON_PATH = path.resolve(baseDir, "file.json");
|
|
39
|
-
fs.writeFileSync(FILE_JSON_PATH, JSON.stringify({ hi: "mom" }), { encoding: "utf-8" });
|
|
40
|
-
fs.symlinkSync(FILE_JSON_PATH, SYMLINK_JSON_PATH);
|
|
41
|
-
fs.writeFileSync(FILE_TXT_PATH, "hi dad", { encoding: "utf-8" });
|
|
42
|
-
fs.symlinkSync(FILE_TXT_PATH, SYMLINK_TXT_PATH);
|
|
43
|
-
});
|
|
44
|
-
function expectFileToExist(file) {
|
|
45
|
-
return expect(fs.existsSync(file));
|
|
46
|
-
}
|
|
47
|
-
function expectFileContents(file) {
|
|
48
|
-
return expect(fs.readFileSync(file, { encoding: "utf-8" }));
|
|
49
|
-
}
|
|
50
|
-
function expectSymlinkTarget(src, target) {
|
|
51
|
-
const stat = fs.lstatSync(src);
|
|
52
|
-
expect(stat.isSymbolicLink() && fs.readlinkSync(src)).toEqual(target);
|
|
53
|
-
}
|
|
54
|
-
it("Answers exists() properly", async () => {
|
|
55
|
-
expect.assertions(2);
|
|
56
|
-
await realfs.promises.writeFile(path.join(baseDir, "b.txt"), "hi", { encoding: "utf-8" });
|
|
57
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
58
|
-
expect(host.exists(path.join(baseDir, "b.txt"))).toBe(true);
|
|
59
|
-
expect(host.exists(path.join(baseDir, "nosuchfile.txt"))).toBe(false);
|
|
60
|
-
});
|
|
61
|
-
it("properly handles deletes", async () => {
|
|
62
|
-
expect.assertions(2);
|
|
63
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
64
|
-
host.writeFile(path.join(baseDir, "b.txt"), "hi", { encoding: "utf-8" });
|
|
65
|
-
host.deleteFile(path.join(baseDir, "b.txt"));
|
|
66
|
-
host.deleteFile(path.join(baseDir, "a.json"));
|
|
67
|
-
await host.flush();
|
|
68
|
-
expectFileToExist(path.join(baseDir, "b.txt")).toBeFalsy();
|
|
69
|
-
expectFileToExist(path.join(baseDir, "a.txt")).toBeFalsy();
|
|
70
|
-
});
|
|
71
|
-
it("handles simple read/write workflow", async () => {
|
|
72
|
-
expect.assertions(1);
|
|
73
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
74
|
-
host.writeFile(FILE_JSON_PATH, "cow", { encoding: "utf-8" });
|
|
75
|
-
expect(host.readFile(FILE_JSON_PATH, { encoding: "utf-8" })).toEqual("cow");
|
|
76
|
-
});
|
|
77
|
-
it("handles target symlink changing", async () => {
|
|
78
|
-
expect.assertions(1);
|
|
79
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
80
|
-
host.writeFile(FILE_JSON_PATH, "cow", { encoding: "utf-8" });
|
|
81
|
-
expect(host.readFile(FILE_JSON_PATH, { encoding: "utf-8" })).toEqual("cow");
|
|
82
|
-
});
|
|
83
|
-
it("handles writing symlinks properly", async () => {
|
|
84
|
-
expect.assertions(8);
|
|
85
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
86
|
-
// file.json should now hold "hmm"
|
|
87
|
-
host.writeFile(SYMLINK_JSON_PATH, "hmm", { encoding: "utf-8" });
|
|
88
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
89
|
-
expect(host.readFile(FILE_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
90
|
-
// Write it out so we can verify disk is right
|
|
91
|
-
await host.flush();
|
|
92
|
-
expectFileToExist(SYMLINK_JSON_PATH).toBeTruthy();
|
|
93
|
-
expectFileToExist(FILE_TXT_PATH).toBeTruthy();
|
|
94
|
-
expectFileContents(FILE_JSON_PATH).toBe("hmm");
|
|
95
|
-
expectFileContents(SYMLINK_JSON_PATH).toBe("hmm");
|
|
96
|
-
expectSymlinkTarget(SYMLINK_JSON_PATH, FILE_JSON_PATH);
|
|
97
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
98
|
-
});
|
|
99
|
-
it("handles writing symlinks properly if you read it first", async () => {
|
|
100
|
-
expect.assertions(8);
|
|
101
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
102
|
-
host.readFile(SYMLINK_JSON_PATH);
|
|
103
|
-
// file.json should now hold "hmm"
|
|
104
|
-
host.writeFile(path.join(baseDir, "symlink.json"), "hmm", { encoding: "utf-8" });
|
|
105
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
106
|
-
expect(host.readFile(FILE_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
107
|
-
// Write it out so we can verify disk is right
|
|
108
|
-
await host.flush();
|
|
109
|
-
expectFileToExist(SYMLINK_JSON_PATH).toBeTruthy();
|
|
110
|
-
expectFileToExist(FILE_TXT_PATH).toBeTruthy();
|
|
111
|
-
expectFileContents(FILE_JSON_PATH).toBe("hmm");
|
|
112
|
-
expectFileContents(SYMLINK_JSON_PATH).toBe("hmm");
|
|
113
|
-
expectSymlinkTarget(SYMLINK_JSON_PATH, FILE_JSON_PATH);
|
|
114
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
115
|
-
});
|
|
116
|
-
it("handles creating new symlinks", async () => {
|
|
117
|
-
expect.assertions(8);
|
|
118
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
119
|
-
host.readFile(SYMLINK_JSON_PATH);
|
|
120
|
-
// file.json should now hold "hmm"
|
|
121
|
-
host.writeFile(path.join(baseDir, "symlink.json"), "hmm", { encoding: "utf-8" });
|
|
122
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
123
|
-
expect(host.readFile(FILE_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
124
|
-
// Write it out so we can verify disk is right
|
|
125
|
-
await host.flush();
|
|
126
|
-
expectFileToExist(SYMLINK_JSON_PATH).toBeTruthy();
|
|
127
|
-
expectFileToExist(FILE_TXT_PATH).toBeTruthy();
|
|
128
|
-
expectFileContents(FILE_JSON_PATH).toBe("hmm");
|
|
129
|
-
expectFileContents(SYMLINK_JSON_PATH).toBe("hmm");
|
|
130
|
-
expectSymlinkTarget(SYMLINK_JSON_PATH, FILE_JSON_PATH);
|
|
131
|
-
expect(host.readFile(SYMLINK_JSON_PATH, { encoding: "utf-8" })).toEqual("hmm");
|
|
132
|
-
});
|
|
133
|
-
it("makes directories", async () => {
|
|
134
|
-
expect.assertions(3);
|
|
135
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
136
|
-
host.mkdir(path.join(baseDir, "foo", "bar", "baz"), { recursive: true });
|
|
137
|
-
// Write it out so we can verify disk is right
|
|
138
|
-
await host.flush();
|
|
139
|
-
expectFileToExist(path.join(baseDir, "foo")).toBeTruthy();
|
|
140
|
-
expectFileToExist(path.join(baseDir, "foo", "bar")).toBeTruthy();
|
|
141
|
-
expectFileToExist(path.join(baseDir, "foo", "bar", "baz")).toBeTruthy();
|
|
142
|
-
});
|
|
143
|
-
it("can unlink empty dirs", async () => {
|
|
144
|
-
expect.assertions(1);
|
|
145
|
-
// base setup
|
|
146
|
-
const fooDirPath = path.join(baseDir, "foo");
|
|
147
|
-
fs.mkdirSync(fooDirPath, { recursive: true });
|
|
148
|
-
// prep obj
|
|
149
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
150
|
-
host.rmdir(fooDirPath);
|
|
151
|
-
// Write it out so we can verify disk is right
|
|
152
|
-
await host.flush();
|
|
153
|
-
expectFileToExist(fooDirPath).toBeFalsy();
|
|
154
|
-
});
|
|
155
|
-
it("doesnt let you delete a directory with files", async () => {
|
|
156
|
-
expect.assertions(2);
|
|
157
|
-
const fooDirPath = path.join(baseDir, "foo");
|
|
158
|
-
const barFilePath = path.join(fooDirPath, "bar.txt");
|
|
159
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
160
|
-
host.mkdir(fooDirPath, { recursive: true });
|
|
161
|
-
host.writeJson(barFilePath, { hi: 5 });
|
|
162
|
-
expect(() => {
|
|
163
|
-
host.rmdir(fooDirPath);
|
|
164
|
-
}).toThrow();
|
|
165
|
-
// Write it out so we can verify disk is right
|
|
166
|
-
await host.flush();
|
|
167
|
-
expectFileToExist(fooDirPath).toBeTruthy();
|
|
168
|
-
});
|
|
169
|
-
it("doesn't let you rmdir() a file", () => {
|
|
170
|
-
expect.assertions(1);
|
|
171
|
-
const host = new CachingHost_1.CachingHost(fs);
|
|
172
|
-
expect(() => {
|
|
173
|
-
host.rmdir(FILE_JSON_PATH);
|
|
174
|
-
}).toThrow();
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
});
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AAC,CAAC;QAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;YACxC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,GAAG,IAAI,yBAAW,CAAC,EAAS,CAAC,CAAC;YACxC,MAAM,CAAC,GAAG,EAAE;gBACV,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2019 Palantir Technologies, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
import { Host } from "./Host";
|
|
8
|
-
export declare function findWorkspaceDir(host: Pick<Host, "readJson" | "exists">, dir: string): Promise<string | undefined>;
|
|
9
|
-
//# sourceMappingURL=findWorkspaceDir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findWorkspaceDir.d.ts","sourceRoot":"","sources":["../src/findWorkspaceDir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC,EACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B"}
|
package/lib/findWorkspaceDir.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright 2019 Palantir Technologies, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.findWorkspaceDir = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const path = tslib_1.__importStar(require("path"));
|
|
12
|
-
const find_workspace_dir_1 = tslib_1.__importDefault(require("@pnpm/find-workspace-dir"));
|
|
13
|
-
async function findWorkspaceDir(host, dir) {
|
|
14
|
-
// Defining workspaces in package.json is not necessary in PNPM
|
|
15
|
-
const maybePnpmWorkspaceDir = await (0, find_workspace_dir_1.default)(dir);
|
|
16
|
-
if (maybePnpmWorkspaceDir != null) {
|
|
17
|
-
return maybePnpmWorkspaceDir;
|
|
18
|
-
}
|
|
19
|
-
// We may not be in a repository that uses PNPM, look for workspaces in package.json
|
|
20
|
-
const packagePath = path.join(dir, "package.json");
|
|
21
|
-
if (host.exists(packagePath)) {
|
|
22
|
-
const packageJson = host.readJson(packagePath);
|
|
23
|
-
if (packageJson.workspaces !== undefined) {
|
|
24
|
-
return dir;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const nextDir = path.normalize(path.join(dir, ".."));
|
|
28
|
-
if (nextDir === dir) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
return findWorkspaceDir(host, nextDir);
|
|
32
|
-
}
|
|
33
|
-
exports.findWorkspaceDir = findWorkspaceDir;
|
|
34
|
-
//# sourceMappingURL=findWorkspaceDir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findWorkspaceDir.js","sourceRoot":"","sources":["../src/findWorkspaceDir.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,mDAA6B;AAG7B,0FAA4D;AAErD,KAAK,UAAU,gBAAgB,CACpC,IAAuC,EACvC,GAAW;IAEX,+DAA+D;IAC/D,MAAM,qBAAqB,GAAG,MAAM,IAAA,4BAAoB,EAAC,GAAG,CAAC,CAAC;IAC9D,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,OAAO,qBAAqB,CAAC;KAC9B;IAED,oFAAoF;IACpF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAgB,CAAC;QAC9D,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;YACxC,OAAO,GAAG,CAAC;SACZ;KACF;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,GAAG,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAzBD,4CAyBC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2019 Palantir Technologies, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
import { Host } from "./Host";
|
|
8
|
-
/**
|
|
9
|
-
* returns a map of package names to their directories in the workspace.
|
|
10
|
-
* if `resolvePaths` is true, the returned directory names are absolute paths
|
|
11
|
-
* resolved against the `workspaceDir`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getPackageNameToDir(host: Pick<Host, "readJson">, workspaceDir: string, resolvePaths?: boolean): Promise<Map<string, string>>;
|
|
14
|
-
//# sourceMappingURL=getPackageNameToDir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageNameToDir.d.ts","sourceRoot":"","sources":["../src/getPackageNameToDir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAC5B,YAAY,EAAE,MAAM,EACpB,YAAY,GAAE,OAAe,gCAc9B"}
|