@verdaccio/server 6.0.0-6-next.65 → 7.0.0-next-7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,569 @@
1
1
  # @verdaccio/server
2
2
 
3
+ ## 7.0.0-next-7.7
4
+
5
+ ### Patch Changes
6
+
7
+ - @verdaccio/core@7.0.0-next-7.7
8
+ - @verdaccio/config@7.0.0-next-7.7
9
+ - @verdaccio/api@7.0.0-next-7.7
10
+ - @verdaccio/auth@7.0.0-next-7.7
11
+ - @verdaccio/loaders@7.0.0-next-7.7
12
+ - @verdaccio/middleware@7.0.0-next-7.7
13
+ - verdaccio-audit@12.0.0-next-7.7
14
+ - @verdaccio/store@7.0.0-next-7.7
15
+ - @verdaccio/utils@7.0.0-next-7.7
16
+ - @verdaccio/web@7.0.0-next-7.7
17
+ - @verdaccio/logger@7.0.0-next-7.7
18
+
19
+ ## 7.0.0-next.6
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [e14b064]
24
+ - Updated dependencies [4d96324]
25
+ - @verdaccio/store@7.0.0-next.6
26
+ - @verdaccio/config@7.0.0-next.6
27
+ - @verdaccio/api@7.0.0-next.6
28
+ - @verdaccio/web@7.0.0-next.6
29
+ - @verdaccio/auth@7.0.0-next.6
30
+ - @verdaccio/loaders@7.0.0-next.6
31
+ - @verdaccio/middleware@7.0.0-next.6
32
+ - verdaccio-audit@12.0.0-next.6
33
+ - @verdaccio/core@7.0.0-next.6
34
+ - @verdaccio/utils@7.0.0-next.6
35
+ - @verdaccio/logger@7.0.0-next.6
36
+
37
+ ## 7.0.0-next.5
38
+
39
+ ### Minor Changes
40
+
41
+ - f047cc8: refactor: auth with legacy sign support
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [f047cc8]
46
+ - @verdaccio/middleware@7.0.0-next.5
47
+ - @verdaccio/core@7.0.0-next.5
48
+ - @verdaccio/config@7.0.0-next.5
49
+ - @verdaccio/auth@7.0.0-next.5
50
+ - @verdaccio/api@7.0.0-next.5
51
+ - @verdaccio/store@7.0.0-next.5
52
+ - @verdaccio/web@7.0.0-next.5
53
+ - @verdaccio/loaders@7.0.0-next.5
54
+ - @verdaccio/logger@7.0.0-next.5
55
+ - verdaccio-audit@12.0.0-next.5
56
+ - @verdaccio/utils@7.0.0-next.5
57
+
58
+ ## 7.0.0-next.4
59
+
60
+ ### Patch Changes
61
+
62
+ - @verdaccio/auth@7.0.0-next.4
63
+ - @verdaccio/api@7.0.0-next.4
64
+ - verdaccio-audit@12.0.0-next.4
65
+ - @verdaccio/web@7.0.0-next.4
66
+ - @verdaccio/core@7.0.0-next.4
67
+ - @verdaccio/config@7.0.0-next.4
68
+ - @verdaccio/loaders@7.0.0-next.4
69
+ - @verdaccio/middleware@7.0.0-next.4
70
+ - @verdaccio/store@7.0.0-next.4
71
+ - @verdaccio/utils@7.0.0-next.4
72
+ - @verdaccio/logger@7.0.0-next.4
73
+
74
+ ## 7.0.0-next.3
75
+
76
+ ### Major Changes
77
+
78
+ - e7ebccb61: update major dependencies, remove old nodejs support
79
+
80
+ ### Patch Changes
81
+
82
+ - 3ca405618: fix: Avoid 404 error when getting favicon from root
83
+ - Updated dependencies [daceb6d87]
84
+ - Updated dependencies [e7ebccb61]
85
+ - @verdaccio/config@7.0.0-next.3
86
+ - @verdaccio/core@7.0.0-next.3
87
+ - @verdaccio/middleware@7.0.0-next.3
88
+ - verdaccio-audit@12.0.0-next.3
89
+ - @verdaccio/utils@7.0.0-next.3
90
+ - @verdaccio/api@7.0.0-next.3
91
+ - @verdaccio/auth@7.0.0-next.3
92
+ - @verdaccio/loaders@7.0.0-next.3
93
+ - @verdaccio/logger@7.0.0-next.3
94
+ - @verdaccio/store@7.0.0-next.3
95
+ - @verdaccio/web@7.0.0-next.3
96
+
97
+ ## 7.0.0-next.2
98
+
99
+ ### Patch Changes
100
+
101
+ - @verdaccio/core@7.0.0-next.2
102
+ - @verdaccio/config@7.0.0-next.2
103
+ - @verdaccio/api@7.0.0-next.2
104
+ - @verdaccio/auth@7.0.0-next.2
105
+ - @verdaccio/loaders@7.0.0-next.2
106
+ - @verdaccio/middleware@7.0.0-next.2
107
+ - verdaccio-audit@12.0.0-next.2
108
+ - @verdaccio/store@7.0.0-next.2
109
+ - @verdaccio/utils@7.0.0-next.2
110
+ - @verdaccio/web@7.0.0-next.2
111
+ - @verdaccio/logger@7.0.0-next.2
112
+
113
+ ## 7.0.0-next.1
114
+
115
+ ### Patch Changes
116
+
117
+ - @verdaccio/core@7.0.0-next.1
118
+ - @verdaccio/config@7.0.0-next.1
119
+ - @verdaccio/api@7.0.0-next.1
120
+ - @verdaccio/auth@7.0.0-next.1
121
+ - @verdaccio/loaders@7.0.0-next.1
122
+ - @verdaccio/middleware@7.0.0-next.1
123
+ - verdaccio-audit@12.0.0-next.1
124
+ - @verdaccio/store@7.0.0-next.1
125
+ - @verdaccio/utils@7.0.0-next.1
126
+ - @verdaccio/web@7.0.0-next.1
127
+ - @verdaccio/logger@7.0.0-next.1
128
+
129
+ ## 7.0.0-next.0
130
+
131
+ ### Major Changes
132
+
133
+ - feat!: bump to v7
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies
138
+ - @verdaccio/api@7.0.0-next.0
139
+ - @verdaccio/auth@7.0.0-next.0
140
+ - @verdaccio/config@7.0.0-next.0
141
+ - @verdaccio/core@7.0.0-next.0
142
+ - @verdaccio/loaders@7.0.0-next.0
143
+ - @verdaccio/logger@7.0.0-next.0
144
+ - @verdaccio/middleware@7.0.0-next.0
145
+ - verdaccio-audit@12.0.0-next.0
146
+ - @verdaccio/store@7.0.0-next.0
147
+ - @verdaccio/utils@7.0.0-next.0
148
+ - @verdaccio/web@7.0.0-next.0
149
+
150
+ ## 6.0.0
151
+
152
+ ### Major Changes
153
+
154
+ - 292c0a37f: feat!: replace deprecated request dependency by got
155
+
156
+ This is a big refactoring of the core, fetching dependencies, improve code, more tests and better stability. This is essential for the next release, will take some time but would allow modularize more the core.
157
+
158
+ ## Notes
159
+
160
+ - Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
161
+ - Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
162
+ - Refactor with promises instead callback wherever is possible
163
+ - ~Document the API~
164
+ - Improve testing, integration tests
165
+ - Bugfix
166
+ - Clean up old validations
167
+ - Improve performance
168
+
169
+ ## 💥 Breaking changes
170
+
171
+ - Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
172
+ - Write Tarball, Read Tarball methods parameters change, a new set of options like `AbortController` signals are being provided to the `addAbortSignal` can be internally used with Streams when a request is aborted. eg: `addAbortSignal(signal, fs.createReadStream(pathName));`
173
+ - `@verdaccio/streams` stream abort support is legacy is being deprecated removed
174
+ - Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
175
+
176
+ - a828271d6: refactor: download manifest endpoint and integrate fastify
177
+
178
+ Much simpler API for fetching a package
179
+
180
+ ```
181
+ const manifest = await storage.getPackageNext({
182
+ name,
183
+ uplinksLook: true,
184
+ req,
185
+ version: queryVersion,
186
+ requestOptions,
187
+ });
188
+ ```
189
+
190
+ > not perfect, the `req` still is being passed to the proxy (this has to be refactored at proxy package) and then removed from here, in proxy we pass the request instance to the `request` library.
191
+
192
+ ### Details
193
+
194
+ - `async/await` sugar for getPackage()
195
+ - Improve and reuse code between current implementation and new fastify endpoint (add scaffolding for request manifest)
196
+ - Improve performance
197
+ - Add new tests
198
+
199
+ ### Breaking changes
200
+
201
+ All storage plugins will stop to work since the storage uses `getPackageNext` method which is Promise based, I won't replace this now because will force me to update all plugins, I'll follow up in another PR. Currently will throw http 500
202
+
203
+ - 459b6fa72: refactor: search v1 endpoint and local-database
204
+
205
+ - refactor search `api v1` endpoint, improve performance
206
+ - remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
207
+ - refactor method storage class
208
+ - create new module `core` to reduce the ammount of modules with utilities
209
+ - use `undici` instead `node-fetch`
210
+ - use `fastify` instead `express` for functional test
211
+
212
+ ### Breaking changes
213
+
214
+ - plugin storage API changes
215
+ - remove old search endpoint (return 404)
216
+ - filter local private packages at plugin level
217
+
218
+ The storage api changes for methods `get`, `add`, `remove` as promise base. The `search` methods also changes and recieves a `query` object that contains all query params from the client.
219
+
220
+ ```ts
221
+ export interface IPluginStorage<T> extends IPlugin {
222
+ add(name: string): Promise<void>;
223
+ remove(name: string): Promise<void>;
224
+ get(): Promise<any>;
225
+ init(): Promise<void>;
226
+ getSecret(): Promise<string>;
227
+ setSecret(secret: string): Promise<any>;
228
+ getPackageStorage(packageInfo: string): IPackageStorage;
229
+ search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
230
+ saveToken(token: Token): Promise<any>;
231
+ deleteToken(user: string, tokenKey: string): Promise<any>;
232
+ readTokens(filter: TokenFilter): Promise<Token[]>;
233
+ }
234
+ ```
235
+
236
+ - 9fc2e7961: feat(plugins): improve plugin loader
237
+
238
+ ### Changes
239
+
240
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
241
+ - Avoid config collisions https://github.com/verdaccio/verdaccio/issues/928
242
+ - https://github.com/verdaccio/verdaccio/issues/1394
243
+ - `config.plugins` plugin path validations
244
+ - Updated algorithm for plugin loader.
245
+ - improved documentation (included dev)
246
+
247
+ ## Features
248
+
249
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
250
+ - Custom prefix:
251
+
252
+ ```
253
+ // config.yaml
254
+ server:
255
+ pluginPrefix: mycompany
256
+ middleware:
257
+ audit:
258
+ foo: 1
259
+ ```
260
+
261
+ This configuration will look up for `mycompany-audit` instead `Verdaccio-audit`.
262
+
263
+ ## Breaking Changes
264
+
265
+ ### sinopia plugins
266
+
267
+ - `sinopia` fallback support is removed, but can be restored using `pluginPrefix`
268
+
269
+ ### plugin filter
270
+
271
+ - method rename `filter_metadata`->`filterMetadata`
272
+
273
+ ### Plugin constructor does not merge configs anymore https://github.com/verdaccio/verdaccio/issues/928
274
+
275
+ The plugin receives as first argument `config`, which represents the config of the plugin. Example:
276
+
277
+ ```
278
+ // config.yaml
279
+ auth:
280
+ plugin:
281
+ foo: 1
282
+ bar: 2
283
+
284
+ export class Plugin<T> {
285
+ public constructor(config: T, options: PluginOptions) {
286
+ console.log(config);
287
+ // {foo:1, bar: 2}
288
+ }
289
+ }
290
+ ```
291
+
292
+ - 794af76c5: Remove Node 12 support
293
+
294
+ - We need move to the new `undici` and does not support Node.js 12
295
+
296
+ - 10aeb4f13: feat!: experiments config renamed to flags
297
+
298
+ - The `experiments` configuration is renamed to `flags`. The functionality is exactly the same.
299
+
300
+ ```js
301
+ flags: token: false;
302
+ search: false;
303
+ ```
304
+
305
+ - The `self_path` property from the config file is being removed in favor of `config_file` full path.
306
+ - Refactor `config` module, better types and utilities
307
+
308
+ - e367c3f1e: - Replace signature handler for legacy tokens by removing deprecated crypto.createDecipher by createCipheriv
309
+
310
+ - Introduce environment variables for legacy tokens
311
+
312
+ ### Code Improvements
313
+
314
+ - Add debug library for improve developer experience
315
+
316
+ ### Breaking change
317
+
318
+ - The new signature invalidates all previous tokens generated by Verdaccio 4 or previous versions.
319
+ - The secret key must have 32 characters long.
320
+
321
+ ### New environment variables
322
+
323
+ - `VERDACCIO_LEGACY_ALGORITHM`: Allows to define the specific algorithm for the token signature which by default is `aes-256-ctr`
324
+ - `VERDACCIO_LEGACY_ENCRYPTION_KEY`: By default, the token stores in the database, but using this variable allows to get it from memory
325
+
326
+ - 061bfcc8d: feat: standalone registry with no dependencies
327
+
328
+ ## Usage
329
+
330
+ To install a server with no dependencies
331
+
332
+ ```bash
333
+ npm install -g @verdaccio/standalone
334
+ ```
335
+
336
+ with no internet required
337
+
338
+ ```bash
339
+ npm install -g ./tarball.tar.gz
340
+ ```
341
+
342
+ Bundles htpasswd and audit plugins.
343
+
344
+ ### Breaking Change
345
+
346
+ It does not allow anymore the `auth` and `middleware` property at config file empty,
347
+ it will fallback to those plugins by default.
348
+
349
+ - 82cb0f2bf: feat!: config.logs throw an error, logging config not longer accept array or logs property
350
+
351
+ ### 💥 Breaking change
352
+
353
+ This is valid
354
+
355
+ ```yaml
356
+ log: { type: stdout, format: pretty, level: http }
357
+ ```
358
+
359
+ This is invalid
360
+
361
+ ```yaml
362
+ logs: { type: stdout, format: pretty, level: http }
363
+ ```
364
+
365
+ or
366
+
367
+ ```yaml
368
+ logs:
369
+ - [{ type: stdout, format: pretty, level: http }]
370
+ ```
371
+
372
+ ### Minor Changes
373
+
374
+ - ae93e039d: fix: expose middleware methods
375
+ - 631abe1ac: feat: refactor logger
376
+ - 00d1d2a17: chore: env variable for launch fastify
377
+
378
+ - Update fastify to major release `v4.3.0`
379
+ - Update CLI launcher
380
+
381
+ via CLI
382
+
383
+ ```
384
+ VERDACCIO_SERVER=fastify verdaccio
385
+ ```
386
+
387
+ with docker
388
+
389
+ ```
390
+ docker run -it --rm --name verdaccio \
391
+ -e "VERDACCIO_SERVER=8080" -p 8080:8080 \
392
+ -e "VERDACCIO_SERVER=fastify" \
393
+ verdaccio/verdaccio
394
+ ```
395
+
396
+ - 048ac95e8: feat: align with v5 ui endpoints and ui small bugfix
397
+ - b61f762d6: feat: add server rate limit protection to all request
398
+
399
+ To modify custom values, use the server settings property.
400
+
401
+ ```markdown
402
+ server:
403
+
404
+ ## https://www.npmjs.com/package/express-rate-limit#configuration-options
405
+
406
+ rateLimit:
407
+ windowMs: 1000
408
+ max: 10000
409
+ ```
410
+
411
+ The values are intended to be high, if you want to improve security of your server consider
412
+ using different values.
413
+
414
+ - 154b2ecd3: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
415
+ - aa763baec: feat: add typescript project references settings
416
+
417
+ Reading https://ebaytech.berlin/optimizing-multi-package-apps-with-typescript-project-references-d5c57a3b4440 I realized I can use project references to solve the issue to pre-compile modules on develop mode.
418
+
419
+ It allows to navigate (IDE) trough the packages without need compile the packages.
420
+
421
+ Add two `tsconfig`, one using the previous existing configuration that is able to produce declaration files (`tsconfig.build`) and a new one `tsconfig` which is enables [_projects references_](https://www.typescriptlang.org/docs/handbook/project-references.html).
422
+
423
+ - 16e38df8a: feat: trustProxy property
424
+ - 5167bb528: feat: ui search support for remote, local and private packages
425
+
426
+ The command `npm search` search globally and return all matches, with this improvement the user interface
427
+ is powered with the same capabilities.
428
+
429
+ The UI also tag where is the origin the package with a tag, also provide the latest version and description of the package.
430
+
431
+ - 45c03819e: refactor: render html middleware
432
+
433
+ ### Patch Changes
434
+
435
+ - 9943e2b18: fix: extract logger from middleware
436
+ - 351aeeaa8: fix(deps): @verdaccio/utils should be a prod dep of local-storage
437
+ - 7ef599cc4: fix: missing version on footer
438
+ - 19d272d10: fix: restore logger on init
439
+
440
+ Enable logger after parse configuration and log the very first step on startup phase.
441
+
442
+ ```bash
443
+ warn --- experiments are enabled, it is recommended do not use experiments in production comment out this section to disable it
444
+ info --- support for experiment [token] is disabled
445
+ info --- support for experiment [search] is disabled
446
+ (node:50831) Warning: config.logs is deprecated, rename configuration to "config.log"
447
+ (Use `node --trace-warnings ...` to show where the warning was created)
448
+ info --- http address http://localhost:4873/
449
+ info --- version: 6.0.0-6-next.11
450
+ info --- server started
451
+ ```
452
+
453
+ - a610ef26b: chore: add release step to private regisry on merge changeset pr
454
+ - 648575aa4: Bug Fixes
455
+
456
+ - fix escaped slash in namespaced packages
457
+
458
+ #### Related tickets
459
+
460
+ https://github.com/verdaccio/verdaccio/pull/2193
461
+
462
+ - 34f0f1101: Enable prerelease mode with **changesets**
463
+ - 68ea21214: ESLint Warnings Fixed
464
+
465
+ Related to issue #1461
466
+
467
+ - max-len: most of the sensible max-len errors are fixed
468
+ - no-unused-vars: most of these types of errors are fixed by deleting not needed declarations
469
+ - @typescript-eslint/no-unused-vars: same as above
470
+
471
+ - Updated dependencies [0da7031e7]
472
+ - Updated dependencies [292c0a37f]
473
+ - Updated dependencies [dc05edfe6]
474
+ - Updated dependencies [a1986e098]
475
+ - Updated dependencies [974cd8c19]
476
+ - Updated dependencies [a828271d6]
477
+ - Updated dependencies [ef88da3b4]
478
+ - Updated dependencies [43f32687c]
479
+ - Updated dependencies [679c19c1b]
480
+ - Updated dependencies [a3a209b5e]
481
+ - Updated dependencies [459b6fa72]
482
+ - Updated dependencies [9fc2e7961]
483
+ - Updated dependencies [9943e2b18]
484
+ - Updated dependencies [ae93e039d]
485
+ - Updated dependencies [702d5c497]
486
+ - Updated dependencies [24b9be020]
487
+ - Updated dependencies [794af76c5]
488
+ - Updated dependencies [e75c0a3b9]
489
+ - Updated dependencies [351aeeaa8]
490
+ - Updated dependencies [10aeb4f13]
491
+ - Updated dependencies [1d1112805]
492
+ - Updated dependencies [631abe1ac]
493
+ - Updated dependencies [9718e0330]
494
+ - Updated dependencies [7ef599cc4]
495
+ - Updated dependencies [b702ea363]
496
+ - Updated dependencies [1b217fd34]
497
+ - Updated dependencies [e367c3f1e]
498
+ - Updated dependencies [a1da11308]
499
+ - Updated dependencies [d167f92e1]
500
+ - Updated dependencies [d2c65da9c]
501
+ - Updated dependencies [00d1d2a17]
502
+ - Updated dependencies [a828a5f6c]
503
+ - Updated dependencies [1810ed0d8]
504
+ - Updated dependencies [a610ef26b]
505
+ - Updated dependencies [ddb6a2239]
506
+ - Updated dependencies [e54ec4b5d]
507
+ - Updated dependencies [a23628be9]
508
+ - Updated dependencies [048ac95e8]
509
+ - Updated dependencies [f96b147ea]
510
+ - Updated dependencies [31d661c7b]
511
+ - Updated dependencies [648575aa4]
512
+ - Updated dependencies [b61f762d6]
513
+ - Updated dependencies [4fc21146a]
514
+ - Updated dependencies [d43894e8f]
515
+ - Updated dependencies [154b2ecd3]
516
+ - Updated dependencies [061bfcc8d]
517
+ - Updated dependencies [aa763baec]
518
+ - Updated dependencies [378e907d5]
519
+ - Updated dependencies [16e38df8a]
520
+ - Updated dependencies [34f0f1101]
521
+ - Updated dependencies [82cb0f2bf]
522
+ - Updated dependencies [dc571aabd]
523
+ - Updated dependencies [5ddfa5264]
524
+ - Updated dependencies [b78f35257]
525
+ - Updated dependencies [ce013d2fc]
526
+ - Updated dependencies [f859d2b1a]
527
+ - Updated dependencies [000d43746]
528
+ - Updated dependencies [2c594910d]
529
+ - Updated dependencies [6c1eb021b]
530
+ - Updated dependencies [168833d85]
531
+ - Updated dependencies [62c24b632]
532
+ - Updated dependencies [0a6412ca9]
533
+ - Updated dependencies [0a6412ca9]
534
+ - Updated dependencies [d08fe29d9]
535
+ - Updated dependencies [b4cc80017]
536
+ - Updated dependencies [558d78f32]
537
+ - Updated dependencies [5167bb528]
538
+ - Updated dependencies [f86c31ed0]
539
+ - Updated dependencies [65f88b826]
540
+ - Updated dependencies [781ac9ac2]
541
+ - Updated dependencies [aeff267d9]
542
+ - Updated dependencies [20c9e43ed]
543
+ - Updated dependencies [b3e8438f6]
544
+ - Updated dependencies [c9d1af0e5]
545
+ - Updated dependencies [730b5d8cc]
546
+ - Updated dependencies [4b29d715b]
547
+ - Updated dependencies [b13a3fefd]
548
+ - Updated dependencies [68ea21214]
549
+ - Updated dependencies [37274e4c8]
550
+ - Updated dependencies [fa274ee44]
551
+ - Updated dependencies [8f43bf17d]
552
+ - Updated dependencies [45c03819e]
553
+ - Updated dependencies [aecbd226d]
554
+ - Updated dependencies [b849128de]
555
+ - @verdaccio/web@6.0.0
556
+ - @verdaccio/api@6.0.0
557
+ - @verdaccio/auth@6.0.0
558
+ - @verdaccio/config@6.0.0
559
+ - @verdaccio/core@6.0.0
560
+ - @verdaccio/loaders@6.0.0
561
+ - @verdaccio/logger@6.0.0
562
+ - @verdaccio/middleware@6.0.0
563
+ - verdaccio-audit@11.0.0
564
+ - @verdaccio/store@6.0.0
565
+ - @verdaccio/utils@6.0.0
566
+
3
567
  ## 6.0.0-6-next.65
4
568
 
5
569
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Verdaccio contributors
3
+ Copyright (c) 2024 Verdaccio contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/build/server.js CHANGED
@@ -46,7 +46,7 @@ const defineAPI = async function (config, storage) {
46
46
  app.use((0, _middleware.userAgent)(config));
47
47
  app.use((0, _compression.default)());
48
48
  app.get('/favicon.ico', function (req, res, next) {
49
- req.url = '/-/static/favicon.png';
49
+ req.url = '/-/static/favicon.ico';
50
50
  next();
51
51
  });
52
52
 
@@ -97,26 +97,36 @@ const defineAPI = async function (config, storage) {
97
97
  app.get('/*', function (req, res, next) {
98
98
  next(_core.errorUtils.getNotFound('resource not found'));
99
99
  });
100
- app.use(function (err, req, res, next) {
101
- if (_lodash.default.isError(err)) {
102
- if (err.code === 'ECONNABORT' && res.statusCode === _core.HTTP_STATUS.NOT_MODIFIED) {
103
- return next();
104
- }
105
- if (_lodash.default.isFunction(res.locals.report_error) === false) {
106
- // in case of very early error this middleware may not be loaded before error is generated
107
- // fixing that
108
- errorReportingMiddlewareWrap(req, res, _lodash.default.noop);
109
- }
110
- res.locals.report_error(err);
111
- } else {
112
- // Fall to Middleware.final
113
- return next(err);
114
- }
115
- });
100
+
101
+ // @ts-ignore
102
+ app.use((0, _middleware.handleError)(_logger.logger));
103
+
104
+ // app.use(function (
105
+ // err: HttpError,
106
+ // req: $RequestExtend,
107
+ // res: $ResponseExtend,
108
+ // next: $NextFunctionVer
109
+ // ) {
110
+ // if (_.isError(err)) {
111
+ // if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {
112
+ // return next();
113
+ // }
114
+ // if (_.isFunction(res.locals.report_error) === false) {
115
+ // // in case of very early error this middleware may not be loaded before error is generated
116
+ // // fixing that
117
+ // errorReportingMiddlewareWrap(req, res, _.noop);
118
+ // }
119
+ // res.locals.report_error(err);
120
+ // } else {
121
+ // // Fall to Middleware.final
122
+ // return next(err);
123
+ // }
124
+ // });
125
+
116
126
  app.use(_middleware.final);
117
127
  return app;
118
128
  };
119
- var startServer = async function startServer(configHash) {
129
+ var startServer = exports.default = async function startServer(configHash) {
120
130
  debug('start server');
121
131
  const config = new _config.Config({
122
132
  ...configHash
@@ -138,5 +148,4 @@ var startServer = async function startServer(configHash) {
138
148
  }
139
149
  return await defineAPI(config, storage);
140
150
  };
141
- exports.default = startServer;
142
151
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":["_compression","_interopRequireDefault","require","_cors","_debug","_express","_lodash","_verdaccioAudit","_api","_auth","_config","_core","_loaders","_logger","_middleware","_store","_web","_debug2","obj","__esModule","default","debug","buildDebug","version","defineAPI","config","storage","_config$server","auth","Auth","init","app","express","set","process","env","NODE_ENV","server","trustProxy","use","cors","rateLimit","serverSettings","errorReportingMiddlewareWrap","errorReportingMiddleware","logger","log","userAgent","compression","get","req","res","next","url","hookDebug","configPath","plugins","asyncLoadPlugin","middlewares","plugin","register_middlewares","length","info","push","AuditMiddleware","enabled","strict_ssl","forEach","apiEndpoint","_","_req","locals","app_version","middleware","webMiddleware","errorUtils","getNotFound","API_ERROR","WEB_DISABLED","err","isError","code","statusCode","HTTP_STATUS","NOT_MODIFIED","isFunction","report_error","noop","final","startServer","configHash","AppConfig","Storage","error","msg","Error","exports"],"sources":["../src/server.ts"],"sourcesContent":["import compression from 'compression';\nimport cors from 'cors';\nimport buildDebug from 'debug';\nimport express from 'express';\nimport { HttpError } from 'http-errors';\nimport _ from 'lodash';\nimport AuditMiddleware from 'verdaccio-audit';\n\nimport apiEndpoint from '@verdaccio/api';\nimport { Auth } from '@verdaccio/auth';\nimport { Config as AppConfig } from '@verdaccio/config';\nimport { API_ERROR, HTTP_STATUS, errorUtils, pluginUtils } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { errorReportingMiddleware, final, log, rateLimit, userAgent } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { ConfigYaml } from '@verdaccio/types';\nimport { Config as IConfig } from '@verdaccio/types';\nimport webMiddleware from '@verdaccio/web';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\nimport hookDebug from './debug';\n\nconst debug = buildDebug('verdaccio:server');\nconst { version } = require('../package.json');\n\nconst defineAPI = async function (config: IConfig, storage: Storage): Promise<any> {\n const auth: Auth = new Auth(config);\n await auth.init();\n const app = express();\n // run in production mode by default, just in case\n // it shouldn't make any difference anyway\n app.set('env', process.env.NODE_ENV || 'production');\n if (config.server?.trustProxy) {\n app.set('trust proxy', config.server.trustProxy);\n }\n app.use(cors());\n app.use(rateLimit(config.serverSettings.rateLimit));\n\n const errorReportingMiddlewareWrap = errorReportingMiddleware(logger);\n\n // Router setup\n app.use(log(logger));\n app.use(errorReportingMiddlewareWrap);\n app.use(userAgent(config));\n app.use(compression());\n\n app.get(\n '/favicon.ico',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n req.url = '/-/static/favicon.png';\n next();\n }\n );\n\n // Hook for tests only\n if (config._debug) {\n hookDebug(app, config.configPath);\n }\n\n const plugins: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>[] = await asyncLoadPlugin(\n config.middlewares,\n {\n config,\n logger,\n },\n function (plugin) {\n return typeof plugin.register_middlewares !== 'undefined';\n }\n );\n\n if (plugins.length === 0) {\n logger.info('none middleware plugins has been defined, adding audit middleware by default');\n // @ts-ignore\n plugins.push(new AuditMiddleware({ enabled: true, strict_ssl: true }, { config, logger }));\n }\n\n plugins.forEach((plugin: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>) => {\n plugin.register_middlewares(app, auth, storage);\n });\n\n // For npm request\n // @ts-ignore\n app.use(apiEndpoint(config, auth, storage));\n\n // For WebUI & WebUI API\n if (_.get(config, 'web.enable', true)) {\n app.use((_req, res, next) => {\n res.locals.app_version = version ?? '';\n next();\n });\n const middleware = await webMiddleware(config, auth, storage);\n app.use(middleware);\n } else {\n app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));\n });\n }\n\n // Catch 404\n app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound('resource not found'));\n });\n\n app.use(function (\n err: HttpError,\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ) {\n if (_.isError(err)) {\n if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n return next();\n }\n if (_.isFunction(res.locals.report_error) === false) {\n // in case of very early error this middleware may not be loaded before error is generated\n // fixing that\n errorReportingMiddlewareWrap(req, res, _.noop);\n }\n res.locals.report_error(err);\n } else {\n // Fall to Middleware.final\n return next(err);\n }\n });\n\n app.use(final);\n\n return app;\n};\n\nexport default (async function startServer(configHash: ConfigYaml): Promise<any> {\n debug('start server');\n const config: IConfig = new AppConfig({ ...configHash } as any);\n // register middleware plugins\n debug('loaded filter plugin');\n // @ts-ignore\n const storage: Storage = new Storage(config);\n try {\n // waits until init calls have been initialized\n debug('storage init start');\n await storage.init(config);\n debug('storage init end');\n } catch (err: any) {\n logger.error({ error: err.msg }, 'storage has failed: @{error}');\n throw new Error(err);\n }\n return await defineAPI(config, storage);\n});\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,IAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,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G,CAACoB,MAAM,CAACe,YAAY,CAAC,KAAK,KAAK,EAAE;QACnD;QACA;QACA3C,4BAA4B,CAACO,GAAG,EAAEC,GAAG,EAAEkB,eAAC,CAACkB,IAAI,CAAC;MAChD;MACApC,GAAG,CAACoB,MAAM,CAACe,YAAY,CAACP,GAAG,CAAC;IAC9B,CAAC,MAAM;MACL;MACA,OAAO3B,IAAI,CAAC2B,GAAG,CAAC;IAClB;EACF,CAAC,CAAC;EAEFhD,GAAG,CAACQ,GAAG,CAACiD,iBAAK,CAAC;EAEd,OAAOzD,GAAG;AACZ,CAAC;AAAC,IAE6B0D,WAAW,GAA1B,eAAeA,WAAWA,CAACC,UAAsB,EAAgB;EAC/ErE,KAAK,CAAC,cAAc,CAAC;EACrB,MAAMI,MAAe,GAAG,IAAIkE,cAAS,CAAC;IAAE,GAAGD;EAAW,CAAQ,CAAC;EAC/D;EACArE,KAAK,CAAC,sBAAsB,CAAC;EAC7B;EACA,MAAMK,OAAgB,GAAG,IAAIkE,cAAO,CAACnE,MAAM,CAAC;EAC5C,IAAI;IACF;IACAJ,KAAK,CAAC,oBAAoB,CAAC;IAC3B,MAAMK,OAAO,CAACI,IAAI,CAACL,MAAM,CAAC;IAC1BJ,KAAK,CAAC,kBAAkB,CAAC;EAC3B,CAAC,CAAC,OAAO0D,GAAQ,EAAE;IACjBlC,cAAM,CAACgD,KAAK,CAAC;MAAEA,KAAK,EAAEd,GAAG,CAACe;IAAI,CAAC,EAAE,8BAA8B,CAAC;IAChE,MAAM,IAAIC,KAAK,CAAChB,GAAG,CAAC;EACtB;EACA,OAAO,MAAMvD,SAAS,CAACC,MAAM,EAAEC,OAAO,CAAC;AACzC,CAAC;AAAAsE,OAAA,CAAA5E,OAAA,GAAAqE,WAAA"}
1
+ {"version":3,"file":"server.js","names":["_compression","_interopRequireDefault","require","_cors","_debug","_express","_lodash","_verdaccioAudit","_api","_auth","_config","_core","_loaders","_logger","_middleware","_store","_web","_debug2","obj","__esModule","default","debug","buildDebug","version","defineAPI","config","storage","_config$server","auth","Auth","init","app","express","set","process","env","NODE_ENV","server","trustProxy","use","cors","rateLimit","serverSettings","errorReportingMiddlewareWrap","errorReportingMiddleware","logger","log","userAgent","compression","get","req","res","next","url","hookDebug","configPath","plugins","asyncLoadPlugin","middlewares","plugin","register_middlewares","length","info","push","AuditMiddleware","enabled","strict_ssl","forEach","apiEndpoint","_","_req","locals","app_version","middleware","webMiddleware","errorUtils","getNotFound","API_ERROR","WEB_DISABLED","handleError","final","startServer","exports","configHash","AppConfig","Storage","err","error","msg","Error"],"sources":["../src/server.ts"],"sourcesContent":["import compression from 'compression';\nimport cors from 'cors';\nimport buildDebug from 'debug';\nimport express from 'express';\nimport _ from 'lodash';\nimport AuditMiddleware from 'verdaccio-audit';\n\nimport apiEndpoint from '@verdaccio/api';\nimport { Auth } from '@verdaccio/auth';\nimport { Config as AppConfig } from '@verdaccio/config';\nimport { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport {\n errorReportingMiddleware,\n final,\n handleError,\n log,\n rateLimit,\n userAgent,\n} from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { ConfigYaml } from '@verdaccio/types';\nimport { Config as IConfig } from '@verdaccio/types';\nimport webMiddleware from '@verdaccio/web';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\nimport hookDebug from './debug';\n\nconst debug = buildDebug('verdaccio:server');\nconst { version } = require('../package.json');\n\nconst defineAPI = async function (config: IConfig, storage: Storage): Promise<any> {\n const auth: Auth = new Auth(config);\n await auth.init();\n const app = express();\n // run in production mode by default, just in case\n // it shouldn't make any difference anyway\n app.set('env', process.env.NODE_ENV || 'production');\n if (config.server?.trustProxy) {\n app.set('trust proxy', config.server.trustProxy);\n }\n app.use(cors());\n app.use(rateLimit(config.serverSettings.rateLimit));\n\n const errorReportingMiddlewareWrap = errorReportingMiddleware(logger);\n\n // Router setup\n app.use(log(logger));\n app.use(errorReportingMiddlewareWrap);\n app.use(userAgent(config));\n app.use(compression());\n\n app.get(\n '/favicon.ico',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n req.url = '/-/static/favicon.ico';\n next();\n }\n );\n\n // Hook for tests only\n if (config._debug) {\n hookDebug(app, config.configPath);\n }\n\n const plugins: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>[] = await asyncLoadPlugin(\n config.middlewares,\n {\n config,\n logger,\n },\n function (plugin) {\n return typeof plugin.register_middlewares !== 'undefined';\n }\n );\n\n if (plugins.length === 0) {\n logger.info('none middleware plugins has been defined, adding audit middleware by default');\n // @ts-ignore\n plugins.push(new AuditMiddleware({ enabled: true, strict_ssl: true }, { config, logger }));\n }\n\n plugins.forEach((plugin: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>) => {\n plugin.register_middlewares(app, auth, storage);\n });\n\n // For npm request\n // @ts-ignore\n app.use(apiEndpoint(config, auth, storage));\n\n // For WebUI & WebUI API\n if (_.get(config, 'web.enable', true)) {\n app.use((_req, res, next) => {\n res.locals.app_version = version ?? '';\n next();\n });\n const middleware = await webMiddleware(config, auth, storage);\n app.use(middleware);\n } else {\n app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));\n });\n }\n\n // Catch 404\n app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound('resource not found'));\n });\n\n // @ts-ignore\n app.use(handleError(logger));\n\n // app.use(function (\n // err: HttpError,\n // req: $RequestExtend,\n // res: $ResponseExtend,\n // next: $NextFunctionVer\n // ) {\n // if (_.isError(err)) {\n // if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n // return next();\n // }\n // if (_.isFunction(res.locals.report_error) === false) {\n // // in case of very early error this middleware may not be loaded before error is generated\n // // fixing that\n // errorReportingMiddlewareWrap(req, res, _.noop);\n // }\n // res.locals.report_error(err);\n // } else {\n // // Fall to Middleware.final\n // return next(err);\n // }\n // });\n\n app.use(final);\n\n return app;\n};\n\nexport default (async function startServer(configHash: ConfigYaml): Promise<any> {\n debug('start server');\n const config: IConfig = new AppConfig({ ...configHash } as any);\n // register middleware plugins\n debug('loaded filter plugin');\n // @ts-ignore\n const storage: Storage = new Storage(config);\n try {\n // waits until init calls have been initialized\n debug('storage init start');\n await storage.init(config);\n debug('storage init end');\n } catch (err: any) {\n logger.error({ error: err.msg }, 'storage has failed: @{error}');\n throw new Error(err);\n }\n return await defineAPI(config, storage);\n});\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,IAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAQA,IAAAa,MAAA,GAAAb,OAAA;AAGA,IAAAc,IAAA,GAAAf,sBAAA,CAAAC,OAAA;AAGA,IAAAe,OAAA,GAAAhB,sBAAA,CAAAC,OAAA;AAAgC,SAAAD,uBAAAiB,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,kBAAkB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C,CAAC,OAAOiE,GAAQ,EAAE;IACjBzC,cAAM,CAAC0C,KAAK,CAAC;MAAEA,KAAK,EAAED,GAAG,CAACE;IAAI,CAAC,EAAE,8BAA8B,CAAC;IAChE,MAAM,IAAIC,KAAK,CAACH,GAAG,CAAC;EACtB;EACA,OAAO,MAAM9D,SAAS,CAACC,MAAM,EAAEC,OAAO,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/server",
3
- "version": "6.0.0-6-next.65",
3
+ "version": "7.0.0-next-7.7",
4
4
  "description": "server logic",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -26,21 +26,20 @@
26
26
  "verdaccio"
27
27
  ],
28
28
  "engines": {
29
- "node": ">=14",
30
- "npm": ">=6"
29
+ "node": ">=18"
31
30
  },
32
31
  "dependencies": {
33
- "@verdaccio/api": "6.0.0-6-next.59",
34
- "@verdaccio/auth": "6.0.0-6-next.55",
35
- "@verdaccio/core": "6.0.0-6-next.76",
36
- "@verdaccio/config": "6.0.0-6-next.76",
37
- "@verdaccio/loaders": "6.0.0-6-next.45",
38
- "@verdaccio/logger": "6.0.0-6-next.44",
39
- "@verdaccio/middleware": "6.0.0-6-next.55",
40
- "@verdaccio/store": "6.0.0-6-next.56",
41
- "@verdaccio/utils": "6.0.0-6-next.44",
42
- "@verdaccio/web": "6.0.0-6-next.63",
43
- "verdaccio-audit": "11.0.0-6-next.39",
32
+ "@verdaccio/api": "7.0.0-next-7.7",
33
+ "@verdaccio/auth": "7.0.0-next-7.7",
34
+ "@verdaccio/core": "7.0.0-next-7.7",
35
+ "@verdaccio/config": "7.0.0-next-7.7",
36
+ "@verdaccio/loaders": "7.0.0-next-7.7",
37
+ "@verdaccio/logger": "7.0.0-next-7.7",
38
+ "@verdaccio/middleware": "7.0.0-next-7.7",
39
+ "@verdaccio/store": "7.0.0-next-7.7",
40
+ "@verdaccio/utils": "7.0.0-next-7.7",
41
+ "@verdaccio/web": "7.0.0-next-7.7",
42
+ "verdaccio-audit": "12.0.0-next-7.7",
44
43
  "compression": "1.7.4",
45
44
  "cors": "2.8.5",
46
45
  "debug": "4.3.4",
@@ -48,8 +47,8 @@
48
47
  "lodash": "4.17.21"
49
48
  },
50
49
  "devDependencies": {
51
- "@verdaccio/proxy": "6.0.0-6-next.54",
52
- "@verdaccio/test-helper": "2.0.0-6-next.8",
50
+ "@verdaccio/proxy": "7.0.0-next-7.7",
51
+ "@verdaccio/test-helper": "3.0.0-next.1",
53
52
  "http-errors": "2.0.0"
54
53
  },
55
54
  "funding": {
package/src/server.ts CHANGED
@@ -2,17 +2,23 @@ import compression from 'compression';
2
2
  import cors from 'cors';
3
3
  import buildDebug from 'debug';
4
4
  import express from 'express';
5
- import { HttpError } from 'http-errors';
6
5
  import _ from 'lodash';
7
6
  import AuditMiddleware from 'verdaccio-audit';
8
7
 
9
8
  import apiEndpoint from '@verdaccio/api';
10
9
  import { Auth } from '@verdaccio/auth';
11
10
  import { Config as AppConfig } from '@verdaccio/config';
12
- import { API_ERROR, HTTP_STATUS, errorUtils, pluginUtils } from '@verdaccio/core';
11
+ import { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';
13
12
  import { asyncLoadPlugin } from '@verdaccio/loaders';
14
13
  import { logger } from '@verdaccio/logger';
15
- import { errorReportingMiddleware, final, log, rateLimit, userAgent } from '@verdaccio/middleware';
14
+ import {
15
+ errorReportingMiddleware,
16
+ final,
17
+ handleError,
18
+ log,
19
+ rateLimit,
20
+ userAgent,
21
+ } from '@verdaccio/middleware';
16
22
  import { Storage } from '@verdaccio/store';
17
23
  import { ConfigYaml } from '@verdaccio/types';
18
24
  import { Config as IConfig } from '@verdaccio/types';
@@ -48,7 +54,7 @@ const defineAPI = async function (config: IConfig, storage: Storage): Promise<an
48
54
  app.get(
49
55
  '/favicon.ico',
50
56
  function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {
51
- req.url = '/-/static/favicon.png';
57
+ req.url = '/-/static/favicon.ico';
52
58
  next();
53
59
  }
54
60
  );
@@ -102,27 +108,30 @@ const defineAPI = async function (config: IConfig, storage: Storage): Promise<an
102
108
  next(errorUtils.getNotFound('resource not found'));
103
109
  });
104
110
 
105
- app.use(function (
106
- err: HttpError,
107
- req: $RequestExtend,
108
- res: $ResponseExtend,
109
- next: $NextFunctionVer
110
- ) {
111
- if (_.isError(err)) {
112
- if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {
113
- return next();
114
- }
115
- if (_.isFunction(res.locals.report_error) === false) {
116
- // in case of very early error this middleware may not be loaded before error is generated
117
- // fixing that
118
- errorReportingMiddlewareWrap(req, res, _.noop);
119
- }
120
- res.locals.report_error(err);
121
- } else {
122
- // Fall to Middleware.final
123
- return next(err);
124
- }
125
- });
111
+ // @ts-ignore
112
+ app.use(handleError(logger));
113
+
114
+ // app.use(function (
115
+ // err: HttpError,
116
+ // req: $RequestExtend,
117
+ // res: $ResponseExtend,
118
+ // next: $NextFunctionVer
119
+ // ) {
120
+ // if (_.isError(err)) {
121
+ // if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {
122
+ // return next();
123
+ // }
124
+ // if (_.isFunction(res.locals.report_error) === false) {
125
+ // // in case of very early error this middleware may not be loaded before error is generated
126
+ // // fixing that
127
+ // errorReportingMiddlewareWrap(req, res, _.noop);
128
+ // }
129
+ // res.locals.report_error(err);
130
+ // } else {
131
+ // // Fall to Middleware.final
132
+ // return next(err);
133
+ // }
134
+ // });
126
135
 
127
136
  app.use(final);
128
137
 
package/test/_helper.ts CHANGED
@@ -8,7 +8,7 @@ import { generateRandomHexString } from '@verdaccio/utils';
8
8
 
9
9
  import apiMiddleware from '../src';
10
10
 
11
- setup();
11
+ setup({});
12
12
 
13
13
  export const getConf = async (conf) => {
14
14
  const configPath = path.join(__dirname, 'config', conf);