inup 1.5.5 → 1.5.6
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/README.md +24 -10
- package/dist/cli.js +20 -22
- package/dist/config/constants.js +4 -2
- package/dist/config/package-meta.js +10 -0
- package/dist/config/project-config.js +6 -1
- package/dist/core/package-detector.js +8 -4
- package/dist/core/upgrade-runner.js +7 -10
- package/dist/core/upgrader.js +6 -8
- package/dist/features/changelog/clients/github-client.js +5 -6
- package/dist/features/changelog/services/changelog-service.js +2 -4
- package/dist/features/changelog/services/package-metadata-service.js +6 -11
- package/dist/features/changelog/services/release-notes-service.js +4 -2
- package/dist/features/debug/services/performance-tracker.js +6 -8
- package/dist/index.js +1 -2
- package/dist/interactive-ui.js +13 -606
- package/dist/services/background-audit.js +3 -5
- package/dist/services/cache-manager.js +5 -7
- package/dist/services/http/inflight.js +22 -0
- package/dist/services/http/retry.js +30 -0
- package/dist/services/jsdelivr/client.js +191 -0
- package/dist/services/jsdelivr/manifest.js +136 -0
- package/dist/services/jsdelivr-registry.js +6 -392
- package/dist/services/npm-registry.js +12 -81
- package/dist/services/persistent-cache.js +8 -13
- package/dist/types/domain.js +3 -0
- package/dist/types/streaming.js +3 -0
- package/dist/types/ui.js +3 -0
- package/dist/types.js +17 -0
- package/dist/ui/controllers/package-info-modal-controller.js +22 -31
- package/dist/ui/controllers/vulnerability-audit-controller.js +17 -8
- package/dist/ui/index.js +3 -0
- package/dist/ui/input-handler.js +58 -75
- package/dist/ui/keymap.js +208 -0
- package/dist/ui/modal/package-info-sections/release-notes.js +161 -0
- package/dist/ui/modal/package-info-sections/sections.js +150 -0
- package/dist/ui/modal/package-info-sections/text.js +75 -0
- package/dist/ui/modal/package-info-sections.js +15 -369
- package/dist/ui/modal/package-info.js +1 -1
- package/dist/ui/renderer/help-modal.js +75 -0
- package/dist/ui/renderer/index.js +2 -5
- package/dist/ui/renderer/package-list/interface.js +184 -0
- package/dist/ui/renderer/package-list/rows.js +172 -0
- package/dist/ui/renderer/package-list.js +15 -455
- package/dist/ui/session/action-dispatcher.js +233 -0
- package/dist/ui/session/index.js +13 -0
- package/dist/ui/session/interactive-session.js +280 -0
- package/dist/ui/session/selection-state-builder.js +144 -0
- package/dist/ui/state/filter-manager.js +17 -6
- package/dist/ui/state/modal-manager.js +35 -0
- package/dist/ui/state/navigation-manager.js +33 -4
- package/dist/ui/state/state-manager.js +68 -3
- package/dist/ui/state/theme-manager.js +1 -0
- package/dist/ui/themes-colors.js +4 -1
- package/dist/ui/themes.js +11 -19
- package/dist/ui/utils/cursor.js +3 -4
- package/dist/ui/utils/index.js +6 -1
- package/dist/ui/utils/text.js +3 -2
- package/dist/ui/utils/version.js +60 -86
- package/dist/utils/config.js +13 -1
- package/dist/utils/filesystem/io.js +87 -0
- package/dist/utils/filesystem/paths.js +19 -0
- package/dist/utils/filesystem/scan.js +205 -0
- package/dist/utils/filesystem.js +17 -335
- package/dist/utils/version.js +31 -1
- package/package.json +6 -5
|
@@ -1,459 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports.renderSpacer = renderSpacer;
|
|
9
|
-
exports.renderInterface = renderInterface;
|
|
10
|
-
exports.renderPackagesTable = renderPackagesTable;
|
|
11
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
-
const utils_1 = require("../utils");
|
|
13
|
-
const themes_colors_1 = require("../themes-colors");
|
|
14
|
-
const vulnerability_1 = require("../presenters/vulnerability");
|
|
15
|
-
function padLineToWidth(line, terminalWidth) {
|
|
16
|
-
const padding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(line));
|
|
17
|
-
return line + ' '.repeat(padding);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Get type badge for dependency type (theme-aware)
|
|
21
|
-
*/
|
|
22
|
-
function getTypeBadge(type) {
|
|
23
|
-
switch (type) {
|
|
24
|
-
case 'devDependencies':
|
|
25
|
-
return (0, themes_colors_1.getThemeColor)('textSecondary')('[D]');
|
|
26
|
-
case 'peerDependencies':
|
|
27
|
-
return (0, themes_colors_1.getThemeColor)('textSecondary')('[P]');
|
|
28
|
-
case 'optionalDependencies':
|
|
29
|
-
return (0, themes_colors_1.getThemeColor)('textSecondary')('[O]');
|
|
30
|
-
case 'dependencies':
|
|
31
|
-
default:
|
|
32
|
-
return ''; // No badge for regular dependencies
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Render a single package line
|
|
37
|
-
* @param state Package selection state
|
|
38
|
-
* @param index Index in the list
|
|
39
|
-
* @param isCurrentRow Whether this is the current/highlighted row
|
|
40
|
-
* @param terminalWidth Terminal width for dynamic truncation (default 80)
|
|
41
|
-
*/
|
|
42
|
-
function renderPackageLine(state, index, isCurrentRow, terminalWidth = 80, options = {}) {
|
|
43
|
-
const prefix = isCurrentRow ? (0, themes_colors_1.getThemeColor)('success')('❯ ') : ' ';
|
|
44
|
-
// Package name with special formatting for scoped packages (@author/package)
|
|
45
|
-
let packageName;
|
|
46
|
-
if (state.name.startsWith('@')) {
|
|
47
|
-
const parts = state.name.split('/');
|
|
48
|
-
if (parts.length >= 2) {
|
|
49
|
-
const author = parts[0]; // @author
|
|
50
|
-
const packagePart = parts.slice(1).join('/'); // package name
|
|
51
|
-
if (isCurrentRow) {
|
|
52
|
-
packageName =
|
|
53
|
-
chalk_1.default.bold((0, themes_colors_1.getThemeColor)('packageAuthor')(author)) +
|
|
54
|
-
(0, themes_colors_1.getThemeColor)('packageName')('/' + packagePart);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
packageName = chalk_1.default.bold.white(author) + chalk_1.default.white('/' + packagePart);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
packageName = isCurrentRow
|
|
62
|
-
? (0, themes_colors_1.getThemeColor)('packageName')(state.name)
|
|
63
|
-
: chalk_1.default.white(state.name);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
packageName = isCurrentRow ? (0, themes_colors_1.getThemeColor)('packageName')(state.name) : chalk_1.default.white(state.name);
|
|
68
|
-
}
|
|
69
|
-
// Determine which dot should be filled (only one per package)
|
|
70
|
-
const isCurrentSelected = state.selectedOption === 'none';
|
|
71
|
-
const isRangeSelected = state.selectedOption === 'range';
|
|
72
|
-
const isLatestSelected = state.selectedOption === 'latest';
|
|
73
|
-
const isPending = state.loadState === 'pending';
|
|
74
|
-
const isFailed = state.loadState === 'failed';
|
|
75
|
-
// Current version dot and version (show original specifier with prefix)
|
|
76
|
-
const currentDot = isCurrentSelected ? (0, themes_colors_1.getThemeColor)('dot')('●') : (0, themes_colors_1.getThemeColor)('dotEmpty')('○');
|
|
77
|
-
const currentVersion = chalk_1.default.white(state.currentVersionSpecifier);
|
|
78
|
-
// Range version dot and version
|
|
79
|
-
let rangeDot = '';
|
|
80
|
-
let rangeVersionText = '';
|
|
81
|
-
if (isPending) {
|
|
82
|
-
rangeDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('◌');
|
|
83
|
-
rangeVersionText = chalk_1.default.gray('loading');
|
|
84
|
-
}
|
|
85
|
-
else if (isFailed) {
|
|
86
|
-
rangeDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('◌');
|
|
87
|
-
rangeVersionText = chalk_1.default.gray('unavailable');
|
|
88
|
-
}
|
|
89
|
-
else if (state.hasRangeUpdate) {
|
|
90
|
-
rangeDot = isRangeSelected ? (0, themes_colors_1.getThemeColor)('dot')('●') : (0, themes_colors_1.getThemeColor)('dotEmpty')('○');
|
|
91
|
-
const rangeVersionWithPrefix = utils_1.VersionUtils.applyVersionPrefix(state.currentVersionSpecifier, state.rangeVersion);
|
|
92
|
-
rangeVersionText = (0, themes_colors_1.getThemeColor)('versionRange')(rangeVersionWithPrefix);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
rangeDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('○');
|
|
96
|
-
rangeVersionText = '';
|
|
97
|
-
}
|
|
98
|
-
// Latest version dot and version
|
|
99
|
-
let latestDot = '';
|
|
100
|
-
let latestVersionText = '';
|
|
101
|
-
if (isPending) {
|
|
102
|
-
latestDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('◌');
|
|
103
|
-
latestVersionText = chalk_1.default.gray('loading');
|
|
104
|
-
}
|
|
105
|
-
else if (isFailed) {
|
|
106
|
-
latestDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('◌');
|
|
107
|
-
latestVersionText = chalk_1.default.gray('unavailable');
|
|
108
|
-
}
|
|
109
|
-
else if (state.hasMajorUpdate) {
|
|
110
|
-
latestDot = isLatestSelected ? (0, themes_colors_1.getThemeColor)('dot')('●') : (0, themes_colors_1.getThemeColor)('dotEmpty')('○');
|
|
111
|
-
const latestVersionWithPrefix = utils_1.VersionUtils.applyVersionPrefix(state.currentVersionSpecifier, state.latestVersion);
|
|
112
|
-
latestVersionText = (0, themes_colors_1.getThemeColor)('versionLatest')(latestVersionWithPrefix);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
latestDot = (0, themes_colors_1.getThemeColor)('dotEmpty')('○');
|
|
116
|
-
latestVersionText = '';
|
|
117
|
-
}
|
|
118
|
-
// Column widths with capped package name width
|
|
119
|
-
// Layout: prefix(2) + name + dashes + spacing(3) + current(16) + spacing(3) + range(16) + spacing(3) + latest(16)
|
|
120
|
-
const currentColumnWidth = 16; // Increased to accommodate ^ and ~ prefixes
|
|
121
|
-
const rangeColumnWidth = 16; // Increased to accommodate ^ and ~ prefixes
|
|
122
|
-
const latestColumnWidth = 16; // Increased to accommodate ^ and ~ prefixes
|
|
123
|
-
const spacingWidth = 3;
|
|
124
|
-
// Package name width: max 50 chars (after which ellipsis kicks in), but scales down on small terminals
|
|
125
|
-
const maxPackageNameWidth = 50;
|
|
126
|
-
const minPackageNameWidth = 24;
|
|
127
|
-
const otherColumnsWidth = currentColumnWidth + rangeColumnWidth + latestColumnWidth + spacingWidth * 3;
|
|
128
|
-
const prefixWidth = 2;
|
|
129
|
-
const availableForPackageName = terminalWidth - prefixWidth - otherColumnsWidth - 1;
|
|
130
|
-
const packageNameWidth = Math.min(maxPackageNameWidth, Math.max(minPackageNameWidth, availableForPackageName));
|
|
131
|
-
// Apply ellipsis truncation if package name exceeds available width
|
|
132
|
-
const badgeWidth = state.type === 'dependencies' ? 0 : 3; // [X] without leading space
|
|
133
|
-
const truncatedName = utils_1.VersionUtils.truncateMiddle(state.name, packageNameWidth - 1 - badgeWidth); // -1 for space after name, -badgeWidth for badge
|
|
134
|
-
// Helper function to determine if dashes should be shown based on available padding
|
|
135
|
-
// Only show dashes if there's significant padding (> 2 chars) to fill
|
|
136
|
-
const shouldShowDashes = (paddingAmount) => paddingAmount > 2;
|
|
137
|
-
const dashColor = isCurrentRow ? chalk_1.default.white : chalk_1.default.gray;
|
|
138
|
-
// Use truncated name if it differs from original, otherwise use colored packageName
|
|
139
|
-
const displayName = truncatedName !== state.name ? truncatedName : packageName;
|
|
140
|
-
// Package name with dashes and badge at the end
|
|
141
|
-
const typeBadge = getTypeBadge(state.type);
|
|
142
|
-
const shouldShowVulnerability = (0, vulnerability_1.shouldDisplayVulnerabilityForDependency)(state.type, options);
|
|
143
|
-
const vulnBadge = shouldShowVulnerability ? (0, vulnerability_1.getVulnerabilityBadge)(state.vulnerability) : '';
|
|
144
|
-
const vulnBadgeWidth = vulnBadge ? utils_1.VersionUtils.getVisualLength(vulnBadge) + 1 : 0; // +1 for space
|
|
145
|
-
const nameLength = utils_1.VersionUtils.getVisualLength(truncatedName);
|
|
146
|
-
const namePadding = Math.max(0, packageNameWidth - nameLength - 1 - badgeWidth - vulnBadgeWidth); // -1 for space after package name
|
|
147
|
-
const nameDashes = shouldShowDashes(namePadding)
|
|
148
|
-
? dashColor('-').repeat(namePadding)
|
|
149
|
-
: ' '.repeat(namePadding);
|
|
150
|
-
// Place badges at the end of dashes: name ------⚠[D]
|
|
151
|
-
const vulnSuffix = vulnBadge ? ` ${vulnBadge}` : '';
|
|
152
|
-
const packageNameSection = typeBadge
|
|
153
|
-
? `${displayName} ${nameDashes}${vulnSuffix}${typeBadge}`
|
|
154
|
-
: `${displayName} ${nameDashes}${vulnSuffix}`;
|
|
155
|
-
// Current version section with dashes only if needed
|
|
156
|
-
const currentSection = `${currentDot} ${currentVersion}`;
|
|
157
|
-
const currentSectionLength = utils_1.VersionUtils.getVisualLength(currentSection) + 1; // +1 for space before padding
|
|
158
|
-
const currentPadding = Math.max(0, currentColumnWidth - currentSectionLength);
|
|
159
|
-
const currentPaddingText = shouldShowDashes(currentPadding)
|
|
160
|
-
? dashColor('-').repeat(currentPadding)
|
|
161
|
-
: ' '.repeat(currentPadding);
|
|
162
|
-
const currentWithPadding = currentSection + ' ' + currentPaddingText;
|
|
163
|
-
// Range version section with dashes only if needed
|
|
164
|
-
let rangeSection = '';
|
|
165
|
-
if (isPending || isFailed || state.hasRangeUpdate) {
|
|
166
|
-
rangeSection = `${rangeDot} ${rangeVersionText}`;
|
|
167
|
-
const rangeSectionLength = utils_1.VersionUtils.getVisualLength(rangeSection) + 1; // +1 for space before padding
|
|
168
|
-
const rangePadding = Math.max(0, rangeColumnWidth - rangeSectionLength);
|
|
169
|
-
const rangePaddingText = shouldShowDashes(rangePadding)
|
|
170
|
-
? dashColor('-').repeat(rangePadding)
|
|
171
|
-
: ' '.repeat(rangePadding);
|
|
172
|
-
rangeSection += ' ' + rangePaddingText;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
// Empty slot - maintain column width
|
|
176
|
-
rangeSection = ' '.repeat(rangeColumnWidth);
|
|
177
|
-
}
|
|
178
|
-
// Latest version section with dashes only if needed
|
|
179
|
-
let latestSection = '';
|
|
180
|
-
if (isPending || isFailed || state.hasMajorUpdate) {
|
|
181
|
-
latestSection = `${latestDot} ${latestVersionText}`;
|
|
182
|
-
const latestSectionLength = utils_1.VersionUtils.getVisualLength(latestSection) + 1; // +1 for space before padding
|
|
183
|
-
const latestPadding = Math.max(0, latestColumnWidth - latestSectionLength);
|
|
184
|
-
const latestPaddingText = shouldShowDashes(latestPadding)
|
|
185
|
-
? dashColor('-').repeat(latestPadding)
|
|
186
|
-
: ' '.repeat(latestPadding);
|
|
187
|
-
latestSection += ' ' + latestPaddingText;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
// Empty slot - maintain column width
|
|
191
|
-
latestSection = ' '.repeat(latestColumnWidth);
|
|
192
|
-
}
|
|
193
|
-
// Build line with fixed column widths
|
|
194
|
-
const line = `${prefix}${packageNameSection} ${currentWithPadding} ${rangeSection} ${latestSection}`;
|
|
195
|
-
return line;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Render section header
|
|
199
|
-
*/
|
|
200
|
-
function renderSectionHeader(title, sectionType) {
|
|
201
|
-
const colorFn = sectionType === 'main' ? chalk_1.default.cyan : sectionType === 'peer' ? chalk_1.default.magenta : chalk_1.default.yellow;
|
|
202
|
-
return ' ' + colorFn.bold(title);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Render spacer
|
|
206
|
-
*/
|
|
207
|
-
function renderSpacer() {
|
|
208
|
-
return '';
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Render the main interface
|
|
212
|
-
*/
|
|
213
|
-
function renderInterface(states, currentRow, scrollOffset, maxVisibleItems, forceFullRender, renderableItems, activeFilterLabel, packageManager, filterMode, filterQuery, totalPackagesBeforeFilter, terminalWidth = 80, loadingProgress, auditProgress, options = {}) {
|
|
214
|
-
const output = [];
|
|
215
|
-
// Header section (same for initial and incremental render)
|
|
216
|
-
if (packageManager) {
|
|
217
|
-
// Color map for each package manager - use their primary color for main text
|
|
218
|
-
const colorMap = {
|
|
219
|
-
npm: chalk_1.default.red,
|
|
220
|
-
yarn: chalk_1.default.blue,
|
|
221
|
-
pnpm: chalk_1.default.yellow,
|
|
222
|
-
bun: chalk_1.default.magenta,
|
|
223
|
-
};
|
|
224
|
-
const pmColor = colorMap[packageManager.name] || packageManager.color;
|
|
225
|
-
// Each character in "inup" gets a different color
|
|
226
|
-
const headerLine = ' ' +
|
|
227
|
-
chalk_1.default.bold(pmColor('🚀')) +
|
|
228
|
-
' ' +
|
|
229
|
-
(0, themes_colors_1.coloredInupLogo)() +
|
|
230
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(` (${packageManager.displayName})`);
|
|
231
|
-
// Show filter state (always show, including "All")
|
|
232
|
-
const fullHeaderLine = activeFilterLabel
|
|
233
|
-
? headerLine +
|
|
234
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(' - ') +
|
|
235
|
-
(0, themes_colors_1.getThemeColor)('primary')(activeFilterLabel)
|
|
236
|
-
: headerLine;
|
|
237
|
-
// Pad to terminal width to clear any leftover characters
|
|
238
|
-
const headerPadding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(fullHeaderLine));
|
|
239
|
-
output.push(fullHeaderLine + ' '.repeat(headerPadding));
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
const headerLine = ' ' + chalk_1.default.bold.blue('🚀 ') + (0, themes_colors_1.coloredInupLogo)();
|
|
243
|
-
// Show filter state (always show, including "All")
|
|
244
|
-
const fullHeaderLine = activeFilterLabel
|
|
245
|
-
? headerLine +
|
|
246
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(' - ') +
|
|
247
|
-
(0, themes_colors_1.getThemeColor)('primary')(activeFilterLabel)
|
|
248
|
-
: headerLine;
|
|
249
|
-
// Pad to terminal width to clear any leftover characters
|
|
250
|
-
const headerPadding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(fullHeaderLine));
|
|
251
|
-
output.push(fullHeaderLine + ' '.repeat(headerPadding));
|
|
252
|
-
}
|
|
253
|
-
output.push('');
|
|
254
|
-
if (filterMode) {
|
|
255
|
-
// Show filter input with cursor when actively filtering
|
|
256
|
-
const filterDisplay = ' ' +
|
|
257
|
-
chalk_1.default.bold.white('Search: ') +
|
|
258
|
-
(0, themes_colors_1.getThemeColor)('primary')(filterQuery || '') +
|
|
259
|
-
(0, themes_colors_1.getThemeColor)('border')('█');
|
|
260
|
-
// Pad to terminal width to clear any leftover characters from backspace
|
|
261
|
-
const padding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(filterDisplay));
|
|
262
|
-
output.push(filterDisplay + ' '.repeat(padding));
|
|
263
|
-
}
|
|
264
|
-
else if (filterQuery) {
|
|
265
|
-
// Show applied filter when not in filter mode but filter is active
|
|
266
|
-
const filterDisplay = ' ' +
|
|
267
|
-
chalk_1.default.bold.white('Search: ') +
|
|
268
|
-
(0, themes_colors_1.getThemeColor)('primary')(filterQuery) +
|
|
269
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(' (press / to edit)');
|
|
270
|
-
const padding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(filterDisplay));
|
|
271
|
-
output.push(filterDisplay + ' '.repeat(padding));
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
// Show instructions when not filtering
|
|
275
|
-
output.push(' ' +
|
|
276
|
-
chalk_1.default.bold.white('/ ') +
|
|
277
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Search') +
|
|
278
|
-
' ' +
|
|
279
|
-
chalk_1.default.bold.white('↑/↓ ') +
|
|
280
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Move') +
|
|
281
|
-
' ' +
|
|
282
|
-
chalk_1.default.bold.white('←/→ ') +
|
|
283
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Select') +
|
|
284
|
-
' ' +
|
|
285
|
-
chalk_1.default.bold.white('D/P/O ') +
|
|
286
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Filter') +
|
|
287
|
-
' ' +
|
|
288
|
-
chalk_1.default.bold.white('I ') +
|
|
289
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Info') +
|
|
290
|
-
' ' +
|
|
291
|
-
chalk_1.default.bold.white('S ') +
|
|
292
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Vulnerable') +
|
|
293
|
-
' ' +
|
|
294
|
-
chalk_1.default.bold.white('M ') +
|
|
295
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('Minor') +
|
|
296
|
-
' ' +
|
|
297
|
-
chalk_1.default.bold.white('L ') +
|
|
298
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('All') +
|
|
299
|
-
' ' +
|
|
300
|
-
chalk_1.default.bold.white('U ') +
|
|
301
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')('None'));
|
|
302
|
-
}
|
|
303
|
-
// Show status line with item range
|
|
304
|
-
const totalPackages = states.length;
|
|
305
|
-
const totalBeforeFilter = totalPackagesBeforeFilter || totalPackages;
|
|
306
|
-
// Use renderableItems length only if we have renderable items (grouped mode), otherwise use totalPackages (flat mode)
|
|
307
|
-
const totalVisualItems = renderableItems && renderableItems.length > 0 ? renderableItems.length : totalPackages;
|
|
308
|
-
const startItem = scrollOffset + 1;
|
|
309
|
-
const endItem = Math.min(scrollOffset + maxVisibleItems, totalVisualItems);
|
|
310
|
-
let statusLine = '';
|
|
311
|
-
if (filterMode) {
|
|
312
|
-
// In filter mode, show Enter to apply and ESC to clear
|
|
313
|
-
if (totalPackages === 0) {
|
|
314
|
-
statusLine =
|
|
315
|
-
(0, themes_colors_1.getThemeColor)('warning')(`No matches found`) +
|
|
316
|
-
' ' +
|
|
317
|
-
chalk_1.default.bold.white('Esc ') +
|
|
318
|
-
chalk_1.default.gray('Clear');
|
|
319
|
-
}
|
|
320
|
-
else if (totalVisualItems > maxVisibleItems) {
|
|
321
|
-
statusLine =
|
|
322
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(`Showing ${chalk_1.default.white(startItem)}-${chalk_1.default.white(endItem)} of ${chalk_1.default.white(totalPackages)} matches`) +
|
|
323
|
-
' ' +
|
|
324
|
-
chalk_1.default.bold.white('Enter ') +
|
|
325
|
-
chalk_1.default.gray('Apply') +
|
|
326
|
-
' ' +
|
|
327
|
-
chalk_1.default.bold.white('Esc ') +
|
|
328
|
-
chalk_1.default.gray('Clear');
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
statusLine =
|
|
332
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(`Showing all ${chalk_1.default.white(totalPackages)} matches`) +
|
|
333
|
-
' ' +
|
|
334
|
-
chalk_1.default.bold.white('Enter ') +
|
|
335
|
-
chalk_1.default.gray('Apply') +
|
|
336
|
-
' ' +
|
|
337
|
-
chalk_1.default.bold.white('Esc ') +
|
|
338
|
-
chalk_1.default.gray('Clear');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
else if (totalPackages < totalBeforeFilter) {
|
|
342
|
-
// Filter is applied but not in filter mode
|
|
343
|
-
if (totalVisualItems > maxVisibleItems) {
|
|
344
|
-
statusLine =
|
|
345
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(`Showing ${chalk_1.default.white(startItem)}-${chalk_1.default.white(endItem)} of ${chalk_1.default.white(totalPackages)} matches`) +
|
|
346
|
-
' ' +
|
|
347
|
-
chalk_1.default.bold.white('D/P/O ') +
|
|
348
|
-
chalk_1.default.gray('Filter') +
|
|
349
|
-
' ' +
|
|
350
|
-
chalk_1.default.bold.white('M ') +
|
|
351
|
-
chalk_1.default.gray('Minor') +
|
|
352
|
-
' ' +
|
|
353
|
-
chalk_1.default.bold.white('L ') +
|
|
354
|
-
chalk_1.default.gray('All') +
|
|
355
|
-
' ' +
|
|
356
|
-
chalk_1.default.bold.white('U ') +
|
|
357
|
-
chalk_1.default.gray('None') +
|
|
358
|
-
' ' +
|
|
359
|
-
chalk_1.default.bold.white('Esc ') +
|
|
360
|
-
chalk_1.default.gray('Clear');
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
statusLine =
|
|
364
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(`Showing all ${chalk_1.default.white(totalPackages)} matches`) +
|
|
365
|
-
' ' +
|
|
366
|
-
chalk_1.default.bold.white('D/P/O ') +
|
|
367
|
-
chalk_1.default.gray('Filter') +
|
|
368
|
-
' ' +
|
|
369
|
-
chalk_1.default.bold.white('M ') +
|
|
370
|
-
chalk_1.default.gray('Minor') +
|
|
371
|
-
' ' +
|
|
372
|
-
chalk_1.default.bold.white('L ') +
|
|
373
|
-
chalk_1.default.gray('All') +
|
|
374
|
-
' ' +
|
|
375
|
-
chalk_1.default.bold.white('U ') +
|
|
376
|
-
chalk_1.default.gray('None') +
|
|
377
|
-
' ' +
|
|
378
|
-
chalk_1.default.bold.white('Esc ') +
|
|
379
|
-
chalk_1.default.gray('Clear');
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
// No filter applied
|
|
384
|
-
if (totalVisualItems > maxVisibleItems) {
|
|
385
|
-
statusLine =
|
|
386
|
-
chalk_1.default.gray(`Showing ${chalk_1.default.white(startItem)}-${chalk_1.default.white(endItem)} of ${chalk_1.default.white(totalPackages)} packages`) +
|
|
387
|
-
' ' +
|
|
388
|
-
chalk_1.default.bold.white('Enter ') +
|
|
389
|
-
chalk_1.default.gray('Confirm');
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
statusLine =
|
|
393
|
-
chalk_1.default.gray(`Showing all ${chalk_1.default.white(totalPackages)} packages`) +
|
|
394
|
-
' ' +
|
|
395
|
-
chalk_1.default.bold.white('Enter ') +
|
|
396
|
-
chalk_1.default.gray('Confirm');
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
if (auditProgress && auditProgress.total > 0) {
|
|
400
|
-
const auditLabel = auditProgress.isRunning
|
|
401
|
-
? `Audit ${auditProgress.completed}/${auditProgress.total}`
|
|
402
|
-
: `Audit ${auditProgress.total}/${auditProgress.total}`;
|
|
403
|
-
statusLine += ' ' + (0, themes_colors_1.getThemeColor)('textSecondary')(auditLabel);
|
|
404
|
-
}
|
|
405
|
-
// Pad status line to terminal width to clear any leftover characters
|
|
406
|
-
const statusLineFull = ' ' + statusLine;
|
|
407
|
-
const statusPadding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(statusLineFull));
|
|
408
|
-
output.push(statusLineFull + ' '.repeat(statusPadding));
|
|
409
|
-
output.push('');
|
|
410
|
-
// Render visible items
|
|
411
|
-
if (renderableItems && renderableItems.length > 0) {
|
|
412
|
-
// Use renderable items for grouped display
|
|
413
|
-
for (let i = scrollOffset; i < Math.min(scrollOffset + maxVisibleItems, renderableItems.length); i++) {
|
|
414
|
-
const item = renderableItems[i];
|
|
415
|
-
if (item.type === 'header') {
|
|
416
|
-
output.push(renderSectionHeader(item.title, item.sectionType));
|
|
417
|
-
}
|
|
418
|
-
else if (item.type === 'spacer') {
|
|
419
|
-
output.push(renderSpacer());
|
|
420
|
-
}
|
|
421
|
-
else if (item.type === 'package') {
|
|
422
|
-
const line = renderPackageLine(item.state, item.originalIndex, item.originalIndex === currentRow, terminalWidth, options);
|
|
423
|
-
output.push(line);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
// Fallback to flat rendering (legacy mode)
|
|
429
|
-
for (let i = scrollOffset; i < Math.min(scrollOffset + maxVisibleItems, states.length); i++) {
|
|
430
|
-
const line = renderPackageLine(states[i], i, i === currentRow, terminalWidth, options);
|
|
431
|
-
output.push(line);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
if (loadingProgress?.isLoading) {
|
|
435
|
-
const loadingLabel = `Loading packages... (${loadingProgress.resolved}/${loadingProgress.total} checked)`;
|
|
436
|
-
const failedLabel = loadingProgress.failed > 0 ? ` ${loadingProgress.failed} unavailable` : '';
|
|
437
|
-
const loadingLine = ' ' +
|
|
438
|
-
(0, themes_colors_1.getThemeColor)('textSecondary')(loadingLabel) +
|
|
439
|
-
(failedLabel ? chalk_1.default.yellow(failedLabel) : '');
|
|
440
|
-
const loadingPadding = Math.max(0, terminalWidth - utils_1.VersionUtils.getVisualLength(loadingLine));
|
|
441
|
-
output.push(loadingLine + ' '.repeat(loadingPadding));
|
|
442
|
-
}
|
|
443
|
-
return output.map((line) => padLineToWidth(line, terminalWidth));
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Render packages table
|
|
447
|
-
*/
|
|
448
|
-
function renderPackagesTable(packages) {
|
|
449
|
-
if (packages.length === 0) {
|
|
450
|
-
return chalk_1.default.green('✅ All packages are up to date!');
|
|
451
|
-
}
|
|
452
|
-
const outdatedPackages = packages.filter((p) => p.isOutdated);
|
|
453
|
-
if (outdatedPackages.length === 0) {
|
|
454
|
-
return chalk_1.default.green('✅ All packages are up to date!');
|
|
455
|
-
}
|
|
456
|
-
// Just show a simple message, the interactive interface will handle the display
|
|
457
|
-
return chalk_1.default.bold.blue('🚀 inup\n');
|
|
458
|
-
}
|
|
17
|
+
__exportStar(require("./package-list/rows"), exports);
|
|
18
|
+
__exportStar(require("./package-list/interface"), exports);
|
|
459
19
|
//# sourceMappingURL=package-list.js.map
|