pnpm-catalog-updates 0.4.3 → 0.5.1
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/dist/application/services/CatalogUpdateService.d.ts +1 -1
- package/dist/application/services/CatalogUpdateService.d.ts.map +1 -1
- package/dist/application/services/CatalogUpdateService.js +47 -7
- package/dist/application/services/CatalogUpdateService.js.map +1 -1
- package/dist/cli/commands/CheckCommand.js +2 -2
- package/dist/cli/commands/CheckCommand.js.map +1 -1
- package/dist/cli/commands/SecurityCommand.js +2 -2
- package/dist/cli/commands/SecurityCommand.js.map +1 -1
- package/dist/cli/commands/UpdateCommand.js +3 -3
- package/dist/cli/commands/UpdateCommand.js.map +1 -1
- package/dist/cli/formatters/ProgressBar.d.ts +3 -3
- package/dist/cli/formatters/ProgressBar.d.ts.map +1 -1
- package/dist/cli/formatters/ProgressBar.js +2 -2
- package/dist/cli/formatters/ProgressBar.js.map +1 -1
- package/dist/common/error-handling/ErrorTracker.d.ts +48 -0
- package/dist/common/error-handling/ErrorTracker.d.ts.map +1 -0
- package/dist/common/error-handling/ErrorTracker.js +93 -0
- package/dist/common/error-handling/ErrorTracker.js.map +1 -0
- package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts +74 -0
- package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts.map +1 -0
- package/dist/common/error-handling/UserFriendlyErrorHandler.js +703 -0
- package/dist/common/error-handling/UserFriendlyErrorHandler.js.map +1 -0
- package/dist/common/error-handling/index.d.ts +11 -0
- package/dist/common/error-handling/index.d.ts.map +1 -0
- package/dist/common/error-handling/index.js +9 -0
- package/dist/common/error-handling/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/external-services/NpmRegistryService.d.ts +2 -2
- package/dist/infrastructure/external-services/NpmRegistryService.d.ts.map +1 -1
- package/dist/infrastructure/external-services/NpmRegistryService.js +30 -7
- package/dist/infrastructure/external-services/NpmRegistryService.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-Friendly Error Handler
|
|
3
|
+
*
|
|
4
|
+
* Provides user-friendly error messages instead of exposing technical details.
|
|
5
|
+
* Categorizes errors and provides helpful suggestions where possible.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { Logger } from '../logger/Logger.js';
|
|
9
|
+
import { ErrorTracker } from './ErrorTracker.js';
|
|
10
|
+
export class UserFriendlyErrorHandler {
|
|
11
|
+
static logger = Logger.getLogger('ErrorHandler');
|
|
12
|
+
// Common package name corrections
|
|
13
|
+
static packageSuggestions = new Map([
|
|
14
|
+
// Framework packages
|
|
15
|
+
['sveltekit', ['@sveltejs/kit']],
|
|
16
|
+
['vue-router', ['vue-router']],
|
|
17
|
+
['vue-cli', ['@vue/cli']],
|
|
18
|
+
['angular-cli', ['@angular/cli']],
|
|
19
|
+
['angular-core', ['@angular/core']],
|
|
20
|
+
['angular-universal', ['@nguniversal/express-engine', '@angular/universal']],
|
|
21
|
+
['react-router', ['react-router-dom']],
|
|
22
|
+
['react-dom', ['react-dom']],
|
|
23
|
+
['nextjs', ['next']],
|
|
24
|
+
['nuxtjs', ['nuxt']],
|
|
25
|
+
// UI Libraries
|
|
26
|
+
['material-ui', ['@mui/material', '@material-ui/core']],
|
|
27
|
+
['mui', ['@mui/material']],
|
|
28
|
+
['antd', ['antd']],
|
|
29
|
+
['ant-design', ['antd']],
|
|
30
|
+
['prime-ng', ['primeng']],
|
|
31
|
+
['primeng', ['primeng']],
|
|
32
|
+
['ng-zorro', ['ng-zorro-antd']],
|
|
33
|
+
['bootstrap-vue', ['bootstrap-vue']],
|
|
34
|
+
['vuetify', ['vuetify']],
|
|
35
|
+
['quasar', ['quasar']],
|
|
36
|
+
['onsen-ui', ['onsenui']],
|
|
37
|
+
['ionic', ['@ionic/angular', '@ionic/react', '@ionic/vue']],
|
|
38
|
+
// CSS Frameworks
|
|
39
|
+
['tailwindcss', ['tailwindcss']],
|
|
40
|
+
['tailwind', ['tailwindcss']],
|
|
41
|
+
['bulma', ['bulma']],
|
|
42
|
+
['water-css', ['water.css']],
|
|
43
|
+
['holiday-css', ['@holiday-css/main']],
|
|
44
|
+
['wing-css', ['@wing-css/wing']],
|
|
45
|
+
['picnic-css', ['picnicss']],
|
|
46
|
+
// Build Tools & Bundlers
|
|
47
|
+
['webpack', ['webpack']],
|
|
48
|
+
['webpack-cli', ['webpack-cli']],
|
|
49
|
+
['rollup', ['rollup']],
|
|
50
|
+
['vite', ['vite']],
|
|
51
|
+
['parcel', ['parcel']],
|
|
52
|
+
['esbuild', ['esbuild']],
|
|
53
|
+
['swc', ['@swc/core']],
|
|
54
|
+
// Testing
|
|
55
|
+
['jest', ['jest']],
|
|
56
|
+
['vitest', ['vitest']],
|
|
57
|
+
['mocha', ['mocha']],
|
|
58
|
+
['chai', ['chai']],
|
|
59
|
+
['cypress', ['cypress']],
|
|
60
|
+
['playwright', ['@playwright/test']],
|
|
61
|
+
['puppeteer', ['puppeteer']],
|
|
62
|
+
['selenium', ['selenium-webdriver']],
|
|
63
|
+
['webdriver', ['selenium-webdriver']],
|
|
64
|
+
['lambdatest', ['@lambdatest/selenium-webdriver']],
|
|
65
|
+
['applitools', ['@applitools/eyes-selenium']],
|
|
66
|
+
['experitest', ['@experitest/seetest-client']],
|
|
67
|
+
['kobiton', ['@kobiton/api']],
|
|
68
|
+
['crossbrowsertesting', ['@crossbrowsertesting/selenium']],
|
|
69
|
+
// Cloud Services
|
|
70
|
+
['aws-sdk', ['@aws-sdk/client-s3', 'aws-sdk']],
|
|
71
|
+
['aws-device-farm', ['@aws-sdk/client-device-farm']],
|
|
72
|
+
['firebase', ['firebase']],
|
|
73
|
+
['firebase-test-lab', ['@google-cloud/testing']],
|
|
74
|
+
['azure', ['@azure/storage-blob', '@azure/cosmos']],
|
|
75
|
+
['azure-devtest-labs', ['@azure/arm-devtestlabs']],
|
|
76
|
+
['gcp', ['@google-cloud/storage']],
|
|
77
|
+
// Databases & ORMs
|
|
78
|
+
['mongoose', ['mongoose']],
|
|
79
|
+
['sequelize', ['sequelize']],
|
|
80
|
+
['typeorm', ['typeorm']],
|
|
81
|
+
['prisma', ['@prisma/client']],
|
|
82
|
+
['knex', ['knex']],
|
|
83
|
+
['pg', ['pg']],
|
|
84
|
+
['mysql', ['mysql2']],
|
|
85
|
+
['sqlite', ['sqlite3']],
|
|
86
|
+
['redis', ['redis']],
|
|
87
|
+
['mongodb', ['mongodb']],
|
|
88
|
+
// Utilities
|
|
89
|
+
['lodash', ['lodash']],
|
|
90
|
+
['loadash', ['lodash']],
|
|
91
|
+
['underscore', ['underscore']],
|
|
92
|
+
['ramda', ['ramda']],
|
|
93
|
+
['rxjs', ['rxjs']],
|
|
94
|
+
['axios', ['axios']],
|
|
95
|
+
['axois', ['axios']],
|
|
96
|
+
['fetch', ['node-fetch']],
|
|
97
|
+
['node-fetch', ['node-fetch']],
|
|
98
|
+
['request', ['axios', 'node-fetch']],
|
|
99
|
+
['superagent', ['superagent']],
|
|
100
|
+
// Date/Time
|
|
101
|
+
['moment', ['moment']],
|
|
102
|
+
['momentjs', ['moment']],
|
|
103
|
+
['dayjs', ['dayjs']],
|
|
104
|
+
['date-fns', ['date-fns']],
|
|
105
|
+
['luxon', ['luxon']],
|
|
106
|
+
// Linting & Formatting
|
|
107
|
+
['eslint', ['eslint']],
|
|
108
|
+
['prettier', ['prettier']],
|
|
109
|
+
['tslint', ['@typescript-eslint/eslint-plugin']],
|
|
110
|
+
['typescript-eslint', ['@typescript-eslint/eslint-plugin', '@typescript-eslint/parser']],
|
|
111
|
+
// Type Definitions
|
|
112
|
+
['types-node', ['@types/node']],
|
|
113
|
+
['@types-node', ['@types/node']],
|
|
114
|
+
['types-react', ['@types/react']],
|
|
115
|
+
['types-express', ['@types/express']],
|
|
116
|
+
// Backend Frameworks
|
|
117
|
+
['express', ['express']],
|
|
118
|
+
['expressjs', ['express']],
|
|
119
|
+
['fastify', ['fastify']],
|
|
120
|
+
['koa', ['koa']],
|
|
121
|
+
['nestjs', ['@nestjs/core']],
|
|
122
|
+
['nest', ['@nestjs/core']],
|
|
123
|
+
['hapi', ['@hapi/hapi']],
|
|
124
|
+
// State Management
|
|
125
|
+
['redux', ['redux']],
|
|
126
|
+
['mobx', ['mobx']],
|
|
127
|
+
['vuex', ['vuex']],
|
|
128
|
+
['pinia', ['pinia']],
|
|
129
|
+
['zustand', ['zustand']],
|
|
130
|
+
['recoil', ['recoil']],
|
|
131
|
+
// Styling
|
|
132
|
+
['styled-components', ['styled-components']],
|
|
133
|
+
['styled-component', ['styled-components']],
|
|
134
|
+
['emotion', ['@emotion/react']],
|
|
135
|
+
['sass', ['sass']],
|
|
136
|
+
['node-sass', ['sass']],
|
|
137
|
+
['less', ['less']],
|
|
138
|
+
['stylus', ['stylus']],
|
|
139
|
+
// Admin/CMS
|
|
140
|
+
['forestadmin', ['forest-express', 'forest-express-sequelize']],
|
|
141
|
+
['strapi', ['@strapi/strapi']],
|
|
142
|
+
['keystone', ['@keystone-6/core']],
|
|
143
|
+
['ghost', ['ghost']],
|
|
144
|
+
// Documentation
|
|
145
|
+
['storybook', ['@storybook/react', '@storybook/vue3']],
|
|
146
|
+
['docusaurus', ['@docusaurus/core']],
|
|
147
|
+
['gitbook', ['@gitbook/cli']],
|
|
148
|
+
['typedoc', ['typedoc']],
|
|
149
|
+
// Desktop Apps
|
|
150
|
+
['electron', ['electron']],
|
|
151
|
+
['tauri', ['@tauri-apps/api']],
|
|
152
|
+
['nwjs', ['nw']],
|
|
153
|
+
// Mobile Development
|
|
154
|
+
['react-native', ['react-native']],
|
|
155
|
+
['expo', ['expo']],
|
|
156
|
+
['cordova', ['cordova']],
|
|
157
|
+
['phonegap', ['phonegap']],
|
|
158
|
+
// Common Misspellings
|
|
159
|
+
['jquery', ['jquery']],
|
|
160
|
+
['boostrap', ['bootstrap']],
|
|
161
|
+
['bootstrap', ['bootstrap']],
|
|
162
|
+
['fontawesome', ['@fortawesome/fontawesome-free']],
|
|
163
|
+
['font-awesome', ['@fortawesome/fontawesome-free']],
|
|
164
|
+
// Internationalization
|
|
165
|
+
['react-i18n', ['react-i18next']],
|
|
166
|
+
['i18n', ['i18next']],
|
|
167
|
+
['i18next', ['i18next']],
|
|
168
|
+
['vue-i18n', ['vue-i18n']],
|
|
169
|
+
['react-intl', ['react-intl']],
|
|
170
|
+
['intl', ['intl']],
|
|
171
|
+
// Data Visualization & Charts
|
|
172
|
+
['chart', ['chart.js']],
|
|
173
|
+
['chartjs', ['chart.js']],
|
|
174
|
+
['chart.js', ['chart.js']],
|
|
175
|
+
['d3', ['d3']],
|
|
176
|
+
['d3js', ['d3']],
|
|
177
|
+
['plotly', ['plotly.js']],
|
|
178
|
+
['echarts', ['echarts']],
|
|
179
|
+
['highcharts', ['highcharts']],
|
|
180
|
+
['recharts', ['recharts']],
|
|
181
|
+
['victory', ['victory']],
|
|
182
|
+
['nivo', ['@nivo/core']],
|
|
183
|
+
['observable', ['@observablehq/plot']],
|
|
184
|
+
// Real-time Communication & WebRTC
|
|
185
|
+
['socket.io', ['socket.io']],
|
|
186
|
+
['socketio', ['socket.io']],
|
|
187
|
+
['websocket', ['ws']],
|
|
188
|
+
['ws', ['ws']],
|
|
189
|
+
['webrtc', ['simple-peer']],
|
|
190
|
+
['peer', ['peerjs']],
|
|
191
|
+
['peerjs', ['peerjs']],
|
|
192
|
+
['signalr', ['@microsoft/signalr']],
|
|
193
|
+
// Blockchain & Web3
|
|
194
|
+
['web3', ['web3']],
|
|
195
|
+
['web3js', ['web3']],
|
|
196
|
+
['ethers', ['ethers']],
|
|
197
|
+
['ethersjs', ['ethers']],
|
|
198
|
+
['ethereum', ['web3', 'ethers']],
|
|
199
|
+
['metamask', ['@metamask/sdk']],
|
|
200
|
+
['wagmi', ['wagmi']],
|
|
201
|
+
['rainbow-kit', ['@rainbow-me/rainbowkit']],
|
|
202
|
+
['wallet-connect', ['@walletconnect/client']],
|
|
203
|
+
// Machine Learning & AI
|
|
204
|
+
['tensorflow', ['@tensorflow/tfjs']],
|
|
205
|
+
['tensorflowjs', ['@tensorflow/tfjs']],
|
|
206
|
+
['tfjs', ['@tensorflow/tfjs']],
|
|
207
|
+
['brain', ['brain.js']],
|
|
208
|
+
['brainjs', ['brain.js']],
|
|
209
|
+
['synaptic', ['synaptic']],
|
|
210
|
+
['ml-matrix', ['ml-matrix']],
|
|
211
|
+
['opencv', ['opencv4nodejs']],
|
|
212
|
+
// Image Processing
|
|
213
|
+
['sharp', ['sharp']],
|
|
214
|
+
['jimp', ['jimp']],
|
|
215
|
+
['canvas', ['canvas']],
|
|
216
|
+
['fabric', ['fabric']],
|
|
217
|
+
['fabricjs', ['fabric']],
|
|
218
|
+
['konva', ['konva']],
|
|
219
|
+
['konvajs', ['konva']],
|
|
220
|
+
['p5', ['p5']],
|
|
221
|
+
['p5js', ['p5']],
|
|
222
|
+
['three', ['three']],
|
|
223
|
+
['threejs', ['three']],
|
|
224
|
+
// Audio/Video Processing
|
|
225
|
+
['howler', ['howler']],
|
|
226
|
+
['howlerjs', ['howler']],
|
|
227
|
+
['tone', ['tone']],
|
|
228
|
+
['tonejs', ['tone']],
|
|
229
|
+
['video', ['video.js']],
|
|
230
|
+
['videojs', ['video.js']],
|
|
231
|
+
['hls', ['hls.js']],
|
|
232
|
+
['hlsjs', ['hls.js']],
|
|
233
|
+
['dash', ['dashjs']],
|
|
234
|
+
['dashjs', ['dashjs']],
|
|
235
|
+
// Game Development
|
|
236
|
+
['phaser', ['phaser']],
|
|
237
|
+
['phaserjs', ['phaser']],
|
|
238
|
+
['pixijs', ['pixi.js']],
|
|
239
|
+
['pixi', ['pixi.js']],
|
|
240
|
+
['babylonjs', ['babylonjs']],
|
|
241
|
+
['babylon', ['babylonjs']],
|
|
242
|
+
['aframe', ['aframe']],
|
|
243
|
+
// IoT & Hardware
|
|
244
|
+
['johnny-five', ['johnny-five']],
|
|
245
|
+
['arduino', ['johnny-five']],
|
|
246
|
+
['raspberry-pi', ['raspi']],
|
|
247
|
+
['raspi', ['raspi']],
|
|
248
|
+
['serialport', ['serialport']],
|
|
249
|
+
['noble', ['noble']],
|
|
250
|
+
['bluetooth', ['noble']],
|
|
251
|
+
// Progressive Web Apps
|
|
252
|
+
['workbox', ['workbox-webpack-plugin']],
|
|
253
|
+
['sw-precache', ['workbox-webpack-plugin']],
|
|
254
|
+
['service-worker', ['workbox-webpack-plugin']],
|
|
255
|
+
['pwa', ['workbox-webpack-plugin']],
|
|
256
|
+
// Map & Geolocation
|
|
257
|
+
['leaflet', ['leaflet']],
|
|
258
|
+
['mapbox', ['mapbox-gl']],
|
|
259
|
+
['google-maps', ['@googlemaps/js-api-loader']],
|
|
260
|
+
['googlemaps', ['@googlemaps/js-api-loader']],
|
|
261
|
+
['openlayers', ['ol']],
|
|
262
|
+
['ol', ['ol']],
|
|
263
|
+
// Animation
|
|
264
|
+
['gsap', ['gsap']],
|
|
265
|
+
['anime', ['animejs']],
|
|
266
|
+
['animejs', ['animejs']],
|
|
267
|
+
['lottie', ['lottie-web']],
|
|
268
|
+
['lottie-web', ['lottie-web']],
|
|
269
|
+
['framer-motion', ['framer-motion']],
|
|
270
|
+
['react-spring', ['react-spring']],
|
|
271
|
+
// Form & Validation
|
|
272
|
+
['formik', ['formik']],
|
|
273
|
+
['react-hook-form', ['react-hook-form']],
|
|
274
|
+
['yup', ['yup']],
|
|
275
|
+
['joi', ['joi']],
|
|
276
|
+
['ajv', ['ajv']],
|
|
277
|
+
['zod', ['zod']],
|
|
278
|
+
['superstruct', ['superstruct']],
|
|
279
|
+
// Editor & Rich Text
|
|
280
|
+
['quill', ['quill']],
|
|
281
|
+
['quilljs', ['quill']],
|
|
282
|
+
['tinymce', ['tinymce']],
|
|
283
|
+
['ckeditor', ['@ckeditor/ckeditor5-build-classic']],
|
|
284
|
+
['slate', ['slate']],
|
|
285
|
+
['slatejs', ['slate']],
|
|
286
|
+
['draft', ['draft-js']],
|
|
287
|
+
['draftjs', ['draft-js']],
|
|
288
|
+
['monaco', ['monaco-editor']],
|
|
289
|
+
['monaco-editor', ['monaco-editor']],
|
|
290
|
+
// HTTP & API
|
|
291
|
+
['apollo', ['@apollo/client']],
|
|
292
|
+
['apollo-client', ['@apollo/client']],
|
|
293
|
+
['graphql', ['graphql']],
|
|
294
|
+
['relay', ['react-relay']],
|
|
295
|
+
['urql', ['urql']],
|
|
296
|
+
['swr', ['swr']],
|
|
297
|
+
['react-query', ['@tanstack/react-query']],
|
|
298
|
+
['tanstack-query', ['@tanstack/react-query']],
|
|
299
|
+
// More Common Typos
|
|
300
|
+
['reac', ['react']],
|
|
301
|
+
['reactjs', ['react']],
|
|
302
|
+
['veu', ['vue']],
|
|
303
|
+
['vuejs', ['vue']],
|
|
304
|
+
['angualr', ['@angular/core']],
|
|
305
|
+
['svelt', ['svelte']],
|
|
306
|
+
['sveltte', ['svelte']],
|
|
307
|
+
['typescirpt', ['typescript']],
|
|
308
|
+
['typescript', ['typescript']],
|
|
309
|
+
['javasript', ['node']],
|
|
310
|
+
['javascript', ['node']],
|
|
311
|
+
// DevOps & CI/CD
|
|
312
|
+
['docker', ['dockerode']],
|
|
313
|
+
['k8s', ['@kubernetes/client-node']],
|
|
314
|
+
['kubernetes', ['@kubernetes/client-node']],
|
|
315
|
+
['kubectl', ['@kubernetes/client-node']],
|
|
316
|
+
['helm', ['@helm/sdk']],
|
|
317
|
+
['jenkins', ['jenkins']],
|
|
318
|
+
['circleci', ['@circleci/circleci-config-sdk']],
|
|
319
|
+
['github-actions', ['@actions/core', '@actions/github']],
|
|
320
|
+
['gitlab-ci', ['@gitbeaker/node']],
|
|
321
|
+
['travis', ['@travis-ci/travis-yml']],
|
|
322
|
+
['terraform', ['@cdktf/provider-aws']],
|
|
323
|
+
['ansible', ['@ansible/galaxy']],
|
|
324
|
+
['vagrant', ['vagrant']],
|
|
325
|
+
['consul', ['consul']],
|
|
326
|
+
['vault', ['node-vault']],
|
|
327
|
+
['nomad', ['nomad-client']],
|
|
328
|
+
// 监控和日志
|
|
329
|
+
['winston', ['winston']],
|
|
330
|
+
['morgan', ['morgan']],
|
|
331
|
+
['pino', ['pino']],
|
|
332
|
+
['bunyan', ['bunyan']],
|
|
333
|
+
['log4js', ['log4js']],
|
|
334
|
+
['sentry', ['@sentry/node', '@sentry/react']],
|
|
335
|
+
['bugsnag', ['@bugsnag/js']],
|
|
336
|
+
['rollbar', ['rollbar']],
|
|
337
|
+
['newrelic', ['newrelic']],
|
|
338
|
+
['datadog', ['@datadog/browser-rum']],
|
|
339
|
+
['prometheus', ['prom-client']],
|
|
340
|
+
['grafana', ['@grafana/toolkit']],
|
|
341
|
+
['elastic', ['@elastic/elasticsearch']],
|
|
342
|
+
['elasticsearch', ['@elastic/elasticsearch']],
|
|
343
|
+
['kibana', ['@elastic/kibana-utils']],
|
|
344
|
+
['logstash', ['@elastic/logstash']],
|
|
345
|
+
// 微服务架构
|
|
346
|
+
['microservices', ['express']],
|
|
347
|
+
['service-mesh', ['istio']],
|
|
348
|
+
['envoy', ['envoy']],
|
|
349
|
+
['istio', ['istio']],
|
|
350
|
+
['linkerd', ['linkerd']],
|
|
351
|
+
['consul-connect', ['consul']],
|
|
352
|
+
['eureka', ['eureka-js-client']],
|
|
353
|
+
['zookeeper', ['node-zookeeper-client']],
|
|
354
|
+
['etcd', ['etcd3']],
|
|
355
|
+
['grpc', ['@grpc/grpc-js']],
|
|
356
|
+
['protobuf', ['protobufjs']],
|
|
357
|
+
// 缓存系统
|
|
358
|
+
['redis', ['redis']],
|
|
359
|
+
['memcached', ['memcached']],
|
|
360
|
+
['node-cache', ['node-cache']],
|
|
361
|
+
['memory-cache', ['memory-cache']],
|
|
362
|
+
['lru-cache', ['lru-cache']],
|
|
363
|
+
['cache-manager', ['cache-manager']],
|
|
364
|
+
['ioredis', ['ioredis']],
|
|
365
|
+
['hazelcast', ['hazelcast-client']],
|
|
366
|
+
// 消息队列
|
|
367
|
+
['rabbitmq', ['amqplib']],
|
|
368
|
+
['kafka', ['kafkajs']],
|
|
369
|
+
['apache-kafka', ['kafkajs']],
|
|
370
|
+
['bull', ['bull']],
|
|
371
|
+
['bullmq', ['bullmq']],
|
|
372
|
+
['bee-queue', ['bee-queue']],
|
|
373
|
+
['kue', ['kue']],
|
|
374
|
+
['agenda', ['agenda']],
|
|
375
|
+
['amqp', ['amqplib']],
|
|
376
|
+
['mqtt', ['mqtt']],
|
|
377
|
+
['nats', ['nats']],
|
|
378
|
+
['zeromq', ['zeromq']],
|
|
379
|
+
['zmq', ['zeromq']],
|
|
380
|
+
// 搜索引擎
|
|
381
|
+
['solr', ['solr-client']],
|
|
382
|
+
['algolia', ['algoliasearch']],
|
|
383
|
+
['sphinx', ['sphinxapi']],
|
|
384
|
+
['lucene', ['lucene']],
|
|
385
|
+
['whoosh', ['whoosh']],
|
|
386
|
+
['meilisearch', ['meilisearch']],
|
|
387
|
+
['typesense', ['typesense']],
|
|
388
|
+
// 文件上传处理
|
|
389
|
+
['multer', ['multer']],
|
|
390
|
+
['formidable', ['formidable']],
|
|
391
|
+
['busboy', ['busboy']],
|
|
392
|
+
['multiparty', ['multiparty']],
|
|
393
|
+
['file-upload', ['express-fileupload']],
|
|
394
|
+
['cloudinary', ['cloudinary']],
|
|
395
|
+
['aws-s3', ['@aws-sdk/client-s3']],
|
|
396
|
+
// 加密和安全
|
|
397
|
+
['bcrypt', ['bcrypt']],
|
|
398
|
+
['bcryptjs', ['bcryptjs']],
|
|
399
|
+
['crypto', ['crypto-js']],
|
|
400
|
+
['crypto-js', ['crypto-js']],
|
|
401
|
+
['jsonwebtoken', ['jsonwebtoken']],
|
|
402
|
+
['jwt', ['jsonwebtoken']],
|
|
403
|
+
['passport', ['passport']],
|
|
404
|
+
['helmet', ['helmet']],
|
|
405
|
+
['cors', ['cors']],
|
|
406
|
+
['express-rate-limit', ['express-rate-limit']],
|
|
407
|
+
['rate-limiter', ['express-rate-limit']],
|
|
408
|
+
['argon2', ['argon2']],
|
|
409
|
+
['scrypt', ['scrypt']],
|
|
410
|
+
['node-rsa', ['node-rsa']],
|
|
411
|
+
['speakeasy', ['speakeasy']],
|
|
412
|
+
['otplib', ['otplib']],
|
|
413
|
+
// 邮件服务
|
|
414
|
+
['nodemailer', ['nodemailer']],
|
|
415
|
+
['sendgrid', ['@sendgrid/mail']],
|
|
416
|
+
['mailgun', ['mailgun.js']],
|
|
417
|
+
['ses', ['@aws-sdk/client-ses']],
|
|
418
|
+
['postmark', ['postmark']],
|
|
419
|
+
['sparkpost', ['sparkpost']],
|
|
420
|
+
['mandrill', ['mandrill-api']],
|
|
421
|
+
['mailchimp', ['@mailchimp/mailchimp_marketing']],
|
|
422
|
+
['email-templates', ['email-templates']],
|
|
423
|
+
// 模板引擎
|
|
424
|
+
['handlebars', ['handlebars']],
|
|
425
|
+
['hbs', ['hbs']],
|
|
426
|
+
['mustache', ['mustache']],
|
|
427
|
+
['pug', ['pug']],
|
|
428
|
+
['jade', ['pug']], // jade was renamed to pug
|
|
429
|
+
['ejs', ['ejs']],
|
|
430
|
+
['nunjucks', ['nunjucks']],
|
|
431
|
+
['twig', ['twig']],
|
|
432
|
+
['dust', ['dustjs-linkedin']],
|
|
433
|
+
// Serverless框架
|
|
434
|
+
['serverless', ['serverless']],
|
|
435
|
+
['sls', ['serverless']],
|
|
436
|
+
['lambda', ['aws-lambda']],
|
|
437
|
+
['azure-functions', ['@azure/functions']],
|
|
438
|
+
['google-functions', ['@google-cloud/functions-framework']],
|
|
439
|
+
['netlify-lambda', ['netlify-lambda']],
|
|
440
|
+
['vercel', ['@vercel/node']],
|
|
441
|
+
['claudia', ['claudia']],
|
|
442
|
+
['apex', ['apex']],
|
|
443
|
+
['sam', ['@aws-cdk/aws-sam']],
|
|
444
|
+
// 更多数据库
|
|
445
|
+
['couchdb', ['nano']],
|
|
446
|
+
['pouchdb', ['pouchdb']],
|
|
447
|
+
['neo4j', ['neo4j-driver']],
|
|
448
|
+
['influxdb', ['influx']],
|
|
449
|
+
['cassandra', ['cassandra-driver']],
|
|
450
|
+
['rethinkdb', ['rethinkdb']],
|
|
451
|
+
['orientdb', ['orientjs']],
|
|
452
|
+
['arangodb', ['arangojs']],
|
|
453
|
+
['leveldb', ['level']],
|
|
454
|
+
['rocksdb', ['rocksdb']],
|
|
455
|
+
['sqlite', ['sqlite3', 'better-sqlite3']],
|
|
456
|
+
['mariadb', ['mariadb']],
|
|
457
|
+
['cockroachdb', ['pg']], // uses pg driver
|
|
458
|
+
// 更多云服务
|
|
459
|
+
['heroku', ['heroku']],
|
|
460
|
+
['digitalocean', ['@digitalocean/droplet-api']],
|
|
461
|
+
['linode', ['@linode/api-v4']],
|
|
462
|
+
['vultr', ['@vultr/vultr-node']],
|
|
463
|
+
['scaleway', ['@scaleway/sdk']],
|
|
464
|
+
['ovh', ['ovh']],
|
|
465
|
+
['cloudflare', ['cloudflare']],
|
|
466
|
+
['fastly', ['fastly']],
|
|
467
|
+
['maxcdn', ['maxcdn']],
|
|
468
|
+
['bunnycdn', ['bunnycdn']],
|
|
469
|
+
// 性能分析和优化
|
|
470
|
+
['lighthouse', ['lighthouse']],
|
|
471
|
+
['webpagetest', ['webpagetest']],
|
|
472
|
+
['clinic', ['clinic']],
|
|
473
|
+
['0x', ['0x']],
|
|
474
|
+
['autocannon', ['autocannon']],
|
|
475
|
+
['loadtest', ['loadtest']],
|
|
476
|
+
['artillery', ['artillery']],
|
|
477
|
+
['k6', ['k6']],
|
|
478
|
+
['benchmark', ['benchmark']],
|
|
479
|
+
['clinic.js', ['clinic']],
|
|
480
|
+
// 更多拼写错误和变体
|
|
481
|
+
['expressjs', ['express']],
|
|
482
|
+
['node.js', ['node']],
|
|
483
|
+
['nodejs', ['node']],
|
|
484
|
+
['npm', ['npm']],
|
|
485
|
+
['yarn', ['yarn']],
|
|
486
|
+
['pnpm', ['pnpm']],
|
|
487
|
+
['bun', ['bun']],
|
|
488
|
+
['deno', ['deno']],
|
|
489
|
+
['typescript', ['typescript']],
|
|
490
|
+
['js', ['javascript']],
|
|
491
|
+
['ts', ['typescript']],
|
|
492
|
+
['html', ['html']],
|
|
493
|
+
['css', ['css']],
|
|
494
|
+
['json', ['json']],
|
|
495
|
+
['xml', ['xml2js']],
|
|
496
|
+
['yaml', ['yaml']],
|
|
497
|
+
['toml', ['@iarna/toml']],
|
|
498
|
+
['ini', ['ini']],
|
|
499
|
+
['csv', ['csv-parser', 'papaparse']],
|
|
500
|
+
['pdf', ['pdf2pic', 'pdfkit']],
|
|
501
|
+
['excel', ['xlsx']],
|
|
502
|
+
['word', ['mammoth']],
|
|
503
|
+
['zip', ['node-zip']],
|
|
504
|
+
['tar', ['tar']],
|
|
505
|
+
['gzip', ['zlib']],
|
|
506
|
+
// 数据处理和转换
|
|
507
|
+
['cheerio', ['cheerio']],
|
|
508
|
+
['jsdom', ['jsdom']],
|
|
509
|
+
['xml2js', ['xml2js']],
|
|
510
|
+
['csv-parse', ['csv-parse']],
|
|
511
|
+
['papaparse', ['papaparse']],
|
|
512
|
+
['fast-csv', ['fast-csv']],
|
|
513
|
+
['xlsx', ['xlsx']],
|
|
514
|
+
['pdfkit', ['pdfkit']],
|
|
515
|
+
['jspdf', ['jspdf']],
|
|
516
|
+
['mammoth', ['mammoth']],
|
|
517
|
+
['pdf-parse', ['pdf-parse']],
|
|
518
|
+
// CLI工具
|
|
519
|
+
['commander', ['commander']],
|
|
520
|
+
['yargs', ['yargs']],
|
|
521
|
+
['inquirer', ['inquirer']],
|
|
522
|
+
['chalk', ['chalk']],
|
|
523
|
+
['ora', ['ora']],
|
|
524
|
+
['cli-progress', ['cli-progress']],
|
|
525
|
+
['figlet', ['figlet']],
|
|
526
|
+
['boxen', ['boxen']],
|
|
527
|
+
['update-notifier', ['update-notifier']],
|
|
528
|
+
['meow', ['meow']],
|
|
529
|
+
['arg', ['arg']],
|
|
530
|
+
['minimist', ['minimist']],
|
|
531
|
+
]);
|
|
532
|
+
/**
|
|
533
|
+
* Handle package not found errors (404)
|
|
534
|
+
*/
|
|
535
|
+
static handlePackageNotFound(packageName, context) {
|
|
536
|
+
const suggestions = this.packageSuggestions.get(packageName);
|
|
537
|
+
if (suggestions && suggestions.length > 0) {
|
|
538
|
+
console.log(chalk.yellow(`⚠️ 包 "${packageName}" 不存在`));
|
|
539
|
+
console.log(chalk.cyan(`💡 可能的正确包名:`));
|
|
540
|
+
suggestions.forEach((suggestion) => {
|
|
541
|
+
console.log(chalk.cyan(` • ${suggestion}`));
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
console.log(chalk.yellow(`⚠️ 包 "${packageName}" 在 npm registry 中不存在`));
|
|
546
|
+
console.log(chalk.cyan(`💡 请检查包名是否正确,或者该包可能已被移除`));
|
|
547
|
+
}
|
|
548
|
+
// Track for summary
|
|
549
|
+
ErrorTracker.trackSkippedPackage(packageName, new Error('Package not found (404)'));
|
|
550
|
+
// Log technical details for debugging
|
|
551
|
+
this.logger.debug('Package not found', { packageName, context });
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Handle empty version errors
|
|
555
|
+
*/
|
|
556
|
+
static handleEmptyVersion(packageName, context) {
|
|
557
|
+
console.log(chalk.yellow(`⚠️ 包 "${packageName}" 的版本信息为空`));
|
|
558
|
+
console.log(chalk.cyan(`💡 这可能是由于:`));
|
|
559
|
+
console.log(chalk.cyan(` • 包的 package.json 配置问题`));
|
|
560
|
+
console.log(chalk.cyan(` • catalog 配置中的版本格式错误`));
|
|
561
|
+
console.log(chalk.cyan(` • npm registry 数据同步问题`));
|
|
562
|
+
// Track for summary
|
|
563
|
+
ErrorTracker.trackSkippedPackage(packageName, new Error('Version string cannot be empty'));
|
|
564
|
+
this.logger.debug('Empty version string', { packageName, context });
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Handle network/timeout errors
|
|
568
|
+
*/
|
|
569
|
+
static handleNetworkError(packageName, error, context) {
|
|
570
|
+
console.log(chalk.yellow(`⚠️ 检查包 "${packageName}" 时遇到网络问题`));
|
|
571
|
+
console.log(chalk.cyan(`💡 请稍后重试,或检查网络连接`));
|
|
572
|
+
// Track for summary
|
|
573
|
+
ErrorTracker.trackSkippedPackage(packageName, error);
|
|
574
|
+
this.logger.debug('Network error', { packageName, error: error.message, context });
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Handle security check failures
|
|
578
|
+
*/
|
|
579
|
+
static handleSecurityCheckFailure(packageName, error, context) {
|
|
580
|
+
// Track for statistics
|
|
581
|
+
ErrorTracker.trackSecurityFailure();
|
|
582
|
+
// Only show user-friendly message, don't expose technical details
|
|
583
|
+
this.logger.debug(`Security check failed for ${packageName}`, {
|
|
584
|
+
error: error.message,
|
|
585
|
+
context,
|
|
586
|
+
});
|
|
587
|
+
// Don't spam the user with security check failures unless it's critical
|
|
588
|
+
if (context?.operation === 'update' || context?.operation === 'security-audit') {
|
|
589
|
+
console.log(chalk.yellow(`⚠️ 无法检查 "${packageName}" 的安全状态`));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Handle retry attempts silently
|
|
594
|
+
*/
|
|
595
|
+
static handleRetryAttempt(packageName, attempt, maxRetries, error) {
|
|
596
|
+
// Log for debugging but don't spam users
|
|
597
|
+
this.logger.debug(`Retry attempt ${attempt}/${maxRetries} for ${packageName}`, {
|
|
598
|
+
error: error.message,
|
|
599
|
+
});
|
|
600
|
+
// Only show to user on final failure
|
|
601
|
+
if (attempt === maxRetries) {
|
|
602
|
+
this.handleFinalFailure(packageName, error);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Handle final failure after retries
|
|
607
|
+
*/
|
|
608
|
+
static handleFinalFailure(packageName, error) {
|
|
609
|
+
if (error.message.includes('404') || error.message.includes('Not found')) {
|
|
610
|
+
this.handlePackageNotFound(packageName);
|
|
611
|
+
}
|
|
612
|
+
else if (error.message.includes('timeout') || error.message.includes('ETIMEDOUT')) {
|
|
613
|
+
this.handleNetworkError(packageName, error);
|
|
614
|
+
}
|
|
615
|
+
else if (error.message.includes('Version string cannot be empty')) {
|
|
616
|
+
this.handleEmptyVersion(packageName);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
// Generic error handling
|
|
620
|
+
console.log(chalk.yellow(`⚠️ 跳过包 "${packageName}" (检查失败)`));
|
|
621
|
+
this.logger.debug('Package check failed', { packageName, error: error.message });
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Handle general package query failures
|
|
626
|
+
*/
|
|
627
|
+
static handlePackageQueryFailure(packageName, error, context) {
|
|
628
|
+
// Categorize the error and provide appropriate user message
|
|
629
|
+
if (error.message.includes('404') || error.message.includes('Not found')) {
|
|
630
|
+
this.handlePackageNotFound(packageName, context);
|
|
631
|
+
}
|
|
632
|
+
else if (error.message.includes('Version string cannot be empty')) {
|
|
633
|
+
this.handleEmptyVersion(packageName, context);
|
|
634
|
+
}
|
|
635
|
+
else if (error.message.includes('timeout') || error.message.includes('ETIMEDOUT')) {
|
|
636
|
+
this.handleNetworkError(packageName, error, context);
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
// For other errors, just skip silently and log for debugging
|
|
640
|
+
ErrorTracker.trackSkippedPackage(packageName, error);
|
|
641
|
+
this.logger.debug(`Package query failed for ${packageName}`, {
|
|
642
|
+
error: error.message,
|
|
643
|
+
context,
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Show summary of skipped packages
|
|
649
|
+
*/
|
|
650
|
+
static showSkippedPackagesSummary() {
|
|
651
|
+
const totalSkipped = ErrorTracker.getTotalSkipped();
|
|
652
|
+
if (totalSkipped === 0)
|
|
653
|
+
return;
|
|
654
|
+
console.log();
|
|
655
|
+
console.log(chalk.cyan(`📋 跳过了 ${totalSkipped} 个包的检查:`));
|
|
656
|
+
const grouped = ErrorTracker.getSkippedPackages();
|
|
657
|
+
if (grouped.notFound.length > 0) {
|
|
658
|
+
console.log(chalk.yellow(` 不存在的包 (${grouped.notFound.length}): ${grouped.notFound.join(', ')}`));
|
|
659
|
+
}
|
|
660
|
+
if (grouped.emptyVersion.length > 0) {
|
|
661
|
+
console.log(chalk.yellow(` 版本信息为空 (${grouped.emptyVersion.length}): ${grouped.emptyVersion.join(', ')}`));
|
|
662
|
+
}
|
|
663
|
+
if (grouped.network.length > 0) {
|
|
664
|
+
console.log(chalk.yellow(` 网络问题 (${grouped.network.length}): ${grouped.network.join(', ')}`));
|
|
665
|
+
}
|
|
666
|
+
if (grouped.other.length > 0) {
|
|
667
|
+
console.log(chalk.yellow(` 其他问题 (${grouped.other.length}): ${grouped.other.join(', ')}`));
|
|
668
|
+
}
|
|
669
|
+
const stats = ErrorTracker.getErrorStats();
|
|
670
|
+
if (stats.security > 0) {
|
|
671
|
+
console.log(chalk.gray(` 安全检查失败: ${stats.security} 次`));
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Get statistics for reporting
|
|
676
|
+
*/
|
|
677
|
+
static getStatistics() {
|
|
678
|
+
return {
|
|
679
|
+
totalSkipped: ErrorTracker.getTotalSkipped(),
|
|
680
|
+
errorBreakdown: ErrorTracker.getErrorStats(),
|
|
681
|
+
skippedPackages: ErrorTracker.getSkippedPackages(),
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Reset error tracking (useful for testing)
|
|
686
|
+
*/
|
|
687
|
+
static resetTracking() {
|
|
688
|
+
ErrorTracker.reset();
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Add a new package suggestion
|
|
692
|
+
*/
|
|
693
|
+
static addPackageSuggestion(originalName, suggestions) {
|
|
694
|
+
this.packageSuggestions.set(originalName, suggestions);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Get suggestions for a package name
|
|
698
|
+
*/
|
|
699
|
+
static getPackageSuggestions(packageName) {
|
|
700
|
+
return this.packageSuggestions.get(packageName) || [];
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
//# sourceMappingURL=UserFriendlyErrorHandler.js.map
|