inup 1.5.4 → 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 +30 -587
- 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 +62 -77
- 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 -368
- 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 -462
- 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 +8 -0
- 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 +10 -9
package/README.md
CHANGED
|
@@ -54,18 +54,32 @@ inup [options]
|
|
|
54
54
|
|
|
55
55
|
## Keyboard Shortcuts
|
|
56
56
|
|
|
57
|
+
<!-- KEYS:START -->
|
|
57
58
|
| Key | Action |
|
|
58
59
|
|-----|--------|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
60
|
+
| `↑ / k` | Move up |
|
|
61
|
+
| `↓ / j` | Move down |
|
|
62
|
+
| `g` | Jump to the first package |
|
|
63
|
+
| `G` | Jump to the last package |
|
|
64
|
+
| `←` | Cycle selection left (none → range → latest) |
|
|
65
|
+
| `→` | Cycle selection right (none → range → latest) |
|
|
66
|
+
| `Space` | Toggle the current package on/off |
|
|
67
|
+
| `m` | Select all minor/patch updates |
|
|
68
|
+
| `l` | Select all latest updates (including major) |
|
|
69
|
+
| `u` | Unselect all packages |
|
|
70
|
+
| `Enter` | Confirm selection and upgrade |
|
|
71
|
+
| `/` | Search packages by name |
|
|
72
|
+
| `d` | Toggle devDependencies |
|
|
73
|
+
| `p` | Toggle peerDependencies |
|
|
74
|
+
| `o` | Toggle optionalDependencies |
|
|
75
|
+
| `s` | Run the vulnerability audit |
|
|
76
|
+
| `v` | Show only vulnerable packages |
|
|
77
|
+
| `Esc` | Clear the active search filter |
|
|
78
|
+
| `i` | View package details and changelog |
|
|
79
|
+
| `t` | Change the color theme |
|
|
80
|
+
| `?` | Show this help |
|
|
81
|
+
| `!` | Show the performance/debug panel |
|
|
82
|
+
<!-- KEYS:END -->
|
|
69
83
|
|
|
70
84
|
## Privacy
|
|
71
85
|
|
package/dist/cli.js
CHANGED
|
@@ -7,15 +7,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.runCli = runCli;
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
10
|
const path_1 = require("path");
|
|
12
11
|
const index_1 = require("./index");
|
|
13
12
|
const services_1 = require("./services");
|
|
14
13
|
const config_1 = require("./config");
|
|
15
14
|
const utils_1 = require("./utils");
|
|
16
15
|
const git_1 = require("./utils/git");
|
|
17
|
-
const
|
|
18
|
-
const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json'), 'utf-8'));
|
|
16
|
+
const ui_1 = require("./ui");
|
|
19
17
|
const program = new commander_1.Command();
|
|
20
18
|
async function runCli(options) {
|
|
21
19
|
const cwd = (0, path_1.resolve)(options.dir);
|
|
@@ -24,7 +22,7 @@ async function runCli(options) {
|
|
|
24
22
|
}
|
|
25
23
|
const gitState = (0, git_1.getGitWorkingTreeState)(cwd);
|
|
26
24
|
if (gitState.isRepo && gitState.isDirty) {
|
|
27
|
-
const shouldProceed = await
|
|
25
|
+
const shouldProceed = await ui_1.TerminalInput.promptForImmediateConfirmation(`${chalk_1.default.yellow('Warning:')} dirty working tree. Proceed anyway? ${chalk_1.default.dim('[y/N]')} `, false);
|
|
28
26
|
if (!shouldProceed) {
|
|
29
27
|
console.log(chalk_1.default.yellow('Upgrade cancelled.'));
|
|
30
28
|
return;
|
|
@@ -55,7 +53,7 @@ async function runCli(options) {
|
|
|
55
53
|
process.exit(1);
|
|
56
54
|
}
|
|
57
55
|
// Check for updates in the background (non-blocking)
|
|
58
|
-
const updateCheckPromise = (0, services_1.checkForUpdateAsync)(
|
|
56
|
+
const updateCheckPromise = (0, services_1.checkForUpdateAsync)(config_1.PACKAGE_NAME, config_1.PACKAGE_VERSION);
|
|
59
57
|
// Validate package manager if provided
|
|
60
58
|
let packageManager;
|
|
61
59
|
if (options.packageManager) {
|
|
@@ -81,30 +79,30 @@ async function runCli(options) {
|
|
|
81
79
|
// After the main flow completes, check if there's an update available
|
|
82
80
|
const updateCheck = await updateCheckPromise;
|
|
83
81
|
if (updateCheck?.isOutdated) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
const columns = process.stdout.columns && process.stdout.columns > 0 ? process.stdout.columns : 80;
|
|
83
|
+
const innerWidth = Math.max(40, Math.min(columns, 100) - 2); // chars between the │ borders
|
|
84
|
+
const border = chalk_1.default.yellow;
|
|
85
|
+
const padTo = (visibleLength) => ' '.repeat(Math.max(0, innerWidth - visibleLength));
|
|
86
|
+
const line1Plain = ` Update available! ${updateCheck.currentVersion} → ${updateCheck.latestVersion}`;
|
|
87
|
+
const line1 = ' ' +
|
|
88
88
|
chalk_1.default.bold.yellow('Update available! ') +
|
|
89
|
-
chalk_1.default.gray(
|
|
89
|
+
chalk_1.default.gray(updateCheck.currentVersion) +
|
|
90
90
|
' → ' +
|
|
91
|
-
chalk_1.default.green(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
console.log(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
chalk_1.default.yellow('│'));
|
|
100
|
-
console.log(chalk_1.default.yellow('└' + '─'.repeat(78) + '┘'));
|
|
91
|
+
chalk_1.default.green(updateCheck.latestVersion);
|
|
92
|
+
const line2Plain = ` Run: ${updateCheck.updateCommand}`;
|
|
93
|
+
const line2 = ' ' + chalk_1.default.gray('Run: ') + chalk_1.default.cyan(updateCheck.updateCommand);
|
|
94
|
+
console.log('');
|
|
95
|
+
console.log(border('┌' + '─'.repeat(innerWidth) + '┐'));
|
|
96
|
+
console.log(border('│') + line1 + padTo(line1Plain.length) + border('│'));
|
|
97
|
+
console.log(border('│') + line2 + padTo(line2Plain.length) + border('│'));
|
|
98
|
+
console.log(border('└' + '─'.repeat(innerWidth) + '┘'));
|
|
101
99
|
console.log('');
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
program
|
|
105
|
-
.name(
|
|
103
|
+
.name(config_1.PACKAGE_NAME)
|
|
106
104
|
.description('Interactive upgrade tool for package managers. Auto-detects and works with npm, yarn, pnpm, and bun.')
|
|
107
|
-
.version(
|
|
105
|
+
.version(config_1.PACKAGE_VERSION)
|
|
108
106
|
.option('-d, --dir <directory>', 'specify directory to run in', process.cwd())
|
|
109
107
|
.option('-e, --exclude <patterns>', 'exclude paths matching regex patterns (comma-separated)', '')
|
|
110
108
|
.option('-i, --ignore <packages>', 'ignore packages (comma-separated, supports glob patterns like @babel/*)')
|
package/dist/config/constants.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSDELIVR_POOL_TIMEOUT = exports.JSDELIVR_RETRY_DELAYS = exports.JSDELIVR_RETRY_TIMEOUTS = exports.REQUEST_TIMEOUT = exports.CACHE_TTL = exports.MAX_CONCURRENT_REQUESTS = exports.JSDELIVR_CDN_URL = exports.NPM_REGISTRY_URL = exports.PACKAGE_NAME = void 0;
|
|
4
|
-
|
|
3
|
+
exports.JSDELIVR_POOL_TIMEOUT = exports.JSDELIVR_RETRY_DELAYS = exports.JSDELIVR_RETRY_TIMEOUTS = exports.REQUEST_TIMEOUT = exports.CACHE_TTL = exports.MAX_CONCURRENT_REQUESTS = exports.JSDELIVR_CDN_URL = exports.NPM_REGISTRY_URL = exports.PACKAGE_VERSION = exports.PACKAGE_NAME = void 0;
|
|
4
|
+
var package_meta_1 = require("./package-meta");
|
|
5
|
+
Object.defineProperty(exports, "PACKAGE_NAME", { enumerable: true, get: function () { return package_meta_1.PACKAGE_NAME; } });
|
|
6
|
+
Object.defineProperty(exports, "PACKAGE_VERSION", { enumerable: true, get: function () { return package_meta_1.PACKAGE_VERSION; } });
|
|
5
7
|
exports.NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
6
8
|
exports.JSDELIVR_CDN_URL = 'https://cdn.jsdelivr.net/npm';
|
|
7
9
|
exports.MAX_CONCURRENT_REQUESTS = 150;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PACKAGE_VERSION = exports.PACKAGE_NAME = void 0;
|
|
7
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
|
+
exports.PACKAGE_NAME = package_json_1.default.name;
|
|
9
|
+
exports.PACKAGE_VERSION = package_json_1.default.version;
|
|
10
|
+
//# sourceMappingURL=package-meta.js.map
|
|
@@ -4,7 +4,12 @@ exports.loadProjectConfig = loadProjectConfig;
|
|
|
4
4
|
exports.isPackageIgnored = isPackageIgnored;
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
7
|
+
const package_meta_1 = require("./package-meta");
|
|
8
|
+
const CONFIG_FILES = [
|
|
9
|
+
`.${package_meta_1.PACKAGE_NAME}rc`,
|
|
10
|
+
`.${package_meta_1.PACKAGE_NAME}rc.json`,
|
|
11
|
+
`${package_meta_1.PACKAGE_NAME}.config.json`,
|
|
12
|
+
];
|
|
8
13
|
/**
|
|
9
14
|
* Load project configuration from .inuprc, .inuprc.json, or inup.config.json
|
|
10
15
|
* Searches in the specified directory and parent directories up to root
|
|
@@ -42,11 +42,15 @@ const utils_2 = require("../ui/utils");
|
|
|
42
42
|
const utils_3 = require("../utils");
|
|
43
43
|
const debug_1 = require("../features/debug");
|
|
44
44
|
class PackageDetector {
|
|
45
|
+
packageJsonPath = null;
|
|
46
|
+
packageJson = null;
|
|
47
|
+
cwd;
|
|
48
|
+
excludePatterns;
|
|
49
|
+
ignorePackages;
|
|
50
|
+
maxDepth;
|
|
51
|
+
batchSize = 10;
|
|
52
|
+
maxConcurrency = 10;
|
|
45
53
|
constructor(options) {
|
|
46
|
-
this.packageJsonPath = null;
|
|
47
|
-
this.packageJson = null;
|
|
48
|
-
this.batchSize = 10;
|
|
49
|
-
this.maxConcurrency = 10;
|
|
50
54
|
this.cwd = options?.cwd || process.cwd();
|
|
51
55
|
this.excludePatterns = options?.excludePatterns || [];
|
|
52
56
|
this.ignorePackages = options?.ignorePackages || [];
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.UpgradeRunner = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const package_detector_1 = require("./package-detector");
|
|
9
9
|
const interactive_ui_1 = require("../interactive-ui");
|
|
@@ -15,8 +15,11 @@ const debug_1 = require("../features/debug");
|
|
|
15
15
|
* Main orchestrator for the inup upgrade process
|
|
16
16
|
*/
|
|
17
17
|
class UpgradeRunner {
|
|
18
|
+
detector;
|
|
19
|
+
ui;
|
|
20
|
+
upgrader;
|
|
21
|
+
packageManager;
|
|
18
22
|
constructor(options) {
|
|
19
|
-
this.options = options;
|
|
20
23
|
// Detect package manager
|
|
21
24
|
const cwd = options?.cwd || process.cwd();
|
|
22
25
|
if (options?.packageManager) {
|
|
@@ -96,14 +99,14 @@ class UpgradeRunner {
|
|
|
96
99
|
let selectedChoices = await selectionPromise;
|
|
97
100
|
const outdatedPackages = this.detector.getOutdatedPackagesOnly(latestPackages);
|
|
98
101
|
if (outdatedPackages.length === 0 && selectedChoices.length === 0) {
|
|
99
|
-
console.log(chalk_1.default.green('✅
|
|
102
|
+
console.log(chalk_1.default.green('✅ Everything is up to date — no upgrades needed.'));
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
// Interactive selection and confirmation loop
|
|
103
106
|
let shouldProceed = false;
|
|
104
107
|
while (true) {
|
|
105
108
|
if (selectedChoices.length === 0) {
|
|
106
|
-
console.log(chalk_1.default.yellow('
|
|
109
|
+
console.log(chalk_1.default.yellow('Nothing selected — no changes made.'));
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
109
112
|
// Validate selected choices before confirmation
|
|
@@ -184,10 +187,4 @@ class UpgradeRunner {
|
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
exports.UpgradeRunner = UpgradeRunner;
|
|
187
|
-
/**
|
|
188
|
-
* @deprecated Use UpgradeRunner instead
|
|
189
|
-
*/
|
|
190
|
-
class PnpmUpgradeInteractive extends UpgradeRunner {
|
|
191
|
-
}
|
|
192
|
-
exports.PnpmUpgradeInteractive = PnpmUpgradeInteractive;
|
|
193
190
|
//# sourceMappingURL=upgrade-runner.js.map
|
package/dist/core/upgrader.js
CHANGED
|
@@ -11,16 +11,17 @@ const path_1 = require("path");
|
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
13
13
|
class PackageUpgrader {
|
|
14
|
+
packageManager;
|
|
14
15
|
constructor(packageManager) {
|
|
15
16
|
this.packageManager = packageManager;
|
|
16
17
|
}
|
|
17
|
-
async upgradePackages(choices,
|
|
18
|
+
async upgradePackages(choices, _packageInfos) {
|
|
18
19
|
if (choices.length === 0) {
|
|
19
20
|
console.log(chalk_1.default.yellow('No packages to upgrade.'));
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
// Group choices by package.json path and dependency type
|
|
23
|
-
const choicesByFileAndType = this.groupChoicesByFileAndType(choices
|
|
24
|
+
const choicesByFileAndType = this.groupChoicesByFileAndType(choices);
|
|
24
25
|
for (const [fileAndType, choiceList] of Object.entries(choicesByFileAndType)) {
|
|
25
26
|
if (choiceList.length === 0)
|
|
26
27
|
continue;
|
|
@@ -32,9 +33,9 @@ class PackageUpgrader {
|
|
|
32
33
|
const uniquePackages = new Set(choices.map((c) => c.name));
|
|
33
34
|
console.log(chalk_1.default.green(`\n✅ Successfully upgraded ${uniquePackages.size} package(s)!`));
|
|
34
35
|
// Execute package manager install after all upgrades are complete
|
|
35
|
-
await this.runInstall(choices
|
|
36
|
+
await this.runInstall(choices);
|
|
36
37
|
}
|
|
37
|
-
async runInstall(choices
|
|
38
|
+
async runInstall(choices) {
|
|
38
39
|
if (choices.length === 0) {
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
@@ -71,7 +72,7 @@ class PackageUpgrader {
|
|
|
71
72
|
throw new Error(`${this.packageManager.installCommand} exited with code ${result.status}`);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
groupChoicesByFileAndType(choices
|
|
75
|
+
groupChoicesByFileAndType(choices) {
|
|
75
76
|
const groups = {};
|
|
76
77
|
choices.forEach((choice) => {
|
|
77
78
|
const key = `${choice.packageJsonPath}|${choice.dependencyType}`;
|
|
@@ -93,9 +94,6 @@ class PackageUpgrader {
|
|
|
93
94
|
try {
|
|
94
95
|
// Read the current package.json
|
|
95
96
|
const packageJson = (0, utils_1.readPackageJson)(packageJsonPath);
|
|
96
|
-
// Find workspace root
|
|
97
|
-
const workspaceRoot = (0, utils_1.findWorkspaceRoot)(packageDir, this.packageManager.name);
|
|
98
|
-
const isWorkspaceRoot = packageDir === workspaceRoot;
|
|
99
97
|
// Group by upgrade type (range vs latest)
|
|
100
98
|
const rangeChoices = choices.filter((c) => c.upgradeType === 'range');
|
|
101
99
|
const latestChoices = choices.filter((c) => c.upgradeType === 'latest');
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GitHubClient = void 0;
|
|
4
4
|
const repository_ref_1 = require("../parsers/repository-ref");
|
|
5
|
+
const config_1 = require("../../../config");
|
|
5
6
|
const GITHUB_RELEASES_PAGE_LIMIT = 3;
|
|
6
7
|
class GitHubClient {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.rawChangelogCache = new Map();
|
|
10
|
-
}
|
|
8
|
+
releasesCache = new Map();
|
|
9
|
+
rawChangelogCache = new Map();
|
|
11
10
|
clearCache() {
|
|
12
11
|
this.releasesCache.clear();
|
|
13
12
|
this.rawChangelogCache.clear();
|
|
@@ -21,7 +20,7 @@ class GitHubClient {
|
|
|
21
20
|
method: 'GET',
|
|
22
21
|
headers: {
|
|
23
22
|
accept: 'application/vnd.github.v3+json',
|
|
24
|
-
'user-agent':
|
|
23
|
+
'user-agent': `${config_1.PACKAGE_NAME}-cli`,
|
|
25
24
|
},
|
|
26
25
|
signal,
|
|
27
26
|
});
|
|
@@ -72,7 +71,7 @@ class GitHubClient {
|
|
|
72
71
|
method: 'GET',
|
|
73
72
|
headers: {
|
|
74
73
|
accept: 'application/vnd.github.v3+json',
|
|
75
|
-
'user-agent':
|
|
74
|
+
'user-agent': `${config_1.PACKAGE_NAME}-cli`,
|
|
76
75
|
},
|
|
77
76
|
signal,
|
|
78
77
|
});
|
|
@@ -4,10 +4,8 @@ exports.changelogFetcher = exports.ChangelogFetcher = void 0;
|
|
|
4
4
|
const package_metadata_service_1 = require("./package-metadata-service");
|
|
5
5
|
const release_notes_service_1 = require("./release-notes-service");
|
|
6
6
|
class ChangelogFetcher {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.releaseNotesService = new release_notes_service_1.ReleaseNotesService(this.metadataService);
|
|
10
|
-
}
|
|
7
|
+
metadataService = new package_metadata_service_1.PackageMetadataService();
|
|
8
|
+
releaseNotesService = new release_notes_service_1.ReleaseNotesService(this.metadataService);
|
|
11
9
|
async fetchPackageMetadata(packageName, version, signal) {
|
|
12
10
|
return await this.metadataService.fetchPackageMetadata(packageName, version, signal);
|
|
13
11
|
}
|
|
@@ -4,12 +4,15 @@ exports.PackageMetadataService = void 0;
|
|
|
4
4
|
const npm_registry_client_1 = require("../clients/npm-registry-client");
|
|
5
5
|
const package_metadata_1 = require("../parsers/package-metadata");
|
|
6
6
|
const jsdelivr_registry_1 = require("../../../services/jsdelivr-registry");
|
|
7
|
+
const inflight_1 = require("../../../services/http/inflight");
|
|
7
8
|
class PackageMetadataService {
|
|
9
|
+
npmRegistryClient;
|
|
10
|
+
exactManifestFetcher;
|
|
11
|
+
cache = new Map();
|
|
12
|
+
inFlight = new inflight_1.InflightMap();
|
|
8
13
|
constructor(npmRegistryClient = new npm_registry_client_1.NpmRegistryClient(), exactManifestFetcher = jsdelivr_registry_1.fetchExactPackageManifest) {
|
|
9
14
|
this.npmRegistryClient = npmRegistryClient;
|
|
10
15
|
this.exactManifestFetcher = exactManifestFetcher;
|
|
11
|
-
this.cache = new Map();
|
|
12
|
-
this.inFlight = new Map();
|
|
13
16
|
}
|
|
14
17
|
clearCache() {
|
|
15
18
|
this.cache.clear();
|
|
@@ -28,15 +31,7 @@ class PackageMetadataService {
|
|
|
28
31
|
if (this.cache.has(cacheKey)) {
|
|
29
32
|
return this.cache.get(cacheKey) ?? null;
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
if (inFlight) {
|
|
33
|
-
return await inFlight;
|
|
34
|
-
}
|
|
35
|
-
const lookupPromise = this.fetchAndCachePackageMetadata(packageName, version, signal).finally(() => {
|
|
36
|
-
this.inFlight.delete(cacheKey);
|
|
37
|
-
});
|
|
38
|
-
this.inFlight.set(cacheKey, lookupPromise);
|
|
39
|
-
return await lookupPromise;
|
|
34
|
+
return this.inFlight.dedupe(cacheKey, () => this.fetchAndCachePackageMetadata(packageName, version, signal));
|
|
40
35
|
}
|
|
41
36
|
cacheMetadata(packageName, rawData) {
|
|
42
37
|
const metadata = this.buildMetadata(packageName, rawData);
|
|
@@ -42,11 +42,13 @@ const constants_1 = require("../../../config/constants");
|
|
|
42
42
|
const RELEASE_NOTES_FETCH_TIMEOUT_MS = 5000;
|
|
43
43
|
const PREFER_GITHUB_RELEASE_PAGE = true;
|
|
44
44
|
class ReleaseNotesService {
|
|
45
|
+
metadataService;
|
|
46
|
+
githubClient;
|
|
47
|
+
releaseNotesCache = new Map();
|
|
48
|
+
releaseNotesInFlight = new Map();
|
|
45
49
|
constructor(metadataService, githubClient = new github_client_1.GitHubClient()) {
|
|
46
50
|
this.metadataService = metadataService;
|
|
47
51
|
this.githubClient = githubClient;
|
|
48
|
-
this.releaseNotesCache = new Map();
|
|
49
|
-
this.releaseNotesInFlight = new Map();
|
|
50
52
|
}
|
|
51
53
|
clearCache() {
|
|
52
54
|
this.releaseNotesCache.clear();
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPerformanceTracker = getPerformanceTracker;
|
|
4
4
|
class PerformanceTracker {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.packageManager = null;
|
|
12
|
-
}
|
|
5
|
+
startedAt = null;
|
|
6
|
+
phases = {};
|
|
7
|
+
counts = {};
|
|
8
|
+
batches = [];
|
|
9
|
+
failedPackages = [];
|
|
10
|
+
packageManager = null;
|
|
13
11
|
start() {
|
|
14
12
|
this.startedAt = Date.now();
|
|
15
13
|
this.phases = {};
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Public API for inup
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.UpgradeRunner = void 0;
|
|
7
7
|
var core_1 = require("./core");
|
|
8
8
|
Object.defineProperty(exports, "UpgradeRunner", { enumerable: true, get: function () { return core_1.UpgradeRunner; } });
|
|
9
|
-
Object.defineProperty(exports, "PnpmUpgradeInteractive", { enumerable: true, get: function () { return core_1.PnpmUpgradeInteractive; } });
|
|
10
9
|
//# sourceMappingURL=index.js.map
|